alchemy-custom-model 2.2.1 → 3.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/concerns/alchemy/admin/nodes_controller_dec.rb +2 -1
- data/app/helpers/alchemy/custom/model/admin/base_helper.rb +1 -1
- data/app/views/alchemy/admin/nodes/_form.html.erb +44 -63
- data/app/views/alchemy/custom/model/admin/base/index.html.erb +4 -4
- data/lib/alchemy/custom/model/el_finder/paths/active_record_reference.rb +9 -0
- data/lib/alchemy/custom/model/version.rb +1 -1
- metadata +10 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 55c17f5ce203eedbd4ad364be3ed1302d1d4dd7d4216613238e844e0ed5fabee
|
4
|
+
data.tar.gz: 546fdbb3be926f0e8a32fd6e03dd9bff4abcc8c4a6fc359b81af0fa1323ee59a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 167b7b826b42af9a46bd7c35f790afca9cabeb5557166f6823bc3303974137000f3ead2b6f8f8934c5477f6d8d8e3d421fe28d476d14b65c28857a4fcf91e92e
|
7
|
+
data.tar.gz: 638a5b8b4d714ce849501652cf47f4cb7e715006aea25d596713d6f743bcf40d4a3bc68b6eac051462da7fefd18d998072f475879fcdc350ebd906b461052101
|
@@ -392,7 +392,7 @@ module Alchemy::Custom::Model::Admin::BaseHelper
|
|
392
392
|
|
393
393
|
def order_path(obj = nil, options = {})
|
394
394
|
if obj.nil?
|
395
|
-
new_polymorphic_path([:admin, base_class.to_s.pluralize.underscore, :order])
|
395
|
+
new_polymorphic_path([:admin, base_class.to_s.pluralize.underscore.to_sym, :order])
|
396
396
|
else
|
397
397
|
new_polymorphic_path([:admin, obj, :order])
|
398
398
|
end
|
@@ -1,75 +1,57 @@
|
|
1
1
|
<%= alchemy_form_for([:admin, node]) do |f| %>
|
2
|
+
<% if node.new_record? && node.root? %>
|
3
|
+
<%= f.input :menu_type,
|
4
|
+
collection: Alchemy::Language.current.available_menu_names.map { |n| [I18n.t(n, scope: [:alchemy, :menu_names]), n] },
|
5
|
+
include_blank: false,
|
6
|
+
input_html: { class: 'alchemy_selectbox' } %>
|
2
7
|
|
3
|
-
<%
|
4
|
-
|
5
|
-
|
6
|
-
<%= f.input :name,
|
7
|
-
collection: Alchemy::Node.available_menu_names.map { |n| [I18n.t(n, scope: [:alchemy, :menu_names]), n] },
|
8
|
-
include_blank: false,
|
9
|
-
input_html: {class: 'alchemy_selectbox'} %>
|
8
|
+
<% else %>
|
9
|
+
<% if node.root? %>
|
10
|
+
<%= f.input :name %>
|
10
11
|
<% else %>
|
11
12
|
<%= f.input :name, input_html: {
|
12
|
-
autofocus: true,
|
13
|
-
value: node.page && node.read_attribute(:name).blank? ? nil : node.name,
|
14
|
-
placeholder: node.page ? node.page.name : nil
|
15
|
-
} %>
|
16
|
-
<% end %>
|
17
|
-
|
18
|
-
<% else %>
|
19
|
-
|
20
|
-
<%= f.input :name, as: :string, input_html: {
|
21
13
|
autofocus: true,
|
22
14
|
value: node.page && node.read_attribute(:name).blank? ? nil : node.name,
|
23
15
|
placeholder: node.page ? node.page.name : nil
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
active_klass = (node.errors.keys.include? :custom_model_klass or
|
16
|
+
} %>
|
17
|
+
<%
|
18
|
+
active_klass = (node.errors.keys.include? :custom_model_klass or
|
28
19
|
node.custom_model?) ? "ui-tabs-active" : ""
|
29
|
-
|
20
|
+
%>
|
21
|
+
|
22
|
+
<div class="container_selctor_age_custom_model">
|
23
|
+
<div id="tabs_nodes" class="ui-tabs ui-corner-all ui-widget ui-widget-content">
|
24
|
+
<ul role="tablist" class="ui-tabs-nav ui-corner-all ui-helper-reset ui-helper-clearfix ui-widget-header">
|
25
|
+
<li role="tab" tabindex="0" class="ui-tabs-tab ui-corner-top ui-state-default ui-tab">
|
26
|
+
<a href="#pages" role="presentation" tabindex="-1" class="ui-tabs-anchor" id="ui-id-1">
|
27
|
+
<%= Alchemy.t(:pages_select) %>
|
28
|
+
</a>
|
29
|
+
</li>
|
30
|
+
<li role="tab" tabindex="1" class="ui-tabs-tab ui-corner-top ui-tab <%= active_klass %>">
|
31
|
+
<a href="#custom_models" role="presentation" tabindex="1" class="ui-tabs-anchor" id="ui-id-2">
|
32
|
+
<%= Alchemy.t(:custom_models) %>
|
33
|
+
</a>
|
34
|
+
</li>
|
35
|
+
</ul>
|
36
|
+
<div id="custom_models" aria-labelledby="legacy_urls_label" role="tabpanel" class="ui-tabs-panel ui-corner-bottom ui-widget-content" aria-hidden="false">
|
37
|
+
<%= f.input :custom_model_klass, input_html: {class: 'alchemy_selectbox'} %>
|
38
|
+
<%= f.input :custom_model_method, input_html: {class: 'alchemy_selectbox'} %>
|
39
|
+
</div>
|
40
|
+
<div id="pages" aria-labelledby="ui-id-1" role="tabpanel" class="ui-tabs-panel ui-corner-bottom ui-widget-content" aria-hidden="false">
|
41
|
+
<%= f.input :page_id, label: Alchemy::Page.model_name.human, input_html: {class: 'alchemy_selectbox'} %>
|
42
|
+
<%= f.input :url, input_html: {disabled: node.page}, hint: Alchemy.t(:node_url_hint) %>
|
43
|
+
<%= f.input :title %>
|
44
|
+
<%= f.input :nofollow %>
|
45
|
+
<%= f.input :external %>
|
46
|
+
<%= f.hidden_field :parent_id %>
|
47
|
+
</div>
|
30
48
|
|
31
|
-
<div class="container_selctor_age_custom_model">
|
32
|
-
<div id="tabs_nodes" class="ui-tabs ui-corner-all ui-widget ui-widget-content">
|
33
|
-
<ul role="tablist" class="ui-tabs-nav ui-corner-all ui-helper-reset ui-helper-clearfix ui-widget-header">
|
34
|
-
<li role="tab" tabindex="0" class="ui-tabs-tab ui-corner-top ui-state-default ui-tab">
|
35
|
-
<a href="#pages" role="presentation" tabindex="-1" class="ui-tabs-anchor" id="ui-id-1">
|
36
|
-
<%= Alchemy.t(:pages_select) %>
|
37
|
-
</a>
|
38
|
-
</li>
|
39
|
-
<li role="tab" tabindex="1" class="ui-tabs-tab ui-corner-top ui-tab <%= active_klass %>">
|
40
|
-
<a href="#custom_models" role="presentation" tabindex="1" class="ui-tabs-anchor" id="ui-id-2">
|
41
|
-
<%= Alchemy.t(:custom_models) %>
|
42
|
-
</a>
|
43
|
-
</li>
|
44
|
-
</ul>
|
45
|
-
<div id="custom_models" aria-labelledby="legacy_urls_label" role="tabpanel" class="ui-tabs-panel ui-corner-bottom ui-widget-content" aria-hidden="false">
|
46
|
-
<%= f.input :custom_model_klass, input_html: {class: 'alchemy_selectbox'} %>
|
47
|
-
<%= f.input :custom_model_method, input_html: {class: 'alchemy_selectbox'} %>
|
48
|
-
</div>
|
49
|
-
<div id="pages" aria-labelledby="ui-id-1" role="tabpanel" class="ui-tabs-panel ui-corner-bottom ui-widget-content" aria-hidden="false">
|
50
|
-
<%= f.input :page_id, label: Alchemy::Page.model_name.human, input_html: {class: 'alchemy_selectbox'} %>
|
51
|
-
<%= f.input :url, input_html: {disabled: node.page}, hint: Alchemy.t(:node_url_hint) %>
|
52
|
-
<%= f.input :title %>
|
53
|
-
<%= f.input :nofollow %>
|
54
|
-
<%= f.input :external %>
|
55
|
-
<%= f.hidden_field :parent_id %>
|
56
49
|
</div>
|
57
|
-
|
58
50
|
</div>
|
59
|
-
</div>
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
51
|
|
65
|
-
|
66
|
-
<% end %>
|
67
|
-
<% if node.respond_to? :site_id %>
|
68
|
-
<%= f.hidden_field :site_id %>
|
69
|
-
<% end %>
|
70
|
-
<% if node.respond_to? :language_id %>
|
71
|
-
<%= f.hidden_field :language_id %>
|
52
|
+
<% end %>
|
72
53
|
<% end %>
|
54
|
+
<%= f.hidden_field :language_id %>
|
73
55
|
<%= f.submit button_label %>
|
74
56
|
<% end %>
|
75
57
|
|
@@ -102,7 +84,6 @@
|
|
102
84
|
|
103
85
|
})
|
104
86
|
|
105
|
-
$('#node_custom_model_method').select2('disable');
|
106
87
|
|
107
88
|
$('#node_page_id').alchemyPageSelect({
|
108
89
|
placeholder: "<%= Alchemy.t(:search_page) %>",
|
@@ -111,16 +92,16 @@
|
|
111
92
|
initialSelection: {
|
112
93
|
id: <%= node.page_id %>,
|
113
94
|
text: "<%= node.page.name %>",
|
114
|
-
|
95
|
+
url_path: "<%= node.page.url_path %>"
|
115
96
|
}
|
116
97
|
<% end %>
|
117
|
-
}).on('change', function
|
98
|
+
}).on('change', function(e) {
|
118
99
|
if (e.val === '') {
|
119
100
|
$('#node_name').removeAttr('placeholder')
|
120
101
|
$('#node_url').val('').prop('disabled', false)
|
121
102
|
} else {
|
122
103
|
$('#node_name').attr('placeholder', e.added.name)
|
123
|
-
$('#node_url').val(
|
104
|
+
$('#node_url').val(e.added.url_path).prop('disabled', true)
|
124
105
|
}
|
125
106
|
})
|
126
107
|
</script>
|
@@ -31,22 +31,22 @@
|
|
31
31
|
}
|
32
32
|
end
|
33
33
|
|
34
|
-
if can?(:export_csv, base_class) and check_presence_polymorphic_path([:export_csv, :admin, base_class.to_s.demodulize.pluralize.underscore ], :get, format: :csv)
|
34
|
+
if can?(:export_csv, base_class) and check_presence_polymorphic_path([:export_csv, :admin, base_class.to_s.demodulize.pluralize.underscore.to_sym ], :get, format: :csv)
|
35
35
|
buttons << {
|
36
36
|
icon: "download",
|
37
37
|
label: t(:export_selected_data),
|
38
|
-
url: polymorphic_path([:export_csv, :admin, base_class.to_s.demodulize.pluralize.underscore], {format: :csv}.merge(request.query_parameters) ),
|
38
|
+
url: polymorphic_path([:export_csv, :admin, base_class.to_s.demodulize.pluralize.underscore.to_sym], {format: :csv}.merge(request.query_parameters) ),
|
39
39
|
title: t(:export_selected_data),
|
40
40
|
dialog: false,
|
41
41
|
if_permitted_to: [:export_csv, base_class]
|
42
42
|
}
|
43
43
|
end
|
44
44
|
|
45
|
-
if can?(:export_csv_full, base_class) and check_presence_polymorphic_path([:export_csv_full, :admin, base_class.to_s.demodulize.pluralize.underscore ], :get, format: :csv)
|
45
|
+
if can?(:export_csv_full, base_class) and check_presence_polymorphic_path([:export_csv_full, :admin, base_class.to_s.demodulize.pluralize.underscore.to_sym ], :get, format: :csv)
|
46
46
|
buttons << {
|
47
47
|
icon: "file-archive",
|
48
48
|
label: t(:export_all_data),
|
49
|
-
url: polymorphic_path([:export_csv_full, :admin, base_class.to_s.demodulize.pluralize.underscore],format: :csv),
|
49
|
+
url: polymorphic_path([:export_csv_full, :admin, base_class.to_s.demodulize.pluralize.underscore.to_sym],format: :csv),
|
50
50
|
title: t(:export_all_data),
|
51
51
|
dialog: false,
|
52
52
|
if_permitted_to: [:export_csv_full, base_class]
|
@@ -35,6 +35,15 @@ module Alchemy::Custom::Model::ElFinder
|
|
35
35
|
"#{p.id}#{URI_SPACER}"
|
36
36
|
end
|
37
37
|
|
38
|
+
##
|
39
|
+
# Identifichiamo la data di modifica del file con la data di modifica del record, in questo modo la cache
|
40
|
+
# che viene generata attraverso l'inserimento di un parametro nella query con il valore t=orario non andrà ad essere
|
41
|
+
# aggiornato ad ogni refresh, anche solo a livello di browser
|
42
|
+
# nel caso abbiamo problemi usiamo lo standard
|
43
|
+
def mtime
|
44
|
+
active_record_instance.updated_at rescue super
|
45
|
+
end
|
46
|
+
|
38
47
|
def file
|
39
48
|
active_record_instance.file
|
40
49
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: alchemy-custom-model
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alessandro Baccanelli
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2021-
|
12
|
+
date: 2021-07-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: alchemy_cms
|
@@ -17,14 +17,20 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - "~>"
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: '
|
20
|
+
version: '5.1'
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 5.1.2
|
21
24
|
type: :runtime
|
22
25
|
prerelease: false
|
23
26
|
version_requirements: !ruby/object:Gem::Requirement
|
24
27
|
requirements:
|
25
28
|
- - "~>"
|
26
29
|
- !ruby/object:Gem::Version
|
27
|
-
version: '
|
30
|
+
version: '5.1'
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 5.1.2
|
28
34
|
- !ruby/object:Gem::Dependency
|
29
35
|
name: jquery-ui-rails
|
30
36
|
requirement: !ruby/object:Gem::Requirement
|