pwb 1.2.0 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +40 -25
- data/app/assets/fonts/fonts/FontAwesome.otf +0 -0
- data/app/assets/fonts/fonts/fontawesome-webfont.eot +0 -0
- data/app/assets/fonts/fonts/fontawesome-webfont.svg +2668 -637
- data/app/assets/fonts/fonts/fontawesome-webfont.ttf +0 -0
- data/app/assets/fonts/fonts/fontawesome-webfont.woff +0 -0
- data/app/assets/fonts/fonts/fontawesome-webfont.woff2 +0 -0
- data/app/assets/javascripts/pwb/shared/page-content.js +24 -0
- data/app/assets/javascripts/pwb/shared/squares-container.js +58 -0
- data/app/assets/javascripts/pwb/shared/vue-main.js +1 -1
- data/app/assets/javascripts/pwb/shared/vue-squares.js.erb +74 -0
- data/app/assets/javascripts/pwb/squares/tabable-section.js +47 -0
- data/app/assets/javascripts/pwb/themes/squares.js.erb +45 -0
- data/app/assets/javascripts/pwb/themes/vic.js.erb +152 -0
- data/app/assets/javascripts/pwb_admin_panel/application_legacy_1.js +5 -0
- data/app/assets/stylesheets/pwb/themes/berlin.scss +4 -0
- data/app/assets/stylesheets/pwb/themes/berlin/main.scss +1 -1
- data/app/assets/stylesheets/pwb/themes/default.scss +1 -0
- data/app/assets/stylesheets/pwb/themes/default/carousel.scss +2 -1
- data/app/assets/stylesheets/pwb/themes/default/landing_content_areas.scss +13 -13
- data/app/assets/stylesheets/pwb/themes/default/shame.scss +0 -16
- data/app/assets/stylesheets/pwb/themes/matt.scss +18 -0
- data/app/assets/stylesheets/pwb/themes/shared/liquid_templates.scss +37 -0
- data/app/assets/stylesheets/pwb/themes/shared/shame.scss +7 -0
- data/app/assets/stylesheets/pwb/themes/squares.scss +22 -0
- data/app/assets/stylesheets/pwb/themes/squares/vue-material-docs.scss +200 -0
- data/app/assets/stylesheets/pwb/themes/squares/vue-material-vars.scss +141 -0
- data/app/assets/stylesheets/pwb/themes/vic.scss +104 -0
- data/app/assets/stylesheets/pwb/themes/vic/general.scss +15 -0
- data/app/assets/stylesheets/pwb/themes/vic/landing.scss +189 -0
- data/app/assets/stylesheets/pwb/themes/vic/slider.scss +127 -0
- data/app/assets/stylesheets/pwb_admin_panel/application_legacy_1.scss +6 -0
- data/app/controllers/pwb/admin_panel_controller.rb +7 -1
- data/app/controllers/pwb/api/v1/clients_controller.rb +35 -0
- data/app/controllers/pwb/api/v1/contacts_controller.rb +41 -0
- data/app/controllers/pwb/api/v1/links_controller.rb +47 -0
- data/app/controllers/pwb/api/v1/page_controller.rb +117 -0
- data/app/controllers/pwb/api/v1/page_fragments_controller.rb +74 -0
- data/app/controllers/pwb/api/v1/properties_controller.rb +30 -9
- data/app/controllers/pwb/api/v1/sections_controller.rb +27 -26
- data/app/controllers/pwb/api/v1/website_controller.rb +11 -11
- data/app/controllers/pwb/application_controller.rb +22 -11
- data/app/controllers/pwb/{sections_controller.rb → contact_us_controller.rb} +24 -45
- data/app/controllers/pwb/css_controller.rb +5 -2
- data/app/controllers/pwb/pages_controller.rb +36 -0
- data/app/controllers/pwb/search_controller.rb +33 -11
- data/app/controllers/pwb/squares_controller.rb +48 -0
- data/app/controllers/pwb/welcome_controller.rb +30 -5
- data/app/helpers/pwb/application_helper.rb +50 -49
- data/app/helpers/pwb/css_helper.rb +14 -0
- data/app/helpers/pwb/navigation_helper.rb +82 -0
- data/app/models/pwb/contact.rb +25 -0
- data/app/models/pwb/content.rb +26 -8
- data/app/models/pwb/content_photo.rb +18 -0
- data/app/models/pwb/link.rb +41 -0
- data/app/models/pwb/message.rb +1 -1
- data/app/models/pwb/page.rb +227 -0
- data/app/models/pwb/page_content.rb +33 -0
- data/app/models/pwb/page_part.rb +17 -0
- data/app/models/pwb/preset_style.rb +37 -0
- data/app/models/pwb/prop.rb +4 -0
- data/app/models/pwb/website.rb +64 -9
- data/app/resources/pwb/api/v1/{section_resource.rb → client_resource.rb} +3 -4
- data/app/resources/pwb/api/v1/property_resource.rb +23 -4
- data/app/resources/pwb/api/v1/web_content_resource.rb +1 -1
- data/app/resources/pwb/api_public/v1/prop_resource.rb +9 -2
- data/{db/cms_fixtures/cms/layouts/about-us/content.html → app/themes/airbnb/views/layouts/pwb/_generic_modal.html.erb} +0 -0
- data/{db/cms_fixtures/cms/layouts/about-us/javascript.js → app/themes/airbnb/views/layouts/pwb/_login_modal.html.erb} +0 -0
- data/app/themes/airbnb/views/layouts/pwb/application.html.erb +82 -0
- data/app/themes/airbnb/views/pwb/_footer.html.erb +25 -0
- data/app/themes/airbnb/views/pwb/props/_images_section_carousel.html.erb +43 -0
- data/app/themes/airbnb/views/pwb/props/show.html.erb +69 -0
- data/app/themes/airbnb/views/pwb/search/_search_form_for_rent.html.erb +183 -0
- data/app/themes/airbnb/views/pwb/search/_search_results.html.erb +34 -0
- data/app/themes/airbnb/views/pwb/search/buy.html.erb +65 -0
- data/app/themes/airbnb/views/pwb/search/rent.html.erb +87 -0
- data/app/themes/airbnb/views/pwb/sections/_contact_us_form.html.erb +49 -0
- data/app/themes/airbnb/views/pwb/sections/contact_us.html.erb +56 -0
- data/app/themes/airbnb/views/pwb/welcome/_content_area_cols.html.erb +12 -0
- data/app/themes/airbnb/views/pwb/welcome/_single_property_row.html.erb +51 -0
- data/app/themes/airbnb/views/pwb/welcome/index.html.erb +66 -0
- data/app/themes/berlin/views/pwb/_footer.html.erb +15 -20
- data/app/themes/berlin/views/pwb/_header.html.erb +7 -9
- data/app/themes/berlin/views/pwb/pages/show.html.erb +50 -0
- data/app/themes/berlin/views/pwb/search/buy.html.erb +1 -1
- data/app/themes/berlin/views/pwb/search/rent.html.erb +1 -2
- data/app/themes/berlin/views/pwb/sections/contact_us.html.erb +1 -1
- data/app/themes/berlin/views/pwb/welcome/index.html.erb +51 -7
- data/app/themes/config.json +14 -0
- data/app/themes/default/views/pwb/{sections/cms.html.erb → pages/show.html.erb} +9 -8
- data/app/themes/default/views/pwb/search/buy.html.erb +1 -1
- data/app/themes/default/views/pwb/search/rent.html.erb +1 -1
- data/app/themes/default/views/pwb/sections/about_us.html.erb +8 -7
- data/app/themes/default/views/pwb/sections/contact_us.html.erb +40 -30
- data/app/themes/default/views/pwb/sections/static.html.erb +3 -20
- data/app/themes/default/views/pwb/welcome/_single_property_row.html.erb +1 -1
- data/app/themes/default/views/pwb/welcome/index.html.erb +7 -38
- data/app/themes/matt/views/layouts/pwb/application.html.erb +45 -0
- data/app/themes/matt/views/pwb/_footer.html.erb +60 -0
- data/app/themes/matt/views/pwb/_header.html.erb +105 -0
- data/app/themes/matt/views/pwb/search/buy.html.erb +65 -0
- data/app/themes/matt/views/pwb/welcome/index.html.erb +132 -0
- data/app/themes/vic/views/layouts/pwb/application.html.erb +94 -0
- data/app/themes/vic/views/pwb/_header.html.erb +100 -0
- data/app/themes/vic/views/pwb/props/_images_section_carousel.html.erb +43 -0
- data/app/themes/vic/views/pwb/props/show.html.erb +69 -0
- data/app/themes/vic/views/pwb/search/buy.html.erb +65 -0
- data/app/themes/vic/views/pwb/search/rent.html.erb +65 -0
- data/app/themes/vic/views/pwb/sections/_contact_us_form.html.erb +49 -0
- data/app/themes/vic/views/pwb/sections/contact_us.html.erb +56 -0
- data/app/themes/vic/views/pwb/welcome/_content_area_cols.html.erb +12 -0
- data/app/themes/vic/views/pwb/welcome/_single_property_row.html.erb +51 -0
- data/app/themes/vic/views/pwb/welcome/index.html.erb +27 -0
- data/app/views/devise/shared/_links.html.erb +1 -1
- data/app/views/layouts/pwb/admin_panel_error.html.erb +19 -0
- data/app/views/layouts/pwb/admin_panel_legacy_1.html.erb +21 -0
- data/app/views/layouts/pwb/squares.html.erb +72 -0
- data/app/views/pwb/_footer.html.erb +2 -6
- data/app/views/pwb/_header.html.erb +23 -25
- data/app/views/pwb/admin_panel/show_legacy_1.html.erb +3 -0
- data/app/views/pwb/custom_css/_berlin.css.erb +0 -67
- data/app/views/pwb/custom_css/_default.css.erb +0 -22
- data/app/views/pwb/custom_css/_shared.css.erb +4 -3
- data/app/views/pwb/custom_css/_vic.css.erb +10 -0
- data/app/views/pwb/props/_images_section_carousel.html.erb +1 -1
- data/app/views/pwb/search/_search_result_item.html.erb +1 -1
- data/app/views/pwb/squares/show_client.html.erb +26 -0
- data/app/views/pwb/squares/show_prop.html.erb +26 -0
- data/app/views/pwb/squares/vue.html.erb +1 -0
- data/config/client_setups/default.json +28 -27
- data/config/initializers/i18n_globalise.rb +4 -0
- data/config/locales/admin.en.yml +38 -7
- data/config/locales/admin.es.yml +60 -6
- data/config/locales/admin.pt.yml +474 -0
- data/config/locales/admin.ru.yml +49 -6
- data/config/locales/devise.it.yml +137 -0
- data/config/locales/en.yml +7 -7
- data/config/locales/it.yml +160 -0
- data/config/locales/pt.yml +2 -0
- data/config/locales/rails.it.yml +213 -0
- data/config/locales/tr.yml +36 -36
- data/config/locales/vi.yml +5 -5
- data/config/preset_styles/green_amber.json +23 -0
- data/config/preset_styles/purple_teal.json +23 -0
- data/config/preset_styles/red_light.json +18 -0
- data/config/routes.rb +35 -23
- data/db/example_images/carousel_villa_with_pool.jpg +0 -0
- data/db/example_images/flat_luxury_dining_area.jpg +0 -0
- data/db/example_images/flat_luxury_living_area.jpg +0 -0
- data/db/migrate/20161120103546_create_pwb_props.rb +3 -3
- data/db/migrate/20161122174847_create_pwb_sections.rb +9 -8
- data/db/migrate/20161128221919_create_pwb_clients.rb +1 -0
- data/db/migrate/20170315195413_add_extra_cols_to_pwb_sections.rb +7 -6
- data/db/migrate/20170716075456_create_pwb_pages.rb +23 -0
- data/db/migrate/20170716110121_translate_pages.rb +17 -0
- data/db/migrate/20170720183443_create_pwb_links.rb +29 -0
- data/db/migrate/20170720201601_translate_links.rb +13 -0
- data/db/migrate/20170915094326_create_pwb_page_contents.rb +17 -0
- data/db/migrate/20170917215533_add_page_part_key_to_pwb_contents.rb +7 -0
- data/db/migrate/20170919134945_add_block_key_to_pwb_content_photos.rb +5 -0
- data/db/migrate/20170923195321_create_pwb_contacts.rb +33 -0
- data/db/migrate/20171011212930_create_pwb_page_parts.rb +30 -0
- data/db/seeds/translations_es.rb +1 -87
- data/db/seeds/translations_it.rb +92 -0
- data/db/yml_seeds/agency_address.yml +8 -8
- data/db/yml_seeds/contacts.yml +13 -0
- data/db/yml_seeds/content_translations/en.yml +73 -0
- data/db/yml_seeds/content_translations/es.yml +74 -0
- data/db/yml_seeds/content_translations/it.yml +73 -0
- data/db/yml_seeds/content_translations/pt.yml +73 -0
- data/db/yml_seeds/{content/footer.yml → footer.yml} +0 -0
- data/db/yml_seeds/links.yml +389 -0
- data/db/yml_seeds/page_parts/ABOUT_PAGE_PARTS.md +5 -0
- data/db/yml_seeds/page_parts/about-us__content_html.yml +24 -0
- data/db/yml_seeds/page_parts/about-us__our_agency.yml +51 -0
- data/db/yml_seeds/page_parts/contact-us__content_html.yml +24 -0
- data/db/yml_seeds/page_parts/contact-us__form_and_map.yml +17 -0
- data/db/yml_seeds/page_parts/home__about_us_services.yml +85 -0
- data/db/yml_seeds/page_parts/home__content_html.yml +24 -0
- data/db/yml_seeds/page_parts/home__landing_hero.yml +51 -0
- data/db/yml_seeds/page_parts/legal__content_html.yml +24 -0
- data/db/yml_seeds/page_parts/privacy__content_html.yml +24 -0
- data/db/yml_seeds/page_parts/sell__content_html.yml +24 -0
- data/db/yml_seeds/pages/about.yml +11 -0
- data/db/yml_seeds/pages/buy.yml +23 -0
- data/db/yml_seeds/pages/contact.yml +12 -0
- data/db/yml_seeds/pages/home.yml +15 -0
- data/db/yml_seeds/pages/legal_notice.yml +11 -0
- data/db/yml_seeds/pages/privacy_policy.yml +11 -0
- data/db/yml_seeds/pages/rent.yml +15 -0
- data/db/yml_seeds/pages/sell.yml +13 -0
- data/db/yml_seeds/prop/flat_for_rent.yml +11 -11
- data/db/yml_seeds/prop/flat_for_rent_2.yml +57 -0
- data/db/yml_seeds/prop/flat_for_sale.yml +11 -12
- data/db/yml_seeds/prop/flat_for_sale_2.yml +56 -0
- data/db/yml_seeds/prop/villa_for_rent.yml +14 -14
- data/db/yml_seeds/prop/villa_for_sale.yml +15 -15
- data/db/yml_seeds/prop_spain/flat_for_rent.yml +58 -0
- data/db/yml_seeds/prop_spain/flat_for_sale.yml +58 -0
- data/db/yml_seeds/prop_spain/villa_for_rent.yml +58 -0
- data/db/yml_seeds/prop_spain/villa_for_sale.yml +59 -0
- data/db/yml_seeds/sections.yml +119 -119
- data/db/yml_seeds/{content → to_delete}/about_us.yml +0 -0
- data/db/yml_seeds/{content → to_delete}/carousel.yml +0 -0
- data/db/yml_seeds/{content → to_delete}/content_columns.yml +0 -0
- data/db/yml_seeds/to_delete/footer.yml +15 -0
- data/db/yml_seeds/{content → to_delete}/sell.yml +0 -0
- data/db/yml_seeds/{content → to_delete}/static.yml +0 -0
- data/db/yml_seeds/website.yml +2 -1
- data/lib/pwb/engine.rb +16 -2
- data/lib/pwb/pages_seeder.rb +190 -0
- data/lib/pwb/seeder.rb +56 -14
- data/lib/pwb/version.rb +1 -1
- data/lib/tasks/pwb_tasks.rake +19 -2
- data/spec/controllers/pwb/api/v1/propeties_controller_spec.rb +2 -2
- data/spec/controllers/pwb/welcome_controller_spec.rb +18 -5
- data/spec/dummy/config/initializers/assets.rb +9 -0
- data/spec/dummy/config/routes.rb +2 -0
- data/spec/dummy/config/secrets.yml +3 -0
- data/spec/dummy/db/migrate/20171201161323_create_property_web_scraper_import_hosts.property_web_scraper.rb +22 -0
- data/spec/dummy/db/migrate/20171201161324_create_property_web_scraper_listings.property_web_scraper.rb +84 -0
- data/spec/dummy/db/schema.rb +475 -398
- data/spec/factories/pwb_contacts.rb +5 -0
- data/spec/factories/pwb_contents.rb +3 -0
- data/spec/factories/pwb_links.rb +5 -0
- data/spec/factories/pwb_page_contents.rb +5 -0
- data/spec/factories/pwb_page_parts.rb +8 -0
- data/spec/factories/pwb_pages.rb +29 -0
- data/spec/factories/pwb_prop_photos.rb +11 -2
- data/spec/fixtures/mls/properties_interealty.json +1 -496
- data/spec/fixtures/params/bulk_create.json +3 -3
- data/spec/libraries/pwb/pages_seeder_spec.rb +56 -0
- data/spec/libraries/pwb/seeder_spec.rb +14 -10
- data/spec/models/pwb/contact_spec.rb +7 -0
- data/spec/models/pwb/link_spec.rb +7 -0
- data/spec/models/pwb/page_content_spec.rb +7 -0
- data/spec/models/pwb/page_part_spec.rb +7 -0
- data/spec/models/pwb/page_spec.rb +28 -0
- data/spec/models/pwb/website_spec.rb +10 -0
- data/spec/rails_helper.rb +1 -1
- data/spec/requests/pwb/themes_spec.rb +15 -10
- data/spec/views/pwb/application_layout.html.erb_spec.rb +28 -21
- data/spec/views/pwb/contact_us.html.erb_spec.rb +11 -0
- data/spec/views/pwb/welcome.html.erb_spec.rb +13 -9
- metadata +230 -244
- data/app/controllers/pwb/api/v1/cms_pages_controller.rb +0 -102
- data/app/controllers/pwb/comfy_controller.rb +0 -106
- data/app/models/pwb/cms_page_container.rb +0 -9
- data/app/models/pwb/section.rb +0 -35
- data/app/models/pwb/welcome.rb +0 -4
- data/app/resources/pwb/api/v1/cms_block_resource.rb +0 -11
- data/app/resources/pwb/api/v1/cms_page_resource.rb +0 -27
- data/app/themes/berlin/views/pwb/sections/about_us.html.erb +0 -59
- data/app/themes/berlin/views/pwb/sections/cms.html.erb +0 -34
- data/app/themes/berlin/views/pwb/sections/static.html.erb +0 -58
- data/app/views/pwb/search/_search_result_item_to_del.html.erb +0 -56
- data/config/cms_page_containers/about-us.json +0 -18
- data/config/cms_page_containers/about.json +0 -107
- data/config/cms_page_containers/landing.json +0 -19
- data/config/cms_page_containers/legal.json +0 -17
- data/config/cms_page_containers/sell.json +0 -96
- data/config/initializers/comfortable_mexican_sofa.rb +0 -142
- data/config/initializers/i18n.rb +0 -1
- data/db/cms_fixtures/cms/categories/pages.yml +0 -3
- data/db/cms_fixtures/cms/files/_rerenting-landing_framed.png.yml +0 -6
- data/db/cms_fixtures/cms/files/rerenting-landing_framed.png +0 -0
- data/db/cms_fixtures/cms/layouts/about-us/attributes.yml +0 -4
- data/db/cms_fixtures/cms/layouts/about-us/people/attributes.yml +0 -4
- data/db/cms_fixtures/cms/layouts/about-us/people/content.html +0 -55
- data/db/cms_fixtures/cms/layouts/about-us/services/attributes.yml +0 -4
- data/db/cms_fixtures/cms/layouts/about-us/services/content.html +0 -32
- data/db/cms_fixtures/cms/layouts/about-us/services/javascript.js +0 -0
- data/db/cms_fixtures/cms/layouts/about-us/services/stylesheet.css +0 -0
- data/db/cms_fixtures/cms/layouts/about-us/stylesheet.css +0 -0
- data/db/cms_fixtures/cms/layouts/default-layout/attributes.yml +0 -4
- data/db/cms_fixtures/cms/layouts/default-layout/content.html +0 -51
- data/db/cms_fixtures/cms/layouts/default-layout/javascript.js +0 -0
- data/db/cms_fixtures/cms/layouts/default-layout/stylesheet.css +0 -0
- data/db/cms_fixtures/cms/pages/index/about-us/attributes.yml +0 -8
- data/db/cms_fixtures/cms/pages/index/about-us/people/attributes.yml +0 -8
- data/db/cms_fixtures/cms/pages/index/about-us/people/de/attributes.yml +0 -8
- data/db/cms_fixtures/cms/pages/index/about-us/people/de/person_details_a.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/people/de/person_details_b.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/people/de/person_details_c.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/people/de/person_details_d.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/people/de/person_img_url_a.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/people/de/person_img_url_b.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/people/de/person_img_url_c.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/people/de/person_img_url_d.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/people/de/person_name_a.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/people/de/person_name_b.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/people/de/person_name_c.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/people/de/person_name_d.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/people/de/person_title_a.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/people/de/person_title_b.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/people/de/person_title_c.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/people/de/person_title_d.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/people/en/attributes.yml +0 -8
- data/db/cms_fixtures/cms/pages/index/about-us/people/en/person_details_a.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/people/en/person_details_b.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/people/en/person_details_c.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/people/en/person_details_d.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/people/en/person_img_url_a.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/people/en/person_img_url_b.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/people/en/person_img_url_c.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/people/en/person_img_url_d.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/people/en/person_name_a.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/people/en/person_name_b.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/people/en/person_name_c.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/people/en/person_name_d.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/people/en/person_title_a.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/people/en/person_title_b.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/people/en/person_title_c.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/people/en/person_title_d.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/people/es/attributes.yml +0 -8
- data/db/cms_fixtures/cms/pages/index/about-us/people/es/person_details_a.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/people/es/person_details_b.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/people/es/person_details_c.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/people/es/person_details_d.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/people/es/person_img_url_a.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/people/es/person_img_url_b.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/people/es/person_img_url_c.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/people/es/person_img_url_d.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/people/es/person_name_a.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/people/es/person_name_b.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/people/es/person_name_c.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/people/es/person_name_d.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/people/es/person_title_a.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/people/es/person_title_b.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/people/es/person_title_c.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/people/es/person_title_d.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/people/pt/attributes.yml +0 -8
- data/db/cms_fixtures/cms/pages/index/about-us/people/pt/person_details_a.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/people/pt/person_details_b.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/people/pt/person_details_c.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/people/pt/person_details_d.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/people/pt/person_name_a.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/people/pt/person_name_b.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/people/pt/person_name_c.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/people/pt/person_name_d.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/people/pt/person_title_a.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/people/pt/person_title_b.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/people/pt/person_title_c.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/people/pt/person_title_d.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/people/ru/attributes.yml +0 -8
- data/db/cms_fixtures/cms/pages/index/about-us/people/ru/person_details_a.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/people/ru/person_details_b.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/people/ru/person_details_c.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/people/ru/person_details_d.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/people/ru/person_img_url_a.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/people/ru/person_img_url_b.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/people/ru/person_img_url_c.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/people/ru/person_img_url_d.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/people/ru/person_name_a.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/people/ru/person_name_b.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/people/ru/person_name_c.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/people/ru/person_name_d.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/people/ru/person_title_a.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/people/ru/person_title_b.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/people/ru/person_title_c.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/people/ru/person_title_d.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/services/attributes.yml +0 -8
- data/db/cms_fixtures/cms/pages/index/about-us/services/content_a.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/services/content_b.html +0 -0
- data/db/cms_fixtures/cms/pages/index/about-us/services/content_c.html +0 -0
- data/db/cms_fixtures/cms/pages/index/about-us/services/de/attributes.yml +0 -8
- data/db/cms_fixtures/cms/pages/index/about-us/services/de/content_a.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/services/de/content_b.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/services/de/content_c.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/services/de/title_a.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/services/de/title_b.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/services/de/title_c.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/services/en/attributes.yml +0 -8
- data/db/cms_fixtures/cms/pages/index/about-us/services/en/content_a.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/services/en/content_b.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/services/en/content_c.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/services/en/title_a.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/services/en/title_b.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/services/en/title_c.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/services/es/attributes.yml +0 -8
- data/db/cms_fixtures/cms/pages/index/about-us/services/es/content_a.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/services/es/content_b.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/services/es/content_c.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/services/es/title_a.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/services/es/title_b.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/services/es/title_c.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/services/title_a.html +0 -1
- data/db/cms_fixtures/cms/pages/index/about-us/services/title_b.html +0 -0
- data/db/cms_fixtures/cms/pages/index/about-us/services/title_c.html +0 -0
- data/db/cms_fixtures/cms/pages/index/attributes.yml +0 -8
- data/db/cms_fixtures/cms/pages/index/content.html +0 -1
- data/db/cms_fixtures/cms/pages/index/title.html +0 -0
- data/db/cms_fixtures/cms/snippets/snippet1/attributes.yml +0 -3
- data/db/cms_fixtures/cms/snippets/snippet1/content.html +0 -1
- data/db/cms_fixtures/sample-site/categories/files.yml +0 -1
- data/db/cms_fixtures/sample-site/categories/pages.yml +0 -1
- data/db/cms_fixtures/sample-site/categories/snippets.yml +0 -1
- data/db/cms_fixtures/sample-site/files/_sample.jpg.yml +0 -5
- data/db/cms_fixtures/sample-site/files/sample.jpg +0 -0
- data/db/cms_fixtures/sample-site/layouts/default/attributes.yml +0 -1
- data/db/cms_fixtures/sample-site/layouts/default/content.html +0 -5
- data/db/cms_fixtures/sample-site/layouts/default/javascript.js +0 -1
- data/db/cms_fixtures/sample-site/layouts/default/nested/attributes.yml +0 -2
- data/db/cms_fixtures/sample-site/layouts/default/nested/content.haml +0 -3
- data/db/cms_fixtures/sample-site/layouts/default/nested/javascript.js +0 -1
- data/db/cms_fixtures/sample-site/layouts/default/nested/stylesheet.css +0 -1
- data/db/cms_fixtures/sample-site/layouts/default/stylesheet.css +0 -1
- data/db/cms_fixtures/sample-site/pages/index/attributes.yml +0 -6
- data/db/cms_fixtures/sample-site/pages/index/child/attributes.yml +0 -3
- data/db/cms_fixtures/sample-site/pages/index/child/left.haml +0 -1
- data/db/cms_fixtures/sample-site/pages/index/child/right.html +0 -1
- data/db/cms_fixtures/sample-site/pages/index/child/thumbnail.png +0 -0
- data/db/cms_fixtures/sample-site/pages/index/content.html +0 -2
- data/db/cms_fixtures/sample-site/snippets/default/attributes.yml +0 -4
- data/db/cms_fixtures/sample-site/snippets/default/content.html +0 -1
- data/db/migrate/20170315212222_translate_sections.rb +0 -15
- data/db/migrate/20170513221300_create_cms.rb +0 -133
- data/lib/pwb/cms_data_loader.rb +0 -38
- data/spec/dummy/log/development.log +0 -0
- data/spec/dummy/log/test.log +0 -0
- data/spec/dummy/public/uploads/pwb/content_photo/image/1/carousel_windows.jpg +0 -0
- data/spec/dummy/public/uploads/pwb/content_photo/image/2/carousel_deck_chair.jpg +0 -0
- data/spec/dummy/public/uploads/pwb/content_photo/image/3/carousel_grass.jpg +0 -0
- data/spec/dummy/public/uploads/pwb/content_photo/image/4/carousel_grass.jpg +0 -0
- data/spec/dummy/public/uploads/pwb/prop_photo/image/1/flat_balcony.jpg +0 -0
- data/spec/dummy/public/uploads/pwb/prop_photo/image/1/gdaje3atcct1gx2ngv9u.jpg +0 -0
- data/spec/dummy/public/uploads/pwb/prop_photo/image/1/new_villa.jpg +0 -0
- data/spec/dummy/public/uploads/pwb/prop_photo/image/2/flat_balcony.jpg +0 -0
- data/spec/dummy/public/uploads/pwb/prop_photo/image/2/kitchen_modern.jpg +0 -0
- data/spec/dummy/public/uploads/pwb/prop_photo/image/2/rxo23syongfydjpoizrd.jpg +0 -0
- data/spec/dummy/public/uploads/pwb/prop_photo/image/3/mansion_front.jpg +0 -0
- data/spec/dummy/public/uploads/pwb/prop_photo/image/3/vzlptgtccsk2d2ewp4id.jpg +0 -0
- data/spec/dummy/public/uploads/pwb/prop_photo/image/4/mansion_bedroom.jpg +0 -0
- data/spec/dummy/public/uploads/pwb/prop_photo/image/4/xwayprwnmmmhrzrgwvch.jpg +0 -0
- data/spec/dummy/public/uploads/pwb/prop_photo/image/5/flat_window.jpg +0 -0
- data/spec/dummy/public/uploads/pwb/prop_photo/image/5/ilxn2u37bak0v60u6f8q.jpg +0 -0
- data/spec/dummy/public/uploads/pwb/prop_photo/image/6/kitchen_classic.jpg +0 -0
- data/spec/dummy/public/uploads/pwb/prop_photo/image/7/flat_balcony.jpg +0 -0
- data/spec/dummy/public/uploads/pwb/prop_photo/image/8/lounge_cosy.jpg +0 -0
- data/spec/factories/pwb_sections.rb +0 -4
- data/spec/models/pwb/section_spec.rb +0 -11
@@ -0,0 +1,35 @@
|
|
1
|
+
module Pwb
|
2
|
+
class Api::V1::ClientsController < JSONAPI::ResourceController
|
3
|
+
# Skipping action below allows me to browse to endpoint
|
4
|
+
# without having set mime type
|
5
|
+
skip_before_action :ensure_valid_accept_media_type
|
6
|
+
# later version changes above method name
|
7
|
+
# https://github.com/cerebris/jsonapi-resources/pull/806/files
|
8
|
+
# https://github.com/cerebris/jsonapi-resources/pull/801
|
9
|
+
|
10
|
+
# def index
|
11
|
+
# # can't figure out why default jsonapi index action returns nothing..
|
12
|
+
# sections = Section.all
|
13
|
+
# # JSONAPI::ResourceSerializer.new(Api::V1::SectionResource).serialize_to_hash(Api::V1::SectionResource.new(sections, nil))
|
14
|
+
# render json: sections
|
15
|
+
# end
|
16
|
+
|
17
|
+
def bulk_update
|
18
|
+
sectionsJSON = JSON.parse params[:items]
|
19
|
+
sections = []
|
20
|
+
sectionsJSON.each do |sectionJSON|
|
21
|
+
section = Section.find sectionJSON["id"]
|
22
|
+
section.update(sectionJSON.slice("show_in_top_nav", "show_in_footer", "sort_order"))
|
23
|
+
sections.push section
|
24
|
+
end
|
25
|
+
|
26
|
+
render json: sections.as_json
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def sections_params
|
32
|
+
params.permit(:items, items: [])
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module Pwb
|
2
|
+
class Api::V1::ContactsController < ApplicationApiController
|
3
|
+
|
4
|
+
respond_to :json
|
5
|
+
|
6
|
+
def create
|
7
|
+
Pwb::Contact.create create_contact_params
|
8
|
+
end
|
9
|
+
|
10
|
+
def update
|
11
|
+
contact = Pwb::Contact.find_by_id params[:id]
|
12
|
+
contact.update update_contact_params
|
13
|
+
return render json: contact.as_json
|
14
|
+
end
|
15
|
+
|
16
|
+
def show
|
17
|
+
contact = Pwb::Contact.find_by_id params[:id]
|
18
|
+
return render json: contact.as_json
|
19
|
+
end
|
20
|
+
|
21
|
+
def index
|
22
|
+
contacts = Pwb::Contact.all
|
23
|
+
return render json: contacts.as_json
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def create_contact_params
|
29
|
+
params.require(:details).permit(
|
30
|
+
:first_name, :last_name
|
31
|
+
)
|
32
|
+
end
|
33
|
+
|
34
|
+
def update_contact_params
|
35
|
+
params.require(:details).permit(
|
36
|
+
:first_name, :last_name
|
37
|
+
)
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module Pwb
|
2
|
+
class Api::V1::LinksController < ApplicationApiController
|
3
|
+
|
4
|
+
def index
|
5
|
+
# Globalize.fallbacks = {:ru => [:en]}
|
6
|
+
# top_nav_links, footer_links = nil
|
7
|
+
locale = params[:locale] || :en
|
8
|
+
I18n.with_locale(locale) do
|
9
|
+
top_nav_links = Link.ordered_top_nav
|
10
|
+
footer_links = Link.ordered_footer
|
11
|
+
render json: {
|
12
|
+
footer_links: footer_links.as_json,
|
13
|
+
top_nav_links: top_nav_links.as_json
|
14
|
+
}
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def bulk_update
|
19
|
+
link_groups_JSON = JSON.parse params[:linkGroups]
|
20
|
+
# above gets me around difficulty of passing an array
|
21
|
+
# as a param to rails (I've stringified json on clientside)
|
22
|
+
# without above I'd have to get keys and loop through like so
|
23
|
+
# link_groups = params[:linkGroups]
|
24
|
+
# footer_links_keys = link_groups[:footer_links].keys
|
25
|
+
# footer_links_keys.each do |footer_links_key|
|
26
|
+
# linkJSON = link_groups[:footer_links][footer_links_key]
|
27
|
+
|
28
|
+
link_groups_JSON["top_nav_links"].each do |linkJSON|
|
29
|
+
link = Link.find_by_slug linkJSON["slug"]
|
30
|
+
link.update(linkJSON)
|
31
|
+
end
|
32
|
+
link_groups_JSON["footer_links"].each do |linkJSON|
|
33
|
+
link = Link.find_by_slug linkJSON["slug"]
|
34
|
+
link.update(linkJSON)
|
35
|
+
end
|
36
|
+
render json: {
|
37
|
+
success: true
|
38
|
+
}
|
39
|
+
end
|
40
|
+
|
41
|
+
private
|
42
|
+
|
43
|
+
def links_params
|
44
|
+
params.permit(:items, items: [])
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,117 @@
|
|
1
|
+
require_dependency "pwb/application_controller"
|
2
|
+
|
3
|
+
module Pwb
|
4
|
+
class Api::V1::PageController < ApplicationApiController
|
5
|
+
# protect_from_forgery with: :null_session
|
6
|
+
def get
|
7
|
+
# admin_setup = Pwb::CmsPageContainer.where(name: params[:page_name]).first || {}
|
8
|
+
# render json: admin_setup.as_json_for_admin["attributes"]
|
9
|
+
page = Pwb::Page.find_by_slug(params[:page_name])
|
10
|
+
if page
|
11
|
+
render json: page.as_json_for_admin
|
12
|
+
else
|
13
|
+
render json: {}
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
def set_photo
|
20
|
+
page = Page.find_by_slug params[:page_slug]
|
21
|
+
|
22
|
+
unless params["block_label"]
|
23
|
+
return render_json_error 'Please provide block_label'
|
24
|
+
end
|
25
|
+
block_label = params["block_label"]
|
26
|
+
unless params["page_part_key"]
|
27
|
+
return render_json_error 'Please provide label'
|
28
|
+
end
|
29
|
+
page_part_key = params["page_part_key"]
|
30
|
+
|
31
|
+
photo = page.create_fragment_photo page_part_key, block_label, params[:file]
|
32
|
+
photo.reload
|
33
|
+
render json: {
|
34
|
+
image_url: photo.optimized_image_url
|
35
|
+
}
|
36
|
+
end
|
37
|
+
|
38
|
+
def update
|
39
|
+
page = Page.find_by_slug params[:page][:slug]
|
40
|
+
page.update(page_params)
|
41
|
+
page.save!
|
42
|
+
render json: page.as_json_for_admin
|
43
|
+
end
|
44
|
+
|
45
|
+
def update_page_part_visibility
|
46
|
+
page = Page.find_by_slug params[:page_slug]
|
47
|
+
|
48
|
+
if params["cmd"] == "setAsHidden"
|
49
|
+
page.set_fragment_visibility params[:page_part_key], false
|
50
|
+
end
|
51
|
+
if params["cmd"] == "setAsVisible"
|
52
|
+
page.set_fragment_visibility params[:page_part_key], true
|
53
|
+
end
|
54
|
+
|
55
|
+
# page.details["visiblePageParts"] = params[:visible_page_parts]
|
56
|
+
# page.save!
|
57
|
+
render json: page
|
58
|
+
end
|
59
|
+
|
60
|
+
def save_page_fragment
|
61
|
+
page = Page.find_by_slug params[:page_slug]
|
62
|
+
fragment_details = params[:fragment_details]
|
63
|
+
unless fragment_details["locale"]
|
64
|
+
return render_json_error 'Please provide locale'
|
65
|
+
end
|
66
|
+
locale = fragment_details["locale"]
|
67
|
+
unless fragment_details["page_part_key"]
|
68
|
+
return render_json_error 'Please provide page_part_key'
|
69
|
+
end
|
70
|
+
page_part_key = fragment_details["page_part_key"]
|
71
|
+
|
72
|
+
# updated_details = page.set_fragment_details page_part_key, locale, fragment_details
|
73
|
+
# fragment_html = render_to_string :partial => "pwb/fragments/#{page_part_key}", :locals => { page_part: params[:fragment_details][:blocks]}
|
74
|
+
|
75
|
+
# save the block contents (in associated page_part model)
|
76
|
+
updated_details = page.set_page_part_block_contents page_part_key, locale, fragment_details
|
77
|
+
# retrieve the contents saved above and use to rebuild html for that page_part
|
78
|
+
# (and save it in associated page_content model)
|
79
|
+
fragment_html = page.rebuild_page_content page_part_key, locale
|
80
|
+
|
81
|
+
# # Check if an image url has been set
|
82
|
+
# fragment_details.each do |fragment_detail|
|
83
|
+
# update_all_images = true
|
84
|
+
# end
|
85
|
+
|
86
|
+
# page.save!
|
87
|
+
# rescue StandardError => error
|
88
|
+
# return render_json_error error.message
|
89
|
+
# end
|
90
|
+
|
91
|
+
return render json: {
|
92
|
+
blocks: updated_details,
|
93
|
+
html: fragment_html
|
94
|
+
}
|
95
|
+
end
|
96
|
+
|
97
|
+
private
|
98
|
+
|
99
|
+
def page_fragment_params
|
100
|
+
params.require(:fragment_details).permit(:label, :locale, blocks: [:content, :identifier, :is_image])
|
101
|
+
end
|
102
|
+
|
103
|
+
|
104
|
+
def page_params
|
105
|
+
page_fields = ["sort_order_top_nav","visible"]
|
106
|
+
locales = I18n.available_locales
|
107
|
+
locales.each do |locale|
|
108
|
+
page_fields.push("link_title_#{locale}")
|
109
|
+
page_fields.push("page_title_#{locale}")
|
110
|
+
page_fields.push("raw_html_#{locale}")
|
111
|
+
end
|
112
|
+
params.require(:page).permit(
|
113
|
+
page_fields
|
114
|
+
)
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
module Pwb
|
2
|
+
# grew out of Api::V1::CmsPagesController which had used
|
3
|
+
# comfy mex sofa
|
4
|
+
class Api::V1::PageFragmentsController < ApplicationApiController
|
5
|
+
def show
|
6
|
+
page = Page.find_by_slug "home"
|
7
|
+
render json: page.details["fragments"]
|
8
|
+
end
|
9
|
+
|
10
|
+
def update
|
11
|
+
page = Page.find_by_slug "home"
|
12
|
+
|
13
|
+
services_fragment = {
|
14
|
+
"about_us_services": {
|
15
|
+
"en": cms_page_update_params[:attributes]
|
16
|
+
}
|
17
|
+
}
|
18
|
+
page.details["fragments"] = services_fragment.as_json
|
19
|
+
|
20
|
+
# page.update(page_params)
|
21
|
+
page.save!
|
22
|
+
render json: page.details["fragments"]
|
23
|
+
|
24
|
+
|
25
|
+
# updated_caches = []
|
26
|
+
# refresh_all_locales = false
|
27
|
+
# cms_page_update_params[:attributes][:blocks].each do |block_params|
|
28
|
+
# block = Comfy::Cms::Block.find block_params[:id]
|
29
|
+
# if block_params[:is_image]
|
30
|
+
# # for images I want to update all language variants of the block
|
31
|
+
# cross_locale_blocks = Comfy::Cms::Block.where(identifier: block_params[:identifier])
|
32
|
+
# cross_locale_blocks.each do |cross_locale_block|
|
33
|
+
# cross_locale_block.update block_params.slice :content
|
34
|
+
# end
|
35
|
+
# refresh_all_locales = true
|
36
|
+
# else
|
37
|
+
# block.update block_params.slice :content
|
38
|
+
# end
|
39
|
+
# # blocks.push block
|
40
|
+
# end
|
41
|
+
|
42
|
+
# if refresh_all_locales
|
43
|
+
# pages = Comfy::Cms::Page.where(label: cms_page_update_params[:attributes][:label])
|
44
|
+
# pages.each do |page|
|
45
|
+
# page.clear_content_cache
|
46
|
+
# updated_caches.push({
|
47
|
+
# page_id: page.id,
|
48
|
+
# page_content_cache: page.content_cache
|
49
|
+
# })
|
50
|
+
# end
|
51
|
+
# else
|
52
|
+
# page = Comfy::Cms::Page.find cms_page_update_params[:id]
|
53
|
+
# page.clear_content_cache
|
54
|
+
# # need to call content_cache again for refresh
|
55
|
+
# page.content_cache
|
56
|
+
# end
|
57
|
+
|
58
|
+
# # below ensures valid json_api response is sent:
|
59
|
+
# page = Comfy::Cms::Page.find cms_page_update_params[:id]
|
60
|
+
# serialized_page = JSONAPI::ResourceSerializer.new(Pwb::Api::V1::CmsPageResource).serialize_to_hash(Pwb::Api::V1::CmsPageResource.new(page, nil))
|
61
|
+
# updated_caches.push {}
|
62
|
+
# serialized_page[:data]["attributes"]["updated-caches"] = updated_caches
|
63
|
+
# # [{id: 22, cc: "dddd"}]
|
64
|
+
# render json: serialized_page
|
65
|
+
|
66
|
+
# render json: page
|
67
|
+
end
|
68
|
+
|
69
|
+
|
70
|
+
def cms_page_update_params
|
71
|
+
params.require(:data).permit(:id, attributes: [:label, blocks: [:content, :id, :identifier, :info, :is_image]])
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
@@ -5,7 +5,6 @@ module Pwb
|
|
5
5
|
skip_before_action :ensure_valid_accept_media_type
|
6
6
|
|
7
7
|
# def set_default_currency
|
8
|
-
# binding.pry
|
9
8
|
# @model
|
10
9
|
# end
|
11
10
|
|
@@ -17,21 +16,44 @@ module Pwb
|
|
17
16
|
new_props = []
|
18
17
|
existing_props = []
|
19
18
|
errors = []
|
20
|
-
|
21
19
|
propertiesJSON.each do |propertyJSON|
|
22
20
|
if Pwb::Prop.where(reference: propertyJSON["reference"]).exists?
|
23
|
-
existing_props.push propertyJSON
|
21
|
+
existing_props.push Pwb::Prop.find_by_reference propertyJSON["reference"]
|
22
|
+
# propertyJSON
|
24
23
|
else
|
25
24
|
begin
|
26
|
-
new_prop = Pwb::Prop.create
|
27
|
-
|
28
|
-
|
25
|
+
new_prop = Pwb::Prop.create(propertyJSON.except( "features", "property_photos", "locale_code"))
|
26
|
+
# new_prop = Pwb::Prop.create(propertyJSON.except("features", "property_photos", "image_urls", "last_retrieved_at"))
|
27
|
+
|
28
|
+
# create will use website defaults for currency and area_unit
|
29
|
+
# need to override that
|
30
|
+
if propertyJSON["currency"]
|
31
|
+
new_prop.currency = propertyJSON["currency"]
|
32
|
+
new_prop.save!
|
33
|
+
end
|
34
|
+
if propertyJSON["area_unit"]
|
35
|
+
new_prop.area_unit = propertyJSON["area_unit"]
|
36
|
+
new_prop.save!
|
37
|
+
end
|
38
|
+
|
39
|
+
# TODO - go over supported locales and save title and description
|
40
|
+
# into them
|
41
|
+
|
42
|
+
if propertyJSON["features"]
|
43
|
+
new_prop.set_extras=propertyJSON["features"]
|
29
44
|
end
|
30
45
|
if propertyJSON["property_photos"]
|
31
|
-
|
46
|
+
# uploading images can slow things down so worth setting a limit
|
47
|
+
max_photos_to_process = 1
|
48
|
+
# TODO - retrieve above as a param
|
49
|
+
propertyJSON["property_photos"].each_with_index do |property_photo, index|
|
50
|
+
if index > max_photos_to_process
|
51
|
+
return
|
52
|
+
end
|
32
53
|
photo = PropPhoto.create
|
33
54
|
photo.sort_order = property_photo["sort_order"] || nil
|
34
|
-
photo.remote_image_url = property_photo["
|
55
|
+
photo.remote_image_url = property_photo["url"]
|
56
|
+
# photo.remote_image_url = property_photo["image"]["url"] || property_photo["url"]
|
35
57
|
photo.save!
|
36
58
|
new_prop.prop_photos.push photo
|
37
59
|
end
|
@@ -39,7 +61,6 @@ module Pwb
|
|
39
61
|
|
40
62
|
new_props.push new_prop
|
41
63
|
rescue => err
|
42
|
-
# binding.pry
|
43
64
|
errors.push err.message
|
44
65
|
# logger.error err.message
|
45
66
|
end
|
@@ -1,35 +1,36 @@
|
|
1
|
+
# oct 2017 - no longer in use - to_delete
|
1
2
|
module Pwb
|
2
3
|
class Api::V1::SectionsController < JSONAPI::ResourceController
|
3
|
-
# Skipping action below allows me to browse to endpoint
|
4
|
-
# without having set mime type
|
5
|
-
skip_before_action :ensure_valid_accept_media_type
|
6
|
-
# later version changes above method name
|
7
|
-
# https://github.com/cerebris/jsonapi-resources/pull/806/files
|
8
|
-
# https://github.com/cerebris/jsonapi-resources/pull/801
|
4
|
+
# # Skipping action below allows me to browse to endpoint
|
5
|
+
# # without having set mime type
|
6
|
+
# skip_before_action :ensure_valid_accept_media_type
|
7
|
+
# # later version changes above method name
|
8
|
+
# # https://github.com/cerebris/jsonapi-resources/pull/806/files
|
9
|
+
# # https://github.com/cerebris/jsonapi-resources/pull/801
|
9
10
|
|
10
|
-
def index
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
end
|
11
|
+
# def index
|
12
|
+
# # can't figure out why default jsonapi index action returns nothing..
|
13
|
+
# sections = Section.all
|
14
|
+
# # JSONAPI::ResourceSerializer.new(Api::V1::SectionResource).serialize_to_hash(Api::V1::SectionResource.new(sections, nil))
|
15
|
+
# render json: sections
|
16
|
+
# end
|
16
17
|
|
17
|
-
def bulk_update
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
18
|
+
# def bulk_update
|
19
|
+
# sectionsJSON = JSON.parse params[:items]
|
20
|
+
# sections = []
|
21
|
+
# sectionsJSON.each do |sectionJSON|
|
22
|
+
# section = Section.find sectionJSON["id"]
|
23
|
+
# section.update(sectionJSON.slice("show_in_top_nav", "show_in_footer", "sort_order"))
|
24
|
+
# sections.push section
|
25
|
+
# end
|
25
26
|
|
26
|
-
|
27
|
-
end
|
27
|
+
# render json: sections.as_json
|
28
|
+
# end
|
28
29
|
|
29
|
-
private
|
30
|
+
# private
|
30
31
|
|
31
|
-
def sections_params
|
32
|
-
|
33
|
-
end
|
32
|
+
# def sections_params
|
33
|
+
# params.permit(:items, items: [])
|
34
|
+
# end
|
34
35
|
end
|
35
36
|
end
|