refinerycms-subscriptions 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,7 +3,7 @@ module Refinery
3
3
  class Subscription < Refinery::Core::BaseModel
4
4
  self.table_name = 'refinery_subscriptions'
5
5
 
6
- attr_accessible :email, :position
6
+ attr_accessible :email, :first_name, :last_name, :position
7
7
 
8
8
  acts_as_indexed :fields => [:email]
9
9
 
@@ -1,7 +1,9 @@
1
1
  <li class='clearfix record <%= cycle("on", "on-hover") %>' id="<%= dom_id(subscription) -%>">
2
2
  <span class='title'>
3
3
  <%= subscription.email %>
4
-
4
+ <% if subscription.first_name.present? or subscription.last_name.present? %>
5
+ <%= " - #{subscription.first_name} #{subscription.last_name}" %>
6
+ <% end %>
5
7
  </span>
6
8
  <span class='actions'>
7
9
 
@@ -1,5 +1,7 @@
1
1
  <div class='subscriptions'>
2
2
  <%= form_for [refinery, :subscriptions, @subscription] do |f| %>
3
+ <%= f.text_field :first_name, :placeholder => t('.first_name') %><br />
4
+ <%= f.text_field :last_name, :placeholder => t('.last_name') %><br />
3
5
  <%= f.email_field :email, :placeholder => t('.email') %>
4
6
  <%= f.submit t('.send') %>
5
7
  <% end %>
@@ -2,6 +2,14 @@
2
2
 
3
3
  <%=raw t('.you_received_new_subscription') %>
4
4
 
5
+ <% unless @subscription.first_name.blank? %>
6
+ <%=raw t('.first_name') %>: <%= @subscription.first_name %>
7
+
8
+ <% end %>
9
+ <% unless @subscription.last_name.blank? %>
10
+ <%=raw t('.last_name') %>: <%= @subscription.last_name %>
11
+
12
+ <% end %>
5
13
  <%=raw t('.email') %>: <%= @subscription.email %>
6
14
 
7
15
  <%=raw Refinery::Core.site_name %>
@@ -29,11 +29,15 @@ en:
29
29
  subscription:
30
30
  send: 'Subscribe'
31
31
  email: 'Email'
32
+ first_name: 'First name'
33
+ last_name: 'Last name'
32
34
  subscription_mailer:
33
35
  notification:
34
36
  greeting: Hi there
35
37
  you_received_new_subscription: You just received a new subscription to your newsletter.
36
38
  email: Email
39
+ first_name: First name
40
+ last_name: Last name
37
41
  closing_line: Kind Regards
38
42
  ps: P.S. All your subscriptions are stored in the "Subscriptions" section of Refinery should you ever want to view it later there.
39
43
  activerecord:
@@ -7,6 +7,8 @@ en:
7
7
  subscription:
8
8
  send: 'Prijavi se'
9
9
  email: 'Email'
10
+ first_name: 'Ime'
11
+ last_name: 'Prezime'
10
12
  activerecord:
11
13
  attributes:
12
14
  'refinery/subscriptions/subscription':
@@ -0,0 +1,8 @@
1
+ class AddNameToSubscriptions < ActiveRecord::Migration
2
+
3
+ def change
4
+ add_column :refinery_subscriptions, :first_name, :string
5
+ add_column :refinery_subscriptions, :last_name, :string
6
+ end
7
+
8
+ end
data/readme.md CHANGED
@@ -1,10 +1,38 @@
1
- # Subscriptions extension for Refinery CMS.
1
+ # Subscriptions engine for Refinery CMS.
2
2
 
3
- ## How to build this extension as a gem
3
+ ## About
4
4
 
5
- cd vendor/extensions/subscriptions
6
- gem build refinerycms-subscriptions.gemspec
7
- gem install refinerycms-subscriptions.gem
5
+ Simple Refinery's subscriptions engine that allow users to subscribe to newsletter.
8
6
 
9
- # Sign up for a http://rubygems.org/ account and publish the gem
10
- gem push refinerycms-subscriptions.gem
7
+
8
+ ### Features
9
+
10
+ * Frontend subscription form
11
+ * Email notification to admin
12
+ * *Confirm subscription - TODO*
13
+ * *Export emails to CSV - TODO*
14
+
15
+ ## Installation
16
+
17
+ Include gem into your Gemfile:
18
+
19
+ gem "refinerycms-subscriptions", '~> 0.0.1'
20
+
21
+ Inside your Refinery CMS application's root directory run:
22
+
23
+ bundle install
24
+ rails generate refinery:subscriptions
25
+ rake db:migrate
26
+ rake db:seed
27
+
28
+ ## Customize view
29
+
30
+ To customize view override subscription form by running
31
+
32
+ rake refinery:override view=refinery/subscriptions/shared/_subscription
33
+
34
+ ## Attribution
35
+
36
+ Inspired by and modeled like RefineryCMS Inquiries engine
37
+
38
+ https://github.com/refinery/refinerycms-inquiries
metadata CHANGED
@@ -1,11 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: refinerycms-subscriptions
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - Refactorit
9
+ - Ivan Lučev
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
@@ -87,6 +88,7 @@ files:
87
88
  - config/locales/hr.yml
88
89
  - config/routes.rb
89
90
  - db/migrate/1_create_subscriptions_subscriptions.rb
91
+ - db/migrate/2_add_name_to_subscriptions.rb
90
92
  - db/seeds.rb
91
93
  - lib/refinerycms-subscriptions.rb
92
94
  - lib/generators/refinery/subscriptions_generator.rb
@@ -94,7 +96,7 @@ files:
94
96
  - lib/refinery/subscriptions/engine.rb
95
97
  - lib/tasks/refinery/subscriptions.rake
96
98
  - readme.md
97
- homepage:
99
+ homepage: https://github.com/refactorit/refinerycms-subscriptions
98
100
  licenses: []
99
101
  post_install_message:
100
102
  rdoc_options: []