Only showing those statuses that are available for the story's tracker

This needs to be further limited to the accessible statuses - depending on the workflows
pull/6827/head
Gregor Schmidt 13 years ago
parent 6b5a5ca645
commit 15f986ebcd
  1. 10
      app/views/rb_stories/_helpers.html.erb
  2. 21
      assets/javascripts/app/model.js

@ -1,4 +1,14 @@
<!-- story helper tags -->
<% Story.trackers.each do |tracker_id| %>
<select class="status_id helper" id="status_id_options_<%= tracker_id %>">
<% Tracker.find(tracker_id).issue_statuses.each do |status| %>
<option value="<%= status.id %>" class="<%= (status.is_closed? ? l(:label_closed_issues) + ' ' : "") %>">
<%= status.name %>
</option>
<% end %>
</select>
<% end %>
<select class="status_id helper" id="status_id_options">
<% IssueStatus.find(:all, :order => "position ASC").each do |status| %>
<option value="<%= status.id %>" class="<%= (status.is_closed? ? l(:label_closed_issues) + ' ' : "") %>">

@ -115,7 +115,8 @@ RB.Model = (function ($) {
});
this.$.find('.editable').each(function (index) {
var field, fieldType, fieldLabel, fieldName, fieldOrder, input;
var field, fieldType, fieldLabel, fieldName, fieldOrder, input,
trackerId;
field = $(this);
fieldName = field.attr('fieldname');
@ -130,7 +131,23 @@ RB.Model = (function ($) {
$("<label></label>").text(fieldLabel).appendTo(editor);
if (fieldType === 'select') {
input = $('#' + fieldName + '_options').clone(true);
// Special handling for status_id => they are dependent of tracker_id
if (fieldName === 'status_id') {
trackerId = $.trim(self.$.find('.tracker_id .v').html());
trackerId = $('#' + fieldName + '_options_' + trackerId);
if (trackerId.length !== 0) {
input = trackerId.clone(true);
}
else {
// now special list for this tracker id found - don't know why,
// but better show all statuses than none.
input = $('#' + fieldName + '_options').clone(true);
}
}
else {
input = $('#' + fieldName + '_options').clone(true);
}
}
else {
input = $(document.createElement(fieldType));

Loading…
Cancel
Save