Notifications for course updates.
This commit is contained in:
@@ -6,6 +6,7 @@ Feature: Course updates
|
||||
And I go to the course updates page
|
||||
When I add a new update with the text "Hello"
|
||||
Then I should see the update "Hello"
|
||||
And I see a "saving" notification
|
||||
|
||||
Scenario: Users can edit updates
|
||||
Given I have opened a new course in Studio
|
||||
@@ -13,15 +14,16 @@ Feature: Course updates
|
||||
When I add a new update with the text "Hello"
|
||||
And I modify the text to "Goodbye"
|
||||
Then I should see the update "Goodbye"
|
||||
And I see a "saving" notification
|
||||
|
||||
Scenario: Users can delete updates
|
||||
Given I have opened a new course in Studio
|
||||
And I go to the course updates page
|
||||
And I add a new update with the text "Hello"
|
||||
When I will confirm all alerts
|
||||
And I delete the update
|
||||
And I confirm the prompt
|
||||
Then I should not see the update "Hello"
|
||||
|
||||
And I see a "deleting" notification
|
||||
|
||||
Scenario: Users can edit update dates
|
||||
Given I have opened a new course in Studio
|
||||
@@ -29,9 +31,11 @@ Feature: Course updates
|
||||
And I add a new update with the text "Hello"
|
||||
When I edit the date to "June 1, 2013"
|
||||
Then I should see the date "June 1, 2013"
|
||||
And I see a "saving" notification
|
||||
|
||||
Scenario: Users can change handouts
|
||||
Given I have opened a new course in Studio
|
||||
And I go to the course updates page
|
||||
When I modify the handout to "<ol>Test</ol>"
|
||||
Then I see the handout "Test"
|
||||
And I see a "saving" notification
|
||||
|
||||
@@ -42,8 +42,8 @@ def i_save_a_new_section_release_date(_step):
|
||||
world.browser.click_link_by_text('Save')
|
||||
|
||||
|
||||
@step('I see a "saving" notification')
|
||||
def i_see_a_saving_notification(step):
|
||||
@step('I see a "(saving|deleting)" notification')
|
||||
def i_see_a_mini_notification(_step, _type):
|
||||
saving_css = '.wrapper-notification-mini'
|
||||
assert world.is_css_present(saving_css)
|
||||
|
||||
|
||||
@@ -97,7 +97,15 @@ CMS.Views.ClassInfoUpdateView = Backbone.View.extend({
|
||||
var targetModel = this.eventModel(event);
|
||||
targetModel.set({ date : this.dateEntry(event).val(), content : this.$codeMirror.getValue() });
|
||||
// push change to display, hide the editor, submit the change
|
||||
targetModel.save({});
|
||||
var saving = new CMS.Views.Notification.Mini({
|
||||
title: gettext('Saving') + '…'
|
||||
});
|
||||
saving.show();
|
||||
targetModel.save({}, {
|
||||
success: function() {
|
||||
saving.hide();
|
||||
}
|
||||
});
|
||||
this.closeEditor(this);
|
||||
|
||||
analytics.track('Saved Course Update', {
|
||||
@@ -140,29 +148,48 @@ CMS.Views.ClassInfoUpdateView = Backbone.View.extend({
|
||||
onDelete: function(event) {
|
||||
event.preventDefault();
|
||||
|
||||
if (!confirm('Are you sure you want to delete this update? This action cannot be undone.')) {
|
||||
return;
|
||||
}
|
||||
|
||||
analytics.track('Deleted Course Update', {
|
||||
'course': course_location_analytics,
|
||||
'date': this.dateEntry(event).val()
|
||||
});
|
||||
|
||||
var self = this;
|
||||
var targetModel = this.eventModel(event);
|
||||
this.modelDom(event).remove();
|
||||
var cacheThis = this;
|
||||
targetModel.destroy({
|
||||
success: function (model, response) {
|
||||
cacheThis.collection.fetch({
|
||||
success: function() {
|
||||
cacheThis.render();
|
||||
},
|
||||
reset: true
|
||||
});
|
||||
var confirm = new CMS.Views.Prompt.Warning({
|
||||
title: gettext('Are you sure you want to delete this update?'),
|
||||
message: gettext('This action cannot be undone.'),
|
||||
actions: {
|
||||
primary: {
|
||||
text: gettext('OK'),
|
||||
click: function () {
|
||||
analytics.track('Deleted Course Update', {
|
||||
'course': course_location_analytics,
|
||||
'date': self.dateEntry(event).val()
|
||||
});
|
||||
self.modelDom(event).remove();
|
||||
var deleting = new CMS.Views.Notification.Mini({
|
||||
title: gettext('Deleting') + '…'
|
||||
});
|
||||
deleting.show();
|
||||
targetModel.destroy({
|
||||
success: function (model, response) {
|
||||
self.collection.fetch({
|
||||
success: function() {
|
||||
self.render();
|
||||
deleting.hide();
|
||||
},
|
||||
reset: true
|
||||
});
|
||||
}
|
||||
});
|
||||
confirm.hide();
|
||||
}
|
||||
},
|
||||
secondary: {
|
||||
text: gettext('Cancel'),
|
||||
click: function() {
|
||||
confirm.hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
confirm.show();
|
||||
},
|
||||
|
||||
closeEditor: function(self, removePost) {
|
||||
var targetModel = self.collection.get(self.$currentPost.attr('name'));
|
||||
@@ -280,7 +307,15 @@ CMS.Views.ClassInfoHandoutsView = Backbone.View.extend({
|
||||
onSave: function(event) {
|
||||
this.model.set('data', this.$codeMirror.getValue());
|
||||
this.render();
|
||||
this.model.save({});
|
||||
var saving = new CMS.Views.Notification.Mini({
|
||||
title: gettext('Saving') + '…'
|
||||
});
|
||||
saving.show();
|
||||
this.model.save({}, {
|
||||
success: function() {
|
||||
saving.hide();
|
||||
}
|
||||
});
|
||||
this.$form.hide();
|
||||
this.closeEditor(this);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user