Skip to content

Commit

Permalink
remove share module from subscription in webiva core
Browse files Browse the repository at this point in the history
  • Loading branch information
Tia committed Mar 4, 2010
1 parent a1425cf commit 764b8a7
Show file tree
Hide file tree
Showing 13 changed files with 1 addition and 193 deletions.
2 changes: 0 additions & 2 deletions app/controllers/emarketing_controller.rb
Expand Up @@ -17,8 +17,6 @@ def index
"View and Track Visitors to your site" ],
[ "Real Time Statistics", :editor_visitors, "emarketing_statistics.gif", { :action => 'stats' },
"View Real Time Visits to your site" ],
[ "Tell-a-Friend Emails", :editor_content, "emarketing_members.gif", { :controller => "/subscription",:action => "tell_friends" },
"See emails sent with Tell-a-friend" ],
[ "Subscriptions", :editor_mailing,"emarketing_subscriptions.gif", { :controller => '/subscription' },
"Edit Newsletters and Mailing Lists Subscriptions" ],
[ "Email Templates", :editor_mailing,"emarketing_templates.gif", { :controller => '/mail_manager', :action => 'templates' },
Expand Down
93 changes: 1 addition & 92 deletions app/controllers/subscription_controller.rb
Expand Up @@ -7,8 +7,7 @@ class SubscriptionController < CmsController # :nodoc: all
permit ['editor_mailing','editor_content']

cms_admin_paths 'e_marketing',
'Emarketing' => { :controller => '/emarketing' },
'Tell-a-Friend' => {:action => 'tell_friends' }
'Emarketing' => { :controller => '/emarketing' }

include ActiveTable::Controller
active_table :subscription_table, UserSubscription,
Expand Down Expand Up @@ -116,96 +115,6 @@ def download

end

active_table :email_friend_table, EmailFriend,
[ ActiveTable::IconHeader.new('',:width => 10),
ActiveTable::StringHeader.new('from_name'),
ActiveTable::StringHeader.new('end_users.email', :label => 'User'),
ActiveTable::StringHeader.new('to_email'),
ActiveTable::StringHeader.new('site_url'),
ActiveTable::DateRangeHeader.new('sent_at')
]

def tell_friends
cms_page_path [ 'Emarketing'],'Tell-a-Friend'

display_email_friend_table(false)
end

def display_email_friend_table(display = true)

@tbl = email_friend_table_generate params, :order => 'sent_at DESC', :include => :end_user

render :partial => 'email_friend_table' if display

end

def email_friend
@entry = EmailFriend.find_by_id(params[:path][0])

render :partial => 'email_friend'
end

active_table :email_friend_group_table, EmailFriend,
[ ActiveTable::StringHeader.new('site_url'),
ActiveTable::NumberHeader.new('count'),
ActiveTable::DateRangeHeader.new('sent_at')
]

def tell_friends_group
cms_page_path [ 'Emarketing','Tell-a-Friend'],'Statistics'

display_email_friend_group_table(false)

end

def tell_friends_download_all
@tbl = email_friend_table_generate params, :order => 'sent_at DESC', :include => :end_user, :all => 1

output = ''

CSV::Writer.generate(output) do |csv|
csv << [ 'From Name', 'From Email', 'To Email', 'Site Url', 'Sent At' ]
@tbl[1].each { |t| csv << [ t.from_name,t.end_user ? t.end_user.email : '-', t.to_email, t.site_url,t.sent_at.strftime(DEFAULT_DATETIME_FORMAT.t) ] }
end


send_data(output,
:stream => true,
:type => "text/csv",
:disposition => 'attachment',
:filename => "send_to_friend_statistics.csv"
)

end

def download_group_data
@tbl = email_friend_group_table_generate params,:order => 'sent_at DESC', :group => 'site_url',:select => 'COUNT(*) as count, site_url,MAX(sent_at) as sent_max, MIN(sent_at) as sent_min', :count_by => 'site_url', :all => 1

output = ''
CSV::Writer.generate(output) do |csv|
csv << [ 'Site Url', 'Count','Sent Between' ]
@tbl[1].each { |t| csv << [ t.count,t.site_url, "#{t.sent_min ? Time.parse(t.sent_min).strftime(DEFAULT_DATE_FORMAT.t) : '-'} - #{t.sent_max ? Time.parse(t.sent_max).strftime(DEFAULT_DATE_FORMAT.t) : '-'}" ] }
end


send_data(output,
:stream => true,
:type => "text/csv",
:disposition => 'attachment',
:filename => "send_to_friend_statistics.csv"
)
end

def display_email_friend_group_table(display=true)

@tbl =email_friend_group_table_generate params, :order => 'sent_at DESC', :group => 'site_url',:select => 'COUNT(*) as count, site_url,MAX(sent_at) as sent_max, MIN(sent_at) as sent_min', :count_by => 'site_url'

render :partial => 'email_friend_group_table' if display
end

def view_email
@email = EmailFriend.find_by_id(params[:path][0])
render :partial => 'email_friend'
end

end
8 changes: 0 additions & 8 deletions app/models/email_friend.rb

This file was deleted.

1 change: 0 additions & 1 deletion app/models/end_user.rb
Expand Up @@ -76,7 +76,6 @@ class EndUser < DomainModel

has_many :end_user_cookies, :dependent => :delete_all, :class_name => 'EndUserCookie'

has_many :email_friends, :dependent => :delete_all
has_many :end_user_actions, :dependent => :delete_all

has_many :end_user_tokens, :dependent => :delete_all, :include => [ :access_token ]
Expand Down
11 changes: 0 additions & 11 deletions app/views/subscription/_email_friend.rhtml

This file was deleted.

7 changes: 0 additions & 7 deletions app/views/subscription/_email_friend_group_table.rhtml

This file was deleted.

10 changes: 0 additions & 10 deletions app/views/subscription/_email_friend_table.rhtml

This file was deleted.

17 changes: 0 additions & 17 deletions app/views/subscription/tell_friends.rhtml

This file was deleted.

15 changes: 0 additions & 15 deletions app/views/subscription/tell_friends_group.rhtml

This file was deleted.

15 changes: 0 additions & 15 deletions db/migrate/062_add_email_friend_table.rb
@@ -1,22 +1,7 @@
class AddEmailFriendTable < ActiveRecord::Migration
def self.up
create_table :email_friends do |t|
t.integer :end_user_id
t.string :from_name
t.string :to_email
t.string :page_title
t.string :page_url
t.text :message
t.datetime :sent_at
t.string :ip_address
t.string :session
end

add_index :email_friends, [ :sent_at, :ip_address ], :name => 'sent_ip'
add_index :email_friends, [ :end_user_id, :sent_at ], :name => 'sending_user'
end

def self.down
drop_table :email_friends
end
end
3 changes: 0 additions & 3 deletions db/migrate/079_add_email_friends_url.rb
@@ -1,10 +1,7 @@
class AddEmailFriendsUrl < ActiveRecord::Migration
def self.up
add_column :email_friends, :site_url, :string
add_index :email_friends, [ :site_url, :sent_at ], :name => 'url_index'
end

def self.down
remove_column :email_friends, :site_url
end
end
6 changes: 0 additions & 6 deletions spec/fixtures/files/book-import.csv

This file was deleted.

6 changes: 0 additions & 6 deletions spec/fixtures/files/book-import2.csv

This file was deleted.

0 comments on commit 764b8a7

Please sign in to comment.