Don't release date if it hasn't been changed.

STUD-2056
This commit is contained in:
Ben McMorran
2014-08-05 11:15:46 -04:00
committed by cahrens
parent 391ab8469e
commit e4635aaa69
2 changed files with 37 additions and 1 deletions

View File

@@ -184,6 +184,14 @@ define(['jquery', 'backbone', 'underscore', 'gettext', 'js/views/modals/base_mod
ReleaseDateView = BaseDateView.extend({
fieldName: 'start',
startingReleaseDate: null,
afterRender: function () {
BaseDateView.prototype.afterRender.call(this);
// Store the starting date and time so that we can determine if the user
// actually changed it when "Save" is pressed.
this.startingReleaseDate = this.getValue();
},
getValue: function () {
return DateUtils.getDate(this.$('#start_date'), this.$('#start_time'));
@@ -195,8 +203,12 @@ define(['jquery', 'backbone', 'underscore', 'gettext', 'js/views/modals/base_mod
},
getMetadata: function () {
var newReleaseDate = this.getValue();
if (JSON.stringify(newReleaseDate) === JSON.stringify(this.startingReleaseDate)) {
return {};
}
return {
'start': this.getValue()
'start': newReleaseDate
};
}
});