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
Léo-Paul Géneau
gitlab-ce
Commits
e0df75de
Commit
e0df75de
authored
Apr 07, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor Issues.js. Remove unused actions. Respect filters while searching for issue
parent
7f368753
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
80 additions
and
109 deletions
+80
-109
app/assets/javascripts/issues.js
app/assets/javascripts/issues.js
+0
-80
app/assets/javascripts/issues.js.coffee
app/assets/javascripts/issues.js.coffee
+69
-0
app/controllers/issues_controller.rb
app/controllers/issues_controller.rb
+3
-22
app/views/issues/_issues.html.haml
app/views/issues/_issues.html.haml
+1
-0
app/views/issues/index.html.haml
app/views/issues/index.html.haml
+6
-4
app/views/issues/index.js.haml
app/views/issues/index.js.haml
+1
-1
config/routes.rb
config/routes.rb
+0
-2
No files found.
app/assets/javascripts/issues.js
deleted
100644 → 0
View file @
7f368753
function
initIssuesSearch
()
{
var
href
=
$
(
'
#issue_search_form
'
).
attr
(
'
action
'
);
var
last_terms
=
''
;
$
(
'
#issue_search
'
).
keyup
(
function
()
{
var
terms
=
$
(
this
).
val
();
var
milestone_id
=
$
(
'
#milestone_id
'
).
val
();
var
status
=
$
(
'
#status
'
).
val
();
if
(
terms
!=
last_terms
)
{
last_terms
=
terms
;
if
(
terms
.
length
>=
2
||
terms
.
length
==
0
)
{
$
.
get
(
href
,
{
'
status
'
:
status
,
'
terms
'
:
terms
,
'
milestone_id
'
:
milestone_id
},
function
(
response
)
{
$
(
'
.issues-holder
'
).
html
(
response
);
});
}
}
});
}
/**
* Init issues page
*
*/
function
issuesPage
(){
initIssuesSearch
();
$
(
"
#update_status
"
).
chosen
();
$
(
"
#update_assignee_id
"
).
chosen
();
$
(
"
#update_milestone_id
"
).
chosen
();
$
(
"
#label_name
"
).
chosen
();
$
(
"
#assignee_id
"
).
chosen
();
$
(
"
#milestone_id
"
).
chosen
();
$
(
"
#milestone_id, #assignee_id, #label_name
"
).
on
(
"
change
"
,
function
(){
$
(
this
).
closest
(
"
form
"
).
submit
();
});
$
(
'
body
'
).
on
(
'
ajax:success
'
,
'
.close_issue, .reopen_issue
'
,
function
(){
var
t
=
$
(
this
),
totalIssues
,
reopen
=
t
.
hasClass
(
'
reopen_issue
'
);
$
(
'
.issue_counter
'
).
each
(
function
(){
var
issue
=
$
(
this
);
totalIssues
=
parseInt
(
$
(
this
).
html
(),
10
);
if
(
reopen
&&
issue
.
closest
(
'
.main_menu
'
).
length
){
$
(
this
).
html
(
totalIssues
+
1
);
}
else
{
$
(
this
).
html
(
totalIssues
-
1
);
}
});
});
$
(
"
.check_all_issues
"
).
click
(
function
()
{
$
(
'
.selected_issue
'
).
attr
(
'
checked
'
,
this
.
checked
);
issuesCheckChanged
();
});
$
(
'
.selected_issue
'
).
bind
(
'
change
'
,
issuesCheckChanged
);
}
function
issuesCheckChanged
()
{
var
checked_issues
=
$
(
'
.selected_issue:checked
'
);
if
(
checked_issues
.
length
>
0
)
{
var
ids
=
[]
$
.
each
(
checked_issues
,
function
(
index
,
value
)
{
ids
.
push
(
$
(
value
).
attr
(
"
data-id
"
));
})
$
(
'
#update_issues_ids
'
).
val
(
ids
);
$
(
'
.issues_filters
'
).
hide
();
$
(
'
.issues_bulk_update
'
).
show
();
}
else
{
$
(
'
#update_issues_ids
'
).
val
([]);
$
(
'
.issues_bulk_update
'
).
hide
();
$
(
'
.issues_filters
'
).
show
();
}
}
app/assets/javascripts/issues.js.coffee
0 → 100644
View file @
e0df75de
@
Issues
=
init
:
->
Issues
.
initSearch
()
Issues
.
initSelects
()
$
(
"body"
).
on
"ajax:success"
,
".close_issue, .reopen_issue"
,
->
t
=
$
(
this
)
totalIssues
=
undefined
reopen
=
t
.
hasClass
(
"reopen_issue"
)
$
(
".issue_counter"
).
each
->
issue
=
$
(
this
)
totalIssues
=
parseInt
(
$
(
this
).
html
(),
10
)
if
reopen
and
issue
.
closest
(
".main_menu"
).
length
$
(
this
).
html
totalIssues
+
1
else
$
(
this
).
html
totalIssues
-
1
reload
:
->
Issues
.
initSelects
()
Issues
.
initChecks
()
$
(
'#filter_issue_search'
).
val
(
$
(
'#issue_search'
).
val
())
initSelects
:
->
$
(
"#update_status"
).
chosen
()
$
(
"#update_assignee_id"
).
chosen
()
$
(
"#update_milestone_id"
).
chosen
()
$
(
"#label_name"
).
chosen
()
$
(
"#assignee_id"
).
chosen
()
$
(
"#milestone_id"
).
chosen
()
$
(
"#milestone_id, #assignee_id, #label_name"
).
on
"change"
,
->
$
(
this
).
closest
(
"form"
).
submit
()
initChecks
:
->
$
(
".check_all_issues"
).
click
->
$
(
".selected_issue"
).
attr
"checked"
,
@
checked
Issues
.
checkChanged
()
$
(
".selected_issue"
).
bind
"change"
,
Issues
.
checkChanged
initSearch
:
->
form
=
$
(
"#issue_search_form"
)
last_terms
=
""
$
(
"#issue_search"
).
keyup
->
terms
=
$
(
this
).
val
()
unless
terms
is
last_terms
last_terms
=
terms
if
terms
.
length
>=
2
or
terms
.
length
is
0
$
(
'#search_status'
).
val
(
$
(
'#status'
).
val
())
$
(
'#search_assignee_id'
).
val
(
$
(
'#assignee_id'
).
val
())
$
(
'#search_milestone_id'
).
val
(
$
(
'#milestone_id'
).
val
())
$
(
'#search_label_name'
).
val
(
$
(
'#label_name'
).
val
())
form
.
submit
()
checkChanged
:
->
checked_issues
=
$
(
".selected_issue:checked"
)
if
checked_issues
.
length
>
0
ids
=
[]
$
.
each
checked_issues
,
(
index
,
value
)
->
ids
.
push
$
(
value
).
attr
(
"data-id"
)
$
(
"#update_issues_ids"
).
val
ids
$
(
".issues_filters"
).
hide
()
$
(
".issues_bulk_update"
).
show
()
else
$
(
"#update_issues_ids"
).
val
[]
$
(
".issues_bulk_update"
).
hide
()
$
(
".issues_filters"
).
show
()
app/controllers/issues_controller.rb
View file @
e0df75de
...
@@ -14,7 +14,10 @@ class IssuesController < ProjectResourceController
...
@@ -14,7 +14,10 @@ class IssuesController < ProjectResourceController
respond_to
:js
,
:html
respond_to
:js
,
:html
def
index
def
index
terms
=
params
[
'issue_search'
]
@issues
=
issues_filtered
@issues
=
issues_filtered
@issues
=
@issues
.
where
(
"title LIKE ?"
,
"%
#{
terms
}
%"
)
if
terms
.
present?
@issues
=
@issues
.
page
(
params
[
:page
]).
per
(
20
)
@issues
=
@issues
.
page
(
params
[
:page
]).
per
(
20
)
respond_to
do
|
format
|
respond_to
do
|
format
|
...
@@ -76,28 +79,6 @@ class IssuesController < ProjectResourceController
...
@@ -76,28 +79,6 @@ class IssuesController < ProjectResourceController
end
end
end
end
def
sort
return
render_404
unless
can?
(
current_user
,
:admin_issue
,
@project
)
@issues
=
@project
.
issues
.
where
(
id:
params
[
'issue'
])
@issues
.
each
do
|
issue
|
issue
.
position
=
params
[
'issue'
].
index
(
issue
.
id
.
to_s
)
+
1
issue
.
save
end
render
nothing:
true
end
def
search
terms
=
params
[
'terms'
]
@issues
=
issues_filtered
@issues
=
@issues
.
where
(
"title LIKE ?"
,
"%
#{
terms
}
%"
)
unless
terms
.
blank?
@issues
=
@issues
.
page
(
params
[
:page
]).
per
(
100
)
render
partial:
'issues'
end
def
bulk_update
def
bulk_update
result
=
IssuesBulkUpdateContext
.
new
(
project
,
current_user
,
params
).
execute
result
=
IssuesBulkUpdateContext
.
new
(
project
,
current_user
,
params
).
execute
redirect_to
:back
,
notice:
"
#{
result
[
:count
]
}
issues updated"
redirect_to
:back
,
notice:
"
#{
result
[
:count
]
}
issues updated"
...
...
app/views/issues/_issues.html.haml
View file @
e0df75de
...
@@ -18,6 +18,7 @@
...
@@ -18,6 +18,7 @@
=
select_tag
(
:assignee_id
,
options_from_collection_for_select
([
unassigned_filter
]
+
@project
.
users
.
all
,
"id"
,
"name"
,
params
[
:assignee_id
]),
prompt:
"Assignee"
)
=
select_tag
(
:assignee_id
,
options_from_collection_for_select
([
unassigned_filter
]
+
@project
.
users
.
all
,
"id"
,
"name"
,
params
[
:assignee_id
]),
prompt:
"Assignee"
)
=
select_tag
(
:milestone_id
,
options_from_collection_for_select
([
unassigned_filter
]
+
issues_active_milestones
,
"id"
,
"title"
,
params
[
:milestone_id
]),
prompt:
"Milestone"
)
=
select_tag
(
:milestone_id
,
options_from_collection_for_select
([
unassigned_filter
]
+
issues_active_milestones
,
"id"
,
"title"
,
params
[
:milestone_id
]),
prompt:
"Milestone"
)
=
hidden_field_tag
:status
,
params
[
:status
]
=
hidden_field_tag
:status
,
params
[
:status
]
=
hidden_field_tag
:issue_search
,
params
[
:status
],
id:
'filter_issue_search'
%ul
.well-list.issues-list
%ul
.well-list.issues-list
=
render
@issues
=
render
@issues
...
...
app/views/issues/index.html.haml
View file @
e0df75de
...
@@ -9,9 +9,11 @@
...
@@ -9,9 +9,11 @@
=
link_to
new_project_issue_path
(
@project
,
issue:
{
assignee_id:
params
[
:assignee_id
],
milestone_id:
params
[
:milestone_id
]}),
class:
"btn btn-primary pull-right"
,
title:
"New Issue"
,
id:
"new_issue_link"
do
=
link_to
new_project_issue_path
(
@project
,
issue:
{
assignee_id:
params
[
:assignee_id
],
milestone_id:
params
[
:milestone_id
]}),
class:
"btn btn-primary pull-right"
,
title:
"New Issue"
,
id:
"new_issue_link"
do
%i
.icon-plus
%i
.icon-plus
New Issue
New Issue
=
form_tag
search_project_issues_path
(
@project
),
method: :get
,
remote:
true
,
id:
"issue_search_form"
,
class:
'pull-right'
do
=
form_tag
project_issues_path
(
@project
),
method: :get
,
remote:
true
,
id:
"issue_search_form"
,
class:
'pull-right'
do
=
hidden_field_tag
:project_id
,
@project
.
id
,
{
id:
'project_id'
}
=
hidden_field_tag
:status
,
params
[
:status
],
id:
'search_status'
=
hidden_field_tag
:status
,
params
[
:status
]
=
hidden_field_tag
:assignee_id
,
params
[
:assignee_id
],
id:
'search_assignee_id'
=
hidden_field_tag
:milestone_id
,
params
[
:milestone_id
],
id:
'search_milestone_id'
=
hidden_field_tag
:label_name
,
params
[
:label_name
],
id:
'search_label_name'
=
search_field_tag
:issue_search
,
nil
,
{
placeholder:
'Search'
,
class:
'issue_search input-xlarge append-right-10 search-text-input'
}
=
search_field_tag
:issue_search
,
nil
,
{
placeholder:
'Search'
,
class:
'issue_search input-xlarge append-right-10 search-text-input'
}
.clearfix
.clearfix
...
@@ -24,5 +26,5 @@
...
@@ -24,5 +26,5 @@
:javascript
:javascript
$
(
function
(){
$
(
function
(){
issuesPage
();
Issues
.
init
();
})
})
app/views/issues/index.js.haml
View file @
e0df75de
:plain
:plain
$('.issues-holder').html("
#{
escape_javascript
(
render
(
'issues'
))
}
");
$('.issues-holder').html("
#{
escape_javascript
(
render
(
'issues'
))
}
");
History.replaceState({path: "
#{
request
.
url
}
"}, document.title, "
#{
request
.
url
}
");
History.replaceState({path: "
#{
request
.
url
}
"}, document.title, "
#{
request
.
url
}
");
issuesPage
();
Issues.reload
();
config/routes.rb
View file @
e0df75de
...
@@ -266,9 +266,7 @@ Gitlab::Application.routes.draw do
...
@@ -266,9 +266,7 @@ Gitlab::Application.routes.draw do
resources
:labels
,
only:
[
:index
]
resources
:labels
,
only:
[
:index
]
resources
:issues
,
except:
[
:destroy
]
do
resources
:issues
,
except:
[
:destroy
]
do
collection
do
collection
do
post
:sort
post
:bulk_update
post
:bulk_update
get
:search
end
end
end
end
...
...
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