mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-21 20:06:54 +00:00
Compare commits
159 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
198d4be18f | ||
|
|
42e26f3328 | ||
|
|
cb23cda9e9 | ||
|
|
4ecbf51b33 | ||
|
|
837e65d72a | ||
|
|
aa9a85159e | ||
|
|
db993652c4 | ||
|
|
b500486f6b | ||
|
|
11a7316b9d | ||
|
|
75ed148490 | ||
|
|
2f82afcb07 | ||
|
|
fcf6f1929b | ||
|
|
6f90a7b07f | ||
|
|
36fa34a39e | ||
|
|
d516b1d885 | ||
|
|
d9aa1b054a | ||
|
|
a8eecf963d | ||
|
|
bba85e5e79 | ||
|
|
a712f254e0 | ||
|
|
5a05a21dad | ||
|
|
f95b0e3c54 | ||
|
|
755222a35d | ||
|
|
e52937c113 | ||
|
|
4fe9a936f0 | ||
|
|
a253228b96 | ||
|
|
b41302d5d8 | ||
|
|
dd0375aed4 | ||
|
|
d3cca04703 | ||
|
|
3e32abe64f | ||
|
|
dc1a24339c | ||
|
|
95f123d137 | ||
|
|
b016337d4f | ||
|
|
24a60cd108 | ||
|
|
2699e17b63 | ||
|
|
527f4e2cb3 | ||
|
|
a6cec20056 | ||
|
|
31738ceb49 | ||
|
|
674ca3026b | ||
|
|
a3d9f1f3cc | ||
|
|
4d2235c9cc | ||
|
|
de76a1d41e | ||
|
|
23627c5453 | ||
|
|
5a25de1c82 | ||
|
|
355b5ab56f | ||
|
|
bcd0173ed0 | ||
|
|
7c694e3cf3 | ||
|
|
89ea9913e6 | ||
|
|
c821380ff1 | ||
|
|
e4e84b0a86 | ||
|
|
a7d873356d | ||
|
|
ba7b53051a | ||
|
|
5803c0fe50 | ||
|
|
2e701656d2 | ||
|
|
a8efbffca6 | ||
|
|
ef724d2de8 | ||
|
|
bb848811e6 | ||
|
|
6ebc6bcd6f | ||
|
|
9653b0a965 | ||
|
|
aca3a76854 | ||
|
|
d38cf1da1f | ||
|
|
a226aedaec | ||
|
|
b39ed424f6 | ||
|
|
e4cf6421bd | ||
|
|
0776fcf5cc | ||
|
|
59358443b4 | ||
|
|
c4911b1947 | ||
|
|
6c24d4bc1a | ||
|
|
8753076dcd | ||
|
|
7f5e58bcc3 | ||
|
|
d839313cf5 | ||
|
|
f51f304818 | ||
|
|
7f09fd4c19 | ||
|
|
b8617e0a5a | ||
|
|
6701afcdce | ||
|
|
fbf0e48a07 | ||
|
|
e4087e9c65 | ||
|
|
0eea932778 | ||
|
|
db8f8a2675 | ||
|
|
3ef5953db2 | ||
|
|
586c97b22c | ||
|
|
d54cb9182f | ||
|
|
3257f16667 | ||
|
|
178c0a441b | ||
|
|
937cede9b8 | ||
|
|
3b4baab01a | ||
|
|
4476d7f69e | ||
|
|
6cf0c73453 | ||
|
|
d3c2158121 | ||
|
|
0cb2739139 | ||
|
|
0cca01345c | ||
|
|
3ebba9502a | ||
|
|
a5190ec5d7 | ||
|
|
5bfe079262 | ||
|
|
7b641ace23 | ||
|
|
7bcb0bcaa8 | ||
|
|
7ecd67a3fe | ||
|
|
d9f459d94a | ||
|
|
76756923ba | ||
|
|
401dd99225 | ||
|
|
e21ef3f182 | ||
|
|
9e1d8ab369 | ||
|
|
00988dc1e7 | ||
|
|
7007de752d | ||
|
|
832fbb7d5d | ||
|
|
dc7c674a0e | ||
|
|
bfea47802e | ||
|
|
28ebb303af | ||
|
|
f20cf509d3 | ||
|
|
3f9a3b41da | ||
|
|
38811b5a28 | ||
|
|
f791f6fa20 | ||
|
|
c84f9e56fb | ||
|
|
355837547e | ||
|
|
0f5c39317a | ||
|
|
43877f4e34 | ||
|
|
b427fd6876 | ||
|
|
a31487a86d | ||
|
|
84a40e6ae0 | ||
|
|
19f32b7825 | ||
|
|
93e422ec59 | ||
|
|
6e9ae0b0db | ||
|
|
a1438bdb3d | ||
|
|
510f74f654 | ||
|
|
52452f7939 | ||
|
|
b3240f859a | ||
|
|
2de442f44d | ||
|
|
c2211c501d | ||
|
|
6c340f8ed4 | ||
|
|
a22cc96ea5 | ||
|
|
8c9733d8da | ||
|
|
ff9ad96b74 | ||
|
|
8479d4ff7c | ||
|
|
d450aff607 | ||
|
|
1c28b9783f | ||
|
|
f92c082df8 | ||
|
|
d69f714032 | ||
|
|
50d0952dd5 | ||
|
|
5453a1c0fa | ||
|
|
18231cd950 | ||
|
|
5629dfbe09 | ||
|
|
21b80db0ee | ||
|
|
c22799bda1 | ||
|
|
2b187c0547 | ||
|
|
f73e5c74fb | ||
|
|
7008b5ec7b | ||
|
|
f167b09397 | ||
|
|
54c645e33a | ||
|
|
385446807d | ||
|
|
ea2cb4e6c0 | ||
|
|
303bf5420e | ||
|
|
58a96c6500 | ||
|
|
4f50afc188 | ||
|
|
e388238a25 | ||
|
|
1674c6a252 | ||
|
|
93ebfb6a4f | ||
|
|
47404b1dc8 | ||
|
|
c24ceac063 | ||
|
|
c5a2d183d8 | ||
|
|
413896af5d |
File diff suppressed because it is too large
Load Diff
@@ -1 +1 @@
|
||||
2.5.9
|
||||
2.7.3
|
||||
|
||||
0
.simplecov
Normal file → Executable file
0
.simplecov
Normal file → Executable file
16
Gemfile
16
Gemfile
@@ -1,7 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
source 'https://rubygems.org'
|
||||
ruby "2.5.9"
|
||||
ruby "2.7.3"
|
||||
git_source(:github) { |repo_name| "https://github.com/#{repo_name}.git" }
|
||||
|
||||
gem 'rails', '~> 6.0.3.7'
|
||||
@@ -9,7 +9,7 @@ gem 'rails', '~> 6.0.3.7'
|
||||
gem 'activemerchant', '>= 1.78.0'
|
||||
gem 'angular-rails-templates', '>= 0.3.0'
|
||||
gem 'awesome_nested_set'
|
||||
gem 'ransack', '2.4.1'
|
||||
gem 'ransack', '2.4.2'
|
||||
gem 'responders'
|
||||
gem 'sass', '~> 3.4.0' # this restriction originates from foundation-rails's version
|
||||
gem 'sass-rails', '< 5.1.0' # this restriction originates from the compass-rails's version
|
||||
@@ -64,8 +64,9 @@ gem 'actionpack-action_caching'
|
||||
# AMS is deprecated, we will introduce an alternative at some point
|
||||
gem "active_model_serializers", "0.8.4"
|
||||
gem 'activerecord-session_store'
|
||||
gem 'acts-as-taggable-on', '~> 7.0'
|
||||
gem 'acts-as-taggable-on', '~> 8.0'
|
||||
gem 'angularjs-file-upload-rails', '~> 2.4.1'
|
||||
gem 'bigdecimal', '3.0.2'
|
||||
gem 'bootsnap', require: false
|
||||
gem 'custom_error_message', github: 'jeremydurham/custom-err-msg'
|
||||
gem 'dalli'
|
||||
@@ -73,14 +74,14 @@ gem 'figaro'
|
||||
gem 'geocoder'
|
||||
gem 'gmaps4rails'
|
||||
gem 'mimemagic', '> 0.3.5'
|
||||
gem 'paper_trail', '~> 10.3.1'
|
||||
gem 'paperclip', '~> 3.4.1'
|
||||
gem 'paper_trail', '~> 10.3.1'
|
||||
gem 'rack-rewrite'
|
||||
gem 'rack-ssl', require: 'rack/ssl'
|
||||
gem 'roadie-rails'
|
||||
|
||||
gem 'redis', '>= 4.0', require: ['redis', 'redis/connection/hiredis']
|
||||
gem 'hiredis'
|
||||
gem 'redis', '>= 4.0', require: ['redis', 'redis/connection/hiredis']
|
||||
gem 'sidekiq'
|
||||
gem 'sidekiq-scheduler'
|
||||
|
||||
@@ -151,11 +152,11 @@ end
|
||||
group :test do
|
||||
gem 'byebug'
|
||||
gem 'codecov', require: false
|
||||
gem 'pdf-reader'
|
||||
gem 'rails-controller-testing'
|
||||
gem 'simplecov', require: false
|
||||
gem 'test-prof'
|
||||
gem 'webmock'
|
||||
gem 'rails-controller-testing'
|
||||
gem 'pdf-reader'
|
||||
# See spec/spec_helper.rb for instructions
|
||||
# gem 'perftools.rb'
|
||||
end
|
||||
@@ -168,6 +169,7 @@ group :development do
|
||||
gem 'rubocop-rails'
|
||||
gem 'spring'
|
||||
gem 'spring-commands-rspec'
|
||||
gem 'web-console'
|
||||
|
||||
gem "view_component_storybook", require: "view_component/storybook/engine"
|
||||
|
||||
|
||||
27
Gemfile.lock
27
Gemfile.lock
@@ -100,7 +100,7 @@ GEM
|
||||
activejob (6.0.3.7)
|
||||
activesupport (= 6.0.3.7)
|
||||
globalid (>= 0.3.6)
|
||||
activemerchant (1.120.0)
|
||||
activemerchant (1.121.0)
|
||||
activesupport (>= 4.2)
|
||||
builder (>= 2.1.2, < 4.0.0)
|
||||
i18n (>= 0.6.9)
|
||||
@@ -131,7 +131,7 @@ GEM
|
||||
minitest (~> 5.1)
|
||||
tzinfo (~> 1.1)
|
||||
zeitwerk (~> 2.2, >= 2.2.2)
|
||||
acts-as-taggable-on (7.0.0)
|
||||
acts-as-taggable-on (8.0.0)
|
||||
activerecord (>= 5.0, < 6.2)
|
||||
acts_as_list (1.0.4)
|
||||
activerecord (>= 4.2)
|
||||
@@ -157,6 +157,8 @@ GEM
|
||||
json (~> 1.4)
|
||||
nokogiri (~> 1)
|
||||
bcrypt (3.1.16)
|
||||
bigdecimal (3.0.2)
|
||||
bindex (0.8.1)
|
||||
bootsnap (1.7.5)
|
||||
msgpack (~> 1.0)
|
||||
bugsnag (6.20.0)
|
||||
@@ -477,7 +479,7 @@ GEM
|
||||
rainbow (3.0.0)
|
||||
raindrops (0.19.1)
|
||||
rake (13.0.3)
|
||||
ransack (2.4.1)
|
||||
ransack (2.4.2)
|
||||
activerecord (>= 5.2.4)
|
||||
activesupport (>= 5.2.4)
|
||||
i18n
|
||||
@@ -485,7 +487,7 @@ GEM
|
||||
rb-inotify (0.10.1)
|
||||
ffi (~> 1.0)
|
||||
redcarpet (3.5.1)
|
||||
redis (4.2.5)
|
||||
redis (4.3.1)
|
||||
regexp_parser (2.1.1)
|
||||
request_store (1.5.0)
|
||||
rack (>= 1.4)
|
||||
@@ -538,7 +540,7 @@ GEM
|
||||
rswag-ui (2.4.0)
|
||||
actionpack (>= 3.1, < 7.0)
|
||||
railties (>= 3.1, < 7.0)
|
||||
rubocop (1.16.1)
|
||||
rubocop (1.17.0)
|
||||
parallel (~> 1.10)
|
||||
parser (>= 3.0.0.0)
|
||||
rainbow (>= 2.2.2, < 4.0)
|
||||
@@ -639,6 +641,11 @@ GEM
|
||||
view_component (>= 2.2)
|
||||
warden (1.2.9)
|
||||
rack (>= 2.0.9)
|
||||
web-console (4.1.0)
|
||||
actionview (>= 6.0.0)
|
||||
activemodel (>= 6.0.0)
|
||||
bindex (>= 0.4.0)
|
||||
railties (>= 6.0.0)
|
||||
webdrivers (4.6.0)
|
||||
nokogiri (~> 1.6)
|
||||
rubyzip (>= 1.3.0)
|
||||
@@ -670,7 +677,7 @@ DEPENDENCIES
|
||||
activerecord-import
|
||||
activerecord-postgresql-adapter
|
||||
activerecord-session_store
|
||||
acts-as-taggable-on (~> 7.0)
|
||||
acts-as-taggable-on (~> 8.0)
|
||||
acts_as_list (= 1.0.4)
|
||||
andand
|
||||
angular-rails-templates (>= 0.3.0)
|
||||
@@ -680,6 +687,7 @@ DEPENDENCIES
|
||||
awesome_nested_set
|
||||
awesome_print
|
||||
aws-sdk (= 1.67.0)
|
||||
bigdecimal (= 3.0.2)
|
||||
bootsnap
|
||||
bugsnag
|
||||
bullet
|
||||
@@ -750,7 +758,7 @@ DEPENDENCIES
|
||||
rails-controller-testing
|
||||
rails-i18n
|
||||
rails_safe_tasks (~> 1.0)
|
||||
ransack (= 2.4.1)
|
||||
ransack (= 2.4.2)
|
||||
redcarpet
|
||||
redis (>= 4.0)
|
||||
responders
|
||||
@@ -783,6 +791,7 @@ DEPENDENCIES
|
||||
view_component
|
||||
view_component_storybook
|
||||
web!
|
||||
web-console
|
||||
webdrivers
|
||||
webmock
|
||||
whenever
|
||||
@@ -790,7 +799,7 @@ DEPENDENCIES
|
||||
wkhtmltopdf-binary
|
||||
|
||||
RUBY VERSION
|
||||
ruby 2.5.9p229
|
||||
ruby 2.7.3p183
|
||||
|
||||
BUNDLED WITH
|
||||
1.17.3
|
||||
2.1.4
|
||||
|
||||
4
Rakefile
4
Rakefile
@@ -8,6 +8,6 @@ require_relative 'config/application'
|
||||
|
||||
Openfoodnetwork::Application.load_tasks
|
||||
|
||||
unless ENV['DISABLE_KNAPSACK']
|
||||
Knapsack.load_tasks if defined?(Knapsack)
|
||||
if !ENV['DISABLE_KNAPSACK'] && defined?(Knapsack)
|
||||
Knapsack.load_tasks
|
||||
end
|
||||
|
||||
@@ -8,6 +8,7 @@ angular.module("ofn.admin", [
|
||||
"admin.dropdown",
|
||||
"admin.products",
|
||||
"admin.taxons",
|
||||
"infinite-scroll"
|
||||
"infinite-scroll",
|
||||
"admin.orders"
|
||||
]).config ($httpProvider) ->
|
||||
$httpProvider.defaults.headers.common["Accept"] = "application/json, text/javascript, */*"
|
||||
|
||||
@@ -110,5 +110,8 @@
|
||||
// foundation
|
||||
//= require ../shared/mm-foundation-tpls-0.9.0-20180826174721.min.js
|
||||
|
||||
// LocalStorage
|
||||
//= require ../shared/angular-local-storage.js
|
||||
|
||||
// requires the rest of the JS code in this folder
|
||||
//= require_tree .
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
angular.module("ofn.admin").directive "select2WatchNgModel", () ->
|
||||
restrict: 'E'
|
||||
scope: true
|
||||
require: "ngModel"
|
||||
link: (scope, element, attrs, ngModel) ->
|
||||
ngModel.$render = () ->
|
||||
newValue = ngModel.$viewValue;
|
||||
element.children(".select2").select2("val", newValue)
|
||||
@@ -1,4 +1,4 @@
|
||||
angular.module("admin.orders").controller "ordersCtrl", ($scope, $timeout, RequestMonitor, Orders, SortOptions, $window, $filter) ->
|
||||
angular.module("admin.orders").controller "ordersCtrl", ($scope, $timeout, RequestMonitor, Orders, SortOptions, $window, $filter, $location, KeyValueMapStore) ->
|
||||
$scope.RequestMonitor = RequestMonitor
|
||||
$scope.pagination = Orders.pagination
|
||||
$scope.orders = Orders.all
|
||||
@@ -15,39 +15,54 @@ angular.module("admin.orders").controller "ordersCtrl", ($scope, $timeout, Reque
|
||||
$scope.poll = 0
|
||||
$scope.rowStatus = {}
|
||||
|
||||
KeyValueMapStore.localStorageKey = 'ordersFilters'
|
||||
KeyValueMapStore.storableKeys = ["q", "sorting", "page", "per_page"]
|
||||
|
||||
$scope.initialise = ->
|
||||
unless KeyValueMapStore.restoreValues($scope)
|
||||
$scope.setDefaults()
|
||||
|
||||
$scope.fetchResults()
|
||||
|
||||
$scope.setDefaults = ->
|
||||
$scope.per_page = 15
|
||||
$scope.q = {
|
||||
completed_at_not_null: true
|
||||
}
|
||||
|
||||
$scope.clearFilters = () ->
|
||||
KeyValueMapStore.clearKeyValueMap()
|
||||
$scope.setDefaults()
|
||||
$scope.fetchResults()
|
||||
|
||||
$scope.fetchResults = (page=1) ->
|
||||
startDateWithTime = $scope.appendStringIfNotEmpty($scope['q']['completed_at_gteq'], ' 00:00:00')
|
||||
endDateWithTime = $scope.appendStringIfNotEmpty($scope['q']['completed_at_lteq'], ' 23:59:59')
|
||||
startDateWithTime = $scope.appendStringIfNotEmpty($scope.q?.completed_at_gteq, ' 00:00:00')
|
||||
endDateWithTime = $scope.appendStringIfNotEmpty($scope.q?.completed_at_lteq, ' 23:59:59')
|
||||
|
||||
$scope.resetSelected()
|
||||
params = {
|
||||
'q[completed_at_gteq]': startDateWithTime,
|
||||
'q[completed_at_lteq]': endDateWithTime,
|
||||
'q[state_eq]': $scope['q']['state_eq'],
|
||||
'q[number_cont]': $scope['q']['number_cont'],
|
||||
'q[email_cont]': $scope['q']['email_cont'],
|
||||
'q[bill_address_firstname_start]': $scope['q']['bill_address_firstname_start'],
|
||||
'q[bill_address_lastname_start]': $scope['q']['bill_address_lastname_start'],
|
||||
'q[state_eq]': $scope.q?.state_eq,
|
||||
'q[number_cont]': $scope.q?.number_cont,
|
||||
'q[email_cont]': $scope.q?.email_cont,
|
||||
'q[bill_address_firstname_start]': $scope.q?.bill_address_firstname_start,
|
||||
'q[bill_address_lastname_start]': $scope.q?.bill_address_lastname_start,
|
||||
# Set default checkbox values to null. See: https://github.com/openfoodfoundation/openfoodnetwork/pull/3076#issuecomment-440010498
|
||||
'q[completed_at_not_null]': $scope['q']['completed_at_not_null'] || null,
|
||||
'q[distributor_id_in][]': $scope['q']['distributor_id_in'],
|
||||
'q[order_cycle_id_in][]': $scope['q']['order_cycle_id_in'],
|
||||
'q[completed_at_not_null]': $scope.q?.completed_at_not_null || null,
|
||||
'q[distributor_id_in][]': $scope.q?.distributor_id_in,
|
||||
'q[order_cycle_id_in][]': $scope.q?.order_cycle_id_in,
|
||||
'q[s]': $scope.sorting || 'completed_at desc',
|
||||
shipping_method_id: $scope.shipping_method_id,
|
||||
shipping_method_id: $scope.q?.shipping_method_id,
|
||||
per_page: $scope.per_page,
|
||||
page: page
|
||||
}
|
||||
KeyValueMapStore.setStoredValues($scope)
|
||||
RequestMonitor.load(Orders.index(params).$promise)
|
||||
|
||||
$scope.appendStringIfNotEmpty = (baseString, stringToAppend) ->
|
||||
return baseString unless baseString
|
||||
return baseString if baseString.endsWith(stringToAppend)
|
||||
|
||||
baseString + stringToAppend
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
angular.module("admin.orders", ['admin.indexUtils', 'ngResource', 'mm.foundation'])
|
||||
angular.module("admin.orders", ['admin.indexUtils', 'ngResource', 'mm.foundation', "OFNShared"])
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
angular.module("admin.products")
|
||||
.controller "unitsCtrl", ($scope, VariantUnitManager, OptionValueNamer, UnitPrices) ->
|
||||
.controller "unitsCtrl", ($scope, VariantUnitManager, OptionValueNamer, UnitPrices, PriceParser) ->
|
||||
$scope.product = { master: {} }
|
||||
$scope.product.master.product = $scope.product
|
||||
$scope.placeholder_text = ""
|
||||
@@ -26,9 +26,9 @@ angular.module("admin.products")
|
||||
|
||||
$scope.processUnitValueWithDescription = ->
|
||||
if $scope.product.master.hasOwnProperty("unit_value_with_description")
|
||||
match = $scope.product.master.unit_value_with_description.match(/^([\d\.]+(?= *|$)|)( *)(.*)$/)
|
||||
match = $scope.product.master.unit_value_with_description.match(/^([\d\.,]+(?= *|$)|)( *)(.*)$/)
|
||||
if match
|
||||
$scope.product.master.unit_value = parseFloat(match[1])
|
||||
$scope.product.master.unit_value = PriceParser.parse(match[1])
|
||||
$scope.product.master.unit_value = null if isNaN($scope.product.master.unit_value)
|
||||
$scope.product.master.unit_value *= $scope.product.variant_unit_scale if $scope.product.master.unit_value && $scope.product.variant_unit_scale
|
||||
$scope.product.master.unit_description = match[3]
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
angular.module("admin.products").controller "variantUnitsCtrl", ($scope, VariantUnitManager, $timeout, UnitPrices) ->
|
||||
angular.module("admin.products").controller "variantUnitsCtrl", ($scope, VariantUnitManager, $timeout, UnitPrices, PriceParser) ->
|
||||
|
||||
$scope.unitName = (scale, type) ->
|
||||
VariantUnitManager.getUnitName(scale, type)
|
||||
@@ -23,7 +23,7 @@ angular.module("admin.products").controller "variantUnitsCtrl", ($scope, Variant
|
||||
|
||||
$scope.updateValue = ->
|
||||
unit_value_human = angular.element('#unit_value_human').val()
|
||||
$scope.unit_value = unit_value_human * $scope.scale
|
||||
$scope.unit_value = PriceParser.parse(unit_value_human) * $scope.scale
|
||||
|
||||
variant_unit_value = angular.element('#variant_unit_value').val()
|
||||
$scope.unit_value_human = variant_unit_value / $scope.scale
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
angular.module("admin.products").factory "UnitPrices", (VariantUnitManager, localizeCurrencyFilter, unlocalizeCurrencyFilter) ->
|
||||
angular.module("admin.products").factory "UnitPrices", (VariantUnitManager, localizeCurrencyFilter, PriceParser) ->
|
||||
class UnitPrices
|
||||
@displayableUnitPrice: (price, scale, unit_type, unit_value, variant_unit_name) ->
|
||||
price = unlocalizeCurrencyFilter(price)
|
||||
price = PriceParser.parse(price)
|
||||
if price && !isNaN(price) && unit_type && unit_value
|
||||
value = localizeCurrencyFilter(UnitPrices.price(price, scale, unit_type, unit_value, variant_unit_name))
|
||||
unit = UnitPrices.unit(scale, unit_type, variant_unit_name)
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
angular.module("admin.indexUtils").factory 'KeyValueMapStore', (localStorageService)->
|
||||
new class KeyValueMapStore
|
||||
localStorageKey: ''
|
||||
storableKeys: []
|
||||
|
||||
constructor: ->
|
||||
localStorageService.setStorageType("sessionStorage")
|
||||
|
||||
getStoredKeyValueMap: ->
|
||||
localStorageService.get(@localStorageKey) || {}
|
||||
|
||||
setStoredValues: (source) ->
|
||||
keyValueMap = {}
|
||||
for key in @storableKeys
|
||||
keyValueMap[key] = source[key]
|
||||
localStorageService.set(@localStorageKey, keyValueMap)
|
||||
|
||||
restoreValues: (target) ->
|
||||
storedKeyValueMap = @getStoredKeyValueMap()
|
||||
|
||||
return false if _.isEmpty(storedKeyValueMap)
|
||||
|
||||
for k,v of storedKeyValueMap
|
||||
target[k] = v
|
||||
|
||||
return true
|
||||
|
||||
clearKeyValueMap: () ->
|
||||
localStorageService.remove(@localStorageKey)
|
||||
@@ -2,10 +2,13 @@ angular.module("admin.utils").directive "datepicker", ($window, $timeout) ->
|
||||
require: "ngModel"
|
||||
link: (scope, element, attrs, ngModel) ->
|
||||
$timeout ->
|
||||
flatpickr(element, Object.assign(
|
||||
flapickrInstance = flatpickr(element, Object.assign(
|
||||
{},
|
||||
$window.FLATPICKR_DATE_DEFAULT, {
|
||||
onOpen: (selectedDates, dateStr, instance) ->
|
||||
instance.setDate(ngModel.$modelValue)
|
||||
}
|
||||
));
|
||||
ngModel.$render = () ->
|
||||
newValue = ngModel.$viewValue;
|
||||
flapickrInstance?.setDate(newValue)
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
angular.module("admin.utils").filter "unlocalizeCurrency", ()->
|
||||
# Convert string to number using injected currency configuration.
|
||||
(price) ->
|
||||
# used decimal and thousands separators from currency configuration
|
||||
decimal_separator = I18n.toCurrency(.1, {precision: 1, unit: ''}).substring(1,2)
|
||||
thousands_separator = I18n.toCurrency(1000, {precision: 1, unit: ''}).substring(1,2)
|
||||
|
||||
if (price.length > 4)
|
||||
# remove configured thousands separator if price is greater than 999
|
||||
price = price.replaceAll(thousands_separator, '')
|
||||
|
||||
if (decimal_separator == ",")
|
||||
price = price.replace(",", ".")
|
||||
|
||||
return parseFloat(price)
|
||||
@@ -0,0 +1,31 @@
|
||||
angular.module("admin.utils").factory "PriceParser", ->
|
||||
new class PriceParser
|
||||
parse: (price) =>
|
||||
return null unless price
|
||||
# used decimal and thousands separators from currency configuration
|
||||
decimal_separator = I18n.toCurrency(.1, {precision: 1, unit: ''}).substring(1,2)
|
||||
thousands_separator = I18n.toCurrency(1000, {precision: 1, unit: ''}).substring(1,2)
|
||||
|
||||
# Replace comma used as a decimal separator and remplace by "."
|
||||
price = this.replaceCommaByFinalPoint(price)
|
||||
|
||||
# Remove configured thousands separator if it is actually a thousands separator
|
||||
price = this.removeThousandsSeparator(price, thousands_separator)
|
||||
|
||||
if (decimal_separator == ",")
|
||||
price = price.replace(",", ".")
|
||||
|
||||
price = parseFloat(price)
|
||||
|
||||
return null if isNaN(price)
|
||||
|
||||
return price
|
||||
|
||||
replaceCommaByFinalPoint : (price) =>
|
||||
if price.match(/^[0-9]*(,{1})[0-9]{1,2}$/g) then price.replace(",", ".") else price
|
||||
|
||||
removeThousandsSeparator : (price, thousands_separator) =>
|
||||
if (new RegExp("^([0-9]*(" + thousands_separator + "{1})[0-9]{3}[0-9\.,]*)*$", "g").test(price))
|
||||
price.replaceAll(thousands_separator, '')
|
||||
else
|
||||
price
|
||||
@@ -1,4 +1,5 @@
|
||||
window.OFNShared = angular.module("OFNShared", [
|
||||
"mm.foundation"
|
||||
"mm.foundation",
|
||||
"LocalStorageModule"
|
||||
]).config ($httpProvider) ->
|
||||
$httpProvider.defaults.headers.common["Accept"] = "application/json, text/javascript, */*"
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#table-filter {
|
||||
|
||||
.field {
|
||||
input[type="text"], input[type="phone"],
|
||||
input[type="email"], input[type="number"],
|
||||
@@ -9,6 +8,9 @@
|
||||
}
|
||||
|
||||
.actions {
|
||||
text-align: center;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
column-gap: 20px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,6 +84,8 @@ $color-ste-sold-bg: $color-success !default;
|
||||
$color-ste-sold-text: $color-1 !default;
|
||||
$color-ste-pending-bg: $color-notice !default;
|
||||
$color-ste-pending-text: $color-1 !default;
|
||||
$color-ste-requires_authorization-bg: $color-notice !default;
|
||||
$color-ste-requires_authorization-text: $color-1 !default;
|
||||
$color-ste-awaiting_return-bg: $color-notice !default;
|
||||
$color-ste-awaiting_return-text: $color-1 !default;
|
||||
$color-ste-returned-bg: $color-notice !default;
|
||||
@@ -124,9 +126,9 @@ $color-ste-inactive-bg: $color-notice !default;
|
||||
$color-ste-inactive-text: $color-1 !default;
|
||||
|
||||
// Available states
|
||||
$states: completed, complete, sold, pending, awaiting_return, returned, credit_owed, paid, shipped, balance_due, backorder, checkout, cart, address, delivery, payment, confirm, canceled, ready, void, active, inactive !default;
|
||||
$states-bg-colors: $color-ste-completed-bg, $color-ste-complete-bg, $color-ste-sold-bg, $color-ste-pending-bg, $color-ste-awaiting_return-bg, $color-ste-returned-bg, $color-ste-credit_owed-bg, $color-ste-paid-bg, $color-ste-shipped-bg, $color-ste-balance_due-bg, $color-ste-backorder-bg, $color-ste-checkout-bg, $color-ste-cart-bg, $color-ste-address-bg, $color-ste-delivery-bg, $color-ste-payment-bg, $color-ste-confirm-bg, $color-ste-canceled-bg, $color-ste-ready-bg, $color-ste-void-bg, $color-ste-active-bg, $color-ste-inactive-bg !default;
|
||||
$states-text-colors: $color-ste-completed-text, $color-ste-complete-text, $color-ste-sold-text, $color-ste-pending-text, $color-ste-awaiting_return-text, $color-ste-returned-text, $color-ste-credit_owed-text, $color-ste-paid-text, $color-ste-shipped-text, $color-ste-balance_due-text, $color-ste-backorder-text, $color-ste-checkout-text, $color-ste-cart-text, $color-ste-address-text, $color-ste-delivery-text, $color-ste-payment-text, $color-ste-confirm-text, $color-ste-canceled-text, $color-ste-ready-text, $color-ste-void-text, $color-ste-active-text, $color-ste-inactive-text !default;
|
||||
$states: completed, complete, sold, pending, awaiting_return, returned, credit_owed, paid, shipped, balance_due, backorder, checkout, cart, address, delivery, payment, confirm, canceled, ready, void, requires_authorization, active, inactive !default;
|
||||
$states-bg-colors: $color-ste-completed-bg, $color-ste-complete-bg, $color-ste-sold-bg, $color-ste-pending-bg, $color-ste-awaiting_return-bg, $color-ste-returned-bg, $color-ste-credit_owed-bg, $color-ste-paid-bg, $color-ste-shipped-bg, $color-ste-balance_due-bg, $color-ste-backorder-bg, $color-ste-checkout-bg, $color-ste-cart-bg, $color-ste-address-bg, $color-ste-delivery-bg, $color-ste-payment-bg, $color-ste-confirm-bg, $color-ste-canceled-bg, $color-ste-ready-bg, $color-ste-void-bg, $color-ste-requires_authorization-bg, $color-ste-active-bg, $color-ste-inactive-bg !default;
|
||||
$states-text-colors: $color-ste-completed-text, $color-ste-complete-text, $color-ste-sold-text, $color-ste-pending-text, $color-ste-awaiting_return-text, $color-ste-returned-text, $color-ste-credit_owed-text, $color-ste-paid-text, $color-ste-shipped-text, $color-ste-balance_due-text, $color-ste-backorder-text, $color-ste-checkout-text, $color-ste-cart-text, $color-ste-address-text, $color-ste-delivery-text, $color-ste-payment-text, $color-ste-confirm-text, $color-ste-canceled-text, $color-ste-ready-text, $color-ste-void-text, $color-ste-requires_authorization-text, $color-ste-active-text, $color-ste-inactive-text !default;
|
||||
|
||||
// Available actions
|
||||
$actions: edit, clone, remove, void, capture, save, cancel, mail !default;
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Admin
|
||||
class BulkLineItemsController < Spree::Admin::BaseController
|
||||
include PaginationData
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Admin
|
||||
class ColumnPreferencesController < Admin::ResourceController
|
||||
before_action :load_collection, only: [:bulk_update]
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Admin
|
||||
class ContentsController < Spree::Admin::BaseController
|
||||
def edit
|
||||
@@ -16,7 +18,8 @@ module Admin
|
||||
# Save any uploaded images
|
||||
ContentConfig.save
|
||||
|
||||
flash[:success] = t(:successfully_updated, resource: I18n.t('admin.contents.edit.your_content'))
|
||||
flash[:success] =
|
||||
t(:successfully_updated, resource: I18n.t('admin.contents.edit.your_content'))
|
||||
|
||||
redirect_to main_app.edit_admin_contents_path
|
||||
end
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'open_food_network/address_finder'
|
||||
|
||||
module Admin
|
||||
@@ -10,7 +12,10 @@ module Admin
|
||||
tag_rule_mapping = TagRule.mapping_for(Enterprise.where(id: @customer.enterprise))
|
||||
render_as_json @customer, tag_rule_mapping: tag_rule_mapping
|
||||
},
|
||||
failure: lambda { render json: { errors: @customer.errors.full_messages }, status: :unprocessable_entity }
|
||||
failure: lambda {
|
||||
render json: { errors: @customer.errors.full_messages },
|
||||
status: :unprocessable_entity
|
||||
}
|
||||
} }
|
||||
|
||||
def index
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Admin
|
||||
class EnterpriseFeesController < Admin::ResourceController
|
||||
before_action :load_enterprise_fee_set, only: :index
|
||||
@@ -16,7 +18,9 @@ module Admin
|
||||
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.json { render_as_json @collection, controller: self, include_calculators: @include_calculators }
|
||||
format.json {
|
||||
render_as_json @collection, controller: self, include_calculators: @include_calculators
|
||||
}
|
||||
# format.json { @presented_collection = @collection.each_with_index.map { |ef, i| EnterpriseFeePresenter.new(self, ef, i) } }
|
||||
end
|
||||
end
|
||||
@@ -56,10 +60,12 @@ module Admin
|
||||
order_cycle = OrderCycle.find_by(id: params[:order_cycle_id]) if params[:order_cycle_id]
|
||||
coordinator = Enterprise.find_by(id: params[:coordinator_id]) if params[:coordinator_id]
|
||||
order_cycle = OrderCycle.new(coordinator: coordinator) if order_cycle.nil? && coordinator.present?
|
||||
enterprises = OpenFoodNetwork::OrderCyclePermissions.new(spree_current_user, order_cycle).visible_enterprises
|
||||
enterprises = OpenFoodNetwork::OrderCyclePermissions.new(spree_current_user,
|
||||
order_cycle).visible_enterprises
|
||||
EnterpriseFee.for_enterprises(enterprises).order('enterprise_id', 'fee_type', 'name')
|
||||
else
|
||||
collection = EnterpriseFee.managed_by(spree_current_user).order('enterprise_id', 'fee_type', 'name')
|
||||
collection = EnterpriseFee.managed_by(spree_current_user).order('enterprise_id',
|
||||
'fee_type', 'name')
|
||||
collection = collection.for_enterprise(current_enterprise) if current_enterprise
|
||||
collection
|
||||
end
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Admin
|
||||
class EnterpriseGroupsController < Admin::ResourceController
|
||||
before_action :load_data, except: :index
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Admin
|
||||
class EnterpriseRelationshipsController < Admin::ResourceController
|
||||
def index
|
||||
@@ -16,7 +18,8 @@ module Admin
|
||||
if @enterprise_relationship.save
|
||||
render plain: Api::Admin::EnterpriseRelationshipSerializer.new(@enterprise_relationship).to_json
|
||||
else
|
||||
render status: :bad_request, json: { errors: @enterprise_relationship.errors.full_messages.join(', ') }
|
||||
render status: :bad_request,
|
||||
json: { errors: @enterprise_relationship.errors.full_messages.join(', ') }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Admin
|
||||
class EnterpriseRolesController < Admin::ResourceController
|
||||
def index
|
||||
@@ -13,7 +15,8 @@ module Admin
|
||||
render plain: Api::Admin::EnterpriseRoleSerializer.new(@enterprise_role).to_json
|
||||
|
||||
else
|
||||
render status: :bad_request, json: { errors: @enterprise_role.errors.full_messages.join(', ') }
|
||||
render status: :bad_request,
|
||||
json: { errors: @enterprise_role.errors.full_messages.join(', ') }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'open_food_network/referer_parser'
|
||||
require 'open_food_network/permissions'
|
||||
require 'open_food_network/order_cycle_permissions'
|
||||
@@ -32,7 +34,10 @@ module Admin
|
||||
def index
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.json { render_as_json @collection, ams_prefix: params[:ams_prefix], spree_current_user: spree_current_user }
|
||||
format.json {
|
||||
render_as_json @collection, ams_prefix: params[:ams_prefix],
|
||||
spree_current_user: spree_current_user
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
@@ -56,11 +61,15 @@ module Admin
|
||||
respond_with(@object) do |format|
|
||||
format.html { redirect_to location_after_save }
|
||||
format.js { render layout: false }
|
||||
format.json { render_as_json @object, ams_prefix: 'index', spree_current_user: spree_current_user }
|
||||
format.json {
|
||||
render_as_json @object, ams_prefix: 'index', spree_current_user: spree_current_user
|
||||
}
|
||||
end
|
||||
else
|
||||
respond_with(@object) do |format|
|
||||
format.json { render json: { errors: @object.errors.messages }, status: :unprocessable_entity }
|
||||
format.json {
|
||||
render json: { errors: @object.errors.messages }, status: :unprocessable_entity
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -101,7 +110,8 @@ module Admin
|
||||
def for_order_cycle
|
||||
respond_to do |format|
|
||||
format.json do
|
||||
render json: @collection, each_serializer: Api::Admin::ForOrderCycle::EnterpriseSerializer, order_cycle: @order_cycle, spree_current_user: spree_current_user
|
||||
render json: @collection,
|
||||
each_serializer: Api::Admin::ForOrderCycle::EnterpriseSerializer, order_cycle: @order_cycle, spree_current_user: spree_current_user
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -109,7 +119,8 @@ module Admin
|
||||
def visible
|
||||
respond_to do |format|
|
||||
format.json do
|
||||
render_as_json @collection, ams_prefix: params[:ams_prefix] || 'basic', spree_current_user: spree_current_user
|
||||
render_as_json @collection, ams_prefix: params[:ams_prefix] || 'basic',
|
||||
spree_current_user: spree_current_user
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -152,7 +163,7 @@ module Admin
|
||||
if enterprises.present?
|
||||
enterprises.includes(
|
||||
supplied_products:
|
||||
[:supplier, master: [:images], variants: { option_values: :option_type }]
|
||||
[:supplier, { master: [:images], variants: { option_values: :option_type } }]
|
||||
)
|
||||
end
|
||||
when :index
|
||||
@@ -284,7 +295,8 @@ module Admin
|
||||
end
|
||||
|
||||
def strip_new_properties
|
||||
unless spree_current_user.admin? || params.dig(:enterprise, :producer_properties_attributes).nil?
|
||||
unless spree_current_user.admin? || params.dig(:enterprise,
|
||||
:producer_properties_attributes).nil?
|
||||
names = Spree::Property.pluck(:name)
|
||||
enterprise_params[:producer_properties_attributes].each do |key, property|
|
||||
enterprise_params[:producer_properties_attributes].delete key unless names.include? property[:property_name]
|
||||
|
||||
@@ -1,15 +1,23 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Admin
|
||||
class InventoryItemsController < Admin::ResourceController
|
||||
respond_to :json
|
||||
|
||||
respond_override update: { json: {
|
||||
success: lambda { render_as_json @inventory_item },
|
||||
failure: lambda { render json: { errors: @inventory_item.errors.full_messages }, status: :unprocessable_entity }
|
||||
failure: lambda {
|
||||
render json: { errors: @inventory_item.errors.full_messages },
|
||||
status: :unprocessable_entity
|
||||
}
|
||||
} }
|
||||
|
||||
respond_override create: { json: {
|
||||
success: lambda { render_as_json @inventory_item },
|
||||
failure: lambda { render json: { errors: @inventory_item.errors.full_messages }, status: :unprocessable_entity }
|
||||
failure: lambda {
|
||||
render json: { errors: @inventory_item.errors.full_messages },
|
||||
status: :unprocessable_entity
|
||||
}
|
||||
} }
|
||||
|
||||
private
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Admin
|
||||
class InvoiceSettingsController < Spree::Admin::BaseController
|
||||
def update
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Admin
|
||||
class ManagerInvitationsController < Spree::Admin::BaseController
|
||||
authorize_resource class: false
|
||||
@@ -11,7 +13,8 @@ module Admin
|
||||
existing_user = Spree::User.find_by(email: @email)
|
||||
|
||||
if existing_user
|
||||
render json: { errors: t('admin.enterprises.invite_manager.user_already_exists') }, status: :unprocessable_entity
|
||||
render json: { errors: t('admin.enterprises.invite_manager.user_already_exists') },
|
||||
status: :unprocessable_entity
|
||||
return
|
||||
end
|
||||
|
||||
@@ -20,7 +23,8 @@ module Admin
|
||||
if new_user
|
||||
render json: { user: new_user.id }, status: :ok
|
||||
else
|
||||
render json: { errors: t('admin.enterprises.invite_manager.error') }, status: :internal_server_error
|
||||
render json: { errors: t('admin.enterprises.invite_manager.error') },
|
||||
status: :internal_server_error
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Admin
|
||||
class MatomoSettingsController < Spree::Admin::BaseController
|
||||
def update
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Admin
|
||||
class OrderCyclesController < Admin::ResourceController
|
||||
include OrderCyclesHelper
|
||||
@@ -156,8 +158,8 @@ module Admin
|
||||
orders_close_at_gt = raw_params[:q].andand.delete(:orders_close_at_gt) || 31.days.ago
|
||||
raw_params[:q] = {
|
||||
g: [raw_params.delete(:q) || {}, { m: 'or',
|
||||
orders_close_at_gt: orders_close_at_gt,
|
||||
orders_close_at_null: true }]
|
||||
orders_close_at_gt: orders_close_at_gt,
|
||||
orders_close_at_null: true }]
|
||||
}
|
||||
@collection = collection
|
||||
end
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Admin
|
||||
class ProducerPropertiesController < Admin::ResourceController
|
||||
before_action :load_enterprise
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'roo'
|
||||
|
||||
module Admin
|
||||
@@ -12,7 +14,8 @@ module Admin
|
||||
|
||||
def import
|
||||
@filepath = save_uploaded_file(params[:file])
|
||||
@importer = ProductImport::ProductImporter.new(File.new(@filepath), spree_current_user, params[:settings])
|
||||
@importer = ProductImport::ProductImporter.new(File.new(@filepath), spree_current_user,
|
||||
params[:settings])
|
||||
@original_filename = params[:file].try(:original_filename)
|
||||
@non_updatable_fields = ProductImport::EntryValidator.non_updatable_fields
|
||||
|
||||
@@ -34,7 +37,8 @@ module Admin
|
||||
end
|
||||
|
||||
def reset_absent_products
|
||||
@importer = ProductImport::ProductImporter.new(File.new(params[:filepath]), spree_current_user, import_into: params[:import_into], enterprises_to_reset: params[:enterprises_to_reset], updated_ids: params[:updated_ids], settings: params[:settings])
|
||||
@importer = ProductImport::ProductImporter.new(File.new(params[:filepath]),
|
||||
spree_current_user, import_into: params[:import_into], enterprises_to_reset: params[:enterprises_to_reset], updated_ids: params[:updated_ids], settings: params[:settings])
|
||||
|
||||
if params.key?(:enterprises_to_reset) && params.key?(:updated_ids)
|
||||
@importer.reset_absent(params[:updated_ids])
|
||||
@@ -52,7 +56,8 @@ module Admin
|
||||
end
|
||||
|
||||
def process_data(method)
|
||||
@importer = ProductImport::ProductImporter.new(File.new(params[:filepath]), spree_current_user, start: params[:start], end: params[:end], settings: params[:settings])
|
||||
@importer = ProductImport::ProductImporter.new(File.new(params[:filepath]),
|
||||
spree_current_user, start: params[:start], end: params[:end], settings: params[:settings])
|
||||
|
||||
begin
|
||||
@importer.public_send("#{method}_entries")
|
||||
@@ -75,7 +80,8 @@ module Admin
|
||||
|
||||
def check_spreadsheet_has_data(importer)
|
||||
unless importer.item_count
|
||||
redirect_to '/admin/product_import', notice: I18n.t(:product_import_no_data_in_spreadsheet_notice)
|
||||
redirect_to '/admin/product_import',
|
||||
notice: I18n.t(:product_import_no_data_in_spreadsheet_notice)
|
||||
true
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Admin
|
||||
class ProxyOrdersController < Admin::ResourceController
|
||||
respond_to :json
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Admin
|
||||
class ResourceController < Spree::Admin::BaseController
|
||||
helper_method :new_object_url, :edit_object_url, :object_url, :collection_url
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'open_food_network/permissions'
|
||||
require 'order_management/subscriptions/proxy_order_syncer'
|
||||
|
||||
@@ -15,18 +17,31 @@ module Admin
|
||||
respond_to :json
|
||||
|
||||
respond_override create: { json: {
|
||||
success: lambda { render_as_json @schedule, editable_schedule_ids: permissions.editable_schedules.pluck(:id) },
|
||||
failure: lambda { render json: { errors: @schedule.errors.full_messages }, status: :unprocessable_entity }
|
||||
success: lambda {
|
||||
render_as_json @schedule,
|
||||
editable_schedule_ids: permissions.editable_schedules.pluck(:id)
|
||||
},
|
||||
failure: lambda {
|
||||
render json: { errors: @schedule.errors.full_messages },
|
||||
status: :unprocessable_entity
|
||||
}
|
||||
} }
|
||||
respond_override update: { json: {
|
||||
success: lambda { render_as_json @schedule, editable_schedule_ids: permissions.editable_schedules.pluck(:id) },
|
||||
failure: lambda { render json: { errors: @schedule.errors.full_messages }, status: :unprocessable_entity }
|
||||
success: lambda {
|
||||
render_as_json @schedule,
|
||||
editable_schedule_ids: permissions.editable_schedules.pluck(:id)
|
||||
},
|
||||
failure: lambda {
|
||||
render json: { errors: @schedule.errors.full_messages },
|
||||
status: :unprocessable_entity
|
||||
}
|
||||
} }
|
||||
|
||||
def index
|
||||
respond_to do |format|
|
||||
format.json do
|
||||
render_as_json @collection, ams_prefix: params[:ams_prefix], editable_schedule_ids: permissions.editable_schedules.pluck(:id)
|
||||
render_as_json @collection, ams_prefix: params[:ams_prefix],
|
||||
editable_schedule_ids: permissions.editable_schedules.pluck(:id)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -111,7 +126,8 @@ module Admin
|
||||
def check_dependent_subscriptions
|
||||
return if Subscription.where(schedule_id: @schedule).empty?
|
||||
|
||||
render json: { errors: [t('admin.schedules.destroy.associated_subscriptions_error')] }, status: :conflict
|
||||
render json: { errors: [t('admin.schedules.destroy.associated_subscriptions_error')] },
|
||||
status: :conflict
|
||||
end
|
||||
|
||||
def permissions
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'stripe/account_connector'
|
||||
|
||||
module Admin
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# This controller is used by super admin users to update the settings the app is using
|
||||
|
||||
module Admin
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'open_food_network/permissions'
|
||||
require 'open_food_network/order_cycle_permissions'
|
||||
require 'open_food_network/scope_variant_to_hub'
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'open_food_network/permissions'
|
||||
|
||||
module Admin
|
||||
@@ -85,7 +87,8 @@ module Admin
|
||||
def collection
|
||||
if request.format.json?
|
||||
permissions.editable_subscriptions.ransack(params[:q]).result
|
||||
.preload([:shop, :customer, :schedule, :subscription_line_items, :ship_address, :bill_address, proxy_orders: { order: :order_cycle }])
|
||||
.preload([:shop, :customer, :schedule, :subscription_line_items, :ship_address,
|
||||
:bill_address, { proxy_orders: { order: :order_cycle } }])
|
||||
else
|
||||
Subscription.where("1=0")
|
||||
end
|
||||
@@ -116,11 +119,13 @@ module Admin
|
||||
end
|
||||
|
||||
def wrap_bill_address_attrs
|
||||
subscription_params[:bill_address_attributes] = raw_params[:bill_address].slice(*Spree::Address.attribute_names)
|
||||
subscription_params[:bill_address_attributes] =
|
||||
raw_params[:bill_address].slice(*Spree::Address.attribute_names)
|
||||
end
|
||||
|
||||
def wrap_ship_address_attrs
|
||||
subscription_params[:ship_address_attributes] = raw_params[:ship_address].slice(*Spree::Address.attribute_names)
|
||||
subscription_params[:ship_address_attributes] =
|
||||
raw_params[:ship_address].slice(*Spree::Address.attribute_names)
|
||||
end
|
||||
|
||||
def check_for_open_orders
|
||||
@@ -129,14 +134,16 @@ module Admin
|
||||
@open_orders_to_keep = @subscription.proxy_orders.placed_and_open.pluck(:id)
|
||||
return if @open_orders_to_keep.empty? || params[:open_orders] == 'keep'
|
||||
|
||||
render json: { errors: { open_orders: t('admin.subscriptions.confirm_cancel_open_orders_msg') } }, status: :conflict
|
||||
render json: { errors: { open_orders: t('admin.subscriptions.confirm_cancel_open_orders_msg') } },
|
||||
status: :conflict
|
||||
end
|
||||
|
||||
def check_for_canceled_orders
|
||||
return if params[:canceled_orders] == 'notified'
|
||||
return if @subscription.proxy_orders.active.canceled.empty?
|
||||
|
||||
render json: { errors: { canceled_orders: t('admin.subscriptions.resume_canceled_orders_msg') } }, status: :conflict
|
||||
render json: { errors: { canceled_orders: t('admin.subscriptions.resume_canceled_orders_msg') } },
|
||||
status: :conflict
|
||||
end
|
||||
|
||||
def strip_banned_attrs
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Admin
|
||||
class TagRulesController < Admin::ResourceController
|
||||
respond_to :json
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'open_food_network/spree_api_key_loader'
|
||||
|
||||
module Admin
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Api
|
||||
module V0
|
||||
class TaxonsController < Api::V0::BaseController
|
||||
|
||||
@@ -52,10 +52,10 @@ class ApplicationController < ActionController::Base
|
||||
|
||||
def redirect_to(options = {}, response_status = {})
|
||||
::Rails.logger.error("Redirected by #{begin
|
||||
caller(1).first
|
||||
rescue StandardError
|
||||
'unknown'
|
||||
end}")
|
||||
caller(1).first
|
||||
rescue StandardError
|
||||
'unknown'
|
||||
end}")
|
||||
super(options, response_status)
|
||||
end
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class CartController < BaseController
|
||||
before_action :check_authorization
|
||||
|
||||
|
||||
@@ -137,7 +137,7 @@ class CheckoutController < ::BaseController
|
||||
|
||||
last_payment = OrderPaymentFinder.new(@order).last_payment
|
||||
@order.state == "payment" &&
|
||||
last_payment&.state == "pending" &&
|
||||
last_payment&.state == "requires_authorization" &&
|
||||
last_payment&.response_code == params["payment_intent"]
|
||||
end
|
||||
|
||||
@@ -152,8 +152,8 @@ class CheckoutController < ::BaseController
|
||||
|
||||
def checkout_workflow(shipping_method_id)
|
||||
while @order.state != "complete"
|
||||
if @order.state == "payment"
|
||||
return if redirect_to_payment_gateway
|
||||
if @order.state == "payment" && redirect_to_payment_gateway
|
||||
return
|
||||
end
|
||||
|
||||
next if OrderWorkflow.new(@order).next({ shipping_method_id: shipping_method_id })
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'discourse/single_sign_on'
|
||||
|
||||
class DiscourseSsoController < ApplicationController
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'open_food_network/enterprise_injection_data'
|
||||
|
||||
class EnterprisesController < BaseController
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class GroupsController < BaseController
|
||||
layout 'darkswarm'
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class HomeController < BaseController
|
||||
layout 'darkswarm'
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class LineItemsController < BaseController
|
||||
respond_to :json
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class MapController < BaseController
|
||||
layout 'darkswarm'
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# For the API
|
||||
ActionController::Metal.class_eval do
|
||||
def spree_current_user
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class ProducersController < BaseController
|
||||
layout 'darkswarm'
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'open_food_network/spree_api_key_loader'
|
||||
|
||||
class RegistrationController < BaseController
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class ShopController < BaseController
|
||||
layout "darkswarm"
|
||||
before_action :require_distributor_chosen, :set_order_cycles, except: :changeable_orders_alert
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class ShopsController < BaseController
|
||||
layout 'darkswarm'
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class SitemapController < ApplicationController
|
||||
layout nil
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Spree
|
||||
module Admin
|
||||
class AdjustmentsController < ::Admin::ResourceController
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Spree
|
||||
module Admin
|
||||
class BaseController < ApplicationController
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Spree
|
||||
module Admin
|
||||
class CountriesController < ::Admin::ResourceController
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Spree
|
||||
module Admin
|
||||
class GeneralSettingsController < Spree::Admin::BaseController
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Spree
|
||||
module Admin
|
||||
class ImagesController < ::Admin::ResourceController
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Spree
|
||||
module Admin
|
||||
class InvoicesController < Spree::Admin::BaseController
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Spree
|
||||
module Admin
|
||||
class MailMethodsController < Spree::Admin::BaseController
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Spree
|
||||
module Admin
|
||||
module Orders
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'open_food_network/spree_api_key_loader'
|
||||
|
||||
module Spree
|
||||
@@ -37,6 +39,11 @@ module Spree
|
||||
def update
|
||||
@order.recreate_all_fees!
|
||||
|
||||
unless @order.cart?
|
||||
@order.create_tax_charge!
|
||||
@order.update_order!
|
||||
end
|
||||
|
||||
unless order_params.present? && @order.update(order_params) && @order.line_items.present?
|
||||
if @order.line_items.empty? && !params[:suppress_error_msg]
|
||||
@order.errors.add(:line_items, Spree.t('errors.messages.blank'))
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# this clas was inspired (heavily) from the mephisto admin architecture
|
||||
module Spree
|
||||
module Admin
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Spree
|
||||
module Admin
|
||||
class PaymentMethodsController < ::Admin::ResourceController
|
||||
|
||||
@@ -11,7 +11,7 @@ module Spree
|
||||
before_action :can_transition_to_payment
|
||||
# We ensure that items are in stock before all screens if the order is in the Payment state.
|
||||
# This way, we don't allow someone to enter credit card details for an order only to be told
|
||||
# that it can't be processed.
|
||||
# that it can't be processed.
|
||||
before_action :ensure_sufficient_stock_lines
|
||||
|
||||
respond_to :html
|
||||
@@ -150,7 +150,7 @@ module Spree
|
||||
return if !@order.payment? || @order.insufficient_stock_lines.blank?
|
||||
|
||||
flash[:error] = I18n.t("spree.orders.line_item.insufficient_stock",
|
||||
on_hand: "0 #{out_of_stock_item_names}")
|
||||
on_hand: "0 #{out_of_stock_item_names}")
|
||||
redirect_to spree.edit_admin_order_url(@order)
|
||||
end
|
||||
|
||||
@@ -171,13 +171,15 @@ module Spree
|
||||
end
|
||||
|
||||
def authorize_stripe_sca_payment
|
||||
return unless @payment.payment_method.class == Spree::Gateway::StripeSCA
|
||||
return unless @payment.payment_method.instance_of?(Spree::Gateway::StripeSCA)
|
||||
|
||||
@payment.authorize!(full_order_path(@payment.order))
|
||||
|
||||
raise Spree::Core::GatewayError, I18n.t('authorization_failure') unless @payment.pending?
|
||||
unless @payment.pending? || @payment.requires_authorization?
|
||||
raise Spree::Core::GatewayError, I18n.t('authorization_failure')
|
||||
end
|
||||
|
||||
return unless @payment.authorization_action_required?
|
||||
return unless @payment.requires_authorization?
|
||||
|
||||
PaymentMailer.authorize_payment(@payment).deliver_later
|
||||
raise Spree::Core::GatewayError, I18n.t('action_required')
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Spree
|
||||
module Admin
|
||||
class ProductPropertiesController < ::Admin::ResourceController
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'open_food_network/spree_api_key_loader'
|
||||
require 'open_food_network/referer_parser'
|
||||
require 'open_food_network/permissions'
|
||||
@@ -161,7 +163,9 @@ module Spree
|
||||
private
|
||||
|
||||
def product_set_from_params
|
||||
collection_hash = Hash[products_bulk_params[:products].each_with_index.map { |p, i| [i, p] }]
|
||||
collection_hash = Hash[products_bulk_params[:products].each_with_index.map { |p, i|
|
||||
[i, p]
|
||||
} ]
|
||||
Sets::ProductSet.new(collection_attributes: collection_hash)
|
||||
end
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Spree
|
||||
module Admin
|
||||
class PropertiesController < ::Admin::ResourceController
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'csv'
|
||||
|
||||
require 'open_food_network/reports/list'
|
||||
@@ -46,7 +48,8 @@ module Spree
|
||||
def customers
|
||||
@report_types = report_types[:customers]
|
||||
@report_type = params[:report_type]
|
||||
@report = OpenFoodNetwork::CustomersReport.new spree_current_user, raw_params, render_content?
|
||||
@report = OpenFoodNetwork::CustomersReport.new spree_current_user, raw_params,
|
||||
render_content?
|
||||
render_report(@report.header, @report.table, params[:csv], "customers_#{timestamp}.csv")
|
||||
end
|
||||
|
||||
@@ -91,7 +94,8 @@ module Spree
|
||||
def sales_tax
|
||||
@distributors = my_distributors
|
||||
@report_type = params[:report_type]
|
||||
@report = OpenFoodNetwork::SalesTaxReport.new spree_current_user, raw_params, render_content?
|
||||
@report = OpenFoodNetwork::SalesTaxReport.new spree_current_user, raw_params,
|
||||
render_content?
|
||||
render_report(@report.header, @report.table, params[:csv], "sales_tax.csv")
|
||||
end
|
||||
|
||||
@@ -101,7 +105,8 @@ module Spree
|
||||
@report_type = params[:report_type]
|
||||
|
||||
# -- Build Report with Order Grouper
|
||||
@report = OpenFoodNetwork::PaymentsReport.new spree_current_user, raw_params, render_content?
|
||||
@report = OpenFoodNetwork::PaymentsReport.new spree_current_user, raw_params,
|
||||
render_content?
|
||||
@table = order_grouper_table
|
||||
csv_file_name = "payments_#{timestamp}.csv"
|
||||
|
||||
@@ -279,14 +284,14 @@ module Spree
|
||||
def describe_report(report)
|
||||
name = I18n.t(:name, scope: [:admin, :reports, report])
|
||||
description = begin
|
||||
I18n.t!(:description, scope: [:admin, :reports, report])
|
||||
rescue I18n::MissingTranslationData
|
||||
render_to_string(
|
||||
partial: "#{report}_description",
|
||||
layout: false,
|
||||
locals: { report_types: report_types[report] }
|
||||
).html_safe
|
||||
end
|
||||
I18n.t!(:description, scope: [:admin, :reports, report])
|
||||
rescue I18n::MissingTranslationData
|
||||
render_to_string(
|
||||
partial: "#{report}_description",
|
||||
layout: false,
|
||||
locals: { report_types: report_types[report] }
|
||||
).html_safe
|
||||
end
|
||||
{ name: name, url: url_for_report(report), description: description }
|
||||
end
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Spree
|
||||
module Admin
|
||||
class ReturnAuthorizationsController < ::Admin::ResourceController
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Spree
|
||||
module Admin
|
||||
class SearchController < Spree::Admin::BaseController
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Spree
|
||||
module Admin
|
||||
class ShippingCategoriesController < ::Admin::ResourceController
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Spree
|
||||
module Admin
|
||||
class ShippingMethodsController < ::Admin::ResourceController
|
||||
@@ -87,7 +89,7 @@ module Spree
|
||||
params.require(:shipping_method).permit(
|
||||
:name, :description, :display_on, :require_ship_address, :tag_list, :calculator_type,
|
||||
:tax_category_id, distributor_ids: [],
|
||||
calculator_attributes: PermittedAttributes::Calculator.attributes
|
||||
calculator_attributes: PermittedAttributes::Calculator.attributes
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Spree
|
||||
module Admin
|
||||
class StatesController < ::Admin::ResourceController
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Spree
|
||||
module Admin
|
||||
class TaxCategoriesController < ::Admin::ResourceController
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Spree
|
||||
module Admin
|
||||
class TaxRatesController < ::Admin::ResourceController
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Spree
|
||||
module Admin
|
||||
class TaxSettingsController < Spree::Admin::BaseController
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Spree
|
||||
module Admin
|
||||
class TaxonomiesController < ::Admin::ResourceController
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Spree
|
||||
module Admin
|
||||
class TaxonsController < Spree::Admin::BaseController
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Spree
|
||||
module Admin
|
||||
class UsersController < ::Admin::ResourceController
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'open_food_network/scope_variants_for_search'
|
||||
|
||||
module Spree
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Spree
|
||||
module Admin
|
||||
class ZonesController < ::Admin::ResourceController
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Spree
|
||||
class OrdersController < ::BaseController
|
||||
include OrderCyclesHelper
|
||||
@@ -131,7 +133,7 @@ module Spree
|
||||
result = ProcessPaymentIntent.new(params["payment_intent"], @order).call!
|
||||
|
||||
unless result.ok?
|
||||
flash.now[:error] = "#{I18n.t("payment_could_not_process")}. #{result.error}"
|
||||
flash.now[:error] = "#{I18n.t('payment_could_not_process')}. #{result.error}"
|
||||
end
|
||||
@order.reload
|
||||
end
|
||||
|
||||
@@ -26,7 +26,9 @@ module Spree
|
||||
# sent back and the response is handled in the #confirm action in this controller.
|
||||
redirect_to provider.express_checkout_url(pp_response, useraction: 'commit')
|
||||
else
|
||||
flash[:error] = Spree.t('flash.generic_error', scope: 'paypal', reasons: pp_response.errors.map(&:long_message).join(" "))
|
||||
flash[:error] =
|
||||
Spree.t('flash.generic_error', scope: 'paypal',
|
||||
reasons: pp_response.errors.map(&:long_message).join(" "))
|
||||
redirect_to main_app.checkout_state_path(:payment)
|
||||
end
|
||||
rescue SocketError
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Spree
|
||||
class UsersController < ::BaseController
|
||||
layout 'darkswarm'
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'stripe/account_connector'
|
||||
|
||||
module Stripe
|
||||
@@ -13,7 +15,8 @@ module Stripe
|
||||
else
|
||||
flash[:error] = t('admin.controllers.enterprises.stripe_connect_fail')
|
||||
end
|
||||
redirect_to main_app.edit_admin_enterprise_path(connector.enterprise, anchor: 'payment_methods')
|
||||
redirect_to main_app.edit_admin_enterprise_path(connector.enterprise,
|
||||
anchor: 'payment_methods')
|
||||
rescue Stripe::StripeError => e
|
||||
render plain: e.message, status: :internal_server_error
|
||||
end
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'stripe/webhook_handler'
|
||||
|
||||
module Stripe
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class UserConfirmationsController < DeviseController
|
||||
# Needed for access to current_ability, so we can authorize! actions
|
||||
include Spree::Core::ControllerHelpers::Auth
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class UserPasswordsController < Spree::UserPasswordsController
|
||||
layout 'darkswarm'
|
||||
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'open_food_network/error_logger'
|
||||
|
||||
class UserRegistrationsController < Spree::UserRegistrationsController
|
||||
I18N_SCOPE = 'devise.user_registrations.spree_user'.freeze
|
||||
I18N_SCOPE = 'devise.user_registrations.spree_user'
|
||||
|
||||
before_action :set_checkout_redirect, only: :create
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Admin
|
||||
module EnterprisesHelper
|
||||
def add_check_if_single(count)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user