usefull_table 1.0.4 → 1.0.8
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/CHANGELOG.md +16 -2
- data/Gemfile +4 -2
- data/README.rdoc +5 -3
- data/app/controllers/usefull_table/table_controller.rb +3 -4
- data/app/helpers/usefull_table_helper.rb +15 -5
- data/lib/generators/usefull_table/install/templates/config/locales/usefull_table.it.yml +1 -12
- data/lib/generators/usefull_table/install/templates/public/stylesheets/usefull_table.css +31 -12
- data/lib/generators/usefull_table/scaffold/templates/lib/templates/erb/scaffold/index.html.erb +0 -2
- data/lib/usefull_table/table_builder.rb +70 -21
- data/lib/usefull_table/version.rb +1 -1
- metadata +35 -19
data/CHANGELOG.md
CHANGED
@@ -7,9 +7,23 @@ ToDo
|
|
7
7
|
- Add :if => Proc.new to condition column presence
|
8
8
|
|
9
9
|
BugToFix
|
10
|
-
-
|
10
|
+
- link :name=> "pippo", body_type => icon, :url => "my_url" do not render default icons if not passed in yml
|
11
|
+
- Export: currency column must not be renderered as string
|
12
|
+
- Export: unable to find local view if namespace are used. If I call export from /production/orders/index.html
|
13
|
+
contrllers.paths has only /orders/index.xlsx.maker
|
14
|
+
|
15
|
+
1.0.8 (September 5, 2013)
|
16
|
+
- Fixed Header Link localization, now localize association correctly
|
17
|
+
|
18
|
+
1.0.7 (March 30, 2013)
|
19
|
+
- Fixed data_type => Date, Time, DateTime crash with blank/empty values
|
20
|
+
|
21
|
+
1.0.6 (October 11, 2012)
|
22
|
+
- Added Percentage support to :data_field
|
23
|
+
|
24
|
+
1.0.5
|
25
|
+
- If Currency column is nil, must output 0 currency formatted
|
11
26
|
|
12
|
-
BugToFix
|
13
27
|
1.0.2 (July 13, 2012)
|
14
28
|
- Update to Rails 3.0.14
|
15
29
|
|
data/Gemfile
CHANGED
@@ -3,8 +3,10 @@ source "http://rubygems.org"
|
|
3
3
|
gem "rails", "~>3.0.14"
|
4
4
|
|
5
5
|
group :development, :test do
|
6
|
-
gem "acts_as_monitor", :path => "/home/www/gems/acts_as_monitor"
|
7
|
-
gem "acts_as_xls", :path => "/home/www/gems/acts_as_xls"
|
6
|
+
#gem "acts_as_monitor", :path => "/home/www/gems/acts_as_monitor"
|
7
|
+
#gem "acts_as_xls", :path => "/home/www/gems/acts_as_xls"
|
8
|
+
gem "acts_as_monitor"
|
9
|
+
gem "acts_as_xls"
|
8
10
|
gem "meta_search"
|
9
11
|
gem "will_paginate"
|
10
12
|
gem "ruby-debug"
|
data/README.rdoc
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
=UsefullTable
|
2
2
|
table_for generate a full-optionals table, with excel export, columns ordering, links, inline editing and monitoring (ActsAsMonitor https://github.com/skylord73/acts_as_monitor)
|
3
|
-
but don't
|
3
|
+
but don't worry because a rich set of defaults, make its use very simple!
|
4
|
+
|
4
5
|
|
5
6
|
for a working sample please refer to test/dummy
|
6
7
|
|
@@ -125,6 +126,7 @@ Render column value
|
|
125
126
|
- :Time
|
126
127
|
- :DateTime
|
127
128
|
- :Currency
|
129
|
+
- :Percentage #transform float number in percentage with :precision => 0 ( 0.1 => 10%)
|
128
130
|
- :Bool #Transform value in boolean
|
129
131
|
- :Bool_reverse #Transform vale in boolean and reverse the vale
|
130
132
|
|
@@ -137,7 +139,8 @@ Render column value
|
|
137
139
|
- true #enable inline editing for the column, works also with nested fields (no controller add-on required)
|
138
140
|
|
139
141
|
==label
|
140
|
-
Render static label
|
142
|
+
- Render static label
|
143
|
+
- <% t.label Proc.new {|item| item.id * 3}, :label => "Id * 3" %>
|
141
144
|
|
142
145
|
===Usage
|
143
146
|
<% t.label object %> #render object.inspect
|
@@ -230,4 +233,3 @@ Many thanks to :
|
|
230
233
|
- WillPaginate
|
231
234
|
- Spreadsheet
|
232
235
|
- Axlsx
|
233
|
-
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module UsefullTable
|
2
2
|
class TableController < ::ApplicationController
|
3
|
-
|
3
|
+
|
4
4
|
def create
|
5
5
|
usefull_table = HashWithIndifferentAccess.new(ActiveSupport::JSON.decode(params[:usefull_table]))
|
6
6
|
#Rails::logger.info("MonitorsController back=#{usefull_table[:paths].inspect}")
|
@@ -12,13 +12,13 @@ module UsefullTable
|
|
12
12
|
end
|
13
13
|
@params = usefull_table[:params]
|
14
14
|
end
|
15
|
-
|
15
|
+
|
16
16
|
respond_to do |format|
|
17
17
|
format.html
|
18
18
|
format.xlsx { render :xlsx => "create", :template => select_path(usefull_table[:paths],"xlsx.maker") }
|
19
19
|
end
|
20
20
|
end
|
21
|
-
|
21
|
+
|
22
22
|
def update
|
23
23
|
#usefull_table = HashWithIndifferentAccess.new(ActiveSupport::JSON.decode(params[:usefull_table]))
|
24
24
|
Rails::logger.info("TableController#update params=#{params.inspect}")
|
@@ -28,7 +28,6 @@ module UsefullTable
|
|
28
28
|
render :text => CGI::escapeHTML(@item.send(params[:attribute_name]).to_s)
|
29
29
|
end
|
30
30
|
end
|
31
|
-
|
32
31
|
|
33
32
|
end
|
34
33
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module UsefullTableHelper
|
2
2
|
#=UsefullTable
|
3
3
|
#table_for generate a full-optionals table, with excel export, columns ordering, links, inline edit and monitoring (ActsAsMonitor gem)
|
4
|
-
#but don't
|
4
|
+
#but don't worry because of a rich set of defaults makes it very simple to use.
|
5
5
|
#
|
6
6
|
#==Setup
|
7
7
|
#Add this line to your application's Gemfile:
|
@@ -55,7 +55,11 @@ module UsefullTableHelper
|
|
55
55
|
# options[:export][:filter] = *true* | false _note:_ false if @search not present
|
56
56
|
# options[:export][:human] = *true* | false
|
57
57
|
# options[:export][:worksheet] = *object.class.name.gsub(/::/,"#")* _note:_ class name with namespace separator #
|
58
|
-
# options[:export][:url] = custom url
|
58
|
+
# options[:export][:url] = custom url
|
59
|
+
# options[:export][:search] |= options[:export][:url] ? false : true
|
60
|
+
# If you have a custom url and force :search = true, you have to manage the deserialization of params[:usefull_table]
|
61
|
+
# see app/controllers/usefull_table/table_controller for a pratical example.
|
62
|
+
# the option is used to manage the filter params in custom url files
|
59
63
|
#===Table
|
60
64
|
# options[:table][:div_html] = *{:class => "usefull_table"}*
|
61
65
|
# options[:table][:header_html] = *{:class => "first_row"}*
|
@@ -119,8 +123,8 @@ module UsefullTableHelper
|
|
119
123
|
out << stylesheet_link_tag('usefull_table.css')
|
120
124
|
out << content_tag(:div, options[:html]) do
|
121
125
|
ext = ''
|
122
|
-
ext << usefull_table_paginator_for(object, options[:paginator])
|
123
126
|
ext << usefull_table_export_for(object,search,builder, options[:export])
|
127
|
+
ext << usefull_table_paginator_for(object, options[:paginator])
|
124
128
|
ext << usefull_table_for(builder, object, search, options[:table])
|
125
129
|
ext << usefull_table_paginator_for(object, options[:paginator])
|
126
130
|
ext.html_safe
|
@@ -137,8 +141,12 @@ module UsefullTableHelper
|
|
137
141
|
#
|
138
142
|
#You can build a new table passing a block (see ::table_for
|
139
143
|
def export_for(object, params = nil, &block)
|
140
|
-
|
141
|
-
|
144
|
+
unless object.blank?
|
145
|
+
builder = UsefullTable::TableBuilder.new(object, nil, nil, self, :params => params, &block)
|
146
|
+
builder.to_a
|
147
|
+
else
|
148
|
+
[]
|
149
|
+
end
|
142
150
|
end
|
143
151
|
|
144
152
|
#Draw inline edit field
|
@@ -236,6 +244,8 @@ module UsefullTableHelper
|
|
236
244
|
end
|
237
245
|
end
|
238
246
|
|
247
|
+
#Return the first valid path af an xlsx.maker
|
248
|
+
#if nil default is used.
|
239
249
|
def select_path(paths, extension)
|
240
250
|
Rails::logger.info("select_path @path=#{paths.inspect}\n\n")
|
241
251
|
paths.delete_if {|path| !File.exists?(path)}
|
@@ -28,15 +28,4 @@ it:
|
|
28
28
|
|
29
29
|
date:
|
30
30
|
formats:
|
31
|
-
usefull_table_date: "%d/%m/%Y"
|
32
|
-
|
33
|
-
number:
|
34
|
-
currency:
|
35
|
-
format:
|
36
|
-
format: "%n %u"
|
37
|
-
unit: "€"
|
38
|
-
separator: ","
|
39
|
-
delimiter: "."
|
40
|
-
precision: 2
|
41
|
-
significant: false
|
42
|
-
strip_insignificant_zeros: false
|
31
|
+
usefull_table_date: "%d/%m/%Y"
|
@@ -1,14 +1,21 @@
|
|
1
1
|
/*Export*/
|
2
|
-
|
3
|
-
|
2
|
+
|
3
|
+
div.usefull_table_export {
|
4
|
+
background: gold;
|
4
5
|
border-width: 1px;
|
5
6
|
margin-top: 3px;
|
6
|
-
margin-bottom: 3px;
|
7
|
+
margin-bottom: 3px;
|
8
|
+
top:35px;
|
9
|
+
right:300px
|
7
10
|
}
|
8
11
|
|
12
|
+
div.usefull_table_export input[type='submit']{
|
13
|
+
background: orange;
|
14
|
+
}
|
15
|
+
|
9
16
|
/*Paginator */
|
10
17
|
div.usefull_table_paginator {
|
11
|
-
width:
|
18
|
+
width: 99%;
|
12
19
|
background: white;
|
13
20
|
cursor: default;
|
14
21
|
border: 2px solid #dddddd;
|
@@ -71,31 +78,43 @@ div.usefull_table_paginator {
|
|
71
78
|
overflow: hidden; }
|
72
79
|
|
73
80
|
/* Table*/
|
81
|
+
div.usefull_table {width:100%;overflow:auto;}
|
74
82
|
div.usefull_table table {
|
75
83
|
border-collapse:collapse;
|
76
84
|
border-spacing:0;
|
77
85
|
margin-bottom:1.4em;
|
78
86
|
width:100%;}
|
87
|
+
|
88
|
+
div.usefull_table tbody {
|
89
|
+
width:100%;}
|
79
90
|
div.usefull_table tbody tr.first_row {
|
80
|
-
background:#C3D934;
|
91
|
+
background:#C3D934;
|
92
|
+
font-weight:bold;}
|
81
93
|
div.usefull_table tbody tr.odd {
|
82
94
|
background-color: #FFFFFF;}
|
83
95
|
div.usefull_table tbody tr.even {
|
84
96
|
background-color: #E5ECF9;}
|
85
97
|
div.usefull_table td, .usefull_table th {
|
98
|
+
text-align: center;
|
86
99
|
padding:2px 4px;
|
87
|
-
text-align:left;
|
88
100
|
margin:0;
|
89
101
|
vertical-align:middle;
|
90
102
|
float:none !important;
|
91
|
-
max-width:
|
92
|
-
border-collapse: collapse;
|
93
|
-
|
94
|
-
|
95
|
-
|
103
|
+
max-width:400px;
|
104
|
+
border-collapse: collapse;
|
105
|
+
}
|
106
|
+
.min30{
|
107
|
+
min-width:30px !important;
|
108
|
+
}
|
109
|
+
.min75{
|
110
|
+
min-width:75px !important;
|
111
|
+
}
|
112
|
+
|
113
|
+
/*div.usefull_table th {
|
114
|
+
border:0 none;}*/
|
96
115
|
div.usefull_table td {
|
97
116
|
border-bottom:1px solid red;
|
98
117
|
text-overflow:ellipsis;
|
99
118
|
overflow:hidden;
|
100
119
|
white-space:nowrap;
|
101
|
-
font-weight:normal;}
|
120
|
+
font-weight:normal;}
|
@@ -9,11 +9,13 @@ module UsefullTable
|
|
9
9
|
#[ {column1}, {column2} ...]
|
10
10
|
#where {column} is an hash with the following options:
|
11
11
|
#* {
|
12
|
-
#* :nome => column name (ActiveRecord)
|
12
|
+
#* :nome => column name (ActiveRecord) in the form :column or "collection.column"
|
13
13
|
#* :type => :column | :link
|
14
|
-
#* :label => "
|
14
|
+
#* :label => "what you want" | column name if not specified
|
15
15
|
#* :header_type => :sort | :plain | :human | :nil
|
16
|
-
#* :body_type => :value (column value) | :plain (
|
16
|
+
#* :body_type => :value (column value) | :plain (whatever you write as column name)
|
17
|
+
#* :td_html => html <td> tag attributes
|
18
|
+
#* }
|
17
19
|
class TableBuilder
|
18
20
|
DATE = [:date, :datetime]
|
19
21
|
LINK = [:show, :edit, :destroy, :download, :link]
|
@@ -106,7 +108,9 @@ module UsefullTable
|
|
106
108
|
#
|
107
109
|
# :url => "static_path" or Proc #Proc expose the object instance of the current row
|
108
110
|
#
|
109
|
-
# :inline => true (default false) enable inline edit
|
111
|
+
# :inline => true (default false) enable inline edit
|
112
|
+
#
|
113
|
+
# :if => evaluate a Proc to show colum value or not
|
110
114
|
#
|
111
115
|
def col(attribute, *args)
|
112
116
|
options = args.extract_options!
|
@@ -116,6 +120,8 @@ module UsefullTable
|
|
116
120
|
options[:header_type] ||= options[:label].nil? ? :sort : :plain
|
117
121
|
options[:body_type] ||= options[:url].blank? ? :value : :link
|
118
122
|
options[:label] ||= attribute
|
123
|
+
options[:td_html] ||= ''
|
124
|
+
options[:wrap] ||= false
|
119
125
|
@data << options
|
120
126
|
end
|
121
127
|
|
@@ -245,7 +251,8 @@ module UsefullTable
|
|
245
251
|
num = 1
|
246
252
|
data.delete_if { |element| element[:method_name] == :link || element[:body].kind_of?(Proc)}
|
247
253
|
data.each do |element|
|
248
|
-
element[:url] = "/" if element[:url].present?
|
254
|
+
element[:url] = "/" if element[:url].present?
|
255
|
+
element.delete(:if)
|
249
256
|
end if data.present?
|
250
257
|
#Rails::logger.info("TableBuilder#_sanitize_data(fine) data=#{data.inspect}")
|
251
258
|
data
|
@@ -266,10 +273,10 @@ module UsefullTable
|
|
266
273
|
@options[:paginator] ||= {}
|
267
274
|
@options[:paginator][:visible] = true if @options[:paginator][:visible].nil?
|
268
275
|
@options[:paginator][:visible] = false if !@object.respond_to? :total_pages
|
269
|
-
@options[:paginator][:class] = "usefull_table_paginator"
|
276
|
+
@options[:paginator][:class] = "usefull_table_paginator span-24"
|
270
277
|
|
271
278
|
#Container
|
272
|
-
@options[:html] ||= {:class => "usefull_table_container"}
|
279
|
+
@options[:html] ||= {:class => "usefull_table_container span-24"}
|
273
280
|
|
274
281
|
#Excel
|
275
282
|
@options[:export] ||= {}
|
@@ -279,13 +286,13 @@ module UsefullTable
|
|
279
286
|
@options[:export][:human] = true if @options[:export][:human].nil?
|
280
287
|
@options[:export][:worksheet] ||= @object.first.class.name.gsub(/::/,"#")
|
281
288
|
#remove search options if custom url is passed
|
282
|
-
@options[:export][:search]
|
289
|
+
@options[:export][:search] |= @options[:export][:url] ? false : true
|
283
290
|
@options[:export][:url] ||= @template.url_for(:action => "create", :controller => "usefull_table/table") + ".xlsx"
|
284
|
-
@options[:export][:class] = "usefull_table_export"
|
291
|
+
@options[:export][:class] = "usefull_table_export span-24"
|
285
292
|
|
286
293
|
#Table
|
287
294
|
@options[:table] ||= {}
|
288
|
-
@options[:table][:div_html] ||= {:class => "usefull_table"}
|
295
|
+
@options[:table][:div_html] ||= {:class => "usefull_table span-24"}
|
289
296
|
@options[:table][:header_html] ||= {:class => "first_row"}
|
290
297
|
#Ususally column_type is :sort, but is search is not present I cannot render a sort_link...
|
291
298
|
@options[:table][:header_type] = :human if @search.nil?
|
@@ -320,7 +327,7 @@ module UsefullTable
|
|
320
327
|
@data.each do |element|
|
321
328
|
b = body(obj,element)
|
322
329
|
row << b[:plain]
|
323
|
-
@template.concat @template.content_tag(:td, b[:html])
|
330
|
+
@template.concat @template.content_tag(:td, b[:html],b[:td_html])
|
324
331
|
end
|
325
332
|
end
|
326
333
|
@excel << row.compact
|
@@ -335,13 +342,21 @@ module UsefullTable
|
|
335
342
|
case attribute[:header_type]
|
336
343
|
when :sort then
|
337
344
|
value = nestize(attribute)
|
338
|
-
|
345
|
+
title = localize_title(attribute)
|
346
|
+
# out_html = @template.sort_link(@search, value)
|
347
|
+
|
348
|
+
# Set column Header default sorting to 'desc' (at the first click).
|
349
|
+
# If in the controller you specified a default filter for a column which already sets
|
350
|
+
# the default order to "desc", then the first click will sort by ascending order this time,
|
351
|
+
# only for that column/field.
|
352
|
+
out_html = @template.sort_link(@search, value, title, :default_order => :desc)
|
339
353
|
out = value
|
340
354
|
when :plain then
|
341
355
|
out_html = out = attribute[:label] = localize(attribute[:label])
|
342
356
|
when :human then
|
343
357
|
#UserSession.log("TableHelper#h: object.first.class.human_attribute_name(#{attribute[:label]})")
|
344
358
|
out_html = out = @object.first.class.human_attribute_name(attribute[:label].to_s.gsub(/\./,"_"))
|
359
|
+
#out_html = out = @object.first.class.human_attribute_name(attribute[:label])
|
345
360
|
when :nil then
|
346
361
|
out_html = out = ""
|
347
362
|
else
|
@@ -357,7 +372,8 @@ module UsefullTable
|
|
357
372
|
def body(obj, attribute)
|
358
373
|
#Rails::logger.info("TableBuilder#body")
|
359
374
|
out = ""
|
360
|
-
out_html = ""
|
375
|
+
out_html = ""
|
376
|
+
if_value = attribute[:if].kind_of?(Proc) ? attribute[:if].call(obj) : true
|
361
377
|
case attribute[:type]
|
362
378
|
when :link then
|
363
379
|
out_html = attribute_link(obj, attribute)
|
@@ -391,10 +407,22 @@ module UsefullTable
|
|
391
407
|
end
|
392
408
|
else
|
393
409
|
out_html = out = I18n.t(:body_error, :scope => :usefull_table, :default => "Body Error")
|
394
|
-
end
|
395
|
-
{:html => out_html.to_s.html_safe, :plain => out}
|
410
|
+
end if if_value == true
|
411
|
+
{:html => out_html.to_s.html_safe, :plain => out, :td_html => attribute[:td_html]}
|
396
412
|
end
|
397
413
|
|
414
|
+
#Localize attribute through associations
|
415
|
+
#association.association1.attribute => association1.klass.attribute
|
416
|
+
def localize_title(attribute)
|
417
|
+
associations = attribute[:name].to_s.split(".")
|
418
|
+
klass = @object.respond_to?(:klass) ? @object.klass : @object.class
|
419
|
+
while associations.size > 1
|
420
|
+
klass = klass.reflect_on_association(associations.shift.to_sym).klass
|
421
|
+
end
|
422
|
+
#ass= associations.shift
|
423
|
+
#klass = klass.reflect_on_association(ass).klass
|
424
|
+
klass.human_attribute_name(associations)
|
425
|
+
end
|
398
426
|
|
399
427
|
#Localize if Symbol, print if String
|
400
428
|
def localize(value)
|
@@ -418,13 +446,18 @@ module UsefullTable
|
|
418
446
|
true_values = [1, true, "vero", "true", "yes", "si", "s"]
|
419
447
|
case type
|
420
448
|
when :Date then
|
421
|
-
|
449
|
+
#@template.l(attribute_value(obj,attribute[:name]), :format => :usefull_table_date)
|
450
|
+
l(attribute_value(obj,attribute[:name]), :format => :usefull_table_date)
|
422
451
|
when :Time then
|
423
|
-
|
452
|
+
#@template.l(attribute_value(obj,attribute[:name]), :format => :usefull_table_time )
|
453
|
+
l(attribute_value(obj,attribute[:name]), :format => :usefull_table_time )
|
424
454
|
when :DateTime then
|
425
|
-
|
455
|
+
#@template.l(attribute_value(obj,attribute[:name]), :format => :usefull_table_datetime)
|
456
|
+
l(attribute_value(obj,attribute[:name]), :format => :usefull_table_datetime)
|
426
457
|
when :Currency then
|
427
|
-
@template.number_to_currency(
|
458
|
+
@template.number_to_currency(currency_attribute_value(obj,attribute[:name]))
|
459
|
+
when :Percentage then
|
460
|
+
@template.number_to_percentage(percentage_attribute_value(obj,attribute[:name]), :precision => 0)
|
428
461
|
when :Bool then
|
429
462
|
true_values.include?(attribute_value(obj,attribute[:name])) ? true : false
|
430
463
|
when :Bool_reverse then
|
@@ -434,6 +467,11 @@ module UsefullTable
|
|
434
467
|
end
|
435
468
|
end
|
436
469
|
|
470
|
+
#Localize Times, Dates, etc.. and return "" if blank?
|
471
|
+
def l(value, *args)
|
472
|
+
value.blank? ? "" : @template.l(value, *args)
|
473
|
+
end
|
474
|
+
|
437
475
|
#Return attribute value if defined blank otherwise
|
438
476
|
def attribute_value(obj, attribute_name)
|
439
477
|
#Rails::logger.info("TableBuilder#attribute_value obj=#{obj.inspect}, attribute=#{attribute_name.inspect}")
|
@@ -444,6 +482,17 @@ module UsefullTable
|
|
444
482
|
end
|
445
483
|
end
|
446
484
|
|
485
|
+
#return attribute value if defined, 0.0 otherwise
|
486
|
+
def currency_attribute_value(obj, attribute_name)
|
487
|
+
attribute_value(obj, attribute_name).blank? ? 0.0 : attribute_value(obj, attribute_name)
|
488
|
+
end
|
489
|
+
|
490
|
+
#return attribute value if defined, 0 otherwise
|
491
|
+
def percentage_attribute_value(obj, attribute_name)
|
492
|
+
attribute_value(obj, attribute_name).blank? ? 0.0 : attribute_value(obj, attribute_name) * 100
|
493
|
+
end
|
494
|
+
|
495
|
+
|
447
496
|
#Render in_place_editor
|
448
497
|
#
|
449
498
|
#get Class and method name and send them to helper for rendering.
|
@@ -475,7 +524,7 @@ module UsefullTable
|
|
475
524
|
#Render a red/green label
|
476
525
|
def attribute_bool(value)
|
477
526
|
name = value ? :ok : :ko
|
478
|
-
@template.content_tag(:span, @template.image_tag(I18n.t(name, :scope => "usefull_table.icons", :
|
527
|
+
@template.content_tag(:span, @template.image_tag(I18n.t(name, :scope => "usefull_table.icons", :default => "usefull_table_#{name.to_s}.png")), :align => :center )
|
479
528
|
end
|
480
529
|
|
481
530
|
|
@@ -496,7 +545,7 @@ module UsefullTable
|
|
496
545
|
icon_name = attribute[:body_type] == :icon ? @template.image_tag(I18n.t(attribute_name.to_s.underscore, :scope => "usefull_table.icons", :defualt => "usefull_table_#{attribute_name.to_s.underscore}.png") ): localize(attribute_name)
|
497
546
|
@template.link_to(icon_name, url, attribute[:link_options])
|
498
547
|
end
|
499
|
-
|
548
|
+
|
500
549
|
#Return attribute Type
|
501
550
|
#works evenif the attribute is nested : document.activity.data_prevista => :Date
|
502
551
|
#Time object in Rails is a DateTime object, so it is renamed
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: usefull_table
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 7
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 1.0.
|
9
|
+
- 8
|
10
|
+
version: 1.0.8
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Andrea Bignozzi
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2013-10-04 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
version_requirements: &id001 !ruby/object:Gem::Requirement
|
@@ -29,12 +29,28 @@ dependencies:
|
|
29
29
|
- 0
|
30
30
|
- 14
|
31
31
|
version: 3.0.14
|
32
|
-
type: :runtime
|
33
|
-
requirement: *id001
|
34
32
|
prerelease: false
|
33
|
+
type: :runtime
|
35
34
|
name: rails
|
35
|
+
requirement: *id001
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
version_requirements: &id002 !ruby/object:Gem::Requirement
|
38
|
+
none: false
|
39
|
+
requirements:
|
40
|
+
- - "="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
hash: 23
|
43
|
+
segments:
|
44
|
+
- 1
|
45
|
+
- 3
|
46
|
+
- 6
|
47
|
+
version: 1.3.6
|
48
|
+
prerelease: false
|
49
|
+
type: :runtime
|
50
|
+
name: axlsx
|
51
|
+
requirement: *id002
|
52
|
+
- !ruby/object:Gem::Dependency
|
53
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
38
54
|
none: false
|
39
55
|
requirements:
|
40
56
|
- - ">="
|
@@ -43,10 +59,10 @@ dependencies:
|
|
43
59
|
segments:
|
44
60
|
- 0
|
45
61
|
version: "0"
|
46
|
-
type: :runtime
|
47
|
-
requirement: *id002
|
48
62
|
prerelease: false
|
63
|
+
type: :runtime
|
49
64
|
name: acts_as_xls
|
65
|
+
requirement: *id003
|
50
66
|
description: Table Helper with Excel export, inline editing and monitoring funxtions
|
51
67
|
email:
|
52
68
|
- skylord73@gmail.com
|
@@ -57,27 +73,27 @@ extensions: []
|
|
57
73
|
extra_rdoc_files: []
|
58
74
|
|
59
75
|
files:
|
60
|
-
- app/views/usefull_table/table/create.xlsx.maker
|
61
|
-
- app/helpers/usefull_table_helper.rb
|
62
76
|
- app/controllers/usefull_table/table_controller.rb
|
63
|
-
-
|
77
|
+
- app/helpers/usefull_table_helper.rb
|
78
|
+
- app/views/usefull_table/table/create.xlsx.maker
|
64
79
|
- lib/generators/usefull_table/install/install_generator.rb
|
65
|
-
- lib/generators/usefull_table/install/templates/
|
80
|
+
- lib/generators/usefull_table/install/templates/config/locales/usefull_table.it.yml
|
66
81
|
- lib/generators/usefull_table/install/templates/public/images/usefull_table_destroy.png
|
82
|
+
- lib/generators/usefull_table/install/templates/public/images/usefull_table_download.png
|
67
83
|
- lib/generators/usefull_table/install/templates/public/images/usefull_table_edit.png
|
68
|
-
- lib/generators/usefull_table/install/templates/public/images/usefull_table_true.png
|
69
84
|
- lib/generators/usefull_table/install/templates/public/images/usefull_table_false.png
|
70
|
-
- lib/generators/usefull_table/install/templates/public/images/
|
85
|
+
- lib/generators/usefull_table/install/templates/public/images/usefull_table_show.png
|
86
|
+
- lib/generators/usefull_table/install/templates/public/images/usefull_table_true.png
|
71
87
|
- lib/generators/usefull_table/install/templates/public/stylesheets/usefull_table.css
|
72
|
-
- lib/generators/usefull_table/install/templates/config/locales/usefull_table.it.yml
|
73
|
-
- lib/generators/usefull_table/scaffold/templates/lib/templates/rails/scaffold_controller/controller.rb
|
74
|
-
- lib/generators/usefull_table/scaffold/templates/lib/templates/erb/scaffold/show.html.erb
|
75
|
-
- lib/generators/usefull_table/scaffold/templates/lib/templates/erb/scaffold/index.html.erb
|
76
88
|
- lib/generators/usefull_table/scaffold/scaffold_generator.rb
|
89
|
+
- lib/generators/usefull_table/scaffold/templates/lib/templates/erb/scaffold/index.html.erb
|
90
|
+
- lib/generators/usefull_table/scaffold/templates/lib/templates/erb/scaffold/show.html.erb
|
91
|
+
- lib/generators/usefull_table/scaffold/templates/lib/templates/rails/scaffold_controller/controller.rb
|
77
92
|
- lib/usefull_table/engine.rb
|
78
|
-
- lib/usefull_table/table_builder.rb
|
79
93
|
- lib/usefull_table/exceptions.rb
|
94
|
+
- lib/usefull_table/table_builder.rb
|
80
95
|
- lib/usefull_table/version.rb
|
96
|
+
- lib/usefull_table.rb
|
81
97
|
- config/routes.rb
|
82
98
|
- MIT-LICENSE
|
83
99
|
- Rakefile
|