From a9d25dcdec10861795cd06546aa7bf4b7d309915 Mon Sep 17 00:00:00 2001 From: chris Date: Fri, 12 Apr 2013 03:13:03 +0800 Subject: [PATCH] Orbit bar Structure: page, link, edit and new, page view, edit page parts Temporary disable authentication in items controller --- app/controllers/admin/items_controller.rb | 18 +- app/controllers/admin/links_controller.rb | 32 +- .../admin/page_parts_controller.rb | 3 +- app/controllers/admin/pages_controller.rb | 148 +- app/helpers/admin/items_helper.rb | 9 + app/helpers/application_helper.rb | 28 +- app/views/admin/items/_node.html.erb | 33 + .../admin/items/_node_and_children.html.erb | 21 + app/views/admin/items/_site_bar.html.erb | 10 + .../admin/items/_site_map_left_bar.html.erb | 6 - app/views/admin/items/index.html.erb | 38 +- app/views/admin/items/reload_items.js | 3 + app/views/admin/links/_edit.html.erb | 22 +- app/views/admin/links/_form.html.erb | 75 +- app/views/admin/links/_new.html.erb | 23 +- app/views/admin/links/create.js.erb | 3 - app/views/admin/links/edit.html.erb | 4 - app/views/admin/links/edit.js.erb | 2 +- app/views/admin/links/new.html.erb | 4 - app/views/admin/links/new.js.erb | 2 +- app/views/admin/links/update.js.erb | 2 - .../_custom_widget_setting.html.erb | 2 +- .../_default_widget_setting.html.erb | 2 +- .../_default_widget_style_panel.html.erb | 2 +- app/views/admin/page_parts/_edit.html.erb | 3 - .../_widget_data_source_category.html.erb | 28 +- .../_widget_data_source_tag.html.erb | 2 +- app/views/admin/page_parts/edit.html.erb | 4 - .../admin/pages/_data_count_field.html.erb | 12 +- app/views/admin/pages/_edit.html.erb | 21 +- app/views/admin/pages/_form.html.erb | 142 +- .../admin/pages/_frontend_setting.html.erb | 3 - app/views/admin/pages/_new.html.erb | 21 +- app/views/admin/pages/_show.html.erb | 4 +- app/views/admin/pages/create.js.erb | 3 - app/views/admin/pages/edit.html.erb | 7 +- app/views/admin/pages/edit.js.erb | 2 +- app/views/admin/pages/new.html.erb | 4 - app/views/admin/pages/new.js.erb | 2 +- app/views/admin/pages/update.js.erb | 3 - app/views/front/show_banner.html.erb | 2 +- app/views/layouts/_drop_down_menu.html.erb | 9 - app/views/layouts/_google_font.html.erb | 1 + app/views/layouts/_guest_orbit_menu.erb | 5 - app/views/layouts/_ie_html5_fix.html.erb | 4 + app/views/layouts/_lang_menu.html.erb | 7 - app/views/layouts/_left_menu.html.erb | 31 + app/views/layouts/_member_orbit_menu.erb | 15 - app/views/layouts/_meta.html.erb | 5 + app/views/layouts/_orbit_bar.html.erb | 106 +- app/views/layouts/_right_menu.html.erb | 84 + app/views/layouts/page_edit.html.erb | 20 + app/views/layouts/page_layout.html.erb | 7 +- app/views/layouts/site_editor.html.erb | 36 - app/views/layouts/structure.html.erb | 16 + config/locales/new_ui.en.yml | 5 + lib/orbit_app/module/registration.rb | 4 + lib/orbit_app/module/side_bar.rb | 8 + lib/parsers/parser_common.rb | 8 +- public/static/jquery.cycle.all.latest.js | 1331 -- public/static/jquery.js | 10835 ++++++++-------- public/static/kernel.js | 45 - 62 files changed, 6129 insertions(+), 7208 deletions(-) create mode 100644 app/views/admin/items/_node.html.erb create mode 100644 app/views/admin/items/_node_and_children.html.erb create mode 100644 app/views/admin/items/_site_bar.html.erb delete mode 100644 app/views/admin/items/_site_map_left_bar.html.erb create mode 100644 app/views/admin/items/reload_items.js delete mode 100644 app/views/admin/links/create.js.erb delete mode 100644 app/views/admin/links/update.js.erb delete mode 100644 app/views/admin/pages/_frontend_setting.html.erb delete mode 100644 app/views/admin/pages/create.js.erb delete mode 100644 app/views/admin/pages/update.js.erb delete mode 100644 app/views/layouts/_drop_down_menu.html.erb create mode 100644 app/views/layouts/_google_font.html.erb delete mode 100644 app/views/layouts/_guest_orbit_menu.erb create mode 100644 app/views/layouts/_ie_html5_fix.html.erb delete mode 100644 app/views/layouts/_lang_menu.html.erb create mode 100644 app/views/layouts/_left_menu.html.erb delete mode 100644 app/views/layouts/_member_orbit_menu.erb create mode 100644 app/views/layouts/_meta.html.erb create mode 100644 app/views/layouts/_right_menu.html.erb create mode 100644 app/views/layouts/page_edit.html.erb delete mode 100644 app/views/layouts/site_editor.html.erb create mode 100644 app/views/layouts/structure.html.erb create mode 100644 config/locales/new_ui.en.yml delete mode 100644 public/static/jquery.cycle.all.latest.js delete mode 100644 public/static/kernel.js diff --git a/app/controllers/admin/items_controller.rb b/app/controllers/admin/items_controller.rb index e0a8a445d..db18870da 100644 --- a/app/controllers/admin/items_controller.rb +++ b/app/controllers/admin/items_controller.rb @@ -1,11 +1,11 @@ class Admin::ItemsController < OrbitBackendController - layout "site_editor" + layout "structure" - before_filter :authenticate_user! - before_filter :find_parent_item - before_filter :is_admin? - before_filter :set_current_item + # before_filter :authenticate_user! + # before_filter :find_parent_item + # before_filter :is_admin? + # before_filter :set_current_item def index if params[:item_id] @@ -15,6 +15,14 @@ class Admin::ItemsController < OrbitBackendController end end + def destroy + @item = Item.find(params[:id]) + @item.destroy + respond_to do |format| + format.js { render 'admin/items/reload_items' } + end + end + def update_position item = Item.find(params[:id]) item.shift_to(params[:parent_id], params[:position]) diff --git a/app/controllers/admin/links_controller.rb b/app/controllers/admin/links_controller.rb index 5eece0ca5..07d045dbc 100644 --- a/app/controllers/admin/links_controller.rb +++ b/app/controllers/admin/links_controller.rb @@ -7,10 +7,12 @@ class Admin::LinksController < Admin::ItemsController def new @item = Link.new @item.parent = Page.find(params[:parent_id]) rescue nil + render layout: false end def edit @item = Link.find(params[:id]) + render layout: false end def create @@ -19,10 +21,7 @@ class Admin::LinksController < Admin::ItemsController if @item.save flash.now[:notice] = t('create.success.link') respond_to do |format| - format.html { - redirect_to admin_link_url(@item) - } - format.js {} + format.js { render 'admin/items/reload_items' } end else flash.now[:error] = t('create.error.link') @@ -36,35 +35,12 @@ class Admin::LinksController < Admin::ItemsController if @item.update_attributes(params[:link]) flash.now[:notice] = t('update.success.link') respond_to do |format| - format.html { - redirect_to admin_link_url(@item) - } - format.js {} + format.js { render 'admin/items/reload_items' } end else flash.now[:error] = t('update.error.link') render :action => "edit" end end - - def destroy - @item = Link.find(params[:id]) - @item.destroy - respond_to do |format| - format.html { - redirect_to admin_items_url - } - format.js {} - end - end - - def delete - @item = Link.find(params[:id]) - @item.destroy - respond_to do |format| - format.html {} - format.js { @item = @item.parent } - end - end end diff --git a/app/controllers/admin/page_parts_controller.rb b/app/controllers/admin/page_parts_controller.rb index de212e50f..3bb13ebb5 100644 --- a/app/controllers/admin/page_parts_controller.rb +++ b/app/controllers/admin/page_parts_controller.rb @@ -1,6 +1,6 @@ class Admin::PagePartsController < OrbitBackendController include Admin::FrontendWidgetInterface - layout "site_editor" + layout "structure" before_filter :authenticate_user! before_filter :is_admin? before_filter :set_current_item @@ -43,6 +43,7 @@ class Admin::PagePartsController < OrbitBackendController get_categories_and_tags get_frontend_data_count @app_frontend_urls = get_app_frontend_urls + @no_orbit_bar = true end def reload_widgets diff --git a/app/controllers/admin/pages_controller.rb b/app/controllers/admin/pages_controller.rb index 837994e99..7d7b283f2 100644 --- a/app/controllers/admin/pages_controller.rb +++ b/app/controllers/admin/pages_controller.rb @@ -1,65 +1,24 @@ class Admin::PagesController < Admin::ItemsController -helper Admin::PagePartsHelper -include Admin::FrontendWidgetInterface + helper Admin::PagePartsHelper + include Admin::FrontendWidgetInterface + def show @item = Page.find(params[:id]) - respond_to do |format| - format.html { - render 'admin/items/index' - } - format.js {} - end + @no_orbit_bar = true + render layout: 'page_layout' end def new - @item = Page.new + @item = Page.new(params[:page]) @item.parent = Item.find(params[:parent_id]) rescue nil - # @apps = ModuleApp.for_frontend_select - - @designs = Design.all.entries - @themes = Design.first.themes - @module_apps = ModuleApp.for_frontend_select - @app_frontend_urls = nil - @categories = nil - @tags = nil - @page_frontend_data_counts = nil - @frontend_styles = nil - @selected={ - :design => @designs.first, - :theme=> @themes.first, - :module_app=>nil,#@module_apps.first - :app_frontend_url=> nil, #@module_apps.first - :category=>nil, - :tag=>nil, - :page_frontend_data_count=>nil, - :frontend_style => nil - } + get_variables_for_new + render layout: false end def edit @item = Page.find(params[:id]) - - @designs = Design.all.entries - @themes = @item.design ? @item.design.themes : @designs.first.themes - @module_apps = ModuleApp.for_frontend_select - @categories = nil - @tags = nil - @page_frontend_data_counts = nil - @frontend_styles = nil - - @selected={ - :design => @item.design || @designs.first, - :theme=> @item.theme, - :module_app=>@item.module_app,#@module_apps.first - :app_frontend_url=> @item.app_frontend_url, #@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 - } - @app_frontend_urls = @item.module_app ? select_array_for_app_frontend_urls(@item.module_app.app_pages) : nil - get_categories_and_tags - get_frontend_data_count + get_variables_for_edit + render layout: false end def reload_themes @@ -133,22 +92,17 @@ include Admin::FrontendWidgetInterface clean_tags_and_category_params @item = Page.new(params[:page]) - if @item.module_app && @item.module_app.key == 'page_content' - @item.page_contexts.build(:create_user_id => current_user.id, :update_user_id => current_user.id ) - end + if @item.module_app && @item.module_app.key == 'page_content' + @item.page_contexts.build(:create_user_id => current_user.id, :update_user_id => current_user.id ) + end if @item.save flash.now[:notice] = t('create.success.page') respond_to do |format| - format.html { - redirect_to admin_page_url(@item) - } - format.js {} + format.js { render 'admin/items/reload_items' } end else - flash.now[:error] = t('create.error.page') - @designs = Design.all.entries - @design = Design.first + get_variables_for_new render :action => "new" end end @@ -163,40 +117,64 @@ include Admin::FrontendWidgetInterface if @item.update_attributes(params[:page]) flash[:notice] = t('update.success.page') respond_to do |format| - format.html { - redirect_to admin_page_url(@item) - } - format.js {} + format.js { render 'admin/items/reload_items' } end else + get_variables_for_edit render :action => "edit" end end - def destroy - @item = Page.find(params[:id]) - @item.destroy - respond_to do |format| - format.html { - redirect_to admin_items_url( :parent_id => @item.parent_id ) - } - format.js { redirect_to admin_items_url } - end - end - - def delete - @item = Page.find(params[:id]) - @item.destroy - respond_to do |format| - format.html {} - format.js { @item = @item.parent } - end - end - protected def get_frontend_styles 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 get_variables_for_new + @designs = Design.all.entries + @themes = Design.first.themes + @module_apps = ModuleApp.for_frontend_select + @app_frontend_urls = nil + @categories = nil + @tags = nil + @page_frontend_data_counts = nil + @frontend_styles = nil + @selected={ + :design => @designs.first, + :theme=> @themes.first, + :module_app=>nil,#@module_apps.first + :app_frontend_url=> nil, #@module_apps.first + :category=>nil, + :tag=>nil, + :page_frontend_data_count=>nil, + :frontend_style => nil + } + end + + def get_variables_for_edit + @designs = Design.all.entries + @themes = @item.design ? @item.design.themes : @designs.first.themes + @module_apps = ModuleApp.for_frontend_select + @categories = nil + @tags = nil + @page_frontend_data_counts = nil + @frontend_styles = nil + + @selected={ + :design => @item.design || @designs.first, + :theme=> @item.theme, + :module_app=>@item.module_app,#@module_apps.first + :app_frontend_url=> @item.app_frontend_url, #@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 + } + @app_frontend_urls = @item.module_app ? select_array_for_app_frontend_urls(@item.module_app.app_pages) : nil + get_categories_and_tags + get_frontend_data_count + end + end diff --git a/app/helpers/admin/items_helper.rb b/app/helpers/admin/items_helper.rb index fe76e1e0d..52ca9c85f 100644 --- a/app/helpers/admin/items_helper.rb +++ b/app/helpers/admin/items_helper.rb @@ -41,4 +41,13 @@ module Admin::ItemsHelper end end + def get_item_module_infos(item) + if module_app = item.module_app + app = OrbitApp::Module::Registration.find_by_key(module_app.key) + [t(app.get_label_i18n), (app.get_icon_class rescue 'icons-daniel-bruce-2')] + else + [t(:no_app), 'icons-daniel-bruce-2'] + end + end + end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 655a20909..d9e4f512a 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -28,7 +28,7 @@ module ApplicationHelper def current_or_guest_user if current_user if session[:guest_user_id] - guest_user.destroy + User.find(session[:guest_user_id]).destroy rescue nil session[:guest_user_id] = nil end current_user @@ -179,16 +179,8 @@ module ApplicationHelper def page_stylesheets(page, edit=nil) stylesheets = '' - unless edit - stylesheets << "\n" - stylesheets << "\n" - stylesheets << "\n" - end + stylesheets << "\n" stylesheets << "\n" if page.design.css_reset - stylesheets << "\n" - stylesheets << "\n" - stylesheets << "\n" - stylesheets << "\n" stylesheets << "\n" stylesheets << "\n" stylesheets << "\n" if page.design.css_default @@ -199,20 +191,8 @@ module ApplicationHelper def page_javascripts(page, edit=nil) javascripts = '' - unless edit - javascripts << "\n" - javascripts << "\n" - javascripts << "\n" - javascripts << "\n" - javascripts << "\n" - javascripts << "\n" - end - javascripts << "\n" - javascripts << "\n" - javascripts << "\n" - # javascripts << "\n" - javascripts << "\n" - javascripts << "\n" + # javascripts << "\n" + # javascripts << "\n" page.design.javascripts.each do |js| javascripts << "" end diff --git a/app/views/admin/items/_node.html.erb b/app/views/admin/items/_node.html.erb new file mode 100644 index 000000000..b67db54ee --- /dev/null +++ b/app/views/admin/items/_node.html.erb @@ -0,0 +1,33 @@ + \ No newline at end of file diff --git a/app/views/admin/items/_node_and_children.html.erb b/app/views/admin/items/_node_and_children.html.erb new file mode 100644 index 000000000..bc4fd2db1 --- /dev/null +++ b/app/views/admin/items/_node_and_children.html.erb @@ -0,0 +1,21 @@ +<% unless node.root? %> +
  • +<% end %> + + <%= render 'node', node: node %> + + <% unless node.children.blank? %> + <% unless node.root? %> +
      + <% end %> + <% node.children.each do |child| %> + <%= render 'node_and_children', node: child %> + <% end %> + <% unless node.root? %> +
    + <% end %> + <% end %> + +<% unless node.root? %> +
  • +<% end %> diff --git a/app/views/admin/items/_site_bar.html.erb b/app/views/admin/items/_site_bar.html.erb new file mode 100644 index 000000000..6eb6d3b67 --- /dev/null +++ b/app/views/admin/items/_site_bar.html.erb @@ -0,0 +1,10 @@ + \ No newline at end of file diff --git a/app/views/admin/items/_site_map_left_bar.html.erb b/app/views/admin/items/_site_map_left_bar.html.erb deleted file mode 100644 index 282f3ea21..000000000 --- a/app/views/admin/items/_site_map_left_bar.html.erb +++ /dev/null @@ -1,6 +0,0 @@ - - diff --git a/app/views/admin/items/index.html.erb b/app/views/admin/items/index.html.erb index 92af4611d..f3b68e933 100644 --- a/app/views/admin/items/index.html.erb +++ b/app/views/admin/items/index.html.erb @@ -1,5 +1,35 @@ -<% content_for :sidebar do %> - <%= render 'admin/items/site_map_left_bar' %> -<% end -%> +<% node = Item.root %> -<%= render "admin/#{@item.class.to_s.downcase.pluralize}/show" %> +<%= render 'site_bar' %> + +
    +
    +
      + <%= render 'node_and_children', node: node %> +
    +
    +
    + + + + +<%= javascript_include_tag "lib/jquery.pageslide.js" %> diff --git a/app/views/admin/items/reload_items.js b/app/views/admin/items/reload_items.js new file mode 100644 index 000000000..ee77002f9 --- /dev/null +++ b/app/views/admin/items/reload_items.js @@ -0,0 +1,3 @@ +$("#dialog").modal('hide'); +$("#main-wrap ol.sortable").html("<%= j render 'admin/items/node_and_children', node: Item.root %>"); +reloadStructure(); \ No newline at end of file diff --git a/app/views/admin/links/_edit.html.erb b/app/views/admin/links/_edit.html.erb index 1c9488ff6..706e11356 100644 --- a/app/views/admin/links/_edit.html.erb +++ b/app/views/admin/links/_edit.html.erb @@ -1,12 +1,10 @@ -

    <%= t('editing.link') %>

    - -<%= flash_messages %> - -<%= form_for @item, :url => admin_link_path(@item), :html => { :class => 'form' } do |f| %> - - <%= render :partial => "admin/links/form", :locals => { :f => f } %> - -

    - <%= f.submit t(:update_) %> <%= link_back %> -

    -<% end %> +<%= form_for @item, url: admin_link_path(@item), remote: true do |f| %> +
    + <%= t('editing.link') %> + <%= 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/links/_form.html.erb b/app/views/admin/links/_form.html.erb index b19d660cd..423f35958 100644 --- a/app/views/admin/links/_form.html.erb +++ b/app/views/admin/links/_form.html.erb @@ -1,59 +1,40 @@ +<%= flash_messages %> <%= f.error_messages %> + <%= f.hidden_field :parent, :value => (@item.parent.id rescue nil) %> -
    - <%= f.label :name, t(:name), :class => 'control-label' %> -
    - <%= f.text_field :name, :class => 'text input-xlarge' %> - -
    -
    +<%= f.label :name, t(:name) %> +<%= f.text_field :name, class: 'input-xlarge', placeholder: t(:name) %> + +<%= f.label :url, t(:url) %> +<%= f.text_field :url, :class => 'input-xlarge', placeholder: t(:url) %> <%= 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, :class => 'text input-xlarge', :value => (@item.title_translations[locale] rescue nil) %> - -
    -
    + <%= f.label :locale, "#{t(:title)} #{I18nVariable.from_locale(locale)}" %> + <%= f.text_field locale, class: 'input-xlarge', placeholder: "#{t(:title)} #{I18nVariable.from_locale(locale)}", value: (@item.title_translations[locale] rescue nil) %> <% end %> <% end %> -
    - <%= f.label :is_published, "#{t(:is_published)} ?", :class => 'control-label' %> -
    - - - -
    -
    +<%= f.label :is_published, "#{t('front_page.is_published')} ?" %> +

    + + +

    -
    - <%= f.label :menu_enabled_for, "#{t(:menu_enabled_for)}:", :class => 'control-label' %> -
    - <% @site_valid_locales.each do |valid_locale| %> -
    -
    - -
    - <%= f.label :url, "#{t(:url)}:", :class => 'control-label' %> -
    - <%= f.text_field :url, :class => 'text input-xlarge', :value => (@item.url rescue nil) %> - -
    -
    + + <% end %> + <%= hidden_field_tag 'link[menu_enabled_for][]', '' %> +

    diff --git a/app/views/admin/links/_new.html.erb b/app/views/admin/links/_new.html.erb index 1dec644b6..630bdec79 100644 --- a/app/views/admin/links/_new.html.erb +++ b/app/views/admin/links/_new.html.erb @@ -1,13 +1,10 @@ -

    <%= t('new.link') %>

    - -<%= flash_messages %> - -<%= form_for @item, :url => admin_links_path, :html => { :class => 'form' } do |f| %> - - <%= render :partial => "admin/links/form", :locals => { :f => f } %> - -

    - <%= f.submit t(:create_) %> <%= link_back %> -

    - -<% end %> +<%= form_for @item, url: admin_links_path, remote: true do |f| %> +
    + <%= t('new.link') %> + <%= render :partial => "form", :locals => { :f => f } %> +
    + <%= t(:cancel) %> + <%= f.submit t(:create_), class: 'btn btn-primary btn-small' %> +
    +
    +<% end %> \ No newline at end of file diff --git a/app/views/admin/links/create.js.erb b/app/views/admin/links/create.js.erb deleted file mode 100644 index efb284188..000000000 --- a/app/views/admin/links/create.js.erb +++ /dev/null @@ -1,3 +0,0 @@ -$('#back_sidebar').html("<%= escape_javascript(render(:partial => 'admin/items/site_map_left_bar')) %>"); -$('#back_main').html("<%= escape_javascript(render(:partial => 'admin/links/show')) %>"); -history.pushState(null, document.title, "<%= escape_javascript(admin_link_url(@item)) %>"); \ No newline at end of file diff --git a/app/views/admin/links/edit.html.erb b/app/views/admin/links/edit.html.erb index 1b5fb6b56..96ba353ad 100644 --- a/app/views/admin/links/edit.html.erb +++ b/app/views/admin/links/edit.html.erb @@ -1,5 +1 @@ -<% content_for :sidebar do %> - <%= render 'admin/items/site_map_left_bar' %> -<% end -%> - <%= render 'edit' %> diff --git a/app/views/admin/links/edit.js.erb b/app/views/admin/links/edit.js.erb index 083328cce..30d88e18a 100644 --- a/app/views/admin/links/edit.js.erb +++ b/app/views/admin/links/edit.js.erb @@ -1 +1 @@ -$('#back_main').html("<%= escape_javascript(render(:partial => 'admin/links/edit')) %>"); \ No newline at end of file +$('#view-page .content').html("<%= j render 'edit' %>"); \ No newline at end of file diff --git a/app/views/admin/links/new.html.erb b/app/views/admin/links/new.html.erb index afb9580e7..41230acde 100644 --- a/app/views/admin/links/new.html.erb +++ b/app/views/admin/links/new.html.erb @@ -1,5 +1 @@ -<% content_for :sidebar do %> - <%= render 'admin/items/site_map_left_bar' %> -<% end -%> - <%= render 'new' %> diff --git a/app/views/admin/links/new.js.erb b/app/views/admin/links/new.js.erb index 6914621f4..5ecf8f163 100644 --- a/app/views/admin/links/new.js.erb +++ b/app/views/admin/links/new.js.erb @@ -1 +1 @@ -$('#back_main').html("<%= escape_javascript(render(:partial => 'admin/links/new')) %>"); \ No newline at end of file +$('#view-page .content').html("<%= j render 'new' %>"); \ No newline at end of file diff --git a/app/views/admin/links/update.js.erb b/app/views/admin/links/update.js.erb deleted file mode 100644 index be187b0db..000000000 --- a/app/views/admin/links/update.js.erb +++ /dev/null @@ -1,2 +0,0 @@ -$('#back_main').html("<%= escape_javascript(render(:partial => 'admin/links/show')) %>"); -history.pushState(null, document.title, "<%= escape_javascript(admin_link_url(@item)) %>"); \ 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 index 7a3838e68..d377dcbd7 100644 --- a/app/views/admin/page_parts/_custom_widget_setting.html.erb +++ b/app/views/admin/page_parts/_custom_widget_setting.html.erb @@ -2,7 +2,7 @@ -
    +
    <% 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%> 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 2bb780892..b91cb52a4 100644 --- a/app/views/admin/page_parts/_default_widget_setting.html.erb +++ b/app/views/admin/page_parts/_default_widget_setting.html.erb @@ -13,7 +13,7 @@ -
    +
    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 1c1d9ba8e..2b002d530 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 @@ -9,7 +9,7 @@ -
    +
      <% if @selected[:module_app].get_default_widget["enabled_styles"].include?("typeA") %>
    • diff --git a/app/views/admin/page_parts/_edit.html.erb b/app/views/admin/page_parts/_edit.html.erb index 50ebaa7a4..812f50c77 100644 --- a/app/views/admin/page_parts/_edit.html.erb +++ b/app/views/admin/page_parts/_edit.html.erb @@ -19,6 +19,3 @@
    <% end %> - -<%=javascript_include_tag "inc/update_cates_and_tags.js" %> -<%= javascript_include_tag "inc/page_widget_edit_interface.js" %> \ 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 index c3e4c21d3..fb622ab19 100644 --- a/app/views/admin/page_parts/_widget_data_source_category.html.erb +++ b/app/views/admin/page_parts/_widget_data_source_category.html.erb @@ -6,17 +6,17 @@ <% end %> - -
    - <% if @categories %> -
    - <%= nil_checkbox_button(object,:category) %> - <%= content_tag_for(:label, @categories,:class=>"radio inline") 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 %> -
    \ No newline at end of file + +
    +<% if @categories %> +
    + <%= nil_checkbox_button(object,:category) %> + <%= content_tag_for(:label, @categories,:class=>"radio inline") 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 %> +
    \ No newline at end of file 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 index c067aeded..34dbdbf03 100644 --- a/app/views/admin/page_parts/_widget_data_source_tag.html.erb +++ b/app/views/admin/page_parts/_widget_data_source_tag.html.erb @@ -7,7 +7,7 @@ -
    +
    <% if @categories %>
    <%= nil_checkbox_button(object,:tag) %> diff --git a/app/views/admin/page_parts/edit.html.erb b/app/views/admin/page_parts/edit.html.erb index 907cc7eb0..9e91e9ef2 100644 --- a/app/views/admin/page_parts/edit.html.erb +++ b/app/views/admin/page_parts/edit.html.erb @@ -1,5 +1 @@ -<% content_for :sidebar do %> - <%= render 'admin/items/site_map_left_bar' %> -<% end -%> - <%= render 'edit' %> \ No newline at end of file diff --git a/app/views/admin/pages/_data_count_field.html.erb b/app/views/admin/pages/_data_count_field.html.erb index 725b5c000..1cfd69b8f 100644 --- a/app/views/admin/pages/_data_count_field.html.erb +++ b/app/views/admin/pages/_data_count_field.html.erb @@ -1,6 +1,6 @@ - -
    - <%= select_tag(field_name,options_for_select(@page_frontend_data_counts||[],field_value )) %> -
    \ No newline at end of file + +
    + <%= 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 index c4398ef69..24fa99def 100644 --- a/app/views/admin/pages/_edit.html.erb +++ b/app/views/admin/pages/_edit.html.erb @@ -1,11 +1,10 @@ -<%#= flash_messages %> -
    -

    <%= t('editing.page') %>

    - <%= form_for @item, :url => admin_page_path(@item), :html => { :class => 'form-horizontal edit_page' } do |f| %> - <%= render :partial => "form", :locals => { :f => f } %> -
    - <%= f.submit t(:update_), :class => 'btn btn-primary' %> - <%= link_to t('cancel'), get_go_back, :class=>"btn" %> -
    - <% end %> -
    +<%= 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/_form.html.erb b/app/views/admin/pages/_form.html.erb index 559e8be61..f377ea02f 100644 --- a/app/views/admin/pages/_form.html.erb +++ b/app/views/admin/pages/_form.html.erb @@ -1,116 +1,90 @@ +<%= flash_messages %> <%= f.error_messages %> + <%= f.hidden_field :parent, :value => (@item.parent.id rescue nil) %> -<%= f.hidden_field :id, :value => (@item.id),:id=>"object_id" %> -
    - <%= f.label :name, '*'+t(:name), :class => 'control-label' %> - - -
    - <%= f.text_field :name, :class => 'text input-xlarge' %> - <%= I18n.t("front_page.name_field_helper") %> - -
    -
    +<%= f.hidden_field :id, :value => (@item.id), :id => "object_id" %> + +<%= f.label :name, '*' + t(:name) %> +<%= f.text_field :name, class: 'input-xlarge', placeholder: t(:name) %> +<%= I18n.t("front_page.name_field_helper") %> <%= 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, :class => 'text input-xlarge', :value => (@item.title_translations[locale] rescue nil) %> - -
    -
    + <%= f.label :locale, "#{t(:title)} #{I18nVariable.from_locale(locale)}" %> + <%= f.text_field locale, class: 'input-xlarge', placeholder: "#{t(:title)} #{I18nVariable.from_locale(locale)}", value: (@item.title_translations[locale] rescue nil) %> <% end %> <% end %> -
    - <%= f.label :name, t(:template_name), :class => 'control-label' %> -
    - <%= f.collection_select :design, @designs, :id, :title, {:selected => (@selected[:design].id rescue nil) }, {:rel => reload_themes_admin_pages_path} %> - -
    +<%= f.label :design, t(:template_name) %> +<%= f.collection_select :design, @designs, :id, :title, {selected: (@selected[:design].id rescue nil) }, {rel: reload_themes_admin_pages_path, class: "input-xlarge"} %> + +<%= f.label :theme, t(:theme) %> +<%= f.select :theme_id, @themes.collect { |t| [t.name.capitalize, t.id] }, {include_blank: true, selected: (@selected[:theme].id rescue nil) }, { class: "input-xlarge" } %> + +
    + + <%= f.select :module_app_id, 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_pages_path, id: "page_module_app_id", class: "input-xlarge"} %>
    -
    - <%= f.label :name, t(:theme), :class => 'control-label' %> -
    - <%= f.select :theme_id, @themes.collect { |t| [t.name.capitalize, t.id] }, {:include_blank => true, :selected=>(@selected[:theme].id rescue nil) } %> - + +
    + +
    + <%= select('page','app_frontend_url', @app_frontend_urls || [], {selected: @selected[:app_frontend_url], rel: reload_after_list_changed_admin_pages_path}, class: "input-xlarge") rescue '' %>
    -
    - <%= f.label '',t("default_widget.select_module_app"), :class => 'control-label' %> -
    - <%= f.select :module_app_id, 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_pages_path,:id=>"page_module_app_id"} %> -
    -
    - -
    - <%= f.label '', t("front_page.select_app_url"), :class => 'control-label' %> -
    - <%= select('page','app_frontend_url', @app_frontend_urls || [], {:selected => @selected[:app_frontend_url],:rel => reload_after_list_changed_admin_pages_path}) 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} %> + <% if show_default_widget_setting_panel %> + <%= render :partial=>'admin/page_parts/widget_setting',:locals=>{:object=>@item,:f=>f} %> + <% end %>
    -
    +
    <%= render :partial=>'data_count_field',:locals=>{:field_name=>"page[frontend_data_count]",:field_value=>@selected[:page_frontend_data_count]} %>
    -
    - <%= f.label :is_published, "#{t('front_page.is_published')} ?", :class => 'control-label' %> -
    - - - -
    -
    -
    - <%= f.label :menu_enabled_for, "#{t('front_page.menu_enable_lang')}:", :class => 'control-label' %> -
    - <% @site_valid_locales.each do |valid_locale| %> -
    -
    + + <% end %> + <%= hidden_field_tag 'page[menu_enabled_for][]', '' %> +

    -
    - <%= f.label :enabled_for, "#{t('front_page.link_enable_lang')}:", :class => 'control-label' %> -
    - <% @site_valid_locales.each do |valid_locale| %> -
    -
    - -<%=javascript_include_tag "inc/update_cates_and_tags.js" %> -<%= javascript_include_tag "inc/page_widget_edit_interface.js" %> \ No newline at end of file +

    diff --git a/app/views/admin/pages/_frontend_setting.html.erb b/app/views/admin/pages/_frontend_setting.html.erb deleted file mode 100644 index 4e6392729..000000000 --- a/app/views/admin/pages/_frontend_setting.html.erb +++ /dev/null @@ -1,3 +0,0 @@ -<% 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/_new.html.erb b/app/views/admin/pages/_new.html.erb index 44abadf5e..7162cbc0a 100644 --- a/app/views/admin/pages/_new.html.erb +++ b/app/views/admin/pages/_new.html.erb @@ -1,11 +1,10 @@ -<%#= flash_messages %> -
    -

    <%= t('new.page') %>

    - <%= form_for @item, :url => admin_pages_path, :html => { :class => 'form-horizontal edit_page' } do |f| %> - <%= render :partial => "form", :locals => { :f => f } %> -
    - <%= f.submit t(:create_), :class => 'btn btn-primary' %> - <%= link_to t('cancel'), get_go_back, :class=>"btn" %> -
    - <% end %> -
    \ No newline at end of file +<%= form_for @item, url: admin_pages_path, remote: true do |f| %> +
    + <%= t('new.page') %> + <%= 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 index d33d08bd7..00c2ba903 100644 --- a/app/views/admin/pages/_show.html.erb +++ b/app/views/admin/pages/_show.html.erb @@ -1,7 +1,7 @@ <%#= flash_messages %> -<%= page_stylesheets(@item, true).html_safe %> -<%= page_javascripts(@item, true).html_safe %> +<%#= page_stylesheets(@item, true).html_safe %> +<%#= page_javascripts(@item, true).html_safe %> <%= parse_page_edit_noko(@item).html_safe %> \ No newline at end of file diff --git a/app/views/admin/pages/create.js.erb b/app/views/admin/pages/create.js.erb deleted file mode 100644 index 7ce5b016f..000000000 --- a/app/views/admin/pages/create.js.erb +++ /dev/null @@ -1,3 +0,0 @@ -$('#back_main').html("<%= escape_javascript(render(:partial => 'admin/pages/show')) %>"); -$('#back_sidebar').html("<%= escape_javascript(render(:partial => 'admin/items/site_map_left_bar')) %>"); -history.pushState(null, document.title, "<%= escape_javascript(admin_page_url(@item)) %>"); \ 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 b9029cf8a..9e91e9ef2 100644 --- a/app/views/admin/pages/edit.html.erb +++ b/app/views/admin/pages/edit.html.erb @@ -1,6 +1 @@ -<%= stylesheet_link_tag "admin/default_widget_setting" %> -<% content_for :sidebar do %> - <%= render 'admin/items/site_map_left_bar' %> -<% end -%> - -<%= render 'edit' %> \ No newline at end of file +<%= 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 index 8c7413099..30d88e18a 100644 --- a/app/views/admin/pages/edit.js.erb +++ b/app/views/admin/pages/edit.js.erb @@ -1 +1 @@ -$('#back_main').html("<%= escape_javascript(render 'edit') %>"); \ No newline at end of file +$('#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 index f4b7c9068..e3355a939 100644 --- a/app/views/admin/pages/new.html.erb +++ b/app/views/admin/pages/new.html.erb @@ -1,5 +1 @@ -<% content_for :sidebar do %> - <%= render 'admin/items/site_map_left_bar' %> -<% end -%> - <%= 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 index cdddb060e..5ecf8f163 100644 --- a/app/views/admin/pages/new.js.erb +++ b/app/views/admin/pages/new.js.erb @@ -1 +1 @@ -$('#back_main').html("<%= escape_javascript(render(:partial => 'admin/pages/new')) %>"); \ No newline at end of file +$('#view-page .content').html("<%= j render 'new' %>"); \ No newline at end of file diff --git a/app/views/admin/pages/update.js.erb b/app/views/admin/pages/update.js.erb deleted file mode 100644 index 7ce5b016f..000000000 --- a/app/views/admin/pages/update.js.erb +++ /dev/null @@ -1,3 +0,0 @@ -$('#back_main').html("<%= escape_javascript(render(:partial => 'admin/pages/show')) %>"); -$('#back_sidebar').html("<%= escape_javascript(render(:partial => 'admin/items/site_map_left_bar')) %>"); -history.pushState(null, document.title, "<%= escape_javascript(admin_page_url(@item)) %>"); \ No newline at end of file diff --git a/app/views/front/show_banner.html.erb b/app/views/front/show_banner.html.erb index 491dbe729..9945adbb4 100644 --- a/app/views/front/show_banner.html.erb +++ b/app/views/front/show_banner.html.erb @@ -1,4 +1,4 @@ - +