mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-05-25 01:13:03 -04:00
Added checkbox for whether to send planting reminder
This commit is contained in:
7
app/controllers/passwords_controller.rb
Normal file
7
app/controllers/passwords_controller.rb
Normal file
@@ -0,0 +1,7 @@
|
||||
class PasswordsController < Devise::PasswordsController
|
||||
|
||||
protected
|
||||
def after_resetting_password_path_for(resource)
|
||||
root_path
|
||||
end
|
||||
end
|
||||
@@ -13,11 +13,13 @@ class Notifier < ActionMailer::Base
|
||||
def planting_reminder(member)
|
||||
@member = member
|
||||
|
||||
@plantings = member.plantings.reorder.last(5)
|
||||
@harvests = member.harvests.reorder.last(5)
|
||||
@plantings = @member.plantings.reorder.last(5)
|
||||
@harvests = @member.harvests.reorder.last(5)
|
||||
|
||||
mail(:to => @member.email,
|
||||
:subject => "What have you planted lately?")
|
||||
if @member.send_planting_reminder
|
||||
mail(:to => @member.email,
|
||||
:subject => "What have you planted lately?")
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -42,8 +42,13 @@ class Member < ActiveRecord::Base
|
||||
|
||||
# Setup accessible (or protected) attributes for your model
|
||||
attr_accessible :login_name, :email, :password, :password_confirmation,
|
||||
:remember_me, :login, :tos_agreement, :show_email, :newsletter,
|
||||
:location, :latitude, :longitude, :send_notification_email, :bio
|
||||
:remember_me, :login,
|
||||
# terms of service
|
||||
:tos_agreement,
|
||||
# profile stuff
|
||||
:bio, :location, :latitude, :longitude,
|
||||
# email settings
|
||||
:show_email, :newsletter, :send_notification_email, :send_planting_reminder
|
||||
|
||||
# set up geocoding
|
||||
geocoded_by :location
|
||||
|
||||
@@ -16,16 +16,31 @@
|
||||
= f.check_box :show_email
|
||||
Show email publicly on your profile page
|
||||
|
||||
%h2
|
||||
Receive emails
|
||||
.control-group
|
||||
.controls
|
||||
= f.check_box :send_notification_email
|
||||
Receive emailed copies of Inbox notifications.
|
||||
Copies of messages from your Inbox
|
||||
.help-block
|
||||
Private messages from other members, comments on your posts, etc.
|
||||
.control-group
|
||||
.controls
|
||||
= f.check_box :send_planting_reminder
|
||||
Regular planting/harvest reminders
|
||||
.help-block
|
||||
We'll help you track your planting and harvesting more accurately.
|
||||
%strong
|
||||
This feature is in beta test.
|
||||
Email will not be sent automatically.
|
||||
= link_to "Click here to send one.", send_planting_reminder_path
|
||||
|
||||
|
||||
.control-group
|
||||
.controls
|
||||
= f.check_box :newsletter
|
||||
Subscribe to the #{ENV['GROWSTUFF_SITE_NAME']} newsletter
|
||||
.help-inline
|
||||
.help-block
|
||||
= render :partial => 'newsletter_blurb'
|
||||
|
||||
%h2 Profile details
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
- content_for :title, "Sent planting reminder"
|
||||
- content_for :title, "Planting reminder email (beta)"
|
||||
|
||||
%p
|
||||
We just sent you a planting reminder email.
|
||||
- if current_member.send_planting_reminder
|
||||
%p
|
||||
We just sent you a planting reminder email.
|
||||
- else
|
||||
%p
|
||||
Your profile settings say not to send you this email, so we haven't.
|
||||
|
||||
%p
|
||||
= link_to "Back to your profile", edit_member_registration_path
|
||||
|
||||
@@ -3,7 +3,8 @@ Growstuff::Application.routes.draw do
|
||||
resources :plant_parts
|
||||
|
||||
get '/members/send_planting_reminder' => 'members#send_planting_reminder', :as => 'send_planting_reminder'
|
||||
devise_for :members, :controllers => { :registrations => "registrations" }
|
||||
devise_for :members, :controllers => { :registrations => "registrations", :passwords => "passwords" }
|
||||
|
||||
resources :members
|
||||
|
||||
resources :photos
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
class AddSendPlantingReminderToMember < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :members, :send_planting_reminder, :boolean, :default => true
|
||||
end
|
||||
end
|
||||
21
db/schema.rb
21
db/schema.rb
@@ -11,7 +11,7 @@
|
||||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20131031000655) do
|
||||
ActiveRecord::Schema.define(:version => 20140720085713) do
|
||||
|
||||
create_table "account_types", :force => true do |t|
|
||||
t.string "name", :null => false
|
||||
@@ -51,13 +51,13 @@ ActiveRecord::Schema.define(:version => 20131031000655) do
|
||||
end
|
||||
|
||||
create_table "crops", :force => true do |t|
|
||||
t.string "name", :null => false
|
||||
t.string "name", :null => false
|
||||
t.string "en_wikipedia_url"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.string "slug"
|
||||
t.integer "parent_id"
|
||||
t.integer "plantings_count"
|
||||
t.integer "plantings_count", :default => 0
|
||||
t.integer "creator_id"
|
||||
end
|
||||
|
||||
@@ -139,6 +139,7 @@ ActiveRecord::Schema.define(:version => 20131031000655) do
|
||||
t.text "bio"
|
||||
t.integer "plantings_count"
|
||||
t.boolean "newsletter"
|
||||
t.boolean "send_planting_reminder", :default => true
|
||||
end
|
||||
|
||||
add_index "members", ["confirmation_token"], :name => "index_users_on_confirmation_token", :unique => true
|
||||
@@ -242,11 +243,11 @@ ActiveRecord::Schema.define(:version => 20131031000655) do
|
||||
add_index "posts", ["slug"], :name => "index_updates_on_slug", :unique => true
|
||||
|
||||
create_table "products", :force => true do |t|
|
||||
t.string "name", :null => false
|
||||
t.text "description", :limit => 255, :null => false
|
||||
t.integer "min_price", :null => false
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.string "name", :null => false
|
||||
t.text "description", :null => false
|
||||
t.integer "min_price", :null => false
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.integer "account_type_id"
|
||||
t.integer "paid_months"
|
||||
t.integer "recommended_price"
|
||||
|
||||
Reference in New Issue
Block a user