homing 0.1.0 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/app/controllers/emails_controller.rb +14 -0
- data/app/views/emails/new.html.haml +13 -0
- data/config/locales/homing.en.yml +3 -0
- data/config/routes.rb +1 -0
- metadata +6 -4
@@ -3,4 +3,18 @@ class EmailsController < ApplicationController
|
|
3
3
|
@email = Email.find_by_unsubscribe_token(params[:unsubscribe_token])
|
4
4
|
@email.unsubscribe! if @email && @email.active?
|
5
5
|
end
|
6
|
+
|
7
|
+
def new
|
8
|
+
@email = Email.new
|
9
|
+
end
|
10
|
+
|
11
|
+
def create
|
12
|
+
if params[:email][:address].present? &&
|
13
|
+
@email = Email.find_or_create_by_address(params[:email][:address])
|
14
|
+
@email.unsubscribe! if @email.active?
|
15
|
+
redirect_to(root_url, :notice => t(:unsubscribe_message))
|
16
|
+
else
|
17
|
+
redirect_to(new_email_url, :notice => t(:invalid_email))
|
18
|
+
end
|
19
|
+
end
|
6
20
|
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
%br/
|
2
|
+
Please enter your email to be unsubscribed:
|
3
|
+
%br/
|
4
|
+
= form_for @email do |f|
|
5
|
+
-if @email.errors.any?
|
6
|
+
%ul
|
7
|
+
- @email.errors.full_messages.each do |msg|
|
8
|
+
%li= msg
|
9
|
+
%p
|
10
|
+
= f.label :address
|
11
|
+
= f.text_field :address
|
12
|
+
%p
|
13
|
+
= f.submit "Unsubscribe"
|
data/config/routes.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: homing
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 29
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 3
|
10
|
+
version: 0.1.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Codrea
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-08-
|
18
|
+
date: 2011-08-16 00:00:00 -04:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -46,7 +46,9 @@ files:
|
|
46
46
|
- app/models/campaign.rb
|
47
47
|
- app/models/email.rb
|
48
48
|
- app/models/recipient.rb
|
49
|
+
- app/views/emails/new.html.haml
|
49
50
|
- app/views/emails/unsubscribe.html.haml
|
51
|
+
- config/locales/homing.en.yml
|
50
52
|
- config/routes.rb
|
51
53
|
- lib/generators/homing/homing_generator.rb
|
52
54
|
- lib/generators/homing/templates/create_campaigns.rb
|