pulitzer 0.15.0 → 0.15.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/interactions/pulitzer/create_free_form_section_partials.rb +2 -2
- data/app/interactions/pulitzer/post_types_controller/create_singleton_post.rb +1 -1
- data/app/interactions/pulitzer/post_types_controller/create_template_version.rb +1 -1
- data/app/models/pulitzer/partial.rb +4 -4
- data/app/models/pulitzer/partial_type.rb +1 -1
- data/app/models/pulitzer/post_type.rb +0 -6
- data/app/models/pulitzer/version.rb +2 -2
- data/app/views/pulitzer/partial_types/_new.html.erb +2 -2
- data/app/views/pulitzer/partial_types/_show.html.erb +1 -1
- data/db/migrate/20170515230633_create_post_type_version.rb +2 -2
- data/db/migrate/20170515232938_reconnect_post_type_to_post.rb +40 -1
- data/lib/pulitzer/version.rb +1 -1
- data/spec/controllers/pages_controller_spec.rb +4 -2
- data/spec/controllers/pulitzer/arrangement_styles_controller_spec.rb +4 -3
- data/spec/controllers/pulitzer/background_styles_controller_spec.rb +4 -3
- data/spec/controllers/pulitzer/free_form_section_types_controller_spec.rb +5 -4
- data/spec/controllers/pulitzer/justification_styles_controller_spec.rb +4 -3
- data/spec/controllers/pulitzer/partials_controller_spec.rb +12 -10
- data/spec/controllers/pulitzer/post_type_content_element_types_controller_spec.rb +10 -9
- data/spec/controllers/pulitzer/post_types_controller_spec.rb +7 -4
- data/spec/controllers/pulitzer/sequence_flow_styles_controller_spec.rb +4 -3
- data/spec/controllers/pulitzer/versions_controller_spec.rb +4 -3
- data/spec/dummy/app/controllers/pages_controller.rb +2 -1
- data/spec/dummy/config/application.rb +3 -0
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/schema.rb +20 -12
- data/spec/dummy/db/seeds/pulitzer_post_types.rb +10 -6
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/lib/state_machine/model.rb +23 -0
- data/spec/dummy/lib/state_machine/transition.rb +65 -0
- data/spec/dummy/log/development.log +275 -0
- data/spec/dummy/log/test.log +104454 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/199/cms_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/199/sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/199/thumb_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/221/cms_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/221/sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/221/thumb_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/243/cms_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/243/sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/243/thumb_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/265/cms_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/265/sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/265/thumb_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/287/cms_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/287/sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/287/thumb_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/309/cms_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/309/sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/309/thumb_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/331/cms_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/331/sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/331/thumb_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/353/cms_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/353/sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/353/thumb_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/375/cms_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/375/sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/375/thumb_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/397/cms_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/397/sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/397/thumb_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/419/cms_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/419/sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/419/thumb_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/441/cms_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/441/sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/441/thumb_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/463/cms_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/463/sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/463/thumb_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/485/cms_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/485/sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/485/thumb_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/507/cms_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/507/sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/507/thumb_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/529/cms_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/529/sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/529/thumb_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/551/cms_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/551/sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/551/thumb_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/595/cms_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/595/sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/595/thumb_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/617/cms_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/617/sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/617/thumb_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/639/cms_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/639/sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/639/thumb_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/661/cms_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/661/sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/661/thumb_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/683/cms_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/683/sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/683/thumb_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/705/cms_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/705/sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/705/thumb_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/727/cms_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/727/sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/727/thumb_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/749/cms_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/749/sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/749/thumb_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/771/cms_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/771/sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/771/thumb_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/793/cms_sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/793/sam_and_snow.jpg +0 -0
- data/spec/dummy/public/uploads/pulitzer/content_element/image/793/thumb_sam_and_snow.jpg +0 -0
- data/spec/factories/free_form_section_types.rb +1 -1
- data/spec/factories/partial_type.rb +1 -1
- data/spec/factories/post.rb +1 -1
- data/spec/factories/post_type.rb +2 -12
- data/spec/factories/post_type_content_element_type.rb +1 -1
- data/spec/factories/post_type_version.rb +19 -0
- data/spec/interactions/clone_version_spec.rb +2 -1
- data/spec/interactions/create_free_form_section_partials_spec.rb +3 -3
- data/spec/interactions/create_partial_content_elements_spec.rb +4 -4
- data/spec/interactions/create_post_content_elements_spec.rb +4 -4
- data/spec/interactions/update_post_type_content_elements_spec.rb +3 -2
- data/spec/models/post_spec.rb +1 -1
- data/spec/models/post_type_content_element_type_spec.rb +4 -3
- data/spec/models/post_type_spec.rb +0 -6
- data/spec/models/version_spec.rb +2 -2
- metadata +184 -4
- data/spec/interactions/destroy_free_form_partials_spec.rb +0 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7edd441572379a5d31ec637ab226b8deea385aa3
|
4
|
+
data.tar.gz: f0ae9071cffd03e098696c6829bfd782a2542ddf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b763b802d97e4f6e35b7219dd58fa8cc7309fae4035c5928c1ed283b690db7221416f508714efb130a8a4421ba985fee199252b869ad2168259821bc46eebeea
|
7
|
+
data.tar.gz: 7283342aa440d681573e546ee32fb62e51bf929908624d01bae79434ea0bdf53e41083410b4f64306e9c0e2fea4f9b25624eeaa270fd1d0d8e1163e517e62268
|
@@ -13,8 +13,8 @@ class Pulitzer::CreateFreeFormSectionPartials
|
|
13
13
|
partial = free_form_section.partials.create do |p|
|
14
14
|
p.label = @partial_type.label
|
15
15
|
p.sort_order = @partial_type.sort_order
|
16
|
-
p.
|
17
|
-
p.layout_id
|
16
|
+
p.post_type_version_id = @partial_type.post_type_version_id
|
17
|
+
p.layout_id = @partial_type.layout_id
|
18
18
|
end
|
19
19
|
Pulitzer::CreatePartialContentElements.new(partial).call
|
20
20
|
end
|
@@ -6,7 +6,7 @@ class Pulitzer::PostTypesController::CreateTemplateVersion
|
|
6
6
|
|
7
7
|
def call
|
8
8
|
post_type_version = @post_type.post_type_versions.create
|
9
|
-
CreateSingletonPost.new(post_type_version).call
|
9
|
+
Pulitzer::PostTypesController::CreateSingletonPost.new(post_type_version).call
|
10
10
|
end
|
11
11
|
|
12
12
|
end
|
@@ -38,19 +38,19 @@ module Pulitzer
|
|
38
38
|
end
|
39
39
|
|
40
40
|
def available_backgrounds
|
41
|
-
|
41
|
+
post_type_version.background_styles
|
42
42
|
end
|
43
43
|
|
44
44
|
def available_justifications
|
45
|
-
|
45
|
+
post_type_version.justification_styles
|
46
46
|
end
|
47
47
|
|
48
48
|
def available_sequence_flows
|
49
|
-
|
49
|
+
post_type_version.sequence_flow_styles
|
50
50
|
end
|
51
51
|
|
52
52
|
def available_arrangements
|
53
|
-
|
53
|
+
post_type_version.arrangement_styles
|
54
54
|
end
|
55
55
|
|
56
56
|
def folder_path
|
@@ -3,12 +3,6 @@ class Pulitzer::PostType < ActiveRecord::Base
|
|
3
3
|
has_many :post_type_versions, dependent: :destroy
|
4
4
|
has_one :published_type_version, -> { where(status: 'published') }, class_name: 'PostTypeVersion'
|
5
5
|
has_many :preview_type_versions, -> { where(status: 'prevew') }, class_name: 'PostTypeVersion'
|
6
|
-
has_many :posts, through: :published_type_version
|
7
|
-
has_many :partials, through: :published_type_version
|
8
|
-
has_many :post_type_content_element_types, through: :published_type_version
|
9
|
-
has_many :content_element_types, through: :post_type_content_element_types
|
10
|
-
has_many :free_form_section_types, through: :published_type_version
|
11
|
-
has_many :layouts, through: :published_type_version
|
12
6
|
|
13
7
|
scope :templates, -> { where(kind: Pulitzer::PostType.kinds[:template])}
|
14
8
|
scope :partials, -> { where(kind: Pulitzer::PostType.kinds[:partial])}
|
@@ -58,13 +58,13 @@ module Pulitzer
|
|
58
58
|
|
59
59
|
def required_partials?
|
60
60
|
has_all_partials = true
|
61
|
-
free_form_section_types = post.
|
61
|
+
free_form_section_types = post.post_type_version.free_form_section_types
|
62
62
|
free_form_sections = self.free_form_sections.where(name: free_form_section_types.pluck(:name))
|
63
63
|
free_form_sections.each do |fs|
|
64
64
|
free_form_section_type = free_form_section_types.select{|ffst| ffst.name == fs.name }
|
65
65
|
partial_types = free_form_section_type.first.partial_types
|
66
66
|
partials = fs.partials.where(label: partial_types.pluck(:label))
|
67
|
-
has_all_partials = partial_types.all?{|pt| fs.partials.where(
|
67
|
+
has_all_partials = partial_types.all?{|pt| fs.partials.where(post_type_version_id: pt.post_type_version_id).any?}
|
68
68
|
end
|
69
69
|
has_all_partials
|
70
70
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
<%= render 'pulitzer/shared/error_messages', object: partial_type %>
|
2
2
|
<%= form_for partial_type, html: ajax_form_hash(dom_target(partial_type.free_form_section_type, :partial_container), insert_method: 'append', empty_on_success: dom_target(partial_type.free_form_section_type, :new_partial)) do |f| %>
|
3
3
|
<%= f.hidden_field :free_form_section_type_id %>
|
4
|
-
<%= f.label :
|
5
|
-
<%= f.collection_select :
|
4
|
+
<%= f.label :post_type_version_id, 'Partial Type' %>
|
5
|
+
<%= f.collection_select :post_type_version_id, Pulitzer::PostType.partials, :published_type_version_id, :name, {}, revealer(dom_id(partial_type.free_form_section_type, :new_partial_type), highlander: true) %>
|
6
6
|
|
7
7
|
<%= submit_tag "Create" %>
|
8
8
|
<a class="button" data-emptier="true" data-target="<%= dom_target(partial_type.free_form_section_type, :new_partial) %>">Close</a>
|
@@ -8,7 +8,7 @@
|
|
8
8
|
</div>
|
9
9
|
<div class="pulitzer-span one-fifth margin">
|
10
10
|
<div class="pulitzer-row">
|
11
|
-
<div class="pulitzer-span"><%= partial_type.
|
11
|
+
<div class="pulitzer-span"><%= partial_type.post_type_version.name %></div>
|
12
12
|
<div class="pulitzer-span right"><%= ajax_delete 'ⓧ', partial_type_path(partial_type), {}, dom_target(partial_type) %></div>
|
13
13
|
</div>
|
14
14
|
</div>
|
@@ -1,9 +1,9 @@
|
|
1
1
|
class CreatePostTypeVersion < ActiveRecord::Migration[5.0]
|
2
2
|
def change
|
3
3
|
create_table :pulitzer_post_type_versions do |t|
|
4
|
-
t.
|
4
|
+
t.integer :post_type_id, index: true
|
5
5
|
t.integer :version_number, default: 1, null: false
|
6
|
-
t.string :status, default: '
|
6
|
+
t.string :status, default: 'incomplete', null: false
|
7
7
|
end
|
8
8
|
end
|
9
9
|
end
|
@@ -1,13 +1,52 @@
|
|
1
1
|
class ReconnectPostTypeToPost < ActiveRecord::Migration[5.0]
|
2
2
|
def change
|
3
|
+
Monocle.drop('travel_articles')
|
4
|
+
Monocle.drop('travel_guides')
|
3
5
|
add_column :pulitzer_posts, :post_type_version_id, :integer
|
6
|
+
add_column :pulitzer_background_styles, :post_type_version_id, :integer
|
7
|
+
add_column :pulitzer_justification_styles, :post_type_version_id, :integer
|
8
|
+
add_column :pulitzer_sequence_flow_styles, :post_type_version_id, :integer
|
9
|
+
add_column :pulitzer_arrangement_styles, :post_type_version_id, :integer
|
10
|
+
add_column :pulitzer_post_type_content_element_types, :post_type_version_id, :integer
|
11
|
+
add_column :pulitzer_partials, :post_type_version_id, :integer
|
12
|
+
add_column :pulitzer_partial_types, :post_type_version_id, :integer
|
13
|
+
add_column :pulitzer_free_form_section_types, :post_type_version_id, :integer
|
14
|
+
|
4
15
|
Pulitzer::Post.reset_column_information
|
16
|
+
Pulitzer::BackgroundStyle.reset_column_information
|
17
|
+
Pulitzer::JustificationStyle.reset_column_information
|
18
|
+
Pulitzer::SequenceFlowStyle.reset_column_information
|
19
|
+
Pulitzer::ArrangementStyle.reset_column_information
|
20
|
+
Pulitzer::Partial.reset_column_information
|
21
|
+
Pulitzer::PartialType.reset_column_information
|
22
|
+
Pulitzer::FreeFormSectionType.reset_column_information
|
23
|
+
Pulitzer::PostTypeContentElementType.reset_column_information
|
24
|
+
|
5
25
|
Pulitzer::PostType.all.each do |pt|
|
6
26
|
ptv = pt.published_type_version
|
7
|
-
ptv ||= pt.post_type_versions.create(status: '
|
27
|
+
ptv ||= pt.post_type_versions.create(status: 'published')
|
8
28
|
Pulitzer::Post.where(post_type_id: pt.id).update_all post_type_version_id: ptv.id
|
29
|
+
Pulitzer::BackgroundStyle.where(post_type_id: pt.id).update_all post_type_version_id: ptv.id
|
30
|
+
Pulitzer::JustificationStyle.where(post_type_id: pt.id).update_all post_type_version_id: ptv.id
|
31
|
+
Pulitzer::SequenceFlowStyle.where(post_type_id: pt.id).update_all post_type_version_id: ptv.id
|
32
|
+
Pulitzer::ArrangementStyle.where(post_type_id: pt.id).update_all post_type_version_id: ptv.id
|
33
|
+
Pulitzer::Partial.where(post_type_id: pt.id).update_all post_type_version_id: ptv.id
|
34
|
+
Pulitzer::PartialType.where(post_type_id: pt.id).update_all post_type_version_id: ptv.id
|
35
|
+
Pulitzer::FreeFormSectionType.where(post_type_id: pt.id).update_all post_type_version_id: ptv.id
|
36
|
+
Pulitzer::PostTypeContentElementType.where(post_type_id: pt.id).update_all post_type_version_id: ptv.id
|
9
37
|
end
|
38
|
+
|
39
|
+
remove_column :pulitzer_post_type_content_element_types, :post_type_id
|
40
|
+
remove_column :pulitzer_free_form_section_types, :post_type_id
|
41
|
+
remove_column :pulitzer_partials, :post_type_id
|
42
|
+
remove_column :pulitzer_sequence_flow_styles, :post_type_id
|
43
|
+
remove_column :pulitzer_background_styles, :post_type_id
|
44
|
+
remove_column :pulitzer_justification_styles, :post_type_id
|
45
|
+
remove_column :pulitzer_arrangement_styles, :post_type_id
|
10
46
|
remove_column :pulitzer_posts, :post_type_id
|
47
|
+
|
11
48
|
add_index :pulitzer_posts, :post_type_version_id
|
49
|
+
Monocle.create('travel_guides')
|
50
|
+
Monocle.create('travel_articles')
|
12
51
|
end
|
13
52
|
end
|
data/lib/pulitzer/version.rb
CHANGED
@@ -4,10 +4,12 @@ describe PagesController do
|
|
4
4
|
describe "#welcome", type: :request do
|
5
5
|
|
6
6
|
it "renders the welcome page" do
|
7
|
-
|
7
|
+
post_type_version = Pulitzer::PostType.named('Welcome').published_type_version
|
8
|
+
version = post_type_version.posts.find_by!(slug: 'welcome').get_active_version!
|
8
9
|
ffs = version.free_form_sections.find_by name: 'Main Content'
|
9
10
|
partial_type = Pulitzer::PostType.create(name: 'partial with no display', kind: Pulitzer::PostType.kinds[:partial], plural: false)
|
10
|
-
|
11
|
+
partial_type_version = partial_type.post_type_versions.create(status: :published)
|
12
|
+
ffs.partials.create(post_type_version_id: partial_type_version.id)
|
11
13
|
get welcome_path slug: 'welcome'
|
12
14
|
expect(response.status).to eq 200
|
13
15
|
end
|
@@ -5,11 +5,12 @@ describe Pulitzer::ArrangementStylesController do
|
|
5
5
|
render_views
|
6
6
|
|
7
7
|
let(:post_type) { Pulitzer::PostType.create(name: 'partial with various layout styles', kind: Pulitzer::PostType.kinds[:partial], plural: false) }
|
8
|
-
let(:
|
8
|
+
let(:post_type_version) {post_type.post_type_versions.create}
|
9
|
+
let(:arrangement_style) { post_type_version.arrangement_styles.create(display_name: 'White', view_file_name: 'white') }
|
9
10
|
|
10
11
|
describe "arrangement_styles", type: :request do
|
11
12
|
it "renders the new form" do
|
12
|
-
get pulitzer.new_arrangement_style_path(arrangement_style: {
|
13
|
+
get pulitzer.new_arrangement_style_path(arrangement_style: {post_type_version_id: post_type_version.id})
|
13
14
|
expect(response.status).to eq 200
|
14
15
|
expect(response.body).to match /arrangement_style\[display_name\]/
|
15
16
|
end
|
@@ -17,7 +18,7 @@ describe Pulitzer::ArrangementStylesController do
|
|
17
18
|
it "creates a new arrangement_style" do
|
18
19
|
post pulitzer.arrangement_styles_path(
|
19
20
|
arrangement_style: {
|
20
|
-
|
21
|
+
post_type_version_id: post_type_version.id,
|
21
22
|
view_file_name: 'pretty-arrangement',
|
22
23
|
display_name: 'Pretty Arrangement'})
|
23
24
|
expect(response.status).to eq 200
|
@@ -5,11 +5,12 @@ describe Pulitzer::BackgroundStylesController do
|
|
5
5
|
render_views
|
6
6
|
|
7
7
|
let(:post_type) { Pulitzer::PostType.create(name: 'partial with various layout styles', kind: Pulitzer::PostType.kinds[:partial], plural: false) }
|
8
|
-
let(:
|
8
|
+
let(:post_type_version) {post_type.post_type_versions.create}
|
9
|
+
let(:background_style) { post_type_version.background_styles.create(display_name: 'White', css_class_name: 'white') }
|
9
10
|
|
10
11
|
describe "background_styles", type: :request do
|
11
12
|
it "renders the new form" do
|
12
|
-
get pulitzer.new_background_style_path(background_style: {
|
13
|
+
get pulitzer.new_background_style_path(background_style: {post_type_version_id: post_type_version.id})
|
13
14
|
expect(response.status).to eq 200
|
14
15
|
expect(response.body).to match /background_style\[display_name\]/
|
15
16
|
end
|
@@ -17,7 +18,7 @@ describe Pulitzer::BackgroundStylesController do
|
|
17
18
|
it "creates a new background_style" do
|
18
19
|
post pulitzer.background_styles_path(
|
19
20
|
background_style: {
|
20
|
-
|
21
|
+
post_type_version_id: post_type_version.id,
|
21
22
|
css_class_name: 'pretty-class',
|
22
23
|
display_name: 'Pretty Class'})
|
23
24
|
expect(response.status).to eq 200
|
@@ -5,18 +5,19 @@ describe Pulitzer::FreeFormSectionTypesController do
|
|
5
5
|
render_views
|
6
6
|
|
7
7
|
let(:post_type) { Pulitzer::PostType.create(name: 'free as a bird', plural: true, kind: Pulitzer::PostType.kinds[:template]) }
|
8
|
-
let(:
|
8
|
+
let(:post_type_version) {post_type.post_type_versions.create}
|
9
|
+
let(:free_form_section_type) { post_type_version.free_form_section_types.create(name: 'main content') }
|
9
10
|
|
10
11
|
describe "#amenities", type: :request do
|
11
12
|
it "renders the new form" do
|
12
|
-
|
13
|
-
get pulitzer.new_free_form_section_type_path
|
13
|
+
post_type_version
|
14
|
+
get pulitzer.new_free_form_section_type_path post_type_version_id: post_type_version.id
|
14
15
|
expect(response.status).to eq 200
|
15
16
|
expect(response.body).to match /free_form_section_type\[name\]/
|
16
17
|
end
|
17
18
|
|
18
19
|
it "creates a new free form section type" do
|
19
|
-
post pulitzer.free_form_section_types_path free_form_section_type: {
|
20
|
+
post pulitzer.free_form_section_types_path free_form_section_type: {post_type_version_id: post_type_version.id, name: 'test sidebar'}
|
20
21
|
expect(response.status).to eq 200
|
21
22
|
ffst = Pulitzer::FreeFormSectionType.order(id: :desc).first
|
22
23
|
expect(ffst.name).to eq "test sidebar"
|
@@ -5,11 +5,12 @@ describe Pulitzer::JustificationStylesController do
|
|
5
5
|
render_views
|
6
6
|
|
7
7
|
let(:post_type) { Pulitzer::PostType.create(name: 'partial with various layout styles', kind: Pulitzer::PostType.kinds[:partial], plural: false) }
|
8
|
-
let(:
|
8
|
+
let(:post_type_version) {post_type.post_type_versions.create}
|
9
|
+
let(:justification_style) { post_type_version.justification_styles.create(display_name: 'White', css_class_name: 'white') }
|
9
10
|
|
10
11
|
describe "justification_styles", type: :request do
|
11
12
|
it "renders the new form" do
|
12
|
-
get pulitzer.new_justification_style_path(justification_style: {
|
13
|
+
get pulitzer.new_justification_style_path(justification_style: {post_type_version_id: post_type_version.id})
|
13
14
|
expect(response.status).to eq 200
|
14
15
|
expect(response.body).to match /justification_style\[display_name\]/
|
15
16
|
end
|
@@ -17,7 +18,7 @@ describe Pulitzer::JustificationStylesController do
|
|
17
18
|
it "creates a new justification_style" do
|
18
19
|
post pulitzer.justification_styles_path(
|
19
20
|
justification_style: {
|
20
|
-
|
21
|
+
post_type_version_id: post_type_version.id,
|
21
22
|
css_class_name: 'pretty-class',
|
22
23
|
display_name: 'Pretty Class'})
|
23
24
|
expect(response.status).to eq 200
|
@@ -5,31 +5,32 @@ describe Pulitzer::PartialsController do
|
|
5
5
|
render_views
|
6
6
|
|
7
7
|
let(:post_type) { Pulitzer::PostType.create(name: 'Centered Text White BG', plural: true, kind: Pulitzer::PostType.kinds[:partial]) }
|
8
|
+
let(:post_type_version) {post_type.post_type_versions.create(status: :published)}
|
8
9
|
let(:free_form_section) { Pulitzer::FreeFormSection.create(name: 'free as a bird') }
|
9
|
-
let(:partial) { free_form_section.partials.create(
|
10
|
+
let(:partial) { free_form_section.partials.create(post_type_version_id: post_type_version.id, label: 'test partial') }
|
10
11
|
|
11
12
|
describe "#amenities", type: :request do
|
12
13
|
it "renders the new form" do
|
13
|
-
|
14
|
+
post_type_version
|
14
15
|
get pulitzer.new_partial_path partial: {free_form_section_id: free_form_section.id}
|
15
16
|
expect(response.status).to eq 200
|
16
|
-
expect(response.body).to match
|
17
|
+
expect(response.body).to match post_type_version.name
|
17
18
|
end
|
18
19
|
|
19
20
|
it "creates a new partial" do
|
20
|
-
bg =
|
21
|
-
just =
|
22
|
-
sf =
|
23
|
-
arr =
|
21
|
+
bg = post_type_version.background_styles.create(display_name: 'Grey', css_class_name: 'grey')
|
22
|
+
just = post_type_version.justification_styles.create(display_name: 'Left', css_class_name: 'left')
|
23
|
+
sf = post_type_version.sequence_flow_styles.create(display_name: 'Begin Sequence', css_class_name: 'begin-sequence')
|
24
|
+
arr = post_type_version.arrangement_styles.create(display_name: 'Image Right', view_file_name: 'image-right')
|
24
25
|
post pulitzer.partials_path partial: {
|
25
|
-
|
26
|
+
post_type_version_id: post_type_version.id, free_form_section_id: free_form_section.id,
|
26
27
|
justification_style_id: just.id, background_style_id: bg.id,
|
27
28
|
sequence_flow_style_id: sf.id, arrangement_style_id: arr.id
|
28
29
|
}
|
29
30
|
expect(response.status).to eq 200
|
30
31
|
partial = Pulitzer::Partial.order(id: :desc).first
|
31
32
|
expect(partial.free_form_section_id).to eq free_form_section.id
|
32
|
-
expect(partial.
|
33
|
+
expect(partial.post_type_version_id).to eq post_type_version.id
|
33
34
|
expect(response.body).to match('Grey')
|
34
35
|
expect(response.body).to match('Left')
|
35
36
|
expect(response.body).to match('Begin Sequence')
|
@@ -45,7 +46,8 @@ describe Pulitzer::PartialsController do
|
|
45
46
|
|
46
47
|
it "updates a partial" do
|
47
48
|
other_post_type = Pulitzer::PostType.create(name: 'Left Text White BG', plural: true, kind: Pulitzer::PostType.kinds[:partial])
|
48
|
-
|
49
|
+
opt_version = other_post_type.post_type_versions.create
|
50
|
+
patch pulitzer.partial_path id: partial.id, partial: {post_type_version_id: opt_version.id}
|
49
51
|
expect(response.status).to eq 200
|
50
52
|
expect(partial.reload.name).to eq 'Left Text White BG'
|
51
53
|
end
|
@@ -7,7 +7,8 @@ describe Pulitzer::PostTypeContentElementTypesController do
|
|
7
7
|
let(:custom_option_list) {Pulitzer::CustomOptionList.find_by name: 'Sliders'}
|
8
8
|
let(:cet) {Pulitzer::ContentElementType.find_by name: 'Clickable'}
|
9
9
|
let(:post_type) {Pulitzer::PostType.create(name: 'Text and Action', plural: true, kind: :partial)}
|
10
|
-
let(:
|
10
|
+
let(:post_type_version) {post_type.post_type_versions.create(status: :published)}
|
11
|
+
let(:post_type_content_element_type) {post_type_version.post_type_content_element_types.create label: 'Action Button', content_element_type_id: cet.id}
|
11
12
|
|
12
13
|
describe "clickable_types", type: :request do
|
13
14
|
it "renders the correct options for clickable_kinds" do
|
@@ -23,7 +24,7 @@ describe Pulitzer::PostTypeContentElementTypesController do
|
|
23
24
|
post_type_content_element_type:{
|
24
25
|
label: 'Action Button 2',
|
25
26
|
content_element_type_id: cet.id,
|
26
|
-
|
27
|
+
post_type_version_id: post_type_version.id,
|
27
28
|
clickable_kind: 'any'
|
28
29
|
}
|
29
30
|
)
|
@@ -31,7 +32,7 @@ describe Pulitzer::PostTypeContentElementTypesController do
|
|
31
32
|
ptcet = Pulitzer::PostTypeContentElementType.order(id: :desc).first
|
32
33
|
expect(ptcet.label).to eq 'Action Button 2'
|
33
34
|
expect(ptcet.content_element_type_id).to eq cet.id
|
34
|
-
expect(ptcet.
|
35
|
+
expect(ptcet.post_type_version_id).to eq post_type_version.id
|
35
36
|
expect(ptcet.clickable_kind).to eq 'any'
|
36
37
|
end
|
37
38
|
|
@@ -40,7 +41,7 @@ describe Pulitzer::PostTypeContentElementTypesController do
|
|
40
41
|
post_type_content_element_type:{
|
41
42
|
label: 'Action Button 2',
|
42
43
|
content_element_type_id: cet.id,
|
43
|
-
|
44
|
+
post_type_version_id: post_type_version.id,
|
44
45
|
clickable_kind: custom_option_list.gid
|
45
46
|
}
|
46
47
|
)
|
@@ -48,7 +49,7 @@ describe Pulitzer::PostTypeContentElementTypesController do
|
|
48
49
|
ptcet = Pulitzer::PostTypeContentElementType.order(id: :desc).first
|
49
50
|
expect(ptcet.label).to eq 'Action Button 2'
|
50
51
|
expect(ptcet.content_element_type_id).to eq cet.id
|
51
|
-
expect(ptcet.
|
52
|
+
expect(ptcet.post_type_version_id).to eq post_type_version.id
|
52
53
|
expect(ptcet.custom_option_list.id).to eq custom_option_list.id
|
53
54
|
end
|
54
55
|
|
@@ -57,7 +58,7 @@ describe Pulitzer::PostTypeContentElementTypesController do
|
|
57
58
|
post_type_content_element_type:{
|
58
59
|
label: 'Action Button 2',
|
59
60
|
content_element_type_id: cet.id,
|
60
|
-
|
61
|
+
post_type_version_id: post_type_version.id,
|
61
62
|
clickable_kind: 'url'
|
62
63
|
}
|
63
64
|
)
|
@@ -65,7 +66,7 @@ describe Pulitzer::PostTypeContentElementTypesController do
|
|
65
66
|
ptcet = Pulitzer::PostTypeContentElementType.order(id: :desc).first
|
66
67
|
expect(ptcet.label).to eq 'Action Button 2'
|
67
68
|
expect(ptcet.content_element_type_id).to eq cet.id
|
68
|
-
expect(ptcet.
|
69
|
+
expect(ptcet.post_type_version_id).to eq post_type_version.id
|
69
70
|
expect(ptcet.clickable_kind).to eq 'url'
|
70
71
|
end
|
71
72
|
|
@@ -86,14 +87,14 @@ describe Pulitzer::PostTypeContentElementTypesController do
|
|
86
87
|
post_type_content_element_type: {
|
87
88
|
label: 'Action Button 2',
|
88
89
|
content_element_type_id: cet.id,
|
89
|
-
|
90
|
+
post_type_version_id: post_type_version.id,
|
90
91
|
clickable_kind: 'url'
|
91
92
|
}
|
92
93
|
)
|
93
94
|
expect(response.status).to eq 200
|
94
95
|
expect(post_type_content_element_type.reload.label).to eq 'Action Button 2'
|
95
96
|
expect(post_type_content_element_type.content_element_type_id).to eq cet.id
|
96
|
-
expect(post_type_content_element_type.
|
97
|
+
expect(post_type_content_element_type.post_type_version_id).to eq post_type_version.id
|
97
98
|
expect(post_type_content_element_type.clickable_kind).to eq 'url'
|
98
99
|
end
|
99
100
|
|