Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 27 additions & 26 deletions app/views/admin/pages/tabs/_snippets_field.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -14,32 +14,33 @@
</ul>
<% end %>
</div>

<div class="inactive-snippets">
<% inactive_snippets = Snippet.all %>
<% if inactive_snippets.length > 0 %>
<h2><%= t('.inactive') %></h2>
<ul>
<% inactive_snippets.each do |snippet| %>
<li class='clearfix record <%= cycle('on', 'on-hover') %>' >
<span class="title"><%= snippet.title %></span>
<div class="actions">
<% unless snippet.after?(part) %>
<%= link_to t('.add_after_body'), {:controller => 'snippets_page_parts', :action => 'add', :id => @page.id, :snippet_id => snippet.id, :part_id => part.id}, :class => 'add_icon add-snippet' %>
<% else %>
<span class="add_icon add-snippet"><%= t('.add_after_body') %></span>
<% end %>
<% unless snippet.before?(part) %>
<%= link_to t('.add_before_body'), {:controller => 'snippets_page_parts', :action => 'add', :id => @page.id, :snippet_id => snippet.id, :part_id => part.id, :before_body => 'true'}, :class => 'add_icon add-snippet' %>
<% else %>
<span class="add_icon add-snippet"><%= t('.add_before_body') %></span>
<% end %>
</div>
</li>
<% end %>
</ul>
<% end %>
</div>
<% if ::Refinery::Plugins.active.names.include?("snippets") %>
<div class="inactive-snippets">
<% inactive_snippets = Snippet.all %>
<% if inactive_snippets.length > 0 %>
<h2><%= t('.inactive') %></h2>
<ul>
<% inactive_snippets.each do |snippet| %>
<li class='clearfix record <%= cycle('on', 'on-hover') %>' >
<span class="title"><%= snippet.title %></span>
<div class="actions">
<% unless snippet.after?(part) %>
<%= link_to t('.add_after_body'), {:controller => 'snippets_page_parts', :action => 'add', :id => @page.id, :snippet_id => snippet.id, :part_id => part.id}, :class => 'add_icon add-snippet' %>
<% else %>
<span class="add_icon add-snippet"><%= t('.add_after_body') %></span>
<% end %>
<% unless snippet.before?(part) %>
<%= link_to t('.add_before_body'), {:controller => 'snippets_page_parts', :action => 'add', :id => @page.id, :snippet_id => snippet.id, :part_id => part.id, :before_body => 'true'}, :class => 'add_icon add-snippet' %>
<% else %>
<span class="add_icon add-snippet"><%= t('.add_before_body') %></span>
<% end %>
</div>
</li>
<% end %>
</ul>
<% end %>
</div>
<% end %>
</div>


Expand Down
16 changes: 9 additions & 7 deletions app/views/admin/pages/tabs/_snippets_list_item.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@
</span>
<% end %>
</span>
<span class='actions'>
<%= link_to refinery_icon_tag('application_edit.png'), edit_admin_snippet_path(snippet),
:title => t('.edit') %>
<%= link_to refinery_icon_tag('delete.png'), url_for({:controller => 'snippets_page_parts', :action => 'remove', :id => @page.id, :snippet_id => snippet.id, :part_id => part.id, :before_body => before_body}),
:title => t('.remove'),
:class => 'remove-snippet' %>
</span>
<% if ::Refinery::Plugins.active.names.include?("snippets") %>
<span class='actions'>
<%= link_to refinery_icon_tag('application_edit.png'), edit_admin_snippet_path(snippet),
:title => t('.edit') %>
<%= link_to refinery_icon_tag('delete.png'), url_for({:controller => 'snippets_page_parts', :action => 'remove', :id => @page.id, :snippet_id => snippet.id, :part_id => part.id, :before_body => before_body}),
:title => t('.remove'),
:class => 'remove-snippet' %>
</span>
<% end %>
</li>