mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-16 23:30:12 +01:00
Merge branch '2.3_branch'
This commit is contained in:
commit
8dd4970b0c
6 changed files with 36 additions and 10 deletions
|
|
@ -301,7 +301,6 @@ var TodoItems = {
|
|||
/* Drag & Drop for successor/predecessor */
|
||||
var dragged_todo = ui.draggable[0].id.split('_')[2];
|
||||
var dropped_todo = this.id.split('_')[2];
|
||||
ui.draggable.remove();
|
||||
$('.drop_target').hide(); // IE8 doesn't call stop() in this situation
|
||||
|
||||
ajax_options = default_ajax_options_for_scripts('POST', relative_to_root('todos/add_predecessor'), $(this));
|
||||
|
|
@ -324,7 +323,7 @@ var TodoItems = {
|
|||
setup_drag_and_drop: function() {
|
||||
$('.item-show').draggable({
|
||||
handle: '.grip',
|
||||
revert: 'invalid',
|
||||
revert: true,
|
||||
start: TodoItems.drag_todo,
|
||||
stop: function() {
|
||||
$('.drop_target').hide();
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ class TodosController < ApplicationController
|
|||
create_multiple
|
||||
else
|
||||
p = Todos::TodoCreateParamsHelper.new(params, current_user)
|
||||
p.parse_dates() unless mobile?
|
||||
p.parse_dates unless mobile?
|
||||
tag_list = p.tag_list
|
||||
|
||||
@todo = current_user.todos.build
|
||||
|
|
@ -423,7 +423,18 @@ class TodosController < ApplicationController
|
|||
update_dependencies
|
||||
update_attributes_of_todo
|
||||
|
||||
@saved = @todo.save
|
||||
begin
|
||||
@saved = @todo.save!
|
||||
rescue ActiveRecord::RecordInvalid => exception
|
||||
record = exception.record
|
||||
if record.is_a?(Dependency)
|
||||
record.errors.each { |key,value| @todo.errors[key] << value }
|
||||
end
|
||||
@saved = false
|
||||
end
|
||||
|
||||
|
||||
provide_project_or_context_for_view
|
||||
|
||||
# this is set after save and cleared after reload, so save it here
|
||||
@removed_predecessors = @todo.removed_predecessors
|
||||
|
|
@ -457,6 +468,15 @@ class TodosController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def provide_project_or_context_for_view
|
||||
# see application_helper:source_view_key, used in shown partials
|
||||
if source_view_is :project
|
||||
@project = @todo.project
|
||||
elsif source_view_is :context
|
||||
@context = @todo.context
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@source_view = params['_source_view'] || 'todo'
|
||||
@todo = current_user.todos.find(params['id'])
|
||||
|
|
@ -1133,7 +1153,7 @@ end
|
|||
end
|
||||
|
||||
def update_project
|
||||
@project_changed = false;
|
||||
@project_changed = false
|
||||
if params['todo']['project_id'].blank? && !params['project_name'].nil?
|
||||
if params['project_name'].blank?
|
||||
project = Project.null_object
|
||||
|
|
|
|||
|
|
@ -513,7 +513,7 @@ module TodosHelper
|
|||
def update_needs_to_remove_todo_from_container
|
||||
source_view do |page|
|
||||
page.context { return @context_changed || @todo_deferred_state_changed || @todo_pending_state_changed || @todo_should_be_hidden }
|
||||
page.project { return @todo_deferred_state_changed || @todo_pending_state_changed || @project_changed}
|
||||
page.project { return @context_changed || @todo_deferred_state_changed || @todo_pending_state_changed || @project_changed}
|
||||
page.deferred { return todo_moved_out_of_container || !(@todo.deferred? || @todo.pending?) }
|
||||
page.calendar { return @due_date_changed || !@todo.due }
|
||||
page.stats { return @todo.completed? }
|
||||
|
|
@ -547,7 +547,7 @@ module TodosHelper
|
|||
def append_updated_todo
|
||||
source_view do |page|
|
||||
page.context { return @todo_deferred_state_changed || @todo_pending_state_changed }
|
||||
page.project { return @todo_deferred_state_changed || @todo_pending_state_changed }
|
||||
page.project { return @context_changed || @todo_deferred_state_changed || @todo_pending_state_changed }
|
||||
page.deferred { return todo_moved_out_of_container && (@todo.deferred? || @todo.pending?) }
|
||||
page.calendar { return @due_date_changed && @todo.due }
|
||||
page.stats { return false }
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ function show_empty_messages() {
|
|||
}
|
||||
|
||||
function remove_todo_from_page() {
|
||||
<% if (@remaining_in_context == 0) && update_needs_to_hide_container
|
||||
<% if update_needs_to_hide_container
|
||||
# remove context with deleted todo
|
||||
-%>
|
||||
$('#<%=item_container_id(@todo)%>').fadeOut(400, function() {
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ var <%= object_name %> = {
|
|||
redirect_to(path);
|
||||
},
|
||||
remove_todo: function(next_steps) {
|
||||
<% if (@remaining_in_context == 0) && update_needs_to_hide_container
|
||||
<% if update_needs_to_hide_container
|
||||
# remove context with deleted todo
|
||||
-%>
|
||||
$('#<%= item_container_id(@original_item)%>').slideUp(400, function() {
|
||||
|
|
|
|||
|
|
@ -326,7 +326,14 @@ Feature: Edit a next action from every page
|
|||
Given I have a deferred todo "moving" in context "@pc" with tags "tag"
|
||||
When I go to the tickler page
|
||||
And I edit the context of "moving" to "@new"
|
||||
And I should see the container for context "@new"
|
||||
Then I should see the container for context "@new"
|
||||
|
||||
@javascript
|
||||
Scenario: Editing the context of a todo in the project view to a new context will show new context
|
||||
Given I have a todo "something" in the context "@pc" in the project "project"
|
||||
When I go to the "project" project page
|
||||
And I edit the context of "something" to "@new"
|
||||
Then I should see the container for context "@new"
|
||||
|
||||
@javascript
|
||||
Scenario: Making an error when editing a todo will show error message
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue