solidus_admin_bar 3.0.1 → 3.0.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 +4 -4
- data/README.md +8 -2
- data/app/overrides/admin_bar.rb +2 -0
- data/lib/generators/solidus_admin_bar/install/install_generator.rb +0 -1
- data/lib/solidus_admin_bar/version.rb +1 -1
- data/solidus_admin_bar.gemspec +1 -1
- data/spec/spec_helper.rb +0 -1
- data/spec/system/admin_bar_spec.rb +97 -113
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1c145c14ee4bb4a2893299144422d7380ffa6922c9ccfac642cf478d2766cb05
|
4
|
+
data.tar.gz: bcff3969f95369b8b0b6b3c2e29c3f08f0be7fba291495ab096c519d3c13f3a7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d22e60779be9b6c400790f1b110631abb2dad2844d0c7a94ee7fa3dc3333fd24ce2acc5a68e6fa05dedca57b30e52fe598c611528bf5a9c53cb56ecc59334494
|
7
|
+
data.tar.gz: e3e55d0acb39ae5e8a758fa5c5470ab374b8c3ad784060af8cb5cc0e3a4b411036cc98403ac1de93498c47e8d9ee358c4ae1881fd185dc3adbe811b1b34a210c
|
data/README.md
CHANGED
@@ -1,9 +1,15 @@
|
|
1
1
|
# Solidus Admin Bar
|
2
2
|
|
3
3
|
[](https://circleci.com/gh/QuintinAdam/solidus_admin_bar)
|
4
|
-
[](https://codecov.io/gh/QuintinAdam/solidus_admin_bar)
|
5
5
|
|
6
|
-
This extension adds
|
6
|
+
This extension adds an admin navbar to the frontend of your Solidus store. It allows for a quick link to the admin dashboard.
|
7
|
+
|
8
|
+
The admin bar gets displayed at the top of each page to users logged in as an admin. It works with following the entities:
|
9
|
+
* Products
|
10
|
+
* Taxons/Taxonomies
|
11
|
+
* Pages ([solidus_static_content](https://github.com/solidusio-contrib/solidus_static_content))
|
12
|
+
* Related Products ([solidus_related_products](https://github.com/solidusio-contrib/solidus_related_products))
|
7
13
|
|
8
14
|
## Installation
|
9
15
|
|
data/app/overrides/admin_bar.rb
CHANGED
data/solidus_admin_bar.gemspec
CHANGED
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
|
|
17
17
|
spec.metadata['source_code_uri'] = 'https://github.com/QuintinAdam/solidus_admin_bar'
|
18
18
|
spec.metadata['changelog_uri'] = 'https://github.com/QuintinAdam/solidus_admin_bar/blob/master/CHANGELOG.md'
|
19
19
|
|
20
|
-
spec.required_ruby_version =
|
20
|
+
spec.required_ruby_version = '>= 2.5.0'
|
21
21
|
|
22
22
|
# Specify which files should be added to the gem when it is released.
|
23
23
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
data/spec/spec_helper.rb
CHANGED
@@ -2,136 +2,125 @@
|
|
2
2
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
5
|
+
describe 'Admin Bar', type: :system do
|
6
|
+
describe 'home page' do
|
7
|
+
context "when an admin user" do
|
8
|
+
before do
|
9
|
+
sign_in_as_admin!
|
10
|
+
visit spree.root_path
|
11
|
+
end
|
12
|
+
|
13
|
+
it "displays the admin bar and links to dashboard" do
|
14
|
+
within('#admin_bar'){ click_link 'Dashboard' }
|
15
|
+
expect(page).to have_current_path(spree.admin_orders_path, ignore_query: true)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
it "does not allow a regular user to see the admin bar" do
|
20
|
+
sign_in_as_user!
|
9
21
|
visit spree.root_path
|
22
|
+
expect(page).not_to have_content('Dashboard')
|
10
23
|
end
|
11
|
-
|
12
|
-
|
13
|
-
|
24
|
+
|
25
|
+
it "does not allow a guest user to see the admin bar" do
|
26
|
+
visit spree.root_path
|
27
|
+
expect(page).not_to have_content('Dashboard')
|
14
28
|
end
|
15
29
|
end
|
16
30
|
|
17
|
-
|
18
|
-
|
19
|
-
visit spree.root_path
|
20
|
-
expect(page).not_to have_content('Dashboard')
|
21
|
-
end
|
31
|
+
describe 'products admin bar' do
|
32
|
+
let!(:product) { create(:product, name: "Superman T-Shirt") }
|
22
33
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
34
|
+
context "when an admin user" do
|
35
|
+
before do
|
36
|
+
sign_in_as_admin!
|
37
|
+
visit spree.root_path
|
38
|
+
click_link 'Superman T-Shirt'
|
39
|
+
end
|
40
|
+
|
41
|
+
it "can navigate to edit the product in the admin" do
|
42
|
+
within('#admin_bar'){ click_link 'Edit Product' }
|
43
|
+
expect(page).to have_current_path(spree.edit_admin_product_path(product), ignore_query: true)
|
44
|
+
end
|
45
|
+
|
46
|
+
it "allows an admin user to edit product images in the admin" do
|
47
|
+
within('#admin_bar'){ click_link 'Images' }
|
48
|
+
expect(page).to have_current_path(spree.admin_product_images_path(product), ignore_query: true)
|
49
|
+
end
|
28
50
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
51
|
+
it "allows an admin user to edit variants in the admin" do
|
52
|
+
within('#admin_bar'){ click_link 'Variants' }
|
53
|
+
expect(page).to have_current_path(spree.admin_product_variants_path(product), ignore_query: true)
|
54
|
+
end
|
55
|
+
|
56
|
+
it "allows an admin user to edit prices in the admin" do
|
57
|
+
within('#admin_bar'){ click_link 'Prices' }
|
58
|
+
expect(page).to have_current_path(spree.admin_product_prices_path(product), ignore_query: true)
|
59
|
+
end
|
60
|
+
|
61
|
+
it "allows an admin user to edit properties in the admin" do
|
62
|
+
within('#admin_bar'){ click_link 'Properties' }
|
63
|
+
expect(page).to have_current_path(spree.admin_product_product_properties_path(product), ignore_query: true)
|
64
|
+
end
|
65
|
+
|
66
|
+
it "allows an admin user to edit stock in the admin" do
|
67
|
+
within('#admin_bar'){ click_link 'Stock' }
|
68
|
+
expect(page).to have_current_path(spree.admin_product_stock_path(product), ignore_query: true)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
it "does not allow a regular user to navigate to the admin" do
|
73
|
+
sign_in_as_user!
|
34
74
|
visit spree.root_path
|
35
75
|
click_link 'Superman T-Shirt'
|
76
|
+
expect(page).not_to have_content('Edit Product')
|
36
77
|
end
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
it "allows an admin user to edit product images in the admin" do
|
43
|
-
within('#admin_bar'){ click_link 'Images' }
|
44
|
-
expect(current_path).to eq(spree.admin_product_images_path(product))
|
45
|
-
end
|
46
|
-
it "allows an admin user to edit variants in the admin" do
|
47
|
-
within('#admin_bar'){ click_link 'Variants' }
|
48
|
-
expect(current_path).to eq(spree.admin_product_variants_path(product))
|
49
|
-
end
|
50
|
-
it "allows an admin user to edit prices in the admin" do
|
51
|
-
within('#admin_bar'){ click_link 'Prices' }
|
52
|
-
expect(current_path).to eq(spree.admin_product_prices_path(product))
|
53
|
-
end
|
54
|
-
it "allows an admin user to edit properties in the admin" do
|
55
|
-
within('#admin_bar'){ click_link 'Properties' }
|
56
|
-
expect(current_path).to eq(spree.admin_product_product_properties_path(product))
|
57
|
-
end
|
58
|
-
it "allows an admin user to edit stock in the admin" do
|
59
|
-
within('#admin_bar'){ click_link 'Stock' }
|
60
|
-
expect(current_path).to eq(spree.admin_product_stock_path(product))
|
78
|
+
|
79
|
+
it "does not allow a guest user to navigate to the admin" do
|
80
|
+
visit spree.root_path
|
81
|
+
click_link 'Superman T-Shirt'
|
82
|
+
expect(page).not_to have_content('Edit Product')
|
61
83
|
end
|
62
|
-
# it "allows an admin user to edit related products in the admin" do
|
63
|
-
# within('#admin_bar'){ click_link 'Related' }
|
64
|
-
# expect(current_path).to eq(spree.related_admin_product_path(product))
|
65
|
-
# end
|
66
84
|
end
|
67
85
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
click_link 'Superman T-Shirt'
|
72
|
-
expect(page).not_to have_content('Dashboard')
|
73
|
-
expect(page).to_not have_content('Edit Product')
|
74
|
-
end
|
86
|
+
describe 'taxons admin bar' do
|
87
|
+
let!(:taxonomy) { create(:taxonomy, name: "Category") }
|
88
|
+
let!(:taxon) { taxonomy.root.children.create(name: "Clothing", taxonomy_id: taxonomy.id) }
|
75
89
|
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
90
|
+
context "when an admin user" do
|
91
|
+
before do
|
92
|
+
sign_in_as_admin!
|
93
|
+
visit spree.root_path
|
94
|
+
click_link 'Clothing'
|
95
|
+
end
|
96
|
+
|
97
|
+
it "can navigate to edit the taxonomy in the admin" do
|
98
|
+
within('#admin_bar'){ click_link 'Edit Taxonomy' }
|
99
|
+
expect(page).to have_current_path(spree.edit_admin_taxonomy_path(taxonomy), ignore_query: true)
|
100
|
+
end
|
101
|
+
|
102
|
+
it "can navigate to edit the taxon in the admin" do
|
103
|
+
within('#admin_bar'){ click_link 'Edit Taxon' }
|
104
|
+
expect(page).to have_current_path(spree.edit_admin_taxonomy_taxon_path(taxonomy.id, taxon.id),
|
105
|
+
ignore_query: true)
|
106
|
+
end
|
107
|
+
end
|
83
108
|
|
84
|
-
|
85
|
-
|
86
|
-
let!(:taxon) { taxonomy.root.children.create(name: "Clothing", taxonomy_id: taxonomy.id) }
|
87
|
-
context "an admin user" do
|
88
|
-
before do
|
89
|
-
sign_in_as_admin!
|
109
|
+
it "does not allow a normal user to navigate to the admin" do
|
110
|
+
sign_in_as_user!
|
90
111
|
visit spree.root_path
|
91
112
|
click_link 'Clothing'
|
113
|
+
expect(page).not_to have_content('Edit Taxonomy')
|
92
114
|
end
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
within('#admin_bar'){ click_link 'Edit Taxon' }
|
99
|
-
expect(current_path).to eq(spree.edit_admin_taxonomy_taxon_path(taxonomy.id, taxon.id))
|
115
|
+
|
116
|
+
it "does not allow a guest user to navigate to the admin" do
|
117
|
+
visit spree.root_path
|
118
|
+
click_link 'Clothing'
|
119
|
+
expect(page).not_to have_content('Edit Taxonomy')
|
100
120
|
end
|
101
121
|
end
|
102
|
-
it "does not allow a normal user to navigate to the admin" do
|
103
|
-
sign_in_as_user!
|
104
|
-
visit spree.root_path
|
105
|
-
click_link 'Clothing'
|
106
|
-
expect(page).not_to have_content('Dashboard')
|
107
|
-
expect(page).to_not have_content('Edit Taxonomy')
|
108
|
-
expect(page).to_not have_content('Edit Taxon')
|
109
|
-
end
|
110
|
-
it "does not allow a guest user to navigate to the admin" do
|
111
|
-
visit spree.root_path
|
112
|
-
click_link 'Clothing'
|
113
|
-
expect(page).not_to have_content('Dashboard')
|
114
|
-
expect(page).to_not have_content('Edit Taxonomy')
|
115
|
-
expect(page).to_not have_content('Edit Taxon')
|
116
|
-
end
|
117
122
|
end
|
118
123
|
|
119
|
-
# describe 'pages admin bar' do
|
120
|
-
# let!(:store) { create(:store, default: true) }
|
121
|
-
# let!(:content_page) { Spree::Page.create!(slug: '/page2', title: 'TestPage2', body: 'Body2', visible: true, stores: [store]) }
|
122
|
-
# it "an admin user can navigate to edit the page in the admin" do
|
123
|
-
# sign_in_as_admin!
|
124
|
-
# visit '/page2'
|
125
|
-
# expect(page).to have_content('Edit Page')
|
126
|
-
# within('#admin_bar'){ click_link 'Edit Page' }
|
127
|
-
# current_path.expect == spree.edit_admin_page_path(content_page)
|
128
|
-
# end
|
129
|
-
# it "does not allow a regular user to navigate to the admin" do
|
130
|
-
# visit '/page2'
|
131
|
-
# page.expect_not have_content('Edit Page')
|
132
|
-
# end
|
133
|
-
# end
|
134
|
-
|
135
124
|
def sign_in_as_admin!
|
136
125
|
user = create(:admin_user)
|
137
126
|
visit '/login'
|
@@ -147,8 +136,3 @@ def sign_in_as_user!
|
|
147
136
|
fill_in 'Password', with: 'secret'
|
148
137
|
click_button 'Login'
|
149
138
|
end
|
150
|
-
|
151
|
-
def create_taxon
|
152
|
-
taxonomy = create(:taxonomy, name: "Category")
|
153
|
-
create(:taxon, name: "T-Shirts", parent: taxonomy.root, taxonomy: taxonomy)
|
154
|
-
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: solidus_admin_bar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- QuintinAdam
|
@@ -110,9 +110,9 @@ require_paths:
|
|
110
110
|
- lib
|
111
111
|
required_ruby_version: !ruby/object:Gem::Requirement
|
112
112
|
requirements:
|
113
|
-
- - "
|
113
|
+
- - ">="
|
114
114
|
- !ruby/object:Gem::Version
|
115
|
-
version:
|
115
|
+
version: 2.5.0
|
116
116
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
117
117
|
requirements:
|
118
118
|
- - ">="
|