Sha256: 862ec84dbce9ec165322b0e6cd6f2aac5c438bdec5f2b3d229eaf7059f820661
Contents?: true
Size: 1.98 KB
Versions: 3
Compression:
Stored size: 1.98 KB
Contents
module Refinery module <%= namespacing %> module Admin class <%= class_name.pluralize %>Controller < Refinery::AdminController crudify :'refinery/<%= namespacing.underscore %>/<%= singular_name %>', <% if (title = attributes.detect { |a| a.refinery_type.to_s == "string" }).present? %> :title_attribute => "<%= title.name %>", <% end %> :order => "created_at DESC" <% if include_spam? -%> before_action :get_spam_count, :only => [:index, :spam] def index @<%= plural_name %> = find_all_<%= plural_name %>.ham @<%= plural_name %> = @<%= plural_name %>.with_query(params[:search]) if searching? @grouped_<%= plural_name %> = group_by_date(@<%= plural_name %>) end def spam @<%= plural_name %> = find_all_<%= plural_name %>.spam @<%= plural_name %> = @<%= plural_name %>.with_query(params[:search]) if searching? @grouped_<%= plural_name %> = group_by_date(@<%= plural_name %>) end def toggle_spam find_<%= singular_name %> @<%= singular_name %>.toggle!(:spam) redirect_to :back end protected def get_spam_count @spam_count = <%= class_name %>.count(:conditions => {:spam => true}) end <% else %> def index if searching? search_all_<%= plural_name %> else find_all_<%= plural_name %> end @grouped_<%= plural_name %> = group_by_date(@<%= plural_name %>) end <% end -%> private # Only allow a trusted parameter "white list" through. def <%= "#{singular_table_name}_params" %> <%- if attributes_names.empty? -%> params[:<%= singular_table_name %>] <%- else -%> params.require(:<%= singular_table_name %>).permit(<%= attributes.map { |attr| ":#{attr.column_name}" }.join(', ') %>) <%- end -%> end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems