@@ -69,6 +69,14 @@ | |||
'<%= escape_javascript action -%>': '<%= escape_javascript message("issue.action.#{action}.formlink") -%>', | |||
<% end -%> | |||
}, | |||
'transitions': { | |||
confirm: '<%= escape_javascript message('issue.transition.confirm') -%>', | |||
unconfirm: '<%= escape_javascript message('issue.transition.unconfirm') -%>', | |||
resolve: '<%= escape_javascript message('issue.transition.resolve') -%>', | |||
falsepositive: '<%= escape_javascript message('issue.transition.falsepositive') -%>', | |||
reopen: '<%= escape_javascript message('issue.transition.reopen') -%>', | |||
close: '<%= escape_javascript message('issue.transition.close') -%>' | |||
}, | |||
assignee: '<%= escape_javascript message('issue_filter.criteria.assignee') -%>', | |||
resolution: '<%= escape_javascript message('issue_filter.criteria.resolution') -%>', | |||
resolutions: { |
@@ -7,7 +7,7 @@ | |||
{{/if}} | |||
<div class="line-right"> | |||
{{fromNow updateDate}} | |||
{{fUpdateAge}} | |||
</div> | |||
</div> | |||
@@ -123,7 +123,7 @@ | |||
<h4> | |||
<%= image_tag('reviews/comment.png') -%> | |||
<b>{{userName}}</b> | |||
({{fCreationDate}}) | |||
({{fCreatedAge}}) | |||
{{#if updatable}} | |||
<%= image_tag 'sep12.png' -%> | |||
@@ -137,46 +137,55 @@ | |||
{{/each}} | |||
</div> | |||
<ul class="code-issue-actions"> | |||
{{#inArray actions "comment"}} | |||
<li> | |||
<a id="issue-comment" class="link-action"><%= message('issue.comment.formlink') -%></a> | |||
</li> | |||
{{/inArray}} | |||
{{#ifNotEmpty actions transitions}} | |||
<ul class="code-issue-actions"> | |||
{{#inArray actions "comment"}} | |||
<li> | |||
<a id="issue-comment" class="link-action">{{translate "actions.comment" }}</a> | |||
</li> | |||
{{/inArray}} | |||
{{#inArray actions "assign"}} | |||
<li> | |||
<a id="issue-assign" class="link-action"><%= message('issue.assign.formlink') -%></a> | |||
{{#inArray actions "assign_to_me"}} | |||
[<a id="issue-assign-to-me" class="link-action"><%= message('issue.assign.to_me') -%></a>] | |||
{{/inArray}} | |||
</li> | |||
{{/inArray}} | |||
{{#inArray actions "assign"}} | |||
<li> | |||
<a id="issue-assign" class="link-action">{{translate "actions.assign" }}</a> | |||
{{#inArray actions "assign_to_me"}} | |||
[<a id="issue-assign-to-me" class="link-action">{{translate "actions.assign_to_me" }}</a>] | |||
{{/inArray}} | |||
</li> | |||
{{/inArray}} | |||
{{#inArray actions "plan"}} | |||
<li> | |||
<a id="issue-plan" class="link-action"><%= message('issue.do_plan') -%></a> | |||
</li> | |||
{{/inArray}} | |||
{{#inArray actions "plan"}} | |||
<li> | |||
<a id="issue-plan" class="link-action">{{translate "actions.plan" }}</a> | |||
</li> | |||
{{/inArray}} | |||
<li> | |||
<div class="dropdown"> | |||
<a class="link-action link-more" onclick="showDropdownMenuOnElement($j(this).next('.dropdown-menu')); return false;">More actions</a> | |||
<ul style="display: none" class="dropdown-menu"> | |||
{{#inArray actions "set_severity"}} | |||
<li> | |||
<a id="issue-change-severity" class="link-action spacer-right">Change severity</a> | |||
</li> | |||
{{/inArray}} | |||
{{#each transitions}} | |||
<li> | |||
<a class="link-action spacer-right issue-transition" data-transition="{{this}}">{{this}}</a> | |||
</li> | |||
{{/each}} | |||
</ul> | |||
</div> | |||
</li> | |||
</ul> | |||
{{#ifHasExtraActions actions transitions}} | |||
<li> | |||
<div class="dropdown"> | |||
<a class="link-action link-more" onclick="showDropdownMenuOnElement($j(this).next('.dropdown-menu')); return false;">More actions</a> | |||
<ul style="display: none" class="dropdown-menu"> | |||
{{#inArray actions "set_severity"}} | |||
<li> | |||
<a id="issue-change-severity" class="link-action spacer-right">{{translate "actions.set_severity"}}</a> | |||
</li> | |||
{{/inArray}} | |||
{{#pluginActions actions}} | |||
<li> | |||
<a class="link-action spacer-right issue-action" data-action="{{this}}">{{translate "actions" this}}</a> | |||
</li> | |||
{{/pluginActions}} | |||
{{#each transitions}} | |||
<li> | |||
<a class="link-action spacer-right issue-transition" data-transition="{{this}}">{{translate "transitions" this}}</a> | |||
</li> | |||
{{/each}} | |||
</ul> | |||
</div> | |||
</li> | |||
{{/ifHasExtraActions}} | |||
</ul> | |||
{{/ifNotEmpty}} | |||
<div class="code-issue-form"></div> | |||
</div> |
@@ -8,7 +8,7 @@ | |||
</tr> | |||
<tr> | |||
<td style="padding-top: 5px"> | |||
<input id="issue-comment-submit" type="submit" value="<%= message('issue.comment.submit') -%>" disabled> | |||
<input id="issue-comment-submit" type="submit" value="{{#if id}}<%= message('save') -%>{{else}}<%= message('issue.comment.submit') -%>{{/if}}" disabled> | |||
<a id="issue-comment-cancel" class="link-action"><%= message('cancel') -%></a> | |||
</td> | |||
<td align="right"> |
@@ -1,19 +1,21 @@ | |||
<script id="issues-actions-template" type="text/x-handlebars-template"> | |||
<div class="navigator-actions-order"> | |||
{{#if sorting}} | |||
Ordered by {{sorting.sortText}} {{#if sorting.asc}}<i class="icon-arrow-up"></i>{{else}}<i class="icon-arrow-down"></i>{{/if}} | |||
{{else}} | |||
Order | |||
{{/if}} | |||
</div> | |||
<ul class="navigator-actions-order-choices"> | |||
<li data-sort="UPDATE_DATE" data-asc="true"><%= message('issues.sort.update_date') -%> <i class="icon-arrow-up"></i></li> | |||
<li data-sort="UPDATE_DATE" data-asc="false"><%= message('issues.sort.update_date') -%> <i class="icon-arrow-down"></i></li> | |||
<li data-sort="SEVERITY" data-asc="true"><%= message('issues.sort.severity') -%> <i class="icon-arrow-up"></i></li> | |||
<li data-sort="SEVERITY" data-asc="false"><%= message('issues.sort.severity') -%> <i class="icon-arrow-down"></i></li> | |||
<li data-sort="STATUS" data-asc="true"><%= message('issues.sort.status') -%> <i class="icon-arrow-up"></i></li> | |||
<li data-sort="STATUS" data-asc="false"><%= message('issues.sort.status') -%> <i class="icon-arrow-down"></i></li> | |||
</ul> | |||
{{#unless maxResultsReached}} | |||
<div class="navigator-actions-order"> | |||
{{#if sorting}} | |||
Ordered by {{sorting.sortText}} {{#if sorting.asc}}<i class="icon-arrow-up"></i>{{else}}<i class="icon-arrow-down"></i>{{/if}} | |||
{{else}} | |||
Order | |||
{{/if}} | |||
</div> | |||
<ul class="navigator-actions-order-choices"> | |||
<li data-sort="UPDATE_DATE" data-asc="true"><%= message('issues.sort.update_date') -%> <i class="icon-arrow-up"></i></li> | |||
<li data-sort="UPDATE_DATE" data-asc="false"><%= message('issues.sort.update_date') -%> <i class="icon-arrow-down"></i></li> | |||
<li data-sort="SEVERITY" data-asc="true"><%= message('issues.sort.severity') -%> <i class="icon-arrow-up"></i></li> | |||
<li data-sort="SEVERITY" data-asc="false"><%= message('issues.sort.severity') -%> <i class="icon-arrow-down"></i></li> | |||
<li data-sort="STATUS" data-asc="true"><%= message('issues.sort.status') -%> <i class="icon-arrow-up"></i></li> | |||
<li data-sort="STATUS" data-asc="false"><%= message('issues.sort.status') -%> <i class="icon-arrow-down"></i></li> | |||
</ul> | |||
{{/unless}} | |||
<div class="navigator-actions-total"> | |||
Found: {{paging.total}} | |||
{{#if appState.canBulkChange}} |
@@ -49,7 +49,6 @@ | |||
<%= javascript_include_tag 'third-party/handlebars' %> | |||
<%= javascript_include_tag 'third-party/jquery.ba-throttle-debounce.min.js' %> | |||
<%= javascript_include_tag 'third-party/select2.min' %> | |||
<%= javascript_include_tag 'third-party/moment.min' %> | |||
<%= javascript_include_tag 'widgets/widget' %> | |||
<%= javascript_include_tag 'widgets/bubble-chart' %> |
@@ -1,5 +1,7 @@ | |||
(function() { | |||
var defaultActions = ['comment', 'assign', 'assign_to_me', 'plan', 'set_severity']; | |||
Handlebars.registerHelper('capitalize', function(string) { | |||
return string.charAt(0).toUpperCase() + string.slice(1).toLowerCase(); | |||
}); | |||
@@ -22,10 +24,6 @@ | |||
); | |||
}); | |||
Handlebars.registerHelper('fromNow', function(time) { | |||
return moment(time).fromNow(true); | |||
}); | |||
Handlebars.registerHelper('inArray', function(array, element, options) { | |||
if (array.indexOf(element) !== -1) { | |||
return options.fn(this); | |||
@@ -34,6 +32,15 @@ | |||
} | |||
}); | |||
Handlebars.registerHelper('ifNotEmpty', function() { | |||
var args = Array.prototype.slice.call(arguments, 0, -1), | |||
options = arguments[arguments.length - 1], | |||
notEmpty = args.reduce(function(prev, current) { | |||
return prev || (current && current.length > 0); | |||
}, false); | |||
return notEmpty ? options.fn(this) : ''; | |||
}); | |||
Handlebars.registerHelper('dashboardUrl', function(componentKey, componentQualifier) { | |||
var url = '/dashboard/index/' + decodeURIComponent(componentKey); | |||
if (componentQualifier === 'FIL' || componentQualifier === 'CLA') { | |||
@@ -42,4 +49,32 @@ | |||
return url; | |||
}); | |||
Handlebars.registerHelper('translate', function(key, prefix) { | |||
var args = Array.prototype.slice.call(arguments, 0, -1), | |||
tokens = args.reduce(function(prev, current) { | |||
return prev.concat(current.split('.')); | |||
}, []), | |||
start = window.SS.phrases; | |||
return tokens.reduce(function(prev, current) { | |||
return current ? prev[current] : prev; | |||
}, start); | |||
}); | |||
Handlebars.registerHelper('pluginActions', function(actions, options) { | |||
var pluginActions = _.difference(actions, defaultActions); | |||
return pluginActions.reduce(function(prev, current) { | |||
return prev + options.fn(current); | |||
}, ''); | |||
}); | |||
Handlebars.registerHelper('ifHasExtraActions', function(actions, transitions, options) { | |||
var actionsLeft = _.difference(actions, _.without(defaultActions, 'set_severity')); | |||
if (actionsLeft.length > 0 || transitions.length > 0) { | |||
return options.fn(this); | |||
} else { | |||
return ''; | |||
} | |||
}); | |||
})(); |
@@ -53,6 +53,7 @@ jQuery(function() { | |||
} | |||
this.paging = r.paging; | |||
this.maxResultsReached = r.maxResultsReached; | |||
return r.issues.map(function(issue) { | |||
return _.extend({}, issue, { | |||
@@ -236,6 +237,7 @@ jQuery(function() { | |||
return _.extend(data || {}, { | |||
paging: this.collection.paging, | |||
sorting: this.collection.sorting, | |||
maxResultsReached: this.collection.maxResultsReached, | |||
appState: window.SS.appState.toJSON(), | |||
query: (Backbone.history.fragment || '').replace(/\|/g, '&') | |||
}); | |||
@@ -383,15 +385,21 @@ jQuery(function() { | |||
submit: function() { | |||
var that = this, | |||
text = this.ui.textarea.val(); | |||
that.options.detailView.updateAfterAction(); | |||
text = this.ui.textarea.val(), | |||
update = this.model && this.model.has('key'), | |||
url = baseUrl + '/api/issues/' + (update ? 'edit_comment' : 'add_comment'), | |||
data = { text: text }; | |||
if (update) { | |||
data.key = this.model.get('key'); | |||
} else { | |||
data.issue = this.options.issue.get('key'); | |||
} | |||
jQuery.ajax({ | |||
type: 'POST', | |||
url: baseUrl + '/api/issues/add_comment', | |||
data: { | |||
issue: this.options.issue.get('key'), | |||
text: text | |||
} | |||
url: url, | |||
data: data | |||
}).done(function() { | |||
that.options.detailView.updateAfterAction(true); | |||
}); | |||
@@ -443,11 +451,13 @@ jQuery(function() { | |||
that.formRegion.reset(); | |||
that.$('.code-issue-actions').show(); | |||
that.$('.code-issue-form').hide(); | |||
that.$('[data-comment-key]').show(); | |||
}); | |||
} else { | |||
that.formRegion.reset(); | |||
that.$('.code-issue-actions').show(); | |||
that.$('.code-issue-form').hide(); | |||
that.$('[data-comment-key]').show(); | |||
} | |||
}, | |||
@@ -462,11 +472,11 @@ jQuery(function() { | |||
editComment: function(e) { | |||
var that = this, | |||
commentKey = jQuery(e.target).closest('[data-comment-key]').data('comment-key'), | |||
var commentEl = jQuery(e.target).closest('[data-comment-key]'), | |||
commentKey = commentEl.data('comment-key'), | |||
comment = _.findWhere(this.model.get('comments'), { key: commentKey }); | |||
console.log(comment); | |||
commentEl.hide(); | |||
var commentFormView = new IssueDetailCommentFormView({ | |||
model: new Backbone.Model(comment), | |||
@@ -483,7 +493,7 @@ jQuery(function() { | |||
confirmMsg = jQuery(e.target).data('confirm-msg'); | |||
if (confirm(confirmMsg)) { | |||
$j.ajax({ | |||
jQuery.ajax({ | |||
type: "POST", | |||
url: baseUrl + "/issue/delete_comment?id=" + commentKey | |||
}).done(function() { |
@@ -29,7 +29,6 @@ | |||
<js>/javascripts/third-party/handlebars.js</js> | |||
<js>/javascripts/third-party/jquery.ba-throttle-debounce.min.js</js> | |||
<js>/javascripts/third-party/select2.min.js</js> | |||
<js>/javascripts/third-party/moment.min.js</js> | |||
<js>/javascripts/widgets/widget.js</js> | |||
<js>/javascripts/widgets/bubble-chart.js</js> |