Skip to content

Commit

Permalink
added in Shemail(mail_styles) plugin for better html email styling
Browse files Browse the repository at this point in the history
  • Loading branch information
nikolaiwarner committed Jan 3, 2010
1 parent 9a0ad34 commit 06d6d07
Show file tree
Hide file tree
Showing 8 changed files with 84 additions and 38 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
@@ -0,0 +1,3 @@
[submodule "vendor/plugins/mail_style"]
path = vendor/plugins/mail_style
url = git://github.com/purify/mail_style.git
19 changes: 12 additions & 7 deletions app/models/application_mailer.rb
@@ -1,13 +1,18 @@
class ApplicationMailer < ActionMailer::Base

ActionMailer::Base.default_url_options[:host] = "canada.nikolaiwarner.com"



def send_weekly_newsletter(content)
css :email

def send_weekly_newsletter(options)
@subject = 'Collexion Newsletter - ' + Date.today.to_s(:db)
@recipients = 'nickwarner@gmail.com' #'collexion@googlegroups.com'
@from = 'nick@nwarner.com'
@sent_on = Time.now
@content_type = 'text/html'
@body[:body] = options[:body]
subject 'Collexion Newsletter - ' + Date.today.to_s(:db)
recipients 'nickwarner@gmail.com' #'collexion@googlegroups.com'
from 'nick@nwarner.com'
sent_on Time.now
content_type 'text/html'
body :body => content
end

end
@@ -1,6 +1,6 @@
!!! 5
!!!
%html
%head
%title Collexion Newsletter
%body
=@body
=body
@@ -0,0 +1,3 @@
Collexion Newsletter

<%= body %>
61 changes: 33 additions & 28 deletions app/views/pages/create.html.haml
Expand Up @@ -2,61 +2,66 @@
%input{:type => "submit", :value => "Send Newsletter Email"}
%br
%textarea{:rows => "40", :cols => "100", :name => "body"}
.section{ :style => "margin: 10px" }
.section_header{ :style => "margin: 10px; font-weight: 900; font-size:20px; font-family: 'Helvetica Nue', Helvetica, Arial, sans-serif;" }
.section
.section_header
The Collexion Newsletter -
= Date.today.to_s(:db)
.section{ :style => "margin: 10px" }
.section_header{ :style => "margin: 10px; font-weight: 900;" }
.section_header
EVENTS
.section_content{ :style => "margin: 5px" }
.section_content
- @events.each do |event|
.item{ :style => "margin: 10px" }
.title{ :style => "font-weight: 900;" }= event.title
.item
.title
= event.title
= event.time_string + " <br/> " if event.time_string
= "@ " + event.location.title + " (" + event.location.address + ")" if event.location
%br
= event.description
.section_header{ :style => "margin: 10px; font-weight: 900;" }
.section_header
Coming Soon:
.section_content{ :style => "margin: 5px" }
.section_content
- @coming_events.each do |event|
.item{ :style => "margin: 5px" }
= event.title
.item
.title
= event.title
= "@ " + event.location.title + " (" + event.location.address + ")" if event.location
= " - " + event.time_string if event.time_string
- unless @announcements.count.zero?
.section{ :style => "margin: 10px" }
.section_header{ :style => "margin: 10px; font-weight: 900;" }
.section
.section_header
ANNOUNCEMENTS
.section_content{ :style => "margin: 5px" }
.section_content
- @announcements.each_with_index do |announcement, i|
.item{ :style => "margin: 10px" }
= (i + 1).to_s + ") " + announcement.title
.item
.title
= (i + 1).to_s + ") " + announcement.title
%br
= announcement.description
- unless @hacks.count.zero?
.section{ :style => "margin: 10px" }
.section_header{ :style => "margin: 10px; font-weight: 900;" }
.section
.section_header
HACKS OF THE WEEK
.section_content{ :style => "margin: 5px" }
.section_content
- @hacks.each do |hack|
.item{ :style => "margin: 10px" }
= hack.title
.item
.title
= hack.title
%br
= hack.description
- unless @resources.count.zero?
.section{ :style => "margin: 10px" }
.section_header{ :style => "margin: 10px; font-weight: 900;" }
.section
.section_header
RESOURCES
.section_content{ :style => "margin: 5px" }
.section_content
- @resources.each do |resource|
.item{ :style => "margin: 5px" }
= resource.title + ": " + resource.link
.item
.title
= resource.title + ": " + resource.link
= " - " + resource.description if resource.description
.section{ :style => "margin: 10px" }
.section_header{ :style => "margin: 10px; font-weight: 900;" }
.section
.section_header
QUESTIONS/COMMENTS/SUBMISSIONS
.section_content
.item{ :style => "margin: 5px" }
.item
Have an announcement, event, idea, or hack to submit for the next newsletter? Email nick@nwarner.com
4 changes: 3 additions & 1 deletion config/environment.rb
@@ -1,7 +1,7 @@
# Be sure to restart your server when you modify this file

# Specifies gem version of Rails to use when vendor/rails is not present
RAILS_GEM_VERSION = '2.3.4' unless defined? RAILS_GEM_VERSION
RAILS_GEM_VERSION = '2.3.5' unless defined? RAILS_GEM_VERSION

# Bootstrap the Rails environment, frameworks, and default configuration
require File.join(File.dirname(__FILE__), 'boot')
Expand All @@ -19,6 +19,8 @@
# config.gem "hpricot", :version => '0.6', :source => "http://code.whytheluckystiff.net"
# config.gem "sqlite3-ruby", :lib => "sqlite3"
# config.gem "aws-s3", :lib => "aws/s3"
config.gem "nokogiri"
config.gem "css_parser"
config.gem "ri_cal"

# Only load the plugins named here, in the order given (default is alphabetical).
Expand Down
27 changes: 27 additions & 0 deletions public/stylesheets/email.css
@@ -0,0 +1,27 @@


.section {
margin: 10px;
}

.section_header {
margin: 10px;
font-weight: 900;
font-size:20px;
font-family: 'Helvetica Nue', Helvetica, Arial, sans-serif;
}

.section_content {
margin: 5px;
}

.item {
margin: 10px;
font-weight: 100;
}

.title {
font-weight: 900;
}


1 change: 1 addition & 0 deletions vendor/plugins/mail_style
Submodule mail_style added at ccfdd4

0 comments on commit 06d6d07

Please sign in to comment.