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 = {}) def to_csv(options = {})
CSV.generate(options) do |csv| CSV.generate(options) do |csv|
csv << ["id", "name", "permission", "user.name"] csv << ["id", "name", "metacode", "user.name", "permission"]
self.topics.each do |topic| self.topics.each do |topic|
csv << [ csv << [
topic.id, topic.id,
topic.name, topic.name,
topic.permission, topic.metacode.name,
topic.user.name topic.user.name,
topic.permission
] ]
end end
end end

View file

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