activeadmin 0.5.0.pre → 0.5.0.pre1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of activeadmin might be problematic. Click here for more details.

@@ -61,11 +61,11 @@ module ActiveAdmin
61
61
  def add_default_batch_actions
62
62
  destroy_options = {
63
63
  :priority => 100,
64
- :confirm => I18n.t('active_admin.batch_actions.delete_confirmation', :plural_model => plural_resource_label.downcase),
64
+ :confirm => proc { I18n.t('active_admin.batch_actions.delete_confirmation', :plural_model => active_admin_config.plural_resource_label.downcase) },
65
65
  :if => proc{ controller.action_methods.include?('destroy') }
66
66
  }
67
67
 
68
- add_batch_action :destroy, I18n.t('active_admin.delete'), destroy_options do |selected_ids|
68
+ add_batch_action :destroy, proc { I18n.t('active_admin.delete') }, destroy_options do |selected_ids|
69
69
  active_admin_config.resource_class.find(selected_ids).each { |r| r.destroy }
70
70
 
71
71
  redirect_to collection_path, :notice => I18n.t("active_admin.batch_actions.succesfully_destroyed",
@@ -27,13 +27,16 @@ module ActiveAdmin
27
27
  :id => "batch_actions_selector",
28
28
  :button => { :class => "disabled" } do
29
29
  batch_actions_to_display.each do |batch_action|
30
+ confirmation_text = render_or_call_method_or_proc_on(self, batch_action.confirm)
31
+
30
32
  options = {
31
33
  :class => "batch_action",
32
34
  "data-action" => batch_action.sym,
33
- "data-confirm" => batch_action.confirm
35
+ "data-confirm" => confirmation_text
34
36
  }
35
37
 
36
- title = I18n.t("active_admin.batch_actions.labels.#{batch_action.sym}", :default => batch_action.title)
38
+ default_title = render_or_call_method_or_proc_on(self, batch_action.title)
39
+ title = I18n.t("active_admin.batch_actions.labels.#{batch_action.sym}", :default => default_title)
37
40
  label = I18n.t("active_admin.batch_actions.action_label", :title => title)
38
41
 
39
42
  item label, "#", options
@@ -1,3 +1,3 @@
1
1
  module ActiveAdmin
2
- VERSION = '0.5.0.pre'
2
+ VERSION = '0.5.0.pre1'
3
3
  end
@@ -35,14 +35,24 @@ module ActiveAdmin
35
35
 
36
36
  def add_default_user_to_migration
37
37
  # Don't assume that we have a migration!
38
- devise_migrations = Dir["db/migrate/*_devise_create_#{table_name}.rb"]
39
- if devise_migrations.size > 0
40
- inject_into_file Dir["db/migrate/*_devise_create_#{table_name}.rb"].first,
38
+ devise_migration_file = Dir["db/migrate/*_devise_create_#{table_name}.rb"].first
39
+ return if devise_migration_file.nil?
40
+
41
+ devise_migration_content = File.read(devise_migration_file)
42
+
43
+ if devise_migration_content["def change"]
44
+ inject_into_file devise_migration_file,
41
45
  "def migrate(direction)\n super\n # Create a default user\n AdminUser.create!(:email => 'admin@example.com', :password => 'password', :password_confirmation => 'password') if direction == :up\n end\n\n ",
42
46
  :before => "def change"
47
+ elsif devise_migration_content[/def (self.)?up/]
48
+ inject_into_file devise_migration_file,
49
+ "# Create a default user\n #{class_name}.create!(:email => 'admin@example.com', :password => 'password', :password_confirmation => 'password')\n\n ",
50
+ :before => "add_index :#{table_name}, :email"
51
+ else
52
+ puts devise_migration_content
53
+ raise "Failed to add default admin user to migration."
43
54
  end
44
55
  end
45
-
46
56
  end
47
57
  end
48
58
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activeadmin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0.pre
4
+ version: 0.5.0.pre1
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-08-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
- requirement: &70151132987020 !ruby/object:Gem::Requirement
16
+ requirement: &70133835008040 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 3.0.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70151132987020
24
+ version_requirements: *70133835008040
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: jquery-rails
27
- requirement: &70151132986220 !ruby/object:Gem::Requirement
27
+ requirement: &70133835006600 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 1.0.0
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70151132986220
35
+ version_requirements: *70133835006600
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: bourbon
38
- requirement: &70151132985460 !ruby/object:Gem::Requirement
38
+ requirement: &70133835020700 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 1.0.0
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70151132985460
46
+ version_requirements: *70133835020700
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: meta_search
49
- requirement: &70151132984760 !ruby/object:Gem::Requirement
49
+ requirement: &70133835018280 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 0.9.2
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70151132984760
57
+ version_requirements: *70133835018280
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: devise
60
- requirement: &70151132984040 !ruby/object:Gem::Requirement
60
+ requirement: &70133835016380 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: 1.1.2
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *70151132984040
68
+ version_requirements: *70133835016380
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: formtastic
71
- requirement: &70151132983320 !ruby/object:Gem::Requirement
71
+ requirement: &70133835030680 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: 2.0.0
77
77
  type: :runtime
78
78
  prerelease: false
79
- version_requirements: *70151132983320
79
+ version_requirements: *70133835030680
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: inherited_resources
82
- requirement: &70151132982640 !ruby/object:Gem::Requirement
82
+ requirement: &70133835029980 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: 1.3.1
88
88
  type: :runtime
89
89
  prerelease: false
90
- version_requirements: *70151132982640
90
+ version_requirements: *70133835029980
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: kaminari
93
- requirement: &70151132982060 !ruby/object:Gem::Requirement
93
+ requirement: &70133835028700 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ! '>='
@@ -98,10 +98,10 @@ dependencies:
98
98
  version: 0.13.0
99
99
  type: :runtime
100
100
  prerelease: false
101
- version_requirements: *70151132982060
101
+ version_requirements: *70133835028700
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: sass
104
- requirement: &70151132997280 !ruby/object:Gem::Requirement
104
+ requirement: &70133835027420 !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
107
  - - ! '>='
@@ -109,10 +109,10 @@ dependencies:
109
109
  version: 3.1.0
110
110
  type: :runtime
111
111
  prerelease: false
112
- version_requirements: *70151132997280
112
+ version_requirements: *70133835027420
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: fastercsv
115
- requirement: &70151132996440 !ruby/object:Gem::Requirement
115
+ requirement: &70133835026260 !ruby/object:Gem::Requirement
116
116
  none: false
117
117
  requirements:
118
118
  - - ! '>='
@@ -120,10 +120,10 @@ dependencies:
120
120
  version: '0'
121
121
  type: :runtime
122
122
  prerelease: false
123
- version_requirements: *70151132996440
123
+ version_requirements: *70133835026260
124
124
  - !ruby/object:Gem::Dependency
125
125
  name: arbre
126
- requirement: &70151132995240 !ruby/object:Gem::Requirement
126
+ requirement: &70133835025440 !ruby/object:Gem::Requirement
127
127
  none: false
128
128
  requirements:
129
129
  - - ! '>='
@@ -131,7 +131,7 @@ dependencies:
131
131
  version: 1.0.1
132
132
  type: :runtime
133
133
  prerelease: false
134
- version_requirements: *70151132995240
134
+ version_requirements: *70133835025440
135
135
  description: The administration framework for Ruby on Rails.
136
136
  email:
137
137
  - gregdbell@gmail.com
@@ -611,7 +611,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
611
611
  version: '0'
612
612
  segments:
613
613
  - 0
614
- hash: 3076799807113517211
614
+ hash: 2086761120614959852
615
615
  required_rubygems_version: !ruby/object:Gem::Requirement
616
616
  none: false
617
617
  requirements: