pulitzer 0.15.0 → 0.15.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (131) hide show
  1. checksums.yaml +4 -4
  2. data/app/interactions/pulitzer/create_free_form_section_partials.rb +2 -2
  3. data/app/interactions/pulitzer/post_types_controller/create_singleton_post.rb +1 -1
  4. data/app/interactions/pulitzer/post_types_controller/create_template_version.rb +1 -1
  5. data/app/models/pulitzer/partial.rb +4 -4
  6. data/app/models/pulitzer/partial_type.rb +1 -1
  7. data/app/models/pulitzer/post_type.rb +0 -6
  8. data/app/models/pulitzer/version.rb +2 -2
  9. data/app/views/pulitzer/partial_types/_new.html.erb +2 -2
  10. data/app/views/pulitzer/partial_types/_show.html.erb +1 -1
  11. data/db/migrate/20170515230633_create_post_type_version.rb +2 -2
  12. data/db/migrate/20170515232938_reconnect_post_type_to_post.rb +40 -1
  13. data/lib/pulitzer/version.rb +1 -1
  14. data/spec/controllers/pages_controller_spec.rb +4 -2
  15. data/spec/controllers/pulitzer/arrangement_styles_controller_spec.rb +4 -3
  16. data/spec/controllers/pulitzer/background_styles_controller_spec.rb +4 -3
  17. data/spec/controllers/pulitzer/free_form_section_types_controller_spec.rb +5 -4
  18. data/spec/controllers/pulitzer/justification_styles_controller_spec.rb +4 -3
  19. data/spec/controllers/pulitzer/partials_controller_spec.rb +12 -10
  20. data/spec/controllers/pulitzer/post_type_content_element_types_controller_spec.rb +10 -9
  21. data/spec/controllers/pulitzer/post_types_controller_spec.rb +7 -4
  22. data/spec/controllers/pulitzer/sequence_flow_styles_controller_spec.rb +4 -3
  23. data/spec/controllers/pulitzer/versions_controller_spec.rb +4 -3
  24. data/spec/dummy/app/controllers/pages_controller.rb +2 -1
  25. data/spec/dummy/config/application.rb +3 -0
  26. data/spec/dummy/db/development.sqlite3 +0 -0
  27. data/spec/dummy/db/schema.rb +20 -12
  28. data/spec/dummy/db/seeds/pulitzer_post_types.rb +10 -6
  29. data/spec/dummy/db/test.sqlite3 +0 -0
  30. data/spec/dummy/lib/state_machine/model.rb +23 -0
  31. data/spec/dummy/lib/state_machine/transition.rb +65 -0
  32. data/spec/dummy/log/development.log +275 -0
  33. data/spec/dummy/log/test.log +104454 -0
  34. data/spec/dummy/public/uploads/pulitzer/content_element/image/199/cms_sam_and_snow.jpg +0 -0
  35. data/spec/dummy/public/uploads/pulitzer/content_element/image/199/sam_and_snow.jpg +0 -0
  36. data/spec/dummy/public/uploads/pulitzer/content_element/image/199/thumb_sam_and_snow.jpg +0 -0
  37. data/spec/dummy/public/uploads/pulitzer/content_element/image/221/cms_sam_and_snow.jpg +0 -0
  38. data/spec/dummy/public/uploads/pulitzer/content_element/image/221/sam_and_snow.jpg +0 -0
  39. data/spec/dummy/public/uploads/pulitzer/content_element/image/221/thumb_sam_and_snow.jpg +0 -0
  40. data/spec/dummy/public/uploads/pulitzer/content_element/image/243/cms_sam_and_snow.jpg +0 -0
  41. data/spec/dummy/public/uploads/pulitzer/content_element/image/243/sam_and_snow.jpg +0 -0
  42. data/spec/dummy/public/uploads/pulitzer/content_element/image/243/thumb_sam_and_snow.jpg +0 -0
  43. data/spec/dummy/public/uploads/pulitzer/content_element/image/265/cms_sam_and_snow.jpg +0 -0
  44. data/spec/dummy/public/uploads/pulitzer/content_element/image/265/sam_and_snow.jpg +0 -0
  45. data/spec/dummy/public/uploads/pulitzer/content_element/image/265/thumb_sam_and_snow.jpg +0 -0
  46. data/spec/dummy/public/uploads/pulitzer/content_element/image/287/cms_sam_and_snow.jpg +0 -0
  47. data/spec/dummy/public/uploads/pulitzer/content_element/image/287/sam_and_snow.jpg +0 -0
  48. data/spec/dummy/public/uploads/pulitzer/content_element/image/287/thumb_sam_and_snow.jpg +0 -0
  49. data/spec/dummy/public/uploads/pulitzer/content_element/image/309/cms_sam_and_snow.jpg +0 -0
  50. data/spec/dummy/public/uploads/pulitzer/content_element/image/309/sam_and_snow.jpg +0 -0
  51. data/spec/dummy/public/uploads/pulitzer/content_element/image/309/thumb_sam_and_snow.jpg +0 -0
  52. data/spec/dummy/public/uploads/pulitzer/content_element/image/331/cms_sam_and_snow.jpg +0 -0
  53. data/spec/dummy/public/uploads/pulitzer/content_element/image/331/sam_and_snow.jpg +0 -0
  54. data/spec/dummy/public/uploads/pulitzer/content_element/image/331/thumb_sam_and_snow.jpg +0 -0
  55. data/spec/dummy/public/uploads/pulitzer/content_element/image/353/cms_sam_and_snow.jpg +0 -0
  56. data/spec/dummy/public/uploads/pulitzer/content_element/image/353/sam_and_snow.jpg +0 -0
  57. data/spec/dummy/public/uploads/pulitzer/content_element/image/353/thumb_sam_and_snow.jpg +0 -0
  58. data/spec/dummy/public/uploads/pulitzer/content_element/image/375/cms_sam_and_snow.jpg +0 -0
  59. data/spec/dummy/public/uploads/pulitzer/content_element/image/375/sam_and_snow.jpg +0 -0
  60. data/spec/dummy/public/uploads/pulitzer/content_element/image/375/thumb_sam_and_snow.jpg +0 -0
  61. data/spec/dummy/public/uploads/pulitzer/content_element/image/397/cms_sam_and_snow.jpg +0 -0
  62. data/spec/dummy/public/uploads/pulitzer/content_element/image/397/sam_and_snow.jpg +0 -0
  63. data/spec/dummy/public/uploads/pulitzer/content_element/image/397/thumb_sam_and_snow.jpg +0 -0
  64. data/spec/dummy/public/uploads/pulitzer/content_element/image/419/cms_sam_and_snow.jpg +0 -0
  65. data/spec/dummy/public/uploads/pulitzer/content_element/image/419/sam_and_snow.jpg +0 -0
  66. data/spec/dummy/public/uploads/pulitzer/content_element/image/419/thumb_sam_and_snow.jpg +0 -0
  67. data/spec/dummy/public/uploads/pulitzer/content_element/image/441/cms_sam_and_snow.jpg +0 -0
  68. data/spec/dummy/public/uploads/pulitzer/content_element/image/441/sam_and_snow.jpg +0 -0
  69. data/spec/dummy/public/uploads/pulitzer/content_element/image/441/thumb_sam_and_snow.jpg +0 -0
  70. data/spec/dummy/public/uploads/pulitzer/content_element/image/463/cms_sam_and_snow.jpg +0 -0
  71. data/spec/dummy/public/uploads/pulitzer/content_element/image/463/sam_and_snow.jpg +0 -0
  72. data/spec/dummy/public/uploads/pulitzer/content_element/image/463/thumb_sam_and_snow.jpg +0 -0
  73. data/spec/dummy/public/uploads/pulitzer/content_element/image/485/cms_sam_and_snow.jpg +0 -0
  74. data/spec/dummy/public/uploads/pulitzer/content_element/image/485/sam_and_snow.jpg +0 -0
  75. data/spec/dummy/public/uploads/pulitzer/content_element/image/485/thumb_sam_and_snow.jpg +0 -0
  76. data/spec/dummy/public/uploads/pulitzer/content_element/image/507/cms_sam_and_snow.jpg +0 -0
  77. data/spec/dummy/public/uploads/pulitzer/content_element/image/507/sam_and_snow.jpg +0 -0
  78. data/spec/dummy/public/uploads/pulitzer/content_element/image/507/thumb_sam_and_snow.jpg +0 -0
  79. data/spec/dummy/public/uploads/pulitzer/content_element/image/529/cms_sam_and_snow.jpg +0 -0
  80. data/spec/dummy/public/uploads/pulitzer/content_element/image/529/sam_and_snow.jpg +0 -0
  81. data/spec/dummy/public/uploads/pulitzer/content_element/image/529/thumb_sam_and_snow.jpg +0 -0
  82. data/spec/dummy/public/uploads/pulitzer/content_element/image/551/cms_sam_and_snow.jpg +0 -0
  83. data/spec/dummy/public/uploads/pulitzer/content_element/image/551/sam_and_snow.jpg +0 -0
  84. data/spec/dummy/public/uploads/pulitzer/content_element/image/551/thumb_sam_and_snow.jpg +0 -0
  85. data/spec/dummy/public/uploads/pulitzer/content_element/image/595/cms_sam_and_snow.jpg +0 -0
  86. data/spec/dummy/public/uploads/pulitzer/content_element/image/595/sam_and_snow.jpg +0 -0
  87. data/spec/dummy/public/uploads/pulitzer/content_element/image/595/thumb_sam_and_snow.jpg +0 -0
  88. data/spec/dummy/public/uploads/pulitzer/content_element/image/617/cms_sam_and_snow.jpg +0 -0
  89. data/spec/dummy/public/uploads/pulitzer/content_element/image/617/sam_and_snow.jpg +0 -0
  90. data/spec/dummy/public/uploads/pulitzer/content_element/image/617/thumb_sam_and_snow.jpg +0 -0
  91. data/spec/dummy/public/uploads/pulitzer/content_element/image/639/cms_sam_and_snow.jpg +0 -0
  92. data/spec/dummy/public/uploads/pulitzer/content_element/image/639/sam_and_snow.jpg +0 -0
  93. data/spec/dummy/public/uploads/pulitzer/content_element/image/639/thumb_sam_and_snow.jpg +0 -0
  94. data/spec/dummy/public/uploads/pulitzer/content_element/image/661/cms_sam_and_snow.jpg +0 -0
  95. data/spec/dummy/public/uploads/pulitzer/content_element/image/661/sam_and_snow.jpg +0 -0
  96. data/spec/dummy/public/uploads/pulitzer/content_element/image/661/thumb_sam_and_snow.jpg +0 -0
  97. data/spec/dummy/public/uploads/pulitzer/content_element/image/683/cms_sam_and_snow.jpg +0 -0
  98. data/spec/dummy/public/uploads/pulitzer/content_element/image/683/sam_and_snow.jpg +0 -0
  99. data/spec/dummy/public/uploads/pulitzer/content_element/image/683/thumb_sam_and_snow.jpg +0 -0
  100. data/spec/dummy/public/uploads/pulitzer/content_element/image/705/cms_sam_and_snow.jpg +0 -0
  101. data/spec/dummy/public/uploads/pulitzer/content_element/image/705/sam_and_snow.jpg +0 -0
  102. data/spec/dummy/public/uploads/pulitzer/content_element/image/705/thumb_sam_and_snow.jpg +0 -0
  103. data/spec/dummy/public/uploads/pulitzer/content_element/image/727/cms_sam_and_snow.jpg +0 -0
  104. data/spec/dummy/public/uploads/pulitzer/content_element/image/727/sam_and_snow.jpg +0 -0
  105. data/spec/dummy/public/uploads/pulitzer/content_element/image/727/thumb_sam_and_snow.jpg +0 -0
  106. data/spec/dummy/public/uploads/pulitzer/content_element/image/749/cms_sam_and_snow.jpg +0 -0
  107. data/spec/dummy/public/uploads/pulitzer/content_element/image/749/sam_and_snow.jpg +0 -0
  108. data/spec/dummy/public/uploads/pulitzer/content_element/image/749/thumb_sam_and_snow.jpg +0 -0
  109. data/spec/dummy/public/uploads/pulitzer/content_element/image/771/cms_sam_and_snow.jpg +0 -0
  110. data/spec/dummy/public/uploads/pulitzer/content_element/image/771/sam_and_snow.jpg +0 -0
  111. data/spec/dummy/public/uploads/pulitzer/content_element/image/771/thumb_sam_and_snow.jpg +0 -0
  112. data/spec/dummy/public/uploads/pulitzer/content_element/image/793/cms_sam_and_snow.jpg +0 -0
  113. data/spec/dummy/public/uploads/pulitzer/content_element/image/793/sam_and_snow.jpg +0 -0
  114. data/spec/dummy/public/uploads/pulitzer/content_element/image/793/thumb_sam_and_snow.jpg +0 -0
  115. data/spec/factories/free_form_section_types.rb +1 -1
  116. data/spec/factories/partial_type.rb +1 -1
  117. data/spec/factories/post.rb +1 -1
  118. data/spec/factories/post_type.rb +2 -12
  119. data/spec/factories/post_type_content_element_type.rb +1 -1
  120. data/spec/factories/post_type_version.rb +19 -0
  121. data/spec/interactions/clone_version_spec.rb +2 -1
  122. data/spec/interactions/create_free_form_section_partials_spec.rb +3 -3
  123. data/spec/interactions/create_partial_content_elements_spec.rb +4 -4
  124. data/spec/interactions/create_post_content_elements_spec.rb +4 -4
  125. data/spec/interactions/update_post_type_content_elements_spec.rb +3 -2
  126. data/spec/models/post_spec.rb +1 -1
  127. data/spec/models/post_type_content_element_type_spec.rb +4 -3
  128. data/spec/models/post_type_spec.rb +0 -6
  129. data/spec/models/version_spec.rb +2 -2
  130. metadata +184 -4
  131. 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: 0df49a7939d9ace02ebfe847087de3131b1a965a
4
- data.tar.gz: f4f23a63b4f53dece53b66a4f0ed29a7952c1af1
3
+ metadata.gz: 7edd441572379a5d31ec637ab226b8deea385aa3
4
+ data.tar.gz: f0ae9071cffd03e098696c6829bfd782a2542ddf
5
5
  SHA512:
6
- metadata.gz: 6bc0696eac392143c15aad0104e106e86802382dce526bf2a0c098e1ff57a4acd5d3b88df9c238e57e0403f98b0f5c74fcc05bde2d83bb97c02f00b93edd4d37
7
- data.tar.gz: fc751dcec13a5765799467e27c3d516bb26526fe1e9b93b942a61028561badcfb8df8e07111ba43eff832f0a03298775e13229de4556bbe7546936a06d179b33
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.post_type_id = @partial_type.post_type_id
17
- p.layout_id = @partial_type.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
@@ -1,4 +1,4 @@
1
- class Pulitzer::CreateSingletonPost
1
+ class Pulitzer::PostTypesController::CreateSingletonPost
2
2
  attr_accessor :post_type_version, :title
3
3
 
4
4
  def initialize(post_type_version)
@@ -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
- post_type.background_styles
41
+ post_type_version.background_styles
42
42
  end
43
43
 
44
44
  def available_justifications
45
- post_type.justification_styles
45
+ post_type_version.justification_styles
46
46
  end
47
47
 
48
48
  def available_sequence_flows
49
- post_type.sequence_flow_styles
49
+ post_type_version.sequence_flow_styles
50
50
  end
51
51
 
52
52
  def available_arrangements
53
- post_type.arrangement_styles
53
+ post_type_version.arrangement_styles
54
54
  end
55
55
 
56
56
  def folder_path
@@ -1,7 +1,7 @@
1
1
  module Pulitzer
2
2
  class PartialType < ActiveRecord::Base
3
3
  belongs_to :free_form_section_type
4
- belongs_to :post_type
4
+ belongs_to :post_type_version
5
5
 
6
6
  def first?
7
7
  free_form_section_type.first_partial_type.id == id
@@ -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.post_type.free_form_section_types
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(post_type_id: pt.post_type_id).any?}
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 :post_type_id, 'Partial Type' %>
5
- <%= f.collection_select :post_type_id, Pulitzer::PostType.partials, :id, :name, {}, revealer(dom_id(partial_type.free_form_section_type, :new_partial_type), highlander: true) %>
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.post_type.name %></div>
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.references :pulitzer_post_type, index: true
4
+ t.integer :post_type_id, index: true
5
5
  t.integer :version_number, default: 1, null: false
6
- t.string :status, default: 'preview', null: false
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: 'active')
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
@@ -1,3 +1,3 @@
1
1
  module Pulitzer
2
- VERSION = '0.15.0'
2
+ VERSION = '0.15.1'
3
3
  end
@@ -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
- version = Pulitzer::PostType.named('Welcome').posts.find_by!(slug: 'welcome').get_active_version!
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
- ffs.partials.create(post_type_id: partial_type.id)
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(:arrangement_style) { post_type.arrangement_styles.create(display_name: 'White', view_file_name: 'white') }
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: {post_type_id: post_type.id})
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
- post_type_id: post_type.id,
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(:background_style) { post_type.background_styles.create(display_name: 'White', css_class_name: 'white') }
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: {post_type_id: post_type.id})
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
- post_type_id: post_type.id,
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(:free_form_section_type) { post_type.free_form_section_types.create(name: 'main content') }
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
- post_type
13
- get pulitzer.new_free_form_section_type_path post_type_id: post_type.id
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: {post_type_id: post_type.id, name: 'test sidebar'}
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(:justification_style) { post_type.justification_styles.create(display_name: 'White', css_class_name: 'white') }
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: {post_type_id: post_type.id})
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
- post_type_id: post_type.id,
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(post_type_id: post_type.id, label: 'test partial') }
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
- post_type
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 post_type.name
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 = post_type.background_styles.create(display_name: 'Grey', css_class_name: 'grey')
21
- just = post_type.justification_styles.create(display_name: 'Left', css_class_name: 'left')
22
- sf = post_type.sequence_flow_styles.create(display_name: 'Begin Sequence', css_class_name: 'begin-sequence')
23
- arr = post_type.arrangement_styles.create(display_name: 'Image Right', view_file_name: 'image-right')
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
- post_type_id: post_type.id, free_form_section_id: free_form_section.id,
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.post_type_id).to eq post_type.id
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
- patch pulitzer.partial_path id: partial.id, partial: {post_type_id: other_post_type.id}
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(:post_type_content_element_type) {post_type.post_type_content_element_types.create label: 'Action Button', content_element_type_id: cet.id}
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
- post_type_id: post_type.id,
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.post_type_id).to eq post_type.id
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
- post_type_id: post_type.id,
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.post_type_id).to eq post_type.id
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
- post_type_id: post_type.id,
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.post_type_id).to eq post_type.id
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
- post_type_id: post_type.id,
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.post_type_id).to eq post_type.id
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