-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
fd30489
commit 3a64293
Showing
42 changed files
with
467 additions
and
15 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
# Place all the behaviors and hooks related to the matching controller here. | ||
# All this logic will automatically be available in application.js. | ||
# You can use CoffeeScript in this file: http://coffeescript.org/ | ||
$('.datepicker').datepicker() |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// Place all the styles related to the newsletters controller here. | ||
// They will automatically be included in application.css. | ||
// You can use Sass (SCSS) here: http://sass-lang.com/ |
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,2 +1,47 @@ | ||
class NewslettersController < ApplicationController | ||
|
||
def index | ||
@newsletters = Newsletter.order_by([:sent_on, :asc]) | ||
end | ||
|
||
def show | ||
@newsletter = Newsletter.find(params[:id]) | ||
end | ||
|
||
def new | ||
@newsletter = Newsletter.new | ||
end | ||
|
||
def newsletters_params | ||
params.require(:newsletter).permit(:id, :content, :sent_on, :users_count) | ||
end | ||
|
||
def create | ||
@newsletter = Newsletter.new(newsletters_params) | ||
if @newsletter.save | ||
redirect_to newsletters_path | ||
else | ||
render action: 'new' | ||
end | ||
end | ||
|
||
def edit | ||
@newsletter = Newsletter.find(params[:id]) | ||
end | ||
|
||
def update | ||
@newsletter = Newsletter.find(params[:id]) | ||
if @newsletter.update_attributes(newsletters_params) | ||
redirect_to newsletters_path | ||
else | ||
render action: 'edit' | ||
end | ||
end | ||
|
||
def destroy | ||
@newsletter = Newsletter.find(params[:id]) | ||
@newsletter.destroy | ||
redirect_to newsletters_path | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
class UserMailer < ActionMailer::Base | ||
include SendGrid | ||
sendgrid_category :use_subject_lines | ||
sendgrid_enable :ganalytics, :opentrack | ||
sendgrid_unique_args :key1 => "value1", :key2 => "value2" | ||
|
||
def welcome_message(email, newsletter_content,id,name) | ||
sendgrid_category "Welcome" | ||
sendgrid_unique_args :key2 => "newvalue2", :key3 => "value3" | ||
|
||
content = ERB.new(newsletter_content) | ||
object_id = id | ||
#headers['X-SMTPAPI'] = { :to => user.pluck(:email_id) }.to_json | ||
|
||
mail( to: email, | ||
category: "newuser", | ||
subject: "Welcome #{name}", | ||
body: content.result(binding), | ||
content_type: "text/html" | ||
) | ||
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,9 @@ | ||
class RedactorRails::Asset | ||
include Mongoid::Document | ||
include Mongoid::Timestamps | ||
|
||
include RedactorRails::Orm::Mongoid::AssetBase | ||
|
||
delegate :url, :current_path, :size, :content_type, :filename, :to => :data | ||
validates_presence_of :data | ||
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,14 @@ | ||
class RedactorRails::Document < RedactorRails::Asset | ||
mount_uploader :data, RedactorRailsDocumentUploader, :mount_on => :data_file_name | ||
|
||
def url_content | ||
url(:content) | ||
end | ||
|
||
def thumb | ||
# Could theoretically provide an icon set here | ||
# to match against the extensions | ||
# but for now it's nil to address the bug | ||
nil | ||
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,7 @@ | ||
class RedactorRails::Picture < RedactorRails::Asset | ||
mount_uploader :data, RedactorRailsPictureUploader, :mount_on => :data_file_name | ||
|
||
def url_content | ||
url(:content) | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# encoding: utf-8 | ||
class RedactorRailsDocumentUploader < CarrierWave::Uploader::Base | ||
include RedactorRails::Backend::CarrierWave | ||
|
||
# storage :fog | ||
storage :file | ||
|
||
def store_dir | ||
"system/redactor_assets/documents/#{model.id}" | ||
end | ||
|
||
def extension_white_list | ||
RedactorRails.document_file_types | ||
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,53 @@ | ||
# encoding: utf-8 | ||
class RedactorRailsPictureUploader < CarrierWave::Uploader::Base | ||
include RedactorRails::Backend::CarrierWave | ||
|
||
# Include RMagick or ImageScience support: | ||
# include CarrierWave::RMagick | ||
include CarrierWave::MiniMagick | ||
# include CarrierWave::ImageScience | ||
|
||
# Choose what kind of storage to use for this uploader: | ||
storage :file | ||
|
||
# Override the directory where uploaded files will be stored. | ||
# This is a sensible default for uploaders that are meant to be mounted: | ||
def store_dir | ||
"system/redactor_assets/pictures/#{model.id}" | ||
end | ||
|
||
# Provide a default URL as a default if there hasn't been a file uploaded: | ||
# def default_url | ||
# "/images/fallback/" + [version_name, "default.png"].compact.join('_') | ||
# end | ||
|
||
# Process files as they are uploaded: | ||
# process :scale => [200, 300] | ||
# | ||
# def scale(width, height) | ||
# # do something | ||
# end | ||
|
||
process :read_dimensions | ||
|
||
# Create different versions of your uploaded files: | ||
version :thumb do | ||
process :resize_to_fill => [118, 100] | ||
end | ||
|
||
version :content do | ||
process :resize_to_limit => [800, 800] | ||
end | ||
|
||
# Add a white list of extensions which are allowed to be uploaded. | ||
# For images you might use something like this: | ||
def extension_white_list | ||
RedactorRails.image_file_types | ||
end | ||
|
||
# Override the filename of the uploaded files: | ||
# Avoid using model.id or version_name here, see uploader/store.rb for details. | ||
# def filename | ||
# "something.jpg" if original_filename | ||
# end | ||
end |
Oops, something went wrong.