lalala 4.0.0.dev.165 → 4.0.0.dev.168

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8d09f6cbd3bc0bf378e619fc8fec19048a28690f
4
- data.tar.gz: a5821336b7851714566f7c848f90630eeeebfa0b
3
+ metadata.gz: 1b5f31ad479a2cdad90fdcfd6fda2733024dd1c3
4
+ data.tar.gz: 6a3c7d2ec51583cfc9e8a83ed0f19d0ef84dd74b
5
5
  SHA512:
6
- metadata.gz: 492462e6f2cf0ded49d860a6d9654a1936b73f67193f610d878651a5fe4002cc4f71519d75c2872d7404ce4ae3d4aa26eadd793f3f90321f4e9785a27b3b0433
7
- data.tar.gz: 7d7307073c1f0e35881d5639d24b676b3271414734181e539a6345b5faf9c38343bb47e7d4a565fea82129b6111d40394f22427a8ad3a9c3af59b39cdb7e081d
6
+ metadata.gz: 040befd4fb4361625f2dcffe2f3a29bfb7603f00902f7e1c54ae7168f7f932ed5da4c36ac2f6d587ce024b5a0705022153a249f386ffbea6919eb1b8e2ae142f
7
+ data.tar.gz: 73132af6063adc89d770c241b8d40a6f69664fccc5c8807c960e4f88c874220d7c8e38de5983de13e33480e7c0ce44fdde5df08d838cf765641943c489acb902
@@ -0,0 +1,19 @@
1
+ class Lalala::AdminUser < ActiveRecord::Base
2
+ self.table_name = 'admin_users'
3
+ self.abstract_class = true
4
+
5
+ # Include default devise modules. Others available are:
6
+ # :token_authenticatable, :confirmable,
7
+ # :lockable, :timeoutable and :omniauthable
8
+ devise :database_authenticatable,
9
+ :recoverable, :rememberable, :trackable, :validatable
10
+
11
+ # Setup accessible (or protected) attributes for your model
12
+ attr_accessible :name, :email, :password, :password_confirmation, :remember_me
13
+ # attr_accessible :title, :body
14
+
15
+ validates :name,
16
+ presence: true,
17
+ uniqueness: true
18
+
19
+ end
@@ -0,0 +1,240 @@
1
+ # Use this hook to configure devise mailer, warden hooks and so forth.
2
+ # Many of these configuration options can be set straight in your model.
3
+ Devise.setup do |config|
4
+ # ==> Mailer Configuration
5
+ # Configure the e-mail address which will be shown in Devise::Mailer,
6
+ # note that it will be overwritten if you use your own mailer class with default "from" parameter.
7
+ config.mailer_sender = "hello@mrhenry.be"
8
+
9
+ # Configure the class responsible to send e-mails.
10
+ # config.mailer = "Devise::Mailer"
11
+
12
+ # ==> ORM configuration
13
+ # Load and configure the ORM. Supports :active_record (default) and
14
+ # :mongoid (bson_ext recommended) by default. Other ORMs may be
15
+ # available as additional gems.
16
+ require 'devise/orm/active_record'
17
+
18
+ # ==> Configuration for any authentication mechanism
19
+ # Configure which keys are used when authenticating a user. The default is
20
+ # just :email. You can configure it to use [:username, :subdomain], so for
21
+ # authenticating a user, both parameters are required. Remember that those
22
+ # parameters are used only when authenticating and not when retrieving from
23
+ # session. If you need permissions, you should implement that in a before filter.
24
+ # You can also supply a hash where the value is a boolean determining whether
25
+ # or not authentication should be aborted when the value is not present.
26
+ # config.authentication_keys = [ :email ]
27
+
28
+ # Configure parameters from the request object used for authentication. Each entry
29
+ # given should be a request method and it will automatically be passed to the
30
+ # find_for_authentication method and considered in your model lookup. For instance,
31
+ # if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
32
+ # The same considerations mentioned for authentication_keys also apply to request_keys.
33
+ # config.request_keys = []
34
+
35
+ # Configure which authentication keys should be case-insensitive.
36
+ # These keys will be downcased upon creating or modifying a user and when used
37
+ # to authenticate or find a user. Default is :email.
38
+ config.case_insensitive_keys = [ :email ]
39
+
40
+ # Configure which authentication keys should have whitespace stripped.
41
+ # These keys will have whitespace before and after removed upon creating or
42
+ # modifying a user and when used to authenticate or find a user. Default is :email.
43
+ config.strip_whitespace_keys = [ :email ]
44
+
45
+ # Tell if authentication through request.params is enabled. True by default.
46
+ # It can be set to an array that will enable params authentication only for the
47
+ # given strategies, for example, `config.params_authenticatable = [:database]` will
48
+ # enable it only for database (email + password) authentication.
49
+ # config.params_authenticatable = true
50
+
51
+ # Tell if authentication through HTTP Basic Auth is enabled. False by default.
52
+ # It can be set to an array that will enable http authentication only for the
53
+ # given strategies, for example, `config.http_authenticatable = [:token]` will
54
+ # enable it only for token authentication.
55
+ # config.http_authenticatable = false
56
+
57
+ # If http headers should be returned for AJAX requests. True by default.
58
+ # config.http_authenticatable_on_xhr = true
59
+
60
+ # The realm used in Http Basic Authentication. "Application" by default.
61
+ # config.http_authentication_realm = "Application"
62
+
63
+ # It will change confirmation, password recovery and other workflows
64
+ # to behave the same regardless if the e-mail provided was right or wrong.
65
+ # Does not affect registerable.
66
+ # config.paranoid = true
67
+
68
+ # By default Devise will store the user in session. You can skip storage for
69
+ # :http_auth and :token_auth by adding those symbols to the array below.
70
+ # Notice that if you are skipping storage for all authentication paths, you
71
+ # may want to disable generating routes to Devise's sessions controller by
72
+ # passing :skip => :sessions to `devise_for` in your config/routes.rb
73
+ config.skip_session_storage = [:http_auth]
74
+
75
+ # ==> Configuration for :database_authenticatable
76
+ # For bcrypt, this is the cost for hashing the password and defaults to 10. If
77
+ # using other encryptors, it sets how many times you want the password re-encrypted.
78
+ #
79
+ # Limiting the stretches to just one in testing will increase the performance of
80
+ # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
81
+ # a value less than 10 in other environments.
82
+ config.stretches = Rails.env.test? ? 1 : 10
83
+
84
+ # Setup a pepper to generate the encrypted password.
85
+ # config.pepper = "37ce281d9639297d9717165f5edf58bda617dea1502ed99bcbae0d5164da3f46d53fcd4f76168c1e768fedffb57a73cc06b94676cfda86674ef796c0b806d7a4"
86
+
87
+ # ==> Configuration for :confirmable
88
+ # A period that the user is allowed to access the website even without
89
+ # confirming his account. For instance, if set to 2.days, the user will be
90
+ # able to access the website for two days without confirming his account,
91
+ # access will be blocked just in the third day. Default is 0.days, meaning
92
+ # the user cannot access the website without confirming his account.
93
+ # config.allow_unconfirmed_access_for = 2.days
94
+
95
+ # A period that the user is allowed to confirm their account before their
96
+ # token becomes invalid. For example, if set to 3.days, the user can confirm
97
+ # their account within 3 days after the mail was sent, but on the fourth day
98
+ # their account can't be confirmed with the token any more.
99
+ # Default is nil, meaning there is no restriction on how long a user can take
100
+ # before confirming their account.
101
+ # config.confirm_within = 3.days
102
+
103
+ # If true, requires any email changes to be confirmed (exactly the same way as
104
+ # initial account confirmation) to be applied. Requires additional unconfirmed_email
105
+ # db field (see migrations). Until confirmed new email is stored in
106
+ # unconfirmed email column, and copied to email column on successful confirmation.
107
+ config.reconfirmable = true
108
+
109
+ # Defines which key will be used when confirming an account
110
+ # config.confirmation_keys = [ :email ]
111
+
112
+ # ==> Configuration for :rememberable
113
+ # The time the user will be remembered without asking for credentials again.
114
+ # config.remember_for = 2.weeks
115
+
116
+ # If true, extends the user's remember period when remembered via cookie.
117
+ # config.extend_remember_period = false
118
+
119
+ # Options to be passed to the created cookie. For instance, you can set
120
+ # :secure => true in order to force SSL only cookies.
121
+ # config.rememberable_options = {}
122
+
123
+ # ==> Configuration for :validatable
124
+ # Range for password length. Default is 8..128.
125
+ config.password_length = 8..128
126
+
127
+ # Email regex used to validate email formats. It simply asserts that
128
+ # an one (and only one) @ exists in the given string. This is mainly
129
+ # to give user feedback and not to assert the e-mail validity.
130
+ # config.email_regexp = /\A[^@]+@[^@]+\z/
131
+
132
+ # ==> Configuration for :timeoutable
133
+ # The time you want to timeout the user session without activity. After this
134
+ # time the user will be asked for credentials again. Default is 30 minutes.
135
+ # config.timeout_in = 30.minutes
136
+
137
+ # If true, expires auth token on session timeout.
138
+ # config.expire_auth_token_on_timeout = false
139
+
140
+ # ==> Configuration for :lockable
141
+ # Defines which strategy will be used to lock an account.
142
+ # :failed_attempts = Locks an account after a number of failed attempts to sign in.
143
+ # :none = No lock strategy. You should handle locking by yourself.
144
+ # config.lock_strategy = :failed_attempts
145
+
146
+ # Defines which key will be used when locking and unlocking an account
147
+ # config.unlock_keys = [ :email ]
148
+
149
+ # Defines which strategy will be used to unlock an account.
150
+ # :email = Sends an unlock link to the user email
151
+ # :time = Re-enables login after a certain amount of time (see :unlock_in below)
152
+ # :both = Enables both strategies
153
+ # :none = No unlock strategy. You should handle unlocking by yourself.
154
+ # config.unlock_strategy = :both
155
+
156
+ # Number of authentication tries before locking an account if lock_strategy
157
+ # is failed attempts.
158
+ # config.maximum_attempts = 20
159
+
160
+ # Time interval to unlock the account if :time is enabled as unlock_strategy.
161
+ # config.unlock_in = 1.hour
162
+
163
+ # ==> Configuration for :recoverable
164
+ #
165
+ # Defines which key will be used when recovering the password for an account
166
+ # config.reset_password_keys = [ :email ]
167
+
168
+ # Time interval you can reset your password with a reset password key.
169
+ # Don't put a too small interval or your users won't have the time to
170
+ # change their passwords.
171
+ config.reset_password_within = 6.hours
172
+
173
+ # ==> Configuration for :encryptable
174
+ # Allow you to use another encryption algorithm besides bcrypt (default). You can use
175
+ # :sha1, :sha512 or encryptors from others authentication tools as :clearance_sha1,
176
+ # :authlogic_sha512 (then you should set stretches above to 20 for default behavior)
177
+ # and :restful_authentication_sha1 (then you should set stretches to 10, and copy
178
+ # REST_AUTH_SITE_KEY to pepper)
179
+ # config.encryptor = :sha512
180
+
181
+ # ==> Configuration for :token_authenticatable
182
+ # Defines name of the authentication token params key
183
+ # config.token_authentication_key = :auth_token
184
+
185
+ # ==> Scopes configuration
186
+ # Turn scoped views on. Before rendering "sessions/new", it will first check for
187
+ # "users/sessions/new". It's turned off by default because it's slower if you
188
+ # are using only default views.
189
+ # config.scoped_views = false
190
+
191
+ # Configure the default scope given to Warden. By default it's the first
192
+ # devise role declared in your routes (usually :user).
193
+ # config.default_scope = :user
194
+
195
+ # Set this configuration to false if you want /users/sign_out to sign out
196
+ # only the current scope. By default, Devise signs out all scopes.
197
+ # config.sign_out_all_scopes = true
198
+
199
+ # ==> Navigation configuration
200
+ # Lists the formats that should be treated as navigational. Formats like
201
+ # :html, should redirect to the sign in page when the user does not have
202
+ # access, but formats like :xml or :json, should return 401.
203
+ #
204
+ # If you have any extra navigational formats, like :iphone or :mobile, you
205
+ # should add them to the navigational formats lists.
206
+ #
207
+ # The "*/*" below is required to match Internet Explorer requests.
208
+ # config.navigational_formats = ["*/*", :html]
209
+
210
+ # The default HTTP method used to sign out a resource. Default is :delete.
211
+ config.sign_out_via = :delete
212
+
213
+ # ==> OmniAuth
214
+ # Add a new OmniAuth provider. Check the wiki for more information on setting
215
+ # up on your models and hooks.
216
+ # config.omniauth :github, 'APP_ID', 'APP_SECRET', :scope => 'user,public_repo'
217
+
218
+ # ==> Warden configuration
219
+ # If you want to use other strategies, that are not supported by Devise, or
220
+ # change the failure app, you can configure them inside the config.warden block.
221
+ #
222
+ # config.warden do |manager|
223
+ # manager.intercept_401 = false
224
+ # manager.default_strategies(:scope => :user).unshift :some_external_strategy
225
+ # end
226
+
227
+ # ==> Mountable engine configurations
228
+ # When using Devise inside an engine, let's call it `MyEngine`, and this engine
229
+ # is mountable, there are some extra configurations to be taken into account.
230
+ # The following options are available, assuming the engine is mounted as:
231
+ #
232
+ # mount MyEngine, at: "/my_engine"
233
+ #
234
+ # The router that invoked `devise_for`, in the example above, would be:
235
+ # config.router_name = :my_engine
236
+ #
237
+ # When using omniauth, Devise cannot automatically set Omniauth path,
238
+ # so you need to do it manually. For the users scope, it would be:
239
+ # config.omniauth_path_prefix = "/my_engine/users/auth"
240
+ end
@@ -2,7 +2,7 @@ class DeviseCreateAdminUsers < ActiveRecord::Migration
2
2
  def migrate(direction)
3
3
  super
4
4
  # Create a default user
5
- AdminUser.create!(:email => 'admin@example.com', :password => 'password', :password_confirmation => 'password') if direction == :up
5
+ AdminUser.create!(:name => 'Admin', :email => 'admin@example.com', :password => 'password', :password_confirmation => 'password') if direction == :up
6
6
  end
7
7
 
8
8
  def change
@@ -0,0 +1,7 @@
1
+ class AddNameToAdminUsers < ActiveRecord::Migration
2
+ def change
3
+ change_table :admin_users do |t|
4
+ t.string :name
5
+ end
6
+ end
7
+ end
@@ -9,8 +9,6 @@ module Lalala
9
9
  desc "Installs Active Admin and generates the necessary migrations"
10
10
  argument :name, :type => :string, :default => "AdminUser"
11
11
 
12
- hook_for :users, :default => "devise", :desc => "Admin user generator to run. Skip with --skip-users"
13
-
14
12
  def self.source_root
15
13
  @_active_admin_source_root ||= File.expand_path("../templates", __FILE__)
16
14
  end
@@ -36,9 +34,16 @@ module Lalala
36
34
  copy_file "models/image_asset.rb", "app/models/image_asset.rb"
37
35
  end
38
36
 
37
+ def setup_admin_users
38
+ empty_directory "app/models"
39
+ template 'models/admin_user.rb', 'app/models/admin_user.rb'
40
+ empty_directory "app/admin"
41
+ template 'admin_users.rb', 'app/admin/admin_users.rb'
42
+ end
43
+
39
44
  def setup_pages
40
45
  empty_directory "app/pages"
41
- template 'application_page.rb', 'app/pages/application_page.rb'
46
+ template 'models/application_page.rb', 'app/pages/application_page.rb'
42
47
  empty_directory "app/controllers"
43
48
  template 'pages_controller.rb', 'app/controllers/pages_controller.rb'
44
49
  empty_directory "app/admin"
@@ -48,16 +53,12 @@ module Lalala
48
53
  def setup_directory
49
54
  empty_directory "app/admin"
50
55
  template 'dashboard.rb', 'app/admin/dashboard.rb'
51
- if options[:users].present?
52
- @user_class = name
53
- template 'admin_user.rb.erb', "app/admin/#{name.underscore.pluralize}.rb"
54
- end
55
56
  end
56
57
 
57
58
  def setup_uploaders
58
59
  empty_directory "app/uploaders"
59
- copy_file "uploaders/file.rb", "app/uploaders/file.rb"
60
- copy_file "uploaders/image.rb", "app/uploaders/image.rb"
60
+ copy_file "uploaders/file_uploader.rb", "app/uploaders/file_uploader.rb"
61
+ copy_file "uploaders/image_uploader.rb", "app/uploaders/image_uploader.rb"
61
62
  end
62
63
 
63
64
  def create_assets
@@ -1,11 +1,6 @@
1
1
  ActiveAdmin.register ApplicationPage, :as => 'Page' do
2
2
  # Customize the pages resource
3
3
 
4
- menu :priority => 2
5
-
6
- # Disable pagination
7
- config.paginate = false
8
-
9
4
  # Enable the filter
10
5
  # config.filters = false
11
6
 
@@ -0,0 +1,2 @@
1
+ ActiveAdmin.register AdminUser do
2
+ end
@@ -0,0 +1,2 @@
1
+ class AdminUser < Lalala::AdminUser
2
+ end
@@ -0,0 +1,29 @@
1
+ if defined?(ActiveAdmin) and defined?(AdminUser)
2
+ ActiveAdmin.register AdminUser do
3
+
4
+ menu priority: 90, html_options: { class: 'icon-user_gray' }
5
+
6
+ filter :name
7
+ filter :email
8
+
9
+ index do
10
+ column :name
11
+ column :email
12
+ column :current_sign_in_at
13
+ column :last_sign_in_at
14
+ column :sign_in_count
15
+ default_actions
16
+ end
17
+
18
+ form do |f|
19
+ f.inputs "Admin Details" do
20
+ f.input :name
21
+ f.input :email
22
+ f.input :password
23
+ f.input :password_confirmation
24
+ end
25
+ f.actions
26
+ end
27
+
28
+ end
29
+ end
@@ -1,7 +1,10 @@
1
1
  if defined?(ActiveAdmin) and defined?(ApplicationPage)
2
2
  ActiveAdmin.register ApplicationPage, :as => 'Page' do
3
3
 
4
- config.filters = false
4
+ menu priority: 20, html_options: { class: 'icon-page' }
5
+
6
+ config.filters = false
7
+ config.paginate = false
5
8
 
6
9
  index as: :tree_table, paginator: false, download_links: false do
7
10
  selectable_column
data/lib/lalala/engine.rb CHANGED
@@ -1,4 +1,6 @@
1
1
  module Lalala
2
+ require 'lalala'
3
+
2
4
  class Engine < Rails::Engine
3
5
 
4
6
  config.i18n.fallbacks = true
@@ -86,11 +88,13 @@ module Lalala
86
88
  Lalala::ExtWithAdvisoryLock.patch!
87
89
  end
88
90
 
89
- Formtastic::FormBuilder.send(
90
- :include, Lalala::Markdown::InputHelper)
91
+ if defined?(Formtastic)
92
+ Formtastic::FormBuilder.send(
93
+ :include, Lalala::Markdown::InputHelper)
91
94
 
92
- Formtastic::FormBuilder.send(
93
- :include, Lalala::ExtI18n::InputHelper)
95
+ Formtastic::FormBuilder.send(
96
+ :include, Lalala::ExtI18n::InputHelper)
97
+ end
94
98
 
95
99
  ActiveSupport.on_load :active_record do
96
100
 
@@ -1,6 +1,6 @@
1
1
  module Lalala
2
2
  VERSION = "4.0.0"
3
- BUILD = "165"
3
+ BUILD = "168"
4
4
 
5
5
  if BUILD != ("{{BUILD_NUMBER" + "}}") # prevent sed replacement (see script/ci)
6
6
  BUILD_VERSION = "#{VERSION}.dev.#{BUILD}"
data/lib/lalala.rb CHANGED
@@ -24,7 +24,6 @@ module Lalala
24
24
  require 'stringex'
25
25
  require 'activeadmin'
26
26
 
27
-
28
27
  if groups.include?(:assets)
29
28
  require 'lalala/assets'
30
29
  end
@@ -1,8 +1,6 @@
1
1
  ActiveAdmin.register ApplicationPage, :as => 'Page' do
2
2
  # Customize the pages resource
3
3
 
4
- menu :priority => 2
5
-
6
4
  # Enable the filter
7
5
  # config.filters = false
8
6
 
@@ -1,20 +1,2 @@
1
1
  ActiveAdmin.register AdminUser do
2
- index do
3
- column :email
4
- column :current_sign_in_at
5
- column :last_sign_in_at
6
- column :sign_in_count
7
- default_actions
8
- end
9
-
10
- filter :email
11
-
12
- form do |f|
13
- f.inputs "Admin Details" do
14
- f.input :email
15
- f.input :password
16
- f.input :password_confirmation
17
- end
18
- f.actions
19
- end
20
2
  end
@@ -1,11 +1,2 @@
1
- class AdminUser < ActiveRecord::Base
2
- # Include default devise modules. Others available are:
3
- # :token_authenticatable, :confirmable,
4
- # :lockable, :timeoutable and :omniauthable
5
- devise :database_authenticatable,
6
- :recoverable, :rememberable, :trackable, :validatable
7
-
8
- # Setup accessible (or protected) attributes for your model
9
- attr_accessible :email, :password, :password_confirmation, :remember_me
10
- # attr_accessible :title, :body
1
+ class AdminUser < Lalala::AdminUser
11
2
  end
@@ -4,7 +4,7 @@ Devise.setup do |config|
4
4
  # ==> Mailer Configuration
5
5
  # Configure the e-mail address which will be shown in Devise::Mailer,
6
6
  # note that it will be overwritten if you use your own mailer class with default "from" parameter.
7
- config.mailer_sender = "please-change-me-at-config-initializers-devise@example.com"
7
+ config.mailer_sender = "hello@mrhenry.be"
8
8
 
9
9
  # Configure the class responsible to send e-mails.
10
10
  # config.mailer = "Devise::Mailer"
@@ -11,7 +11,7 @@
11
11
  #
12
12
  # It's strongly recommended to check this file into your version control system.
13
13
 
14
- ActiveRecord::Schema.define(:version => 20130506155010) do
14
+ ActiveRecord::Schema.define(:version => 20130524155010) do
15
15
 
16
16
  create_table "active_admin_comments", :force => true do |t|
17
17
  t.string "resource_id", :null => false
@@ -41,6 +41,7 @@ ActiveRecord::Schema.define(:version => 20130506155010) do
41
41
  t.string "last_sign_in_ip"
42
42
  t.datetime "created_at", :null => false
43
43
  t.datetime "updated_at", :null => false
44
+ t.string "name"
44
45
  end
45
46
 
46
47
  add_index "admin_users", ["email"], :name => "index_admin_users_on_email", :unique => true
@@ -0,0 +1,43 @@
1
+ require File.dirname(__FILE__) + '/../test_helper'
2
+
3
+ class AdminUsersTest < ActionDispatch::IntegrationTest
4
+
5
+ def setup
6
+ login_as_admin!
7
+ end
8
+
9
+ test 'list users' do
10
+ click_on('Admin Users')
11
+ assert page.has_text?('admin@example.com')
12
+ end
13
+
14
+ test 'create user' do
15
+ click_on('Admin Users')
16
+ click_on('New Admin User')
17
+ assert_equal('/lalala/admin_users/new', current_path)
18
+
19
+ fill_in('Name', with: 'Mr. Manager')
20
+ fill_in('Email', with: 'manager@example.com')
21
+ fill_in('admin_user[password]', with: 'foobarbaz!')
22
+ fill_in('admin_user[password_confirmation]', with: 'foobarbaz!')
23
+ click_on('Create Admin user')
24
+ assert_equal('/lalala/admin_users/2', current_path)
25
+
26
+ assert page.has_text?('manager@example.com')
27
+ assert page.has_text?('Mr. Manager')
28
+ end
29
+
30
+ private
31
+
32
+ def login_as_admin!
33
+ AdminUser.create! name: 'Admin', email: 'admin@example.com', password: 'password', password_confirmation: 'password'
34
+
35
+ visit('/lalala')
36
+ assert_equal(new_admin_user_session_path, current_path)
37
+ fill_in('Email', with: 'admin@example.com')
38
+ fill_in('Password', with: 'password')
39
+ click_on('Login')
40
+ assert_equal('/lalala', current_path)
41
+ end
42
+
43
+ end
@@ -3,7 +3,7 @@ require File.dirname(__FILE__) + '/../test_helper'
3
3
  class LoginIntegrationTest < ActionDispatch::IntegrationTest
4
4
 
5
5
  def setup
6
- AdminUser.create! email: 'admin@example.com', password: 'password', password_confirmation: 'password'
6
+ AdminUser.create! name: 'Admin', email: 'admin@example.com', password: 'password', password_confirmation: 'password'
7
7
  end
8
8
 
9
9
  test 'when not loged in whe should be redirected to the login page' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lalala
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0.dev.165
4
+ version: 4.0.0.dev.168
5
5
  platform: ruby
6
6
  authors:
7
7
  - Simon Menke
@@ -1320,6 +1320,7 @@ files:
1320
1320
  - app/controllers/lalala/public/errors_controller.rb
1321
1321
  - app/controllers/lalala/public/pages_controller.rb
1322
1322
  - app/models/lalala/abstract_asset.rb
1323
+ - app/models/lalala/admin_user.rb
1323
1324
  - app/models/lalala/file_asset.rb
1324
1325
  - app/models/lalala/image_asset.rb
1325
1326
  - app/models/lalala/page.rb
@@ -1332,6 +1333,7 @@ files:
1332
1333
  - app/views/layouts/lalala/markdown.html.erb
1333
1334
  - config/initializers/active_admin.rb
1334
1335
  - config/initializers/carrierwave.rb
1336
+ - config/initializers/devise.rb
1335
1337
  - config/routes.rb
1336
1338
  - db/migrate/20130321140345_devise_create_admin_users.rb
1337
1339
  - db/migrate/20130321140351_create_admin_notes.rb
@@ -1340,6 +1342,7 @@ files:
1340
1342
  - db/migrate/20130328171232_create_images.rb
1341
1343
  - db/migrate/20130423142125_replace_images_with_assets.rb
1342
1344
  - db/migrate/20130506155010_add_locale_to_asset_translations.rb
1345
+ - db/migrate/20130524155010_add_name_to_admin_users.rb
1343
1346
  - lalala-assets.gemspec
1344
1347
  - lalala-development.gemspec
1345
1348
  - lalala-test.gemspec
@@ -1349,14 +1352,14 @@ files:
1349
1352
  - lib/generators/lalala/assets/assets_generator.rb
1350
1353
  - lib/generators/lalala/assets/templates/active_admin.css.scss
1351
1354
  - lib/generators/lalala/assets/templates/active_admin.js
1352
- - lib/generators/lalala/devise/devise_generator.rb
1353
1355
  - lib/generators/lalala/install/install_generator.rb
1354
1356
  - lib/generators/lalala/install/templates/active_admin.rb.erb
1355
1357
  - lib/generators/lalala/install/templates/admin_pages.rb
1356
- - lib/generators/lalala/install/templates/admin_user.rb.erb
1357
- - lib/generators/lalala/install/templates/application_page.rb
1358
+ - lib/generators/lalala/install/templates/admin_users.rb
1358
1359
  - lib/generators/lalala/install/templates/dashboard.rb
1359
1360
  - lib/generators/lalala/install/templates/errors_controller.rb
1361
+ - lib/generators/lalala/install/templates/models/admin_user.rb
1362
+ - lib/generators/lalala/install/templates/models/application_page.rb
1360
1363
  - lib/generators/lalala/install/templates/models/file_asset.rb
1361
1364
  - lib/generators/lalala/install/templates/models/image_asset.rb
1362
1365
  - lib/generators/lalala/install/templates/pages_controller.rb
@@ -1368,6 +1371,7 @@ files:
1368
1371
  - lib/generators/lalala/resource/USAGE
1369
1372
  - lib/generators/lalala/resource/resource_generator.rb
1370
1373
  - lib/lalala.rb
1374
+ - lib/lalala/admin/admin_users.rb
1371
1375
  - lib/lalala/admin/pages.rb
1372
1376
  - lib/lalala/assets.rb
1373
1377
  - lib/lalala/cache.rb
@@ -1470,6 +1474,7 @@ files:
1470
1474
  - test/dummy/test/unit/admin_user_test.rb
1471
1475
  - test/dummy/tmp/cache/.gitkeep
1472
1476
  - test/i18n/router_test.rb
1477
+ - test/integration/admin_users_test.rb
1473
1478
  - test/integration/login_test.rb
1474
1479
  - test/lalala_test.rb
1475
1480
  - test/test_helper.rb
@@ -1548,6 +1553,7 @@ test_files:
1548
1553
  - test/dummy/test/unit/admin_user_test.rb
1549
1554
  - test/dummy/tmp/cache/.gitkeep
1550
1555
  - test/i18n/router_test.rb
1556
+ - test/integration/admin_users_test.rb
1551
1557
  - test/integration/login_test.rb
1552
1558
  - test/lalala_test.rb
1553
1559
  - test/test_helper.rb
@@ -1,44 +0,0 @@
1
- module Lalala
2
- module Generators
3
- class DeviseGenerator < Rails::Generators::NamedBase
4
- desc "Creates an admin user and uses Devise for authentication"
5
- argument :name, :type => :string, :default => "AdminUser"
6
-
7
- class_option :registerable, :type => :boolean, :default => false,
8
- :desc => "Should the generated resource be registerable?"
9
-
10
- def install_devise
11
- require 'devise'
12
- if File.exists?(File.join(destination_root, "config", "initializers", "devise.rb"))
13
- log :generate, "No need to install devise, already done."
14
- else
15
- log :generate, "devise:install"
16
- invoke "devise:install"
17
- end
18
- end
19
-
20
- def create_admin_user
21
- invoke "devise", [name]
22
- end
23
-
24
- def remove_registerable_from_model
25
- unless options[:registerable]
26
- model_file = File.join(destination_root, "app", "models", "#{file_path}.rb")
27
- gsub_file model_file, /\:registerable([.]*,)?/, ""
28
- end
29
- end
30
-
31
- def set_namespace_for_path
32
- routes_file = File.join(destination_root, "config", "routes.rb")
33
- gsub_file routes_file, /devise_for :#{plural_table_name}/, "devise_for :#{plural_table_name}, ActiveAdmin::Devise.config"
34
- end
35
-
36
- def remove_migration
37
- # Don't assume that we have a migration!
38
- devise_migration_file = Dir["db/migrate/*_devise_create_#{table_name}.rb"].first
39
- return if devise_migration_file.nil?
40
- File.unlink(devise_migration_file)
41
- end
42
- end
43
- end
44
- end
@@ -1,20 +0,0 @@
1
- ActiveAdmin.register <%= @user_class %> do
2
- index do
3
- column :email
4
- column :current_sign_in_at
5
- column :last_sign_in_at
6
- column :sign_in_count
7
- default_actions
8
- end
9
-
10
- filter :email
11
-
12
- form do |f|
13
- f.inputs "Admin Details" do
14
- f.input :email
15
- f.input :password
16
- f.input :password_confirmation
17
- end
18
- f.actions
19
- end
20
- end