rao-component 0.0.10.pre → 0.0.11.pre
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 +4 -4
- data/README.md +14 -0
- data/app/assets/javascripts/rao-component/acts_as_list.js.coffee +21 -0
- data/app/components/rao/component/collection_table.rb +1 -0
- data/app/concerns/rao/component/collection_table/acts_as_list_concern.rb +1 -1
- data/app/concerns/rao/component/collection_table/batch_actions_concern.rb +1 -1
- data/app/views/rao/component/_collection_table.html.haml +2 -0
- data/app/views/rao/component/table/body_cells/_acts_as_list.html.haml +1 -1
- data/app/views/rao/component/table/body_cells/_acts_as_published.html.haml +4 -2
- data/app/views/rao/component/table/body_cells/_awesome_nested_set.html.haml +1 -1
- data/app/views/rao/component/table/header_cells/_batch_actions.html.haml +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d0eb08d89fc0b01b77547fe96cfb10263bbe2ca3
|
4
|
+
data.tar.gz: 0e63adb0d9fce8033ff5416679bfeba83515e90e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 12bc5410ae3cc782669cda50bf9368d141afa5a13edba4208f71f9ac4eaa76b3cbf2eece7ae465f6511e2acc2494aaa90cbeff45923def3abe98975ea8e02559
|
7
|
+
data.tar.gz: 7aa78944d0fa51e76e1c402f10e8efa5a27de6d69be3d3bdfadd10d4300d701f80f4ca40b24b658abc28a4e5a7f686a64c700a63911665f86d44e0d18dfcf52e
|
data/README.md
CHANGED
@@ -4,6 +4,20 @@ Short description and motivation.
|
|
4
4
|
## Usage
|
5
5
|
How to use my plugin.
|
6
6
|
|
7
|
+
## Adding acts_as_list support for collection tables.
|
8
|
+
|
9
|
+
To use this feature you have to add coffee-rails, jquery-rails and jquery-ui-rails gems to your applicaiton.
|
10
|
+
|
11
|
+
If you want to have sortable items via acts_as_list and drag and drop, you have to add the javascript to your
|
12
|
+
application:
|
13
|
+
|
14
|
+
```
|
15
|
+
// app/assets/javascripts/applicaiton.js
|
16
|
+
//= require jquery
|
17
|
+
//= require jquery-ui
|
18
|
+
//= require rao-component/acts_as_list
|
19
|
+
```
|
20
|
+
|
7
21
|
## Installation
|
8
22
|
Add this line to your application's Gemfile:
|
9
23
|
|
@@ -0,0 +1,21 @@
|
|
1
|
+
$ ->
|
2
|
+
$('[data-acts-as-list-item]').each ->
|
3
|
+
$(@).draggable({
|
4
|
+
scope: $(@).attr('data-acts-as-list-item-scope'),
|
5
|
+
revert: true
|
6
|
+
})
|
7
|
+
|
8
|
+
$ ->
|
9
|
+
$('[data-acts-as-list-item]').each ->
|
10
|
+
redirect_target = $(@).attr('data-acts-as-list-item-on-drop-target')
|
11
|
+
authenticity_token = $( 'meta[name="csrf-token"]' ).attr( 'content' );
|
12
|
+
|
13
|
+
$(@).droppable({
|
14
|
+
accept: '.acts-as-list-item',
|
15
|
+
scope: $(@).attr('data-acts-as-list-item-scope'),
|
16
|
+
activeClass: 'btn-success',
|
17
|
+
drop: (event, ui) ->
|
18
|
+
dropped_element = $(ui.draggable)
|
19
|
+
dropped_element_to_param = dropped_element.attr('data-acts-as-list-item-uid')
|
20
|
+
$.redirect(redirect_target,{ authenticity_token: authenticity_token, dropped_id: dropped_element_to_param });
|
21
|
+
})
|
@@ -105,6 +105,7 @@ module Rao
|
|
105
105
|
end
|
106
106
|
|
107
107
|
def table_css_classes
|
108
|
+
return @options[:table_html] if @options.has_key?(:table_html)
|
108
109
|
classes = ['table', 'collection-table', @resource_class.name.underscore.pluralize.gsub('/', '-')]
|
109
110
|
classes << 'table-bordered' if bordered?
|
110
111
|
classes << 'table-hover' if hover?
|
@@ -42,7 +42,7 @@ module Rao
|
|
42
42
|
extend ActiveSupport::Concern
|
43
43
|
|
44
44
|
def acts_as_list_actions(options = {}, &block)
|
45
|
-
options.reverse_merge!(render_as: :acts_as_list, title:
|
45
|
+
options.reverse_merge!(render_as: :acts_as_list, title: '', scope: nil)
|
46
46
|
|
47
47
|
scope = options.delete(:scope)
|
48
48
|
scope = "#{scope}_id".intern if scope.is_a?(Symbol) && scope.to_s !~ /_id$/
|
@@ -9,7 +9,7 @@ module Rao
|
|
9
9
|
#
|
10
10
|
def batch_actions(options = {}, &block)
|
11
11
|
@wrap_in_form = true
|
12
|
-
title = @view.render partial: 'component/table/header_cells/batch_actions', locals: { options: options }
|
12
|
+
title = @view.render partial: 'rao/component/table/header_cells/batch_actions', locals: { options: options }
|
13
13
|
options.reverse_merge!(render_as: :batch_actions, title: title)
|
14
14
|
column(:batch_actions, options, &block)
|
15
15
|
end
|
@@ -7,5 +7,5 @@
|
|
7
7
|
}
|
8
8
|
data_attributes['acts-as-list-item-scope'] = "#{scope}-#{resource.send(scope)}" if scope.present?
|
9
9
|
|
10
|
-
%span.btn.btn-xs.btn-default.acts-as-list-item{ data: data_attributes }
|
10
|
+
%span.btn.btn-sm.btn-xs.btn-default.acts-as-list-item{ data: data_attributes }
|
11
11
|
%span.glyphicon.glyphicon-sort.fas.fa-sort
|
@@ -1,9 +1,11 @@
|
|
1
1
|
- link_path = controller.url_for(action: :toggle_published, id: resource.to_param)
|
2
2
|
- if resource.published?
|
3
|
-
= button_to(link_path, class: 'btn btn-xs btn-danger btn-responsive', method: :post) do
|
3
|
+
= button_to(link_path, class: 'btn btn-sm btn-xs btn-danger btn-responsive', method: :post) do
|
4
|
+
%i.fas.fa-eye-slash
|
4
5
|
%span.glyphicon.glyphicon-eye-close
|
5
6
|
%span.btn-text= t('.unpublish', default: t('acts_as_published.actions.unpublish'))
|
6
7
|
- else
|
7
|
-
= button_to(link_path, class: 'btn btn-xs btn-success btn-responsive', method: :post) do
|
8
|
+
= button_to(link_path, class: 'btn btn-sm btn-xs btn-success btn-responsive', method: :post) do
|
9
|
+
%i.fas.fa-eye
|
8
10
|
%span.glyphicon.glyphicon-eye-open
|
9
11
|
%span.btn-text= t('.publish', default: t('acts_as_published.actions.publish'))
|
@@ -5,5 +5,5 @@
|
|
5
5
|
'awesome-nested-set-item-on-drop-target': url_for([:reposition, resource])
|
6
6
|
}
|
7
7
|
data_attributes['awesome-nested-set-item-scope'] = scope.call(model) if options[:scope].present?
|
8
|
-
%span.btn.btn-xs.btn-default.awesome-nested-set-item{ data: data_attributes }
|
8
|
+
%span.btn.btn-sm.btn-xs.btn-default.awesome-nested-set-item{ data: data_attributes }
|
9
9
|
%span.glyphicon.glyphicon-sort
|
@@ -17,7 +17,7 @@
|
|
17
17
|
:javascript
|
18
18
|
$(document).ready(function() {
|
19
19
|
$('.batch-action-checkbox').click(function() {
|
20
|
-
var check_count = $('.batch-action-checkbox:checked').
|
20
|
+
var check_count = $('.batch-action-checkbox:checked').length;
|
21
21
|
if( check_count > 0 ) {
|
22
22
|
$("#batch-action-dropdown").show();
|
23
23
|
} else {
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rao-component
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.11.pre
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Roberto Vasquez Angel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-02-
|
11
|
+
date: 2019-02-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -174,6 +174,7 @@ files:
|
|
174
174
|
- MIT-LICENSE
|
175
175
|
- README.md
|
176
176
|
- Rakefile
|
177
|
+
- app/assets/javascripts/rao-component/acts_as_list.js.coffee
|
177
178
|
- app/components/rao/component/base.rb
|
178
179
|
- app/components/rao/component/collection_table.rb
|
179
180
|
- app/components/rao/component/resource_table.rb
|