added metacode to the xls and csv views

This commit is contained in:
Devin Howard 2015-03-01 13:13:52 -05:00
parent b5b13841bc
commit 657925e0e2
2 changed files with 8 additions and 5 deletions

View file

@ -84,13 +84,14 @@ class Map < ActiveRecord::Base
def to_csv(options = {})
CSV.generate(options) do |csv|
csv << ["id", "name", "permission", "user.name"]
csv << ["id", "name", "metacode", "user.name", "permission"]
self.topics.each do |topic|
csv << [
topic.id,
topic.name,
topic.permission,
topic.user.name
topic.metacode.name,
topic.user.name,
topic.permission
]
end
end

View file

@ -2,15 +2,17 @@
<tr>
<th>ID</th>
<th>Name</th>
<th>Permission</th>
<th>Metacode</th>
<th>Username</th>
<th>Permission</th>
</tr>
<% @map.topics.each do |topic| %>
<tr>
<td><%= topic.id %></td>
<td><%= topic.name %></td>
<td><%= topic.permission %></td>
<td><%= topic.metacode.name %></td>
<td><%= topic.user.name %></td>
<td><%= topic.permission %></td>
</tr>
<% end %>
</table>