From d0b0c9d0606d90d75356a8a01a6ae7dbc014079c Mon Sep 17 00:00:00 2001 From: Bernat Exposito Domenech Date: Wed, 11 Mar 2020 12:03:55 +0100 Subject: [PATCH] pull request changes --- front/core/components/watcher/watcher.js | 5 ++++- loopback/locale/es.json | 2 +- modules/travel/back/models/travel.js | 2 +- modules/travel/front/create/index.js | 12 +----------- modules/travel/front/create/index.spec.js | 2 +- modules/travel/front/index/locale/es.yml | 3 ++- 6 files changed, 10 insertions(+), 16 deletions(-) diff --git a/front/core/components/watcher/watcher.js b/front/core/components/watcher/watcher.js index 0ab41edf9..1a1abffa5 100644 --- a/front/core/components/watcher/watcher.js +++ b/front/core/components/watcher/watcher.js @@ -167,6 +167,9 @@ export default class Watcher extends Component { ); }); } + /** + * return the request method. + */ requestMethod() { return this.$attrs.save && this.$attrs.save.toLowerCase(); @@ -183,7 +186,7 @@ export default class Watcher extends Component { } /** - * Checks if data is ready to send. + * Checks if the form is valid. */ isInvalid() { if (this.form && this.form.$invalid) diff --git a/loopback/locale/es.json b/loopback/locale/es.json index e97518504..5f41c9931 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -129,5 +129,5 @@ "ORDER_ROW_UNAVAILABLE": "No hay disponibilidad de este producto", "Distance must be lesser than 1000": "La distancia debe ser inferior a 1000", "This ticket is deleted": "Este ticket está eliminado", - "The introduced data already exists": "La información introducida ya existe" + "A travel with this data already exists": "Ya existe un travel con estos datos" } \ No newline at end of file diff --git a/modules/travel/back/models/travel.js b/modules/travel/back/models/travel.js index a7c045b31..b47742c26 100644 --- a/modules/travel/back/models/travel.js +++ b/modules/travel/back/models/travel.js @@ -10,7 +10,7 @@ module.exports = Self => { Self.rewriteDbError(function(err) { if (err.code === 'ER_DUP_ENTRY') - return new UserError('The introduced data already exists'); + return new UserError('A travel with this data already exists'); return err; }); }; diff --git a/modules/travel/front/create/index.js b/modules/travel/front/create/index.js index 513e1e0b1..0d5a2cc01 100644 --- a/modules/travel/front/create/index.js +++ b/modules/travel/front/create/index.js @@ -5,21 +5,11 @@ class Controller extends Section { constructor($element, $, $stateParams) { super($element, $); this.$stateParams = $stateParams; - this.travel = {}; } $onChanges() { if (this.$stateParams && this.$stateParams.q) - this._travel = JSON.parse(this.$stateParams.q); - } - - get travel() { - return this._travel; - } - - set travel(value) { - this._travel = value; - if (!value) return; + this.travel = JSON.parse(this.$stateParams.q); } onSubmit() { diff --git a/modules/travel/front/create/index.spec.js b/modules/travel/front/create/index.spec.js index e1095d35b..a6fa5a9b1 100644 --- a/modules/travel/front/create/index.spec.js +++ b/modules/travel/front/create/index.spec.js @@ -36,7 +36,7 @@ describe('Travel Component vnTravelCreate', () => { controller.$onChanges(); - expect(controller._travel).toEqual(json); + expect(controller.travel).toEqual(json); }); }); }); diff --git a/modules/travel/front/index/locale/es.yml b/modules/travel/front/index/locale/es.yml index 63d23affd..5ce4c502f 100644 --- a/modules/travel/front/index/locale/es.yml +++ b/modules/travel/front/index/locale/es.yml @@ -1,2 +1,3 @@ Do you want to clone this travel?: ¿Desea clonar este envio? -All it's properties will be copied: Todas sus propiedades serán copiadas \ No newline at end of file +All it's properties will be copied: Todas sus propiedades serán copiadas +Clone: Clonar \ No newline at end of file