Refactored IssuesController
This commit is contained in:
parent
3a2d7a6604
commit
0e33bf6eb0
3 changed files with 50 additions and 45 deletions
|
@ -41,27 +41,14 @@
|
|||
= render "issues"
|
||||
|
||||
:javascript
|
||||
var href = $('.issue_search').parent().attr('action');
|
||||
var last_terms = '';
|
||||
|
||||
$('.issue_search').keyup(function() {
|
||||
var terms = $(this).val();
|
||||
var project_id = $('#project_id').val();
|
||||
var status = $('#status').val();
|
||||
if (terms != last_terms) {
|
||||
last_terms = terms;
|
||||
|
||||
if (terms.length >= 2 || terms.length == 0) {
|
||||
$.get(href, { 'status': status, 'terms': terms, project: project_id }, function(response) {
|
||||
$('#issues-table').html(response);
|
||||
setSortable();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$('.delete-issue').live('ajax:success', function() {
|
||||
$(this).closest('tr').fadeOut(); updatePage();});
|
||||
$(function(){
|
||||
initIssuesSearch();
|
||||
setSortable();
|
||||
$("#milestone_id").chosen();
|
||||
$("#milestone_id").live("change", function(){
|
||||
$(this).closest("form").submit();
|
||||
});
|
||||
})
|
||||
|
||||
function setSortable(){
|
||||
$('#issues-table').sortable({
|
||||
|
@ -83,11 +70,3 @@
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
$(function(){
|
||||
setSortable();
|
||||
$("#milestone_id").chosen();
|
||||
$("#milestone_id").live("change", function(){
|
||||
$(this).closest("form").submit();
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue