summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksei Kvitinskii <aleksei.wm@gmail.com>2011-11-08 23:02:57 +0200
committerAleksei Kvitinskii <aleksei.wm@gmail.com>2011-11-08 23:02:57 +0200
commit5b1634cd4b1bdd29b6bdd2141cd24b6dffc2fb3e (patch)
tree9973ebe24e018625fc6c8bfc5a9ab20bb6513106
parent49bced3a24ec81d782296def8a3e864e781ef9dd (diff)
parent3fe9f3ebe6b89489fb5a022cb8afe6f63d33b529 (diff)
downloadgitlab-ce-5b1634cd4b1bdd29b6bdd2141cd24b6dffc2fb3e.tar.gz
implemented cookie remember option for issue page filter
-rw-r--r--app/helpers/issues_helper.rb15
-rw-r--r--app/views/issues/index.html.haml14
-rw-r--r--app/views/layouts/project.html.haml2
3 files changed, 21 insertions, 10 deletions
diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb
index cf5e0656383..bdb6c281870 100644
--- a/app/helpers/issues_helper.rb
+++ b/app/helpers/issues_helper.rb
@@ -1,7 +1,12 @@
module IssuesHelper
- def sort_class
- if can?(current_user, :admin_issue, @project) && (!params[:f] || params[:f] == "0")
- "handle"
- end
- end
+ def sort_class
+ if can?(current_user, :admin_issue, @project) && (!params[:f] || params[:f] == "0")
+ "handle"
+ end
+ end
+
+ def project_issues_filter_path project, params = {}
+ params[:f] ||= cookies['issue_filter']
+ project_issues_path project, params
+ end
end
diff --git a/app/views/issues/index.html.haml b/app/views/issues/index.html.haml
index 355429c3776..89b7b2c4807 100644
--- a/app/views/issues/index.html.haml
+++ b/app/views/issues/index.html.haml
@@ -13,16 +13,16 @@
.right.issues_filter
= form_tag project_issues_path(@project), :method => :get do
.left
- = radio_button_tag :f, 0, (params[:f] || "0") == "0", :onclick => "this.form.submit()", :id => "open_issues", :class => "status"
+ = radio_button_tag :f, 0, (params[:f] || "0") == "0", :onclick => "setIssueFilter(this.form, 0)", :id => "open_issues", :class => "status"
= label_tag "open_issues","Open"
.left
- = radio_button_tag :f, 2, params[:f] == "2", :onclick => "this.form.submit()", :id => "closed_issues", :class => "status"
+ = radio_button_tag :f, 2, params[:f] == "2", :onclick => "setIssueFilter(this.form, 2)", :id => "closed_issues", :class => "status"
= label_tag "closed_issues","Closed"
.left
- = radio_button_tag :f, 3, params[:f] == "3", :onclick => "this.form.submit()", :id => "my_issues", :class => "status"
+ = radio_button_tag :f, 3, params[:f] == "3", :onclick => "setIssueFilter(this.form, 3)", :id => "my_issues", :class => "status"
= label_tag "my_issues","To Me"
.left
- = radio_button_tag :f, 1, params[:f] == "1", :onclick => "this.form.submit()", :id => "all_issues", :class => "status"
+ = radio_button_tag :f, 1, params[:f] == "1", :onclick => "setIssueFilter(this.form, 1)", :id => "all_issues", :class => "status"
= label_tag "all_issues","All"
= render "issues"
@@ -31,6 +31,12 @@
var href = $('.issue_search').parent().attr('action');
var last_terms = '';
+
+ var setIssueFilter = function(form, value){
+ $.cookie('issue_filter', value, { expires: 140 });
+ form.submit();
+ }
+
$('.issue_search').keyup(function() {
var terms = $(this).val();
var project_id = $('#project_id').val();
diff --git a/app/views/layouts/project.html.haml b/app/views/layouts/project.html.haml
index 984ff4d0d6d..2bcc7bbeb39 100644
--- a/app/views/layouts/project.html.haml
+++ b/app/views/layouts/project.html.haml
@@ -25,7 +25,7 @@
Team
- if @project.users_projects.count > 0
%span{ :class => "number" }= @project.users_projects.count
- = link_to project_issues_path(@project), :class => (controller.controller_name == "issues") ? "current" : nil do
+ = link_to project_issues_filter_path(@project), :class => (controller.controller_name == "issues") ? "current" : nil do
Issues
- if @project.issues.opened.count > 0
%span{ :class => "number" }= @project.issues.opened.count