Sha256: 6b7e1f71ebc2de5e7d74073e65733ce9acd427b987607d8aa10e94a813e0a054
Contents?: true
Size: 1.34 KB
Versions: 1
Compression:
Stored size: 1.34 KB
Contents
module BootstrapActioncell module ActioncellHelper def ac_buttons(resource,buttons=[],actions=[],options={}) options = { :clear_default_buttons => false, :edit_button => true, :delete_button => true, :edit_icon => "pencil", :delete_icon => "remove" }.deep_merge(options) unless options[:clear_default_buttons] buttons << {:path => url_for(:controller => resource.class.name.demodulize.underscore.pluralize, :action => 'edit', :id => resource.id), :options => {:class => "btn btn-mini", "data-toggle" => "tooltip", :title => "Edit"}, :icon => options[:edit_icon]} if options[:edit_button] and defined?(current_ability) and can? :update, resource buttons << {:path => url_for(:controller => resource.class.name.demodulize.underscore.pluralize, :action => 'destroy', :id => resource.id), :options => {:class => "btn btn-mini", "data-toggle" => "tooltip", :title => "Delete", :method => "delete", :confirm => "Are you sure you want to delete this #{resource.class.name.demodulize.underscore.split("_").join(" ")}?"}, :icon => options[:delete_icon]} if options[:delete_button] and defined?(current_ability) and can? :destroy, resource end render :partial => "bootstrap_actioncell/buttons", :locals => {:resource => resource, :buttons => buttons, :actions => actions} end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
bootstrap_actioncell-0.1.9 | lib/bootstrap_actioncell/actioncell_helper.rb |