active_element 0.0.16 → 0.0.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/app/assets/config/active_element/manifest.js +2 -2
- data/app/assets/javascripts/active_element/{application.js → active_element.js} +0 -1
- data/app/assets/javascripts/active_element/confirm.js +1 -1
- data/app/assets/javascripts/active_element/form.js +1 -1
- data/app/assets/javascripts/active_element/json_field.js +1 -1
- data/app/assets/javascripts/active_element/pagination.js +1 -1
- data/app/assets/javascripts/active_element/popover.js +1 -1
- data/app/assets/javascripts/active_element/secret.js +1 -1
- data/app/assets/javascripts/active_element/setup.js +2 -1
- data/app/assets/javascripts/active_element/text_search_field.js +1 -1
- data/app/assets/javascripts/active_element/theme.js +1 -1
- data/app/assets/javascripts/active_element/timezones.js +1 -1
- data/app/views/active_element/default_views/edit.html.erb +4 -0
- data/app/views/active_element/default_views/index.html.erb +4 -0
- data/app/views/active_element/default_views/new.html.erb +4 -0
- data/app/views/active_element/default_views/show.html.erb +3 -0
- data/app/views/layouts/active_element.html.erb +25 -9
- data/lib/active_element/version.rb +1 -1
- metadata +4 -4
- /data/app/assets/stylesheets/active_element/{application.scss → active_element.scss} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7c6d9d2e62cd64334ba324d02116adda1fb4177b3ada32e2634c69ddc8a59d42
|
4
|
+
data.tar.gz: d37225180b3932060de9cbbaa4d1e5c69a70ccf277aeaaa27fdd94a99b2327f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6f97e214aa565b0c47bcac56a11340a043ecf5f0d138229e9827f7a35f730cc66d44e0ce73666c8f7fe87126a30beb0fe06e8a16072eadcb4cf264fe579762f5
|
7
|
+
data.tar.gz: d30d2534b1418c8f9ad70dcca84b7a53587d5e171d7c9b8489d51667c4714f502de905382d7ec030566da90eb02f8c2141f76a888f7a52770b4a711fbf6576b7
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
active_element (0.0.
|
4
|
+
active_element (0.0.18)
|
5
5
|
bootstrap (~> 5.3.0alpha3)
|
6
6
|
kaminari (~> 1.2)
|
7
7
|
paintbrush (~> 0.1.2)
|
@@ -150,7 +150,7 @@ GEM
|
|
150
150
|
mini_mime (1.1.5)
|
151
151
|
mini_portile2 (2.8.2)
|
152
152
|
minitest (5.18.1)
|
153
|
-
net-imap (0.4.
|
153
|
+
net-imap (0.4.10)
|
154
154
|
date
|
155
155
|
net-protocol
|
156
156
|
net-pop (0.1.2)
|
@@ -1,2 +1,2 @@
|
|
1
|
-
//= link active_element/
|
2
|
-
//= link active_element/
|
1
|
+
//= link active_element/active_element.js
|
2
|
+
//= link active_element/active_element.css
|
@@ -1,7 +1,7 @@
|
|
1
1
|
(() => {
|
2
2
|
const cloneElement = (id) => ActiveElement.cloneElement('form', id);
|
3
3
|
|
4
|
-
window.addEventListener(
|
4
|
+
window.addEventListener(ActiveElement.reloadEvent, () => {
|
5
5
|
const confirmLinks = document.querySelectorAll('[data-confirm-action="true"]');
|
6
6
|
|
7
7
|
confirmLinks.forEach((element) => {
|
@@ -602,7 +602,7 @@ ActiveElement.JsonField = (() => {
|
|
602
602
|
})();
|
603
603
|
|
604
604
|
(() => {
|
605
|
-
window.addEventListener(
|
605
|
+
window.addEventListener(ActiveElement.reloadEvent, () => {
|
606
606
|
document.querySelectorAll('.json-field').forEach((element) => {
|
607
607
|
ActiveElement.JsonField(element);
|
608
608
|
});
|
@@ -1,5 +1,5 @@
|
|
1
1
|
(() => {
|
2
|
-
window.addEventListener(
|
2
|
+
window.addEventListener(ActiveElement.reloadEvent, () => {
|
3
3
|
const popoverTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="popover"]'))
|
4
4
|
const popoverList = popoverTriggerList.map(function (element) {
|
5
5
|
return new bootstrap.Popover(element)
|
@@ -1,7 +1,7 @@
|
|
1
1
|
(() => {
|
2
2
|
const cloneElement = (id) => ActiveElement.cloneElement('secret', id);
|
3
3
|
|
4
|
-
window.addEventListener(
|
4
|
+
window.addEventListener(ActiveElement.reloadEvent, () => {
|
5
5
|
document.querySelectorAll('span[data-field-type="secret"]').forEach((element) => {
|
6
6
|
const secret = element.dataset.secret;
|
7
7
|
const showButton = cloneElement('show-button');
|
@@ -33,6 +33,7 @@
|
|
33
33
|
|
34
34
|
const ActiveElement = {
|
35
35
|
debug: false,
|
36
|
+
reloadEvent: window.ActiveElement.turbo ? 'turbo:load' : 'DOMContentLoaded',
|
36
37
|
log: {
|
37
38
|
debug: (message) => { ActiveElement.debug && console.log(`[ActiveElement:debug]`, message); },
|
38
39
|
info: (message) => { console.log(`[ActiveElement:info] ${message}`); },
|
@@ -47,7 +48,7 @@
|
|
47
48
|
controller_path: document.querySelector('meta[name="active_element_controller_path"]').content
|
48
49
|
};
|
49
50
|
|
50
|
-
window.ActiveElement = ActiveElement;
|
51
|
+
window.ActiveElement = { ...(window.ActiveElement || {}), ...ActiveElement };
|
51
52
|
})();
|
52
53
|
|
53
54
|
ActiveElement.log.info('Initialized');
|
@@ -58,7 +58,7 @@
|
|
58
58
|
}
|
59
59
|
};
|
60
60
|
|
61
|
-
window.addEventListener(
|
61
|
+
window.addEventListener(ActiveElement.reloadEvent, () => {
|
62
62
|
document.querySelectorAll('[data-field-type="text-search"]').forEach((element) => {
|
63
63
|
const id = element.id;
|
64
64
|
const hiddenId = `${id}-hidden-value`;
|
@@ -1,7 +1,7 @@
|
|
1
1
|
(() => {
|
2
2
|
const cloneElement = (id) => ActiveElement.cloneElement('theme', id);
|
3
3
|
|
4
|
-
window.addEventListener(
|
4
|
+
window.addEventListener(ActiveElement.reloadEvent, () => {
|
5
5
|
const themeSelect = document.querySelector('#theme-select');
|
6
6
|
|
7
7
|
const setTheme = (theme) => {
|
@@ -1,5 +1,9 @@
|
|
1
1
|
<%= active_element.component.page_title record.model_name.to_s.titleize %>
|
2
2
|
|
3
|
+
<%= render_active_element_hook "#{controller_path}/before_edit" %>
|
4
|
+
|
3
5
|
<%= active_element.component.form model: [namespace, record].compact,
|
4
6
|
destroy: active_element.state.deletable?,
|
5
7
|
fields: active_element.state.editable_fields %>
|
8
|
+
|
9
|
+
<%= render_active_element_hook "#{controller_path}/after_edit" %>
|
@@ -7,6 +7,8 @@
|
|
7
7
|
fields: active_element.state.searchable_fields %>
|
8
8
|
<% end %>
|
9
9
|
|
10
|
+
<%= render_active_element_hook "#{controller_path}/before_index" %>
|
11
|
+
|
10
12
|
<% if active_element.state.search_required && search_filters.compact_blank.blank? %>
|
11
13
|
<% if active_element.state.creatable? %>
|
12
14
|
<%= active_element.component.new_button(collection.model&.new, float: 'end', class: 'mb-3') %>
|
@@ -21,3 +23,5 @@
|
|
21
23
|
collection: collection,
|
22
24
|
fields: active_element.state.listable_fields %>
|
23
25
|
<% end %>
|
26
|
+
|
27
|
+
<%= render_active_element_hook "#{controller_path}/after_index" %>
|
@@ -1,4 +1,8 @@
|
|
1
1
|
<%= active_element.component.page_title record.model_name.to_s.titleize %>
|
2
2
|
|
3
|
+
<%= render_active_element_hook "#{controller_path}/before_new" %>
|
4
|
+
|
3
5
|
<%= active_element.component.form model: [namespace, record].compact,
|
4
6
|
fields: active_element.state.editable_fields %>
|
7
|
+
|
8
|
+
<%= render_active_element_hook "#{controller_path}/after_new" %>
|
@@ -1,7 +1,10 @@
|
|
1
1
|
<%= active_element.component.page_title record.model_name.to_s.titleize %>
|
2
2
|
|
3
|
+
<%= render_active_element_hook "#{controller_path}/before_show" %>
|
4
|
+
|
3
5
|
<%= active_element.component.table item: record,
|
4
6
|
edit: active_element.state.editable?,
|
5
7
|
destroy: active_element.state.deletable?,
|
6
8
|
fields: active_element.state.viewable_fields %>
|
7
9
|
|
10
|
+
<%= render_active_element_hook "#{controller_path}/after_show" %>
|
@@ -1,9 +1,24 @@
|
|
1
1
|
<html>
|
2
2
|
<head>
|
3
|
+
<script>
|
4
|
+
window.ActiveElement = window.ActiveElement || {};
|
5
|
+
</script>
|
6
|
+
|
3
7
|
<%= render_active_element_hook 'active_element/before_head' %>
|
4
8
|
<%= render_active_element_hook 'active_element/favicon' %>
|
5
9
|
<%= render_active_element_hook 'active_element/title' %>
|
6
10
|
|
11
|
+
<% if respond_to?(:javascript_importmap_tags) %>
|
12
|
+
<%= javascript_importmap_tags %>
|
13
|
+
<script>
|
14
|
+
window.ActiveElement.turbo = true;
|
15
|
+
</script>
|
16
|
+
<% else %>
|
17
|
+
<script>
|
18
|
+
window.ActiveElement.turbo = false;
|
19
|
+
</script>
|
20
|
+
<% end %>
|
21
|
+
|
7
22
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" integrity="sha512-iecdLmaskl7CVkqkXNQ/ZH/XLlvWZOJyj7Yy7tcenmpD1ypASozpmT/E0iPtmFIB46ZmdtAc9eNBvH0H/ZpiBw==" crossorigin="anonymous" referrerpolicy="no-referrer" />
|
8
23
|
<link rel="stylesheet"
|
9
24
|
href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/11.7.0/styles/default.min.css">
|
@@ -48,16 +63,16 @@
|
|
48
63
|
window.ActiveElement = window.ActiveElement || {};
|
49
64
|
</script>
|
50
65
|
|
51
|
-
<%=
|
66
|
+
<%= csrf_meta_tag %>
|
67
|
+
<meta name="active_element_controller_path" content="<%= controller_path %>">
|
68
|
+
|
69
|
+
<%= stylesheet_link_tag 'active_element/active_element' %>
|
70
|
+
<%= javascript_include_tag 'active_element/active_element' %>
|
52
71
|
|
53
72
|
<% if Rails.application.assets&.find_asset('application.css').present? %>
|
54
|
-
<%= stylesheet_link_tag 'application'
|
73
|
+
<%= stylesheet_link_tag 'application' %>
|
55
74
|
<% end %>
|
56
75
|
|
57
|
-
<%= csrf_meta_tag %>
|
58
|
-
|
59
|
-
<meta name="active_element_controller_path" content="<%= controller_path %>">
|
60
|
-
|
61
76
|
<%= render_active_element_hook 'active_element/after_head' %>
|
62
77
|
</head>
|
63
78
|
|
@@ -97,9 +112,10 @@
|
|
97
112
|
|
98
113
|
<%= render_active_element_hook 'active_element/after_content' %>
|
99
114
|
|
100
|
-
|
101
|
-
|
102
|
-
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
|
115
|
+
<% if !respond_to?(:javascript_importmap_tags) && Rails.application.assets&.find_asset('application.js').present? %>
|
116
|
+
<%= javascript_include_tag 'active_element/active_element', 'data-turbo-track': 'reload', 'data-turbolinks-track': 'reload' %>
|
117
|
+
<%= javascript_include_tag 'application', 'data-turbo-track': 'reload', 'data-turbolinks-track': 'reload' %>
|
103
118
|
<% end %>
|
119
|
+
|
104
120
|
</body>
|
105
121
|
</html>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_element
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.18
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bob Farrell
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-02-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bootstrap
|
@@ -113,7 +113,7 @@ files:
|
|
113
113
|
- Rakefile
|
114
114
|
- active_element.gemspec
|
115
115
|
- app/assets/config/active_element/manifest.js
|
116
|
-
- app/assets/javascripts/active_element/
|
116
|
+
- app/assets/javascripts/active_element/active_element.js
|
117
117
|
- app/assets/javascripts/active_element/confirm.js
|
118
118
|
- app/assets/javascripts/active_element/form.js
|
119
119
|
- app/assets/javascripts/active_element/highlight.js
|
@@ -128,7 +128,7 @@ files:
|
|
128
128
|
- app/assets/javascripts/active_element/toast.js
|
129
129
|
- app/assets/stylesheets/active_element/_dark.scss
|
130
130
|
- app/assets/stylesheets/active_element/_variables.scss
|
131
|
-
- app/assets/stylesheets/active_element/
|
131
|
+
- app/assets/stylesheets/active_element/active_element.scss
|
132
132
|
- app/controllers/active_element/application_controller.rb
|
133
133
|
- app/controllers/concerns/active_element/default_controller_actions.rb
|
134
134
|
- app/views/active_element/_title.html.erb
|
File without changes
|