From a63163ca85d78151789a5426cc6a4aec9ed18719 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Se=C3=B1or=20Rolando?= Date: Fri, 1 Nov 2013 23:25:05 +0100 Subject: [PATCH] Remove ActiveAdmin as it's not really working that well with Rails 4 and we still don't really use it. --- app/admin/contacts.rb | 9 -- app/admin/dashboards.rb | 53 ------- config/initializers/active_admin.rb | 129 ------------------ config/routes.rb | 5 - ...0120210222344_devise_create_admin_users.rb | 55 -------- .../20120210232424_create_admin_notes.rb | 16 --- ...0210232425_move_admin_notes_to_comments.rb | 25 ---- 7 files changed, 292 deletions(-) delete mode 100644 app/admin/contacts.rb delete mode 100644 app/admin/dashboards.rb delete mode 100644 config/initializers/active_admin.rb delete mode 100644 db/migrate/20120210222344_devise_create_admin_users.rb delete mode 100644 db/migrate/20120210232424_create_admin_notes.rb delete mode 100644 db/migrate/20120210232425_move_admin_notes_to_comments.rb diff --git a/app/admin/contacts.rb b/app/admin/contacts.rb deleted file mode 100644 index 3e3a46c..0000000 --- a/app/admin/contacts.rb +++ /dev/null @@ -1,9 +0,0 @@ -ActiveAdmin.register Contact do - scope :unreleased - - index do - column :firstname - column :lastname - default_actions - end -end diff --git a/app/admin/dashboards.rb b/app/admin/dashboards.rb deleted file mode 100644 index a4d0a9f..0000000 --- a/app/admin/dashboards.rb +++ /dev/null @@ -1,53 +0,0 @@ -ActiveAdmin::Dashboards.build do - - # 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 "Recent Contacts" do - table_for Contact.order("created_at desc").limit(5) do - column :firstname - column :lastname - column :created_at - end - strong { link_to "View All Contacts", admin_contact_path } - 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/config/initializers/active_admin.rb b/config/initializers/active_admin.rb deleted file mode 100644 index b0c0a9b..0000000 --- a/config/initializers/active_admin.rb +++ /dev/null @@ -1,129 +0,0 @@ -ActiveAdmin.setup do |config| - - # == Site Title - # - # Set the title that is displayed on the main layout - # for each of the active admin pages. - # - config.site_title = "Contact o'Rama" - - # Set the link url for the title. For example, to take - # users to your main site. Defaults to no link. - # - # config.site_title_link = "/" - - # Set an optional image to be displayed for the header - # instead of a string (overrides :site_title) - # - # Note: Recommended image height is 21px to properly fit in the header - # - # config.site_title_image = "/images/logo.png" - - # == Default Namespace - # - # Set the default namespace each administration resource - # will be added to. - # - # eg: - # config.default_namespace = :hello_world - # - # This will create resources in the HelloWorld module and - # will namespace routes to /hello_world/* - # - # To set no namespace by default, use: - # config.default_namespace = false - # - # Default: - # config.default_namespace = :admin - # - # You can customize the settings for each namespace by using - # a namespace block. For example, to change the site title - # within a namespace: - # - # config.namespace :admin do |admin| - # admin.site_title = "Custom Admin Title" - # end - # - # This will ONLY change the title for the admin section. Other - # namespaces will continue to use the main "site_title" configuration. - - # == User Authentication - # - # Active Admin will automatically call an authentication - # method in a before filter of all controller actions to - # ensure that there is a currently logged in admin user. - # - # This setting changes the method which Active Admin calls - # within the controller. - config.authentication_method = :authenticate_admin_user! - - - # == Current User - # - # Active Admin will associate actions with the current - # user performing them. - # - # This setting changes the method which Active Admin calls - # to return the currently logged in user. - config.current_user_method = :current_admin_user - - - # == Logging Out - # - # Active Admin displays a logout link on each screen. These - # settings configure the location and method used for the link. - # - # This setting changes the path where the link points to. If it's - # a string, the strings is used as the path. If it's a Symbol, we - # will call the method to return the path. - # - # Default: - # config.logout_link_path = :destroy_admin_user_session_path - - # This setting changes the http method used when rendering the - # link. For example :get, :delete, :put, etc.. - # - # Default: - # config.logout_link_method = :get - - - # == Admin Comments - # - # Admin comments allow you to add comments to any model for admin use. - # Admin comments are enabled by default. - # - # Default: - # config.allow_comments = true - # - # You can turn them on and off for any given namespace by using a - # namespace config block. - # - # Eg: - # config.namespace :without_comments do |without_comments| - # without_comments.allow_comments = false - # end - - - # == Controller Filters - # - # You can add before, after and around filters to all of your - # Active Admin resources from here. - # - # config.before_filter :do_something_awesome - - - # == Register Stylesheets & Javascripts - # - # We recommend using the built in Active Admin layout and loading - # up your own stylesheets / javascripts to customize the look - # and feel. - # - # To load a stylesheet: - # config.register_stylesheet 'my_stylesheet.css' - # - # You can provide an options hash for more control, which is passed along to stylesheet_link_tag(): - # config.register_stylesheet 'my_print_stylesheet.css', :media => :print - # - # To load a javascript file: - # config.register_javascript 'my_javascript.js' -end diff --git a/config/routes.rb b/config/routes.rb index be1ffce..a93cbba 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,9 +1,4 @@ ContactORama::Application.routes.draw do - - ActiveAdmin.routes(self) - - devise_for :admin_users, ActiveAdmin::Devise.config - devise_for :users resources :users diff --git a/db/migrate/20120210222344_devise_create_admin_users.rb b/db/migrate/20120210222344_devise_create_admin_users.rb deleted file mode 100644 index aad8f29..0000000 --- a/db/migrate/20120210222344_devise_create_admin_users.rb +++ /dev/null @@ -1,55 +0,0 @@ -class DeviseCreateAdminUsers < ActiveRecord::Migration - def self.up - create_table(:admin_users) do |t| - ## Database authenticatable - t.string :email, :null => false, :default => "" - t.string :encrypted_password, :null => false, :default => "" - - ## Recoverable - t.string :reset_password_token - # t.datetime :reset_password_sent_at - - ## Rememberable - t.datetime :remember_created_at - - ## Trackable - t.integer :sign_in_count, :default => 0 - t.datetime :current_sign_in_at - t.datetime :last_sign_in_at - t.string :current_sign_in_ip - t.string :last_sign_in_ip - -## Encryptable - # t.string :password_salt - - ## Confirmable - # t.string :confirmation_token - # t.datetime :confirmed_at - # t.datetime :confirmation_sent_at - # t.string :unconfirmed_email # Only if using reconfirmable - - ## Lockable - # t.integer :failed_attempts, :default => 0 # Only if lock strategy is :failed_attempts - # t.string :unlock_token # Only if unlock strategy is :email or :both - # t.datetime :locked_at - - # Token authenticatable - # t.string :authentication_token - - t.timestamps - end - - # Create a default user - AdminUser.create!(:email => 'admin@contact-o-rama.com', :password => 'admin.password314', :password_confirmation => 'admin.password314') - - add_index :admin_users, :email, :unique => true - add_index :admin_users, :reset_password_token, :unique => true - # add_index :admin_users, :confirmation_token, :unique => true - # add_index :admin_users, :unlock_token, :unique => true - # add_index :admin_users, :authentication_token, :unique => true - end - - def self.down - drop_table :admin_users - end -end diff --git a/db/migrate/20120210232424_create_admin_notes.rb b/db/migrate/20120210232424_create_admin_notes.rb deleted file mode 100644 index a2d3247..0000000 --- a/db/migrate/20120210232424_create_admin_notes.rb +++ /dev/null @@ -1,16 +0,0 @@ -class CreateAdminNotes < ActiveRecord::Migration - def self.up - create_table :admin_notes do |t| - t.references :resource, :polymorphic => true, :null => false - t.references :admin_user, :polymorphic => true - t.text :body - t.timestamps - end - add_index :admin_notes, [:resource_type, :resource_id] - add_index :admin_notes, [:admin_user_type, :admin_user_id] - end - - def self.down - drop_table :admin_notes - end -end diff --git a/db/migrate/20120210232425_move_admin_notes_to_comments.rb b/db/migrate/20120210232425_move_admin_notes_to_comments.rb deleted file mode 100644 index 296aa43..0000000 --- a/db/migrate/20120210232425_move_admin_notes_to_comments.rb +++ /dev/null @@ -1,25 +0,0 @@ -class MoveAdminNotesToComments < ActiveRecord::Migration - def self.up - remove_index :admin_notes, [:admin_user_type, :admin_user_id] - rename_table :admin_notes, :active_admin_comments - rename_column :active_admin_comments, :admin_user_type, :author_type - rename_column :active_admin_comments, :admin_user_id, :author_id - add_column :active_admin_comments, :namespace, :string - add_index :active_admin_comments, [:namespace] - add_index :active_admin_comments, [:author_type, :author_id] - - # Update all the existing comments to the default namespace - say "Updating any existing comments to the #{ActiveAdmin.application.default_namespace} namespace." - execute "UPDATE active_admin_comments SET namespace='#{ActiveAdmin.application.default_namespace}'" - end - - def self.down - remove_index :active_admin_comments, :column => [:author_type, :author_id] - remove_index :active_admin_comments, :column => [:namespace] - remove_column :active_admin_comments, :namespace - rename_column :active_admin_comments, :author_id, :admin_user_id - rename_column :active_admin_comments, :author_type, :admin_user_type - rename_table :active_admin_comments, :admin_notes - add_index :admin_notes, [:admin_user_type, :admin_user_id] - end -end