Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
190e483f
Commit
190e483f
authored
Dec 14, 2012
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rework of milestones
parent
b01f8b63
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
72 additions
and
34 deletions
+72
-34
app/assets/stylesheets/common.scss
app/assets/stylesheets/common.scss
+8
-3
app/controllers/milestones_controller.rb
app/controllers/milestones_controller.rb
+4
-3
app/models/milestone.rb
app/models/milestone.rb
+17
-2
app/models/snippet.rb
app/models/snippet.rb
+1
-1
app/views/issues/_show.html.haml
app/views/issues/_show.html.haml
+1
-1
app/views/milestones/_milestone.html.haml
app/views/milestones/_milestone.html.haml
+4
-2
app/views/milestones/index.html.haml
app/views/milestones/index.html.haml
+4
-1
app/views/milestones/show.html.haml
app/views/milestones/show.html.haml
+33
-21
No files found.
app/assets/stylesheets/common.scss
View file @
190e483f
...
@@ -531,9 +531,14 @@ pre {
...
@@ -531,9 +531,14 @@ pre {
}
}
}
}
.milestone
.progress
{
.milestone
{
&
.milestone-closed
{
background
:
#eee
;
}
.progress
{
margin-bottom
:
0
;
margin-bottom
:
0
;
margin-top
:
4px
;
margin-top
:
4px
;
}
}
}
.float-link
{
.float-link
{
...
...
app/controllers/milestones_controller.rb
View file @
190e483f
...
@@ -12,11 +12,12 @@ class MilestonesController < ProjectResourceController
...
@@ -12,11 +12,12 @@ class MilestonesController < ProjectResourceController
def
index
def
index
@milestones
=
case
params
[
:f
]
@milestones
=
case
params
[
:f
]
when
'all'
;
@project
.
milestones
when
'all'
;
@project
.
milestones
.
order
(
"closed, due_date DESC"
)
else
@project
.
milestones
.
active
when
'closed'
;
@project
.
milestones
.
closed
.
order
(
"due_date DESC"
)
else
@project
.
milestones
.
active
.
order
(
"due_date ASC"
)
end
end
@milestones
=
@milestones
.
includes
(
:project
)
.
order
(
"due_date"
)
@milestones
=
@milestones
.
includes
(
:project
)
@milestones
=
@milestones
.
page
(
params
[
:page
]).
per
(
20
)
@milestones
=
@milestones
.
page
(
params
[
:page
]).
per
(
20
)
end
end
...
...
app/models/milestone.rb
View file @
190e483f
...
@@ -19,12 +19,19 @@ class Milestone < ActiveRecord::Base
...
@@ -19,12 +19,19 @@ class Milestone < ActiveRecord::Base
has_many
:issues
has_many
:issues
has_many
:merge_requests
has_many
:merge_requests
scope
:active
,
where
(
closed:
false
)
scope
:closed
,
where
(
closed:
true
)
validates
:title
,
presence:
true
validates
:title
,
presence:
true
validates
:project
,
presence:
true
validates
:project
,
presence:
true
validates
:closed
,
inclusion:
{
in:
[
true
,
false
]
}
validates
:closed
,
inclusion:
{
in:
[
true
,
false
]
}
def
self
.
active
def
expired?
where
(
"due_date > ? OR due_date IS NULL"
,
Date
.
today
)
if
due_date
due_date
<
Date
.
today
else
false
end
end
end
def
participants
def
participants
...
@@ -52,4 +59,12 @@ class Milestone < ActiveRecord::Base
...
@@ -52,4 +59,12 @@ class Milestone < ActiveRecord::Base
def
expires_at
def
expires_at
"expires at
#{
due_date
.
stamp
(
"Aug 21, 2011"
)
}
"
if
due_date
"expires at
#{
due_date
.
stamp
(
"Aug 21, 2011"
)
}
"
if
due_date
end
end
def
can_be_closed?
issues
.
count
>
0
&&
open
?
&&
issues
.
opened
.
count
.
zero?
end
def
open?
!
closed
end
end
end
app/models/snippet.rb
View file @
190e483f
...
@@ -22,7 +22,7 @@ class Snippet < ActiveRecord::Base
...
@@ -22,7 +22,7 @@ class Snippet < ActiveRecord::Base
belongs_to
:author
,
class_name:
"User"
belongs_to
:author
,
class_name:
"User"
has_many
:notes
,
as: :noteable
,
dependent: :destroy
has_many
:notes
,
as: :noteable
,
dependent: :destroy
delegate
:name
,
:email
,
to: :author
,
prefix:
true
delegate
:name
,
:email
,
to: :author
,
prefix:
true
,
allow_nil:
true
validates
:author
,
presence:
true
validates
:author
,
presence:
true
validates
:project
,
presence:
true
validates
:project
,
presence:
true
...
...
app/views/issues/_show.html.haml
View file @
190e483f
...
@@ -28,7 +28,7 @@
...
@@ -28,7 +28,7 @@
%p
=
link_to_gfm
truncate
(
issue
.
title
,
length:
100
),
project_issue_path
(
issue
.
project
,
issue
),
class:
"row_title"
%p
=
link_to_gfm
truncate
(
issue
.
title
,
length:
100
),
project_issue_path
(
issue
.
project
,
issue
),
class:
"row_title"
%span
.update-author
%span
.update-author
%s
mall
.cdark
=
"#
#{
issue
.
id
}
"
%s
pan
.cdark
=
"#
#{
issue
.
id
}
"
-
if
issue
.
assignee
-
if
issue
.
assignee
assigned to
#{
issue
.
assignee_name
}
assigned to
#{
issue
.
assignee_name
}
-
else
-
else
...
...
app/views/milestones/_milestone.html.haml
View file @
190e483f
%li
{
class:
"milestone"
,
id:
dom_id
(
milestone
)
}
%li
{
class:
"milestone
milestone-#{milestone.closed ? 'closed' : 'open'}
"
,
id:
dom_id
(
milestone
)
}
.right
.right
-
if
can?
current_user
,
:admin_milestone
,
milestone
.
project
-
if
can?
(
current_user
,
:admin_milestone
,
milestone
.
project
)
and
milestone
.
open?
=
link_to
edit_project_milestone_path
(
milestone
.
project
,
milestone
),
class:
"btn small edit-milestone-link grouped"
do
=
link_to
edit_project_milestone_path
(
milestone
.
project
,
milestone
),
class:
"btn small edit-milestone-link grouped"
do
%i
.icon-edit
%i
.icon-edit
Edit
Edit
%h4
%h4
=
link_to_gfm
truncate
(
milestone
.
title
,
length:
100
),
project_milestone_path
(
milestone
.
project
,
milestone
)
=
link_to_gfm
truncate
(
milestone
.
title
,
length:
100
),
project_milestone_path
(
milestone
.
project
,
milestone
)
-
if
milestone
.
expired?
and
not
milestone
.
closed
%span
.cred
(Expired)
%small
%small
=
milestone
.
expires_at
=
milestone
.
expires_at
.row
.row
...
...
app/views/milestones/index.html.haml
View file @
190e483f
...
@@ -11,6 +11,9 @@
...
@@ -11,6 +11,9 @@
%li
{
class:
(
"active"
if
(
params
[
:f
]
==
"active"
||
!
params
[
:f
]))}
%li
{
class:
(
"active"
if
(
params
[
:f
]
==
"active"
||
!
params
[
:f
]))}
=
link_to
project_milestones_path
(
@project
,
f:
"active"
)
do
=
link_to
project_milestones_path
(
@project
,
f:
"active"
)
do
Active
Active
%li
{
class:
(
"active"
if
params
[
:f
]
==
"closed"
)}
=
link_to
project_milestones_path
(
@project
,
f:
"closed"
)
do
Closed
%li
{
class:
(
"active"
if
params
[
:f
]
==
"all"
)}
%li
{
class:
(
"active"
if
params
[
:f
]
==
"all"
)}
=
link_to
project_milestones_path
(
@project
,
f:
"all"
)
do
=
link_to
project_milestones_path
(
@project
,
f:
"all"
)
do
All
All
...
@@ -19,7 +22,7 @@
...
@@ -19,7 +22,7 @@
=
render
@milestones
=
render
@milestones
-
if
@milestones
.
present?
-
if
@milestones
.
present?
%li
.bottom
=
paginate
@milestones
,
remote:
true
,
theme:
"gitlab"
%li
.bottom
=
paginate
@milestones
,
theme:
"gitlab"
-
else
-
else
%li
%li
%h3
.nothing_here_message
Nothing to show here
%h3
.nothing_here_message
Nothing to show here
app/views/milestones/show.html.haml
View file @
190e483f
%h3
.page_title
.row
.span6
%h3
.page_title
Milestone ##{@milestone.id}
Milestone ##{@milestone.id}
%small
%small
=
@milestone
.
expires_at
=
@milestone
.
expires_at
.back_link
%span
.right
=
link_to
project_milestones_path
(
@project
)
do
←
To milestones list
.span6
.right
-
unless
@milestone
.
closed
=
link_to
new_project_issue_path
(
@project
,
issue:
{
milestone_id:
@milestone
.
id
}),
class:
"btn small grouped"
,
title:
"New Issue"
do
=
link_to
new_project_issue_path
(
@project
,
issue:
{
milestone_id:
@milestone
.
id
}),
class:
"btn small grouped"
,
title:
"New Issue"
do
%i
.icon-plus
%i
.icon-plus
New Issue
New Issue
...
@@ -13,19 +19,23 @@
...
@@ -13,19 +19,23 @@
%i
.icon-edit
%i
.icon-edit
Edit
Edit
.back_link
=
link_to
project_milestones_path
(
@project
)
do
←
To milestones list
-
if
@milestone
.
can_be_closed?
%hr
%p
%span
All issues for this milestone are closed. You may close milestone now.
=
link_to
'Close Milestone'
,
project_milestone_path
(
@project
,
@milestone
,
milestone:
{
closed:
true
}),
method: :put
,
class:
"btn small danger"
.main_box
.main_box
.top_box_content
.top_box_content
%h
5
%h
4
.box-title
-
if
@milestone
.
closed
-
if
@milestone
.
closed
.alert-message.error.status_info
Closed
.error.status_info
Closed
-
else
-
elsif
@milestone
.
expired?
.alert-message.success.status_info
Open
.error.status_info
Expired
=
gfm
escape_once
(
@milestone
.
title
)
=
gfm
escape_once
(
@milestone
.
title
)
%small
.right
=
@milestone
.
expires_at
.middle_box_content
.middle_box_content
%h5
%h5
...
@@ -34,6 +44,7 @@
...
@@ -34,6 +44,7 @@
#{
@milestone
.
closed_items_count
}
closed
#{
@milestone
.
closed_items_count
}
closed
–
–
#{
@milestone
.
open_items_count
}
open
#{
@milestone
.
open_items_count
}
open
%span
.right
=
@milestone
.
expires_at
.progress.progress-info
.progress.progress-info
.bar
{
style:
"width: #{@milestone.percent_complete}%;"
}
.bar
{
style:
"width: #{@milestone.percent_complete}%;"
}
...
@@ -43,6 +54,7 @@
...
@@ -43,6 +54,7 @@
=
preserve
do
=
preserve
do
=
markdown
@milestone
.
description
=
markdown
@milestone
.
description
.row
.row
.span6
.span6
%table
.milestone-issue-filter
%table
.milestone-issue-filter
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment