radmin 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (111) hide show
  1. data/.gitignore +7 -0
  2. data/.rspec +2 -0
  3. data/Gemfile +4 -0
  4. data/MIT-LICENSE +20 -0
  5. data/README +30 -0
  6. data/Rakefile +9 -0
  7. data/app/controllers/admin/accounts_controller.rb +16 -0
  8. data/app/controllers/admin/passwords_controller.rb +4 -0
  9. data/app/controllers/admin/sessions_controller.rb +13 -0
  10. data/app/controllers/admin/settings_controller.rb +40 -0
  11. data/app/controllers/admin/users_controller.rb +43 -0
  12. data/app/controllers/admin_controller.rb +15 -0
  13. data/app/helpers/admin_helper.rb +45 -0
  14. data/app/models/radmin/assignment.rb +8 -0
  15. data/app/models/radmin/role.rb +8 -0
  16. data/app/models/radmin/setting.rb +38 -0
  17. data/app/models/radmin/user.rb +18 -0
  18. data/app/views/admin/accounts/edit.html.haml +11 -0
  19. data/app/views/admin/passwords/edit.html.haml +11 -0
  20. data/app/views/admin/passwords/new.html.haml +8 -0
  21. data/app/views/admin/sessions/new.html.haml +9 -0
  22. data/app/views/admin/settings/_form.html.haml +12 -0
  23. data/app/views/admin/settings/edit.html.haml +3 -0
  24. data/app/views/admin/settings/index.html.haml +18 -0
  25. data/app/views/admin/settings/new.html.haml +3 -0
  26. data/app/views/admin/users/_form.html.haml +21 -0
  27. data/app/views/admin/users/edit.html.haml +3 -0
  28. data/app/views/admin/users/index.html.haml +18 -0
  29. data/app/views/admin/users/new.html.haml +3 -0
  30. data/app/views/layouts/admin.html.haml +40 -0
  31. data/config/routes.rb +10 -0
  32. data/lib/generators/radmin/install_generator.rb +31 -0
  33. data/lib/generators/radmin/templates/assets/images/admin/topnav_active.gif +0 -0
  34. data/lib/generators/radmin/templates/assets/images/admin/topnav_stretch.gif +0 -0
  35. data/lib/generators/radmin/templates/assets/javascripts/admin/application.js +1 -0
  36. data/lib/generators/radmin/templates/assets/javascripts/admin/jquery.js +16 -0
  37. data/lib/generators/radmin/templates/assets/javascripts/admin/jquery.rails.js +226 -0
  38. data/lib/generators/radmin/templates/assets/stylesheets/admin/reset.css +48 -0
  39. data/lib/generators/radmin/templates/assets/stylesheets/admin/style.css +422 -0
  40. data/lib/generators/radmin/templates/authorization_rules.rb +17 -0
  41. data/lib/generators/radmin/templates/migrations/01_radmin_create_users.rb +17 -0
  42. data/lib/generators/radmin/templates/migrations/02_radmin_create_roles.rb +13 -0
  43. data/lib/generators/radmin/templates/migrations/03_radmin_create_assignments.rb +15 -0
  44. data/lib/generators/radmin/templates/migrations/04_radmin_create_settings.rb +15 -0
  45. data/lib/radmin.rb +5 -0
  46. data/lib/radmin/admin_ui.rb +136 -0
  47. data/lib/radmin/engine.rb +8 -0
  48. data/lib/radmin/i18n.rb +14 -0
  49. data/lib/radmin/version.rb +3 -0
  50. data/lib/tasks/radmin.rake +13 -0
  51. data/radmin.gemspec +32 -0
  52. data/spec/dummy/Rakefile +7 -0
  53. data/spec/dummy/app/controllers/application_controller.rb +3 -0
  54. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  55. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  56. data/spec/dummy/config.ru +4 -0
  57. data/spec/dummy/config/application.rb +45 -0
  58. data/spec/dummy/config/authorization_rules.rb +17 -0
  59. data/spec/dummy/config/boot.rb +10 -0
  60. data/spec/dummy/config/database.yml +22 -0
  61. data/spec/dummy/config/environment.rb +5 -0
  62. data/spec/dummy/config/environments/development.rb +28 -0
  63. data/spec/dummy/config/environments/production.rb +49 -0
  64. data/spec/dummy/config/environments/test.rb +35 -0
  65. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  66. data/spec/dummy/config/initializers/devise.rb +194 -0
  67. data/spec/dummy/config/initializers/inflections.rb +10 -0
  68. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  69. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  70. data/spec/dummy/config/initializers/session_store.rb +8 -0
  71. data/spec/dummy/config/locales/en.yml +5 -0
  72. data/spec/dummy/config/routes.rb +58 -0
  73. data/spec/dummy/db/migrate/20110524171909_radmin_create_users.rb +17 -0
  74. data/spec/dummy/db/migrate/20110524171910_radmin_create_roles.rb +13 -0
  75. data/spec/dummy/db/migrate/20110524171911_radmin_create_assignments.rb +15 -0
  76. data/spec/dummy/db/migrate/20110524171912_radmin_create_settings.rb +15 -0
  77. data/spec/dummy/db/schema.rb +59 -0
  78. data/spec/dummy/public/404.html +26 -0
  79. data/spec/dummy/public/422.html +26 -0
  80. data/spec/dummy/public/500.html +26 -0
  81. data/spec/dummy/public/favicon.ico +0 -0
  82. data/spec/dummy/public/images/admin/topnav_active.gif +0 -0
  83. data/spec/dummy/public/images/admin/topnav_stretch.gif +0 -0
  84. data/spec/dummy/public/javascripts/admin/application.js +1 -0
  85. data/spec/dummy/public/javascripts/admin/jquery.js +16 -0
  86. data/spec/dummy/public/javascripts/admin/jquery.rails.js +226 -0
  87. data/spec/dummy/public/javascripts/application.js +2 -0
  88. data/spec/dummy/public/javascripts/controls.js +965 -0
  89. data/spec/dummy/public/javascripts/dragdrop.js +974 -0
  90. data/spec/dummy/public/javascripts/effects.js +1123 -0
  91. data/spec/dummy/public/javascripts/prototype.js +6001 -0
  92. data/spec/dummy/public/javascripts/rails.js +191 -0
  93. data/spec/dummy/public/stylesheets/.gitkeep +0 -0
  94. data/spec/dummy/public/stylesheets/admin/reset.css +48 -0
  95. data/spec/dummy/public/stylesheets/admin/style.css +422 -0
  96. data/spec/dummy/script/rails +6 -0
  97. data/spec/dummy/vendor/plugins/dynamic_form/MIT-LICENSE +20 -0
  98. data/spec/dummy/vendor/plugins/dynamic_form/README +13 -0
  99. data/spec/dummy/vendor/plugins/dynamic_form/Rakefile +10 -0
  100. data/spec/dummy/vendor/plugins/dynamic_form/dynamic_form.gemspec +12 -0
  101. data/spec/dummy/vendor/plugins/dynamic_form/init.rb +1 -0
  102. data/spec/dummy/vendor/plugins/dynamic_form/lib/action_view/helpers/dynamic_form.rb +300 -0
  103. data/spec/dummy/vendor/plugins/dynamic_form/lib/action_view/locale/en.yml +8 -0
  104. data/spec/dummy/vendor/plugins/dynamic_form/lib/dynamic_form.rb +5 -0
  105. data/spec/dummy/vendor/plugins/dynamic_form/test/dynamic_form_i18n_test.rb +42 -0
  106. data/spec/dummy/vendor/plugins/dynamic_form/test/dynamic_form_test.rb +370 -0
  107. data/spec/dummy/vendor/plugins/dynamic_form/test/test_helper.rb +9 -0
  108. data/spec/integration/navigation_spec.rb +9 -0
  109. data/spec/radmin_spec.rb +7 -0
  110. data/spec/spec_helper.rb +33 -0
  111. metadata +270 -0
@@ -0,0 +1,7 @@
1
+ .bundle/
2
+ Gemfile.lock
3
+ log/*.log
4
+ pkg
5
+ spec/dummy/db/*.sqlite3
6
+ spec/dummy/log/*.log
7
+ spec/dummy/tmp/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format documentation
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in radmin.gemspec
4
+ gemspec
@@ -0,0 +1,20 @@
1
+ Copyright 2011 Damian Caruso
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README ADDED
@@ -0,0 +1,30 @@
1
+ Radmin
2
+ =======
3
+
4
+ A drop-in admin backend for existing rails applications.
5
+
6
+ Tested with rails 3.0.7.
7
+
8
+ QuickStart
9
+ ==========
10
+ $> rails myapp
11
+ $> cd myapp
12
+
13
+ #add devise to Gemfile
14
+ gem 'devise'
15
+
16
+ $> bundle install
17
+ $> bundle exec rails g devise:install
18
+
19
+ #add radmin to Gemfile
20
+ gem 'radmin'
21
+
22
+ $> bundle install
23
+ $> bundle exec rails g radmin:install
24
+ $> bundle exec rake db:migrate
25
+ $> bundle exec rake radmin:setup
26
+ $> bundle exec rails s
27
+
28
+ Login to http://localhost:3000/admin as admin@example.net/password
29
+
30
+ Copyright (c) 2011 Damian Caruso, released under the MIT license
@@ -0,0 +1,9 @@
1
+ # encoding: UTF-8
2
+ require 'bundler'
3
+ Bundler::GemHelper.install_tasks
4
+
5
+ require 'rspec/core/rake_task'
6
+ RSpec::Core::RakeTask.new('spec')
7
+
8
+ task :test => :spec
9
+ task :default => :spec
@@ -0,0 +1,16 @@
1
+ class Admin::AccountsController < AdminController
2
+ def edit
3
+ @user = current_admin
4
+ end
5
+
6
+ def update
7
+ @user = current_admin
8
+ if @user.update_attributes(params[:user])
9
+ flash[:notice] = Radmin::I18n.t(:account_updated, :default => "Account updated.")
10
+ redirect_to edit_admin_account_url
11
+ else
12
+ flash.now[:alert] = Radmin::I18n.t(:account_could_not_be_updated, :default => "Account could not be updated.")
13
+ render :action => :edit
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,4 @@
1
+ class Admin::PasswordsController < Devise::PasswordsController
2
+ helper :admin
3
+ layout "admin"
4
+ end
@@ -0,0 +1,13 @@
1
+ class Admin::SessionsController < Devise::SessionsController
2
+ helper :admin
3
+ layout "admin"
4
+
5
+ protected
6
+ def after_sign_in_path_for(resource_or_scope)
7
+ admin_url
8
+ end
9
+
10
+ def after_sign_out_path_for(resource_or_scope)
11
+ new_session_url(resource_or_scope)
12
+ end
13
+ end
@@ -0,0 +1,40 @@
1
+ class Admin::SettingsController < AdminController
2
+ before_filter :find_setting, :only => [:edit,:update,:destroy]
3
+ filter_access_to [:index,:new,:create,:edit,:update,:destroy]
4
+
5
+ def index
6
+ @settings = Radmin::Setting.all
7
+ end
8
+
9
+ def new
10
+ @setting = Radmin::Setting.new
11
+ end
12
+
13
+ def create
14
+ Radmin::Setting["#{params[:setting]['key']}"] = params[:setting]['value']
15
+ flash[:notice] = Radmin::I18n.t(:setting_sucessfully_created, :default => "Setting sucessfully created.")
16
+ redirect_to admin_settings_url
17
+ rescue ActiveRecord::RecordInvalid
18
+ render :action => :new
19
+ end
20
+
21
+ def update
22
+ @setting.value = params[:setting]['value']
23
+ @setting.save!
24
+ flash[:notice] = Radmin::I18n.t(:setting_sucessfully_updated, :default => "Setting sucessfully updated.")
25
+ redirect_to admin_settings_url
26
+ rescue ActiveRecord::RecordInvalid
27
+ render :action => :edit
28
+ end
29
+
30
+ def destroy
31
+ @setting.destroy
32
+ flash[:notice] = Radmin::I18n.t(:setting_sucessfully_deleted, :default => "Setting sucessfully deleted.")
33
+ redirect_to admin_settings_url
34
+ end
35
+
36
+ protected
37
+ def find_setting
38
+ @setting = Radmin::Setting.find(params[:id])
39
+ end
40
+ end
@@ -0,0 +1,43 @@
1
+ class Admin::UsersController < AdminController
2
+ before_filter :load_user, :only => [:edit,:update,:destroy]
3
+ filter_access_to [:index,:new,:create]
4
+ filter_access_to [:edit,:update,:destroy], :attribute_check => true, :load_method => lambda { |c| @user = Radmin::User.find(params[:id]) }
5
+
6
+ def index
7
+ @users = Radmin::User.all(:include => [:roles])
8
+ end
9
+
10
+ def new
11
+ @user = Radmin::User.new
12
+ end
13
+
14
+ def create
15
+ @user = Radmin::User.new(params[:user])
16
+ if @user.save
17
+ redirect_to(admin_users_url, :notice => Radmin::I18n.t(:account_created, :default => "Account created."))
18
+ else
19
+ flash.now[:alert] = Radmin::I18n.t(:account_could_not_be_created, :default => "Account could not be created.")
20
+ render :action => :new
21
+ end
22
+ end
23
+
24
+ def update
25
+ if @user.update_attributes(params[:user])
26
+ flash[:notice] = Radmin::I18n.t(:user_updated, :default => "User updated.")
27
+ redirect_to admin_users_url
28
+ else
29
+ flash.now[:alert] = Radmin::I18n.t(:user_could_not_be_updated, :default => "User could not be updated.")
30
+ render :action => :edit
31
+ end
32
+ end
33
+
34
+ def destroy
35
+ @user.destroy
36
+ redirect_to(admin_users_url, :notice => Radmin::I18n.t(:account_deleted, :default => "Account deleted."))
37
+ end
38
+
39
+ protected
40
+ def load_user
41
+ @user = Radmin::User.find(params[:id])
42
+ end
43
+ end
@@ -0,0 +1,15 @@
1
+ class AdminController < ApplicationController
2
+ helper :admin
3
+ before_filter :authenticate_admin!
4
+ layout "admin"
5
+
6
+ protected
7
+ def current_user
8
+ current_admin
9
+ end
10
+
11
+ def permission_denied
12
+ flash[:alert] = Radmin::I18n.t(:permission_denied,:default => "Sorry, you are not allowed to access that page.")
13
+ redirect_to admin_url
14
+ end
15
+ end
@@ -0,0 +1,45 @@
1
+ module AdminHelper
2
+ def current_url?(options)
3
+ url = case options
4
+ when Hash
5
+ url_for options
6
+ else
7
+ options.to_s
8
+ end
9
+ request.fullpath =~ Regexp.new('^' + Regexp.quote(clean(url)))
10
+ end
11
+
12
+ def clean(url)
13
+ uri = URI.parse(url)
14
+ uri.path.gsub(%r{/+}, '/').gsub(%r{/$}, '')
15
+ end
16
+
17
+ def admin
18
+ Radmin::AdminUI.instance
19
+ end
20
+
21
+ def nav_tabs
22
+ admin.nav
23
+ end
24
+
25
+ def current_tab?(tab)
26
+ @current_tab ||= tab if tab.any? {|item| current_url?(item.relative_url) }
27
+ @current_tab == tab
28
+ end
29
+
30
+ def nav_link_to(name, options)
31
+ klass = current_url?(options) ? "current" : ""
32
+ content_tag :li, :class => "#{klass}" do
33
+ link_to name, options
34
+ end
35
+ end
36
+
37
+ def title(page_title, show_title = true)
38
+ content_for(:title) { page_title.to_s }
39
+ @show_title = show_title
40
+ end
41
+
42
+ def show_title?
43
+ @show_title
44
+ end
45
+ end
@@ -0,0 +1,8 @@
1
+ module Radmin
2
+ def self.table_name_prefix; "radmin_"; end
3
+
4
+ class Assignment < ActiveRecord::Base
5
+ belongs_to :user, :class_name => "Radmin::User", :foreign_key => "radmin_user_id"
6
+ belongs_to :role, :class_name => "Radmin::Role", :foreign_key => "radmin_role_id"
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ module Radmin
2
+ def self.table_name_prefix; "radmin_"; end
3
+
4
+ class Role < ActiveRecord::Base
5
+ has_many :assignments, :class_name => "Radmin::Assignment", :foreign_key => "radmin_role_id"
6
+ has_many :users, :through => :assignments
7
+ end
8
+ end
@@ -0,0 +1,38 @@
1
+ module Radmin
2
+ def self.table_name_prefix; "radmin_"; end
3
+
4
+ class Setting < ActiveRecord::Base
5
+ after_save { Rails.cache.write('Radmin::Settings',Radmin::Setting.to_hash) }
6
+
7
+ class << self
8
+ def [](key)
9
+ settings = Rails.cache.fetch('Radmin::Settings') { Radmin::Setting.to_hash }
10
+ settings[key]
11
+ end
12
+
13
+ def []=(key, value)
14
+ pair = find_or_initialize_by_key(key)
15
+ pair.update_attributes(:value => value)
16
+ value
17
+ end
18
+
19
+ def to_hash
20
+ Hash[ *find(:all).map { |pair| [pair.key, pair.value] }.flatten ]
21
+ end
22
+ end
23
+
24
+ def value=(param)
25
+ self[:value] = param.to_s
26
+ end
27
+
28
+ def value
29
+ unless new_record?
30
+ if key.ends_with? "?"
31
+ self[:value] == "true"
32
+ else
33
+ self[:value]
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,18 @@
1
+ module Radmin
2
+ def self.table_name_prefix; "radmin_"; end
3
+
4
+ class User < ActiveRecord::Base
5
+ devise :database_authenticatable, :recoverable, :trackable, :validatable
6
+
7
+ attr_accessible :email, :password, :password_confirmation, :role_ids
8
+
9
+ has_many :assignments, :class_name => "Radmin::Assignment", :dependent => :destroy, :foreign_key => "radmin_user_id"
10
+ has_many :roles, :through => :assignments
11
+
12
+ def role_symbols
13
+ roles.map do |role|
14
+ role.name.underscore.to_sym
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,11 @@
1
+ - title Radmin::I18n.t(:edit_user,:default => "Edit Account")
2
+ = form_for @user, :as => :user, :url => admin_account_path do |f|
3
+ .col
4
+ = f.label :email, Radmin::User.human_attribute_name("email")
5
+ = f.text_field :email
6
+ = f.label :password, Radmin::I18n.t(:new_password, :default => "New Password")
7
+ = f.password_field :password
8
+ = f.label :password_confirmation, Radmin::User.human_attribute_name("password_confirmation")
9
+ = f.password_field :password_confirmation
10
+ %p.buttons
11
+ = f.submit Radmin::I18n.t(:save,:default=>"Save")
@@ -0,0 +1,11 @@
1
+ - title Radmin::I18n.t(:change_password, :default => "Change your password")
2
+ = form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :put }) do |f|
3
+ = f.hidden_field :reset_password_token
4
+ = f.label :password, "New password"
5
+ = f.password_field :password
6
+ = f.error_message_on :password
7
+ = f.label :password_confirmation, "Confirm new password"
8
+ = f.password_field :password_confirmation
9
+ = f.error_message_on :password_confirmation
10
+ .buttons
11
+ = f.submit Radmin::I18n.t(:change_password, :default => "Change Password")
@@ -0,0 +1,8 @@
1
+ - title Radmin::I18n.t(:forgot_password, :default => "Forgot password?")
2
+ = form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :post }) do |f|
3
+ = f.label :email
4
+ = f.text_field :email
5
+ = f.error_message_on :email
6
+ .buttons
7
+ = f.submit Radmin::I18n.t(:send_instructions, :default => "Send Instructions")
8
+ = link_to t(:login, :default => "Login"), new_session_path(resource_name)
@@ -0,0 +1,9 @@
1
+ - title Radmin::I18n.t(:login,:default => "Login")
2
+ = form_for resource, :as => resource_name, :url => session_path(resource_name) do |f|
3
+ = f.label :email, Radmin::User.human_attribute_name("email")
4
+ = f.text_field :email
5
+ = f.label :password, Radmin::User.human_attribute_name("password")
6
+ = f.password_field :password
7
+ .buttons
8
+ = f.submit Radmin::I18n.t(:login,:default=>"Login")
9
+ = link_to t(:forgot_password, :default => "Forgot password?"), new_password_path(resource_name)
@@ -0,0 +1,12 @@
1
+ .col
2
+ = label_tag Radmin::I18n.t(:setting_key, :default => "Setting Key")
3
+ - if @setting.new_record?
4
+ = text_field_tag "setting[key]"
5
+ - else
6
+ = text_field_tag "setting[key]", @setting.key, :disabled => true
7
+ = label_tag Radmin::I18n.t(:setting_value, :default => "Setting Value")
8
+ = text_field_tag "setting[value]", @setting.value
9
+ %p.buttons
10
+ = submit_tag Radmin::I18n.t(:save,:default=>"Save")
11
+ = Radmin::I18n.t(:or,:default=>"or")
12
+ = link_to Radmin::I18n.t(:cancel,:default=>"Cancel"), admin_settings_path
@@ -0,0 +1,3 @@
1
+ - title Radmin::I18n.t(:edit_setting,:default => "Edit Setting")
2
+ = form_tag admin_setting_path(@key), :method => :put do
3
+ = render :partial => "form"
@@ -0,0 +1,18 @@
1
+ - title Radmin::I18n.t(:settings,:default => "Application Settings")
2
+ %span.toolbar
3
+ = link_to(Radmin::I18n.t(:new_setting,:default => "New"), new_admin_setting_path) if permitted_to? :create
4
+ %p.intro= Radmin::I18n.t(:settings_list_intro,:default => "Application Settings")
5
+ %table
6
+ %thead
7
+ %th= Radmin::I18n.t(:setting_key, :default => "Key")
8
+ %th= Radmin::I18n.t(:setting_value, :default => "Value")
9
+ %th.last
10
+ %tbody
11
+ - @settings.each do |setting|
12
+ %tr
13
+ %td= link_to setting.key, edit_admin_setting_path(setting)
14
+ %td= setting.value
15
+ %td.last
16
+ = link_to(Radmin::I18n.t(:edit,:default => "Edit"), edit_admin_setting_path(setting), :class => "edit") if permitted_to? :update
17
+ |
18
+ \#{link_to(Radmin::I18n.t(:delete,:default => "Delete"), admin_setting_path(setting), :confirm => Radmin::I18n.t(:are_you_sure,:default => "Are you sure?"), :method => :delete, :class => "delete") if permitted_to? :destroy}
@@ -0,0 +1,3 @@
1
+ - title Radmin::I18n.t(:new_setting,:default => "New Setting")
2
+ = form_tag admin_settings_path do
3
+ = render :partial => "form"
@@ -0,0 +1,21 @@
1
+ .col
2
+ = form.label :email, Radmin::User.human_attribute_name("email")
3
+ = form.text_field :email
4
+ = form.label :password, form.object.new_record? ? Radmin::User.human_attribute_name("password") : Radmin::I18n.t(:change_password, :default => "Change Password")
5
+ = form.password_field :password
6
+ = form.label :password_confirmation, Radmin::User.human_attribute_name("password_confirmation")
7
+ = form.password_field :password_confirmation
8
+ - has_role?(:admin) do
9
+ %h2= Radmin::I18n.t(:roles,:default=>"Roles")
10
+ .col
11
+ - for role in Radmin::Role.all
12
+ %div
13
+ = check_box_tag "admin_user[role_ids][]", role.id, @user.roles.include?(role), :id => "admin_user_role_#{role.name.underscore.to_sym}"
14
+ = label_tag "admin_user_role_#{role.name.underscore.to_sym}", Radmin::I18n.t(role.name.underscore.to_sym,:default=>h(role.name.capitalize)), :class => "light inline"
15
+ %p.buttons
16
+ = form.submit Radmin::I18n.t(:save,:default=>"Save")
17
+ = Radmin::I18n.t(:or,:default=>"or")
18
+ - if permitted_to? :index
19
+ = link_to Radmin::I18n.t(:cancel,:default=>"Cancel"), admin_users_path
20
+ - else
21
+ = link_to Radmin::I18n.t(:cancel,:default=>"Cancel"), admin_overview_path