adva 0.2.1 → 0.2.3

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,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e21414bd4e4a1bc2f2997b923f801e3d9975691f988db62aae1143c04c87f7f3
4
- data.tar.gz: 59403cb73cdc450177df44dd4cd533be6373924e8cd1f709064ba0aa273b7cf2
3
+ metadata.gz: 978b534aa1c0c30a24a3cf729c1b3216a6a97c6488151c94a1b846f0b7e7c373
4
+ data.tar.gz: ac852a47a7167285e007538ed127c38a8d1e1f960cfa7c8477d6520ae212d21b
5
5
  SHA512:
6
- metadata.gz: dbfb718c389be77270bc0f4bd61b64265f84273164e1a8cb3defd75581f46009600c506f812fcc87d5abbc91f066a828982a6b79d620f8eacf2e1670ac32b16f
7
- data.tar.gz: 3060ae6ddb8cce65b26be5d390ba5f1a1f75126d90cf96e7f1dc5501867cedf2dbc7442eefaf843db29c036412a770a2acaea4e57ebbd8d2726c7705a20b27a9
6
+ metadata.gz: 0f1a614b3b38549dfa6159404f0db4fa77996336812570af9d9fdf942e3ba7435fb766333cf9343212292c15b52c87dba7302594e57f8f588815ad9537461a7a
7
+ data.tar.gz: 5c1efba1d71c1615249efea827c5dcc20141711478b159eccc8fd4f94caf53748019dea3f17532f6b620f2ce3ac8bc9a0b5e81237fb9730a4c29bd82f79f5f86
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
@@ -2,6 +2,13 @@ require "adva/has_permalink"
2
2
  require "adva/belongs_to_author"
3
3
 
4
4
  class Content < ActiveRecord::Base
5
+ # Fix STI in dev
6
+ unless Rails.application.config.eager_load
7
+ def self.find_sti_class(type_name)
8
+ eval(type_name.to_s)
9
+ end
10
+ end
11
+
5
12
  acts_as_nested_set :scope => :section_id
6
13
 
7
14
  acts_as_taggable
@@ -145,3 +152,4 @@ class Content < ActiveRecord::Base
145
152
  end
146
153
  end
147
154
  end
155
+
@@ -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.1"
2
+ VERSION = "0.2.3"
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.1
4
+ version: 0.2.3
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-08-12 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