diff --git a/app/admin/categories.rb b/app/admin/categories.rb index b783ff6f..6c1a4f9e 100644 --- a/app/admin/categories.rb +++ b/app/admin/categories.rb @@ -1,21 +1,17 @@ ActiveAdmin.register Category do - # This will authorize the Foobar class # The authorization is done using the AdminAbility class controller.authorize_resource # View index do - #column :id column :name, :sortable => :name column "Created", :created_at column "Updated", :updated_at column "Description", :description - #column "Slug", :slug default_actions # Add show, edit, delete column end show do - attributes_table do row :name row :access_count @@ -25,7 +21,6 @@ div do panel("Articles with this category") do - table_for(category.articles) do column "" do |article| if article.is_a? QuickAnswer @@ -36,10 +31,11 @@ link_to( "Edit", admin_guide_path(article)) end end + column "" do |article| if article.status=="Published" link_to "View", article - else + else "Draft" end end @@ -50,10 +46,7 @@ column :user column :status end - end #panel end #div - end #show - end diff --git a/app/admin/contacts.rb b/app/admin/contacts.rb index 00cb4ebc..a61806f1 100644 --- a/app/admin/contacts.rb +++ b/app/admin/contacts.rb @@ -1,17 +1,13 @@ ActiveAdmin.register Contact do - # This will authorize the Foobar class # The authorization is done using the AdminAbility class - controller.authorize_resource + controller.authorize_resource - - # View + # View index do - #column :id column "Name", :name column :department column :url column "Created", :created_at - # column :tags default_actions # Add show, edit, delete column end @@ -19,7 +15,6 @@ end show do |contact| - attributes_table do row :name row :subname @@ -32,7 +27,6 @@ div do panel("Articles with this contact") do - table_for(contact.articles) do column "" do |article| if article.is_a? QuickAnswer @@ -57,10 +51,7 @@ column :user column :status end - end end - end - end diff --git a/app/admin/dashboards.rb b/app/admin/dashboards.rb index c3b2e4c6..79887b59 100644 --- a/app/admin/dashboards.rb +++ b/app/admin/dashboards.rb @@ -31,50 +31,7 @@ column "User", :email do |user| link_to user.email, [:admin, user] end - #column "Moderator", :is_moderator end strong { link_to "View All Users", admin_users_path } end - - # Define your dashboard sections here. Each block will be - # rendered on the dashboard in the context of the view. So just - # return the content which you would like to display. - - # == Simple Dashboard Section - # Here is an example of a simple dashboard section - # - # section "Recent Posts" do - # ul do - # Post.recent(5).collect do |post| - # li link_to(post.title, admin_post_path(post)) - # end - # end - # end - - # == Render Partial Section - # The block is rendered within the context of the view, so you can - # easily render a partial rather than build content in ruby. - # - # section "Recent Posts" do - # div do - # render 'recent_posts' # => this will render /app/views/admin/dashboard/_recent_posts.html.erb - # end - # end - - # == Section Ordering - # The dashboard sections are ordered by a given priority from top left to - # bottom right. The default priority is 10. By giving a section numerically lower - # priority it will be sorted higher. For example: - # - # section "Recent Posts", :priority => 10 - # section "Recent User", :priority => 1 - # - # Will render the "Recent Users" then the "Recent Posts" sections on the dashboard. - - # == Conditionally Display - # Provide a method name or Proc object to conditionally render a section at run time. - # - # section "Membership Summary", :if => :memberships_enabled? - # section "Membership Summary", :if => Proc.new { current_admin_user.account.memberships.any? } - end diff --git a/app/admin/guide_steps.rb b/app/admin/guide_steps.rb index 6418f730..e68d4839 100644 --- a/app/admin/guide_steps.rb +++ b/app/admin/guide_steps.rb @@ -2,9 +2,9 @@ # as per https://github.com/gregbell/active_admin/wiki/Enforce-CanCan-constraints controller do load_and_authorize_resource :except => :index - def scoped_collection - end_of_association_chain.accessible_by(current_ability) - end + def scoped_collection + end_of_association_chain.accessible_by(current_ability) + end end menu :parent => "Articles" diff --git a/app/admin/guides.rb b/app/admin/guides.rb index 001ab403..c9e05169 100644 --- a/app/admin/guides.rb +++ b/app/admin/guides.rb @@ -2,27 +2,21 @@ # as per https://github.com/gregbell/active_admin/wiki/Enforce-CanCan-constraints controller do load_and_authorize_resource :except => :index - def scoped_collection - end_of_association_chain.accessible_by(current_ability) - end + def scoped_collection + end_of_association_chain.accessible_by(current_ability) + end end - # Add to :parent Dropdown menu menu :parent => "Articles" - # menu :priority => 3 - # Initialize tinymce - # tinymce_assets - # tinymce - + # Filterable attributes filter :title filter :tags filter :contact_id filter :status - + # View index do - #column :id column "Guide Title", :title do |guide| link_to guide.title, [:admin, guide] end @@ -36,14 +30,12 @@ def scoped_collection (article.user.try(:email) || "") end end - # column :tags column :slug column "Status", :status default_actions # Add show, edit, delete column end - - form :partial => "shared/admin/article_form" + form :partial => "shared/admin/article_form" show do |guide| attributes_table do diff --git a/app/admin/quick_answers.rb b/app/admin/quick_answers.rb index 81d6cc3b..25d75435 100644 --- a/app/admin/quick_answers.rb +++ b/app/admin/quick_answers.rb @@ -2,24 +2,22 @@ # as per https://github.com/gregbell/active_admin/wiki/Enforce-CanCan-constraints controller do load_and_authorize_resource :except => :index - def scoped_collection - end_of_association_chain.accessible_by(current_ability) - end + def scoped_collection + end_of_association_chain.accessible_by(current_ability) + end end # Add to :parent Dropdown menu menu :parent => "Articles" - # menu :priority => 2 - + # Filterable attributes filter :title filter :tags filter :contact_id filter :status - + # View index do - #column :id column "Quick Answer Title", :title do |article| link_to article.title, [:admin, article] end @@ -27,13 +25,12 @@ def scoped_collection column :contact column "Created", :created_at column "Author", :user do |article| - if(article.user.try(:department)) + if article.user.try(:department) (article.user.try(:email) || "") + ", " + (article.user.try(:department).name || "") else - (article.user.try(:email) || "") + article.user.try(:email) || "" end end - # column :tags column :slug column "Status", :status default_actions # Add show, edit, delete column diff --git a/app/admin/users.rb b/app/admin/users.rb index f18d8c8d..f855ece2 100644 --- a/app/admin/users.rb +++ b/app/admin/users.rb @@ -1,13 +1,10 @@ ActiveAdmin.register User do - menu :if => proc{ current_user.is_admin? || current_user.is_editor? }, :label => 'Users' - # This will authorize the Foobar class # The authorization is done using the AdminAbility class controller.authorize_resource - index do # Display only specific article db columns - #column :id + index do column :email column :is_admin column :is_editor @@ -16,7 +13,7 @@ default_actions # View/Edit/Delete column end - form do |f| # create/edit user form + form do |f| f.inputs "User Details" do f.input :email f.input :password @@ -48,5 +45,4 @@ member_action :create, :method => :post, &create_or_edit member_action :update, :method => :put, &create_or_edit - end diff --git a/app/admin/web_services.rb b/app/admin/web_services.rb index 5ef0dc0f..9e5236cb 100644 --- a/app/admin/web_services.rb +++ b/app/admin/web_services.rb @@ -2,9 +2,9 @@ # as per https://github.com/gregbell/active_admin/wiki/Enforce-CanCan-constraints controller do load_and_authorize_resource :except => :index - def scoped_collection - end_of_association_chain.accessible_by(current_ability) - end + def scoped_collection + end_of_association_chain.accessible_by(current_ability) + end end # Add to :parent Dropdown menu @@ -18,7 +18,6 @@ def scoped_collection # View index do - #column :id column "Web Service Title", :title do |article| link_to article.title, [:admin, article] end @@ -32,13 +31,10 @@ def scoped_collection (article.user.try(:email) || "") end end - # column :tags column :slug column "Status", :status default_actions # Add show, edit, delete column end - - form :partial => "shared/admin/article_form" - + form :partial => "shared/admin/article_form" end