zuora_connect_ui 0.1.1 → 0.1.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9cbdac12e3385ab223a184c84a6b5f63f8acda5b
4
- data.tar.gz: 82b60505afb4eb343f3287155515d9f2cfe72b1f
3
+ metadata.gz: 3e91757c7d997a8d72f0589ca060480cf8cf7eb2
4
+ data.tar.gz: 792fd53612e44d1d6b001bfde0cadd2d6ff13a5e
5
5
  SHA512:
6
- metadata.gz: ed1ec0fc12c2b908f1055d1d0b0e39e8b57768d23e26d1c3c6323c0a3171d8baafeeca95cf931a5dbf0ec82d2cd7af69b058b03957e9207eefb9465abea5a3a4
7
- data.tar.gz: 5436ef384942baa8ca6b13185bf8513f9a11cae8404016f280ea8ed5974154569aea4c1c8512eb39f3759265c281fc27a900205a083840bee8ebe861068321e0
6
+ metadata.gz: caf970f2b54d47a556382c7efa2c979bf8f5b0908fb16224b2cd2b195998a342ece2c955b54628a22f41d7c4de972987335381d0e2746c02d6c4ff9f6d2debf9
7
+ data.tar.gz: 09a453c62a32fe43a76fed40635c7711c476a643d4874b63fc4cd43c462b7ac35bc7117620e9ecd43564b7a1e9e63738ba4ecaf1a79fd612d34d6d4a516cc68b
@@ -0,0 +1,4 @@
1
+ // Datatables in tabs that aren't initially shown need columns resized on show
2
+ $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
3
+ $(this.getAttribute("href")).find('table.dataTable').each(function() { $(this).dataTable().fnAdjustColumnSizing() });
4
+ });
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Helper methods for rendering JQuery Datatables
4
+ module DatatableHelper
5
+ def default_datatable_columns(object)
6
+ datatable_columns(object, ['actions'] + object.column_names)
7
+ end
8
+
9
+ def datatable_columns(object, cols)
10
+ obj_name = object.to_s.underscore.pluralize
11
+ cols.map do |col|
12
+ if col == 'actions'
13
+ { title: '', data: "#{obj_name.tr('/', '_')}__actions",
14
+ class: 'actions center', bSortable: false }
15
+ else
16
+ { title: col.split('_').collect(&:capitalize).join(' ').to_s,
17
+ data: "#{obj_name}__#{col}", visible: true }
18
+ end
19
+ end
20
+ end
21
+
22
+ def render_datatable(object, table_url, columns: nil, table_name: nil, aoData: [], initial_size: 25, table_views: { table: true, grid: false }, table_filters: {}, table_actions: nil, sort: [[0, 'asc']])
23
+ if table_name.nil?
24
+ table_name = object.to_s.pluralize.underscore.tr('/', '_')
25
+ end
26
+ columns = default_datatable_columns(object) if columns.nil?
27
+ render(
28
+ partial: 'partials/table', locals: {
29
+ table_name: table_name, aoData: aoData, columns: columns, sort: sort,
30
+ table_filters: table_filters, table_views: table_views,
31
+ initial_size: initial_size, table_actions: table_actions,
32
+ table_url: table_url
33
+ }.merge(request.query_parameters), formats: [:html]
34
+ )
35
+ end
36
+ end
@@ -98,7 +98,7 @@
98
98
  });
99
99
 
100
100
  var <%= table_name %> = $('#<%= "#{table_name}_content" %>').find('table.datatable').dataTable({
101
- "sDom": "<'datatable-scroll-wrapper't><'row'<'grid_view col-lg-12'>><'table_footer'i<'<%="\##{table_name}_select_container" %>.select_container'>p>",
101
+ "sDom": "t<'row'<'grid_view col-lg-12'>><'table_footer'i<'<%="\##{table_name}_select_container" %>.select_container'>p>",
102
102
  "pagingType": "full_numbers",
103
103
  "language" : {
104
104
  "paginate" : {
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ZuoraConnectUi
2
- VERSION = '0.1.1'.freeze
4
+ VERSION = '0.1.2'
3
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zuora_connect_ui
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Connect Team
@@ -132,6 +132,7 @@ files:
132
132
  - LICENSE.txt
133
133
  - README.md
134
134
  - app/assets/javascripts/zuora_connect_ui.js
135
+ - app/assets/javascripts/zuora_connect_ui/datatable.js
135
136
  - app/assets/javascripts/zuora_connect_ui/input.js
136
137
  - app/assets/stylesheets/_zuora_connect_ui.scss
137
138
  - app/assets/stylesheets/zuora_connect_ui/base.scss
@@ -143,6 +144,7 @@ files:
143
144
  - app/assets/stylesheets/zuora_connect_ui/input.scss
144
145
  - app/assets/stylesheets/zuora_connect_ui/modal.scss
145
146
  - app/assets/stylesheets/zuora_connect_ui/tabs.scss
147
+ - app/helpers/datatable_helper.rb
146
148
  - app/helpers/input_helper.rb
147
149
  - app/views/partials/_admin_menu.html.erb
148
150
  - app/views/partials/_filters.html.erb