From f694134150bd8d0c78d273aa1be751a5a10b8a45 Mon Sep 17 00:00:00 2001 From: chris Date: Tue, 8 Oct 2013 21:33:10 +0800 Subject: [PATCH] Remove useless code Add data-title --- app/controllers/admin/links_controller.rb | 4 --- app/helpers/admin/items_helper.rb | 41 ----------------------- app/views/admin/items/_node.html.erb | 10 +++--- app/views/admin/items/index.html.erb | 2 -- app/views/admin/items/index.js.erb | 7 ---- app/views/admin/links/_show.html.erb | 37 -------------------- app/views/admin/links/delete.html.erb | 7 ---- app/views/admin/links/delete.js.erb | 3 -- app/views/admin/links/show.html.erb | 5 --- app/views/admin/links/show.js.erb | 1 - app/views/admin/pages/_show.html.erb | 6 ---- app/views/admin/pages/delete.html.erb | 7 ---- app/views/admin/pages/delete.js.erb | 3 -- app/views/admin/pages/show.js.erb | 1 - 14 files changed, 5 insertions(+), 129 deletions(-) delete mode 100644 app/views/admin/items/index.js.erb delete mode 100644 app/views/admin/links/_show.html.erb delete mode 100644 app/views/admin/links/delete.html.erb delete mode 100644 app/views/admin/links/delete.js.erb delete mode 100644 app/views/admin/links/show.html.erb delete mode 100644 app/views/admin/links/show.js.erb delete mode 100644 app/views/admin/pages/delete.html.erb delete mode 100644 app/views/admin/pages/delete.js.erb delete mode 100644 app/views/admin/pages/show.js.erb diff --git a/app/controllers/admin/links_controller.rb b/app/controllers/admin/links_controller.rb index 20a7d766..9813c560 100644 --- a/app/controllers/admin/links_controller.rb +++ b/app/controllers/admin/links_controller.rb @@ -1,9 +1,5 @@ class Admin::LinksController < Admin::ItemsController - def show - @item ||= Link.find(params[:id]) - end - def new @item = Link.new @item.parent = Page.find(params[:parent_id]) rescue nil diff --git a/app/helpers/admin/items_helper.rb b/app/helpers/admin/items_helper.rb index 2d760294..da1ecf19 100644 --- a/app/helpers/admin/items_helper.rb +++ b/app/helpers/admin/items_helper.rb @@ -1,45 +1,4 @@ module Admin::ItemsHelper - - def render_node_and_children(node) - ret = '' - if node - case node.class.to_s - when 'Page' - dest = admin_page_path(node) - when 'Link' - dest = admin_link_path(node) - no_nested = 'no-nest' - end - ret << "
  • " - ret << "
    " - ret << (link_to node.title, dest, :class => 'js_history') - ret << "
    " - ret << (link_to t(:edit), eval("edit_admin_#{node.class.to_s.downcase}_path(node)"), :class => 'js_history') if node.class.to_s.eql?('Page') - ret << (link_to t('new.page'), new_admin_page_path(:parent_id => node.id), :class => 'new_page js_history') if node.class.to_s.eql?('Page') - ret << (link_to t('new.link'), new_admin_link_path(:parent_id => node.id), :class => 'new_link js_history') if node.class.to_s.eql?('Page') - ret << (link_to t(:delete_), eval("delete_admin_#{node.class.to_s.downcase}_path(node, :authenticity_token => form_authenticity_token)"), :confirm => t('sure?'), :class => 'delete js_history') - ret << "
    " - ret << "
    " - ret << render_children(node) - ret << "
  • " - end - ret.html_safe - end - - def render_children(parent) - children = parent.children - if !parent.children.entries.blank? - ret = '' - ret << "
      " - children.each do |child| - ret << render_node_and_children(child) - end - ret << '
    ' - ret - else - '' - end - end def get_item_module_infos(item) if module_app = item.module_app diff --git a/app/views/admin/items/_node.html.erb b/app/views/admin/items/_node.html.erb index a0926f4d..431e1c1d 100644 --- a/app/views/admin/items/_node.html.erb +++ b/app/views/admin/items/_node.html.erb @@ -17,11 +17,11 @@ <%= link_to node.title, node.url %> <% end %>
    - <%= link_to content_tag(:i, nil, class: "icon-eye-open"), eval("admin_#{node.class.to_s.downcase}_path(node)"), class: "view-page open-slide tip", title: t(:view) if node.class.to_s.eql?('Page') %> - <%= link_to content_tag(:i, nil, class: "icon-edit"), eval("edit_admin_#{node.class.to_s.downcase}_path(node)"), class: "open-slide tip", title: t(:edit) %> - <%= link_to content_tag(:i, nil, class: "icons-newspaper"), new_admin_page_path(:parent_id => node.id), class: "open-slide tip", title: t(:add_page) if node.class.to_s.eql?('Page') %> - <%= link_to content_tag(:i, nil, class: "icon-link"), new_admin_link_path(:parent_id => node.id), class: "open-slide tip", title: t(:add_link) if node.class.to_s.eql?('Page') %> - <%= link_to content_tag(:i, nil, class: "icon-trash"), nil, rel: eval("admin_#{node.class.to_s.downcase}_path(node)"), class: "delete tip", title: t(:delete_) unless node.root? %> + <%= link_to content_tag(:i, nil, class: "icon-eye-open"), eval("admin_#{node.class.to_s.downcase}_path(node)"), class: "view-page open-slide tip", title: t(:view), data: {title: t(:view)} if node.class.to_s.eql?('Page') %> + <%= link_to content_tag(:i, nil, class: "icon-edit"), eval("edit_admin_#{node.class.to_s.downcase}_path(node)"), class: "open-slide tip", title: t(:edit), data: {title: t(:edit)} %> + <%= link_to content_tag(:i, nil, class: "icons-newspaper"), new_admin_page_path(:parent_id => node.id), class: "open-slide tip", title: t(:add_page), data: {title: t(:add_page)} if node.class.to_s.eql?('Page') %> + <%= link_to content_tag(:i, nil, class: "icon-link"), new_admin_link_path(:parent_id => node.id), class: "open-slide tip", title: t(:add_link), data: {title: t(:add_link)} if node.class.to_s.eql?('Page') %> + <%= link_to content_tag(:i, nil, class: "icon-trash"), nil, rel: eval("admin_#{node.class.to_s.downcase}_path(node)"), class: "delete tip", title: t(:delete_), data: {title: t(:delete_)} unless node.root? %>
    diff --git a/app/views/admin/items/index.html.erb b/app/views/admin/items/index.html.erb index 67b0d30b..1459b4ce 100644 --- a/app/views/admin/items/index.html.erb +++ b/app/views/admin/items/index.html.erb @@ -5,5 +5,3 @@ <% end %> <%= render 'layouts/delete_modal', delete_options: {remote: true} %> - -<%= javascript_include_tag "lib/jquery.pageslide.js" %> diff --git a/app/views/admin/items/index.js.erb b/app/views/admin/items/index.js.erb deleted file mode 100644 index bc701ca2..00000000 --- a/app/views/admin/items/index.js.erb +++ /dev/null @@ -1,7 +0,0 @@ -$('#back_main').empty(); -<% case @item.class.to_s %> - <% when 'Page' %> - $('#back_main').append("<%= escape_javascript(render(:partial => 'admin/pages/show')) %>"); - <% when 'Link' %> - $('#back_main').append("<%= escape_javascript(render(:partial => 'admin/links/show')) %>"); -<% end %> \ No newline at end of file diff --git a/app/views/admin/links/_show.html.erb b/app/views/admin/links/_show.html.erb deleted file mode 100644 index 36e6bd98..00000000 --- a/app/views/admin/links/_show.html.erb +++ /dev/null @@ -1,37 +0,0 @@ -<%= flash_messages %> - -
    - -
    - <%= @item.name %> - -
    -
    - -<% @site_valid_locales.each do |locale| %> -
    - -
    - <%= @item.title_translations[locale] if @item.title %> - -
    -
    -<% end %> - -
    - -
    - <%= @item.is_published.to_s %> - -
    -
    - -
    - -
    - <%= @item.url %> - -
    -
    - -<%= link_to t(:edit), edit_admin_link_path(@item), :class => 'nav' %> \ No newline at end of file diff --git a/app/views/admin/links/delete.html.erb b/app/views/admin/links/delete.html.erb deleted file mode 100644 index 66de0436..00000000 --- a/app/views/admin/links/delete.html.erb +++ /dev/null @@ -1,7 +0,0 @@ -<% form_for :link, :url => admin_link_path(@item), :html => { :method => :delete } do |f| %> -

    <%= t('sure?') %>

    -

    - <%= submit_tag t(:delete_) %> - <%= link_back %> -

    -<% end %> \ No newline at end of file diff --git a/app/views/admin/links/delete.js.erb b/app/views/admin/links/delete.js.erb deleted file mode 100644 index 8ea2a642..00000000 --- a/app/views/admin/links/delete.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/pages/show')) %>"); -history.pushState(null, document.title, "<%= escape_javascript(admin_items_url) %>"); \ No newline at end of file diff --git a/app/views/admin/links/show.html.erb b/app/views/admin/links/show.html.erb deleted file mode 100644 index 28c1ecfd..00000000 --- a/app/views/admin/links/show.html.erb +++ /dev/null @@ -1,5 +0,0 @@ -<% content_for :sidebar do %> - <%= render 'admin/items/site_map_left_bar' %> -<% end -%> - -<%= render 'show' %> diff --git a/app/views/admin/links/show.js.erb b/app/views/admin/links/show.js.erb deleted file mode 100644 index 92676945..00000000 --- a/app/views/admin/links/show.js.erb +++ /dev/null @@ -1 +0,0 @@ -$('#back_main').html("<%= escape_javascript(render(:partial => 'show')) %>"); \ 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 00c2ba90..edad4233 100644 --- a/app/views/admin/pages/_show.html.erb +++ b/app/views/admin/pages/_show.html.erb @@ -1,7 +1 @@ -<%#= flash_messages %> - - -<%#= 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/delete.html.erb b/app/views/admin/pages/delete.html.erb deleted file mode 100644 index 9c58189e..00000000 --- a/app/views/admin/pages/delete.html.erb +++ /dev/null @@ -1,7 +0,0 @@ -<% form_for :page, :url => admin_page_path(@item), :html => { :method => :delete } do |f| %> -

    <%= t('sure?') %>

    -

    - <%= submit_tag t(:delete_) %> - <%= link_back %> -

    -<% end %> \ No newline at end of file diff --git a/app/views/admin/pages/delete.js.erb b/app/views/admin/pages/delete.js.erb deleted file mode 100644 index 8ea2a642..00000000 --- a/app/views/admin/pages/delete.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/pages/show')) %>"); -history.pushState(null, document.title, "<%= escape_javascript(admin_items_url) %>"); \ No newline at end of file diff --git a/app/views/admin/pages/show.js.erb b/app/views/admin/pages/show.js.erb deleted file mode 100644 index 92676945..00000000 --- a/app/views/admin/pages/show.js.erb +++ /dev/null @@ -1 +0,0 @@ -$('#back_main').html("<%= escape_javascript(render(:partial => 'show')) %>"); \ No newline at end of file