active_scaffold_vho 3.2.10 → 3.2.11

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.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MGQ4MzQyOGU2ZjQ3MTJmYWQ3NDVlMjY2ODVmMjNkOGQ1YzY2MDljMg==
4
+ MDdiYjFiZTVjMjhhMjZhN2FkNDQxMjc4M2Q3ZDU0ZjkwZjE5YzczNQ==
5
5
  data.tar.gz: !binary |-
6
- NjcwMDEzMmJmYjk0YTE2NThlMWNiZWU1N2JhMzQ3MjY3ODYxNDI2MQ==
6
+ M2FkZWIxMWZmYWYyOTA1MDJlNGVlNTIyODFhZDE3OGIyZmI4ODJhYw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZDgwN2VjZGZhMDJiYjY0NDg2Y2IxNzZhMDIzMzBjZTI2M2VmNjQ4M2RiMmQ2
10
- MzY4YmM5YjE0MjI0Y2ZjNThlNDU3NjY0NTBjOGNkMTlhNWY1NzhmZTFiNzUx
11
- YTJjMmZkNjJkMWVlM2RjOGIzN2EwY2Q0MmQzZThjZTBmNTdjOWI=
9
+ YTlhMTRkOTZhNjlhYTRjNTM3N2QyZjJlZTViODZhOTAyMDVlOTJhMmNkYjMz
10
+ MjViNTM3NzFiODdhMjJkNDc3N2EwNmVkZjgwMjFlZTRiODk4NGVhNjc3YWYw
11
+ NDRjNDg5YjY2ZWNmNDRmYTFmZmY5NjBkN2QyZDA2MmEzYmJhNGY=
12
12
  data.tar.gz: !binary |-
13
- ZTk5ZmJkNDliZTQ4YmY5ZmQxN2Q0ZGRmOWYyYjMyZmQ0YTk3ZTNhNjYzODlm
14
- YmM4ZGI3NTU1M2MxMjYyZTE2ODg2YTQyMmNjNWIzZWRkM2NlMjc4NGU2M2Ew
15
- OTY3OThhYzRlMjVjODJlYWUzZWEwNWI4OGU4YWM4YzcwMmQ5NTU=
13
+ Mzg1MjZlMmVlMjk0MmVlMTM1NjU0YmI1NGU5MGRlYTM4YTdmMGExNGZkN2Fl
14
+ YzhhNDVkNjM1YTNiNWY0YTkzNmIzMDhjOGQxYzIzYTBhNWFmNDEyYjU4ZDFi
15
+ MjBlMzQ4NTkwZTgyMmUwNTc1ZDVlMTQyNjk3ZWMyNGQ4NTNiMDk=
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- active_scaffold_vho (3.2.9)
4
+ active_scaffold_vho (3.2.10)
5
5
  kaminari
6
6
  rails (>= 3.1.0)
7
7
 
@@ -1,9 +1,9 @@
1
1
  <% if ActiveScaffold.js_framework == :jquery %>
2
+ <% require_asset "jquery/date_picker_bridge" %>
3
+ <% require_asset "jquery/tiny_mce_bridge" %>
2
4
  <% require_asset "jquery/active_scaffold" %>
3
5
  <% require_asset "jquery/jquery.editinplace" %>
4
6
  <% require_asset "jquery/jquery-ui-timepicker-addon.js" %>
5
- <% require_asset "jquery/date_picker_bridge" %>
6
- <% require_asset "jquery/tiny_mce_bridge" %>
7
7
  <% else %>
8
8
  <% require_asset "prototype/active_scaffold" %>
9
9
  <% require_asset "prototype/dhtml_history" %>
@@ -1,22 +1,24 @@
1
- $(document).on('as:form_loaded', 'form.as_form, form.inplace_form', function(event) {
2
- var as_form = $(this).closest("form");
3
- as_form.find('textarea.as_mceEditor').each(function(index, elem) {
4
- tinyMCE.execCommand('mceAddControl', false, $(elem).attr('id'));
1
+ $(document).ready(function() {
2
+ $(document).on('as:form_loaded', 'form.as_form, form.inplace_form', function(event) {
3
+ var as_form = $(this).closest("form");
4
+ as_form.find('textarea.as_mceEditor').each(function(index, elem) {
5
+ tinyMCE.execCommand('mceAddControl', false, $(elem).attr('id'));
6
+ });
7
+ return true;
8
+ });
9
+ $(document).on('as:form_submit', 'form.as_form, form.inplace_form', function(event) {
10
+ var as_form = $(this).closest("form");
11
+ if (as_form.has('textarea.as_mceEditor').length > 0) {
12
+ tinyMCE.triggerSave();
13
+ }
14
+ return true;
5
15
  });
6
- return true;
7
- });
8
- $(document).on('as:form_submit', 'form.as_form, form.inplace_form', function(event) {
9
- var as_form = $(this).closest("form");
10
- if (as_form.has('textarea.as_mceEditor').length > 0) {
11
- tinyMCE.triggerSave();
12
- }
13
- return true;
14
- });
15
16
 
16
- $(document).on('as:form_unloaded', 'form.as_form, form.inplace_form', function(event) {
17
- var as_form = $(this).closest("form");
18
- as_form.find('textarea.as_mceEditor').each(function(index, elem) {
19
- tinyMCE.execCommand('mceRemoveControl', false, $(elem).attr('id'));
17
+ $(document).on('as:form_unloaded', 'form.as_form, form.inplace_form', function(event) {
18
+ var as_form = $(this).closest("form");
19
+ as_form.find('textarea.as_mceEditor').each(function(index, elem) {
20
+ tinyMCE.execCommand('mceRemoveControl', false, $(elem).attr('id'));
21
+ });
22
+ return true;
20
23
  });
21
- return true;
22
- });
24
+ });
@@ -1,2 +1,2 @@
1
1
  <% scope ||= nil %>
2
- <%= hidden_field :record, column.name, active_scaffold_input_options(column, scope) %>
2
+ <%= active_scaffold_input_hidden(column, active_scaffold_input_options(column, scope)) %>
@@ -3,6 +3,14 @@ module ActiveScaffold::Config
3
3
  include ActiveScaffold::Configurable
4
4
  extend ActiveScaffold::Configurable
5
5
 
6
+ def initialize(core_config)
7
+ @core = core_config
8
+ @action_group = self.class.action_group.clone if self.class.action_group
9
+ # start with the ActionLink defined globally
10
+ @link = self.class.link.clone if self.class.respond_to?(:link) && self.class.link
11
+ end
12
+ attr_reader :core
13
+
6
14
  def self.inherited(subclass)
7
15
  class << subclass
8
16
  # the crud type of the action. possible values are :create, :read, :update, :delete, and nil.
@@ -3,11 +3,7 @@ module ActiveScaffold::Config
3
3
  self.crud_type = :delete
4
4
 
5
5
  def initialize(core_config)
6
- @core = core_config
7
-
8
- # start with the ActionLink defined globally
9
- @link = self.class.link.clone
10
- @action_group = self.class.action_group.clone if self.class.action_group
6
+ super
11
7
  self.refresh_list = self.class.refresh_list
12
8
  end
13
9
 
@@ -3,14 +3,10 @@ module ActiveScaffold::Config
3
3
  self.crud_type = :read
4
4
 
5
5
  def initialize(core_config)
6
- @core = core_config
6
+ super
7
7
 
8
8
  @text_search = self.class.text_search
9
9
  @or_delimiter = self.class.or_delimiter
10
-
11
- # start with the ActionLink defined globally
12
- @link = self.class.link.clone
13
- @action_group = self.class.action_group.clone if self.class.action_group
14
10
  end
15
11
 
16
12
 
@@ -1,12 +1,7 @@
1
1
  module ActiveScaffold::Config
2
2
  class Form < Base
3
3
  def initialize(core_config)
4
- @core = core_config
5
-
6
- # start with the ActionLink defined globally
7
- @link = self.class.link.clone unless self.class.link.nil?
8
- @action_group = self.class.action_group.clone if self.class.action_group
9
-
4
+ super
10
5
  # no global setting here because multipart should only be set for specific forms
11
6
  @multipart = false
12
7
  end
@@ -3,14 +3,10 @@ module ActiveScaffold::Config
3
3
  self.crud_type = :read
4
4
 
5
5
  def initialize(core_config)
6
- @core = core_config
6
+ super
7
7
 
8
8
  @text_search = self.class.text_search
9
9
  @live = self.class.live?
10
-
11
- # start with the ActionLink defined globally
12
- @link = self.class.link.clone
13
- @action_group = self.class.action_group.clone if self.class.action_group
14
10
  end
15
11
 
16
12
 
@@ -3,10 +3,7 @@ module ActiveScaffold::Config
3
3
  self.crud_type = :read
4
4
 
5
5
  def initialize(core_config)
6
- @core = core_config
7
- # start with the ActionLink defined globally
8
- @link = self.class.link.clone
9
- @action_group = self.class.action_group.clone if self.class.action_group
6
+ super
10
7
  end
11
8
 
12
9
  # global level configuration
@@ -30,25 +30,13 @@ module ActiveScaffold
30
30
  # if we get here, it's because the column has a form_ui but not one ActiveScaffold knows about.
31
31
  raise "Unknown form_ui `#{column.form_ui}' for column `#{column.name}'"
32
32
  end
33
- elsif column.virtual?
34
- active_scaffold_input_virtual(column, options)
35
-
36
33
  else # regular model attribute column
37
34
  # if we (or someone else) have created a custom render option for the column type, use that
38
- if override_input?(column.column.type)
35
+ if !column.virtual? && override_input?(column.column.type)
39
36
  send(override_input(column.column.type), column, options)
40
37
  # final ultimate fallback: use rails' generic input method
41
38
  else
42
- # for textual fields we pass different options
43
- text_types = [:text, :string, :integer, :float, :decimal, :date, :time, :datetime]
44
- options = active_scaffold_input_text_options(options) if text_types.include?(column.column.type)
45
- if column.column.type == :string && options[:maxlength].blank?
46
- options[:maxlength] = column.column.limit
47
- options[:size] ||= ActionView::Helpers::InstanceTag::DEFAULT_FIELD_OPTIONS["size"]
48
- end
49
- options[:include_blank] = true if column.column.null and [:date, :datetime, :time].include?(column.column.type)
50
- options[:value] = format_number_value(@record.send(column.name), column.options) if column.column.number?
51
- text_field(:record, column.name, options.merge(column.options))
39
+ active_scaffold_input_text_field(column, options)
52
40
  end
53
41
  end
54
42
  end
@@ -94,6 +82,34 @@ module ActiveScaffold
94
82
  ##
95
83
  ## Form input methods
96
84
  ##
85
+ def active_scaffold_input_text_field(column, options)
86
+ if column.column.nil?
87
+ options = active_scaffold_input_text_options(options)
88
+ if column.association
89
+ associated = @record.send(column.association.name)
90
+ options[:value] = associated.id
91
+ end
92
+ else
93
+ text_types = [:text, :string, :integer, :float, :decimal, :date, :time, :datetime]
94
+ options = active_scaffold_input_text_options(options) if text_types.include?(column.column.type)
95
+ if column.column.type == :string && options[:maxlength].blank?
96
+ options[:maxlength] = column.column.limit
97
+ options[:size] ||= ActionView::Helpers::InstanceTag::DEFAULT_FIELD_OPTIONS["size"]
98
+ end
99
+ options[:include_blank] = true if column.column.null and [:date, :datetime, :time].include?(column.column.type)
100
+ options[:value] = format_number_value(@record.send(column.name), column.options) if column.column.number?
101
+ end
102
+
103
+ text_field(:record, column.name, options.merge(column.options))
104
+ end
105
+
106
+ def active_scaffold_input_hidden(column, options)
107
+ if column.association
108
+ associated = @record.send(column.association.name)
109
+ options[:value] = associated.id
110
+ end
111
+ hidden_field(:record, column.name, options)
112
+ end
97
113
 
98
114
  def active_scaffold_input_singular_association(column, html_options)
99
115
  associated = @record.send(column.association.name)
@@ -223,11 +239,6 @@ module ActiveScaffold
223
239
  def active_scaffold_input_textarea(column, options)
224
240
  text_area(:record, column.name, options.merge(:cols => column.options[:cols], :rows => column.options[:rows], :size => column.options[:size]))
225
241
  end
226
-
227
- def active_scaffold_input_virtual(column, options)
228
- options = active_scaffold_input_text_options(options)
229
- text_field :record, column.name, options.merge(column.options)
230
- end
231
242
 
232
243
  #
233
244
  # Column.type-based inputs
@@ -2,7 +2,7 @@ module ActiveScaffold
2
2
  module Version
3
3
  MAJOR = 3
4
4
  MINOR = 2
5
- PATCH = 10
5
+ PATCH = 11
6
6
 
7
7
  STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_scaffold_vho
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.10
4
+ version: 3.2.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Many, see README
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-14 00:00:00.000000000 Z
11
+ date: 2014-11-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: shoulda