Permalink
Browse files

Added preliminary Mollom framework.

  • Loading branch information...
1 parent 0bb52dd commit 08790991417a853b833dd3d5017acd4abfa54cf5 @chadoh committed May 12, 2010
Showing with 46 additions and 21 deletions.
  1. +1 −0 Gemfile
  2. +10 −4 Gemfile.lock
  3. +2 −1 TODO
  4. +32 −15 controls.rb
  5. +1 −1 public/javascripts/validation.js
View
@@ -8,3 +8,4 @@ gem "rdiscount"
gem "shotgun"
gem 'pony'
gem 'sinatra-content-for'
+gem 'mollom'
View
@@ -8,6 +8,10 @@ dependencies:
group:
- :default
version: ">= 0"
+ mollom:
+ group:
+ - :default
+ version: ">= 0"
haml:
group:
- :default
@@ -20,11 +24,11 @@ dependencies:
group:
- :default
version: ">= 0"
- rack-flash:
+ sinatra:
group:
- :default
version: ">= 0"
- sinatra:
+ rack-flash:
group:
- :default
version: ">= 0"
@@ -42,7 +46,7 @@ specs:
- crack:
version: 0.1.7
- haml:
- version: 2.2.24
+ version: 3.0.2
- mime-types:
version: "1.16"
- polyglot:
@@ -51,6 +55,8 @@ specs:
version: 1.4.5
- mail:
version: 2.2.0
+- mollom:
+ version: 0.2.2
- pony:
version: "1.0"
- rack:
@@ -65,7 +71,7 @@ specs:
version: "1.0"
- sinatra-content-for:
version: "0.2"
-hash: dcc4990e2b1a030cd53d4dbf7731d40d3770a80e
+hash: 102f4eedf1209af56c2dad800f167ad29ea5ce4f
sources:
- Rubygems:
uri: http://rubygems.org
View
3 TODO
@@ -1,4 +1,5 @@
-make contact form functional (hopefuly Pony 1.0 will fix all my woes)
+Complete Mollom contact form validation
+Sinatra form validation?
Show number of comments (slide-toggle them when clicked)
Add pagination (without and then with ajax calls)
View
@@ -19,6 +19,7 @@
require 'rack-flash'
require 'pony'
require 'sinatra/content_for'
+require 'mollom'
enable :sessions
@@ -104,20 +105,36 @@ def method_missing(name)
end
post "/contact" do
- #form validation in Sinatra?
+ #backend form validation in Sinatra?
#put it here!
- Pony.mail :to => 'chad.ostrowski@gmail.com',
- :from => '"' + params[:name] + '" <' + params[:email] + '>',
- :body => params[:message],
- :subject => "Mail from Lisli.net!",
- :via => :smtp,
- :via_options => { :address => 'smtp.sendgrid.net',
- :port => '25',
- :authentication => :plain,
- :user => ENV['SENDGRID_USERNAME'],
- :password => ENV['SENDGRID_PASSWORD'],
- :domain => ENV['SENDGRID_DOMAIN']
- }
- flash.now[:notice] = "Thanks for your message! I'll get back to you soon."
- haml :contact
+# m = Mollom.new(:private_key => 'none yet', :public_key => 'ni esto')
+#
+# content = m check_content(:post_body => params[:message], :author_name => params[:name])
+#
+# if content.spam?
+# flash.now[:notice] = "Sorry, that message seemed like it was written by a robot. Are you a robot? Go away! Otherwise, write something less spammy, please!"
+# haml :contact
+# elsif content.unsure?
+# flash.now[:notice] = "Hmm... You might be a robot? It's hard to tell, these days. Please verify your humanity."
+# @mollom = m.image_captcha(:session_id => content.session_id)["url"]
+#
+# #check captcha response before all of this, put @mollom in page
+#
+# haml:contact
+# else
+ Pony.mail :to => 'chad.ostrowski@gmail.com',
+ :from => '"' + params[:name] + '" <' + params[:email] + '>',
+ :body => params[:message],
+ :subject => "Mail from Lisli.net!",
+ :via => :smtp,
+ :via_options => { :address => 'smtp.sendgrid.net',
+ :port => '25',
+ :authentication => :plain,
+ :user => ENV['SENDGRID_USERNAME'],
+ :password => ENV['SENDGRID_PASSWORD'],
+ :domain => ENV['SENDGRID_DOMAIN']
+ }
+ flash.now[:notice] = "Thanks for your message! I'll get back to you soon."
+ haml :contact
+# end
end
@@ -1,7 +1,7 @@
$(function() {
$("form").validate({
- debug: true,
+ /*debug: true,*/
messages: {
email: {
required: "I need your email address, please!",

0 comments on commit 0879099

Please sign in to comment.