Commit 2e839cee authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Fixed tests. Fixed overrided scope. Better usability for milestone view

parent b1bdd829
$ ->
$('.milestone-merge-requests-filter li[data-closed]').addClass('hide')
$('.milestone-merge-requests-filter ul.nav li a').click ->
$('.milestone-merge-requests-filter li').toggleClass('active')
$('.milestone-merge-requests-filter li[data-closed]').toggleClass('hide')
false
...@@ -8,7 +8,7 @@ module Issues ...@@ -8,7 +8,7 @@ module Issues
@issues = case params[:status] @issues = case params[:status]
when issues_filter[:all] then @project.issues when issues_filter[:all] then @project.issues
when issues_filter[:closed] then @project.issues.closed when issues_filter[:closed] then @project.issues.closed
when issues_filter[:to_me] then @project.issues.assigned(current_user) when issues_filter[:to_me] then @project.issues.assigned_to(current_user)
when issues_filter[:by_me] then @project.issues.authored(current_user) when issues_filter[:by_me] then @project.issues.authored(current_user)
else @project.issues.opened else @project.issues.opened
end end
......
...@@ -22,8 +22,10 @@ module Issuable ...@@ -22,8 +22,10 @@ module Issuable
scope :closed, -> { with_state(:closed) } scope :closed, -> { with_state(:closed) }
scope :of_group, ->(group) { where(project_id: group.project_ids) } scope :of_group, ->(group) { where(project_id: group.project_ids) }
scope :of_user_team, ->(team) { where(project_id: team.project_ids, assignee_id: team.member_ids) } scope :of_user_team, ->(team) { where(project_id: team.project_ids, assignee_id: team.member_ids) }
scope :assigned, ->(u) { where(assignee_id: u.id)} scope :assigned_to, ->(u) { where(assignee_id: u.id)}
scope :recent, -> { order("created_at DESC") } scope :recent, -> { order("created_at DESC") }
scope :assigned, -> { where("assignee_id IS NOT NULL") }
scope :unassigned, -> { where("assignee_id IS NULL") }
delegate :name, delegate :name,
:email, :email,
......
...@@ -28,8 +28,6 @@ class Issue < ActiveRecord::Base ...@@ -28,8 +28,6 @@ class Issue < ActiveRecord::Base
scope :cared, ->(user) { where(assignee_id: user) } scope :cared, ->(user) { where(assignee_id: user) }
scope :authored, ->(user) { where(author_id: user) } scope :authored, ->(user) { where(author_id: user) }
scope :open_for, ->(user) { opened.assigned(user) } scope :open_for, ->(user) { opened.assigned(user) }
scope :assigned, -> { where("assignee_id IS NOT NULL") }
scope :unassigned, -> { where("assignee_id IS NULL") }
state_machine :state, initial: :opened do state_machine :state, initial: :opened do
event :close do event :close do
......
.span6 .ui-box
.ui-box.milestone-issue-filter
%h5.title= title %h5.title= title
%ul.well-list %ul.well-list
- issues.each do |issue| - issues.each do |issue|
%li{data: {closed: issue.closed?}} %li
= link_to [@project, issue] do = link_to [@project, issue] do
%span.badge.badge-info ##{issue.id} %span.badge{class: issue.closed? ? 'badge-important' : 'badge-info'} ##{issue.id}
&ndash;
= link_to_gfm truncate(issue.title, length: 60), [@project, issue] = link_to_gfm truncate(issue.title, length: 60), [@project, issue]
- if issue.assignee
.pull-right
= image_tag gravatar_icon(issue.assignee.email, 16), class: "avatar s16"
%li
= link_to [@project, merge_request] do
%span.badge.badge-info ##{merge_request.id}
&ndash;
= link_to_gfm truncate(merge_request.title, length: 60), [@project, merge_request]
...@@ -55,32 +55,52 @@ ...@@ -55,32 +55,52 @@
= markdown @milestone.description = markdown @milestone.description
.row %ul.nav.nav-tabs
= render(partial: 'issues', locals: {title: 'Unstarted Issues (open and unassigned)', issues: @issues.opened.unassigned}) %li.active
= link_to '#tab-issues', 'data-toggle' => 'tab' do
Issues
%span.badge= @issues.count
%li
= link_to '#tab-merge-requests', 'data-toggle' => 'tab' do
Merge Requests
%span.badge= @merge_requests.count
%li
= link_to '#tab-participants', 'data-toggle' => 'tab' do
Participants
%span.badge= @users.count
= render(partial: 'issues', locals: {title: 'Ongoing Issues (open and assigned)', issues: @issues.opened.assigned})
.row .tab-content
.tab-pane.active#tab-issues
.row
.span4
= render('issues', title: 'Unstarted Issues (open and unassigned)', issues: @issues.opened.unassigned)
.span4
= render('issues', title: 'Ongoing Issues (open and assigned)', issues: @issues.opened.assigned)
.span4
= render('issues', title: 'Completed Issues (closed)', issues: @issues.closed)
.tab-pane#tab-merge-requests
.row
.span6 .span6
.ui-box.milestone-merge-requests-filter .ui-box
.title %h5.title Open
%ul.nav.nav-pills
%li.active= link_to('Open Merge Requests', '#')
%li=link_to('All Merge Requests', '#')
%ul.well-list %ul.well-list
- @merge_requests.each do |merge_request| - @merge_requests.opened.each do |merge_request|
%li{data: {closed: merge_request.closed? || merge_request.merged?}} = render 'merge_request', merge_request: merge_request
= link_to [@project, merge_request] do .span6
%span.badge.badge-info ##{merge_request.id} .ui-box
&ndash; %h5.title Closed
= link_to_gfm truncate(merge_request.title, length: 60), [@project, merge_request] %ul.well-list
- @merge_requests.closed.each do |merge_request|
= render(:partial => 'issues', locals: {title: 'Completed Issues (closed)', issues: @issues.closed}) = render 'merge_request', merge_request: merge_request
%hr .tab-pane#tab-participants
%h6 Participants: %ul.bordered-list
%div
- @users.each do |user| - @users.each do |user|
= link_to_member(@project, user) %li
= link_to user, title: user.name, class: "dark" do
.clearfix = image_tag gravatar_icon(user.email, 32), class: "avatar s32"
%strong= truncate(user.name, lenght: 40)
%br
%small.cgray= user.username
...@@ -50,6 +50,6 @@ class ProjectMilestones < Spinach::FeatureSteps ...@@ -50,6 +50,6 @@ class ProjectMilestones < Spinach::FeatureSteps
end end
Then "I should see 3 issues" do Then "I should see 3 issues" do
page.should have_selector('.milestone-issue-filter .well-list li', count: 4) page.should have_selector('#tab-issues li', count: 4)
end end
end end
...@@ -93,7 +93,7 @@ class Userteams < Spinach::FeatureSteps ...@@ -93,7 +93,7 @@ class Userteams < Spinach::FeatureSteps
Then 'I should see issues from this team assigned to me' do Then 'I should see issues from this team assigned to me' do
team = UserTeam.last team = UserTeam.last
team.projects.each do |project| team.projects.each do |project|
project.issues.assigned(current_user).each do |issue| project.issues.assigned_to(current_user).each do |issue|
page.should have_content issue.title page.should have_content issue.title
end end
end end
...@@ -121,7 +121,7 @@ class Userteams < Spinach::FeatureSteps ...@@ -121,7 +121,7 @@ class Userteams < Spinach::FeatureSteps
team = UserTeam.last team = UserTeam.last
team.projects.each do |project| team.projects.each do |project|
team.members.each do |member| team.members.each do |member|
project.issues.assigned(member).each do |issue| project.issues.assigned_to(member).each do |issue|
page.should have_content issue.title page.should have_content issue.title
end end
end 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