2012-04-08 23:28:58 +02:00
|
|
|
= render "issues/head"
|
2012-01-28 00:49:14 +01:00
|
|
|
.issues_content
|
2012-01-28 10:54:11 +01:00
|
|
|
%h3
|
|
|
|
Issues
|
2012-05-27 00:09:44 +02:00
|
|
|
%small (#{@issues.total_count})
|
2012-04-08 23:28:58 +02:00
|
|
|
.right
|
2012-04-10 19:06:17 +02:00
|
|
|
.span5
|
|
|
|
- if can? current_user, :write_issue, @project
|
2012-06-04 00:37:27 +02:00
|
|
|
= link_to new_project_issue_path(@project), :class => "right btn small", :title => "New Issue", :remote => true do
|
2012-04-10 19:06:17 +02:00
|
|
|
New Issue
|
|
|
|
= form_tag search_project_issues_path(@project), :method => :get, :remote => true, :id => "issue_search_form", :class => :right do
|
2012-04-08 23:28:58 +02:00
|
|
|
= hidden_field_tag :project_id, @project.id, { :id => 'project_id' }
|
|
|
|
= hidden_field_tag :status, params[:f]
|
2012-04-10 19:06:17 +02:00
|
|
|
= search_field_tag :issue_search, nil, { :placeholder => 'Search', :class => 'issue_search span3 right neib' }
|
2012-04-08 23:28:58 +02:00
|
|
|
|
2012-02-26 21:06:40 +01:00
|
|
|
%br
|
2012-02-18 13:12:48 +01:00
|
|
|
%div#issues-table-holder.ui-box
|
|
|
|
.title
|
|
|
|
.row
|
2012-04-08 23:28:58 +02:00
|
|
|
.span6
|
2012-04-10 07:51:08 +02:00
|
|
|
%ul.nav.nav-pills.left
|
2012-02-18 13:12:48 +01:00
|
|
|
%li{:class => ("active" if (params[:f] == "0" || !params[:f]))}
|
2012-06-04 00:37:27 +02:00
|
|
|
= link_to project_issues_path(@project, :f => 0, :milestone_id => params[:milestone_id]) do
|
2012-02-18 13:12:48 +01:00
|
|
|
Open
|
|
|
|
%li{:class => ("active" if params[:f] == "2")}
|
2012-06-04 00:37:27 +02:00
|
|
|
= link_to project_issues_path(@project, :f => 2, :milestone_id => params[:milestone_id]) do
|
2012-02-18 13:12:48 +01:00
|
|
|
Closed
|
|
|
|
%li{:class => ("active" if params[:f] == "3")}
|
2012-06-04 00:37:27 +02:00
|
|
|
= link_to project_issues_path(@project, :f => 3, :milestone_id => params[:milestone_id]) do
|
2012-02-18 13:12:48 +01:00
|
|
|
To Me
|
|
|
|
%li{:class => ("active" if params[:f] == "1")}
|
2012-06-04 00:37:27 +02:00
|
|
|
= link_to project_issues_path(@project, :f => 1, :milestone_id => params[:milestone_id]) do
|
2012-02-18 13:12:48 +01:00
|
|
|
All
|
2012-01-28 00:49:14 +01:00
|
|
|
|
2012-04-10 07:51:08 +02:00
|
|
|
.span4.right
|
2012-04-08 23:28:58 +02:00
|
|
|
= form_tag project_issues_path(@project), :method => :get, :class => :right do
|
|
|
|
= select_tag(:milestone_id, options_from_collection_for_select(@project.milestones.order("id desc").all, "id", "title", params[:milestone_id]), :prompt => "Select milestone")
|
2012-04-17 20:03:01 +02:00
|
|
|
= hidden_field_tag :f, params[:f]
|
2012-01-17 23:04:27 +01:00
|
|
|
|
2012-03-10 22:41:05 +01:00
|
|
|
%ul#issues-table.unstyled
|
|
|
|
= render "issues"
|
2012-04-08 23:28:58 +02:00
|
|
|
|
2011-10-08 23:36:38 +02:00
|
|
|
:javascript
|
2011-10-26 02:15:11 +02:00
|
|
|
var href = $('.issue_search').parent().attr('action');
|
|
|
|
var last_terms = '';
|
|
|
|
|
2011-10-22 06:06:38 +02:00
|
|
|
$('.issue_search').keyup(function() {
|
2011-10-26 02:15:11 +02:00
|
|
|
var terms = $(this).val();
|
|
|
|
var project_id = $('#project_id').val();
|
2012-01-29 23:43:14 +01:00
|
|
|
var status = $('#status').val();
|
2011-10-26 02:15:11 +02:00
|
|
|
if (terms != last_terms) {
|
|
|
|
last_terms = terms;
|
2011-10-22 06:06:38 +02:00
|
|
|
|
2011-10-26 02:15:11 +02:00
|
|
|
if (terms.length >= 2 || terms.length == 0) {
|
|
|
|
$.get(href, { 'status': status, 'terms': terms, project: project_id }, function(response) {
|
2012-01-29 11:04:09 +01:00
|
|
|
$('#issues-table').html(response);
|
2011-10-26 02:15:11 +02:00
|
|
|
setSortable();
|
|
|
|
});
|
|
|
|
}
|
2011-10-22 06:06:38 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2011-10-26 15:46:25 +02:00
|
|
|
$('.delete-issue').live('ajax:success', function() {
|
2011-10-27 17:18:50 +02:00
|
|
|
$(this).closest('tr').fadeOut(); updatePage();});
|
2011-10-26 15:46:25 +02:00
|
|
|
|
2011-10-15 18:56:53 +02:00
|
|
|
function setSortable(){
|
2012-01-29 11:04:09 +01:00
|
|
|
$('#issues-table').sortable({
|
2011-10-15 18:56:53 +02:00
|
|
|
axis: 'y',
|
|
|
|
dropOnEmpty: false,
|
2012-04-08 23:28:58 +02:00
|
|
|
handle: '.avatar',
|
|
|
|
items: 'li',
|
2011-10-15 18:56:53 +02:00
|
|
|
opacity: 0.4,
|
|
|
|
scroll: true,
|
|
|
|
update: function(){
|
|
|
|
$.ajax({
|
|
|
|
type: 'post',
|
2012-01-29 11:04:09 +01:00
|
|
|
data: $('#issues-table').sortable('serialize'),
|
2011-10-15 18:56:53 +02:00
|
|
|
dataType: 'script',
|
|
|
|
complete: function(request){
|
2012-01-29 11:04:09 +01:00
|
|
|
$('#issues-table').effect('highlight');
|
2011-10-15 18:56:53 +02:00
|
|
|
},
|
|
|
|
url: "#{sort_project_issues_path(@project)}"})
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
$(function(){
|
|
|
|
setSortable();
|
2012-04-08 23:28:58 +02:00
|
|
|
$("#milestone_id").chosen();
|
|
|
|
$("#milestone_id").live("change", function(){
|
|
|
|
$(this).closest("form").submit();
|
|
|
|
});
|
2011-10-15 18:56:53 +02:00
|
|
|
});
|