bcms_contact_us_module 1.0.1 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2 @@
1
+ class Cms::BcmsQuestionsController < Cms::ContentBlockController
2
+ end
@@ -1,4 +1,4 @@
1
- class Notifications < ActionMailer::Base
1
+ class BcmsNotifications < ActionMailer::Base
2
2
 
3
3
 
4
4
  def new_question_notification(question, recipients, from_email="no_reply@bcms-site.com", subject="New question submitted")
@@ -1,11 +1,11 @@
1
- class Question < ActiveRecord::Base
1
+ class BcmsQuestion < ActiveRecord::Base
2
2
  acts_as_content_block
3
3
 
4
4
  # Pattern used to find real emails
5
5
  EMAIL_PATTERN = /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i
6
6
 
7
7
  # i18n messages stored in config/locales/en.yml
8
- validates_presence_of :email
8
+ validates_presence_of :email, :name
9
9
  validates_format_of :email, :with => EMAIL_PATTERN
10
10
 
11
11
  # display_name is used in the admin secton of the cms to give our
@@ -5,12 +5,12 @@ class ContactUsPortlet < Portlet
5
5
 
6
6
  def render
7
7
  pmap = flash[instance_name] || params
8
- @question = Question.new pmap[:question]
9
- @question.errors.add_from_hash flash["#{instance_name}_errors"]
8
+ @bcms_question = BcmsQuestion.new pmap[:bcms_question]
9
+ @bcms_question.errors.add_from_hash flash["#{instance_name}_errors"]
10
10
  end
11
11
 
12
12
  def action
13
- question = Question.new(params[:question] || {})
13
+ question = BcmsQuestion.new(params[:bcms_question] || {})
14
14
 
15
15
  if question.save
16
16
 
@@ -7,7 +7,6 @@
7
7
  </head>
8
8
  <body>
9
9
  <%= cms_toolbar %>
10
- <%= flash_messages %>
11
10
  <%= render_breadcrumbs %>
12
11
  <%= container :default %>
13
12
  </body>
@@ -2,8 +2,8 @@
2
2
 
3
3
  <div class="contact_us_form">
4
4
 
5
- <% form_for @question, :url => cms_handler_path(@portlet, "action") do |f| %>
6
- <%= error_messages_for :question %>
5
+ <% form_for @bcms_question, :url => cms_handler_path(@portlet, "action") do |f| %>
6
+ <%= error_messages_for :bcms_question %>
7
7
 
8
8
  <fieldset>
9
9
 
@@ -0,0 +1,21 @@
1
+ class CreateBcmsQuestions < ActiveRecord::Migration
2
+ def self.up
3
+ create_content_table :bcms_questions do |t|
4
+ t.string :name
5
+ t.string :email
6
+ t.string :subject
7
+ t.text :message
8
+ end
9
+
10
+
11
+ ContentType.create!(:name => "BcmsQuestion", :group_name => "Administration")
12
+ end
13
+
14
+ def self.down
15
+ ContentType.delete_all(['name = ?', 'BcmsQuestion'])
16
+ CategoryType.all(:conditions => ['name = ?', 'Question']).each(&:destroy)
17
+ #If you aren't creating a versioned table, be sure to comment this out.
18
+ drop_table :bcms_question_versions
19
+ drop_table :bcms_questions
20
+ end
21
+ end
@@ -1,7 +1,7 @@
1
1
  module Cms::Routes
2
2
  def routes_for_bcms_contact_us_module
3
3
  namespace(:cms) do |cms|
4
- cms.content_blocks :questions
4
+ cms.content_blocks :bcms_questions
5
5
  end
6
6
  end
7
7
  end
data/rails/init.rb CHANGED
@@ -1,3 +1,4 @@
1
+ require 'browsercms'
1
2
  gem_root = File.expand_path(File.join(File.dirname(__FILE__), ".."))
2
3
  Cms.add_to_rails_paths gem_root
3
4
  Cms.add_generator_paths gem_root, "db/migrate/[0-9]*_*.rb"
@@ -1,6 +1,6 @@
1
1
  require File.join(File.dirname(__FILE__), '/../../test_helper')
2
2
 
3
- class Cms::QuestionsControllerTest < ActionController::TestCase
3
+ class Cms::BcmsQuestionsControllerTest < ActionController::TestCase
4
4
 
5
5
  test "Add_test_here" do
6
6
 
@@ -0,0 +1,8 @@
1
+ require 'test_helper'
2
+
3
+ class BcmsNotificationsTest < ActionMailer::TestCase
4
+ # replace this with your real tests
5
+ test "the truth" do
6
+ assert true
7
+ end
8
+ end
@@ -1,6 +1,6 @@
1
1
  require 'test_helper'
2
2
 
3
- class QuestionObserverTest < ActiveSupport::TestCase
3
+ class BcmsQuestionTest < ActiveSupport::TestCase
4
4
  # Replace this with your real tests.
5
5
  test "the truth" do
6
6
  assert true
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bcms_contact_us_module
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
5
- prerelease: false
4
+ hash: 23
5
+ prerelease:
6
6
  segments:
7
7
  - 1
8
- - 0
9
8
  - 1
10
- version: 1.0.1
9
+ - 2
10
+ version: 1.1.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Freddy Andersen
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-11-01 00:00:00 -07:00
18
+ date: 2011-01-11 00:00:00 -08:00
19
19
  default_executable:
20
20
  dependencies: []
21
21
 
@@ -30,30 +30,29 @@ extra_rdoc_files:
30
30
  - README.markdown
31
31
  files:
32
32
  - app/controllers/application_controller.rb
33
- - app/controllers/cms/questions_controller.rb
33
+ - app/controllers/cms/bcms_questions_controller.rb
34
34
  - app/helpers/application_helper.rb
35
- - app/models/notifications.rb
36
- - app/models/question.rb
35
+ - app/models/bcms_notifications.rb
36
+ - app/models/bcms_question.rb
37
37
  - app/portlets/contact_us_portlet.rb
38
38
  - app/portlets/helpers/contact_us_portlet_helper.rb
39
- - app/views/cms/questions/_form.html.erb
40
- - app/views/cms/questions/render.html.erb
39
+ - app/views/cms/bcms_questions/_form.html.erb
40
+ - app/views/cms/bcms_questions/render.html.erb
41
41
  - app/views/layouts/templates/default.html.erb
42
42
  - app/views/portlets/contact_us/_form.html.erb
43
43
  - app/views/portlets/contact_us/render.html.erb
44
- - db/migrate/20101030141654_create_questions.rb
44
+ - db/migrate/20101030141654_create_bcms_questions.rb
45
45
  - lib/bcms_contact_us_module.rb
46
46
  - lib/bcms_contact_us_module/routes.rb
47
47
  - rails/init.rb
48
48
  - LICENSE.txt
49
49
  - README.markdown
50
- - test/functional/cms/questions_controller_test.rb
50
+ - test/functional/cms/bcms_questions_controller_test.rb
51
51
  - test/performance/browsing_test.rb
52
52
  - test/test_helper.rb
53
- - test/unit/models/question_test.rb
54
- - test/unit/notifications_test.rb
53
+ - test/unit/bcms_notifications_test.rb
54
+ - test/unit/bcms_question_test.rb
55
55
  - test/unit/portlets/contact_us_portlet_test.rb
56
- - test/unit/question_observer_test.rb
57
56
  has_rdoc: true
58
57
  homepage: http://github.com/heimdull/bcms_contact_us_module
59
58
  licenses: []
@@ -84,15 +83,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
84
83
  requirements: []
85
84
 
86
85
  rubyforge_project:
87
- rubygems_version: 1.3.7
86
+ rubygems_version: 1.4.1
88
87
  signing_key:
89
88
  specification_version: 3
90
89
  summary: Contact Us portlet in BrowserCMS
91
90
  test_files:
92
- - test/functional/cms/questions_controller_test.rb
91
+ - test/functional/cms/bcms_questions_controller_test.rb
93
92
  - test/performance/browsing_test.rb
94
93
  - test/test_helper.rb
95
- - test/unit/models/question_test.rb
96
- - test/unit/notifications_test.rb
94
+ - test/unit/bcms_notifications_test.rb
95
+ - test/unit/bcms_question_test.rb
97
96
  - test/unit/portlets/contact_us_portlet_test.rb
98
- - test/unit/question_observer_test.rb
@@ -1,2 +0,0 @@
1
- class Cms::QuestionsController < Cms::ContentBlockController
2
- end
@@ -1,21 +0,0 @@
1
- class CreateQuestions < ActiveRecord::Migration
2
- def self.up
3
- create_content_table :questions do |t|
4
- t.string :name
5
- t.string :email
6
- t.string :subject
7
- t.text :message
8
- end
9
-
10
-
11
- ContentType.create!(:name => "Question", :group_name => "Administration")
12
- end
13
-
14
- def self.down
15
- ContentType.delete_all(['name = ?', 'Question'])
16
- CategoryType.all(:conditions => ['name = ?', 'Question']).each(&:destroy)
17
- #If you aren't creating a versioned table, be sure to comment this out.
18
- drop_table :question_versions
19
- drop_table :questions
20
- end
21
- end
@@ -1,9 +0,0 @@
1
- require File.join(File.dirname(__FILE__), '/../../test_helper')
2
-
3
- class QuestionTest < ActiveSupport::TestCase
4
-
5
- test "should be able to create new block" do
6
- assert Question.create!
7
- end
8
-
9
- end
@@ -1,12 +0,0 @@
1
- require 'test_helper'
2
-
3
- class NotificationsTest < ActionMailer::TestCase
4
- test "new_question" do
5
- @expected.subject = 'Notifications#new_question'
6
- @expected.body = read_fixture('new_question')
7
- @expected.date = Time.now
8
-
9
- assert_equal @expected.encoded, Notifications.create_new_question(@expected.date).encoded
10
- end
11
-
12
- end