dm_cms 4.2.3.9 → 4.2.3.10

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
  SHA1:
3
- metadata.gz: 3db5ee05c48bfa0f3f505b4ce857b0de3bdaaea2
4
- data.tar.gz: dc44057669badf50fa81684c89dc49e9727e7df7
3
+ metadata.gz: 98b4d1df67ba08c8d217be36f506c9397fcbedb8
4
+ data.tar.gz: 978bec9c13db543562c1ebc06d0fc90ea1557ef5
5
5
  SHA512:
6
- metadata.gz: a03df7b89cf0178891f734764dbe99ab8021caa3ccb524304eb284171b641b5c8df51bcf9c0f1664d0a830f6a0f6976ced13b2d5b34a793edcb592688550551d
7
- data.tar.gz: aad14a8d226dec597afc87a3bd45837fa37b9d1c0818f42c84ae4d352916cfdf464a17813a282b1bd61d1df6c5fda3029eb9bcf783a5d3f9bffada1b898d3c17
6
+ metadata.gz: b74d812b33a4a1e48b633a5049c254be5403fcf3261b62751d07920a97708d4349ca049a222dc60270fa46b3d7140d2af768b53ad6d2d914431f794acaf5782a
7
+ data.tar.gz: 5e35ee2f5f40a40c6c741295866f401c21993e3a86a734aa043a8b32654cee6eacf573814b8ccdc7b3afb76e37b91eb8879322b48fe82dadec3a537e530e0c60
@@ -46,6 +46,8 @@ class DmCms::PagesController < DmCms::ApplicationController
46
46
  redirect_to "/#{DmCore::Language.locale}/#{@current_page.link}"
47
47
  when 'link'
48
48
  redirect_to @current_page.link
49
+ when 'link-new-window'
50
+ redirect_to @current_page.link
49
51
  when 'divider'
50
52
  render text: 'Not a real page'
51
53
  end
@@ -86,7 +86,7 @@ module DmCms::PagesHelper
86
86
  if (root = options[:include_root])
87
87
  active = (current_page?(root) ? options[:active_class] : nil)
88
88
  active_found ||= !active.nil?
89
- menu_str += content_tag :li, link_to(root.menutitle, dm_cms.showpage_url(root.slug)), class: active
89
+ menu_str += content_tag :li, page_link(root), class: active
90
90
  end
91
91
  pages.each do |page, children|
92
92
  if allow_page_in_menu?(page)
@@ -94,7 +94,7 @@ module DmCms::PagesHelper
94
94
  active = (submenu_active || current_page?(page) ? options[:active_class] : nil)
95
95
  active_found ||= !active.nil?
96
96
  menu_str += content_tag(:li, class: active) do
97
- link_to(page.menutitle, dm_cms.showpage_url(page.slug)) +
97
+ page_link(page) +
98
98
  submenu.html_safe
99
99
  end
100
100
  end
@@ -111,7 +111,7 @@ module DmCms::PagesHelper
111
111
  if (root = options[:include_root])
112
112
  active = (current_page?(root) ? options[:active_class] : nil)
113
113
  active_found ||= !active.nil?
114
- menu_str += content_tag :li, link_to(root.menutitle, dm_cms.showpage_url(root.slug)), class: active
114
+ menu_str += content_tag :li, page_link(root), class: active
115
115
  end
116
116
  pages.each do |page, children|
117
117
  if allow_page_in_menu?(page)
@@ -120,11 +120,11 @@ module DmCms::PagesHelper
120
120
  active_found ||= !active.nil?
121
121
  if !submenu.blank?
122
122
  menu_str += content_tag(:li, class: ['dropdown', active].join(' ')) do
123
- link_to(''.html_safe + page.menutitle + ' <b class="caret"></b>'.html_safe, dm_cms.showpage_url(page.slug), class: 'dropdown-toggle', data: {toggle: 'dropdown'}) +
123
+ page_link(page, ''.html_safe + page.menutitle + ' <b class="caret"></b>'.html_safe, class: 'dropdown-toggle', data: {toggle: 'dropdown'}) +
124
124
  submenu.html_safe
125
125
  end
126
126
  else
127
- menu_str += content_tag :li, link_to(page.menutitle, dm_cms.showpage_url(page.slug)), class: active
127
+ menu_str += content_tag :li, page_link(page), class: active
128
128
  end
129
129
  end
130
130
  end
@@ -161,9 +161,16 @@ module DmCms::PagesHelper
161
161
 
162
162
  # return a link to the page's slug, with the passed in link text
163
163
  #------------------------------------------------------------------------------
164
- def page_link(page, text = nil)
164
+ def page_link(page, text = nil, options = {})
165
165
  text ||= page.menutitle
166
- link_to text, dm_cms.showpage_url(page.slug)
166
+ case page.pagetype
167
+ when 'link'
168
+ link_to text, page.link || dm_cms.showpage_url(page.slug), options
169
+ when 'link-new-window'
170
+ link_to text, page.link || dm_cms.showpage_url(page.slug), options.merge(target: '_blank')
171
+ else
172
+ link_to text, dm_cms.showpage_url(page.slug), options
173
+ end
167
174
  end
168
175
 
169
176
  private
@@ -48,7 +48,7 @@ class CmsPage < ActiveRecord::Base
48
48
  validates_length_of :template, :maximum => 50
49
49
 
50
50
  # --- list of pagetypes
51
- PAGETYPE = ['content', 'pagelink', 'controller/action', 'link', 'divider']
51
+ PAGETYPE = [['Regular content', 'content'], ["Link to interior page using it's slug", 'pagelink'], ['Link to external page with url', 'link'], ['Link to external page with url (open in new window)', 'link-new-window'], ['Menu divider (no content)', 'divider'], ['Controller/Action (rarely used)', 'controller/action']]
52
52
 
53
53
  # Base the slug on the default locale
54
54
  #------------------------------------------------------------------------------
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dm_cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.2.3.9
4
+ version: 4.2.3.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Walker
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-27 00:00:00.000000000 Z
11
+ date: 2017-02-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dm_core
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 4.2.3.9
19
+ version: 4.2.3.10
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 4.2.3.9
26
+ version: 4.2.3.10
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: meta-tags-helpers
29
29
  requirement: !ruby/object:Gem::Requirement