コード例 #1
0
ファイル: list.js プロジェクト: winnlab/agusha-frontend
					.done(function (doc, status, def) {
						appState.attr('notification', {
							status: status,
							msg: status === 'success'
								? options.deletedMsg
								: options.deletedErr
						});
					})
コード例 #2
0
	init: function (element, options) {
        var self = this;

		_.extend(self.options, options);

        var options = self.options;

        self.module = new can.Map({
            langs: appState.attr('langs')
        });

        self.ensureObject(options.doc, 'age');
        self.ensureObject(options.doc, 'answer', []);
        self.ensureObject(options.doc, 'theme');
        self.ensureObject(options.doc, 'type');

        self.module.attr(options.moduleName, options.doc);

        self.module.attr('ages', options.ages);
        self.module.attr('themes', options.themes);
        self.module.attr('types', options.types);

        self.module.attr('addingComment', null);
        self.module.attr('showComments', true);

        self.module.attr('specialistNames', specialistNames);

        var ageValue = [],
            themeValue = [];

        self.module.attr(options.moduleName + '.age').each(function (item) {
            ageValue.push(item._id);
        });

        self.module.attr(options.moduleName + '.theme').each(function (item) {
            themeValue.push(item._id);
        });

        self.module.attr('ageValue', ageValue);
        self.module.attr('themeValue', themeValue);

        if(!self.options.doc.attr('_id')) {
            self.options.doc.attr('active', true);
        }

        self.loadView(options.viewpath + options.viewName, self.module);
	},
コード例 #3
0
ファイル: article.js プロジェクト: winnlab/agusha-frontend
	init: function(element, options) {
		_.extend(this.options, options);

		var self = this,
			options = this.options,
			gallery = new can.List;

		self.module = new can.Map({
			langs: appState.attr('langs')
		});

		if (!options.doc.attr('_id')) {
            can.ajax({
                url: `/admin/article/maxpos`
            }).always((response) => {
                var pos = response.data && response.data.max || 0;
                options.doc.attr('position', pos + 1);
            });
		};

		self.ensureObject(options.doc, 'desc');
		self.ensureObject(options.doc, 'meta');
		self.ensureObject(options.doc, 'age', []);
		self.ensureObject(options.doc, 'theme', []);
		self.ensureObject(options.doc, 'type');
		self.ensureObject(options.doc, 'image');

		self.module.attr(options.moduleName, options.doc);

		self.module.attr('ages', options.ages);
		self.module.attr('themes', options.themes);
		self.module.attr('types', options.types);

		var ageValue = [],
			themeValue = [];

		self.module.attr(options.moduleName + '.age').each(function (item) {
			ageValue.push(item._id);
		});

		self.module.attr(options.moduleName + '.theme').each(function (item) {
			themeValue.push(item._id);
		});

		self.module.attr('ageValue', ageValue);
		self.module.attr('themeValue', themeValue);

		if (options.doc) {
			if (options.doc.attr('_id')) {
				gallery = new GalleryModel.List({article_id: options.doc.attr('_id')});
			}
		}

		self.module.attr('gallery', gallery);
		self.module.attr('module', {gallery: self.module.attr('gallery')});

		self.module.attr('newGalleryName', '');
		self.module.attr('addingGallery', false);
		self.module.attr('showCroppers', false);
		self.module.attr('cropSizes', [
			{size: 'B', name: 'Фоновое изображение', ratio: 2.31, w: 1850, h: 800, alt: options.doc.attr('image.dataB.alt') || false},
			{size: 'S', name: 'Малое изображение (S)', ratio: 0.96, w: 290, h: 303, alt: options.doc.attr('image.dataS.alt') || false},
			{size: 'L', name: 'Большое изображение (L)', ratio: 1.91, w: 580, h: 303, alt: options.doc.attr('image.dataL.alt') || false},
			{size: 'XL', name: 'Экстра большое изображение (XL)', ratio: 0.96, w: 580, h: 606, alt: options.doc.attr('image.dataXL.alt') || false},
			{size: 'SOCIAL', name: 'Для шаринга в социальные сети', ratio: 1.91, w: 470, h: 246, alt: options.doc.attr('image.dataSOCIAL.alt') || false}
		]);

		self.loadView(options.viewpath + options.viewName, self.module);
	},
コード例 #4
0
ファイル: list.js プロジェクト: winnlab/agusha-frontend
 setNotification: function (status, msg) {
     appState.attr('notification', {
         status: status,
         msg: msg
     });
 },
コード例 #5
0
ファイル: list.js プロジェクト: winnlab/agusha-frontend
					.fail(function (response) {
						appState.attr('notification', {
							status: 'error',
							msg: response
						});
					})