rails_admin_ui_index_cards 1.1.10 → 1.1.12

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '009c10844a8c5f969ff4f4527c5653c104bcb68b3edaefa5970cf4257b16ba52'
4
- data.tar.gz: 5709608d3b276474997ed91778ada07269852789523eeaa49b4d031ee4e6c808
3
+ metadata.gz: 0dc238d4841e3a628079ca483bd77a16275506b1337e1db519f8bcd053b4bfe9
4
+ data.tar.gz: 330729b57fe29dcfe0e1e5837a7b5aca9e7f9524c24af6318b5602de52a8aad3
5
5
  SHA512:
6
- metadata.gz: 03a03c6242a8bce4cc6fe007831427da909caa721480e8c6064ed142da370638bb3ebcb4f1a0b1696a54062953e86f1c1eb794c65b348c0cd326991201eeab02
7
- data.tar.gz: 572ce6a77a16450add400001b097a886336c6c719b26be07b5325b251ede8dcc58b880a48327695b03fd36ad5b5e1e5d47b86211bbb2d06f7de16f7251739918
6
+ metadata.gz: 3b9fa6edde558d32579b62df44b536e12aa75a9777f564ee2b80e26b754c03f5c467eefaa64920f0afb78b58e7ede3b3c03aeae93218741acf21eff9e7eefd50
7
+ data.tar.gz: 174b55550f98eb0c89543e13206e1ac79827871c1581eb937a7019bb5d8010e0328c5b613d750428a6d406664c133066202448ef8e75af7a6c417f5ecb9f4e7f
@@ -3,7 +3,7 @@
3
3
  %ul.inline.list-inline.pull-right
4
4
  = menu_for :member, @abstract_model, object, true
5
5
  %h4.panel-title
6
- = check_box_tag "bulk_ids[]", object.id, false
6
+ = check_box_tag "bulk_ids[]", object.id, false, id: "bulk_ids_#{object.id}"
7
7
  %a{:"data-toggle" => "collapse", href: "#object-id-#{object.id}"}
8
8
  = (object.resume rescue false || object.display_name rescue false || object.title rescue false || object.name rescue false || object.code rescue false)
9
9
  %div{id: "object-id-#{object.id}", class: "panel-collapse collapse"}
@@ -10,79 +10,62 @@
10
10
  export_action = nil unless export_action && authorized?(export_action.authorization_key, @abstract_model)
11
11
  description = RailsAdmin.config(@abstract_model.model_name).description
12
12
  properties = @model_config.list.with(controller: self.controller, view: self, object: @abstract_model.model.new).visible_fields
13
+ checkboxes = @model_config.list.checkboxes?
14
+ # columns paginate
15
+ unless (frozen_columns = @model_config.list.sidescroll_frozen_columns)
16
+ sets = get_column_sets(properties)
17
+ properties = sets[params[:set].to_i] || []
18
+ other_left = ((params[:set].to_i - 1) >= 0) && sets[params[:set].to_i - 1].present?
19
+ other_right = sets[params[:set].to_i + 1].present?
20
+ end
13
21
 
14
22
  - content_for :contextual_tabs do
15
- = bulk_menu
23
+ - if checkboxes
24
+ = bulk_menu
25
+ - if filterable_fields.present?
26
+ %li.dropdown{style: 'float:right'}
27
+ %a.dropdown-toggle{href: '#', :'data-toggle' => "dropdown"}
28
+ = t('admin.misc.add_filter')
29
+ %b.caret
30
+ %ul.dropdown-menu#filters{style: 'left:auto; right:0;'}
31
+ - filterable_fields.each do |field|
32
+ - field_options = case field.type
33
+ - when :enum
34
+ - options_for_select(field.with(object: @abstract_model.model.new).enum)
35
+ - else
36
+ - ''
37
+ %li
38
+ %a{href: '#', :"data-field-label" => field.label, :"data-field-name" => field.name, :"data-field-options" => field_options.html_safe, :"data-field-type" => field.type, :"data-field-value" => "", :"data-field-datetimepicker-format" => (field.try(:parser) && field.parser.to_momentjs)}= capitalize_first_letter(field.label)
16
39
 
17
40
  %style
18
41
  - properties.select{ |p| p.column_width.present? }.each do |property|
19
42
  = "#list th.#{property.css_class} { width: #{property.column_width}px; min-width: #{property.column_width}px; }"
20
43
  = "#list td.#{property.css_class} { max-width: #{property.column_width}px; }"
21
- #list
22
- .well.well-sm
23
- - if filterable_fields.present? || !@model_config.list.scopes.empty?
24
- .dropdown.pull-right{style: "margin-left:0.5em"}
25
- %button.btn.btn-primary.dropdown-toggle#dropdownFilters{type: "button", :"data-toggle" => "dropdown", :"aria-haspopup" => "true", :"aria-expanded" => "true"}
26
- = t('admin.misc.add_filter')
27
- %b.caret
28
- %ul.dropdown-menu#filters{:"aria-labelledby" => "dropdownFilters"}
29
- - if filterable_fields.present?
30
- - filterable_fields.each do |field|
31
- - field_options = case field.type
32
- - when :enum
33
- - options_for_select(field.with(object: @abstract_model.model.new).enum)
34
- - else
35
- - ''
36
- %li
37
- %a{href: '#', :"data-field-label" => field.label, :"data-field-name" => field.name, :"data-field-options" => field_options.html_safe, :"data-field-type" => field.type, :"data-field-value" => "", :"data-field-datetimepicker-format" => (field.try(:parser) && field.parser.to_momentjs)}= capitalize_first_letter(field.label)
38
- - if !@model_config.list.scopes.empty?
39
- %li
40
- %a{href: '#'}= "--"
41
- - @model_config.list.scopes.each_with_index do |scope, index|
42
- - scope = '_all' if scope.nil?
43
- %li{class: "#{'active' if scope.to_s == params[:scope] || (params[:scope].blank? && index == 0)}"}
44
- %a{href: index_path(params.merge(scope: scope, page: nil)), class: 'pjax'}= I18n.t("admin.scopes.#{@abstract_model.to_param}.#{scope}", default: I18n.t("admin.scopes.#{scope}", default: scope.to_s.titleize))
45
-
46
- .dropdown.pull-right{style: "margin-left:0.5em"}
47
- %button.btn.btn-primary.dropdown-toggle#dropdownOrder{type: "button", :"data-toggle" => "dropdown", :"aria-haspopup" => "true", :"aria-expanded" => "true"}
48
- = t('admin.misc.order_by')
49
- %b.caret
50
- %ul.dropdown-menu{:"aria-labelledby" => "dropdownOrder"}
51
- - properties.each do |property|
52
- - selected = (sort == property.name.to_s)
53
- - if property.sortable
54
- - sort_location = index_path params.except('sort_reverse').except('page').merge(sort: property.name).merge(selected && sort_reverse != "true" ? {sort_reverse: "true"} : {})
55
- - sort_direction = (sort_reverse == 'true' ? "sort-alpha-asc" : "sort-alpha-desc" if selected)
56
- %li
57
- %a{href:"#", class: "#{property.sortable && "header pjax" || nil} #{sort_direction if property.sortable && sort_direction} #{property.css_class} #{property.type_css_class}", :'data-href' => (property.sortable && sort_location), rel: "tooltip", title: "#{property.hint}"}
58
- %span{class: "fa fa-#{sort_direction}"}
59
- = capitalize_first_letter(property.label)
60
44
 
61
- -# -# Export filtered
62
- -# - if export_action
63
- -# .pull-right{style: "margin-left:0.5em"}
64
- -# %a.btn.btn-primary{href: export_path(params.except('set').except('page'))}
65
- -# = t("admin.export.found")
66
-
67
- -unless @objects.blank?
68
- .pull-right{style: "margin-left:0.5em"}
69
- %a.btn.btn-primary#select-all
70
- = t("admin.select.toggle")
71
-
72
- = form_tag(index_path(params.except(*%w[page f query])), method: :get, class: "pjax-form form-inline") do
45
+ #list
46
+ = form_tag(index_path(params.except(*%w[page f query])), method: :get, class: "pjax-form form-inline") do
47
+ .well
48
+ %span#filters_box{data: {options: ordered_filter_options.to_json}}
49
+ %hr.filters_box{style: "display:#{ordered_filters.empty? ? 'none' : 'block'}"}
73
50
  .input-group
74
51
  %input.form-control.input-small{name: "query", type: "search", value: query, placeholder: t("admin.misc.filter")}
75
52
  %span.input-group-btn
76
53
  %button.btn.btn-primary{type: 'submit', :'data-disable-with' => '<i class="icon-white icon-refresh"></i> '.html_safe + t('admin.misc.refresh')}
77
54
  %i.icon-white.icon-refresh
55
+ = t('admin.misc.refresh')
78
56
  %button#remove_filter.btn.btn-info{title: "Reset filters"}
79
57
  %i.icon-white.icon-remove
80
- %a.btn.btn-primary{href: export_path(params.except('set').except('page')), style: "margin-left:0.5em"}
81
- %i.icon-white.icon-share
82
- %hr.filters_box{style: "display:#{ordered_filters.empty? ? 'none' : 'block'}"}
83
- %span#filters_box
58
+ - if export_action
59
+ %span{style: 'float:right'}= link_to wording_for(:link, export_action), export_path(params.except('set').except('page')), class: 'btn btn-info'
84
60
 
85
- = form_tag bulk_action_path(model_name: @abstract_model.to_param), method: :post, id: "bulk_form", class: "form" do
61
+ - unless @model_config.list.scopes.empty?
62
+ %ul.nav.nav-tabs#scope_selector
63
+ - @model_config.list.scopes.each_with_index do |scope, index|
64
+ - scope = '_all' if scope.nil?
65
+ %li{class: "#{'active' if scope.to_s == params[:scope] || (params[:scope].blank? && index == 0)}"}
66
+ %a{href: index_path(params.merge(scope: scope, page: nil)), class: 'pjax'}= I18n.t("admin.scopes.#{@abstract_model.to_param}.#{scope}", default: I18n.t("admin.scopes.#{scope}", default: scope.to_s.titleize))
67
+
68
+ = form_tag bulk_action_path(model_name: @abstract_model.to_param), method: :post, id: "bulk_form", class: ["form", frozen_columns ? 'ra-sidescroll' : nil], data: (frozen_columns ? {ra_sidescroll: frozen_columns} : {}) do
86
69
  = hidden_field_tag :bulk_action
87
70
  - if description.present?
88
71
  %p
@@ -91,21 +74,17 @@
91
74
  - @objects.each do |object|
92
75
  = render partial: "card", locals: {object: object, properties: properties, sort: sort, sort_reverse: sort_reverse}
93
76
 
94
- - if @objects.respond_to?(:total_count)
77
+ - if @model_config.list.limited_pagination
78
+ .row
79
+ .col-md-6= paginate(@objects, theme: 'ra-twitter-bootstrap/without_count', total_pages: Float::INFINITY, remote: true)
80
+
81
+ - elsif @objects.respond_to?(:total_count)
95
82
  - total_count = @objects.total_count.to_i
96
83
  .row
97
84
  .col-md-6= paginate(@objects, theme: 'ra-twitter-bootstrap', remote: true)
98
85
  .row
99
86
  .col-md-6= link_to(t("admin.misc.show_all"), index_path(params.merge(all: true)), class: "show-all btn btn-default clearfix pjax") unless total_count > 100 || total_count <= @objects.to_a.size
100
87
  .clearfix.total-count= "#{total_count} #{@model_config.pluralize(total_count).downcase}"
88
+
101
89
  - else
102
90
  .clearfix.total-count= "#{@objects.size} #{@model_config.pluralize(@objects.size).downcase}"
103
-
104
- :javascript
105
- jQuery(function($) {
106
- #{ordered_filter_string}
107
- });
108
- $("#select-all").click(_ => $("input[name='bulk_ids[]']").each((index, chkBox) => {
109
- console.log(chkBox);
110
- $(chkBox).prop('checked', !$(chkBox).is(':checked'));
111
- }));
@@ -1,3 +1,3 @@
1
1
  module RailsAdminUiIndexCards
2
- VERSION = '1.1.10'.freeze
2
+ VERSION = '1.1.12'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_admin_ui_index_cards
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.10
4
+ version: 1.1.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gabriele Tassoni
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-09-25 00:00:00.000000000 Z
11
+ date: 2020-01-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thecore