From a14d69211bf5d9d0c71976f4248b2109315cefc6 Mon Sep 17 00:00:00 2001 From: chris Date: Mon, 28 Oct 2013 16:21:36 +0800 Subject: [PATCH] PagePart widgets for "system widget" Delete useless code --- app/assets/javascripts/lib/items/items.js.erb | 3 +- .../javascripts/lib/items/page_part.js.erb | 1 + app/assets/stylesheets/basic/global.css | 73 ++++++- .../admin/page_parts_controller.rb | 188 ++++++------------ app/controllers/admin/pages_controller.rb | 2 - .../admin/frontend_widget_interface.rb | 35 ---- app/helpers/admin/page_parts_helper.rb | 138 ------------- .../_custom_widget_setting.html.erb | 20 -- .../_default_widget_setting.html.erb | 45 ----- .../_default_widget_style_panel.html.erb | 67 ------- app/views/admin/page_parts/_edit.html.erb | 136 ------------- .../admin/page_parts/_language_bar.html.erb | 7 - .../admin/page_parts/_module_widget.html.erb | 53 ----- .../admin/page_parts/_public_r_tag.html.erb | 15 -- app/views/admin/page_parts/_reset.html.erb | 8 - app/views/admin/page_parts/_text.html.erb | 8 - .../_widget_data_source_category.html.erb | 20 -- .../_widget_data_source_tag.html.erb | 20 -- .../page_parts/_widget_ext_options.html.erb | 18 -- .../admin/page_parts/_widget_setting.html.erb | 10 - app/views/admin/page_parts/edit.html.erb | 165 ++++++++++++++- app/views/admin/page_parts/edit.js.erb | 44 ---- .../page_parts/reload_widget_field.js.erb | 1 - .../page_parts/reload_widget_styles.js.erb | 7 - .../admin/page_parts/reload_widgets.js.erb | 20 -- app/views/admin/page_parts/update.js.erb | 2 - app/views/admin/pages/_app_selector.html.erb | 0 .../pages/_custom_frontend_setting.html.erb | 12 -- .../admin/pages/_data_count_field.html.erb | 6 - app/views/admin/pages/_edit.html.erb | 10 - .../admin/pages/_frontend_fields.html.erb | 11 - app/views/admin/pages/_new.html.erb | 9 - app/views/admin/pages/_show.html.erb | 1 - app/views/admin/pages/_themes_ddl.html.erb | 2 - app/views/admin/pages/edit.html.erb | 1 - app/views/admin/pages/edit.js.erb | 1 - app/views/admin/pages/new.html.erb | 1 - app/views/admin/pages/new.js.erb | 1 - .../pages/reload_front_end_setting.js.erb | 6 - .../admin/pages/reload_frontend_pages.js.erb | 30 --- app/views/admin/pages/reload_themes.js.erb | 1 - .../admin/pages/reload_widget_field.js.erb | 1 - app/views/admin/pages/show.html.erb | 2 +- app/views/layouts/structure.html.erb | 3 +- config/routes.rb | 10 - lib/parsers/parser_front_end.rb | 2 +- 46 files changed, 303 insertions(+), 913 deletions(-) delete mode 100644 app/helpers/admin/frontend_widget_interface.rb delete mode 100644 app/helpers/admin/page_parts_helper.rb delete mode 100644 app/views/admin/page_parts/_custom_widget_setting.html.erb delete mode 100644 app/views/admin/page_parts/_default_widget_setting.html.erb delete mode 100644 app/views/admin/page_parts/_default_widget_style_panel.html.erb delete mode 100644 app/views/admin/page_parts/_edit.html.erb delete mode 100644 app/views/admin/page_parts/_language_bar.html.erb delete mode 100644 app/views/admin/page_parts/_module_widget.html.erb delete mode 100644 app/views/admin/page_parts/_public_r_tag.html.erb delete mode 100644 app/views/admin/page_parts/_reset.html.erb delete mode 100644 app/views/admin/page_parts/_text.html.erb delete mode 100644 app/views/admin/page_parts/_widget_data_source_category.html.erb delete mode 100644 app/views/admin/page_parts/_widget_data_source_tag.html.erb delete mode 100644 app/views/admin/page_parts/_widget_ext_options.html.erb delete mode 100644 app/views/admin/page_parts/_widget_setting.html.erb delete mode 100644 app/views/admin/page_parts/edit.js.erb delete mode 100644 app/views/admin/page_parts/reload_widget_field.js.erb delete mode 100644 app/views/admin/page_parts/reload_widget_styles.js.erb delete mode 100644 app/views/admin/page_parts/reload_widgets.js.erb delete mode 100644 app/views/admin/page_parts/update.js.erb delete mode 100644 app/views/admin/pages/_app_selector.html.erb delete mode 100644 app/views/admin/pages/_custom_frontend_setting.html.erb delete mode 100644 app/views/admin/pages/_data_count_field.html.erb delete mode 100644 app/views/admin/pages/_edit.html.erb delete mode 100644 app/views/admin/pages/_frontend_fields.html.erb delete mode 100644 app/views/admin/pages/_new.html.erb delete mode 100644 app/views/admin/pages/_show.html.erb delete mode 100644 app/views/admin/pages/_themes_ddl.html.erb delete mode 100644 app/views/admin/pages/edit.html.erb delete mode 100644 app/views/admin/pages/edit.js.erb delete mode 100644 app/views/admin/pages/new.html.erb delete mode 100644 app/views/admin/pages/new.js.erb delete mode 100644 app/views/admin/pages/reload_front_end_setting.js.erb delete mode 100644 app/views/admin/pages/reload_frontend_pages.js.erb delete mode 100644 app/views/admin/pages/reload_themes.js.erb delete mode 100644 app/views/admin/pages/reload_widget_field.js.erb diff --git a/app/assets/javascripts/lib/items/items.js.erb b/app/assets/javascripts/lib/items/items.js.erb index b08b88dda..91f54f25a 100644 --- a/app/assets/javascripts/lib/items/items.js.erb +++ b/app/assets/javascripts/lib/items/items.js.erb @@ -189,7 +189,7 @@ function pageSetting(id, edit) { }); $pageCategoryGroup.show(); } - if(val.tag.length > 0) { + if(val.tags.length > 0) { $.each(val.tags, function(index, val) { var _arr = $.inArray($(this)[1], _selectData.module.tags[1]); $pageTags.append(''); @@ -371,6 +371,7 @@ $(function() { $(this).children("option:selected").each(function () { var _val = $(this).val(); $subSelete.empty(); + $pageCount.empty(); if(_val) { $.each(_data, function(index, val) { if(_val == val.main[1]) { diff --git a/app/assets/javascripts/lib/items/page_part.js.erb b/app/assets/javascripts/lib/items/page_part.js.erb index f4b107c8e..1460ddb29 100644 --- a/app/assets/javascripts/lib/items/page_part.js.erb +++ b/app/assets/javascripts/lib/items/page_part.js.erb @@ -42,6 +42,7 @@ $(function() { $(this).children("option:selected").each(function () { var _val = $(this).val(); $subSelete.empty(); + $pageCount.empty(); if(_val) { $.each(_data, function(index, val) { if(_val == val.main[1]) { diff --git a/app/assets/stylesheets/basic/global.css b/app/assets/stylesheets/basic/global.css index 6c9ce1829..af68c5d3b 100644 --- a/app/assets/stylesheets/basic/global.css +++ b/app/assets/stylesheets/basic/global.css @@ -441,7 +441,6 @@ legend { font-size: 1.2em; } - /* Edit link in structure */ .page_content { width: 100%; @@ -511,6 +510,73 @@ legend { color: #E47E6B; } +/* Page Parts */ +.page-parts { + background-color: #E7E7E7; +} +.page-parts body { + background-color: transparent; +} +.page-parts #main-wrap { + padding-top: 0; +} +.page-parts #main-wrap .wrap-inner { + padding: 30px 10px 10px; +} +.page-parts .main-forms { + text-align: center; +} +.page-parts .main-forms fieldset { + text-align: left; +} +.page-parts .main-forms > .btn-group { + margin-bottom: 20px; +} +.page-parts .display-mode td { + padding-bottom: 10px; +} +.page-parts .display-mode td i { + font-size: 2em; +} +.page-parts .radio.inline + .radio.inline, +.page-parts .checkbox.inline + .checkbox.inline { + margin-left: 0; +} + +/* Show Preview */ +#show_preview .modal { + width: 90%; + margin-left: -45%; +} +#show_preview .modal-body { + padding: 0; + max-height: none; + height: 100%; + overflow: hidden; +} +#show_preview iframe { + border: 0; + outline: none; + width: 100%; + height: 100%; +} +#show_preview form { + text-align: left; + margin-bottom: 0px; +} +#show_preview form .control-group { + margin-bottom: 0; +} +#show_preview form .pull-right + .pull-left { + margin-right: 10px; +} +#show_preview form .control-label { + width: 70px; +} +#show_preview form .controls { + margin-left: 80px; +} + /* tooltip */ #sideset .ui-tooltip.sidebar-tooltip { color: #FFFFFF; @@ -690,6 +756,9 @@ legend { width: auto; margin-left: auto; } + #show_preview .modal { +   margin-left: 0 auto; + } } @media (max-width: 480px) { @@ -697,4 +766,4 @@ legend { #main-wrap .wrap-inner { padding: 20px 0; } -} +} \ 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 b3ded3ade..7eabe2688 100644 --- a/app/controllers/admin/page_parts_controller.rb +++ b/app/controllers/admin/page_parts_controller.rb @@ -1,86 +1,44 @@ class Admin::PagePartsController < OrbitBackendController - include Admin::FrontendWidgetInterface - layout "structure" - before_filter :authenticate_user! - before_filter :is_admin? - before_filter :set_current_item - - helper 'admin/items' - def show - @part = PagePart.find(params[:id]) - respond_to do |format| - format.html { - render 'admin/items/index' - } - format.js {} - end - end + layout "structure" + open_for_admin def edit - # @part = PagePart.find(params[:id]) - # @r_tag = @part.public_r_tag.blank? ? LIST[:public_r_tags][0] : @part.public_r_tag - # @tag_objects = @r_tag.classify.constantize.all rescue nil - # if @r_tag.eql?('tag_cloud') - # @tag_objects = ModuleApp.where(has_tag: true) - # else - # @tag_objects = @r_tag.classify.constantize.all rescue nil - # end - - # @module_apps = ModuleApp.for_widget_select - # @categories = nil - # @tags = nil - # @page_frontend_data_counts = nil - # # @frontend_styles = nil - - # @selected={ - # :module_app=> @part.module_app ? @part.module_app : nil, - # :app_frontend_url=> @part.widget_path || "default_widget", #@module_apps.first - # :category=>nil, #fetch by method: get_categories_and_tags - # :tag=>nil, #fetch by method: get_categories_and_tags - # :page_frontend_data_count=>nil, - # :frontend_style => nil, - # :widget_path=> nil - # } - - # @selected[:widget_path] = @part.widget_path ? @part.widget_path : (@selected[:module_app].widgets.keys[0] rescue nil) - # get_categories_and_tags - # get_frontend_data_count - # @app_frontend_urls = get_app_frontend_urls - # @no_orbit_bar = @side_bar = @no_header = true - - - @id = params[:id] @part = PagePart.find(params[:id]) @module_apps = ModuleApp.for_widget_select - @module_app = @part.module_app - if @module_app - @module_app_categories = @module_app.categories - @module_app_tags = @module_app.tags - @widget_paths = ModuleApp.find(@module_app.id).widgets.map{|name, data| [t(data["i18n"]), name]} rescue [] - if @part.widget_path.present? - if @part.widget_path.eql?("default_widget") - @checked_style = @part.widget_style - @enabled_styles = @module_app.get_default_widget["enabled_styles"] - @widget_fields = @module_app.widget_fields.collect do |widget_field| - label = I18n.t("#{@module_app.key}.default_widget.#{widget_field[0]}") - [label, widget_field[0], class: widget_field[2]] - end - @class_options = LIST[:widget_field_type].collect{|widget_field| [widget_field.humanize, widget_field]} - @partial = 'default_widget' - else - @frontend_styles = @module_app.widgets[params[:val]]["style"] rescue nil - @partial = 'custom_widget' if @frontend_styles.present? + @module_app = @part.module_app || @module_apps.first + @module_app_categories = @module_app.categories + @module_app_tags = @module_app.tags + @widget_paths = ModuleApp.find(@module_app.id).widgets.map{|name, data| [t(data["i18n"]), name]} rescue [] + if @part.widget_path.present? + if @part.widget_path.eql?("default_widget") + @checked_style = @part.widget_style + @enabled_styles = @module_app.get_default_widget["enabled_styles"] + @widget_fields = @module_app.widget_fields.collect do |widget_field| + label = I18n.t("#{@module_app.key}.default_widget.#{widget_field[0]}") + [label, widget_field[0], class: widget_field[2]] end + @class_options = LIST[:widget_field_type].collect{|widget_field| [widget_field.humanize, widget_field]} + @partial = 'default_widget' + else + @frontend_styles = @module_app.widgets[params[:val]]["style"] rescue nil + @partial = 'custom_widget' if @frontend_styles.present? end - @data_count = @module_app.get_registration.get_data_count.to_a rescue [] end + @data_count = @module_app.get_registration.get_data_count.to_a rescue [] @no_orbit_bar = @side_bar = @no_header = true + @r_tag = @part.public_r_tag.blank? ? LIST[:public_r_tags][0] : @part.public_r_tag + @tag_objects = @r_tag.classify.constantize.all rescue nil + if @r_tag.eql?('tag_cloud') + @tag_objects = ModuleApp.where(has_tag: true) + else + @tag_objects = @r_tag.classify.constantize.all rescue nil + end - + @html_class = "page-parts" end def get_page_setting_json @@ -103,7 +61,6 @@ class Admin::PagePartsController < OrbitBackendController m = {} m["main"] = [module_app.title, module_app.id.to_s] m["sub"] = module_app.widgets.map{|name, data| [t(data["i18n"]), name]} rescue [] - m["sub"] << [I18n.t('default_widget.default_widget'),'default_widget'] if module_app.has_default_widget? m["category"] = module_app.categories.map{|category| [category.title, category.id.to_s] } rescue '' m["tags"] = module_app.tags.map{|tag| [tag.name, tag.id.to_s] } rescue '' m["count"] = module_app.get_registration.get_data_count.to_a @@ -132,67 +89,51 @@ class Admin::PagePartsController < OrbitBackendController end end - def reload_widgets - @part = PagePart.find params[:id] - @selected={ - :module_app=> ModuleApp.find(params["module_app_id"]) - } - get_categories_and_tags - get_frontend_data_count - @selected[:app_frontend_url] = @selected[:module_app].has_default_widget? ? 'default_widget' : @selected[:module_app].widget_options.first.name - end - - - def reload_widget_styles - @part = PagePart.find(params[:id]) - @selected={ - :module_app=> ModuleApp.find(params["module_app_id"]), - :app_frontend_url=> params["frontend"], #@module_apps.first - :category=>nil, #fetch by method: get_categories_and_tags - :tag=>nil, #fetch by method: get_categories_and_tags - :page_frontend_data_count=>nil, - :frontend_style => nil, - :widget_path=> nil - } - get_categories_and_tags - get_frontend_data_count - end - - def reload_widget_field - @index = params[:field_seri].to_i - @part = PagePart.find(params[:id]) - @selected = { - :module_app=> ModuleApp.find(params["module_app_id"]), - :default_widget_field=>params[:widget_field_value] - } - end - def update - @part = PagePart.find(params[:id]) - - - clean_tags_and_category_params - - # params[:page_part][:widget_field].each{|t| t[2] = (t[2]=="true" ? true : false )} if !params[:page_part][:widget_field].blank? if @part.update_attributes(params[:page_part]) set_children_sub_menu(@part) if @part.public_r_tag && @part.public_r_tag.eql?('sub_menu') flash.now[:notice] = t('update.success.content') - - if @part.page.name == 'home' - expire_page '/' - else - expire_page page_path(@part.page.name) - end respond_to do |format| format.html { - redirect_to admin_page_url( @part.page ) - } - format.js { - @item = @part.page + redirect_to admin_page_url(@part.page, edit: true) } end else + @id = params[:id] + @module_apps = ModuleApp.for_widget_select + @module_app = @part.module_app || @module_apps.first + @module_app_categories = @module_app.categories + @module_app_tags = @module_app.tags + @widget_paths = ModuleApp.find(@module_app.id).widgets.map{|name, data| [t(data["i18n"]), name]} rescue [] + if @part.widget_path.present? + if @part.widget_path.eql?("default_widget") + @checked_style = @part.widget_style + @enabled_styles = @module_app.get_default_widget["enabled_styles"] + @widget_fields = @module_app.widget_fields.collect do |widget_field| + label = I18n.t("#{@module_app.key}.default_widget.#{widget_field[0]}") + [label, widget_field[0], class: widget_field[2]] + end + @class_options = LIST[:widget_field_type].collect{|widget_field| [widget_field.humanize, widget_field]} + @partial = 'default_widget' + else + @frontend_styles = @module_app.widgets[params[:val]]["style"] rescue nil + @partial = 'custom_widget' if @frontend_styles.present? + end + end + @data_count = @module_app.get_registration.get_data_count.to_a rescue [] + @no_orbit_bar = @side_bar = @no_header = true + + @r_tag = @part.public_r_tag.blank? ? LIST[:public_r_tags][0] : @part.public_r_tag + @tag_objects = @r_tag.classify.constantize.all rescue nil + if @r_tag.eql?('tag_cloud') + @tag_objects = ModuleApp.where(has_tag: true) + else + @tag_objects = @r_tag.classify.constantize.all rescue nil + end + + @html_class = "page-parts" + render :action => "edit" end end @@ -217,11 +158,6 @@ class Admin::PagePartsController < OrbitBackendController end protected - def get_app_frontend_urls - @selected[:module_app] ? @selected[:module_app].widgets.collect{|k,v| [I18n.t(v["i18n"]),k]} : [] - # has_old_value = @selected[:module_app].app_pages[@selected[:app_frontend_url]] - # @frontend_styles = has_old_value ? has_old_value["style"] : (@selected[:module_app].app_pages.first[1]["style"] rescue nil) - end def set_children_sub_menu(part) part.page.children.each do |child| diff --git a/app/controllers/admin/pages_controller.rb b/app/controllers/admin/pages_controller.rb index 8462a5dcf..b08f89169 100644 --- a/app/controllers/admin/pages_controller.rb +++ b/app/controllers/admin/pages_controller.rb @@ -1,6 +1,4 @@ class Admin::PagesController < Admin::ItemsController - # helper Admin::PagePartsHelper - # include Admin::FrontendWidgetInterface def show @item = Page.find(params[:id]) diff --git a/app/helpers/admin/frontend_widget_interface.rb b/app/helpers/admin/frontend_widget_interface.rb deleted file mode 100644 index 4d9e53a46..000000000 --- a/app/helpers/admin/frontend_widget_interface.rb +++ /dev/null @@ -1,35 +0,0 @@ -module Admin::FrontendWidgetInterface - -protected - def get_categories_and_tags - unless @selected[:module_app].nil? - @categories = @selected[:module_app].categories - @tags = @selected[:module_app].tags - end - end - - def get_frontend_data_count - local_item = set_local_item - @page_frontend_data_counts = @selected[:module_app].get_registration.get_data_count rescue [] - @selected[:page_frontend_data_count] = case local_item - when PagePart - local_item.widget_data_count - when Page - local_item.frontend_data_count - end - end - - def set_local_item - local_item = @part - local_item = @item if local_item.nil? && @item - local_item - end - - def select_array_for_app_frontend_urls(hash) - ary = hash.collect{|name,data| [I18n.t(data["i18n"]),name]} - ary << [I18n.t('default_widget.name'),'default_widget'] if @selected[:module_app] and @selected[:module_app].has_default_widget? - ary - end - - -end diff --git a/app/helpers/admin/page_parts_helper.rb b/app/helpers/admin/page_parts_helper.rb deleted file mode 100644 index 59eb99718..000000000 --- a/app/helpers/admin/page_parts_helper.rb +++ /dev/null @@ -1,138 +0,0 @@ -module Admin::PagePartsHelper - include Admin::FrontendWidgetInterface - - def support_link - url_method = @selected[:module_app].get_default_widget[:url_method] - unless url_method.nil? - res = "Link:" - res << select_tag( "page_part[widget_field_is_link][]", options_for_select([["NotLink",false],["Link1",url_method]])) - res.html_safe - end - end - - def get_widget_field_rel - case set_local_item - when Page - reload_after_list_changed_admin_pages_path - when PagePart - reload_after_list_changed_admin_page_part_path - end - end - - def link_to_field_switch( i ,object_name,field_name,local_item=nil,assign_field_name_value=nil) #link_to_field is for showing - field_is_checked = nil - local_item = case - when local_item.nil? && @part - @part - when local_item.nil? && @item - @item - end - - field_is_checked = local_item.default_widget_field_sat_to_link?(i) - res = hidden_field_tag "#{object_name}[#{field_name}][][sat_to_link]", 'false' - - unless field_is_checked.nil? and assign_field_name_value.nil? - origin_field = nil - origin_field = @selected[:module_app].widget_fields.select{|t| t.first.to_s==(assign_field_name_value || local_item.default_widget_field_name[i])}.first - - if origin_field and origin_field[2]==:link #choosen_field_is_link - - res = label_tag '' do - check_box_tag("#{object_name}[#{field_name}][][sat_to_link]", "true", field_is_checked) + I18n.t("default_widget.field_is_link") - end - else # choosen_field_not_link - return res - end # of if choosen_field_is_link - else - return res - end - end - - def widget_field_options(i,local_item=nil) - local_item = set_local_item - - options = @selected[:module_app].widget_fields.collect do |widget_field| - label = I18n.t("#{@selected[:module_app].key}.default_widget.#{widget_field[0]}") - [label, widget_field[0]] - end - case local_item - when Page - options_for_select(options, (local_item.frontend_field_name[i] if(local_item) )) - when PagePart - options_for_select(options, (local_item.widget_field_name[i] if(local_item) )) - end - end - - def widget_field_class_options(i,local_item=nil) - options = LIST[:widget_field_type].collect{|widget_field| [widget_field.humanize, widget_field]} - local_item = set_local_item - case local_item - when Page - options_for_select(options, (local_item.frontend_class[i] if (local_item) )) - when PagePart - options_for_select(options, (local_item.widget_class[i] if (local_item) )) - end - end - - def tag_checked_value(part,radio_value) - if radio_value.blank? - (part.nil? || part[:tag].blank?) ? true : false - else - part and (part[:tag].include?(radio_value.to_s)) ? true : false - end - end - - def category_checked_value(part,radio_value) - if radio_value.blank? - (part.nil? || part[:category].blank?) ? true : false - else - part and (part[:category].include?(radio_value.to_s)) ? true : false - end - end - - def style_checked_value(part,radio_value) - case part - when Page - if part.frontend_style.nil? && radio_value == "typeA" - true - else - (part.frontend_style == radio_value) ? true : false - end - when PagePart - if part.widget_style.nil? && radio_value == "typeA" - true - else - (part.widget_style == radio_value) ? true : false - end - when nil - false - end - end - - def nil_checkbox_button(part,tag_or_cate) - field_name = set_field_name - - content_tag :label,:class=>"radio inline" do - op = check_box_tag("#{field_name}[#{tag_or_cate}][]", 'nil' , eval("#{tag_or_cate}_checked_value(part,'')"),:class=>'select_all') - op << I18n.t("default_widget.no_value") - end - end - - def nil_radio_button(part,tag_or_cate) - field_name = set_field_name - - content_tag :label,:class=>"radio inline" do - 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 - - def show_default_widget_setting_panel - @selected[:module_app] && @selected[:module_app].has_default_widget? && (@selected[:app_frontend_url]== 'default_widget') - end - - def show_custom_widget_setting_panel - true - end - -end \ No newline at end of file diff --git a/app/views/admin/page_parts/_custom_widget_setting.html.erb b/app/views/admin/page_parts/_custom_widget_setting.html.erb deleted file mode 100644 index 9c02d46a0..000000000 --- a/app/views/admin/page_parts/_custom_widget_setting.html.erb +++ /dev/null @@ -1,20 +0,0 @@ -
- -
- <% if @selected[:module_app].nil? || @selected[:module_app].widgets.nil? || (@selected[:module_app].widgets[@selected[:app_frontend_url]].blank? rescue true) || @selected[:module_app].widgets[@selected[:app_frontend_url]]["style"].nil? %> - <%= t("default_widget.no_support_setting")%> - <%else%> - <%= select('page_part', 'widget_style', @selected[:module_app].widgets[@selected[:app_frontend_url]]["style"]) %> - <% end %> -
-
-<% if(@selected[:module_app] && @selected[:module_app].widget_options(@selected[:app_frontend_url])) %> -
- -
- <%= render :partial=> "widget_ext_options" %> -
-
-<% end %> diff --git a/app/views/admin/page_parts/_default_widget_setting.html.erb b/app/views/admin/page_parts/_default_widget_setting.html.erb deleted file mode 100644 index b91cb52a4..000000000 --- a/app/views/admin/page_parts/_default_widget_setting.html.erb +++ /dev/null @@ -1,45 +0,0 @@ -<% case object%> - <% when PagePart %> - <% object_name = 'page_part' %> - <% field_name = 'widget_field' %> - <% reload_rel = reload_after_widget_field_changed_admin_page_part_path %> - <% when Page %> - <% object_name = 'page' %> - <% field_name = 'frontend_field' %> - <% reload_rel = reload_after_widget_field_changed_admin_pages_path %> -<% end %> - -
- -
- - -
- - - - - - - - -
- -<% @selected[:module_app].widget_fields.each_with_index do |widget_field, i| %> -
- - <%= i+1 %> - <%= select_tag "#{object_name}[#{field_name}][][field_name]", widget_field_options(i), :include_blank => true ,:class=>'widget_field_select',:field_seri => i ,:id=>"#{object_name}_#{field_name}_#{i}",:rel=>reload_rel%> - - - <%= select_tag "#{object_name}[#{field_name}][][class]", widget_field_class_options(i), :include_blank => true %>
-
- - <%= link_to_field_switch(i,object_name,field_name) %> - -

-<% 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 deleted file mode 100644 index 2b002d530..000000000 --- a/app/views/admin/page_parts/_default_widget_style_panel.html.erb +++ /dev/null @@ -1,67 +0,0 @@ -<% field_name='' %> -<% case object %> - <% when Page %> - <% field_name = "page[frontend_style]" %> - <% when PagePart %> - <% field_name = "page_part[widget_style]" %> -<% end %> -
- -
-
    - <% if @selected[:module_app].get_default_widget["enabled_styles"].include?("typeA") %> -
  • - - -
  • - <% end %> - <% if @selected[:module_app].get_default_widget["enabled_styles"].include?("typeB_style2") %> -
  • - -
  • - <% end %> - <% if @selected[:module_app].get_default_widget["enabled_styles"].include?("typeB_style3") %> -
  • - -
  • - <% end %> - <% if @selected[:module_app].get_default_widget["enabled_styles"].include?("typeB_style4") %> -
  • - -
  • - <% end %> - <% if @selected[:module_app].get_default_widget["enabled_styles"].include?("typeC") %> -
  • - -
  • - <% end %> -
-
-
\ No newline at end of file diff --git a/app/views/admin/page_parts/_edit.html.erb b/app/views/admin/page_parts/_edit.html.erb deleted file mode 100644 index 662fc86ed..000000000 --- a/app/views/admin/page_parts/_edit.html.erb +++ /dev/null @@ -1,136 +0,0 @@ -<% content_for :page_specific_javascript do %> - <%= javascript_include_tag "lib/items/page_part" %> -<% end %> - -<%= form_for @part, url: admin_page_part_path(@part), html: { class: "form-horizontal main-forms"} do |f| %> -
- - - - -
-
-
-
<%= t(:select_one_function) %>
-
- - -
- <% @site_valid_locales.each_with_index do |locale, i| %> -
-
- -
-
- <%= f.fields_for :content_translations do |f| %> - <%= f.text_area locale, class: "ckeditor input-block-level", value: (@part.content_translations[locale] rescue nil) %> - <% end %> -
-
-
-
- <% end %> -
-
-
- <%= f.fields_for :title_translations do |f| %> - <% @site_valid_locales.each do |locale| %> -
- <%= f.label :locale, "#{t(:title)} #{I18nVariable.from_locale(locale)}", class: "control-label muted" %> -
- <%= f.text_field locale, class: 'input-xlarge page_title', placeholder: "#{t(:title)} #{I18nVariable.from_locale(locale)}", id: locale %> -
-
- <% end %> - <% end %> -
- <%= f.label :module_app_id, t(:module), class: "control-label muted" %> -
- <%= f.select :module_app, options_from_collection_for_select(@module_apps, :id, :module_name, selected: (@part.module_app_id rescue nil)), {}, {include_blank: true, class: "input-xlarge change"} %> -
-
-
- <%= f.label :widget_path, t('front_page.display_mode'), class: "control-label muted" %> -
- <%= f.select :widget_path, @widget_paths, {}, selected: (@part.widget_path rescue nil), class: "input-xlarge change" %> -
-
-
- <%= f.label :categories, t(:categories), class: "control-label muted" %> -
- <%= content_tag :label, class: "checkbox" do %> - <%= check_box_tag nil, nil, true, class: "select_all" %> <%= t(:all) %> - <% end %> -
- <%= content_tag_for(:label, @module_app_categories, class: "checkbox") do |category|%> - <%= check_box_tag("page_part[tag][]", category.id, (@part.category.include?(category.id) rescue false) ) %> - <%= category.title %> - <% end if @module_app_tags %> -
-
-
-
- <%= f.label :tags, t(:tags), class: "control-label muted" %> -
- <%= content_tag :label, class: "checkbox" do %> - <%= check_box_tag nil, nil, true, class: "select_all" %> <%= t(:all) %> - <% end %> -
- <%= content_tag_for(:label, @module_app_tags, class: "checkbox") do |tag|%> - <%= check_box_tag("page_part[tag][]", tag.id, (@part.tag.include?(tag.id) rescue false) ) %> - <%= tag.name %> - <% end if @module_app_tags %> -
-
-
-
- <%= render @partial %> -
-
- <%= f.label :widget_data_count, t(:widget_data_count), class: "control-label muted" %> -
- <%= f.select :widget_data_count, options_for_select(@data_count, @part.widget_data_count), {}, class: "input-mini", id: "page_count" %> -
-
-
-
-
- <%= f.submit t(:update_), class: "btn btn-primary" %> - -
-
-<% end %> - - diff --git a/app/views/admin/page_parts/_language_bar.html.erb b/app/views/admin/page_parts/_language_bar.html.erb deleted file mode 100644 index 5ba98931b..000000000 --- a/app/views/admin/page_parts/_language_bar.html.erb +++ /dev/null @@ -1,7 +0,0 @@ -<%= raw(VALID_LOCALES.map{ |locale| - if @part_locale.to_s.eql?(locale) - t(:_locale, :locale => locale) - else - link_to t(:_locale, :locale => locale), edit_admin_page_part_path(@part, :part_locale => locale), :class => 'reload' - end -}.join(' | ')) %> \ No newline at end of file diff --git a/app/views/admin/page_parts/_module_widget.html.erb b/app/views/admin/page_parts/_module_widget.html.erb deleted file mode 100644 index 58a75f8ba..000000000 --- a/app/views/admin/page_parts/_module_widget.html.erb +++ /dev/null @@ -1,53 +0,0 @@ -
- <%= f.fields_for :title_translations do |f| %> - <% @site_valid_locales.each do |locale| %> -
- <%= f.label :locale, "#{t(:title)} #{I18nVariable.from_locale(locale)}",:class=>"control-label" %> -
- <%= f.text_field locale, :value => (@part.title_translations[locale] rescue nil),:size=>30 %> -
-
- <% end %> - <% end %> -
- - -
- -
- <%= f.select :module_app, options_from_collection_for_select(@module_apps, :id, :module_name, :selected => (@selected[:module_app].id rescue nil)), {:include_blank => true }, {:rel => reload_after_module_changed_admin_page_part_path,:id=>"page_module_app_id"} %> -
-
- -
- -
- <%#= @module_app ? @module_app.widgets.collect{|k,v| [I18n.t(v["i18n"]),k]} %> - <%= f.select :widget_path, @app_frontend_urls , {}, { :selected => @selected[:app_frontend_url], :rel => get_widget_field_rel } %> -
-
- - -
-
- <%= render :partial => 'widget_data_source_category' ,:locals=>{:object=>@part}%> -
-
- <%= render :partial => 'widget_data_source_tag' ,:locals=>{:object=>@part} %> -
- - -
- -
- <%= render :partial => 'widget_setting' ,:locals=>{:f=>f,:object=>@part} %> -
- -
- <%= render :partial=>'admin/pages/data_count_field',:locals=>{:field_name=>"page_part[widget_data_count]",:field_value=>@part.widget_data_count } %> -
- diff --git a/app/views/admin/page_parts/_public_r_tag.html.erb b/app/views/admin/page_parts/_public_r_tag.html.erb deleted file mode 100644 index 88057f138..000000000 --- a/app/views/admin/page_parts/_public_r_tag.html.erb +++ /dev/null @@ -1,15 +0,0 @@ - - <%= f.select :public_r_tag, LIST[:public_r_tags].collect{|tag| [t(tag), tag]}, {:selected => @r_tag}, {:rel => reload_r_tag_options_admin_page_part_path(@part)} %> - - - - <% if @r_tag.eql?('sub_menu') %> - <%= f.hidden_field :public_r_tag_object_id, :value => @part.page.id %> - <%#= f.select :public_r_tag_object_id, options_for_select([t(:horizontal), t(:vertical)], t(:horizontal)) %> - <% elsif @r_tag.eql?('sitemap') %> - <% elsif @r_tag.eql?('terms_of_use') %> - <% elsif @r_tag.eql?('breadcrumb') %> - <% else %> - <%= f.select :public_r_tag_object_id, options_from_collection_for_select(@tag_objects, :id, :title, :selected => @part.public_r_tag_object_id) %> - <% end %> - diff --git a/app/views/admin/page_parts/_reset.html.erb b/app/views/admin/page_parts/_reset.html.erb deleted file mode 100644 index 3698d0f5a..000000000 --- a/app/views/admin/page_parts/_reset.html.erb +++ /dev/null @@ -1,8 +0,0 @@ -
- -
- <%= t('default_widget.no_support_setting') %> -
-
\ No newline at end of file diff --git a/app/views/admin/page_parts/_text.html.erb b/app/views/admin/page_parts/_text.html.erb deleted file mode 100644 index 1eb572053..000000000 --- a/app/views/admin/page_parts/_text.html.erb +++ /dev/null @@ -1,8 +0,0 @@ -<%= f.fields_for :content_translations do |f| %> - <% @site_valid_locales.each do |locale| %> -
- <%= I18nVariable.from_locale(locale) %> - <%= f.text_area locale, :class => 'tinymce_textarea', :value => (@part.content_translations[locale] rescue nil) %> -
- <% end %> -<% end %> \ No newline at end of file diff --git a/app/views/admin/page_parts/_widget_data_source_category.html.erb b/app/views/admin/page_parts/_widget_data_source_category.html.erb deleted file mode 100644 index 3561038a3..000000000 --- a/app/views/admin/page_parts/_widget_data_source_category.html.erb +++ /dev/null @@ -1,20 +0,0 @@ -<% case object %> -<% when Page %> - <% field_name = 'page' %> -<% when PagePart %> - <% field_name = 'page_part' %> -<% end %> - - - -

- <% if @categories %> - <%= nil_checkbox_button(object,:category) %> - <%= content_tag_for(:label, @categories,:class=>"radio") do |category|%> - <%= check_box_tag("#{field_name}[category][]", category.id, category_checked_value(object,category.id),:class=>'select_option' )%> - <%= category.title%> - <% end %> - <% else %> - <%= t("default_widget.no_support_setting")%> - <% end %> -

diff --git a/app/views/admin/page_parts/_widget_data_source_tag.html.erb b/app/views/admin/page_parts/_widget_data_source_tag.html.erb deleted file mode 100644 index 14df13529..000000000 --- a/app/views/admin/page_parts/_widget_data_source_tag.html.erb +++ /dev/null @@ -1,20 +0,0 @@ -<% case object %> -<% when Page %> - <% field_name = 'page' %> -<% when PagePart %> - <% field_name = 'page_part' %> -<% end %> - - - -

- <% if @categories %> - <%= nil_checkbox_button(object,:tag) %> - <%= content_tag_for(:label, @tags,:class=>"radio") do |tag|%> - <%= check_box_tag("#{field_name}[tag][]", tag.id, tag_checked_value(object,tag.id),:class=>'select_option' ) %> - <%= tag.name%> - <% end if @tags%> - <% else %> - <%= t("default_widget.no_support_setting")%> - <% end %> -

diff --git a/app/views/admin/page_parts/_widget_ext_options.html.erb b/app/views/admin/page_parts/_widget_ext_options.html.erb deleted file mode 100644 index 1a9202253..000000000 --- a/app/views/admin/page_parts/_widget_ext_options.html.erb +++ /dev/null @@ -1,18 +0,0 @@ -<% if (not(@selected[:module_app].widget_options(@selected[:app_frontend_url]).blank?) and @selected[:app_frontend_url]!='default_widget')%> - - - <% @selected[:module_app].widget_options(@selected[:app_frontend_url]).get_options.each do |key,settings| %> - <% options = settings[:opts] %> - <%= label_tag(t(settings[:label_i18n]))%> - <% case options%> - <% when Hash%> - <%= select_tag "page_part[widget_options][#{key}]", options_from_collection_for_select(eval(options["query"]), options["value"], options["label"].to_s, :selected => (@part.widget_options[key] rescue nil)) %> - <% else%> - <%= select_tag "page_part[widget_options][#{key}]", options_for_select(options,(@part.widget_options[key] rescue nil)) %> - - <% end %> - - - <% end %> - -<% end %> diff --git a/app/views/admin/page_parts/_widget_setting.html.erb b/app/views/admin/page_parts/_widget_setting.html.erb deleted file mode 100644 index 8de901097..000000000 --- a/app/views/admin/page_parts/_widget_setting.html.erb +++ /dev/null @@ -1,10 +0,0 @@ -<% if show_default_widget_setting_panel %> -
- <%= render :partial => 'admin/page_parts/default_widget_style_panel',:locals=>{:f=>f,:object=>object} %> - <%= render :partial => 'admin/page_parts/default_widget_setting',:locals=>{:object=>object} %> -
-<% elsif show_custom_widget_setting_panel %> -
- <%= render :partial => 'admin/page_parts/custom_widget_setting',:locals=>{:object=>object} %> -
-<% end %> diff --git a/app/views/admin/page_parts/edit.html.erb b/app/views/admin/page_parts/edit.html.erb index 3efc1736c..cafd4ba0e 100644 --- a/app/views/admin/page_parts/edit.html.erb +++ b/app/views/admin/page_parts/edit.html.erb @@ -1,2 +1,163 @@ -<%= stylesheet_link_tag "lib/main-forms" %> -<%= render 'edit' %> \ No newline at end of file +<% content_for :page_specific_css do %> + <%= stylesheet_link_tag "lib/main-forms" %><% end %> +<% content_for :page_specific_javascript do %> + <%= javascript_include_tag "lib/items/page_part" %> +<% end %> + +<%= form_for @part, url: admin_page_part_path(@part), html: { class: "form-horizontal main-forms"} do |f| %> + <%= f.error_messages %> +
+ + + + +
+
+
+
<%= t(:select_one_function) %>
+
+ + +
+ <% @site_valid_locales.each_with_index do |locale, i| %> +
+
+ +
+
+ <%= f.fields_for :content_translations do |f| %> + <%= f.text_area locale, class: "ckeditor input-block-level", value: (@part.content_translations[locale] rescue nil) %> + <% end %> +
+
+
+
+ <% end %> +
+
+
+
+ +
+ + <%= f.select :public_r_tag, LIST[:public_r_tags].collect{|tag| [t(tag), tag]}, {selected: @r_tag}, {rel: reload_r_tag_options_admin_page_part_path(@part), class: "input-xlarge"} %> + + + <% case @r_tag %> + <% when 'sub_menu' %> + <%= f.hidden_field :public_r_tag_object_id, :value => @part.page.id %> + <%#= f.select :public_r_tag_object_id, options_for_select([t(:horizontal), t(:vertical)], t(:horizontal)) %> + <% when 'sitemap', 'terms_of_use', 'breadcrumb' %> + <% else %> + <%= f.select :public_r_tag_object_id, options_from_collection_for_select(@tag_objects, :id, :title, selected: @part.public_r_tag_object_id) %> + <% end %> + +
+
+
+
+ <%= f.fields_for :title_translations do |f| %> + <% @site_valid_locales.each do |locale| %> +
+ <%= f.label :locale, "#{t(:title)} #{I18nVariable.from_locale(locale)}", class: "control-label muted" %> +
+ <%= f.text_field locale, class: 'input-xlarge page_title', placeholder: "#{t(:title)} #{I18nVariable.from_locale(locale)}", id: locale %> +
+
+ <% end %> + <% end %> +
+ <%= f.label :module_app_id, t(:module), class: "control-label muted" %> +
+ <%= f.select :module_app, options_from_collection_for_select(@module_apps, :id, :module_name, selected: (@part.module_app_id rescue nil)), {}, {include_blank: true, class: "input-xlarge change"} %> +
+
+
+ <%= f.label :widget_path, t('front_page.display_mode'), class: "control-label muted" %> +
+ <%= f.select :widget_path, @widget_paths, {}, selected: (@part.widget_path rescue nil), class: "input-xlarge change" %> +
+
+
+ <%= f.label :categories, t(:categories), class: "control-label muted" %> +
+ <%= content_tag :label, class: "checkbox" do %> + <%= check_box_tag nil, nil, true, class: "select_all" %> <%= t(:all) %> + <% end %> +
+ <%= content_tag_for(:label, @module_app_categories, class: "checkbox inline") do |category|%> + <%= check_box_tag("page_part[tag][]", category.id, (@part.category.include?(category.id) rescue false) ) %> + <%= category.title %> + <% end if @module_app_tags %> +
+
+
+
+ <%= f.label :tags, t(:tags), class: "control-label muted" %> +
+ <%= content_tag :label, class: "checkbox" do %> + <%= check_box_tag nil, nil, true, class: "select_all" %> <%= t(:all) %> + <% end %> +
+ <%= content_tag_for(:label, @module_app_tags, class: "checkbox inline") do |tag|%> + <%= check_box_tag("page_part[tag][]", tag.id, (@part.tag.include?(tag.id) rescue false) ) %> + <%= tag.name %> + <% end if @module_app_tags %> +
+
+
+
+ <%= render @partial if @partial %> +
+
+ <%= f.label :widget_data_count, t(:widget_data_count), class: "control-label muted" %> +
+ <%= f.select :widget_data_count, options_for_select(@data_count, @part.widget_data_count), {}, class: "input-mini", id: "page_count" %> +
+
+
+
+
+ <%= f.submit t(:update_), class: "btn btn-primary" %> + +
+
+<% end %> + + diff --git a/app/views/admin/page_parts/edit.js.erb b/app/views/admin/page_parts/edit.js.erb deleted file mode 100644 index 3e50360c6..000000000 --- a/app/views/admin/page_parts/edit.js.erb +++ /dev/null @@ -1,44 +0,0 @@ -$('#back_main').html("<%= j render(:partial => 'edit') %>"); -tinymce.init({ - // General options - mode: 'textareas', - theme: 'advanced', - file_browser_callback : 'myFileBrowser', - plugins : "autolink,lists,pagebreak,style,layer,table,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount,advlist,autosave", - - // Theme options - theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,formatselect,fontselect,fontsizeselect", - theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,bullist,numlist,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,forecolor,backcolor", - theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,fullscreen", - theme_advanced_toolbar_location : "top", - theme_advanced_toolbar_align : "left", - theme_advanced_statusbar_location : "bottom", - theme_advanced_resizing : true, - - // Skin options - skin : "o2k7", - skin_variant : "silver", - - // Drop lists for link/image/media/template dialogs - template_external_list_url : "js/template_list.js", - // external_link_list_url : "js/link_list.js", - // external_image_list_url : "js/image_list.js", - // media_external_list_url : "js/media_list.js" - - // Style formats - style_formats : [ - {title : 'Bold text', inline : 'b'}, - {title : 'Red text', inline : 'span', styles : {color : '#ff0000'}}, - {title : 'Red header', block : 'h1', styles : {color : '#ff0000'}}, - {title : 'Example 1', inline : 'span', classes : 'example1'}, - {title : 'Example 2', inline : 'span', classes : 'example2'}, - {title : 'Table styles'}, - {title : 'Table row 1', selector : 'tr', classes : 'tablerow1'} - ], - - // Replace values for the template plugin - template_replace_values : { - username : "Some User", - staffid : "991234" - } -}); \ No newline at end of file diff --git a/app/views/admin/page_parts/reload_widget_field.js.erb b/app/views/admin/page_parts/reload_widget_field.js.erb deleted file mode 100644 index bb44377e3..000000000 --- a/app/views/admin/page_parts/reload_widget_field.js.erb +++ /dev/null @@ -1 +0,0 @@ -$("#<%= params[:dom_id] %>").parents(".rows").find(".link_switch_holder").html("<%= j link_to_field_switch(@index,'page_part','widget_field',nil,@selected[:default_widget_field]) %>"); \ No newline at end of file diff --git a/app/views/admin/page_parts/reload_widget_styles.js.erb b/app/views/admin/page_parts/reload_widget_styles.js.erb deleted file mode 100644 index b9eb36498..000000000 --- a/app/views/admin/page_parts/reload_widget_styles.js.erb +++ /dev/null @@ -1,7 +0,0 @@ - <% if show_default_widget_setting_panel %> - $('#widget_setting').html("<%= j render :partial => 'default_widget_style_panel',:locals=>{:object=>@part} %>"); - $('#widget_setting').append("<%= j render :partial => 'default_widget_setting',:locals=>{:object=>@part} %>"); - <% elsif show_custom_widget_setting_panel %> - $('#widget_setting').html("<%= j render :partial => 'custom_widget_setting' %>"); - <% end %> - diff --git a/app/views/admin/page_parts/reload_widgets.js.erb b/app/views/admin/page_parts/reload_widgets.js.erb deleted file mode 100644 index 0bef30a69..000000000 --- a/app/views/admin/page_parts/reload_widgets.js.erb +++ /dev/null @@ -1,20 +0,0 @@ -<% if @selected[:module_app]%> - $('#widget_list select').html("<%= j options_for_select(@selected[:module_app].widgets.collect{|k,v| [I18n.t(v['i18n']),k]},@selected[:app_frontend_url]) %>"); - $("#widget_data_source_category").html("<%= j render :partial => 'widget_data_source_category',:locals=>{:object=>@part} %>"); - $("#widget_data_source_tag").html("<%= j render :partial => 'widget_data_source_tag',:locals=>{:object=>@part} %>"); - $("#data_count").html("<%= j render :partial => 'admin/pages/data_count_field',:locals=>{:field_name=>'page_part[widget_data_count]',:field_value=>@part.widget_data_count } %>"); - <% if @part %> - <% if show_default_widget_setting_panel %> - $('#widget_setting').html("<%= j render :partial => 'default_widget_style_panel',:locals=>{:object=>@part} %>"); - $('#widget_setting').append("<%= j render :partial => 'default_widget_setting',:locals=>{:object=>@part} %>"); - <% elsif show_custom_widget_setting_panel %> - $('#widget_setting').html("<%= j render :partial => 'custom_widget_setting' %>"); - <% end %> - <% end %> - <% else %> - $('#widget_option').find("div.well.controls").html("<%= t('default_widget.no_support_setting')%>"); - $('#widget_setting').html("<%=j render :partial=> 'reset',:locals=>{:label_i18n=>'default_widget.select_widget_style'}%>"); - $('#widget_list select').html("<%= j options_for_select([]) %>"); -<% end %> -update_cates_and_tags(); -rebind(); \ No newline at end of file diff --git a/app/views/admin/page_parts/update.js.erb b/app/views/admin/page_parts/update.js.erb deleted file mode 100644 index bc4592e6e..000000000 --- a/app/views/admin/page_parts/update.js.erb +++ /dev/null @@ -1,2 +0,0 @@ -$('#back_main').html("<%= escape_javascript(render(:partial => 'admin/pages/show' )) %>"); -history.pushState(null, document.title, "<%= escape_javascript(admin_page_url(@item)) %>"); \ No newline at end of file diff --git a/app/views/admin/pages/_app_selector.html.erb b/app/views/admin/pages/_app_selector.html.erb deleted file mode 100644 index e69de29bb..000000000 diff --git a/app/views/admin/pages/_custom_frontend_setting.html.erb b/app/views/admin/pages/_custom_frontend_setting.html.erb deleted file mode 100644 index 98ded6019..000000000 --- a/app/views/admin/pages/_custom_frontend_setting.html.erb +++ /dev/null @@ -1,12 +0,0 @@ -
- -
- <% if @frontend_styles%> - <%= select('page', 'frontend_style', @frontend_styles,{:selected => @selected[:frontend_style]}) %> - <% else %> - <%= t("default_widget.no_support_setting")%> - <% end %> -
-
diff --git a/app/views/admin/pages/_data_count_field.html.erb b/app/views/admin/pages/_data_count_field.html.erb deleted file mode 100644 index 1cfd69b8f..000000000 --- a/app/views/admin/pages/_data_count_field.html.erb +++ /dev/null @@ -1,6 +0,0 @@ - -
- <%= select_tag(field_name, options_for_select(@page_frontend_data_counts||[],field_value), class: "input-xlarge") %> -
\ No newline at end of file diff --git a/app/views/admin/pages/_edit.html.erb b/app/views/admin/pages/_edit.html.erb deleted file mode 100644 index 24fa99def..000000000 --- a/app/views/admin/pages/_edit.html.erb +++ /dev/null @@ -1,10 +0,0 @@ -<%= form_for @item, url: admin_page_path(@item), remote: true do |f| %> -
- <%= t('editing.page') %> - <%= render :partial => "form", :locals => { :f => f } %> -
- <%= t(:cancel) %> - <%= f.submit t(:update_), class: 'btn btn-primary btn-small' %> -
-
-<% end %> \ No newline at end of file diff --git a/app/views/admin/pages/_frontend_fields.html.erb b/app/views/admin/pages/_frontend_fields.html.erb deleted file mode 100644 index 07ff80d23..000000000 --- a/app/views/admin/pages/_frontend_fields.html.erb +++ /dev/null @@ -1,11 +0,0 @@ - - <% if (@module_app && @module_app.widget_fields) %> - <%= label_tag('frontend_field & frontend_field_type') %> - <% @module_app.widget_fields.each_with_index do |frontend_field, i| %> - <%= i+1 %> - <%= select_tag "page[frontend_field][]",widget_field_options(i,@item) , :include_blank => true %> - <%= select_tag "page[frontend_field_type][]", widget_field_class_options(i,@item), :include_blank => true %>
- <% end %> - <% end %> - - \ No newline at end of file diff --git a/app/views/admin/pages/_new.html.erb b/app/views/admin/pages/_new.html.erb deleted file mode 100644 index e9b6390b4..000000000 --- a/app/views/admin/pages/_new.html.erb +++ /dev/null @@ -1,9 +0,0 @@ -<%= form_for @item, url: admin_pages_path, remote: true do |f| %> -
- <%= render :partial => "form", :locals => { :f => f } %> -
- <%= t(:cancel) %> - <%= f.submit t(:create_), class: 'btn btn-primary btn-small' %> -
-
-<% end %> diff --git a/app/views/admin/pages/_show.html.erb b/app/views/admin/pages/_show.html.erb deleted file mode 100644 index edad4233f..000000000 --- a/app/views/admin/pages/_show.html.erb +++ /dev/null @@ -1 +0,0 @@ -<%= parse_page_edit_noko(@item).html_safe %> \ No newline at end of file diff --git a/app/views/admin/pages/_themes_ddl.html.erb b/app/views/admin/pages/_themes_ddl.html.erb deleted file mode 100644 index 1bb31ac92..000000000 --- a/app/views/admin/pages/_themes_ddl.html.erb +++ /dev/null @@ -1,2 +0,0 @@ - -<%= options_from_collection_for_select(@themes, :id, :name) %> \ No newline at end of file diff --git a/app/views/admin/pages/edit.html.erb b/app/views/admin/pages/edit.html.erb deleted file mode 100644 index 9e91e9ef2..000000000 --- a/app/views/admin/pages/edit.html.erb +++ /dev/null @@ -1 +0,0 @@ -<%= render 'edit' %> \ No newline at end of file diff --git a/app/views/admin/pages/edit.js.erb b/app/views/admin/pages/edit.js.erb deleted file mode 100644 index 1a636f389..000000000 --- a/app/views/admin/pages/edit.js.erb +++ /dev/null @@ -1 +0,0 @@ -$('.view-page .content').html("<%= j render 'edit' %>"); \ No newline at end of file diff --git a/app/views/admin/pages/new.html.erb b/app/views/admin/pages/new.html.erb deleted file mode 100644 index e3355a939..000000000 --- a/app/views/admin/pages/new.html.erb +++ /dev/null @@ -1 +0,0 @@ -<%= render 'new' %> \ No newline at end of file diff --git a/app/views/admin/pages/new.js.erb b/app/views/admin/pages/new.js.erb deleted file mode 100644 index b9ed1e31c..000000000 --- a/app/views/admin/pages/new.js.erb +++ /dev/null @@ -1 +0,0 @@ -$('.view-page .content').html("<%= j render 'new' %>"); \ No newline at end of file diff --git a/app/views/admin/pages/reload_front_end_setting.js.erb b/app/views/admin/pages/reload_front_end_setting.js.erb deleted file mode 100644 index 521f0ce6d..000000000 --- a/app/views/admin/pages/reload_front_end_setting.js.erb +++ /dev/null @@ -1,6 +0,0 @@ -<% if show_default_widget_setting_panel %> - $('#frontend_setting').html("<%= j render :partial => 'admin/page_parts/default_widget_style_panel',:locals=>{:object=>@item} %>"); - $('#frontend_setting').append("<%= j render :partial => 'admin/page_parts/default_widget_setting',:locals=>{:object=>@item} %>"); - <% 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 deleted file mode 100644 index f81d5ad4d..000000000 --- a/app/views/admin/pages/reload_frontend_pages.js.erb +++ /dev/null @@ -1,30 +0,0 @@ -<% if @selected[:module_app] %> - $('#app_page_category').html("<%= j render :partial => 'admin/page_parts/widget_data_source_category' ,:locals=>{:object=>@item}%>"); - $('#app_page_tag').html("<%= j render :partial => 'admin/page_parts/widget_data_source_tag',:locals=>{:object=>@item} %>"); - $("#data_count").html("<%= j render :partial => 'admin/pages/data_count_field',:locals=>{:field_name=>'page[frontend_data_count]',:field_value=>(@item.frontend_data_count rescue nil)} %>"); - - <% if !@selected[:module_app].app_pages.blank? or @selected[:module_app].has_default_widget? %> - $('#app_page_url').html("<%= escape_javascript(select 'page', 'app_frontend_url', options_for_select(@app_frontend_urls, @selected[:app_frontend_url]),{},{:rel => reload_after_list_changed_admin_pages_path}) %>"); - <% else %> - $('#app_page_url').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=>@item} %>"); - - $('#frontend_setting').html("<%= j render :partial => 'admin/page_parts/default_widget_style_panel',:locals=>{:object=>@item} %>"); - $('#frontend_setting').append("<%= j render :partial => 'admin/page_parts/default_widget_setting',:locals=>{:object=>@item} %>"); - <% else %> - $('#frontend_setting').html("<%= j render :partial => 'custom_frontend_setting' %>"); - <% end %> -<% else %> - - $('#app_page_url').html("<%= t('default_widget.no_support_setting')%>"); - $('#app_page_category').find("div.well.controls").html("<%= t('default_widget.no_support_setting')%>"); - $('#app_page_tag').find("div.well.controls").html("<%= t('default_widget.no_support_setting')%>"); - - $('#app_page_url').html("<%= t('default_widget.no_support_setting')%>"); - $('#frontend_setting').html("<%= j render :partial => 'custom_frontend_setting' %>"); -<% end %> -update_cates_and_tags(); -rebind(); \ No newline at end of file diff --git a/app/views/admin/pages/reload_themes.js.erb b/app/views/admin/pages/reload_themes.js.erb deleted file mode 100644 index 8515d02a9..000000000 --- a/app/views/admin/pages/reload_themes.js.erb +++ /dev/null @@ -1 +0,0 @@ -$('#page_theme_id').html("<%= escape_javascript(render :partial => 'admin/pages/themes_ddl') %>"); \ No newline at end of file diff --git a/app/views/admin/pages/reload_widget_field.js.erb b/app/views/admin/pages/reload_widget_field.js.erb deleted file mode 100644 index 993125c24..000000000 --- a/app/views/admin/pages/reload_widget_field.js.erb +++ /dev/null @@ -1 +0,0 @@ -$("#<%= params[:dom_id] %>").parents(".rows").find(".link_switch_holder").html("<%= j link_to_field_switch(@index,'page','frontend_field',nil,@selected[:default_widget_field]) %>"); \ No newline at end of file diff --git a/app/views/admin/pages/show.html.erb b/app/views/admin/pages/show.html.erb index 3e1160c7a..edad4233f 100644 --- a/app/views/admin/pages/show.html.erb +++ b/app/views/admin/pages/show.html.erb @@ -1 +1 @@ -<%= render 'show' %> \ No newline at end of file +<%= parse_page_edit_noko(@item).html_safe %> \ No newline at end of file diff --git a/app/views/layouts/structure.html.erb b/app/views/layouts/structure.html.erb index a2df68b54..b6742a16e 100644 --- a/app/views/layouts/structure.html.erb +++ b/app/views/layouts/structure.html.erb @@ -1,10 +1,11 @@ - + <%= @title || t('site.settings') || APP_CONFIG['orbit'] %> <%= render 'layouts/meta' %> <%= render 'layouts/google_font' %> <%= stylesheet_link_tag "structure" %> + <%= yield :page_specific_css %> <%= render 'layouts/ie_html5_fix' %> <%= javascript_include_tag "structure" %> <%= yield :page_specific_javascript %> diff --git a/config/routes.rb b/config/routes.rb index 6ba5150af..6d1e40c12 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -106,13 +106,6 @@ Orbit::Application.routes.draw do collection do get 'get_display_style' get 'get_page_setting_json' - get 'reload_themes' - get 'reload_after_module_changed', :action=>'reload_frontend_pages' - get 'reload_after_list_changed',:action=> 'reload_front_end_setting' - get 'reload_after_widget_field_changed',:action=> 'reload_widget_field' - end - member do - get 'delete' end end @@ -157,9 +150,6 @@ Orbit::Application.routes.draw do get 'get_page_setting_json' end member do - get 'reload_after_widget_field_changed',:action=>'reload_widget_field' - 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_front_end.rb b/lib/parsers/parser_front_end.rb index 6d4ca50d8..2ab4c9855 100644 --- a/lib/parsers/parser_front_end.rb +++ b/lib/parsers/parser_front_end.rb @@ -34,7 +34,7 @@ module ParserFrontEnd ret << "' - ret << page_part.child.to_html rescue nil + ret << page_part.inner_html rescue nil ret << '' fragment = Nokogiri::HTML::DocumentFragment.new(body, ret) page_part.swap(fragment)