Permalink
Browse files

Added admin stuff

  • Loading branch information...
1 parent 2285a08 commit 0e8ddb8acbbf1a94d875e30207a727e3be0bdb65 @dbousamra committed Jun 4, 2012
Showing with 209 additions and 2 deletions.
  1. +1 −1 Gemfile
  2. +29 −0 Gemfile.lock
  3. +145 −0 config/initializers/rails_admin.rb
  4. +2 −0 config/routes.rb
  5. +18 −0 db/migrate/20120604122413_create_rails_admin_histories_table.rb
  6. +14 −1 db/schema.rb
View
@@ -35,7 +35,7 @@ gem 'twitter-bootstrap-rails', :git => 'git://github.com/seyhunak/twitter-bootst
gem 'facets', :require=>false
gem 'devise'
gem 'rakismet'
-
+gem 'rails_admin'
# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
View
@@ -39,9 +39,11 @@ GEM
i18n (~> 0.6)
multi_json (~> 1.0)
arel (3.0.2)
+ bbenezech-nested_form (0.0.6)
bcrypt-ruby (3.0.1)
bootstrap-generators (2.0.1)
railties (~> 3.1)
+ bootstrap-sass (2.0.2)
builder (3.0.0)
coffee-rails (3.2.2)
coffee-script (>= 2.2.0)
@@ -64,8 +66,10 @@ GEM
execjs (1.4.0)
multi_json (~> 1.0)
facets (2.9.3)
+ haml (3.1.5)
hike (1.2.1)
hirb (0.6.2)
+ hpricot (0.8.6)
i18n (0.6.0)
irt (1.2.10)
differ (>= 0.1.1)
@@ -75,7 +79,14 @@ GEM
jquery-rails (2.0.2)
railties (>= 3.2.0, < 5.0)
thor (~> 0.14)
+ jquery-ui-rails (0.2.2)
+ jquery-rails
+ railties (>= 3.1.0)
json (1.7.3)
+ kaminari (0.13.0)
+ actionpack (>= 3.0.0)
+ activesupport (>= 3.0.0)
+ railties (>= 3.0.0)
less (2.2.1)
commonjs (~> 0.2.6)
less-rails (2.2.3)
@@ -99,6 +110,9 @@ GEM
rack (1.4.1)
rack-cache (1.2)
rack (>= 0.4)
+ rack-pjax (0.5.9)
+ hpricot (~> 0.8.6)
+ rack (~> 1.3)
rack-ssl (1.3.2)
rack
rack-test (0.6.1)
@@ -111,6 +125,19 @@ GEM
activesupport (= 3.2.3)
bundler (~> 1.0)
railties (= 3.2.3)
+ rails_admin (0.0.2)
+ bbenezech-nested_form (~> 0.0.6)
+ bootstrap-sass (~> 2.0)
+ builder (~> 3.0)
+ coffee-rails (~> 3.1)
+ haml (~> 3.1)
+ jquery-rails (>= 1.0.17)
+ jquery-ui-rails (~> 0.2.2)
+ kaminari (~> 0.12)
+ rack-pjax (~> 0.5)
+ rails (~> 3.1)
+ remotipart (~> 1.0)
+ sass-rails (~> 3.1)
railties (3.2.3)
actionpack (= 3.2.3)
activesupport (= 3.2.3)
@@ -122,6 +149,7 @@ GEM
rakismet (1.2.1)
rdoc (3.12)
json (~> 1.4)
+ remotipart (1.0.2)
sass (3.1.19)
sass-rails (3.2.5)
railties (~> 3.2.0)
@@ -168,6 +196,7 @@ DEPENDENCIES
nested_scaffold
pg
rails (= 3.2.3)
+ rails_admin
rakismet
sass-rails (~> 3.2.3)
simple_form (~> 2.0)
@@ -0,0 +1,145 @@
+# RailsAdmin config file. Generated on June 04, 2012 22:24
+# See github.com/sferik/rails_admin for more informations
+
+RailsAdmin.config do |config|
+
+ # If your default_local is different from :en, uncomment the following 2 lines and set your default locale here:
+ # require 'i18n'
+ # I18n.default_locale = :de
+
+ config.current_user_method { current_user } # auto-generated
+
+ # If you want to track changes on your models:
+ # config.audit_with :history, User
+
+ # Or with a PaperTrail: (you need to install it first)
+ # config.audit_with :paper_trail, User
+
+ # Set the admin name here (optional second array element will appear in a beautiful RailsAdmin red ©)
+ config.main_app_name = ['Subjects', 'Admin']
+ # or for a dynamic name:
+ # config.main_app_name = Proc.new { |controller| [Rails.application.engine_name.titleize, controller.params['action'].titleize] }
+
+
+ # ==> Global show view settings
+ # Display empty fields in show views
+ # config.compact_show_view = false
+
+ # ==> Global list view settings
+ # Number of default rows per-page:
+ # config.default_items_per_page = 20
+
+ # ==> Included models
+ # Add all excluded models here:
+ # config.excluded_models = [Review, Subject, User]
+
+ # Add models here if you want to go 'whitelist mode':
+ # config.included_models = [Review, Subject, User]
+
+ # Application wide tried label methods for models' instances
+ # config.label_methods << :description # Default is [:name, :title]
+
+ # ==> Global models configuration
+ # config.models do
+ # # Configuration here will affect all included models in all scopes, handle with care!
+ #
+ # list do
+ # # Configuration here will affect all included models in list sections (same for show, export, edit, update, create)
+ #
+ # fields_of_type :date do
+ # # Configuration here will affect all date fields, in the list section, for all included models. See README for a comprehensive type list.
+ # end
+ # end
+ # end
+ #
+ # ==> Model specific configuration
+ # Keep in mind that *all* configuration blocks are optional.
+ # RailsAdmin will try his best to provide the best defaults for each section, for each field.
+ # Try to override as few things as possible, in the most generic way. Try to avoid setting labels for models and attributes, use ActiveRecord I18n API instead.
+ # Less code is better code!
+ # config.model MyModel do
+ # # Cross-section field configuration
+ # object_label_method :name # Name of the method called for pretty printing an *instance* of ModelName
+ # label 'My model' # Name of ModelName (smartly defaults to ActiveRecord's I18n API)
+ # label_plural 'My models' # Same, plural
+ # weight -1 # Navigation priority. Bigger is higher.
+ # parent OtherModel # Set parent model for navigation. MyModel will be nested below. OtherModel will be on first position of the dropdown
+ # navigation_label # Sets dropdown entry's name in navigation. Only for parents!
+ # # Section specific configuration:
+ # list do
+ # filters [:id, :name] # Array of field names which filters should be shown by default in the table header
+ # items_per_page 100 # Override default_items_per_page
+ # sort_by :id # Sort column (default is primary key)
+ # sort_reverse true # Sort direction (default is true for primary key, last created first)
+ # # Here goes the fields configuration for the list view
+ # end
+ # end
+
+ # Your model's configuration, to help you get started:
+
+ # All fields marked as 'hidden' won't be shown anywhere in the rails_admin unless you mark them as visible. (visible(true))
+
+ # config.model Review do
+ # # Found associations:
+ # configure :subject, :belongs_to_association
+ # configure :user, :belongs_to_association # # Found columns:
+ # configure :id, :integer
+ # configure :subject_id, :integer # Hidden
+ # configure :difficulty, :integer
+ # configure :workload, :integer
+ # configure :review, :text
+ # configure :created_at, :datetime
+ # configure :updated_at, :datetime
+ # configure :recommend, :boolean
+ # configure :semester, :integer
+ # configure :user_id, :integer # Hidden
+ # configure :approved, :boolean # # Sections:
+ # list do; end
+ # export do; end
+ # show do; end
+ # edit do; end
+ # create do; end
+ # update do; end
+ # end
+ # config.model Subject do
+ # # Found associations:
+ # configure :reviews, :has_many_association # # Found columns:
+ # configure :id, :integer
+ # configure :code, :string
+ # configure :title, :string
+ # configure :created_at, :datetime
+ # configure :updated_at, :datetime # # Sections:
+ # list do; end
+ # export do; end
+ # show do; end
+ # edit do; end
+ # create do; end
+ # update do; end
+ # end
+ # config.model User do
+ # # Found associations:
+ # configure :reviews, :has_many_association # # Found columns:
+ # configure :id, :integer
+ # configure :email, :string
+ # configure :password, :password # Hidden
+ # configure :password_confirmation, :password # Hidden
+ # configure :reset_password_token, :string # Hidden
+ # configure :reset_password_sent_at, :datetime
+ # configure :remember_created_at, :datetime
+ # configure :sign_in_count, :integer
+ # configure :current_sign_in_at, :datetime
+ # configure :last_sign_in_at, :datetime
+ # configure :current_sign_in_ip, :string
+ # configure :last_sign_in_ip, :string
+ # configure :created_at, :datetime
+ # configure :updated_at, :datetime
+ # configure :course, :string
+ # configure :name, :string # # Sections:
+ # list do; end
+ # export do; end
+ # show do; end
+ # edit do; end
+ # create do; end
+ # update do; end
+ # end
+end
View
@@ -1,5 +1,7 @@
Subjects::Application.routes.draw do
+ mount RailsAdmin::Engine => '/admin', :as => 'rails_admin'
+
devise_for :users
root :to => 'subjects#index'
@@ -0,0 +1,18 @@
+class CreateRailsAdminHistoriesTable < ActiveRecord::Migration
+ def self.up
+ create_table :rails_admin_histories do |t|
+ t.text :message # title, name, or object_id
+ t.string :username
+ t.integer :item
+ t.string :table
+ t.integer :month, :limit => 2
+ t.integer :year, :limit => 5
+ t.timestamps
+ end
+ add_index(:rails_admin_histories, [:item, :table, :month, :year], :name => 'index_rails_admin_histories' )
+ end
+
+ def self.down
+ drop_table :rails_admin_histories
+ end
+end
View
@@ -11,7 +11,20 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20120604082932) do
+ActiveRecord::Schema.define(:version => 20120604122413) do
+
+ create_table "rails_admin_histories", :force => true do |t|
+ t.text "message"
+ t.string "username"
+ t.integer "item"
+ t.string "table"
+ t.integer "month", :limit => 2
+ t.integer "year", :limit => 5
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ add_index "rails_admin_histories", ["item", "table", "month", "year"], :name => "index_rails_admin_histories"
create_table "reviews", :force => true do |t|
t.integer "subject_id"

0 comments on commit 0e8ddb8

Please sign in to comment.