translations in app/assets/javascripts/admin/

This commit is contained in:
ludivinecp
2015-12-14 19:49:45 +01:00
committed by elf Pavlik
parent 7192f12a49
commit 69ab113201
3 changed files with 57 additions and 30 deletions

View File

@@ -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("label_producers"), 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") + 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,21 +253,21 @@ 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."
message = if DirtyProducts.count() == 1 then t("one_product") else DirtyProducts.count() + t("products")
StatusMessage.display 'notice', t("changes_to") + "#{message}" + t("remain_unsaved.")
else
StatusMessage.clear()

View File

@@ -34,7 +34,7 @@ angular.module('enterprise_fees', [])
return function(scope, element, attrs) {
if(scope.enterprise_fee.id) {
var url = "/admin/enterprise_fees/" + scope.enterprise_fee.id
var html = '<a href="'+url+'" class="delete-resource icon_link with-tip icon-trash no-text" data-action="remove" data-confirm="Are you sure?" url="'+url+'"></a>';
var html = '<a href="'+url+'" class="delete-resource icon_link with-tip icon-trash no-text" data-action="remove" data-confirm="'+t("are_you_sure")+'" url="'+url+'"></a>';
//var html = '<a href="'+url+'" class="delete-resource" data-confirm="Are you sure?"><img alt="Delete" src="/assets/admin/icons/delete.png" /> Delete</a>';
element.append(html);
}

View File

@@ -324,6 +324,11 @@ See the %{link} to find out more about %{sitename}'s features and to start using
products_cart_empty: "Cart empty"
products_edit_cart: "Edit your cart"
products_from: from
products_change: "No changes to save"
products_update_error: "Saving failed with the following error(s):"
products_update_error_msg: "Saving failed."
products_update_error_data: "Save failed due to invalid data:"
products_changes_saved: "Changes saved."
search_no_results_html: "Sorry, no results found for %{query}. Try another search?"
@@ -337,6 +342,7 @@ See the %{link} to find out more about %{sitename}'s features and to start using
groups_search: "Search name or keyword"
groups_no_groups: "No groups found"
groups_about: "About Us"
groups_producers: "Our producers"
groups_hubs: "Our hubs"
groups_contact_web: Contact
@@ -430,7 +436,16 @@ See the %{link} to find out more about %{sitename}'s features and to start using
products_variant: Variant
products_quantity: Quantity
products_availabel: Available?
products_price: Price
products_price: "Price"
products_sku: "SKU"
products_name: "name"
products_unit: "unit"
products_on_hand: "on hand"
products_on_demand: "on demand"
products_category: "category"
products_tax_category: "tax category"
products_available_on: "available on"
products_inherits_properties: "Inherits Properties ?"
register_title: Register
@@ -832,3 +847,15 @@ Please follow the instructions there to make your enterprise visible on the Open
invoice_date: "Invoice date:"
due_date: "Due date:"
account_code: "Account code:"
equals: "Equals"
contains: "contains"
filter_products: "Filter Products"
delete_product_variant: "The last variant cannot be deleted!"
progress: "progress"
saving: "Saving.."
success: "success"
failure: "failure"
unsaved_changes_confirmation: "Unsaved changes will be lost. Continue anyway?"
one_product: "one product"
changes_to: "Changes to"
remain_unsaved: "remain unsaced"