Commit 5b1634cd authored by Aleksei Kvitinskii's avatar Aleksei Kvitinskii

implemented cookie remember option for issue page filter

parents 49bced3a 3fe9f3eb
......@@ -4,4 +4,9 @@ module IssuesHelper
"handle"
end
end
def project_issues_filter_path project, params = {}
params[:f] ||= cookies['issue_filter']
project_issues_path project, params
end
end
......@@ -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();
......
......@@ -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
......
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