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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
5f356d69
Commit
5f356d69
authored
Jun 27, 2012
by
randx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issues tags: refactoring
parent
50fdb2e7
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
20 deletions
+39
-20
app/assets/javascripts/issues.js
app/assets/javascripts/issues.js
+15
-0
app/controllers/issues_controller.rb
app/controllers/issues_controller.rb
+15
-4
app/views/issues/index.html.haml
app/views/issues/index.html.haml
+9
-16
No files found.
app/assets/javascripts/issues.js
View file @
5f356d69
...
@@ -61,3 +61,18 @@ function initIssuesSearch() {
...
@@ -61,3 +61,18 @@ function initIssuesSearch() {
$
(
this
).
closest
(
'
tr
'
).
fadeOut
();
updatePage
();
$
(
this
).
closest
(
'
tr
'
).
fadeOut
();
updatePage
();
});
});
}
}
/**
* Init issues page
*
*/
function
issuesPage
(){
initIssuesSearch
();
setSortable
();
$
(
"
#label_name
"
).
chosen
();
$
(
"
#assignee_id
"
).
chosen
();
$
(
"
#milestone_id
"
).
chosen
();
$
(
"
#milestone_id, #assignee_id, #label_name
"
).
on
(
"
change
"
,
function
(){
$
(
this
).
closest
(
"
form
"
).
submit
();
});
}
app/controllers/issues_controller.rb
View file @
5f356d69
...
@@ -3,6 +3,8 @@ class IssuesController < ApplicationController
...
@@ -3,6 +3,8 @@ class IssuesController < ApplicationController
before_filter
:project
before_filter
:project
before_filter
:module_enabled
before_filter
:module_enabled
before_filter
:issue
,
:only
=>
[
:edit
,
:update
,
:destroy
,
:show
]
before_filter
:issue
,
:only
=>
[
:edit
,
:update
,
:destroy
,
:show
]
helper_method
:issues_filter
layout
"project"
layout
"project"
# Authorize
# Authorize
...
@@ -130,10 +132,10 @@ class IssuesController < ApplicationController
...
@@ -130,10 +132,10 @@ class IssuesController < ApplicationController
end
end
def
issues_filtered
def
issues_filtered
@issues
=
case
params
[
:f
]
.
to_i
@issues
=
case
params
[
:f
]
when
1
then
@project
.
issues
when
issues_filter
[
:all
]
then
@project
.
issues
when
2
then
@project
.
issues
.
closed
when
issues_filter
[
:closed
]
then
@project
.
issues
.
closed
when
3
then
@project
.
issues
.
opened
.
assigned
(
current_user
)
when
issues_filter
[
:to_me
]
then
@project
.
issues
.
opened
.
assigned
(
current_user
)
else
@project
.
issues
.
opened
else
@project
.
issues
.
opened
end
end
...
@@ -143,4 +145,13 @@ class IssuesController < ApplicationController
...
@@ -143,4 +145,13 @@ class IssuesController < ApplicationController
@issues
=
@issues
.
includes
(
:author
,
:project
).
order
(
"updated_at"
)
@issues
=
@issues
.
includes
(
:author
,
:project
).
order
(
"updated_at"
)
@issues
@issues
end
end
def
issues_filter
{
all:
"1"
,
closed:
"2"
,
to_me:
"3"
,
open:
"0"
}
end
end
end
app/views/issues/index.html.haml
View file @
5f356d69
...
@@ -18,17 +18,17 @@
...
@@ -18,17 +18,17 @@
.title
.title
.left
.left
%ul
.nav.nav-pills.left
%ul
.nav.nav-pills.left
%li
{
:class
=>
(
"active"
if
(
params
[
:f
]
==
"0"
||
!
params
[
:f
]))}
%li
{
:class
=>
(
"active"
if
(
params
[
:f
]
==
issues_filter
[
:open
]
||
!
params
[
:f
]))}
=
link_to
project_issues_path
(
@project
,
:f
=>
0
,
:milestone_id
=>
params
[
:milestone_id
])
do
=
link_to
project_issues_path
(
@project
,
:f
=>
issues_filter
[
:open
]
,
:milestone_id
=>
params
[
:milestone_id
])
do
Open
Open
%li
{
:class
=>
(
"active"
if
params
[
:f
]
==
"2"
)}
%li
{
:class
=>
(
"active"
if
params
[
:f
]
==
issues_filter
[
:closed
]
)}
=
link_to
project_issues_path
(
@project
,
:f
=>
2
,
:milestone_id
=>
params
[
:milestone_id
])
do
=
link_to
project_issues_path
(
@project
,
:f
=>
issues_filter
[
:closed
]
,
:milestone_id
=>
params
[
:milestone_id
])
do
Closed
Closed
%li
{
:class
=>
(
"active"
if
params
[
:f
]
==
"3"
)}
%li
{
:class
=>
(
"active"
if
params
[
:f
]
==
issues_filter
[
:to_me
]
)}
=
link_to
project_issues_path
(
@project
,
:f
=>
3
,
:milestone_id
=>
params
[
:milestone_id
])
do
=
link_to
project_issues_path
(
@project
,
:f
=>
issues_filter
[
:to_me
]
,
:milestone_id
=>
params
[
:milestone_id
])
do
To Me
To Me
%li
{
:class
=>
(
"active"
if
params
[
:f
]
==
"1"
)}
%li
{
:class
=>
(
"active"
if
params
[
:f
]
==
issues_filter
[
:all
]
)}
=
link_to
project_issues_path
(
@project
,
:f
=>
1
,
:milestone_id
=>
params
[
:milestone_id
])
do
=
link_to
project_issues_path
(
@project
,
:f
=>
issues_filter
[
:all
]
,
:milestone_id
=>
params
[
:milestone_id
])
do
All
All
.right
.right
...
@@ -44,14 +44,7 @@
...
@@ -44,14 +44,7 @@
:javascript
:javascript
$
(
function
(){
$
(
function
(){
initIssuesSearch
();
issuesPage
();
setSortable
();
$
(
"
#label_name
"
).
chosen
();
$
(
"
#assignee_id
"
).
chosen
();
$
(
"
#milestone_id
"
).
chosen
();
$
(
"
#milestone_id, #assignee_id, #label_name
"
).
live
(
"
change
"
,
function
(){
$
(
this
).
closest
(
"
form
"
).
submit
();
});
})
})
function
setSortable
(){
function
setSortable
(){
...
...
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