forked from joshnuss/spree-contact-form
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
1 parent
c1cf73c
commit 716d202
Showing
28 changed files
with
115 additions
and
80 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
4.0.0 |
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,4 +1,5 @@ | ||
"0.70.x" => { :branch => "master", :version => '3.0.5' } | ||
"1.x.x" => { :branch => "master", :version => '4.0.0' } | ||
"0.70.x" => { :tag => "0.70.x", :version => '3.0.5' } | ||
"0.60.x" => { :tag => "0.60.x", :version => '3.0.4' } | ||
"0.50.x" => { :tag => "0.60.x", :version => '3.0.4' } | ||
"0.40.x" => { :tag => "0.60.x", :version => '3.0.4' } | ||
"0.40.x" => { :tag => "0.60.x", :version => '3.0.4' } |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,13 @@ | ||
module Spree | ||
module Admin | ||
class ContactTopicsController < ResourceController | ||
|
||
# create.wants.html { redirect_to collection_path } | ||
# update.wants.html { redirect_to collection_path } | ||
# | ||
# new_action.response do |wants| | ||
# wants.html {render :action => :new, :layout => !request.xhr?} | ||
# end | ||
end | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
module Spree | ||
class ContactController < BaseController | ||
before_filter :load_topics | ||
|
||
def show | ||
@message = Message.new | ||
end | ||
|
||
def create | ||
@message = Message.new(params[:message] || {}) | ||
if @message.save | ||
ContactMailer.message_email(@message).deliver | ||
flash[:notice] = t('contact_thank_you') | ||
redirect_to root_path | ||
else | ||
render :action => 'show' | ||
end | ||
end | ||
|
||
private | ||
def load_topics | ||
@topics = ContactTopic.all | ||
end | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,6 @@ | ||
module Spree | ||
module Admin | ||
module ContactTopicsHelper | ||
end | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module Spree | ||
module ContactHelper | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
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,12 @@ | ||
module Spree | ||
class ContactMailer < ActionMailer::Base | ||
helper "spree/base" | ||
|
||
def message_email(message) | ||
subject = "#{Spree::Config[:site_name]} - Message from #{message.email}" | ||
|
||
@message = message | ||
mail(:to => message.topic.emails, :subject => subject, :reply_to => message.email) | ||
end | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,6 @@ | ||
module Spree | ||
class ContactTopic < ActiveRecord::Base | ||
validates :name, :emails, :presence => true | ||
validates :name, :uniqueness => true | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
module Spree | ||
class Message < ActiveRecord::Base | ||
validates :name, :message, :topic_id, :presence => true | ||
|
||
validates :email, :format => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i | ||
validates :order_number, :format => /(^$)|(^R\d{9}$)/i | ||
|
||
belongs_to :topic, :class_name => 'ContactTopic' | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,12 @@ | ||
Deface::Override.new(:virtual_path => "admin/configurations/index", | ||
Deface::Override.new(:virtual_path => "spree/admin/configurations/index", | ||
:name => "converted_admin_configurations_menu_394888068", | ||
:insert_after => "[data-hook='admin_configurations_menu'], #admin_configurations_menu[data-hook]", | ||
# :insert_bottom => "[data-hook='admin_tabs'], #admin_tabs[data-hook]", | ||
:text => "<%= configurations_menu_item(I18n.t('contact_topics'), admin_contact_topics_path, I18n.t('contact_topics_description')) %>", | ||
:disabled => false) | ||
|
||
# Deface::Override.new(:virtual_path => "spree/layouts/admin", | ||
# :name => "promo_admin_tabs", | ||
# :insert_bottom => "[data-hook='admin_tabs'], #admin_tabs[data-hook]", | ||
# :text => "<%= tab(:promotions, :url => spree.admin_promotions_path) %>", | ||
# :disabled => false) |
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.
2 changes: 1 addition & 1 deletion
2
...views/admin/contact_topics/index.html.erb → ...spree/admin/contact_topics/index.html.erb
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
7 changes: 6 additions & 1 deletion
7
app/views/admin/contact_topics/new.html.erb → ...s/spree/admin/contact_topics/new.html.erb
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,4 +1,9 @@ | ||
<h1><%= t(:topic) %></h1> | ||
|
||
<%= form_for(@contact_topic, :url => collection_url) do |f| %> | ||
<%= render :partial => 'form', :locals => {:f => f} %> | ||
<%= render :partial => 'admin/shared/new_resource_links' %> | ||
<%= render :partial => 'spree/admin/shared/new_resource_links' %> | ||
<% 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
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
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,7 +1,7 @@ | ||
Rails.application.routes.draw do | ||
Spree::Core::Engine.routes.prepend do | ||
resource :contact, :controller => 'contact' | ||
|
||
namespace :admin do | ||
resources :contact_topics | ||
end | ||
end | ||
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