adva 0.2.0 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8f16fead7014a86e872d525253b6df9702dc1e6914b1b90278c314055d95c497
4
- data.tar.gz: d0ce6569c64d50860f36fc695d3f7e881b92d39051bb44df2818f1dff1114fa6
3
+ metadata.gz: e08dd9649ae6dd11c6e37290d1117e0804a31f6fe8f5c351d075c04734f2818d
4
+ data.tar.gz: f3b4606e63ccf7079f0da6e0310b31c6679f01d411027edb4e773fac8ae3ec99
5
5
  SHA512:
6
- metadata.gz: 0dfde419a4b47e88322f2df4d1d12f919d6c95366c5762d7a11440d10d5b12352fe2aaf44b2a75329de180751a7301fe35ede836fb7c6146a950b02d31179457
7
- data.tar.gz: 17f54412e35104938c42bce0cdfeba484cc8a10691e3e2507846d8d889945e8c78b2d3701c6c293b05ebd011909cf2501feca5a0c7cf3efa7f9c693995cb970b
6
+ metadata.gz: f772ae34995d9068b01801c5176004a9a07c5c45e936235e80d82a2df626815d39143df4cb4f3a7576194f4336f921b6565930009fad1402f14a1169d9d532a8
7
+ data.tar.gz: 8d7355b2338f519f4244155fcf6b43ecc833d4fc40b5d3ad2e3e427d077fe49a87d546af49a8292cd41b07f71087f41922407b9820a1a303743c20ef6002ddde
data/adva.gemspec CHANGED
@@ -17,6 +17,7 @@ Gem::Specification.new do |gem|
17
17
 
18
18
  gem.add_dependency "will_paginate"
19
19
  gem.add_dependency "awesome_nested_set"
20
+ gem.add_dependency "labelled_form"
20
21
  gem.add_dependency "ckeditor"
21
22
  gem.add_dependency "nacelle"
22
23
  gem.add_dependency "friendly_id", "~> 5.1.0" # 5.2.0 tries to call #slug= on invalid save
@@ -39,15 +39,10 @@ class ArticlesController < BaseController
39
39
  end
40
40
 
41
41
  helper_method def tags
42
- if !defined?(@tags)
43
- @tags = if params[:tags]
44
- names = params[:tags].split('+')
45
- @tags = Tag.where(name: names).pluck(:name)
46
- raise ActiveRecord::RecordNotFound unless @tags.size == names.size
47
- else
48
- []
49
- end
50
- end
42
+ return @tags if defined?(@tags)
43
+ names = params[:tags].to_s.split('+')
44
+ @tags = Tag.where(name: names).pluck(:name)
45
+ raise ActiveRecord::RecordNotFound if @tags.size != names.size
51
46
  @tags
52
47
  end
53
48
 
@@ -10,7 +10,7 @@
10
10
  <%= f.text_field :body, class: 'big' %>
11
11
 
12
12
  <%= f.label :draft, "Save as Draft?" %>
13
- <%= f.check_box :draft?, id: 'toggle_draft', label: "Yes, save this link as a draft" %>
13
+ <%= f.check_box :draft?, label: "Yes, save this link as a draft" %>
14
14
 
15
15
  <p class="show-if-previous-unchecked">
16
16
  <%= f.label :published_at, "Publish on this date" %>
@@ -76,35 +76,6 @@ module Adva
76
76
  end
77
77
  end
78
78
 
79
- helpers = field_helpers + %w(select date_select datetime_select time_select time_zone_select collection_select) -
80
- %w(hidden_field label fields_for apply_form_for_options!)
81
-
82
- helpers.each do |method_name|
83
- class_eval <<-src, __FILE__, __LINE__
84
- def #{method_name}(*args, &block)
85
- type = #{method_name.to_sym.inspect}
86
-
87
- options = args.extract_options!
88
- options = add_default_class_names(options, type)
89
- # options = add_tabindex(options, type)
90
-
91
- label, wrap, hint = options.delete(:label), options.delete(:wrap), options.delete(:hint)
92
- name = args.first
93
-
94
- hint = I18n.t(hint) if hint.is_a?(Symbol)
95
- options[:title] = hint
96
-
97
- with_callbacks(name) do
98
- tag = super(*(args << options), &block)
99
- # remember_tabindex(tag, options)
100
- tag = labelize(type, tag, name, label) if label || self.options[:labels]
101
- tag = wrap(tag) if wrap || self.options[:wrap]
102
- tag
103
- end
104
- end
105
- src
106
- end
107
-
108
79
  def field_set(*args, &block)
109
80
  options = args.extract_options!
110
81
  options = add_default_class_names(options, :field_set)
@@ -164,25 +135,6 @@ module Adva
164
135
 
165
136
  protected
166
137
 
167
- def labelize(type, tag, method, label = nil)
168
- label = case label
169
- when String then label
170
- when Symbol then I18n.t(label)
171
- when TrueClass then
172
- scope = [:activerecord, :attributes] + object.class.to_s.underscore.split('/')
173
- string = I18n.t(method, :scope => scope)
174
- string.is_a?(String) ? string : method.to_s.titleize
175
- else nil
176
- end
177
-
178
- case type
179
- when :check_box, :radio_button
180
- tag + self.label(method, label, :class => 'inline light', :for => extract_id(tag), :id => "#{extract_id(tag)}_label")
181
- else
182
- self.label(method, label) + tag
183
- end
184
- end
185
-
186
138
  def wrap(tag)
187
139
  @template.content_tag(:p, tag)
188
140
  end
data/lib/adva/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Adva
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: adva
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Micah Geisel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-07-30 00:00:00.000000000 Z
11
+ date: 2024-08-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: will_paginate
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: labelled_form
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: ckeditor
43
57
  requirement: !ruby/object:Gem::Requirement