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 +12 -0
- data/VERSION +1 -1
- data/admin_assistant.gemspec +1 -1
- data/lib/admin_assistant/active_record_column.rb +16 -12
- data/lib/admin_assistant.rb +2 -1
- data/website/api/index.markdown +8 -0
- metadata +4 -4
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
|
+
2.2.0
|
data/admin_assistant.gemspec
CHANGED
@@ -179,18 +179,22 @@ class AdminAssistant
|
|
179
179
|
end
|
180
180
|
|
181
181
|
def default_input
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
:
|
187
|
-
|
188
|
-
:
|
189
|
-
|
190
|
-
:
|
191
|
-
|
192
|
-
:
|
193
|
-
|
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
|
data/lib/admin_assistant.rb
CHANGED
data/website/api/index.markdown
CHANGED
@@ -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:
|
4
|
+
hash: 7
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 2
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 2.
|
8
|
+
- 2
|
9
|
+
- 0
|
10
|
+
version: 2.2.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Francis Hwang
|