hyalin 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/app/controllers/hyalin/messages_controller.rb +5 -16
- data/app/mailers/hyalin/postman.rb +13 -8
- data/app/models/hyalin/message.rb +2 -2
- data/app/views/hyalin/postman/contact_email.html.erb +7 -0
- data/app/views/hyalin/postman/contact_email.text.plain.erb +6 -0
- data/config/locales/hyalin.en.yml +25 -3
- data/config/locales/hyalin.pt-BR.yml +8 -3
- data/lib/hyalin/version.rb +1 -1
- data/test/dummy/config/locales/hyalin.en.yml +1 -1
- metadata +2 -3
- data/app/helpers/hyalin/application_helper.rb +0 -4
- data/app/helpers/hyalin/messages_helper.rb +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 81722c7355161e2ee9187c20638c1f19b69ed343
|
4
|
+
data.tar.gz: c92171e1b04123b26b218f765ccc34f383945d1c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e82a3198f262fe5de3949ef3c8a1ab6b39bc0165b0a3330dd4c049112d298df6878859c6a75602773982e3df88ba2538bd6519f4453e26040c5005daf6e46723
|
7
|
+
data.tar.gz: 1d00fabf57a407d7b52a4d76665c00354c5440f69cb0a520ab2a4e06f6a4240713eb1e91013baf8b4518a97b2792a950a6ceaf07d1e0ac3a6b7bfccc0092ecd5
|
data/README.md
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
## Hyalin (paper)
|
2
2
|
|
3
|
-
A Rails
|
3
|
+
A Rails 4+ Engine providing a basic contact form.
|
4
4
|
|
5
5
|
## Requirements
|
6
6
|
|
7
7
|
Hyalin requires:
|
8
8
|
|
9
|
-
* Ruby >=
|
10
|
-
* Rails >=
|
9
|
+
* Ruby >= 2.0.0
|
10
|
+
* Rails >= 4.0.0
|
11
11
|
|
12
12
|
It is also recommended to use SimpleForm in order to hook into your apps custom form builders.
|
13
13
|
Heavily inspired on [jdutil/contact_us](https://github.com/jdutil/contact_us)
|
@@ -2,32 +2,21 @@ require_dependency "hyalin_controller"
|
|
2
2
|
|
3
3
|
module Hyalin
|
4
4
|
class MessagesController < HyalinController
|
5
|
+
respond_to :html, :json
|
5
6
|
|
6
7
|
# GET /message/new
|
7
8
|
# GET /message/new.json
|
8
9
|
def new
|
9
10
|
@message = Message.new
|
10
|
-
|
11
|
-
respond_to do |format|
|
12
|
-
format.html
|
13
|
-
format.json { render :json => @message }
|
14
|
-
end
|
11
|
+
respond_with @message
|
15
12
|
end
|
16
13
|
|
17
14
|
# POST /messages
|
18
15
|
# POST /messages.json
|
19
16
|
def create
|
20
|
-
@message = Message.new
|
21
|
-
|
22
|
-
|
23
|
-
if @message.save
|
24
|
-
format.html { redirect_to after_send_path, :notice => t('hyalin.messages.sent_success') }
|
25
|
-
format.json { render :json => @message, :status => :created, :location => @message }
|
26
|
-
else
|
27
|
-
format.html { render_new_action }
|
28
|
-
format.json { render :json => {errors: @message.errors}, :status => :unprocessable_entity }
|
29
|
-
end
|
30
|
-
end
|
17
|
+
@message = Message.new params[:message]
|
18
|
+
@message.save
|
19
|
+
respond_with @message, location: after_send_path, notice: t('hyalin.messages.sent_success')
|
31
20
|
end
|
32
21
|
|
33
22
|
private
|
@@ -1,16 +1,21 @@
|
|
1
1
|
class Hyalin::Postman < ActionMailer::Base
|
2
|
-
default :
|
3
|
-
:
|
4
|
-
:
|
2
|
+
default from: Hyalin.mailer_from,
|
3
|
+
subject: -> { generate_default_subject },
|
4
|
+
to: Hyalin.mailer_to
|
5
5
|
|
6
6
|
# TODO Create Hyalin.mailer_layout
|
7
|
-
layout 'hyalin/postman'
|
7
|
+
# layout 'hyalin/postman'
|
8
8
|
|
9
|
-
def
|
9
|
+
def contact_email message
|
10
10
|
@message = message
|
11
11
|
|
12
|
-
mail :
|
13
|
-
:
|
14
|
-
|
12
|
+
mail from: message.email,
|
13
|
+
reply_to: message.email
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def generate_default_subject
|
19
|
+
t 'hyalin.postman.contact_email.subject', name: @message.name || @message.email
|
15
20
|
end
|
16
21
|
end
|
@@ -14,12 +14,12 @@ module Hyalin
|
|
14
14
|
# messages
|
15
15
|
|
16
16
|
if Hyalin.persist_messages
|
17
|
-
validate :persisted?, :message => 'Can\'t update
|
17
|
+
validate :persisted?, :message => 'Can\'t update contact messages!'
|
18
18
|
end
|
19
19
|
|
20
20
|
def save
|
21
21
|
if self.valid?
|
22
|
-
Hyalin::Postman.
|
22
|
+
Hyalin::Postman.contact_email(self).deliver
|
23
23
|
super if Hyalin.persist_messages
|
24
24
|
return true
|
25
25
|
|
@@ -1,12 +1,34 @@
|
|
1
1
|
en:
|
2
|
+
mongoid:
|
3
|
+
models:
|
4
|
+
hyalin/message:
|
5
|
+
one: Contact Message
|
6
|
+
other: Contact Messages
|
7
|
+
attributes:
|
8
|
+
timestamps: ×tamps
|
9
|
+
created_at: Created At
|
10
|
+
updated_at: Updated At
|
11
|
+
hyalin/message:
|
12
|
+
<<: *timestamps
|
13
|
+
name: Name
|
14
|
+
body: Message
|
15
|
+
email: Email
|
16
|
+
phone: Phone
|
17
|
+
subject: Subject
|
18
|
+
|
2
19
|
hyalin:
|
20
|
+
postman:
|
21
|
+
contact_email:
|
22
|
+
subject: 'Contact: %{name}'
|
23
|
+
sent_by_name: "Sent by %{name} from %{email} (%{phone})"
|
3
24
|
messages:
|
4
25
|
sent_success: Message delivered!
|
5
26
|
new: &hyalin-message
|
6
27
|
title: Contact Us
|
7
28
|
submit: Send Message
|
29
|
+
message: Message
|
30
|
+
submit: Send Message
|
8
31
|
new_simple_form:
|
9
32
|
<<: *hyalin-message
|
10
|
-
|
11
|
-
|
12
|
-
sent_by_name: 'Sent By:'
|
33
|
+
|
34
|
+
|
@@ -1,5 +1,5 @@
|
|
1
1
|
pt-BR:
|
2
|
-
|
2
|
+
mongoid:
|
3
3
|
models:
|
4
4
|
hyalin/message:
|
5
5
|
one: Mensagem de Contato
|
@@ -12,10 +12,15 @@ pt-BR:
|
|
12
12
|
<<: *timestamps
|
13
13
|
name: Nome
|
14
14
|
body: Mensagem
|
15
|
+
email: Email
|
16
|
+
phone: Telefone
|
17
|
+
subject: Assunto
|
18
|
+
|
15
19
|
hyalin:
|
16
20
|
postman:
|
17
|
-
|
18
|
-
|
21
|
+
contact_email:
|
22
|
+
subject: 'Contato: %{name}'
|
23
|
+
sent_by_name: 'Enviado por %{name} de %{email} (%{phone})'
|
19
24
|
messages:
|
20
25
|
sent_success: Mensagem enviada!
|
21
26
|
new: &hyalin-message
|
data/lib/hyalin/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hyalin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Heitor Salazar
|
@@ -93,13 +93,12 @@ files:
|
|
93
93
|
- app/assets/stylesheets/hyalin/messages.css
|
94
94
|
- app/controllers/hyalin/messages_controller.rb
|
95
95
|
- app/controllers/hyalin_controller.rb
|
96
|
-
- app/helpers/hyalin/application_helper.rb
|
97
|
-
- app/helpers/hyalin/messages_helper.rb
|
98
96
|
- app/mailers/hyalin/postman.rb
|
99
97
|
- app/models/hyalin/message.rb
|
100
98
|
- app/views/hyalin/messages/new.html.erb
|
101
99
|
- app/views/hyalin/messages/show.html.erb
|
102
100
|
- app/views/hyalin/postman/contact_email.html.erb
|
101
|
+
- app/views/hyalin/postman/contact_email.text.plain.erb
|
103
102
|
- config/locales/contact.en.yml~
|
104
103
|
- config/locales/contact.pt-BR.yml~
|
105
104
|
- config/locales/hyalin.en.yml
|