Skip to content

Commit

Permalink
tweak lead forms
Browse files Browse the repository at this point in the history
  • Loading branch information
mreq committed Nov 19, 2018
1 parent 4de5e21 commit ec2988b
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 10 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Change Log
All notable changes to this project will be documented in this file.

## 2018-11-19
### Changed
- Changed `Lead` - `skip_email_validation?` to public

## 2018-11-11
### Added
- Added image `alt` and document `title` fields.
Expand Down
10 changes: 10 additions & 0 deletions app/assets/stylesheets/folio/_loader.sass
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
$folio-loader-background: rgba(255, 255, 255, 0.8) !default
$folio-loader-foreground: black !default

$folio-loader-inverse-background: rgba(0, 0, 0, 0.8) !default
$folio-loader-inverse-foreground: white !default

@keyframes load8
0%
transform: rotate(0deg)
Expand Down Expand Up @@ -48,3 +51,10 @@ $folio-loader-foreground: black !default

&.folio-loader-transparent
background-color: transparent

.folio-inversed-loader &
background: $folio-loader-inverse-background

&:before
border-color: rgba($folio-loader-inverse-foreground, 0.2)
border-left-color: $folio-loader-inverse-foreground
7 changes: 3 additions & 4 deletions app/cells/folio/lead_form/show.slim
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,16 @@
= f.input :name, label: t('.name')

.row.folio-lead-form__email-phone-row
.col-sm
.col-sm.folio-lead-form__email-col
= f.input :email, as: :email, label: t('.email')

.col-sm
.col-sm.folio-lead-form__phone-col
= f.input :phone, label: t('.phone')

.row.folio-lead-form__note-row
.col-sm
= f.input :note, label: note_label, \
placeholder: t('.note_placeholder'), \
input_html: { value: note, rows: 3 }
input_html: { value: note, rows: note_rows }

== options[:above_submit_content] if options[:above_submit_content].present?

Expand Down
5 changes: 5 additions & 0 deletions app/cells/folio/lead_form_cell.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ def message
t('.message')
end

def note_rows
return options[:note_rows] if options[:note_rows]
3
end

def remember_option_keys
LeadsController::REMEMBER_OPTION_KEYS
end
Expand Down
1 change: 1 addition & 0 deletions app/controllers/folio/leads_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class LeadsController < ApplicationController
:message,
:name,
:note_label,
:note_rows,
:above_submit_content,
]

Expand Down
8 changes: 4 additions & 4 deletions app/models/folio/lead.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@ def csv_attributes
end
end

private
def skip_email_validation?
false
end

def skip_email_validation?
false
end
private

def skip_note_validation?
false
Expand Down
5 changes: 4 additions & 1 deletion app/views/folio/console/leads/show.slim
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ table.table
td = Folio::Lead.human_attribute_name(:email)
td
- if @lead.email.present?
= mail_to(@lead.email, @lead.email)
- if @lead.skip_email_validation?
= @lead.email
- else
= mail_to(@lead.email, @lead.email)
- else
= t('.blank')

Expand Down
1 change: 0 additions & 1 deletion config/locales/cs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ cs:
phone: Telefon
submit: Odeslat
note: Zpráva
note_placeholder: ''
message: Děkujeme za zaslání Vaší zprávy!
failure: Zprávu se nepodařilo odeslat. Zkuste to prosíme později.

Expand Down

0 comments on commit ec2988b

Please sign in to comment.