Skip to content

Commit

Permalink
Makes all in listing actions look and behave the same.
Browse files Browse the repository at this point in the history
  • Loading branch information
Frédéric de Villamil committed Aug 29, 2013
1 parent 8e5c7d8 commit d951655
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 13 deletions.
25 changes: 19 additions & 6 deletions app/helpers/admin/feedback_helper.rb
Expand Up @@ -8,12 +8,25 @@ def comment_class state

def show_feedback_actions(item, context='listing')
return if current_user.profile.label == "contributor"
content_tag(:small) do
[change_status(item, context),
content_tag(:small, link_to(_("Edit"), :controller => 'admin/feedback', :action => 'edit', :id => item.id)),
content_tag(:small, link_to(_("Delete"), {:controller => 'admin/feedback', :action => 'destroy', :id => item.id}, {:class => 'delete'})),
link_to(_("Show conversation"), :controller => 'admin/feedback', :action => 'article', :id => item.article_id)].join(" | ").html_safe
end
content_tag(:div, { :class => 'action', :style => '' }) do
[content_tag(:small, change_status(item, context)),
small_to_edit_comment(item),
small_to_delete_comment(item),
small_to_conversation(item)
].join(" | ").html_safe
end
end

def small_to_edit_comment(item)
content_tag(:small, link_to(_("Edit"), :controller => "admin/feedback", :action => 'edit', :id => item.id))
end

def small_to_delete_comment(item)
content_tag(:small, link_to(_("Delete"), {:controller => 'admin/feedback', :action => 'destroy', :id => item.id}, :class => 'delete'))
end

def small_to_conversation(item)
content_tag(:small, link_to(_("Show conversation"), :controller => 'admin/feedback', :action => 'article', :id => item.article_id))
end

def filter_link(text, filter='', style='')
Expand Down
4 changes: 2 additions & 2 deletions app/views/admin/categories/new.html.erb
Expand Up @@ -31,9 +31,9 @@
</thead>
<%= render_void_table(@categories.size, 4) %>
<% for category in @categories -%>
<tr <%= alternate_class -%> id="category_<%= category.id -%>">
<tr id="category_<%= category.id -%>">
<td>
<%= link_to_edit category.name, category %><br />
<%= link_to_edit category.name, category %>
<%= show_category_actions category %>
</td>
<td><%= h category.description %></td>
Expand Down
2 changes: 1 addition & 1 deletion app/views/admin/content/_article_list.html.erb
@@ -1,7 +1,7 @@
<%= render_empty_table(7) if @articles.empty? %>
<% for article in @articles %>
<tr <%= alternate_class %>>
<td class='article-title'>
<td>
<strong><%= link_to_edit h(article.title), article %></strong>
<%= show_actions article %>
</td>
Expand Down
2 changes: 1 addition & 1 deletion app/views/admin/feedback/_feedback.html.erb
Expand Up @@ -16,7 +16,7 @@
<small><%= format_date_time comment.created_at %></small>
</div>
</td>
<td class='article-title'>
<td>
<%= comment.html(:all) %>
<div class='action'>
<%= show_feedback_actions comment %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/admin/tags/new.html.erb
Expand Up @@ -23,7 +23,7 @@
</thead>
<%= render_void_table(@tags.size, 3) %>
<% for tag in @tags %>
<tr <%= alternate_class %>>
<tr>
<td>
<%= link_to_edit tag.display_name, tag %>
<%= show_tag_actions tag %>
Expand Down
4 changes: 2 additions & 2 deletions public/stylesheets/administration_structure.css
Expand Up @@ -30,11 +30,11 @@ td small {
font-size: 11px;
}

td.article-title .action {
tr .action {
display: none;
}

td.article-title:hover .action {
tr:hover .action {
display: block;
}

Expand Down

0 comments on commit d951655

Please sign in to comment.