solidus_backend 1.2.1 → 1.2.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.
Potentially problematic release.
This version of solidus_backend might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/app/assets/javascripts/spree/backend/handlebars_extensions.coffee +2 -0
- data/app/assets/javascripts/spree/backend/taxonomy.js.coffee +21 -12
- data/app/assets/javascripts/spree/backend/templates/taxons/_tree.hbs +16 -0
- data/app/assets/javascripts/spree/backend/templates/taxons/tree.hbs +1 -0
- data/app/views/spree/admin/taxonomies/edit.erb +1 -4
- data/spec/features/admin/taxons_spec.rb +12 -1
- metadata +8 -8
- data/app/views/spree/admin/taxonomies/_js_head.html.erb +0 -13
- data/app/views/spree/admin/taxons/_list_template.html.erb +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 06989a896502698f667c9003187bae8aaaa01d44
|
4
|
+
data.tar.gz: f1804fb9406cc68260ab5630bec3bac3217cbe79
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4df80190b2cab7f56d803c754e55901f88dc314024e9256b5113f0641e2df1a700b5bcbe345b2a0c10b70485229d976f47958a5b13fe569af6b17bb92de2e22c
|
7
|
+
data.tar.gz: 83fefa9cbf10943d2a68b2f0872f5515c7d175023ebaeaecad97092553ac442ce49f478d492783ab1e6fb23cfafdf797b024ac4471221707f22d754207c4167b
|
@@ -1,4 +1,3 @@
|
|
1
|
-
taxons_template = null
|
2
1
|
Handlebars.registerHelper 'isRootTaxon', ->
|
3
2
|
!@parent_id?
|
4
3
|
|
@@ -32,6 +31,7 @@ delete_taxon = ({id}) ->
|
|
32
31
|
error: redraw_tree
|
33
32
|
|
34
33
|
draw_tree = (taxonomy) ->
|
34
|
+
taxons_template = HandlebarsTemplates["taxons/tree"]
|
35
35
|
$('#taxonomy_tree')
|
36
36
|
.html( taxons_template({ taxons: [taxonomy.root] }) )
|
37
37
|
.find('ul')
|
@@ -67,21 +67,25 @@ handle_delete = (e) ->
|
|
67
67
|
delete_taxon({id: el.data('taxon-id')})
|
68
68
|
el.remove()
|
69
69
|
|
70
|
+
handle_add_child = (e) ->
|
71
|
+
el = $(e.target).closest('li')
|
72
|
+
parent_id = el.data('taxon-id')
|
73
|
+
name = 'New node'
|
74
|
+
child_index = 0
|
75
|
+
create_taxon({name, parent_id, child_index})
|
76
|
+
|
70
77
|
get_create_handler = (taxonomy_id) ->
|
71
78
|
handle_create = (e) ->
|
72
79
|
e.preventDefault()
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
80
|
+
get_taxonomy().done (taxonomy) ->
|
81
|
+
name = 'New node'
|
82
|
+
parent_id = taxonomy.root.id
|
83
|
+
child_index = 0
|
84
|
+
create_taxon({name, parent_id, child_index})
|
77
85
|
|
78
|
-
|
79
|
-
return unless taxonomy_id?
|
80
|
-
taxons_template_text = $('#taxons-list-template').text()
|
81
|
-
taxons_template = Handlebars.compile(taxons_template_text)
|
82
|
-
Handlebars.registerPartial( 'taxons', taxons_template_text )
|
86
|
+
setup_taxonomy_tree = (taxonomy_id) ->
|
83
87
|
redraw_tree()
|
84
|
-
$(
|
88
|
+
$("#taxonomy_tree").on
|
85
89
|
sortstart: (e, ui) ->
|
86
90
|
resize_placeholder(ui)
|
87
91
|
sortover: (e, ui) ->
|
@@ -89,5 +93,10 @@ get_create_handler = (taxonomy_id) ->
|
|
89
93
|
sortstop: restore_sort_targets
|
90
94
|
sortupdate: (e, ui) ->
|
91
95
|
handle_move(ui.item) unless ui.sender?
|
92
|
-
.on('click', '.
|
96
|
+
.on('click', '.js-taxon-delete', handle_delete)
|
97
|
+
.on('click', '.js-taxon-add-child', handle_add_child)
|
93
98
|
$('.add-taxon-button').on('click', get_create_handler(taxonomy_id))
|
99
|
+
|
100
|
+
$ ->
|
101
|
+
if $('#taxonomy_tree').length
|
102
|
+
setup_taxonomy_tree($('#taxonomy_tree').data("taxonomy-id"))
|
@@ -0,0 +1,16 @@
|
|
1
|
+
{{#each taxons}}
|
2
|
+
<li data-taxon-id="{{id}}" data-taxon-taxonomy-id="{{taxonomy_id}}">
|
3
|
+
<div class="sortable-handle">
|
4
|
+
{{#if (isRootTaxon) }}{{else}}<i class="fa fa-arrows"></i>{{/if}}
|
5
|
+
{{name}}
|
6
|
+
<div class="actions right">
|
7
|
+
<a href="#" class="js-taxon-add-child fa fa-plus icon_link no-text"></a>
|
8
|
+
<a href="{{admin_url}}/taxonomies/{{taxonomy_id}}/taxons/{{id}}/edit" class="fa fa-edit icon_link no-text"></a>
|
9
|
+
<a href="#" class="js-taxon-delete fa fa-trash icon_link no-text"></a>
|
10
|
+
</div>
|
11
|
+
</div>
|
12
|
+
<ul>
|
13
|
+
{{> taxons/_tree }}
|
14
|
+
</ul>
|
15
|
+
</li>
|
16
|
+
{{/each}}
|
@@ -0,0 +1 @@
|
|
1
|
+
{{> taxons/_tree }}
|
@@ -1,8 +1,5 @@
|
|
1
1
|
<%= render :partial => 'spree/admin/shared/configuration_menu' %>
|
2
2
|
|
3
|
-
<%= render :partial => 'spree/admin/taxons/list_template' %>
|
4
|
-
<%= render :partial => 'js_head' %>
|
5
|
-
|
6
3
|
<% content_for :page_title do %>
|
7
4
|
<%= Spree.t(:taxonomy_edit) %>
|
8
5
|
<% end %>
|
@@ -33,6 +30,6 @@
|
|
33
30
|
Spree.routes.taxonomy_taxons_path = "<%= spree.api_taxonomy_taxons_path(@taxonomy) %>";
|
34
31
|
Spree.routes.admin_taxonomy_taxons_path = "<%= spree.admin_taxonomy_taxons_path(@taxonomy) %>";
|
35
32
|
</script>
|
36
|
-
<div id="taxonomy_tree" class="tree"></div>
|
33
|
+
<div id="taxonomy_tree" class="tree" data-taxonomy-id="<%= @taxonomy.id %>"></div>
|
37
34
|
</div>
|
38
35
|
<% end %>
|
@@ -22,10 +22,21 @@ describe "Taxonomies and taxons", :type => :feature do
|
|
22
22
|
expect(page).to have_content("Taxon \"Shirt\" has been successfully updated!")
|
23
23
|
end
|
24
24
|
|
25
|
-
it "can
|
25
|
+
it "can view and add to taxon tree", js: true do
|
26
26
|
taxonomy = create :taxonomy
|
27
27
|
|
28
28
|
visit spree.edit_admin_taxonomy_path(taxonomy)
|
29
29
|
expect(page).to have_content('Brand')
|
30
|
+
|
31
|
+
click_on('Add taxon')
|
32
|
+
expect(page).to have_content('New node')
|
33
|
+
|
34
|
+
# Little tricky to select the right taxon. Since the text is technically
|
35
|
+
# inside the top-level li.
|
36
|
+
within '#taxonomy_tree li li', text: 'New node' do
|
37
|
+
click_icon :edit
|
38
|
+
end
|
39
|
+
|
40
|
+
expect(page).to have_current_path %r{/admin/taxonomies/\d+/taxons/\d+/edit}
|
30
41
|
end
|
31
42
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: solidus_backend
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Solidus Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-03-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: solidus_api
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.2.
|
19
|
+
version: 1.2.2
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.2.
|
26
|
+
version: 1.2.2
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: solidus_core
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - '='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 1.2.
|
33
|
+
version: 1.2.2
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 1.2.
|
40
|
+
version: 1.2.2
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bourbon
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -185,6 +185,8 @@ files:
|
|
185
185
|
- app/assets/javascripts/spree/backend/templates/promotions/rules/option_values_select.hbs
|
186
186
|
- app/assets/javascripts/spree/backend/templates/stock_items/stock_location_stock_item.hbs
|
187
187
|
- app/assets/javascripts/spree/backend/templates/stock_transfers/transfer_item.hbs.erb
|
188
|
+
- app/assets/javascripts/spree/backend/templates/taxons/_tree.hbs
|
189
|
+
- app/assets/javascripts/spree/backend/templates/taxons/tree.hbs
|
188
190
|
- app/assets/javascripts/spree/backend/templates/variants/autocomplete.hbs.erb
|
189
191
|
- app/assets/javascripts/spree/backend/templates/variants/autocomplete_stock.hbs
|
190
192
|
- app/assets/javascripts/spree/backend/templates/variants/line_items_autocomplete_stock.hbs
|
@@ -571,14 +573,12 @@ files:
|
|
571
573
|
- app/views/spree/admin/tax_rates/index.html.erb
|
572
574
|
- app/views/spree/admin/tax_rates/new.html.erb
|
573
575
|
- app/views/spree/admin/taxonomies/_form.html.erb
|
574
|
-
- app/views/spree/admin/taxonomies/_js_head.html.erb
|
575
576
|
- app/views/spree/admin/taxonomies/_list.html.erb
|
576
577
|
- app/views/spree/admin/taxonomies/_taxon.html.erb
|
577
578
|
- app/views/spree/admin/taxonomies/edit.erb
|
578
579
|
- app/views/spree/admin/taxonomies/index.html.erb
|
579
580
|
- app/views/spree/admin/taxonomies/new.html.erb
|
580
581
|
- app/views/spree/admin/taxons/_form.html.erb
|
581
|
-
- app/views/spree/admin/taxons/_list_template.html.erb
|
582
582
|
- app/views/spree/admin/taxons/_taxon_table.html.erb
|
583
583
|
- app/views/spree/admin/taxons/edit.html.erb
|
584
584
|
- app/views/spree/admin/taxons/index.html.erb
|
@@ -1,13 +0,0 @@
|
|
1
|
-
<% content_for :head do %>
|
2
|
-
<%= javascript_tag "var taxonomy_id = #{@taxonomy.id};
|
3
|
-
var loading = '#{escape_javascript Spree.t(:loading)}';
|
4
|
-
var new_taxon = '#{escape_javascript Spree.t(:new_taxon)}';
|
5
|
-
var server_error = '#{escape_javascript Spree.t(:server_error)}';
|
6
|
-
var taxonomy_tree_error = '#{escape_javascript Spree.t(:taxonomy_tree_error)}';
|
7
|
-
|
8
|
-
$(document).ready(function(){
|
9
|
-
setup_taxonomy_tree(taxonomy_id);
|
10
|
-
});
|
11
|
-
"
|
12
|
-
%>
|
13
|
-
<% end %>
|
@@ -1,17 +0,0 @@
|
|
1
|
-
<script type="text/template" id="taxons-list-template">
|
2
|
-
{{#each taxons}}
|
3
|
-
<li data-taxon-id="{{id}}" data-taxon-taxonomy-id="{{taxonomy_id}}">
|
4
|
-
<div class="sortable-handle">
|
5
|
-
{{#if (isRootTaxon) }}{{else}}<i class="fa fa-arrows"></i>{{/if}}
|
6
|
-
{{name}}
|
7
|
-
<div class="actions right">
|
8
|
-
<a href="/admin/taxonomies/{{taxonomy_id}}/taxons/{{id}}/edit" class="fa fa-edit icon_link with-tip no-text"></a>
|
9
|
-
<a href="#" class="delete-taxon-button fa fa-trash icon_link with-tip no-text"></a>
|
10
|
-
</div>
|
11
|
-
</div>
|
12
|
-
<ul>
|
13
|
-
{{> taxons}}
|
14
|
-
</ul>
|
15
|
-
</li>
|
16
|
-
{{/each}}
|
17
|
-
</script>
|