typus 1.0.0.pre → 1.0.0.pre2
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.
- data/Gemfile +0 -1
- data/Gemfile.lock +0 -2
- data/app/controllers/admin/account_controller.rb +1 -1
- data/app/controllers/{admin_controller.rb → admin/base_controller.rb} +1 -1
- data/app/controllers/admin/dashboard_controller.rb +1 -1
- data/app/controllers/admin/resource_controller.rb +1 -1
- data/app/controllers/admin/resources_controller.rb +1 -1
- data/app/controllers/admin/session_controller.rb +1 -1
- data/app/helpers/admin/base_helper.rb +60 -0
- data/app/views/admin/session/new.html.erb +1 -1
- data/app/views/layouts/{admin.html.erb → admin/base.html.erb} +0 -0
- data/lib/generators/templates/public/admin/javascripts/jquery.rails.js +17 -11
- data/lib/generators/templates/public/admin/stylesheets/screen.css +1 -0
- data/lib/generators/typus/migration_generator.rb +1 -1
- data/lib/generators/typus/typus_generator.rb +2 -2
- data/lib/typus/format.rb +1 -1
- data/lib/typus/orm/active_record.rb +7 -9
- data/lib/typus/user.rb +3 -3
- data/lib/typus/version.rb +1 -1
- data/test/fixtures/rails_app/config/routes.rb +1 -4
- data/test/fixtures/rails_app/log/test.log +41948 -1879
- data/test/fixtures/rails_app/tmp/{export-posts-20100902120447.csv → export-posts-20100913124503.csv} +0 -0
- data/test/fixtures/rails_app/tmp/{export-posts-20100902120700.csv → export-posts-20100913124524.csv} +0 -0
- data/test/fixtures/rails_app/tmp/export-posts-20100913124638.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20100913124717.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20100913125425.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20100913125626.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20100913125651.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20100913125741.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20100913125827.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20100913125856.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20100913125928.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20100913130119.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20100913130159.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20100913130319.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20100913130339.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20100913131400.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20100913131915.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20100913132022.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20100913132844.csv +2 -0
- data/test/lib/typus/active_record_test.rb +49 -18
- data/test/lib/typus/configuration_test.rb +7 -7
- data/test/unit/typus_user_test.rb +37 -21
- metadata +26 -10
- data/app/helpers/admin_helper.rb +0 -56
data/test/fixtures/rails_app/tmp/{export-posts-20100902120447.csv → export-posts-20100913124503.csv}
RENAMED
File without changes
|
data/test/fixtures/rails_app/tmp/{export-posts-20100902120700.csv → export-posts-20100913124524.csv}
RENAMED
File without changes
|
@@ -208,14 +208,16 @@ class ActiveRecordTest < ActiveSupport::TestCase
|
|
208
208
|
|
209
209
|
context "Typus date format" do
|
210
210
|
|
211
|
-
should "verify typus_date_format accepts strings
|
211
|
+
should "verify typus_date_format accepts strings" do
|
212
212
|
assert_equal :db, Post.typus_date_format("unknown")
|
213
|
+
end
|
214
|
+
|
215
|
+
should "verify typus_date_format accepts symbols" do
|
213
216
|
assert_equal :db, Post.typus_date_format(:unknown)
|
214
217
|
end
|
215
218
|
|
216
219
|
should "return typus_date_formats for Post" do
|
217
220
|
assert_equal :db, Post.typus_date_format
|
218
|
-
assert_equal :post_short, Post.typus_date_format("created_at")
|
219
221
|
assert_equal :post_short, Post.typus_date_format(:created_at)
|
220
222
|
end
|
221
223
|
|
@@ -223,8 +225,11 @@ class ActiveRecordTest < ActiveSupport::TestCase
|
|
223
225
|
|
224
226
|
context "Typus defaults for" do
|
225
227
|
|
226
|
-
should "verify typus_defaults_for on Model accepts strings
|
228
|
+
should "verify typus_defaults_for on Model accepts strings" do
|
227
229
|
assert_equal %w( title ), Post.typus_defaults_for("search")
|
230
|
+
end
|
231
|
+
|
232
|
+
should "verify typus_defaults_for on Model accepts symbols" do
|
228
233
|
assert_equal %w( title ), Post.typus_defaults_for(:search)
|
229
234
|
end
|
230
235
|
|
@@ -250,8 +255,36 @@ class ActiveRecordTest < ActiveSupport::TestCase
|
|
250
255
|
|
251
256
|
context "Build conditions" do
|
252
257
|
|
258
|
+
should "generate conditions for id" do
|
259
|
+
Post.stubs(:typus_defaults_for).with(:search).returns(["id"])
|
260
|
+
|
261
|
+
params = { :search => '1' }
|
262
|
+
expected = "(id LIKE '%1%')"
|
263
|
+
|
264
|
+
assert_equal expected, Post.build_conditions(params).first
|
265
|
+
end
|
266
|
+
|
267
|
+
should "generate conditions for fields starting with equal" do
|
268
|
+
Post.stubs(:typus_defaults_for).with(:search).returns(["=id"])
|
269
|
+
|
270
|
+
params = { :search => '1' }
|
271
|
+
expected = "(id LIKE '1')"
|
272
|
+
|
273
|
+
assert_equal expected, Post.build_conditions(params).first
|
274
|
+
end
|
275
|
+
|
276
|
+
should "generate conditions for fields starting with ^" do
|
277
|
+
Post.stubs(:typus_defaults_for).with(:search).returns(["^id"])
|
278
|
+
|
279
|
+
params = { :search => '1' }
|
280
|
+
expected = "(id LIKE '1%')"
|
281
|
+
|
282
|
+
assert_equal expected, Post.build_conditions(params).first
|
283
|
+
end
|
284
|
+
|
253
285
|
should "return_sql_conditions_on_search_for_typus_user" do
|
254
286
|
expected = "(role LIKE '%francesc%' OR last_name LIKE '%francesc%' OR email LIKE '%francesc%' OR first_name LIKE '%francesc%')"
|
287
|
+
|
255
288
|
params = { :search => "francesc" }
|
256
289
|
assert_equal expected, TypusUser.build_conditions(params).first
|
257
290
|
params = { :search => "Francesc" }
|
@@ -259,7 +292,6 @@ class ActiveRecordTest < ActiveSupport::TestCase
|
|
259
292
|
end
|
260
293
|
|
261
294
|
should "return_sql_conditions_on_search_and_filter_for_typus_user" do
|
262
|
-
|
263
295
|
case ENV["DB"]
|
264
296
|
when /mysql/
|
265
297
|
boolean_true = "(`typus_users`.`status` = 1)"
|
@@ -270,15 +302,14 @@ class ActiveRecordTest < ActiveSupport::TestCase
|
|
270
302
|
end
|
271
303
|
|
272
304
|
expected = "((role LIKE '%francesc%' OR last_name LIKE '%francesc%' OR email LIKE '%francesc%' OR first_name LIKE '%francesc%')) AND #{boolean_true}"
|
305
|
+
|
273
306
|
params = { :search => "francesc", :status => "true" }
|
274
307
|
assert_equal expected, TypusUser.build_conditions(params).first
|
275
308
|
params = { :search => "francesc", :status => "false" }
|
276
309
|
assert_match /#{boolean_false}/, TypusUser.build_conditions(params).first
|
277
|
-
|
278
310
|
end
|
279
311
|
|
280
312
|
should "return_sql_conditions_on_filtering_typus_users_by_status" do
|
281
|
-
|
282
313
|
case ENV["DB"]
|
283
314
|
when /mysql/
|
284
315
|
boolean_true = "(`typus_users`.`status` = 1)"
|
@@ -292,27 +323,26 @@ class ActiveRecordTest < ActiveSupport::TestCase
|
|
292
323
|
assert_equal boolean_true, TypusUser.build_conditions(params).first
|
293
324
|
params = { :status => "false" }
|
294
325
|
assert_equal boolean_false, TypusUser.build_conditions(params).first
|
295
|
-
|
296
326
|
end
|
297
327
|
|
298
328
|
should "return_sql_conditions_on_filtering_typus_users_by_created_at today" do
|
299
329
|
expected = case ENV["DB"]
|
300
330
|
when /postgresql/
|
301
|
-
"(created_at BETWEEN E'#{Time.
|
331
|
+
"(created_at BETWEEN E'#{Time.zone.now.beginning_of_day.to_s(:db)}' AND E'#{Time.zone.now.beginning_of_day.tomorrow.to_s(:db)}')"
|
302
332
|
else
|
303
|
-
"(created_at BETWEEN '#{Time.
|
333
|
+
"(created_at BETWEEN '#{Time.zone.now.beginning_of_day.to_s(:db)}' AND '#{Time.zone.now.beginning_of_day.tomorrow.to_s(:db)}')"
|
304
334
|
end
|
305
|
-
params = { :created_at => "today" }
|
306
335
|
|
336
|
+
params = { :created_at => "today" }
|
307
337
|
assert_equal expected, TypusUser.build_conditions(params).first
|
308
338
|
end
|
309
339
|
|
310
340
|
should "return_sql_conditions_on_filtering_typus_users_by_created_at last_few_days" do
|
311
341
|
expected = case ENV["DB"]
|
312
342
|
when /postgresql/
|
313
|
-
"(created_at BETWEEN E'#{3.days.ago.
|
343
|
+
"(created_at BETWEEN E'#{3.days.ago.beginning_of_day.to_s(:db)}' AND E'#{Time.zone.now.beginning_of_day.tomorrow.to_s(:db)}')"
|
314
344
|
else
|
315
|
-
"(created_at BETWEEN '#{3.days.ago.
|
345
|
+
"(created_at BETWEEN '#{3.days.ago.beginning_of_day.to_s(:db)}' AND '#{Time.zone.now.beginning_of_day.tomorrow.to_s(:db)}')"
|
316
346
|
end
|
317
347
|
|
318
348
|
params = { :created_at => "last_few_days" }
|
@@ -322,9 +352,9 @@ class ActiveRecordTest < ActiveSupport::TestCase
|
|
322
352
|
should "return_sql_conditions_on_filtering_typus_users_by_created_at last_7_days" do
|
323
353
|
expected = case ENV["DB"]
|
324
354
|
when /postgresql/
|
325
|
-
"(created_at BETWEEN E'#{6.days.ago.
|
355
|
+
"(created_at BETWEEN E'#{6.days.ago.beginning_of_day.to_s(:db)}' AND E'#{Time.zone.now.beginning_of_day.tomorrow.to_s(:db)}')"
|
326
356
|
else
|
327
|
-
"(created_at BETWEEN '#{6.days.ago.
|
357
|
+
"(created_at BETWEEN '#{6.days.ago.beginning_of_day.to_s(:db)}' AND '#{Time.zone.now.beginning_of_day.tomorrow.to_s(:db)}')"
|
328
358
|
end
|
329
359
|
|
330
360
|
params = { :created_at => "last_7_days" }
|
@@ -334,10 +364,11 @@ class ActiveRecordTest < ActiveSupport::TestCase
|
|
334
364
|
should "return_sql_conditions_on_filtering_typus_users_by_created_at last_30_days" do
|
335
365
|
expected = case ENV["DB"]
|
336
366
|
when /postgresql/
|
337
|
-
"(created_at BETWEEN E'#{Time.
|
367
|
+
"(created_at BETWEEN E'#{Time.zone.now.beginning_of_day.prev_month.to_s(:db)}' AND E'#{Time.zone.now.beginning_of_day.tomorrow.to_s(:db)}')"
|
338
368
|
else
|
339
|
-
"(created_at BETWEEN '#{Time.
|
369
|
+
"(created_at BETWEEN '#{Time.zone.now.beginning_of_day.prev_month.to_s(:db)}' AND '#{Time.zone.now.beginning_of_day.tomorrow.to_s(:db)}')"
|
340
370
|
end
|
371
|
+
|
341
372
|
params = { :created_at => "last_30_days" }
|
342
373
|
assert_equal expected, TypusUser.build_conditions(params).first
|
343
374
|
end
|
@@ -345,9 +376,9 @@ class ActiveRecordTest < ActiveSupport::TestCase
|
|
345
376
|
should "return_sql_conditions_on_filtering_posts_by_published_at today" do
|
346
377
|
expected = case ENV["DB"]
|
347
378
|
when /postgresql/
|
348
|
-
"(published_at BETWEEN E'#{Time.
|
379
|
+
"(published_at BETWEEN E'#{Time.zone.now.beginning_of_day.to_s(:db)}' AND E'#{Time.zone.now.beginning_of_day.tomorrow.to_s(:db)}')"
|
349
380
|
else
|
350
|
-
"(published_at BETWEEN '#{Time.
|
381
|
+
"(published_at BETWEEN '#{Time.zone.now.beginning_of_day.to_s(:db)}' AND '#{Time.zone.now.beginning_of_day.tomorrow.to_s(:db)}')"
|
351
382
|
end
|
352
383
|
|
353
384
|
params = { :published_at => "today" }
|
@@ -13,20 +13,20 @@ class ConfigurationTest < ActiveSupport::TestCase
|
|
13
13
|
end
|
14
14
|
|
15
15
|
should "load configuration files from config broken" do
|
16
|
-
Typus.expects(:config_folder).at_least_once.returns("
|
16
|
+
Typus.expects(:config_folder).at_least_once.returns("test/fixtures/config/broken")
|
17
17
|
assert_not_equal Hash.new, Typus::Configuration.roles!
|
18
18
|
assert_not_equal Hash.new, Typus::Configuration.config!
|
19
19
|
end
|
20
20
|
|
21
21
|
should "load configuration files from config empty" do
|
22
|
-
Typus.expects(:config_folder).at_least_once.returns("
|
22
|
+
Typus.expects(:config_folder).at_least_once.returns("test/fixtures/config/empty")
|
23
23
|
assert_equal Hash.new, Typus::Configuration.roles!
|
24
24
|
assert_equal Hash.new, Typus::Configuration.config!
|
25
25
|
end
|
26
26
|
|
27
27
|
should "load configuration files from config ordered" do
|
28
|
-
Typus.expects(:config_folder).at_least_once.returns("
|
29
|
-
files = Dir[
|
28
|
+
Typus.expects(:config_folder).at_least_once.returns("test/fixtures/config/ordered")
|
29
|
+
files = Dir["#{Typus.config_folder}/*_roles.yml"]
|
30
30
|
expected = files.collect { |file| File.basename(file) }.sort
|
31
31
|
assert_equal expected, ["001_roles.yml", "002_roles.yml"]
|
32
32
|
expected = { "admin" => { "categories" => "read" } }
|
@@ -34,8 +34,8 @@ class ConfigurationTest < ActiveSupport::TestCase
|
|
34
34
|
end
|
35
35
|
|
36
36
|
should "load configuration files from config unordered" do
|
37
|
-
Typus.expects(:config_folder).at_least_once.returns("
|
38
|
-
files = Dir[
|
37
|
+
Typus.expects(:config_folder).at_least_once.returns("test/fixtures/config/unordered")
|
38
|
+
files = Dir["#{Typus.config_folder}/*_roles.yml"]
|
39
39
|
expected = files.collect { |file| File.basename(file) }
|
40
40
|
assert_equal expected, ["app_one_roles.yml", "app_two_roles.yml"]
|
41
41
|
expected = { "admin" => { "categories" => "read, update" } }
|
@@ -43,7 +43,7 @@ class ConfigurationTest < ActiveSupport::TestCase
|
|
43
43
|
end
|
44
44
|
|
45
45
|
should "load configuration files from config default" do
|
46
|
-
Typus.expects(:config_folder).at_least_once.returns("
|
46
|
+
Typus.expects(:config_folder).at_least_once.returns("test/fixtures/config/default")
|
47
47
|
assert_not_equal Hash.new, Typus::Configuration.roles!
|
48
48
|
assert_not_equal Hash.new, Typus::Configuration.config!
|
49
49
|
assert Typus.resources.empty?
|
@@ -15,21 +15,26 @@ class TypusUserTest < ActiveSupport::TestCase
|
|
15
15
|
|
16
16
|
should_not allow_mass_assignment_of :status
|
17
17
|
|
18
|
-
should ensure_length_of(:password).is_at_least(
|
18
|
+
should ensure_length_of(:password).is_at_least(6).is_at_most(40)
|
19
19
|
|
20
20
|
# should validate_uniqueness_of :email
|
21
21
|
|
22
|
+
should "verify columns" do
|
23
|
+
attributes = %w( id first_name last_name email role status salt crypted_password token preferences created_at updated_at )
|
24
|
+
TypusUser.columns.collect { |u| u.name }.each { |c| assert attributes.include?(c) }
|
25
|
+
end
|
26
|
+
|
27
|
+
should "verify generate requires the role" do
|
28
|
+
assert TypusUser.generate(:email => 'demo@example.com', :password => 'XXXXXXXX').valid?
|
29
|
+
assert TypusUser.generate(:email => 'demo@example.com', :password => 'XXXXXXXX', :role => 'admin').valid?
|
30
|
+
end
|
31
|
+
|
22
32
|
context "TypusUser" do
|
23
33
|
|
24
34
|
setup do
|
25
35
|
@typus_user = Factory(:typus_user)
|
26
36
|
end
|
27
37
|
|
28
|
-
should "verify definition" do
|
29
|
-
attributes = %w( id first_name last_name email role status salt crypted_password token preferences created_at updated_at )
|
30
|
-
TypusUser.columns.collect { |u| u.name }.each { |c| assert attributes.include?(c) }
|
31
|
-
end
|
32
|
-
|
33
38
|
should "return email when first_name and last_name are not set" do
|
34
39
|
assert_equal @typus_user.email, @typus_user.name
|
35
40
|
end
|
@@ -40,15 +45,16 @@ class TypusUserTest < ActiveSupport::TestCase
|
|
40
45
|
end
|
41
46
|
|
42
47
|
should "verify salt never changes" do
|
43
|
-
|
44
|
-
|
45
|
-
@typus_user.
|
46
|
-
assert_equal salt, @typus_user.salt
|
47
|
-
assert_not_equal crypted_password, @typus_user.crypted_password
|
48
|
+
expected = @typus_user.salt
|
49
|
+
@typus_user.update_attributes(:password => '11111111', :password_confirmation => '11111111')
|
50
|
+
assert_equal expected, @typus_user.salt
|
48
51
|
end
|
49
52
|
|
50
|
-
should "verify authenticated?" do
|
53
|
+
should "verify authenticated? returns true when password is right" do
|
51
54
|
assert @typus_user.authenticated?('12345678')
|
55
|
+
end
|
56
|
+
|
57
|
+
should "verify authenticated? returns false when password is wrong" do
|
52
58
|
assert !@typus_user.authenticated?('87654321')
|
53
59
|
end
|
54
60
|
|
@@ -66,24 +72,34 @@ class TypusUserTest < ActiveSupport::TestCase
|
|
66
72
|
|
67
73
|
end
|
68
74
|
|
69
|
-
context "
|
75
|
+
context "Root roles" do
|
70
76
|
|
71
77
|
setup do
|
72
|
-
@typus_user = Factory(:typus_user, :role => "
|
78
|
+
@typus_user = Factory(:typus_user, :role => "admin")
|
73
79
|
end
|
74
80
|
|
75
|
-
should "
|
76
|
-
assert @typus_user.
|
77
|
-
|
81
|
+
should "respond true to is_root?" do
|
82
|
+
assert @typus_user.is_root?
|
83
|
+
end
|
84
|
+
|
85
|
+
should "respond false to is_not_root?" do
|
86
|
+
assert !@typus_user.is_not_root?
|
78
87
|
end
|
79
88
|
|
80
89
|
end
|
81
90
|
|
82
|
-
context "
|
91
|
+
context "Non root roles" do
|
83
92
|
|
84
|
-
|
85
|
-
|
86
|
-
|
93
|
+
setup do
|
94
|
+
@typus_user = Factory(:typus_user, :role => "editor")
|
95
|
+
end
|
96
|
+
|
97
|
+
should "respond true to is_no_root?" do
|
98
|
+
assert @typus_user.is_not_root?
|
99
|
+
end
|
100
|
+
|
101
|
+
should "respond false to is_root?" do
|
102
|
+
assert !@typus_user.is_root?
|
87
103
|
end
|
88
104
|
|
89
105
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: typus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: -1876988175
|
5
5
|
prerelease: true
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
9
|
- 0
|
10
|
-
-
|
11
|
-
version: 1.0.0.
|
10
|
+
- pre2
|
11
|
+
version: 1.0.0.pre2
|
12
12
|
platform: ruby
|
13
13
|
authors:
|
14
14
|
- Francesc Esplugas
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2010-09-
|
19
|
+
date: 2010-09-13 00:00:00 +02:00
|
20
20
|
default_executable:
|
21
21
|
dependencies: []
|
22
22
|
|
@@ -31,11 +31,12 @@ extra_rdoc_files: []
|
|
31
31
|
|
32
32
|
files:
|
33
33
|
- app/controllers/admin/account_controller.rb
|
34
|
+
- app/controllers/admin/base_controller.rb
|
34
35
|
- app/controllers/admin/dashboard_controller.rb
|
35
36
|
- app/controllers/admin/resource_controller.rb
|
36
37
|
- app/controllers/admin/resources_controller.rb
|
37
38
|
- app/controllers/admin/session_controller.rb
|
38
|
-
- app/
|
39
|
+
- app/helpers/admin/base_helper.rb
|
39
40
|
- app/helpers/admin/dashboard_helper.rb
|
40
41
|
- app/helpers/admin/filters_helper.rb
|
41
42
|
- app/helpers/admin/form_helper.rb
|
@@ -45,7 +46,6 @@ files:
|
|
45
46
|
- app/helpers/admin/search_helper.rb
|
46
47
|
- app/helpers/admin/sidebar_helper.rb
|
47
48
|
- app/helpers/admin/table_helper.rb
|
48
|
-
- app/helpers/admin_helper.rb
|
49
49
|
- app/mailers/admin/mailer.rb
|
50
50
|
- app/models/admin/fake_user.rb
|
51
51
|
- app/views/admin/account/forgot_password.html.erb
|
@@ -92,8 +92,8 @@ files:
|
|
92
92
|
- app/views/admin/templates/_text.html.erb
|
93
93
|
- app/views/admin/templates/_time.html.erb
|
94
94
|
- app/views/admin/templates/_tree.html.erb
|
95
|
+
- app/views/layouts/admin/base.html.erb
|
95
96
|
- app/views/layouts/admin/session.html.erb
|
96
|
-
- app/views/layouts/admin.html.erb
|
97
97
|
- CHANGELOG
|
98
98
|
- config/available_locales/ca.yml
|
99
99
|
- config/available_locales/ca_models.yml
|
@@ -288,8 +288,25 @@ files:
|
|
288
288
|
- test/fixtures/rails_app/Rakefile
|
289
289
|
- test/fixtures/rails_app/README
|
290
290
|
- test/fixtures/rails_app/script/rails
|
291
|
-
- test/fixtures/rails_app/tmp/export-posts-
|
292
|
-
- test/fixtures/rails_app/tmp/export-posts-
|
291
|
+
- test/fixtures/rails_app/tmp/export-posts-20100913124503.csv
|
292
|
+
- test/fixtures/rails_app/tmp/export-posts-20100913124524.csv
|
293
|
+
- test/fixtures/rails_app/tmp/export-posts-20100913124638.csv
|
294
|
+
- test/fixtures/rails_app/tmp/export-posts-20100913124717.csv
|
295
|
+
- test/fixtures/rails_app/tmp/export-posts-20100913125425.csv
|
296
|
+
- test/fixtures/rails_app/tmp/export-posts-20100913125626.csv
|
297
|
+
- test/fixtures/rails_app/tmp/export-posts-20100913125651.csv
|
298
|
+
- test/fixtures/rails_app/tmp/export-posts-20100913125741.csv
|
299
|
+
- test/fixtures/rails_app/tmp/export-posts-20100913125827.csv
|
300
|
+
- test/fixtures/rails_app/tmp/export-posts-20100913125856.csv
|
301
|
+
- test/fixtures/rails_app/tmp/export-posts-20100913125928.csv
|
302
|
+
- test/fixtures/rails_app/tmp/export-posts-20100913130119.csv
|
303
|
+
- test/fixtures/rails_app/tmp/export-posts-20100913130159.csv
|
304
|
+
- test/fixtures/rails_app/tmp/export-posts-20100913130319.csv
|
305
|
+
- test/fixtures/rails_app/tmp/export-posts-20100913130339.csv
|
306
|
+
- test/fixtures/rails_app/tmp/export-posts-20100913131400.csv
|
307
|
+
- test/fixtures/rails_app/tmp/export-posts-20100913131915.csv
|
308
|
+
- test/fixtures/rails_app/tmp/export-posts-20100913132022.csv
|
309
|
+
- test/fixtures/rails_app/tmp/export-posts-20100913132844.csv
|
293
310
|
- test/functional/admin/account_controller_test.rb
|
294
311
|
- test/functional/admin/dashboard_controller_http_basic_test.rb
|
295
312
|
- test/functional/admin/dashboard_controller_none_test.rb
|
@@ -332,7 +349,6 @@ files:
|
|
332
349
|
- test/unit/admin/mailer_test.rb
|
333
350
|
- test/unit/typus_user_roles_test.rb
|
334
351
|
- test/unit/typus_user_test.rb
|
335
|
-
- typus-1.0.0.pre.gem
|
336
352
|
- typus.gemspec
|
337
353
|
has_rdoc: true
|
338
354
|
homepage: http://core.typuscms.com/
|
data/app/helpers/admin_helper.rb
DELETED
@@ -1,56 +0,0 @@
|
|
1
|
-
module AdminHelper
|
2
|
-
|
3
|
-
def typus_block(resource = @resource.to_resource, partial = params[:action])
|
4
|
-
partials_path = "admin/#{resource}"
|
5
|
-
resources_partials_path = "admin/resources"
|
6
|
-
|
7
|
-
partials = ActionController::Base.view_paths.map do |view_path|
|
8
|
-
Dir["#{view_path}/#{partials_path}/*"].map { |f| File.basename(f, '.html.erb') }
|
9
|
-
end.flatten
|
10
|
-
resources_partials = Dir[Rails.root.join("app/views/#{resources_partials_path}/*").to_s].map do |file|
|
11
|
-
File.basename(file, ".html.erb")
|
12
|
-
end
|
13
|
-
|
14
|
-
path = if partials.include?("_#{partial}") then partials_path
|
15
|
-
elsif resources_partials.include?(partial) then resources_partials_path
|
16
|
-
end
|
17
|
-
|
18
|
-
render "#{path}/#{partial}" if path
|
19
|
-
end
|
20
|
-
|
21
|
-
def title(page_title)
|
22
|
-
content_for(:title) { page_title }
|
23
|
-
end
|
24
|
-
|
25
|
-
def header
|
26
|
-
render "admin/helpers/header"
|
27
|
-
end
|
28
|
-
|
29
|
-
def apps
|
30
|
-
render "admin/helpers/apps"
|
31
|
-
end
|
32
|
-
|
33
|
-
def login_info(user = @current_user)
|
34
|
-
return if user.kind_of?(Admin::FakeUser)
|
35
|
-
|
36
|
-
admin_edit_typus_user_path = { :controller => "/admin/#{Typus.user_class.to_resource}",
|
37
|
-
:action => 'edit',
|
38
|
-
:id => user.id }
|
39
|
-
|
40
|
-
message = _("Are you sure you want to sign out and end your session?")
|
41
|
-
|
42
|
-
user_details = if user.can?('edit', Typus.user_class_name)
|
43
|
-
link_to user.name, admin_edit_typus_user_path
|
44
|
-
else
|
45
|
-
user.name
|
46
|
-
end
|
47
|
-
|
48
|
-
render "admin/helpers/login_info", :message => message, :user_details => user_details
|
49
|
-
end
|
50
|
-
|
51
|
-
def display_flash_message(message = flash)
|
52
|
-
return if message.empty?
|
53
|
-
render "admin/helpers/flash_message", :flash_type => message.keys.first, :message => message
|
54
|
-
end
|
55
|
-
|
56
|
-
end
|