typus 0.9.20 → 0.9.21

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/VERSION CHANGED
@@ -1 +1 @@
1
- 0.9.20
1
+ 0.9.21
@@ -19,17 +19,17 @@ module Admin::TableHelper
19
19
  fields.each do |key, value|
20
20
  case value
21
21
  when :boolean then html << typus_table_boolean_field(key, item)
22
- when :datetime then html << typus_table_datetime_field(key, item, fields.keys.first, link_options)
23
- when :date then html << typus_table_datetime_field(key, item, fields.keys.first, link_options)
24
- when :file then html << typus_table_file_field(key, item, fields.keys.first, link_options)
25
- when :time then html << typus_table_datetime_field(key, item, fields.keys.first, link_options)
22
+ when :datetime then html << typus_table_datetime_field(key, item, link_options)
23
+ when :date then html << typus_table_datetime_field(key, item, link_options)
24
+ when :file then html << typus_table_file_field(key, item, link_options)
25
+ when :time then html << typus_table_datetime_field(key, item, link_options)
26
26
  when :belongs_to then html << typus_table_belongs_to_field(key, item)
27
27
  when :tree then html << typus_table_tree_field(key, item)
28
28
  when :position then html << typus_table_position_field(key, item)
29
29
  when :has_and_belongs_to_many then
30
30
  html << typus_table_has_and_belongs_to_many_field(key, item)
31
31
  else
32
- html << typus_table_string_field(key, item, fields.keys.first, link_options)
32
+ html << typus_table_string_field(key, item, link_options)
33
33
  end
34
34
 
35
35
  end
@@ -142,13 +142,13 @@ module Admin::TableHelper
142
142
  HTML
143
143
  end
144
144
 
145
- def typus_table_string_field(attribute, item, first_field, link_options = {})
145
+ def typus_table_string_field(attribute, item, link_options = {})
146
146
  <<-HTML
147
147
  <td>#{item.send(attribute)}</td>
148
148
  HTML
149
149
  end
150
150
 
151
- def typus_table_file_field(attribute, item, first_field, link_options = {})
151
+ def typus_table_file_field(attribute, item, link_options = {})
152
152
  <<-HTML
153
153
  <td><a href="##{item.to_dom(:suffix => 'zoom')}" id="#{item.to_dom}" title="Click to preview">#{item.send(attribute)}</a></td>
154
154
  <div id="#{item.to_dom(:suffix => 'zoom')}">#{item.typus_preview}</div>
@@ -184,17 +184,10 @@ module Admin::TableHelper
184
184
 
185
185
  end
186
186
 
187
- def typus_table_datetime_field(attribute, item, first_field = nil, link_options = {} )
188
-
189
- action = item.class.typus_options_for(:default_action_on_item)
187
+ def typus_table_datetime_field(attribute, item, link_options = {} )
190
188
 
191
189
  date_format = item.class.typus_date_format(attribute)
192
- value = !item.send(attribute).nil? ? item.send(attribute).to_s(date_format) : item.class.typus_options_for(:nil)
193
- content = if first_field == attribute
194
- link_to value, link_options.merge(:controller => "admin/#{item.class.name.tableize}", :action => action, :id => item.id )
195
- else
196
- value
197
- end
190
+ content = !item.send(attribute).nil? ? item.send(attribute).to_s(date_format) : item.class.typus_options_for(:nil)
198
191
 
199
192
  <<-HTML
200
193
  <td>#{content}</td>
@@ -206,7 +206,7 @@ class Admin::TableHelperTest < ActiveSupport::TestCase
206
206
 
207
207
  output = typus_table_datetime_field(:created_at, post, :created_at)
208
208
  expected = <<-HTML
209
- <td><a href="http://test.host/admin/posts/edit/#{post.id}">#{post.created_at.strftime('%m/%y')}</a></td>
209
+ <td>#{post.created_at.strftime('%m/%y')}</td>
210
210
  HTML
211
211
 
212
212
  assert_equal expected, output
data/typus.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{typus}
8
- s.version = "0.9.20"
8
+ s.version = "0.9.21"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Francesc Esplugas"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: typus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.20
4
+ version: 0.9.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - Francesc Esplugas