Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
redirect: function(node) {
const parent = _.last(_.without(node.parents, '#'));
const routeParams = _.extend({}, this.onSelectRouteParameters, {
activeGroup: parent + '/' + node.id
});
const state = tools.unpackFromQueryString(location.search)[this.viewGroup] || {};
if (_.isUndefined(routeParams[this.viewGroup])) {
routeParams[this.viewGroup] = state;
}
const url = routing.generate(this.onSelectRoute, routeParams);
// simulate click on real link to check page state
const $link = $('<a>').attr('href', url);
this.$tree.before($link);
$link.click().remove();
},
</a>
url: function(method, params) {
const route = this.ROUTE[method];
if (!route) {
throw new Error('Method `' + method + '` is not supported by the collection');
}
return routing.generate(route, _.defaults({
entity: this.type
}, params));
},
url: function(method, params) {
return routing.generate(this.ROUTE[method], _.defaults({
entity: this.type,
id: this.id,
association: this.association
}, params));
},
_getUrl: function(actionKey, model) {
const routes = model.get('routes');
return routing.generate(routes[actionKey], {
entity: model.get('relatedActivityClass'),
id: model.get('relatedActivityId')
});
},
url: function(method, params) {
return routing.generate(this.ROUTE[method], _.defaults({entity: this.type, id: this.id}, params));
},
loadEmails: function() {
let url;
let promise;
const ids = this.$(this.selectors.loadMore).addClass('process').data('emailsItems');
if (ids) {
url = routing.generate('oro_email_items_view', {ids: ids.join(',')});
promise = $.ajax(url)
.done(_.bind(this.onDoneLoadEmails, this))
.fail(_.bind(this.onFailLoadEmails, this));
} else {
promise = $.Deferred().resolve('').promise();
}
return promise;
},
url: function() {
let base = _.result(this, 'urlRoot') || _.result(this.collection, 'url');
if (base && base.indexOf(this.get('type')) === -1) {
base += (base.charAt(base.length - 1) === '/' ? '' : '/') + this.get('type');
} else if (!base) {
base = routing.generate(this.route, {type: this.get('type')});
}
if (this.isNew()) {
return base;
}
return base + (base.charAt(base.length - 1) === '/' ? '' : '/') + 'ids/' + encodeURIComponent(this.id);
}
});
handleTemplate: function() {
if (!this.options.exportTemplateProcessor) {
throw new TypeError('"exportTemplateProcessor" is required');
}
let exportTemplateUrl;
if (this.options.isExportTemplatePopupRequired) {
exportTemplateUrl = routing.generate(
this.options.exportTemplateConfigRoute,
$.extend({}, this.routeOptions, {
processorAlias: this.options.exportTemplateProcessor
})
);
this._renderDialogWidget({
url: exportTemplateUrl,
dialogOptions: {
title: this.options.exportTemplateTitle
}
});
} else {
exportTemplateUrl = routing.generate(
this.options.exportTemplateRoute,
$.extend({}, this.routeOptions, {
this.options = $.extend(true, thisOptions, this.options, options || {});
this.$el = options._sourceElement;
this.$el.attr('autocomplete', 'off');
const dropClasses = this.$el.data('dropdown-classes');
if (dropClasses) {
this.options.config = _.assign(this.options.config, {
holder: '<div class="' + dropClasses.holder + '"></div>',
menu: '<ul class="' + dropClasses.menu + '"></ul>',
item: '<li class="' + dropClasses.item + '"><a href="#" class="' + dropClasses.link + '"></a></li>'
});
}
if (this.options.route_name) {
this.url = routing.generate(
this.options.route_name,
this.options.route_parameters
);
}
if (!_.isFunction(this.options.selection_template) && !_.isEmpty(this.options.selection_template)) {
this.options.selection_template = _.template(this.options.selection_template);
}
this.$el.typeahead(this.options.config);
},
url: function() {
let url;
let parameters;
if (this.isNew()) {
if (!this.get('relationClass') || !this.get('relationId')) {
throw new Error('Please specify relationClass and relationId');
}
parameters = {
relationId: this.get('relationId'),
relationClass: this.get('relationClass')
};
url = routing.generate('oro_api_comment_get_items', parameters);
} else {
parameters = {
id: this.get('id'),
_format: 'json'
};
url = routing.generate(this.route, parameters);
}
return url;
},