Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added basic Active Admin #53

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,8 @@ gem 'amazon_flex_pay'

# Configuration File
gem 'rails_config'

# Active Admin
gem 'activeadmin'
gem 'meta_search', '>= 1.1.0.pre'
gem 'country-select'
49 changes: 49 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,18 @@ GEM
rack-cache (~> 1.2)
rack-test (~> 0.6.1)
sprockets (~> 2.2.1)
activeadmin (0.6.0)
arbre (>= 1.0.1)
bourbon (>= 1.0.0)
devise (>= 1.1.2)
fastercsv
formtastic (>= 2.0.0)
inherited_resources (>= 1.3.1)
jquery-rails (>= 1.0.0)
kaminari (>= 0.13.0)
meta_search (>= 0.9.2)
rails (>= 3.0.0)
sass (>= 3.1.0)
activemodel (3.2.13)
activesupport (= 3.2.13)
builder (~> 3.0.0)
Expand All @@ -32,7 +44,13 @@ GEM
activesupport (>= 3.0.14)
multi_xml (>= 0.5.2)
rest-client (~> 1.6.1)
arbre (1.0.1)
activesupport (>= 3.0.0)
arel (3.0.2)
bcrypt-ruby (3.0.1)
bourbon (3.1.5)
sass (>= 3.2.0)
thor
bourne (1.1.2)
mocha (= 0.10.5)
builder (3.0.4)
Expand All @@ -44,31 +62,55 @@ GEM
coffee-script-source
execjs
coffee-script-source (1.4.0)
country-select (1.1.1)
daemons (1.1.9)
devise (2.2.3)
bcrypt-ruby (~> 3.0)
orm_adapter (~> 0.1)
railties (~> 3.1)
warden (~> 1.2.1)
diff-lcs (1.1.3)
erubis (2.7.0)
eventmachine (1.0.0)
execjs (1.4.0)
multi_json (~> 1.0)
fastercsv (1.5.5)
formtastic (2.2.1)
actionpack (>= 3.0)
has_scope (0.5.1)
hike (1.2.1)
i18n (0.6.1)
inherited_resources (1.4.0)
has_scope (~> 0.5.0)
responders (~> 0.9)
journey (1.0.4)
jquery-rails (2.1.4)
railties (>= 3.0, < 5.0)
thor (>= 0.14, < 2.0)
json (1.7.7)
kaminari (0.14.1)
actionpack (>= 3.0.0)
activesupport (>= 3.0.0)
mail (2.4.4)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
meta_search (1.1.3)
actionpack (~> 3.1)
activerecord (~> 3.1)
activesupport (~> 3.1)
polyamorous (~> 0.5.0)
metaclass (0.0.1)
method_source (0.8.1)
mime-types (1.22)
mocha (0.10.5)
metaclass (~> 0.0.1)
multi_json (1.7.2)
multi_xml (0.5.3)
orm_adapter (0.4.0)
pg (0.14.1)
polyamorous (0.5.0)
activerecord (~> 3.0)
polyglot (0.3.3)
pry (0.9.10)
coderay (~> 1.0.5)
Expand Down Expand Up @@ -103,6 +145,8 @@ GEM
rake (10.0.3)
rdoc (3.12)
json (~> 1.4)
responders (0.9.3)
railties (~> 3.1)
rest-client (1.6.7)
mime-types (>= 1.16)
rspec-core (2.12.2)
Expand Down Expand Up @@ -148,15 +192,20 @@ GEM
uglifier (1.3.0)
execjs (>= 0.3.0)
multi_json (~> 1.0, >= 1.0.2)
warden (1.2.1)
rack (>= 1.0)

PLATFORMS
ruby

DEPENDENCIES
activeadmin
amazon_flex_pay
coffee-rails (~> 3.2.1)
country-select
jquery-rails
json (~> 1.7.7)
meta_search (>= 1.1.0.pre)
pg
pry-rails
rails (= 3.2.13)
Expand Down
20 changes: 20 additions & 0 deletions app/admin/admin_user.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
ActiveAdmin.register AdminUser do
index do
column :email
column :current_sign_in_at
column :last_sign_in_at
column :sign_in_count
default_actions
end

filter :email

form do |f|
f.inputs "Admin Details" do
f.input :email
f.input :password
f.input :password_confirmation
end
f.actions
end
end
30 changes: 30 additions & 0 deletions app/admin/dashboard.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
ActiveAdmin.register_page "Dashboard" do

menu :priority => 1, :label => proc{ I18n.t("active_admin.dashboard") }

content :title => proc{ I18n.t("active_admin.dashboard") } do
if AdminUser.find(1).valid_password?('password')
div :class => "blank_slate_container", :id => "dashboard_default_message" do
span :class => "blank_slate" do
span :class => "warning" do
span "Please don't forget to change the "
span link_to("default administrator password", edit_admin_admin_user_path(1))
end
end
end
br
end

columns do
column do
panel "Recent Orders" do
ul do
Order.order("created_at DESC").limit(5).map do |order|
li link_to(order.uuid, admin_order_path(order))
end
end
end
end
end
end # content
end
3 changes: 3 additions & 0 deletions app/admin/orders.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ActiveAdmin.register Order do

end
1 change: 1 addition & 0 deletions app/assets/javascripts/active_admin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//= require active_admin/base
32 changes: 32 additions & 0 deletions app/assets/stylesheets/active_admin.css.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// SASS variable overrides must be declared before loading up Active Admin's styles.
//
// To view the variables that Active Admin provides, take a look at
// `app/assets/stylesheets/active_admin/mixins/_variables.css.scss` in the
// Active Admin source.
//
// For example, to change the sidebar width:
// $sidebar-width: 242px;

// Active Admin's got SASS!
@import "active_admin/mixins";
@import "active_admin/base";

// Overriding any non-variable SASS must be done after the fact.
// For example, to change the default status-tag color:
//
// body.active_admin {
// .status_tag { background: #6090DB; }
// }
//
// Notice that Active Admin CSS rules are nested within a
// 'body.active_admin' selector to prevent conflicts with
// other pages in the app. It is best to wrap your changes in a
// namespace so they are properly recognized. You have options
// if you e.g. want different styles for different namespaces:
//
// .active_admin applies to any Active Admin namespace
// .admin_namespace applies to the admin namespace (eg: /admin)
// .other_namespace applies to a custom namespace named other (eg: /other)
.warning {
color: #FF0000;
}
11 changes: 11 additions & 0 deletions app/models/admin_user.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
class AdminUser < ActiveRecord::Base
# Include default devise modules. Others available are:
# :token_authenticatable, :confirmable,
# :lockable, :timeoutable and :omniauthable
devise :database_authenticatable,
:recoverable, :rememberable, :trackable, :validatable

# Setup accessible (or protected) attributes for your model
attr_accessible :email, :password, :password_confirmation, :remember_me
# attr_accessible :title, :body
end
Loading