BigW Consortium Gitlab

index.html.haml 3.01 KB
Newer Older
1
= render "issues/head"
2 3 4 5
- if current_user.private_token   
  = content_for :rss_icon do 
    .rss-icon
      = link_to project_issues_path(@project, :atom, { :private_token => current_user.private_token }) do 
6
        = image_tag "Rss-UI.PNG", :width => 22, :title => "feed"
7

gitlabhq committed
8
%div#issues-table-holder
9
  .top_panel_issues
10
    = form_tag search_project_issues_path(@project), :method => :get, :remote => true, :class => :right, :id => "issue_search_form" do
11 12 13
      = hidden_field_tag :project_id, @project.id, { :id => 'project_id' }
      = search_field_tag :issue_search, nil, { :placeholder => 'Search', :class => 'issue_search' }

14
    .left.issues_filter
15 16 17
      = form_tag project_issues_path(@project), :method => :get do
        .left
          = radio_button_tag :f, 0, (params[:f] || "0") == "0", :onclick => "setIssueFilter(this.form, 0)", :id => "open_issues", :class => "status"
18 19
          = label_tag "open_issues" do 
            %span.tag.open Open
20 21
        .left
          = radio_button_tag :f, 2, params[:f] == "2", :onclick => "setIssueFilter(this.form, 2)", :id => "closed_issues", :class => "status"
22 23
          = label_tag "closed_issues" do 
            %span.tag.closed Closed
24 25 26 27 28 29
        .left
          = 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 => "setIssueFilter(this.form, 1)", :id => "all_issues", :class => "status"
          = label_tag "all_issues","All"
gitlabhq committed
30

31 32 33
  .clear
  %hr
  %table.no-borders#issues-table
gitlabhq committed
34
    = render "issues"
gitlabhq committed
35 36
  %br
:javascript
37 38 39
  var href       = $('.issue_search').parent().attr('action');
  var last_terms = '';

40 41 42 43 44
  var setIssueFilter = function(form, value){
    $.cookie('issue_filter', value, { expires: 140 });
    form.submit();
  }

45
  $('.issue_search').keyup(function() {
46 47 48 49 50
    var terms       = $(this).val();
    var project_id  = $('#project_id').val();
    var status      = $('.status:checked').val();
    if (terms != last_terms) {
      last_terms = terms;
51

52 53
      if (terms.length >= 2 || terms.length == 0) {
        $.get(href, { 'status': status, 'terms': terms, project: project_id  }, function(response) {
gitlabhq committed
54
          $('#issues-table tbody').html(response);
55 56 57
          setSortable();
        });
      }
58 59 60
    }
  });

Nihad Abbasov committed
61
  $('.delete-issue').live('ajax:success', function() {
62
    $(this).closest('tr').fadeOut(); updatePage();});
Nihad Abbasov committed
63

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

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