constructor-pages 0.8.12 → 0.8.13

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: c09866c9e4bcf1acc6b6507998a7cb406f374eda
4
- data.tar.gz: ea5777196397b8e286e6f692b9c7a9cdd25a13b0
3
+ metadata.gz: d026926c52a6cb3a5ae3d475466be5ea3e7b117b
4
+ data.tar.gz: 607421994b5261c7375f5af42f3912d6f9521f83
5
5
  SHA512:
6
- metadata.gz: 8312e4a5faf16128dad527508472dea2b4bb1938cf69ae1a0a177e3b3fabd844a14a3425edae259209467ae50f5e18ec3816bbdfcee4225f455b1274554e1697
7
- data.tar.gz: 38778dbfc8f196fd125d7e296005ff9b8d0471aac3ef56b4b839007534a37688a726e9e702cf26ce3eb5126b0700829cf0c49af69e02945960307dd86e4b5880
6
+ metadata.gz: 4ed6b39d54645df86219b201f3f9451a96812dca3f809d6fabeb9068bd0703cb3fe6129ca912d32fd4573b42705d4557006a65877d3639ff650e0043169237b6
7
+ data.tar.gz: 1a531f685ae260efe0db140f77e65a6ac5950469a17d0e88bcc093bc3f89643b57fd658bb0edb1b148d02760f4dabaa77caba6c721337791032bb105b4c52be2
@@ -23,7 +23,7 @@ module ConstructorPages
23
23
  _request = "/#{params[:all]}"
24
24
  @page = Page.find_by_request_or_first(_request)
25
25
  error_404 and return if @page.nil? or (!@page.published? and _request != '/')
26
- redirect_to @page.link if @page.redirect?
26
+ redirect_to(@page.redirect) && return if @page.redirect?
27
27
  _code_name = @page.template.code_name
28
28
  instance_variable_set('@'+_code_name, @page)
29
29
 
@@ -181,7 +181,7 @@ module ConstructorPages
181
181
  end
182
182
 
183
183
  # Check if link specified
184
- def redirect?; url != link && !link.empty? end
184
+ def redirect?; url != redirect && !redirect.empty? end
185
185
 
186
186
  # Touch all pages in same branch
187
187
  def touch_branch
@@ -41,16 +41,16 @@
41
41
  .control-group
42
42
  = f.label :parent_id, class: 'control-label'
43
43
  .controls
44
- = f.select :parent_id, options_for_select(for_select(@pages, true), selected: @parent_id), disabled: @page.self_and_descendants.map(&:id), include_blank: t(:no)
44
+ = f.select :parent_id, options_for_select(for_select(@pages, true), selected: @parent_id), disabled: @page.self_and_descendants.map(&:id), include_blank: '--'
45
45
 
46
46
  .control-group
47
47
  = f.label :template_id, :class => 'control-label'
48
48
  .controls
49
49
  = f.select :template_id, options_for_select(templates, selected: @template_id)
50
50
  .control-group
51
- = f.label :link, class: 'control-label'
51
+ = f.label :redirect, class: 'control-label'
52
52
  .controls
53
- = f.text_field :link, class: 'span9'
53
+ = f.text_field :redirect, class: 'span9'
54
54
  .control-group
55
55
  %label.control-label=t :display_in
56
56
  .controls
@@ -18,7 +18,7 @@
18
18
  .control-group
19
19
  = f.label :parent_id, class: 'control-label'
20
20
  .controls
21
- = f.select :parent_id, options_for_select(for_select(@templates), selected: @template.parent_id), disabled: @template.self_and_descendants.map(&:id), include_blank: t(:no)
21
+ = f.select :parent_id, options_for_select(for_select(@templates), selected: @template.parent_id), disabled: @template.self_and_descendants.map(&:id), include_blank: '--'
22
22
 
23
23
  - unless @template.new_record?
24
24
  .control-group
@@ -62,14 +62,14 @@ ru:
62
62
  constructor_pages/template:
63
63
  name: "Название"
64
64
  code_name: "Кодовое имя"
65
- parent: "Родительский"
65
+ parent_id: "Родительский"
66
66
  child: "Дочерний"
67
67
 
68
68
  constructor_pages/page:
69
69
  active: "Вкл./Выкл."
70
70
  image: "Изображение"
71
71
  name: "Название"
72
- template: "Шаблон"
72
+ template_id: "Шаблон"
73
73
  auto_url: "Авто-ссылка"
74
74
  url: "Адрес"
75
75
  in_menu: "Меню"
@@ -78,7 +78,7 @@ ru:
78
78
  in_url: "Адрес"
79
79
  parent: "Родитель"
80
80
  parent_id: "Родительская страница"
81
- link: "Ссылка"
81
+ redirect: "Редирект"
82
82
  title: "Заголовок"
83
83
  keywords: "Ключевые слова"
84
84
  description: "Описание"
@@ -20,7 +20,7 @@ Gem::Specification.new do |s|
20
20
 
21
21
  s.add_dependency 'dragonfly'
22
22
  s.add_dependency 'rack-cache'
23
- s.add_dependency 'awesome_nested_set'
23
+ s.add_dependency 'awesome_nested_set', '3.0.0.rc1'
24
24
  s.add_dependency 'haml-rails'
25
25
  s.add_dependency 'acts_as_list'
26
26
 
@@ -0,0 +1,9 @@
1
+ class RenameLinkToRedirect < ActiveRecord::Migration
2
+ def self.up
3
+ rename_column 'constructor_pages_pages', :link, :redirect
4
+ end
5
+
6
+ def self.down
7
+ rename_column 'constructor_pages_pages', :redirect, :link
8
+ end
9
+ end
@@ -88,6 +88,21 @@ module ConstructorPages
88
88
  visit _second_page.full_url
89
89
  page.should have_content 'Home page'
90
90
  end
91
+
92
+ it 'should redirect if redirect specified' do
93
+ _page = Page.create name: 'First page', template: @template
94
+ _template = Template.create name: 'Home page', code_name: 'home_page'
95
+ Page.create name: 'Second page', template: _template
96
+
97
+ visit _page.full_url
98
+ current_path.should == '/first-page'
99
+
100
+ _page.redirect = '/second-page'
101
+ _page.save
102
+
103
+ visit _page.full_url
104
+ current_path.should == '/second-page'
105
+ end
91
106
  end
92
107
 
93
108
  describe 'Moving' do
@@ -280,12 +280,12 @@ module ConstructorPages
280
280
  page = Page.create name: 'Test redirection'
281
281
  page.redirect?.should be_false
282
282
 
283
- page.link = ''
283
+ page.redirect = ''
284
284
  page.save
285
285
 
286
286
  page.redirect?.should be_false
287
287
 
288
- page.link = '/hello-redirect'
288
+ page.redirect = '/hello-redirect'
289
289
  page.save
290
290
 
291
291
  page.redirect?.should be_true
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: constructor-pages
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.12
4
+ version: 0.8.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ivan Zotov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-24 00:00:00.000000000 Z
11
+ date: 2013-08-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: constructor-core
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 0.8.12
19
+ version: 0.8.13
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: 0.8.12
26
+ version: 0.8.13
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: dragonfly
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -56,16 +56,16 @@ dependencies:
56
56
  name: awesome_nested_set
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - '='
60
60
  - !ruby/object:Gem::Version
61
- version: '0'
61
+ version: 3.0.0.rc1
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - '='
67
67
  - !ruby/object:Gem::Version
68
- version: '0'
68
+ version: 3.0.0.rc1
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: haml-rails
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -188,6 +188,7 @@ files:
188
188
  - db/migrate/12_add_default_template.rb
189
189
  - db/migrate/13_add_in_url_to_pages.rb
190
190
  - db/migrate/14_remove_child_id_from_templates.rb
191
+ - db/migrate/15_rename_link_to_redirect.rb
191
192
  - db/migrate/1_create_pages.rb
192
193
  - db/migrate/2_create_templates.rb
193
194
  - db/migrate/3_create_fields.rb