pulitzer 0.3.9 → 0.4.0

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.
Files changed (250) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/stylesheets/pulitzer.scss +10 -1
  3. data/app/controllers/pulitzer/content_elements_controller.rb +0 -12
  4. data/app/controllers/pulitzer/free_form_section_types_controller.rb +48 -0
  5. data/app/controllers/pulitzer/layouts_controller.rb +43 -0
  6. data/app/controllers/pulitzer/partials_controller.rb +52 -0
  7. data/app/interactions/pulitzer/clone_version.rb +10 -0
  8. data/app/interactions/pulitzer/create_partial_content_elements.rb +20 -0
  9. data/app/interactions/pulitzer/create_post_content_elements.rb +3 -0
  10. data/app/interactions/pulitzer/create_post_type_free_form_sections.rb +17 -0
  11. data/app/interactions/pulitzer/destroy_post_type_free_form_sections.rb +16 -0
  12. data/app/interactions/pulitzer/update_post_type_free_form_sections.rb +17 -0
  13. data/app/models/pulitzer/free_form_section.rb +20 -0
  14. data/app/models/pulitzer/free_form_section_type.rb +7 -0
  15. data/app/models/pulitzer/layout.rb +11 -0
  16. data/app/models/pulitzer/partial.rb +50 -0
  17. data/app/models/pulitzer/post.rb +1 -1
  18. data/app/models/pulitzer/post_type.rb +10 -6
  19. data/app/models/pulitzer/version.rb +10 -1
  20. data/app/views/pulitzer/content_elements/_form.html.erb +1 -1
  21. data/app/views/pulitzer/content_elements/_index.html.erb +1 -16
  22. data/app/views/pulitzer/content_elements/_partial_index.html.erb +5 -0
  23. data/app/views/pulitzer/content_elements/_show.html.erb +1 -1
  24. data/app/views/pulitzer/free_form_section_types/_form.html.erb +8 -0
  25. data/app/views/pulitzer/free_form_section_types/_form_fields.html.erb +2 -0
  26. data/app/views/pulitzer/free_form_section_types/_new.html.erb +7 -0
  27. data/app/views/pulitzer/free_form_section_types/_show.html.erb +9 -0
  28. data/app/views/pulitzer/free_form_section_types/_show_wrapper.html.erb +3 -0
  29. data/app/views/pulitzer/free_form_sections/_index.html.erb +3 -0
  30. data/app/views/pulitzer/free_form_sections/_show.html.erb +2 -0
  31. data/app/views/pulitzer/free_form_sections/_show_wrapper.html.erb +3 -0
  32. data/app/views/pulitzer/layouts/_form.html.erb +8 -0
  33. data/app/views/pulitzer/layouts/_form_fields.html.erb +2 -0
  34. data/app/views/pulitzer/layouts/_new.html.erb +7 -0
  35. data/app/views/pulitzer/layouts/_show.html.erb +9 -0
  36. data/app/views/pulitzer/layouts/_show_wrapper.html.erb +3 -0
  37. data/app/views/pulitzer/partials/_fields.html.erb +2 -0
  38. data/app/views/pulitzer/partials/_form.html.erb +11 -0
  39. data/app/views/pulitzer/partials/_index.html.erb +12 -0
  40. data/app/views/pulitzer/partials/_new.html.erb +16 -0
  41. data/app/views/pulitzer/partials/_show.html.erb +7 -0
  42. data/app/views/pulitzer/partials/_show_wrapper.html.erb +3 -0
  43. data/app/views/pulitzer/post_type_content_element_types/_form_fields.html.erb +4 -4
  44. data/app/views/pulitzer/post_types/_form.html.erb +1 -1
  45. data/app/views/pulitzer/post_types/_form_fields.html.erb +10 -3
  46. data/app/views/pulitzer/post_types/_show.html.erb +27 -6
  47. data/app/views/pulitzer/versions/_edit.html.erb +11 -5
  48. data/config/routes.rb +5 -1
  49. data/db/migrate/20160511192041_create_partials.rb +9 -0
  50. data/db/migrate/20160512214545_add_partial_to_content_element.rb +5 -0
  51. data/db/migrate/20160513153209_create_free_form_section_type.rb +8 -0
  52. data/db/migrate/20160513153214_create_free_form_section.rb +9 -0
  53. data/db/migrate/20160516150237_fix_post_type_kinds.rb +7 -0
  54. data/db/migrate/20160517181706_create_layouts.rb +8 -0
  55. data/db/migrate/20160517182500_add_layout_to_partial.rb +5 -0
  56. data/lib/pulitzer.rb +3 -1
  57. data/lib/pulitzer/version.rb +1 -1
  58. data/spec/controllers/pulitzer/free_form_section_types_controller_spec.rb +45 -0
  59. data/spec/controllers/pulitzer/partials_controller_spec.rb +42 -0
  60. data/spec/dummy/db/development.sqlite3 +0 -0
  61. data/spec/dummy/db/schema.rb +25 -1
  62. data/spec/dummy/db/test.sqlite3 +0 -0
  63. data/spec/dummy/log/development.log +151 -0
  64. data/spec/dummy/log/test.log +49898 -0
  65. data/spec/dummy/public/uploads/tmp/1452811005-24393-0063/sam_and_snow.jpg +0 -0
  66. data/spec/dummy/public/uploads/tmp/1452811005-24393-0063/thumb_sam_and_snow.jpg +0 -0
  67. data/spec/dummy/public/uploads/tmp/1452811173-24792-0199/sam_and_snow.jpg +0 -0
  68. data/spec/dummy/public/uploads/tmp/1452811173-24792-0199/thumb_sam_and_snow.jpg +0 -0
  69. data/spec/dummy/public/uploads/tmp/1453327522-88240-8875/cms_sam_and_snow.jpg +0 -0
  70. data/spec/dummy/public/uploads/tmp/1453327522-88240-8875/sam_and_snow.jpg +0 -0
  71. data/spec/dummy/public/uploads/tmp/1453327522-88240-8875/thumb_sam_and_snow.jpg +0 -0
  72. data/spec/dummy/public/uploads/tmp/1453327846-88664-1819/cms_sam_and_snow.jpg +0 -0
  73. data/spec/dummy/public/uploads/tmp/1453327846-88664-1819/sam_and_snow.jpg +0 -0
  74. data/spec/dummy/public/uploads/tmp/1453327846-88664-1819/thumb_sam_and_snow.jpg +0 -0
  75. data/spec/dummy/public/uploads/tmp/1453327891-88742-0077/cms_sam_and_snow.jpg +0 -0
  76. data/spec/dummy/public/uploads/tmp/1453327891-88742-0077/sam_and_snow.jpg +0 -0
  77. data/spec/dummy/public/uploads/tmp/1453327891-88742-0077/thumb_sam_and_snow.jpg +0 -0
  78. data/spec/dummy/public/uploads/tmp/1453327908-88792-8689/cms_sam_and_snow.jpg +0 -0
  79. data/spec/dummy/public/uploads/tmp/1453327908-88792-8689/sam_and_snow.jpg +0 -0
  80. data/spec/dummy/public/uploads/tmp/1453327908-88792-8689/thumb_sam_and_snow.jpg +0 -0
  81. data/spec/dummy/public/uploads/tmp/1453327942-88859-9073/cms_sam_and_snow.jpg +0 -0
  82. data/spec/dummy/public/uploads/tmp/1453327942-88859-9073/sam_and_snow.jpg +0 -0
  83. data/spec/dummy/public/uploads/tmp/1453327942-88859-9073/thumb_sam_and_snow.jpg +0 -0
  84. data/spec/dummy/public/uploads/tmp/1453328584-89616-8416/cms_sam_and_snow.jpg +0 -0
  85. data/spec/dummy/public/uploads/tmp/1453328584-89616-8416/sam_and_snow.jpg +0 -0
  86. data/spec/dummy/public/uploads/tmp/1453328584-89616-8416/thumb_sam_and_snow.jpg +0 -0
  87. data/spec/dummy/public/uploads/tmp/1453328600-89648-3830/cms_sam_and_snow.jpg +0 -0
  88. data/spec/dummy/public/uploads/tmp/1453328600-89648-3830/sam_and_snow.jpg +0 -0
  89. data/spec/dummy/public/uploads/tmp/1453328600-89648-3830/thumb_sam_and_snow.jpg +0 -0
  90. data/spec/dummy/public/uploads/tmp/1453328621-89685-3083/cms_sam_and_snow.jpg +0 -0
  91. data/spec/dummy/public/uploads/tmp/1453328621-89685-3083/sam_and_snow.jpg +0 -0
  92. data/spec/dummy/public/uploads/tmp/1453328621-89685-3083/thumb_sam_and_snow.jpg +0 -0
  93. data/spec/dummy/public/uploads/tmp/1453328659-89747-3646/cms_sam_and_snow.jpg +0 -0
  94. data/spec/dummy/public/uploads/tmp/1453328659-89747-3646/sam_and_snow.jpg +0 -0
  95. data/spec/dummy/public/uploads/tmp/1453328659-89747-3646/thumb_sam_and_snow.jpg +0 -0
  96. data/spec/dummy/public/uploads/tmp/1453328908-90227-0244/cms_sam_and_snow.jpg +0 -0
  97. data/spec/dummy/public/uploads/tmp/1453328908-90227-0244/sam_and_snow.jpg +0 -0
  98. data/spec/dummy/public/uploads/tmp/1453328908-90227-0244/thumb_sam_and_snow.jpg +0 -0
  99. data/spec/dummy/public/uploads/tmp/1453328976-90335-7466/cms_sam_and_snow.jpg +0 -0
  100. data/spec/dummy/public/uploads/tmp/1453328976-90335-7466/sam_and_snow.jpg +0 -0
  101. data/spec/dummy/public/uploads/tmp/1453328976-90335-7466/thumb_sam_and_snow.jpg +0 -0
  102. data/spec/dummy/public/uploads/tmp/1453329010-90384-7488/cms_sam_and_snow.jpg +0 -0
  103. data/spec/dummy/public/uploads/tmp/1453329010-90384-7488/sam_and_snow.jpg +0 -0
  104. data/spec/dummy/public/uploads/tmp/1453329010-90384-7488/thumb_sam_and_snow.jpg +0 -0
  105. data/spec/dummy/public/uploads/tmp/1453329018-90436-7916/cms_sam_and_snow.jpg +0 -0
  106. data/spec/dummy/public/uploads/tmp/1453329018-90436-7916/sam_and_snow.jpg +0 -0
  107. data/spec/dummy/public/uploads/tmp/1453329018-90436-7916/thumb_sam_and_snow.jpg +0 -0
  108. data/spec/dummy/public/uploads/tmp/1453393083-47505-1178/cms_sam_and_snow.jpg +0 -0
  109. data/spec/dummy/public/uploads/tmp/1453393083-47505-1178/sam_and_snow.jpg +0 -0
  110. data/spec/dummy/public/uploads/tmp/1453393083-47505-1178/thumb_sam_and_snow.jpg +0 -0
  111. data/spec/dummy/public/uploads/tmp/1453393088-47594-1406/cms_sam_and_snow.jpg +0 -0
  112. data/spec/dummy/public/uploads/tmp/1453393088-47594-1406/sam_and_snow.jpg +0 -0
  113. data/spec/dummy/public/uploads/tmp/1453393088-47594-1406/thumb_sam_and_snow.jpg +0 -0
  114. data/spec/dummy/public/uploads/tmp/1453393124-47630-8343/cms_sam_and_snow.jpg +0 -0
  115. data/spec/dummy/public/uploads/tmp/1453393124-47630-8343/sam_and_snow.jpg +0 -0
  116. data/spec/dummy/public/uploads/tmp/1453393124-47630-8343/thumb_sam_and_snow.jpg +0 -0
  117. data/spec/dummy/public/uploads/tmp/1453393148-47674-3845/cms_sam_and_snow.jpg +0 -0
  118. data/spec/dummy/public/uploads/tmp/1453393148-47674-3845/sam_and_snow.jpg +0 -0
  119. data/spec/dummy/public/uploads/tmp/1453393148-47674-3845/thumb_sam_and_snow.jpg +0 -0
  120. data/spec/dummy/public/uploads/tmp/1453393221-47816-8142/cms_sam_and_snow.jpg +0 -0
  121. data/spec/dummy/public/uploads/tmp/1453393221-47816-8142/sam_and_snow.jpg +0 -0
  122. data/spec/dummy/public/uploads/tmp/1453393221-47816-8142/thumb_sam_and_snow.jpg +0 -0
  123. data/spec/dummy/public/uploads/tmp/1453393870-48546-6445/cms_sam_and_snow.jpg +0 -0
  124. data/spec/dummy/public/uploads/tmp/1453393870-48546-6445/sam_and_snow.jpg +0 -0
  125. data/spec/dummy/public/uploads/tmp/1453393870-48546-6445/thumb_sam_and_snow.jpg +0 -0
  126. data/spec/dummy/public/uploads/tmp/1453393926-48624-7189/cms_sam_and_snow.jpg +0 -0
  127. data/spec/dummy/public/uploads/tmp/1453393926-48624-7189/sam_and_snow.jpg +0 -0
  128. data/spec/dummy/public/uploads/tmp/1453393926-48624-7189/thumb_sam_and_snow.jpg +0 -0
  129. data/spec/dummy/public/uploads/tmp/1453393989-48708-0009/cms_sam_and_snow.jpg +0 -0
  130. data/spec/dummy/public/uploads/tmp/1453393989-48708-0009/sam_and_snow.jpg +0 -0
  131. data/spec/dummy/public/uploads/tmp/1453393989-48708-0009/thumb_sam_and_snow.jpg +0 -0
  132. data/spec/dummy/public/uploads/tmp/1453739521-68535-5576/cms_sam_and_snow.jpg +0 -0
  133. data/spec/dummy/public/uploads/tmp/1453739521-68535-5576/sam_and_snow.jpg +0 -0
  134. data/spec/dummy/public/uploads/tmp/1453739521-68535-5576/thumb_sam_and_snow.jpg +0 -0
  135. data/spec/dummy/public/uploads/tmp/1453739650-68698-8068/cms_sam_and_snow.jpg +0 -0
  136. data/spec/dummy/public/uploads/tmp/1453739650-68698-8068/sam_and_snow.jpg +0 -0
  137. data/spec/dummy/public/uploads/tmp/1453739650-68698-8068/thumb_sam_and_snow.jpg +0 -0
  138. data/spec/dummy/public/uploads/tmp/1453740957-70195-5923/cms_sam_and_snow.jpg +0 -0
  139. data/spec/dummy/public/uploads/tmp/1453740957-70195-5923/sam_and_snow.jpg +0 -0
  140. data/spec/dummy/public/uploads/tmp/1453740957-70195-5923/thumb_sam_and_snow.jpg +0 -0
  141. data/spec/dummy/public/uploads/tmp/1453741054-70338-5984/cms_sam_and_snow.jpg +0 -0
  142. data/spec/dummy/public/uploads/tmp/1453741054-70338-5984/sam_and_snow.jpg +0 -0
  143. data/spec/dummy/public/uploads/tmp/1453741054-70338-5984/thumb_sam_and_snow.jpg +0 -0
  144. data/spec/dummy/public/uploads/tmp/1453741100-70403-3570/cms_sam_and_snow.jpg +0 -0
  145. data/spec/dummy/public/uploads/tmp/1453741100-70403-3570/sam_and_snow.jpg +0 -0
  146. data/spec/dummy/public/uploads/tmp/1453741100-70403-3570/thumb_sam_and_snow.jpg +0 -0
  147. data/spec/dummy/public/uploads/tmp/1453741119-70445-1368/cms_sam_and_snow.jpg +0 -0
  148. data/spec/dummy/public/uploads/tmp/1453741119-70445-1368/sam_and_snow.jpg +0 -0
  149. data/spec/dummy/public/uploads/tmp/1453741119-70445-1368/thumb_sam_and_snow.jpg +0 -0
  150. data/spec/dummy/public/uploads/tmp/1453741152-70510-7020/cms_sam_and_snow.jpg +0 -0
  151. data/spec/dummy/public/uploads/tmp/1453741152-70510-7020/sam_and_snow.jpg +0 -0
  152. data/spec/dummy/public/uploads/tmp/1453741152-70510-7020/thumb_sam_and_snow.jpg +0 -0
  153. data/spec/dummy/public/uploads/tmp/1453741165-70539-8838/cms_sam_and_snow.jpg +0 -0
  154. data/spec/dummy/public/uploads/tmp/1453741165-70539-8838/sam_and_snow.jpg +0 -0
  155. data/spec/dummy/public/uploads/tmp/1453741165-70539-8838/thumb_sam_and_snow.jpg +0 -0
  156. data/spec/dummy/public/uploads/tmp/1453741192-70601-8114/cms_sam_and_snow.jpg +0 -0
  157. data/spec/dummy/public/uploads/tmp/1453741192-70601-8114/sam_and_snow.jpg +0 -0
  158. data/spec/dummy/public/uploads/tmp/1453741192-70601-8114/thumb_sam_and_snow.jpg +0 -0
  159. data/spec/dummy/public/uploads/tmp/1453741252-70701-6629/cms_sam_and_snow.jpg +0 -0
  160. data/spec/dummy/public/uploads/tmp/1453741252-70701-6629/sam_and_snow.jpg +0 -0
  161. data/spec/dummy/public/uploads/tmp/1453741252-70701-6629/thumb_sam_and_snow.jpg +0 -0
  162. data/spec/dummy/public/uploads/tmp/1454010788-22795-5507/cms_sam_and_snow.jpg +0 -0
  163. data/spec/dummy/public/uploads/tmp/1454010788-22795-5507/sam_and_snow.jpg +0 -0
  164. data/spec/dummy/public/uploads/tmp/1454010788-22795-5507/thumb_sam_and_snow.jpg +0 -0
  165. data/spec/dummy/public/uploads/tmp/1454011239-23492-4674/cms_sam_and_snow.jpg +0 -0
  166. data/spec/dummy/public/uploads/tmp/1454011239-23492-4674/sam_and_snow.jpg +0 -0
  167. data/spec/dummy/public/uploads/tmp/1454011239-23492-4674/thumb_sam_and_snow.jpg +0 -0
  168. data/spec/dummy/public/uploads/tmp/1454011266-23542-4559/cms_sam_and_snow.jpg +0 -0
  169. data/spec/dummy/public/uploads/tmp/1454011266-23542-4559/sam_and_snow.jpg +0 -0
  170. data/spec/dummy/public/uploads/tmp/1454011266-23542-4559/thumb_sam_and_snow.jpg +0 -0
  171. data/spec/dummy/public/uploads/tmp/1463429995-65562-0251/cms_sam_and_snow.jpg +0 -0
  172. data/spec/dummy/public/uploads/tmp/1463429995-65562-0251/sam_and_snow.jpg +0 -0
  173. data/spec/dummy/public/uploads/tmp/1463429995-65562-0251/thumb_sam_and_snow.jpg +0 -0
  174. data/spec/dummy/public/uploads/tmp/1463430043-65638-7727/cms_sam_and_snow.jpg +0 -0
  175. data/spec/dummy/public/uploads/tmp/1463430043-65638-7727/sam_and_snow.jpg +0 -0
  176. data/spec/dummy/public/uploads/tmp/1463430043-65638-7727/thumb_sam_and_snow.jpg +0 -0
  177. data/spec/dummy/public/uploads/tmp/1463432105-68023-3063/cms_sam_and_snow.jpg +0 -0
  178. data/spec/dummy/public/uploads/tmp/1463432105-68023-3063/sam_and_snow.jpg +0 -0
  179. data/spec/dummy/public/uploads/tmp/1463432105-68023-3063/thumb_sam_and_snow.jpg +0 -0
  180. data/spec/dummy/public/uploads/tmp/1463432295-68282-2138/cms_sam_and_snow.jpg +0 -0
  181. data/spec/dummy/public/uploads/tmp/1463432295-68282-2138/sam_and_snow.jpg +0 -0
  182. data/spec/dummy/public/uploads/tmp/1463432295-68282-2138/thumb_sam_and_snow.jpg +0 -0
  183. data/spec/dummy/public/uploads/tmp/1463432657-68730-3477/cms_sam_and_snow.jpg +0 -0
  184. data/spec/dummy/public/uploads/tmp/1463432657-68730-3477/sam_and_snow.jpg +0 -0
  185. data/spec/dummy/public/uploads/tmp/1463432657-68730-3477/thumb_sam_and_snow.jpg +0 -0
  186. data/spec/dummy/public/uploads/tmp/1463432704-68798-5985/cms_sam_and_snow.jpg +0 -0
  187. data/spec/dummy/public/uploads/tmp/1463432704-68798-5985/sam_and_snow.jpg +0 -0
  188. data/spec/dummy/public/uploads/tmp/1463432704-68798-5985/thumb_sam_and_snow.jpg +0 -0
  189. data/spec/dummy/public/uploads/tmp/1463432882-69024-4017/cms_sam_and_snow.jpg +0 -0
  190. data/spec/dummy/public/uploads/tmp/1463432882-69024-4017/sam_and_snow.jpg +0 -0
  191. data/spec/dummy/public/uploads/tmp/1463432882-69024-4017/thumb_sam_and_snow.jpg +0 -0
  192. data/spec/dummy/public/uploads/tmp/1463432913-69082-5884/cms_sam_and_snow.jpg +0 -0
  193. data/spec/dummy/public/uploads/tmp/1463432913-69082-5884/sam_and_snow.jpg +0 -0
  194. data/spec/dummy/public/uploads/tmp/1463432913-69082-5884/thumb_sam_and_snow.jpg +0 -0
  195. data/spec/dummy/public/uploads/tmp/1463442041-78001-4031/cms_sam_and_snow.jpg +0 -0
  196. data/spec/dummy/public/uploads/tmp/1463442041-78001-4031/sam_and_snow.jpg +0 -0
  197. data/spec/dummy/public/uploads/tmp/1463442041-78001-4031/thumb_sam_and_snow.jpg +0 -0
  198. data/spec/dummy/public/uploads/tmp/1463442140-78140-3268/cms_sam_and_snow.jpg +0 -0
  199. data/spec/dummy/public/uploads/tmp/1463442140-78140-3268/sam_and_snow.jpg +0 -0
  200. data/spec/dummy/public/uploads/tmp/1463442140-78140-3268/thumb_sam_and_snow.jpg +0 -0
  201. data/spec/dummy/public/uploads/tmp/1463442186-78198-7364/cms_sam_and_snow.jpg +0 -0
  202. data/spec/dummy/public/uploads/tmp/1463442186-78198-7364/sam_and_snow.jpg +0 -0
  203. data/spec/dummy/public/uploads/tmp/1463442186-78198-7364/thumb_sam_and_snow.jpg +0 -0
  204. data/spec/dummy/public/uploads/tmp/1463442776-78848-1943/cms_sam_and_snow.jpg +0 -0
  205. data/spec/dummy/public/uploads/tmp/1463442776-78848-1943/sam_and_snow.jpg +0 -0
  206. data/spec/dummy/public/uploads/tmp/1463442776-78848-1943/thumb_sam_and_snow.jpg +0 -0
  207. data/spec/dummy/public/uploads/tmp/1463442832-78935-6772/cms_sam_and_snow.jpg +0 -0
  208. data/spec/dummy/public/uploads/tmp/1463442832-78935-6772/sam_and_snow.jpg +0 -0
  209. data/spec/dummy/public/uploads/tmp/1463442832-78935-6772/thumb_sam_and_snow.jpg +0 -0
  210. data/spec/dummy/public/uploads/tmp/1463442860-78978-8181/cms_sam_and_snow.jpg +0 -0
  211. data/spec/dummy/public/uploads/tmp/1463442860-78978-8181/sam_and_snow.jpg +0 -0
  212. data/spec/dummy/public/uploads/tmp/1463442860-78978-8181/thumb_sam_and_snow.jpg +0 -0
  213. data/spec/dummy/public/uploads/tmp/1463443482-79702-8123/cms_sam_and_snow.jpg +0 -0
  214. data/spec/dummy/public/uploads/tmp/1463443482-79702-8123/sam_and_snow.jpg +0 -0
  215. data/spec/dummy/public/uploads/tmp/1463443482-79702-8123/thumb_sam_and_snow.jpg +0 -0
  216. data/spec/dummy/public/uploads/tmp/1463443627-79922-4880/cms_sam_and_snow.jpg +0 -0
  217. data/spec/dummy/public/uploads/tmp/1463443627-79922-4880/sam_and_snow.jpg +0 -0
  218. data/spec/dummy/public/uploads/tmp/1463443627-79922-4880/thumb_sam_and_snow.jpg +0 -0
  219. data/spec/dummy/public/uploads/tmp/1463443847-80184-3453/cms_sam_and_snow.jpg +0 -0
  220. data/spec/dummy/public/uploads/tmp/1463443847-80184-3453/sam_and_snow.jpg +0 -0
  221. data/spec/dummy/public/uploads/tmp/1463443847-80184-3453/thumb_sam_and_snow.jpg +0 -0
  222. data/spec/dummy/public/uploads/tmp/1463444011-80461-3483/cms_sam_and_snow.jpg +0 -0
  223. data/spec/dummy/public/uploads/tmp/1463444011-80461-3483/sam_and_snow.jpg +0 -0
  224. data/spec/dummy/public/uploads/tmp/1463444011-80461-3483/thumb_sam_and_snow.jpg +0 -0
  225. data/spec/dummy/public/uploads/tmp/1463500404-81001-9924/cms_sam_and_snow.jpg +0 -0
  226. data/spec/dummy/public/uploads/tmp/1463500404-81001-9924/sam_and_snow.jpg +0 -0
  227. data/spec/dummy/public/uploads/tmp/1463500404-81001-9924/thumb_sam_and_snow.jpg +0 -0
  228. data/spec/dummy/public/uploads/tmp/1463500762-81388-3536/cms_sam_and_snow.jpg +0 -0
  229. data/spec/dummy/public/uploads/tmp/1463500762-81388-3536/sam_and_snow.jpg +0 -0
  230. data/spec/dummy/public/uploads/tmp/1463500762-81388-3536/thumb_sam_and_snow.jpg +0 -0
  231. data/spec/dummy/public/uploads/tmp/1463500770-81454-6155/cms_sam_and_snow.jpg +0 -0
  232. data/spec/dummy/public/uploads/tmp/1463500770-81454-6155/sam_and_snow.jpg +0 -0
  233. data/spec/dummy/public/uploads/tmp/1463500770-81454-6155/thumb_sam_and_snow.jpg +0 -0
  234. data/spec/dummy/public/uploads/tmp/1463500842-81525-6615/cms_sam_and_snow.jpg +0 -0
  235. data/spec/dummy/public/uploads/tmp/1463500842-81525-6615/sam_and_snow.jpg +0 -0
  236. data/spec/dummy/public/uploads/tmp/1463500842-81525-6615/thumb_sam_and_snow.jpg +0 -0
  237. data/spec/dummy/public/uploads/tmp/1463500982-81717-1186/cms_sam_and_snow.jpg +0 -0
  238. data/spec/dummy/public/uploads/tmp/1463500982-81717-1186/sam_and_snow.jpg +0 -0
  239. data/spec/dummy/public/uploads/tmp/1463500982-81717-1186/thumb_sam_and_snow.jpg +0 -0
  240. data/spec/dummy/public/uploads/tmp/1463607059-57999-0085/cms_sam_and_snow.jpg +0 -0
  241. data/spec/dummy/public/uploads/tmp/1463607059-57999-0085/sam_and_snow.jpg +0 -0
  242. data/spec/dummy/public/uploads/tmp/1463607059-57999-0085/thumb_sam_and_snow.jpg +0 -0
  243. data/spec/factories/post_type.rb +8 -0
  244. data/spec/factories/version.rb +8 -0
  245. data/spec/interactions/clone_version_spec.rb +8 -0
  246. data/spec/interactions/create_partial_content_elements_spec.rb +16 -0
  247. data/spec/interactions/create_post_content_elements_spec.rb +9 -0
  248. data/spec/models/post_type_spec.rb +1 -1
  249. metadata +449 -42
  250. data/app/views/pulitzer/content_elements/_new.html.erb +0 -25
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6626f6ea526448f17b909ab61340394f6d5839c8
4
- data.tar.gz: e0939b39e49365ed485b2071e45604c64e0ee31d
3
+ metadata.gz: 54fd0fa0136f609b34b98862ed71797feee860fd
4
+ data.tar.gz: 075af04a1bbb69e1ec3046d0c62450f5ce026980
5
5
  SHA512:
6
- metadata.gz: d0f2344498517ab18cbb693a6500373db5d997bf84ad2282bbc15c89397814280880a70819ca1f056a221e4b7f7713cd990c0c33063271a7650c025d4c6eb2ae
7
- data.tar.gz: f62ca1a52b775aa89a26bde635104042e3be6e2365e20e6ce212b70a392c3811ee1e37c2aa624a696fc973ac371e694bf6cf567a0cd5ec4ecf6cbd33fd97750f
6
+ metadata.gz: 4b0377b9dc7d0334585a9ec5ab4ee10b71b08feef1b955bd602ce2605fff6d1248c4efa6a1506f7a57ef26e54f93e37bed9dbe1c45efc5e8ee956811d1d1dcf4
7
+ data.tar.gz: 2be9075b5238485db8ec72ecc48428682621aadff8a6382b7e6b7bd80844bc8fd1c63baf960486fe154c82044ee8f235f0e0b4dbdff30a41dba0606a436e8ebb
@@ -71,6 +71,9 @@ body {
71
71
  float: left;
72
72
  margin-top: 8px;
73
73
  }
74
+ .pulitzer-indent{
75
+ margin-left: 40px;
76
+ }
74
77
  a {
75
78
  color: #32638a;
76
79
  text-decoration: none;
@@ -135,6 +138,13 @@ body {
135
138
  display: inline-block;
136
139
  width: 5px;
137
140
  }
141
+ &.match-h5{
142
+ line-height: 20px;
143
+ margin: 10px 0;
144
+ }
145
+ &.margin {
146
+ margin-right: 1em;
147
+ }
138
148
  }
139
149
  .pulitzer-hidden{
140
150
  display: none;
@@ -170,7 +180,6 @@ body {
170
180
  }
171
181
  }
172
182
 
173
-
174
183
  // wysihtml5
175
184
  .wysihtml5-sandbox {
176
185
  width: 100% !important;
@@ -1,18 +1,6 @@
1
1
  class Pulitzer::ContentElementsController < Pulitzer::ApplicationController
2
2
  before_filter :set_content_element, only: [:show, :edit, :update]
3
3
 
4
- def new
5
- @version = Pulitzer::Version.find params[:version_id]
6
- @content_element = @version.content_elements.build
7
- render partial: 'new', locals: { content_element: @content_element, version: @version }
8
- end
9
-
10
- def create
11
- @version = Pulitzer::Version.find content_element_params[:version_id]
12
- @content_element = @version.content_elements.create content_element_params.merge(ensure_unique: true)
13
- render partial: 'show_wrapper', locals: { content_element: @content_element }
14
- end
15
-
16
4
  def show
17
5
  render partial: 'show', locals: { content_element: @content_element }
18
6
  end
@@ -0,0 +1,48 @@
1
+ class Pulitzer::FreeFormSectionTypesController < Pulitzer::ApplicationController
2
+ before_filter :get_ffst, only: [:show, :edit, :update, :destroy]
3
+
4
+ def new
5
+ @post_type = Pulitzer::PostType.find(params[:post_type_id])
6
+ @ffst = @post_type.free_form_section_types.build
7
+ render partial: 'new', locals: {ffst: @ffst}
8
+ end
9
+
10
+ def create
11
+ @post_type = Pulitzer::PostType.find(ffst_params[:post_type_id])
12
+ @ffst = @post_type.free_form_section_types.create(ffst_params)
13
+ Pulitzer::CreatePostTypeFreeFormSections.new(@ffst).call
14
+ render partial: 'show_wrapper', locals: {ffst: @ffst}
15
+ end
16
+
17
+ def show
18
+ render partial: 'show', locals: {ffst: @ffst}
19
+ end
20
+
21
+ def edit
22
+ render partial: 'form', locals: {ffst: @ffst}
23
+ end
24
+
25
+ def update
26
+ old_label = @ffst.name
27
+ @ffst.update_attributes(ffst_params)
28
+ Pulitzer::UpdatePostTypeFreeFormSections.new(@ffst, old_label).call
29
+ render partial: 'show', locals: {ffst: @ffst}
30
+ end
31
+
32
+ def destroy
33
+ @ffst.destroy
34
+ Pulitzer::DestroyPostTypeFreeFormSections.new(@ffst).call
35
+ render nothing: true
36
+ end
37
+
38
+ protected
39
+
40
+ def get_ffst
41
+ @ffst = Pulitzer::FreeFormSectionType.find(params[:id])
42
+ end
43
+
44
+ def ffst_params
45
+ params[:free_form_section_type].permit!
46
+ end
47
+
48
+ end
@@ -0,0 +1,43 @@
1
+ class Pulitzer::LayoutsController < Pulitzer::ApplicationController
2
+ before_filter :get_layout, only: [:show, :edit, :update, :destroy]
3
+
4
+ def new
5
+ @layout = Pulitzer::Layout.new(layout_params)
6
+ @post_type = @layout.post_type
7
+ render partial: 'new', locals: {layout: @layout}
8
+ end
9
+
10
+ def create
11
+ @layout = Pulitzer::Layout.create(layout_params)
12
+ render partial: 'show_wrapper', locals: {layout: @layout}
13
+ end
14
+
15
+ def show
16
+ render partial: 'show', locals: {layout: @layout}
17
+ end
18
+
19
+ def edit
20
+ render partial: 'form', locals: {layout: @layout}
21
+ end
22
+
23
+ def update
24
+ @layout.update_attributes(layout_params)
25
+ render partial: 'show', locals: {layout: @layout}
26
+ end
27
+
28
+ def destroy
29
+ @layout.destroy
30
+ render nothing: true
31
+ end
32
+
33
+ protected
34
+
35
+ def get_layout
36
+ @layout = Pulitzer::Layout.find(params[:id])
37
+ end
38
+
39
+ def layout_params
40
+ params[:layout].permit!
41
+ end
42
+
43
+ end
@@ -0,0 +1,52 @@
1
+ class Pulitzer::PartialsController < Pulitzer::ApplicationController
2
+ before_filter :set_partial, only: [:show, :edit, :update]
3
+
4
+ def new
5
+ @partial = Pulitzer::Partial.new(partial_params)
6
+ @free_form_section = @partial.free_form_section
7
+ render partial: 'new', locals: { partial: @partial }
8
+ end
9
+
10
+ def create
11
+ @free_form_section = Pulitzer::FreeFormSection.find partial_params[:free_form_section_id]
12
+ @partial = @free_form_section.partials.create partial_params
13
+ if @partial && @partial.errors.empty?
14
+ Pulitzer::CreatePartialContentElements.new(@partial).call
15
+ render partial: 'show_wrapper', locals: { partial: @partial }
16
+ else
17
+ render partial: 'new', locals: {partial: @partial}
18
+ end
19
+ end
20
+
21
+ def show
22
+ render partial: 'show', locals: { partial: @partial }
23
+ end
24
+
25
+ def edit
26
+ render partial: 'form', locals: { partial: @partial }
27
+ end
28
+
29
+ def update
30
+ @partial.update partial_params
31
+ render partial: 'show', locals: { partial: @partial }
32
+ end
33
+
34
+ def update_all
35
+ partials = Pulitzer::Partial.find params[:partial]
36
+ partials.each do |ce|
37
+ new_sort_order = params[:partial].index(ce.id.to_s)
38
+ ce.update_attribute(:sort_order, new_sort_order)
39
+ end
40
+ render nothing: true
41
+ end
42
+
43
+ protected
44
+
45
+ def partial_params
46
+ params[:partial].permit!
47
+ end
48
+
49
+ def set_partial
50
+ @partial = Pulitzer::Partial.find(params[:id])
51
+ end
52
+ end
@@ -22,6 +22,16 @@ class Pulitzer::CloneVersion
22
22
  new_version.processed_element_count += 1
23
23
  new_version.broadcast_change if defined? ForeignOffice
24
24
  end
25
+ @version.free_form_sections.each do |ffs|
26
+ begin
27
+ cloned_ffs = ffs.clone_me
28
+ new_version.free_form_sections << cloned_ffs
29
+ rescue ActiveRecord::RecordInvalid => invalid
30
+ cloning_errors.push "Free Form Section #{ffs.id} could not be cloned: #{invalid.record.errors.full_messages.join(', ')}"
31
+ end
32
+ new_version.processed_element_count += 1
33
+ new_version.broadcast_change if defined? ForeignOffice
34
+ end
25
35
  @version.post_tags.each do |pt|
26
36
  new_version.post_tags << pt.clone_me
27
37
  new_version.processed_element_count += 1
@@ -0,0 +1,20 @@
1
+ class Pulitzer::CreatePartialContentElements
2
+ attr_accessor :partial
3
+
4
+ def initialize(partial)
5
+ self.partial = partial
6
+ end
7
+
8
+ def call
9
+ partial.post_type_content_element_types.each do |cet|
10
+ partial.content_elements.create do |ce|
11
+ ce.label = cet.label
12
+ ce.height = cet.height
13
+ ce.width = cet.width
14
+ ce.text_editor = cet.text_editor
15
+ ce.content_element_type = cet.content_element_type
16
+ ce.post_type_content_element_type = cet
17
+ end
18
+ end
19
+ end
20
+ end
@@ -16,5 +16,8 @@ class Pulitzer::CreatePostContentElements
16
16
  ce.post_type_content_element_type = cet
17
17
  end
18
18
  end
19
+ post.free_form_section_types.each do |ffst|
20
+ post.preview_version.free_form_sections.create name: ffst.name
21
+ end
19
22
  end
20
23
  end
@@ -0,0 +1,17 @@
1
+ class Pulitzer::CreatePostTypeFreeFormSections
2
+ attr_accessor :post_type, :ffst, :old_label
3
+
4
+ def initialize(ffst)
5
+ self.post_type = ffst.post_type
6
+ self.ffst = ffst
7
+ end
8
+
9
+ def call
10
+ post_type.posts.each do |post|
11
+ post.preview_version.free_form_sections.create do |ffs|
12
+ ffs.name = ffst.name
13
+ ffs.free_form_section_type = ffst
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,16 @@
1
+ class Pulitzer::DestroyPostTypeFreeFormSections
2
+ attr_accessor :post_type, :ffst
3
+
4
+ def initialize(ffst)
5
+ self.post_type = ffst.post_type
6
+ self.ffst = ffst
7
+ end
8
+
9
+ def call
10
+ post_type.posts.each do |post|
11
+ post.preview_version.free_form_sections.where(free_form_section_type_id: ffst.id).each do |ffs|
12
+ ffs.destroy
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,17 @@
1
+ class Pulitzer::UpdatePostTypeFreeFormSections
2
+ attr_accessor :post_type, :ffst, :old_label
3
+
4
+ def initialize(ffst, old_label=nil)
5
+ self.post_type = ffst.post_type
6
+ self.ffst = ffst
7
+ self.old_label = old_label || ffst.label
8
+ end
9
+
10
+ def call
11
+ post_type.posts.each do |post|
12
+ post.preview_version.free_form_sections.where(free_form_section_type_id: ffst.id).each do |ffs|
13
+ ffs.update(name: ffst.name)
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,20 @@
1
+ module Pulitzer
2
+ class FreeFormSection < ActiveRecord::Base
3
+ belongs_to :version
4
+ belongs_to :free_form_section_type
5
+ has_many :partials
6
+
7
+ def clone_me
8
+ clone_attrs = self.attributes.dup
9
+ clone_attrs.delete 'id'
10
+ clone_attrs.delete 'version_id'
11
+
12
+ my_clone = Pulitzer::FreeFormSection.create!(clone_attrs)
13
+ partials.each do |partial|
14
+ cloned_partial = partial.clone_me
15
+ my_clone.partials << cloned_partial
16
+ end
17
+ my_clone
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,7 @@
1
+ module Pulitzer
2
+ class FreeFormSectionType < ActiveRecord::Base
3
+ belongs_to :post_type
4
+ has_many :free_form_sections
5
+
6
+ end
7
+ end
@@ -0,0 +1,11 @@
1
+ module Pulitzer
2
+ class Layout < ActiveRecord::Base
3
+ has_many :partials
4
+ belongs_to :post_type
5
+ validates :name, presence: true
6
+
7
+ def template_path
8
+ name.downcase.gsub(/ /,'_').gsub(/\W/,'')
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,50 @@
1
+ module Pulitzer
2
+ class Partial < ActiveRecord::Base
3
+ belongs_to :free_form_section
4
+ belongs_to :post_type
5
+ belongs_to :layout
6
+
7
+ has_many :content_elements, dependent: :destroy
8
+
9
+ delegate :name, :post_type_content_element_types, to: :post_type
10
+ delegate :template_path, to: :layout, allow_nil: true
11
+
12
+ before_save :handle_sort_order
13
+
14
+ def content_element(label)
15
+ self.content_elements.find_by(label: label)
16
+ end
17
+
18
+ def handle_sort_order
19
+ if new_record? && sort_order.nil?
20
+ self.sort_order = free_form_section.partials.maximum(:sort_order).to_i + 1
21
+ end
22
+ end
23
+
24
+ def available_layouts
25
+ post_type.layouts
26
+ end
27
+
28
+ def folder_path
29
+ name.downcase.gsub(/ /,'_').gsub(/\W/,'')
30
+ end
31
+
32
+ def full_view_path
33
+ Pulitzer.partial_folder + folder_path + '/' + template_path
34
+ end
35
+
36
+ def clone_me
37
+ clone_attrs = self.attributes.dup
38
+ clone_attrs.delete 'id'
39
+ clone_attrs.delete 'free_form_section_id'
40
+
41
+ my_clone = Pulitzer::Partial.create!(clone_attrs)
42
+ content_elements.each do |ce|
43
+ cloned_content_element = ce.clone_me
44
+ my_clone.content_elements << cloned_content_element
45
+ end
46
+ my_clone
47
+ end
48
+
49
+ end
50
+ end
@@ -4,7 +4,7 @@ module Pulitzer
4
4
  extend ::FriendlyId
5
5
  has_many :versions
6
6
  belongs_to :post_type
7
- delegate :post_type_content_element_types, :allow_free_form?, to: :post_type
7
+ delegate :post_type_content_element_types, :free_form_section_types, :has_free_form_sections?, :has_templated_content_elements?, to: :post_type
8
8
  delegate :content_elements, :post_tags, :has_label_type, :has_label, :post_tags_for, to: :active_version, allow_nil: true
9
9
  friendly_id :title, use: [:slugged, :finders]
10
10
  after_create :create_preview_version
@@ -1,9 +1,12 @@
1
1
  class Pulitzer::PostType < ActiveRecord::Base
2
- enum kind: [ :template, :free_form, :hybrid ]
2
+ enum kind: [ :template, :partial ]
3
3
  has_many :posts, dependent: :destroy
4
4
  has_many :post_type_content_element_types, dependent: :destroy
5
5
  has_many :content_element_types, through: :post_type_content_element_types
6
-
6
+ has_many :free_form_section_types, dependent: :destroy
7
+ has_many :layouts, dependent: :destroy
8
+
9
+ scope :partials, -> { where(kind: Pulitzer::PostType.kinds[:partial])}
7
10
  validates :name, :kind, presence: true
8
11
  validates :plural, :inclusion => { :in => [true, false] }
9
12
 
@@ -23,11 +26,12 @@ class Pulitzer::PostType < ActiveRecord::Base
23
26
  !!singleton_post
24
27
  end
25
28
 
26
- def allow_template?
27
- template? || hybrid?
29
+ def has_templated_content_elements?
30
+ content_element_types.any?
28
31
  end
29
32
 
30
- def allow_free_form?
31
- free_form? || hybrid?
33
+ def has_free_form_sections?
34
+ free_form_section_types.any?
32
35
  end
36
+
33
37
  end