Skip to content

Commit 019899c

Browse files
Merge pull request #807 from crossroads/master
Release July#1
2 parents e9107e2 + 38771b6 commit 019899c

File tree

109 files changed

+2546
-430
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

109 files changed

+2546
-430
lines changed

.github/workflows/release-notes.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ on:
1212
jobs:
1313
release-notes:
1414
runs-on: ubuntu-latest
15+
if: github.event.pull_request.merged == true
1516
steps:
1617
- uses: actions/checkout@v2
1718
- name: Use Node.js 12.x

app/adapters/designation.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ export default ApplicationAdapter.extend({
1414
const params = {
1515
include_packages: false,
1616
include_order: true,
17-
include_orders_packages: false
17+
include_orders_packages: false,
18+
include_messages: true
1819
};
1920
let baseUrl = this.buildURL(modelName, id, snapshot);
2021
const paramStr = _.map(params, (value, key) => `${key}=${value}`).join("&");

app/adapters/item_action.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import ApplicationAdapter from "./application";
2+
import _ from "lodash";
3+
import config from "stock/config/environment";
4+
5+
export default ApplicationAdapter.extend({
6+
urlForQuery(query, modelName) {
7+
const { NAMESPACE, API_HOST_URL } = config.APP;
8+
const paramStr = _.map(query, (value, key) => `${key}=${value}`).join("&");
9+
return `${API_HOST_URL}/${NAMESPACE}/packages_inventories?${paramStr}`;
10+
}
11+
});
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import ValidatableForm from "ember-cli-html5-validation/components/validatable-form";
2+
import AsyncMixin, { ERROR_STRATEGIES } from "stock/mixins/async";
3+
4+
export default ValidatableForm.extend(AsyncMixin, {
5+
actions: {
6+
submit(eventName) {
7+
if (!this.get("element").checkValidity()) {
8+
this.scrollToFirstError();
9+
return false;
10+
}
11+
12+
this.runTask(async () => {
13+
this.get(eventName || "onSubmit")();
14+
}, ERROR_STRATEGIES.MODAL);
15+
16+
return false;
17+
}
18+
}
19+
});

app/components/calendar-input.js

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const MIN_DATE = moment()
77
const DEFAULT_PICKADATE_CONFIG = {
88
selectMonths: true,
99
selectYears: true,
10-
format: "ddd mmm d",
10+
formatSubmit: "ddd mmm d",
1111
monthsFull: moment.months(),
1212
monthsShort: moment.monthsShort(),
1313
weekdaysShort: moment.weekdaysShort(),
@@ -47,6 +47,14 @@ export default Ember.TextField.extend({
4747
return selected.getTime() === date.getTime();
4848
},
4949

50+
_cb() {
51+
const onSelect = this.get("onSelect");
52+
if (onSelect) {
53+
const date = this.get("selection");
54+
onSelect(date);
55+
}
56+
},
57+
5058
onClose(pickadate) {
5159
Ember.$(document.activeElement).blur();
5260
if (this.setting) {
@@ -58,7 +66,8 @@ export default Ember.TextField.extend({
5866
this.set("selection", date);
5967
this.setting = true;
6068
Ember.run.next(() => {
61-
pickadate.set("select", new Date(date), { format: "ddd mmm d" });
69+
this._cb();
70+
pickadate.set("select", moment(date).toDate(), { format: "ddd mmm d" });
6271
this.setting = false;
6372
});
6473
}
@@ -67,7 +76,9 @@ export default Ember.TextField.extend({
6776
onStart(pickadate) {
6877
var date = this.get("selection");
6978
if (date) {
70-
pickadate.set("select", new Date(date), { format: "ddd mmm d" });
79+
pickadate.set("select", moment(new Date(date)).toDate(), {
80+
format: "ddd mmm d"
81+
});
7182
}
7283
},
7384

@@ -95,6 +106,9 @@ export default Ember.TextField.extend({
95106
},
96107
onOpen: function() {
97108
component.onStart(this);
109+
},
110+
onStart: function() {
111+
component.onStart(this);
98112
}
99113
})
100114
);
@@ -105,5 +119,9 @@ export default Ember.TextField.extend({
105119
Ember.$("[id$=selectedDate]").trigger("blur");
106120
});
107121
});
122+
},
123+
124+
willDestroyElement() {
125+
this.set("selection", null);
108126
}
109127
});

app/components/check-box.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import Ember from "ember";
2+
3+
export default Ember.Component.extend({
4+
attributeBindings: ["type", "value"],
5+
tagName: "input",
6+
type: "checkbox",
7+
checked: false,
8+
selection: [],
9+
10+
didInsertElement() {
11+
let isSelected =
12+
this.get("selection").indexOf(parseInt(this.get("selected"))) >= 0;
13+
if (isSelected) {
14+
this.$().prop("checked", true);
15+
this.sendAction("action", this.get("value"), true);
16+
}
17+
},
18+
19+
_updateElementValue: function() {
20+
this.set("checked", this.$().prop("checked"));
21+
let isChecked = this.get("checked");
22+
this.sendAction("action", this.get("value"), isChecked);
23+
}.on("didInsertElement"),
24+
25+
change: function(event) {
26+
this._updateElementValue();
27+
}
28+
});

app/components/date-picker.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export default Ember.TextField.extend({
3232
val = null;
3333
}
3434
this.set("_model", val);
35-
this.set("value", val ? moment(val).format("ddd MMM D") : "");
35+
this.set("value", val ? moment(val).format("LL") : "");
3636
return val;
3737
}
3838
}),
@@ -45,7 +45,7 @@ export default Ember.TextField.extend({
4545
Ember.$(this.element).pickadate({
4646
selectMonths: !!enablePastDate,
4747
selectYears: !!enablePastDate,
48-
format: "ddd mmm d",
48+
formatSubmit: "ddd mmm d",
4949
monthsFull: moment.months(),
5050
monthsShort: moment.monthsShort(),
5151
weekdaysShort: moment.weekdaysShort(),
@@ -56,7 +56,7 @@ export default Ember.TextField.extend({
5656
onStart: function() {
5757
if (this.get("value")) {
5858
cmp.set("_model", this.get("value"));
59-
cmp.set("value", moment(this.get("value")).format("ddd MMM D"));
59+
cmp.set("value", moment(this.get("value")).format("LL"));
6060
}
6161
},
6262

@@ -68,7 +68,7 @@ export default Ember.TextField.extend({
6868
this.get("val") || (this.get("select") && this.get("select").obj);
6969
if (isValidDate(date) && _.isFunction(onSelect)) {
7070
onSelect(date);
71-
cmp.set("value", moment(date).format("ddd MMM D"));
71+
cmp.set("value", moment(date).format("LL"));
7272
}
7373
}
7474
},

app/components/goodcity/add-item-overlay.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,6 @@ export default Ember.Component.extend({
1010

1111
pkgLocations: Ember.computed.alias("pkg.packagesLocations"),
1212

13-
pkgLocationName: Ember.computed("pkg.packagesLocations", function() {
14-
let pkgLocations = this.get("pkgLocations");
15-
return pkgLocations && pkgLocations.get("firstObject.location.name");
16-
}),
17-
1813
calculateSumFor(attribute) {
1914
let quantities = [];
2015
if (this.get("pkg.packagesLocations")) {

app/components/image-zoom.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ export default Ember.Component.extend({
1212
return this.get("item.setImages");
1313
}
1414

15-
return this.get("item.images").mapBy("imageUrl");
15+
let images = this.get("item.images") || [this.get("item.image")];
16+
17+
return images.mapBy("imageUrl");
1618
}),
1719

1820
actions: {

app/components/item-description-textarea.js

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,19 @@ export default AutoResizableTextarea.extend({
2323
var item = this.get("item");
2424
var url = `/packages/${item.get("id")}`;
2525
var key = this.get("name");
26-
var value = this.attrs.value.value || "";
26+
const value = this.get("value") ? this.get("value").trim() : "";
2727
var packageParams = {};
28-
packageParams[key] = this.get("value").trim() || "";
28+
packageParams[key] = value;
2929

30+
if (value === "" && this.get("required")) {
31+
this.$().focus();
32+
return false;
33+
}
3034
if (
3135
packageParams[key].toString() !==
32-
this.get("previousValue")
33-
.toString()
34-
.trim() &&
35-
value !== ""
36+
this.get("previousValue")
37+
.toString()
38+
.trim()
3639
) {
3740
var loadingView = getOwner(this)
3841
.lookup("component:loading")
@@ -47,22 +50,15 @@ export default AutoResizableTextarea.extend({
4750
loadingView.destroy();
4851
});
4952
}
50-
this.element.value = value.trim();
51-
if (this.element.value === "") {
52-
this.$().focus();
53-
return false;
54-
}
55-
Ember.$(this.element).removeClass("item-description-textarea");
53+
Ember.$(this.element).removeClass("item-description-textarea-withbg");
5654
},
5755

5856
focusIn() {
5957
this.addCssStyle();
6058
},
6159

6260
addCssStyle() {
63-
if (!this.get("noCss")) {
64-
Ember.$(this.element).addClass("item-description-textarea");
65-
}
61+
Ember.$(this.element).addClass("item-description-textarea-withbg");
6662
this.set("previousValue", this.get("value") || "");
6763
},
6864

0 commit comments

Comments
 (0)