spree_contact_form 3.0.4 → 3.0.6

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,13 +1,28 @@
1
- ContactForm
2
- ===========
1
+ Spree Contact Form Extension
2
+ =========
3
3
 
4
- Introduction goes here.
4
+ An spree extension for contact forms.
5
5
 
6
+ Installation
7
+ ============
6
8
 
7
- Example
8
- =======
9
+ 1) add the gem to your `Gemfile`:
9
10
 
10
- Example goes here.
11
+ `gem 'spree_contact_form'`
11
12
 
13
+ 2) run bundler:
12
14
 
13
- Copyright (c) 2010 [name of extension creator], released under the New BSD License
15
+ `bundle install`
16
+
17
+ 3) install it:
18
+
19
+ `rails generate spree_contact_form:install`
20
+
21
+ 3) migrate your database:
22
+
23
+ `rake db:migrate`
24
+
25
+ Viewing Contact Form
26
+ ======================
27
+
28
+ `http://yourdomain.tld/contact`
@@ -1,4 +1,4 @@
1
1
  class ContactTopic < ActiveRecord::Base
2
- validates_presence_of :name, :emails
3
- validates_uniqueness_of :name
2
+ validates :name, :emails, :presence => true
3
+ validates :name, :uniqueness => true
4
4
  end
@@ -1,8 +1,8 @@
1
1
  class Message < ActiveRecord::Base
2
- validates_presence_of :name, :message, :topic_id
2
+ validates :name, :message, :topic_id, :presence => true
3
3
 
4
- validates_format_of :email, :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i
5
- validates_format_of :order_number, :with => /(^$)|(^R\d{9}$)/i, :message => I18n.t("invalid_order_number")
4
+ validates :email, :format => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i
5
+ validates :order_number, :format => /(^$)|(^R\d{9}$)/i
6
6
 
7
7
  belongs_to :topic, :class_name => 'ContactTopic'
8
8
  end
@@ -0,0 +1,5 @@
1
+ Deface::Override.new(:virtual_path => "admin/configurations/index",
2
+ :name => "converted_admin_configurations_menu_394888068",
3
+ :insert_after => "[data-hook='admin_configurations_menu'], #admin_configurations_menu[data-hook]",
4
+ :text => "<%= configurations_menu_item(I18n.t('contact_topics'), admin_contact_topics_path, I18n.t('contact_topics_description')) %>",
5
+ :disabled => false)
@@ -2,7 +2,7 @@
2
2
 
3
3
  <%= render "shared/error_messages", :target => f.object %>
4
4
 
5
- <%= hook :admin_contact_topic_form, locals do %>
5
+ <div data-hook="admin_contact_topic_form">
6
6
 
7
7
  <%= f.field_container :name do %>
8
8
  <%= f.label :name, t("name") %> <span class="required">*</span><br />
@@ -16,4 +16,4 @@
16
16
  <%= f.error_message_on :emails %>
17
17
  <% end %>
18
18
 
19
- <% end %>
19
+ </div>
@@ -12,28 +12,21 @@
12
12
  <div id="new_contact_topic"></div>
13
13
 
14
14
  <table class="index">
15
- <tr>
16
- <%= hook :admin_contact_topic_index_headers do %>
17
- <th><%= t("name") %></th>
18
- <th><%= t("emails") %></th>
19
- <% end %>
20
- <th>
21
- <%= hook :admin_contact_topic_index_header_actions %>
15
+ <tr data-hook='admin_contact_topic_index_headers'>
16
+ <th><%= t("name") %></th>
17
+ <th><%= t("emails") %></th>
18
+ <th data-hook='admin_contact_topic_index_header_actions'>
22
19
  </th>
23
20
  </tr>
24
21
  <% @contact_topics.each do |topic| %>
25
- <tr id="<%= dom_id topic %>">
26
- <%- locals = {:topic => topic} %>
27
- <%= hook :admin_contact_topics_index_rows, locals do %>
28
- <td><%= topic.name %></td>
29
- <td><%= topic.emails %></td>
30
- <% end %>
31
- <td class="actions">
32
- <%= hook :admin_contact_topics_index_row_actions, locals do %>
33
- <%= link_to_edit topic %>
34
- &nbsp;
35
- <%= link_to_delete topic %>
36
- <% end %>
22
+ <%- locals = {:topic => topic} %>
23
+ <tr id="<%= dom_id topic %>" data-hook="admin_contact_topics_index_rows">
24
+ <td><%= topic.name %></td>
25
+ <td><%= topic.emails %></td>
26
+ <td class="actions" data-hook="admin_contact_topic_index_header_actions">
27
+ <%= link_to_edit topic %>
28
+ &nbsp;
29
+ <%= link_to_delete topic %>
37
30
  </td>
38
31
  </tr>
39
32
  <% end %>
@@ -4,14 +4,12 @@
4
4
  <div id="contact-us">
5
5
  <h1><%= t("contact_us") %></h1>
6
6
 
7
- <%= hook :contact do %>
8
-
7
+ <div data-hook='contact'>
9
8
  <%= render "shared/error_messages", :target => @message %>
10
9
 
11
- <%= form_for(:message, @message, :url => contact_path) do |f| %>
12
-
13
- <%= hook :contact_inside_form do %>
10
+ <%= form_for(:message, :url => contact_path) do |f| %>
14
11
 
12
+ <div data-hook="contact_inside_form">
15
13
  <p>
16
14
  <%= f.label :topic_id, t("subject") %><br />
17
15
  <%= f.collection_select :topic_id, @topics, :id, :name %>
@@ -38,11 +36,7 @@
38
36
  </p>
39
37
 
40
38
  <p><%= submit_tag t("send_message"), :class => 'button primary' %></p>
41
- <% end %>
42
-
39
+ </div>
43
40
  <% end %>
44
-
45
- <% end %>
46
-
41
+ </div>
47
42
  </div>
48
-
@@ -0,0 +1,29 @@
1
+ module SpreeContactForm
2
+ module Generators
3
+ class InstallGenerator < Rails::Generators::Base
4
+
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"
8
+ end
9
+
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
13
+ end
14
+
15
+ def add_migrations
16
+ run 'bundle exec rake railties:install:migrations FROM=spree_contact_form'
17
+ end
18
+
19
+ def run_migrations
20
+ res = ask "Would you like to run the migrations now? [Y/n]"
21
+ if res == "" || res.downcase == "y"
22
+ run 'bundle exec rake db:migrate'
23
+ else
24
+ puts "Skiping rake db:migrate, don't forget to run it!"
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -1,12 +1,26 @@
1
1
  require "spree_contact_form"
2
2
 
3
3
  module SpreeContactForm
4
-
5
4
  class Engine < Rails::Engine
5
+ engine_name 'spree_contact_form'
6
+
7
+ config.autoload_paths += %W(#{config.root}/lib)
8
+
9
+ # use rspec for tests
10
+ config.generators do |g|
11
+ g.test_framework :rspec
12
+ end
6
13
 
7
14
  def self.activate
15
+ Dir.glob(File.join(File.dirname(__FILE__), "../../app/**/*_decorator*.rb")) do |c|
16
+ Rails.application.config.cache_classes ? require(c) : load(c)
17
+ end
18
+
19
+ Dir.glob(File.join(File.dirname(__FILE__), "../../app/overrides/*.rb")) do |c|
20
+ Rails.application.config.cache_classes ? require(c) : load(c)
21
+ end
8
22
  end
9
23
 
24
+ config.to_prepare &method(:activate).to_proc
10
25
  end
11
-
12
26
  end
@@ -1,3 +1,2 @@
1
1
  require 'spree_core'
2
- require 'spree_contact_form_hooks'
3
2
  require 'spree_contact_form/engine'
metadata CHANGED
@@ -1,105 +1,77 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: spree_contact_form
3
- version: !ruby/object:Gem::Version
4
- hash: 15
5
- prerelease: false
6
- segments:
7
- - 3
8
- - 0
9
- - 4
10
- version: 3.0.4
3
+ version: !ruby/object:Gem::Version
4
+ version: 3.0.6
5
+ prerelease:
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Josh Nussbaum
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2011-04-13 00:00:00 -04:00
19
- default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
12
+ date: 2011-11-11 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
22
15
  name: spree_core
23
- prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &77798830 !ruby/object:Gem::Requirement
25
17
  none: false
26
- requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- hash: 101
30
- segments:
31
- - 0
32
- - 30
33
- - 1
34
- version: 0.30.1
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: 0.70.RC1
35
22
  type: :runtime
36
- version_requirements: *id001
37
- description: Add a contact form for your spree website, you can setup topics and when the user submits the form, it is emailed to the site admin
23
+ prerelease: false
24
+ version_requirements: *77798830
25
+ description: Add a contact form for your spree website, you can setup topics and when
26
+ the user submits the form, it is emailed to the site admin
38
27
  email: joshnuss@gmail.com
39
28
  executables: []
40
-
41
29
  extensions: []
42
-
43
30
  extra_rdoc_files: []
44
-
45
- files:
31
+ files:
46
32
  - README.md
47
- - lib/spree_contact_form_hooks.rb
33
+ - lib/generators/spree_contact_form/install/install_generator.rb
48
34
  - lib/spree_contact_form.rb
49
35
  - lib/spree_contact_form/engine.rb
50
- - lib/generators/spree_contact_form/install_generator.rb
51
- - lib/generators/templates/db/migrate/20101122153512_create_contact_topics.rb
52
- - lib/generators/templates/db/migrate/20101122153513_create_messages.rb
53
36
  - app/views/contact_mailer/message_email.text.erb
54
- - app/views/contact/show.html.erb
55
37
  - app/views/admin/contact_topics/edit.html.erb
56
- - app/views/admin/contact_topics/new.html.erb
57
38
  - app/views/admin/contact_topics/_form.html.erb
58
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
43
+ - app/overrides/admin.rb
44
+ - app/models/message.rb
45
+ - app/models/contact_topic.rb
59
46
  - app/helpers/contact_helper.rb
60
47
  - app/helpers/admin/contact_topics_helper.rb
61
48
  - app/controllers/contact_controller.rb
62
49
  - app/controllers/admin/contact_topics_controller.rb
63
- - app/mailers/contact_mailer.rb
64
- - app/models/contact_topic.rb
65
- - app/models/message.rb
66
50
  - config/routes.rb
67
51
  - config/locales/en.yml
68
- has_rdoc: true
69
52
  homepage: http://spreecommerce.com
70
53
  licenses: []
71
-
72
54
  post_install_message:
73
55
  rdoc_options: []
74
-
75
- require_paths:
56
+ require_paths:
76
57
  - lib
77
- required_ruby_version: !ruby/object:Gem::Requirement
58
+ required_ruby_version: !ruby/object:Gem::Requirement
78
59
  none: false
79
- requirements:
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- hash: 57
83
- segments:
84
- - 1
85
- - 8
86
- - 7
60
+ requirements:
61
+ - - ! '>='
62
+ - !ruby/object:Gem::Version
87
63
  version: 1.8.7
88
- required_rubygems_version: !ruby/object:Gem::Requirement
64
+ required_rubygems_version: !ruby/object:Gem::Requirement
89
65
  none: false
90
- requirements:
91
- - - ">="
92
- - !ruby/object:Gem::Version
93
- hash: 3
94
- segments:
95
- - 0
96
- version: "0"
97
- requirements:
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ requirements:
98
71
  - none
99
72
  rubyforge_project: spree_contact_form
100
- rubygems_version: 1.3.7
73
+ rubygems_version: 1.8.6
101
74
  signing_key:
102
75
  specification_version: 3
103
76
  summary: Adds a contact form for your spree site
104
77
  test_files: []
105
-
@@ -1,13 +0,0 @@
1
- module SpreeContactForm
2
- module Generators
3
- class InstallGenerator < Rails::Generators::Base
4
- source_root File.expand_path("../../templates", __FILE__)
5
-
6
- desc "Configures your Rails application for use with spree_contact_form"
7
- def copy_migrations
8
- directory "db"
9
- end
10
-
11
- end
12
- end
13
- end
@@ -1,14 +0,0 @@
1
- class CreateContactTopics < ActiveRecord::Migration
2
- def self.up
3
- create_table :contact_topics do |t|
4
- t.string :name
5
- t.string :emails
6
-
7
- t.timestamps
8
- end
9
- end
10
-
11
- def self.down
12
- drop_table :contact_topics
13
- end
14
- end
@@ -1,17 +0,0 @@
1
- class CreateMessages < ActiveRecord::Migration
2
- def self.up
3
- create_table :messages do |t|
4
- t.belongs_to :topic
5
- t.string :name, :null => false
6
- t.string :email, :null => false
7
- t.string :order_number
8
- t.text :message, :null => false
9
-
10
- t.timestamps
11
- end
12
- end
13
-
14
- def self.down
15
- drop_table :messages
16
- end
17
- end
@@ -1,7 +0,0 @@
1
- class SpreeContactFormHooks < Spree::ThemeSupport::HookListener
2
- insert_after :admin_configurations_menu do
3
- "<%= configurations_menu_item(I18n.t('contact_topics'), admin_contact_topics_path, I18n.t('contact_topics_description')) %>"
4
- end
5
-
6
- end
7
-