index.html.haml 3.23 KB
Newer Older
1
= render "issues/head"
2
.issues_content
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
3 4
  %h3
    Issues
5 6
    %span.rss-icon
      = link_to project_issues_path(@project, :atom, { :private_token => current_user.private_token }) do 
7
        = image_tag "Rss-UI.PNG", :width => 16, :title => "feed"
8

9 10 11 12 13 14 15 16 17 18 19
    .right
      .span4.left
        = form_tag search_project_issues_path(@project), :method => :get, :remote => true, :id => "issue_search_form", :class => :left  do
          = hidden_field_tag :project_id, @project.id, { :id => 'project_id' }
          = hidden_field_tag :status, params[:f]
          = search_field_tag :issue_search, nil, { :placeholder => 'Search', :class => 'issue_search' }

      - if can? current_user, :write_issue, @project
        .span2.left
          = link_to new_project_issue_path(@project), :class => "right btn small", :title => "New Issue", :remote => true do 
            New Issue
20
  %br
21 22 23
  %div#issues-table-holder.ui-box
    .title
      .row
24
        .span6
25 26 27 28 29 30 31 32 33 34 35 36 37
          %ul.pills.left
            %li{:class => ("active" if (params[:f] == "0" || !params[:f]))}
              = link_to project_issues_path(@project, :f => 0) do 
                Open
            %li{:class => ("active" if params[:f] == "2")}
              = link_to project_issues_path(@project, :f => 2) do 
                Closed
            %li{:class => ("active" if params[:f] == "3")}
              = link_to project_issues_path(@project, :f => 3) do 
                To Me
            %li{:class => ("active" if params[:f] == "1")}
              = link_to project_issues_path(@project, :f => 1) do 
                All
38

39 40 41
        .span6.right
          = 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")
42

43 44
    %ul#issues-table.unstyled
      = render "issues"
45

gitlabhq's avatar
gitlabhq committed
46
:javascript
47 48 49
  var href       = $('.issue_search').parent().attr('action');
  var last_terms = '';

Adam Leonard's avatar
Adam Leonard committed
50
  $('.issue_search').keyup(function() {
51 52
    var terms       = $(this).val();
    var project_id  = $('#project_id').val();
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
53
    var status      = $('#status').val();
54 55
    if (terms != last_terms) {
      last_terms = terms;
Adam Leonard's avatar
Adam Leonard committed
56

57 58
      if (terms.length >= 2 || terms.length == 0) {
        $.get(href, { 'status': status, 'terms': terms, project: project_id  }, function(response) {
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
59
          $('#issues-table').html(response);
60 61 62
          setSortable();
        });
      }
Adam Leonard's avatar
Adam Leonard committed
63 64 65
    }
  });

Nihad Abbasov's avatar
Nihad Abbasov committed
66
  $('.delete-issue').live('ajax:success', function() {
gitlabhq's avatar
gitlabhq committed
67
    $(this).closest('tr').fadeOut(); updatePage();});
Nihad Abbasov's avatar
Nihad Abbasov committed
68

VSizov's avatar
VSizov committed
69
  function setSortable(){
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
70
    $('#issues-table').sortable({
VSizov's avatar
VSizov committed
71 72
      axis: 'y',
      dropOnEmpty: false,
73 74
      handle: '.avatar',
      items: 'li',
VSizov's avatar
VSizov committed
75 76 77 78 79
      opacity: 0.4,
      scroll: true,
      update: function(){
        $.ajax({
        type: 'post',
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
80
        data: $('#issues-table').sortable('serialize'),
VSizov's avatar
VSizov committed
81 82
        dataType: 'script',
        complete: function(request){
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
83
          $('#issues-table').effect('highlight');
VSizov's avatar
VSizov committed
84 85 86 87 88 89 90 91
        },
        url: "#{sort_project_issues_path(@project)}"})
        }
      });
  }

  $(function(){
    setSortable();
92 93 94 95
    $("#milestone_id").chosen();
    $("#milestone_id").live("change", function(){
      $(this).closest("form").submit();
    });
VSizov's avatar
VSizov committed
96
  });