aerogel-admin 1.4.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +13 -0
- data/Rakefile +1 -0
- data/aerogel-admin.gemspec +31 -0
- data/app/helpers/admin.rb +54 -0
- data/app/helpers/decorators.rb +29 -0
- data/app/helpers/icons.rb +11 -0
- data/app/helpers/table_builder.rb +8 -0
- data/app/helpers/tabs_builder.rb +7 -0
- data/app/routes/admin.rb +37 -0
- data/app/routes/users.rb +71 -0
- data/app/routes/users_access.rb +54 -0
- data/app/routes/users_roles.rb +53 -0
- data/assets/fonts/aerogel-icons.css +28 -0
- data/assets/fonts/aerogel-icons.eot +0 -0
- data/assets/fonts/aerogel-icons.svg +11 -0
- data/assets/fonts/aerogel-icons.ttf +0 -0
- data/assets/fonts/aerogel-icons.woff +0 -0
- data/assets/javascripts/.gitkeep +0 -0
- data/assets/javascripts/controllers/admin-modal.js.coffee +7 -0
- data/assets/javascripts/controllers/admin-modal/admin-modal-form-buttons.js.coffee +56 -0
- data/assets/javascripts/controllers/admin.js.coffee +13 -0
- data/assets/javascripts/controllers/admin/selectize-inputs.js.coffee +7 -0
- data/assets/javascripts/controllers/admin/top-menu-shadow.js.coffee +9 -0
- data/assets/javascripts/utils/ajax-spinner.js.coffee +26 -0
- data/assets/javascripts/utils/ajax-watcher.js.coffee +18 -0
- data/assets/javascripts/utils/bootstrap-modal-reload.js.coffee +8 -0
- data/assets/javascripts/utils/form-data-async.js.coffee +27 -0
- data/assets/javascripts/utils/i18n.js.coffee +27 -0
- data/assets/javascripts/utils/on-future-elements.js.coffee +15 -0
- data/assets/stylesheets/admin/bootstrap-settings.css.scss +33 -0
- data/assets/stylesheets/admin/global.css.scss +61 -0
- data/assets/stylesheets/admin/styles/ajax-indicator.css.scss +26 -0
- data/assets/stylesheets/admin/styles/bootstrap-modal.css.scss +24 -0
- data/assets/stylesheets/admin/styles/language-selector.css.scss +5 -0
- data/assets/stylesheets/admin/styles/page-header.css.scss +7 -0
- data/assets/stylesheets/admin/styles/sticky-footer-navbar.css.scss +34 -0
- data/assets/stylesheets/admin/styles/table.css.scss +3 -0
- data/assets/stylesheets/admin/styles/top-menu.css.scss +3 -0
- data/assets/stylesheets/admin/utils/center-absolutely.css.scss +5 -0
- data/assets/stylesheets/controllers/admin.css.scss +14 -0
- data/assets/vendor/bootstrap-datetimepicker.css.scss +1 -0
- data/assets/vendor/bootstrap-datetimepicker.js.coffee +1 -0
- data/assets/vendor/bootstrap-datetimepicker/bootstrap-datetimepicker.min.css +5 -0
- data/assets/vendor/bootstrap-datetimepicker/bootstrap-datetimepicker.min.js +1 -0
- data/assets/vendor/bootstrap-datetimepicker/bootstrap-datetimepicker.ru.js +163 -0
- data/assets/vendor/moment.js.coffee +1 -0
- data/assets/vendor/momentjs/moment-with-langs.min.js +9 -0
- data/assets/vendor/selectize.css.scss +2 -0
- data/assets/vendor/selectize.js.coffee +1 -0
- data/assets/vendor/selectize/selectize.bootstrap3.css +385 -0
- data/assets/vendor/selectize/selectize.css +311 -0
- data/assets/vendor/selectize/selectize.default.css +381 -0
- data/assets/vendor/selectize/selectize.js +3345 -0
- data/assets/vendor/smart-list-table.css.scss +42 -0
- data/assets/vendor/smart-list-table.js.coffee +1 -0
- data/assets/vendor/smart-list-table/smart-list-table-row.js.coffee +63 -0
- data/assets/vendor/smart-list-table/smart-list-table.css.scss +54 -0
- data/assets/vendor/smart-list-table/smart-list-table.js.coffee +133 -0
- data/assets/vendor/smart-tree-table.css.scss +42 -0
- data/assets/vendor/smart-tree-table.js.coffee +1 -0
- data/assets/vendor/smart-tree-table/smart-tree-table-drag-n-drop.js.coffee +190 -0
- data/assets/vendor/smart-tree-table/smart-tree-table-row.js.coffee +78 -0
- data/assets/vendor/smart-tree-table/smart-tree-table.css.scss +54 -0
- data/assets/vendor/smart-tree-table/smart-tree-table.js.coffee +267 -0
- data/assets/vendor/spin.js +353 -0
- data/config/README.md +3 -0
- data/config/development/.keep +0 -0
- data/config/production/.keep +0 -0
- data/db/model/README.md +1 -0
- data/db/model/admin/user_new_form.rb +40 -0
- data/db/model/user.rb +26 -0
- data/db/seed/01_admin_roles.seed +8 -0
- data/db/seed/02_admin_access.seed +24 -0
- data/db/seed/development/.keep +0 -0
- data/db/seed/development/20_users.seed +45 -0
- data/db/seed/development/admin_users.seed +38 -0
- data/db/seed/production/.keep +0 -0
- data/lib/aerogel/admin.rb +25 -0
- data/lib/aerogel/admin/core.rb +14 -0
- data/lib/aerogel/admin/menu.rb +38 -0
- data/lib/aerogel/admin/table_builder.rb +100 -0
- data/lib/aerogel/admin/tabs_builder.rb +69 -0
- data/lib/aerogel/admin/version.rb +5 -0
- data/locales/actions.en.yml +27 -0
- data/locales/actions.ru.yml +28 -0
- data/locales/admin.en.yml +14 -0
- data/locales/admin.ru.yml +14 -0
- data/locales/models.en.yml +8 -0
- data/locales/models.ru.yml +8 -0
- data/locales/views.en.yml +46 -0
- data/locales/views.ru.yml +46 -0
- data/public/README.md +1 -0
- data/rake/README.md +3 -0
- data/views/admin/index.html.erb +3 -0
- data/views/admin/table_builder/standard/_table_column.html.erb +3 -0
- data/views/admin/table_builder/standard/_table_row.html.erb +7 -0
- data/views/admin/table_builder/standard/table.html.erb +10 -0
- data/views/admin/tabs_builder/standard/_tab.html.erb +3 -0
- data/views/admin/tabs_builder/standard/tabs.html.erb +3 -0
- data/views/admin/users/_tabs.html.erb +8 -0
- data/views/admin/users/access/delete.html.erb +12 -0
- data/views/admin/users/access/edit.html.erb +9 -0
- data/views/admin/users/access/index.html.erb +23 -0
- data/views/admin/users/access/new.html.erb +9 -0
- data/views/admin/users/delete.html.erb +12 -0
- data/views/admin/users/edit.html.erb +46 -0
- data/views/admin/users/index.html.erb +31 -0
- data/views/admin/users/new.html.erb +11 -0
- data/views/admin/users/roles/delete.html.erb +12 -0
- data/views/admin/users/roles/edit.html.erb +9 -0
- data/views/admin/users/roles/index.html.erb +21 -0
- data/views/admin/users/roles/new.html.erb +7 -0
- data/views/form_builder/standard/field_multiselect.erb +14 -0
- data/views/form_builder/standard/field_select.erb +17 -0
- data/views/layouts/admin.html.erb +63 -0
- data/views/layouts/admin/_ajax_indicator.html.erb +4 -0
- data/views/layouts/admin/_alerts.html.erb +22 -0
- data/views/layouts/admin/_menu.html.erb +50 -0
- data/views/layouts/admin/_menu_item.html.erb +5 -0
- data/views/layouts/admin/_modals.html.erb +8 -0
- data/views/layouts/admin/modal.html.erb +38 -0
- metadata +280 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: bc0ccafb5b79a5c1d23aa8b96b8c55337f5b397d
|
4
|
+
data.tar.gz: 0ab68d3e63d9db24776da846dc77595dc2bd1927
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5149fb9f86505ebcab497404144cf784ae13a11639e89cfdaf4739092780d4f36e8d68b1d6720e4ee2cc7c93a8cd5fd504c3e92a0d293f027eea4ecc1e8850e7
|
7
|
+
data.tar.gz: 07471fb38a1cec4ee74b3a78b49be48a74ac948ce7765bfcfde88c382b50f7cffd805311f8d76f392e59e9ddee9acda91bb94d4d6205e881b5647c939958f227
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Alex Kukushkin
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'aerogel/admin/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "aerogel-admin"
|
8
|
+
spec.version = Aerogel::Admin::VERSION
|
9
|
+
spec.authors = ["Alex Kukushkin"]
|
10
|
+
spec.email = ["alex@kukushk.in"]
|
11
|
+
spec.description = %q{Admin panel for aerogel CMS}
|
12
|
+
spec.summary = %q{Admin panel for aerogel CMS}
|
13
|
+
spec.homepage = "https://github.com/kukushkin/aerogel-admin"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_dependency "aerogel-core", "~> 1.4"
|
22
|
+
spec.add_dependency "aerogel-forms"
|
23
|
+
spec.add_dependency "aerogel-users", "~> 1.4"
|
24
|
+
spec.add_dependency "aerogel-media", "~> 1.4"
|
25
|
+
spec.add_dependency "aerogel-bootstrap"
|
26
|
+
spec.add_dependency "aerogel-font_awesome"
|
27
|
+
|
28
|
+
|
29
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
30
|
+
spec.add_development_dependency "rake"
|
31
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
#
|
2
|
+
# Admin helpers
|
3
|
+
#
|
4
|
+
|
5
|
+
# Defines a menu item
|
6
|
+
#
|
7
|
+
def admin_menu( url, opts = {} )
|
8
|
+
Aerogel::Admin::Menu::Item.create url, opts
|
9
|
+
end
|
10
|
+
|
11
|
+
# Returns list of menu items ordered by priority
|
12
|
+
#
|
13
|
+
def admin_menu_items
|
14
|
+
Aerogel::Admin::Menu.instance.items.sort_by( &:priority )
|
15
|
+
end
|
16
|
+
|
17
|
+
# Renders a link to open a modal window with remote content.
|
18
|
+
#
|
19
|
+
def link_to_modal( url, *args, &block )
|
20
|
+
opts = (String === args.first) ? args[1] : args[0]
|
21
|
+
opts = {
|
22
|
+
href: url,
|
23
|
+
'data-toggle' => 'modal',
|
24
|
+
'data-target' => '#adminModal'
|
25
|
+
}.deep_merge( opts || {} )
|
26
|
+
if String === args.first
|
27
|
+
args[1] = opts
|
28
|
+
else
|
29
|
+
args[0] = opts
|
30
|
+
end
|
31
|
+
tag :a, *args, &block
|
32
|
+
end
|
33
|
+
|
34
|
+
# Renders a link to open a modal window with remote content,
|
35
|
+
# if this operation is allowed.
|
36
|
+
# Renders a plain text otherwise.
|
37
|
+
#
|
38
|
+
def link_to_modal_if_can( url, text, opts = {} )
|
39
|
+
if can? url
|
40
|
+
link_to_modal url, text, opts
|
41
|
+
else
|
42
|
+
text
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
# Creates a <button ...>...</button> tag.
|
47
|
+
#
|
48
|
+
def button_to( url, text = url, opts = {} )
|
49
|
+
opts = {
|
50
|
+
class: "btn btn-default",
|
51
|
+
href: url
|
52
|
+
}.deep_merge opts
|
53
|
+
tag :a, text, opts
|
54
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# Renders UserEmail.confirmed attribute as icon
|
2
|
+
#
|
3
|
+
def user_email_confirmed_as_icon( email )
|
4
|
+
email.confirmed ?
|
5
|
+
icon( "glyphicon-ok-sign", title: t.aerogel.admin.decorators.confirmed, style: "color: green" ) :
|
6
|
+
icon( "glyphicon-question-sign", title: t.aerogel.admin.decorators.not_confirmed )
|
7
|
+
end
|
8
|
+
|
9
|
+
# Renders UserEmail.confirmed attribute as label
|
10
|
+
#
|
11
|
+
def user_email_confirmed_as_label( email )
|
12
|
+
email.confirmed ?
|
13
|
+
"<span class='label label-success'>#{t.aerogel.admin.decorators.confirmed}</span>" :
|
14
|
+
"<span class='label label-default'>#{t.aerogel.admin.decorators.not_confirmed}</span>"
|
15
|
+
end
|
16
|
+
|
17
|
+
# Renders Authentication provier as icon.
|
18
|
+
#
|
19
|
+
def auth_provider_as_icon( provider_key )
|
20
|
+
provider = Aerogel::Auth.providers[provider_key]
|
21
|
+
icon provider[:icon], title: provider[:name]
|
22
|
+
end
|
23
|
+
|
24
|
+
# Renders Authentication provier as icon.
|
25
|
+
#
|
26
|
+
def auth_provider_as_text( provider_key )
|
27
|
+
provider = Aerogel::Auth.providers[provider_key]
|
28
|
+
provider[:name]
|
29
|
+
end
|
data/app/routes/admin.rb
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
namespace "/admin" do
|
2
|
+
|
3
|
+
# admin_menu "/admin/lorem", label: 'Lorem'
|
4
|
+
|
5
|
+
before do
|
6
|
+
if request.xhr?
|
7
|
+
layout "admin/modal"
|
8
|
+
else
|
9
|
+
layout "admin"
|
10
|
+
end
|
11
|
+
|
12
|
+
on_access_denied do |path|
|
13
|
+
redirect "/user/login?on_success=#{path}" unless current_user?
|
14
|
+
redirect "/admin/" if can? "/admin/"
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
|
19
|
+
get "/" do
|
20
|
+
flash.now[:notice] = "Welcome, admin!"
|
21
|
+
pass
|
22
|
+
end
|
23
|
+
|
24
|
+
get "/lorem" do
|
25
|
+
view "lorem"
|
26
|
+
end
|
27
|
+
|
28
|
+
#
|
29
|
+
# Common User controller routes
|
30
|
+
#
|
31
|
+
route :get, :post, ['/', '/:action'] do
|
32
|
+
action = params[:action] || 'index'
|
33
|
+
view "admin/#{action}"
|
34
|
+
end
|
35
|
+
|
36
|
+
|
37
|
+
end
|
data/app/routes/users.rb
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
namespace "/admin/users" do
|
2
|
+
|
3
|
+
admin_menu "/admin/users/", icon: 'fa-users', label: :'aerogel.admin.panes.users', priority: 90
|
4
|
+
|
5
|
+
get "/" do
|
6
|
+
pass
|
7
|
+
end
|
8
|
+
|
9
|
+
get "/new" do
|
10
|
+
@admin_user_new_form = ::Admin::UserNewForm.new
|
11
|
+
pass
|
12
|
+
end
|
13
|
+
|
14
|
+
post "/new" do
|
15
|
+
@admin_user_new_form = ::Admin::UserNewForm.new( params[:admin_user_new_form] )
|
16
|
+
pass unless @admin_user_new_form.valid?
|
17
|
+
user = User.create_from_admin_user_new_form @admin_user_new_form
|
18
|
+
unless user.save
|
19
|
+
flash[:error] = t.aerogel.db.errors.failed_to_save name: User.model_name.human,
|
20
|
+
errors: user.errors.full_messages.join(", ")
|
21
|
+
pass
|
22
|
+
end
|
23
|
+
user.request_activation!
|
24
|
+
email 'user/account_activation', user
|
25
|
+
authentication = user.request_password_reset! @admin_user_new_form.email
|
26
|
+
email 'user/password_reset', authentication
|
27
|
+
redirect '/admin/users/', notice: t.aerogel.admin.actions.users.created( name: h( user.full_name ) )
|
28
|
+
end
|
29
|
+
|
30
|
+
get "/:id/edit" do
|
31
|
+
@user = User.find( params[:id] ) or halt 404
|
32
|
+
pass
|
33
|
+
end
|
34
|
+
|
35
|
+
post "/:id/edit" do
|
36
|
+
@user = User.find( params[:id] ) or halt 404
|
37
|
+
if @user.update_attributes params[:user].except( :emails, :authentications )
|
38
|
+
redirect '/admin/users/', notice: t.aerogel.admin.actions.users.updated( name: h( @user.full_name ) )
|
39
|
+
end
|
40
|
+
flash.now[:error] = t.aerogel.db.errors.failed_to_save( name: h( @user.full_name ),
|
41
|
+
errors: @user.errors.full_messages.join(", ")
|
42
|
+
)
|
43
|
+
pass
|
44
|
+
end
|
45
|
+
|
46
|
+
get "/:id/delete" do
|
47
|
+
@user = User.find( params[:id] ) or halt 404
|
48
|
+
pass
|
49
|
+
end
|
50
|
+
|
51
|
+
post "/:id/delete" do
|
52
|
+
@user = User.find( params[:id] ) or halt 404
|
53
|
+
if current_user == @user
|
54
|
+
redirect '/admin/users/', error: t.aerogel.admin.actions.users.failed_to_delete_self
|
55
|
+
else
|
56
|
+
@user.destroy
|
57
|
+
redirect '/admin/users/', notice: t.aerogel.admin.actions.users.deleted( name: h(@user.full_name) )
|
58
|
+
end
|
59
|
+
pass
|
60
|
+
end
|
61
|
+
|
62
|
+
#
|
63
|
+
# Common User controller routes
|
64
|
+
#
|
65
|
+
route :get, :post, ['/', '/:action', '/:id/:action'] do
|
66
|
+
action = params[:action] || 'index'
|
67
|
+
pass if params[:id] and [:roles, :access].include? params[:id].to_sym
|
68
|
+
view "admin/users/#{action}"
|
69
|
+
end
|
70
|
+
|
71
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
namespace "/admin/users/access" do
|
2
|
+
|
3
|
+
|
4
|
+
get "/" do
|
5
|
+
pass
|
6
|
+
end
|
7
|
+
|
8
|
+
get "/new" do
|
9
|
+
@access = Access.new
|
10
|
+
pass
|
11
|
+
end
|
12
|
+
|
13
|
+
post "/new" do
|
14
|
+
@access = Access.new( params[:access] )
|
15
|
+
pass unless @access.save
|
16
|
+
redirect '/admin/users/access/', notice: t.aerogel.admin.actions.users_access.created( name: @access.path )
|
17
|
+
end
|
18
|
+
|
19
|
+
get "/:id/edit" do
|
20
|
+
@access = Access.find( params[:id] ) or halt 404
|
21
|
+
pass
|
22
|
+
end
|
23
|
+
|
24
|
+
post "/:id/edit" do
|
25
|
+
@access = Access.find( params[:id] ) or halt 404
|
26
|
+
if @access.update_attributes params[:access].except( :path_matcher )
|
27
|
+
redirect '/admin/users/access/', notice: t.aerogel.admin.actions.users_access.updated( name: @access.path )
|
28
|
+
end
|
29
|
+
flash.now[:error] = t.aerogel.db.errors.failed_to_save name: Access.model_name.human,
|
30
|
+
errors: @access.errors.full_messages.join(", ")
|
31
|
+
pass
|
32
|
+
end
|
33
|
+
|
34
|
+
get "/:id/delete" do
|
35
|
+
@access = Access.find( params[:id] ) or halt 404
|
36
|
+
pass
|
37
|
+
end
|
38
|
+
|
39
|
+
post "/:id/delete" do
|
40
|
+
@access = Access.find( params[:id] ) or halt 404
|
41
|
+
@access.destroy
|
42
|
+
redirect '/admin/users/access/', notice: t.aerogel.admin.actions.users_access.deleted( name: @access.path )
|
43
|
+
pass
|
44
|
+
end
|
45
|
+
|
46
|
+
#
|
47
|
+
# Common User/Access controller routes
|
48
|
+
#
|
49
|
+
route :get, :post, ['/', '/:action', '/:id/:action'] do
|
50
|
+
action = params[:action] || 'index'
|
51
|
+
view "admin/users/access/#{action}"
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
namespace "/admin/users/roles" do
|
2
|
+
|
3
|
+
get "/" do
|
4
|
+
pass
|
5
|
+
end
|
6
|
+
|
7
|
+
get "/new" do
|
8
|
+
@role = Role.new
|
9
|
+
pass
|
10
|
+
end
|
11
|
+
|
12
|
+
post "/new" do
|
13
|
+
@role = Role.new( params[:role] )
|
14
|
+
pass unless @role.save
|
15
|
+
redirect '/admin/users/roles/', notice: t.aerogel.admin.actions.users_roles.created( name: @role.name )
|
16
|
+
end
|
17
|
+
|
18
|
+
get "/:id/edit" do
|
19
|
+
@role = Role.find( params[:id] ) or halt 404
|
20
|
+
pass
|
21
|
+
end
|
22
|
+
|
23
|
+
post "/:id/edit" do
|
24
|
+
@role = Role.find( params[:id] ) or halt 404
|
25
|
+
if @role.update_attributes params[:role]
|
26
|
+
redirect '/admin/users/roles/', notice: t.aerogel.admin.actions.users_roles.updated( name: @role.name )
|
27
|
+
end
|
28
|
+
flash.now[:error] = t.aerogel.db.errors.failed_to_save name: Role.model_name.human,
|
29
|
+
errors: @role.errors.full_messages.join(", ")
|
30
|
+
pass
|
31
|
+
end
|
32
|
+
|
33
|
+
get "/:id/delete" do
|
34
|
+
@role = Role.find( params[:id] ) or halt 404
|
35
|
+
pass
|
36
|
+
end
|
37
|
+
|
38
|
+
post "/:id/delete" do
|
39
|
+
@role = Role.find( params[:id] ) or halt 404
|
40
|
+
@role.destroy
|
41
|
+
redirect '/admin/users/roles/', notice: t.aerogel.admin.actions.users_roles.deleted( name: @role.name )
|
42
|
+
pass
|
43
|
+
end
|
44
|
+
|
45
|
+
#
|
46
|
+
# Common User/Roles controller routes
|
47
|
+
#
|
48
|
+
route :get, :post, ['/', '/:action', '/:id/:action'] do
|
49
|
+
action = params[:action] || 'index'
|
50
|
+
view "admin/users/roles/#{action}"
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
@font-face {
|
2
|
+
font-family: 'aerogel-icons';
|
3
|
+
src:asset-url('aerogel-icons.eot?dmxr4k');
|
4
|
+
src:asset-url('aerogel-icons.eot?#iefixdmxr4k') format('embedded-opentype'),
|
5
|
+
asset-url('aerogel-icons.woff?dmxr4k') format('woff'),
|
6
|
+
asset-url('aerogel-icons.ttf?dmxr4k') format('truetype'),
|
7
|
+
asset-url('aerogel-icons.svg?dmxr4k#aerogel-icons') format('svg');
|
8
|
+
font-weight: normal;
|
9
|
+
font-style: normal;
|
10
|
+
}
|
11
|
+
|
12
|
+
[class^="aerogel-"], [class*=" aerogel-"] {
|
13
|
+
font-family: 'aerogel-icons';
|
14
|
+
speak: none;
|
15
|
+
font-style: normal;
|
16
|
+
font-weight: normal;
|
17
|
+
font-variant: normal;
|
18
|
+
text-transform: none;
|
19
|
+
line-height: 1;
|
20
|
+
|
21
|
+
/* Better Font Rendering =========== */
|
22
|
+
-webkit-font-smoothing: antialiased;
|
23
|
+
-moz-osx-font-smoothing: grayscale;
|
24
|
+
}
|
25
|
+
|
26
|
+
.aerogel-logo:before {
|
27
|
+
content: "\e001";
|
28
|
+
}
|