Remove useless code

Add data-title
This commit is contained in:
chris 2013-10-08 21:33:10 +08:00
parent 00e9a5df5b
commit f694134150
14 changed files with 5 additions and 129 deletions

View File

@ -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

View File

@ -1,46 +1,5 @@
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 << "<li id='#{node.id}' class='#{no_nested}'>"
ret << "<div class='with_action'><i class='icons-plus-3'></i>"
ret << (link_to node.title, dest, :class => 'js_history')
ret << "<div class='quick-edit hide'>"
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 << "</div>"
ret << "</div>"
ret << render_children(node)
ret << "</li>"
end
ret.html_safe
end
def render_children(parent)
children = parent.children
if !parent.children.entries.blank?
ret = ''
ret << "<ol class='#{'sortable' if parent.parent.nil?}'>"
children.each do |child|
ret << render_node_and_children(child)
end
ret << '</ol>'
ret
else
''
end
end
def get_item_module_infos(item)
if module_app = item.module_app
app = OrbitApp::Module::Registration.find_by_key(module_app.key)

View File

@ -17,11 +17,11 @@
<%= link_to node.title, node.url %>
<% end %>
<div class="item-menu">
<%= 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? %>
</div>
</div>
<div class="item-info pull-right">

View File

@ -5,5 +5,3 @@
</ol>
<% end %>
<%= render 'layouts/delete_modal', delete_options: {remote: true} %>
<%= javascript_include_tag "lib/jquery.pageslide.js" %>

View File

@ -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 %>

View File

@ -1,37 +0,0 @@
<%= flash_messages %>
<div class="control-group">
<label class="control-label"><%= t(:url) %></label>
<div class="controls">
<%= @item.name %>
<!-- <p class="help-block">In addition to freeform text, any HTML5 text-based input appears like so.</p> -->
</div>
</div>
<% @site_valid_locales.each do |locale| %>
<div class="control-group">
<label class="control-label"><%= t(:title) %></label>
<div class="controls">
<%= @item.title_translations[locale] if @item.title %>
<!-- <p class="help-block">In addition to freeform text, any HTML5 text-based input appears like so.</p> -->
</div>
</div>
<% end %>
<div class="control-group">
<label class="control-label"><%= t(:is_published) %></label>
<div class="controls">
<%= @item.is_published.to_s %>
<!-- <p class="help-block">In addition to freeform text, any HTML5 text-based input appears like so.</p> -->
</div>
</div>
<div class="control-group">
<label class="control-label"><%= t(:url) %></label>
<div class="controls">
<%= @item.url %>
<!-- <p class="help-block">In addition to freeform text, any HTML5 text-based input appears like so.</p> -->
</div>
</div>
<%= link_to t(:edit), edit_admin_link_path(@item), :class => 'nav' %>

View File

@ -1,7 +0,0 @@
<% form_for :link, :url => admin_link_path(@item), :html => { :method => :delete } do |f| %>
<h2><%= t('sure?') %></h2>
<p>
<%= submit_tag t(:delete_) %>
<%= link_back %>
</p>
<% end %>

View File

@ -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) %>");

View File

@ -1,5 +0,0 @@
<% content_for :sidebar do %>
<%= render 'admin/items/site_map_left_bar' %>
<% end -%>
<%= render 'show' %>

View File

@ -1 +0,0 @@
$('#back_main').html("<%= escape_javascript(render(:partial => 'show')) %>");

View File

@ -1,7 +1 @@
<%#= flash_messages %>
<%#= page_stylesheets(@item, true).html_safe %>
<%#= page_javascripts(@item, true).html_safe %>
<%= parse_page_edit_noko(@item).html_safe %>

View File

@ -1,7 +0,0 @@
<% form_for :page, :url => admin_page_path(@item), :html => { :method => :delete } do |f| %>
<h2><%= t('sure?') %></h2>
<p>
<%= submit_tag t(:delete_) %>
<%= link_back %>
</p>
<% end %>

View File

@ -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) %>");

View File

@ -1 +0,0 @@
$('#back_main').html("<%= escape_javascript(render(:partial => 'show')) %>");