From 04e6d8df3c87f7e823a7a72bd3d6bc0d639115f6 Mon Sep 17 00:00:00 2001 From: swatijadhav Date: Thu, 2 Apr 2020 14:39:18 +0530 Subject: [PATCH 01/19] GCW-3106 inject missing logger service --- app/mixins/async_tasks.js | 1 + 1 file changed, 1 insertion(+) diff --git a/app/mixins/async_tasks.js b/app/mixins/async_tasks.js index 7ea264fba..88ff6efed 100644 --- a/app/mixins/async_tasks.js +++ b/app/mixins/async_tasks.js @@ -25,6 +25,7 @@ export const ERROR_STRATEGIES = { export default Ember.Mixin.create({ messageBox: Ember.inject.service(), + logger: Ember.inject.service(), ERROR_STRATEGIES, From 09c20ff42bcc051246d399629ded380bf01104b3 Mon Sep 17 00:00:00 2001 From: bharat619 Date: Thu, 2 Apr 2020 15:40:49 +0530 Subject: [PATCH 02/19] GCW-2644 show copy icon only for items which are not in draft state --- app/controllers/review_item.js | 94 ++++++++++++++++++++-------------- app/templates/review_item.hbs | 23 +++------ 2 files changed, 62 insertions(+), 55 deletions(-) diff --git a/app/controllers/review_item.js b/app/controllers/review_item.js index 9d2184b5c..0ae500469 100644 --- a/app/controllers/review_item.js +++ b/app/controllers/review_item.js @@ -1,23 +1,22 @@ -import Ember from 'ember'; +import Ember from "ember"; const { getOwner } = Ember; export default Ember.Controller.extend({ - application: Ember.inject.controller(), store: Ember.inject.service(), messageBox: Ember.inject.service(), i18n: Ember.inject.service(), - defaultPackage: Ember.computed.alias('model.packageType'), - item: Ember.computed.alias('model'), + defaultPackage: Ember.computed.alias("model.packageType"), + item: Ember.computed.alias("model"), cordova: Ember.inject.service(), - isItemVanished: Ember.computed.or('item.isDeleted', 'item.isDeleting'), + isItemVanished: Ember.computed.or("item.isDeleted", "item.isDeleting"), - showDeleteError: Ember.observer('item', 'isItemVanished', function(){ - var currentRoute = this.get('application.currentRouteName'); + showDeleteError: Ember.observer("item", "isItemVanished", function() { + var currentRoute = this.get("application.currentRouteName"); - if(this.get("isItemVanished")) { - if(currentRoute.indexOf("review_item") >= 0) { + if (this.get("isItemVanished")) { + if (currentRoute.indexOf("review_item") >= 0) { this.get("messageBox").alert(this.get("i18n").t("404_error"), () => { this.transitionToRoute("my_list"); }); @@ -25,7 +24,7 @@ export default Ember.Controller.extend({ } }), - itemDescriptionPlaceholder: Ember.computed(function(){ + itemDescriptionPlaceholder: Ember.computed(function() { return this.get("i18n").t("items.add_item.description_placeholder").string; }), @@ -44,41 +43,59 @@ export default Ember.Controller.extend({ } }), - displayEditLink: Ember.computed("application.currentRouteName", function(){ + displayEditLink: Ember.computed("application.currentRouteName", function() { return this.get("application.currentRouteName").indexOf("accept") >= 0; }), - isEditing: Ember.computed('item', 'item.donorDescription', 'item.donorCondition', { + isEditing: Ember.computed( + "item", + "item.donorDescription", + "item.donorCondition", + { + get: function() { + var item = this.get("item"); + var description = Ember.$.trim(item.get("donorDescription")); + return !(item.get("donorCondition") && description.length > 0); + }, + set: function(key, value) { + return value; + } + } + ), + canCopy: Ember.computed("item", { get: function() { - var item = this.get('item'); - var description = Ember.$.trim(item.get('donorDescription')); - return !(item.get('donorCondition') && description.length > 0); + const item = this.get("item"); + return ( + !item.get("offer").get("isFinished") && item.get("state") != "draft" + ); }, set: function(key, value) { return value; } }), - itemTypeId: Ember.computed('defaultPackage', { + itemTypeId: Ember.computed("defaultPackage", { get: function() { - return this.get('defaultPackage.id'); + return this.get("defaultPackage.id"); }, set: function(key, value) { return value; } }), - itemType: Ember.computed('defaultPackage', { + itemType: Ember.computed("defaultPackage", { get: function() { - return this.get('defaultPackage'); + return this.get("defaultPackage"); }, set: function(key, value) { return value; } }), - itemTypes: Ember.computed(function(){ - return this.get("store").peekAll('package_type').sortBy('name'); + itemTypes: Ember.computed(function() { + return this.get("store") + .peekAll("package_type") + .sortBy("name"); }), actions: { @@ -87,36 +104,37 @@ export default Ember.Controller.extend({ }, copyItem() { - var loadingView = getOwner(this).lookup('component:loading').append(); + var loadingView = getOwner(this) + .lookup("component:loading") + .append(); var _this = this; var item = _this.get("model"); var images = item.get("images"); var promises = []; var newItem = _this.get("store").createRecord("item", { - offer: item.get('offer'), - donorCondition: item.get('donorCondition'), + offer: item.get("offer"), + donorCondition: item.get("donorCondition"), state: "draft", packageType: item.get("packageType"), - donorDescription: item.get('donorDescription') + donorDescription: item.get("donorDescription") }); - newItem.save() - .then(() => { - images.forEach(function(image){ - var newImage = _this.get("store").createRecord('image', { - cloudinaryId: image.get('cloudinaryId'), - item: newItem, - favourite: image.get('favourite') - }); - promises.push(newImage.save()); + newItem.save().then(() => { + images.forEach(function(image) { + var newImage = _this.get("store").createRecord("image", { + cloudinaryId: image.get("cloudinaryId"), + item: newItem, + favourite: image.get("favourite") }); + promises.push(newImage.save()); + }); - Ember.RSVP.all(promises).then(function(){ - loadingView.destroy(); - _this.transitionToRoute('item.edit_images', newItem); - }); + Ember.RSVP.all(promises).then(function() { + loadingView.destroy(); + _this.transitionToRoute("item.edit_images", newItem); }); + }); } } }); diff --git a/app/templates/review_item.hbs b/app/templates/review_item.hbs index 9aab32079..93574af22 100644 --- a/app/templates/review_item.hbs +++ b/app/templates/review_item.hbs @@ -2,27 +2,23 @@
{{#link-to 'review_offer' classNames="back"}}{{t "back"}}{{/link-to}}
-

{{t "review_item.title"}}

-
- {{#unless model.offer.isFinished}} - + {{#if canCopyItem}} + - {{/unless}} + {{/if}}
-
-
+
-
+
{{partial 'item/status_message'}}
- {{#if isEditing}} {{partial 'item/item_edit_form'}} {{else}} @@ -41,7 +37,6 @@
{{/if}} -
-
{{#link-to 'review_item.accept' tagName="dd" classNames="small-3 columns text-center"}} @@ -58,14 +52,12 @@
{{t "review_item.accept"}}
{{/link-to}} {{/link-to}} - {{#link-to 'review_item.reject' tagName="dd" classNames="small-3 columns text-center"}} {{#link-to 'review_item.reject'}}
{{t "review_item.reject"}}
{{/link-to}} {{/link-to}} - {{#link-to 'review_item.donor_messages' tagName="dd" classNames="small-3 columns text-center"}} {{#link-to 'review_item.donor_messages'}} @@ -75,7 +67,6 @@
{{t "review_item.donor_message"}}
{{/link-to}} {{/link-to}} - {{#link-to 'review_item.supervisor_messages' tagName="dd" classNames="small-3 columns text-center"}} {{#link-to 'review_item.supervisor_messages'}} @@ -85,11 +76,9 @@
{{t "review_item.supervisor_message"}}
{{/link-to}} {{/link-to}} -
-
-
+
{{outlet}}
From 3e8d25347f5d219d324fe8781213383297a3c875 Mon Sep 17 00:00:00 2001 From: bharat619 Date: Thu, 2 Apr 2020 17:00:49 +0530 Subject: [PATCH 03/19] GCW-2644 changing method name --- app/controllers/review_item.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/review_item.js b/app/controllers/review_item.js index 0ae500469..9b5ed92ad 100644 --- a/app/controllers/review_item.js +++ b/app/controllers/review_item.js @@ -62,7 +62,7 @@ export default Ember.Controller.extend({ } } ), - canCopy: Ember.computed("item", { + canCopyItem: Ember.computed("item", { get: function() { const item = this.get("item"); return ( From 79e1153f4cdd765d637f6741f868cfdd3a673dd3 Mon Sep 17 00:00:00 2001 From: bharat619 Date: Fri, 3 Apr 2020 09:14:33 +0530 Subject: [PATCH 04/19] GCW-2644 removing get and set --- app/controllers/review_item.js | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/app/controllers/review_item.js b/app/controllers/review_item.js index 9b5ed92ad..93900a203 100644 --- a/app/controllers/review_item.js +++ b/app/controllers/review_item.js @@ -62,16 +62,9 @@ export default Ember.Controller.extend({ } } ), - canCopyItem: Ember.computed("item", { - get: function() { - const item = this.get("item"); - return ( - !item.get("offer").get("isFinished") && item.get("state") != "draft" - ); - }, - set: function(key, value) { - return value; - } + canCopyItem: Ember.computed("item", function() { + const item = this.get("item"); + return !item.get("offer").get("isFinished") && item.get("state") != "draft"; }), itemTypeId: Ember.computed("defaultPackage", { From b8d767ef4921a46e8bb0aaeff3f69861d58cbac6 Mon Sep 17 00:00:00 2001 From: bharat619 Date: Fri, 3 Apr 2020 09:49:40 +0530 Subject: [PATCH 05/19] GCW-2744 fix for mobile date filter issue --- app/components/date-picker.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/components/date-picker.js b/app/components/date-picker.js index 35957a7f4..54012b881 100644 --- a/app/components/date-picker.js +++ b/app/components/date-picker.js @@ -49,14 +49,14 @@ export default Ember.TextField.extend({ onClose: function() { Ember.$(document.activeElement).blur(); - const [minDate, maxDate] = [cmp.get("minDate"), cmp.get("maxDate")]; - this.set("min", minDate || ""); - this.set("max", maxDate || ""); }, onOpen: function() { const date = cmp.get("model"); this.set("val", date ? date : null); + const [minDate, maxDate] = [cmp.get("minDate"), cmp.get("maxDate")]; + this.set("min", minDate || ""); + this.set("max", maxDate || ""); }, onSet: function() { @@ -64,7 +64,7 @@ export default Ember.TextField.extend({ var onSelect = cmp.get("onSelect"); const date = this.get("val") || (this.get("select") && this.get("select").obj); - if (_.isFunction(onSelect)) { + if (isValidDate(date) && _.isFunction(onSelect)) { onSelect(date); } } From b5bda2b2a24428bc7e46426f0c2723744e6a0b07 Mon Sep 17 00:00:00 2001 From: Patrick R Date: Mon, 6 Apr 2020 11:25:42 +0800 Subject: [PATCH 06/19] Refactor edit_images into generic image_editor page --- app/controllers/image_editor.js | 345 ++++++++++++++++++++++++ app/controllers/receive_package.js | 4 +- app/mixins/async_tasks.js | 1 + app/models/package.js | 27 +- app/router.js | 10 +- app/routes/package/image_editor.js | 9 + app/services/api-base-service.js | 14 +- app/services/image-service.js | 41 +++ app/styles/app.scss | 1 + app/styles/templates/_image_editor.scss | 97 +++++++ app/templates/image_editor.hbs | 67 +++++ app/templates/receive_package.hbs | 4 +- app/utils/utility-methods.js | 7 + yarn.lock | 2 +- 14 files changed, 600 insertions(+), 29 deletions(-) create mode 100644 app/controllers/image_editor.js create mode 100644 app/routes/package/image_editor.js create mode 100644 app/services/image-service.js create mode 100644 app/styles/templates/_image_editor.scss create mode 100644 app/templates/image_editor.hbs diff --git a/app/controllers/image_editor.js b/app/controllers/image_editor.js new file mode 100644 index 000000000..897c8a53a --- /dev/null +++ b/app/controllers/image_editor.js @@ -0,0 +1,345 @@ +import Ember from "ember"; +import { translationMacro as t } from "ember-i18n"; +import config from "../config/environment"; +import AsyncMixin from "../mixins/async_tasks"; +import utils from "../utils/utility-methods"; + +/** + * Image Editor + * + * This is based on the old `edit_images` controller (shared.goodcity) + * This version supports any time of imageable record. In our case Item and Package + * + */ +export default Ember.Controller.extend(AsyncMixin, { + session: Ember.inject.service(), + store: Ember.inject.service(), + messageBox: Ember.inject.service(), + i18n: Ember.inject.service(), + cordova: Ember.inject.service(), + imageService: Ember.inject.service(), + previewImage: null, + addPhotoLabel: t("edit_images.add_photo"), + isReady: false, + isExpanded: false, + backBtnVisible: true, + loadingPercentage: t("edit_images.image_uploading"), + uploadedFileDate: null, + + record: Ember.computed.alias("model"), + + initActionSheet(onSuccess) { + return window.plugins.actionsheet.show( + { + buttonLabels: [ + this.locale("edit_images.upload").string, + this.locale("edit_images.camera").string, + this.locale("edit_images.cancel").string + ] + }, + function(buttonIndex) { + if (buttonIndex === 1) { + navigator.camera.getPicture(onSuccess, null, { + quality: 40, + destinationType: navigator.camera.DestinationType.DATA_URL, + sourceType: navigator.camera.PictureSourceType.PHOTOLIBRARY + }); + } + if (buttonIndex === 2) { + navigator.camera.getPicture(onSuccess, null, { + correctOrientation: true, + quality: 40, + destinationType: navigator.camera.DestinationType.DATA_URL, + sourceType: navigator.camera.PictureSourceType.CAMERA + }); + } + if (buttonIndex === 3) { + window.plugins.actionsheet.hide(); + } + } + ); + }, + + previewMatchesFavourite: Ember.computed( + "previewImage", + "favouriteImage", + function() { + return this.get("previewImage") === this.get("favouriteImage"); + } + ), + + noImage: Ember.computed.empty("images"), + + images: Ember.computed("record.images.length", function() { + //The reason for sorting is because by default it's ordered by favourite + //then id order. If another image is made favourite then deleted the first image + //by id order is made favourite which can be second image in list which seems random. + + //Sort by id ascending except place new images id = 0 at end + return (this.getWithDefault("record.images", []) || Ember.A()) + .toArray() + .sort(function(a, b) { + a = parseInt(a.get("id"), 10); + b = parseInt(b.get("id"), 10); + if (a === 0) { + return 1; + } + if (b === 0) { + return -1; + } + return a - b; + }); + }), + + supportsFavouriteImage: Ember.computed("record", function() { + const record = this.get("record"); + + return utils.supportsField(record, "favouriteImageId"); + }), + + favouriteImage: Ember.computed( + "images.@each.favourite", + "supportsFavouriteImage", + "record.favouriteImageId", + function() { + return this.get("supportsFavouriteImage") + ? this.get("record.favouriteImage") + : this.get("images").findBy("favourite"); + } + ), + + initPreviewImage: Ember.on( + "init", + Ember.observer("record", "images.[]", function() { + var image = this.get("images.firstObject"); + if (image) { + this.send("setPreview", image); + } + }) + ), + + //css related + previewImageBgCss: Ember.computed( + "previewImage", + "isExpanded", + "previewImage.angle", + { + get() { + var css = this.get("instructionBoxCss"); + if (!this.get("previewImage")) { + return css; + } + + var imgTag = new Image(); + imgTag.onload = () => { + var newCSS = new Ember.Handlebars.SafeString( + css + + "background-image:url(" + + this.get("previewImage.imageUrl") + + ");" + + "background-size: " + + (this.get("isExpanded") ? "contain" : "cover") + + ";" + ); + this.set("previewImageBgCss", newCSS); + }; + + imgTag.src = this.get("previewImage.imageUrl"); + + return new Ember.Handlebars.SafeString( + css + + "background-image:url('assets/images/image_loading.gif');" + + "background-size: 'inherit';" + ); + }, + + set(key, value) { + return value; + } + } + ), + + instructionBoxCss: Ember.computed("previewImage", "isExpanded", function() { + var height = Ember.$(window).height() * 0.6; + return new Ember.Handlebars.SafeString("min-height:" + height + "px;"); + }), + + thumbImageCss: Ember.computed(function() { + var imgWidth = Math.min(120, Ember.$(window).width() / 4 - 14); + return new Ember.Handlebars.SafeString( + "width:" + imgWidth + "px; height:" + imgWidth + "px;" + ); + }), + + locale(str) { + return this.get("i18n").t(str); + }, + + confirmRemoveImage() { + const deferred = Ember.RSVP.defer(); + + this.get("messageBox").custom( + this.locale("edit_images.delete_confirm"), + this.locale("edit_images.cancel_item"), + () => deferred.resolve(false), + this.locale("edit_images.remove_image"), + () => deferred.resolve(true) + ); + + return deferred.promise; + }, + + actions: { + done() { + window.history.back(); + }, + + setPreview(image) { + this.get("images").setEach("selected", false); + image.set("selected", true); + this.set("previewImage", image); + }, + + setFavourite() { + const record = this.get("record"); + const img = this.get("previewImage"); + + if (this.get("supportsFavouriteImage")) { + record.set("favouriteImageId", img.get("id")); + record.save().catch(error => { + record.rollbackAttributes(); + throw error; + }); + } else { + this.get("images").setEach("favourite", false); + this.get("previewImage").set("favourite", true); + this.get("previewImage") + .save() + .catch(error => { + this.get("images").forEach(i => i.rollbackAttributes()); + throw error; + }); + } + }, + + deleteImage(img) { + this.confirmRemoveImage().then(allowed => { + if (!allowed) return; + + this.runTask(() => { + img.deleteRecord(); + return img.save().then(i => { + i.unloadRecord(); + this.initPreviewImage(); + if (!this.get("favouriteImage")) { + this.send("setFavourite"); + } + }); + }, this.ERROR_STRATEGIES.MODAL); + }); + }, + + expandImage() { + this.toggleProperty("isExpanded"); + }, + + //file upload + triggerUpload() { + // For Cordova application + if (config.cordova.enabled) { + var onSuccess = (function(_this) { + return function(path) { + console.log(path); + var dataURL = "data:image/jpg;base64," + path; + + $("input[type='file']").fileupload( + "option", + "formData" + ).file = dataURL; + $("input[type='file']").fileupload("add", { files: [dataURL] }); + }; + })(this); + + this.initActionSheet(onSuccess); + } else { + // Trigger the file selection + Ember.$("#photo-list input[type='file']").trigger("click"); + } + }, + + uploadReady() { + this.set("isReady", true); + }, + + uploadStart(e, data) { + this.set("uploadedFileDate", data); + Ember.$(".loading-image-indicator").show(); + }, + + cancelUpload() { + if (this.get("uploadedFileDate")) { + this.get("uploadedFileDate").abort(); + } + }, + + uploadProgress(e, data) { + e.target.disabled = true; // disable image-selection + var progress = parseInt((data.loaded / data.total) * 100, 10) || 0; + this.set("addPhotoLabel", progress + "%"); + this.set( + "loadingPercentage", + this.get("i18n").t("edit_images.image_uploading") + progress + "%" + ); + }, + + uploadComplete(e) { + e.target.disabled = false; // enable image-selection + this.set("uploadedFileDate", null); + Ember.$(".loading-image-indicator.hide_image_loading").hide(); + this.set("addPhotoLabel", this.get("i18n").t("edit_images.add_photo")); + this.set( + "loadingPercentage", + this.get("i18n").t("edit_images.image_uploading") + ); + }, + + uploadSuccess(e, data) { + const identifier = + data.result.version + + "/" + + data.result.public_id + + "." + + data.result.format; + const record = this.get("record"); + const favourite = this.get("images.length") === 0; + + this.runTask(() => { + return this.get("imageService").createImage(record, identifier, { + favourite + }); + }, this.ERROR_STRATEGIES.MODAL); + }, + + rotateImageRight() { + var angle = this.get("previewImage.angle"); + angle = (angle + 90) % 360; + this.send("rotateImage", angle); + }, + + rotateImageLeft() { + var angle = this.get("previewImage.angle"); + angle = (angle ? angle - 90 : 270) % 360; + this.send("rotateImage", angle); + }, + + rotateImage(angle) { + var image = this.get("previewImage"); + image.set("angle", angle); + Ember.run.debounce(this, this.saveImageRotation, image, 400); + } + }, + + saveImageRotation(image) { + image.save(); + } +}); diff --git a/app/controllers/receive_package.js b/app/controllers/receive_package.js index d442b1c0f..b9564acb7 100644 --- a/app/controllers/receive_package.js +++ b/app/controllers/receive_package.js @@ -336,9 +336,7 @@ export default Ember.Controller.extend(AsyncTasksMixin, { assignImageToPackage() { const itemId = this.get("package.item.id"); - this.transitionToRoute("item.edit_images", itemId, { - queryParams: { isUnplannedPackage: true } - }); + this.transitionToRoute("package.image_editor", this.get("package")); }, moveBack() { diff --git a/app/mixins/async_tasks.js b/app/mixins/async_tasks.js index 7ea264fba..88ff6efed 100644 --- a/app/mixins/async_tasks.js +++ b/app/mixins/async_tasks.js @@ -25,6 +25,7 @@ export const ERROR_STRATEGIES = { export default Ember.Mixin.create({ messageBox: Ember.inject.service(), + logger: Ember.inject.service(), ERROR_STRATEGIES, diff --git a/app/models/package.js b/app/models/package.js index d2d4b2cbd..131e847c6 100644 --- a/app/models/package.js +++ b/app/models/package.js @@ -74,15 +74,9 @@ export default DS.Model.extend({ return !res ? "" : res + "cm"; }), - displayImageUrl: Ember.computed( - "favouriteImage", - "item.displayImageUrl", - function() { - return this.get("favouriteImage") - ? this.get("favouriteImage.thumbImageUrl") - : this.get("item.displayImageUrl"); - } - ), + displayImageUrl: Ember.computed("favouriteImage", function() { + return this.getWithDefault("favouriteImage.thumbImageUrl", ""); + }), images: hasMany("image", { async: false @@ -90,17 +84,10 @@ export default DS.Model.extend({ packageImages: Ember.computed.alias("images"), - favouriteImage: Ember.computed("packageImages.@each.favourite", function() { - return ( - this.get("packageImages") - .filterBy("favourite") - .get("firstObject") || - this.get("packageImages") - .sortBy("id") - .get("firstObject") || - this.get("item.displayImage") || - null - ); + favouriteImage: Ember.computed("images.@each.favourite", function() { + const images = this.get("images"); + + return images.findBy("favourite") || images.sortBy("id").get("firstObject"); }), hasOneDesignatedPackage: Ember.computed( diff --git a/app/router.js b/app/router.js index f4932f0f8..05921cb05 100755 --- a/app/router.js +++ b/app/router.js @@ -41,7 +41,15 @@ Router.map(function() { "item", { resetNamespace: true, path: "/items/:item_id" }, function() { - this.route("edit_images"); + this.route("image_editor"); + } + ); + + this.route( + "package", + { resetNamespace: true, path: "/package/:package_id" }, + function() { + this.route("image_editor"); } ); diff --git a/app/routes/package/image_editor.js b/app/routes/package/image_editor.js new file mode 100644 index 000000000..46b6593a7 --- /dev/null +++ b/app/routes/package/image_editor.js @@ -0,0 +1,9 @@ +import AuthorizeRoute from "../authorize"; + +export default AuthorizeRoute.extend({ + controllerName: "image_editor", + + renderTemplate() { + this.render("image_editor"); + } +}); diff --git a/app/services/api-base-service.js b/app/services/api-base-service.js index ae87b1658..77ed0872c 100644 --- a/app/services/api-base-service.js +++ b/app/services/api-base-service.js @@ -13,17 +13,23 @@ function urlWithParams(url, params) { export default Ember.Service.extend({ // ----- Services ----- + store: Ember.inject.service(), session: Ember.inject.service(), // ----- Utilities ----- _request(url, options, authorizedRequest) { - const { action, body } = options; + const { action, body, persist = false } = options; return new AjaxPromise( url, action, authorizedRequest ? this.get("session.authToken") : null, body - ); + ).then(data => { + if (persist) { + this.get("store").pushPayload(data); + } + return data; + }); }, // ----- CRUD ACTIONS ----- @@ -36,6 +42,7 @@ export default Ember.Service.extend({ return this._request( urlWithParams(url, opts), { + ...opts, action: "GET" }, authorizedRequest @@ -47,6 +54,7 @@ export default Ember.Service.extend({ return this._request( url, { + ...opts, action: "POST", body }, @@ -59,6 +67,7 @@ export default Ember.Service.extend({ return this._request( url, { + ...opts, action: "PUT", body }, @@ -71,6 +80,7 @@ export default Ember.Service.extend({ return this._request( url, { + ...opts, action: "DELETE" }, authorizedRequest diff --git a/app/services/image-service.js b/app/services/image-service.js new file mode 100644 index 000000000..5949780c4 --- /dev/null +++ b/app/services/image-service.js @@ -0,0 +1,41 @@ +import Ember from "ember"; +import ApiBaseService from "./api-base-service"; +import _ from "lodash"; + +const ID = record => { + switch (typeof record) { + case "string": + case "number": + return record; + default: + return record.get("id"); + } +}; + +export default ApiBaseService.extend({ + store: Ember.inject.service(), + + createImage(imageableRecord, cloudinaryId, params = {}) { + const modelName = imageableRecord.get("constructor.modelName"); + + return this.POST( + `/images`, + { + image: { + imageable_type: _.upperFirst(_.camelCase(modelName)), + imageable_id: imageableRecord.get("id"), + cloudinary_id: cloudinaryId, + favourite: _.get(params, "favourite", false) + } + }, + { persist: true } + ).then(data => { + const id = Number(data["image"]["id"]); + const img = this.get("store").peekRecord("image", id); + + imageableRecord.getWithDefault("images", []).pushObject(img); + + return img; + }); + } +}); diff --git a/app/styles/app.scss b/app/styles/app.scss index 6b334bb32..eefde185a 100644 --- a/app/styles/app.scss +++ b/app/styles/app.scss @@ -32,6 +32,7 @@ @import "templates/review_offer/donor_details"; @import "templates/review_item/reject"; @import "templates/review_item"; +@import "templates/image_editor"; @import "templates/delivery/contact_details"; @import "templates/delivery/drop_off"; @import "node_modules/ember-searchable-select/app/styles/ember-searchable-select/style"; diff --git a/app/styles/templates/_image_editor.scss b/app/styles/templates/_image_editor.scss new file mode 100644 index 000000000..2e0e0058c --- /dev/null +++ b/app/styles/templates/_image_editor.scss @@ -0,0 +1,97 @@ +.image-editor-page { + padding: 0; + + #photo-list { + margin-left: 0; + li { + list-style-type: none; + padding: 3px; + display: inline-block; + vertical-align: middle; + position: relative; + img:hover, .selected img { + border-color: white; + } + } + .disabled { + border-color: $org-grey !important; + color: $org-grey !important; + } + .fa-star { + position: absolute; + top: -3px; + right: -3px; + } + .noImage { + left: 20%; + a { + text-decoration: underline; + font-weight: bold; + color: #596573 !important; + } + } + } + + #add-photo { + font-size: 0.8em; + vertical-align: middle; + color: white; + border: white 2px dashed; + border-radius: 2px; + background-color: $white-with-shadow; + text-align: center; + padding: 5px; + } + + #main-image { + margin-bottom: 20px; + background-color: black; + > div { + height: 92%; + width: 100%; + background-repeat: no-repeat; + background-position: center center; + position: relative; + } + } + + #main-image-controls { + color: white; + background-color: $black-with-shadow; + bottom: 0; + left: 0; + font-size: 34px; + padding: 0.5rem 0.5rem; + display: inline-block; + height: 8% !important; + + .fa-star-o, .fa-star, .fa-trash, .fa-repeat, .fa-undo { + float: right; + } + .fa-expand, .fa-compress { + float: left; + } + .fa-star-o, .fa-star, .fa-trash, .fa-repeat, { + margin-left: 1rem; + } + } + + #main-image.is-expanded { + position: absolute; + width: 100%; + height: 100%; + top: 0; + left: 0; + z-index: 10; + margin-bottom: 0; + padding-bottom: 3%; + } + + .hidden_file_input{ + opacity: 0; + height: 0; + z-index: -100; + width: 0; + position: absolute; + } +} diff --git a/app/templates/image_editor.hbs b/app/templates/image_editor.hbs new file mode 100644 index 000000000..fcc1b5027 --- /dev/null +++ b/app/templates/image_editor.hbs @@ -0,0 +1,67 @@ +
+ +
+ {{#unless noImage}} +
+
+ + + + {{else}} +
+ +

{{t "edit_images.donating_what"}}

+

{{t "edit_images.take_photos"}}

+
+
+ {{/unless}} +
+ +
    +
  • + + + + {{addPhotoLabel}} + + + {{cloudinary-upload ready="uploadReady" progress="uploadProgress" + always="uploadComplete" done="uploadSuccess" submit="uploadProgress" + offerId=offer.id}} +
  • + {{#unless noImage}} + {{#each images as |image|}} +
  • + + + + +
  • + {{/each}} + {{/unless}} +
+
+ +
+
+
+ +
+
+
diff --git a/app/templates/receive_package.hbs b/app/templates/receive_package.hbs index f7fa4e761..77c2e9608 100644 --- a/app/templates/receive_package.hbs +++ b/app/templates/receive_package.hbs @@ -41,8 +41,8 @@
- {{#if package.item.displayImageUrl}} - + {{#if package.displayImageUrl}} + {{else}}
{{t 'items.add_item.add_images'}} diff --git a/app/utils/utility-methods.js b/app/utils/utility-methods.js index e1d32fe6f..f73512712 100644 --- a/app/utils/utility-methods.js +++ b/app/utils/utility-methods.js @@ -1,3 +1,5 @@ +import _ from "lodash"; + export default { arrayExists(arr) { return arr && arr.length; @@ -9,5 +11,10 @@ export default { stringifyArray(arr) { return Array.isArray(arr) ? arr.toString() : ""; + }, + + supportsField(record, field) { + const fields = record.get("constructor.attributes"); + return fields.has(_.camelCase(field)); } }; diff --git a/yarn.lock b/yarn.lock index a5eed403f..3f8ba5650 100644 --- a/yarn.lock +++ b/yarn.lock @@ -12305,7 +12305,7 @@ sha@~2.0.1: "shared-goodcity@git://github.com/crossroads/shared.goodcity.git#master": version "0.0.0" - resolved "git://github.com/crossroads/shared.goodcity.git#d0a58d679189761f9968281ad777a44d30e9cc69" + resolved "git://github.com/crossroads/shared.goodcity.git#629f28a97126237e4e33df13d22f41612657a923" dependencies: cryptiles "^4.1.2" ember-cli-babel "^5.1.6" From fe836c7deab21a0d77f1323d52a8aa4bb9bf58b1 Mon Sep 17 00:00:00 2001 From: Patrick R Date: Mon, 6 Apr 2020 11:51:11 +0800 Subject: [PATCH 07/19] restore edit_images for item (temp) --- app/router.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/router.js b/app/router.js index 05921cb05..ffaede3c4 100755 --- a/app/router.js +++ b/app/router.js @@ -41,7 +41,7 @@ Router.map(function() { "item", { resetNamespace: true, path: "/items/:item_id" }, function() { - this.route("image_editor"); + this.route("edit_images"); } ); From 3dadcd30e8fb49f97279b12f968c2cf225ae5ff3 Mon Sep 17 00:00:00 2001 From: Patrick R Date: Mon, 6 Apr 2020 12:58:44 +0800 Subject: [PATCH 08/19] remove unused code --- app/services/image-service.js | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/app/services/image-service.js b/app/services/image-service.js index 5949780c4..35ad1d0dd 100644 --- a/app/services/image-service.js +++ b/app/services/image-service.js @@ -1,20 +1,7 @@ -import Ember from "ember"; import ApiBaseService from "./api-base-service"; import _ from "lodash"; -const ID = record => { - switch (typeof record) { - case "string": - case "number": - return record; - default: - return record.get("id"); - } -}; - export default ApiBaseService.extend({ - store: Ember.inject.service(), - createImage(imageableRecord, cloudinaryId, params = {}) { const modelName = imageableRecord.get("constructor.modelName"); From b3ada8346cdff2665418d1a2c9079b7c774b80f2 Mon Sep 17 00:00:00 2001 From: Patrick R Date: Mon, 6 Apr 2020 13:32:43 +0800 Subject: [PATCH 09/19] CircleCI Fix attempt --- .circleci/config.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 94cbd359f..63e160488 100755 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -91,6 +91,9 @@ jobs: - run: name: Wait for Ember test server to start command: dockerize -wait tcp://localhost:4201 -timeout 1m + - run: + name: Sleep for a while + command: sleep 30 - run: name: Run Ember tests command: COVERAGE=true yarn test:ci From 63971a3d4b8b58a13478dbe92bc8241048161f7b Mon Sep 17 00:00:00 2001 From: Patrick R Date: Mon, 6 Apr 2020 13:44:43 +0800 Subject: [PATCH 10/19] CircleCI Fix attempt --- .circleci/config.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 63e160488..397b167ae 100755 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -91,12 +91,9 @@ jobs: - run: name: Wait for Ember test server to start command: dockerize -wait tcp://localhost:4201 -timeout 1m - - run: - name: Sleep for a while - command: sleep 30 - run: name: Run Ember tests - command: COVERAGE=true yarn test:ci + command: yarn test:ci - persist_to_workspace: root: . paths: From 84e05956f0894be23842b36d0e8dd0c0643895c2 Mon Sep 17 00:00:00 2001 From: Patrick R Date: Mon, 6 Apr 2020 13:46:23 +0800 Subject: [PATCH 11/19] CircleCI Fix attempt --- .circleci/config.yml | 2 +- app/services/api-base-service.js | 20 ++++++++------------ 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 397b167ae..94cbd359f 100755 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -93,7 +93,7 @@ jobs: command: dockerize -wait tcp://localhost:4201 -timeout 1m - run: name: Run Ember tests - command: yarn test:ci + command: COVERAGE=true yarn test:ci - persist_to_workspace: root: . paths: diff --git a/app/services/api-base-service.js b/app/services/api-base-service.js index 77ed0872c..18e39abd6 100644 --- a/app/services/api-base-service.js +++ b/app/services/api-base-service.js @@ -41,10 +41,9 @@ export default Ember.Service.extend({ const { authorizedRequest = true } = opts; return this._request( urlWithParams(url, opts), - { - ...opts, + _.extend({}, opts, { action: "GET" - }, + }), authorizedRequest ); }, @@ -53,11 +52,10 @@ export default Ember.Service.extend({ const { authorizedRequest = true } = opts; return this._request( url, - { - ...opts, + _.extend({}, opts, { action: "POST", body - }, + }), authorizedRequest ); }, @@ -66,11 +64,10 @@ export default Ember.Service.extend({ const { authorizedRequest = true } = opts; return this._request( url, - { - ...opts, + _.extend({}, opts, { action: "PUT", body - }, + }), authorizedRequest ); }, @@ -79,10 +76,9 @@ export default Ember.Service.extend({ const { authorizedRequest = true } = opts; return this._request( url, - { - ...opts, + _.extend({}, opts, { action: "DELETE" - }, + }), authorizedRequest ); } From e120c4370cef62bb417fd2c17276eef55b8c4606 Mon Sep 17 00:00:00 2001 From: Patrick R Date: Mon, 6 Apr 2020 13:55:21 +0800 Subject: [PATCH 12/19] CircleCI Fix attempt --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 94cbd359f..397b167ae 100755 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -93,7 +93,7 @@ jobs: command: dockerize -wait tcp://localhost:4201 -timeout 1m - run: name: Run Ember tests - command: COVERAGE=true yarn test:ci + command: yarn test:ci - persist_to_workspace: root: . paths: From c453627271bf18f9565a511cb83f5842610c0b2b Mon Sep 17 00:00:00 2001 From: Patrick R Date: Mon, 6 Apr 2020 14:31:52 +0800 Subject: [PATCH 13/19] CircleCI Fix attempt --- .circleci/config.yml | 2 +- app/controllers/image_editor.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 397b167ae..94cbd359f 100755 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -93,7 +93,7 @@ jobs: command: dockerize -wait tcp://localhost:4201 -timeout 1m - run: name: Run Ember tests - command: yarn test:ci + command: COVERAGE=true yarn test:ci - persist_to_workspace: root: . paths: diff --git a/app/controllers/image_editor.js b/app/controllers/image_editor.js index 897c8a53a..1b538cf1a 100644 --- a/app/controllers/image_editor.js +++ b/app/controllers/image_editor.js @@ -7,7 +7,7 @@ import utils from "../utils/utility-methods"; /** * Image Editor * - * This is based on the old `edit_images` controller (shared.goodcity) + * This is a modified version of the old `edit_images` controller (shared.goodcity) * This version supports any time of imageable record. In our case Item and Package * */ @@ -315,7 +315,7 @@ export default Ember.Controller.extend(AsyncMixin, { this.runTask(() => { return this.get("imageService").createImage(record, identifier, { - favourite + favourite: favourite }); }, this.ERROR_STRATEGIES.MODAL); }, From e2e86aebbc3767ebab054be1b989ce27b03adea7 Mon Sep 17 00:00:00 2001 From: Patrick R Date: Tue, 7 Apr 2020 10:19:02 +0800 Subject: [PATCH 14/19] Fix master build --- tests/acceptance/review-item-test.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/tests/acceptance/review-item-test.js b/tests/acceptance/review-item-test.js index 54d41ebc5..e94cf3c75 100644 --- a/tests/acceptance/review-item-test.js +++ b/tests/acceptance/review-item-test.js @@ -21,7 +21,10 @@ module("Display review Item", { App = startApp({}, 2); role = FactoryGuy.make("role"); offer = FactoryGuy.make("offer", { state: "under_review" }); - item = FactoryGuy.make("item_with_type", { state: "accepted" }); + item = FactoryGuy.make("item_with_type", { + offer: offer, + state: "accepted" + }); packageType = FactoryGuy.make("package_type", { visibleInSelects: true }); package1 = FactoryGuy.make("package", { item: item, @@ -63,7 +66,7 @@ module("Display review Item", { } }); $.mockjax({ - url: "/api/v1/package*", + url: "/api/v1/package_type*", type: "GET", status: 200, responseText: { @@ -75,7 +78,9 @@ module("Display review Item", { type: "PUT", status: 200, responseText: { - package: [package2.toJSON({ includeId: true })] + packages: [package2.toJSON({ includeId: true })], + items: [item.toJSON({ includeId: true })], + offers: [offer.toJSON({ includeId: true })] } }); $.mockjax({ @@ -83,8 +88,9 @@ module("Display review Item", { type: "PUT", status: 200, responseText: { - item: [item.toJSON({ includeId: true })], - package: [package2.toJSON({ includeId: true })] + items: [item.toJSON({ includeId: true })], + packages: [package2.toJSON({ includeId: true })], + offers: [offer.toJSON({ includeId: true })] } }); }, From cbe1e8f10db5b12368b73457add91c7a42fa1e50 Mon Sep 17 00:00:00 2001 From: Patrick R Date: Tue, 7 Apr 2020 10:28:36 +0800 Subject: [PATCH 15/19] More spec fixes --- .../acceptance/selecting-package-type-test.js | 69 +++++++++++++------ 1 file changed, 47 insertions(+), 22 deletions(-) diff --git a/tests/acceptance/selecting-package-type-test.js b/tests/acceptance/selecting-package-type-test.js index 049a649d8..b8ccd6894 100644 --- a/tests/acceptance/selecting-package-type-test.js +++ b/tests/acceptance/selecting-package-type-test.js @@ -1,50 +1,75 @@ -import Ember from 'ember'; -import { module, test } from 'qunit'; -import startApp from '../helpers/start-app'; -import '../factories/offer'; -import '../factories/item'; -import '../factories/package'; -import FactoryGuy from 'ember-data-factory-guy'; -import TestHelper from 'ember-data-factory-guy/factory-guy-test-helper'; +import Ember from "ember"; +import { module, test } from "qunit"; +import startApp from "../helpers/start-app"; +import "../factories/offer"; +import "../factories/item"; +import "../factories/package"; +import FactoryGuy from "ember-data-factory-guy"; +import TestHelper from "ember-data-factory-guy/factory-guy-test-helper"; var App, offer, item1, item2, package1, package2, packageType, role; -module('Reviewer: Accept Item Tab', { +module("Reviewer: Select package type", { beforeEach: function() { App = startApp({}, 2); TestHelper.setup(); - offer = FactoryGuy.make("offer", { state:"under_review" }); - item1 = FactoryGuy.make("item_with_type", { state: "accepted" }); + offer = FactoryGuy.make("offer", { state: "under_review" }); + item1 = FactoryGuy.make("item_with_type", { + offer: offer, + state: "accepted" + }); item2 = FactoryGuy.make("item", { offer: offer }); - packageType = item1.get('packageType'); - package1 = FactoryGuy.make("package", { item: item1, packageType: packageType }); - package2 = FactoryGuy.make("package", { item: item1, packageType: packageType }); + packageType = item1.get("packageType"); + package1 = FactoryGuy.make("package", { + item: item1, + packageType: packageType + }); + package2 = FactoryGuy.make("package", { + item: item1, + packageType: packageType + }); role = FactoryGuy.make("role"); - $.mockjax({url: '/api/v1/role*', type: 'GET', status: 200,responseText: { - roles: [role.toJSON({includeId: true})] + $.mockjax({ + url: "/api/v1/role*", + type: "GET", + status: 200, + responseText: { + roles: [role.toJSON({ includeId: true })] } }); - $.mockjax({url: '/api/v1/package_types', type: 'GET', status: 200, responseText: { + $.mockjax({ + url: "/api/v1/package_types", + type: "GET", + status: 200, + responseText: { package_types: [packageType.toJSON({ includeId: true })] } }); }, afterEach: function() { - Em.run(function() { TestHelper.teardown(); }); - Ember.run(App, 'destroy'); + Em.run(function() { + TestHelper.teardown(); + }); + Ember.run(App, "destroy"); } }); -test("selecting package-type popup default sub package type", function(assert){ +test("selecting package-type popup default sub package type", function(assert) { assert.expect(2); visit("/offers/" + offer.id + "/review_item/" + item1.id + "/accept"); andThen(function() { - assert.equal($('.item_lable_input input').val(), item1.get('packageType.name')); - assert.equal($('.detail_container div label select').val(), item1.get('packageType.id')); + assert.equal( + $(".item_lable_input input").val(), + item1.get("packageType.name") + ); + assert.equal( + $(".detail_container div label select").val(), + item1.get("packageType.id") + ); }); }); From 43f373e8e93ea02a4899ed553d8980d65e2a0e96 Mon Sep 17 00:00:00 2001 From: Patrick R Date: Tue, 7 Apr 2020 13:47:05 +0800 Subject: [PATCH 16/19] bump version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d9f2fbd64..cb202a519 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "goodcity", - "version": "0.17.0", + "version": "0.17.1", "description": "The GoodCity Admin app enables administrators to process donated goods.", "private": true, "directories": { From f1520bb77b52c194da838dd038af265cb5fed0b8 Mon Sep 17 00:00:00 2001 From: Patrick R Date: Tue, 7 Apr 2020 15:49:30 +0800 Subject: [PATCH 17/19] Fix the package-image component's selection --- app/components/package-image.js | 42 +++++++++++++--------- app/controllers/image_editor.js | 9 ++--- app/controllers/review_item/accept.js | 4 +-- app/templates/components/package-image.hbs | 2 +- app/templates/review_item/accept.hbs | 2 +- 5 files changed, 30 insertions(+), 29 deletions(-) diff --git a/app/components/package-image.js b/app/components/package-image.js index 62dd36a28..807f28a61 100644 --- a/app/components/package-image.js +++ b/app/components/package-image.js @@ -1,7 +1,6 @@ -import Ember from 'ember'; +import Ember from "ember"; export default Ember.Component.extend({ - store: Ember.inject.service(), displayUserPrompt: false, selectedImage: null, @@ -9,38 +8,47 @@ export default Ember.Component.extend({ // images: Ember.computed.alias("package.item.images"), currentPackage: Ember.computed("package", function() { - return this.get("store").peekRecord("package", this.get("package.id")) || this.get("package"); + return ( + this.get("store").peekRecord("package", this.get("package.id")) || + this.get("package") + ); }), - images: Ember.computed("currentPackage.item.images.[]", "currentPackage.packageImages.[]", function() { - // if(this.get("currentPackage.packageImages.length") > 0) { - // return this.get("currentPackage.packageImages"); - // } else { - return this.get("currentPackage.item.images"); - // } - }), + images: Ember.computed( + "currentPackage.item.images.[]", + "currentPackage.images.[]", + function() { + const pkgImages = this.getWithDefault( + "currentPackage.images", + [] + ).toArray(); + + return this.getWithDefault("currentPackage.item.images", []) + .toArray() + .filter(im => !pkgImages.findBy("cloudinaryId", im.get("cloudinaryId"))) + .concat(pkgImages); + } + ), actions: { - selectImage(image) { - this.get("images").setEach("selected", false); - image.set("selected", true); this.set("selectedImage", image); }, setPackageImage() { var image = this.get("selectedImage"); this.get("package").favouriteImage = image; - this.sendAction("setPackageImage", this.get("index"), image); + this.sendAction("setPackageImage", this.get("currentPackage"), image); }, displayImagesListOverlay() { - if(this.get("images").length > 0) { + if (this.get("images").length > 0) { this.set("displayUserPrompt", true); var favouriteImage = this.get("package.favouriteImage"); - if(favouriteImage) { this.send("selectImage", favouriteImage); } + if (favouriteImage) { + this.send("selectImage", favouriteImage); + } } } } - }); diff --git a/app/controllers/image_editor.js b/app/controllers/image_editor.js index 1b538cf1a..bf54da1f6 100644 --- a/app/controllers/image_editor.js +++ b/app/controllers/image_editor.js @@ -99,12 +99,9 @@ export default Ember.Controller.extend(AsyncMixin, { favouriteImage: Ember.computed( "images.@each.favourite", - "supportsFavouriteImage", - "record.favouriteImageId", + "images.[]", function() { - return this.get("supportsFavouriteImage") - ? this.get("record.favouriteImage") - : this.get("images").findBy("favourite"); + return this.get("images").findBy("favourite"); } ), @@ -195,8 +192,6 @@ export default Ember.Controller.extend(AsyncMixin, { }, setPreview(image) { - this.get("images").setEach("selected", false); - image.set("selected", true); this.set("previewImage", image); }, diff --git a/app/controllers/review_item/accept.js b/app/controllers/review_item/accept.js index 1fefbc693..85d709a50 100644 --- a/app/controllers/review_item/accept.js +++ b/app/controllers/review_item/accept.js @@ -161,11 +161,9 @@ export default Ember.Controller.extend({ }); }, - setPackageImage(index, image) { - var currentPackage = this.get("packages")[index]; + setPackageImage(currentPackage, image) { Ember.set(currentPackage, "favouriteImageId", image.get("id")); Ember.set(currentPackage, "displayImageUrl", image.get("thumbImageUrl")); - this.get("packages")[index] = currentPackage; }, removePackage(index) { diff --git a/app/templates/components/package-image.hbs b/app/templates/components/package-image.hbs index 8410409f8..68de82977 100644 --- a/app/templates/components/package-image.hbs +++ b/app/templates/components/package-image.hbs @@ -9,7 +9,7 @@
    {{#each images as |image|}}
  • - +
  • diff --git a/app/templates/review_item/accept.hbs b/app/templates/review_item/accept.hbs index 20aac9ce5..dd0118eb3 100644 --- a/app/templates/review_item/accept.hbs +++ b/app/templates/review_item/accept.hbs @@ -14,7 +14,7 @@
    - {{package-image package=pkg index=index setPackageImage="setPackageImage"}} + {{package-image package=pkg setPackageImage="setPackageImage"}}
    From 98f080bbac5a60b36a8e80f556b478fc1301c757 Mon Sep 17 00:00:00 2001 From: Patrick R Date: Tue, 7 Apr 2020 17:30:05 +0800 Subject: [PATCH 18/19] Popup fix + restore expansion fix + update shared.goodcity --- app/controllers/image_editor.js | 6 ++++-- yarn.lock | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/controllers/image_editor.js b/app/controllers/image_editor.js index bf54da1f6..ee8a6c461 100644 --- a/app/controllers/image_editor.js +++ b/app/controllers/image_editor.js @@ -177,7 +177,7 @@ export default Ember.Controller.extend(AsyncMixin, { this.get("messageBox").custom( this.locale("edit_images.delete_confirm"), - this.locale("edit_images.cancel_item"), + this.locale("receive.receiving.not_now"), () => deferred.resolve(false), this.locale("edit_images.remove_image"), () => deferred.resolve(true) @@ -230,7 +230,9 @@ export default Ember.Controller.extend(AsyncMixin, { this.send("setFavourite"); } }); - }, this.ERROR_STRATEGIES.MODAL); + }, this.ERROR_STRATEGIES.MODAL).finally(() => { + this.set("isExpanded", false); + }); }); }, diff --git a/yarn.lock b/yarn.lock index 3f8ba5650..85a3718ba 100644 --- a/yarn.lock +++ b/yarn.lock @@ -12305,7 +12305,7 @@ sha@~2.0.1: "shared-goodcity@git://github.com/crossroads/shared.goodcity.git#master": version "0.0.0" - resolved "git://github.com/crossroads/shared.goodcity.git#629f28a97126237e4e33df13d22f41612657a923" + resolved "git://github.com/crossroads/shared.goodcity.git#ecdf3d340831865b6e6a362d7b615b91516113d4" dependencies: cryptiles "^4.1.2" ember-cli-babel "^5.1.6" From 2f24c28b52036708c439d736a92f27baebb51a86 Mon Sep 17 00:00:00 2001 From: shreyas098 Date: Tue, 7 Apr 2020 15:01:19 +0530 Subject: [PATCH 19/19] Added changes to yarn.lock --- yarn.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yarn.lock b/yarn.lock index 3f8ba5650..5c1187da3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -12305,7 +12305,7 @@ sha@~2.0.1: "shared-goodcity@git://github.com/crossroads/shared.goodcity.git#master": version "0.0.0" - resolved "git://github.com/crossroads/shared.goodcity.git#629f28a97126237e4e33df13d22f41612657a923" + resolved "git://github.com/crossroads/shared.goodcity.git#4482b5e3cbd338f76a7e0078c1f9a1f5ebdff13f" dependencies: cryptiles "^4.1.2" ember-cli-babel "^5.1.6"