node_cms 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +92 -0
- data/Rakefile +40 -0
- data/app/controllers/admin/index_controller.rb +17 -0
- data/app/views/devise/confirmations/new.html.erb +12 -0
- data/app/views/devise/mailer/confirmation_instructions.html.erb +5 -0
- data/app/views/devise/mailer/reset_password_instructions.html.erb +8 -0
- data/app/views/devise/mailer/unlock_instructions.html.erb +7 -0
- data/app/views/devise/passwords/edit.html.erb +16 -0
- data/app/views/devise/passwords/new.html.slim +21 -0
- data/app/views/devise/registrations/edit.html.erb +29 -0
- data/app/views/devise/registrations/new.html.slim +30 -0
- data/app/views/devise/sessions/new.html.slim +29 -0
- data/app/views/devise/shared/_links.erb +25 -0
- data/app/views/devise/unlocks/new.html.erb +12 -0
- data/app/views/layouts/admin/admin.html.slim +45 -0
- data/app/views/layouts/admin/login.html.slim +19 -0
- data/config/routes.rb +4 -0
- data/lib/generators/node_cms/config_generator.rb +16 -0
- data/lib/generators/node_cms/install_generator.rb +14 -0
- data/lib/generators/node_cms/layout_generator.rb +15 -0
- data/lib/generators/node_cms/templates/node_cms_config.rb +22 -0
- data/lib/generators/node_cms/view_generator.rb +18 -0
- data/lib/node_cms.rb +5 -0
- data/lib/node_cms/config.rb +28 -0
- data/lib/node_cms/engine.rb +8 -0
- data/lib/node_cms/version.rb +3 -0
- data/lib/tasks/node_cms_tasks.rake +4 -0
- metadata +86 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 1269a17c57e1951c7cf7378e0bae82cffd90db5a
|
4
|
+
data.tar.gz: e401037346d065a9cd0ce194d3c422a85f0cbd32
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9e62b4cf0c829a857c580abb6df1fbdefd8a03767a06ea91dd840def9805c669c80f939731ec3bed2c399f4c456ac590b99bb3e7e576ec320e019e8ce19c9c0e
|
7
|
+
data.tar.gz: 23c57e2c763fcc6a63f6a067baeebed7c44424458b66c0eaa9ccb4fa277f913c61fbda87799f38478e22e628e26bbd0467edc44fea218e2cab79a91a549d5bf0
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2013 YOURNAME
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
= HowTo
|
2
|
+
|
3
|
+
Rails engine that makes managing faq/manual easy and simple. Multilingual CMS for managing faq, question/answer, manual etc.
|
4
|
+
|
5
|
+
|
6
|
+
{Live Demo}[http://how-to-demo.herokuapp.com]
|
7
|
+
|
8
|
+
{Live demo source code}[https://github.com/railscash/how_to_demo]
|
9
|
+
|
10
|
+
|
11
|
+
===Usage
|
12
|
+
======Include the gem in your Gemfile and bundle to install the gem.
|
13
|
+
|
14
|
+
gem 'how_to'
|
15
|
+
|
16
|
+
====You may need to add the following gems if you want to use default layout for how_to. See layout customization section for more details
|
17
|
+
|
18
|
+
gem "jquery-rails"
|
19
|
+
gem 'bootstrap-sass'
|
20
|
+
gem 'sass-rails', '~> 3.2.5'
|
21
|
+
|
22
|
+
|
23
|
+
===== Install the migrations
|
24
|
+
rake how_to:install:migrations
|
25
|
+
|
26
|
+
===== Run db migrations
|
27
|
+
rake db:migrate
|
28
|
+
|
29
|
+
|
30
|
+
===== Mount in your application's route
|
31
|
+
mount HowTo::Engine => "/how_to"
|
32
|
+
|
33
|
+
===== You can also get the configuration file and overrides by running the config generator.
|
34
|
+
rails g how_to:config
|
35
|
+
|
36
|
+
Details are documented in config file, so please read the config file carefully.
|
37
|
+
|
38
|
+
====== rake db:migrate and visit mounted location, e.g.
|
39
|
+
|
40
|
+
localhost:3000/how_to
|
41
|
+
|
42
|
+
You should see the public page. You should also see two links on head section named sections and contents. if you override the authorization methods (described in later section) make sure you have permissions to access those pages.
|
43
|
+
|
44
|
+
===Modules
|
45
|
+
Two models are there.
|
46
|
+
|
47
|
+
==== Section
|
48
|
+
You can have multilevel section. You can consider this as category. Sections are hierarchical, but only leaves are eligible to have contents
|
49
|
+
|
50
|
+
|
51
|
+
==== Content
|
52
|
+
You can create content as question/answer or faq under a specific section. If you love rich text editor for content then see the last section of Readme.
|
53
|
+
|
54
|
+
|
55
|
+
===== Sample helper methods you may need to define them in your application controller
|
56
|
+
|
57
|
+
def authorize_to_manage_how_to! #you can set the method name in config file
|
58
|
+
redirect_to :root, :notice => t('notifications.admin_section_access_error') unless admin?
|
59
|
+
end
|
60
|
+
|
61
|
+
def allowed_to_view_how_to #you can set the method name in config file
|
62
|
+
redirect_to main_app.root_path, :notice => t('notifications.admin_section_access_error') unless current_user
|
63
|
+
end
|
64
|
+
|
65
|
+
def permitted_to_manage_how_to? #you can set the method name in config file
|
66
|
+
admin?
|
67
|
+
end
|
68
|
+
|
69
|
+
|
70
|
+
===== Optionaly you can customise the layout and view page using:
|
71
|
+
======this will generate layout and associated partials under views/layouts/how_to/
|
72
|
+
rails g how_to:layout
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
======this will generate the public page for faq/manual under views/how_to/
|
77
|
+
rails g how_to:view
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
|
82
|
+
=== If you want to use rich text editor to manage your content HowTo uses Mercury gem for it. Just install mercury gem and configure as per your requirements. Visit https://github.com/jejacks0n/mercury for more details
|
83
|
+
Then set
|
84
|
+
config.rich_text_enabled = true
|
85
|
+
in initializers/how_to_config.rb file
|
86
|
+
|
87
|
+
|
88
|
+
====For any issues feel free to contact with me or use issue tracker. Drop me a line to ahmed2tul@gmail.com
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
This project rocks and uses MIT-LICENSE.
|
data/Rakefile
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
begin
|
3
|
+
require 'bundler/setup'
|
4
|
+
rescue LoadError
|
5
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
6
|
+
end
|
7
|
+
begin
|
8
|
+
require 'rdoc/task'
|
9
|
+
rescue LoadError
|
10
|
+
require 'rdoc/rdoc'
|
11
|
+
require 'rake/rdoctask'
|
12
|
+
RDoc::Task = Rake::RDocTask
|
13
|
+
end
|
14
|
+
|
15
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
16
|
+
rdoc.rdoc_dir = 'rdoc'
|
17
|
+
rdoc.title = 'HowTo'
|
18
|
+
rdoc.options << '--line-numbers'
|
19
|
+
rdoc.rdoc_files.include('README.rdoc')
|
20
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
21
|
+
end
|
22
|
+
|
23
|
+
APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
|
24
|
+
load 'rails/tasks/engine.rake'
|
25
|
+
|
26
|
+
|
27
|
+
|
28
|
+
Bundler::GemHelper.install_tasks
|
29
|
+
|
30
|
+
require 'rake/testtask'
|
31
|
+
|
32
|
+
Rake::TestTask.new(:test) do |t|
|
33
|
+
t.libs << 'lib'
|
34
|
+
t.libs << 'test'
|
35
|
+
t.pattern = 'test/**/*_test.rb'
|
36
|
+
t.verbose = false
|
37
|
+
end
|
38
|
+
|
39
|
+
|
40
|
+
task :default => :test
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class Admin::IndexController < ApplicationController
|
2
|
+
before_filter :authenticate_admin!
|
3
|
+
|
4
|
+
layout 'admin'
|
5
|
+
def index
|
6
|
+
|
7
|
+
end
|
8
|
+
|
9
|
+
|
10
|
+
def after_sign_out_path_for(resource)
|
11
|
+
new_admin_session_path
|
12
|
+
end
|
13
|
+
|
14
|
+
def after_sign_in_path_for(resource)
|
15
|
+
request.env['omniauth.origin'] || stored_location_for(resource) || new_admin_manual_page_path
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<h2>Resend confirmation instructions</h2>
|
2
|
+
|
3
|
+
<%= form_for(resource, :as => resource_name, :url => confirmation_path(resource_name), :html => { :method => :post }) do |f| %>
|
4
|
+
<%= devise_error_messages! %>
|
5
|
+
|
6
|
+
<div><%= f.label :email %><br />
|
7
|
+
<%= f.email_field :email, :autofocus => true %></div>
|
8
|
+
|
9
|
+
<div><%= f.submit "Resend confirmation instructions" %></div>
|
10
|
+
<% end %>
|
11
|
+
|
12
|
+
<%= render "devise/shared/links" %>
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<p>Hello <%= @resource.email %>!</p>
|
2
|
+
|
3
|
+
<p>Someone has requested a link to change your password. You can do this through the link below.</p>
|
4
|
+
|
5
|
+
<p><%= link_to 'Change my password', edit_password_url(@resource, :reset_password_token => @token) %></p>
|
6
|
+
|
7
|
+
<p>If you didn't request this, please ignore this email.</p>
|
8
|
+
<p>Your password won't change until you access the link above and create a new one.</p>
|
@@ -0,0 +1,7 @@
|
|
1
|
+
<p>Hello <%= @resource.email %>!</p>
|
2
|
+
|
3
|
+
<p>Your account has been locked due to an excessive number of unsuccessful sign in attempts.</p>
|
4
|
+
|
5
|
+
<p>Click the link below to unlock your account:</p>
|
6
|
+
|
7
|
+
<p><%= link_to 'Unlock my account', unlock_url(@resource, :unlock_token => @token) %></p>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<h2>Change your password</h2>
|
2
|
+
|
3
|
+
<%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :put }) do |f| %>
|
4
|
+
<%= devise_error_messages! %>
|
5
|
+
<%= f.hidden_field :reset_password_token %>
|
6
|
+
|
7
|
+
<div><%= f.label :password, "New password" %><br />
|
8
|
+
<%= f.password_field :password, :autofocus => true %></div>
|
9
|
+
|
10
|
+
<div><%= f.label :password_confirmation, "Confirm new password" %><br />
|
11
|
+
<%= f.password_field :password_confirmation %></div>
|
12
|
+
|
13
|
+
<div><%= f.submit "Change my password" %></div>
|
14
|
+
<% end %>
|
15
|
+
|
16
|
+
<%= render "devise/shared/links" %>
|
@@ -0,0 +1,21 @@
|
|
1
|
+
|
2
|
+
div class="panel panel-default col-md-5 col-md-offset-3" style="margin-top:50px; padding:0px"
|
3
|
+
|
4
|
+
div class="panel-heading"
|
5
|
+
strong Forgot your password?
|
6
|
+
|
7
|
+
div class="panel-body"
|
8
|
+
= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :post }) do |f|
|
9
|
+
= devise_error_messages!
|
10
|
+
|
11
|
+
div
|
12
|
+
= f.label :email
|
13
|
+
br
|
14
|
+
= f.email_field :email, :autofocus => true, :class=>"form-control"
|
15
|
+
br
|
16
|
+
|
17
|
+
div
|
18
|
+
= f.submit "Send me reset password instructions", :class => "btn btn-default"
|
19
|
+
|
20
|
+
br
|
21
|
+
= render "devise/shared/links"
|
@@ -0,0 +1,29 @@
|
|
1
|
+
<h2>Edit <%= resource_name.to_s.humanize %></h2>
|
2
|
+
|
3
|
+
<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put }) do |f| %>
|
4
|
+
<%= devise_error_messages! %>
|
5
|
+
|
6
|
+
<div><%= f.label :email %><br />
|
7
|
+
<%= f.email_field :email, :autofocus => true %></div>
|
8
|
+
|
9
|
+
<% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
|
10
|
+
<div>Currently waiting confirmation for: <%= resource.unconfirmed_email %></div>
|
11
|
+
<% end %>
|
12
|
+
|
13
|
+
<div><%= f.label :password %> <i>(leave blank if you don't want to change it)</i><br />
|
14
|
+
<%= f.password_field :password, :autocomplete => "off" %></div>
|
15
|
+
|
16
|
+
<div><%= f.label :password_confirmation %><br />
|
17
|
+
<%= f.password_field :password_confirmation %></div>
|
18
|
+
|
19
|
+
<div><%= f.label :current_password %> <i>(we need your current password to confirm your changes)</i><br />
|
20
|
+
<%= f.password_field :current_password %></div>
|
21
|
+
|
22
|
+
<div><%= f.submit "Update" %></div>
|
23
|
+
<% end %>
|
24
|
+
|
25
|
+
<h3>Cancel my account</h3>
|
26
|
+
|
27
|
+
<p>Unhappy? <%= button_to "Cancel my account", registration_path(resource_name), :data => { :confirm => "Are you sure?" }, :method => :delete %></p>
|
28
|
+
|
29
|
+
<%= link_to "Back", :back %>
|
@@ -0,0 +1,30 @@
|
|
1
|
+
div class="panel panel-default col-md-5 col-md-offset-3" style="margin-top:50px; padding:0px"
|
2
|
+
|
3
|
+
div class="panel-heading"
|
4
|
+
strong Sign up
|
5
|
+
|
6
|
+
div class="panel-body"
|
7
|
+
= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f|
|
8
|
+
= devise_error_messages!
|
9
|
+
|
10
|
+
div
|
11
|
+
= f.label :email
|
12
|
+
br
|
13
|
+
= f.email_field :email, :autofocus => true, :class=>"form-control"
|
14
|
+
br
|
15
|
+
div
|
16
|
+
= f.label :password
|
17
|
+
br
|
18
|
+
= f.password_field :password, :class=>"form-control"
|
19
|
+
br
|
20
|
+
div
|
21
|
+
= f.label :password_confirmation
|
22
|
+
br
|
23
|
+
= f.password_field :password_confirmation, :class=>"form-control"
|
24
|
+
br
|
25
|
+
div
|
26
|
+
= f.submit "Sign up", :class => "btn btn-default"
|
27
|
+
br
|
28
|
+
br
|
29
|
+
|
30
|
+
= render "devise/shared/links"
|
@@ -0,0 +1,29 @@
|
|
1
|
+
div class="panel panel-default col-md-5 col-md-offset-3" style="margin-top:50px; padding:0px"
|
2
|
+
|
3
|
+
div class="panel-heading"
|
4
|
+
strong Sign in
|
5
|
+
|
6
|
+
div class="panel-body"
|
7
|
+
= form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f|
|
8
|
+
|
9
|
+
div
|
10
|
+
= f.label :email
|
11
|
+
br
|
12
|
+
= f.email_field :email, :autofocus => true, :class=>"form-control"
|
13
|
+
br
|
14
|
+
div
|
15
|
+
= f.label :password
|
16
|
+
br
|
17
|
+
= f.password_field :password, :class=>"form-control"
|
18
|
+
|
19
|
+
div class = "checkbox"
|
20
|
+
= f.check_box :remember_me
|
21
|
+
= f.label :remember_me
|
22
|
+
|
23
|
+
div
|
24
|
+
= f.submit "Sign in", :class => "btn btn-default"
|
25
|
+
br
|
26
|
+
br
|
27
|
+
|
28
|
+
|
29
|
+
= render "devise/shared/links"
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<%- if controller_name != 'sessions' %>
|
2
|
+
<%= link_to "Sign in", new_session_path(resource_name) %><br />
|
3
|
+
<% end -%>
|
4
|
+
|
5
|
+
<%- if devise_mapping.registerable? && controller_name != 'registrations' %>
|
6
|
+
<%= link_to "Sign up", new_registration_path(resource_name) %><br />
|
7
|
+
<% end -%>
|
8
|
+
|
9
|
+
<%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %>
|
10
|
+
<%= link_to "Forgot your password?", new_password_path(resource_name) %><br />
|
11
|
+
<% end -%>
|
12
|
+
|
13
|
+
<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
|
14
|
+
<%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %><br />
|
15
|
+
<% end -%>
|
16
|
+
|
17
|
+
<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
|
18
|
+
<%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %><br />
|
19
|
+
<% end -%>
|
20
|
+
|
21
|
+
<%- if devise_mapping.omniauthable? %>
|
22
|
+
<%- resource_class.omniauth_providers.each do |provider| %>
|
23
|
+
<%= link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider) %><br />
|
24
|
+
<% end -%>
|
25
|
+
<% end -%>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<h2>Resend unlock instructions</h2>
|
2
|
+
|
3
|
+
<%= form_for(resource, :as => resource_name, :url => unlock_path(resource_name), :html => { :method => :post }) do |f| %>
|
4
|
+
<%= devise_error_messages! %>
|
5
|
+
|
6
|
+
<div><%= f.label :email %><br />
|
7
|
+
<%= f.email_field :email, :autofocus => true %></div>
|
8
|
+
|
9
|
+
<div><%= f.submit "Resend unlock instructions" %></div>
|
10
|
+
<% end %>
|
11
|
+
|
12
|
+
<%= render "devise/shared/links" %>
|
@@ -0,0 +1,45 @@
|
|
1
|
+
doctype html
|
2
|
+
html
|
3
|
+
head
|
4
|
+
title FirstApp
|
5
|
+
= stylesheet_link_tag "admin", media: "all", "data-turbolinks-track" => true
|
6
|
+
= javascript_include_tag "admin", "data-turbolinks-track" => true
|
7
|
+
= csrf_meta_tags
|
8
|
+
body
|
9
|
+
|
10
|
+
div class="header"
|
11
|
+
a href="#{request.path}"
|
12
|
+
img src="#{asset_path('logo.png')}"
|
13
|
+
|
14
|
+
div class="pull-right"
|
15
|
+
- if admin_signed_in?
|
16
|
+
'Welcome,
|
17
|
+
= current_admin.email
|
18
|
+
br
|
19
|
+
= link_to 'Logout', destroy_admin_session_path, :method => :delete
|
20
|
+
- else
|
21
|
+
= link_to 'Login', new_admin_session_path
|
22
|
+
|
23
|
+
|
24
|
+
div id="center" class="container"
|
25
|
+
div class="t-left"
|
26
|
+
|
27
|
+
ul class="menu"
|
28
|
+
li
|
29
|
+
a href="/admin/manual/pages" Manual
|
30
|
+
|
31
|
+
li
|
32
|
+
a href="#" Pages
|
33
|
+
|
34
|
+
li
|
35
|
+
a href="/admin/settings" Settings
|
36
|
+
|
37
|
+
|
38
|
+
div id="content" class="t-right"
|
39
|
+
div style="padding:0px 10px"
|
40
|
+
== yield
|
41
|
+
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
div id="footer"
|
@@ -0,0 +1,19 @@
|
|
1
|
+
doctype html
|
2
|
+
html
|
3
|
+
head
|
4
|
+
title FirstApp
|
5
|
+
= stylesheet_link_tag asset_path('admin.css'), media: "all", "data-turbolinks-track" => true
|
6
|
+
= javascript_include_tag asset_path('admin.js'), "data-turbolinks-track" => true
|
7
|
+
= csrf_meta_tags
|
8
|
+
body
|
9
|
+
|
10
|
+
div class="header"
|
11
|
+
a href="#{request.path}"
|
12
|
+
img src="#{asset_path('logo.png')}"
|
13
|
+
|
14
|
+
div class="container"
|
15
|
+
|
16
|
+
== yield
|
17
|
+
|
18
|
+
|
19
|
+
div id="footer"
|
data/config/routes.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
module Node_Cms
|
2
|
+
module Generators
|
3
|
+
class ConfigGenerator < Rails::Generators::Base
|
4
|
+
source_root File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
|
5
|
+
|
6
|
+
desc <<DESC
|
7
|
+
Description:
|
8
|
+
Copies HowTo configuration file to your application's initializer directory.
|
9
|
+
DESC
|
10
|
+
|
11
|
+
def copy_config_file
|
12
|
+
template 'node_cms_config.rb', 'config/initializers/node_cms_config.rb'
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Node_Cms
|
2
|
+
module Generators
|
3
|
+
class InstallGenerator < Rails::Generators::Base
|
4
|
+
source_root File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
|
5
|
+
|
6
|
+
def copy_config_file
|
7
|
+
template 'node_cms_config.rb', 'config/initializers/node_cms_config.rb'
|
8
|
+
directory "../../../../app/views/layouts/admin" , "app/views/layouts/admin"
|
9
|
+
directory "../../../../app/views/devise" , "app/views/devise"
|
10
|
+
directory "../../../../app/controllers/admin" , "app/controllers/admin"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Node_Cms
|
2
|
+
module Generators
|
3
|
+
|
4
|
+
class LayoutGenerator < Rails::Generators::Base
|
5
|
+
source_root File.expand_path('../../../../app', __FILE__)
|
6
|
+
|
7
|
+
def generate_partial
|
8
|
+
copy_file "/models/admin.rb", "app/models/admin.rb"
|
9
|
+
directory "../admin" , "app/views/layouts/admin"
|
10
|
+
directory "../../devise" , "app/views/devise"
|
11
|
+
directory "../../../controllers/admin" , "app/controllers/admin"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
Node_Cms.configure do |config|
|
2
|
+
#to enable rich text editor make the following line uncommented with the value true
|
3
|
+
#HowTo uses mercury <https://github.com/jejacks0n/mercury> for rich text editor
|
4
|
+
#You have to install mercury to your application
|
5
|
+
#config.rich_text_enabled = false
|
6
|
+
|
7
|
+
#in your application controller:
|
8
|
+
# def authorize_to_manage_how_to
|
9
|
+
# redirect_to :somewhere_else unless <condition>
|
10
|
+
# end
|
11
|
+
#
|
12
|
+
#config.authorization_method_to_manage = :authorize_to_manage_how_to!
|
13
|
+
#
|
14
|
+
# if you want to set some permission to vew the how to then you can set a method name and define it as like authorization_method_to_manage
|
15
|
+
# def allowed_to_view_how_to
|
16
|
+
# redirect_to main_app.root_path, :notice => t('notifications.admin_section_access_error') unless current_user
|
17
|
+
# end
|
18
|
+
#config.authorization_method_to_view = nil #nil allows everybody to vew the how lo page
|
19
|
+
|
20
|
+
#this method should return true/false
|
21
|
+
#config.permitted_to_manage_how_to = :permitted_to_manage_how_to?
|
22
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Node_Cms
|
2
|
+
module Generators
|
3
|
+
|
4
|
+
class ViewGenerator < Rails::Generators::Base
|
5
|
+
source_root File.expand_path('../../../../app/views/node_manual', __FILE__)
|
6
|
+
|
7
|
+
desc <<DESC
|
8
|
+
Description:
|
9
|
+
Copies NodeManual view (show.html.erb) file to your application's /views/node_manual directory.
|
10
|
+
DESC
|
11
|
+
def generate_view
|
12
|
+
copy_file "faq/show.html.erb", "app/views/node_manual/faq/show.html.erb"
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
data/lib/node_cms.rb
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'active_support/configurable'
|
2
|
+
|
3
|
+
module Node_Cms
|
4
|
+
|
5
|
+
def self.configure(&block)
|
6
|
+
yield @config ||= Node_Cms::Configuration.new
|
7
|
+
end
|
8
|
+
|
9
|
+
# Global settings for Node_Cms
|
10
|
+
def self.config
|
11
|
+
@config
|
12
|
+
end
|
13
|
+
|
14
|
+
class Configuration #:nodoc:
|
15
|
+
include ActiveSupport::Configurable
|
16
|
+
config_accessor :rich_text_enabled
|
17
|
+
config_accessor :authorization_method_to_manage
|
18
|
+
config_accessor :authorization_method_to_view
|
19
|
+
config_accessor :permitted_to_manage_how_to
|
20
|
+
end
|
21
|
+
|
22
|
+
configure do |config|
|
23
|
+
config.rich_text_enabled = false
|
24
|
+
config.authorization_method_to_manage = 'authorize_to_manage_how_to'
|
25
|
+
config.authorization_method_to_view = nil
|
26
|
+
config.permitted_to_manage_how_to = 'permitted_to_manage_how_to?'
|
27
|
+
end
|
28
|
+
end
|
metadata
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: node_cms
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Tomasz Bec
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-11-06 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 4.0.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 4.0.0
|
27
|
+
description: CMS for managing manual pages etc
|
28
|
+
email:
|
29
|
+
- tomaszbec@node1.com
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- app/controllers/admin/index_controller.rb
|
35
|
+
- app/views/devise/confirmations/new.html.erb
|
36
|
+
- app/views/devise/mailer/confirmation_instructions.html.erb
|
37
|
+
- app/views/devise/mailer/reset_password_instructions.html.erb
|
38
|
+
- app/views/devise/mailer/unlock_instructions.html.erb
|
39
|
+
- app/views/devise/passwords/edit.html.erb
|
40
|
+
- app/views/devise/passwords/new.html.slim
|
41
|
+
- app/views/devise/registrations/edit.html.erb
|
42
|
+
- app/views/devise/registrations/new.html.slim
|
43
|
+
- app/views/devise/sessions/new.html.slim
|
44
|
+
- app/views/devise/shared/_links.erb
|
45
|
+
- app/views/devise/unlocks/new.html.erb
|
46
|
+
- app/views/layouts/admin/admin.html.slim
|
47
|
+
- app/views/layouts/admin/login.html.slim
|
48
|
+
- config/routes.rb
|
49
|
+
- lib/generators/node_cms/config_generator.rb
|
50
|
+
- lib/generators/node_cms/install_generator.rb
|
51
|
+
- lib/generators/node_cms/layout_generator.rb
|
52
|
+
- lib/generators/node_cms/templates/node_cms_config.rb
|
53
|
+
- lib/generators/node_cms/view_generator.rb
|
54
|
+
- lib/node_cms/config.rb
|
55
|
+
- lib/node_cms/engine.rb
|
56
|
+
- lib/node_cms/version.rb
|
57
|
+
- lib/node_cms.rb
|
58
|
+
- lib/tasks/node_cms_tasks.rake
|
59
|
+
- MIT-LICENSE
|
60
|
+
- Rakefile
|
61
|
+
- README.rdoc
|
62
|
+
homepage: http://node1.com
|
63
|
+
licenses: []
|
64
|
+
metadata: {}
|
65
|
+
post_install_message:
|
66
|
+
rdoc_options: []
|
67
|
+
require_paths:
|
68
|
+
- lib
|
69
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
70
|
+
requirements:
|
71
|
+
- - ">="
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '0'
|
74
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
75
|
+
requirements:
|
76
|
+
- - ">="
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '0'
|
79
|
+
requirements: []
|
80
|
+
rubyforge_project:
|
81
|
+
rubygems_version: 2.1.10
|
82
|
+
signing_key:
|
83
|
+
specification_version: 4
|
84
|
+
summary: Node1 - CMS
|
85
|
+
test_files: []
|
86
|
+
has_rdoc:
|