itsf_backend 2.0.2 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/itsf/backend/application/awesome-nested-set.coffee +22 -0
- data/app/controllers/concerns/controller/awesome_nested_set_concern.rb +12 -0
- data/app/extensions/concerns/resource_row/acts_as_list_extensions.rb +3 -3
- data/config/locales/de.yml +3 -0
- data/config/locales/en.yml +8 -1
- data/lib/itsf/backend/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1377cac6270de3ab9cdfcc629ad0060bc69d9cda
|
4
|
+
data.tar.gz: a85dc898f14824c69a99f6c62224f50efde3ca26
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d0ccb6de223660f65de4c4d21c5b0b20173c92fd3e43804c3db0bc66779dd1dfd0ee48027b02e7d22c164d025320debebb3cfda3e1f12ad25aa544f0b53e605b
|
7
|
+
data.tar.gz: c2d629d70cbc71b21b391cfb039ea27d96a723fcb49cdce617193a0ed59f5cd591e0c03d4ce4d3cc847b3a04f2728ffd640e6763f5855382283ecb8f821c399e
|
@@ -0,0 +1,22 @@
|
|
1
|
+
$ ->
|
2
|
+
$('[data-awesome-nested-set-item]').each ->
|
3
|
+
$(@).draggable({
|
4
|
+
scope: $(@).attr('data-awesome-nested-set-item-scope'),
|
5
|
+
revert: true
|
6
|
+
})
|
7
|
+
|
8
|
+
$ ->
|
9
|
+
$('[data-awesome-nested-set-item]').each ->
|
10
|
+
redirect_target = $(@).attr('data-awesome-nested-set-item-on-drop-target')
|
11
|
+
console.log(redirect_target)
|
12
|
+
authenticity_token = $( 'meta[name="csrf-token"]' ).attr( 'content' );
|
13
|
+
|
14
|
+
$(@).droppable({
|
15
|
+
accept: '.awesome-nested-set-item',
|
16
|
+
scope: $(@).attr('data-awesome-nested-set-item-scope'),
|
17
|
+
activeClass: 'btn-success',
|
18
|
+
drop: (event, ui) ->
|
19
|
+
dropped_element = $(ui.draggable)
|
20
|
+
dropped_element_to_param = dropped_element.attr('data-awesome-nested-set-item-uid')
|
21
|
+
$.redirect(redirect_target,{ authenticity_token: authenticity_token, dropped_id: dropped_element_to_param });
|
22
|
+
})
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module Controller
|
2
|
+
module AwesomeNestedSetConcern
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
def reposition
|
6
|
+
@resource = load_resource
|
7
|
+
@dropped_resource = resource_class.find(params[:dropped_id])
|
8
|
+
@dropped_resource.move_to_right_of(@resource)
|
9
|
+
redirect_to collection_path, notice: I18n.t("awesome_nested_set.inserted_after", target_resource: @resource.try_all(*Itsf::Backend::Configuration.resource_title_methods), inserted_resource: @dropped_resource.try_all(*Itsf::Backend::Configuration.resource_title_methods))
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -12,9 +12,9 @@ module ResourceRow
|
|
12
12
|
scope = "#{scope}_id".intern if scope.is_a?(Symbol) && scope.to_s !~ /_id$/
|
13
13
|
|
14
14
|
data_attributes = {
|
15
|
-
'acts-as-list-item':
|
16
|
-
'acts-as-list-item-scope':
|
17
|
-
'acts-as-list-item-uid':
|
15
|
+
'acts-as-list-item': true,
|
16
|
+
'acts-as-list-item-scope': "#{scope}-#{resource.send(scope)}",
|
17
|
+
'acts-as-list-item-uid': resource.to_param,
|
18
18
|
'acts-as-list-item-on-drop-target': h.url_for([:reposition, resource])
|
19
19
|
}
|
20
20
|
|
data/config/locales/de.yml
CHANGED
@@ -7,10 +7,13 @@ de:
|
|
7
7
|
acts_as_list:
|
8
8
|
inserted_after: "%{inserted_resource} nach %{target_resource} eingefügt"
|
9
9
|
inserted_before: "%{inserted_resource} vor %{target_resource} eingefügt"
|
10
|
+
awesome_nested_set:
|
11
|
+
inserted_after: "%{inserted_resource} nach %{target_resource} eingefügt"
|
10
12
|
attributes:
|
11
13
|
actions: 'Aktionen'
|
12
14
|
acts_as_list_actions: 'Liste'
|
13
15
|
acts_as_published_actions: 'Veröffentlichung'
|
16
|
+
awesome_nested_set_actions: 'Baum'
|
14
17
|
published: Veröffentlicht?
|
15
18
|
booleans:
|
16
19
|
'true': Ja
|
data/config/locales/en.yml
CHANGED
@@ -11,6 +11,7 @@ en:
|
|
11
11
|
actions: 'Actions'
|
12
12
|
acts_as_list_actions: 'List'
|
13
13
|
acts_as_published_actions: 'Publishing'
|
14
|
+
awesome_nested_set_actions: 'Tree'
|
14
15
|
published: Published?
|
15
16
|
booleans:
|
16
17
|
'true': Yes
|
@@ -37,7 +38,13 @@ en:
|
|
37
38
|
notice: "Published %{resource_name}."
|
38
39
|
unpublished:
|
39
40
|
notice: "Unpublished %{resource_name}."
|
40
|
-
|
41
|
+
helpers:
|
42
|
+
submit:
|
43
|
+
call: "%{model} ausführen"
|
44
|
+
create_and_continue_with_edit: "Create%{resource_name} and continue editing"
|
45
|
+
create_and_continue_with_new: "Create %{resource_name} and add another one"
|
46
|
+
update_and_continue_with_edit: "Update %{resource_name} and continue editing"
|
47
|
+
update_and_continue_with_new: "Update %{resource_name} and add another one"
|
41
48
|
itsf_backend: "Backend"
|
42
49
|
itsf:
|
43
50
|
backend:
|
data/lib/itsf/backend/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: itsf_backend
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0
|
4
|
+
version: 2.1.0
|
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: 2016-
|
11
|
+
date: 2016-10-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -460,6 +460,7 @@ files:
|
|
460
460
|
- app/assets/javascripts/itsf/backend/application/acts-as-list.coffee
|
461
461
|
- app/assets/javascripts/itsf/backend/application/auto-submit.coffee
|
462
462
|
- app/assets/javascripts/itsf/backend/application/autofocus-last.coffee
|
463
|
+
- app/assets/javascripts/itsf/backend/application/awesome-nested-set.coffee
|
463
464
|
- app/assets/javascripts/itsf/backend/application/drop-down-hover.coffee
|
464
465
|
- app/assets/javascripts/itsf/backend/application/itsf-logo.coffee
|
465
466
|
- app/assets/javascripts/itsf/backend/application/pagination-size.coffee
|
@@ -502,6 +503,7 @@ files:
|
|
502
503
|
- app/concerns/routing/service_concern.rb
|
503
504
|
- app/controllers/concerns/controller/acts_as_list_concern.rb
|
504
505
|
- app/controllers/concerns/controller/acts_as_published_concern.rb
|
506
|
+
- app/controllers/concerns/controller/awesome_nested_set_concern.rb
|
505
507
|
- app/controllers/concerns/controller/pagination_concern.rb
|
506
508
|
- app/controllers/concerns/controller/pundit_authorization_failure_handling_concern.rb
|
507
509
|
- app/controllers/concerns/controller/pundit_namespaced_authorize_concern.rb
|