0
@@ -3,7 +3,7 @@ class DataController < ApplicationController
0
-
@page_title = "TRACKS::Export"
0
+
@page_title = "TRACKS::Export"
0
@@ -35,21 +35,21 @@ class DataController < ApplicationController
0
content_type = 'text/csv'
0
CSV::Writer.generate(result = "") do |csv|
0
csv << ["id", "Context", "Project", "Description", "Notes", "Tags",
0
- "Created at", "Due", "Completed at", "User ID", "Show from",
0
+ "Created at", "Due", "Completed at", "User ID", "Show from",
0
current_user.todos.find(:all, :include => [:context, :project]).each do |todo|
0
- # Format dates in ISO format for easy sorting in spreadsheet
0
- # Print context and project names for easy viewing
0
+ # Format dates in ISO format for easy sorting in spreadsheet Print
0
+ # context and project names for easy viewing
0
csv << [todo.id, todo.context.name,
0
- todo.project_id = todo.project_id.nil? ? "" : todo.project.name,
0
- todo.notes, todo.tags.collect{|t| t.name}.join(', '),
0
- todo.created_at.to_formatted_s(:db),
0
- todo.due = todo.due? ? todo.due.to_formatted_s(:db) : "",
0
- todo.completed_at = todo.completed_at? ? todo.completed_at.to_formatted_s(:db) : "",
0
- todo.show_from = todo.show_from? ? todo.show_from.to_formatted_s(:db) : "",
0
+ todo.project_id = todo.project_id.nil? ? "" : todo.project.name,
0
+ todo.notes, todo.tags.collect{|t| t.name}.join(', '),
0
+ todo.created_at.to_formatted_s(:db),
0
+ todo.due = todo.due? ? todo.due.to_formatted_s(:db) : "",
0
+ todo.completed_at = todo.completed_at? ? todo.completed_at.to_formatted_s(:db) : "",
0
+ todo.show_from = todo.show_from? ? todo.show_from.to_formatted_s(:db) : "",
0
send_data(result, :filename => "todos.csv", :type => content_type)
0
@@ -59,16 +59,17 @@ class DataController < ApplicationController
0
content_type = 'text/csv'
0
CSV::Writer.generate(result = "") do |csv|
0
csv << ["id", "User ID", "Project", "Note",
0
- "Created at", "Updated at"]
0
- # had to remove project include because it's association order is leaking through
0
- # and causing an ambiguous column ref even with_exclusive_scope didn't seem to help -JamesKebinger
0
+ "Created at", "Updated at"]
0
+ # had to remove project include because it's association order is leaking
0
+ # through and causing an ambiguous column ref even with_exclusive_scope
0
+ # didn't seem to help -JamesKebinger
0
current_user.notes.find(:all,:order=>"notes.created_at").each do |note|
0
- # Format dates in ISO format for easy sorting in spreadsheet
0
- # Print context and project names for easy viewing
0
+ # Format dates in ISO format for easy sorting in spreadsheet Print
0
+ # context and project names for easy viewing
0
csv << [note.id, note.user_id,
0
- note.project_id = note.project_id.nil? ? "" : note.project.name,
0
- note.body, note.created_at.to_formatted_s(:db),
0
- note.updated_at.to_formatted_s(:db)]
0
+ note.project_id = note.project_id.nil? ? "" : note.project.name,
0
+ note.body, note.created_at.to_formatted_s(:db),
0
+ note.updated_at.to_formatted_s(:db)]
0
send_data(result, :filename => "notes.csv", :type => content_type)
0
@@ -104,7 +105,6 @@ class DataController < ApplicationController
0
@inarray = YAML::load(params['import']['yaml'])
0
# arrays to handle id translations
0
translate_context = Hash.new
0
translate_context[nil] = nil
0
@@ -153,18 +153,18 @@ class DataController < ApplicationController
0
case item.ivars['attributes']['state']
0
- when 'active' : newitem.activate!
0
- when 'project_hidden' : newitem.hide!
0
- newitem.completed_at = adjust_time(item.ivars['attributes']['completed_at'])
0
- when 'deferred' : newitem.defer!
0
+ when 'active' then newitem.activate!
0
+ when 'project_hidden' then newitem.hide!
0
+ newitem.completed_at = adjust_time(item.ivars['attributes']['completed_at'])
0
+ when 'deferred' then newitem.defer!
0
newitem.created_at = adjust_time(item.ivars['attributes']['created_at'])
0
translate_tag = Hash.new
0
translate_tag[nil] = nil
0
current_user.tags.each { |item| item.destroy }
0
@@ -182,8 +182,8 @@ class DataController < ApplicationController
0
newitem.user_id = current_user.id
0
newitem.tag_id = translate_tag[newitem.tag_id]
0
case newitem.taggable_type
0
- when 'Todo' : newitem.taggable_id = translate_todo[newitem.taggable_id]
0
- else newitem.taggable_id = 0
0
+ when 'Todo' then newitem.taggable_id = translate_todo[newitem.taggable_id]
0
+ else newitem.taggable_id = 0
0
@@ -198,7 +198,6 @@ class DataController < ApplicationController
0
newitem.created_at = adjust_time(item.ivars['attributes']['created_at'])
0
\ No newline at end of file