return baseUrl + '/api/issues/search';
},
+ _injectRelational: function (issue, source, baseField, lookupField) {
+ var baseValue = issue[baseField];
+ if (baseValue != null && _.size(source)) {
+ var lookupValue = _.find(source, function (candidate) {
+ return candidate[lookupField] === baseValue;
+ });
+ if (lookupValue != null) {
+ Object.keys(lookupValue).forEach(function (key) {
+ var newKey = baseField + key.charAt(0).toUpperCase() + key.slice(1);
+ issue[newKey] = lookupValue[key];
+ });
+ }
+ }
+ return issue;
+ },
+
parseIssues: function (r) {
+ var that = this;
var find = function (source, key, keyField) {
var searchDict = {};
searchDict[keyField || 'key'] = key;
ruleName: rule.name
});
}
+ issue = that._injectRelational(issue, r.users, 'assignee', 'login');
return issue;
});
},
</li>
<li>
- {{#if assignee.login}}
- <a href="#" class="issue-action-option" data-property="assignees" data-value="{{assignee.login}}">
- {{t "assigned_to"}} {{assignee.name}}
+ {{#if assignee}}
+ <a href="#" class="issue-action-option" data-property="assignees" data-value="{{assignee}}">
+ {{t "assigned_to"}} {{assigneeName}}
</a>
{{else}}
<a href="#" data-property="assigned" data-value="false">
return baseUrl + '/api/issues/search';
},
+ _injectRelational: function (issue, source, baseField, lookupField) {
+ var baseValue = issue[baseField];
+ if (baseValue != null && _.size(source)) {
+ var lookupValue = _.find(source, function (candidate) {
+ return candidate[lookupField] === baseValue;
+ });
+ if (lookupValue != null) {
+ Object.keys(lookupValue).forEach(function (key) {
+ var newKey = baseField + key.charAt(0).toUpperCase() + key.slice(1);
+ issue[newKey] = lookupValue[key];
+ });
+ }
+ }
+ return issue;
+ },
+
parse: function (r) {
+ var that = this;
function find (source, key, keyField) {
var searchDict = {};
searchDict[keyField || 'key'] = key;
if (rule) {
_.extend(issue, { ruleName: rule.name });
}
+ issue = that._injectRelational(issue, r.users, 'assignee', 'login');
return issue;
});
}
},
parse: function (r) {
- return r.issue ? r.issue : r;
+ if (r.issue) {
+ return this._injectRelational(r.issue, r.users, 'assignee', 'login');
+ } else {
+ return r;
+ }
+ },
+
+ _injectRelational: function (issue, source, baseField, lookupField) {
+ var baseValue = issue[baseField];
+ if (baseValue != null && _.size(source)) {
+ var lookupValue = _.find(source, function (candidate) {
+ return candidate[lookupField] === baseValue;
+ });
+ if (lookupValue != null) {
+ Object.keys(lookupValue).forEach(function (key) {
+ var newKey = baseField + key.charAt(0).toUpperCase() + key.slice(1);
+ issue[newKey] = lookupValue[key];
+ });
+ }
+ }
+ return issue;
},
sync: function (method, model, options) {
<li class="issue-meta">
{{#inArray actions "assign"}}
<button class="button-link issue-action issue-action-with-options js-issue-assign">
- {{#if assignee.login}}
+ {{#if assignee}}
{{#ifShowAvatars}}
- <span class="text-top">{{avatarHelper assignee.email 16}}</span>
+ <span class="text-top">{{avatarHelper assigneeEmail 16}}</span>
{{/ifShowAvatars}}
{{/if}}
- <span class="issue-meta-label">{{#if assignee.login}}{{assignee.name}}{{else}}{{t 'unassigned'}}{{/if}}</span> <i class="icon-dropdown"></i>
+ <span class="issue-meta-label">{{#if assignee}}{{assigneeName}}{{else}}{{t 'unassigned'}}{{/if}}</span> <i class="icon-dropdown"></i>
</button>
{{else}}
- {{#if assignee.login}}
+ {{#if assignee}}
{{#ifShowAvatars}}
- <span class="text-top">{{avatarHelper assignee.email 16}}</span>
+ <span class="text-top">{{avatarHelper assigneeEmail 16}}</span>
{{/ifShowAvatars}}
{{/if}}
- <span class="issue-meta-label">{{#if assignee.login}}{{assignee.name}}{{else}}{{t 'unassigned'}}{{/if}}</span>
+ <span class="issue-meta-label">{{#if assignee}}{{assigneeName}}{{else}}{{t 'unassigned'}}{{/if}}</span>
{{/inArray}}
</li>
},
getAssignee: function () {
- return this.model.get('assignee').login;
+ return this.model.get('assignee');
},
getAssigneeName: function () {
- return this.model.get('assignee').name;
+ return this.model.get('assigneeName');
},
onRender: function () {