Skip to content

Commit

Permalink
Use CSS for required labels.
Browse files Browse the repository at this point in the history
  • Loading branch information
parndt committed May 20, 2015
1 parent ebc0a98 commit a8e3902
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 6 deletions.
3 changes: 3 additions & 0 deletions app/assets/stylesheets/refinery/inquiries/inquiries.css.scss
Expand Up @@ -4,6 +4,9 @@
label {
width: 150px;
float: left;
&.required:after {
content:" *"
}
}
input {
width: 200px;
Expand Down
8 changes: 4 additions & 4 deletions app/views/refinery/inquiries/inquiries/_form.html.erb
Expand Up @@ -5,12 +5,12 @@
:include_object_name => true
} %>
<div class="field">
<%= f.required_label :name, :class => 'placeholder-fallback' %>
<%= f.label :name, :class => 'placeholder-fallback required' %>
<%= f.text_field :name, :class => 'text', :required => 'required',
:placeholder => (t('name', :scope => 'activerecord.attributes.refinery/inquiries/inquiry') if Refinery::Inquiries.show_placeholders) %>
</div>
<div class="field">
<%= f.required_label :email, :class => 'placeholder-fallback' %>
<%= f.label :email, :class => 'placeholder-fallback required' %>
<%= f.email_field :email, :class => 'text email', :required => 'required',
:placeholder => (t('email', :scope => 'activerecord.attributes.refinery/inquiries/inquiry') if Refinery::Inquiries.show_placeholders) %>
</div>
Expand All @@ -24,12 +24,12 @@
<% end %>

<div class='field message_field'>
<%= f.required_label :message, :class => 'placeholder-fallback' %>
<%= f.label :message, :class => 'placeholder-fallback required' %>
<%= f.text_area :message, :rows => 8, :required => 'required',
:placeholder => (t('message', :scope => 'activerecord.attributes.refinery/inquiries/inquiry') if Refinery::Inquiries.show_placeholders) %>
</div>
<div class="actions">
<%= f.submit t('.send') %>
<%= link_to t('.privacy_policy'), "/pages/privacy-policy", :id => "privacy_link" if Refinery::Inquiries.show_contact_privacy_link %>
</div>
<% end %>
<% end %>
4 changes: 3 additions & 1 deletion lib/refinery/inquiries/engine.rb
Expand Up @@ -5,13 +5,15 @@ class Engine < Rails::Engine

isolate_namespace Refinery::Inquiries

initializer "init plugin" do
before_inclusion do
Refinery::Plugin.register do |plugin|
plugin.pathname = root
plugin.name = "refinerycms_inquiries"
plugin.url = proc { Refinery::Core::Engine.routes.url_helpers.inquiries_admin_inquiries_path }
plugin.menu_match = %r{refinery/inquiries(/.+?)?$}
end

Rails.application.config.assets.precompile += %w(refinery/inquiries/*)
end

config.after_initialize do
Expand Down
15 changes: 14 additions & 1 deletion readme.md
Expand Up @@ -6,7 +6,9 @@

Include the latest [gem](http://rubygems.org/gems/refinerycms-inquiries) into your Refinery CMS application's Gemfile:

gem 'refinerycms-inquiries', '~> 2.0.0'
```ruby
gem 'refinerycms-inquiries', '~> 3.0.0'
```

Then type the following at command line inside your Refinery CMS application's root directory:

Expand All @@ -23,6 +25,17 @@ Add pages to the database and you're done:

rake db:seed

#### Optionally include the stylesheet.

Next, you can include the stylesheet that improves the form's display a bit,
and also adds an asterisk to each `required` label: `Name *` instead of `Name`.

To do this, include it in your `application.css` manifest file and insert:

```css
//= require refinery/theme
```

## About

__Add a simple contact form to Refinery that notifies you and the customer when an inquiry is made.__
Expand Down

0 comments on commit a8e3902

Please sign in to comment.