padrino-admin 0.11.4 → 0.12.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/lib/padrino-admin/access_control.rb +1 -1
  3. data/lib/padrino-admin/generators/admin_app.rb +1 -1
  4. data/lib/padrino-admin/generators/templates/account/activerecord.rb.tt +9 -6
  5. data/lib/padrino-admin/generators/templates/account/couchrest.rb.tt +15 -14
  6. data/lib/padrino-admin/generators/templates/account/datamapper.rb.tt +7 -6
  7. data/lib/padrino-admin/generators/templates/account/minirecord.rb.tt +9 -6
  8. data/lib/padrino-admin/generators/templates/account/mongoid.rb.tt +7 -6
  9. data/lib/padrino-admin/generators/templates/account/mongomapper.rb.tt +7 -6
  10. data/lib/padrino-admin/generators/templates/account/ohm.rb.tt +7 -6
  11. data/lib/padrino-admin/generators/templates/account/sequel.rb.tt +7 -6
  12. data/lib/padrino-admin/generators/templates/app/controllers/sessions.rb.tt +3 -3
  13. data/lib/padrino-admin/generators/templates/assets/javascripts/application.js +2 -1
  14. data/lib/padrino-admin/generators/templates/erb/app/base/index.erb.tt +1 -1
  15. data/lib/padrino-admin/generators/templates/erb/app/layouts/application.erb.tt +2 -2
  16. data/lib/padrino-admin/generators/templates/erb/app/sessions/new.erb.tt +2 -2
  17. data/lib/padrino-admin/generators/templates/haml/app/base/index.haml.tt +1 -1
  18. data/lib/padrino-admin/generators/templates/haml/app/layouts/application.haml.tt +2 -2
  19. data/lib/padrino-admin/generators/templates/haml/app/sessions/new.haml.tt +4 -4
  20. data/lib/padrino-admin/generators/templates/haml/page/edit.haml.tt +1 -1
  21. data/lib/padrino-admin/generators/templates/haml/page/index.haml.tt +3 -3
  22. data/lib/padrino-admin/generators/templates/haml/page/new.haml.tt +1 -1
  23. data/lib/padrino-admin/generators/templates/slim/app/base/index.slim.tt +1 -1
  24. data/lib/padrino-admin/generators/templates/slim/app/layouts/application.slim.tt +2 -2
  25. data/lib/padrino-admin/generators/templates/slim/app/sessions/new.slim.tt +4 -4
  26. data/lib/padrino-admin/generators/templates/slim/page/edit.slim.tt +1 -1
  27. data/lib/padrino-admin/generators/templates/slim/page/index.slim.tt +3 -3
  28. data/lib/padrino-admin/generators/templates/slim/page/new.slim.tt +1 -1
  29. data/lib/padrino-admin/helpers/authentication_helpers.rb +1 -1
  30. data/padrino-admin.gemspec +1 -0
  31. data/test/test_admin_application.rb +20 -0
  32. metadata +10 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cf3dcdd045be97a348167272e0164460b6df4162
4
- data.tar.gz: bd4f782b57d442725eb6729d7a0fbc8681c008be
3
+ metadata.gz: 59d3555e8e56082baba626251a152c8663016484
4
+ data.tar.gz: 6cd5f67e229164a70c9d34dc0a335da06e904824
5
5
  SHA512:
6
- metadata.gz: 6b5b0e6d13948f5cb6c90d25e0e9cab1f888f3da99124fe2c7138da8f47e20ec55db5e2ad6c998cf899b2b07e72da603d958516872f5ad16ac092dbacb848740
7
- data.tar.gz: 75a724d82e3e3b787d4f441a88c9fc08fcc5885133df0996f67a4ae3c6c9f61b798e882e4b376dcdf270c32997dd987d12f84b6718af5d71bd051cee56df0808
6
+ metadata.gz: ec01231b86c0a2ebedd62a5bcfc7ceb82bacd0766ec933fa20e8ee8c95c908032252b4d8fccb50fcfff8fa655e05875262a4d082f63e51bed94437fd98ad326f
7
+ data.tar.gz: ed059febbc883daddac9d2d9c790a520e5cdbd14b1665d80d4abd69d54b4d417f90f1327f3fa539f6e44fe6fa39fbe9669195868a98d190c6d09442d22473c7f
@@ -13,7 +13,7 @@ module Padrino
13
13
  # Method used by Padrino::Application when we register the extension.
14
14
  #
15
15
  def registered(app)
16
- app.set :session_id, "_padrino_#{File.basename(Padrino.root)}_#{app.app_name}".to_sym
16
+ app.set :session_id, "_padrino_#{File.basename(Padrino.root)}_#{app.app_name}".to_sym unless app.respond_to?(:session_id)
17
17
  app.set :admin_model, 'Account' unless app.respond_to?(:admin_model)
18
18
  app.helpers Padrino::Admin::Helpers::AuthenticationHelpers
19
19
  app.helpers Padrino::Admin::Helpers::ViewHelpers
@@ -72,7 +72,7 @@ module Padrino
72
72
  directory "templates/app", destination_root("admin")
73
73
  directory "templates/assets", destination_root("public", "admin")
74
74
  template "templates/app.rb.tt", destination_root("admin/app.rb")
75
- append_file destination_root("config/apps.rb"), "\nPadrino.mount(\"#{@app_name}::Admin\", :app_file => File.expand_path('../../admin/app.rb', __FILE__)).to(\"/admin\")"
75
+ inject_into_file destination_root('config/apps.rb'), "\nPadrino.mount(\"#{@app_name}::Admin\", :app_file => File.expand_path('../../admin/app.rb', __FILE__)).to(\"/admin\")\n", :before => /^Padrino.mount.*\.to\('\/'\)$/
76
76
  unless options[:destroy]
77
77
  insert_middleware 'ActiveRecord::ConnectionAdapters::ConnectionManagement', 'admin' if [:minirecord, :activerecord].include?(orm)
78
78
  end
@@ -28,11 +28,14 @@ class <%= @model_name %> < ActiveRecord::Base
28
28
  end
29
29
 
30
30
  private
31
- def encrypt_password
32
- self.crypted_password = ::BCrypt::Password.create(password)
33
- end
34
31
 
35
- def password_required
36
- crypted_password.blank? || password.present?
37
- end
32
+ def encrypt_password
33
+ value = ::BCrypt::Password.create(password)
34
+ value = value.force_encoding(Encoding::UTF_8) if value.encoding == Encoding::ASCII_8BIT
35
+ self.crypted_password = value
36
+ end
37
+
38
+ def password_required
39
+ crypted_password.blank? || password.present?
40
+ end
38
41
  end
@@ -44,23 +44,24 @@ class <%= @model_name %> < CouchRest::Model::Base
44
44
  end
45
45
 
46
46
  private
47
- def encrypt_password
48
- self.crypted_password = ::BCrypt::Password.create(password)
49
- end
50
47
 
51
- def password_required
52
- crypted_password.blank? || password.present?
53
- end
48
+ def encrypt_password
49
+ self.crypted_password = ::BCrypt::Password.create(password)
50
+ end
51
+
52
+ def password_required
53
+ crypted_password.blank? || password.present?
54
+ end
54
55
 
55
- def unique_email_validator
56
- account = self.class.find_by_email(email)
56
+ def unique_email_validator
57
+ account = self.class.find_by_email(email)
57
58
 
58
- # Didn't find email in the database.
59
- return if account.nil?
59
+ # Didn't find email in the database.
60
+ return if account.nil?
60
61
 
61
- # Account with same email in database is this account.
62
- return if has_key?('_id') && self['_id'] == account['_id']
62
+ # Account with same email in database is this account.
63
+ return if has_key?('_id') && self['_id'] == account['_id']
63
64
 
64
- errors.add(:email, "is not unique")
65
- end
65
+ errors.add(:email, "is not unique")
66
+ end
66
67
  end
@@ -45,11 +45,12 @@ class <%= @model_name %>
45
45
  end
46
46
 
47
47
  private
48
- def password_required
49
- crypted_password.blank? || password.present?
50
- end
51
48
 
52
- def encrypt_password
53
- self.crypted_password = ::BCrypt::Password.create(password) if password.present?
54
- end
49
+ def password_required
50
+ crypted_password.blank? || password.present?
51
+ end
52
+
53
+ def encrypt_password
54
+ self.crypted_password = ::BCrypt::Password.create(password) if password.present?
55
+ end
55
56
  end
@@ -31,11 +31,14 @@ class <%= @model_name %> < ActiveRecord::Base
31
31
  end
32
32
 
33
33
  private
34
- def encrypt_password
35
- self.crypted_password = ::BCrypt::Password.create(password)
36
- end
37
34
 
38
- def password_required
39
- crypted_password.blank? || password.present?
40
- end
35
+ def encrypt_password
36
+ value = ::BCrypt::Password.create(password)
37
+ value = value.force_encoding(Encoding::UTF_8) if value.encoding == Encoding::ASCII_8BIT
38
+ self.crypted_password = value
39
+ end
40
+
41
+ def password_required
42
+ crypted_password.blank? || password.present?
43
+ end
41
44
  end
@@ -43,11 +43,12 @@ class <%= @model_name %>
43
43
  end
44
44
 
45
45
  private
46
- def encrypt_password
47
- self.crypted_password = ::BCrypt::Password.create(self.password)
48
- end
49
46
 
50
- def password_required
51
- crypted_password.blank? || self.password.present?
52
- end
47
+ def encrypt_password
48
+ self.crypted_password = ::BCrypt::Password.create(self.password)
49
+ end
50
+
51
+ def password_required
52
+ crypted_password.blank? || self.password.present?
53
+ end
53
54
  end
@@ -36,11 +36,12 @@ class <%= @model_name %>
36
36
  end
37
37
 
38
38
  private
39
- def encrypt_password
40
- self.crypted_password = ::BCrypt::Password.create(password)
41
- end
42
39
 
43
- def password_required
44
- crypted_password.blank? || password.present?
45
- end
40
+ def encrypt_password
41
+ self.crypted_password = ::BCrypt::Password.create(password)
42
+ end
43
+
44
+ def password_required
45
+ crypted_password.blank? || password.present?
46
+ end
46
47
  end
@@ -59,11 +59,12 @@ class Account < Ohm::Model
59
59
  end
60
60
 
61
61
  private
62
- def encrypt_password
63
- self.crypted_password = ::BCrypt::Password.create(password) if password_required
64
- end
65
62
 
66
- def password_required
67
- crypted_password.blank? || password.present?
68
- end
63
+ def encrypt_password
64
+ self.crypted_password = ::BCrypt::Password.create(password) if password_required
65
+ end
66
+
67
+ def password_required
68
+ crypted_password.blank? || password.present?
69
+ end
69
70
  end
@@ -42,11 +42,12 @@ class <%= @model_name %> < Sequel::Model
42
42
  end
43
43
 
44
44
  private
45
- def encrypt_password
46
- self.crypted_password = ::BCrypt::Password.create(password) if password.present?
47
- end
48
45
 
49
- def password_required
50
- self.crypted_password.blank? || password.present?
51
- end
46
+ def encrypt_password
47
+ self.crypted_password = ::BCrypt::Password.create(password) if password.present?
48
+ end
49
+
50
+ def password_required
51
+ self.crypted_password.blank? || password.present?
52
+ end
52
53
  end
@@ -16,9 +16,9 @@
16
16
  set_current_account(account)
17
17
  redirect url(:base, :index)
18
18
  else
19
- params[:email], params[:password] = h(params[:email]), h(params[:password])
20
- flash[:error] = pat('login.error')
21
- redirect url(:sessions, :new)
19
+ params[:email] = h(params[:email])
20
+ flash.now[:error] = pat('login.error')
21
+ render "/sessions/new", nil, :layout => false
22
22
  end
23
23
  end
24
24
 
@@ -112,6 +112,7 @@
112
112
  }
113
113
 
114
114
  // Autofocus first field with an error. (usability)
115
- $('.has-error :input').first().focus();
115
+ var error_input;
116
+ if (error_input = $('.has-error :input').first()) { error_input.focus(); }
116
117
  });
117
118
  }(window.jQuery);
@@ -6,7 +6,7 @@
6
6
 
7
7
  <div class=base-icons>
8
8
  <div class=btn-group>
9
- <div class="btn btn-primary" title="Adapters for datamapper, sequel, activerecord, mongomapper, mongoid, couchrest"><%%= tag_icon("cogs icon-2x", "Orm Agnostic") %></div>
9
+ <div class="btn btn-primary" title="Adapters for datamapper, sequel, activerecord, minirecord, mongomapper, mongoid, couchrest"><%%= tag_icon("cogs icon-2x", "Orm Agnostic") %></div>
10
10
  <div class="btn btn-success" title="User Authentication Support, User Authorization Management"><%%= tag_icon("group icon-2x", "Authentication") %></div>
11
11
  <div class="btn btn-info" title="Erb, Haml, Slim Rendering Support"><%%= tag_icon("tasks icon-2x", "Template Agnostic") %></div>
12
12
  <div class="btn btn-warning" title="English, German, Russian, Danish, French, Brazilian and Italian localizations and many more!.."><%%= tag_icon("flag icon-2x", "Multi Language") %></div>
@@ -16,7 +16,7 @@
16
16
  <div class="navbar navbar-fixed-top">
17
17
  <div class=navbar-inner>
18
18
  <div class=container>
19
- <%%= link_to 'Padrino', url(:base_index), :class => 'navbar-brand', :title => 'Padrino Admin' %>
19
+ <%%= link_to 'Padrino', url(:base, :index), :class => 'navbar-brand', :title => 'Padrino Admin' %>
20
20
  <ul class="nav navbar-nav pull-right">
21
21
  <li class=navbar-edit-account><%%= link_to tag_icon(:user), url(:<%= @model_plural %>, :edit, :id => current_account.id), :title => pat(:profile), :class => 'navbar-nav-link' %></li>
22
22
  <li class=navbar-logout>
@@ -41,7 +41,7 @@
41
41
 
42
42
  <div class='container main'>
43
43
  <div class='main-wrapper'>
44
- <%%= [:error, :warning, :success, :notice].map { |type| flash_tag(type, :class => "alert alert-#{type} fade in", :bootstrap => true) }.join.html_safe %>
44
+ <%%= {:error => 'danger', :warning => 'warning', :success => 'success', :notice => 'info'}.map { |type, class_name| flash_tag(type, :class => "alert alert-#{class_name} fade in", :bootstrap => true) }.join.html_safe %>
45
45
  <div class='row'><%%= yield %></div>
46
46
  <div class='main-wrapper-push'></div>
47
47
  </div>
@@ -18,7 +18,7 @@
18
18
  </div>
19
19
  <div class="login-body modal-body">
20
20
 
21
- <%%= [:error, :warning, :success, :notice].map { |type| flash_tag(type, :class => "alert alert-#{type} fade in", :bootstrap => true) }.join.html_safe %>
21
+ <%%= {:error => 'danger', :warning => 'warning', :success => 'success', :notice => 'info'}.map { |type, class_name| flash_tag(type, :class => "alert alert-#{class_name} fade in", :bootstrap => true) }.join.html_safe %>
22
22
 
23
23
  <div class="form-group">
24
24
  <label for="email" class="col-lg-2 control-label"><%%= pat('login.email') %></label>
@@ -27,7 +27,7 @@
27
27
 
28
28
  <div class="form-group">
29
29
  <label for="password" class="col-lg-2 control-label"><%%= pat('login.password') %></label>
30
- <div class="col-lg-10"><%%= password_field_tag :password, :value => params[:password], :class => 'form-control' %></div>
30
+ <div class="col-lg-10"><%%= password_field_tag :password, :class => 'form-control' %></div>
31
31
  </div>
32
32
 
33
33
  <fieldset class="login-control-group-last control-group">
@@ -5,7 +5,7 @@
5
5
 
6
6
  .base-icons
7
7
  .btn-group
8
- .btn.btn-primary{:title => "Adapters for datamapper, sequel, activerecord, mongomapper, mongoid, couchrest"}=tag_icon("cogs icon-2x", "Orm Agnostic")
8
+ .btn.btn-primary{:title => "Adapters for datamapper, sequel, activerecord, minirecord, mongomapper, mongoid, couchrest"}=tag_icon("cogs icon-2x", "Orm Agnostic")
9
9
  .btn.btn-success{:title => "User Authentication Support, User Authorization Management"}=tag_icon("group icon-2x", "Authentication")
10
10
  .btn.btn-info{:title => "Erb, Haml, Slim Rendering Support"}=tag_icon("tasks icon-2x", "Template Agnostic")
11
11
  .btn.btn-warning{:title => "English, German, Russian, Danish, French, Brazilian and Italian localizations and many more!.."}=tag_icon("flag icon-2x", "Multi Language")
@@ -16,7 +16,7 @@
16
16
  .navbar.navbar-fixed-top
17
17
  .navbar-inner
18
18
  .container
19
- =link_to 'Padrino', url(:base_index), :class => 'navbar-brand', :title => 'Padrino Admin'
19
+ =link_to 'Padrino', url(:base, :index), :class => 'navbar-brand', :title => 'Padrino Admin'
20
20
  %ul.nav.navbar-nav.pull-right
21
21
  %li.navbar-edit-account=link_to tag_icon(:user), url(:accounts, :edit, :id => current_account.id), :title => pat(:profile), :class => 'navbar-nav-link'
22
22
  %li.navbar-logout
@@ -30,7 +30,7 @@
30
30
 
31
31
  .container.main
32
32
  .main-wrapper
33
- =[:error, :warning, :success, :notice].map { |type| flash_tag(type, :class => "alert alert-#{type} fade in", :bootstrap => true) }.join.html_safe
33
+ ={:error => 'danger', :warning => 'warning', :success => 'success', :notice => 'info'}.map { |type, class_name| flash_tag(type, :class => "alert alert-#{class_name} fade in", :bootstrap => true) }.join.html_safe
34
34
  .row=yield
35
35
  .main-wrapper-push
36
36
 
@@ -11,11 +11,11 @@
11
11
  =favicon_tag 'favicon.ico'
12
12
  =stylesheet_link_tag 'bootstrap', 'application'
13
13
  %body
14
- - form_tag url(:sessions, :create), :class=>'login form-horizontal' do
14
+ = form_tag url(:sessions, :create), :class=>'login form-horizontal' do
15
15
  .login-header.modal-header
16
16
  .login-logo=image_tag('logo.png', :alt => "Padrino's logo", :height => 250, :width => 193)
17
17
  .login-body.modal-body
18
- = [:error, :warning, :notice].map { |type| flash_tag(type, :class => "alert alert-#{type} fade in", :bootstrap => true) }.join.html_safe
18
+ = {:error => 'danger', :warning => 'warning', :success => 'success', :notice => 'info'}.map { |type, class_name| flash_tag(type, :class => "alert alert-#{class_name} fade in", :bootstrap => true) }.join.html_safe
19
19
 
20
20
  .form-group
21
21
  %label.col-lg-2.control-label{:for => :email}= pat('login.email')
@@ -23,7 +23,7 @@
23
23
 
24
24
  .form-group
25
25
  %label.col-lg-2.control-label{:for => :password}= pat('login.password')
26
- .col-lg-10=password_field_tag :password, :value => params[:password], :class =>'form-control'
26
+ .col-lg-10=password_field_tag :password, :class =>'form-control'
27
27
 
28
28
  %fieldset.login-control-group-last.control-group
29
29
  .login-controls.controls
@@ -34,4 +34,4 @@
34
34
  .login-footer.modal-footer
35
35
  =submit_tag(pat('login.sign_in'), :class => 'btn btn-primary pull-right')
36
36
 
37
- =javascript_include_tag 'jquery-1.9.0.min', (Padrino.env == :production ? 'bootstrap/bootstrap.min' : %w[bootstrap/affix bootstrap/alert bootstrap/button bootstrap/carousel bootstrap/collapse bootstrap/dropdown bootstrap/tooltip bootstrap/transition bootstrap/modal bootstrap/popover bootstrap/scrollspy bootstrap/tab]), :application
37
+ =javascript_include_tag 'jquery-1.9.0.min', (Padrino.env == :production ? 'bootstrap/bootstrap.min' : %w[bootstrap/affix bootstrap/alert bootstrap/button bootstrap/carousel bootstrap/collapse bootstrap/dropdown bootstrap/tooltip bootstrap/transition bootstrap/modal bootstrap/popover bootstrap/scrollspy bootstrap/tab]), :application
@@ -4,5 +4,5 @@
4
4
  %li.active=link_to tag_icon(:edit, pat(:edit)), url(:<%= @orm.name_plural %>, :edit, :id => @<%= @orm.name_singular %>.id)
5
5
 
6
6
  .tabs-content
7
- -form_for :<%= @orm.name_singular %>, url(:<%= @orm.name_plural %>, :update, :id => @<%= @orm.name_singular %>.id), :method => :put, :class => 'form-horizontal' do |f|
7
+ = form_for :<%= @orm.name_singular %>, url(:<%= @orm.name_plural %>, :update, :id => @<%= @orm.name_singular %>.id), :method => :put, :class => 'form-horizontal' do |f|
8
8
  =partial '<%= @orm.name_plural %>/form', :locals => { :f => f }
@@ -22,7 +22,7 @@
22
22
  .arrow
23
23
  %h3.popover-title=pat(:delete_selected_title)
24
24
  .popover-content
25
- -form_tag url(:<%= @orm.name_plural %>, :destroy_many), :method => :delete do
25
+ = form_tag url(:<%= @orm.name_plural %>, :destroy_many), :method => :delete do
26
26
  =hidden_field_tag :<%= @orm.name_singular %>_ids, :'data-delete-many-ids' => true
27
27
  =submit_tag pat(:delete), :class =>'list-menu-popover-delete-selected-btn btn btn-danger btn-small'
28
28
  .btn.btn-default.btn-small.cancel=pat(:cancel)
@@ -53,6 +53,6 @@
53
53
  .arrow
54
54
  %h3.popover-title=pat(:delete, :model => "<%= @orm.name_singular %>")
55
55
  .popover-content
56
- -form_tag url(:<%= @orm.name_plural %>, :destroy, :id => <%= @orm.name_singular %>.id), :method => :delete do
56
+ = form_tag url(:<%= @orm.name_plural %>, :destroy, :id => <%= @orm.name_singular %>.id), :method => :delete do
57
57
  =submit_tag pat(:delete), :class =>'list-row-action-popover-delete-one-btn btn btn-danger btn-small'
58
- .btn.btn-default.btn-small.cancel=pat(:cancel)
58
+ .btn.btn-default.btn-small.cancel=pat(:cancel)
@@ -3,5 +3,5 @@
3
3
  %li.active=link_to tag_icon(:plus, pat(:new)), url(:<%= @orm.name_plural %>, :new)
4
4
 
5
5
  .tabs-content
6
- -form_for :<%= @orm.name_singular %>, url(:<%= @orm.name_plural %>, :create), :class => 'form-horizontal' do |f|
6
+ = form_for :<%= @orm.name_singular %>, url(:<%= @orm.name_plural %>, :create), :class => 'form-horizontal' do |f|
7
7
  =partial '<%= @orm.name_plural %>/form', :locals => { :f => f }
@@ -5,7 +5,7 @@ div class="base-text"
5
5
 
6
6
  div class="base-icons"
7
7
  div class="btn-group"
8
- div class="btn btn-primary" title="Adapters for datamapper, sequel, activerecord, mongomapper, mongoid, couchrest" = tag_icon("cogs icon-2x", "Orm Agnostic")
8
+ div class="btn btn-primary" title="Adapters for datamapper, sequel, activerecord, minirecord, mongomapper, mongoid, couchrest" = tag_icon("cogs icon-2x", "Orm Agnostic")
9
9
  div class="btn btn-success" title="User Authentication Support, User Authorization Management" = tag_icon("group icon-2x", "Authentication")
10
10
  div class="btn btn-info" title="Erb, Haml, Slim Rendering Support" = tag_icon("tasks icon-2x", "Template Agnostic")
11
11
  div class="btn btn-warning" title="English, German, Russian, Danish, French, Brazilian and Italian localizations" = tag_icon("flag icon-2x", "Multi Language")
@@ -16,7 +16,7 @@ html lang='en'
16
16
  div class='navbar navbar-fixed-top'
17
17
  div class='navbar-inner'
18
18
  div class='container'
19
- = link_to 'Padrino', url(:base_index), :class => 'navbar-brand', :title => 'Padrino Admin'
19
+ = link_to 'Padrino', url(:base, :index), :class => 'navbar-brand', :title => 'Padrino Admin'
20
20
 
21
21
  ul class='nav navbar-nav pull-right'
22
22
  li class='navbar-edit-account' = link_to tag_icon(:user), url(:<%= @model_plural %>, :edit, :id => current_account.id), :title => pat(:profile), :class => 'navbar-nav-link'
@@ -30,7 +30,7 @@ html lang='en'
30
30
 
31
31
  div class='container main'
32
32
  div class='main-wrapper'
33
- = [:error, :warning, :success, :notice].map { |type| flash_tag(type, :class => "alert alert-#{type} fade in", :bootstrap => true) }.join.html_safe
33
+ = {:error => 'danger', :warning => 'warning', :success => 'success', :notice => 'info'}.map { |type, class_name| flash_tag(type, :class => "alert alert-#{class_name} fade in", :bootstrap => true) }.join.html_safe
34
34
  div class='row' = yield
35
35
  div class='main-wrapper-push'
36
36
 
@@ -12,11 +12,11 @@ html lang="en" xmlns="http://www.w3.org/1999/xhtml"
12
12
  = stylesheet_link_tag 'bootstrap', 'application'
13
13
 
14
14
  body
15
- - form_tag url(:sessions, :create), :class=>'login form-horizontal' do
15
+ = form_tag url(:sessions, :create), :class=>'login form-horizontal' do
16
16
  div class="login-header modal-header"
17
17
  div class="login-logo" = image_tag('logo.png', :alt => "Padrino's logo", :height => 250, :width => 193)
18
18
  div class="login-body modal-body"
19
- = [:error, :warning, :notice].map { |type| flash_tag(type, :class => "alert alert-#{type} fade in", :bootstrap => true) }.join.html_safe
19
+ = {:error => 'danger', :warning => 'warning', :success => 'success', :notice => 'info'}.map { |type, class_name| flash_tag(type, :class => "alert alert-#{class_name} fade in", :bootstrap => true) }.join.html_safe
20
20
 
21
21
  div class='form-group'
22
22
  label for="email" class='col-lg-2 control-label' = pat('login.email')
@@ -24,7 +24,7 @@ html lang="en" xmlns="http://www.w3.org/1999/xhtml"
24
24
 
25
25
  div class='form-group'
26
26
  label for="password" class='col-lg-2 control-label' = pat('login.password')
27
- div class='col-lg-10' = password_field_tag :password, :value => params[:password], :class => 'form-control'
27
+ div class='col-lg-10' = password_field_tag :password, :class => 'form-control'
28
28
 
29
29
  fieldset class='login-control-group-last control-group'
30
30
  div class='login-controls controls'
@@ -34,4 +34,4 @@ html lang="en" xmlns="http://www.w3.org/1999/xhtml"
34
34
 
35
35
  div class="login-footer modal-footer"
36
36
  = submit_tag(pat('login.sign_in'), :class => 'btn btn-primary pull-right')
37
- = javascript_include_tag 'jquery-1.9.0.min', (Padrino.env == :production ? 'bootstrap/bootstrap.min' : %w[bootstrap/affix bootstrap/alert bootstrap/button bootstrap/carousel bootstrap/collapse bootstrap/dropdown bootstrap/tooltip bootstrap/transition bootstrap/modal bootstrap/popover bootstrap/scrollspy bootstrap/tab]), :application
37
+ = javascript_include_tag 'jquery-1.9.0.min', (Padrino.env == :production ? 'bootstrap/bootstrap.min' : %w[bootstrap/affix bootstrap/alert bootstrap/button bootstrap/carousel bootstrap/collapse bootstrap/dropdown bootstrap/tooltip bootstrap/transition bootstrap/modal bootstrap/popover bootstrap/scrollspy bootstrap/tab]), :application
@@ -4,5 +4,5 @@ ul class="nav nav-tabs"
4
4
  li class="active" = link_to tag_icon(:edit, pat(:edit)), url(:<%= @orm.name_plural %>, :edit, :id => @<%= @orm.name_singular %>.id)
5
5
 
6
6
  div class="tabs-content"
7
- - form_for :<%= @orm.name_singular %>, url(:<%= @orm.name_plural %>, :update, :id => @<%= @orm.name_singular %>.id), :method => :put, :class => 'form-horizontal' do |f|
7
+ = form_for :<%= @orm.name_singular %>, url(:<%= @orm.name_plural %>, :update, :id => @<%= @orm.name_singular %>.id), :method => :put, :class => 'form-horizontal' do |f|
8
8
  = partial '<%= @orm.name_plural %>/form', :locals => { :f => f }
@@ -21,7 +21,7 @@ div class="tabs-content"
21
21
  div class='arrow'
22
22
  h3 class='popover-title' = pat(:delete_selected_title)
23
23
  div class='popover-content'
24
- - form_tag url(:<%= @orm.name_plural %>, :destroy_many), :method => :delete do
24
+ = form_tag url(:<%= @orm.name_plural %>, :destroy_many), :method => :delete do
25
25
  = hidden_field_tag :<%= @orm.name_singular %>_ids, :'data-delete-many-ids' => true
26
26
  = submit_tag pat(:delete), :class =>'list-menu-popover-delete-selected-btn btn btn-danger btn-small'
27
27
  div class='btn btn-default btn-small cancel' = pat(:cancel)
@@ -51,6 +51,6 @@ div class="tabs-content"
51
51
  div class='arrow'
52
52
  h3 class='popover-title' = pat(:delete, :model => "<%= @orm.name_singular %>")
53
53
  div class='popover-content'
54
- - form_tag url(:<%= @orm.name_plural %>, :destroy, :id => <%= @orm.name_singular %>.id), :method => :delete do
54
+ = form_tag url(:<%= @orm.name_plural %>, :destroy, :id => <%= @orm.name_singular %>.id), :method => :delete do
55
55
  = submit_tag pat(:delete), :class =>'list-row-action-popover-delete-one-btn btn btn-danger btn-small'
56
- div class='btn btn-default btn-small cancel' = pat(:cancel)
56
+ div class='btn btn-default btn-small cancel' = pat(:cancel)
@@ -3,5 +3,5 @@ ul class="nav nav-tabs"
3
3
  li class="active" = link_to tag_icon(:plus, pat(:new)), url(:<%= @orm.name_plural %>, :new)
4
4
 
5
5
  div class="tabs-content"
6
- - form_for :<%= @orm.name_singular %>, url(:<%= @orm.name_plural %>, :create), :class => 'form-horizontal' do |f|
6
+ = form_for :<%= @orm.name_singular %>, url(:<%= @orm.name_plural %>, :create), :class => 'form-horizontal' do |f|
7
7
  = partial '<%= @orm.name_plural %>/form', :locals => { :f => f }
@@ -63,7 +63,7 @@ module Padrino
63
63
  # Store in session[:return_to] the env['REQUEST_URI'].
64
64
  #
65
65
  def store_location!
66
- session[:return_to] = env['REQUEST_URI']
66
+ session[:return_to] = "#{ENV['RACK_BASE_URI']}#{env['REQUEST_URI']}" if env['REQUEST_URI']
67
67
  end
68
68
 
69
69
  ##
@@ -14,6 +14,7 @@ Gem::Specification.new do |s|
14
14
  s.required_rubygems_version = ">= 1.3.6"
15
15
  s.version = Padrino.version
16
16
  s.date = Time.now.strftime("%Y-%m-%d")
17
+ s.license = "MIT"
17
18
 
18
19
  s.extra_rdoc_files = Dir["*.rdoc"]
19
20
  s.files = `git ls-files`.split("\n")
@@ -6,6 +6,26 @@ describe "AdminApplication" do
6
6
  load_fixture 'data_mapper'
7
7
  end
8
8
 
9
+ describe "session id setting" do
10
+ it "should provide it if it doesn't exist" do
11
+ mock_app do
12
+ register Padrino::Admin::AccessControl
13
+ end
14
+
15
+ assert_equal @app.session_id, "_padrino_#{File.basename(Padrino.root)}_#{@app.app_name}".to_sym
16
+ end
17
+
18
+ # it "should preserve it if it already existed" do
19
+ # Padrino.configure_apps { enable :sessions; set :session_id, "foo" }
20
+
21
+ # mock_app do
22
+ # register Padrino::Admin::AccessControl
23
+ # end
24
+
25
+ # assert_equal @app.session_id, "foo"
26
+ # end
27
+ end
28
+
9
29
  it 'should require correctly login' do
10
30
  mock_app do
11
31
  register Padrino::Admin::AccessControl
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: padrino-admin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.4
4
+ version: 0.12.0.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Padrino Team
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2013-09-24 00:00:00.000000000 Z
14
+ date: 2013-12-31 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: padrino-core
@@ -19,28 +19,28 @@ dependencies:
19
19
  requirements:
20
20
  - - '='
21
21
  - !ruby/object:Gem::Version
22
- version: 0.11.4
22
+ version: 0.12.0.rc1
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - '='
28
28
  - !ruby/object:Gem::Version
29
- version: 0.11.4
29
+ version: 0.12.0.rc1
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: padrino-helpers
32
32
  requirement: !ruby/object:Gem::Requirement
33
33
  requirements:
34
34
  - - '='
35
35
  - !ruby/object:Gem::Version
36
- version: 0.11.4
36
+ version: 0.12.0.rc1
37
37
  type: :runtime
38
38
  prerelease: false
39
39
  version_requirements: !ruby/object:Gem::Requirement
40
40
  requirements:
41
41
  - - '='
42
42
  - !ruby/object:Gem::Version
43
- version: 0.11.4
43
+ version: 0.12.0.rc1
44
44
  - !ruby/object:Gem::Dependency
45
45
  name: therubyracer
46
46
  requirement: !ruby/object:Gem::Requirement
@@ -265,7 +265,8 @@ files:
265
265
  - test/test_admin_application.rb
266
266
  - test/test_locale.rb
267
267
  homepage: http://www.padrinorb.com
268
- licenses: []
268
+ licenses:
269
+ - MIT
269
270
  metadata: {}
270
271
  post_install_message:
271
272
  rdoc_options:
@@ -279,9 +280,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
279
280
  version: '0'
280
281
  required_rubygems_version: !ruby/object:Gem::Requirement
281
282
  requirements:
282
- - - '>='
283
+ - - '>'
283
284
  - !ruby/object:Gem::Version
284
- version: 1.3.6
285
+ version: 1.3.1
285
286
  requirements: []
286
287
  rubyforge_project: padrino-admin
287
288
  rubygems_version: 2.0.6