/
githubmirror
/
edx-platform
Обзор
Документация
Войти
/
githubmirror
/
edx-platform
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
release-ulmo
cms/static/js/models/section.js
38 строк
1 KB
Eric Fischer
eslint --fix
08 дек 2017, 22:38
08 дек 2017, 22:38
5bc6b31
Код
Авторство
О чём код?
define(['backbone', 'gettext', 'common/js/components/views/feedback_notification', 'js/utils/module'], function(Backbone, gettext, NotificationView, ModuleUtils) { var Section = Backbone.Model.extend({ defaults: { name: '' }, validate: function(attrs, options) { if (!attrs.name) { return gettext('You must specify a name'); } }, urlRoot: ModuleUtils.urlRoot, toJSON: function() { return { metadata: { display_name: this.get('name') } }; }, initialize: function() { this.listenTo(this, 'request', this.showNotification); this.listenTo(this, 'sync', this.hideNotification); }, showNotification: function() { if (!this.msg) { this.msg = new NotificationView.Mini({ title: gettext('Saving') }); } this.msg.show(); }, hideNotification: function() { if (!this.msg) { return; } this.msg.hide(); } }); return Section; });