et_cms 0.0.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.
- data/MIT-LICENSE +20 -0
- data/README.rdoc +51 -0
- data/Rakefile +40 -0
- data/app/assets/javascripts/et_cms/admin/user.js +2 -0
- data/app/assets/javascripts/et_cms/admin.js +2 -0
- data/app/assets/javascripts/et_cms/application.js +17 -0
- data/app/assets/javascripts/et_cms/bootstrap.js.coffee +4 -0
- data/app/assets/javascripts/et_cms/pages.js +2 -0
- data/app/assets/stylesheets/et_cms/admin/user.css +4 -0
- data/app/assets/stylesheets/et_cms/admin.css +4 -0
- data/app/assets/stylesheets/et_cms/application.css +13 -0
- data/app/assets/stylesheets/et_cms/bootstrap_and_overrides.css.less +33 -0
- data/app/assets/stylesheets/et_cms/forms.css.scss +33 -0
- data/app/assets/stylesheets/et_cms/pages.css +4 -0
- data/app/controllers/et_cms/admin/pages_controller.rb +47 -0
- data/app/controllers/et_cms/admin/user_controller.rb +49 -0
- data/app/controllers/et_cms/admin_controller.rb +7 -0
- data/app/controllers/et_cms/application_controller.rb +5 -0
- data/app/controllers/et_cms/pages_controller.rb +15 -0
- data/app/helpers/et_cms/admin/user_helper.rb +4 -0
- data/app/helpers/et_cms/admin_helper.rb +4 -0
- data/app/helpers/et_cms/application_helper.rb +4 -0
- data/app/helpers/et_cms/pages_helper.rb +4 -0
- data/app/models/ckeditor/asset.rb +4 -0
- data/app/models/ckeditor/attachment_file.rb +12 -0
- data/app/models/ckeditor/picture.rb +13 -0
- data/app/models/et_cms/page.rb +8 -0
- data/app/models/et_cms/user.rb +19 -0
- data/app/views/et_cms/admin/pages/_form.html.erb +18 -0
- data/app/views/et_cms/admin/pages/edit.html.erb +1 -0
- data/app/views/et_cms/admin/pages/index.html.erb +20 -0
- data/app/views/et_cms/admin/pages/new.html.erb +1 -0
- data/app/views/et_cms/admin/user/edit.html.erb +8 -0
- data/app/views/et_cms/admin/user/index.html.erb +24 -0
- data/app/views/et_cms/admin/user/new.html.erb +8 -0
- data/app/views/et_cms/pages/home.html.erb +2 -0
- data/app/views/et_cms/pages/show.html.erb +1 -0
- data/app/views/layouts/devise.html.erb +44 -0
- data/app/views/layouts/et_cms/admin.html.erb +44 -0
- data/app/views/layouts/et_cms/application.html.erb +41 -0
- data/config/initializers/ckeditor.rb +18 -0
- data/config/initializers/devise.rb +233 -0
- data/config/locales/devise.en.yml +58 -0
- data/config/routes.rb +23 -0
- data/db/migrate/20121218084106_create_ckeditor_assets.rb +26 -0
- data/db/migrate/20121218144615_create_et_cms_pages.rb +20 -0
- data/db/migrate/20121218190919_devise_create_et_cms_users.rb +46 -0
- data/lib/et_cms/engine.rb +5 -0
- data/lib/et_cms/version.rb +3 -0
- data/lib/et_cms.rb +14 -0
- data/lib/generators/et_cms/install_generator.rb +38 -0
- data/lib/generators/et_cms/templates/ckeditor.rb +26 -0
- data/lib/generators/et_cms/templates/pages.rb +20 -0
- data/lib/generators/et_cms/templates/seeds.rb +3 -0
- data/lib/generators/et_cms/templates/users.rb +46 -0
- data/lib/tasks/et_cms_tasks.rake +4 -0
- data/test/dummy/README.rdoc +261 -0
- data/test/dummy/Rakefile +7 -0
- data/test/dummy/app/assets/javascripts/application.js +15 -0
- data/test/dummy/app/assets/stylesheets/application.css +13 -0
- data/test/dummy/app/controllers/application_controller.rb +3 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/config/application.rb +59 -0
- data/test/dummy/config/boot.rb +10 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +37 -0
- data/test/dummy/config/environments/production.rb +67 -0
- data/test/dummy/config/environments/test.rb +37 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/inflections.rb +15 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +7 -0
- data/test/dummy/config/initializers/session_store.rb +8 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +5 -0
- data/test/dummy/config/routes.rb +4 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/log/development.log +3 -0
- data/test/dummy/public/404.html +26 -0
- data/test/dummy/public/422.html +26 -0
- data/test/dummy/public/500.html +25 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/script/rails +6 -0
- data/test/et_cms_test.rb +7 -0
- data/test/fixtures/et_cms/pages.yml +11 -0
- data/test/fixtures/et_cms/users.yml +11 -0
- data/test/functional/et_cms/admin/user_controller_test.rb +26 -0
- data/test/functional/et_cms/admin_controller_test.rb +9 -0
- data/test/functional/et_cms/pages_controller_test.rb +16 -0
- data/test/integration/navigation_test.rb +10 -0
- data/test/test_helper.rb +15 -0
- data/test/unit/et_cms/page_test.rb +9 -0
- data/test/unit/et_cms/user_test.rb +9 -0
- data/test/unit/helpers/et_cms/admin/user_helper_test.rb +6 -0
- data/test/unit/helpers/et_cms/admin_helper_test.rb +6 -0
- data/test/unit/helpers/et_cms/pages_helper_test.rb +6 -0
- metadata +317 -0
data/MIT-LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Copyright 2012 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,51 @@
|
|
|
1
|
+
= EtCms
|
|
2
|
+
|
|
3
|
+
Simple cms that uses, ckeditor, devise, and twitter bootstrap.
|
|
4
|
+
|
|
5
|
+
Add to gemfile
|
|
6
|
+
gem 'et_cms', :git => "git://github.com/entretechno/et-cms.git"
|
|
7
|
+
|
|
8
|
+
Delete my_app/public/index.html
|
|
9
|
+
|
|
10
|
+
Run
|
|
11
|
+
bundle install
|
|
12
|
+
rails g et_cms:install
|
|
13
|
+
rake db:migrate && rake db:seed
|
|
14
|
+
rails s
|
|
15
|
+
|
|
16
|
+
Visit http://localhost:3000/admin and log in using:
|
|
17
|
+
|
|
18
|
+
* *User*: admin@example.com
|
|
19
|
+
* *Password*: password
|
|
20
|
+
|
|
21
|
+
Devise setup
|
|
22
|
+
|
|
23
|
+
Some setup you must do manually if you haven't yet:
|
|
24
|
+
|
|
25
|
+
1. Ensure you have defined default url options in your environments files. Here
|
|
26
|
+
is an example of default_url_options appropriate for a development environment
|
|
27
|
+
in config/environments/development.rb:
|
|
28
|
+
|
|
29
|
+
config.action_mailer.default_url_options = { :host => 'localhost:3000' }
|
|
30
|
+
|
|
31
|
+
In production, :host should be set to the actual host of your application.
|
|
32
|
+
|
|
33
|
+
2. Ensure you have defined root_url to *something* in your config/routes.rb.
|
|
34
|
+
For example:
|
|
35
|
+
|
|
36
|
+
root :to => "home#index"
|
|
37
|
+
|
|
38
|
+
3. Ensure you have flash messages in app/views/layouts/application.html.erb.
|
|
39
|
+
For example:
|
|
40
|
+
|
|
41
|
+
<p class="notice"><%= notice %></p>
|
|
42
|
+
<p class="alert"><%= alert %></p>
|
|
43
|
+
|
|
44
|
+
4. If you are deploying Rails 3.1 on Heroku, you may want to set:
|
|
45
|
+
|
|
46
|
+
config.assets.initialize_on_precompile = false
|
|
47
|
+
|
|
48
|
+
On config/application.rb forcing your application to not access the DB
|
|
49
|
+
or load models when precompiling your assets.
|
|
50
|
+
|
|
51
|
+
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 = 'EtCms'
|
|
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
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
|
2
|
+
// listed below.
|
|
3
|
+
//
|
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
|
5
|
+
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
|
|
6
|
+
//
|
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
|
8
|
+
// the compiled file.
|
|
9
|
+
//
|
|
10
|
+
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
|
|
11
|
+
// GO AFTER THE REQUIRES BELOW.
|
|
12
|
+
//
|
|
13
|
+
//= require jquery
|
|
14
|
+
//= require jquery_ujs
|
|
15
|
+
//= require ckeditor/init
|
|
16
|
+
//= require twitter/bootstrap
|
|
17
|
+
//= require_tree .
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
|
3
|
+
* listed below.
|
|
4
|
+
*
|
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
|
6
|
+
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
|
|
7
|
+
*
|
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the top of the
|
|
9
|
+
* compiled file, but it's generally better to create a new file per style scope.
|
|
10
|
+
*
|
|
11
|
+
*= require_self
|
|
12
|
+
*= require_tree .
|
|
13
|
+
*/
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
@import "twitter/bootstrap/bootstrap";
|
|
2
|
+
body { padding-top: 60px; }
|
|
3
|
+
@import "twitter/bootstrap/responsive";
|
|
4
|
+
|
|
5
|
+
// Set the correct sprite paths
|
|
6
|
+
@iconSpritePath: asset-path("twitter/bootstrap/glyphicons-halflings");
|
|
7
|
+
@iconWhiteSpritePath: asset-path("twitter/bootstrap/glyphicons-halflings-white");
|
|
8
|
+
|
|
9
|
+
// Set the Font Awesome (Font Awesome is default. You can disable by commenting below lines)
|
|
10
|
+
// Note: If you use asset_path() here, your compiled bootstrap_and_overrides.css will not
|
|
11
|
+
// have the proper paths. So for now we use the absolute path.
|
|
12
|
+
@fontAwesomeEotPath: asset-path("fontawesome-webfont.eot");
|
|
13
|
+
@fontAwesomeEotPath_iefix: asset-path("fontawesome-webfont.eot#iefix");
|
|
14
|
+
@fontAwesomeWoffPath: asset-path("fontawesome-webfont.woff");
|
|
15
|
+
@fontAwesomeTtfPath: asset-path("fontawesome-webfont.ttf");
|
|
16
|
+
@fontAwesomeSvgPath: asset-path("fontawesome-webfont.svg");
|
|
17
|
+
|
|
18
|
+
// Font Awesome
|
|
19
|
+
@import "fontawesome";
|
|
20
|
+
|
|
21
|
+
// Glyphicons
|
|
22
|
+
//@import "twitter/bootstrap/sprites.less";
|
|
23
|
+
|
|
24
|
+
// Your custom LESS stylesheets goes here
|
|
25
|
+
//
|
|
26
|
+
// Since bootstrap was imported above you have access to its mixins which
|
|
27
|
+
// you may use and inherit here
|
|
28
|
+
//
|
|
29
|
+
// If you'd like to override bootstrap's own variables, you can do so here as well
|
|
30
|
+
// See http://twitter.github.com/bootstrap/customize.html#variables for their names and documentation
|
|
31
|
+
//
|
|
32
|
+
// Example:
|
|
33
|
+
// @linkColor: #ff0000;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
form {
|
|
2
|
+
|
|
3
|
+
li {
|
|
4
|
+
list-style-type: none;
|
|
5
|
+
label {
|
|
6
|
+
width: 130px;
|
|
7
|
+
color: black !important;
|
|
8
|
+
background-color: white !important;
|
|
9
|
+
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
label {
|
|
13
|
+
font-size: 12px;
|
|
14
|
+
font-weight: bold;
|
|
15
|
+
width: 130px;
|
|
16
|
+
color: black !important;
|
|
17
|
+
background-color: white !important;
|
|
18
|
+
padding-left: 4px;
|
|
19
|
+
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.btn {
|
|
24
|
+
margin-top: 5px;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
#page_parent_id_input {
|
|
28
|
+
padding-top: 10px;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.left {
|
|
32
|
+
float: left;
|
|
33
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
module EtCms
|
|
2
|
+
module Admin
|
|
3
|
+
class PagesController < EtCms::AdminController
|
|
4
|
+
|
|
5
|
+
def index
|
|
6
|
+
@pages = Page.all
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def new
|
|
10
|
+
@page = Page.new
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def edit
|
|
14
|
+
@page = Page.find(params[:id])
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def create
|
|
18
|
+
@page = Page.new(params[:page])
|
|
19
|
+
|
|
20
|
+
if @page.save
|
|
21
|
+
redirect_to(pages_url, :notice => 'Page was successfully created.')
|
|
22
|
+
else
|
|
23
|
+
render :action => "new"
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def update
|
|
28
|
+
@page = Page.find(params[:id])
|
|
29
|
+
|
|
30
|
+
respond_to do |format|
|
|
31
|
+
if @page.update_attributes(params[:page])
|
|
32
|
+
format.html { redirect_to(pages_url, :notice => 'Page was successfully updated.') }
|
|
33
|
+
format.json { head :ok }
|
|
34
|
+
else
|
|
35
|
+
format.html { render :action => "edit" }
|
|
36
|
+
format.json { head :bad_request }
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def destroy
|
|
42
|
+
Page.destroy(params[:id])
|
|
43
|
+
redirect_to(pages_url)
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
module EtCms
|
|
2
|
+
module Admin
|
|
3
|
+
class UserController < EtCms::AdminController
|
|
4
|
+
def index
|
|
5
|
+
@users = User.all
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def new
|
|
9
|
+
@user = User.new
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def create
|
|
13
|
+
@user = User.new(params[:user])
|
|
14
|
+
@user.password = 'password'
|
|
15
|
+
@user.password_confirmation = 'password'
|
|
16
|
+
|
|
17
|
+
if @user.save
|
|
18
|
+
redirect_to(admin_user_index_url, :notice => 'User was successfully created.')
|
|
19
|
+
else
|
|
20
|
+
render :action => "new"
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def edit
|
|
25
|
+
@user = User.find(current_user)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def update
|
|
29
|
+
@user = User.find(current_user)
|
|
30
|
+
params[:user].delete(:password) if params[:user][:password].blank?
|
|
31
|
+
params[:user].delete(:password_confirmation) if params[:user][:password].blank? and params[:user][:password_confirmation].blank?
|
|
32
|
+
if @user.update_attributes(params[:user])
|
|
33
|
+
flash[:notice] = "Successfully updated User."
|
|
34
|
+
redirect_to admin_user_index_url
|
|
35
|
+
else
|
|
36
|
+
render :action => 'edit'
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def destroy
|
|
41
|
+
@user = User.find(params[:id])
|
|
42
|
+
if @user.destroy
|
|
43
|
+
flash[:notice] = "Successfully deleted User."
|
|
44
|
+
redirect_to admin_user_index_url
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
class Ckeditor::AttachmentFile < Ckeditor::Asset
|
|
2
|
+
has_attached_file :data,
|
|
3
|
+
:url => "/ckeditor_assets/attachments/:id/:filename",
|
|
4
|
+
:path => ":rails_root/public/ckeditor_assets/attachments/:id/:filename"
|
|
5
|
+
|
|
6
|
+
validates_attachment_size :data, :less_than => 100.megabytes
|
|
7
|
+
validates_attachment_presence :data
|
|
8
|
+
|
|
9
|
+
def url_thumb
|
|
10
|
+
@url_thumb ||= Ckeditor::Utils.filethumb(filename)
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
class Ckeditor::Picture < Ckeditor::Asset
|
|
2
|
+
has_attached_file :data,
|
|
3
|
+
:url => "/ckeditor_assets/pictures/:id/:style_:basename.:extension",
|
|
4
|
+
:path => ":rails_root/public/ckeditor_assets/pictures/:id/:style_:basename.:extension",
|
|
5
|
+
:styles => { :content => '800>', :thumb => '118x100#' }
|
|
6
|
+
|
|
7
|
+
validates_attachment_size :data, :less_than => 2.megabytes
|
|
8
|
+
validates_attachment_presence :data
|
|
9
|
+
|
|
10
|
+
def url_content
|
|
11
|
+
url(:content)
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
module EtCms
|
|
2
|
+
class User < ActiveRecord::Base
|
|
3
|
+
# Include default devise modules. Others available are:
|
|
4
|
+
# :token_authenticatable, :confirmable,
|
|
5
|
+
# :lockable, :timeoutable and :omniauthable
|
|
6
|
+
devise :database_authenticatable, :registerable,
|
|
7
|
+
:recoverable, :rememberable, :trackable, :validatable
|
|
8
|
+
|
|
9
|
+
# Setup accessible (or protected) attributes for your model
|
|
10
|
+
attr_accessible :email, :password, :password_confirmation, :remember_me
|
|
11
|
+
# attr_accessible :title, :body
|
|
12
|
+
|
|
13
|
+
after_create { |user| user.send_reset_password_instructions if user.password.nil? } unless ['test'].include? Rails.env
|
|
14
|
+
|
|
15
|
+
def password_required?
|
|
16
|
+
new_record? ? false : super
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<%= semantic_form_for [:admin,@page] do |f| %>
|
|
2
|
+
<%= f.input :name %>
|
|
3
|
+
<%= f.input :browser_title %>
|
|
4
|
+
<%= f.input :content, :as => :ckeditor, :input_html => {:height => 400}, :label => false %>
|
|
5
|
+
<%= f.input :parent_id %>
|
|
6
|
+
<%= f.input :meta_description %>
|
|
7
|
+
<%= f.label :exclude_from_menu, :class => "left" %>
|
|
8
|
+
<%= f.check_box :exclude_from_menu %>
|
|
9
|
+
<div style="clear:both;"></div>
|
|
10
|
+
<%= f.input :link_url %>
|
|
11
|
+
<%= f.input :list_order %>
|
|
12
|
+
<%= f.input :status %>
|
|
13
|
+
|
|
14
|
+
<%= f.actions do %>
|
|
15
|
+
<%= f.action :submit, :as => :button, :button_html => {:class => "btn btn-success"} %>
|
|
16
|
+
<%= f.action :cancel, :as => :link, :button_html => {:class => "btn btn-warning"} %>
|
|
17
|
+
<% end %>
|
|
18
|
+
<% end %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= render "form" %>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<%= link_to "New Page", new_admin_page_path, :class => "btn btn-primary" %>
|
|
2
|
+
|
|
3
|
+
<table class="table">
|
|
4
|
+
<thead>
|
|
5
|
+
<tr>
|
|
6
|
+
<th>Page</th>
|
|
7
|
+
<th></th>
|
|
8
|
+
</tr>
|
|
9
|
+
</thead>
|
|
10
|
+
<tbody>
|
|
11
|
+
<% @pages.each do |page| %>
|
|
12
|
+
<tr>
|
|
13
|
+
<td><%= page.name %></td>
|
|
14
|
+
<td>
|
|
15
|
+
<%= link_to 'View', page_path(page) %> | <%= link_to 'Edit', edit_admin_page_path(page) %> | <%= link_to 'Delete', admin_page_path(page), :confirm => "Are you sure?", :method => :delete %>
|
|
16
|
+
</td>
|
|
17
|
+
</tr>
|
|
18
|
+
<% end %>
|
|
19
|
+
</tbody>
|
|
20
|
+
</table>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= render "form" %>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<%= semantic_form_for @user, :url => admin_user_path(@user), :method => :put do |f| %>
|
|
2
|
+
<%= f.input :email %>
|
|
3
|
+
|
|
4
|
+
<%= f.actions do %>
|
|
5
|
+
<%= f.action :submit, :as => :button, :button_html => {:class => "btn btn-success"} %>
|
|
6
|
+
<%= f.action :cancel, :as => :link, :button_html => {:class => "btn btn-warning"} %>
|
|
7
|
+
<% end %>
|
|
8
|
+
<% end %>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<%= link_to "New User", new_admin_user_path, :class => "btn btn-primary" %>
|
|
2
|
+
|
|
3
|
+
<table class="table">
|
|
4
|
+
<thead>
|
|
5
|
+
<tr>
|
|
6
|
+
<th>Email</th>
|
|
7
|
+
<th></th>
|
|
8
|
+
</tr>
|
|
9
|
+
</thead>
|
|
10
|
+
<tbody>
|
|
11
|
+
<% @users.each do |user| %>
|
|
12
|
+
<tr>
|
|
13
|
+
<td><%= user.email %></td>
|
|
14
|
+
<td>
|
|
15
|
+
<% if current_user == user %>
|
|
16
|
+
<%= link_to 'Edit', edit_admin_user_path(user) %>
|
|
17
|
+
<% else %>
|
|
18
|
+
<%= link_to 'Delete', admin_user_path(user), :confirm => "Are you sure?", :method => :delete %>
|
|
19
|
+
<% end %>
|
|
20
|
+
</td>
|
|
21
|
+
</tr>
|
|
22
|
+
<% end %>
|
|
23
|
+
</tbody>
|
|
24
|
+
</table>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<%= semantic_form_for @user, :url => "/admin/user", :method => :post do |f| %>
|
|
2
|
+
<%= f.input :email %>
|
|
3
|
+
|
|
4
|
+
<%= f.actions do %>
|
|
5
|
+
<%= f.action :submit, :as => :button, :button_html => {:class => "btn btn-success"} %>
|
|
6
|
+
<%= f.action :cancel, :as => :link, :button_html => {:class => "btn btn-warning"} %>
|
|
7
|
+
<% end %>
|
|
8
|
+
<% end %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= @page.content.html_safe %>
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>EtCms</title>
|
|
5
|
+
<%= stylesheet_link_tag "et_cms/application", :media => "all" %>
|
|
6
|
+
<%= javascript_include_tag "et_cms/application" %>
|
|
7
|
+
<%= csrf_meta_tags %>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
|
|
11
|
+
<div class="navbar navbar-inverse navbar-fixed-top">
|
|
12
|
+
<div class="navbar-inner">
|
|
13
|
+
<div class="container">
|
|
14
|
+
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
|
|
15
|
+
<span class="icon-bar"></span>
|
|
16
|
+
<span class="icon-bar"></span>
|
|
17
|
+
<span class="icon-bar"></span>
|
|
18
|
+
</a>
|
|
19
|
+
<a class="brand" href="#">ET CMS</a>
|
|
20
|
+
|
|
21
|
+
<div class="nav-collapse collapse">
|
|
22
|
+
<ul class="nav">
|
|
23
|
+
<li><%= link_to "Pages", et_cms.admin_pages_path %></li>
|
|
24
|
+
<li><%= link_to "Users", et_cms.admin_user_index_path %></li>
|
|
25
|
+
<li><%= link_to("Logout", et_cms.destroy_user_session_path, :method => :delete) %></li>
|
|
26
|
+
<li> <%= link_to "Change your password", et_cms.edit_user_registration_path %></li>
|
|
27
|
+
</ul>
|
|
28
|
+
</div>
|
|
29
|
+
<!--/.nav-collapse -->
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
|
|
34
|
+
<p class="notice"><%= notice %></p>
|
|
35
|
+
|
|
36
|
+
<% unless alert.nil? %>
|
|
37
|
+
<p class="alert"><%= alert %></p>
|
|
38
|
+
<% end %>
|
|
39
|
+
<div class="container">
|
|
40
|
+
<%= yield %>
|
|
41
|
+
</div>
|
|
42
|
+
|
|
43
|
+
</body>
|
|
44
|
+
</html>
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>EtCms</title>
|
|
5
|
+
<%= stylesheet_link_tag "et_cms/application", :media => "all" %>
|
|
6
|
+
<%= javascript_include_tag "et_cms/application" %>
|
|
7
|
+
<%= csrf_meta_tags %>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
|
|
11
|
+
<div class="navbar navbar-inverse navbar-fixed-top">
|
|
12
|
+
<div class="navbar-inner">
|
|
13
|
+
<div class="container">
|
|
14
|
+
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
|
|
15
|
+
<span class="icon-bar"></span>
|
|
16
|
+
<span class="icon-bar"></span>
|
|
17
|
+
<span class="icon-bar"></span>
|
|
18
|
+
</a>
|
|
19
|
+
<a class="brand" href="#">ET CMS</a>
|
|
20
|
+
|
|
21
|
+
<div class="nav-collapse collapse">
|
|
22
|
+
<ul class="nav">
|
|
23
|
+
<li><%= link_to "Pages", admin_pages_path %></li>
|
|
24
|
+
<li><%= link_to "Users", admin_user_index_path %></li>
|
|
25
|
+
<li><%= link_to("Logout", destroy_user_session_path, :method => :delete) %></li>
|
|
26
|
+
<li> <%= link_to "Change your password", edit_user_registration_path %></li>
|
|
27
|
+
</ul>
|
|
28
|
+
</div>
|
|
29
|
+
<!--/.nav-collapse -->
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
|
|
34
|
+
<p class="notice"><%= notice %></p>
|
|
35
|
+
|
|
36
|
+
<% unless alert.nil? %>
|
|
37
|
+
<p class="alert"><%= alert %></p>
|
|
38
|
+
<% end %>
|
|
39
|
+
<div class="container">
|
|
40
|
+
<%= yield %>
|
|
41
|
+
</div>
|
|
42
|
+
|
|
43
|
+
</body>
|
|
44
|
+
</html>
|