alchemy-custom-model 3.1.0 → 3.1.4

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: 2317c60439cb8da60f62ae80809fd4b70993e0bf7f9a8102a821c8163f75ec51
4
- data.tar.gz: 2e2fc95122b44aa40c849985a98a5306597e680310a2aa6fe3ea4dfa5750ce25
3
+ metadata.gz: 01ad87a5e290d623e8d028c5037e9240d52144db8eeb467154437172c5dfd8cd
4
+ data.tar.gz: d6a26111999eef68a341f0ab1bf12ad02c0394b28342415d697c280ba2f9a740
5
5
  SHA512:
6
- metadata.gz: 89cec5b88d99fb5db9f0ddbb7fc918c52d5889d747e76699af0cc623817aa800d3e9f0d650f2e1446eeab99f305421f24161b4349eba4643c4f8a4ce7aa40bfa
7
- data.tar.gz: a95507e567669799eae556bea29d30952580359d83ffa83e799723aa464b3edb1684390f2dfe316b208347da05fb4de41a1dd9480111ca928d63265c18b4e244
6
+ metadata.gz: 4886147f390121611f0d8b9f9adb187edb4a920aed5d57f3eb77f93782108270e303903db4e465510549fe6f815fd8b56fd66f4ed278f2c83b6fae0f1882355f
7
+ data.tar.gz: af3798384c8550eb3f03dc20153faddeac62b53131637ad03480994eef4fa8808b932aa5f19b6b345f7c1340e28a8b19fd4884ed9b9e690b91f6d771282b6e4b
@@ -44,7 +44,8 @@ module Alchemy
44
44
  :nofollow,
45
45
  :external,
46
46
  :custom_model_klass,
47
- :custom_model_method
47
+ :custom_model_method,
48
+ :menu_type
48
49
  )
49
50
  end
50
51
 
@@ -8,7 +8,7 @@ module Alchemy::Custom::Model::Admin::OrdersHelper
8
8
  end
9
9
 
10
10
  def order_path(options = {})
11
- new_polymorphic_path([:admin, base_class.to_s.pluralize.underscore, :order], options)
11
+ new_polymorphic_path([:admin, base_class.to_s.pluralize.underscore.to_sym, :order], options)
12
12
  end
13
13
 
14
14
  def index_ordered_path(obj = nil, options = {})
@@ -21,7 +21,7 @@ module Alchemy::Custom::Model::Admin::OrdersHelper
21
21
 
22
22
  def update_order_path(obj=nil,options = {})
23
23
  if obj.nil?
24
- polymorphic_path([:admin, base_class.to_s.pluralize.underscore, :order], options)
24
+ polymorphic_path([:admin, base_class.to_s.pluralize.underscore.to_sym, :order], options)
25
25
  else
26
26
  polymorphic_path([:admin, obj, :order], options)
27
27
 
@@ -110,14 +110,14 @@ Alchemy::PagesHelper.module_eval do
110
110
  end
111
111
 
112
112
  def render_menu_with_language(name, options = {})
113
- root_node = Alchemy::Node.where(language_id: Alchemy::Language.current.id).roots.find_by(name: name)
113
+ root_node = Alchemy::Node.where(language_id: Alchemy::Language.current.id).roots.find_by(menu_type: name)
114
114
  if root_node.nil?
115
115
  warning("Menu with name #{name} not found!")
116
116
  return
117
117
  end
118
118
 
119
119
  options = {
120
- node_partial_name: "#{root_node.view_folder_name}/node"
120
+ node_partial_name: "#{root_node.to_partial_path}"
121
121
  }.merge(options)
122
122
 
123
123
  render(root_node, menu: root_node, node: root_node, options: options)
@@ -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
- <% if node.root? %>
4
-
5
- <% if Alchemy::Node.respond_to? :available_menu_names %>
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
- url: "/<%= node.page.urlname %>"
95
+ url_path: "<%= node.page.url_path %>"
115
96
  }
116
97
  <% end %>
117
- }).on('change', function (e) {
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('/' + e.added.urlname).prop('disabled', true)
104
+ $('#node_url').val(e.added.url_path).prop('disabled', true)
124
105
  }
125
106
  })
126
107
  </script>
@@ -1,7 +1,7 @@
1
1
  module Alchemy
2
2
  module Custom
3
3
  module Model
4
- VERSION = '3.1.0'
4
+ VERSION = '3.1.4'
5
5
  end
6
6
  end
7
7
  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: 3.1.0
4
+ version: 3.1.4
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-07-05 00:00:00.000000000 Z
12
+ date: 2021-09-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: alchemy_cms