spree_backend 4.2.5 → 4.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +1 -1
- data/app/assets/config/spree_backend_manifest.js +129 -0
- data/app/assets/images/backend-arrows-fullscreen.svg +3 -0
- data/app/assets/images/backend-box.svg +3 -0
- data/app/assets/images/backend-circle-fill.svg +3 -0
- data/app/assets/images/backend-circle.svg +3 -0
- data/app/assets/images/backend-default-layout.svg +6 -0
- data/app/assets/images/backend-eye-slash-fill.svg +4 -0
- data/app/assets/images/backend-file-richtext.svg +4 -0
- data/app/assets/images/backend-fullscreen-exit.svg +3 -0
- data/app/assets/images/backend-fullscreen.svg +3 -0
- data/app/assets/images/backend-mobile.svg +5 -0
- data/app/assets/images/backend-pages.svg +10 -0
- data/app/assets/images/backend-phone.svg +4 -0
- data/app/assets/images/backend-reversed-layout.svg +6 -0
- data/app/assets/images/backend-spree-icon.svg +1 -0
- data/app/assets/images/backend-spree-logo.svg +6 -0
- data/app/assets/images/backend-store.svg +2 -13
- data/app/assets/images/backend-translate.svg +4 -0
- data/app/assets/images/backend-users.svg +2 -5
- data/app/assets/images/backend-window-sidebar.svg +4 -0
- data/app/assets/images/noimage/backend-missing-image.svg +4 -0
- data/app/assets/images/noimage/large.png +0 -0
- data/app/assets/images/noimage/mini.png +0 -0
- data/app/assets/images/noimage/product.png +0 -0
- data/app/assets/images/noimage/small.png +0 -0
- data/app/assets/javascripts/spree/backend/address_states.es6 +44 -0
- data/app/assets/javascripts/spree/backend/admin.js +45 -307
- data/app/assets/javascripts/spree/backend/checkouts/edit.js +22 -13
- data/app/assets/javascripts/spree/backend/cms/_index.es6 +4 -0
- data/app/assets/javascripts/spree/backend/cms/links.es6 +25 -0
- data/app/assets/javascripts/spree/backend/cms/live_preview.es6 +34 -0
- data/app/assets/javascripts/spree/backend/cms/page.es6 +133 -0
- data/app/assets/javascripts/spree/backend/cms/section.es6 +43 -0
- data/app/assets/javascripts/spree/backend/global/_index.js +11 -0
- data/app/assets/javascripts/spree/backend/global/alerts.es6 +66 -0
- data/app/assets/javascripts/spree/backend/global/api_functions.es6 +5 -0
- data/app/assets/javascripts/spree/backend/global/bootstrap.es6 +15 -0
- data/app/assets/javascripts/spree/backend/global/flatpickr.es6 +22 -0
- data/app/assets/javascripts/spree/backend/global/info_alert.es6 +38 -0
- data/app/assets/javascripts/spree/backend/global/radio_panel_toggle.es6 +18 -0
- data/app/assets/javascripts/spree/backend/global/ransack.es6 +108 -0
- data/app/assets/javascripts/spree/backend/global/responsive_menus.es6 +56 -0
- data/app/assets/javascripts/spree/backend/global/select2_autocomplete.es6 +132 -0
- data/app/assets/javascripts/spree/backend/global/select2_populate.es6 +87 -0
- data/app/assets/javascripts/spree/backend/global/side_scroll_indication.es6 +137 -0
- data/app/assets/javascripts/spree/backend/global/sortable.es6 +35 -0
- data/app/assets/javascripts/spree/backend/global/tinymce.es6 +11 -0
- data/app/assets/javascripts/spree/backend/menus/_index.es6 +2 -0
- data/app/assets/javascripts/spree/backend/menus/menu.es6 +57 -0
- data/app/assets/javascripts/spree/backend/menus/menu_item.es6 +26 -0
- data/app/assets/javascripts/spree/backend/option_type_autocomplete.js +13 -17
- data/app/assets/javascripts/spree/backend/option_value_picker.js +10 -22
- data/app/assets/javascripts/spree/backend/payments/edit.js +1 -1
- data/app/assets/javascripts/spree/backend/payments/new.js +18 -5
- data/app/assets/javascripts/spree/backend/spree-select2.js +19 -1
- data/app/assets/javascripts/spree/backend/stock_location.js +1 -2
- data/app/assets/javascripts/spree/backend/taxon_autocomplete.js +7 -1
- data/app/assets/javascripts/spree/backend/taxons.js +74 -73
- data/app/assets/javascripts/spree/backend/user_picker.js +7 -10
- data/app/assets/javascripts/spree/backend.js +28 -1
- data/app/assets/javascripts/spree.js +78 -0
- data/app/assets/stylesheets/spree/backend/components/_filters.scss +1 -3
- data/app/assets/stylesheets/spree/backend/components/_main.scss +0 -1
- data/app/assets/stylesheets/spree/backend/components/_navbar.scss +35 -0
- data/app/assets/stylesheets/spree/backend/components/_navigation.scss +13 -0
- data/app/assets/stylesheets/spree/backend/components/_sidebar.scss +0 -1
- data/app/assets/stylesheets/spree/backend/components/_tables.scss +4 -5
- data/app/assets/stylesheets/spree/backend/global/_mixins.scss +59 -0
- data/app/assets/stylesheets/spree/backend/plugins/_nav_x.scss +95 -0
- data/app/assets/stylesheets/spree/backend/plugins/{select2_bootstrap4.scss → _select2_bootstrap4.scss} +0 -0
- data/app/assets/stylesheets/spree/backend/plugins/_sweetalert2_custom.scss +100 -0
- data/app/assets/stylesheets/spree/backend/plugins/_tinymce_custom.scss +4 -0
- data/app/assets/stylesheets/spree/backend/shared/_base.scss +79 -25
- data/app/assets/stylesheets/spree/backend/shared/_forms.scss +8 -0
- data/app/assets/stylesheets/spree/backend/spree_admin.css.scss +5 -0
- data/app/assets/stylesheets/spree/backend/views/_cms_pages.scss +148 -0
- data/app/assets/stylesheets/spree/backend/views/_menus.scss +61 -0
- data/app/controllers/concerns/spree/admin/order_concern.rb +24 -0
- data/app/controllers/concerns/spree/admin/product_concern.rb +11 -0
- data/app/controllers/spree/admin/base_controller.rb +63 -3
- data/app/controllers/spree/admin/cms_pages_controller.rb +29 -0
- data/app/controllers/spree/admin/cms_sections_controller.rb +15 -0
- data/app/controllers/spree/admin/customer_returns_controller.rb +4 -5
- data/app/controllers/spree/admin/errors_controller.rb +11 -0
- data/app/controllers/spree/admin/general_settings_controller.rb +1 -1
- data/app/controllers/spree/admin/images_controller.rb +19 -16
- data/app/controllers/spree/admin/log_entries_controller.rb +4 -3
- data/app/controllers/spree/admin/menu_items_controller.rb +33 -0
- data/app/controllers/spree/admin/menus_controller.rb +32 -0
- data/app/controllers/spree/admin/option_types_controller.rb +1 -1
- data/app/controllers/spree/admin/orders/customer_details_controller.rb +6 -11
- data/app/controllers/spree/admin/orders_controller.rb +23 -31
- data/app/controllers/spree/admin/payment_methods_controller.rb +17 -4
- data/app/controllers/spree/admin/payments_controller.rb +5 -10
- data/app/controllers/spree/admin/prices_controller.rb +2 -2
- data/app/controllers/spree/admin/products_controller.rb +21 -10
- data/app/controllers/spree/admin/promotion_actions_controller.rb +1 -1
- data/app/controllers/spree/admin/promotion_rules_controller.rb +1 -1
- data/app/controllers/spree/admin/promotions_controller.rb +3 -3
- data/app/controllers/spree/admin/prototypes_controller.rb +1 -1
- data/app/controllers/spree/admin/reimbursements_controller.rb +1 -1
- data/app/controllers/spree/admin/reports_controller.rb +5 -1
- data/app/controllers/spree/admin/resource_controller.rb +32 -5
- data/app/controllers/spree/admin/return_index_controller.rb +1 -1
- data/app/controllers/spree/admin/state_changes_controller.rb +2 -7
- data/app/controllers/spree/admin/stock_items_controller.rb +2 -2
- data/app/controllers/spree/admin/stock_locations_controller.rb +2 -2
- data/app/controllers/spree/admin/stock_movements_controller.rb +1 -1
- data/app/controllers/spree/admin/stock_transfers_controller.rb +1 -1
- data/app/controllers/spree/admin/store_credits_controller.rb +13 -8
- data/app/controllers/spree/admin/stores_controller.rb +14 -17
- data/app/controllers/spree/admin/taxons_controller.rb +9 -5
- data/app/controllers/spree/admin/users_controller.rb +9 -7
- data/app/controllers/spree/admin/variants_controller.rb +16 -15
- data/app/helpers/spree/admin/base_helper.rb +52 -14
- data/app/helpers/spree/admin/cms_helper.rb +15 -0
- data/app/helpers/spree/admin/menu_helper.rb +30 -0
- data/app/helpers/spree/admin/stores_helper.rb +21 -0
- data/app/models/spree/backend_configuration.rb +2 -0
- data/app/views/spree/admin/adjustments/_adjustment.html.erb +7 -5
- data/app/views/spree/admin/cms_pages/_form.html.erb +135 -0
- data/app/views/spree/admin/cms_pages/_live_preview_area.html.erb +61 -0
- data/app/views/spree/admin/cms_pages/_section_template.html.erb +16 -0
- data/app/views/spree/admin/cms_pages/edit.html.erb +21 -0
- data/app/views/spree/admin/cms_pages/index.html.erb +84 -0
- data/app/views/spree/admin/cms_pages/new.html.erb +8 -0
- data/app/views/spree/admin/cms_sections/_form.html.erb +69 -0
- data/app/views/spree/admin/cms_sections/edit.html.erb +19 -0
- data/app/views/spree/admin/cms_sections/new.html.erb +11 -0
- data/app/views/spree/admin/cms_sections/types/_featured_article.html.erb +50 -0
- data/app/views/spree/admin/cms_sections/types/_hero_image.html.erb +61 -0
- data/app/views/spree/admin/cms_sections/types/_image_gallery.html.erb +174 -0
- data/app/views/spree/admin/cms_sections/types/_product_carousel.html.erb +5 -0
- data/app/views/spree/admin/cms_sections/types/_rich_text_content.html.erb +4 -0
- data/app/views/spree/admin/cms_sections/types/_side_by_side_images.html.erb +121 -0
- data/app/views/spree/admin/countries/index.html.erb +5 -3
- data/app/views/spree/admin/customer_returns/_reimbursements_table.html.erb +6 -4
- data/app/views/spree/admin/customer_returns/_return_item_decision.html.erb +9 -7
- data/app/views/spree/admin/customer_returns/index.html.erb +4 -2
- data/app/views/spree/admin/errors/forbidden.html.erb +0 -0
- data/app/views/spree/admin/images/index.html.erb +8 -4
- data/app/views/spree/admin/menu_items/_form.html.erb +115 -0
- data/app/views/spree/admin/menu_items/edit.html.erb +11 -0
- data/app/views/spree/admin/menu_items/new.html.erb +11 -0
- data/app/views/spree/admin/menus/_form.html.erb +19 -0
- data/app/views/spree/admin/menus/edit.html.erb +57 -0
- data/app/views/spree/admin/menus/index.html.erb +90 -0
- data/app/views/spree/admin/menus/nested_menu_items/_item_bar.html.erb +30 -0
- data/app/views/spree/admin/menus/new.html.erb +22 -0
- data/app/views/spree/admin/option_types/_form.html.erb +3 -0
- data/app/views/spree/admin/option_types/_option_value_fields.html.erb +5 -1
- data/app/views/spree/admin/option_types/index.html.erb +5 -3
- data/app/views/spree/admin/orders/_channel_form.html.erb +2 -2
- data/app/views/spree/admin/orders/_line_items.html.erb +10 -8
- data/app/views/spree/admin/orders/_shipment.html.erb +26 -18
- data/app/views/spree/admin/orders/_shipment_manifest.html.erb +11 -9
- data/app/views/spree/admin/orders/customer_details/_autocomplete.js.erb +2 -2
- data/app/views/spree/admin/orders/index.html.erb +100 -101
- data/app/views/spree/admin/payment_methods/_form.html.erb +6 -4
- data/app/views/spree/admin/payment_methods/edit.html.erb +1 -1
- data/app/views/spree/admin/payment_methods/index.html.erb +22 -3
- data/app/views/spree/admin/payment_methods/new.html.erb +1 -1
- data/app/views/spree/admin/payments/_list.html.erb +9 -7
- data/app/views/spree/admin/prices/_variant_prices.html.erb +7 -14
- data/app/views/spree/admin/product_properties/_product_property_fields.html.erb +9 -7
- data/app/views/spree/admin/products/_autocomplete.js.erb +10 -6
- data/app/views/spree/admin/products/_form.html.erb +35 -5
- data/app/views/spree/admin/products/index.html.erb +15 -14
- data/app/views/spree/admin/products/new.html.erb +6 -1
- data/app/views/spree/admin/products/stock.html.erb +71 -68
- data/app/views/spree/admin/promotion_categories/index.html.erb +5 -3
- data/app/views/spree/admin/promotions/_form.html.erb +7 -0
- data/app/views/spree/admin/promotions/actions/_create_item_adjustments.html.erb +1 -0
- data/app/views/spree/admin/promotions/calculators/_default_fields.html.erb +2 -1
- data/app/views/spree/admin/promotions/index.html.erb +33 -34
- data/app/views/spree/admin/properties/_form.html.erb +6 -0
- data/app/views/spree/admin/properties/index.html.erb +19 -3
- data/app/views/spree/admin/prototypes/_form.html.erb +1 -1
- data/app/views/spree/admin/prototypes/_prototypes.html.erb +8 -6
- data/app/views/spree/admin/prototypes/index.html.erb +5 -3
- data/app/views/spree/admin/reimbursement_types/index.html.erb +5 -3
- data/app/views/spree/admin/reports/index.html.erb +1 -1
- data/app/views/spree/admin/reports/sales_total.html.erb +1 -1
- data/app/views/spree/admin/return_authorizations/_form.html.erb +2 -2
- data/app/views/spree/admin/return_authorizations/index.html.erb +7 -5
- data/app/views/spree/admin/return_index/customer_returns.html.erb +4 -2
- data/app/views/spree/admin/return_index/return_authorizations.html.erb +5 -3
- data/app/views/spree/admin/roles/index.html.erb +5 -3
- data/app/views/spree/admin/shared/_account_nav.html.erb +5 -5
- data/app/views/spree/admin/shared/_address_form.html.erb +5 -4
- data/app/views/spree/admin/shared/_content_header.html.erb +20 -6
- data/app/views/spree/admin/shared/_head.html.erb +2 -1
- data/app/views/spree/admin/shared/_header.html.erb +7 -10
- data/app/views/spree/admin/shared/_link_fields.html.erb +22 -0
- data/app/views/spree/admin/shared/_main_menu.html.erb +19 -4
- data/app/views/spree/admin/shared/_order_tabs.html.erb +1 -10
- data/app/views/spree/admin/shared/_paths.html.erb +8 -0
- data/app/views/spree/admin/shared/_refunds.html.erb +4 -2
- data/app/views/spree/admin/shared/_sidebar.html.erb +1 -1
- data/app/views/spree/admin/shared/_store_switcher.html.erb +23 -0
- data/app/views/spree/admin/shared/_table_filter.html.erb +6 -6
- data/app/views/spree/admin/shared/_translations.html.erb +2 -0
- data/app/views/spree/admin/shared/cms/_spree_product.html.erb +27 -0
- data/app/views/spree/admin/shared/cms/_spree_taxon.html.erb +27 -0
- data/app/views/spree/admin/shared/linkables/_home_page.html.erb +3 -0
- data/app/views/spree/admin/shared/linkables/_spree_cms_page.erb +23 -0
- data/app/views/spree/admin/shared/linkables/_spree_product.html.erb +20 -0
- data/app/views/spree/admin/shared/linkables/_spree_taxon.html.erb +22 -0
- data/app/views/spree/admin/shared/linkables/_url.html.erb +16 -0
- data/app/views/spree/admin/shared/named_types/_index.html.erb +7 -5
- data/app/views/spree/admin/shared/sub_menu/_configuration.html.erb +1 -3
- data/app/views/spree/admin/shared/sub_menu/_content.html.erb +4 -0
- data/app/views/spree/admin/shared/sub_menu/_stock.html.erb +4 -0
- data/app/views/spree/admin/shipping_categories/index.html.erb +5 -3
- data/app/views/spree/admin/shipping_methods/index.html.erb +5 -3
- data/app/views/spree/admin/states/_state_list.html.erb +5 -3
- data/app/views/spree/admin/stock_locations/index.html.erb +5 -3
- data/app/views/spree/admin/stock_transfers/index.html.erb +5 -4
- data/app/views/spree/admin/stock_transfers/new.html.erb +9 -7
- data/app/views/spree/admin/store_credit_categories/index.html.erb +5 -3
- data/app/views/spree/admin/store_credits/index.html.erb +7 -5
- data/app/views/spree/admin/stores/_form.html.erb +12 -2
- data/app/views/spree/admin/stores/index.html.erb +12 -10
- data/app/views/spree/admin/tax_categories/index.html.erb +5 -3
- data/app/views/spree/admin/tax_rates/index.html.erb +5 -3
- data/app/views/spree/admin/taxonomies/_list.html.erb +5 -3
- data/app/views/spree/admin/taxons/_form.html.erb +1 -1
- data/app/views/spree/admin/users/_addresses_form.html.erb +2 -4
- data/app/views/spree/admin/users/_lifetime_stats.html.erb +16 -4
- data/app/views/spree/admin/users/index.html.erb +5 -3
- data/app/views/spree/admin/users/items.html.erb +1 -1
- data/app/views/spree/admin/variants/_autocomplete.js.erb +6 -2
- data/app/views/spree/admin/variants/_autocomplete_line_items_stock.js.erb +18 -12
- data/app/views/spree/admin/variants/_autocomplete_stock.js.erb +12 -8
- data/app/views/spree/admin/variants/_split.js.erb +9 -7
- data/app/views/spree/admin/variants/index.html.erb +8 -5
- data/app/views/spree/admin/zones/index.html.erb +5 -3
- data/app/views/spree/layouts/admin.html.erb +16 -16
- data/config/initializers/assets.rb +5 -1
- data/config/routes.rb +14 -2
- data/lib/generators/spree/backend/install/install_generator.rb +22 -0
- data/lib/generators/spree/backend/install/templates/vendor/assets/javascripts/spree/backend/all.js +8 -0
- data/lib/generators/spree/backend/install/templates/vendor/assets/stylesheets/spree/backend/all.css +9 -0
- data/lib/spree/backend/engine.rb +4 -11
- data/lib/spree/backend.rb +7 -4
- data/lib/spree_backend.rb +0 -2
- data/spec/fixtures/files/favicon.ico +0 -0
- data/spec/fixtures/files/icon_512x512.png +0 -0
- data/spree_backend.gemspec +10 -5
- data/vendor/assets/javascripts/cleave.js +8 -0
- data/vendor/assets/javascripts/jsonapi-serializer.min.js +8 -0
- data/vendor/assets/javascripts/jsuri.js +458 -0
- data/vendor/assets/javascripts/sortable.js +2 -3709
- data/vendor/assets/javascripts/sweetalert2.js +2 -0
- metadata +193 -21
- data/app/assets/javascripts/spree/backend/address_states.js +0 -44
- data/app/assets/javascripts/spree/frontend/backend.js +0 -1
- data/app/assets/stylesheets/spree/frontend/backend.css +0 -1
- data/app/views/spree/admin/orders/_store_form.html.erb +0 -18
@@ -0,0 +1,15 @@
|
|
1
|
+
module Spree
|
2
|
+
module Admin
|
3
|
+
module CmsHelper
|
4
|
+
def cms_page_preview_url(page)
|
5
|
+
page_localization = if page.locale == current_store.default_locale
|
6
|
+
nil
|
7
|
+
else
|
8
|
+
page.locale
|
9
|
+
end
|
10
|
+
|
11
|
+
spree_storefront_resource_url(page, locale: page_localization)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Spree
|
2
|
+
module Admin
|
3
|
+
module MenuHelper
|
4
|
+
def menu_item_bar(menu, item)
|
5
|
+
render 'spree/admin/menus/nested_menu_items/item_bar', menu: menu, item: item
|
6
|
+
end
|
7
|
+
|
8
|
+
def build_menu_item(menu, item)
|
9
|
+
decendents = []
|
10
|
+
|
11
|
+
unless item.leaf?
|
12
|
+
item.children.each do |child_item|
|
13
|
+
decendents << build_menu_item(menu, child_item) unless item.leaf?
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
info_row = menu_item_bar(menu, item)
|
18
|
+
menu_container = content_tag(:div, raw(decendents.join), class: 'menu-container', data: { parent_id: item.id })
|
19
|
+
|
20
|
+
content_tag(:div, info_row + menu_container,
|
21
|
+
class: 'menu-item menu-container-item dragable removable-dom-element',
|
22
|
+
data: { item_id: item.id })
|
23
|
+
end
|
24
|
+
|
25
|
+
def default_menu_for_store?(menu)
|
26
|
+
menu.store.default_locale == menu.locale
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -4,6 +4,27 @@ module Spree
|
|
4
4
|
def selected_checkout_zone(store)
|
5
5
|
store&.checkout_zone || Spree::Zone.default_checkout_zone
|
6
6
|
end
|
7
|
+
|
8
|
+
def stores_dropdown_values
|
9
|
+
formatted_stores = []
|
10
|
+
|
11
|
+
@stores.map { |store| formatted_stores << [store.unique_name, store.id] }
|
12
|
+
|
13
|
+
formatted_stores
|
14
|
+
end
|
15
|
+
|
16
|
+
def store_switcher_link(store)
|
17
|
+
if current_store.id == store.id
|
18
|
+
classes = 'disabled bg-light'
|
19
|
+
icon = svg_icon name: 'circle-fill.svg', width: '18', height: '18'
|
20
|
+
else
|
21
|
+
classes = nil
|
22
|
+
icon = svg_icon name: 'circle.svg', width: '18', height: '18'
|
23
|
+
end
|
24
|
+
|
25
|
+
link_to icon + store.unique_name, url_for(host: store.formatted_url),
|
26
|
+
class: "#{classes} text-dark p-3 dropdown-item", id: store.code
|
27
|
+
end
|
7
28
|
end
|
8
29
|
end
|
9
30
|
end
|
@@ -1,6 +1,8 @@
|
|
1
1
|
module Spree
|
2
2
|
class BackendConfiguration < Preferences::Configuration
|
3
3
|
preference :locale, :string, default: Rails.application.config.i18n.default_locale
|
4
|
+
preference :variants_per_page, :integer, default: Kaminari.config.default_per_page
|
5
|
+
preference :menus_per_page, :integer, default: Kaminari.config.default_per_page
|
4
6
|
|
5
7
|
ORDER_TABS ||= [:orders, :payments, :creditcard_payments,
|
6
8
|
:shipments, :credit_cards, :return_authorizations,
|
@@ -18,10 +18,12 @@
|
|
18
18
|
<%= Spree.t("state_machine_states.#{adjustment.state}") %>
|
19
19
|
</span>
|
20
20
|
</td>
|
21
|
-
<td class="actions
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
21
|
+
<td class="actions">
|
22
|
+
<span class="d-flex justify-content-center">
|
23
|
+
<% if adjustment.open? %>
|
24
|
+
<%= link_to_edit(adjustment, no_text: true) if can?(:edit, adjustment) %>
|
25
|
+
<%= link_to_delete(adjustment, no_text: true) if can?(:delete, adjustment) %>
|
26
|
+
<% end %>
|
27
|
+
</span>
|
26
28
|
</td>
|
27
29
|
</tr>
|
@@ -0,0 +1,135 @@
|
|
1
|
+
<div id="<% if @cms_page.type == 'Spree::Cms::Pages::StandardPage' %>standardPage<% end %>" data-hook="admin_page_form_fields">
|
2
|
+
<div class="row sp-pb-0">
|
3
|
+
<div class="col-12">
|
4
|
+
<div class="card sp-card">
|
5
|
+
<% unless %w[new create].include? controller.action_name %>
|
6
|
+
<div class="card-header col-12">
|
7
|
+
<div class="row no-gutters pb-0">
|
8
|
+
<div class="col d-flex justify-content-start align-items-center">
|
9
|
+
<%= f.field_container :visible, class: ['form-group pb-0 mb-0'] do %>
|
10
|
+
<div class="custom-control custom-switch custom-switch-md">
|
11
|
+
<%= f.check_box :visible, class: 'custom-control-input', data: {cms_page_id: @cms_page.id} %>
|
12
|
+
<label class="custom-control-label" for="cms_page_visible"></label>
|
13
|
+
<%= f.error_message_on :visible %>
|
14
|
+
</div>
|
15
|
+
<% end %>
|
16
|
+
|
17
|
+
<span id="visibilityStatus" class="d-flex align-items-center">
|
18
|
+
<span class="page_hidden badge badge-secondary <% if @cms_page.visible? %>d-none<% end %>">
|
19
|
+
<%= svg_icon name: "eye-slash-fill.svg", width: '18', height: '18' %> <%= Spree.t('admin.cms.draft_mode') %>
|
20
|
+
</span>
|
21
|
+
|
22
|
+
<span class="page_visible badge badge-primary <% if @cms_page.draft_mode? %>d-none<% end %>">
|
23
|
+
<%= svg_icon name: "view.svg", width: '18', height: '18' %> <%= Spree.t('admin.cms.visible') %>
|
24
|
+
</span>
|
25
|
+
</span>
|
26
|
+
</div>
|
27
|
+
<div class="col-auto d-flex align-items-center">
|
28
|
+
<span class="badge badge-secondary">
|
29
|
+
<%= svg_icon name: "translate.svg", width: '18', height: '18' %> <%= locale_full_name(@cms_page.locale) %>
|
30
|
+
</span>
|
31
|
+
</div>
|
32
|
+
</div>
|
33
|
+
</div>
|
34
|
+
<% end %>
|
35
|
+
|
36
|
+
<div class="card-body pb-2">
|
37
|
+
<div class="row pb-0">
|
38
|
+
|
39
|
+
<%= f.field_container :title, class: ['form-group col-12 col-md-6'] do %>
|
40
|
+
<%= f.label :title, raw(Spree.t('admin.cms.title') + required_span_tag) %>
|
41
|
+
<%= f.text_field :title, class: 'form-control', required: true %>
|
42
|
+
<%= f.error_message_on :title %>
|
43
|
+
<% end %>
|
44
|
+
|
45
|
+
<%= f.field_container :type, class: ['form-group col-12 col-md-6'] do %>
|
46
|
+
<%= f.label :type, Spree.t('admin.cms.page_type') %>
|
47
|
+
<%= f.select(:type, spree_humanize_dropdown_values('Spree::CmsPage', {const: 'TYPES'}), {include_blank: false}, class: 'select2') %>
|
48
|
+
<%= f.error_message_on :type %>
|
49
|
+
<% end %>
|
50
|
+
|
51
|
+
<% unless %w[new create].include? controller.action_name %>
|
52
|
+
<div class="col-12 mt-3">
|
53
|
+
<div id="updatePageType" data-page-type="<%= @cms_page.type %>" class="alert alert-info d-none">
|
54
|
+
<% button_type = Spree.t('update') %>
|
55
|
+
<%= raw Spree.t('admin.cms.click_button_to_change_page_type', button_type: button_type) %>
|
56
|
+
</div>
|
57
|
+
</div>
|
58
|
+
<% end %>
|
59
|
+
</div>
|
60
|
+
|
61
|
+
<div class="<% unless %w[new create].include? controller.action_name %>collapse<% end %>" id="cmsPageSettings">
|
62
|
+
<div class="row pb-0">
|
63
|
+
<div class="col-12"><hr></div>
|
64
|
+
<%= f.field_container :locale, class: ['form-group col-12 col-md-4'] do %>
|
65
|
+
<%= f.label :language %>
|
66
|
+
<%= f.select :locale, options_from_collection_for_select(supported_locales_options, :last, :first, @cms_page.locale || I18n.locale), {}, { class: 'select2' } %>
|
67
|
+
<%= f.error_message_on :default_locale %>
|
68
|
+
<% end %>
|
69
|
+
|
70
|
+
<%= f.field_container :meta_title, class: ['form-group col-12 col-md-4'] do %>
|
71
|
+
<%= f.label :meta_title, Spree.t('admin.cms.meta_title') %>
|
72
|
+
<%= f.text_field :meta_title, class: 'form-control' %>
|
73
|
+
<%= f.error_message_on :meta_title %>
|
74
|
+
<% end %>
|
75
|
+
|
76
|
+
<%= f.field_container :slug, class: ['form-group col-12 col-md-4'] do %>
|
77
|
+
<div id="noHomePage">
|
78
|
+
<%= f.label :slug, Spree.t('slug') %>
|
79
|
+
<%= f.text_field :slug, class: 'form-control', disabled: @cms_page.homepage? %>
|
80
|
+
<%= f.error_message_on :slug %>
|
81
|
+
</div>
|
82
|
+
<% end %>
|
83
|
+
|
84
|
+
<%= f.field_container :meta_description, class: ['form-group col-12'] do %>
|
85
|
+
<%= f.label :meta_description, Spree.t('admin.cms.meta_description') %>
|
86
|
+
<%= f.text_area :meta_description, { rows: 3, class: 'form-control' } %>
|
87
|
+
<%= f.error_message_on :meta_description %>
|
88
|
+
<% end %>
|
89
|
+
</div>
|
90
|
+
</div>
|
91
|
+
|
92
|
+
<% unless %w[new create].include? controller.action_name %>
|
93
|
+
<div class="row pb-0">
|
94
|
+
<% if @cms_page.type != 'Spree::Cms::Pages::StandardPage' %>
|
95
|
+
<div class="col-12 col-sm-7">
|
96
|
+
<%= render partial: 'spree/admin/shared/edit_resource_links' %>
|
97
|
+
</div>
|
98
|
+
<% else %>
|
99
|
+
<div class="col"></div>
|
100
|
+
<% end %>
|
101
|
+
|
102
|
+
<div class="col-12 col-sm text-right pt-3 pt-sm-0">
|
103
|
+
<button id="toggleMorePageSettingsButton" class="btn btn-outline-secondary" type="button" data-toggle="collapse" data-target="#cmsPageSettings" aria-expanded="false" aria-controls="collapsePageSettings">
|
104
|
+
<%= raw Spree.t('admin.cms.more_page_settings') %>
|
105
|
+
</button>
|
106
|
+
</div>
|
107
|
+
</div>
|
108
|
+
<% end %>
|
109
|
+
|
110
|
+
<% if %w[new create].include? controller.action_name %>
|
111
|
+
<div class="row pb-0">
|
112
|
+
<div class="col-6">
|
113
|
+
<%= render partial: 'spree/admin/shared/new_resource_links' %>
|
114
|
+
</div>
|
115
|
+
</div>
|
116
|
+
<% end %>
|
117
|
+
</div>
|
118
|
+
</div>
|
119
|
+
</div>
|
120
|
+
</div>
|
121
|
+
</div>
|
122
|
+
|
123
|
+
<% if @cms_page.type == 'Spree::Cms::Pages::StandardPage' %>
|
124
|
+
<div class="row">
|
125
|
+
<div class="col-12">
|
126
|
+
<%= f.field_container :content, class: ['form-group'] do %>
|
127
|
+
<%= f.text_area :content, { rows: 22, class: 'spree-rte'} %>
|
128
|
+
<%= f.error_message_on :content %>
|
129
|
+
<% end %>
|
130
|
+
</div>
|
131
|
+
</div>
|
132
|
+
<div class="d-flex ">
|
133
|
+
<%= render partial: 'spree/admin/shared/edit_resource_links' %>
|
134
|
+
</div>
|
135
|
+
<% end %>
|
@@ -0,0 +1,61 @@
|
|
1
|
+
<div class="row">
|
2
|
+
<div id="pageSectionsArea" class="col-12">
|
3
|
+
|
4
|
+
<hr class="mt-4 hide-on-full-screen-mode">
|
5
|
+
<div class="row">
|
6
|
+
<div class="col d-flex justify-content-start">
|
7
|
+
<%= button_link_to Spree.t('admin.cms.add_new_section'), spree.new_admin_cms_page_cms_section_path(@cms_page), icon: 'add.svg', class: 'no-wrap btn btn-success align-self-center' %>
|
8
|
+
</div>
|
9
|
+
<div class="col d-none d-md-flex justify-content-end">
|
10
|
+
<div id="LiveViewSwitcher" class="btn-group btn-group-toggle" data-toggle="buttons">
|
11
|
+
<label class="btn btn-outline-primary active">
|
12
|
+
<input type="radio" name="options" id="mobileLiveView" autocomplete="off"> Mobile
|
13
|
+
</label>
|
14
|
+
<label class="btn btn-outline-primary">
|
15
|
+
<input type="radio" name="options" id="tabletLiveView" autocomplete="off"> Tablet
|
16
|
+
</label>
|
17
|
+
<label class="btn btn-outline-primary">
|
18
|
+
<input type="radio" name="options" id="desktopLiveView" autocomplete="off" checked> Desktop
|
19
|
+
</label>
|
20
|
+
</div>
|
21
|
+
|
22
|
+
<div class="ml-2">
|
23
|
+
<button id="cmsSectionEditorFullScreen" type="button" class="btn btn-outline-primary no-wrap" data-toggle="button" autocomplete="off"><%= raw Spree.t('admin.cms.full_screen_mode') %></button>
|
24
|
+
</div>
|
25
|
+
</div>
|
26
|
+
</div>
|
27
|
+
<div class="row no-gutters">
|
28
|
+
<div id="draggableSectionsHolder" class="col-12 col-md-3 bg-light border">
|
29
|
+
<% if @cms_page.cms_sections.any? %>
|
30
|
+
<div id="cmsPagesectionsArea" class="card-body row m-0 p-1 no-gutters">
|
31
|
+
<% @cms_page.cms_sections.each do |section| %>
|
32
|
+
<%= render 'spree/admin/cms_pages/section_template', section: section %>
|
33
|
+
<% end %>
|
34
|
+
</div>
|
35
|
+
|
36
|
+
<% else %>
|
37
|
+
<div class="row">
|
38
|
+
<div class="col-12">
|
39
|
+
<div class="alert alert-info no-objects-found m-4">
|
40
|
+
<%= raw Spree.t('admin.cms.no_sections_found_please_add_one') %>
|
41
|
+
</div>
|
42
|
+
</div>
|
43
|
+
</div>
|
44
|
+
<% end %>
|
45
|
+
</div>
|
46
|
+
|
47
|
+
<div class="d-none d-md-block col bg-secondary border border-left-0">
|
48
|
+
<div id="liveViewCont" class="desktopLiveView">
|
49
|
+
<div class="embed-responsive embed-responsive-4by3">
|
50
|
+
<iframe class="embed-responsive-item"
|
51
|
+
id="pageLivePreview"
|
52
|
+
src="<%= cms_page_preview_url(@cms_page) + "?no_cache=#{rand(1...10000)}" %>"
|
53
|
+
sandbox="allow-same-origin allow-forms allow-popups allow-scripts allow-modals">
|
54
|
+
</iframe>
|
55
|
+
</div>
|
56
|
+
</div>
|
57
|
+
</div>
|
58
|
+
|
59
|
+
</div>
|
60
|
+
</div>
|
61
|
+
</div>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<div class="col-12 p-0 removable-dom-element" data-section-id="<%= section.id %>">
|
2
|
+
<div class="row m-0 mb-1 pb-0 border border-secondary bg-white">
|
3
|
+
<div class="col move-handle d-flex pr-0 truncate">
|
4
|
+
<div class="py-3 align-items-center overflow-hidden w-100">
|
5
|
+
<h6 class="m-0 truncate"><%= section.name %></h6>
|
6
|
+
<small class="form-text mt-0 text-muted"><%= spree_humanize_type(section.type) %></small>
|
7
|
+
</div>
|
8
|
+
</div>
|
9
|
+
<div>
|
10
|
+
<div class="col h-100 d-flex flex-column align-self-sm-stretch p-0 justify-content-between actions cms_section_action_col">
|
11
|
+
<%= link_to_edit(section, no_text: true, url: spree.edit_admin_cms_page_cms_section_path(@cms_page, section)) %>
|
12
|
+
<%= link_to_delete(section, no_text: true, url: spree.admin_cms_page_cms_section_path(@cms_page, section)) if can?(:destroy, section) %>
|
13
|
+
</div>
|
14
|
+
</div>
|
15
|
+
</div>
|
16
|
+
</div>
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<% content_for :page_title do %>
|
2
|
+
<%= link_to Spree.t('admin.cms.all_pages'), spree.admin_cms_pages_path %> / <%= @cms_page.title %>
|
3
|
+
<% end %>
|
4
|
+
|
5
|
+
<% content_for :page_actions do %>
|
6
|
+
<%= button_link_to(Spree.t('admin.cms.preview_page'),
|
7
|
+
cms_page_preview_url(@cms_page),
|
8
|
+
class: 'btn-outline-secondary',
|
9
|
+
icon: 'view.svg',
|
10
|
+
id: 'admin_preview_product',
|
11
|
+
target: :blank) %>
|
12
|
+
<% end %>
|
13
|
+
|
14
|
+
<%= render partial: 'spree/admin/shared/error_messages', locals: { target: @cms_page } %>
|
15
|
+
<%= form_for [:admin, @cms_page], as: :cms_page, url: spree.admin_cms_page_path do |f| %>
|
16
|
+
<%= render partial: 'form', locals: { f: f } %>
|
17
|
+
<% end %>
|
18
|
+
|
19
|
+
<% if @cms_page.sections? %>
|
20
|
+
<%= render partial: 'live_preview_area' %>
|
21
|
+
<% end %>
|
@@ -0,0 +1,84 @@
|
|
1
|
+
<% content_for :page_title do %>
|
2
|
+
<%= Spree.t('admin.cms.all_pages') %>
|
3
|
+
<% end %>
|
4
|
+
|
5
|
+
<% content_for :page_actions do %>
|
6
|
+
<%= button_link_to Spree.t('admin.cms.add_new_page'), new_object_url, { class: "btn-success", icon: 'add.svg', id: 'new_page' } %>
|
7
|
+
<% end if can?(:create, Spree::CmsPage) %>
|
8
|
+
|
9
|
+
<% content_for :table_filter do %>
|
10
|
+
<div data-hook="admin_menus_sidebar">
|
11
|
+
<%= search_form_for [:admin, @search] do |f| %>
|
12
|
+
<%- locals = {f: f} %>
|
13
|
+
<div class="row">
|
14
|
+
<div class="col-12 col-lg-4">
|
15
|
+
<div class="form-group">
|
16
|
+
<%= f.label :title_cont, Spree.t('admin.cms.title') %>
|
17
|
+
<%= f.text_field :title_cont, size: 15, class: "form-control js-quick-search-target js-filterable" %>
|
18
|
+
</div>
|
19
|
+
</div>
|
20
|
+
|
21
|
+
<div class="col-12 col-lg-4">
|
22
|
+
<div class="form-group">
|
23
|
+
<%= label_tag :q_type_eq, Spree.t(:type) %>
|
24
|
+
<%= f.select(:type_eq, spree_humanize_dropdown_values('Spree::CmsPage', {const: 'TYPES'}), {include_blank: true}, class: 'select2-clear js-filterable') %>
|
25
|
+
</div>
|
26
|
+
</div>
|
27
|
+
|
28
|
+
<div class="col-12 col-lg-4">
|
29
|
+
<div class="form-group">
|
30
|
+
<%= label_tag :q_locale_eq, Spree.t(:language) %>
|
31
|
+
<%= f.select :locale_eq, all_locales_options, { include_blank: true }, class: 'select2-clear js-filterable' %>
|
32
|
+
</div>
|
33
|
+
</div>
|
34
|
+
</div>
|
35
|
+
|
36
|
+
<div data-hook="admin_menus_index_search_buttons" class="form-actions">
|
37
|
+
<%= button Spree.t(:search), 'search.svg' %>
|
38
|
+
</div>
|
39
|
+
<% end %>
|
40
|
+
</div>
|
41
|
+
<% end %>
|
42
|
+
|
43
|
+
<% if @cms_pages.any? %>
|
44
|
+
<div class="table-responsive">
|
45
|
+
<table class="table" id="pagesTable">
|
46
|
+
<thead>
|
47
|
+
<th scope="col"><%= Spree.t('admin.cms.title') %></th>
|
48
|
+
<th scope="col"><%= Spree.t('admin.cms.visible') %></th>
|
49
|
+
<th scope="col"><%= Spree.t('admin.cms.page_type') %></th>
|
50
|
+
<th scope="col"><%= Spree.t('language') %></th>
|
51
|
+
<th scope="col"></th>
|
52
|
+
</thead>
|
53
|
+
<tbody>
|
54
|
+
<% @cms_pages.each do |page| %>
|
55
|
+
<tr>
|
56
|
+
<td>
|
57
|
+
<%= page.title %>
|
58
|
+
</td>
|
59
|
+
<td>
|
60
|
+
<%= active_badge(page.visible?) %>
|
61
|
+
</td>
|
62
|
+
<td>
|
63
|
+
<%= spree_humanize_type(page.type) %>
|
64
|
+
</td>
|
65
|
+
<td>
|
66
|
+
<%= locale_full_name(page.locale) %>
|
67
|
+
</td>
|
68
|
+
<td class="actions" data-hook="admin_pages_index_row_actions">
|
69
|
+
<span class="d-flex justify-content-end">
|
70
|
+
<%= link_to_edit(page, no_text: true) %>
|
71
|
+
<%= link_to_delete page, no_text: true, url: spree.admin_cms_page_path(page) if can?(:destroy, page) %>
|
72
|
+
</span>
|
73
|
+
</td>
|
74
|
+
</tr>
|
75
|
+
<% end %>
|
76
|
+
</tbody>
|
77
|
+
</table>
|
78
|
+
</div>
|
79
|
+
<%= render 'spree/admin/shared/index_table_options', collection: @cms_pages, simple: true %>
|
80
|
+
<% else %>
|
81
|
+
<div class="alert alert-info no-objects-found">
|
82
|
+
<%= raw Spree.t('admin.cms.you_have_no_pages') %>
|
83
|
+
</div>
|
84
|
+
<% end %>
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<% content_for :page_title do %>
|
2
|
+
<%= link_to Spree.t('admin.cms.all_pages'), spree.admin_cms_pages_path %> / <%= Spree.t('admin.cms.new_page') %>
|
3
|
+
<% end %>
|
4
|
+
|
5
|
+
<%= render partial: 'spree/admin/shared/error_messages', locals: { target: @cms_page } %>
|
6
|
+
<%= form_for [:admin, @cms_page] do |f| %>
|
7
|
+
<%= render partial: 'form', locals: { f: f } %>
|
8
|
+
<% end %>
|
@@ -0,0 +1,69 @@
|
|
1
|
+
<div data-hook="admin_cms_section_form_fields">
|
2
|
+
<div class="row">
|
3
|
+
<div class="col-12 col-md-6">
|
4
|
+
<%= f.field_container :name, class: ['form-group'] do %>
|
5
|
+
<%= f.label :name, raw(Spree.t(:name) + required_span_tag) %>
|
6
|
+
<%= f.text_field :name, class: 'form-control', required: true, autocomplete: false %>
|
7
|
+
<%= f.error_message_on :name %>
|
8
|
+
<% end %>
|
9
|
+
</div>
|
10
|
+
<div class="col-12 col-md-6">
|
11
|
+
<%= f.field_container :type, class: ['form-group'] do %>
|
12
|
+
<%= f.label :type, Spree.t('admin.cms.section_type') %>
|
13
|
+
<%= f.select(:type, spree_humanize_dropdown_values('Spree::CmsSection', {const: 'TYPES'}), {include_blank: false}) %>
|
14
|
+
<%= f.error_message_on :type %>
|
15
|
+
<% end %>
|
16
|
+
</div>
|
17
|
+
</div>
|
18
|
+
|
19
|
+
<div id="alertToClickUpdate" class="d-none">
|
20
|
+
<div class="row">
|
21
|
+
<div class="col-12">
|
22
|
+
<div class="alert alert-warning mt-3">
|
23
|
+
<% if %w[new create].include? controller.action_name %>
|
24
|
+
<%= raw Spree.t('admin.cms.click_create_to_load_new_link') %>
|
25
|
+
<% else %>
|
26
|
+
<%= raw Spree.t('admin.cms.click_update_to_load_new_link') %>
|
27
|
+
<% end %>
|
28
|
+
</div>
|
29
|
+
</div>
|
30
|
+
</div>
|
31
|
+
</div>
|
32
|
+
|
33
|
+
<% if @cms_section.type.present? %>
|
34
|
+
<div id="CmsSectionType"
|
35
|
+
data-hook="admin_cms_section_form_fields"
|
36
|
+
data-panel-section-type="<%= @cms_section.type %>">
|
37
|
+
<div class="row">
|
38
|
+
<div class="col-12">
|
39
|
+
<div class="card mb-3">
|
40
|
+
<div class="card-header d-flex">
|
41
|
+
<div class="d-flex flex-grow-1">
|
42
|
+
<h5 class="mb-0">
|
43
|
+
<%= raw Spree.t('admin.cms.settings_for', section: spree_humanize_type(@cms_section.type)) %>
|
44
|
+
</h5>
|
45
|
+
</div>
|
46
|
+
<div class="d-flex">
|
47
|
+
<span data-show-info
|
48
|
+
data-alert-kind="info"
|
49
|
+
data-alert-title="<%= spree_humanize_type(@cms_section.type) %>"
|
50
|
+
data-alert-html="<%= raw I18n.t("spree.admin.cms.info_#{spree_resource_path(@cms_section)}_body") %>">
|
51
|
+
<%= svg_icon name: "info.svg", width: '25', height: '25' %>
|
52
|
+
</span>
|
53
|
+
</div>
|
54
|
+
</div>
|
55
|
+
<div class="card-body">
|
56
|
+
<% if @cms_section.type.present? %>
|
57
|
+
<div class="row pb-0">
|
58
|
+
<div class="col-12">
|
59
|
+
<%= render "spree/admin/cms_sections/types/#{spree_resource_path(@cms_section)}", f: f %>
|
60
|
+
</div>
|
61
|
+
</div>
|
62
|
+
<% end %>
|
63
|
+
</div>
|
64
|
+
</div>
|
65
|
+
</div>
|
66
|
+
</div>
|
67
|
+
</div>
|
68
|
+
<% end %>
|
69
|
+
</div>
|