active_list 6.9.1 → 6.9.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/active_list/definition/action_column.rb +2 -1
- data/lib/active_list/definition/attribute_column.rb +5 -5
- data/lib/active_list/definition/data_column.rb +2 -2
- data/lib/active_list/definition/table.rb +2 -2
- data/lib/active_list/exporters/open_document_spreadsheet_exporter.rb +1 -0
- data/lib/active_list/renderers/simple_renderer.rb +6 -16
- data/lib/active_list/version.rb +1 -1
- data/test/dummy/Gemfile +1 -1
- data/test/dummy/config/application.rb +1 -1
- data/test/dummy/db/schema.rb +19 -17
- data/test/dummy/db/seeds.rb +1 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 19d2ab03026d988917f89129c6b30e231575aa61
|
4
|
+
data.tar.gz: f11050e05a4272429f469da1c05d165eb07cb05e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: df9a228e2170d291e42465b246edf06de056482877682805580ddb2edbca4c72679126a45f5d0b968771ed665eb7bad325f8744f27696a52dcc7616c11f6db87
|
7
|
+
data.tar.gz: 5a62e044889dc68c1ba168e38c600630c1c18878c6b041736fde9d4698fa18b1b442375a32ec6865857d35f75161a91f969cde40dbc5980834cad3e36e8ab610
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# coding: utf-8
|
2
|
+
|
2
3
|
module ActiveList
|
3
4
|
module Definition
|
4
5
|
class ActionColumn < AbstractColumn
|
@@ -6,7 +7,7 @@ module ActiveList
|
|
6
7
|
|
7
8
|
ID_PLACEHOLDER = '##IDS##'.freeze
|
8
9
|
|
9
|
-
USE_MODES = [
|
10
|
+
USE_MODES = %i[none single many both].freeze
|
10
11
|
|
11
12
|
attr_reader :use_mode
|
12
13
|
|
@@ -6,11 +6,11 @@ module ActiveList
|
|
6
6
|
def initialize(table, name, options = {})
|
7
7
|
super(table, name, options)
|
8
8
|
@label_method = (options[:label_method] || @name).to_sym
|
9
|
-
if options[:value_method].present?
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
9
|
+
@value_method = if options[:value_method].present?
|
10
|
+
options[:value_method].to_sym
|
11
|
+
else
|
12
|
+
@label_method.to_s.gsub('human_', '').to_sym
|
13
|
+
end
|
14
14
|
unless @sort_column = options[:sort]
|
15
15
|
@sort_column = if @table.model.columns_hash[@label_method.to_s]
|
16
16
|
@label_method
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module ActiveList
|
2
2
|
module Definition
|
3
3
|
class DataColumn < AbstractColumn
|
4
|
-
LABELS_COLUMNS = [
|
4
|
+
LABELS_COLUMNS = %i[full_name label name number coordinate].freeze
|
5
5
|
|
6
6
|
def header_code
|
7
7
|
if @options[:label]
|
@@ -57,7 +57,7 @@ module ActiveList
|
|
57
57
|
end
|
58
58
|
|
59
59
|
def numeric?
|
60
|
-
[
|
60
|
+
%i[decimal integer float numeric].include? datatype
|
61
61
|
end
|
62
62
|
|
63
63
|
# Returns the size/length of the column if the column is in the database
|
@@ -139,9 +139,9 @@ module ActiveList
|
|
139
139
|
if reflections.size == 1
|
140
140
|
reflection = reflections.first
|
141
141
|
columns = reflection.class_name.constantize.columns.collect { |c| c.name.to_s }
|
142
|
-
|
142
|
+
column(%i[label name code number].detect { |l| columns.include?(l.to_s) }, through: reflection.name, url: true)
|
143
143
|
else
|
144
|
-
|
144
|
+
column(column.name.to_sym)
|
145
145
|
end
|
146
146
|
end
|
147
147
|
true
|
@@ -36,7 +36,6 @@ module ActiveList
|
|
36
36
|
|
37
37
|
def build_table_code
|
38
38
|
record = 'r'
|
39
|
-
child = 'c'
|
40
39
|
|
41
40
|
# colgroup = columns_definition_code
|
42
41
|
header = header_code
|
@@ -138,7 +137,7 @@ module ActiveList
|
|
138
137
|
|
139
138
|
def columns_to_cells(nature, options = {})
|
140
139
|
code = ''
|
141
|
-
unless [
|
140
|
+
unless %i[body children].include?(nature)
|
142
141
|
raise ArgumentError, 'Nature is invalid'
|
143
142
|
end
|
144
143
|
record = options[:record] || 'record_of_the_death'
|
@@ -156,7 +155,7 @@ module ActiveList
|
|
156
155
|
elsif column.is_a? ActiveList::Definition::StatusColumn
|
157
156
|
|
158
157
|
value_code = column.datum_code(record, children_mode)
|
159
|
-
levels = %w
|
158
|
+
levels = %w[go caution stop]
|
160
159
|
lights = levels.collect do |light|
|
161
160
|
"content_tag(:span, '', :class => #{light.inspect})"
|
162
161
|
end.join(' + ')
|
@@ -170,7 +169,7 @@ module ActiveList
|
|
170
169
|
value_code = column.datum_code(record, children_mode)
|
171
170
|
if column.datatype == :boolean
|
172
171
|
value_code = "content_tag(:div, '', :class => 'checkbox-'+(" + value_code.to_s + " ? 'true' : 'false'))"
|
173
|
-
elsif [
|
172
|
+
elsif %i[date datetime timestamp measure].include? column.datatype
|
174
173
|
value_code = "(#{value_code}.nil? ? '' : #{value_code}.l)"
|
175
174
|
elsif [:item].include? column.datatype
|
176
175
|
value_code = "(#{value_code}.nil? ? '' : #{value_code}.human_name)"
|
@@ -309,7 +308,7 @@ module ActiveList
|
|
309
308
|
precision = "''"
|
310
309
|
if column.options[:currency]
|
311
310
|
unit = "Nomen::Currency.find(#{column.currency_for(generator.records_variable_name + '.first').inspect} || 'EUR').symbol.to_s"
|
312
|
-
precision = "Nomen::Currency.find(#{column.currency_for(generator.records_variable_name + '.first').inspect} || 'EUR').precision.to_s"
|
311
|
+
precision = "Nomen::Currency.find(#{column.currency_for(generator.records_variable_name + '.first').inspect} || 'EUR').precision.to_s"
|
313
312
|
elsif column.computable?
|
314
313
|
unit = "#{generator.records_variable_name}.first.#{column.value_method}.symbol"
|
315
314
|
precision = "'2'"
|
@@ -362,9 +361,6 @@ module ActiveList
|
|
362
361
|
pagination << '<span class="paginator">'
|
363
362
|
pagination << "<a href=\"#\" data-list-move-to-page=\"' + (#{current_page} - 1).to_s + '\" class=\"btn previous-page\"' + (#{current_page} != 1 ? '' : ' disabled=\"true\"') + '><i></i>' + ::I18n.translate('list.pagination.previous') + '</a>"
|
364
363
|
|
365
|
-
x = '@@PAGE-NUMBER@@'
|
366
|
-
y = '@@PAGE-COUNT@@'
|
367
|
-
|
368
364
|
pagination << "<a href=\"#\" data-list-move-to-page=\"' + (#{current_page} + 1).to_s + '\" class=\"btn next-page\"' + (#{current_page} != #{last_page} ? '' : ' disabled=\"true\"') + '><i></i>' + ::I18n.translate('list.pagination.next')+'</a>"
|
369
365
|
pagination << '</span>'
|
370
366
|
|
@@ -373,13 +369,7 @@ module ActiveList
|
|
373
369
|
code << "'#{pagination}'"
|
374
370
|
codes[:pagination] = "'#{pagination}'"
|
375
371
|
end
|
376
|
-
|
377
|
-
|
378
|
-
unless code.empty?
|
379
|
-
code = "content_tag(:div, (#{code.join(' + ')}).html_safe, class: 'list-control')"
|
380
|
-
end
|
381
|
-
|
382
|
-
code
|
372
|
+
codes
|
383
373
|
end
|
384
374
|
|
385
375
|
def uid
|
@@ -410,7 +400,7 @@ module ActiveList
|
|
410
400
|
classes << :col
|
411
401
|
classes << DATATYPE_ABBREVIATION[column.datatype]
|
412
402
|
classes << :url if column.options[:url].is_a?(Hash)
|
413
|
-
classes << column.label_method if [
|
403
|
+
classes << column.label_method if %i[code color].include? column.label_method.to_sym
|
414
404
|
if column.options[:mode] == :download
|
415
405
|
classes << :dld
|
416
406
|
elsif column.options[:mode] || column.label_method == :email
|
data/lib/active_list/version.rb
CHANGED
data/test/dummy/Gemfile
CHANGED
@@ -4,7 +4,7 @@ require 'rails/all'
|
|
4
4
|
|
5
5
|
if defined?(Bundler)
|
6
6
|
# If you precompile assets before deploying to production, use this line
|
7
|
-
Bundler.require(*Rails.groups(assets: %w
|
7
|
+
Bundler.require(*Rails.groups(assets: %w[development test]))
|
8
8
|
# If you want your assets lazily compiled in production, use this line
|
9
9
|
# Bundler.require(:default, :assets, Rails.env)
|
10
10
|
end
|
data/test/dummy/db/schema.rb
CHANGED
@@ -11,24 +11,26 @@
|
|
11
11
|
#
|
12
12
|
# It's strongly recommended that you check this file into your version control system.
|
13
13
|
|
14
|
-
ActiveRecord::Schema.define(version:
|
15
|
-
|
16
|
-
|
17
|
-
t.
|
18
|
-
t.
|
19
|
-
t.string
|
20
|
-
t.string
|
21
|
-
t.
|
22
|
-
t.datetime
|
14
|
+
ActiveRecord::Schema.define(version: 20120510134500) do
|
15
|
+
|
16
|
+
create_table "contacts", force: :cascade do |t|
|
17
|
+
t.integer "person_id"
|
18
|
+
t.text "address"
|
19
|
+
t.string "phone"
|
20
|
+
t.string "fax"
|
21
|
+
t.string "country"
|
22
|
+
t.datetime "created_at", null: false
|
23
|
+
t.datetime "updated_at", null: false
|
23
24
|
end
|
24
25
|
|
25
|
-
create_table
|
26
|
-
t.string
|
27
|
-
t.date
|
28
|
-
t.decimal
|
29
|
-
t.decimal
|
30
|
-
t.string
|
31
|
-
t.datetime
|
32
|
-
t.datetime
|
26
|
+
create_table "people", force: :cascade do |t|
|
27
|
+
t.string "name"
|
28
|
+
t.date "born_on"
|
29
|
+
t.decimal "height"
|
30
|
+
t.decimal "balance_amount"
|
31
|
+
t.string "currency"
|
32
|
+
t.datetime "created_at", null: false
|
33
|
+
t.datetime "updated_at", null: false
|
33
34
|
end
|
35
|
+
|
34
36
|
end
|
data/test/dummy/db/seeds.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_list
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.9.
|
4
|
+
version: 6.9.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brice Texier
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-06-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -228,7 +228,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
228
228
|
version: '0'
|
229
229
|
requirements: []
|
230
230
|
rubyforge_project:
|
231
|
-
rubygems_version: 2.
|
231
|
+
rubygems_version: 2.5.2
|
232
232
|
signing_key:
|
233
233
|
specification_version: 4
|
234
234
|
summary: Simple interactive tables for Rails app
|