spree_contact_form 3.0.6 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,13 @@
1
+ module Spree
2
+ module Admin
3
+ class ContactTopicsController < ResourceController
4
+
5
+ # create.wants.html { redirect_to collection_path }
6
+ # update.wants.html { redirect_to collection_path }
7
+ #
8
+ # new_action.response do |wants|
9
+ # wants.html {render :action => :new, :layout => !request.xhr?}
10
+ # end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,25 @@
1
+ module Spree
2
+ class ContactController < BaseController
3
+ before_filter :load_topics
4
+
5
+ def show
6
+ @message = Message.new
7
+ end
8
+
9
+ def create
10
+ @message = Message.new(params[:message] || {})
11
+ if @message.save
12
+ ContactMailer.message_email(@message).deliver
13
+ flash[:notice] = t('contact_thank_you')
14
+ redirect_to root_path
15
+ else
16
+ render :action => 'show'
17
+ end
18
+ end
19
+
20
+ private
21
+ def load_topics
22
+ @topics = ContactTopic.all
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,6 @@
1
+ module Spree
2
+ module Admin
3
+ module ContactTopicsHelper
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,4 @@
1
+ module Spree
2
+ module ContactHelper
3
+ end
4
+ end
@@ -0,0 +1,12 @@
1
+ module Spree
2
+ class ContactMailer < ActionMailer::Base
3
+ helper "spree/base"
4
+
5
+ def message_email(message)
6
+ subject = "#{Spree::Config[:site_name]} - Message from #{message.email}"
7
+
8
+ @message = message
9
+ mail(:to => message.topic.emails, :subject => subject, :reply_to => message.email)
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,6 @@
1
+ module Spree
2
+ class ContactTopic < ActiveRecord::Base
3
+ validates :name, :emails, :presence => true
4
+ validates :name, :uniqueness => true
5
+ end
6
+ end
@@ -0,0 +1,10 @@
1
+ module Spree
2
+ class Message < ActiveRecord::Base
3
+ validates :name, :message, :topic_id, :presence => true
4
+
5
+ validates :email, :format => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i
6
+ validates :order_number, :format => /(^$)|(^R\d{9}$)/i
7
+
8
+ belongs_to :topic, :class_name => 'ContactTopic'
9
+ end
10
+ end
@@ -1,5 +1,12 @@
1
- Deface::Override.new(:virtual_path => "admin/configurations/index",
1
+ Deface::Override.new(:virtual_path => "spree/admin/configurations/index",
2
2
  :name => "converted_admin_configurations_menu_394888068",
3
3
  :insert_after => "[data-hook='admin_configurations_menu'], #admin_configurations_menu[data-hook]",
4
+ # :insert_bottom => "[data-hook='admin_tabs'], #admin_tabs[data-hook]",
4
5
  :text => "<%= configurations_menu_item(I18n.t('contact_topics'), admin_contact_topics_path, I18n.t('contact_topics_description')) %>",
5
6
  :disabled => false)
7
+
8
+ # Deface::Override.new(:virtual_path => "spree/layouts/admin",
9
+ # :name => "promo_admin_tabs",
10
+ # :insert_bottom => "[data-hook='admin_tabs'], #admin_tabs[data-hook]",
11
+ # :text => "<%= tab(:promotions, :url => spree.admin_promotions_path) %>",
12
+ # :disabled => false)
@@ -1,6 +1,6 @@
1
1
  <%- locals = {:f => f} %>
2
2
 
3
- <%= render "shared/error_messages", :target => f.object %>
3
+ <%= render "spree/shared/error_messages", :target => f.object %>
4
4
 
5
5
  <div data-hook="admin_contact_topic_form">
6
6
 
@@ -12,7 +12,7 @@
12
12
 
13
13
  <%= f.field_container :emails do %>
14
14
  <%= f.label :emails, t("emails") %> (<%= t('comma_delimited') %>) <span class="required">*</span><br />
15
- <%= f.text_field :emails, :class => 'fullwidth title' %>
15
+ <%= f.text_field :emails, :class => 'fullwidth title' %>
16
16
  <%= f.error_message_on :emails %>
17
17
  <% end %>
18
18
 
@@ -1,7 +1,7 @@
1
1
  <div class='toolbar'>
2
2
  <ul class='actions'>
3
3
  <li id="new_contact_topic_link">
4
- <%= button_link_to t("new_contact_topic"), new_object_url, {:remote => true, :icon => 'add'} %>
4
+ <p><%= button_link_to t(:new_contact_topic), new_object_url, :icon => 'add' %></p>
5
5
  </li>
6
6
  </ul>
7
7
  <br class='clear' />
@@ -1,4 +1,9 @@
1
+ <h1><%= t(:topic) %></h1>
2
+
1
3
  <%= form_for(@contact_topic, :url => collection_url) do |f| %>
2
4
  <%= render :partial => 'form', :locals => {:f => f} %>
3
- <%= render :partial => 'admin/shared/new_resource_links' %>
5
+ <%= render :partial => 'spree/admin/shared/new_resource_links' %>
4
6
  <% end %>
7
+
8
+
9
+
@@ -5,7 +5,8 @@
5
5
  <h1><%= t("contact_us") %></h1>
6
6
 
7
7
  <div data-hook='contact'>
8
- <%= render "shared/error_messages", :target => @message %>
8
+ <%= render "spree/shared/error_messages", :target => @message %>
9
+ <br/>
9
10
 
10
11
  <%= form_for(:message, :url => contact_path) do |f| %>
11
12
 
@@ -26,7 +27,7 @@
26
27
  </p>
27
28
 
28
29
  <p>
29
- <%= f.label :order_number, t("order_number") %> (<%= t('optional') %>)<br />
30
+ <%= f.label :order_number, t(:order_number) %> (<%= t('optional') %>)<br />
30
31
  <%= f.text_field :order_number %>
31
32
  </p>
32
33
 
@@ -1,9 +1,10 @@
1
1
  en:
2
- contact_us: Contact Us
2
+ contact_us: Contact us
3
3
  send_message: Send Message
4
4
  subject: Subject
5
5
  optional: optional
6
6
  message: Message
7
+ order_number: Order number (if you are contacting regarding an order)
7
8
  topic: Topic
8
9
  invalid_order_number: "should start with letter 'R' followed by 9 numbers (e.g. R123123213)"
9
10
  contact_thank_you: "Thank you! Your message has been sent successfully, we will be contacting you shortly"
@@ -1,7 +1,7 @@
1
- Rails.application.routes.draw do
1
+ Spree::Core::Engine.routes.prepend do
2
2
  resource :contact, :controller => 'contact'
3
3
 
4
4
  namespace :admin do
5
5
  resources :contact_topics
6
- end
7
- end
6
+ end
7
+ end
@@ -3,13 +3,13 @@ module SpreeContactForm
3
3
  class InstallGenerator < Rails::Generators::Base
4
4
 
5
5
  def add_javascripts
6
- append_file "app/assets/javascripts/store/all.js", "//= require store/spree_contact_form\n"
7
- append_file "app/assets/javascripts/admin/all.js", "//= require admin/spree_contact_form\n"
6
+ #append_file "app/assets/javascripts/store/all.js", "//= require store/spree_contact_form\n"
7
+ #append_file "app/assets/javascripts/admin/all.js", "//= require admin/spree_contact_form\n"
8
8
  end
9
9
 
10
10
  def add_stylesheets
11
- inject_into_file "app/assets/stylesheets/store/all.css", " *= require store/spree_contact_form\n", :before => /\*\//, :verbose => true
12
- inject_into_file "app/assets/stylesheets/admin/all.css", " *= require admin/spree_contact_form\n", :before => /\*\//, :verbose => true
11
+ #inject_into_file "app/assets/stylesheets/store/all.css", " *= require store/spree_contact_form\n", :before => /\*\//, :verbose => true
12
+ #inject_into_file "app/assets/stylesheets/admin/all.css", " *= require admin/spree_contact_form\n", :before => /\*\//, :verbose => true
13
13
  end
14
14
 
15
15
  def add_migrations
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_contact_form
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.6
4
+ version: 4.0.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,19 +9,19 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-11-11 00:00:00.000000000Z
12
+ date: 2012-04-30 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: spree_core
16
- requirement: &77798830 !ruby/object:Gem::Requirement
16
+ requirement: &85535040 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
20
20
  - !ruby/object:Gem::Version
21
- version: 0.70.RC1
21
+ version: 1.0.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *77798830
24
+ version_requirements: *85535040
25
25
  description: Add a contact form for your spree website, you can setup topics and when
26
26
  the user submits the form, it is emailed to the site admin
27
27
  email: joshnuss@gmail.com
@@ -33,20 +33,20 @@ files:
33
33
  - lib/generators/spree_contact_form/install/install_generator.rb
34
34
  - lib/spree_contact_form.rb
35
35
  - lib/spree_contact_form/engine.rb
36
- - app/views/contact_mailer/message_email.text.erb
37
- - app/views/admin/contact_topics/edit.html.erb
38
- - app/views/admin/contact_topics/_form.html.erb
39
- - app/views/admin/contact_topics/index.html.erb
40
- - app/views/admin/contact_topics/new.html.erb
41
- - app/views/contact/show.html.erb
42
- - app/mailers/contact_mailer.rb
36
+ - app/views/spree/contact_mailer/message_email.text.erb
37
+ - app/views/spree/admin/contact_topics/edit.html.erb
38
+ - app/views/spree/admin/contact_topics/_form.html.erb
39
+ - app/views/spree/admin/contact_topics/index.html.erb
40
+ - app/views/spree/admin/contact_topics/new.html.erb
41
+ - app/views/spree/contact/show.html.erb
42
+ - app/mailers/spree/contact_mailer.rb
43
43
  - app/overrides/admin.rb
44
- - app/models/message.rb
45
- - app/models/contact_topic.rb
46
- - app/helpers/contact_helper.rb
47
- - app/helpers/admin/contact_topics_helper.rb
48
- - app/controllers/contact_controller.rb
49
- - app/controllers/admin/contact_topics_controller.rb
44
+ - app/models/spree/message.rb
45
+ - app/models/spree/contact_topic.rb
46
+ - app/helpers/spree/contact_helper.rb
47
+ - app/helpers/spree/admin/contact_topics_helper.rb
48
+ - app/controllers/spree/contact_controller.rb
49
+ - app/controllers/spree/admin/contact_topics_controller.rb
50
50
  - config/routes.rb
51
51
  - config/locales/en.yml
52
52
  homepage: http://spreecommerce.com
@@ -60,7 +60,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
60
60
  requirements:
61
61
  - - ! '>='
62
62
  - !ruby/object:Gem::Version
63
- version: 1.8.7
63
+ version: 1.9.3
64
64
  required_rubygems_version: !ruby/object:Gem::Requirement
65
65
  none: false
66
66
  requirements:
@@ -1,11 +0,0 @@
1
- class Admin::ContactTopicsController < Admin::BaseController
2
- resource_controller
3
-
4
- create.wants.html { redirect_to collection_path }
5
- update.wants.html { redirect_to collection_path }
6
-
7
- new_action.response do |wants|
8
- wants.html {render :action => :new, :layout => !request.xhr?}
9
- end
10
-
11
- end
@@ -1,23 +0,0 @@
1
- class ContactController < Spree::BaseController
2
- before_filter :load_topics
3
-
4
- def show
5
- @message = Message.new
6
- end
7
-
8
- def create
9
- @message = Message.new(params[:message] || {})
10
- if @message.save
11
- ContactMailer.message_email(@message).deliver
12
- flash[:notice] = t('contact_thank_you')
13
- redirect_to root_path
14
- else
15
- render :action => 'show'
16
- end
17
- end
18
-
19
- private
20
- def load_topics
21
- @topics = ContactTopic.all
22
- end
23
- end
@@ -1,2 +0,0 @@
1
- module Admin::ContactTopicsHelper
2
- end
@@ -1,2 +0,0 @@
1
- module ContactHelper
2
- end
@@ -1,10 +0,0 @@
1
- class ContactMailer < ActionMailer::Base
2
- helper "spree/base"
3
-
4
- def message_email(message)
5
- subject = "#{Spree::Config[:site_name]} - Message from #{message.email}"
6
-
7
- @message = message
8
- mail(:to => message.topic.emails, :subject => subject, :reply_to => message.email)
9
- end
10
- end
@@ -1,4 +0,0 @@
1
- class ContactTopic < ActiveRecord::Base
2
- validates :name, :emails, :presence => true
3
- validates :name, :uniqueness => true
4
- end
@@ -1,8 +0,0 @@
1
- class Message < ActiveRecord::Base
2
- validates :name, :message, :topic_id, :presence => true
3
-
4
- validates :email, :format => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i
5
- validates :order_number, :format => /(^$)|(^R\d{9}$)/i
6
-
7
- belongs_to :topic, :class_name => 'ContactTopic'
8
- end