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
@issues = case params[:status]
when issues_filter[:all] then @project.issues
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)
else @project.issues.opened
end
......
......@@ -22,8 +22,10 @@ module Issuable
scope :closed, -> { with_state(:closed) }
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 :assigned, ->(u) { where(assignee_id: u.id)}
scope :assigned_to, ->(u) { where(assignee_id: u.id)}
scope :recent, -> { order("created_at DESC") }
scope :assigned, -> { where("assignee_id IS NOT NULL") }
scope :unassigned, -> { where("assignee_id IS NULL") }
delegate :name,
:email,
......
......@@ -28,8 +28,6 @@ class Issue < ActiveRecord::Base
scope :cared, ->(user) { where(assignee_id: user) }
scope :authored, ->(user) { where(author_id: 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
event :close do
......
.span6
.ui-box.milestone-issue-filter
%h5.title= title
%ul.well-list
- issues.each do |issue|
%li{data: {closed: issue.closed?}}
= link_to [@project, issue] do
%span.badge.badge-info ##{issue.id}
&ndash;
= link_to_gfm truncate(issue.title, length: 60), [@project, issue]
\ No newline at end of file
.ui-box
%h5.title= title
%ul.well-list
- issues.each do |issue|
%li
= link_to [@project, issue] do
%span.badge{class: issue.closed? ? 'badge-important' : 'badge-info'} ##{issue.id}
= 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 @@
= markdown @milestone.description
.row
= render(partial: 'issues', locals: {title: 'Unstarted Issues (open and unassigned)', issues: @issues.opened.unassigned})
= render(partial: 'issues', locals: {title: 'Ongoing Issues (open and assigned)', issues: @issues.opened.assigned})
%ul.nav.nav-tabs
%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
.row
.span6
.ui-box.milestone-merge-requests-filter
.title
%ul.nav.nav-pills
%li.active= link_to('Open Merge Requests', '#')
%li=link_to('All Merge Requests', '#')
%ul.well-list
- @merge_requests.each do |merge_request|
%li{data: {closed: merge_request.closed? || merge_request.merged?}}
= 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]
= render(:partial => 'issues', locals: {title: 'Completed Issues (closed)', issues: @issues.closed})
.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)
%hr
%h6 Participants:
%div
- @users.each do |user|
= link_to_member(@project, user)
.tab-pane#tab-merge-requests
.row
.span6
.ui-box
%h5.title Open
%ul.well-list
- @merge_requests.opened.each do |merge_request|
= render 'merge_request', merge_request: merge_request
.span6
.ui-box
%h5.title Closed
%ul.well-list
- @merge_requests.closed.each do |merge_request|
= render 'merge_request', merge_request: merge_request
.clearfix
.tab-pane#tab-participants
%ul.bordered-list
- @users.each do |user|
%li
= link_to user, title: user.name, class: "dark" do
= 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
end
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
......@@ -93,7 +93,7 @@ class Userteams < Spinach::FeatureSteps
Then 'I should see issues from this team assigned to me' do
team = UserTeam.last
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
end
end
......@@ -121,7 +121,7 @@ class Userteams < Spinach::FeatureSteps
team = UserTeam.last
team.projects.each do |project|
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
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