Esempio n. 1
0
        request('post', saveURL, data, function(error, response) {
            if (!response.body.success) {
                modal.open({
                    content: response.body.html || response.body,
                    afterOpen: function(container) {
                        if (!response.body.html) { container.style({ width: '90%' }); }
                    }
                });
            } else {
                modal.close();

                if ($('#styles')) {
                    extras = '<br />' + (response.body.warning ? '<hr />' + response.body.title + '<br />' + response.body.html : translate('GANTRY5_PLATFORM_JS_CSS_COMPILED'));
                }

                toastr[response.body.warning ? 'warning' : 'success'](interpolate(sentence, {
                    verb: type.slice(-1) == 's' ? 'have' : 'has',
                    type: type,
                    extras: extras
                }), type + ' ' + translate('GANTRY5_PLATFORM_SAVED'));
            }

            saves.disabled(false);
            saves.hideIndicator();
            saves.forEach(function(save) {
                $(save).lastSaved = new Date();
            });

            if (page == 'layout') { lm.layoutmanager.updatePendingChanges(); }

            // all good, disable 'pending' flag
            flags.set('pending', false);
            flags.emit('update:pending');
        });
Esempio n. 2
0
 , base_urls: function base_urls( ){
     return [{
         name: 'schema'
       , path: interpolate( urljoin(  '{{apiname}}', '{{name}}', 'schema' ), this.options ).replace( /\/\//g, "/" )
       , handler: (req, reply) => this.get_schema( req, reply )
       , config:{ tags:['api'] }
     }
     , {
         name: 'detail'
       , path: interpolate( urljoin(  '{{apiname}}', '{{name}}', '{pk}' ), this.options ).replace( /\/\//g, "/" )
       , handler: (req, reply) => this.dispatch_detail( req, reply )
       , config:{ tags:['api'] }
     }
     , {
         name: 'list'
       , path: interpolate( urljoin(  '{{apiname}}', '{{name}}' ), this.options ).replace( /\/\//g, "/" )
       , handler: (req, reply) => this.dispatch_list( req, reply )
       , config:{
             tags:['api']
             , validate:{ query: validators.query }
         }
     }];
 }
Esempio n. 3
0
        request('post', saveURL, data, function(error, response) {
            if (!response.body.success) {
                modal.open({
                    content: response.body.html || response.body,
                    afterOpen: function(container) {
                        if (!response.body.html) { container.style({ width: '90%' }); }
                    }
                });
            } else {
                modal.close();
                toastr.success(interpolate(sentence, {
                    verb: type.slice(-1) == 's' ? 'have' : 'has',
                    type: type,
                    extras: extras
                }), type + ' Saved');
            }

            element.hideIndicator();
            element.lastSaved = new Date();

            if (page == 'layout') { lm.layoutmanager.updatePendingChanges(); }
        });
Esempio n. 4
0
 url: function(str, args) {
   args = args.map(window.encodeURIComponent);
   return interpolate(str, args, /\{(.+?)\}/);
 },
Esempio n. 5
0
		errors.forEach(function (error) {
			var err = error.error;
			err.filePath = error.file.replace(/components\/[^/]+\.js$/, "$&x");
			console.log(interpolate("{{filePath}}: line {{line}}, col {{character}}, {{reason}}", err));
		});