Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

do not replace HTML special characters for non-HTML output #2073

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
116 changes: 60 additions & 56 deletions app/controllers/todos_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,68 +87,72 @@ def create
if is_multiple
create_multiple
else
p = Todos::TodoCreateParamsHelper.new(params, current_user)
p.parse_dates unless mobile?
tag_list = p.tag_list
create_single
end
end

@todo = current_user.todos.build
@todo.assign_attributes(p.attributes)
p.add_errors(@todo)
def create_single
p = Todos::TodoCreateParamsHelper.new(params, current_user)
p.parse_dates unless mobile?
tag_list = p.tag_list

if @todo.errors.empty?
@todo.add_predecessor_list(p.predecessor_list)
@saved = @todo.save
@todo.tag_with(tag_list) if @saved && tag_list.present?
@todo.block! if @todo.uncompleted_predecessors?
else
@saved = false
end
@todo = current_user.todos.build
@todo.assign_attributes(p.attributes)
p.add_errors(@todo)

@todo_was_created_deferred = @todo.deferred?
@todo_was_created_blocked = @todo.pending?
@not_done_todos = [@todo] if p.new_project_created || p.new_context_created
@new_project_created = p.new_project_created
@new_context_created = p.new_context_created
if @todo.errors.empty?
@todo.add_predecessor_list(p.predecessor_list)
@saved = @todo.save
@todo.tag_with(tag_list) if @saved && tag_list.present?
@todo.block! if @todo.uncompleted_predecessors?
else
@saved = false
end

respond_to do |format|
format.html do
redirect_to :action => "index"
end
format.m do
@return_path=cookies[:mobile_url] ? cookies[:mobile_url] : mobile_path
if @saved
onsite_redirect_to @return_path
else
@projects = current_user.projects
@contexts = current_user.contexts
render :action => "new"
end
@todo_was_created_deferred = @todo.deferred?
@todo_was_created_blocked = @todo.pending?
@not_done_todos = [@todo] if p.new_project_created || p.new_context_created
@new_project_created = p.new_project_created
@new_context_created = p.new_context_created

respond_to do |format|
format.html do
redirect_to :action => "index"
end
format.m do
@return_path=cookies[:mobile_url] ? cookies[:mobile_url] : mobile_path
if @saved
onsite_redirect_to @return_path
else
@projects = current_user.projects
@contexts = current_user.contexts
render :action => "new"
end
format.js do
if @saved
determine_down_count
@contexts = current_user.contexts
@projects = current_user.projects
@context = @todo.context
@project = @todo.project
@initial_context_name = params['default_context_name']
@initial_project_name = params['default_project_name']
@initial_tags = params['initial_tag_list']
@status_message = t('todos.added_new_next_action')
@status_message += ' ' + t('todos.to_tickler') if @todo.deferred?
@status_message += ' ' + t('todos.in_pending_state') if @todo.pending?
@status_message += ' ' + t('todos.in_hidden_state') if @todo.hidden?
@status_message = t('todos.added_new_project') + ' / ' + @status_message if @new_project_created
@status_message = t('todos.added_new_context') + ' / ' + @status_message if @new_context_created
end
render :action => 'create'
end
format.js do
if @saved
determine_down_count
@contexts = current_user.contexts
@projects = current_user.projects
@context = @todo.context
@project = @todo.project
@initial_context_name = params['default_context_name']
@initial_project_name = params['default_project_name']
@initial_tags = params['initial_tag_list']
@status_message = t('todos.added_new_next_action')
@status_message += ' ' + t('todos.to_tickler') if @todo.deferred?
@status_message += ' ' + t('todos.in_pending_state') if @todo.pending?
@status_message += ' ' + t('todos.in_hidden_state') if @todo.hidden?
@status_message = t('todos.added_new_project') + ' / ' + @status_message if @new_project_created
@status_message = t('todos.added_new_context') + ' / ' + @status_message if @new_context_created
end
format.xml do
if @saved
head :created, :location => todo_url(@todo)
else
render_failure @todo.errors.to_xml.html_safe, 409
end
render :action => 'create'
end
format.xml do
if @saved
head :created, :location => todo_url(@todo)
else
render_failure @todo.errors.to_xml.html_safe, 409
end
end
end
Expand Down
6 changes: 3 additions & 3 deletions app/views/todos/create.js.erb
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
function clear_form(next_steps) {
$('#todo-form-new-action').clearForm();
$('#todo-form-new-action').clearDeps();
TracksForm.set_context_name('<%=escape_javascript @initial_context_name%>');
TracksForm.set_project_name_and_default_project_name('<%=escape_javascript @initial_project_name%>');
TracksForm.set_tag_list_and_default_tag_list('<%=escape_javascript @initial_tags%>');
TracksForm.set_context_name('<%=escape_javascript raw @initial_context_name%>');
TracksForm.set_project_name_and_default_project_name('<%= escape_javascript raw @initial_project_name %>');
TracksForm.set_tag_list_and_default_tag_list('<%=escape_javascript raw @initial_tags%>');
$('#todo-form-new-action input:text:first').focus();
$('#new_todo_starred_link .todo_star').removeClass('starred');
$('#new_todo_starred').val('false');
Expand Down