wallaby 5.1.7 → 5.1.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/wallaby/setup.js.erb +1 -1
  3. data/app/views/wallaby/resources/_index_filters.html.erb +1 -4
  4. data/app/views/wallaby/resources/_index_pagination.html.erb +1 -4
  5. data/app/views/wallaby/resources/_index_query.html.erb +2 -8
  6. data/app/views/wallaby/resources/index.csv.erb +5 -16
  7. data/app/views/wallaby/resources/index/_belongs_to.csv.erb +5 -0
  8. data/app/views/wallaby/resources/index/_bigint.csv.erb +5 -0
  9. data/app/views/wallaby/resources/index/_bigserial.csv.erb +5 -0
  10. data/app/views/wallaby/resources/index/_binary.csv.erb +5 -0
  11. data/app/views/wallaby/resources/index/_bit.csv.erb +5 -0
  12. data/app/views/wallaby/resources/index/_bit_varying.csv.erb +5 -0
  13. data/app/views/wallaby/resources/index/_blob.csv.erb +5 -0
  14. data/app/views/wallaby/resources/index/_boolean.csv.erb +5 -0
  15. data/app/views/wallaby/resources/index/_box.csv.erb +5 -0
  16. data/app/views/wallaby/resources/index/_cidr.csv.erb +5 -0
  17. data/app/views/wallaby/resources/index/_circle.csv.erb +5 -0
  18. data/app/views/wallaby/resources/index/_citext.csv.erb +5 -0
  19. data/app/views/wallaby/resources/index/_color.csv.erb +5 -0
  20. data/app/views/wallaby/resources/index/_date.csv.erb +8 -0
  21. data/app/views/wallaby/resources/index/_daterange.csv.erb +6 -0
  22. data/app/views/wallaby/resources/index/_datetime.csv.erb +7 -0
  23. data/app/views/wallaby/resources/index/_decimal.csv.erb +5 -0
  24. data/app/views/wallaby/resources/index/_email.csv.erb +5 -0
  25. data/app/views/wallaby/resources/index/_float.csv.erb +5 -0
  26. data/app/views/wallaby/resources/index/_has_and_belongs_to_many.csv.erb +5 -0
  27. data/app/views/wallaby/resources/index/_has_many.csv.erb +5 -0
  28. data/app/views/wallaby/resources/index/_has_one.csv.erb +5 -0
  29. data/app/views/wallaby/resources/index/_hstore.csv.erb +5 -0
  30. data/app/views/wallaby/resources/index/_inet.csv.erb +5 -0
  31. data/app/views/wallaby/resources/index/_int4range.csv.erb +5 -0
  32. data/app/views/wallaby/resources/index/_int8range.csv.erb +5 -0
  33. data/app/views/wallaby/resources/index/_integer.csv.erb +5 -0
  34. data/app/views/wallaby/resources/index/_json.csv.erb +5 -0
  35. data/app/views/wallaby/resources/index/_jsonb.csv.erb +5 -0
  36. data/app/views/wallaby/resources/index/_line.csv.erb +5 -0
  37. data/app/views/wallaby/resources/index/_longblob.csv.erb +5 -0
  38. data/app/views/wallaby/resources/index/_longtext.csv.erb +5 -0
  39. data/app/views/wallaby/resources/index/_lseg.csv.erb +5 -0
  40. data/app/views/wallaby/resources/index/_ltree.csv.erb +5 -0
  41. data/app/views/wallaby/resources/index/_macaddr.csv.erb +5 -0
  42. data/app/views/wallaby/resources/index/_mediumblob.csv.erb +5 -0
  43. data/app/views/wallaby/resources/index/_mediumtext.csv.erb +5 -0
  44. data/app/views/wallaby/resources/index/_money.csv.erb +5 -0
  45. data/app/views/wallaby/resources/index/_numrange.csv.erb +5 -0
  46. data/app/views/wallaby/resources/index/_password.csv.erb +5 -0
  47. data/app/views/wallaby/resources/index/_path.csv.erb +5 -0
  48. data/app/views/wallaby/resources/index/_point.csv.erb +6 -0
  49. data/app/views/wallaby/resources/index/_polygon.csv.erb +5 -0
  50. data/app/views/wallaby/resources/index/_raw.csv.erb +5 -0
  51. data/app/views/wallaby/resources/index/_serial.csv.erb +5 -0
  52. data/app/views/wallaby/resources/index/_sti.csv.erb +5 -0
  53. data/app/views/wallaby/resources/index/_string.csv.erb +5 -0
  54. data/app/views/wallaby/resources/index/_text.csv.erb +5 -0
  55. data/app/views/wallaby/resources/index/_time.csv.erb +7 -0
  56. data/app/views/wallaby/resources/index/_time.html.erb +1 -1
  57. data/app/views/wallaby/resources/index/_tinyblob.csv.erb +5 -0
  58. data/app/views/wallaby/resources/index/_tinytext.csv.erb +5 -0
  59. data/app/views/wallaby/resources/index/_tsrange.csv.erb +6 -0
  60. data/app/views/wallaby/resources/index/_tstzrange.csv.erb +6 -0
  61. data/app/views/wallaby/resources/index/_tsvector.csv.erb +5 -0
  62. data/app/views/wallaby/resources/index/_unsigned_bigint.csv.erb +5 -0
  63. data/app/views/wallaby/resources/index/_unsigned_decimal.csv.erb +5 -0
  64. data/app/views/wallaby/resources/index/_unsigned_float.csv.erb +5 -0
  65. data/app/views/wallaby/resources/index/_unsigned_integer.csv.erb +5 -0
  66. data/app/views/wallaby/resources/index/_uuid.csv.erb +5 -0
  67. data/app/views/wallaby/resources/index/_xml.csv.erb +5 -0
  68. data/app/views/wallaby/resources/show/_time.html.erb +1 -1
  69. data/lib/helpers/wallaby/index_helper.rb +10 -6
  70. data/lib/servicers/wallaby/abstract_model_servicer.rb +1 -1
  71. data/lib/wallaby/version.rb +1 -1
  72. metadata +62 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 04e4d77dd4f0c389084731a11677f20d1642110c
4
- data.tar.gz: 73de158010b2874fcfe05aaf97124a5d74242c05
3
+ metadata.gz: 318bd15ba641b3b9df0b8c846f77c1d83b63780d
4
+ data.tar.gz: ae1f37f527a3f64543ee1b035922de1754f448f5
5
5
  SHA512:
6
- metadata.gz: 1466a5835767aa9c31ade8afa89fd04d5a28e78550f95ca70d086344adc756a6df54c362cc5f90da04ca05728b56f13d62251344f68c924eae01f3f48d8f8195
7
- data.tar.gz: ed032ac4752e3c61567126a501b9b012be88c8e77aa3d0deffb76e4760ca352d7ce97fa15ddc5c74d11a69b71aef8640cf63c6177ad37ffaf1333f51ad8dc65d
6
+ metadata.gz: 36fcec2d778497d8d1baa282db7377c888419c44187c1b292d324af585f8bd9343a852d6dae3f0742237065387d4fc87cc631f1fcef60072132b2d32300ed0e3
7
+ data.tar.gz: 43b79d5bd13336a0b4034cab3161503e527156fb0e95c1990efb1f9edd1fbc1cacb82701084ce115ee94e4516e3b8af1b47340089fd0fb0c63f577e1843d15c1
@@ -5,7 +5,7 @@ window.readyPrefix = function readyPrefix(eventName) {
5
5
  jQuery(document).off(readyPrefix('.wallaby')).on(readyPrefix('.wallaby'), function () {
6
6
  'use strict';
7
7
 
8
- jQuery('[data-toggle="tooltip"]').tooltip({ html: true, container:'body' })
8
+ jQuery('[data-toggle="tooltip"]').tooltip({ container:'body' })
9
9
  jQuery('#imodal').on('show.bs.modal', function (event) {
10
10
  var $button = jQuery(event.relatedTarget),
11
11
  $this = jQuery(this);
@@ -1,9 +1,6 @@
1
1
  <%
2
2
  filters = current_model_decorator.filters
3
3
  filter = ::Wallaby::Utils.find_filter_name index_params[:filter], filters
4
- html_options = proc do |filter_name|
5
- { class: filter.to_s == filter_name.to_s ? 'filters--current' : '' }
6
- end
7
4
  %>
8
5
  <nav class="filters">
9
6
  <% if filters.present? %>
@@ -14,7 +11,7 @@ end
14
11
  <ul>
15
12
  <li><em><%= t 'filters.title' %></em></li>
16
13
  <% filters.keys.unshift(:all).each do |filter_name| %>
17
- <%= content_tag :li, filter_link(current_model_class, filter_name, filters), html_options.call(filter_name) %>
14
+ <%= content_tag :li, filter_link(current_model_class, filter_name, filters: filters), { class: filter.to_s == filter_name.to_s && 'filters--current' } %>
18
15
  <% end %>
19
16
  </ul>
20
17
  <% else %>
@@ -3,9 +3,6 @@ paginator = paginate(current_model_class, collection, index_params)
3
3
  %>
4
4
  <% if paginator.paginatable? %>
5
5
  <%
6
- active_per = proc do |per|
7
- paginator.page_size == per && 'pagination__pers--current'
8
- end
9
6
  from_to = t 'pagination.from_to', from: paginator.from, to: paginator.to
10
7
  of = t 'pagination.of'
11
8
  total_count = t 'pagination.total_count', total: paginator.total
@@ -23,7 +20,7 @@ paginator = paginate(current_model_class, collection, index_params)
23
20
  <ul aria-labelledby="all_pers">
24
21
  <li><em><%= t 'pagination.pers' %></em></li>
25
22
  <% Wallaby::PERS.each do |per| %>
26
- <%= content_tag :li, class: active_per.call(per) do %>
23
+ <%= content_tag :li, class: paginator.page_size == per && 'pagination__pers--current' do %>
27
24
  <%= index_link(current_model_class, url_params: index_params.merge(per: per)) { per.to_s } %>
28
25
  <% end %>
29
26
  <% end %>
@@ -1,11 +1,4 @@
1
- <%
2
- query_classes = proc do
3
- classes = %w(query)
4
- classes.push 'query--filtered' if index_params.present?
5
- classes
6
- end
7
- %>
8
- <%= content_tag :div, class: query_classes.call do %>
1
+ <%= content_tag :div, class: index_params.present? ? %w(query query--filtered) : %w(query) do %>
9
2
  <nav class="query__actions">
10
3
  <%= index_link(current_model_class, html_classes('query__clear')) {} if index_params.present? %>
11
4
  <%= new_link(current_model_class, html_classes('query__create')) {} %>
@@ -16,6 +9,7 @@ end
16
9
  </nav>
17
10
  <%= form_tag index_path(current_model_class), method: :get, class: 'query__search' do %>
18
11
  <%= hidden_field_tag :sort, index_params[:sort] %>
12
+ <%= hidden_field_tag :filter, index_params[:filter] %>
19
13
  <label for="q">
20
14
  <%= text_field_tag :q, index_params[:q], placeholder: t('search.hint') %>
21
15
  </label>
@@ -1,26 +1,15 @@
1
1
  <%
2
2
  headers = current_model_decorator.index_field_names.map do |field_name|
3
- current_model_decorator.index_metadata_of(field_name)[:label]
3
+ current_model_decorator.index_label_of(field_name)
4
4
  end
5
5
  decorated_collection = decorate collection
6
6
  %>
7
7
  <%= ::CSV.generate_line(headers).strip.html_safe %>
8
8
  <%
9
- decorated_collection.each do |decorated|
10
- data = current_model_decorator.index_field_names.map do |field_name|
11
- value = decorated.public_send(field_name)
12
- if value.respond_to?(:map) && !value.is_a?(Range)
13
- value.map do |v|
14
- if model_decorator(v.class).present?
15
- decorate(v).to_label
16
- else
17
- v
18
- end
19
- end.to_sentence
20
- else
21
- value
22
- end
23
- end
9
+ decorated_collection.each do |decorated|
10
+ data = current_model_decorator.index_field_names.map do |field_name|
11
+ type_partial_render decorated.index_type_of(field_name), object: decorated, field_name: field_name
12
+ end
24
13
  %>
25
14
  <%= ::CSV.generate_line(data).strip.html_safe %>
26
15
  <% end %>
@@ -0,0 +1,5 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
5
+ <%= raw value.present? && decorate(value).to_label || nil %>
@@ -0,0 +1,5 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
5
+ <%= raw value %>
@@ -0,0 +1,5 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
5
+ <%= raw value %>
@@ -0,0 +1,5 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
5
+ <%= raw value.present? && '<binary>' || nil %>
@@ -0,0 +1,5 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
5
+ <%= raw value %>
@@ -0,0 +1,5 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
5
+ <%= raw value %>
@@ -0,0 +1,5 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
5
+ <%= raw value.present? && '<blob>' || nil %>
@@ -0,0 +1,5 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
5
+ <%= raw value %>
@@ -0,0 +1,5 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
5
+ <%= raw value %>
@@ -0,0 +1,5 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
5
+ <%= raw value %>
@@ -0,0 +1,5 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
5
+ <%= raw value %>
@@ -0,0 +1,5 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
5
+ <%= raw value %>
@@ -0,0 +1,5 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
5
+ <%= raw value %>
@@ -0,0 +1,8 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
5
+ <% if value.present? %>
6
+ <% value = Time.zone.parse value if value.is_a? String %>
7
+ <% value = value.to_date if value.is_a? Time %>
8
+ <%= I18n.l value %><% end %>
@@ -0,0 +1,6 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
5
+ <% if value.present? %>
6
+ <%= I18n.l value.first %>...<%= I18n.l value.last %><% end %>
@@ -0,0 +1,7 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
5
+ <% if value.present? %>
6
+ <% value = Time.zone.parse value if value.is_a? String %>
7
+ <%= I18n.l value %><% end %>
@@ -0,0 +1,5 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
5
+ <%= raw value %>
@@ -0,0 +1,5 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
5
+ <%= raw value %>
@@ -0,0 +1,5 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
5
+ <%= raw value.try(:to_f) %>
@@ -0,0 +1,5 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
5
+ <%= raw((value || []).uniq.map { |item| decorate(item).to_label }.to_sentence) %>
@@ -0,0 +1,5 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
5
+ <%= raw((value || []).uniq.map { |item| decorate(item).to_label }.to_sentence) %>
@@ -0,0 +1,5 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
5
+ <%= raw value.present? && decorate(value).to_label || nil %>
@@ -0,0 +1,5 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
5
+ <%= raw value %>
@@ -0,0 +1,5 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
5
+ <%= raw value %>
@@ -0,0 +1,5 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
5
+ <%= raw value %>
@@ -0,0 +1,5 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
5
+ <%= raw value %>
@@ -0,0 +1,5 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
5
+ <%= raw value.try(:to_i) %>
@@ -0,0 +1,5 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
5
+ <%= raw value %>
@@ -0,0 +1,5 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
5
+ <%= raw value %>
@@ -0,0 +1,5 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
5
+ <%= raw value %>
@@ -0,0 +1,5 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
5
+ <%= raw value.present? && '<longblob>' || nil %>
@@ -0,0 +1,5 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
5
+ <%= raw value %>
@@ -0,0 +1,5 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
5
+ <%= raw value %>
@@ -0,0 +1,5 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
5
+ <%= raw value %>
@@ -0,0 +1,5 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
5
+ <%= raw value %>
@@ -0,0 +1,5 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
5
+ <%= raw value.present? && '<mediumblob>' || nil %>
@@ -0,0 +1,5 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
5
+ <%= raw value %>
@@ -0,0 +1,5 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
5
+ <%= raw value %>
@@ -0,0 +1,5 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
5
+ <%= raw value %>
@@ -0,0 +1,5 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
5
+ ********
@@ -0,0 +1,5 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
5
+ <%= raw value %>
@@ -0,0 +1,6 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
5
+ <% if value.present? %>
6
+ (<%= raw value[0] %>, <%= raw value[1] %>)<% end %>
@@ -0,0 +1,5 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
5
+ <%= raw value %>
@@ -0,0 +1,5 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
5
+ <%= raw value %>
@@ -0,0 +1,5 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
5
+ <%= raw value %>
@@ -0,0 +1,5 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
5
+ <%= raw value %>
@@ -0,0 +1,5 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
5
+ <%= raw value %>
@@ -0,0 +1,5 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
5
+ <%= raw value %>
@@ -0,0 +1,7 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
5
+ <% if value.present? %>
6
+ <% value = Time.zone.parse value if value.is_a? String %>
7
+ <%= I18n.l value, format: '%H:%M:%S' %><% end %>
@@ -6,5 +6,5 @@
6
6
  <%= null %>
7
7
  <% else %>
8
8
  <% value = Time.zone.parse value if value.is_a? String %>
9
- <%= value.strftime '%H:%M:%S' %>
9
+ <%= I18n.l value, format: '%H:%M:%S' %>
10
10
  <% end %>
@@ -0,0 +1,5 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
5
+ <%= raw value.present? && '<tinyblob>' || nil %>
@@ -0,0 +1,5 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
5
+ <%= raw value %>
@@ -0,0 +1,6 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
5
+ <% if value.present? %>
6
+ <%= I18n.l value.first %>...<%= I18n.l value.last %><% end %>
@@ -0,0 +1,6 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
5
+ <% if value.present? %>
6
+ <%= I18n.l value.first %>...<%= I18n.l value.last %><% end %>
@@ -0,0 +1,5 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
5
+ <%= raw value %>
@@ -0,0 +1,5 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
5
+ <%= raw value %>
@@ -0,0 +1,5 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
5
+ <%= raw value %>
@@ -0,0 +1,5 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
5
+ <%= raw value.try(:to_f) %>
@@ -0,0 +1,5 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
5
+ <%= raw value.try(:to_i) %>
@@ -0,0 +1,5 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
5
+ <%= raw value %>
@@ -0,0 +1,5 @@
1
+ <%# @param object [model] model instance %>
2
+ <%# @param field_name [String] name of the field %>
3
+ <%# @param value [Object] value of the field %>
4
+ <%# @param metadata [Hash] metadata of the field %>
5
+ <%= raw value %>
@@ -6,5 +6,5 @@
6
6
  <%= null %>
7
7
  <% else %>
8
8
  <% value = Time.zone.parse value if value.is_a? String %>
9
- <%= value.strftime '%H:%M:%S' %>
9
+ <%= I18n.l value, format: '%H:%M:%S' %>
10
10
  <% end %>
@@ -26,9 +26,11 @@ module Wallaby
26
26
 
27
27
  # Export link for a given model_class
28
28
  # @param model_class [Class]
29
+ # @param url_params [Hash, ActionController::Parameters]
29
30
  # @return [String] HTML anchor link
30
- def export_link(model_class)
31
- url_params = index_params.except(:page, :per).merge(format: 'csv')
31
+ def export_link(model_class, url_params: {})
32
+ url_params =
33
+ index_params.except(:page, :per).merge(format: 'csv').merge(url_params)
32
34
  index_link model_class, url_params: url_params do
33
35
  t 'links.export', ext: 'CSV'
34
36
  end
@@ -38,14 +40,16 @@ module Wallaby
38
40
  # @param model_class [Class]
39
41
  # @param filter_name [String, Symbol]
40
42
  # @param filters [Hash]
43
+ # @param url_params [Hash, ActionController::Parameters]
41
44
  # @return [String] HTML anchor link
42
- def filter_link(model_class, filter_name, filters)
45
+ def filter_link(model_class, filter_name, filters: {}, url_params: {})
43
46
  is_all = filter_name == :all
44
47
  config = filters[filter_name] || {}
45
48
  label = is_all ? all_label : filter_label(filter_name, filters)
46
- url_params = if config[:default] then index_params.except(:filter)
47
- else index_params.merge(filter: filter_name)
48
- end
49
+ url_params =
50
+ if config[:default] then index_params.except(:filter).merge(url_params)
51
+ else index_params.merge(filter: filter_name).merge(url_params)
52
+ end
49
53
  index_link(model_class, url_params: url_params) { label }
50
54
  end
51
55
 
@@ -3,7 +3,7 @@ module Wallaby
3
3
  class AbstractModelServicer
4
4
  # @return [Class] model class that comes from its class name
5
5
  def self.model_class
6
- return unless self < ::Wallaby::ModelServicer
6
+ return unless self < ::Wallaby.configuration.mapping.model_servicer
7
7
  Map.model_class_map name.gsub('Servicer', EMPTY_STRING)
8
8
  end
9
9
 
@@ -1,3 +1,3 @@
1
1
  module Wallaby
2
- VERSION = '5.1.7'.freeze
2
+ VERSION = '5.1.8'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wallaby
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.1.7
4
+ version: 5.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tianwen Chen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-13 00:00:00.000000000 Z
11
+ date: 2018-06-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bootstrap-sass
@@ -365,65 +365,125 @@ files:
365
365
  - app/views/wallaby/resources/index.csv.erb
366
366
  - app/views/wallaby/resources/index.html.erb
367
367
  - app/views/wallaby/resources/index.json.jbuilder
368
+ - app/views/wallaby/resources/index/_belongs_to.csv.erb
368
369
  - app/views/wallaby/resources/index/_belongs_to.html.erb
370
+ - app/views/wallaby/resources/index/_bigint.csv.erb
369
371
  - app/views/wallaby/resources/index/_bigint.html.erb
372
+ - app/views/wallaby/resources/index/_bigserial.csv.erb
370
373
  - app/views/wallaby/resources/index/_bigserial.html.erb
374
+ - app/views/wallaby/resources/index/_binary.csv.erb
371
375
  - app/views/wallaby/resources/index/_binary.html.erb
376
+ - app/views/wallaby/resources/index/_bit.csv.erb
372
377
  - app/views/wallaby/resources/index/_bit.html.erb
378
+ - app/views/wallaby/resources/index/_bit_varying.csv.erb
373
379
  - app/views/wallaby/resources/index/_bit_varying.html.erb
380
+ - app/views/wallaby/resources/index/_blob.csv.erb
374
381
  - app/views/wallaby/resources/index/_blob.html.erb
382
+ - app/views/wallaby/resources/index/_boolean.csv.erb
375
383
  - app/views/wallaby/resources/index/_boolean.html.erb
384
+ - app/views/wallaby/resources/index/_box.csv.erb
376
385
  - app/views/wallaby/resources/index/_box.html.erb
386
+ - app/views/wallaby/resources/index/_cidr.csv.erb
377
387
  - app/views/wallaby/resources/index/_cidr.html.erb
388
+ - app/views/wallaby/resources/index/_circle.csv.erb
378
389
  - app/views/wallaby/resources/index/_circle.html.erb
390
+ - app/views/wallaby/resources/index/_citext.csv.erb
379
391
  - app/views/wallaby/resources/index/_citext.html.erb
392
+ - app/views/wallaby/resources/index/_color.csv.erb
380
393
  - app/views/wallaby/resources/index/_color.html.erb
394
+ - app/views/wallaby/resources/index/_date.csv.erb
381
395
  - app/views/wallaby/resources/index/_date.html.erb
396
+ - app/views/wallaby/resources/index/_daterange.csv.erb
382
397
  - app/views/wallaby/resources/index/_daterange.html.erb
398
+ - app/views/wallaby/resources/index/_datetime.csv.erb
383
399
  - app/views/wallaby/resources/index/_datetime.html.erb
400
+ - app/views/wallaby/resources/index/_decimal.csv.erb
384
401
  - app/views/wallaby/resources/index/_decimal.html.erb
402
+ - app/views/wallaby/resources/index/_email.csv.erb
385
403
  - app/views/wallaby/resources/index/_email.html.erb
404
+ - app/views/wallaby/resources/index/_float.csv.erb
386
405
  - app/views/wallaby/resources/index/_float.html.erb
406
+ - app/views/wallaby/resources/index/_has_and_belongs_to_many.csv.erb
387
407
  - app/views/wallaby/resources/index/_has_and_belongs_to_many.html.erb
408
+ - app/views/wallaby/resources/index/_has_many.csv.erb
388
409
  - app/views/wallaby/resources/index/_has_many.html.erb
410
+ - app/views/wallaby/resources/index/_has_one.csv.erb
389
411
  - app/views/wallaby/resources/index/_has_one.html.erb
412
+ - app/views/wallaby/resources/index/_hstore.csv.erb
390
413
  - app/views/wallaby/resources/index/_hstore.html.erb
414
+ - app/views/wallaby/resources/index/_inet.csv.erb
391
415
  - app/views/wallaby/resources/index/_inet.html.erb
416
+ - app/views/wallaby/resources/index/_int4range.csv.erb
392
417
  - app/views/wallaby/resources/index/_int4range.html.erb
418
+ - app/views/wallaby/resources/index/_int8range.csv.erb
393
419
  - app/views/wallaby/resources/index/_int8range.html.erb
420
+ - app/views/wallaby/resources/index/_integer.csv.erb
394
421
  - app/views/wallaby/resources/index/_integer.html.erb
422
+ - app/views/wallaby/resources/index/_json.csv.erb
395
423
  - app/views/wallaby/resources/index/_json.html.erb
424
+ - app/views/wallaby/resources/index/_jsonb.csv.erb
396
425
  - app/views/wallaby/resources/index/_jsonb.html.erb
426
+ - app/views/wallaby/resources/index/_line.csv.erb
397
427
  - app/views/wallaby/resources/index/_line.html.erb
428
+ - app/views/wallaby/resources/index/_longblob.csv.erb
398
429
  - app/views/wallaby/resources/index/_longblob.html.erb
430
+ - app/views/wallaby/resources/index/_longtext.csv.erb
399
431
  - app/views/wallaby/resources/index/_longtext.html.erb
432
+ - app/views/wallaby/resources/index/_lseg.csv.erb
400
433
  - app/views/wallaby/resources/index/_lseg.html.erb
434
+ - app/views/wallaby/resources/index/_ltree.csv.erb
401
435
  - app/views/wallaby/resources/index/_ltree.html.erb
436
+ - app/views/wallaby/resources/index/_macaddr.csv.erb
402
437
  - app/views/wallaby/resources/index/_macaddr.html.erb
438
+ - app/views/wallaby/resources/index/_mediumblob.csv.erb
403
439
  - app/views/wallaby/resources/index/_mediumblob.html.erb
440
+ - app/views/wallaby/resources/index/_mediumtext.csv.erb
404
441
  - app/views/wallaby/resources/index/_mediumtext.html.erb
442
+ - app/views/wallaby/resources/index/_money.csv.erb
405
443
  - app/views/wallaby/resources/index/_money.html.erb
444
+ - app/views/wallaby/resources/index/_numrange.csv.erb
406
445
  - app/views/wallaby/resources/index/_numrange.html.erb
446
+ - app/views/wallaby/resources/index/_password.csv.erb
407
447
  - app/views/wallaby/resources/index/_password.html.erb
448
+ - app/views/wallaby/resources/index/_path.csv.erb
408
449
  - app/views/wallaby/resources/index/_path.html.erb
450
+ - app/views/wallaby/resources/index/_point.csv.erb
409
451
  - app/views/wallaby/resources/index/_point.html.erb
452
+ - app/views/wallaby/resources/index/_polygon.csv.erb
410
453
  - app/views/wallaby/resources/index/_polygon.html.erb
454
+ - app/views/wallaby/resources/index/_raw.csv.erb
411
455
  - app/views/wallaby/resources/index/_raw.html.erb
456
+ - app/views/wallaby/resources/index/_serial.csv.erb
412
457
  - app/views/wallaby/resources/index/_serial.html.erb
458
+ - app/views/wallaby/resources/index/_sti.csv.erb
413
459
  - app/views/wallaby/resources/index/_sti.html.erb
460
+ - app/views/wallaby/resources/index/_string.csv.erb
414
461
  - app/views/wallaby/resources/index/_string.html.erb
462
+ - app/views/wallaby/resources/index/_text.csv.erb
415
463
  - app/views/wallaby/resources/index/_text.html.erb
464
+ - app/views/wallaby/resources/index/_time.csv.erb
416
465
  - app/views/wallaby/resources/index/_time.html.erb
466
+ - app/views/wallaby/resources/index/_tinyblob.csv.erb
417
467
  - app/views/wallaby/resources/index/_tinyblob.html.erb
468
+ - app/views/wallaby/resources/index/_tinytext.csv.erb
418
469
  - app/views/wallaby/resources/index/_tinytext.html.erb
470
+ - app/views/wallaby/resources/index/_tsrange.csv.erb
419
471
  - app/views/wallaby/resources/index/_tsrange.html.erb
472
+ - app/views/wallaby/resources/index/_tstzrange.csv.erb
420
473
  - app/views/wallaby/resources/index/_tstzrange.html.erb
474
+ - app/views/wallaby/resources/index/_tsvector.csv.erb
421
475
  - app/views/wallaby/resources/index/_tsvector.html.erb
476
+ - app/views/wallaby/resources/index/_unsigned_bigint.csv.erb
422
477
  - app/views/wallaby/resources/index/_unsigned_bigint.html.erb
478
+ - app/views/wallaby/resources/index/_unsigned_decimal.csv.erb
423
479
  - app/views/wallaby/resources/index/_unsigned_decimal.html.erb
480
+ - app/views/wallaby/resources/index/_unsigned_float.csv.erb
424
481
  - app/views/wallaby/resources/index/_unsigned_float.html.erb
482
+ - app/views/wallaby/resources/index/_unsigned_integer.csv.erb
425
483
  - app/views/wallaby/resources/index/_unsigned_integer.html.erb
484
+ - app/views/wallaby/resources/index/_uuid.csv.erb
426
485
  - app/views/wallaby/resources/index/_uuid.html.erb
486
+ - app/views/wallaby/resources/index/_xml.csv.erb
427
487
  - app/views/wallaby/resources/index/_xml.html.erb
428
488
  - app/views/wallaby/resources/new.html.erb
429
489
  - app/views/wallaby/resources/show.html.erb