mirror of
https://github.com/TracksApp/tracks.git
synced 2026-01-04 00:08:50 +01:00
Added tags to YAML, CSV and XML export.
git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@633 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
parent
574f269d54
commit
83df7916da
2 changed files with 9 additions and 4 deletions
|
|
@ -20,6 +20,8 @@ class DataController < ApplicationController
|
|||
all_tables['todos'] = current_user.todos.find(:all)
|
||||
all_tables['contexts'] = current_user.contexts.find(:all)
|
||||
all_tables['projects'] = current_user.projects.find(:all)
|
||||
all_tables['tags'] = current_user.tags.find(:all)
|
||||
all_tables['taggings'] = current_user.taggings.find(:all)
|
||||
all_tables['notes'] = current_user.notes.find(:all)
|
||||
|
||||
result = all_tables.to_yaml
|
||||
|
|
@ -30,7 +32,7 @@ class DataController < ApplicationController
|
|||
def csv_actions
|
||||
content_type = 'text/csv'
|
||||
CSV::Writer.generate(result = "") do |csv|
|
||||
csv << ["id", "Context", "Project", "Description", "Notes",
|
||||
csv << ["id", "Context", "Project", "Description", "Notes", "Tags",
|
||||
"Created at", "Due", "Completed at", "User ID", "Show from",
|
||||
"state"]
|
||||
current_user.todos.find(:all, :include => [:context, :project]).each do |todo|
|
||||
|
|
@ -39,7 +41,8 @@ class DataController < ApplicationController
|
|||
csv << [todo.id, todo.context.name,
|
||||
todo.project_id = todo.project_id.nil? ? "" : todo.project.name,
|
||||
todo.description,
|
||||
todo.notes, todo.created_at.to_formatted_s(:db),
|
||||
todo.notes, todo.tags.collect{|t| t.name}.join(', '),
|
||||
todo.created_at.to_formatted_s(:db),
|
||||
todo.due = todo.due? ? todo.due.to_formatted_s(:db) : "",
|
||||
todo.completed_at = todo.completed_at? ? todo.completed_at.to_formatted_s(:db) : "",
|
||||
todo.user_id,
|
||||
|
|
@ -74,6 +77,8 @@ class DataController < ApplicationController
|
|||
result << current_user.todos.find(:all).to_xml
|
||||
result << current_user.contexts.find(:all).to_xml(:skip_instruct => true)
|
||||
result << current_user.projects.find(:all).to_xml(:skip_instruct => true)
|
||||
result << current_user.tags.find(:all).to_xml(:skip_instruct => true)
|
||||
result << current_user.taggings.find(:all).to_xml(:skip_instruct => true)
|
||||
result << current_user.notes.find(:all).to_xml(:skip_instruct => true)
|
||||
send_data(result, :filename => "tracks_backup.xml", :type => 'text/xml')
|
||||
end
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
<th>Download link</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>YAML file containing all your actions, contexts, projects and notes</td>
|
||||
<td>YAML file containing all your actions, contexts, projects, tags and notes</td>
|
||||
<td><%= link_to "YAML file", :controller => 'data', :action => 'yaml_export' %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
|
@ -28,7 +28,7 @@
|
|||
<td><%= link_to "CSV file (notes only)", :controller => 'data', :action => 'csv_notes' %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>XML file containing all your actions, contexts, projects and notes</td>
|
||||
<td>XML file containing all your actions, contexts, projects, tags and notes</td>
|
||||
<td><%= link_to "XML file (actions only)", :controller => 'data', :action => 'xml_export' %></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue