Skip to content

Commit

Permalink
add download as csv for members
Browse files Browse the repository at this point in the history
  • Loading branch information
mumoc committed Mar 18, 2012
1 parent d7167e9 commit 58ab635
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 2 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
source 'http://rubygems.org'

gem 'rails', '3.1.3'
gem 'comma', '~> 3.0'

gem 'forem', :git => "git://github.com/mumo/forem.git"
gem 'forem-redcarpet', :git => "git://github.com/radar/forem-redcarpet"
Expand Down
2 changes: 2 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ GEM
coffee-script-source
execjs
coffee-script-source (1.2.0)
comma (3.0.3)
devise (1.5.3)
bcrypt-ruby (~> 3.0)
orm_adapter (~> 0.0.3)
Expand Down Expand Up @@ -199,6 +200,7 @@ PLATFORMS
DEPENDENCIES
cocoon
coffee-rails (~> 3.1.1)
comma (~> 3.0)
devise
dragonfly (~> 0.9.9)
fog
Expand Down
8 changes: 7 additions & 1 deletion app/controllers/admin/members_controller.rb
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
class Admin::MembersController < Admin::ResourceController
end
respond_to :csv

def report
@members = Member.all
respond_with @members
end
end
14 changes: 14 additions & 0 deletions app/models/member.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,20 @@ class Member < ActiveRecord::Base

devise :database_authenticatable

comma do
title
first_name
last_name
email
first_name 'Password'
street
colony
city
state
local_phone
cel_phone
end

extend FriendlyId
friendly_id :last_name, use: :slugged

Expand Down
1 change: 1 addition & 0 deletions app/views/admin/members/index.html.haml
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
= link_to 'Download', '/admin/members/download.csv'
= render "index", attributes: %w(title first_name last_name email)
4 changes: 3 additions & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@
namespace :admin do
root to: 'events#index'
resources :events
resources :members
resources :members do
get 'download', action: :report, on: :collection
end
resources :adresses
resources :banners
end
Expand Down

0 comments on commit 58ab635

Please sign in to comment.