mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-10 03:30:22 +00:00
Merge branch 'master' of github.com:openfoodfoundation/openfoodnetwork into uk/account-balances
Applied code conventions. Conflicts: config/locales/en.yml
This commit is contained in:
@@ -45,5 +45,8 @@
|
||||
//= require textAngular.min.js
|
||||
//= require textAngular-sanitize.min.js
|
||||
//= require ../shared/bindonce.min.js
|
||||
//= require darkswarm/i18n.js
|
||||
//= require darkswarm/i18n.translate.js
|
||||
|
||||
|
||||
//= require_tree .
|
||||
|
||||
@@ -12,25 +12,25 @@ angular.module("ofn.admin").controller "AdminOrderMgmtCtrl", [
|
||||
$scope.startDate = formatDate start
|
||||
$scope.endDate = formatDate end
|
||||
$scope.quickSearch = ""
|
||||
$scope.bulkActions = [ { name: "Delete Selected", callback: $scope.deleteLineItems } ]
|
||||
$scope.bulkActions = [ { name: t("bom_actions_delete"), callback: $scope.deleteLineItems } ]
|
||||
$scope.selectedBulkAction = $scope.bulkActions[0]
|
||||
$scope.selectedUnitsProduct = {};
|
||||
$scope.selectedUnitsVariant = {};
|
||||
$scope.sharedResource = false
|
||||
$scope.columns = Columns.setColumns
|
||||
order_no: { name: "Order No.", visible: false }
|
||||
full_name: { name: "Name", visible: true }
|
||||
email: { name: "Email", visible: false }
|
||||
phone: { name: "Phone", visible: false }
|
||||
order_date: { name: "Order Date", visible: true }
|
||||
producer: { name: "Producer", visible: true }
|
||||
order_cycle: { name: "Order Cycle", visible: false }
|
||||
hub: { name: "Hub", visible: false }
|
||||
variant: { name: "Variant", visible: true }
|
||||
quantity: { name: "Quantity", visible: true }
|
||||
max: { name: "Max", visible: true }
|
||||
final_weight_volume: { name: "Weight/Volume", visible: false }
|
||||
price: { name: "Price", visible: false }
|
||||
order_no: { name: t("bom_no"), visible: false }
|
||||
full_name: { name: t("name"), visible: true }
|
||||
email: { name: t("email"), visible: false }
|
||||
phone: { name: t("phone"), visible: false }
|
||||
order_date: { name: t("bom_date"), visible: true }
|
||||
producer: { name: t("producer"), visible: true }
|
||||
order_cycle: { name: t("bom_cycle"), visible: false }
|
||||
hub: { name: t("bom_hub"), visible: false }
|
||||
variant: { name: t("bom_variant"), visible: true }
|
||||
quantity: { name: t("bom_quantity"), visible: true }
|
||||
max: { name: t("bom_max"), visible: true }
|
||||
final_weight_volume: { name: t("bom_final_weigth_volume"), visible: false }
|
||||
price: { name: t("price"), visible: false }
|
||||
$scope.initialise = ->
|
||||
$scope.initialiseVariables()
|
||||
authorise_api_reponse = ""
|
||||
|
||||
@@ -4,32 +4,32 @@ angular.module("ofn.admin").controller "AdminProductEditCtrl", ($scope, $timeout
|
||||
$scope.StatusMessage = StatusMessage
|
||||
|
||||
$scope.columns = Columns.setColumns
|
||||
producer: {name: "Producer", visible: true}
|
||||
sku: {name: "SKU", visible: false}
|
||||
name: {name: "Name", visible: true}
|
||||
unit: {name: "Unit", visible: true}
|
||||
price: {name: "Price", visible: true}
|
||||
on_hand: {name: "On Hand", visible: true}
|
||||
on_demand: {name: "On Demand", visible: false}
|
||||
category: {name: "Category", visible: false}
|
||||
tax_category: {name: "Tax Category", visible: false}
|
||||
inherits_properties: {name: "Inherits Properties?", visible: false}
|
||||
available_on: {name: "Available On", visible: false}
|
||||
producer: {name: t("products_producer"), visible: true}
|
||||
sku: {name: t("products_sku"), visible: false}
|
||||
name: {name: t("products_name"), visible: true}
|
||||
unit: {name: t("products_unit"), visible: true}
|
||||
price: {name: t("products_price"), visible: true}
|
||||
on_hand: {name: t("products_on_hand"), visible: true}
|
||||
on_demand: {name: t("products_on_demand"), visible: false}
|
||||
category: {name: t("products_category"), visible: false}
|
||||
tax_category: {name: t("products_tax_category"), visible: false}
|
||||
inherits_properties: {name: t("products_inherits_properties"), visible: false}
|
||||
available_on: {name: t("products_available_on"), visible: false}
|
||||
|
||||
$scope.variant_unit_options = VariantUnitManager.variantUnitOptions()
|
||||
|
||||
$scope.filterableColumns = [
|
||||
{ name: "Producer", db_column: "producer_name" },
|
||||
{ name: "Name", db_column: "name" }
|
||||
{ name: t("label_producers"), db_column: "producer_name" },
|
||||
{ name: t("name"), db_column: "name" }
|
||||
]
|
||||
|
||||
$scope.filterTypes = [
|
||||
{ name: "Equals", predicate: "eq" },
|
||||
{ name: "Contains", predicate: "cont" }
|
||||
{ name: t("equals"), predicate: "eq" },
|
||||
{ name: t("contains"), predicate: "cont" }
|
||||
]
|
||||
|
||||
$scope.optionTabs =
|
||||
filters: { title: "Filter Products", visible: false }
|
||||
filters: { title: t("filter_products"), visible: false }
|
||||
|
||||
|
||||
$scope.producers = producers
|
||||
@@ -105,7 +105,7 @@ angular.module("ofn.admin").controller "AdminProductEditCtrl", ($scope, $timeout
|
||||
$scope.categoryFilter = "0"
|
||||
|
||||
$scope.editWarn = (product, variant) ->
|
||||
if (DirtyProducts.count() > 0 and confirm("Unsaved changes will be lost. Continue anyway?")) or (DirtyProducts.count() == 0)
|
||||
if (DirtyProducts.count() > 0 and confirm(t("unsaved_changes_confirmation"))) or (DirtyProducts.count() == 0)
|
||||
window.location = "/admin/products/" + product.permalink_live + ((if variant then "/variants/" + variant.id else "")) + "/edit"
|
||||
|
||||
|
||||
@@ -150,14 +150,14 @@ angular.module("ofn.admin").controller "AdminProductEditCtrl", ($scope, $timeout
|
||||
if !$scope.variantSaved(variant)
|
||||
$scope.removeVariant(product, variant)
|
||||
else
|
||||
if confirm("Are you sure?")
|
||||
if confirm(t("are_you_sure"))
|
||||
$http(
|
||||
method: "DELETE"
|
||||
url: "/api/products/" + product.permalink_live + "/variants/" + variant.id + "/soft_delete"
|
||||
).success (data) ->
|
||||
$scope.removeVariant(product, variant)
|
||||
else
|
||||
alert("The last variant cannot be deleted!")
|
||||
alert(t("delete_product_variant"))
|
||||
|
||||
$scope.removeVariant = (product, variant) ->
|
||||
product.variants.splice product.variants.indexOf(variant), 1
|
||||
@@ -194,7 +194,7 @@ angular.module("ofn.admin").controller "AdminProductEditCtrl", ($scope, $timeout
|
||||
if productsToSubmit.length > 0
|
||||
$scope.updateProducts productsToSubmit # Don't submit an empty list
|
||||
else
|
||||
StatusMessage.display 'alert', 'No changes to save.'
|
||||
StatusMessage.display 'alert', t("products_change")
|
||||
|
||||
|
||||
$scope.updateProducts = (productsToSubmit) ->
|
||||
@@ -212,10 +212,10 @@ angular.module("ofn.admin").controller "AdminProductEditCtrl", ($scope, $timeout
|
||||
).error (data, status) ->
|
||||
if status == 400 && data.errors? && data.errors.length > 0
|
||||
errors = error + "\n" for error in data.errors
|
||||
alert "Saving failed with the following error(s):\n" + errors
|
||||
$scope.displayFailure "Save failed due to invalid data"
|
||||
alert t("products_update_error") + "\n" + errors
|
||||
$scope.displayFailure t("products_update_error")
|
||||
else
|
||||
$scope.displayFailure "Server returned with error status: " + status
|
||||
$scope.displayFailure t("products_update_error_data") + status
|
||||
|
||||
|
||||
$scope.packProduct = (product) ->
|
||||
@@ -253,23 +253,23 @@ angular.module("ofn.admin").controller "AdminProductEditCtrl", ($scope, $timeout
|
||||
|
||||
|
||||
$scope.displayUpdating = ->
|
||||
StatusMessage.display 'progress', 'Saving...'
|
||||
StatusMessage.display 'progress', t("saving")
|
||||
|
||||
|
||||
$scope.displaySuccess = ->
|
||||
StatusMessage.display 'success', 'Changes saved.'
|
||||
StatusMessage.display 'success',t("products_changes_saved")
|
||||
|
||||
|
||||
$scope.displayFailure = (failMessage) ->
|
||||
StatusMessage.display 'failure', "Saving failed. #{failMessage}"
|
||||
StatusMessage.display 'failure', t("products_update_error_msg") + "#{failMessage}"
|
||||
|
||||
|
||||
$scope.displayDirtyProducts = ->
|
||||
if DirtyProducts.count() > 0
|
||||
message = if DirtyProducts.count() == 1 then "one product" else DirtyProducts.count() + " products"
|
||||
StatusMessage.display 'notice', "Changes to #{message} remain unsaved."
|
||||
else
|
||||
StatusMessage.clear()
|
||||
count = DirtyProducts.count()
|
||||
switch count
|
||||
when 0 then StatusMessage.clear()
|
||||
when 1 then StatusMessage.display 'notice', t("one_product_unsaved")
|
||||
else StatusMessage.display 'notice', t("products_unsaved", n: count)
|
||||
|
||||
|
||||
filterSubmitProducts = (productsToFilter) ->
|
||||
|
||||
@@ -7,7 +7,7 @@ angular.module("ofn.admin").controller "AdminEnterpriseRelationshipsCtrl", ($sco
|
||||
$scope.EnterpriseRelationships.create($scope.parent_id, $scope.child_id, $scope.permissions)
|
||||
|
||||
$scope.delete = (enterprise_relationship) ->
|
||||
if confirm("Are you sure?")
|
||||
if confirm(t("are_you_sure"))
|
||||
$scope.EnterpriseRelationships.delete enterprise_relationship
|
||||
|
||||
$scope.toggleKeyword = (string, key) ->
|
||||
|
||||
@@ -7,5 +7,5 @@ angular.module("ofn.admin").controller "AdminEnterpriseRolesCtrl", ($scope, Ente
|
||||
$scope.EnterpriseRoles.create($scope.user_id, $scope.enterprise_id)
|
||||
|
||||
$scope.delete = (enterprise_role) ->
|
||||
if confirm("Are you sure?")
|
||||
if confirm(t('are_you_sure'))
|
||||
$scope.EnterpriseRoles.delete enterprise_role
|
||||
|
||||
@@ -5,11 +5,11 @@ angular.module("admin.enterprise_groups")
|
||||
|
||||
$scope.menu.setItems [
|
||||
{ name: 'Primary Details', icon_class: "icon-user" }
|
||||
{ name: 'Users', icon_class: "icon-user" }
|
||||
{ name: 'About', icon_class: "icon-pencil" }
|
||||
{ name: 'Images', icon_class: "icon-picture" }
|
||||
{ name: 'Contact', icon_class: "icon-phone" }
|
||||
{ name: 'Web', icon_class: "icon-globe" }
|
||||
{ name: (t('users')), icon_class: "icon-user" }
|
||||
{ name: (t('about')), icon_class: "icon-pencil" }
|
||||
{ name: (t('images')), icon_class: "icon-picture" }
|
||||
{ name: (t('contact')), icon_class: "icon-phone" }
|
||||
{ name: (t('web')), icon_class: "icon-globe" }
|
||||
]
|
||||
|
||||
$scope.select(0)
|
||||
|
||||
@@ -6,7 +6,7 @@ angular.module("admin.enterprises")
|
||||
$scope.navClear = NavigationCheck.clear
|
||||
$scope.pristineEmail = $scope.Enterprise.email
|
||||
$scope.menu = SideMenu
|
||||
$scope.newManager = { id: '', email: 'Add a manager...' }
|
||||
$scope.newManager = { id: '', email: (t('add_manager')) }
|
||||
|
||||
# Provide a callback for generating warning messages displayed before leaving the page. This is passed in
|
||||
# from a directive "nav-check" in the page - if we pass it here it will be called in the test suite,
|
||||
@@ -31,4 +31,4 @@ angular.module("admin.enterprises")
|
||||
if (user for user in $scope.Enterprise.users when user.id == manager.id).length == 0
|
||||
$scope.Enterprise.users.push manager
|
||||
else
|
||||
alert "#{manager.email} is already a manager!"
|
||||
alert ("#{manager.email}" + " " + t("is_already_manager"))
|
||||
|
||||
@@ -5,20 +5,20 @@ angular.module("admin.enterprises")
|
||||
$scope.select = SideMenu.select
|
||||
|
||||
$scope.menu.setItems [
|
||||
{ name: 'Primary Details', icon_class: "icon-home" }
|
||||
{ name: 'Users', icon_class: "icon-user" }
|
||||
{ name: 'Address', icon_class: "icon-map-marker" }
|
||||
{ name: 'Contact', icon_class: "icon-phone" }
|
||||
{ name: 'Social', icon_class: "icon-twitter" }
|
||||
{ name: 'About', icon_class: "icon-pencil" }
|
||||
{ name: 'Business Details', icon_class: "icon-briefcase" }
|
||||
{ name: 'Images', icon_class: "icon-picture" }
|
||||
{ name: "Properties", icon_class: "icon-tags", show: "showProperties()" }
|
||||
{ name: "Shipping Methods", icon_class: "icon-truck", show: "showShippingMethods()" }
|
||||
{ name: "Payment Methods", icon_class: "icon-money", show: "showPaymentMethods()" }
|
||||
{ name: "Enterprise Fees", icon_class: "icon-tasks", show: "showEnterpriseFees()" }
|
||||
{ name: "Inventory Settings", icon_class: "icon-list-ol", show: "showInventorySettings()" }
|
||||
{ name: "Shop Preferences", icon_class: "icon-shopping-cart", show: "showShopPreferences()" }
|
||||
{ name: t('primary_details'), icon_class: "icon-home" }
|
||||
{ name: t('users'), icon_class: "icon-user" }
|
||||
{ name: t('address'), icon_class: "icon-map-marker" }
|
||||
{ name: t('contact'), icon_class: "icon-phone" }
|
||||
{ name: t('social'), icon_class: "icon-twitter" }
|
||||
{ name: t('about'), icon_class: "icon-pencil" }
|
||||
{ name: t('business_details'), icon_class: "icon-briefcase" }
|
||||
{ name: t('images'), icon_class: "icon-picture" }
|
||||
{ name: t('properties'), icon_class: "icon-tags", show: "showProperties()" }
|
||||
{ name: t('shipping_methods'), icon_class: "icon-truck", show: "showShippingMethods()" }
|
||||
{ name: t('payment_methods'), icon_class: "icon-money", show: "showPaymentMethods()" }
|
||||
{ name: t('enterprise_fees'), icon_class: "icon-tasks", show: "showEnterpriseFees()" }
|
||||
{ name: t('inventory_settings'), icon_class: "icon-list-ol", show: "showInventorySettings()" }
|
||||
{ name: t('shop_preferences'), icon_class: "icon-shopping-cart", show: "showShopPreferences()" }
|
||||
]
|
||||
|
||||
$scope.select(0)
|
||||
|
||||
7
app/assets/javascripts/admin/filters/translate.js.coffee
Normal file
7
app/assets/javascripts/admin/filters/translate.js.coffee
Normal file
@@ -0,0 +1,7 @@
|
||||
angular.module('ofn.admin').filter "translate", ->
|
||||
(key, options) ->
|
||||
t(key, options)
|
||||
|
||||
angular.module('ofn.admin').filter "t", ->
|
||||
(key, options) ->
|
||||
t(key, options)
|
||||
@@ -5,27 +5,27 @@ angular.module("admin.lineItems").controller 'LineItemsCtrl', ($scope, $timeout,
|
||||
$scope.confirmDelete = true
|
||||
$scope.startDate = formatDate daysFromToday -7
|
||||
$scope.endDate = formatDate daysFromToday 1
|
||||
$scope.bulkActions = [ { name: "Delete Selected", callback: 'deleteLineItems' } ]
|
||||
$scope.selectedUnitsProduct = {};
|
||||
$scope.selectedUnitsVariant = {};
|
||||
$scope.bulkActions = [ { name: t("bom_actions_delete"), callback: 'deleteLineItems' } ]
|
||||
$scope.selectedUnitsProduct = {}
|
||||
$scope.selectedUnitsVariant = {}
|
||||
$scope.sharedResource = false
|
||||
$scope.columns = Columns.setColumns
|
||||
order_no: { name: "Order No.", visible: false }
|
||||
full_name: { name: "Name", visible: true }
|
||||
email: { name: "Email", visible: false }
|
||||
phone: { name: "Phone", visible: false }
|
||||
order_date: { name: "Order Date", visible: true }
|
||||
producer: { name: "Producer", visible: true }
|
||||
order_cycle: { name: "Order Cycle", visible: false }
|
||||
hub: { name: "Hub", visible: false }
|
||||
variant: { name: "Variant", visible: true }
|
||||
quantity: { name: "Quantity", visible: true }
|
||||
max: { name: "Max", visible: true }
|
||||
final_weight_volume: { name: "Weight/Volume", visible: false }
|
||||
price: { name: "Price", visible: false }
|
||||
order_no: { name: t("bom_no"), visible: false }
|
||||
full_name: { name: t("name"), visible: true }
|
||||
email: { name: t("email"), visible: false }
|
||||
phone: { name: t("phone"), visible: false }
|
||||
order_date: { name: t("bom_date"), visible: true }
|
||||
producer: { name: t("producer"), visible: true }
|
||||
order_cycle: { name: t("bom_cycle"), visible: false }
|
||||
hub: { name: t("bom_hub"), visible: false }
|
||||
variant: { name: t("bom_variant"), visible: true }
|
||||
quantity: { name: t("bom_quantity"), visible: true }
|
||||
max: { name: t("bom_max"), visible: true }
|
||||
final_weight_volume: { name: t("bom_final_weigth_volume"), visible: false }
|
||||
price: { name: t("price"), visible: false }
|
||||
|
||||
$scope.confirmRefresh = ->
|
||||
LineItems.allSaved() || confirm("Unsaved changes exist and will be lost if you continue.")
|
||||
LineItems.allSaved() || confirm(t "unsaved_changes_warning")
|
||||
|
||||
$scope.resetSelectFilters = ->
|
||||
$scope.distributorFilter = blankOption().id
|
||||
@@ -73,12 +73,12 @@ angular.module("admin.lineItems").controller 'LineItemsCtrl', ($scope, $timeout,
|
||||
StatusMessage.display 'success', "All changes saved"
|
||||
$scope.bulk_order_form.$setPristine()
|
||||
).catch ->
|
||||
StatusMessage.display 'failure', "Fields with red borders contain errors."
|
||||
StatusMessage.display 'failure', t "unsaved_changes_error"
|
||||
else
|
||||
StatusMessage.display 'failure', "Fields with red borders contain errors."
|
||||
StatusMessage.display 'failure', t "unsaved_changes_error"
|
||||
|
||||
$scope.deleteLineItem = (lineItem) ->
|
||||
if ($scope.confirmDelete && confirm("Are you sure?")) || !$scope.confirmDelete
|
||||
if ($scope.confirmDelete && confirm(t "are_you_sure")) || !$scope.confirmDelete
|
||||
LineItems.delete lineItem, =>
|
||||
$scope.lineItems.splice $scope.lineItems.indexOf(lineItem), 1
|
||||
|
||||
|
||||
Reference in New Issue
Block a user