pwb 1.0.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (367) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/app/assets/javascripts/comfy/admin/cms/custom.js.coffee +1 -0
  4. data/app/assets/stylesheets/comfy/admin/cms/custom.sass +1 -0
  5. data/app/assets/stylesheets/pwb/themes/berlin/inmo.scss +6 -1
  6. data/app/assets/stylesheets/pwb/themes/berlin/main.scss +12 -11
  7. data/app/assets/stylesheets/pwb/themes/default/shame.scss +1 -1
  8. data/app/controllers/pwb/admin_panel_controller.rb +2 -2
  9. data/app/controllers/pwb/api/v1/cms_pages_controller.rb +102 -0
  10. data/app/controllers/pwb/api/v1/website_controller.rb +7 -0
  11. data/app/controllers/pwb/api_public/v1/props_controller.rb +2 -2
  12. data/app/controllers/pwb/application_api_controller.rb +3 -7
  13. data/app/controllers/pwb/application_controller.rb +2 -3
  14. data/app/controllers/pwb/comfy_controller.rb +106 -0
  15. data/app/controllers/pwb/css_controller.rb +1 -2
  16. data/app/controllers/pwb/devise/registrations_controller.rb +2 -5
  17. data/app/controllers/pwb/devise_controller.rb +3 -8
  18. data/app/controllers/pwb/export/properties_controller.rb +5 -6
  19. data/app/controllers/pwb/export/translations_controller.rb +1 -5
  20. data/app/controllers/pwb/export/web_contents_controller.rb +1 -4
  21. data/app/controllers/pwb/export/website_controller.rb +0 -1
  22. data/app/controllers/pwb/import/mls_controller.rb +3 -6
  23. data/app/controllers/pwb/import/properties_controller.rb +2 -4
  24. data/app/controllers/pwb/import/scrapper_controller.rb +6 -9
  25. data/app/controllers/pwb/props_controller.rb +10 -13
  26. data/app/controllers/pwb/search_controller.rb +16 -16
  27. data/app/controllers/pwb/sections_controller.rb +21 -22
  28. data/app/controllers/pwb/welcome_controller.rb +1 -2
  29. data/app/helpers/pwb/application_helper.rb +37 -0
  30. data/app/helpers/pwb/css_helper.rb +9 -0
  31. data/app/models/pwb/cms_page_container.rb +9 -0
  32. data/app/models/pwb/content.rb +10 -6
  33. data/app/models/pwb/prop.rb +12 -4
  34. data/app/models/pwb/section.rb +1 -1
  35. data/app/models/pwb/website.rb +14 -1
  36. data/app/resources/pwb/api/v1/cms_block_resource.rb +11 -0
  37. data/app/resources/pwb/api/v1/cms_page_resource.rb +27 -0
  38. data/app/themes/berlin/views/layouts/pwb/application.html.erb +25 -9
  39. data/app/themes/berlin/views/pwb/props/show.html.erb +5 -5
  40. data/app/themes/berlin/views/pwb/search/_search_results.html.erb +2 -1
  41. data/app/themes/berlin/views/pwb/search/buy.html.erb +1 -1
  42. data/app/themes/berlin/views/pwb/search/rent.html.erb +2 -1
  43. data/app/themes/berlin/views/pwb/sections/about_us.html.erb +3 -2
  44. data/app/themes/berlin/views/pwb/sections/cms.html.erb +34 -0
  45. data/app/themes/berlin/views/pwb/sections/contact_us.html.erb +2 -1
  46. data/app/themes/berlin/views/pwb/welcome/_about_us_to_del.html.erb +35 -0
  47. data/app/themes/berlin/views/pwb/welcome/{_adv_search.html.erb → _adv_search_to_del.html.erb} +0 -0
  48. data/app/themes/berlin/views/pwb/welcome/_landing_carousel.html.erb +1 -1
  49. data/app/themes/berlin/views/pwb/welcome/_latest_properties.html.erb +2 -1
  50. data/app/themes/default/views/layouts/pwb/application.html.erb +24 -3
  51. data/app/themes/default/views/pwb/sections/about_us.html.erb +1 -2
  52. data/app/themes/default/views/pwb/sections/cms.html.erb +30 -0
  53. data/app/themes/default/views/pwb/welcome/_single_property_row.html.erb +2 -1
  54. data/app/themes/default/views/pwb/welcome/index.html.erb +3 -1
  55. data/app/views/layouts/pwb/devise.html.erb +1 -0
  56. data/app/views/pwb/_analytics.html.erb +15 -0
  57. data/app/views/pwb/_footer.html.erb +0 -12
  58. data/app/views/pwb/custom_css/{berlin.css.erb → _berlin.css.erb} +0 -1
  59. data/app/views/pwb/custom_css/{default.css.erb → _default.css.erb} +0 -1
  60. data/app/views/pwb/custom_css/_shared.css.erb +1 -0
  61. data/app/views/pwb/props/_images_section_carousel.html.erb +13 -27
  62. data/app/views/pwb/props/_prop_info_list.html.erb +1 -1
  63. data/app/views/pwb/search/_search_result_item.html.erb +62 -64
  64. data/app/views/pwb/search/_search_result_item_to_del.html.erb +3 -3
  65. data/config/client_setups/default.json +59 -21
  66. data/config/cms_page_containers/about-us.json +18 -0
  67. data/config/cms_page_containers/about.json +107 -0
  68. data/config/cms_page_containers/landing.json +19 -0
  69. data/config/cms_page_containers/legal.json +17 -0
  70. data/config/cms_page_containers/sell.json +96 -0
  71. data/config/initializers/cloudinary.rb +3 -0
  72. data/config/initializers/comfortable_mexican_sofa.rb +142 -0
  73. data/config/locales/admin.en.yml +213 -0
  74. data/config/locales/admin.es.yml +32 -17
  75. data/config/locales/admin.ru.yml +432 -0
  76. data/config/locales/admin.zh.yml.tmp +226 -0
  77. data/config/locales/de.yml +31 -32
  78. data/config/locales/devise.zh-HK.yml +119 -0
  79. data/config/locales/en.yml +3 -0
  80. data/config/locales/es.yml +3 -5
  81. data/config/locales/rails.zh-HK.yml +210 -0
  82. data/config/locales/ru.yml +11 -11
  83. data/config/locales/zh-HK.yml +154 -0
  84. data/config/routes.rb +17 -2
  85. data/db/cms_fixtures/cms/categories/pages.yml +3 -0
  86. data/db/cms_fixtures/cms/files/_rerenting-landing_framed.png.yml +6 -0
  87. data/{spec/dummy/public/system/comfy/cms/files/files/000/000/003/original → db/cms_fixtures/cms/files}/rerenting-landing_framed.png +0 -0
  88. data/db/cms_fixtures/cms/layouts/about-us/attributes.yml +4 -0
  89. data/db/cms_fixtures/cms/layouts/about-us/content.html +0 -0
  90. data/db/cms_fixtures/cms/layouts/about-us/javascript.js +0 -0
  91. data/db/cms_fixtures/cms/layouts/about-us/people/attributes.yml +4 -0
  92. data/db/cms_fixtures/cms/layouts/about-us/people/content.html +55 -0
  93. data/db/cms_fixtures/cms/layouts/about-us/services/attributes.yml +4 -0
  94. data/db/cms_fixtures/cms/layouts/about-us/services/content.html +32 -0
  95. data/db/cms_fixtures/cms/layouts/about-us/services/javascript.js +0 -0
  96. data/db/cms_fixtures/cms/layouts/about-us/services/stylesheet.css +0 -0
  97. data/db/cms_fixtures/cms/layouts/about-us/stylesheet.css +0 -0
  98. data/db/cms_fixtures/cms/layouts/default-layout/attributes.yml +4 -0
  99. data/db/cms_fixtures/cms/layouts/default-layout/content.html +51 -0
  100. data/db/cms_fixtures/cms/layouts/default-layout/javascript.js +0 -0
  101. data/db/cms_fixtures/cms/layouts/default-layout/stylesheet.css +0 -0
  102. data/db/cms_fixtures/cms/pages/index/about-us/attributes.yml +8 -0
  103. data/db/cms_fixtures/cms/pages/index/about-us/people/attributes.yml +8 -0
  104. data/db/cms_fixtures/cms/pages/index/about-us/people/de/attributes.yml +8 -0
  105. data/db/cms_fixtures/cms/pages/index/about-us/people/de/person_details_a.html +1 -0
  106. data/db/cms_fixtures/cms/pages/index/about-us/people/de/person_details_b.html +1 -0
  107. data/db/cms_fixtures/cms/pages/index/about-us/people/de/person_details_c.html +1 -0
  108. data/db/cms_fixtures/cms/pages/index/about-us/people/de/person_details_d.html +1 -0
  109. data/db/cms_fixtures/cms/pages/index/about-us/people/de/person_img_url_a.html +1 -0
  110. data/db/cms_fixtures/cms/pages/index/about-us/people/de/person_img_url_b.html +1 -0
  111. data/db/cms_fixtures/cms/pages/index/about-us/people/de/person_img_url_c.html +1 -0
  112. data/db/cms_fixtures/cms/pages/index/about-us/people/de/person_img_url_d.html +1 -0
  113. data/db/cms_fixtures/cms/pages/index/about-us/people/de/person_name_a.html +1 -0
  114. data/db/cms_fixtures/cms/pages/index/about-us/people/de/person_name_b.html +1 -0
  115. data/db/cms_fixtures/cms/pages/index/about-us/people/de/person_name_c.html +1 -0
  116. data/db/cms_fixtures/cms/pages/index/about-us/people/de/person_name_d.html +1 -0
  117. data/db/cms_fixtures/cms/pages/index/about-us/people/de/person_title_a.html +1 -0
  118. data/db/cms_fixtures/cms/pages/index/about-us/people/de/person_title_b.html +1 -0
  119. data/db/cms_fixtures/cms/pages/index/about-us/people/de/person_title_c.html +1 -0
  120. data/db/cms_fixtures/cms/pages/index/about-us/people/de/person_title_d.html +1 -0
  121. data/db/cms_fixtures/cms/pages/index/about-us/people/en/attributes.yml +8 -0
  122. data/db/cms_fixtures/cms/pages/index/about-us/people/en/person_details_a.html +1 -0
  123. data/db/cms_fixtures/cms/pages/index/about-us/people/en/person_details_b.html +1 -0
  124. data/db/cms_fixtures/cms/pages/index/about-us/people/en/person_details_c.html +1 -0
  125. data/db/cms_fixtures/cms/pages/index/about-us/people/en/person_details_d.html +1 -0
  126. data/db/cms_fixtures/cms/pages/index/about-us/people/en/person_img_url_a.html +1 -0
  127. data/db/cms_fixtures/cms/pages/index/about-us/people/en/person_img_url_b.html +1 -0
  128. data/db/cms_fixtures/cms/pages/index/about-us/people/en/person_img_url_c.html +1 -0
  129. data/db/cms_fixtures/cms/pages/index/about-us/people/en/person_img_url_d.html +1 -0
  130. data/db/cms_fixtures/cms/pages/index/about-us/people/en/person_name_a.html +1 -0
  131. data/db/cms_fixtures/cms/pages/index/about-us/people/en/person_name_b.html +1 -0
  132. data/db/cms_fixtures/cms/pages/index/about-us/people/en/person_name_c.html +1 -0
  133. data/db/cms_fixtures/cms/pages/index/about-us/people/en/person_name_d.html +1 -0
  134. data/db/cms_fixtures/cms/pages/index/about-us/people/en/person_title_a.html +1 -0
  135. data/db/cms_fixtures/cms/pages/index/about-us/people/en/person_title_b.html +1 -0
  136. data/db/cms_fixtures/cms/pages/index/about-us/people/en/person_title_c.html +1 -0
  137. data/db/cms_fixtures/cms/pages/index/about-us/people/en/person_title_d.html +1 -0
  138. data/db/cms_fixtures/cms/pages/index/about-us/people/es/attributes.yml +8 -0
  139. data/db/cms_fixtures/cms/pages/index/about-us/people/es/person_details_a.html +1 -0
  140. data/db/cms_fixtures/cms/pages/index/about-us/people/es/person_details_b.html +1 -0
  141. data/db/cms_fixtures/cms/pages/index/about-us/people/es/person_details_c.html +1 -0
  142. data/db/cms_fixtures/cms/pages/index/about-us/people/es/person_details_d.html +1 -0
  143. data/db/cms_fixtures/cms/pages/index/about-us/people/es/person_img_url_a.html +1 -0
  144. data/db/cms_fixtures/cms/pages/index/about-us/people/es/person_img_url_b.html +1 -0
  145. data/db/cms_fixtures/cms/pages/index/about-us/people/es/person_img_url_c.html +1 -0
  146. data/db/cms_fixtures/cms/pages/index/about-us/people/es/person_img_url_d.html +1 -0
  147. data/db/cms_fixtures/cms/pages/index/about-us/people/es/person_name_a.html +1 -0
  148. data/db/cms_fixtures/cms/pages/index/about-us/people/es/person_name_b.html +1 -0
  149. data/db/cms_fixtures/cms/pages/index/about-us/people/es/person_name_c.html +1 -0
  150. data/db/cms_fixtures/cms/pages/index/about-us/people/es/person_name_d.html +1 -0
  151. data/db/cms_fixtures/cms/pages/index/about-us/people/es/person_title_a.html +1 -0
  152. data/db/cms_fixtures/cms/pages/index/about-us/people/es/person_title_b.html +1 -0
  153. data/db/cms_fixtures/cms/pages/index/about-us/people/es/person_title_c.html +1 -0
  154. data/db/cms_fixtures/cms/pages/index/about-us/people/es/person_title_d.html +1 -0
  155. data/db/cms_fixtures/cms/pages/index/about-us/people/pt/attributes.yml +8 -0
  156. data/db/cms_fixtures/cms/pages/index/about-us/people/pt/person_details_a.html +1 -0
  157. data/db/cms_fixtures/cms/pages/index/about-us/people/pt/person_details_b.html +1 -0
  158. data/db/cms_fixtures/cms/pages/index/about-us/people/pt/person_details_c.html +1 -0
  159. data/db/cms_fixtures/cms/pages/index/about-us/people/pt/person_details_d.html +1 -0
  160. data/db/cms_fixtures/cms/pages/index/about-us/people/pt/person_name_a.html +1 -0
  161. data/db/cms_fixtures/cms/pages/index/about-us/people/pt/person_name_b.html +1 -0
  162. data/db/cms_fixtures/cms/pages/index/about-us/people/pt/person_name_c.html +1 -0
  163. data/db/cms_fixtures/cms/pages/index/about-us/people/pt/person_name_d.html +1 -0
  164. data/db/cms_fixtures/cms/pages/index/about-us/people/pt/person_title_a.html +1 -0
  165. data/db/cms_fixtures/cms/pages/index/about-us/people/pt/person_title_b.html +1 -0
  166. data/db/cms_fixtures/cms/pages/index/about-us/people/pt/person_title_c.html +1 -0
  167. data/db/cms_fixtures/cms/pages/index/about-us/people/pt/person_title_d.html +1 -0
  168. data/db/cms_fixtures/cms/pages/index/about-us/people/ru/attributes.yml +8 -0
  169. data/db/cms_fixtures/cms/pages/index/about-us/people/ru/person_details_a.html +1 -0
  170. data/db/cms_fixtures/cms/pages/index/about-us/people/ru/person_details_b.html +1 -0
  171. data/db/cms_fixtures/cms/pages/index/about-us/people/ru/person_details_c.html +1 -0
  172. data/db/cms_fixtures/cms/pages/index/about-us/people/ru/person_details_d.html +1 -0
  173. data/db/cms_fixtures/cms/pages/index/about-us/people/ru/person_img_url_a.html +1 -0
  174. data/db/cms_fixtures/cms/pages/index/about-us/people/ru/person_img_url_b.html +1 -0
  175. data/db/cms_fixtures/cms/pages/index/about-us/people/ru/person_img_url_c.html +1 -0
  176. data/db/cms_fixtures/cms/pages/index/about-us/people/ru/person_img_url_d.html +1 -0
  177. data/db/cms_fixtures/cms/pages/index/about-us/people/ru/person_name_a.html +1 -0
  178. data/db/cms_fixtures/cms/pages/index/about-us/people/ru/person_name_b.html +1 -0
  179. data/db/cms_fixtures/cms/pages/index/about-us/people/ru/person_name_c.html +1 -0
  180. data/db/cms_fixtures/cms/pages/index/about-us/people/ru/person_name_d.html +1 -0
  181. data/db/cms_fixtures/cms/pages/index/about-us/people/ru/person_title_a.html +1 -0
  182. data/db/cms_fixtures/cms/pages/index/about-us/people/ru/person_title_b.html +1 -0
  183. data/db/cms_fixtures/cms/pages/index/about-us/people/ru/person_title_c.html +1 -0
  184. data/db/cms_fixtures/cms/pages/index/about-us/people/ru/person_title_d.html +1 -0
  185. data/db/cms_fixtures/cms/pages/index/about-us/services/attributes.yml +8 -0
  186. data/db/cms_fixtures/cms/pages/index/about-us/services/content_a.html +1 -0
  187. data/db/cms_fixtures/cms/pages/index/about-us/services/content_b.html +0 -0
  188. data/db/cms_fixtures/cms/pages/index/about-us/services/content_c.html +0 -0
  189. data/db/cms_fixtures/cms/pages/index/about-us/services/de/attributes.yml +8 -0
  190. data/db/cms_fixtures/cms/pages/index/about-us/services/de/content_a.html +1 -0
  191. data/db/cms_fixtures/cms/pages/index/about-us/services/de/content_b.html +1 -0
  192. data/db/cms_fixtures/cms/pages/index/about-us/services/de/content_c.html +1 -0
  193. data/db/cms_fixtures/cms/pages/index/about-us/services/de/title_a.html +1 -0
  194. data/db/cms_fixtures/cms/pages/index/about-us/services/de/title_b.html +1 -0
  195. data/db/cms_fixtures/cms/pages/index/about-us/services/de/title_c.html +1 -0
  196. data/db/cms_fixtures/cms/pages/index/about-us/services/en/attributes.yml +8 -0
  197. data/db/cms_fixtures/cms/pages/index/about-us/services/en/content_a.html +1 -0
  198. data/db/cms_fixtures/cms/pages/index/about-us/services/en/content_b.html +1 -0
  199. data/db/cms_fixtures/cms/pages/index/about-us/services/en/content_c.html +1 -0
  200. data/db/cms_fixtures/cms/pages/index/about-us/services/en/title_a.html +1 -0
  201. data/db/cms_fixtures/cms/pages/index/about-us/services/en/title_b.html +1 -0
  202. data/db/cms_fixtures/cms/pages/index/about-us/services/en/title_c.html +1 -0
  203. data/db/cms_fixtures/cms/pages/index/about-us/services/es/attributes.yml +8 -0
  204. data/db/cms_fixtures/cms/pages/index/about-us/services/es/content_a.html +1 -0
  205. data/db/cms_fixtures/cms/pages/index/about-us/services/es/content_b.html +1 -0
  206. data/db/cms_fixtures/cms/pages/index/about-us/services/es/content_c.html +1 -0
  207. data/db/cms_fixtures/cms/pages/index/about-us/services/es/title_a.html +1 -0
  208. data/db/cms_fixtures/cms/pages/index/about-us/services/es/title_b.html +1 -0
  209. data/db/cms_fixtures/cms/pages/index/about-us/services/es/title_c.html +1 -0
  210. data/db/cms_fixtures/cms/pages/index/about-us/services/title_a.html +1 -0
  211. data/db/cms_fixtures/cms/pages/index/about-us/services/title_b.html +0 -0
  212. data/db/cms_fixtures/cms/pages/index/about-us/services/title_c.html +0 -0
  213. data/db/cms_fixtures/cms/pages/index/attributes.yml +8 -0
  214. data/db/cms_fixtures/cms/pages/index/content.html +1 -0
  215. data/db/cms_fixtures/cms/pages/index/title.html +0 -0
  216. data/db/cms_fixtures/cms/snippets/snippet1/attributes.yml +3 -0
  217. data/db/cms_fixtures/cms/snippets/snippet1/content.html +1 -0
  218. data/db/cms_fixtures/sample-site/categories/files.yml +1 -0
  219. data/db/cms_fixtures/sample-site/categories/pages.yml +1 -0
  220. data/db/cms_fixtures/sample-site/categories/snippets.yml +1 -0
  221. data/db/cms_fixtures/sample-site/files/_sample.jpg.yml +5 -0
  222. data/db/cms_fixtures/sample-site/files/sample.jpg +0 -0
  223. data/db/cms_fixtures/sample-site/layouts/default/attributes.yml +1 -0
  224. data/db/cms_fixtures/sample-site/layouts/default/content.html +5 -0
  225. data/db/cms_fixtures/sample-site/layouts/default/javascript.js +1 -0
  226. data/db/cms_fixtures/sample-site/layouts/default/nested/attributes.yml +2 -0
  227. data/db/cms_fixtures/sample-site/layouts/default/nested/content.haml +3 -0
  228. data/db/cms_fixtures/sample-site/layouts/default/nested/javascript.js +1 -0
  229. data/db/cms_fixtures/sample-site/layouts/default/nested/stylesheet.css +1 -0
  230. data/db/cms_fixtures/sample-site/layouts/default/stylesheet.css +1 -0
  231. data/db/cms_fixtures/sample-site/pages/index/attributes.yml +6 -0
  232. data/db/cms_fixtures/sample-site/pages/index/child/attributes.yml +3 -0
  233. data/db/cms_fixtures/sample-site/pages/index/child/left.haml +1 -0
  234. data/db/cms_fixtures/sample-site/pages/index/child/right.html +1 -0
  235. data/db/cms_fixtures/sample-site/pages/index/child/thumbnail.png +0 -0
  236. data/db/cms_fixtures/sample-site/pages/index/content.html +2 -0
  237. data/db/cms_fixtures/sample-site/snippets/default/attributes.yml +4 -0
  238. data/db/cms_fixtures/sample-site/snippets/default/content.html +1 -0
  239. data/db/migrate/20170513221300_create_cms.rb +133 -0
  240. data/db/seeds/spain/translations.rb +2 -2
  241. data/db/seeds/translations_ca.rb +92 -0
  242. data/db/seeds/translations_de.rb +86 -85
  243. data/db/seeds/translations_en.rb +73 -73
  244. data/db/seeds/translations_es.rb +79 -78
  245. data/db/seeds/translations_ru.rb +92 -0
  246. data/db/yml_seeds/prop/flat_for_rent.yml +4 -4
  247. data/db/yml_seeds/sections.yml +2 -2
  248. data/db/yml_seeds/website.yml +3 -1
  249. data/lib/pwb/cms_data_loader.rb +38 -0
  250. data/lib/pwb/engine.rb +1 -0
  251. data/lib/pwb/locale_loader.rb +47 -0
  252. data/lib/pwb/seeder.rb +8 -5
  253. data/lib/pwb/version.rb +1 -1
  254. data/lib/tasks/pwb_tasks.rake +1 -0
  255. data/spec/dummy/config/routes.rb +5 -0
  256. data/spec/dummy/config/secrets.yml +5 -0
  257. data/spec/dummy/db/schema.rb +111 -1
  258. data/spec/dummy/log/development.log +0 -0
  259. data/spec/features/pwb/admin_spec.rb +14 -40
  260. data/spec/features/pwb/admin_spec_tmp.rb +54 -0
  261. data/spec/fixtures/to_import/pwb-properties.csv +2 -2
  262. data/spec/views/pwb/application_layout.html.erb_spec.rb +1 -0
  263. metadata +207 -235
  264. data/app/themes/berlin/views/pwb/welcome/_about_us.html.erb +0 -36
  265. data/db/seeds/translations_others.rb +0 -215
  266. data/spec/dummy/public/assets/application-af04b226fd7202dfc532ce7aedb95a0128277937e90d3b3a3d35e1cce9e16886.css +0 -16
  267. data/spec/dummy/public/assets/application-af04b226fd7202dfc532ce7aedb95a0128277937e90d3b3a3d35e1cce9e16886.css.gz +0 -0
  268. data/spec/dummy/public/assets/application-ec8550e416fd8df1557ddb7f132ccd38baaafd36e4c5c9aff8420fbd47c0313f.js +0 -617
  269. data/spec/dummy/public/assets/application-ec8550e416fd8df1557ddb7f132ccd38baaafd36e4c5c9aff8420fbd47c0313f.js.gz +0 -0
  270. data/spec/dummy/public/assets/bootstrap/glyphicons-halflings-regular-13634da87d9e23f8c3ed9108ce1724d183a39ad072e73e1b3d8cbf646d2d0407.eot +0 -0
  271. data/spec/dummy/public/assets/bootstrap/glyphicons-halflings-regular-13634da87d9e23f8c3ed9108ce1724d183a39ad072e73e1b3d8cbf646d2d0407.eot.gz +0 -0
  272. data/spec/dummy/public/assets/bootstrap/glyphicons-halflings-regular-42f60659d265c1a3c30f9fa42abcbb56bd4a53af4d83d316d6dd7a36903c43e5.svg +0 -288
  273. data/spec/dummy/public/assets/bootstrap/glyphicons-halflings-regular-42f60659d265c1a3c30f9fa42abcbb56bd4a53af4d83d316d6dd7a36903c43e5.svg.gz +0 -0
  274. data/spec/dummy/public/assets/bootstrap/glyphicons-halflings-regular-a26394f7ede100ca118eff2eda08596275a9839b959c226e15439557a5a80742.woff +0 -0
  275. data/spec/dummy/public/assets/bootstrap/glyphicons-halflings-regular-e395044093757d82afcb138957d06a1ea9361bdcf0b442d06a18a8051af57456.ttf +0 -0
  276. data/spec/dummy/public/assets/bootstrap/glyphicons-halflings-regular-e395044093757d82afcb138957d06a1ea9361bdcf0b442d06a18a8051af57456.ttf.gz +0 -0
  277. data/spec/dummy/public/assets/bootstrap/glyphicons-halflings-regular-fe185d11a49676890d47bb783312a0cda5a44c4039214094e7957b4c040ef11c.woff2 +0 -0
  278. data/spec/dummy/public/assets/pwb/application-0dc6ff845cde8e032ed365593c17fe09c18a6966d44f551946bf1673d8d1ac51.css +0 -13
  279. data/spec/dummy/public/assets/pwb/application-0dc6ff845cde8e032ed365593c17fe09c18a6966d44f551946bf1673d8d1ac51.css.gz +0 -0
  280. data/spec/dummy/public/assets/pwb/application-b4df8e7ae7700a0d09d88175af77e7f457ca2fbe15ae08450551ebf3bfb0c4d1.js +0 -15656
  281. data/spec/dummy/public/assets/pwb/application-b4df8e7ae7700a0d09d88175af77e7f457ca2fbe15ae08450551ebf3bfb0c4d1.js.gz +0 -0
  282. data/spec/dummy/public/assets/pwb/themes/berlin-279c2e3a7fa11a902fdee83a6819dcc315ff8eb240cfad21b1322cedadb07ea7.js +0 -18690
  283. data/spec/dummy/public/assets/pwb/themes/berlin-279c2e3a7fa11a902fdee83a6819dcc315ff8eb240cfad21b1322cedadb07ea7.js.gz +0 -0
  284. data/spec/dummy/public/assets/pwb/themes/berlin-8038d5cfd670e73fbffb581f6bb8d8c00ac448957945622c5c34438c467d218b.css +0 -8582
  285. data/spec/dummy/public/assets/pwb/themes/berlin-8038d5cfd670e73fbffb581f6bb8d8c00ac448957945622c5c34438c467d218b.css.gz +0 -0
  286. data/spec/dummy/public/assets/pwb/themes/chic-facdff61de4827adfd797b6a36ffd6c8b432072df7190ed722d039f971caa539.css +0 -3500
  287. data/spec/dummy/public/assets/pwb/themes/chic-facdff61de4827adfd797b6a36ffd6c8b432072df7190ed722d039f971caa539.css.gz +0 -0
  288. data/spec/dummy/public/assets/pwb/themes/default-d697fb0c278f500986e614ddd7eb41fd7db502a54f3370b3e8166cc1714509d0.css +0 -8423
  289. data/spec/dummy/public/assets/pwb/themes/default-d697fb0c278f500986e614ddd7eb41fd7db502a54f3370b3e8166cc1714509d0.css.gz +0 -0
  290. data/spec/dummy/public/assets/pwb_admin_panel/application-2d624898965d7a347eb7f365feab34257032c25051633370811ed7dfd24d7c8c.js +0 -61
  291. data/spec/dummy/public/assets/pwb_admin_panel/application-2d624898965d7a347eb7f365feab34257032c25051633370811ed7dfd24d7c8c.js.gz +0 -0
  292. data/spec/dummy/public/assets/pwb_admin_panel/application-f0e38d58d1ce32501b22edd16697f45b561fa44b5be9265398a05e8dee169885.css +0 -17970
  293. data/spec/dummy/public/assets/pwb_admin_panel/application-f0e38d58d1ce32501b22edd16697f45b561fa44b5be9265398a05e8dee169885.css.gz +0 -0
  294. data/spec/dummy/public/img/about-us.png +0 -0
  295. data/spec/dummy/public/img/agents/agent-1.png +0 -0
  296. data/spec/dummy/public/img/agents/agent-3.png +0 -0
  297. data/spec/dummy/public/img/agents/agent-4.png +0 -0
  298. data/spec/dummy/public/img/agents/agent-5.png +0 -0
  299. data/spec/dummy/public/img/banner-ads.jpg +0 -0
  300. data/spec/dummy/public/img/blog-img-1.jpg +0 -0
  301. data/spec/dummy/public/img/blog-img-2.jpg +0 -0
  302. data/spec/dummy/public/img/blog-img-3.jpg +0 -0
  303. data/spec/dummy/public/img/client-brand-1.png +0 -0
  304. data/spec/dummy/public/img/client-brand-2.png +0 -0
  305. data/spec/dummy/public/img/client-brand-3.png +0 -0
  306. data/spec/dummy/public/img/client-brand-4.png +0 -0
  307. data/spec/dummy/public/img/client-brand-5.png +0 -0
  308. data/spec/dummy/public/img/favicon.ico +0 -0
  309. data/spec/dummy/public/img/gallery/big/1.jpg +0 -0
  310. data/spec/dummy/public/img/gallery/big/10.jpg +0 -0
  311. data/spec/dummy/public/img/gallery/big/11 - Copy.jpg +0 -0
  312. data/spec/dummy/public/img/gallery/big/12.jpg +0 -0
  313. data/spec/dummy/public/img/gallery/big/2.jpg +0 -0
  314. data/spec/dummy/public/img/gallery/big/3.jpg +0 -0
  315. data/spec/dummy/public/img/gallery/big/4.jpg +0 -0
  316. data/spec/dummy/public/img/gallery/big/5.jpg +0 -0
  317. data/spec/dummy/public/img/gallery/big/6.jpg +0 -0
  318. data/spec/dummy/public/img/gallery/big/7.jpg +0 -0
  319. data/spec/dummy/public/img/gallery/big/8.jpg +0 -0
  320. data/spec/dummy/public/img/gallery/big/9.jpg +0 -0
  321. data/spec/dummy/public/img/gallery/fancybox_buttons.png +0 -0
  322. data/spec/dummy/public/img/gallery/fancybox_loading.gif +0 -0
  323. data/spec/dummy/public/img/gallery/fancybox_loading@2x.gif +0 -0
  324. data/spec/dummy/public/img/gallery/fancybox_overlay.png +0 -0
  325. data/spec/dummy/public/img/gallery/fancybox_sprite.png +0 -0
  326. data/spec/dummy/public/img/gallery/fancybox_sprite@2x.png +0 -0
  327. data/spec/dummy/public/img/gallery/small/1.jpg +0 -0
  328. data/spec/dummy/public/img/gallery/small/10.jpg +0 -0
  329. data/spec/dummy/public/img/gallery/small/11.jpg +0 -0
  330. data/spec/dummy/public/img/gallery/small/12.jpg +0 -0
  331. data/spec/dummy/public/img/gallery/small/2.jpg +0 -0
  332. data/spec/dummy/public/img/gallery/small/3.jpg +0 -0
  333. data/spec/dummy/public/img/gallery/small/4.jpg +0 -0
  334. data/spec/dummy/public/img/gallery/small/5.jpg +0 -0
  335. data/spec/dummy/public/img/gallery/small/6.jpg +0 -0
  336. data/spec/dummy/public/img/gallery/small/7.jpg +0 -0
  337. data/spec/dummy/public/img/gallery/small/8.jpg +0 -0
  338. data/spec/dummy/public/img/gallery/small/9.jpg +0 -0
  339. data/spec/dummy/public/img/item/1.jpg +0 -0
  340. data/spec/dummy/public/img/item/2.jpg +0 -0
  341. data/spec/dummy/public/img/item/3.jpg +0 -0
  342. data/spec/dummy/public/img/item/4.jpg +0 -0
  343. data/spec/dummy/public/img/item/5.jpg +0 -0
  344. data/spec/dummy/public/img/item/6.jpg +0 -0
  345. data/spec/dummy/public/img/logo.png +0 -0
  346. data/spec/dummy/public/img/promo-banner.jpg +0 -0
  347. data/spec/dummy/public/img/property-header-bg.jpg +0 -0
  348. data/spec/dummy/public/img/property-view-2.jpg +0 -0
  349. data/spec/dummy/public/img/signin-bg.jpg +0 -0
  350. data/spec/dummy/public/img/slider/1.jpg +0 -0
  351. data/spec/dummy/public/img/slider/2.jpg +0 -0
  352. data/spec/dummy/public/img/slider/3.jpg +0 -0
  353. data/spec/dummy/public/img/slider/4.jpg +0 -0
  354. data/spec/dummy/public/img/slider/5.jpg +0 -0
  355. data/spec/dummy/public/img/slider/6.jpg +0 -0
  356. data/spec/dummy/public/img/testimonial-1.png +0 -0
  357. data/spec/dummy/public/img/testimonial-2.png +0 -0
  358. data/spec/dummy/public/img/testimonial-3.png +0 -0
  359. data/spec/dummy/public/img/testimonial-bg.jpg +0 -0
  360. data/spec/dummy/public/js/bootstrap.js +0 -2363
  361. data/spec/dummy/public/js/custom.js +0 -355
  362. data/spec/dummy/public/js/jquery.fancybox.pack.js +0 -46
  363. data/spec/dummy/public/js/jquery.min.js +0 -5
  364. data/spec/dummy/public/js/jquery.mixitup.js +0 -2098
  365. data/spec/dummy/public/js/nouislider.js +0 -1899
  366. data/spec/dummy/public/js/slick.js +0 -2670
  367. data/spec/dummy/public/system/comfy/cms/files/files/000/000/003/cms_thumb/rerenting-landing_framed.png +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 86e4fcfcc8012c05c80fa81d9f68d2bef3b3fa50
4
- data.tar.gz: 253df4b1c3e09128c83fc0e8ef72e3afb3560d83
3
+ metadata.gz: d2344b18a108db8c20c5f6b1760e737006abacc2
4
+ data.tar.gz: 89708feddefa2c2fd85e8de643887c097a3bd1d7
5
5
  SHA512:
6
- metadata.gz: 2606164db8b4b4e942f8bfd700123386d4d2d1fdb8607abe431837b9f470d3091b668d34f4e7cf4cc4c63b051a5f008983679b1c68054fcc67342e963f80a5c1
7
- data.tar.gz: 1f522383910875f8ef545558c4bc11d7182e9874aabdc3a7e5c4f16f8cfde2af30850b6a19910d71f94bffa2f21d792fe004ca50925942aeefbc156015a7f589
6
+ metadata.gz: c3839ba5b0c53acba955504b44d4139ad5ef418310ed8bab0f1daf8e335b206d6fa75863df54754c416143a6b9628daef20ca689538a49d392e6b400b183fcb8
7
+ data.tar.gz: 58590fd4afc2f37f285fa4714d69c82ffbc8ba2e80a818c20e4a46cc4a405c2c728b70c0153c803afb137281e53b748eb3c3e397f8d0aa2f84d7401872b29cdc
data/README.md CHANGED
@@ -32,7 +32,7 @@ Install into an existing Rails project by adding these lines in your application
32
32
  ```ruby
33
33
  gem 'pwb', git: 'https://github.com/etewiah/property_web_builder', branch: 'master'
34
34
  gem 'globalize', git: 'https://github.com/globalize/globalize'
35
-
35
+ gem 'paloma', github: 'fredngo/paloma'
36
36
  ```
37
37
 
38
38
  Also, be sure to use Postgres as your database (by having the "pg" gem and Postgres installed locally
@@ -0,0 +1 @@
1
+ # Custom JS for the admin area
@@ -0,0 +1 @@
1
+ // custom CSS for admin area
@@ -1,5 +1,10 @@
1
- /*main content section*/
1
+ .map-canvas {
2
+ /*when map is displayed, we don't want
3
+ padding between it and footer*/
4
+ margin-bottom: -100px;
5
+ }
2
6
 
7
+ /*main content section*/
3
8
  #aa-main .aa-main-area {
4
9
  display: inline;
5
10
  float: left;
@@ -234,7 +234,8 @@ img {
234
234
 
235
235
  #aa-menu-area {
236
236
  left: 0;
237
- padding-top: 20px;
237
+ /*Ed - reduced below from 20px*/
238
+ padding-top: 2px;
238
239
  position: absolute;
239
240
  right: 0;
240
241
  top: 35px;
@@ -268,8 +269,9 @@ img {
268
269
  }
269
270
 
270
271
  #aa-menu-area .main-navbar .navbar-header .aa-logo-img img {
271
- width: 100%;
272
+ /*width: 100%;*/
272
273
  height: 100%;
274
+ object-fit: cover;
273
275
  }
274
276
 
275
277
  #aa-menu-area .main-navbar .navbar-nav li a {
@@ -306,7 +308,7 @@ img {
306
308
 
307
309
  #aa-menu-area .navbar-fixed-top {
308
310
  background-color: #FFF;
309
- padding: 15px 0;
311
+ /*padding: 15px 0;*/
310
312
  -webkit-transition: all 0.5s;
311
313
  -moz-transition: all 0.5s;
312
314
  -ms-transition: all 0.5s;
@@ -546,6 +548,7 @@ img {
546
548
  #aa-slider .aa-slider-area .aa-top-slider .aa-top-slider-single img {
547
549
  width: 100%;
548
550
  height: 700px;
551
+ object-fit: cover;
549
552
  }
550
553
 
551
554
  #aa-slider .aa-slider-area .aa-top-slider .aa-top-slider-single .aa-top-slider-content {
@@ -832,7 +835,7 @@ img {
832
835
  .aa-properties-item {
833
836
  display: inline;
834
837
  float: left;
835
- /* margin-top: 30px;
838
+ /* margin-top: 30px;
836
839
  */
837
840
  margin-bottom: 30px;
838
841
  width: 100%;
@@ -855,6 +858,7 @@ img {
855
858
  .aa-properties-item .aa-properties-item-img img {
856
859
  width: 100%;
857
860
  height: 239px;
861
+ object-fit: cover;
858
862
  }
859
863
 
860
864
  .aa-properties-item .aa-tag {
@@ -1384,6 +1388,7 @@ img {
1384
1388
  .aa-properties-details .aa-properties-details-img img {
1385
1389
  height: 500px;
1386
1390
  width: 100%;
1391
+ object-fit: cover;
1387
1392
  }
1388
1393
 
1389
1394
  .aa-properties-details .aa-properties-details-img .slick-prev,
@@ -1426,6 +1431,7 @@ img {
1426
1431
  margin-bottom: 10px;
1427
1432
  }
1428
1433
 
1434
+
1429
1435
  /*
1430
1436
  -tick before each extra
1431
1437
  .aa-properties-details .aa-properties-info ul li:before {
@@ -1496,13 +1502,12 @@ img {
1496
1502
  }
1497
1503
 
1498
1504
 
1499
-
1500
1505
  /*==================
1501
1506
  FOOTER SECTION
1502
1507
  ====================*/
1503
1508
 
1504
1509
  #aa-footer {
1505
- /* background-color: #444;
1510
+ /* background-color: #444;
1506
1511
  */
1507
1512
  display: inline;
1508
1513
  float: left;
@@ -1523,7 +1528,7 @@ img {
1523
1528
  }
1524
1529
 
1525
1530
  #aa-footer .aa-footer-area .aa-footer-left p {
1526
- /* color: #fff;
1531
+ /* color: #fff;
1527
1532
  */
1528
1533
  margin-bottom: 0;
1529
1534
  padding-bottom: 10px;
@@ -1626,8 +1631,6 @@ img {
1626
1631
  /*Ed - for mobile show full length photos */
1627
1632
  height: 100%;
1628
1633
  }
1629
-
1630
-
1631
1634
  #aa-menu-area .main-navbar .navbar-nav li a {
1632
1635
  padding-left: 8px;
1633
1636
  padding-right: 8px;
@@ -1932,8 +1935,6 @@ img {
1932
1935
  #aa-properties .aa-properties-content .aa-properties-content-body .aa-list-view li .aa-properties-item .aa-properties-item-img {
1933
1936
  width: 100%;
1934
1937
  }
1935
-
1936
-
1937
1938
  #aa-properties .aa-properties-content .aa-properties-content-body .aa-list-view li .aa-properties-item .aa-properties-item-content {
1938
1939
  border-top: medium none;
1939
1940
  width: 100%;
@@ -25,7 +25,7 @@ ul {
25
25
  list-style: none;
26
26
  }
27
27
 
28
- .static-content-panel {
28
+ .static-content-panel, .comfy-content-panel {
29
29
  min-height: 600px;
30
30
  }
31
31
 
@@ -4,8 +4,8 @@ module Pwb
4
4
  class AdminPanelController < ActionController::Base
5
5
  layout 'pwb/admin_panel'
6
6
  def show
7
- unless current_user && current_user.admin
8
- render 'pwb/errors/admin_required', :layout => "layouts/pwb/devise"
7
+ unless current_user && current_user.admin
8
+ render 'pwb/errors/admin_required', layout: "layouts/pwb/devise"
9
9
  end
10
10
  end
11
11
  end
@@ -0,0 +1,102 @@
1
+ module Pwb
2
+ # http://localhost:3000/api/v1/cms-pages.json
3
+ class Api::V1::CmsPagesController < JSONAPI::ResourceController
4
+ # skip_before_action :verify_content_type_header
5
+ # Skipping action below allows me to browse to endpoint
6
+ # without having set mime type
7
+ skip_before_action :ensure_valid_accept_media_type
8
+ # skip_before_action :verify_accept_header
9
+
10
+ def set_photo
11
+ # This only creates a content photo
12
+ # - does not associate it with a cms page yet
13
+ photo = ContentPhoto.create
14
+ # TODO: - figure out how to remove orphaned photos
15
+ if params[:file]
16
+ photo.image = params[:file]
17
+ end
18
+ photo.save!
19
+ photo.reload
20
+ render json: photo.to_json
21
+ end
22
+
23
+ def meta
24
+ @admin_setup = Pwb::CmsPageContainer.where(name: params[:page_name]).first || {}
25
+ render json: @admin_setup.as_json["attributes"]
26
+ end
27
+
28
+ def create
29
+ new_page = Comfy::Cms::Page.new(cms_page_create_params["attributes"].except("blocks"))
30
+ cms_page_create_params[:attributes][:blocks].each do |block_params|
31
+ new_block = Comfy::Cms::Block.new block_params
32
+ new_block.identifier = "idd"
33
+ new_block.save!
34
+ new_page.blocks << new_block
35
+ end
36
+
37
+ new_page.site_id = 1
38
+ new_page.layout_id = 1
39
+ # new_page.slug = "en"
40
+ byebug
41
+ new_page.label = "lbl"
42
+
43
+ new_page.save!
44
+
45
+ serialized_page = JSONAPI::ResourceSerializer.new(Pwb::Api::V1::CmsPageResource).serialize_to_hash(Pwb::Api::V1::CmsPageResource.new(new_page, nil))
46
+ # updated_caches.push {}
47
+ # serialized_page[:data]["attributes"]["updated-caches"] = updated_caches
48
+ render json: serialized_page
49
+
50
+ end
51
+
52
+ def update
53
+ updated_caches = []
54
+ refresh_all_locales = false
55
+ cms_page_update_params[:attributes][:blocks].each do |block_params|
56
+ block = Comfy::Cms::Block.find block_params[:id]
57
+ if block_params[:is_image]
58
+ # for images I want to update all language variants of the block
59
+ cross_locale_blocks = Comfy::Cms::Block.where(identifier: block_params[:identifier])
60
+ cross_locale_blocks.each do |cross_locale_block|
61
+ cross_locale_block.update block_params.slice :content
62
+ end
63
+ refresh_all_locales = true
64
+ else
65
+ block.update block_params.slice :content
66
+ end
67
+ # blocks.push block
68
+ end
69
+
70
+ if refresh_all_locales
71
+ pages = Comfy::Cms::Page.where(label: cms_page_update_params[:attributes][:label])
72
+ pages.each do |page|
73
+ page.clear_content_cache
74
+ updated_caches.push({
75
+ page_id: page.id,
76
+ page_content_cache: page.content_cache
77
+ })
78
+ end
79
+ else
80
+ page = Comfy::Cms::Page.find cms_page_update_params[:id]
81
+ page.clear_content_cache
82
+ # need to call content_cache again for refresh
83
+ page.content_cache
84
+ end
85
+
86
+ # below ensures valid json_api response is sent:
87
+ page = Comfy::Cms::Page.find cms_page_update_params[:id]
88
+ serialized_page = JSONAPI::ResourceSerializer.new(Pwb::Api::V1::CmsPageResource).serialize_to_hash(Pwb::Api::V1::CmsPageResource.new(page, nil))
89
+ updated_caches.push {}
90
+ serialized_page[:data]["attributes"]["updated-caches"] = updated_caches
91
+ # [{id: 22, cc: "dddd"}]
92
+ render json: serialized_page
93
+ end
94
+
95
+ def cms_page_create_params
96
+ params.require(:data).permit(attributes: [:slug, :site_id, :label, blocks: [:content, :identifier, :info, :is_image]])
97
+ end
98
+ def cms_page_update_params
99
+ params.require(:data).permit(:id, attributes: [:label, blocks: [:content, :id, :identifier, :info, :is_image]])
100
+ end
101
+ end
102
+ end
@@ -13,6 +13,10 @@ module Pwb
13
13
  # which is ugly but works
14
14
  @website.social_media = params[:website][:social_media]
15
15
  @website.style_variables = params[:website][:style_variables]
16
+ @website.sale_price_options_from = params[:website][:sale_price_options_from]
17
+ @website.sale_price_options_till = params[:website][:sale_price_options_till]
18
+ @website.rent_price_options_from = params[:website][:rent_price_options_from]
19
+ @website.rent_price_options_till = params[:website][:rent_price_options_till]
16
20
  @website.save!
17
21
  end
18
22
  render json: @website
@@ -25,6 +29,9 @@ module Pwb
25
29
  :company_name, :display_name, :default_area_unit,
26
30
  :phone_number_primary, :phone_number_other,
27
31
  :theme_name, :default_currency, :default_client_locale,
32
+ :raw_css, :analytics_id_type, :analytics_id,
33
+ :sale_price_options_from, :sale_price_options_till,
34
+ :rent_price_options_from, :rent_price_options_till,
28
35
  supported_locales: []
29
36
  )
30
37
  end
@@ -12,8 +12,8 @@ module Pwb
12
12
  # verify_content_type_header
13
13
  # verify_accept_header
14
14
 
15
- before_filter :cors_preflight_check
16
- after_filter :cors_set_access_control_headers
15
+ before_action :cors_preflight_check
16
+ after_action :cors_set_access_control_headers
17
17
 
18
18
  # For all responses in this controller, return the CORS access control headers.
19
19
 
@@ -1,6 +1,5 @@
1
1
  module Pwb
2
2
  class ApplicationApiController < ActionController::Base
3
-
4
3
  protect_from_forgery with: :exception, prepend: true
5
4
  # include ActionController::HttpAuthentication::Token::ControllerMethods
6
5
 
@@ -8,7 +7,6 @@ module Pwb
8
7
  # , :authenticate_user_from_token!, :set_locale
9
8
  after_action :set_csrf_token
10
9
 
11
-
12
10
  def self.default_url_options
13
11
  { locale: I18n.locale }
14
12
  end
@@ -18,12 +16,11 @@ module Pwb
18
16
  def check_user
19
17
  unless current_user && current_user.admin
20
18
  # unless request.subdomain.present? && (request.subdomain.downcase == current_user.tenants.first.subdomain.downcase)
21
- return render_json_error "unauthorised_user"
19
+ render_json_error "unauthorised_user"
22
20
  end
23
-
24
21
  end
25
22
 
26
- def render_json_error(message, opts={})
23
+ def render_json_error(message, opts = {})
27
24
  render json: message, status: opts[:status] || 422
28
25
  end
29
26
 
@@ -34,11 +31,10 @@ module Pwb
34
31
  def set_csrf_token
35
32
  # http://rajatsingla.in/ruby/2016/08/06/how-to-add-csrf-in-ember-app.html
36
33
  if request.xhr?
37
- response.headers['X-CSRF-Token'] = "#{form_authenticity_token}"
34
+ response.headers['X-CSRF-Token'] = form_authenticity_token.to_s
38
35
  response.headers['X-CSRF-Param'] = "authenticity_token"
39
36
  end
40
37
  # works in conjunction with updating the headers via client app
41
38
  end
42
-
43
39
  end
44
40
  end
@@ -2,13 +2,13 @@ module Pwb
2
2
  class ApplicationController < ActionController::Base
3
3
  protect_from_forgery with: :exception
4
4
 
5
- before_action :footer_content, :current_agency_and_website, :sections,
5
+ before_action :footer_content, :current_agency_and_website, :sections,
6
6
  :set_locale, :set_theme_path
7
7
 
8
8
  def set_theme_path
9
9
  theme_name = Website.unique_instance.theme_name
10
10
  theme_name = theme_name.present? ? theme_name : "default"
11
- # || "default"
11
+ # || "default"
12
12
  # if Agency.last && Agency.last.theme_name.present?
13
13
  # theme_name = Agency.last.theme_name
14
14
  # end
@@ -56,6 +56,5 @@ module Pwb
56
56
  @sections ||= Section.order("sort_order")
57
57
  @show_admin_link = true
58
58
  end
59
-
60
59
  end
61
60
  end
@@ -0,0 +1,106 @@
1
+ require_dependency 'pwb/application_controller'
2
+
3
+ module Pwb
4
+ # based on
5
+ # comfortable-mexican-sofa/app/controllers/comfy/cms/content_controller.rb
6
+ class ComfyController < ApplicationController
7
+ # Comfy::Cms::BaseController
8
+
9
+ # Authentication module must have `authenticate` method
10
+ include ComfortableMexicanSofa.config.public_auth.to_s.constantize
11
+
12
+ # Authorization module must have `authorize` method
13
+ include ComfortableMexicanSofa.config.public_authorization.to_s.constantize
14
+
15
+ before_action :load_cms_site
16
+ # before_action :load_fixtures
17
+ # before_action :load_cms_page
18
+ # :authenticate,
19
+ # :authorize,
20
+ # :only => :show
21
+
22
+ rescue_from ActiveRecord::RecordNotFound, with: :page_not_found
23
+
24
+ def show
25
+ @cms_pages = []
26
+
27
+ begin
28
+ cms_page_container = Pwb::CmsPageContainer.find(params[:page_slug])
29
+ @title_key = cms_page_container.pageTitleKey
30
+ cms_page_container.cmsPartsList.each do |cms_part|
31
+ @cms_page = Comfy::Cms::Page.where({label: cms_part["label"], slug: I18n.locale}).first
32
+ # @cms_site.pages.published.find_by_full_path!("/about-us/services")
33
+ @cms_pages.push @cms_page if @cms_page
34
+ end
35
+ rescue ActiveHash::RecordNotFound
36
+ end
37
+
38
+ @content_area_cols = Content.where(tag: 'content-area-cols').order('sort_order')
39
+
40
+ render "/pwb/sections/cms"
41
+
42
+ # cms_page_path = "/#{params[:page_slug]}-page"
43
+ # https://github.com/comfy/comfortable-mexican-sofa/wiki/View-rendering
44
+ # below makes use of Comfy view rendering:
45
+
46
+ # return render :cms_page => cms_page_path, :layout => "pwb/application", :cms_blocks => {
47
+ # :jumbotron => 'Content About Events'
48
+ # # :column_b => { :template => '/events/index' },
49
+ # # :column_c => { :partial => '/events/calendar' }
50
+ # }
51
+ # return render @cms_page.content_cache
52
+ # , layout: "application"
53
+ end
54
+
55
+ def render_sitemap
56
+ render
57
+ end
58
+
59
+ protected
60
+
61
+ def load_cms_site
62
+ # TODO: - load diff sites depending on locale//
63
+ @cms_site = ::Comfy::Cms::Site.find_by_locale :es
64
+ # (::Comfy::Cms::Site.find_by_locale I18n.locale) || (::Comfy::Cms::Site.find_by_locale :en)
65
+ end
66
+
67
+ # def render_page(status = 200)
68
+ # # below will ren
69
+ # if @cms_layout = @cms_page.layout
70
+ # # app_layout = (@cms_layout.app_layout.blank? || request.xhr?) ? false : @cms_layout.app_layout
71
+ # app_layout = "application"
72
+ # render :inline => @cms_page.content_cache,
73
+ # :layout => app_layout,
74
+ # :status => status,
75
+ # :content_type => mime_type
76
+ # else
77
+ # render :plain => I18n.t('comfy.cms.content.layout_not_found'), :status => 404
78
+ # end
79
+ # end
80
+
81
+ # it's possible to control mimetype of a page by creating a `mime_type` field
82
+ def mime_type
83
+ mime_block = @cms_page.blocks.find_by_identifier(:mime_type)
84
+ mime_block && mime_block.content || 'text/html'
85
+ end
86
+
87
+ def load_fixtures
88
+ return unless ComfortableMexicanSofa.config.enable_fixtures
89
+ ComfortableMexicanSofa::Fixture::Importer.new(@cms_site.identifier).import!
90
+ end
91
+
92
+ def load_cms_page(_page_key)
93
+ @cms_page = @cms_site.pages.published.find_by_full_path!("/[:cms_path]")
94
+ end
95
+
96
+ def page_not_found
97
+ @cms_page = @cms_site.pages.published.find_by_full_path!('/404')
98
+
99
+ respond_to do |format|
100
+ format.html { render_page(404) }
101
+ end
102
+ rescue ActiveRecord::RecordNotFound
103
+ raise ActionController::RoutingError, "Page Not Found at: \"#{params[:cms_path]}\""
104
+ end
105
+ end
106
+ end