Commit 1a2a326b authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets
Browse files

Added milestone_options and assigne_options helpers


Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent 7ff839f83a29
......@@ -76,4 +76,12 @@
def bulk_update_assignee_options
options_for_select(["None (unassigned)", nil]) + options_from_collection_for_select(@project.team.members, "id", "name", params[:assignee_id])
end
def assignee_options object
options_from_collection_for_select(@project.team.members.sort_by(&:name), 'id', 'name', object.assignee_id)
end
def milestone_options object
options_from_collection_for_select(@project.milestones.active, 'id', 'title', object.milestone_id)
end
end
......@@ -21,7 +21,7 @@
Assign to
.controls
.pull-left
= f.select(:assignee_id, @project.team.members.sort_by(&:name).map {|p| [ p.name, p.id ] }, { include_blank: "Select a user" }, {class: 'chosen'})
= f.select(:assignee_id, assignee_options(@issue), { include_blank: "Select a user" }, {class: 'chosen'})
.pull-right
&nbsp;
= link_to 'Assign to me', '#', class: 'btn btn-small assign-to-me-link'
......@@ -29,7 +29,7 @@
= f.label :milestone_id do
%i.icon-time
Milestone
.controls= f.select(:milestone_id, @project.milestones.active.collect {|p| [ p.title, p.id ] }, { include_blank: "Select milestone" }, {class: 'chosen'})
.controls= f.select(:milestone_id, milestone_options(@issue), { include_blank: "Select milestone" }, {class: 'chosen'})
.ui-box-bottom
.control-group
......
......@@ -7,7 +7,7 @@
- if can?(current_user, :modify_issue, @issue)
= link_to profile_path(issue.assignee) do
= image_tag(avatar_icon(issue.assignee.email), class: 'avatar avatar-inline s16 assignee') if issue.assignee
= f.select(:assignee_id, @project.team.members.sort_by(&:name).map {|p| [ p.name, p.id ] }, { include_blank: "Assign to user (none):" }, {class: 'chosen'})
= f.select(:assignee_id, assignee_options(@issue), { include_blank: "Assign to user (none):" }, {class: 'chosen'})
- elsif issue.assignee
= link_to_member(@project, @issue.assignee)
......@@ -16,7 +16,7 @@
%cite.cgray and attached to milestone
- if can?(current_user, :modify_issue, @issue)
= f.select(:milestone_id, @project.milestones.active.all.collect {|p| [ p.title, p.id ] }, { include_blank: "Select milestone (none):" }, {class: 'chosen'})
= f.select(:milestone_id, milestone_options(@issue), { include_blank: "Select milestone (none):" }, {class: 'chosen'})
= hidden_field_tag :issue_context
= f.submit class: 'btn'
......
......@@ -39,8 +39,8 @@
= f.label :assignee_id do
%i.icon-user
Assign to
.controls= f.select(:assignee_id, @project.team.members.sort_by(&:name).map {|p| [ p.name, p.id ] }, { include_blank: "Select user" }, {class: 'chosen span3'})
.controls= f.select(:assignee_id, assignee_options(@merge_request), { include_blank: "Select user" }, {class: 'chosen span3'})
.left
= f.label :milestone_id do
%i.icon-time
Milestone
......@@ -43,8 +43,8 @@
.left
= f.label :milestone_id do
%i.icon-time
Milestone
.controls= f.select(:milestone_id, @project.milestones.active.map {|p| [ p.title, p.id ] }, { include_blank: "Select milestone" }, {class: 'chosen'})
.controls= f.select(:milestone_id, milestone_options(@merge_request), { include_blank: "Select milestone" }, {class: 'chosen'})
.control-group
= f.label :description, "Description"
.controls
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment