Commit 6a18fd98 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'restyle/issue' into 'master'

Improve UI for Issue#show, MR#show pages
parents b09610b5 ededfd2d
...@@ -88,11 +88,15 @@ pre.well-pre { ...@@ -88,11 +88,15 @@ pre.well-pre {
/** Big Labels **/ /** Big Labels **/
.state-label { .state-label {
font-size: 14px; font-size: 14px;
padding: 6px 25px; padding: 9px 25px;
text-align: center; text-align: center;
@include border-radius(4px);
text-shadow: none; text-shadow: none;
margin-left: 10px; margin-right: 20px;
&.state-label-blue {
background: #31708f;
color: #FFF;
}
&.state-label-green { &.state-label-green {
background: #4A4; background: #4A4;
......
...@@ -17,26 +17,33 @@ ...@@ -17,26 +17,33 @@
margin-bottom: 0; margin-bottom: 0;
} }
.state {
height: 34px;
border-bottom: 1px solid #DDD;
line-height: 32px;
}
.title { .title {
font-size: 22px; font-size: 22px;
font-weight: 500; font-weight: 500;
line-height: 1.5; line-height: 1.5;
margin: 0; margin: 0;
color: #333; color: #333;
padding-bottom: 0;
padding: 15px 25px;
} }
.context { .context {
border: none; border: none;
border-top: 1px solid #eee; border-top: 1px solid #eee;
padding: 15px 25px;
} }
.description { .description {
border-top: 1px solid #eee; padding: 0 25px 15px 25px;
} }
.title, .context, .description { .title, .context, .description {
padding: 15px 25px;
.clearfix { .clearfix {
margin: 0; margin: 0;
} }
......
...@@ -84,4 +84,12 @@ module IssuesHelper ...@@ -84,4 +84,12 @@ module IssuesHelper
def milestone_options object def milestone_options object
options_from_collection_for_select(@project.milestones.active, 'id', 'title', object.milestone_id) options_from_collection_for_select(@project.milestones.active, 'id', 'title', object.milestone_id)
end end
def issue_alert_class(issue)
if issue.closed?
'alert-danger'
else
'alert-success'
end
end
end end
...@@ -41,4 +41,14 @@ module MergeRequestsHelper ...@@ -41,4 +41,14 @@ module MergeRequestsHelper
"Branches: #{@merge_request.source_branch} #{separator} #{@merge_request.target_branch}" "Branches: #{@merge_request.source_branch} #{separator} #{@merge_request.target_branch}"
end end
end end
def merge_request_alert_class(merge_request)
if merge_request.merged?
'alert-info'
elsif merge_request.closed?
'alert-danger'
else
'alert-success'
end
end
end end
= form_for [@project, @issue], remote: true, html: {class: 'edit-issue inline-update'} do |f| = form_for [@project, @issue], remote: true, html: {class: 'edit-issue inline-update'} do |f|
Created by #{link_to_member(@project, issue.author)}  %strong.append-right-10
- if issue.assignee Assignee:
\ and currently assigned to
- if can?(current_user, :modify_issue, @issue) - if can?(current_user, :modify_issue, @issue)
= project_users_select_tag('issue[assignee_id]', placeholder: 'Select assignee', class: 'custom-form-control', selected: @issue.assignee_id) = project_users_select_tag('issue[assignee_id]', placeholder: 'Select assignee', class: 'custom-form-control', selected: @issue.assignee_id)
- elsif issue.assignee - elsif issue.assignee
= link_to_member(@project, @issue.assignee) = link_to_member(@project, @issue.assignee)
- else
None
.pull-right
.pull-right.hidden-sm.hidden-xs %strong.append-right-10
- if issue.milestone Milestone:
- milestone = issue.milestone
%cite.cgray Attached to milestone
- if can?(current_user, :modify_issue, @issue) - if can?(current_user, :modify_issue, @issue)
= f.select(:milestone_id, milestone_options(@issue), { include_blank: "Select milestone (none):" }, {class: 'select2 select2-compact'}) = f.select(:milestone_id, milestone_options(@issue), { include_blank: "Select milestone (none):" }, {class: 'select2 select2-compact'})
= hidden_field_tag :issue_context = hidden_field_tag :issue_context
= f.submit class: 'btn' = f.submit class: 'btn'
- elsif issue.milestone - elsif issue.milestone
= link_to issue.milestone.title, project_milestone_path = link_to issue.milestone.title, project_milestone_path
- else
None
%h3.page-title %h3.page-title
Issue ##{@issue.iid} Issue ##{@issue.iid}
%small
created #{time_ago_with_tooltip(@issue.created_at)}
- if @issue.closed?
%span.state-label.state-label-red Closed
- else
%span.state-label.state-label-green Open
%span.pull-right %span.pull-right
- if can?(current_user, :write_issue, @project) - if can?(current_user, :write_issue, @project)
= link_to new_project_issue_path(@project), class: "btn grouped", title: "New Issue", id: "new_issue_link" do = link_to new_project_issue_path(@project), class: "btn grouped", title: "New Issue", id: "new_issue_link" do
...@@ -38,18 +30,27 @@ ...@@ -38,18 +30,27 @@
= @issue.milestone.title = @issue.milestone.title
.issue-box .issue-box
.state{ class: issue_alert_class(@issue) }
- if @issue.closed?
%span.state-label.state-label-red Closed
- else
%span.state-label.state-label-green Open
%span.creator
Created by #{link_to_member(@project, @issue.author)} #{time_ago_with_tooltip(@issue.created_at)}
%h4.title %h4.title
= gfm escape_once(@issue.title) = gfm escape_once(@issue.title)
.context
%cite.cgray
= render partial: 'issue_context', locals: { issue: @issue }
- if @issue.description.present? - if @issue.description.present?
.description .description
.wiki .wiki
= preserve do = preserve do
= markdown @issue.description = markdown @issue.description
.context
%cite.cgray
= render partial: 'issue_context', locals: { issue: @issue }
- content_for :note_actions do - content_for :note_actions do
- if can?(current_user, :modify_issue, @issue) - if can?(current_user, :modify_issue, @issue)
......
= form_for [@project, @merge_request], remote: true, html: {class: 'edit-merge_request inline-update'} do |f| = form_for [@project, @merge_request], remote: true, html: {class: 'edit-merge_request inline-update'} do |f|
Created by #{link_to_member(@project, merge_request.author)}  %strong.append-right-10
- if merge_request.assignee Assignee:
\ and currently assigned to
- if can?(current_user, :modify_merge_request, @merge_request) - if can?(current_user, :modify_merge_request, @merge_request)
= project_users_select_tag('merge_request[assignee_id]', placeholder: 'Select assignee', class: 'custom-form-control', selected: @merge_request.assignee_id) = project_users_select_tag('merge_request[assignee_id]', placeholder: 'Select assignee', class: 'custom-form-control', selected: @merge_request.assignee_id)
- elsif merge_request.assignee - elsif merge_request.assignee
= link_to_member(@project, @merge_request.assignee) = link_to_member(@project, @merge_request.assignee)
- else
None
.pull-right
.pull-right.hidden-sm.hidden-xs %strong.append-right-10
- if merge_request.milestone Milestone:
- milestone = merge_request.milestone
%cite.cgray Attached to milestone
- if can?(current_user, :modify_merge_request, @merge_request) - if can?(current_user, :modify_merge_request, @merge_request)
= f.select(:milestone_id, milestone_options(@merge_request), { include_blank: "Select milestone (none):" }, {class: 'select2 select2-compact'}) = f.select(:milestone_id, milestone_options(@merge_request), { include_blank: "Select milestone (none):" }, {class: 'select2 select2-compact'})
= hidden_field_tag :merge_request_context = hidden_field_tag :merge_request_context
= f.submit class: 'btn' = f.submit class: 'btn'
- elsif merge_request.milestone - elsif merge_request.milestone
= link_to merge_request.milestone.title, project_milestone_path = link_to merge_request.milestone.title, project_milestone_path
- else
None
.issue-box .issue-box
.state{ class: merge_request_alert_class(@merge_request) }
- if @merge_request.merged?
%span.state-label.state-label-blue
Merged
- elsif @merge_request.closed?
%span.state-label.state-label-red
Closed
- else
%span.state-label.state-label-green
Open
%span.creator
Created by #{link_to_member(@project, @merge_request.author)} #{time_ago_with_tooltip(@merge_request.created_at)}
%h4.title %h4.title
= gfm escape_once(@merge_request.title) = gfm escape_once(@merge_request.title)
.context
%cite.cgray
= render partial: 'projects/merge_requests/show/context', locals: { merge_request: @merge_request }
- if @merge_request.description.present? - if @merge_request.description.present?
.description .description
.wiki .wiki
= preserve do = preserve do
= markdown @merge_request.description = markdown @merge_request.description
- if @merge_request.closed? .context
.description.alert-danger %cite.cgray
%span = render partial: 'projects/merge_requests/show/context', locals: { merge_request: @merge_request }
%i.icon-remove
Closed by #{link_to_member(@project, @merge_request.closed_event.author)} - if @merge_request.closed?
#{time_ago_with_tooltip(@merge_request.closed_event.created_at)}. .alert.alert-info
- if @merge_request.merged? %span
.description.alert-success %i.icon-remove
%span Closed by #{link_to_member(@project, @merge_request.closed_event.author)}
%i.icon-ok #{time_ago_with_tooltip(@merge_request.closed_event.created_at)}.
Merged by #{link_to_member(@project, @merge_request.merge_event.author)} - if @merge_request.merged?
#{time_ago_with_tooltip(@merge_request.merge_event.created_at)}. .alert.alert-info
- if !@closes_issues.empty? && @merge_request.opened? %span
.description.alert-info %i.icon-ok
%span Merged by #{link_to_member(@project, @merge_request.merge_event.author)}
%i.icon-ok #{time_ago_with_tooltip(@merge_request.merge_event.created_at)}.
Accepting this merge request will close #{@closes_issues.size == 1 ? 'issue' : 'issues'} - if !@closes_issues.empty? && @merge_request.opened?
= succeed '.' do .alert.alert-info.alert-info
!= gfm(@closes_issues.map { |i| "##{i.iid}" }.to_sentence) %span
%i.icon-ok
Accepting this merge request will close #{@closes_issues.size == 1 ? 'issue' : 'issues'}
= succeed '.' do
!= gfm(@closes_issues.map { |i| "##{i.iid}" }.to_sentence)
%h3.page-title %h3.page-title
= "Merge Request ##{@merge_request.iid}" = "Merge Request ##{@merge_request.iid}"
%small
created #{time_ago_with_tooltip(@merge_request.created_at)}
- if @merge_request.merged?
%span.state-label.state-label-green
%i.icon-ok
Merged
- elsif @merge_request.closed?
%span.state-label.state-label-red
Closed
- else
%span.state-label.state-label-green
Open
%span.pull-right %span.pull-right
- if can?(current_user, :modify_merge_request, @merge_request) - if can?(current_user, :modify_merge_request, @merge_request)
......
...@@ -55,7 +55,9 @@ class ProjectMergeRequests < Spinach::FeatureSteps ...@@ -55,7 +55,9 @@ class ProjectMergeRequests < Spinach::FeatureSteps
end end
step 'I click link "Close"' do step 'I click link "Close"' do
click_link "Close" within '.page-title' do
click_link "Close"
end
end end
step 'I submit new merge request "Wiki Feature"' do step 'I submit new merge request "Wiki Feature"' do
...@@ -163,7 +165,7 @@ class ProjectMergeRequests < Spinach::FeatureSteps ...@@ -163,7 +165,7 @@ class ProjectMergeRequests < Spinach::FeatureSteps
end end
step 'I should see merged request' do step 'I should see merged request' do
within '.page-title' do within '.issue-box' do
page.should have_content "Merged" page.should have_content "Merged"
end end
end end
......
...@@ -186,7 +186,7 @@ describe "Issues" do ...@@ -186,7 +186,7 @@ describe "Issues" do
find('.edit-issue.inline-update #issue_assignee_id').set project.team.members.first.id find('.edit-issue.inline-update #issue_assignee_id').set project.team.members.first.id
click_button 'Update Issue' click_button 'Update Issue'
page.should have_content "currently assigned to" page.should have_content "Assignee:"
page.has_select?('issue_assignee_id', :selected => project.team.members.first.name) page.has_select?('issue_assignee_id', :selected => project.team.members.first.name)
end end
end end
...@@ -206,11 +206,9 @@ describe "Issues" do ...@@ -206,11 +206,9 @@ describe "Issues" do
login_with guest login_with guest
visit project_issue_path(project, issue) visit project_issue_path(project, issue)
page.should have_content "currently assigned to #{issue.assignee.name}" page.should have_content issue.assignee.name
end end
end end
end end
describe 'update milestone from issue#show' do describe 'update milestone from issue#show' do
...@@ -225,17 +223,16 @@ describe "Issues" do ...@@ -225,17 +223,16 @@ describe "Issues" do
find('.edit-issue.inline-update').select(milestone.title, from: 'issue_milestone_id') find('.edit-issue.inline-update').select(milestone.title, from: 'issue_milestone_id')
click_button 'Update Issue' click_button 'Update Issue'
page.should have_content "Attached to milestone" page.should have_content "Milestone"
page.has_select?('issue_assignee_id', :selected => milestone.title) page.has_select?('issue_assignee_id', :selected => milestone.title)
end end
end end
context 'by unauthorized user' do context 'by unauthorized user' do
let(:guest) { create(:user) } let(:guest) { create(:user) }
before :each do before :each do
project.team << [[guest], :guest] project.team << [guest, :guest]
issue.milestone = milestone issue.milestone = milestone
issue.save issue.save
end end
...@@ -245,8 +242,7 @@ describe "Issues" do ...@@ -245,8 +242,7 @@ describe "Issues" do
login_with guest login_with guest
visit project_issue_path(project, issue) visit project_issue_path(project, issue)
page.should have_content milestone.title
page.should have_content "Attached to milestone #{milestone.title}"
end end
end end
end end
...@@ -258,4 +254,4 @@ describe "Issues" do ...@@ -258,4 +254,4 @@ describe "Issues" do
def last_issue def last_issue
all("ul.issues-list li").last.text all("ul.issues-list li").last.text
end end
end end
\ No newline at end of file
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