activeadmin-selleo-cms 0.0.26 → 0.0.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -35,7 +35,7 @@ class PagesController < CmsController
35
35
  def index
36
36
  respond_to do |format|
37
37
  format.html { redirect_to page_path(I18n.locale, ActiveadminSelleoCms::Page.root) }
38
- format.json { render text: ActiveadminSelleoCms::Page.published.reorder("lft ASC").map{|p| [p.to_label, p.url(locale: false)]}.to_json }
38
+ format.json { render text: ActiveadminSelleoCms::Page.published.reorder("lft ASC").map{|p| [p.to_label, with_host(p.url(locale: false))]}.to_json }
39
39
  end
40
40
  end
41
41
  end
@@ -1,17 +1,21 @@
1
1
  module PagesHelper
2
2
  def link_to_locale(link_name, locale, page=nil)
3
3
  if page
4
- link_to link_name, url_to_page(page, locale.to_s)
4
+ link_to link_name, with_host(url_to_page(page, locale.to_s))
5
5
  elsif request.fullpath.match(/^\/\w{2}\/.*/)
6
- link_to link_name, request.fullpath.gsub(/^\/(\w{2})\//, "/#{locale.code}/")
6
+ link_to link_name, with_host(request.fullpath.gsub(/^\/(\w{2})\//, "/#{locale.code}/"))
7
7
  else
8
- link_to link_name, "/#{locale.code}"
8
+ link_to link_name, with_host("/#{locale.code}")
9
9
  end
10
10
  end
11
11
 
12
+ def with_host(relative_path)
13
+ "#{request.protocol}#{request.host_with_port}#{relative_path}"
14
+ end
15
+
12
16
  def link_to_search_result(result)
13
17
  if result.is_a? ActiveadminSelleoCms::Page
14
- "#{link_to result.breadcrumb, result.url} #{link_to "(e)", edit_admin_page_path(result.id), target: '_blank' if current_user}".html_safe
18
+ "#{link_to result.breadcrumb, with_host(result.url)} #{link_to "(e)", edit_admin_page_path(result.id), target: '_blank' if current_user}".html_safe
15
19
  end
16
20
  end
17
21
 
@@ -19,13 +23,13 @@ module PagesHelper
19
23
  return "#" unless page
20
24
  _locale = I18n.locale
21
25
  I18n.locale = locale
22
- _url = page.url
26
+ _url = with_host(page.url)
23
27
  I18n.locale = _locale
24
28
  return _url
25
29
  end
26
30
 
27
31
  def link_to_page(page, link_name=nil, options={})
28
- link_to (link_name || page.title), page.url, options
32
+ link_to (link_name || page.title), with_host(page.url), options
29
33
  end
30
34
 
31
35
  def s(name)
@@ -1,3 +1,3 @@
1
1
  module ActiveadminSelleoCms
2
- VERSION = "0.0.26"
2
+ VERSION = "0.0.27"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activeadmin-selleo-cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.26
4
+ version: 0.0.27
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-20 00:00:00.000000000 Z
12
+ date: 2013-03-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails