diff --git a/app/assets/javascripts/page_edit.js.erb b/app/assets/javascripts/page_edit.js.erb
index 29047c7b..aec24de6 100644
--- a/app/assets/javascripts/page_edit.js.erb
+++ b/app/assets/javascripts/page_edit.js.erb
@@ -1,5 +1,11 @@
function get_part_id(){
- return $(".edit_page_part").attr("action").split('/').pop();
+ return $(".edit_page_part,.edit_page").attr("action").split('/').pop();
+}
+
+function get_object_path(){
+ a = window.location.href.split('/');
+ a.pop();
+ return a.join('/');
}
$("div.editable").live("mouseenter mouseleave", function (event) {
@@ -10,26 +16,26 @@ $("#page_design").live('change', function() {
$.getScript($(this).attr('rel') + '/' + $(this).val() + '/reload_themes');
});
-$("#page_module_app_id").live('change', function() {
- var app_id = $(this).val();
- if(app_id!=''){
- $.getScript($(this).attr('rel') + '/' + $(this).val() + '/reload_frontend_pages',function(data, textStatus){
- if(textStatus == 'success'){
- $(this).after(data);
- }
- });
- }
- else{
- $("#app_page_url").children().remove();
- }
-});
+// $("#page_module_app_id").live('change', function() {
+// var app_id = $(this).val();
+// if(app_id!=''){
+// $.getScript($(this).attr('rel') + '/' + $(this).val() + '/reload_after_module_changed',function(data, textStatus){
+// if(textStatus == 'success'){
+// $(this).after(data);
+// }
+// });
+// }
+// else{
+// $("#app_page_url").children().remove();
+// }
+// });
$("#module_app_list select").live('change', function() {
- $.getScript($(this).attr('rel') + '/' + $(this).val() + '/reload_widgets?part_id=' + get_part_id());
+ $.getScript(get_object_path() + '/reload_after_module_changed?module_app_id='+$(this).val()); //?part_id=' + get_part_id());
});
-$("#widget_list select").live('change', function() {
- $.getScript($(this).attr('rel') + '/' + $(this).val() + '/reload_widget_styles?module_app_id=' + $("#module_app_list select").val() + '&part_id=' + get_part_id());
+$("#widget_list select,#frontend_list select").live('change', function() {
+ $.getScript(get_object_path() +'/reload_after_list_changed?frontend=' + $(this).val() + '&module_app_id=' + $("#module_app_list select").val() );//+ '&part_id=' + get_part_id());
});
$("#tag_list select").live('change', function() {
diff --git a/app/controllers/admin/module_apps_controller.rb b/app/controllers/admin/module_apps_controller.rb
index 9729a97a..da029420 100644
--- a/app/controllers/admin/module_apps_controller.rb
+++ b/app/controllers/admin/module_apps_controller.rb
@@ -9,32 +9,6 @@ class Admin::ModuleAppsController < ApplicationController
end
- def reload_frontend_pages
- @categories =[]
- @module_app = ModuleApp.find(params[:id])
-
- @frontend_path = @module_app.widgets.keys[0] if ( !@module_app.widgets.blank? && @module_app.widgets[0].blank? )
-
- @frontend_style = @module_app.widgets[@frontend_path] if ( !@frontend_path.blank? )
-
- case @module_app.key
- when 'announcement'
- @categories = BulletinCategory.all
- @tags = AnnouncementTag.all
- when 'news'
- @categories = NewsBulletinCategory.all
- @tags = NewsTag.all
- when 'web_resource'
- @categories = WebLinkCategory.all
- @tags = WebResourceTag.all
- when 'archive'
- @categories = ArchiveFileCategory.all
- @tags = ArchiveTag.all
- end
- respond_to do |format|
- format.js {}
- end
- end
def module_auth_proc
@module_app = ModuleApp.find(params[:id])
@@ -136,7 +110,6 @@ class Admin::ModuleAppsController < ApplicationController
end
#user is not permited to do that
flash[:notice] = t('app_auth.operation_not_permitted')
- render :nothing => true, :status => 403
- end
-
+ render :nothing => true,:status => 403
+ end
end
\ No newline at end of file
diff --git a/app/controllers/admin/page_parts_controller.rb b/app/controllers/admin/page_parts_controller.rb
index af6b0ed8..e3d8b88a 100644
--- a/app/controllers/admin/page_parts_controller.rb
+++ b/app/controllers/admin/page_parts_controller.rb
@@ -91,9 +91,9 @@ class Admin::PagePartsController < ApplicationController
end
def reload_widgets
- @part = PagePart.find params[:part_id]
+ @part = PagePart.find params[:id]
@categories =[]
- @module_app = ModuleApp.find(params[:id])
+ @module_app = ModuleApp.find(params[:module_app_id])
@widget_path = @module_app.widgets.keys[0] if ( @module_app.widgets[0].blank? )
@@ -122,9 +122,9 @@ class Admin::PagePartsController < ApplicationController
def reload_widget_styles
@module_app = ModuleApp.find(params[:module_app_id])
- @part = PagePart.find params[:part_id]
- @user_choose =@widget_path= params[:id]
- @widget_style = @module_app.widgets[params[:id]]
+ @part = PagePart.find params[:id]
+ @user_choose =@widget_path= params[:frontend]
+ @widget_style = @module_app.widgets[@widget_path]
respond_to do |format|
format.js {}
diff --git a/app/controllers/admin/pages_controller.rb b/app/controllers/admin/pages_controller.rb
index 73ddc398..bd3dad6f 100644
--- a/app/controllers/admin/pages_controller.rb
+++ b/app/controllers/admin/pages_controller.rb
@@ -19,15 +19,21 @@ helper Admin::PagePartsHelper
end
def edit
- @item = Page.find(params[:id])
+ @item = @page =Page.find(params[:id])
+ @user_choose = @item.app_frontend_url
@apps = ModuleApp.excludes(app_pages: nil).entries
@module_apps = ModuleApp.excludes(widgets: nil).where(enable_frontend: true).order_by(:title, :asc)
@designs = Design.all.entries
@design = @item.design ? @item.design : @designs.first
- @app_frontend_urls = @item.module_app.app_pages if @item.module_app
-
+
+ if @item.module_app
+ @app_frontend_urls = @item.module_app.app_pages
+ @app_frontend_urls << 'default_widget' if @item.module_app.has_default_widget?
+ end
+
+
if @item.module_app
@module_app = @item.module_app
@@ -84,13 +90,13 @@ helper Admin::PagePartsHelper
def update
@item = Page.find(params[:id])
- if @item.module_app && @item.module_app.key == 'page_content' && @item.page_contexts.blank?
- @item.page_contexts.build(:create_user_id => current_user.id, :update_user_id => current_user.id )
- end
-
- params[:page][:frontend_field] = params[:page][:frontend_field].zip( params[:page][:frontend_field_type] ) if params[:page][:frontend_field]
- params[:page][:frontend_field_type] = nil
+ if @item.module_app && @item.module_app.key == 'page_content' && @item.page_contexts.blank?
+ @item.page_contexts.build(:create_user_id => current_user.id, :update_user_id => current_user.id )
+ end
+ params[:page][:frontend_field] = params[:page][:frontend_field].zip( params[:page][:frontend_field_type] ) if params[:page][:frontend_field]
+ params[:page][:frontend_field_type] = nil
+
if @item.update_attributes(params[:page])
flash[:notice] = t('update.success.page')
respond_to do |format|
@@ -123,7 +129,44 @@ helper Admin::PagePartsHelper
format.js { @item = @item.parent }
end
end
+
+ def reload_front_end_setting
+ @page = Page.find params[:id]
+ @module_app = ModuleApp.find params[:module_app_id]
+ @chosen_frontend = @user_choose = params[:frontend]
+ end
+
+ def reload_frontend_pages
+ @page = Page.find params[:id]
+ # @categories =[]
+ @module_app = ModuleApp.find(params[:module_app_id])
+ @app_frontend_urls = @module_app.app_pages
+ @app_frontend_urls << 'default_widget' if @module_app.has_default_widget?
+
+
+ case @module_app.key
+ when 'announcement'
+ @categories = BulletinCategory.all
+ @tags = AnnouncementTag.all
+ when 'news'
+ @categories = NewsBulletinCategory.all
+ @tags = NewsTag.all
+ when 'web_resource'
+ @categories = WebLinkCategory.all
+ @tags = WebResourceTag.all
+ when 'archive'
+ @categories = ArchiveFileCategory.all
+ @tags = ArchiveTag.all
+ else
+ @categories = []
+ @tags = []
+ end
+ respond_to do |format|
+ format.js {}
+ end
+ end
+
def reload_themes
@design = Design.find(params[:id])
@themes = @design.themes
diff --git a/app/controllers/default_widget_controller.rb b/app/controllers/default_widget_controller.rb
index ba5e8ba5..92c28c5e 100644
--- a/app/controllers/default_widget_controller.rb
+++ b/app/controllers/default_widget_controller.rb
@@ -1,7 +1,12 @@
class DefaultWidgetController< OrbitWidgetController
def front_end_available(var)
- @page_part = PagePart.find params[:part_id]
+ @page_part = case params[:item_type]
+ when "page"
+ Page.find params[:page_id]
+ when "page_part"
+ PagePart.find params[:part_id]
+ end
@page_part.module_app.enable_frontend?
end
@@ -9,10 +14,17 @@ class DefaultWidgetController< OrbitWidgetController
@tag_class = nil
@default_widget = @page_part.module_app.get_default_widget
- @widget_image_field = @default_widget[:image]
- data_limit = @page_part.widget_data_count.is_a?(Fixnum) ? @page_part.widget_data_count : (@page_part.widget_data_count.to_i rescue 3)
+ @widget_image_field = @default_widget["image"] || @default_widget[:image]
+ data_limit = case @page_part
+ when Page
+ @fields = @page_part.frontend_field
+ @page_part.frontend_data_count.is_a?(Fixnum) ? @page_part.frontend_data_count : (@page_part.frontend_data_count.to_i rescue 3)
+ when PagePart
+ @fields = @page_part.widget_field
+ @page_part.widget_data_count.is_a?(Fixnum) ? @page_part.widget_data_count : (@page_part.widget_data_count.to_i rescue 3)
+ end
@data = eval(@default_widget["query"]).limit(data_limit).includes(@widget_image_field)
- @fields = @page_part.widget_field
+
case params[:type]
when "typeA"
diff --git a/app/helpers/admin/page_parts_helper.rb b/app/helpers/admin/page_parts_helper.rb
index e8a1afc4..b9253112 100644
--- a/app/helpers/admin/page_parts_helper.rb
+++ b/app/helpers/admin/page_parts_helper.rb
@@ -10,33 +10,60 @@ module Admin::PagePartsHelper
end
def widget_field_options(i,local_item=nil)
- local_item = @part if local_item.nil?
+ local_item = @part if local_item.nil? && @part
+ local_item = @page if local_item.nil? && @page
options = @module_app.widget_fields.collect{|widget_field| [I18n.t(widget_field[1]), widget_field[0]]}
- options_for_select(options, (local_item[:widget_field][i][0] if (local_item && !local_item[:widget_field].blank? && !local_item[:widget_field][i].blank?)) )
+
+ case local_item
+ when Page
+ options_for_select(options, (local_item[:frontend_field][i][0] if (local_item && !local_item[:frontend_field].blank? && !local_item[:frontend_field][i].blank?)) )
+ when PagePart
+ options_for_select(options, (local_item[:widget_field][i][0] if (local_item && !local_item[:widget_field].blank? && !local_item[:widget_field][i].blank?)) )
+ end
end
def widget_fiield_type_options(i,local_item=nil)
options = LIST[:widget_field_type].collect{|widget_field| [widget_field.humanize, widget_field]}
- local_item = @part if local_item.nil?
- options_for_select(options, (local_item[:widget_field][i][1] if (local_item && !local_item[:widget_field].blank? && !local_item[:widget_field][i].blank?)) )
+ local_item = @part if local_item.nil? && @part
+ local_item = @page if local_item.nil? && @page
+
+ case local_item
+ when Page
+ options_for_select(options, (local_item[:frontend_field][i][1] if (local_item && !local_item[:frontend_field].blank? && !local_item[:frontend_field][i].blank?)) )
+ when PagePart
+ options_for_select(options, (local_item[:widget_field][i][1] if (local_item && !local_item[:widget_field].blank? && !local_item[:widget_field][i].blank?)) )
+ end
end
def tag_checked_value(part,radio_value)
- part and (part[:tag] == radio_value) ? true : false
+ part and (part[:tag] == radio_value.to_s) ? true : false
end
def category_checked_value(part,radio_value)
- part and (part[:category] == radio_value) ? true : false
+ part and (part[:category] == radio_value.to_s) ? true : false
end
def style_checked_value(part,radio_value)
- part and (part.widget_style == radio_value) ? true : false
+ case part
+ when Page
+ (part.frontend_style == radio_value) ? true : false
+ when PagePart
+ (part.widget_style == radio_value) ? true : false
+ when nil
+ false
+ end
end
def nil_radio_button(part,tag_or_cate)
+ field_name = case part
+ when PagePart
+ 'page_part'
+ when Page
+ 'page'
+ end
content_tag :label,:class=>"radio inline" do
- op = radio_button("page_part", tag_or_cate, '' , :checked => eval("#{tag_or_cate}_checked_value(part,'')"))
+ op = radio_button(field_name, tag_or_cate, '' , :checked => eval("#{tag_or_cate}_checked_value(part,'')"))
op << I18n.t("default_widget.no_value")
end
end
diff --git a/app/views/admin/module_apps/reload_frontend_pages.js.erb b/app/views/admin/module_apps/reload_frontend_pages.js.erb
deleted file mode 100644
index 4bfbd7fc..00000000
--- a/app/views/admin/module_apps/reload_frontend_pages.js.erb
+++ /dev/null
@@ -1,5 +0,0 @@
-$('#app_page_url').html("<%= escape_javascript(select 'page', 'app_frontend_url', @module_app.app_pages) %>");
-$('#app_page_frontend_style').html("<%= escape_javascript(select 'page', 'frontend_style', @module_app.widgets[@frontend_path]) if !@frontend_path.blank? %>");
-$('#app_page_category').html("<%= j (select 'page', 'category', @categories.collect{|category| [category.title, category.id]}, {:include_blank => true}) if @categories %>");
-$('#app_page_tag').html("<%= j (select 'page', 'tag', @tags.collect{|tag| [tag[I18n.locale], tag.id]}, {:include_blank => true}) if @tags %>");
-$('#app_page_frontend_field').html("<%= j render '../admin/pages/frontend_fields' %>")
diff --git a/app/views/admin/page_parts/_custom_widget_setting.html.erb b/app/views/admin/page_parts/_custom_widget_setting.html.erb
index dea11a06..8d1ca8f8 100644
--- a/app/views/admin/page_parts/_custom_widget_setting.html.erb
+++ b/app/views/admin/page_parts/_custom_widget_setting.html.erb
@@ -3,14 +3,13 @@
<%= t("default_widget.select_widget_style") %>
- <% if @module_app.widgets[@widget_path].blank? %>
+ <% if @module_app.widgets.nil? || (@module_app.widgets[@widget_path].blank? rescue true) %>
<%= t("default_widget.no_support_setting")%>
<%else%>
<%= select('page_part', 'widget_style', @module_app.widgets[@widget_path]) %>
<% end %>
-
<% if(@module_app.widget_options && @module_app.widget_options.has_key?(@widget_path)) %>
diff --git a/app/views/admin/page_parts/_default_widget_setting.html.erb b/app/views/admin/page_parts/_default_widget_setting.html.erb
index 09d648eb..8496b19b 100644
--- a/app/views/admin/page_parts/_default_widget_setting.html.erb
+++ b/app/views/admin/page_parts/_default_widget_setting.html.erb
@@ -1,6 +1,17 @@
+<% case object%>
+ <% when PagePart %>
+ <% object_name = 'page_part' %>
+ <% field_name = 'widget_field' %>
+ <% data_count = 'widget_data_count' %>
+ <% when Page %>
+ <% object_name = 'page' %>
+ <% field_name = 'frontend_field' %>
+ <% data_count = 'frontend_data_count' %>
+<% end %>
+
\ No newline at end of file
diff --git a/app/views/admin/page_parts/_default_widget_style_panel.html.erb b/app/views/admin/page_parts/_default_widget_style_panel.html.erb
index df8ac8d8..49d40214 100644
--- a/app/views/admin/page_parts/_default_widget_style_panel.html.erb
+++ b/app/views/admin/page_parts/_default_widget_style_panel.html.erb
@@ -1,3 +1,11 @@
+<% field_name='' %>
+<% case object %>
+ <% when Page %>
+ <% field_name = "page[frontend_style]" %>
+ <% when PagePart %>
+ <% field_name = "page_part[widget_style]" %>
+<% end %>
+
@@ -32,17 +32,17 @@
- <%= render :partial => 'widget_setting' ,:locals=>{:f=>f} %>
+ <%= render :partial => 'widget_setting' ,:locals=>{:f=>f,:object=>@part} %>
-
- <%= f.label :name, t(:module), :class => 'control-label' %>
+
+
+ <%= f.label '',t("default_widget.select_module_app"), :class => 'control-label' %>
<%= render :partial => "app_selector", :locals => { :f => f } %>
-
- <%= select('page','app_frontend_url', @app_frontend_urls, :selected => @item.app_frontend_url ) rescue ''%>
-
-
- <%= select('page','frontend_style', @frontend_style, :selected => @item[:frontend_style], :include_blank => true ) rescue ''%>
-
-
- <%= select('page','category', @categories.collect{|category| [category.title, category.id]}, :selected => @item[:category], :include_blank => true ) rescue ''%>
-
-
- <%= select('page','tag', @tags.collect{|tag| [tag[I18n.locale], tag.id]}, :selected => @item[:tag], :include_blank => true ) rescue ''%>
-
-
- <%= render 'frontend_fields' %>
-
-
-
- <%= f.label :frontend_data_count, t(:frontend_data_count), :class => 'control-label' %>
-
- <%= f.text_field :frontend_data_count %>
+
+
+ <%= f.label '', t("page.select_app_url"), :class => 'control-label' %>
+
+ <%= select('page','app_frontend_url', @app_frontend_urls, :selected => @item.app_frontend_url ) rescue ''%>
+
+
+
+
+ <%= render :partial=>"admin/page_parts/widget_data_source_category",:locals=>{:object=>@item} %>
+
+
+
+ <%= render :partial=>"admin/page_parts/widget_data_source_tag" ,:locals=>{:object=>@item}%>
+
+
+
+ <%= render :partial => 'frontend_setting', :locals=>{:object=>@item,:f=>f} %>
+
+
+
<%= f.label :is_published, "#{t(:is_published)} ?", :class => 'control-label' %>
diff --git a/app/views/admin/pages/_frontend_setting.html.erb b/app/views/admin/pages/_frontend_setting.html.erb
new file mode 100644
index 00000000..4e639272
--- /dev/null
+++ b/app/views/admin/pages/_frontend_setting.html.erb
@@ -0,0 +1,3 @@
+<% if show_default_widget_setting_panel %>
+<%= render :partial=>'admin/page_parts/widget_setting',:locals=>{:object=>object,:f=>f} %>
+<% end %>
\ No newline at end of file
diff --git a/app/views/admin/pages/edit.html.erb b/app/views/admin/pages/edit.html.erb
index aecf04c7..8bd76634 100644
--- a/app/views/admin/pages/edit.html.erb
+++ b/app/views/admin/pages/edit.html.erb
@@ -1,3 +1,4 @@
+<%= stylesheet_link_tag "admin/default_widget_setting" %>
<% content_for :sidebar do %>
<%= render 'admin/items/site_map_left_bar' %>
<% end -%>
diff --git a/app/views/admin/pages/reload_front_end_setting.js.erb b/app/views/admin/pages/reload_front_end_setting.js.erb
new file mode 100644
index 00000000..ea5cb336
--- /dev/null
+++ b/app/views/admin/pages/reload_front_end_setting.js.erb
@@ -0,0 +1,8 @@
+<% if show_default_widget_setting_panel %>
+ // $('#app_page_tag').html("<%= j render :partial => 'admin/page_parts/widget_data_source_tag',:locals=>{:object=>@page} %>");
+
+ $('#frontend_setting').html("<%= j render :partial => 'admin/page_parts/default_widget_style_panel',:locals=>{:object=>@page} %>");
+ $('#frontend_setting').append("<%= j render :partial => 'admin/page_parts/default_widget_setting',:locals=>{:object=>@page} %>");
+ <% else %>
+ $('#frontend_setting').html("<%= j render :partial => 'custom_frontend_setting' %>");
+<% end %>
\ No newline at end of file
diff --git a/app/views/admin/pages/reload_frontend_pages.js.erb b/app/views/admin/pages/reload_frontend_pages.js.erb
new file mode 100644
index 00000000..8af0f8d5
--- /dev/null
+++ b/app/views/admin/pages/reload_frontend_pages.js.erb
@@ -0,0 +1,24 @@
+
+$('#app_page_category').html("<%= j render :partial => 'admin/page_parts/widget_data_source_category' ,:locals=>{:object=>@page}%>");
+$('#app_page_tag').html("<%= j render :partial => 'admin/page_parts/widget_data_source_tag',:locals=>{:object=>@page} %>");
+
+<% if !@module_app.app_pages.blank? %>
+ $('#app_page_url').html("<%= escape_javascript(select 'page', 'app_frontend_url', options_for_select(@app_frontend_urls, @app_frontend_urls.first)) %>");
+ <%else %>
+ $('#app_page_url').html("<%= t('default_widget.no_support_setting')%>");
+<% end %>
+
+<% if @app_frontend_urls.first =='default_widget' %>
+ $('#app_page_frontend_style').html("<%= escape_javascript(select 'page', 'frontend_style', @module_app.widgets[@frontend_path]) if !@frontend_path.blank? %>");
+ <% else %>
+ $('#app_page_frontend_style').html("<%= t('default_widget.no_support_setting')%>");
+<% end %>
+
+<% if show_default_widget_setting_panel %>
+ $('#app_page_tag').html("<%= j render :partial => 'admin/page_parts/widget_data_source_tag',:locals=>{:object=>@page} %>");
+
+ $('#frontend_setting').html("<%= j render :partial => 'admin/page_parts/default_widget_style_panel',:locals=>{:object=>@page} %>");
+ $('#frontend_setting').append("<%= j render :partial => 'admin/page_parts/default_widget_setting',:locals=>{:object=>@page} %>");
+ <% else %>
+ $('#frontend_setting').html("<%= j render :partial => 'custom_frontend_setting' %>");
+<% end %>
\ No newline at end of file
diff --git a/config/locales/zh_tw.yml b/config/locales/zh_tw.yml
index a79e7897..68c750dd 100644
--- a/config/locales/zh_tw.yml
+++ b/config/locales/zh_tw.yml
@@ -153,6 +153,7 @@ zh_tw:
default_widget:
no_support_setting: 沒有可以使用的設定
no_value: 不設定(全部)
+ fields_: 前台輸出欄位
fields_order: 輸出欄位順序
fields_style: 輸出欄位樣式
select_module_app: 外掛模組選擇
diff --git a/config/routes.rb b/config/routes.rb
index 0d51680a..3c74c1e7 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -82,6 +82,8 @@ Orbit::Application.routes.draw do
member do
get 'delete'
get 'reload_themes'
+ get 'reload_after_module_changed',:action=>'reload_frontend_pages'
+ get 'reload_after_list_changed',:action=> 'reload_front_end_setting'
end
end
@@ -101,14 +103,13 @@ Orbit::Application.routes.draw do
match 'remove_manager/:app_manager_id' ,:action=> 'remove_manager',:via => "delete",:as =>:remove_manager
match 'remove_sub_manager/:app_sub_manager_id' ,:action=> 'remove_sub_manager',:via => "delete",:as =>:remove_sub_manager
- get 'reload_frontend_pages'
end
end
resources :page_parts do
member do
- get 'reload_widgets'
- get 'reload_widget_styles'
+ get 'reload_after_module_changed',:action=>'reload_widgets'
+ get 'reload_after_list_changed',:action=> 'reload_widget_styles'
get 'reload_r_tag_options'
end
end
diff --git a/lib/parsers/parser_common.rb b/lib/parsers/parser_common.rb
index 1075fe75..d6bafdd3 100644
--- a/lib/parsers/parser_common.rb
+++ b/lib/parsers/parser_common.rb
@@ -184,15 +184,21 @@ module ParserCommon
# page_contents
def parse_contents_edit(body, page, edit=nil)
public_r_tags = []
+ url = ''
body.css('.page_content').each do |content|
ret = ''
category = params[:category_id].blank? ? page[:category] : params[:category_id]
tag = params[:tag_id].blank? ? page[:tag] : params[:tag_id]
if (content["main"] == "true" && !page.module_app.nil?)
- ret << "
"
+ if page.app_frontend_url == 'default_widget'
+ url = "/panel/orbit_app/widget/#{page.frontend_style}?inner=true"
+ else
+ url = "/panel/#{page.module_app.key}/front_end/#{page.app_frontend_url}"
+ end
+ ret << "
"
else
part = page.page_parts.detect{ |p| p.name.to_s == content['name'].to_s } rescue nil
part_title = part.title rescue nil
@@ -213,7 +219,7 @@ module ParserCommon
raise ModuleAppError,"PagePart can't find ModuleApp" if part.module_app.nil?
"/panel/#{part.module_app.key}/widget/#{part.widget_path}?inner=true"
end
- options = "&part_id=#{part.id}&category_id=#{!part[:category].blank? ? part[:category].blank? : category}&tag_id=#{!part[:tag].blank? ? part[:tag] : tag}&page=#{params[:page]}&search_query=#{params[:search_query]}&part_title=#{Rack::Utils.escape(part_title).gsub("+", "%20") rescue nil}"
+ options = "&part_id=#{part.id}&category_id=#{!part[:category].blank? ? part[:category].blank? : category}&tag_id=#{!part[:tag].blank? ? part[:tag] : tag}&page=#{params[:page]}&search_query=#{params[:search_query]}&part_title=#{Rack::Utils.escape(part_title).gsub("+", "%20") rescue nil}&item_type=page_part"
ret << "
"
when 'public_r_tag'
ret << "
"
diff --git a/lib/parsers/parser_front_end.rb b/lib/parsers/parser_front_end.rb
index 246e6c20..36aa172b 100644
--- a/lib/parsers/parser_front_end.rb
+++ b/lib/parsers/parser_front_end.rb
@@ -95,11 +95,18 @@ module ParserFrontEnd
# page_contents
def parse_contents(body, page, edit=nil, locale)
public_r_tags = []
+ url = ''
body.css('.page_content').each do |content|
ret = ''
if (content["main"] == "true" && !page.module_app.nil?)
- url = "/panel/#{page.module_app.key}/front_end/#{page.app_frontend_url}\#{(\"/\" + params[:id]) if params[:id] && !params[:id].eql?(page.id.to_s)}\#{(\"/\" + params[:controller_action]) if params[:controller_action] && params[:id]}?inner=true"
- options = "&page_id=#{page.id}&category_id=\#{category}&tag_id=\#{tag}&preview=\#{params[:preview]}&page_main=\#{params[:page_main]}&search_query=\#{params[:search_query]}&name=\#{params[:name]}"
+ if page.app_frontend_url == 'default_widget'
+ url = "/panel/orbit_app/widget/#{page.frontend_style}?inner=true"
+ else
+ "/panel/#{page.module_app.key}/front_end/#{page.app_frontend_url}\#{(\"/\" + params[:id]) if params[:id] && !params[:id].eql?(page.id.to_s)}\#{(\"/\" + params[:controller_action]) if params[:controller_action] && params[:id]}?inner=true"
+ end
+
+
+ options = "&page_id=#{page.id}&category_id=\#{category}&tag_id=\#{tag}&preview=\#{params[:preview]}&page_main=\#{params[:page_main]}&search_query=\#{params[:search_query]}&name=\#{params[:name]}&item_type=page"
ret << "
"
else
part = page.page_parts.detect{ |p| p.name.to_s == content['name'].to_s } rescue nil
@@ -116,7 +123,7 @@ module ParserFrontEnd
else
"/panel/\#{part.module_app.key}/widget/\#{part.widget_path}?inner=true"
end
- options = "&part_id=\#{part.id}&category_id=\#{!part[:category].blank? ? part[:category].blank? : category}&tag_id=\#{!part[:tag].blank? ? part[:tag] : tag}&page=\#{params[:page]}&search_query=\#{params[:search_query]}&part_title=\#{Rack::Utils.escape(part_title).gsub(\"\+\", \"\%20\") rescue nil}"
+ options = "&part_id=\#{part.id}&category_id=\#{!part[:category].blank? ? part[:category].blank? : category}&tag_id=\#{!part[:tag].blank? ? part[:tag] : tag}&page=\#{params[:page]}&search_query=\#{params[:search_query]}&part_title=\#{Rack::Utils.escape(part_title).gsub(\"\+\", \"\%20\") rescue nil}&item_type=page_part"
ret << "
"
when 'public_r_tag'