solidus_admin_bar 3.0.1 → 3.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5e66324464ed7ae44bf5374a6c1e53c27350febd954ef6e6ccb4adb11443eb53
4
- data.tar.gz: 5ebf55dee0ce160bb3be80e8fc3802030c4999d9334e8ff0552c0c5cab9988f4
3
+ metadata.gz: 1c145c14ee4bb4a2893299144422d7380ffa6922c9ccfac642cf478d2766cb05
4
+ data.tar.gz: bcff3969f95369b8b0b6b3c2e29c3f08f0be7fba291495ab096c519d3c13f3a7
5
5
  SHA512:
6
- metadata.gz: a74b9f9ae467b09daca7febff51d17c9598ef6a417fc5f8b30ac894849a4dccbbec95cca17698e417dfa5efa6b3667b337b3519fff107adf3a934b171143a03a
7
- data.tar.gz: 3fc6cd443a87306f0dc0a98b3205dc03eb801d957a42f57abd073e3901e0f912b7adbb73c8bf2d8887f8f477b144b3a6faa87bf124866ff36348d901c78b5ab3
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
  [![CircleCI](https://circleci.com/gh/QuintinAdam/solidus_admin_bar.svg?style=shield)](https://circleci.com/gh/QuintinAdam/solidus_admin_bar)
4
- [![codecov](https://codecov.io/gh/QuintinAdam/solidus_admin_bar/branch/master/graph/badge.svg)](https://codecov.io/gh/QuintinAdam/solidus_admin_bar)
4
+ [![codecov](https://codecov.io/gh/QuintinAdam/solidus_admin_bar/branch/main/graph/badge.svg)](https://codecov.io/gh/QuintinAdam/solidus_admin_bar)
5
5
 
6
- This extension adds a admin navbar to the frontend of your Solidus store. It allows for a quick link to the admin dashboard. If you are on the taxon page it has quick links to edit the taxons. If you are in the product page, it has quick actions to all the product edit links.
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
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  Deface::Override.new(
2
4
  virtual_path: "spree/layouts/spree_application",
3
5
  name: "admin_bar",
@@ -9,7 +9,6 @@ module SolidusAdminBar
9
9
  def add_stylesheets
10
10
  inject_into_file 'vendor/assets/stylesheets/spree/frontend/all.css', " *= require spree/frontend/solidus_admin_bar\n", before: %r{\*/}, verbose: true # rubocop:disable Layout/LineLength
11
11
  end
12
-
13
12
  end
14
13
  end
15
14
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SolidusAdminBar
4
- VERSION = '3.0.1'
4
+ VERSION = '3.0.2'
5
5
  end
@@ -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 = Gem::Requirement.new('~> 2.5')
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
@@ -40,5 +40,4 @@ RSpec.configure do |config|
40
40
  if Spree.solidus_gem_version < Gem::Version.new('2.11')
41
41
  config.extend Spree::TestingSupport::AuthorizationHelpers::Request, type: :system
42
42
  end
43
-
44
43
  end
@@ -2,136 +2,125 @@
2
2
 
3
3
  require 'spec_helper'
4
4
 
5
- context 'admin bar home page' do
6
- context "an admin user" do
7
- before do
8
- sign_in_as_admin!
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
- it "should display the admin bar and links to dashboard" do
12
- within('#admin_bar'){ click_link 'Dashboard' }
13
- expect(current_path).to eq(spree.admin_orders_path)
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
- it "does not allow a regular user to see the admin bar" do
18
- sign_in_as_user!
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
- it "does not allow a guest user to see the admin bar" do
24
- visit spree.root_path
25
- expect(page).not_to have_content('Dashboard')
26
- end
27
- end
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
- describe 'products admin bar' do
30
- let!(:product) { create(:product, name: "Superman T-Shirt") }
31
- context "an admin user" do
32
- before do
33
- sign_in_as_admin!
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
- it "can navigate to edit the product in the admin" do
38
- within('#admin_bar'){ click_link 'Edit Product' }
39
- expect(page).to have_content(product.name)
40
- expect(current_path).to eq(spree.edit_admin_product_path(product))
41
- end
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
- it "does not allow a regular user to navigate to the admin" do
69
- sign_in_as_user!
70
- visit spree.root_path
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
- it "does not allow a guest user to navigate to the admin" do
77
- visit spree.root_path
78
- click_link 'Superman T-Shirt'
79
- expect(page).not_to have_content('Dashboard')
80
- expect(page).to_not have_content('Edit Product')
81
- end
82
- end
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
- describe 'taxons admin bar' do
85
- let!(:taxonomy) { create(:taxonomy, name: "Category") }
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
- it "can navigate to edit the taxonomy in the admin" do
94
- within('#admin_bar'){ click_link 'Edit Taxonomy' }
95
- expect(current_path).to eq(spree.edit_admin_taxonomy_path(taxonomy))
96
- end
97
- it "can navigate to edit the taxon in the admin" do
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.1
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: '2.5'
115
+ version: 2.5.0
116
116
  required_rubygems_version: !ruby/object:Gem::Requirement
117
117
  requirements:
118
118
  - - ">="