Sha256: ee5c33d8b69fe0b50dc6c02c97b31530c22b9d2a14cf0c2778cdc543a5a395a1

Contents?: true

Size: 1.31 KB

Versions: 7

Compression:

Stored size: 1.31 KB

Contents

module ScaffoldHelper
    def default_collection_actions_for(content, scope = :admin)
      buttons = []

      if subject.can_show?(content) && lookup_context.exists?('show', lookup_context.prefixes, false)
        buttons << link_to(t('fullstack.admin.show', :default => "Show"), self.send(:"#{scope}_#{controller_name.singularize}_path", content), :class => "btn")
      end

      if subject.can_edit?(content)
        buttons << link_to(t('fullstack.admin.edit', :default => "Edit"), self.send(:"edit_#{scope}_#{controller_name.singularize}_path", content), :class => "btn")
      end

      if subject.can_destroy?(content)
        buttons << link_to(t('fullstack.admin.delete', :default => "Delete"),
                self.send(:"#{scope}_#{controller_name.singularize}_path", content),
                :confirm => t('fullstack.admin.are_you_sure', :default => "Are you sure?"), :method => "delete",
                :remote => true,  :class => "btn hide btn-danger"

                )
      end
      "#{buttons.join('&nbsp;')}".html_safe
    end

    def sort_link(method)
      method = "#{method}"
      super(@search, method, I18n.t(method, :scope => 'fullstack.admin.form.labels', :default => method.humanize))
    end
    
    def app_name
      Rails.application.class.to_s.split("::").first.underscore.humanize
    end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
fullstack-admin-0.1.18 app/helpers/scaffold_helper.rb
fullstack-admin-0.1.17 app/helpers/scaffold_helper.rb
fullstack-admin-0.1.16 app/helpers/scaffold_helper.rb
fullstack-admin-0.1.15 app/helpers/scaffold_helper.rb
fullstack-admin-0.1.14 app/helpers/scaffold_helper.rb
fullstack-admin-0.1.12 app/helpers/scaffold_helper.rb
fullstack-admin-0.1.11 app/helpers/scaffold_helper.rb