Permalink
Browse files

Admin panel replaced with ActiveAdmin

  • Loading branch information...
1 parent 3a9a58c commit 434f7f70f0a2bdad1dd6498173ec89d44564eb90 @marcinbiegun committed Nov 16, 2011
Showing with 341 additions and 379 deletions.
  1. +1 −2 Gemfile
  2. +6 −7 Gemfile.lock
  3. +38 −0 app/admin/dashboards.rb
  4. +1 −0 app/assets/javascripts/active_admin.js
  5. +6 −0 app/assets/stylesheets/active_admin.css.scss
  6. +0 −3 app/assets/stylesheets/admin/admins.css.scss
  7. +8 −1 app/assets/stylesheets/application.css
  8. +0 −45 app/controllers/admin/admins_controller.rb
  9. +0 −44 app/controllers/admin/artists_controller.rb
  10. +0 −44 app/controllers/admin/external_audios_controller.rb
  11. +0 −16 app/controllers/admin/panel_controller.rb
  12. +0 −44 app/controllers/admin/releases_controller.rb
  13. +0 −44 app/controllers/admin/tracks_controller.rb
  14. +0 −2 app/helpers/admin/admins_helper.rb
  15. +0 −11 app/models/admin.rb
  16. +16 −0 app/models/admin_user.rb
  17. +0 −1 app/views/admin/panel/index.html.haml
  18. +0 −1 app/views/admin/panel/panel.html.haml
  19. +103 −0 config/initializers/active_admin.rb
  20. +29 −14 config/initializers/devise.rb
  21. +0 −50 config/locales/devise.en.yml
  22. +2 −14 config/routes.rb
  23. +25 −0 db/migrate/20111116191732_drop_admins_table.rb
  24. +31 −0 db/migrate/20111116193104_add_devise_to_admin_users.rb
  25. +16 −0 db/migrate/20111116203110_create_admin_notes.rb
  26. +25 −0 db/migrate/20111116203111_move_admin_notes_to_comments.rb
  27. +19 −6 db/schema.rb
  28. +3 −3 db/seeds.rb
  29. +11 −0 test/fixtures/admin_users.yml
  30. +0 −7 test/fixtures/admins.yml
  31. +0 −7 test/functional/admin/admins_controller_test.rb
  32. +1 −1 test/unit/{admin_test.rb → admin_user_test.rb}
  33. +0 −4 test/unit/helpers/admin/admins_helper_test.rb
  34. +0 −4 test/unit/helpers/groups_helper_test.rb
  35. +0 −4 test/unit/helpers/static_helper_test.rb
View
@@ -9,7 +9,6 @@ gem 'sqlite3'
gem 'therubyracer'
# Application
-gem 'devise'
gem 'formtastic'
gem 'haml'
gem 'haml-rails'
@@ -18,11 +17,11 @@ gem 'paperclip'
group :assets do
gem 'coffee-rails', "~> 3.1.0"
- gem 'sass-rails', " ~> 3.1.0"
gem 'uglifier'
end
# ActiveAdmin
gem 'activeadmin'
+gem 'sass-rails'
gem 'meta_search', '>= 1.1.0.pre'
View
@@ -52,10 +52,10 @@ GEM
execjs
coffee-script-source (1.1.3)
columnize (0.3.4)
- devise (1.4.9)
+ devise (1.5.0)
bcrypt-ruby (~> 3.0)
orm_adapter (~> 0.0.3)
- warden (~> 1.0.3)
+ warden (~> 1.1)
erubis (2.7.0)
execjs (1.2.9)
multi_json (~> 1.0)
@@ -82,7 +82,7 @@ GEM
json (1.6.1)
kaminari (0.12.4)
rails (>= 3.0.0)
- libv8 (3.3.10.2)
+ libv8 (3.3.10.4)
linecache19 (0.5.12)
ruby_core_source (>= 0.1.4)
mail (2.3.0)
@@ -163,10 +163,10 @@ GEM
polyglot
polyglot (>= 0.3.1)
tzinfo (0.3.31)
- uglifier (1.0.4)
+ uglifier (1.1.0)
execjs (>= 0.3.0)
multi_json (>= 1.0.2)
- warden (1.0.6)
+ warden (1.1.0)
rack (>= 1.0)
PLATFORMS
@@ -175,7 +175,6 @@ PLATFORMS
DEPENDENCIES
activeadmin
coffee-rails (~> 3.1.0)
- devise
execjs
formtastic
haml
@@ -186,7 +185,7 @@ DEPENDENCIES
rails (= 3.1.0)
rake
ruby-debug19
- sass-rails (~> 3.1.0)
+ sass-rails
sqlite3
therubyracer
uglifier
@@ -0,0 +1,38 @@
+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 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.
+
+end
@@ -0,0 +1 @@
+//= require active_admin/base
@@ -0,0 +1,6 @@
+// Active Admin CSS Styles
+@import "active_admin/mixins";
+@import "active_admin/base";
+
+// To customize the Active Admin interfaces, add your
+// styles here:
@@ -1,3 +0,0 @@
-// Place all the styles related to the admin/admins controller here.
-// They will automatically be included in application.css.
-// You can use Sass (SCSS) here: http://sass-lang.com/
@@ -2,6 +2,13 @@
* This is a manifest file that'll automatically include all the stylesheets available in this directory
* and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
* the top of the compiled file, but it's generally better to create a new file per style scope.
+ *
*= require_self
- *= require_tree .
+ *= require bootstrap-1.4
+ *= require artists/artists
+ *= require music-player/style
+ *= require releases/releases
+ *= require statics/statics
+ *= require style
*/
+
@@ -1,45 +0,0 @@
-class Admin::AdminsController < ApplicationController
-
- def index
- @admins = Admin.all
- end
-
- def show
- @admin = Admin.find(params[:id])
- end
-
- def new
- @admin = Admin.new
- end
-
- def edit
- @admin = Admin.find(params[:id])
- end
-
- def create
- @admin = Admin.new(params[:artist])
-
- if @admin.save
- redirect_to(@admin, :notice => 'Admin was successfully created.')
- else
- render :action => "new"
- end
- end
-
- def update
- @admin = Admin.find(params[:id])
-
- if @admin.update_attributes(params[:artist])
- redirect_to(@admin, :notice => 'Admin was successfully updated.')
- else
- render :action => "edit"
- end
- end
-
- def destroy
- @admin = Admin.find(params[:id])
- @admin.destroy
-
- redirect_to(admins_url)
- end
-end
@@ -1,44 +0,0 @@
-class Admin::ArtistsController < ApplicationController
- def index
- @artists = Artist.all
- end
-
- def show
- @artist = Artist.find(params[:id])
- end
-
- def new
- @artist = Artist.new
- end
-
- def edit
- @artist = Artist.find(params[:id])
- end
-
- def create
- @artist = Artist.new(params[:artist])
-
- if @artist.save
- redirect_to(@artist, :notice => 'Artist was successfully created.')
- else
- render :action => "new"
- end
- end
-
- def update
- @artist = Artist.find(params[:id])
-
- if @artist.update_attributes(params[:artist])
- redirect_to(@artist, :notice => 'Artist was successfully updated.')
- else
- render :action => "edit"
- end
- end
-
- def destroy
- @artist = Artist.find(params[:id])
- @artist.destroy
-
- redirect_to(artists_url)
- end
-end
@@ -1,44 +0,0 @@
-class Admin::ExternalAudiosController < ApplicationController
- def index
- @external_audios = ExternalAudio.all
- end
-
- def show
- @external_audio = ExternalAudio.find(params[:id])
- end
-
- def new
- @external_audio = ExternalAudio.new
- end
-
- def edit
- @external_audio = ExternalAudio.find(params[:id])
- end
-
- def create
- @external_audio = ExternalAudio.new(params[:artist])
-
- if @external_audio.save
- redirect_to(@external_audio, :notice => 'External_audio was successfully created.')
- else
- render :action => "new"
- end
- end
-
- def update
- @external_audio = ExternalAudio.find(params[:id])
-
- if @external_audio.update_attributes(params[:artist])
- redirect_to(@external_audio, :notice => 'External_audio was successfully updated.')
- else
- render :action => "edit"
- end
- end
-
- def destroy
- @external_audio = ExternalAudio.find(params[:id])
- @external_audio.destroy
-
- redirect_to(external_audios_url)
- end
-end
@@ -1,16 +0,0 @@
-class Admin::PanelController < ApplicationController
-
- #before_filter :authenticate_admin, :except => [:index]
-
- def index
- if current_admin
- redirect_to '/admin/panel'
- else
- redirect_to '/admin/login'
- end
- end
-
- def panel
- end
-
-end
@@ -1,44 +0,0 @@
-class Admin::ReleasesController < ApplicationController
- def index
- @releases = Release.all
- end
-
- def show
- @release = Release.find(params[:id])
- end
-
- def new
- @release = Release.new
- end
-
- def edit
- @release = Release.find(params[:id])
- end
-
- def create
- @release = Release.new(params[:artist])
-
- if @release.save
- redirect_to(@release, :notice => 'Release was successfully created.')
- else
- render :action => "new"
- end
- end
-
- def update
- @release = Release.find(params[:id])
-
- if @release.update_attributes(params[:artist])
- redirect_to(@release, :notice => 'Release was successfully updated.')
- else
- render :action => "edit"
- end
- end
-
- def destroy
- @release = Release.find(params[:id])
- @release.destroy
-
- redirect_to(releases_url)
- end
-end
@@ -1,44 +0,0 @@
-class Track::TracksController < ApplicationController
- def index
- @tracks = Track.all
- end
-
- def show
- @track = Track.find(params[:id])
- end
-
- def new
- @track = Track.new
- end
-
- def edit
- @track = Track.find(params[:id])
- end
-
- def create
- @track = Track.new(params[:artist])
-
- if @track.save
- redirect_to(@track, :notice => 'Track was successfully created.')
- else
- render :action => "new"
- end
- end
-
- def update
- @track = Track.find(params[:id])
-
- if @track.update_attributes(params[:artist])
- redirect_to(@track, :notice => 'Track was successfully updated.')
- else
- render :action => "edit"
- end
- end
-
- def destroy
- @track = Track.find(params[:id])
- @track.destroy
-
- redirect_to(tracks_url)
- end
-end
@@ -1,2 +0,0 @@
-module Admin::AdminsHelper
-end
View
@@ -1,11 +0,0 @@
-class Admin < ActiveRecord::Base
- # Include default devise modules. Others available are:
- # :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable
- devise :database_authenticatable, :registerable,
- :recoverable, :rememberable, :trackable, :validatable
-
- # Setup accessible (or protected) attributes for your model
- attr_accessible :email, :password, :password_confirmation, :remember_me
-
- validates_uniqueness_of :email
-end
Oops, something went wrong. Retry.

0 comments on commit 434f7f7

Please sign in to comment.