pixelforce_cms 0.9.8 → 0.9.9.1
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.
- checksums.yaml +4 -4
- data/README.md +4 -0
- data/lib/generators/pixelforce_cms/contact_us_generator.rb +30 -0
- data/lib/generators/pixelforce_cms/install_generator.rb +2 -1
- data/lib/generators/pixelforce_cms/templates/Gemfile +1 -1
- data/lib/generators/pixelforce_cms/templates/contact_us.rb +27 -0
- data/lib/generators/pixelforce_cms/templates/contacts_controller.rb +16 -0
- data/lib/generators/pixelforce_cms/templates/notification.rb +13 -0
- data/lib/generators/pixelforce_cms/templates/unicorn.rb +29 -0
- data/lib/pixelforce_cms/version.rb +1 -1
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 279a2d921fb01a55f4346cfc44321ac8ceba2926
|
4
|
+
data.tar.gz: 4ae94227b3f8c8e1440596de4ed6485f6a2e2f83
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 814052058644c7c633f5a43e8b0abaef95d25fbd78b2410084c4498c006037734ff2f384f1e84db31a75711e730d21f491160380522b270e997fcacc80bf29cf
|
7
|
+
data.tar.gz: ece3e396544a99343a1796b65cef51d34404b36a6efbc7185f304106b8438709f9aac91174089d8b05ac89b3853a61a76843cd9e64c96e5fd97e2643c564e60e
|
data/README.md
CHANGED
@@ -30,6 +30,10 @@ There are 3 options you can customise, assets, controllers, and config. For exam
|
|
30
30
|
|
31
31
|
$ rails g pixelforce_cms:install --skip-config
|
32
32
|
|
33
|
+
Add contact us module
|
34
|
+
|
35
|
+
$ rails g pixelforce_cms:contact_us
|
36
|
+
|
33
37
|
Add a new admin controller
|
34
38
|
|
35
39
|
$ rails g pixelforce_cms:controller [name]
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
|
3
|
+
module PixelforceCms
|
4
|
+
module Generators
|
5
|
+
class ContactUsGenerator < Rails::Generators::Base
|
6
|
+
source_root File.expand_path("../templates", __FILE__)
|
7
|
+
|
8
|
+
def create_model
|
9
|
+
copy_file "contact_us.rb", "app/models/contact_us.rb"
|
10
|
+
copy_file "contacts_controller.rb", "app/controllers/contacts_controller.rb"
|
11
|
+
template "notification.rb", 'app/emailers/notification.rb'
|
12
|
+
create_file "app/views/notification/notify_us"
|
13
|
+
route_config = %q(
|
14
|
+
get '/contact', to: 'contacts#new', as: :conatct
|
15
|
+
post '/contact', to: 'contacts#create'
|
16
|
+
)
|
17
|
+
inject_into_file 'config/routes.rb', "\n#{route_config}\n", { :after => '::Application.routes.draw do', :verbose => false }
|
18
|
+
end
|
19
|
+
|
20
|
+
def application_name
|
21
|
+
if defined?(Rails) && Rails.application
|
22
|
+
Rails.application.class.name.split('::').first.underscore
|
23
|
+
else
|
24
|
+
"application"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -26,7 +26,7 @@ module PixelforceCms
|
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
|
-
def copy_receipt
|
29
|
+
def copy_receipt
|
30
30
|
copy_file "recipes/base.rb", "config/recipes/base.rb"
|
31
31
|
copy_file "recipes/unicorn.rb", "config/recipes/unicorn.rb"
|
32
32
|
copy_file "recipes/sphinx.rb", "config/recipes/sphinx.rb"
|
@@ -48,6 +48,7 @@ module PixelforceCms
|
|
48
48
|
create_file 'app/views/pages/index.html.haml'
|
49
49
|
@application_name = application_name
|
50
50
|
template 'deploy.rb', 'config/deploy.rb'
|
51
|
+
template 'unicorn.rb', 'config/unicorn.rb'
|
51
52
|
end
|
52
53
|
end
|
53
54
|
|
@@ -0,0 +1,27 @@
|
|
1
|
+
class ContactUs
|
2
|
+
include ActiveModel::Conversion
|
3
|
+
extend ActiveModel::Naming
|
4
|
+
include ActiveModel::Validations
|
5
|
+
|
6
|
+
attr_accessor :full_name, :contact_number, :email, :enquiry, :donate, :captcha
|
7
|
+
|
8
|
+
validates :full_name, :contact_number, :email, :enquiry, presence: true
|
9
|
+
|
10
|
+
def initialize(attributes = {})
|
11
|
+
attributes.each do |attr, value|
|
12
|
+
self.send "#{attr}=", value
|
13
|
+
end unless attributes.blank?
|
14
|
+
end
|
15
|
+
|
16
|
+
def persisted?
|
17
|
+
false
|
18
|
+
end
|
19
|
+
|
20
|
+
def save
|
21
|
+
return if captcha.present?
|
22
|
+
if valid?
|
23
|
+
Notification.notify_us(self).deliver
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
class ContactsController < ApplicationController
|
2
|
+
|
3
|
+
def new
|
4
|
+
@contact_us = ContactUs.new
|
5
|
+
end
|
6
|
+
|
7
|
+
def create
|
8
|
+
@contact_us = ContactUs.new params[:contact_us]
|
9
|
+
if @contact_us.save
|
10
|
+
redirect_to contacts_path
|
11
|
+
else
|
12
|
+
render action: :new
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class Notification < ActionMailer::Base
|
2
|
+
default from: "<%= application_name %> Notification <noreply.<%= application_name.underscore %>@gmail.com>"
|
3
|
+
|
4
|
+
def notify_us(contact)
|
5
|
+
@contact = contact
|
6
|
+
mail(
|
7
|
+
to: 'bzbnhang@gmail.com',
|
8
|
+
reply_to: "#{contact.full_name} <#{contact.email}>",
|
9
|
+
subject: "[Contact Form] #{contact.full_name}"
|
10
|
+
)
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
rails_env = ENV['RACK_ENV'] || 'production'
|
2
|
+
worker_processes 2
|
3
|
+
working_directory '/home/deploy/<%= @application_name %>/current'
|
4
|
+
|
5
|
+
listen '/tmp/<%= @application_name %>.sock', :backlog => 2048
|
6
|
+
listen 5001, :tcp_nopush => true
|
7
|
+
|
8
|
+
timeout 60
|
9
|
+
pid "/home/deploy/<%= @application_name %>/shared/pids/unicorn.pid"
|
10
|
+
preload_app true
|
11
|
+
GC.respond_to?(:copy_on_write_friendly=) and
|
12
|
+
GC.copy_on_write_friendly = true
|
13
|
+
|
14
|
+
stderr_path '/home/deploy/<%= @application_name %>/shared/log/<%= @application_name %>.log'
|
15
|
+
|
16
|
+
before_fork do |server, worker|
|
17
|
+
ActiveRecord::Base.connection.disconnect!
|
18
|
+
old_pid = "#{server.config[:pid]}.oldbin"
|
19
|
+
if old_pid != server.pid
|
20
|
+
begin
|
21
|
+
Process.kill('QUIT', File.read(old_pid).to_i)
|
22
|
+
rescue Errno::ENOENT, Errno::ESRCH
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
after_fork do |server, worker|
|
28
|
+
ActiveRecord::Base.establish_connection
|
29
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pixelforce_cms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Zhang
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-05-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -50,6 +50,7 @@ files:
|
|
50
50
|
- LICENSE.txt
|
51
51
|
- README.md
|
52
52
|
- Rakefile
|
53
|
+
- lib/generators/pixelforce_cms/contact_us_generator.rb
|
53
54
|
- lib/generators/pixelforce_cms/controller_generator.rb
|
54
55
|
- lib/generators/pixelforce_cms/install_generator.rb
|
55
56
|
- lib/generators/pixelforce_cms/templates/Capfile
|
@@ -62,6 +63,8 @@ files:
|
|
62
63
|
- lib/generators/pixelforce_cms/templates/application/_head.html.haml
|
63
64
|
- lib/generators/pixelforce_cms/templates/application/_header.html.haml
|
64
65
|
- lib/generators/pixelforce_cms/templates/base_controller.rb
|
66
|
+
- lib/generators/pixelforce_cms/templates/contact_us.rb
|
67
|
+
- lib/generators/pixelforce_cms/templates/contacts_controller.rb
|
65
68
|
- lib/generators/pixelforce_cms/templates/css/application/application.css
|
66
69
|
- lib/generators/pixelforce_cms/templates/css/application/chromeframe.css.scss
|
67
70
|
- lib/generators/pixelforce_cms/templates/css/application/document.css.scss
|
@@ -77,6 +80,7 @@ files:
|
|
77
80
|
- lib/generators/pixelforce_cms/templates/javascripts/application.js
|
78
81
|
- lib/generators/pixelforce_cms/templates/javascripts/respond.js
|
79
82
|
- lib/generators/pixelforce_cms/templates/new.html.haml
|
83
|
+
- lib/generators/pixelforce_cms/templates/notification.rb
|
80
84
|
- lib/generators/pixelforce_cms/templates/pages_controller.rb
|
81
85
|
- lib/generators/pixelforce_cms/templates/recipes/base.rb
|
82
86
|
- lib/generators/pixelforce_cms/templates/recipes/sphinx.rb
|
@@ -84,6 +88,7 @@ files:
|
|
84
88
|
- lib/generators/pixelforce_cms/templates/recipes/templates/sphinx_init.erb
|
85
89
|
- lib/generators/pixelforce_cms/templates/recipes/templates/unicorn_init.erb
|
86
90
|
- lib/generators/pixelforce_cms/templates/recipes/unicorn.rb
|
91
|
+
- lib/generators/pixelforce_cms/templates/unicorn.rb
|
87
92
|
- lib/pixelforce_cms.rb
|
88
93
|
- lib/pixelforce_cms/version.rb
|
89
94
|
- pixelforce_cms.gemspec
|