initial version
@@ -0,0 +1,7 @@
|
||||
.bundle/
|
||||
log/*.log
|
||||
pkg/
|
||||
test/dummy/db/*.sqlite3
|
||||
test/dummy/log/*.log
|
||||
test/dummy/tmp/
|
||||
test/dummy/.sass-cache
|
||||
@@ -0,0 +1,36 @@
|
||||
source "http://rubygems.org"
|
||||
|
||||
# Declare your gem's dependencies in cmtool.gemspec.
|
||||
# Bundler will treat runtime dependencies like base dependencies, and
|
||||
# development dependencies will be added by default to the :development group.
|
||||
gemspec
|
||||
|
||||
# jquery-rails is used by the dummy application
|
||||
gem "jquery-rails"
|
||||
|
||||
gem 'couch_potato' , :git => 'git://github.com/bterkuile/couch_potato.git'
|
||||
gem 'simply_stored' , :git => 'git://github.com/bterkuile/simply_stored.git'
|
||||
gem 'devise'#, '1.4.0'
|
||||
gem 'devise_simply_stored'
|
||||
gem 'tinymce-rails'
|
||||
gem 'haml-rails'
|
||||
gem 'sass-rails'
|
||||
gem 'bourbon'
|
||||
gem 'paperclip'
|
||||
gem 'coffee-script'
|
||||
gem 'email_validator'
|
||||
group :assets do
|
||||
end
|
||||
# Declare any dependencies that are still in development here instead of in
|
||||
# your gemspec. These might include edge Rails or gems from your path or
|
||||
# Git. Remember to move these dependencies to your gemspec before releasing
|
||||
# your gem to rubygems.org.
|
||||
|
||||
# To use debugger
|
||||
group :test do
|
||||
gem 'ruby-debug19', :require => 'ruby-debug'
|
||||
gem 'rspec-rails'
|
||||
end
|
||||
group :development do
|
||||
gem 'ruby-debug19', :require => 'ruby-debug'
|
||||
end
|
||||
@@ -0,0 +1,202 @@
|
||||
GIT
|
||||
remote: git://github.com/bterkuile/couch_potato.git
|
||||
revision: 11a7c6edf216a2460e2f8775d52e799662b3d9d1
|
||||
specs:
|
||||
couch_potato (0.5.7)
|
||||
activemodel
|
||||
couchrest (>= 1.0.1)
|
||||
json
|
||||
|
||||
GIT
|
||||
remote: git://github.com/bterkuile/simply_stored.git
|
||||
revision: a49f8044be2ad4d587e73d53bff9ffbe4aa6d7e3
|
||||
specs:
|
||||
simply_stored (0.5.4)
|
||||
activesupport
|
||||
couch_potato (>= 0.2.15)
|
||||
rest-client (>= 1.4.2)
|
||||
|
||||
PATH
|
||||
remote: .
|
||||
specs:
|
||||
cmtool (0.0.1)
|
||||
rails (~> 3.2.2)
|
||||
|
||||
GEM
|
||||
remote: http://rubygems.org/
|
||||
specs:
|
||||
actionmailer (3.2.2)
|
||||
actionpack (= 3.2.2)
|
||||
mail (~> 2.4.0)
|
||||
actionpack (3.2.2)
|
||||
activemodel (= 3.2.2)
|
||||
activesupport (= 3.2.2)
|
||||
builder (~> 3.0.0)
|
||||
erubis (~> 2.7.0)
|
||||
journey (~> 1.0.1)
|
||||
rack (~> 1.4.0)
|
||||
rack-cache (~> 1.1)
|
||||
rack-test (~> 0.6.1)
|
||||
sprockets (~> 2.1.2)
|
||||
activemodel (3.2.2)
|
||||
activesupport (= 3.2.2)
|
||||
builder (~> 3.0.0)
|
||||
activerecord (3.2.2)
|
||||
activemodel (= 3.2.2)
|
||||
activesupport (= 3.2.2)
|
||||
arel (~> 3.0.2)
|
||||
tzinfo (~> 0.3.29)
|
||||
activeresource (3.2.2)
|
||||
activemodel (= 3.2.2)
|
||||
activesupport (= 3.2.2)
|
||||
activesupport (3.2.2)
|
||||
i18n (~> 0.6)
|
||||
multi_json (~> 1.0)
|
||||
archive-tar-minitar (0.5.2)
|
||||
arel (3.0.2)
|
||||
bcrypt-ruby (3.0.1)
|
||||
bourbon (1.4.0)
|
||||
sass (>= 3.1)
|
||||
builder (3.0.0)
|
||||
cocaine (0.2.1)
|
||||
coffee-script (2.2.0)
|
||||
coffee-script-source
|
||||
execjs
|
||||
coffee-script-source (1.2.0)
|
||||
columnize (0.3.6)
|
||||
couchrest (1.1.2)
|
||||
mime-types (~> 1.15)
|
||||
multi_json (~> 1.0.0)
|
||||
rest-client (~> 1.6.1)
|
||||
devise (2.0.4)
|
||||
bcrypt-ruby (~> 3.0)
|
||||
orm_adapter (~> 0.0.3)
|
||||
railties (~> 3.1)
|
||||
warden (~> 1.1.1)
|
||||
devise_simply_stored (0.0.1)
|
||||
devise
|
||||
diff-lcs (1.1.3)
|
||||
email_validator (1.3.0)
|
||||
activemodel
|
||||
erubis (2.7.0)
|
||||
execjs (1.3.0)
|
||||
multi_json (~> 1.0)
|
||||
haml (3.1.4)
|
||||
haml-rails (0.3.4)
|
||||
actionpack (~> 3.0)
|
||||
activesupport (~> 3.0)
|
||||
haml (~> 3.0)
|
||||
railties (~> 3.0)
|
||||
hike (1.2.1)
|
||||
i18n (0.6.0)
|
||||
journey (1.0.3)
|
||||
jquery-rails (2.0.1)
|
||||
railties (>= 3.2.0, < 5.0)
|
||||
thor (~> 0.14)
|
||||
json (1.6.5)
|
||||
linecache19 (0.5.12)
|
||||
ruby_core_source (>= 0.1.4)
|
||||
mail (2.4.4)
|
||||
i18n (>= 0.4.0)
|
||||
mime-types (~> 1.16)
|
||||
treetop (~> 1.4.8)
|
||||
mime-types (1.18)
|
||||
multi_json (1.0.4)
|
||||
orm_adapter (0.0.6)
|
||||
paperclip (2.7.0)
|
||||
activerecord (>= 2.3.0)
|
||||
activesupport (>= 2.3.2)
|
||||
cocaine (>= 0.0.2)
|
||||
mime-types
|
||||
polyglot (0.3.3)
|
||||
rack (1.4.1)
|
||||
rack-cache (1.2)
|
||||
rack (>= 0.4)
|
||||
rack-ssl (1.3.2)
|
||||
rack
|
||||
rack-test (0.6.1)
|
||||
rack (>= 1.0)
|
||||
rails (3.2.2)
|
||||
actionmailer (= 3.2.2)
|
||||
actionpack (= 3.2.2)
|
||||
activerecord (= 3.2.2)
|
||||
activeresource (= 3.2.2)
|
||||
activesupport (= 3.2.2)
|
||||
bundler (~> 1.0)
|
||||
railties (= 3.2.2)
|
||||
railties (3.2.2)
|
||||
actionpack (= 3.2.2)
|
||||
activesupport (= 3.2.2)
|
||||
rack-ssl (~> 1.3.2)
|
||||
rake (>= 0.8.7)
|
||||
rdoc (~> 3.4)
|
||||
thor (~> 0.14.6)
|
||||
rake (0.9.2.2)
|
||||
rdoc (3.12)
|
||||
json (~> 1.4)
|
||||
rest-client (1.6.7)
|
||||
mime-types (>= 1.16)
|
||||
rspec (2.9.0)
|
||||
rspec-core (~> 2.9.0)
|
||||
rspec-expectations (~> 2.9.0)
|
||||
rspec-mocks (~> 2.9.0)
|
||||
rspec-core (2.9.0)
|
||||
rspec-expectations (2.9.0)
|
||||
diff-lcs (~> 1.1.3)
|
||||
rspec-mocks (2.9.0)
|
||||
rspec-rails (2.9.0)
|
||||
actionpack (>= 3.0)
|
||||
activesupport (>= 3.0)
|
||||
railties (>= 3.0)
|
||||
rspec (~> 2.9.0)
|
||||
ruby-debug-base19 (0.11.25)
|
||||
columnize (>= 0.3.1)
|
||||
linecache19 (>= 0.5.11)
|
||||
ruby_core_source (>= 0.1.4)
|
||||
ruby-debug19 (0.11.6)
|
||||
columnize (>= 0.3.1)
|
||||
linecache19 (>= 0.5.11)
|
||||
ruby-debug-base19 (>= 0.11.19)
|
||||
ruby_core_source (0.1.5)
|
||||
archive-tar-minitar (>= 0.5.2)
|
||||
sass (3.1.15)
|
||||
sass-rails (3.2.5)
|
||||
railties (~> 3.2.0)
|
||||
sass (>= 3.1.10)
|
||||
tilt (~> 1.3)
|
||||
sprockets (2.1.2)
|
||||
hike (~> 1.2)
|
||||
rack (~> 1.0)
|
||||
tilt (~> 1.1, != 1.3.0)
|
||||
sqlite3 (1.3.5)
|
||||
thor (0.14.6)
|
||||
tilt (1.3.3)
|
||||
tinymce-rails (3.4.9)
|
||||
railties (>= 3.1.1)
|
||||
treetop (1.4.10)
|
||||
polyglot
|
||||
polyglot (>= 0.3.1)
|
||||
tzinfo (0.3.32)
|
||||
warden (1.1.1)
|
||||
rack (>= 1.0)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
bourbon
|
||||
cmtool!
|
||||
coffee-script
|
||||
couch_potato!
|
||||
devise
|
||||
devise_simply_stored
|
||||
email_validator
|
||||
haml-rails
|
||||
jquery-rails
|
||||
paperclip
|
||||
rspec-rails
|
||||
ruby-debug19
|
||||
sass-rails
|
||||
simply_stored!
|
||||
sqlite3
|
||||
tinymce-rails
|
||||
@@ -0,0 +1,20 @@
|
||||
Copyright 2012 YOURNAME
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
@@ -0,0 +1,3 @@
|
||||
= Cmtool
|
||||
|
||||
This project rocks and uses MIT-LICENSE.
|
||||
@@ -0,0 +1,40 @@
|
||||
#!/usr/bin/env rake
|
||||
begin
|
||||
require 'bundler/setup'
|
||||
rescue LoadError
|
||||
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
||||
end
|
||||
begin
|
||||
require 'rdoc/task'
|
||||
rescue LoadError
|
||||
require 'rdoc/rdoc'
|
||||
require 'rake/rdoctask'
|
||||
RDoc::Task = Rake::RDocTask
|
||||
end
|
||||
|
||||
RDoc::Task.new(:rdoc) do |rdoc|
|
||||
rdoc.rdoc_dir = 'rdoc'
|
||||
rdoc.title = 'Cmtool'
|
||||
rdoc.options << '--line-numbers'
|
||||
rdoc.rdoc_files.include('README.rdoc')
|
||||
rdoc.rdoc_files.include('lib/**/*.rb')
|
||||
end
|
||||
|
||||
APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
|
||||
load 'rails/tasks/engine.rake'
|
||||
|
||||
|
||||
|
||||
Bundler::GemHelper.install_tasks
|
||||
|
||||
require 'rake/testtask'
|
||||
|
||||
Rake::TestTask.new(:test) do |t|
|
||||
t.libs << 'lib'
|
||||
t.libs << 'test'
|
||||
t.pattern = 'test/**/*_test.rb'
|
||||
t.verbose = false
|
||||
end
|
||||
|
||||
|
||||
task :default => :test
|
||||
|
After Width: | Height: | Size: 260 B |
|
After Width: | Height: | Size: 251 B |
|
After Width: | Height: | Size: 178 B |
|
After Width: | Height: | Size: 104 B |
|
After Width: | Height: | Size: 125 B |
|
After Width: | Height: | Size: 105 B |
|
After Width: | Height: | Size: 3.7 KiB |
|
After Width: | Height: | Size: 90 B |
|
After Width: | Height: | Size: 129 B |
|
After Width: | Height: | Size: 4.3 KiB |
|
After Width: | Height: | Size: 4.3 KiB |
|
After Width: | Height: | Size: 4.3 KiB |
|
After Width: | Height: | Size: 4.3 KiB |
|
After Width: | Height: | Size: 4.3 KiB |
@@ -0,0 +1,17 @@
|
||||
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
||||
// listed below.
|
||||
//
|
||||
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
||||
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
|
||||
//
|
||||
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
||||
// the compiled file.
|
||||
//
|
||||
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
|
||||
// GO AFTER THE REQUIRES BELOW.
|
||||
//
|
||||
//= require jquery
|
||||
//= require jquery_ujs
|
||||
//= require jquery-ui
|
||||
//= require tinymce-jquery
|
||||
//= require_directory .
|
||||
@@ -0,0 +1,10 @@
|
||||
<% cmtool = Cmtool::Engine.routes.url_helpers %>
|
||||
$( ->
|
||||
$('textarea.mceEditor, .editor_full').tinymce(
|
||||
theme: 'advanced',
|
||||
plugins: 'advimage',
|
||||
external_image_list_url: '<%= cmtool.images_path(format: :js) %>',
|
||||
relative_urls: false
|
||||
)
|
||||
$('.editor_basic').tinymce({theme: 'simple'})
|
||||
)
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
||||
* listed below.
|
||||
*
|
||||
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
||||
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
|
||||
*
|
||||
* You're free to add application-wide styles to this file and they'll appear at the top of the
|
||||
* compiled file, but it's generally better to create a new file per style scope.
|
||||
*
|
||||
*= require_self
|
||||
*= require_tree .
|
||||
*/
|
||||
@@ -0,0 +1,4 @@
|
||||
table#directory-view
|
||||
border-collapse: collapse
|
||||
border: 1px solid #444
|
||||
td
|
||||
@@ -0,0 +1,64 @@
|
||||
@import 'bourbon'
|
||||
|
||||
html, body
|
||||
background-color: #eee
|
||||
font-family: $lucida-grande
|
||||
.button
|
||||
@include button(shiny, #777)
|
||||
a
|
||||
color: #333
|
||||
font-weight: bold
|
||||
text-decoration: none
|
||||
&:hover
|
||||
text-decoration: underline
|
||||
.clear
|
||||
clear: both
|
||||
|
||||
.field
|
||||
clear: left
|
||||
&>label
|
||||
width: 202px
|
||||
float: left
|
||||
&>.field_with_errors
|
||||
float: left
|
||||
label
|
||||
width: 202px
|
||||
float: left
|
||||
color: red
|
||||
input
|
||||
border: 1px solid red
|
||||
#page-wrapper
|
||||
width: 972px
|
||||
margin: 10px auto
|
||||
background-color: white
|
||||
#menu-container
|
||||
@include linear-gradient(#1e5799, #2989d8)
|
||||
clear: both
|
||||
padding: 10px
|
||||
ul
|
||||
margin: 0
|
||||
padding: 0
|
||||
list-style: none
|
||||
li
|
||||
float: left
|
||||
margin-right: 9px
|
||||
padding: 5px 4px
|
||||
background-color: white
|
||||
&.parent:hover> ul
|
||||
display: block
|
||||
.child-menu
|
||||
display: none
|
||||
position: absolute
|
||||
z-index: 10000
|
||||
margin-left: -5px
|
||||
margin-top: 4px
|
||||
li
|
||||
float: none
|
||||
&.ui-state-active .child-menu li.ui-state-default a
|
||||
color: #1C94C4
|
||||
#sub-navigation-container
|
||||
ul
|
||||
list-style: none
|
||||
li
|
||||
float: left
|
||||
margin-right: 10px
|
||||
@@ -0,0 +1,5 @@
|
||||
module Cmtool
|
||||
class ApplicationController < ::ApplicationController
|
||||
before_filter :authenticate_user!
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,85 @@
|
||||
module Cmtool
|
||||
class Cmtool::ContactFormsController < Cmtool::ApplicationController
|
||||
# GET /contact_forms
|
||||
# GET /contact_forms.xml
|
||||
def index
|
||||
@contact_forms = Cmtool::ContactForm.all
|
||||
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
format.xml { render :xml => @contact_forms }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /contact_forms/1
|
||||
# GET /contact_forms/1.xml
|
||||
def show
|
||||
@contact_form = Cmtool::ContactForm.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
format.html # show.html.erb
|
||||
format.xml { render :xml => @contact_form }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /contact_forms/new
|
||||
# GET /contact_forms/new.xml
|
||||
def new
|
||||
@contact_form = Cmtool::ContactForm.new
|
||||
|
||||
respond_to do |format|
|
||||
format.html # new.html.erb
|
||||
format.xml { render :xml => @contact_form }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /contact_forms/1/edit
|
||||
def edit
|
||||
@contact_form = Cmtool::ContactForm.find(params[:id])
|
||||
end
|
||||
|
||||
# POST /contact_forms
|
||||
# POST /contact_forms.xml
|
||||
def create
|
||||
@contact_form = Cmtool::ContactForm.new(params[:contact_form])
|
||||
|
||||
respond_to do |format|
|
||||
if @contact_form.save
|
||||
format.html { redirect_to([cmtool, @contact_form], :notice => I18n.t('cmtool.action.create.successful', :model => Cmtool::ContactForm.model_name.human)) }
|
||||
format.xml { render :xml => @contact_form, :status => :created, :location => @contact_form }
|
||||
else
|
||||
format.html { render :action => "new" }
|
||||
format.xml { render :xml => @contact_form.errors, :status => :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# PUT /contact_forms/1
|
||||
# PUT /contact_forms/1.xml
|
||||
def update
|
||||
@contact_form = Cmtool::ContactForm.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
if @contact_form.update_attributes(params[:contact_form])
|
||||
format.html { redirect_to([cmtool, @contact_form], :notice => I18n.t('cmtool.action.update.successful', :model => Cmtool::ContactForm.model_name.human)) }
|
||||
format.xml { head :ok }
|
||||
else
|
||||
format.html { render :action => "edit" }
|
||||
format.xml { render :xml => @contact_form.errors, :status => :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /contact_forms/1
|
||||
# DELETE /contact_forms/1.xml
|
||||
def destroy
|
||||
@contact_form = Cmtool::ContactForm.find(params[:id])
|
||||
@contact_form.destroy
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to(cmtool.contact_forms_url) }
|
||||
format.xml { head :ok }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,90 @@
|
||||
module Cmtool
|
||||
class DirectoriesController < Cmtool::ApplicationController
|
||||
# GET /directories
|
||||
# GET /directories.xml
|
||||
def index
|
||||
@directories = Cmtool::Directory.roots
|
||||
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
format.xml { render :xml => @directories }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /directories/1
|
||||
# GET /directories/1.xml
|
||||
def show
|
||||
@directory = Cmtool::Directory.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
format.html # show.html.erb
|
||||
format.xml { render :xml => @directory }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /directories/new
|
||||
# GET /directories/new.xml
|
||||
def new
|
||||
@directory = Cmtool::Directory.new
|
||||
|
||||
respond_to do |format|
|
||||
format.html # new.html.erb
|
||||
format.xml { render :xml => @directory }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /directories/1/edit
|
||||
def edit
|
||||
@directory = Cmtool::Directory.find(params[:id])
|
||||
end
|
||||
|
||||
# POST /directories
|
||||
# POST /directories.xml
|
||||
def create
|
||||
@directory = Cmtool::Directory.new(params[:directory])
|
||||
|
||||
respond_to do |format|
|
||||
if @directory.save
|
||||
format.html { redirect_to([cmtool, @directory], :notice => I18n.t('cmtool.action.create.successful', :model => Cmtool::Directory.model_name.human)) }
|
||||
format.xml { render :xml => @directory, :status => :created, :location => @directory }
|
||||
else
|
||||
format.html { render :action => "new" }
|
||||
format.xml { render :xml => @directory.errors, :status => :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# PUT /directories/1
|
||||
# PUT /directories/1.xml
|
||||
def update
|
||||
@directory = Cmtool::Directory.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
if @directory.update_attributes(params[:directory])
|
||||
format.html { redirect_to([cmtool, @directory], :notice => I18n.t('cmtool.action.update.successful', :model => Cmtool::Directory.model_name.human)) }
|
||||
format.xml { head :ok }
|
||||
else
|
||||
format.html { render :action => "edit" }
|
||||
format.xml { render :xml => @directory.errors, :status => :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /directories/1
|
||||
# DELETE /directories/1.xml
|
||||
def destroy
|
||||
@directory = Cmtool::Directory.find(params[:id])
|
||||
@directory.destroy
|
||||
flash[:notice] = I18n.t('cmtool.action.destroy.successful', :model => Cmtool::Directory.model_name.human)
|
||||
respond_to do |format|
|
||||
format.html { redirect_to(cmtool.directories_url) }
|
||||
format.xml { head :ok }
|
||||
end
|
||||
end
|
||||
def remove_image
|
||||
@directory = Cmtool::Directory.find(params[:id])
|
||||
@directory.image = nil
|
||||
@directory.save
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,85 @@
|
||||
module Cmtool
|
||||
class Cmtool::FaqsController < Cmtool::ApplicationController
|
||||
# GET /faqs
|
||||
# GET /faqs.xml
|
||||
def index
|
||||
@faqs = Cmtool::Faq.all
|
||||
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
format.xml { render :xml => @faqs }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /faqs/1
|
||||
# GET /faqs/1.xml
|
||||
def show
|
||||
@faq = Cmtool::Faq.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
format.html # show.html.erb
|
||||
format.xml { render :xml => @faq }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /faqs/new
|
||||
# GET /faqs/new.xml
|
||||
def new
|
||||
@faq = Cmtool::Faq.new
|
||||
|
||||
respond_to do |format|
|
||||
format.html # new.html.erb
|
||||
format.xml { render :xml => @faq }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /faqs/1/edit
|
||||
def edit
|
||||
@faq = Cmtool::Faq.find(params[:id])
|
||||
end
|
||||
|
||||
# POST /faqs
|
||||
# POST /faqs.xml
|
||||
def create
|
||||
@faq = Cmtool::Faq.new(params[:faq])
|
||||
|
||||
respond_to do |format|
|
||||
if @faq.save
|
||||
format.html { redirect_to([cmtool, @faq], :notice => I18n.t('cmtool.action.create.successful', :model => Cmtool::Faq.model_name.human)) }
|
||||
format.xml { render :xml => @faq, :status => :created, :location => @faq }
|
||||
else
|
||||
format.html { render :action => "new" }
|
||||
format.xml { render :xml => @faq.errors, :status => :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# PUT /faqs/1
|
||||
# PUT /faqs/1.xml
|
||||
def update
|
||||
@faq = Cmtool::Faq.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
if @faq.update_attributes(params[:faq])
|
||||
format.html { redirect_to([cmtool, @faq], :notice => I18n.t('cmtool.action.create.successful', :model => Cmtool::Faq.model_name.human)) }
|
||||
format.xml { head :ok }
|
||||
else
|
||||
format.html { render :action => "edit" }
|
||||
format.xml { render :xml => @faq.errors, :status => :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /faqs/1
|
||||
# DELETE /faqs/1.xml
|
||||
def destroy
|
||||
@faq = Cmtool::Faq.find(params[:id])
|
||||
@faq.destroy
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to(cmtool.faqs_url) }
|
||||
format.xml { head :ok }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,86 @@
|
||||
module Cmtool
|
||||
class Cmtool::ImagesController < Cmtool::ApplicationController
|
||||
# GET /images
|
||||
# GET /images.xml
|
||||
def index
|
||||
@images = Cmtool::Image.all
|
||||
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
format.xml { render :xml => @images }
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
# GET /images/1
|
||||
# GET /images/1.xml
|
||||
def show
|
||||
@image = Cmtool::Image.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
format.html # show.html.erb
|
||||
format.xml { render :xml => @image }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /images/new
|
||||
# GET /images/new.xml
|
||||
def new
|
||||
@image = Cmtool::Image.new
|
||||
|
||||
respond_to do |format|
|
||||
format.html # new.html.erb
|
||||
format.xml { render :xml => @image }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /images/1/edit
|
||||
def edit
|
||||
@image = Cmtool::Image.find(params[:id])
|
||||
end
|
||||
|
||||
# POST /images
|
||||
# POST /images.xml
|
||||
def create
|
||||
@image = Cmtool::Image.new(params[:image])
|
||||
|
||||
respond_to do |format|
|
||||
if @image.save
|
||||
format.html { redirect_to([cmtool, @image.directory || @image], :notice => I18n.t('cmtool.action.create.successful', :model => Cmtool::Image.model_name.human) ) }
|
||||
format.xml { render :xml => @image, :status => :created, :location => @image }
|
||||
else
|
||||
format.html { render :action => "new" }
|
||||
format.xml { render :xml => @image.errors, :status => :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# PUT /images/1
|
||||
# PUT /images/1.xml
|
||||
def update
|
||||
@image = Cmtool::Image.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
if @image.update_attributes(params[:image])
|
||||
format.html { redirect_to([cmtool, @image], :notice => I18n.t('cmtool.action.update.successful', :model => Cmtool::Image.model_name.human)) }
|
||||
format.xml { head :ok }
|
||||
else
|
||||
format.html { render :action => "edit" }
|
||||
format.xml { render :xml => @image.errors, :status => :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /images/1
|
||||
# DELETE /images/1.xml
|
||||
def destroy
|
||||
@image = Cmtool::Image.find(params[:id])
|
||||
@image.destroy
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to(cmtool.images_url) }
|
||||
format.xml { head :ok }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,85 @@
|
||||
module Cmtool
|
||||
class Cmtool::KeywordsController < Cmtool::ApplicationController
|
||||
# GET /keywords
|
||||
# GET /keywords.xml
|
||||
def index
|
||||
@keywords = Cmtool::Keyword.all
|
||||
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
format.xml { render :xml => @keywords }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /keywords/1
|
||||
# GET /keywords/1.xml
|
||||
def show
|
||||
@keyword = Cmtool::Keyword.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
format.html # show.html.erb
|
||||
format.xml { render :xml => @keyword }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /keywords/new
|
||||
# GET /keywords/new.xml
|
||||
def new
|
||||
@keyword = Cmtool::Keyword.new
|
||||
|
||||
respond_to do |format|
|
||||
format.html # new.html.erb
|
||||
format.xml { render :xml => @keyword }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /keywords/1/edit
|
||||
def edit
|
||||
@keyword = Cmtool::Keyword.find(params[:id])
|
||||
end
|
||||
|
||||
# POST /keywords
|
||||
# POST /keywords.xml
|
||||
def create
|
||||
@keyword = Cmtool::Keyword.new(params[:keyword])
|
||||
|
||||
respond_to do |format|
|
||||
if @keyword.save
|
||||
format.html { redirect_to(cmtool.keywords_path, :notice => I18n.t('cmtool.action.create.successful', :model => Cmtool::Keyword.model_name.human)) }
|
||||
format.xml { render :xml => @keyword, :status => :created, :location => @keyword }
|
||||
else
|
||||
format.html { render :action => "new" }
|
||||
format.xml { render :xml => @keyword.errors, :status => :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# PUT /keywords/1
|
||||
# PUT /keywords/1.xml
|
||||
def update
|
||||
@keyword = Cmtool::Keyword.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
if @keyword.update_attributes(params[:keyword])
|
||||
format.html { redirect_to(cmtool.keywords_path, :notice => I18n.t('cmtool.action.update.successful', :model => Cmtool::Keyword.model_name.human)) }
|
||||
format.xml { head :ok }
|
||||
else
|
||||
format.html { render :action => "edit" }
|
||||
format.xml { render :xml => @keyword.errors, :status => :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /keywords/1
|
||||
# DELETE /keywords/1.xml
|
||||
def destroy
|
||||
@keyword = Cmtool::Keyword.find(params[:id])
|
||||
@keyword.destroy
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to(cmtool.keywords_url, notice: I18n.t('cmtool.action.destroy.successful', model: Cmtool::Keyword.model_name.human)) }
|
||||
format.xml { head :ok }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,91 @@
|
||||
module Cmtool
|
||||
class Cmtool::NewsController < Cmtool::ApplicationController
|
||||
# GET /news
|
||||
# GET /news.xml
|
||||
def index
|
||||
@news = Cmtool::News.all
|
||||
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
format.xml { render :xml => @news }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /news/1
|
||||
# GET /news/1.xml
|
||||
def show
|
||||
@news = Cmtool::News.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
format.html # show.html.erb
|
||||
format.xml { render :xml => @news }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /news/new
|
||||
# GET /news/new.xml
|
||||
def new
|
||||
@news = Cmtool::News.new :date => Date.today
|
||||
|
||||
respond_to do |format|
|
||||
format.html # new.html.erb
|
||||
format.xml { render :xml => @news }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /news/1/edit
|
||||
def edit
|
||||
@news = Cmtool::News.find(params[:id])
|
||||
end
|
||||
|
||||
# POST /news
|
||||
# POST /news.xml
|
||||
def create
|
||||
@news = Cmtool::News.new(params[:news])
|
||||
|
||||
respond_to do |format|
|
||||
if @news.save
|
||||
format.html { redirect_to([cmtool, @news], :notice => t('cmtool.action.create.successful', :model => Cmtool::News.model_name.human)) }
|
||||
format.xml { render :xml => @news, :status => :created, :location => @news }
|
||||
else
|
||||
format.html { render :action => "new" }
|
||||
format.xml { render :xml => @news.errors, :status => :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# PUT /news/1
|
||||
# PUT /news/1.xml
|
||||
def update
|
||||
@news = Cmtool::News.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
if @news.update_attributes(params[:news])
|
||||
format.html { redirect_to([cmtool, @news], :notice => t('cmtool.action.update.successful', :model => Cmtool::News.model_name.human)) }
|
||||
format.xml { head :ok }
|
||||
else
|
||||
format.html { render :action => "edit" }
|
||||
format.xml { render :xml => @news.errors, :status => :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /news/1
|
||||
# DELETE /news/1.xml
|
||||
def destroy
|
||||
@news = Cmtool::News.find(params[:id])
|
||||
@news.destroy
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to(cmtool.news_index_url) }
|
||||
format.xml { head :ok }
|
||||
end
|
||||
end
|
||||
|
||||
def remove_image
|
||||
@news = Cmtool::News.find(params[:id])
|
||||
@news.image = nil
|
||||
@news.save
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,85 @@
|
||||
module Cmtool
|
||||
class Cmtool::NewsletterSubscriptionsController < Cmtool::ApplicationController
|
||||
# GET /newsletter_subscriptions
|
||||
# GET /newsletter_subscriptions.xml
|
||||
def index
|
||||
@newsletter_subscriptions = Cmtool::NewsletterSubscription.all
|
||||
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
format.xml { render :xml => @newsletter_subscriptions }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /newsletter_subscriptions/1
|
||||
# GET /newsletter_subscriptions/1.xml
|
||||
def show
|
||||
@newsletter_subscription = Cmtool::NewsletterSubscription.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
format.html # show.html.erb
|
||||
format.xml { render :xml => @newsletter_subscription }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /newsletter_subscriptions/new
|
||||
# GET /newsletter_subscriptions/new.xml
|
||||
def new
|
||||
@newsletter_subscription = Cmtool::NewsletterSubscription.new
|
||||
|
||||
respond_to do |format|
|
||||
format.html # new.html.erb
|
||||
format.xml { render :xml => @newsletter_subscription }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /newsletter_subscriptions/1/edit
|
||||
def edit
|
||||
@newsletter_subscription = Cmtool::NewsletterSubscription.find(params[:id])
|
||||
end
|
||||
|
||||
# POST /newsletter_subscriptions
|
||||
# POST /newsletter_subscriptions.xml
|
||||
def create
|
||||
@newsletter_subscription = Cmtool::NewsletterSubscription.new(params[:newsletter_subscription])
|
||||
|
||||
respond_to do |format|
|
||||
if @newsletter_subscription.save
|
||||
format.html { redirect_to([cmtool, @newsletter_subscription], :notice => I18n.t('cmtool.action.create.successful', :model => Cmtool::NewsletterSubscription.model_name.human)) }
|
||||
format.xml { render :xml => @newsletter_subscription, :status => :created, :location => @newsletter_subscription }
|
||||
else
|
||||
format.html { render :action => "new" }
|
||||
format.xml { render :xml => @newsletter_subscription.errors, :status => :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# PUT /newsletter_subscriptions/1
|
||||
# PUT /newsletter_subscriptions/1.xml
|
||||
def update
|
||||
@newsletter_subscription = Cmtool::NewsletterSubscription.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
if @newsletter_subscription.update_attributes(params[:newsletter_subscription])
|
||||
format.html { redirect_to([cmtool, @newsletter_subscription], :notice => I18n.t('cmtool.action.update.successful', :model => Cmtool::NewsletterSubscription.model_name.human)) }
|
||||
format.xml { head :ok }
|
||||
else
|
||||
format.html { render :action => "edit" }
|
||||
format.xml { render :xml => @newsletter_subscription.errors, :status => :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /newsletter_subscriptions/1
|
||||
# DELETE /newsletter_subscriptions/1.xml
|
||||
def destroy
|
||||
@newsletter_subscription = Cmtool::NewsletterSubscription.find(params[:id])
|
||||
@newsletter_subscription.destroy
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to(cmtool.newsletter_subscriptions_url) }
|
||||
format.xml { head :ok }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,101 @@
|
||||
module Cmtool
|
||||
class PagesController < Cmtool::ApplicationController
|
||||
# GET /pages
|
||||
# GET /pages.xml
|
||||
def index
|
||||
@pages = ::Page.all.sort_by{|p| "#{p.parent.presence.try(:reverse) || p.name}#{p.position.to_s.rjust(6, "0")}" }
|
||||
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
format.xml { render :xml => @pages }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /pages/1
|
||||
# GET /pages/1.xml
|
||||
def show
|
||||
@page = ::Page.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
format.html # show.html.erb
|
||||
format.xml { render :xml => @page }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /pages/new
|
||||
# GET /pages/new.xml
|
||||
def new
|
||||
@page = ::Page.new
|
||||
|
||||
respond_to do |format|
|
||||
format.html # new.html.erb
|
||||
format.xml { render :xml => @page }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /pages/1/edit
|
||||
def edit
|
||||
@page = ::Page.find(params[:id])
|
||||
end
|
||||
|
||||
# POST /pages
|
||||
# POST /pages.xml
|
||||
def create
|
||||
@page = ::Page.new(params[:page])
|
||||
|
||||
respond_to do |format|
|
||||
if @page.save
|
||||
format.html { redirect_to(cmtool.pages_path, :notice => I18n.t('cmtool.action.create.successful', :model => ::Page.model_name.human)) }
|
||||
format.xml { render :xml => @page, :status => :created, :location => @page }
|
||||
else
|
||||
format.html { render :action => "new" }
|
||||
format.xml { render :xml => @page.errors, :status => :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# PUT /pages/1
|
||||
# PUT /pages/1.xml
|
||||
def update
|
||||
@page = ::Page.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
if @page.update_attributes(params[:page])
|
||||
format.html { redirect_to(cmtool.pages_path, :notice => I18n.t('cmtool.action.update.successful', :model => ::Page.model_name.human)) }
|
||||
format.xml { head :ok }
|
||||
else
|
||||
format.html { render :action => "edit" }
|
||||
format.xml { render :xml => @page.errors, :status => :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /pages/1
|
||||
# DELETE /pages/1.xml
|
||||
def destroy
|
||||
@page = ::Page.find(params[:id])
|
||||
@page.destroy
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to(cmtool.pages_path) }
|
||||
format.xml { head :ok }
|
||||
end
|
||||
end
|
||||
def generate_name
|
||||
@page = ::Page.find(params[:id]) if params[:id]
|
||||
render(:js => "alert('Wel eerst een titel invullen')") and return if params[:name].blank?
|
||||
# Strategy,
|
||||
# make name lowercase
|
||||
# strip all non word charachters from front and end
|
||||
# then replace non word characters with a dash
|
||||
@generated_name = ::Page.generate_name(params[:name])
|
||||
@has_template = @page && @page.name != @generated_name ? template_exists?("pages/#{@page.name}") : nil
|
||||
end
|
||||
|
||||
def preview
|
||||
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,5 @@
|
||||
module Cmtool
|
||||
class PasswordsController < Devise::PasswordsController
|
||||
layout 'cmtool/application'
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,90 @@
|
||||
module Cmtool
|
||||
class Cmtool::QuotesController < Cmtool::ApplicationController
|
||||
# GET /quotes
|
||||
# GET /quotes.xml
|
||||
def index
|
||||
@quotes = Cmtool::Quote.all
|
||||
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
format.xml { render :xml => @quotes }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /quotes/1
|
||||
# GET /quotes/1.xml
|
||||
def show
|
||||
@quote = Cmtool::Quote.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
format.html # show.html.erb
|
||||
format.xml { render :xml => @quote }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /quotes/new
|
||||
# GET /quotes/new.xml
|
||||
def new
|
||||
@quote = Cmtool::Quote.new
|
||||
|
||||
respond_to do |format|
|
||||
format.html # new.html.erb
|
||||
format.xml { render :xml => @quote }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /quotes/1/edit
|
||||
def edit
|
||||
@quote = Cmtool::Quote.find(params[:id])
|
||||
end
|
||||
|
||||
# POST /quotes
|
||||
# POST /quotes.xml
|
||||
def create
|
||||
@quote = Cmtool::Quote.new(params[:quote])
|
||||
|
||||
respond_to do |format|
|
||||
if @quote.save
|
||||
format.html { redirect_to([cmtool, @quote], :notice => I18n.t('cmtool.action.create.successful', :model => Cmtool::Quote.model_name.human)) }
|
||||
format.xml { render :xml => @quote, :status => :created, :location => @quote }
|
||||
else
|
||||
format.html { render :action => "new" }
|
||||
format.xml { render :xml => @quote.errors, :status => :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# PUT /quotes/1
|
||||
# PUT /quotes/1.xml
|
||||
def update
|
||||
@quote = Cmtool::Quote.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
if @quote.update_attributes(params[:quote])
|
||||
format.html { redirect_to([cmtool, @quote], :notice => I18n.t('cmtool.action.update.successful', :model => Cmtool::Quote.model_name.human)) }
|
||||
format.xml { head :ok }
|
||||
else
|
||||
format.html { render :action => "edit" }
|
||||
format.xml { render :xml => @quote.errors, :status => :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /quotes/1
|
||||
# DELETE /quotes/1.xml
|
||||
def destroy
|
||||
@quote = Cmtool::Quote.find(params[:id])
|
||||
@quote.destroy
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to(cmtool.quotes_url, notice: I18n.t('cmtool.action.destroy.successful', model: Cmtool::Quote.model_name.human)) }
|
||||
format.xml { head :ok }
|
||||
end
|
||||
end
|
||||
def remove_image
|
||||
@quote = Cmtool::Quote.find(params[:id])
|
||||
@quote.image = nil
|
||||
@quote.save
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,5 @@
|
||||
module Cmtool
|
||||
class SessionsController < ::Devise::SessionsController
|
||||
layout 'cmtool/application'
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,54 @@
|
||||
module Cmtool
|
||||
class UsersController < Cmtool::ApplicationController
|
||||
|
||||
# GET /cmtool/users
|
||||
def index
|
||||
@users = ::User.all
|
||||
end
|
||||
|
||||
def show
|
||||
@user = ::User.find(params[:id])
|
||||
end
|
||||
|
||||
def edit
|
||||
@user = ::User.find(params[:id])
|
||||
end
|
||||
|
||||
def new
|
||||
@user = ::User.new
|
||||
end
|
||||
|
||||
def create
|
||||
@user = ::User.new(params[:user])
|
||||
if @user.save
|
||||
redirect_to cmtool.users_path, :notice => I18n.t('cmtool.action.create.successful', :model => ::User.model_name.human)
|
||||
else
|
||||
render :action => 'new'
|
||||
end
|
||||
end
|
||||
|
||||
def update
|
||||
user = params[:user]
|
||||
unless user['password'].present?
|
||||
user.delete('password')
|
||||
user.delete('password_confirmation')
|
||||
end
|
||||
@user = ::User.find(params[:id])
|
||||
if @user.update_attributes(user)
|
||||
if user['password']
|
||||
# Sign in after changing current logged in password
|
||||
sign_in(@user, :bypass => true) if @user == current_user
|
||||
end
|
||||
redirect_to cmtool.users_path, :notice => I18n.t('cmtool.action.update.successful', :model => ::User.model_name.human)
|
||||
else
|
||||
render :action => 'edit'
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@user = ::User.find(params[:id])
|
||||
@user.destroy
|
||||
redirect_to cmtool.users_path, :notice => I18n.t('cmtool.action.destroy.successful', :model => ::User.model_name.human)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,85 @@
|
||||
module Cmtool
|
||||
module ApplicationHelper
|
||||
|
||||
def site_title
|
||||
'Cmtool'
|
||||
end
|
||||
def title(*args)
|
||||
content_for :title do
|
||||
if args.first.is_a?(Symbol) && (args[1].respond_to?(:model_name) || args[1].class.respond_to?(:model_name))
|
||||
model = args[1].respond_to?(:model_name) ? args[1] : args[1].class
|
||||
if args.first == :index
|
||||
t('cmtool.action.index.title', models: model.model_name.human_plural)
|
||||
else
|
||||
t("cmtool.action.#{args.first}.title", model: model.model_name.human)
|
||||
end
|
||||
else
|
||||
args.first
|
||||
end
|
||||
end
|
||||
end
|
||||
def are_you_sure(obj = nil)
|
||||
if name = obj && obj.respond_to?(:name) && obj.name.presence
|
||||
t('cmtool.general.are_you_sure_with_name', name: name, model: obj.class.model_name.human)
|
||||
else
|
||||
t('cmtool.general.are_you_sure')
|
||||
end
|
||||
end
|
||||
alias are_you_sure? are_you_sure
|
||||
|
||||
def boolean_text(yes)
|
||||
yes.present? ? t('cmtool.general.yes') : t('cmtool.general.no')
|
||||
end
|
||||
def empty_result(model)
|
||||
t('cmtool.general.empty_result', models: model.model_name.human_plural.downcase )
|
||||
end
|
||||
def link_to_new_content(model)
|
||||
t('cmtool.action.new.title', model: model.model_name.human)
|
||||
end
|
||||
def link_to_edit_content(obj)
|
||||
t('cmtool.action.edit.title', model: obj.class.model_name.human)
|
||||
end
|
||||
def link_to_show_content(obj)
|
||||
t('cmtool.action.show.title', model: obj.class.model_name.human)
|
||||
end
|
||||
def link_to_index_content(model)
|
||||
t('cmtool.action.index.title', models: model.model_name.human_plural)
|
||||
end
|
||||
def link_to_destroy_content(obj)
|
||||
t('cmtool.action.destroy.title', model: obj.class.model_name.human)
|
||||
end
|
||||
|
||||
def create_button_text(obj)
|
||||
t('cmtool.action.create.label', model: obj.class.model_name.human)
|
||||
end
|
||||
def update_button_text(obj)
|
||||
t('cmtool.action.update.label', model: obj.class.model_name.human)
|
||||
end
|
||||
def link_separator
|
||||
' | '
|
||||
end
|
||||
def tree_options_for_select(roots, options = {})
|
||||
iterator = Proc.new do |add_to, elements|
|
||||
for element in elements
|
||||
if !options[:exclude].present? || (element.path_ids & Array.wrap(options[:exclude])).empty?
|
||||
add_to << ['- '*element.tree_depth + element.name, element.id]
|
||||
iterator.call(add_to, element.children) if element.children.any?
|
||||
end
|
||||
end
|
||||
end
|
||||
options_ary = []
|
||||
iterator.call(options_ary, roots)
|
||||
options_for_select(options_ary, options[:selected])
|
||||
end
|
||||
def human_size(n)
|
||||
return '0 MB' unless n
|
||||
n = n.to_i
|
||||
count = 0
|
||||
while n >= 1024 and count < 4
|
||||
n /= 1024.0
|
||||
count += 1
|
||||
end
|
||||
format("%.2f",n) + %w(B KB MB GB TB)[count]
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,10 @@
|
||||
module Cmtool
|
||||
class ContactForm
|
||||
include SimplyStored::Couch
|
||||
property :gender
|
||||
property :name
|
||||
property :email
|
||||
property :phone
|
||||
property :body
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,13 @@
|
||||
module Cmtool
|
||||
class Directory
|
||||
include SimplyStored::Couch
|
||||
|
||||
property :name
|
||||
|
||||
has_ancestry
|
||||
|
||||
view :all_documents, key: :name
|
||||
|
||||
has_many :images
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,16 @@
|
||||
module Cmtool
|
||||
class Faq
|
||||
include SimplyStored::Couch
|
||||
|
||||
property :question
|
||||
property :answer
|
||||
property :active, type: :boolean, default: true
|
||||
|
||||
view :active_view, key: :created_at, conditions: "doc['active']"
|
||||
|
||||
def self.active
|
||||
database.view(active_view)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,24 @@
|
||||
module Cmtool
|
||||
class Image
|
||||
include SimplyStored::Couch
|
||||
include Paperclip::Glue
|
||||
|
||||
property :file_file_name
|
||||
property :file_content_type
|
||||
property :file_file_size, :type => Fixnum
|
||||
property :file_updated_at, :type => Time
|
||||
has_attached_file :file, :styles => { :page => '675x10000>', :medium => "354x1000>", :thumb => "150x1250>" }
|
||||
|
||||
belongs_to :directory
|
||||
|
||||
def self.active(*args)
|
||||
all(*args)
|
||||
end
|
||||
|
||||
# Return cleaned name, without extension
|
||||
def clean_name
|
||||
return file_file_name
|
||||
file_file_name.to_s.sub(/\..*/, '')
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,10 @@
|
||||
module Cmtool
|
||||
class Keyword
|
||||
include SimplyStored::Couch
|
||||
|
||||
property :name
|
||||
|
||||
has_and_belongs_to_many :pages, storing_keys: false, class_name: 'Page'
|
||||
has_and_belongs_to_many :news, :storing_keys => false
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,32 @@
|
||||
module Cmtool
|
||||
class News
|
||||
include SimplyStored::Couch
|
||||
include Paperclip::Glue
|
||||
|
||||
property :title
|
||||
property :active, type: :boolean, default: true
|
||||
property :date, type: Date
|
||||
property :body
|
||||
|
||||
property :image_file_name
|
||||
property :image_content_type
|
||||
property :image_file_size, type: Fixnum
|
||||
property :image_updated_at, type: Time
|
||||
|
||||
has_attached_file :image, styles: { :medium => "500x500>", :thumb => "250x250>" }
|
||||
has_and_belongs_to_many :keywords, storing_keys: true
|
||||
validates :title, presence: true
|
||||
validates :date, presence: true
|
||||
|
||||
view :all_documents, key: :date, descending: true
|
||||
view :by_active, key: [:active, :date], descending: true
|
||||
|
||||
def self.active(options = {till: Date.today})
|
||||
find_all_by_active(true, options)
|
||||
end
|
||||
|
||||
def self.find_all_by_active(active, options = {till: Date.today})
|
||||
database.view(by_active(startkey: [active, options[:till].strftime('%Y-%m-%d')], endkey: [active], descending: true))
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,25 @@
|
||||
module Cmtool
|
||||
class NewsletterSubscription
|
||||
include SimplyStored::Couch
|
||||
|
||||
# PROPERTIES
|
||||
property :email
|
||||
property :active, :type => :boolean, :default => true
|
||||
property :deactivation_token
|
||||
|
||||
# CALLBACKS
|
||||
before_save :set_deactivation_token
|
||||
|
||||
validates :email, presence: true, email: true
|
||||
|
||||
def name
|
||||
email
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def set_deactivation_token
|
||||
self.deactivation_token = ((('a'..'z').to_a + ('A'..'Z').to_a)*100).sample(10).join
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,38 @@
|
||||
module Cmtool
|
||||
class Quote
|
||||
include SimplyStored::Couch
|
||||
include Paperclip::Glue
|
||||
|
||||
property :owner
|
||||
property :function
|
||||
property :state
|
||||
property :body
|
||||
property :active, :type => :boolean, :default => true
|
||||
property :locale
|
||||
|
||||
property :image_file_name
|
||||
property :image_content_type
|
||||
property :image_file_size, :type => Fixnum
|
||||
property :image_updated_at, :type => Time
|
||||
|
||||
has_attached_file :image, :styles => {:medium => "300x1000>", :thumb => "137x1250>" }
|
||||
|
||||
view :for_sidebar_view, :key => [:state, :created_at], :conditions => %{doc['active']}
|
||||
STATES = %w[page sidebar]
|
||||
def self.active(*args)
|
||||
database.view(for_sidebar_view(*args))
|
||||
end
|
||||
|
||||
def self.for_page
|
||||
active(:startkey => ['page'], :endkey => ['page', {}])
|
||||
end
|
||||
|
||||
def self.states
|
||||
STATES
|
||||
end
|
||||
|
||||
def self.for_sidebar
|
||||
active(:startkey => ['sidebar'], :endkey => ['sidebar', {}], :limit => 2)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,3 @@
|
||||
class Page
|
||||
include Cmtool::Page
|
||||
end
|
||||
@@ -0,0 +1,3 @@
|
||||
class User
|
||||
include Cmtool::User
|
||||
end
|
||||
@@ -0,0 +1,10 @@
|
||||
- if alert
|
||||
.message.error.ui-state-error
|
||||
.icon
|
||||
.text
|
||||
=raw flash[:alert]
|
||||
- if notice
|
||||
.message.notice.ui-state-highlight
|
||||
.icon
|
||||
.text
|
||||
=raw flash[:notice]
|
||||
@@ -0,0 +1,6 @@
|
||||
-if target.errors.any?
|
||||
#errorExplanation
|
||||
%h2= t('Errors title', :count => target.errors.count)
|
||||
%ul
|
||||
- target.errors.full_messages.each do |msg|
|
||||
%li= msg
|
||||
@@ -0,0 +1,7 @@
|
||||
#user-info
|
||||
#user-info-email= current_user.email
|
||||
#user-info-sign-in-out{class: user_signed_in? ? 'signed-in' : 'signed-out'}
|
||||
- if user_signed_in?
|
||||
= link_to t('devise.sessions.sign_out'), cmtool.destroy_user_session_path
|
||||
- else
|
||||
= link_to t('devise.sessions.sign_in'), new_user_session_path
|
||||
@@ -0,0 +1,12 @@
|
||||
<h2>Resend confirmation instructions</h2>
|
||||
|
||||
<%= form_for(resource, :as => resource_name, :url => confirmation_path(resource_name), :html => { :method => :post }) do |f| %>
|
||||
<%= devise_error_messages! %>
|
||||
|
||||
<p><%= f.label :email %><br />
|
||||
<%= f.email_field :email %></p>
|
||||
|
||||
<p><%= f.submit "Resend confirmation instructions" %></p>
|
||||
<% end %>
|
||||
|
||||
<%= render :partial => "devise/shared/links" %>
|
||||
@@ -0,0 +1,20 @@
|
||||
= form_for [cmtool, @contact_form] do |f|
|
||||
= render 'error_messages', :target => @contact_form
|
||||
|
||||
.field
|
||||
= f.label :gender
|
||||
= f.text_field :gender
|
||||
.field
|
||||
= f.label :name
|
||||
= f.text_field :name
|
||||
.field
|
||||
= f.label :email
|
||||
= f.text_field :email
|
||||
.field
|
||||
= f.label :phone
|
||||
= f.text_field :phone
|
||||
.field
|
||||
= f.label :body
|
||||
= f.text_area :body, class: :editor_full
|
||||
.actions
|
||||
= f.submit @submit || update_button_text(@contact_form)
|
||||
@@ -0,0 +1,8 @@
|
||||
- title :edit, Cmtool::ContactForm
|
||||
= render 'form', :submit => update_button_text(@contact_form)
|
||||
|
||||
- content_for :page_links do
|
||||
%ul
|
||||
%li= link_to link_to_show_content(@contact_form), cmtool.contact_form_path(@contact_form)
|
||||
%li= link_separator
|
||||
%li= link_to link_to_index_content(Cmtool::ContactForm), cmtool.contact_forms_path
|
||||
@@ -0,0 +1,26 @@
|
||||
- title :index, Cmtool::ContactForm
|
||||
- if @contact_forms.any?
|
||||
%table.index-table
|
||||
%thead
|
||||
%tr
|
||||
%th= Cmtool::ContactForm.human_attribute_name(:gender)
|
||||
%th= Cmtool::ContactForm.human_attribute_name(:name)
|
||||
%th= Cmtool::ContactForm.human_attribute_name(:email)
|
||||
%th= Cmtool::ContactForm.human_attribute_name(:phone)
|
||||
%th
|
||||
%th
|
||||
%tbody
|
||||
- @contact_forms.each do |contact_form|
|
||||
%tr
|
||||
%td= contact_form.gender
|
||||
%td= link_to contact_form.name, cmtool.contact_form_path(contact_form)
|
||||
%td= contact_form.email
|
||||
%td= contact_form.phone
|
||||
%td= link_to link_to_edit_content(contact_form), cmtool.edit_contact_form_path(contact_form)
|
||||
%td= link_to link_to_destroy_content(contact_form), cmtool.contact_form_path(contact_form), :confirm => are_you_sure(contact_form), :method => :delete
|
||||
- else
|
||||
= empty_result(Cmtool::ContactForm)
|
||||
|
||||
- content_for :page_links do
|
||||
%ul
|
||||
%li= link_to link_to_new_content(Cmtool::ContactForm), cmtool.new_contact_form_path
|
||||
@@ -0,0 +1,5 @@
|
||||
- title :new, Cmtool::ContactForm
|
||||
= render 'form', :submit => create_button_text(@contact_form)
|
||||
- content_for :page_links do
|
||||
%ul
|
||||
%li= link_to link_to_index_content(Cmtool::ContactForm), cmtool.contact_forms_path
|
||||
@@ -0,0 +1,22 @@
|
||||
- title :show, Cmtool::ContactForm
|
||||
.show_field
|
||||
%strong= Cmtool::ContactForm.human_attribute_name(:gender)
|
||||
= @contact_form.gender
|
||||
.show_field
|
||||
%strong= Cmtool::ContactForm.human_attribute_name(:name)
|
||||
= @contact_form.name
|
||||
.show_field
|
||||
%strong= Cmtool::ContactForm.human_attribute_name(:email)
|
||||
= @contact_form.email
|
||||
.show_field
|
||||
%strong= Cmtool::ContactForm.human_attribute_name(:phone)
|
||||
= @contact_form.phone
|
||||
.show_field
|
||||
%strong= Cmtool::ContactForm.human_attribute_name(:body)
|
||||
=raw @contact_form.body
|
||||
|
||||
- content_for :page_links do
|
||||
%ul
|
||||
%li= link_to link_to_edit_content(@contact_form), cmtool.edit_contact_form_path(@contact_form)
|
||||
%li= link_separator
|
||||
%li= link_to link_to_index_content(Cmtool::ContactForm), cmtool.contact_forms_path
|
||||
@@ -0,0 +1,14 @@
|
||||
= form_for [:admin, @customer] do |f|
|
||||
= render 'error_messages', :target => @customer
|
||||
|
||||
.field
|
||||
= f.label :email
|
||||
= f.text_field :email
|
||||
.field
|
||||
= f.label :password
|
||||
= f.password_field :password
|
||||
.field
|
||||
= f.label :password_confirmation
|
||||
= f.password_field :password_confirmation
|
||||
.actions
|
||||
= f.submit @submit || update_button_text
|
||||
@@ -0,0 +1,8 @@
|
||||
- title t('action.edit.title', :model => Customer.model_name.human)
|
||||
= render 'form', :submit => update_button_text
|
||||
|
||||
- content_for :page_links do
|
||||
%ul
|
||||
%li= link_to link_to_show_content(@customer), [:admin, @customer]
|
||||
%li= link_separator
|
||||
%li= link_to link_to_index_content(:customer), admin_customers_path
|
||||
@@ -0,0 +1,20 @@
|
||||
- title t('action.index.title', :model => Customer.model_name.human.pluralize)
|
||||
- if @customers.any?
|
||||
%table.index-table
|
||||
%thead
|
||||
%tr
|
||||
%th= Customer.human_attribute_name(:email)
|
||||
%th
|
||||
%th
|
||||
%tbody
|
||||
- @customers.each do |customer|
|
||||
%tr
|
||||
%td= link_to customer.email, [:admin, customer]
|
||||
%td= link_to link_to_edit_content(customer), [:edit, :admin, customer]
|
||||
%td= link_to link_to_destroy_content(customer), [:admin, customer], :confirm => are_you_sure(customer), :method => :delete
|
||||
- else
|
||||
= empty_result(Customer)
|
||||
|
||||
- content_for :page_links do
|
||||
%ul
|
||||
%li= link_to link_to_new_content(:customer), new_admin_customer_path
|
||||
@@ -0,0 +1,7 @@
|
||||
- title t('action.new.title', :model => Customer.model_name.human)
|
||||
|
||||
= render 'form', :submit => create_button_text
|
||||
|
||||
- content_for :page_links do
|
||||
%ul
|
||||
%li= link_to link_to_index_content(:customer), admin_customers_path
|
||||
@@ -0,0 +1,10 @@
|
||||
- title t('action.show.title', :model => Customer.model_name.human)
|
||||
.show_field
|
||||
%strong= Customer.human_attribute_name(:email)
|
||||
= @customer.email
|
||||
|
||||
- content_for :page_links do
|
||||
%ul
|
||||
%li= link_to link_to_edit_content(@customer), [:edit, :admin, @customer]
|
||||
%li= link_separator
|
||||
%li= link_to link_to_index_content(:customer), admin_customers_path
|
||||
@@ -0,0 +1 @@
|
||||
Ik ben een klant
|
||||
@@ -0,0 +1,10 @@
|
||||
= form_for [cmtool, @directory], :html => {:multipart => true} do |f|
|
||||
= render 'error_messages', :target => @directory
|
||||
.field
|
||||
= f.label :name
|
||||
= f.text_field :name
|
||||
.field
|
||||
= f.label :parent_id, Cmtool::Directory.model_name.human
|
||||
= f.select :parent_id, tree_options_for_select(Cmtool::Directory.full_tree, exclude: @directory.id, selected: @directory.parent_id), include_blank: ''
|
||||
.actions
|
||||
= f.submit @submit || update_button_text(@directory)
|
||||
@@ -0,0 +1,5 @@
|
||||
%tr
|
||||
%td.image.thumb= link_to(image_tag(image.file.url(:thumb)), cmtool.image_path(image)
|
||||
%td= link_to image.clean_name, cmtool.image_path(image)
|
||||
%td
|
||||
%td.action.destroy.directory= link_to link_to_destroy_content(image), cmtool.image_path(image), :method => :delete, :confirm => are_you_sure(image)
|
||||
@@ -0,0 +1,8 @@
|
||||
- title :edit, Cmtool::Directory
|
||||
= render 'form', :submit => update_button_text(@directory)
|
||||
|
||||
- content_for :page_links do
|
||||
%ul
|
||||
%li= link_to link_to_show_content(@directory), cmtool.directory_path(@directory)
|
||||
%li= link_separator
|
||||
%li= link_to link_to_index_content(Cmtool::Directory), cmtool.directories_path
|
||||
@@ -0,0 +1,20 @@
|
||||
- title :index, Cmtool::Directory
|
||||
- if @directories.any?
|
||||
%table.index-table
|
||||
%thead
|
||||
%tr
|
||||
%th= Cmtool::Directory.human_attribute_name(:name)
|
||||
%th
|
||||
%th
|
||||
%tbody
|
||||
- @directories.each do |directory|
|
||||
%tr
|
||||
%td= link_to directory.name, cmtool.directory_path(directory)
|
||||
%td= link_to link_to_edit_content(directory), cmtool.edit_directory_path(directory)
|
||||
%td= link_to link_to_destroy_content(directory), cmtool.directory_path(directory), :confirm => are_you_sure(directory), :method => :delete
|
||||
- else
|
||||
= empty_result(Cmtool::Directory)
|
||||
|
||||
- content_for :page_links do
|
||||
%ul
|
||||
%li= link_to link_to_new_content(Cmtool::Directory), cmtool.new_directory_path
|
||||
@@ -0,0 +1,7 @@
|
||||
- title :new, Cmtool::Directory
|
||||
|
||||
= render 'form', :submit => create_button_text(@directory)
|
||||
|
||||
- content_for :page_links do
|
||||
%ul
|
||||
%li= link_to link_to_index_content(Cmtool::Directory), cmtool.directories_path
|
||||
@@ -0,0 +1,35 @@
|
||||
- title :show, Cmtool::Directory
|
||||
- content_for :onload_javascript do
|
||||
$('.add-image-container').dialog({modal: true, autoOpen: false, width: 400})
|
||||
.add-image-container
|
||||
= form_for [cmtool, Cmtool::Image.new(directory_id: @directory.id)], :html => { :multipart => true } do |f|
|
||||
= f.hidden_field :directory_id
|
||||
= f.file_field :file
|
||||
= f.submit t('cmtool.directory.add_image.label', image: Cmtool::Image.model_name.human)
|
||||
.directory.caption= "/#{@directory.tree_path.map{|d| link_to(d.name, cmtool.directory_path(d))}.join('/')}".html_safe
|
||||
%table#directory-view
|
||||
%thead
|
||||
%tbody
|
||||
%tr
|
||||
%td.directory.parent= link_to '..', (@directory.parent ? cmtool.directory_path(@directory.parent) : cmtool.directories_path)
|
||||
%td
|
||||
%td
|
||||
%td
|
||||
- for child in @directory.children
|
||||
%tr
|
||||
%td.directory.child= link_to child.name, cmtool.directory_path(child)
|
||||
%td
|
||||
%td
|
||||
%td.action.destroy.directory= link_to link_to_destroy_content(child), cmtool.directory_path(child), :method => :delete, :confirm => are_you_sure(child)
|
||||
- for image in @directory.images
|
||||
= render 'image', :image => image
|
||||
- content_for :page_links do
|
||||
%ul
|
||||
- if @directory.parent
|
||||
%li= link_to '..', cmtool.directory_path(@directory.parent)
|
||||
%li= link_separator
|
||||
%li= link_to link_to_edit_content(@directory), cmtool.edit_directory_path(@directory)
|
||||
%li= link_separator
|
||||
%li= link_to link_to_index_content(Cmtool::Directory), cmtool.directories_path
|
||||
%li= link_separator
|
||||
%li= link_to_function t('cmtool.directoy.add_file'), %|$('.add-image-container').dialog('open')|
|
||||
@@ -0,0 +1,11 @@
|
||||
= form_for [cmtool, @faq] do |f|
|
||||
= render 'error_messages', :target => @faq
|
||||
|
||||
.field
|
||||
= f.label :question
|
||||
= f.text_area :question, :rows => 3, :class => 'editor_basic'
|
||||
.field
|
||||
= f.label :answer
|
||||
= f.text_area :answer, :rows => 6, :class => 'editor_basic'
|
||||
.actions
|
||||
= f.submit @submit || update_button_text(@faq)
|
||||
@@ -0,0 +1,8 @@
|
||||
- title :edit, @faq
|
||||
= render 'form', :submit => update_button_text(@faq)
|
||||
|
||||
- content_for :page_links do
|
||||
%ul
|
||||
%li= link_to link_to_show_content(@faq), cmtool.faq_path(@faq)
|
||||
%li= link_separator
|
||||
%li= link_to link_to_index_content(Cmtool::Faq), cmtool.faqs_path
|
||||
@@ -0,0 +1,22 @@
|
||||
- title t('cmtool.action.index.title', :models => Cmtool::Faq.model_name.human.pluralize)
|
||||
- if @faqs.any?
|
||||
%table.index-table
|
||||
%thead
|
||||
%tr
|
||||
%th= Cmtool::Faq.human_attribute_name(:question)
|
||||
%th= Cmtool::Faq.human_attribute_name(:answer)
|
||||
%th
|
||||
%th
|
||||
%tbody
|
||||
- @faqs.each do |faq|
|
||||
%tr
|
||||
%td= link_to raw(truncate(faq.question, :length => 40)), cmtool.faq_path(faq)
|
||||
%td= link_to raw(truncate(faq.answer, :length => 40)), cmtool.faq_path(faq)
|
||||
%td= link_to link_to_edit_content(faq), cmtool.edit_faq_path(faq)
|
||||
%td= link_to link_to_destroy_content(faq), cmtool.faq_path(faq), :confirm => are_you_sure(faq), :method => :delete
|
||||
- else
|
||||
= empty_result(Cmtool::Faq)
|
||||
|
||||
- content_for :page_links do
|
||||
%ul
|
||||
%li= link_to link_to_new_content(Cmtool::Faq), cmtool.new_faq_path
|
||||
@@ -0,0 +1,6 @@
|
||||
- title :new, Cmtool::Faq
|
||||
= render 'form', :submit => create_button_text(@faq)
|
||||
|
||||
- content_for :page_links do
|
||||
%ul
|
||||
%li= link_to link_to_index_content(Cmtool::Faq), cmtool.faqs_path
|
||||
@@ -0,0 +1,13 @@
|
||||
- title t('cmtool.action.show.title', :model => Cmtool::Faq.model_name.human)
|
||||
.show_field
|
||||
%strong= Cmtool::Faq.human_attribute_name(:question)
|
||||
=raw @faq.question
|
||||
.show_field
|
||||
%strong= Cmtool::Faq.human_attribute_name(:answer)
|
||||
=raw @faq.answer
|
||||
|
||||
- content_for :page_links do
|
||||
%ul
|
||||
%li= link_to link_to_edit_content(@faq), cmtool.edit_faq_path(@faq)
|
||||
%li= link_separator
|
||||
%li= link_to link_to_index_content(Cmtool::Faq), cmtool.faqs_path
|
||||
@@ -0,0 +1,12 @@
|
||||
= form_for [cmtool, @image], :html => {:multipart => true} do |f|
|
||||
= render 'error_messages', :target => @image
|
||||
|
||||
.field
|
||||
= f.label :file, Cmtool::Image.model_name.human
|
||||
= f.file_field :file
|
||||
.field
|
||||
= f.label :directory_id, Cmtool::Directory.model_name.human
|
||||
= f.select :directory_id, Cmtool::Directory.all.map{|d| ["-"*d.depth + ' ' + d.name.to_s, d.id]}
|
||||
|
||||
.actions
|
||||
= f.submit @submit || update_button_text(@image)
|
||||
@@ -0,0 +1,8 @@
|
||||
- title :edit, Cmtool::Image
|
||||
= render 'form', :submit => update_button_text(@image)
|
||||
|
||||
- content_for :page_links do
|
||||
%ul
|
||||
%li= link_to link_to_show_content(@image), cmtool.image_path(@image)
|
||||
%li= link_separator
|
||||
%li= link_to link_to_index_content(Cmtool::Image), cmtool.images_path
|
||||
@@ -0,0 +1,30 @@
|
||||
- title :index, Cmtool::Image
|
||||
- if @images.any?
|
||||
%table.index-table
|
||||
%thead
|
||||
%tr
|
||||
%th= Cmtool::Image.model_name.human
|
||||
%th= Cmtool::Image.human_attribute_name(:file_file_name)
|
||||
%th= Cmtool::Image.human_attribute_name(:file_content_type)
|
||||
%th= Cmtool::Image.human_attribute_name(:file_file_size)
|
||||
%th= Cmtool::Image.human_attribute_name(:file_updated_at)
|
||||
%th
|
||||
%th
|
||||
%tbody
|
||||
- @images.each do |image|
|
||||
%tr
|
||||
%td
|
||||
- if image.file?
|
||||
= link_to(image_tag(image.file.url(:thumb)), cmtool.image_path(image))
|
||||
%td= link_to image.file_file_name, cmtool.image_path(image)
|
||||
%td= image.file_content_type
|
||||
%td= human_size image.file_file_size
|
||||
%td= l image.file_updated_at #, :format => :short
|
||||
%td= link_to link_to_edit_content(image), cmtool.edit_image_path(image)
|
||||
%td= link_to link_to_destroy_content(image), cmtool.image_path(image), :confirm => are_you_sure(image), :method => :delete
|
||||
- else
|
||||
= empty_result(Cmtool::Image)
|
||||
|
||||
- content_for :page_links do
|
||||
%ul
|
||||
%li= link_to link_to_new_content(Cmtool::Image), cmtool.new_image_path
|
||||
@@ -0,0 +1,3 @@
|
||||
var tinyMCE::ImageList = new Array(
|
||||
<%= Cmtool::Image.active.map{|i| %{['#{i.clean_name} (Origineel)', '#{i.file.url(:original)}'], ['#{i.clean_name} (Pagina)', '#{i.file.url(:page)}'], ['#{i.clean_name} (Medium)', '#{i.file.url(:medium)}'], ['#{i.clean_name} (Thumb)', '#{i.file.url(:thumb)}']}}.join(",\n") %>
|
||||
);
|
||||
@@ -0,0 +1,6 @@
|
||||
- title :new, Cmtool::Image
|
||||
= render 'form', :submit => create_button_text(@image)
|
||||
|
||||
- content_for :page_links do
|
||||
%ul
|
||||
%li= link_to link_to_index_content(Cmtool::Image), cmtool.images_path
|
||||
@@ -0,0 +1,24 @@
|
||||
- title t('action.show.title', :model => Cmtool::Image.model_name.human)
|
||||
.show_field
|
||||
- if @image.file?
|
||||
= image_tag @image.file.url(:page)
|
||||
.show_field
|
||||
%strong= Cmtool::Image.human_attribute_name(:file_file_name)
|
||||
= @image.file_file_name
|
||||
.show_field
|
||||
%strong= Cmtool::Image.human_attribute_name(:file_content_type)
|
||||
= @image.file_content_type
|
||||
.show_field
|
||||
%strong= Cmtool::Image.human_attribute_name(:file_file_size)
|
||||
= human_size @image.file_file_size
|
||||
.show_field
|
||||
%strong= Cmtool::Image.human_attribute_name(:file_updated_at)
|
||||
= @image.file_updated_at
|
||||
|
||||
- content_for :page_links do
|
||||
%ul
|
||||
%li= link_to link_to_edit_content(@image), cmtool.edit_image_path(@image)
|
||||
%li= link_separator
|
||||
%li= link_to link_to_new_content(Cmtool::Image), cmtool.new_image_path, :class => %w[new image]
|
||||
%li= link_separator
|
||||
%li= link_to link_to_index_content(Cmtool::Image), cmtool.images_path
|
||||
@@ -0,0 +1,8 @@
|
||||
= form_for [cmtool, @keyword] do |f|
|
||||
= render 'error_messages', :target => @keyword
|
||||
|
||||
.field
|
||||
= f.label :name
|
||||
= f.text_field :name
|
||||
.actions
|
||||
= f.submit @submit || update_button_text(@keyword)
|
||||
@@ -0,0 +1,6 @@
|
||||
%h4= Cmtool::Keyword.model_name.human.pluralize
|
||||
= hidden_field_tag "#{subject.class.name.underscore.sub(/.*\//, '')}[keyword_ids][]", nil
|
||||
- for keyword in Cmtool::Keyword.all
|
||||
.keyword_container
|
||||
= check_box_tag "#{subject.class.name.underscore.sub(/.*\//, '')}[keyword_ids][]", keyword.id, subject.keywords.include?(keyword), :id => "keyword-checkbox-#{keyword.id}"
|
||||
= label_tag "keyword-checkbox-#{keyword.id}", keyword.name
|
||||
@@ -0,0 +1,8 @@
|
||||
- title t('cmtool.action.edit.title', :model => Cmtool::Keyword.model_name.human)
|
||||
= render 'form', :submit => update_button_text(@keyword)
|
||||
|
||||
- content_for :page_links do
|
||||
%ul
|
||||
%li= link_to link_to_show_content(@keyword), cmtool.keyword_path(@keyword)
|
||||
%li= link_separator
|
||||
%li= link_to link_to_index_content(Cmtool::Keyword), cmtool.keywords_path
|
||||
@@ -0,0 +1,20 @@
|
||||
- title t('action.index.title', :model => Cmtool::Keyword.model_name.human.pluralize)
|
||||
- if @keywords.any?
|
||||
%table.index-table
|
||||
%thead
|
||||
%tr
|
||||
%th= Cmtool::Keyword.human_attribute_name(:name)
|
||||
%th
|
||||
%th
|
||||
%tbody
|
||||
- @keywords.each do |keyword|
|
||||
%tr
|
||||
%td= link_to keyword.name, cmtool.keyword_path(keyword)
|
||||
%td= link_to link_to_edit_content(keyword), cmtool.edit_keyword_path(keyword)
|
||||
%td= link_to link_to_destroy_content(keyword), cmtool.keyword_path(keyword), :confirm => are_you_sure(keyword), :method => :delete
|
||||
- else
|
||||
= empty_result(Cmtool::Keyword)
|
||||
|
||||
- content_for :page_links do
|
||||
%ul
|
||||
%li= link_to link_to_new_content(Cmtool::Keyword), cmtool.new_keyword_path
|
||||
@@ -0,0 +1,7 @@
|
||||
- title t('cmtool.action.new.title', :model => Cmtool::Keyword.model_name.human)
|
||||
|
||||
= render 'form', :submit => create_button_text(@keyword)
|
||||
|
||||
- content_for :page_links do
|
||||
%ul
|
||||
%li= link_to link_to_index_content(Cmtool::Keyword), cmtool.keywords_path
|
||||
@@ -0,0 +1,10 @@
|
||||
- title t('cmtool.action.show.title', :model => Cmtool::Keyword.model_name.human)
|
||||
.show_field
|
||||
%strong= Cmtool::Keyword.human_attribute_name(:name)
|
||||
= @keyword.name
|
||||
|
||||
- content_for :page_links do
|
||||
%ul
|
||||
%li= link_to link_to_edit_content(@keyword), cmtool.edit_keyword_path(@keyword)
|
||||
%li= link_separator
|
||||
%li= link_to link_to_index_content(Cmtool::Keyword), cmtool.keywords_path
|
||||
@@ -0,0 +1,5 @@
|
||||
<p>Welcome <%= @resource.email %>!</p>
|
||||
|
||||
<p>You can confirm your account through the link below:</p>
|
||||
|
||||
<p><%= link_to 'Confirm my account', confirmation_url(@resource, :confirmation_token => @resource.confirmation_token) %></p>
|
||||
@@ -0,0 +1,8 @@
|
||||
<p>Hello <%= @resource.email %>!</p>
|
||||
|
||||
<p>Someone has requested a link to change your password, and you can do this through the link below.</p>
|
||||
|
||||
<p><%= link_to 'Change my password', edit_password_url(@resource, :reset_password_token => @resource.reset_password_token) %></p>
|
||||
|
||||
<p>If you didn't request this, please ignore this email.</p>
|
||||
<p>Your password won't change until you access the link above and create a new one.</p>
|
||||
@@ -0,0 +1,7 @@
|
||||
<p>Hello <%= @resource.email %>!</p>
|
||||
|
||||
<p>Your account has been locked due to an excessive amount of unsuccessful sign in attempts.</p>
|
||||
|
||||
<p>Click the link below to unlock your account:</p>
|
||||
|
||||
<p><%= link_to 'Unlock my account', unlock_url(@resource, :unlock_token => @resource.unlock_token) %></p>
|
||||
@@ -0,0 +1,22 @@
|
||||
= form_for [cmtool, @news], :html => {:multipart => true} do |f|
|
||||
= render 'error_messages', :target => @news
|
||||
.field
|
||||
= f.label :title
|
||||
= f.text_field :title
|
||||
.field
|
||||
= f.label :active
|
||||
= f.check_box :active
|
||||
.field
|
||||
= f.label :date
|
||||
= f.text_field :date
|
||||
(yyyy-mm-dd)
|
||||
.field
|
||||
= f.label :body
|
||||
= f.text_area :body, :class => 'editor_full'
|
||||
.field
|
||||
= f.label :image
|
||||
= f.file_field :image
|
||||
.field
|
||||
= render "cmtool/keywords/habtm", :subject => @news
|
||||
.actions
|
||||
= f.submit @submit || update_button_text(@news)
|
||||
@@ -0,0 +1,10 @@
|
||||
- title t('action.edit.title', :model => Cmtool::News.model_name.human)
|
||||
- if @news.image?
|
||||
= link_to image_tag(@news.image.url(:thumb)), @news.image.url
|
||||
= render 'form', :submit => update_button_text(@news)
|
||||
|
||||
- content_for :page_links do
|
||||
%ul
|
||||
%li= link_to link_to_show_content(@news), cmtool.news_path(@news)
|
||||
%li= link_separator
|
||||
%li= link_to link_to_index_content(Cmtool::News), cmtool.news_index_path
|
||||
@@ -0,0 +1,24 @@
|
||||
- title t('action.index.title', :model => Cmtool::News.model_name.human.pluralize)
|
||||
- if @news.any?
|
||||
%table.index-table
|
||||
%thead
|
||||
%tr
|
||||
%th= Cmtool::News.human_attribute_name(:title)
|
||||
%th= Cmtool::News.human_attribute_name(:active)
|
||||
%th= Cmtool::News.human_attribute_name(:date)
|
||||
%th
|
||||
%th
|
||||
%tbody
|
||||
- @news.each do |news|
|
||||
%tr
|
||||
%td= link_to news.title, cmtool.news_path(news)
|
||||
%td= boolean_text news.active?
|
||||
%td=l news.date
|
||||
%td= link_to link_to_edit_content(news), cmtool.edit_news_path(news)
|
||||
%td= link_to link_to_destroy_content(news), cmtool.news_path(news), :confirm => are_you_sure(news), :method => :delete
|
||||
- else
|
||||
= empty_result(Cmtool::News)
|
||||
|
||||
- content_for :page_links do
|
||||
%ul
|
||||
%li= link_to link_to_new_content(Cmtool::News), cmtool.new_news_path
|
||||
@@ -0,0 +1,7 @@
|
||||
- title t('action.new.title', :model => Cmtool::News.model_name.human)
|
||||
|
||||
= render 'form', :submit => create_button_text(@news)
|
||||
|
||||
- content_for :page_links do
|
||||
%ul
|
||||
%li= link_to link_to_index_content(Cmtool::News), cmtool.news_index_path
|
||||
@@ -0,0 +1 @@
|
||||
$('#news-image-container').slideUp();
|
||||