landable 1.11.0 → 1.11.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -1
- data/app/controllers/landable/api/pages_controller.rb +6 -1
- data/app/decorators/landable/page_decorator.rb +4 -0
- data/app/models/landable/page.rb +8 -0
- data/app/models/landable/page_revision.rb +2 -1
- data/app/models/landable/template.rb +8 -0
- data/app/serializers/landable/page_serializer.rb +1 -1
- data/db/migrate/20141211200012_add_page_name_to_page.rb +5 -0
- data/doc/schema/page.json +4 -0
- data/lib/landable/version.rb +1 -1
- data/spec/concerns/landable/has_templates_spec.rb +4 -1
- data/spec/models/landable/page_spec.rb +3 -0
- data/spec/models/landable/template_spec.rb +19 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7eeff5bea21d975e1a609fae486601fd56f01d14
|
4
|
+
data.tar.gz: 5166ca9ae9d0ce55bc358e277f9ecffea37fbd7e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7c1cf3cead1831d185ad8054651c6f6caf69e933aa1662a775011857a66e89ec4f337a408ebbe597cbcab12b1ab7fec6df48e457303ad6e337ac5c2990122b90
|
7
|
+
data.tar.gz: fad90831911bae1b77ed361ee0ad66bc1e643316798c92fa9fab99764cce0bb5975b0814933dd62283ed643d6732b7390874221ef5daf3252368f4e50d713d3c
|
data/CHANGELOG.md
CHANGED
@@ -2,7 +2,11 @@
|
|
2
2
|
|
3
3
|
See README.md before updating this file.
|
4
4
|
|
5
|
-
## Unreleased [#](https://github.com/enova/landable/compare/v1.11.
|
5
|
+
## Unreleased [#](https://github.com/enova/landable/compare/v1.11.1...master)
|
6
|
+
|
7
|
+
## 1.11.1 [#](https://github.com/enova/landable/compare/v1.11.0...v1.11.1)
|
8
|
+
* Adding PageName [#39]
|
9
|
+
* Force Template Slug to not have a space [#40]
|
6
10
|
|
7
11
|
## 1.11.0 [#](https://github.com/enova/landable/compare/v1.10.0.rc1...v1.11.0)
|
8
12
|
* Make the tracker.user_agent accessible [#33]
|
@@ -112,7 +112,12 @@ module Landable
|
|
112
112
|
|
113
113
|
def page_params
|
114
114
|
params[:page][:audit_flags] ||= []
|
115
|
-
params.require(:page).permit(:id, :path, :theme_id,
|
115
|
+
params.require(:page).permit(:id, :path, :theme_id,
|
116
|
+
:category_id, :title,
|
117
|
+
:head_content, :body,
|
118
|
+
:status_code, :redirect_url,
|
119
|
+
:lock_version, :abstract,
|
120
|
+
:hero_asset_name, :page_name,
|
116
121
|
audit_flags: [],
|
117
122
|
meta_tags: [:description, :keywords, :robots])
|
118
123
|
end
|
data/app/models/landable/page.rb
CHANGED
@@ -22,6 +22,8 @@ module Landable
|
|
22
22
|
validates_uniqueness_of :path
|
23
23
|
validates :path, presence: true
|
24
24
|
|
25
|
+
validate :page_name_byte_size
|
26
|
+
|
25
27
|
validate :forbid_changing_path, on: :update
|
26
28
|
|
27
29
|
validate :body_strip_search
|
@@ -226,6 +228,12 @@ module Landable
|
|
226
228
|
end
|
227
229
|
end
|
228
230
|
|
231
|
+
def page_name_byte_size
|
232
|
+
if page_name.present? && page_name.bytesize > 100
|
233
|
+
errors[:page_name] = 'Invalid PageName, bytesize is too big!'
|
234
|
+
end
|
235
|
+
end
|
236
|
+
|
229
237
|
def hero_asset_existence
|
230
238
|
return true if @hero_asset_name.blank?
|
231
239
|
unless Asset.find_by_name(@hero_asset_name)
|
@@ -10,6 +10,8 @@ module Landable
|
|
10
10
|
validates_uniqueness_of :name, case_sensitive: false
|
11
11
|
validates_uniqueness_of :slug, case_sensitive: false
|
12
12
|
|
13
|
+
before_save :slug_has_no_spaces
|
14
|
+
|
13
15
|
|
14
16
|
belongs_to :published_revision, class_name: 'Landable::TemplateRevision'
|
15
17
|
has_many :audits, class_name: 'Landable::Audit', as: :auditable
|
@@ -63,6 +65,12 @@ module Landable
|
|
63
65
|
save!
|
64
66
|
end
|
65
67
|
|
68
|
+
def slug_has_no_spaces
|
69
|
+
if self.slug =~ /\s/ # check if whitespace
|
70
|
+
self.slug = self.slug.underscore.gsub(/[^\w_]/, '_').gsub(/_{2,}/, '_')
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
66
74
|
class << self
|
67
75
|
def create_from_partials!
|
68
76
|
Partial.all.map(&:to_template)
|
@@ -5,7 +5,7 @@ module Landable
|
|
5
5
|
attributes :head_content, :meta_tags
|
6
6
|
attributes :status_code, :redirect_url
|
7
7
|
attributes :is_publishable, :preview_path
|
8
|
-
attributes :audit_flags
|
8
|
+
attributes :audit_flags, :page_name
|
9
9
|
attributes :hero_asset_name, :abstract
|
10
10
|
attributes :lock_version
|
11
11
|
attributes :deleted_at
|
data/doc/schema/page.json
CHANGED
data/lib/landable/version.rb
CHANGED
@@ -3,7 +3,10 @@ require 'spec_helper'
|
|
3
3
|
module Landable
|
4
4
|
describe HasTemplates do
|
5
5
|
|
6
|
-
before(:each)
|
6
|
+
before(:each) do
|
7
|
+
create_list :template, 2
|
8
|
+
create :template, slug: 'I have a space'
|
9
|
+
end
|
7
10
|
|
8
11
|
let(:templates) { Landable::Template.last(3) }
|
9
12
|
let(:subject) {
|
@@ -7,6 +7,9 @@ module Landable
|
|
7
7
|
it { should have_valid(:status_code).when(200, 301, 302, 410) }
|
8
8
|
it { should_not have_valid(:status_code).when(201, 303, 405, 500, 404) }
|
9
9
|
|
10
|
+
it { should have_valid(:page_name).when(nil, 'Hello', 'adssad', '212131') }
|
11
|
+
it { should_not have_valid(:page_name).when("#{'hello' * 100}") }
|
12
|
+
|
10
13
|
# config.reserved_paths = %w(/reserved_path_set_in_initializer /reject/.* /admin.*)
|
11
14
|
context 'PathValidator' do
|
12
15
|
it { should_not have_valid(:path).when(nil, '', '/reserved_path_set_in_initializer') }
|
@@ -119,5 +119,24 @@ module Landable
|
|
119
119
|
template.revert_to! revision
|
120
120
|
end
|
121
121
|
end
|
122
|
+
|
123
|
+
describe '#slug_has_no_spaces' do
|
124
|
+
it 'should not allow a slug with out underscores' do
|
125
|
+
t = build :template, slug: 'I have no space'
|
126
|
+
t.name = 'No Space'
|
127
|
+
t.save!
|
128
|
+
|
129
|
+
t.slug.should_not == 'I have no space'
|
130
|
+
t.slug.should == 'i_have_no_space'
|
131
|
+
end
|
132
|
+
|
133
|
+
it 'should allow the name to set the slug' do
|
134
|
+
t = build :template, slug: nil
|
135
|
+
t.name = 'I have no space'
|
136
|
+
t.save!
|
137
|
+
|
138
|
+
t.slug.should == 'i_have_no_space'
|
139
|
+
end
|
140
|
+
end
|
122
141
|
end
|
123
142
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: landable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.11.
|
4
|
+
version: 1.11.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Team Trogdor
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-12-
|
11
|
+
date: 2014-12-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -462,6 +462,7 @@ files:
|
|
462
462
|
- db/migrate/20140515164543_add_screenshot_to_page_revisions.rb
|
463
463
|
- db/migrate/20140522202332_join_table_templates_pages.rb
|
464
464
|
- db/migrate/20140602213937_path_response_time_view.rb
|
465
|
+
- db/migrate/20141211200012_add_page_name_to_page.rb
|
465
466
|
- db/test/landable.access_tokens.sql
|
466
467
|
- db/test/landable.assets.sql
|
467
468
|
- db/test/landable.authors.sql
|