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

Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
8 9 10
    - if can? current_user, :write_issue, @project
      = link_to new_project_issue_path(@project), :class => "right btn small", :title => "New Issue", :remote => true do 
        New Issue
11
  %br
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
  %div#issues-table-holder.ui-box
    .title
      .row
        .span8
          %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
29

30 31 32 33 34
        .span3.right
          = form_tag search_project_issues_path(@project), :method => :get, :remote => true, :id => "issue_search_form", :class => :right  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' }
35

Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
36
    %ul#issues-table.unstyled= render "issues"
37

gitlabhq's avatar
gitlabhq committed
38
:javascript
39 40 41
  var href       = $('.issue_search').parent().attr('action');
  var last_terms = '';

Adam Leonard's avatar
Adam Leonard committed
42
  $('.issue_search').keyup(function() {
43 44
    var terms       = $(this).val();
    var project_id  = $('#project_id').val();
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
45
    var status      = $('#status').val();
46 47
    if (terms != last_terms) {
      last_terms = terms;
Adam Leonard's avatar
Adam Leonard committed
48

49 50
      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
51
          $('#issues-table').html(response);
52 53 54
          setSortable();
        });
      }
Adam Leonard's avatar
Adam Leonard committed
55 56 57
    }
  });

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

VSizov's avatar
VSizov committed
61
  function setSortable(){
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
62
    $('#issues-table').sortable({
VSizov's avatar
VSizov committed
63 64 65 66 67 68 69 70 71 72
      axis: 'y',
      dropOnEmpty: false,
      handle: '.handle',
      cursor: 'crosshair',
      items: 'tr',
      opacity: 0.4,
      scroll: true,
      update: function(){
        $.ajax({
        type: 'post',
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
73
        data: $('#issues-table').sortable('serialize'),
VSizov's avatar
VSizov committed
74 75
        dataType: 'script',
        complete: function(request){
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
76
          $('#issues-table').effect('highlight');
VSizov's avatar
VSizov committed
77 78 79 80 81 82 83 84 85
        },
        url: "#{sort_project_issues_path(@project)}"})
        }
      });
  }

  $(function(){
    setSortable();
  });