<% content_for(:html_head) do %> <%= javascript_include_tag "cms/content_library" %> <% javascript_tag do %> jQuery(function($){ var collectionName = '<%= content_type.model_class.name.underscore.pluralize %>' $('table.data tbody tr').hover(function(){ $(this).addClass('hover') }, function(){ $(this).removeClass('hover') }).click(function(){ var match = this.id.match(/(.*)_(\d+)/) var type = match[1] var id = match[2] var editable = !$(this).hasClass("non-editable") var publishable = !$(this).hasClass("non-publishable") $('table.data tbody tr').removeClass('selected') $(this).addClass('selected') $('#functions .button').addClass('disabled').attr('href','#') $('#add_button').removeClass('disabled').attr('href', '/cms/'+collectionName+'/new') $('#view_button').removeClass('disabled').attr('href', '/cms/'+collectionName+'/'+id) if (editable) $('#edit_button').removeClass('disabled').attr('href', '/cms/'+collectionName+'/'+id+'/edit') <% if content_type.model_class.versioned? %> $('#revisions_button').removeClass('disabled').attr('href', '/cms/'+collectionName+'/'+id+'/versions') <% else %> $('#revisions_button').addClass('disabled') .attr('title', '<%= content_type.display_name.pluralize.titleize %> are not versioned') <% end %> var cannot_be_deleted_message = $(this).find('.cannot_be_deleted_message') if(cannot_be_deleted_message.length > 0) { $('#delete_button').addClass('disabled') .attr('title', $.trim(cannot_be_deleted_message.text())) } else { if (publishable) { $('#delete_button').removeClass('disabled') .attr('href', '/cms/'+collectionName+'/'+id) .attr('title', 'Are You Sure You Want To Delete This Record?') } } <% able_to? :publish_content do -%> if($(this).hasClass('draft') && publishable) { $('#publish_button').removeClass('disabled').attr('href', '/cms/'+collectionName+'/'+id+'/publish?_redirect_to='+location.href) } <% end %> }) }) <% end %> <%= stylesheet_link_tag "cms/content_library" %> <% end %> <% page_title "Content Library / List #{content_type.display_name_plural}" %> <% @toolbar_title = "List #{content_type.display_name_plural}" %> <%= render :partial => 'cms/blocks/toolbar' %>
<% content_type.columns_for_index.each_with_index do |column, i| %> <% attrs = if !content_type.model_class.respond_to?(:updated_at) && !content_type.model_class.connectable? && !content_type.model_class.publishable? && content_type.columns_for_index.size == i + 1 %Q{ colspan="2" class="last"} elsif i == 0 %Q{ colspan="2" class="name first"} end %> >
<% if column[:order] %> <%= link_to column[:label], cms_index_path_for(content_type, :order => determine_order(params[:order], column[:order])) %> <% else %> <%= column[:label] %> <% end %>
<% end %> <% if content_type.model_class.respond_to?(:updated_at) %>
<% end %> <% if content_type.model_class.connectable? %><% end %> <% if content_type.model_class.publishable? %><% end %> <% col_ct = 2 col_ct += content_type.columns_for_index.size col_ct += 1 if content_type.model_class.respond_to?(:updated_at) col_ct += 1 if content_type.model_class.connectable? col_ct += 1 if content_type.model_class.publishable? %> <% @blocks.each do |b| %> <% block = b.class.versioned? ? b.as_of_draft_version : b %> <% content_type.columns_for_index.each_with_index do |column, i| %> <% end %> <% if content_type.model_class.respond_to?(:updated_at) %><% end %> <% if content_type.model_class.connectable? %><% end %> <% if content_type.model_class.publishable? %><% end %> <% end %>
Updated
Used
Status
> <%= block.send(column[:method]) %> <% if i.zero? && block.respond_to?(:cannot_be_deleted_message) && block.cannot_be_deleted_message %> <% end %>
<%= block.updated_at.to_s(:date) %>
<%= block.connected_pages.count %>
<%= status_icon(block.status) %>
<%= block.status %>
<% if params[:search] && @blocks.size == 0 %> <% elsif @blocks.total_pages > 1 %> <%= render_pagination @blocks, content_type.content_block_type, :order => params[:order], :search => params[:search] %> <% end %>