administrate 0.0.10 → 0.0.11

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

Potentially problematic release.


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

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4bf162085febeaff1ab69651259d6cff0c83ae85
4
- data.tar.gz: 7ef68a804642c0c383097234e990b80727405862
3
+ metadata.gz: a9b9090f8ba59a083ec8484f644561d803062d56
4
+ data.tar.gz: fe9a6db1a0702cb0b1459d3b67385d36641dc0b1
5
5
  SHA512:
6
- metadata.gz: c75dc5a9894ef7d0165addcb2ea9e84a25c24991d7bd6b77e06dde1c51f858e14bf42123c4e82146d80e8d47bbfb85d325574952691ce2ca1c163149d716cbd4
7
- data.tar.gz: 09aa24e5598534526286435935f0b362e383fc7954f81a98ece98c620075cf6074e9c2168be753f09e791a8909b6da04b386af4a77a1a711c6845cfeb4295915
6
+ metadata.gz: bd0b3a695b131733a8a2d7a3c433e8babb7afff01acf20655764845bf8baa1f5e3cb847c2262ce566d2de459853dbe71b91a7f1603f24eb918c4234f73ef2288
7
+ data.tar.gz: aee894ee80ed845e4adc46a969f04192b59e7550c974de023ddb4cb534f1c4cf5008d74634b9dc0bebf80b85072b33077bc0af65a84fa7dec2d2f7d7b69bf521
@@ -0,0 +1,2 @@
1
+ <%= f.label field.attribute %>
2
+ <%= f.check_box field.attribute %>
@@ -0,0 +1 @@
1
+ <%= field %>
@@ -0,0 +1 @@
1
+ <%= field %>
@@ -1,4 +1,5 @@
1
1
  require "administrate/fields/belongs_to"
2
+ require "administrate/fields/boolean"
2
3
  require "administrate/fields/date_time"
3
4
  require "administrate/fields/email"
4
5
  require "administrate/fields/has_many"
@@ -12,7 +12,13 @@ module Administrate
12
12
  end
13
13
 
14
14
  def candidate_records
15
- Object.const_get(attribute.to_s.camelcase).all
15
+ Object.const_get(associated_class_name).all
16
+ end
17
+
18
+ private
19
+
20
+ def associated_class_name
21
+ options.fetch(:class_name, attribute.to_s.camelcase)
16
22
  end
17
23
  end
18
24
  end
@@ -0,0 +1,15 @@
1
+ require_relative "base"
2
+
3
+ module Administrate
4
+ module Field
5
+ class Boolean < Base
6
+ def to_s
7
+ if data.nil?
8
+ "-"
9
+ else
10
+ data.to_s
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -21,17 +21,17 @@ module Administrate
21
21
  end
22
22
 
23
23
  def candidate_records
24
- Object.const_get(resource_class_name).all
24
+ Object.const_get(associated_class_name).all
25
25
  end
26
26
 
27
27
  private
28
28
 
29
29
  def associated_dashboard
30
- Object.const_get("#{resource_class_name}Dashboard").new
30
+ Object.const_get("#{associated_class_name}Dashboard").new
31
31
  end
32
32
 
33
- def resource_class_name
34
- options[:class_name] || attribute.to_s.singularize.camelcase
33
+ def associated_class_name
34
+ options.fetch(:class_name, attribute.to_s.singularize.camelcase)
35
35
  end
36
36
  end
37
37
  end
@@ -1,3 +1,3 @@
1
1
  module Administrate
2
- VERSION = "0.0.10"
2
+ VERSION = "0.0.11"
3
3
  end
@@ -4,6 +4,7 @@ module Administrate
4
4
  module Generators
5
5
  class DashboardGenerator < Rails::Generators::NamedBase
6
6
  ATTRIBUTE_TYPE_MAPPING = {
7
+ boolean: "Field::Boolean",
7
8
  date: "Field::DateTime",
8
9
  datetime: "Field::DateTime",
9
10
  float: "Field::Number",
@@ -61,11 +62,11 @@ module Administrate
61
62
  if relationship.has_one?
62
63
  "Field::HasOne"
63
64
  elsif relationship.collection?
64
- "Field::HasMany" + has_many_options_string(relationship)
65
+ "Field::HasMany" + relationship_options_string(relationship)
65
66
  elsif relationship.polymorphic?
66
67
  "Field::Polymorphic"
67
68
  else
68
- "Field::BelongsTo"
69
+ "Field::BelongsTo" + relationship_options_string(relationship)
69
70
  end
70
71
  end
71
72
 
@@ -73,7 +74,7 @@ module Administrate
73
74
  @klass ||= Object.const_get(class_name)
74
75
  end
75
76
 
76
- def has_many_options_string(relationship)
77
+ def relationship_options_string(relationship)
77
78
  if relationship.class_name != relationship.name.to_s.classify
78
79
  options_string(class_name: relationship.class_name)
79
80
  else
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: administrate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Grayson Wright
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-15 00:00:00.000000000 Z
11
+ date: 2015-09-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: neat
@@ -187,6 +187,9 @@ files:
187
187
  - app/views/fields/belongs_to/_form.html.erb
188
188
  - app/views/fields/belongs_to/_index.html.erb
189
189
  - app/views/fields/belongs_to/_show.html.erb
190
+ - app/views/fields/boolean/_form.html.erb
191
+ - app/views/fields/boolean/_index.html.erb
192
+ - app/views/fields/boolean/_show.html.erb
190
193
  - app/views/fields/date_time/_form.html.erb
191
194
  - app/views/fields/date_time/_index.html.erb
192
195
  - app/views/fields/date_time/_show.html.erb
@@ -219,6 +222,7 @@ files:
219
222
  - lib/administrate/engine.rb
220
223
  - lib/administrate/fields/base.rb
221
224
  - lib/administrate/fields/belongs_to.rb
225
+ - lib/administrate/fields/boolean.rb
222
226
  - lib/administrate/fields/date_time.rb
223
227
  - lib/administrate/fields/deferred.rb
224
228
  - lib/administrate/fields/email.rb