added RailsAdmin

This commit is contained in:
nilsding 2014-12-10 17:01:59 +01:00
parent a4edb4147d
commit 0eb5e8104b
4 changed files with 74 additions and 0 deletions

View File

@ -32,6 +32,8 @@ gem 'rails-assets-growl'
gem 'ruby-progressbar' gem 'ruby-progressbar'
gem 'rails_admin'
gem 'questiongenerator' gem 'questiongenerator'
group :development do group :development do

View File

@ -89,7 +89,12 @@ GEM
jquery-turbolinks (2.1.0) jquery-turbolinks (2.1.0)
railties (>= 3.1.0) railties (>= 3.1.0)
turbolinks turbolinks
jquery-ui-rails (5.0.3)
railties (>= 3.2.16)
json (1.8.1) json (1.8.1)
kaminari (0.16.1)
actionpack (>= 3.0.0)
activesupport (>= 3.0.0)
kgio (2.9.2) kgio (2.9.2)
mail (2.6.3) mail (2.6.3)
mime-types (>= 1.16, < 3) mime-types (>= 1.16, < 3)
@ -98,6 +103,7 @@ GEM
minitest (5.4.3) minitest (5.4.3)
multi_json (1.10.1) multi_json (1.10.1)
mysql2 (0.3.17) mysql2 (0.3.17)
nested_form (0.3.2)
nokogiri (1.6.5) nokogiri (1.6.5)
mini_portile (~> 0.6.0) mini_portile (~> 0.6.0)
nprogress-rails (0.1.6.3) nprogress-rails (0.1.6.3)
@ -110,6 +116,9 @@ GEM
websocket-driver (>= 0.2.0) websocket-driver (>= 0.2.0)
questiongenerator (0.0.1) questiongenerator (0.0.1)
rack (1.5.2) rack (1.5.2)
rack-pjax (0.8.0)
nokogiri (~> 1.5)
rack (~> 1.1)
rack-test (0.6.2) rack-test (0.6.2)
rack (>= 1.0) rack (>= 1.0)
rails (4.1.8) rails (4.1.8)
@ -125,6 +134,20 @@ GEM
rails-assets-growl (1.2.4) rails-assets-growl (1.2.4)
rails-assets-jquery rails-assets-jquery
rails-assets-jquery (2.1.1) rails-assets-jquery (2.1.1)
rails_admin (0.6.5)
builder (~> 3.1)
coffee-rails (~> 4.0)
font-awesome-rails (>= 3.0, < 5)
haml (~> 4.0)
jquery-rails (~> 3.0)
jquery-ui-rails (~> 5.0)
kaminari (~> 0.14)
nested_form (~> 0.3)
rack-pjax (~> 0.7)
rails (~> 4.0)
remotipart (~> 1.0)
safe_yaml (~> 1.0)
sass-rails (~> 4.0)
railties (4.1.8) railties (4.1.8)
actionpack (= 4.1.8) actionpack (= 4.1.8)
activesupport (= 4.1.8) activesupport (= 4.1.8)
@ -134,6 +157,7 @@ GEM
rake (10.4.2) rake (10.4.2)
rdoc (4.2.0) rdoc (4.2.0)
json (~> 1.4) json (~> 1.4)
remotipart (1.2.1)
responders (1.1.2) responders (1.1.2)
railties (>= 3.2, < 4.2) railties (>= 3.2, < 4.2)
rspec-core (3.0.4) rspec-core (3.0.4)
@ -153,6 +177,7 @@ GEM
rspec-support (~> 3.0.0) rspec-support (~> 3.0.0)
rspec-support (3.0.4) rspec-support (3.0.4)
ruby-progressbar (1.7.0) ruby-progressbar (1.7.0)
safe_yaml (1.0.4)
sass (3.2.19) sass (3.2.19)
sass-rails (4.0.5) sass-rails (4.0.5)
railties (>= 4.0.0, < 5.0) railties (>= 4.0.0, < 5.0)
@ -232,6 +257,7 @@ DEPENDENCIES
questiongenerator questiongenerator
rails (= 4.1.8) rails (= 4.1.8)
rails-assets-growl rails-assets-growl
rails_admin
rspec-rails (~> 3.0.0) rspec-rails (~> 3.0.0)
ruby-progressbar ruby-progressbar
sass-rails (~> 4.0.3) sass-rails (~> 4.0.3)

View File

@ -0,0 +1,45 @@
# workaround to get pagination right
if defined? WillPaginate
Kaminari.configure do |config|
config.page_method_name = :per_page_kaminari
end
end
RailsAdmin.config do |config|
config.main_app_name = ['justask', 'Kontrollzentrum']
## == Authentication ==
config.authenticate_with do
redirect_to main_app.root_path unless current_user.try :admin?
end
config.current_user_method(&:current_user)
config.actions do
dashboard # mandatory
index # mandatory
new
export
bulk_delete
show
edit
delete
show_in_app
## With an audit adapter, you can add:
# history_index
# history_show
end
=begin
config.included_models = %w[
Answer
Comment
Inbox
Question
Relationship
Smile
User
]
=end
end

View File

@ -1,5 +1,6 @@
Rails.application.routes.draw do Rails.application.routes.draw do
mount RailsAdmin::Engine => '/justask_admin', as: 'rails_admin'
get 'notifications/index' get 'notifications/index'
root 'static#index' root 'static#index'