archangel 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.jshintrc +3 -3
- data/.reek +9 -0
- data/Gemfile +1 -0
- data/app/assets/javascripts/archangel/object/flash.js +2 -2
- data/app/assets/javascripts/archangel/object/routes.js.erb +4 -0
- data/app/assets/javascripts/archangel/object/routes/backend.js +13 -2
- data/app/helpers/archangel/flash_helper.rb +1 -1
- data/app/models/archangel/asset.rb +1 -1
- data/app/models/archangel/collection.rb +3 -3
- data/app/models/archangel/page.rb +1 -1
- data/app/models/archangel/site.rb +3 -4
- data/app/models/archangel/user.rb +4 -2
- data/app/models/archangel/widget.rb +1 -1
- data/app/services/archangel/render_service.rb +1 -7
- data/app/services/archangel/template_render_service.rb +1 -3
- data/app/themes/default/assets/javascripts/default/backend.js +0 -2
- data/app/themes/default/assets/javascripts/default/backend/core.js +71 -2
- data/app/themes/default/assets/javascripts/default/common/flash.js +1 -1
- data/app/themes/default/views/layouts/auth.html.erb +2 -0
- data/app/themes/default/views/layouts/backend/_sidebar.html.erb +7 -5
- data/app/views/archangel/shared/_flash_messages.html.erb +3 -3
- data/app/views/devise/shared/_links.html.erb +7 -7
- data/db/migrate/20171003210347_create_archangel_users.rb +2 -2
- data/db/migrate/20171005224054_create_archangel_pages.rb +1 -1
- data/db/migrate/20171006175939_create_archangel_widgets.rb +1 -1
- data/db/migrate/20171006194044_create_archangel_collections.rb +1 -1
- data/db/seeds.rb +72 -7
- data/docs/Extension/Models.md +1 -1
- data/lib/archangel/command/templates/extension/config/routes.rb +1 -1
- data/lib/archangel/engine.rb +4 -0
- data/lib/archangel/version.rb +1 -1
- data/lib/generators/archangel/dummy/templates/config/database.yml +0 -12
- data/spec/lib/archangel/command/extension_spec.rb +1 -1
- data/spec/models/archangel/asset_spec.rb +11 -14
- data/spec/models/archangel/collection_spec.rb +37 -7
- data/spec/models/archangel/entry_spec.rb +8 -6
- data/spec/models/archangel/field_spec.rb +21 -10
- data/spec/models/archangel/page_spec.rb +65 -24
- data/spec/models/archangel/site_spec.rb +45 -2
- data/spec/models/archangel/template_spec.rb +16 -9
- data/spec/models/archangel/user_spec.rb +44 -15
- data/spec/models/archangel/widget_spec.rb +44 -10
- data/spec/policies/archangel/asset_policy_spec.rb +26 -9
- data/spec/policies/archangel/collection_policy_spec.rb +23 -8
- data/spec/policies/archangel/entries_policy_spec.rb +26 -9
- data/spec/policies/archangel/page_policy_spec.rb +23 -8
- data/spec/policies/archangel/site_policy_spec.rb +11 -9
- data/spec/policies/archangel/template_policy_spec.rb +23 -8
- data/spec/policies/archangel/user_policy_spec.rb +23 -8
- data/spec/policies/archangel/widget_policy_spec.rb +23 -8
- metadata +2 -4
- data/app/themes/default/assets/javascripts/default/common/navigation.js +0 -30
- data/app/themes/default/assets/javascripts/default/common/sidebar.js +0 -114
@@ -6,15 +6,30 @@ module Archangel
|
|
6
6
|
RSpec.describe UserPolicy, type: :policy do
|
7
7
|
subject { described_class.new(user, record) }
|
8
8
|
|
9
|
-
let(:user) { create(:user) }
|
10
9
|
let(:record) { create(:user) }
|
11
10
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
11
|
+
context "with `admin` role" do
|
12
|
+
let(:user) { create(:user, :admin) }
|
13
|
+
|
14
|
+
it { is_expected.to permit(:index) }
|
15
|
+
it { is_expected.to permit(:show) }
|
16
|
+
it { is_expected.to permit(:new) }
|
17
|
+
it { is_expected.to permit(:create) }
|
18
|
+
it { is_expected.to permit(:edit) }
|
19
|
+
it { is_expected.to permit(:update) }
|
20
|
+
it { is_expected.to permit(:destroy) }
|
21
|
+
end
|
22
|
+
|
23
|
+
context "with `editor` role" do
|
24
|
+
let(:user) { create(:user, :editor) }
|
25
|
+
|
26
|
+
it { is_expected.to permit(:index) }
|
27
|
+
it { is_expected.to permit(:show) }
|
28
|
+
it { is_expected.to permit(:new) }
|
29
|
+
it { is_expected.to permit(:create) }
|
30
|
+
it { is_expected.to permit(:edit) }
|
31
|
+
it { is_expected.to permit(:update) }
|
32
|
+
it { is_expected.to permit(:destroy) }
|
33
|
+
end
|
19
34
|
end
|
20
35
|
end
|
@@ -6,15 +6,30 @@ module Archangel
|
|
6
6
|
RSpec.describe WidgetPolicy, type: :policy do
|
7
7
|
subject { described_class.new(user, record) }
|
8
8
|
|
9
|
-
let(:user) { create(:user) }
|
10
9
|
let(:record) { create(:widget) }
|
11
10
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
11
|
+
context "with `admin` role" do
|
12
|
+
let(:user) { create(:user, :admin) }
|
13
|
+
|
14
|
+
it { is_expected.to permit(:index) }
|
15
|
+
it { is_expected.to permit(:show) }
|
16
|
+
it { is_expected.to permit(:new) }
|
17
|
+
it { is_expected.to permit(:create) }
|
18
|
+
it { is_expected.to permit(:edit) }
|
19
|
+
it { is_expected.to permit(:update) }
|
20
|
+
it { is_expected.to permit(:destroy) }
|
21
|
+
end
|
22
|
+
|
23
|
+
context "with `editor` role" do
|
24
|
+
let(:user) { create(:user, :editor) }
|
25
|
+
|
26
|
+
it { is_expected.to permit(:index) }
|
27
|
+
it { is_expected.to permit(:show) }
|
28
|
+
it { is_expected.to permit(:new) }
|
29
|
+
it { is_expected.to permit(:create) }
|
30
|
+
it { is_expected.to permit(:edit) }
|
31
|
+
it { is_expected.to permit(:update) }
|
32
|
+
it { is_expected.to permit(:destroy) }
|
33
|
+
end
|
19
34
|
end
|
20
35
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: archangel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Freerksen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-05-
|
11
|
+
date: 2018-05-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jquery-rails
|
@@ -619,8 +619,6 @@ files:
|
|
619
619
|
- app/themes/default/assets/javascripts/default/backend/core.js
|
620
620
|
- app/themes/default/assets/javascripts/default/common/cards.js
|
621
621
|
- app/themes/default/assets/javascripts/default/common/flash.js
|
622
|
-
- app/themes/default/assets/javascripts/default/common/navigation.js
|
623
|
-
- app/themes/default/assets/javascripts/default/common/sidebar.js
|
624
622
|
- app/themes/default/assets/javascripts/default/frontend.js
|
625
623
|
- app/themes/default/assets/javascripts/default/frontend/.keep
|
626
624
|
- app/themes/default/assets/stylesheets/default/auth.css
|
@@ -1,30 +0,0 @@
|
|
1
|
-
(function () {
|
2
|
-
'use strict';
|
3
|
-
|
4
|
-
document.addEventListener('DOMContentLoaded', function() {
|
5
|
-
var sidebarItemLinks = document.querySelectorAll('nav > ul.nav a'),
|
6
|
-
sidebarItemLinkCount = sidebarItemLinks.length,
|
7
|
-
currentUrl = String(window.location).split('?')[0];
|
8
|
-
|
9
|
-
for (var i = 0; i < sidebarItemLinkCount; i += 1) {
|
10
|
-
var item = sidebarItemLinks[i],
|
11
|
-
parentLists = item.parentNode.querySelectorAll('ul'),
|
12
|
-
parentListLength = parentLists.length;
|
13
|
-
|
14
|
-
if (currentUrl.substr(currentUrl.length - 1) == '#') {
|
15
|
-
currentUrl = currentUrl.slice(0, -1);
|
16
|
-
}
|
17
|
-
|
18
|
-
if (currentUrl.lastIndexOf(item.href, 0) === 0) {
|
19
|
-
item.classList.add('active');
|
20
|
-
|
21
|
-
for (var j = 0; j < parentListLength; j += 1) {
|
22
|
-
var linkItem = parentLists[i];
|
23
|
-
|
24
|
-
linkItem.parentclassList.add('open');
|
25
|
-
}
|
26
|
-
}
|
27
|
-
}
|
28
|
-
|
29
|
-
});
|
30
|
-
}());
|
@@ -1,114 +0,0 @@
|
|
1
|
-
(function () {
|
2
|
-
'use strict';
|
3
|
-
|
4
|
-
document.addEventListener('DOMContentLoaded', function() {
|
5
|
-
var sidebarDropdownItems = document.querySelectorAll('nav > ul.nav'),
|
6
|
-
sidebarDropdownItemCount = sidebarDropdownItems.length,
|
7
|
-
sidebarToggler = document.querySelector('.sidebar-toggler'),
|
8
|
-
sidebarMinimizer = document.querySelector('.sidebar-minimizer'),
|
9
|
-
brandMinimizer = document.querySelector('.brand-minimizer'),
|
10
|
-
mobileSidebarToggler = document.querySelector('.mobile-sidebar-toggler'),
|
11
|
-
toggleBodyElement = document.querySelector('body'),
|
12
|
-
localStorageMinimizerName = 'sidebar-minimized';
|
13
|
-
|
14
|
-
////
|
15
|
-
// Resize event
|
16
|
-
//
|
17
|
-
function resizeBroadcast() {
|
18
|
-
var timesRun = 0,
|
19
|
-
interval = setInterval(function() {
|
20
|
-
timesRun += 1;
|
21
|
-
|
22
|
-
if (timesRun === 5) {
|
23
|
-
clearInterval(interval);
|
24
|
-
}
|
25
|
-
|
26
|
-
window.dispatchEvent(new Event('resize'));
|
27
|
-
}, 62.5);
|
28
|
-
}
|
29
|
-
|
30
|
-
////
|
31
|
-
// Toggle sidebar dropdowns
|
32
|
-
//
|
33
|
-
function toggleSidebarDropdown(event) {
|
34
|
-
var hasToggleClass = event.target.classList.contains('nav-dropdown-toggle'),
|
35
|
-
parentObject = event.target.parentNode;
|
36
|
-
|
37
|
-
if (hasToggleClass) {
|
38
|
-
parentObject.toggleClass('open');
|
39
|
-
|
40
|
-
resizeBroadcast();
|
41
|
-
}
|
42
|
-
|
43
|
-
return false;
|
44
|
-
}
|
45
|
-
|
46
|
-
////
|
47
|
-
// Toggle initial on/off of brand minimizer
|
48
|
-
//
|
49
|
-
function triggerInitialSidebarCollapse() {
|
50
|
-
if (typeof(Storage) === 'undefined') {
|
51
|
-
return;
|
52
|
-
}
|
53
|
-
|
54
|
-
var localStorageToggled = localStorage.getItem(localStorageMinimizerName);
|
55
|
-
|
56
|
-
if (localStorageToggled === '1') {
|
57
|
-
brandMinimizer.dispatchEvent(new CustomEvent('click'));
|
58
|
-
}
|
59
|
-
}
|
60
|
-
|
61
|
-
////
|
62
|
-
// Sidebar dropdowns
|
63
|
-
//
|
64
|
-
for (var i = 0; i < sidebarDropdownItemCount; i += 1) {
|
65
|
-
var item = sidebarDropdownItems[i],
|
66
|
-
itemLink = item.querySelector('a');
|
67
|
-
|
68
|
-
itemLink.addEventListener('click', toggleSidebarDropdown, false);
|
69
|
-
}
|
70
|
-
|
71
|
-
////
|
72
|
-
// Sidebar toggler
|
73
|
-
//
|
74
|
-
sidebarToggler.addEventListener('click', function() {
|
75
|
-
toggleBodyElement.classList.toggle('sidebar-hidden');
|
76
|
-
|
77
|
-
resizeBroadcast();
|
78
|
-
}, false);
|
79
|
-
|
80
|
-
////
|
81
|
-
// Sidebar minimizer
|
82
|
-
//
|
83
|
-
sidebarMinimizer.addEventListener('click', function() {
|
84
|
-
toggleBodyElement.classList.toggle('sidebar-minimized');
|
85
|
-
|
86
|
-
resizeBroadcast();
|
87
|
-
}, false);
|
88
|
-
|
89
|
-
////
|
90
|
-
// Sidebar and brand minimizer
|
91
|
-
//
|
92
|
-
brandMinimizer.addEventListener('click', function() {
|
93
|
-
var hasToggleClass = toggleBodyElement.classList.contains('brand-minimized') ? '0' : '1' ;
|
94
|
-
|
95
|
-
localStorage.setItem(localStorageMinimizerName, hasToggleClass);
|
96
|
-
|
97
|
-
toggleBodyElement.classList.toggle('brand-minimized');
|
98
|
-
}, false);
|
99
|
-
|
100
|
-
////
|
101
|
-
// Mobile browser size sidebar toggler
|
102
|
-
//
|
103
|
-
mobileSidebarToggler.addEventListener('click', function() {
|
104
|
-
toggleBodyElement.classList.toggle('sidebar-mobile-show');
|
105
|
-
|
106
|
-
resizeBroadcast();
|
107
|
-
}, false);
|
108
|
-
|
109
|
-
////
|
110
|
-
// Toggle initial on/off of brand minimizer
|
111
|
-
//
|
112
|
-
triggerInitialSidebarCollapse();
|
113
|
-
});
|
114
|
-
}());
|