mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-16 19:16:49 +00:00
Compare commits
18 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4960402643 | ||
|
|
3557c10cd6 | ||
|
|
45dd421f1f | ||
|
|
11653c9430 | ||
|
|
d068094044 | ||
|
|
b892bf726e | ||
|
|
ba45dd84dd | ||
|
|
92e2a83e0e | ||
|
|
f42f513f8c | ||
|
|
54342254b6 | ||
|
|
470761da86 | ||
|
|
6fdf9fa038 | ||
|
|
bbec01a9cb | ||
|
|
e3001cc8c4 | ||
|
|
ad0d0e393e | ||
|
|
2690ff5eb5 | ||
|
|
2594382488 | ||
|
|
946b69242c |
@@ -157,7 +157,7 @@ GEM
|
||||
awesome_nested_set (3.5.0)
|
||||
activerecord (>= 4.0.0, < 7.1)
|
||||
aws-eventstream (1.2.0)
|
||||
aws-partitions (1.742.0)
|
||||
aws-partitions (1.750.0)
|
||||
aws-sdk-core (3.171.0)
|
||||
aws-eventstream (~> 1, >= 1.0.2)
|
||||
aws-partitions (~> 1, >= 1.651.0)
|
||||
@@ -166,7 +166,7 @@ GEM
|
||||
aws-sdk-kms (1.63.0)
|
||||
aws-sdk-core (~> 3, >= 3.165.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-s3 (1.120.1)
|
||||
aws-sdk-s3 (1.121.0)
|
||||
aws-sdk-core (~> 3, >= 3.165.0)
|
||||
aws-sdk-kms (~> 1)
|
||||
aws-sigv4 (~> 1.4)
|
||||
@@ -652,7 +652,7 @@ GEM
|
||||
semantic_range (3.0.0)
|
||||
shoulda-matchers (5.3.0)
|
||||
activesupport (>= 5.2.0)
|
||||
sidekiq (7.0.8)
|
||||
sidekiq (7.0.9)
|
||||
concurrent-ruby (< 2)
|
||||
connection_pool (>= 2.3.0)
|
||||
rack (>= 2.2.4)
|
||||
@@ -697,7 +697,7 @@ GEM
|
||||
rack (>= 2, < 4)
|
||||
railties (>= 5.2, < 8)
|
||||
redis (>= 4.0, < 6.0)
|
||||
stringex (2.8.5)
|
||||
stringex (2.8.6)
|
||||
stripe (8.5.0)
|
||||
swd (1.3.0)
|
||||
activesupport (>= 3)
|
||||
|
||||
@@ -12,5 +12,6 @@ angular.module("ofn.admin", [
|
||||
"admin.orders"
|
||||
]).config ($httpProvider, $locationProvider, $qProvider) ->
|
||||
$httpProvider.defaults.headers.common["Accept"] = "application/json, text/javascript, */*"
|
||||
# for the next line, you should also probably check file: app/assets/javascripts/admin/utils/utils.js.coffee
|
||||
$locationProvider.hashPrefix('')
|
||||
$qProvider.errorOnUnhandledRejections(false)
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
angular.module("admin.utils", ["templates", "ngSanitize"]).config ($httpProvider, $locationProvider) ->
|
||||
# for the next line, you should also probably check file: app/assets/javascripts/admin/admin_ofn.js.coffee
|
||||
$locationProvider.hashPrefix('')
|
||||
$httpProvider.defaults.headers.common["Accept"] = "application/json, text/javascript, */*"
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class ConfirmModalComponent < ModalComponent
|
||||
def initialize(id:, confirm_actions: nil, controllers: nil, message: nil)
|
||||
def initialize(id:, confirm_actions: nil, controllers: nil, message: nil, confirm_reflexes: nil)
|
||||
super(id: id, close_button: true)
|
||||
@confirm_actions = confirm_actions
|
||||
@confirm_reflexes = confirm_reflexes
|
||||
@controllers = controllers
|
||||
@message = message
|
||||
end
|
||||
|
||||
@@ -7,4 +7,4 @@
|
||||
|
||||
.modal-actions
|
||||
%input{ class: "button icon-plus #{close_button_class}", type: 'button', value: t('js.admin.modals.cancel'), "data-action": "click->modal#close" }
|
||||
%input{ class: "button icon-plus primary", type: 'button', value: t('js.admin.modals.confirm'), "data-action": @confirm_actions }
|
||||
%input{ class: "button icon-plus primary", type: 'button', value: t('js.admin.modals.confirm'), "data-action": @confirm_actions, "data-reflex": @confirm_reflexes }
|
||||
|
||||
@@ -10,5 +10,12 @@ module WhiteLabel
|
||||
# if the distributor has the hide_ofn_navigation preference set to true
|
||||
# then we should hide the OFN navigation
|
||||
@hide_ofn_navigation = distributor.hide_ofn_navigation
|
||||
|
||||
# if the distributor has the hide_ofn_navigation preference
|
||||
# set to false, there is no need to check the white_label_logo preference
|
||||
return unless @hide_ofn_navigation
|
||||
|
||||
@white_label_logo = distributor.white_label_logo
|
||||
@white_label_distributor = distributor
|
||||
end
|
||||
end
|
||||
|
||||
@@ -15,6 +15,10 @@ class Enterprise < ApplicationRecord
|
||||
medium: { resize_to_fill: [720, 156] },
|
||||
large: { resize_to_fill: [1200, 260] },
|
||||
}.freeze
|
||||
WHITE_LABEL_LOGO_SIZES = {
|
||||
default: { gravity: "Center", resize_to_fill: [217, 44] },
|
||||
mobile: { gravity: "Center", resize_to_fill: [75, 26] },
|
||||
}.freeze
|
||||
VALID_INSTAGRAM_REGEX = %r{\A[a-zA-Z0-9._]{1,30}([^/-]*)\z}
|
||||
|
||||
searchable_attributes :sells, :is_primary_producer, :name
|
||||
@@ -84,6 +88,7 @@ class Enterprise < ApplicationRecord
|
||||
has_one_attached :logo
|
||||
has_one_attached :promo_image
|
||||
has_one_attached :terms_and_conditions
|
||||
has_one_attached :white_label_logo
|
||||
|
||||
validates :logo,
|
||||
processable_image: true,
|
||||
@@ -302,6 +307,14 @@ class Enterprise < ApplicationRecord
|
||||
)
|
||||
end
|
||||
|
||||
def white_label_logo_url(name = :default)
|
||||
return unless white_label_logo.variable?
|
||||
|
||||
Rails.application.routes.url_helpers.url_for(
|
||||
white_label_logo.variant(WHITE_LABEL_LOGO_SIZES[name])
|
||||
)
|
||||
end
|
||||
|
||||
def website
|
||||
strip_url self[:website]
|
||||
end
|
||||
|
||||
12
app/reflexes/concerns/enterprise_concern.rb
Normal file
12
app/reflexes/concerns/enterprise_concern.rb
Normal file
@@ -0,0 +1,12 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module EnterpriseConcern
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
before_reflex do
|
||||
@enterprise = Enterprise.find_by(permalink: params[:id])
|
||||
authorize! :update, @enterprise
|
||||
end
|
||||
end
|
||||
end
|
||||
24
app/reflexes/white_label_reflex.rb
Normal file
24
app/reflexes/white_label_reflex.rb
Normal file
@@ -0,0 +1,24 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class WhiteLabelReflex < ApplicationReflex
|
||||
include EnterpriseConcern
|
||||
delegate :view_context, to: :controller
|
||||
|
||||
def remove_logo
|
||||
@enterprise.update!(white_label_logo: nil)
|
||||
|
||||
f = ActionView::Helpers::FormBuilder.new(:enterprise, @enterprise, view_context, {})
|
||||
|
||||
html = with_locale {
|
||||
render(partial: "admin/enterprises/form/white_label",
|
||||
locals: { f: f, enterprise: @enterprise })
|
||||
}
|
||||
morph "#white_label_panel", html
|
||||
|
||||
flash[:success] = with_locale {
|
||||
I18n.t("admin.enterprises.form.white_label.remove_logo_success")
|
||||
}
|
||||
cable_ready.dispatch_event(name: "modal:close")
|
||||
morph "#flashes", render(partial: "shared/flashes", locals: { flashes: flash })
|
||||
end
|
||||
end
|
||||
@@ -14,7 +14,7 @@ module Api
|
||||
:logo, :promo_image, :terms_and_conditions,
|
||||
:terms_and_conditions_file_name, :terms_and_conditions_updated_at,
|
||||
:preferred_invoice_order_by_supplier, :preferred_product_low_stock_display,
|
||||
:visible, :hide_ofn_navigation
|
||||
:visible, :hide_ofn_navigation, :white_label_logo
|
||||
|
||||
has_one :owner, serializer: Api::Admin::UserSerializer
|
||||
has_many :users, serializer: Api::Admin::UserSerializer
|
||||
@@ -29,6 +29,10 @@ module Api
|
||||
attachment_urls(object.promo_image, Enterprise::PROMO_IMAGE_SIZES)
|
||||
end
|
||||
|
||||
def white_label_logo
|
||||
attachment_urls(object.white_label_logo, Enterprise::WHITE_LABEL_LOGO_SIZES)
|
||||
end
|
||||
|
||||
def terms_and_conditions
|
||||
return unless object.terms_and_conditions.attached?
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ module Api
|
||||
:phone, :whatsapp_phone, :whatsapp_url, :visible, :email_address, :hash, :logo,
|
||||
:promo_image, :path, :category, :active, :producers, :orders_close_at, :hubs,
|
||||
:taxons, :supplied_taxons, :pickup, :delivery, :preferred_product_low_stock_display,
|
||||
:hide_ofn_navigation
|
||||
:hide_ofn_navigation, :white_label_logo
|
||||
|
||||
has_one :address, serializer: Api::AddressSerializer
|
||||
has_many :supplied_properties, serializer: Api::PropertySerializer
|
||||
@@ -49,6 +49,10 @@ module Api
|
||||
enterprise.promo_image_url(:large)
|
||||
end
|
||||
|
||||
def white_label_logo
|
||||
enterprise.white_label_logo_url
|
||||
end
|
||||
|
||||
def path
|
||||
enterprise_shop_path(enterprise)
|
||||
end
|
||||
|
||||
@@ -35,7 +35,7 @@ module PermittedAttributes
|
||||
:show_customer_names_to_suppliers, :preferred_shopfront_product_sorting_method,
|
||||
:preferred_invoice_order_by_supplier,
|
||||
:preferred_product_low_stock_display,
|
||||
:hide_ofn_navigation
|
||||
:hide_ofn_navigation, :white_label_logo,
|
||||
]
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,6 +1,23 @@
|
||||
- @object ||= enterprise
|
||||
|
||||
.row
|
||||
.three.columns.alpha
|
||||
= f.label :hide_ofn_navigation, t('.hide_ofn_navigation')
|
||||
.three.columns
|
||||
= f.check_box :hide_ofn_navigation
|
||||
= f.check_box :hide_ofn_navigation, { "data-controller": "checkbox-display", "data-checkbox-display-target-id-value": "white_label_logo" }
|
||||
|
||||
.row{id: "white_label_logo"}
|
||||
.three.columns.alpha
|
||||
= f.label :white_label_logo, t('.upload_logo')
|
||||
.three.columns
|
||||
= image_tag @object.white_label_logo_url if @object.white_label_logo.present?
|
||||
= f.file_field :white_label_logo, accept: "image/*"
|
||||
- if @object.white_label_logo.variable?
|
||||
%button.button.small{ type: "button", "data-controller": "modal-link", "data-action": "click->modal-link#open", "data-modal-link-target-value": "remove_logo" }
|
||||
= t('.remove_logo')
|
||||
|
||||
|
||||
- if @object.white_label_logo.variable?
|
||||
= render ConfirmModalComponent.new(id: "remove_logo", confirm_reflexes: "click->WhiteLabel#remove_logo" ) do
|
||||
.margin-bottom-30
|
||||
= t('.remove_logo_confirm')
|
||||
|
||||
@@ -3,7 +3,10 @@
|
||||
%ul.nav-logo
|
||||
%li.ofn-logo
|
||||
%a{href: main_app.root_path}
|
||||
%img{src: ContentConfig.url_for(:logo)}
|
||||
- if @white_label_logo&.variable?
|
||||
= image_tag @white_label_distributor.white_label_logo_url(:default)
|
||||
- else
|
||||
%img{src: ContentConfig.url_for(:logo)}
|
||||
%li.powered-by
|
||||
%img{src: '/favicon.ico'}
|
||||
%span
|
||||
|
||||
@@ -6,7 +6,10 @@
|
||||
%section.left
|
||||
.ofn-logo
|
||||
%a{href: main_app.root_path}
|
||||
%img{src: ContentConfig.url_for(:logo_mobile), srcset: ContentConfig.url_for(:logo_mobile_svg), width: "75", height: "26"}
|
||||
- if @white_label_logo&.variable?
|
||||
= image_tag @white_label_distributor.white_label_logo_url(:mobile)
|
||||
- else
|
||||
%img{src: ContentConfig.url_for(:logo_mobile), srcset: ContentConfig.url_for(:logo_mobile_svg), width: "75", height: "26"}
|
||||
|
||||
%section.right{"ng-cloak" => true}
|
||||
%span.cart-span{"ng-class" => "{ dirty: Cart.dirty || Cart.empty(), 'pure-dirty': Cart.dirty }"}
|
||||
|
||||
37
app/webpacker/controllers/checkbox_display_controller.js
Normal file
37
app/webpacker/controllers/checkbox_display_controller.js
Normal file
@@ -0,0 +1,37 @@
|
||||
import { Controller } from "stimulus";
|
||||
|
||||
export default class extends Controller {
|
||||
static values = { targetId: String };
|
||||
|
||||
connect() {
|
||||
this.element.addEventListener("change", this.change.bind(this));
|
||||
if (this.element.checked) {
|
||||
this.showTarget();
|
||||
} else {
|
||||
this.hideTarget();
|
||||
}
|
||||
}
|
||||
|
||||
disconnect() {
|
||||
this.element.removeEventListener("change", this.change.bind(this));
|
||||
}
|
||||
|
||||
change(event) {
|
||||
// if the checkbox is checked, display the target
|
||||
if (this.element.checked) {
|
||||
this.showTarget();
|
||||
} else {
|
||||
this.hideTarget();
|
||||
}
|
||||
}
|
||||
|
||||
showTarget() {
|
||||
let target = document.getElementById(this.targetIdValue);
|
||||
target.style.display = "block";
|
||||
}
|
||||
|
||||
hideTarget() {
|
||||
let target = document.getElementById(this.targetIdValue);
|
||||
target.style.display = "none";
|
||||
}
|
||||
}
|
||||
@@ -1161,6 +1161,10 @@ en:
|
||||
white_label:
|
||||
legend: "White Label"
|
||||
hide_ofn_navigation: "Hide OFN navigation"
|
||||
upload_logo: "Logo used in shopfront"
|
||||
remove_logo: "Remove logo"
|
||||
remove_logo_confirm: "Are you sure you want to remove this logo?"
|
||||
remove_logo_success: "Logo removed"
|
||||
actions:
|
||||
edit_profile: Settings
|
||||
properties: Properties
|
||||
|
||||
@@ -6,9 +6,22 @@ ru:
|
||||
spree/shipping_method: Способ Доставки
|
||||
attributes:
|
||||
spree/order/ship_address:
|
||||
address1: "Адрес доставки (Улица + Номер дома)"
|
||||
address2: "2 строка адреса доставки"
|
||||
city: "Город адреса доставки "
|
||||
country: "Страна доставки"
|
||||
phone: "Номер телефона"
|
||||
firstname: "Имя"
|
||||
lastname: "Фамилия"
|
||||
zipcode: "Почтовый индекс адреса доставки"
|
||||
spree/order/bill_address:
|
||||
address1: "Платежный адрес (Улица + Номер дома)"
|
||||
zipcode: "Почтовый индекс платежного адреса"
|
||||
city: "Город адреса платежа"
|
||||
country: "Страна платежного адреса"
|
||||
firstname: "Имя платежного адреса"
|
||||
lastname: "Фамилия платежного адреса"
|
||||
phone: Телефон клиента
|
||||
spree/user:
|
||||
password: "Пароль"
|
||||
password_confirmation: "Подтверждение пароля"
|
||||
@@ -409,8 +422,11 @@ ru:
|
||||
filters:
|
||||
categories:
|
||||
title: Категории
|
||||
selected_categories: "выбрано категории %{count}"
|
||||
producers:
|
||||
title: Производители
|
||||
selected_producers: "%{count} выбраны производители"
|
||||
per_page: "%{count} элементов на странице"
|
||||
colums: Колонки
|
||||
columns:
|
||||
name: Название
|
||||
@@ -665,6 +681,7 @@ ru:
|
||||
not_found: не найден в базе данных
|
||||
category_not_found: не соответствует разрешенным категориям. Посмотрите, какие категории выбрать на странице импорта продуктов, или проверьте, нет ли орфографических ошибок.
|
||||
not_updatable: невозможно обновить существующие товары с помощью импорта товаров
|
||||
values_must_be_same: должно быть одинаковым для товаров с одинаковым названием
|
||||
blank: не может быть пустым
|
||||
products_no_permission: у Вас нет разрешения на управление товарами этого предприятия
|
||||
inventory_no_permission: у Вас нет разрешения на создание товарной номенклатуры этого производителя
|
||||
@@ -839,6 +856,7 @@ ru:
|
||||
legend: "Адрес"
|
||||
business_details:
|
||||
legend: "Юридическая Информация"
|
||||
upload: 'загрузить'
|
||||
abn: ИНН
|
||||
abn_placeholder: напр. 0123456789
|
||||
acn: Полное юридическое наименование
|
||||
@@ -1053,8 +1071,20 @@ ru:
|
||||
email_confirmed: "Email подтверждён"
|
||||
email_not_confirmed: "Email не подтверждён"
|
||||
vouchers:
|
||||
legend: Купоны
|
||||
voucher_code: Код Купона
|
||||
rate: Ставка
|
||||
label: Этикетка
|
||||
purpose: Цель
|
||||
expiry: Срок действия
|
||||
use_limit: Использование/Ограничение
|
||||
customers: Клиент
|
||||
net_value: Чистая стоимость
|
||||
add_new: Добавить новое
|
||||
no_voucher_yet: Купонов пока нет
|
||||
white_label:
|
||||
legend: "Белая Этикетка"
|
||||
hide_ofn_navigation: "Скрыть навигацию ОСП"
|
||||
actions:
|
||||
edit_profile: Настройки
|
||||
properties: Свойства
|
||||
@@ -1290,6 +1320,8 @@ ru:
|
||||
tag_rules: "Правила Меток"
|
||||
shop_preferences: "Параметры Магазина"
|
||||
users: "Пользователи"
|
||||
vouchers: Купоны
|
||||
white_label: "Белая Этикетка"
|
||||
enterprise_group:
|
||||
primary_details: "Основная Информация"
|
||||
users: "Пользователи"
|
||||
@@ -1312,6 +1344,7 @@ ru:
|
||||
total_by_customer: Итого По Клиентам
|
||||
total_by_supplier: Всего По Поставщику
|
||||
supplier_totals: Итоговые данные Поставщика Цикла Заказа
|
||||
percentage: "%{value} %"
|
||||
supplier_totals_by_distributor: Итоговые данные Поставщика Цикла Заказа по Дистрибьюторам
|
||||
totals_by_supplier: Итоговые данные Дистрибьютора за Цикл Заказов по Поставщикам
|
||||
customer_totals: Итоги по Клиентам Цикла Заказа
|
||||
@@ -1322,11 +1355,18 @@ ru:
|
||||
addresses: Адреса
|
||||
payment_methods: Отчет О Способах Оплаты
|
||||
delivery: Отчет О Доставке
|
||||
sales_tax_totals_by_producer: Итоговые Суммы Налога с Продаж по Производителям
|
||||
sales_tax_totals_by_order: Сумма Налога с Продаж по Заказу
|
||||
tax_types: Типы Налогов
|
||||
tax_rates: Налоговые Ставки
|
||||
pack_by_customer: Выборка по Клиенту
|
||||
pack_by_supplier: Выборка по Поставщику
|
||||
pack_by_product: Пакет По Продукту
|
||||
show:
|
||||
report_taking_longer: >
|
||||
К сожалению, обработка этого отчета заняла слишком много времени. Он может
|
||||
содержать много данных или мы заняты другими отчетами. Вы можете повторить
|
||||
попытку позже.
|
||||
revenues_by_hub:
|
||||
name: Доходы По Центрам
|
||||
description: Доходы по центрам
|
||||
@@ -1497,8 +1537,10 @@ ru:
|
||||
associated_subscriptions_error: Это расписание не может быть удалено, потому что оно имеет связанные подписки
|
||||
vouchers:
|
||||
new:
|
||||
legend: Новый Купон
|
||||
back: Назад
|
||||
save: Сохранить
|
||||
voucher_code: Код Купона
|
||||
voucher_amount: Количество
|
||||
controllers:
|
||||
enterprises:
|
||||
@@ -1507,6 +1549,16 @@ ru:
|
||||
stripe_connect_fail: К сожалению, не удалось подключиться к вашей учетной записи Stripe
|
||||
stripe_connect_settings:
|
||||
resource: Конфигурация Stripe Connect
|
||||
resend_confirmation_emails_feedback:
|
||||
one: "Письмо с подтверждением отправлено для 1 заказа."
|
||||
few: "Электронные письма с подтверждением отправлены для заказов %{count}."
|
||||
many: "Электронные письма с подтверждением отправлены для заказов %{count}."
|
||||
other: "Электронные письма с подтверждением отправлены для заказов %{count}."
|
||||
send_invoice_feedback:
|
||||
one: "Электронный счет-фактура отправлен за 1 заказ."
|
||||
few: "Электронные счета-фактуры отправлены для заказов %{count}."
|
||||
many: "Электронные счета-фактуры отправлены для заказов %{count}."
|
||||
other: "Электронные счета-фактуры отправлены для %{count} заказов ."
|
||||
api:
|
||||
unknown_error: "Что-то пошло не так. Наша команда уже уведомлена."
|
||||
invalid_api_key: "Указан неверный API ключ (%{key})."
|
||||
@@ -1523,6 +1575,10 @@ ru:
|
||||
destroy_attachment_does_not_exist: "Файл Условий и Положений не существует"
|
||||
orders:
|
||||
failed_to_update: "Не удалось обновить заказ"
|
||||
query_param:
|
||||
error:
|
||||
title: Неверный параметр запроса
|
||||
extra_fields: "Не поддерживаемые поля: %{fields}"
|
||||
checkout:
|
||||
already_ordered:
|
||||
cart: "корзина"
|
||||
@@ -1817,6 +1873,7 @@ ru:
|
||||
message_html: "У вас уже есть заказ для этого цикла заказов. Проверьте %{cart}, чтобы увидеть товары, которые вы заказали ранее. Вы также можете отменять позиции, пока открыт цикл заказа."
|
||||
step1:
|
||||
contact_information:
|
||||
title: Контактная информация
|
||||
email:
|
||||
label: Email
|
||||
phone:
|
||||
@@ -1870,10 +1927,13 @@ ru:
|
||||
title: Подробности доставки
|
||||
edit: Изменить
|
||||
address: Адрес доставки
|
||||
instructions: Инструкции
|
||||
payment_method:
|
||||
title: Способ оплаты
|
||||
edit: Изменить
|
||||
instructions: Инструкции
|
||||
order:
|
||||
title: Информация по заказу
|
||||
edit: Изменить
|
||||
terms_and_conditions:
|
||||
message_html: "Согласен на %{terms_and_conditions_link} продавца."
|
||||
@@ -1886,6 +1946,7 @@ ru:
|
||||
submit: Завершить заказ
|
||||
cancel: Вернуться к Способу оплаты
|
||||
errors:
|
||||
saving_failed: "Не удалось сохранить. Обновите выделенные поля. %{messages}"
|
||||
terms_not_accepted: Пожалуйста, примите Условия использования
|
||||
required: Поле не может быть пустым
|
||||
invalid_number: "Пожалуйста, введите действующий номер телефона"
|
||||
@@ -2668,6 +2729,8 @@ ru:
|
||||
report_header_tax_on_delivery: "Налог на доставку (%{currency_symbol})"
|
||||
report_header_tax_on_fees: "Налог на сборы (%{currency_symbol})"
|
||||
report_header_tax_category: "Налоговая Категория"
|
||||
report_header_tax_rate_name: "Название Налоговой Ставки"
|
||||
report_header_tax_rate: "Ставка Налога"
|
||||
report_header_total_tax: "Общий налог (%{currency_symbol})"
|
||||
report_header_total_excl_tax: "Итого искл. налог (%{currency_symbol})"
|
||||
report_header_total_incl_tax: "Итого, вкл. налог (%{currency_symbol})"
|
||||
@@ -2677,6 +2740,7 @@ ru:
|
||||
report_header_customer_code: Код Клиента
|
||||
report_header_product: Товар
|
||||
report_header_product_properties: Свойства Товара
|
||||
report_header_product_tax_category: Категория Налога на Товар
|
||||
report_header_quantity: Количество
|
||||
report_header_max_quantity: Max Количество
|
||||
report_header_variant: Вариант
|
||||
@@ -2689,6 +2753,8 @@ ru:
|
||||
report_header_supplier: Поставщик
|
||||
report_header_producer: Производитель
|
||||
report_header_producer_suburb: Город Производителя
|
||||
report_header_producer_tax_status: Налоговый Статус Производителя
|
||||
report_header_producer_charges_sales_tax?: Зарегистрирован НДС
|
||||
report_header_unit: Единица измерения
|
||||
report_header_group_buy_unit_quantity: Группа покупает количество единиц
|
||||
report_header_cost: Стоимость
|
||||
@@ -2704,10 +2770,12 @@ ru:
|
||||
report_header_distributor_address: Адрес Дистрибьютора
|
||||
report_header_distributor_city: Город Дистрибьютора
|
||||
report_header_distributor_postcode: Почтовый индекс Дистрибьютора
|
||||
report_header_distributor_tax_status: Налоговый Статус Дистрибьютора
|
||||
report_header_delivery_address: Адрес Доставки
|
||||
report_header_delivery_postcode: Почтовый индекс Доставки
|
||||
report_header_bulk_unit_size: Размер оптовой единицы
|
||||
report_header_weight: Вес
|
||||
report_header_final_weight_volume: Окончательный (Вес/Объем)
|
||||
report_header_height: Высота
|
||||
report_header_width: Ширина
|
||||
report_header_depth: Глубина
|
||||
@@ -2884,6 +2952,7 @@ ru:
|
||||
deleting_item_will_cancel_order: "Эта операция приведет к созданию одного или нескольких пустых заказов, которые будут отменены. Вы хотите продолжить?"
|
||||
modals:
|
||||
got_it: "Понятно"
|
||||
confirm: "Подтвердить"
|
||||
close: "Закрыть"
|
||||
continue: "Продолжить"
|
||||
cancel: "Выход"
|
||||
@@ -3081,6 +3150,11 @@ ru:
|
||||
cancel_the_order_send_cancelation_email: "Отправить клиенту электронное письмо об отмене"
|
||||
restock_item: "Restock Items: вернуть этот товар на склад"
|
||||
restock_items: "Restock Items: вернуть все товары на склад"
|
||||
delete_line_items_html:
|
||||
one: "Это приведет к удалению одной позиции из заказа.<br /> Вы уверены, что хотите продолжить?"
|
||||
few: "Это приведет к удалению позиций %{count} из заказа.<br /> Вы уверены, что хотите продолжить?"
|
||||
many: "Это приведет к удалению позиций %{count} из заказа.<br /> Вы уверены, что хотите продолжить?"
|
||||
other: "Это приведет к удалению позиций %{count} из заказа.<br /> Вы уверены, что хотите продолжить?"
|
||||
resend_user_email_confirmation:
|
||||
resend: "Повторно отправить"
|
||||
sending: "Повторная Отправка..."
|
||||
@@ -3420,6 +3494,13 @@ ru:
|
||||
first: "Первый"
|
||||
previous: "Предыдущий"
|
||||
last: "Последний"
|
||||
webhook_endpoints:
|
||||
create:
|
||||
success: Конечная точка веб-хука успешно создана
|
||||
error: Не удалось создать конечную точку веб-хука
|
||||
destroy:
|
||||
success: Конечная точка веб-хука успешно удалена
|
||||
error: Не удалось удалить конечную точку веб-хука.
|
||||
spree:
|
||||
add_country: "Добавить страну"
|
||||
add_state: "Добавить область"
|
||||
@@ -3460,6 +3541,8 @@ ru:
|
||||
server_error: "Ошибка сервера"
|
||||
shipping_method_names:
|
||||
UPS Ground: "UPS Ground"
|
||||
pick_up: "Самовывоз на ферме"
|
||||
delivery: "Подписано, запечатано, доставлено"
|
||||
start_date: "Дата начала"
|
||||
successfully_removed: "Успешно удалено"
|
||||
taxonomy_edit: "Изменить таксономию"
|
||||
@@ -3544,6 +3627,7 @@ ru:
|
||||
display_currency: "Показывать валюту"
|
||||
choose_currency: "Выбор валюты"
|
||||
mail_method_settings: "Почтовые Настройки"
|
||||
mail_settings_notice_html: "<b>Внесенные здесь изменения будут временными</b> только для отладки и могут быть отменены в будущем.<br> Постоянные изменения можно внести, обновив секреты экземпляра и предоставив их с помощью <a href='https://github.com/openfoodfoundation/ofn-install'>ofn-install</a> . Свяжитесь с глобальной командой ОСП для получения дополнительной информации."
|
||||
general: "Основные"
|
||||
enable_mail_delivery: "Включить отправку почты"
|
||||
send_mails_as: "Отправлять Почту Как"
|
||||
@@ -3592,6 +3676,7 @@ ru:
|
||||
shipping_categories: "Категории Доставки"
|
||||
new_shipping_category: "Новая Категория Доставки"
|
||||
back_to_shipping_categories: "Назад в Категории Доставки"
|
||||
editing_shipping_category: "Редактирование Категории Доставки"
|
||||
name: "Имя"
|
||||
description: "Описание"
|
||||
type: "Тип"
|
||||
@@ -3666,6 +3751,7 @@ ru:
|
||||
messages:
|
||||
included_price_validation: "не может быть выбран, если вы не установили Налоговую Зону по Умолчанию"
|
||||
blank: "не может быть пустым"
|
||||
invalid_instagram_url: "Должно быть только имя пользователя, например the_prof"
|
||||
layouts:
|
||||
admin:
|
||||
login_nav:
|
||||
@@ -3776,6 +3862,9 @@ ru:
|
||||
print_invoices: "Печать Счетов"
|
||||
cancel_orders: "Отменить Заказы"
|
||||
resend_confirmation: "Подтверждение Заказа"
|
||||
resend_confirmation_confirm_html: "Это приведет к повторной отправке письма с подтверждением клиенту.<br /> Вы уверены, что хотите продолжить?"
|
||||
send_invoice: "Отправить Счета"
|
||||
send_invoice_confirm_html: "Счета клиентов будут отправлены по электронной почте для всех выбранных полных заказов.<br> Вы уверены, что хотите продолжить?"
|
||||
selected:
|
||||
zero: "Заказ не выбран"
|
||||
one: "1 заказ выбран"
|
||||
@@ -3924,6 +4013,7 @@ ru:
|
||||
title: "Новый Товар"
|
||||
new_product: "Новый Товар"
|
||||
supplier: "Поставщик"
|
||||
supplier_select_placeholder: "Выберите поставщика"
|
||||
product_name: "Название Товара"
|
||||
units: "Единица измерения"
|
||||
value: "Значение"
|
||||
@@ -3969,6 +4059,9 @@ ru:
|
||||
select_and_search: "Для получения данных, выберите фильры и нажмите на %{option}."
|
||||
customer_names_message:
|
||||
customer_names_tip: "Если имена клиентов скрыты для заказов, которые вы предоставили, вы можете связаться с дистрибьютором и спросить, могут ли они обновить настройки своего магазина, чтобы их поставщики могли просматривать имена клиентов."
|
||||
products_and_inventory:
|
||||
all_products:
|
||||
message: "Обратите внимание, что указанные уровни запасов взяты только из списков продуктов поставщиков. Если вы используете Товарную Номенклатуру для управления запасами, эти значения будут игнорироваться в этом отчете."
|
||||
users:
|
||||
index:
|
||||
listing_users: "Список Пользователей"
|
||||
@@ -4188,6 +4281,16 @@ ru:
|
||||
api_keys:
|
||||
regenerate_key: "Пересоздать Ключ"
|
||||
title: Ключ API
|
||||
webhook_endpoints:
|
||||
title: Конечные точки веб-хука
|
||||
description: События в системе могут запускать веб-хуки к внешним системам.
|
||||
event_types:
|
||||
order_cycle_opened: Цикл Заказа Открыт
|
||||
event_type:
|
||||
header: Тип события
|
||||
url:
|
||||
header: URL-адрес конечной точки
|
||||
create_placeholder: Введите URL-адрес конечной точки удаленного веб-хука.
|
||||
developer_settings:
|
||||
title: Настройки Разработчика
|
||||
form:
|
||||
@@ -4345,6 +4448,7 @@ ru:
|
||||
search_input:
|
||||
placeholder: Поиск
|
||||
selector_with_filter:
|
||||
selected_items: "выбрано %{count}"
|
||||
search_placeholder: Поиск
|
||||
pagination:
|
||||
next: Следующий
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* @jest-environment jsdom
|
||||
*/
|
||||
|
||||
import { Application } from "stimulus";
|
||||
import checkbox_display_controller from "../../../app/webpacker/controllers/checkbox_display_controller";
|
||||
|
||||
describe("CheckboxDisplayController", () => {
|
||||
beforeAll(() => {
|
||||
const application = Application.start();
|
||||
application.register("checkbox-display", checkbox_display_controller);
|
||||
});
|
||||
|
||||
describe("#toggle", () => {
|
||||
beforeEach(() => {
|
||||
document.body.innerHTML = `<div >
|
||||
<input type="checkbox" id="checkbox" data-controller="checkbox-display" data-checkbox-display-target-id-value="content" />
|
||||
<div id="content">
|
||||
content
|
||||
</div>
|
||||
</div>`;
|
||||
});
|
||||
|
||||
it("show the content if the checkbox is checked, hide content either", () => {
|
||||
const checkbox = document.getElementById("checkbox");
|
||||
const content = document.getElementById("content");
|
||||
|
||||
expect(content.style.display).toBe("none");
|
||||
|
||||
checkbox.click();
|
||||
|
||||
expect(content.style.display).toBe("block");
|
||||
|
||||
checkbox.click();
|
||||
|
||||
expect(content.style.display).toBe("none");
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -60,4 +60,17 @@ describe Api::Admin::EnterpriseSerializer do
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context "for white label logo" do
|
||||
let(:enterprise) { create(:distributor_enterprise, white_label_logo: black_logo_file) }
|
||||
|
||||
context "when there is a white label logo" do
|
||||
it "includes URLs of image versions" do
|
||||
serializer = Api::Admin::EnterpriseSerializer.new(enterprise)
|
||||
expect(serializer.as_json[:white_label_logo]).to be_present
|
||||
expect(serializer.as_json[:white_label_logo][:default]).to match(/logo-black\.png$/)
|
||||
expect(serializer.as_json[:white_label_logo][:mobile]).to match(/logo-black\.png$/)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -10,6 +10,7 @@ describe '
|
||||
include AuthenticationHelper
|
||||
include ShopWorkflow
|
||||
include UIComponentHelper
|
||||
include FileHelper
|
||||
|
||||
it "viewing an enterprise" do
|
||||
e = create(:enterprise)
|
||||
@@ -645,6 +646,80 @@ describe '
|
||||
expect(page).not_to have_link "White Label"
|
||||
end
|
||||
end
|
||||
|
||||
context "when the feature is enabled" do
|
||||
before do
|
||||
Flipper.enable(:white_label)
|
||||
visit edit_admin_enterprise_path(distributor1)
|
||||
|
||||
within(".side_menu") do
|
||||
click_link "White Label"
|
||||
end
|
||||
end
|
||||
|
||||
it "set the hide_ofn_navigation preference for the current shop" do
|
||||
expect(page).not_to have_content "LOGO USED IN SHOPFRONT"
|
||||
check "Hide OFN navigation"
|
||||
click_button 'Update'
|
||||
expect(flash_message)
|
||||
.to eq('Enterprise "First Distributor" has been successfully updated!')
|
||||
expect(distributor1.reload.hide_ofn_navigation).to be true
|
||||
|
||||
visit edit_admin_enterprise_path(distributor1)
|
||||
within(".side_menu") do
|
||||
click_link "White Label"
|
||||
end
|
||||
|
||||
expect(page).to have_content "LOGO USED IN SHOPFRONT"
|
||||
uncheck "Hide OFN navigation"
|
||||
click_button 'Update'
|
||||
expect(flash_message)
|
||||
.to eq('Enterprise "First Distributor" has been successfully updated!')
|
||||
expect(distributor1.reload.hide_ofn_navigation).to be false
|
||||
end
|
||||
|
||||
context "when white label is active via `hide_ofn_navigation`" do
|
||||
before do
|
||||
distributor1.update_attribute(:hide_ofn_navigation, true)
|
||||
|
||||
visit edit_admin_enterprise_path(distributor1)
|
||||
within(".side_menu") do
|
||||
click_link "White Label"
|
||||
end
|
||||
end
|
||||
|
||||
it "can updload the white label logo for the current shop" do
|
||||
attach_file "enterprise_white_label_logo", white_logo_path
|
||||
click_button 'Update'
|
||||
expect(flash_message)
|
||||
.to eq('Enterprise "First Distributor" has been successfully updated!')
|
||||
expect(distributor1.reload.white_label_logo_blob.filename).to eq("logo-white.png")
|
||||
end
|
||||
|
||||
context "when enterprise has a white label logo" do
|
||||
before do
|
||||
distributor1.update white_label_logo: white_logo_file
|
||||
|
||||
visit edit_admin_enterprise_path(distributor1)
|
||||
within(".side_menu") do
|
||||
click_link "White Label"
|
||||
end
|
||||
end
|
||||
|
||||
it "can remove the white label logo for the current shop" do
|
||||
expect(page).to have_selector("img[src*='logo-white.png']")
|
||||
expect(distributor1.white_label_logo).to be_attached
|
||||
click_button "Remove"
|
||||
within ".reveal-modal" do
|
||||
click_button "Confirm"
|
||||
end
|
||||
expect(flash_message).to match(/Logo removed/)
|
||||
distributor1.reload
|
||||
expect(distributor1.white_label_logo).to_not be_attached
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -5,6 +5,7 @@ require 'system_helper'
|
||||
describe 'White label setting' do
|
||||
include AuthenticationHelper
|
||||
include ShopWorkflow
|
||||
include FileHelper
|
||||
|
||||
let!(:distributor) { create(:distributor_enterprise, with_payment_and_shipping: true) }
|
||||
let!(:shipping_method) { create(:shipping_method, distributors: [distributor]) }
|
||||
@@ -18,6 +19,13 @@ describe 'White label setting' do
|
||||
variants: [product.variants.first])
|
||||
}
|
||||
let!(:order) { create(:order, distributor: distributor, order_cycle: order_cycle) }
|
||||
let(:complete_order) {
|
||||
create(:order_with_credit_payment,
|
||||
user: nil,
|
||||
email: "guest@user.com",
|
||||
distributor: distributor,
|
||||
order_cycle: order_cycle)
|
||||
}
|
||||
|
||||
let(:ofn_navigation) { 'ul.nav-main-menu' }
|
||||
|
||||
@@ -102,13 +110,6 @@ describe 'White label setting' do
|
||||
end
|
||||
|
||||
context "when the user has a complete order" do
|
||||
let(:complete_order) {
|
||||
create(:order_with_credit_payment,
|
||||
user: nil,
|
||||
email: "guest@user.com",
|
||||
distributor: distributor,
|
||||
order_cycle: order_cycle)
|
||||
}
|
||||
before do
|
||||
set_order(complete_order)
|
||||
end
|
||||
@@ -162,6 +163,112 @@ describe 'White label setting' do
|
||||
it_behaves_like "does not hide the OFN navigation"
|
||||
end
|
||||
end
|
||||
|
||||
context "manage the white_label_logo preference" do
|
||||
context "when the distributor has no logo" do
|
||||
before do
|
||||
distributor.update_attribute(:hide_ofn_navigation, true)
|
||||
end
|
||||
|
||||
shared_examples "shows/hide the right logos" do
|
||||
it "shows the OFN logo on shop page" do
|
||||
expect(page).to have_selector "img[src*='/default_images/ofn-logo.png']"
|
||||
end
|
||||
end
|
||||
|
||||
context "on shop page" do
|
||||
before do
|
||||
visit main_app.enterprise_shop_path(distributor)
|
||||
end
|
||||
|
||||
it_behaves_like "shows/hide the right logos"
|
||||
end
|
||||
|
||||
context "on cart page" do
|
||||
before do
|
||||
order.update_attribute(:state, 'cart')
|
||||
order.line_items << create(:line_item, variant: product.variants.first)
|
||||
set_order(order)
|
||||
visit main_app.cart_path
|
||||
end
|
||||
|
||||
it_behaves_like "shows/hide the right logos"
|
||||
end
|
||||
|
||||
context "on checkout page" do
|
||||
before do
|
||||
order.update_attribute(:state, 'cart')
|
||||
order.line_items << create(:line_item, variant: product.variants.first)
|
||||
set_order(order)
|
||||
visit checkout_path
|
||||
end
|
||||
|
||||
it_behaves_like "shows/hide the right logos"
|
||||
end
|
||||
|
||||
context "on order confirmation page" do
|
||||
before do
|
||||
visit order_path(complete_order, order_token: complete_order.token)
|
||||
end
|
||||
|
||||
it_behaves_like "shows/hide the right logos"
|
||||
end
|
||||
end
|
||||
|
||||
context "when the distributor has a logo" do
|
||||
before do
|
||||
distributor.update_attribute(:hide_ofn_navigation, true)
|
||||
distributor.update white_label_logo: white_logo_file
|
||||
end
|
||||
|
||||
shared_examples "shows/hide the right logos" do
|
||||
it "shows the white label logo on shop page" do
|
||||
expect(page).to have_selector "img[src*='/logo-white.png']"
|
||||
end
|
||||
it "does not show the OFN logo on shop page" do
|
||||
expect(page).not_to have_selector "img[src*='/default_images/ofn-logo.png']"
|
||||
end
|
||||
end
|
||||
|
||||
context "on shop page" do
|
||||
before do
|
||||
visit main_app.enterprise_shop_path(distributor)
|
||||
end
|
||||
|
||||
it_behaves_like "shows/hide the right logos"
|
||||
end
|
||||
|
||||
context "on cart page" do
|
||||
before do
|
||||
order.update_attribute(:state, 'cart')
|
||||
order.line_items << create(:line_item, variant: product.variants.first)
|
||||
set_order(order)
|
||||
visit main_app.cart_path
|
||||
end
|
||||
|
||||
it_behaves_like "shows/hide the right logos"
|
||||
end
|
||||
|
||||
context "on checkout page" do
|
||||
before do
|
||||
order.update_attribute(:state, 'cart')
|
||||
order.line_items << create(:line_item, variant: product.variants.first)
|
||||
set_order(order)
|
||||
visit checkout_path
|
||||
end
|
||||
|
||||
it_behaves_like "shows/hide the right logos"
|
||||
end
|
||||
|
||||
context "on order confirmation page" do
|
||||
before do
|
||||
visit order_path(complete_order, order_token: complete_order.token)
|
||||
end
|
||||
|
||||
it_behaves_like "shows/hide the right logos"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context "when the white label feature is deactivated" do
|
||||
|
||||
Reference in New Issue
Block a user