Commit 65448e2f authored by Jason Blanchard's avatar Jason Blanchard

Added dropdown menus to issue#show page for assignee and milestone

parent 9c668133
v 6.5.0
- Dropdown menus on issue#show page for assignee and milestone (Jason Blanchard)
v 6.4.0
- Added sorting to project issues page (Jason Blanchard)
- Assembla integration (Carlos Paramio)
......
......@@ -79,3 +79,9 @@
$("#update_issues_ids").val []
$(".issues_bulk_update").hide()
$(".issues-filters").show()
$ ->
$('.edit-issue.inline-update input[type="submit"]').hide();
$("body").on "change", ".edit-issue.inline-update select", ->
$(this).submit()
......@@ -119,3 +119,8 @@ input.check_all_issues {
background-color: #f4f4f4;
}
}
.edit-issue.inline-update select {
width: 100%;
max-width: 230px;
}
= form_for [@project, @issue], :remote => true, :html => {:class => 'edit-issue inline-update'} do |f|
.pull-right
Created by #{link_to_member(@project, issue.author)}
- if issue.assignee
\ and currently assigned to
- 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'})
- elsif issue.assignee
= link_to_member(@project, @issue.assignee)
- if issue.milestone
- milestone = issue.milestone
%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'})
= hidden_field_tag :issue_context
= f.submit :class => 'btn'
- elsif issue.milestone
= link_to issue.milestone.title, project_milestone_path
.pull-right
- issue.labels.each do |label|
%span{class: "label #{label_css_class(label.name)}"}
%i.icon-tag
= label.name
 
......@@ -26,7 +26,12 @@
.back-link
= link_to project_issues_path(@project) do
← To issues list
%span.milestone-nav-link
- if @issue.milestone
|
= link_to project_milestone_path(@project, @issue.milestone) do
<strong>Milestone:</strong>
= @issue.milestone.title
.ui-box.ui-box-show
.ui-box-head
......@@ -39,21 +44,7 @@
.ui-box-body
%cite.cgray
Created by #{link_to_member(@project, @issue.author)}
- if @issue.assignee
\ and currently assigned to #{link_to_member(@project, @issue.assignee)}
- if @issue.milestone
- milestone = @issue.milestone
%cite.cgray and attached to milestone
%strong= link_to_gfm truncate(milestone.title, length: 20), project_milestone_path(milestone.project, milestone)
.pull-right
- @issue.labels.each do |label|
%span{class: "label #{label_css_class(label.name)}"}
%i.icon-tag
= label.name
&nbsp;
= render partial: 'issue_context', locals: { issue: @issue }
- if @issue.description.present?
.ui-box-bottom
......@@ -73,4 +64,4 @@
- @issue.participants.each do |participant|
= link_to_member(@project, participant, name: false, size: 24)
.voting_notes#notes= render "projects/notes/notes_with_form"
\ No newline at end of file
.voting_notes#notes= render "projects/notes/notes_with_form"
......@@ -2,3 +2,12 @@
- if @issue.valid?
:plain
$("##{dom_id(@issue)}").fadeOut();
- elsif params[:issue_context]
$('.ui-box-body').html("#{escape_javascript(render partial: 'issue_context', locals: { issue: @issue })}");
$('.ui-box-body').effect('highlight');
$('.chosen').chosen();
$('.edit-issue.inline-update input[type="submit"]').hide();
- if @issue.milestone
$('.milestone-nav-link').replaceWith("#{escape_javascript(link_to "| #{@issue.milestone.title}", project_milestone_path(@issue.project, @issue.milestone), :class => 'milestone-nav-link')}")
- else
$('.milestone-nav-link').html('')
......@@ -175,6 +175,84 @@
end
end
describe 'update assignee from issue#show' do
let(:issue) { create(:issue, project: project, author: @user) }
context 'by autorized user' do
it 'with dropdown menu' do
visit project_issue_path(project, issue)
find('.edit-issue.inline-update').select(project.team.members.first.name, from: 'issue_assignee_id')
click_button 'Update Issue'
page.should have_content "currently assigned to"
page.has_select?('issue_assignee_id', :selected => project.team.members.first.name)
end
end
context 'by unauthorized user' do
let(:guest) { create(:user) }
before :each do
project.team << [[guest], :guest]
issue.assignee = @user
issue.save
end
it 'shows assignee text' do
logout
login_with guest
visit project_issue_path(project, issue)
page.should have_content "currently assigned to #{issue.assignee.name}"
end
end
end
describe 'update milestone from issue#show' do
let!(:issue) { create(:issue, project: project, author: @user) }
let!(:milestone) { create(:milestone, project: project) }
context 'by authorized user' do
it 'with dropdown menu' do
visit project_issue_path(project, issue)
p find('.edit-issue.inline-update').text
find('.edit-issue.inline-update').select(milestone.title, from: 'issue_milestone_id')
click_button 'Update Issue'
page.should have_content "and attached to milestone"
page.has_select?('issue_assignee_id', :selected => milestone.title)
end
end
context 'by unauthorized user' do
let(:guest) { create(:user) }
before :each do
project.team << [[guest], :guest]
issue.milestone = milestone
issue.save
end
it 'shows milestone text' do
logout
login_with guest
visit project_issue_path(project, issue)
page.should have_content "attached to milestone #{milestone.title}"
end
end
end
def first_issue
all("ul.issues-list li").first.text
end
......
Markdown is supported
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