admin_assistant 2.1.1 → 2.2.0

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/Rakefile CHANGED
@@ -34,6 +34,18 @@ task :test do
34
34
  puts cmd
35
35
  puts `#{cmd}`
36
36
  end
37
+ # alternate config tests
38
+ path = File.join(base, 'rails_3_0')
39
+ cmd = "cd #{path} && AA_CONFIG=2 bundle exec rake"
40
+ puts cmd
41
+ puts `#{cmd}`
42
+ end
43
+
44
+ desc 'Run a local copy of jekyll for previewing the documentation site.'
45
+ task :preview_website do
46
+ cmd = 'cd website && jekyll --auto --server --base-url "/admin_assistant/"'
47
+ puts cmd
48
+ puts `#{cmd}`
37
49
  end
38
50
 
39
51
  begin
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.1.1
1
+ 2.2.0
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{admin_assistant}
8
- s.version = "2.1.1"
8
+ s.version = "2.2.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Francis Hwang"]
@@ -179,18 +179,22 @@ class AdminAssistant
179
179
  end
180
180
 
181
181
  def default_input
182
- case @column.field_type
183
- when :boolean
184
- :check_box
185
- when :date
186
- :date_select
187
- when :datetime
188
- :datetime_select
189
- when :text
190
- :text_area
191
- else
192
- :text_field
193
- end
182
+ if AdminAssistant.default_inputs[@column.field_type]
183
+ AdminAssistant.default_inputs[@column.field_type]
184
+ else
185
+ case @column.field_type
186
+ when :boolean
187
+ :check_box
188
+ when :date
189
+ :date_select
190
+ when :datetime
191
+ :datetime_select
192
+ when :text
193
+ :text_area
194
+ else
195
+ :text_field
196
+ end
197
+ end
194
198
  end
195
199
 
196
200
  def ordered_us_state_names_and_codes
@@ -15,7 +15,8 @@ files.each do |file|
15
15
  end
16
16
 
17
17
  class AdminAssistant
18
- cattr_accessor :request_start_time, :routes
18
+ cattr_accessor :default_inputs, :request_start_time, :routes
19
+ self.default_inputs = {}
19
20
  self.routes = []
20
21
 
21
22
  def self.profile(msg)
@@ -21,6 +21,14 @@ The API reference is broken down into a few sections:
21
21
 
22
22
  There are a number of ways to configure admin\_assistant:
23
23
 
24
+ #### Application-wide configuration
25
+
26
+ To set the default inputs that admin\_assistant uses, put the following code in `config/initializers/admin_assistant.rb`:
27
+
28
+ AdminAssistant.default_inputs[:text] = :text_field
29
+
30
+ The above code comes in handy if you're a RDBMS like Postgres, where you might use `text` columns everywhere instead of `varchar(255)` columns, but don't want those columns to be rendered as textareas in your controllers.
31
+
24
32
  #### Through builder objects
25
33
 
26
34
  `admin_assistant_for` takes a block that yields a core builder object:
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: admin_assistant
3
3
  version: !ruby/object:Gem::Version
4
- hash: 9
4
+ hash: 7
5
5
  prerelease:
6
6
  segments:
7
7
  - 2
8
- - 1
9
- - 1
10
- version: 2.1.1
8
+ - 2
9
+ - 0
10
+ version: 2.2.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Francis Hwang