mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-31 06:18:49 +01:00
Projects page completely working now
This commit is contained in:
parent
3d905b7289
commit
586b46661a
2 changed files with 15 additions and 16 deletions
|
|
@ -173,7 +173,7 @@ class ProjectsController < ApplicationController
|
|||
end
|
||||
|
||||
def order
|
||||
project_ids = params["list-active-projects"] || params["list-hidden-projects"] || params["list-completed-projects"]
|
||||
project_ids = params["container_project"]
|
||||
@projects = current_user.projects.update_positions( project_ids )
|
||||
render :nothing => true
|
||||
rescue
|
||||
|
|
@ -186,6 +186,7 @@ class ProjectsController < ApplicationController
|
|||
@projects = current_user.projects.alphabetize(:state => @state) if @state
|
||||
@contexts = current_user.contexts
|
||||
init_not_done_counts(['project'])
|
||||
init_project_hidden_todo_counts(['project']) if @state == 'hidden'
|
||||
end
|
||||
|
||||
def actionize
|
||||
|
|
@ -193,6 +194,7 @@ class ProjectsController < ApplicationController
|
|||
@projects = current_user.projects.actionize(current_user.id, :state => @state) if @state
|
||||
@contexts = current_user.contexts
|
||||
init_not_done_counts(['project'])
|
||||
init_project_hidden_todo_counts(['project']) if @state == 'hidden'
|
||||
end
|
||||
|
||||
protected
|
||||
|
|
|
|||
|
|
@ -229,6 +229,15 @@ function askIfNewContextProvided() {
|
|||
return confirm('New context "' + givenContextName + '" will be also created. Are you sure?');
|
||||
}
|
||||
|
||||
function update_project_order(event, ui){
|
||||
container = $(ui.item).parent();
|
||||
project_display = $(ui.item).children('.project');
|
||||
$.post('/projects/order',
|
||||
container.sortable("serialize"),
|
||||
function(){project_display.effect('highlight', {}, 1000)},
|
||||
'script');
|
||||
}
|
||||
|
||||
/* Unobtrusive jQuery behavior */
|
||||
|
||||
$(document).ready(function() {
|
||||
|
|
@ -361,19 +370,7 @@ $(document).ready(function() {
|
|||
$(this).parents('.edit-form').find('form').clearForm();
|
||||
});
|
||||
|
||||
$("#list-active-projects").sortable({handle: '.handle',
|
||||
/*
|
||||
"#list-active-projects": function(event) {
|
||||
Sortable.create("list-active-projects", {handle:'handle', onUpdate:function(){new Ajax.Request('/projects/order', {asynchronous:true, evalScripts:true, onComplete:function(request){new Effect.Highlight("list-active-projects",{});}, parameters:Sortable.serialize("list-active-projects") + '&authenticity_token=' + encodeURIComponent('1e046f4f2a85aa09451c6e17f902bf9a254868c6')})}, tag:'div'})
|
||||
},
|
||||
"#list-hidden-projects": function(event) {
|
||||
Sortable.create("list-hidden-projects", {handle:'handle', onUpdate:function(){new Ajax.Request('/projects/order', {asynchronous:true, evalScripts:true, onComplete:function(request){new Effect.Highlight("list-hidden-projects",{});}, parameters:Sortable.serialize("list-hidden-projects") + '&authenticity_token=' + encodeURIComponent('1e046f4f2a85aa09451c6e17f902bf9a254868c6')})}, tag:'div'})
|
||||
},
|
||||
"#list-completed-projects": function(event) {
|
||||
Sortable.create("list-completed-projects", {handle:'handle', onUpdate:function(){new Ajax.Request('/projects/order', {asynchronous:true, evalScripts:true, onComplete:function(request){new Effect.Highlight("list-completed-projects",{});}, parameters:Sortable.serialize("list-completed-projects") + '&authenticity_token=' + encodeURIComponent('1e046f4f2a85aa09451c6e17f902bf9a254868c6')})}, tag:'div'})
|
||||
},
|
||||
*/
|
||||
update: function(event, ui){
|
||||
console.log(ui);
|
||||
}});
|
||||
$("#list-active-projects").sortable({handle: '.handle', update: update_project_order});
|
||||
$("#list-hidden-projects").sortable({handle: '.handle', update: update_project_order});
|
||||
$("#list-completed-projects").sortable({handle: '.handle', update: update_project_order});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue