forked from sxysxy/wblog
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
29 changed files
with
132 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,7 +48,6 @@ | |
} | ||
|
||
.recent-title { | ||
border-bottom: 1px solid #DCDCDC; | ||
margin-bottom: 1rem; | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
class UnsubscribesController < ApplicationController | ||
def index | ||
end | ||
|
||
def new | ||
@subscribe = Subscribe.new | ||
end | ||
|
||
def create | ||
subscribe = Subscribe.find_or_initialize_by(email: params[:email]) | ||
subscribe.enable = false | ||
subscribe.save | ||
|
||
flash[:notice] = "退订成功: #{params[:email]}" | ||
redirect_to unsubscribes_path | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
.row | ||
.large-9.large-centered.columns | ||
h2 退订服务 | ||
hr | ||
form action='' ng-controller='SubscribesController' | ||
.row | ||
.small-12.large-6.columns | ||
= text_field_tag :email, nil, placeholder: '[email protected]', 'ng-model' => 'email' | ||
button ng-click="cancel()" 退订 | ||
h2 订阅成功, 我们将提供: | ||
|
||
ul | ||
li 第一时间新博客邮件通知 | ||
li 有相关评论 @ 你的时候邮件通知 | ||
|
||
p 你可以随时取消订阅 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
.row | ||
.small-12.medium-12.large-9.columns | ||
h2 订阅 | ||
|
||
= simple_form_for @subscribe do |f| | ||
= f.input :email | ||
= f.button :submit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.row | ||
.large-9.large-centered.columns | ||
h4 退订成功 | ||
|
||
p 我们将不再向你发送任何邮件 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
.row | ||
.large-9.large-centered.columns | ||
h2 退订服务 | ||
hr | ||
= simple_form_for @subscribe, url: unsubscribes_path do |f| | ||
.row | ||
.small-12.large-6.columns | ||
= f.input :email, placeholder: '[email protected]' | ||
= f.submit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
en: | ||
simple_form: | ||
"yes": '是' | ||
"no": '否' | ||
required: | ||
text: '必须的' | ||
mark: '*' | ||
# You can uncomment the line below if you need to overwrite the whole required html. | ||
# When using html, text and mark won't be used. | ||
# html: '<abbr title="required">*</abbr>' | ||
error_notification: | ||
default_message: "请检查以下问题:" | ||
# Examples | ||
# labels: | ||
# defaults: | ||
# password: 'Password' | ||
# user: | ||
# new: | ||
# email: 'E-mail to sign in.' | ||
# edit: | ||
# email: 'E-mail.' | ||
# hints: | ||
# defaults: | ||
# username: 'User name to sign in.' | ||
# password: 'No special characters, please.' | ||
# include_blanks: | ||
# defaults: | ||
# age: 'Rather not say' | ||
# prompts: | ||
# defaults: | ||
# age: 'Select your age' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,15 +4,13 @@ | |
|
||
describe "POST 'create'" do | ||
it "post ok" do | ||
post 'create', email: '[email protected]' | ||
expect(JSON.parse(response.body)['success']).to be_truthy | ||
post 'create', { subscribe: { email: '[email protected]' } } | ||
expect(Subscribe.all.size).to eq(1) | ||
end | ||
|
||
it "post with disabled email" do | ||
subscribe = Subscribe.create(email: '[email protected]', enable: false) | ||
post 'create', email: '[email protected]' | ||
expect(JSON.parse(response.body)['success']).to be_truthy | ||
post 'create', { subscribe: { email: '[email protected]' } } | ||
expect(subscribe.reload.enable).to be_truthy | ||
end | ||
end | ||
|