Initial
This commit is contained in:
commit
1fa250e0e4
10
.gitignore
vendored
Normal file
10
.gitignore
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
.bundle
|
||||
db/*.sqlite3
|
||||
db/schema.rb
|
||||
log/*.log
|
||||
tmp/**/*
|
||||
|
||||
public/assets/stylesheets/*
|
||||
|
||||
.sass-cache/**
|
||||
|
4
Capfile
Normal file
4
Capfile
Normal file
@ -0,0 +1,4 @@
|
||||
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
|
||||
Dir['vendor/gems/*/recipes/*.rb','vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
|
||||
|
||||
load 'config/deploy' # remove this line to skip loading any of the default tasks
|
55
Gemfile
Normal file
55
Gemfile
Normal file
@ -0,0 +1,55 @@
|
||||
source 'http://rubygems.org'
|
||||
|
||||
gem 'rails', '3.1.0.rc4'
|
||||
gem "rake", "0.8.7"
|
||||
|
||||
# Bundle edge Rails instead:
|
||||
# gem 'rails', :git => 'git://github.com/rails/rails.git'
|
||||
|
||||
gem 'sqlite3'
|
||||
|
||||
# Asset template engines
|
||||
gem 'sass-rails', "~> 3.1.0.rc"
|
||||
gem 'coffee-script'
|
||||
gem 'uglifier'
|
||||
gem 'therubyracer'
|
||||
gem 'jquery-rails'
|
||||
|
||||
# Use unicorn as the web server
|
||||
# gem 'unicorn'
|
||||
|
||||
# Deploy with Capistrano
|
||||
# gem 'capistrano'
|
||||
|
||||
# To use debugger
|
||||
# gem 'ruby-debug19', :require => 'ruby-debug'
|
||||
|
||||
|
||||
|
||||
gem "simple-navigation"
|
||||
|
||||
gem "kaminari"
|
||||
gem 'formtastic'
|
||||
|
||||
gem "acts_as_tree"
|
||||
gem "acts_as_list"
|
||||
|
||||
gem 'rmagick'
|
||||
|
||||
gem 'carrierwave'
|
||||
|
||||
gem 'mimetype-fu'
|
||||
|
||||
gem "cancan"
|
||||
|
||||
#gem "squeel"
|
||||
gem 'meta_search', '1.1.0.pre2'
|
||||
|
||||
gem "devise"
|
||||
gem "haml", ">= 3.0.0"
|
||||
|
||||
|
||||
group :test do
|
||||
# Pretty printed test output
|
||||
gem 'turn', :require => false
|
||||
end
|
159
Gemfile.lock
Normal file
159
Gemfile.lock
Normal file
@ -0,0 +1,159 @@
|
||||
GEM
|
||||
remote: http://rubygems.org/
|
||||
specs:
|
||||
actionmailer (3.1.0.rc4)
|
||||
actionpack (= 3.1.0.rc4)
|
||||
mail (~> 2.3.0)
|
||||
actionpack (3.1.0.rc4)
|
||||
activemodel (= 3.1.0.rc4)
|
||||
activesupport (= 3.1.0.rc4)
|
||||
builder (~> 3.0.0)
|
||||
erubis (~> 2.7.0)
|
||||
i18n (~> 0.6)
|
||||
rack (~> 1.3.0)
|
||||
rack-cache (~> 1.0.1)
|
||||
rack-mount (~> 0.8.1)
|
||||
rack-test (~> 0.6.0)
|
||||
sprockets (~> 2.0.0.beta.10)
|
||||
tzinfo (~> 0.3.27)
|
||||
activemodel (3.1.0.rc4)
|
||||
activesupport (= 3.1.0.rc4)
|
||||
bcrypt-ruby (~> 2.1.4)
|
||||
builder (~> 3.0.0)
|
||||
i18n (~> 0.6)
|
||||
activerecord (3.1.0.rc4)
|
||||
activemodel (= 3.1.0.rc4)
|
||||
activesupport (= 3.1.0.rc4)
|
||||
arel (~> 2.1.1)
|
||||
tzinfo (~> 0.3.27)
|
||||
activeresource (3.1.0.rc4)
|
||||
activemodel (= 3.1.0.rc4)
|
||||
activesupport (= 3.1.0.rc4)
|
||||
activesupport (3.1.0.rc4)
|
||||
multi_json (~> 1.0)
|
||||
acts_as_list (0.1.3)
|
||||
acts_as_tree (0.1.1)
|
||||
ansi (1.3.0)
|
||||
arel (2.1.3)
|
||||
bcrypt-ruby (2.1.4)
|
||||
builder (3.0.0)
|
||||
cancan (1.6.5)
|
||||
carrierwave (0.5.5)
|
||||
activesupport (~> 3.0)
|
||||
coffee-script (2.2.0)
|
||||
coffee-script-source
|
||||
execjs
|
||||
coffee-script-source (1.1.1)
|
||||
devise (1.4.2)
|
||||
bcrypt-ruby (~> 2.1.2)
|
||||
orm_adapter (~> 0.0.3)
|
||||
warden (~> 1.0.3)
|
||||
erubis (2.7.0)
|
||||
execjs (1.2.0)
|
||||
multi_json (~> 1.0)
|
||||
formtastic (1.2.4)
|
||||
actionpack (>= 2.3.7)
|
||||
activesupport (>= 2.3.7)
|
||||
i18n (~> 0.4)
|
||||
haml (3.1.2)
|
||||
hike (1.1.0)
|
||||
i18n (0.6.0)
|
||||
jquery-rails (1.0.12)
|
||||
railties (~> 3.0)
|
||||
thor (~> 0.14)
|
||||
kaminari (0.12.4)
|
||||
rails (>= 3.0.0)
|
||||
libv8 (3.3.10.2)
|
||||
mail (2.3.0)
|
||||
i18n (>= 0.4.0)
|
||||
mime-types (~> 1.16)
|
||||
treetop (~> 1.4.8)
|
||||
meta_search (1.1.0.pre2)
|
||||
actionpack (~> 3.1.0.alpha)
|
||||
activerecord (~> 3.1.0.alpha)
|
||||
activesupport (~> 3.1.0.alpha)
|
||||
mime-types (1.16)
|
||||
mimetype-fu (0.1.2)
|
||||
multi_json (1.0.3)
|
||||
orm_adapter (0.0.5)
|
||||
polyglot (0.3.1)
|
||||
rack (1.3.0)
|
||||
rack-cache (1.0.2)
|
||||
rack (>= 0.4)
|
||||
rack-mount (0.8.1)
|
||||
rack (>= 1.0.0)
|
||||
rack-ssl (1.3.2)
|
||||
rack
|
||||
rack-test (0.6.0)
|
||||
rack (>= 1.0)
|
||||
rails (3.1.0.rc4)
|
||||
actionmailer (= 3.1.0.rc4)
|
||||
actionpack (= 3.1.0.rc4)
|
||||
activerecord (= 3.1.0.rc4)
|
||||
activeresource (= 3.1.0.rc4)
|
||||
activesupport (= 3.1.0.rc4)
|
||||
bundler (~> 1.0)
|
||||
railties (= 3.1.0.rc4)
|
||||
railties (3.1.0.rc4)
|
||||
actionpack (= 3.1.0.rc4)
|
||||
activesupport (= 3.1.0.rc4)
|
||||
rack-ssl (~> 1.3.2)
|
||||
rake (>= 0.8.7)
|
||||
rdoc (~> 3.4)
|
||||
thor (~> 0.14.6)
|
||||
rake (0.8.7)
|
||||
rdoc (3.8)
|
||||
rmagick (2.13.1)
|
||||
sass (3.1.4)
|
||||
sass-rails (3.1.0.rc.4)
|
||||
actionpack (~> 3.1.0.rc1)
|
||||
railties (~> 3.1.0.rc1)
|
||||
sass (>= 3.1.4)
|
||||
sprockets (>= 2.0.0.beta.9)
|
||||
simple-navigation (3.3.3)
|
||||
activesupport (>= 2.3.2)
|
||||
sprockets (2.0.0.beta.10)
|
||||
hike (~> 1.0)
|
||||
rack (~> 1.0)
|
||||
tilt (!= 1.3.0, ~> 1.1)
|
||||
sqlite3 (1.3.3)
|
||||
therubyracer (0.9.2)
|
||||
libv8 (~> 3.3.10)
|
||||
thor (0.14.6)
|
||||
tilt (1.3.2)
|
||||
treetop (1.4.9)
|
||||
polyglot (>= 0.3.1)
|
||||
turn (0.8.2)
|
||||
ansi (>= 1.2.2)
|
||||
tzinfo (0.3.29)
|
||||
uglifier (1.0.0)
|
||||
execjs (>= 0.3.0)
|
||||
multi_json (>= 1.0.2)
|
||||
warden (1.0.4)
|
||||
rack (>= 1.0)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
acts_as_list
|
||||
acts_as_tree
|
||||
cancan
|
||||
carrierwave
|
||||
coffee-script
|
||||
devise
|
||||
formtastic
|
||||
haml (>= 3.0.0)
|
||||
jquery-rails
|
||||
kaminari
|
||||
meta_search (= 1.1.0.pre2)
|
||||
mimetype-fu
|
||||
rails (= 3.1.0.rc4)
|
||||
rake (= 0.8.7)
|
||||
rmagick
|
||||
sass-rails (~> 3.1.0.rc)
|
||||
simple-navigation
|
||||
sqlite3
|
||||
therubyracer
|
||||
turn
|
||||
uglifier
|
261
README
Normal file
261
README
Normal file
@ -0,0 +1,261 @@
|
||||
== Welcome to Rails
|
||||
|
||||
Rails is a web-application framework that includes everything needed to create
|
||||
database-backed web applications according to the Model-View-Control pattern.
|
||||
|
||||
This pattern splits the view (also called the presentation) into "dumb"
|
||||
templates that are primarily responsible for inserting pre-built data in between
|
||||
HTML tags. The model contains the "smart" domain objects (such as Account,
|
||||
Product, Person, Post) that holds all the business logic and knows how to
|
||||
persist themselves to a database. The controller handles the incoming requests
|
||||
(such as Save New Account, Update Product, Show Post) by manipulating the model
|
||||
and directing data to the view.
|
||||
|
||||
In Rails, the model is handled by what's called an object-relational mapping
|
||||
layer entitled Active Record. This layer allows you to present the data from
|
||||
database rows as objects and embellish these data objects with business logic
|
||||
methods. You can read more about Active Record in
|
||||
link:files/vendor/rails/activerecord/README.html.
|
||||
|
||||
The controller and view are handled by the Action Pack, which handles both
|
||||
layers by its two parts: Action View and Action Controller. These two layers
|
||||
are bundled in a single package due to their heavy interdependence. This is
|
||||
unlike the relationship between the Active Record and Action Pack that is much
|
||||
more separate. Each of these packages can be used independently outside of
|
||||
Rails. You can read more about Action Pack in
|
||||
link:files/vendor/rails/actionpack/README.html.
|
||||
|
||||
|
||||
== Getting Started
|
||||
|
||||
1. At the command prompt, create a new Rails application:
|
||||
<tt>rails new myapp</tt> (where <tt>myapp</tt> is the application name)
|
||||
|
||||
2. Change directory to <tt>myapp</tt> and start the web server:
|
||||
<tt>cd myapp; rails server</tt> (run with --help for options)
|
||||
|
||||
3. Go to http://localhost:3000/ and you'll see:
|
||||
"Welcome aboard: You're riding Ruby on Rails!"
|
||||
|
||||
4. Follow the guidelines to start developing your application. You can find
|
||||
the following resources handy:
|
||||
|
||||
* The Getting Started Guide: http://guides.rubyonrails.org/getting_started.html
|
||||
* Ruby on Rails Tutorial Book: http://www.railstutorial.org/
|
||||
|
||||
|
||||
== Debugging Rails
|
||||
|
||||
Sometimes your application goes wrong. Fortunately there are a lot of tools that
|
||||
will help you debug it and get it back on the rails.
|
||||
|
||||
First area to check is the application log files. Have "tail -f" commands
|
||||
running on the server.log and development.log. Rails will automatically display
|
||||
debugging and runtime information to these files. Debugging info will also be
|
||||
shown in the browser on requests from 127.0.0.1.
|
||||
|
||||
You can also log your own messages directly into the log file from your code
|
||||
using the Ruby logger class from inside your controllers. Example:
|
||||
|
||||
class WeblogController < ActionController::Base
|
||||
def destroy
|
||||
@weblog = Weblog.find(params[:id])
|
||||
@weblog.destroy
|
||||
logger.info("#{Time.now} Destroyed Weblog ID ##{@weblog.id}!")
|
||||
end
|
||||
end
|
||||
|
||||
The result will be a message in your log file along the lines of:
|
||||
|
||||
Mon Oct 08 14:22:29 +1000 2007 Destroyed Weblog ID #1!
|
||||
|
||||
More information on how to use the logger is at http://www.ruby-doc.org/core/
|
||||
|
||||
Also, Ruby documentation can be found at http://www.ruby-lang.org/. There are
|
||||
several books available online as well:
|
||||
|
||||
* Programming Ruby: http://www.ruby-doc.org/docs/ProgrammingRuby/ (Pickaxe)
|
||||
* Learn to Program: http://pine.fm/LearnToProgram/ (a beginners guide)
|
||||
|
||||
These two books will bring you up to speed on the Ruby language and also on
|
||||
programming in general.
|
||||
|
||||
|
||||
== Debugger
|
||||
|
||||
Debugger support is available through the debugger command when you start your
|
||||
Mongrel or WEBrick server with --debugger. This means that you can break out of
|
||||
execution at any point in the code, investigate and change the model, and then,
|
||||
resume execution! You need to install ruby-debug to run the server in debugging
|
||||
mode. With gems, use <tt>sudo gem install ruby-debug</tt>. Example:
|
||||
|
||||
class WeblogController < ActionController::Base
|
||||
def index
|
||||
@posts = Post.all
|
||||
debugger
|
||||
end
|
||||
end
|
||||
|
||||
So the controller will accept the action, run the first line, then present you
|
||||
with a IRB prompt in the server window. Here you can do things like:
|
||||
|
||||
>> @posts.inspect
|
||||
=> "[#<Post:0x14a6be8
|
||||
@attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>,
|
||||
#<Post:0x14a6620
|
||||
@attributes={"title"=>"Rails", "body"=>"Only ten..", "id"=>"2"}>]"
|
||||
>> @posts.first.title = "hello from a debugger"
|
||||
=> "hello from a debugger"
|
||||
|
||||
...and even better, you can examine how your runtime objects actually work:
|
||||
|
||||
>> f = @posts.first
|
||||
=> #<Post:0x13630c4 @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>
|
||||
>> f.
|
||||
Display all 152 possibilities? (y or n)
|
||||
|
||||
Finally, when you're ready to resume execution, you can enter "cont".
|
||||
|
||||
|
||||
== Console
|
||||
|
||||
The console is a Ruby shell, which allows you to interact with your
|
||||
application's domain model. Here you'll have all parts of the application
|
||||
configured, just like it is when the application is running. You can inspect
|
||||
domain models, change values, and save to the database. Starting the script
|
||||
without arguments will launch it in the development environment.
|
||||
|
||||
To start the console, run <tt>rails console</tt> from the application
|
||||
directory.
|
||||
|
||||
Options:
|
||||
|
||||
* Passing the <tt>-s, --sandbox</tt> argument will rollback any modifications
|
||||
made to the database.
|
||||
* Passing an environment name as an argument will load the corresponding
|
||||
environment. Example: <tt>rails console production</tt>.
|
||||
|
||||
To reload your controllers and models after launching the console run
|
||||
<tt>reload!</tt>
|
||||
|
||||
More information about irb can be found at:
|
||||
link:http://www.rubycentral.org/pickaxe/irb.html
|
||||
|
||||
|
||||
== dbconsole
|
||||
|
||||
You can go to the command line of your database directly through <tt>rails
|
||||
dbconsole</tt>. You would be connected to the database with the credentials
|
||||
defined in database.yml. Starting the script without arguments will connect you
|
||||
to the development database. Passing an argument will connect you to a different
|
||||
database, like <tt>rails dbconsole production</tt>. Currently works for MySQL,
|
||||
PostgreSQL and SQLite 3.
|
||||
|
||||
== Description of Contents
|
||||
|
||||
The default directory structure of a generated Ruby on Rails application:
|
||||
|
||||
|-- app
|
||||
| |-- assets
|
||||
| |-- images
|
||||
| |-- javascripts
|
||||
| `-- stylesheets
|
||||
| |-- controllers
|
||||
| |-- helpers
|
||||
| |-- mailers
|
||||
| |-- models
|
||||
| `-- views
|
||||
| `-- layouts
|
||||
|-- config
|
||||
| |-- environments
|
||||
| |-- initializers
|
||||
| `-- locales
|
||||
|-- db
|
||||
|-- doc
|
||||
|-- lib
|
||||
| `-- tasks
|
||||
|-- log
|
||||
|-- public
|
||||
|-- script
|
||||
|-- test
|
||||
| |-- fixtures
|
||||
| |-- functional
|
||||
| |-- integration
|
||||
| |-- performance
|
||||
| `-- unit
|
||||
|-- tmp
|
||||
| |-- cache
|
||||
| |-- pids
|
||||
| |-- sessions
|
||||
| `-- sockets
|
||||
`-- vendor
|
||||
|-- assets
|
||||
`-- stylesheets
|
||||
`-- plugins
|
||||
|
||||
app
|
||||
Holds all the code that's specific to this particular application.
|
||||
|
||||
app/assets
|
||||
Contains subdirectories for images, stylesheets, and JavaScript files.
|
||||
|
||||
app/controllers
|
||||
Holds controllers that should be named like weblogs_controller.rb for
|
||||
automated URL mapping. All controllers should descend from
|
||||
ApplicationController which itself descends from ActionController::Base.
|
||||
|
||||
app/models
|
||||
Holds models that should be named like post.rb. Models descend from
|
||||
ActiveRecord::Base by default.
|
||||
|
||||
app/views
|
||||
Holds the template files for the view that should be named like
|
||||
weblogs/index.html.erb for the WeblogsController#index action. All views use
|
||||
eRuby syntax by default.
|
||||
|
||||
app/views/layouts
|
||||
Holds the template files for layouts to be used with views. This models the
|
||||
common header/footer method of wrapping views. In your views, define a layout
|
||||
using the <tt>layout :default</tt> and create a file named default.html.erb.
|
||||
Inside default.html.erb, call <% yield %> to render the view using this
|
||||
layout.
|
||||
|
||||
app/helpers
|
||||
Holds view helpers that should be named like weblogs_helper.rb. These are
|
||||
generated for you automatically when using generators for controllers.
|
||||
Helpers can be used to wrap functionality for your views into methods.
|
||||
|
||||
config
|
||||
Configuration files for the Rails environment, the routing map, the database,
|
||||
and other dependencies.
|
||||
|
||||
db
|
||||
Contains the database schema in schema.rb. db/migrate contains all the
|
||||
sequence of Migrations for your schema.
|
||||
|
||||
doc
|
||||
This directory is where your application documentation will be stored when
|
||||
generated using <tt>rake doc:app</tt>
|
||||
|
||||
lib
|
||||
Application specific libraries. Basically, any kind of custom code that
|
||||
doesn't belong under controllers, models, or helpers. This directory is in
|
||||
the load path.
|
||||
|
||||
public
|
||||
The directory available for the web server. Also contains the dispatchers and the
|
||||
default HTML files. This should be set as the DOCUMENT_ROOT of your web
|
||||
server.
|
||||
|
||||
script
|
||||
Helper scripts for automation and generation.
|
||||
|
||||
test
|
||||
Unit and functional tests along with fixtures. When using the rails generate
|
||||
command, template test files will be generated for you and placed in this
|
||||
directory.
|
||||
|
||||
vendor
|
||||
External libraries that the application depends on. Also includes the plugins
|
||||
subdirectory. If the app has frozen rails, those gems also go here, under
|
||||
vendor/rails/. This directory is in the load path.
|
7
Rakefile
Normal file
7
Rakefile
Normal file
@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env rake
|
||||
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
||||
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
||||
|
||||
require File.expand_path('../config/application', __FILE__)
|
||||
|
||||
Pharma::Application.load_tasks
|
165
app/assets/javascripts/admin/admin.js
Normal file
165
app/assets/javascripts/admin/admin.js
Normal file
@ -0,0 +1,165 @@
|
||||
/*
|
||||
|
||||
= require jquery-ui
|
||||
= require jquery_ujs
|
||||
= require jquery-reject
|
||||
= require tiny_mce/jquery.tinymce.js
|
||||
= require jquery-fileupload-ui
|
||||
= require jquery-activity-indicator
|
||||
= require jquery-fileupload
|
||||
= require_tree .
|
||||
|
||||
*/
|
||||
|
||||
|
||||
function auto_load_divs() {
|
||||
|
||||
$('div[data-load]').live("resize",function () {
|
||||
auto_load_div($(this));
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
function auto_load_div(div_to_load) {
|
||||
|
||||
url = div_to_load.attr("data-url");
|
||||
|
||||
load_block = div_to_load.children(".loading") ;
|
||||
div_to_load.children(".ajax_load_content").hide();
|
||||
load_block.show();
|
||||
|
||||
div_to_load.children(".ajax_load_content").load(url, function() {div_to_load.children(".loading").hide();$(this).show();block_js_initialize(); resize_page_slide();})
|
||||
|
||||
}
|
||||
|
||||
|
||||
function update_auto_load_div(url, div_to_load)
|
||||
{
|
||||
|
||||
div = $("#"+div_to_load);
|
||||
div.attr("data-url", url);
|
||||
auto_load_div(div);
|
||||
|
||||
}
|
||||
|
||||
|
||||
function flash_notice(text) {
|
||||
|
||||
$('#flash').html('');
|
||||
$('#flash').html('<div id="flash_notice" class="notice message closeable" style="display:none;">'+text+'</div>');
|
||||
$('#flash_notice').fadeIn();
|
||||
$('#flash_notice').delay(2000).fadeOut();
|
||||
|
||||
}
|
||||
|
||||
function flash_alert(text) {
|
||||
|
||||
$('#flash').html('');
|
||||
$('#flash').html('<div id="flash_alert" class="alert message closeable" style="display:none;">'+text+'</div>');
|
||||
$('#flash_alert').fadeIn();
|
||||
$('#flash_alert').delay(4000).fadeOut();
|
||||
|
||||
}
|
||||
|
||||
|
||||
function resize_page_slide(){
|
||||
|
||||
$('.page_slide').css('width', $("#breadcrumb").outerWidth());
|
||||
|
||||
}
|
||||
|
||||
|
||||
function auto_tiny_mce(div)
|
||||
{
|
||||
|
||||
div.css("width", "100%");
|
||||
div.css("height", "400px");
|
||||
div.tinymce({
|
||||
|
||||
// Location of TinyMCE script
|
||||
script_url : '/assets/tiny_mce/tiny_mce.js',
|
||||
content_css : "/assets/admin/admin.css",
|
||||
// General options
|
||||
theme : "advanced",
|
||||
skin: "cirkuit",
|
||||
plugins : "pagebreak,style,contextmenu,paste,directionality,noneditable,visualchars,nonbreaking,xhtmlxtras",
|
||||
|
||||
// Theme options
|
||||
theme_advanced_buttons1 : "code,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,fontsizeselect,|,cut,copy,paste,pastetext,pasteword,|,bullist,numlist,|,forecolor,backcolor,sub,sup,|,charmap,|,removeformat",
|
||||
theme_advanced_buttons2 : "",
|
||||
theme_advanced_buttons3 : "",
|
||||
|
||||
theme_advanced_toolbar_location : "top",
|
||||
theme_advanced_toolbar_align : "left",
|
||||
theme_advanced_statusbar_location : false,
|
||||
theme_advanced_resizing : false,
|
||||
theme_advanced_text_colors : "#D2232A,#40AF49,#00ADEF",
|
||||
theme_advanced_background_colors : "#D2232A,#40AF49,#00ADEF",
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
function set_busy(){
|
||||
|
||||
$('body').append('<div id="busy"></div>');
|
||||
$('#busy').activity({segments: 8, steps: 5, opacity: 0.5, width: 10, space: 0, length: 10, color: '#212222', speed: 1.5});
|
||||
|
||||
}
|
||||
|
||||
|
||||
function unset_busy(){
|
||||
|
||||
$('#busy').remove();
|
||||
|
||||
}
|
||||
|
||||
|
||||
function when_admin_load() {
|
||||
|
||||
auto_load_divs();
|
||||
resize_page_slide();
|
||||
|
||||
$('.closeable').hide().fadeIn().delay(2000).fadeOut();
|
||||
|
||||
$('#slides').sortable({
|
||||
opacity:0.5,
|
||||
update : function () {
|
||||
var order = $(this).sortable('serialize');
|
||||
$.ajax({url : "/admin/slides/reorder.js?"+order});
|
||||
}
|
||||
});
|
||||
|
||||
$(window).bind('resize', function(){
|
||||
resize_page_slide();
|
||||
});
|
||||
|
||||
$(".update_auto_load_div").live("click",function() {
|
||||
update_auto_load_div($(this).attr("href"), $(this).attr("data_div_id"));
|
||||
|
||||
$(this).parent().children("a").removeClass("selected");
|
||||
$(this).addClass("selected");
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
when_admin_load();
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
131
app/assets/javascripts/admin/block.js
Normal file
131
app/assets/javascripts/admin/block.js
Normal file
@ -0,0 +1,131 @@
|
||||
|
||||
function block_js_initialize(){
|
||||
|
||||
initialize_receptables();
|
||||
|
||||
$( ".content_types_draggable" ).draggable({
|
||||
|
||||
revert:"invalid",
|
||||
connectToSortable: ".block_portlets",
|
||||
opacity: 0.5,
|
||||
zIndex:1000,
|
||||
helper: 'clone'
|
||||
|
||||
});
|
||||
|
||||
$('.portlet').live('mouseover', function(){
|
||||
|
||||
$(this).addClass('portlet_hover');
|
||||
$(this).parents('.portlet').children(".actions").css({'display':'none'});
|
||||
$(this).parents('.portlet').css({ "border" : "1px solid #FBFBFB"});
|
||||
|
||||
});
|
||||
|
||||
$('.portlet').live('mouseout', function(){
|
||||
|
||||
$(this).removeClass('portlet_hover');
|
||||
$(this).parents('.portlet').children(".actions").css('display','');
|
||||
$(this).parents('.portlet').css({ "border" : ""});
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
function update_portlet_order(){
|
||||
|
||||
var return_order = [];
|
||||
|
||||
$('.block_portlets').each(function(){
|
||||
|
||||
var block_data = {block_id : $(this).data('block_id'), block_portlet_ids : []};
|
||||
|
||||
$(this).children('.portlet').each(function(){
|
||||
if($(this).data('portlet_id')){
|
||||
block_data.block_portlet_ids.push($(this).data('portlet_id'));
|
||||
}
|
||||
|
||||
});
|
||||
return_order.push(block_data);
|
||||
|
||||
});
|
||||
|
||||
$.ajax({url : "/portlet/portlets/reorder", data : {blocks:return_order} });
|
||||
|
||||
}
|
||||
|
||||
|
||||
function initialize_receptables(){
|
||||
$('.portlet_place_holder').remove();
|
||||
$('.block_portlets').prepend('<div class="portlet_place_holder"></div>');
|
||||
$('.portlet').after('<div class="portlet_place_holder"></div>');
|
||||
|
||||
$( ".portlet" ).draggable({
|
||||
|
||||
revert:"invalid",
|
||||
handle:".move",
|
||||
zIndex:600,
|
||||
opacity: 0.5,
|
||||
appendTo:"body",
|
||||
scrollSensitivity : 20,
|
||||
scrollSpeed : 40
|
||||
|
||||
});
|
||||
|
||||
|
||||
$(".portlet_place_holder").droppable({
|
||||
|
||||
hoverClass:"portlet_receptable_hover",
|
||||
tolerance : "pointer",
|
||||
accept: '.portlet, .content_types_draggable' ,
|
||||
over: function(event, ui) {
|
||||
|
||||
$(this).attr("data_height", $(this).height());
|
||||
$(this).css("height", ui.draggable.attr("data_height"))
|
||||
|
||||
},
|
||||
|
||||
out: function(event, ui) {
|
||||
|
||||
$(this).css("height", $(this).attr("data_height"))
|
||||
|
||||
},
|
||||
|
||||
drop: function( event, ui ) {
|
||||
|
||||
if(ui.draggable.data("portlet_id")){
|
||||
|
||||
$(this).after(ui.draggable);
|
||||
ui.draggable.removeClass("ui-draggable");
|
||||
ui.draggable.removeClass("ui-draggable-dragging");
|
||||
ui.draggable.css({"top":"", "left":""});
|
||||
initialize_receptables();
|
||||
update_portlet_order();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
$(this).after('<div id="new_portlet_form_inline" class="portlet"><div id="new_portlet_content_form"></div></div>');
|
||||
initialize_receptables();
|
||||
|
||||
$.ajax({
|
||||
url:"/portlet/portlets/new.js",
|
||||
type: "GET",
|
||||
data: {
|
||||
block_id : $(this).attr("data_block_id"),
|
||||
position : $(this).attr("data_position"),
|
||||
content_type : ui.draggable.attr("data_type")
|
||||
} ,
|
||||
success : function (){
|
||||
after_load_document();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
60
app/assets/javascripts/admin/browser.js
Normal file
60
app/assets/javascripts/admin/browser.js
Normal file
@ -0,0 +1,60 @@
|
||||
$(document).ready(function ($) {
|
||||
|
||||
var browser_test = $.reject({
|
||||
|
||||
header: "Le navigateur que vous utilisez actuellement n'est pas pris en charge",
|
||||
paragraph1: "Notre interface d'administration étant conçu pour être la plus ergonomique et agréable à utiliser nécéssite l'usage d'un navigateur récent et respectueux des standards.",
|
||||
paragraph2: "Nous vous remercions d'installer l'un des navigateurs suivant :",
|
||||
imagePath:"/assets/browser/",
|
||||
close:false,
|
||||
reject : {
|
||||
|
||||
msie: true,
|
||||
chrome9 : true,
|
||||
chrome8 : true,
|
||||
chrome7 : true,
|
||||
chrome6 : true,
|
||||
chrome5 : true,
|
||||
chrome4 : true,
|
||||
chrome3 : true,
|
||||
chrome2 : true,
|
||||
konqueror : true,
|
||||
opera:true,
|
||||
safari2 : true,
|
||||
safari3:true,
|
||||
safari4:true,
|
||||
firefox1: true,
|
||||
firefox2: true,
|
||||
firefox3: true
|
||||
|
||||
},
|
||||
|
||||
display: ['safari','chrome','firefox'],
|
||||
|
||||
browserInfo: {
|
||||
|
||||
safari: {
|
||||
text: 'Safari 5+',
|
||||
img: "/assets/browser/safari.png",
|
||||
url: 'http://www.apple.com/fr/safari/download/'
|
||||
} ,
|
||||
chrome: {
|
||||
text: "Chrome 11+",
|
||||
url: 'http://www.google.com/chrome/'
|
||||
},
|
||||
firefox: {
|
||||
text: "Firefox 4+"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}); // Default Settings
|
||||
|
||||
|
||||
if( browser_test){
|
||||
$('#main').hide();
|
||||
$('#title').hide();
|
||||
}
|
||||
|
||||
});
|
18
app/assets/javascripts/admin/manager/cible.js
Normal file
18
app/assets/javascripts/admin/manager/cible.js
Normal file
@ -0,0 +1,18 @@
|
||||
function select_cible_from_manager(input_id){
|
||||
|
||||
set_busy();
|
||||
manager_prompt("/admin/cibles/?manager=true",function(m_return){
|
||||
|
||||
$('#input_id_'+input_id).val(m_return.cible_id);
|
||||
$('#input_type_'+input_id).val(m_return.cible_type);
|
||||
$('#name_'+input_id).val(m_return.cible_name);
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
function manager_send_cible(cible_id, cible_type, cible_name){
|
||||
|
||||
manager_send_response({cible_id : cible_id, cible_type : cible_type, cible_name : cible_name});
|
||||
}
|
271
app/assets/javascripts/admin/manager/data_files.js
Normal file
271
app/assets/javascripts/admin/manager/data_files.js
Normal file
@ -0,0 +1,271 @@
|
||||
function data_files_load()
|
||||
{
|
||||
|
||||
update_data_multiple_selection_text();
|
||||
set_data_files_big_container_size();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$( ".data_file" ).draggable({
|
||||
revert:"invalid",
|
||||
|
||||
opacity: 0.5,
|
||||
helper: 'clone',
|
||||
appendTo: '#main_workspace_view',
|
||||
start: function(event, ui) {
|
||||
|
||||
},
|
||||
drag: function(){
|
||||
},
|
||||
stop: function(){
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$(".file_folder:not(.active)").droppable({
|
||||
hoverClass:"album_highlight",
|
||||
tolerance : "pointer",
|
||||
|
||||
drop: function( event, ui ) {
|
||||
ui.draggable.fadeOut().remove();
|
||||
|
||||
|
||||
$.ajax({
|
||||
url:ui.draggable.data('show_url'),
|
||||
type: "PUT",
|
||||
data: {
|
||||
data_file : {
|
||||
file_folder_id : $(this).data("file_folder_id")
|
||||
}
|
||||
}
|
||||
});
|
||||
$( this ).effect("highlight", {}, 3000);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
function update_data_multiple_selection_text()
|
||||
{
|
||||
|
||||
var multiple_ids = multiple_data_selection_ids()
|
||||
var text = ""
|
||||
if (multiple_ids.length == 0)
|
||||
{
|
||||
text = "Aucun fichier séléctionné";
|
||||
}
|
||||
else if(multiple_ids.length == 1)
|
||||
{
|
||||
text= "Un fichier séléctionné";
|
||||
}
|
||||
else
|
||||
{
|
||||
text= multiple_ids.length+" fichiers séléctionnés";
|
||||
}
|
||||
|
||||
|
||||
$('#data_files_multiple_selection_text').html(text);
|
||||
|
||||
}
|
||||
|
||||
function multiple_data_selection_ids()
|
||||
{
|
||||
var multiple_selection_ids = []
|
||||
|
||||
$('#data_files .active').each(function ()
|
||||
{
|
||||
multiple_selection_ids.push($(this).data("id"))
|
||||
|
||||
});
|
||||
|
||||
return multiple_selection_ids
|
||||
|
||||
}
|
||||
|
||||
function close_data_file_container(data_file_id)
|
||||
{
|
||||
$('#data_file_container').removeClass("data_file_container_active");
|
||||
$('#data_files_container').css("overflow", "");
|
||||
$('#right_bar').show();
|
||||
|
||||
}
|
||||
|
||||
function set_data_files_big_container_size(){
|
||||
|
||||
if($("#data_files_big_container").parent().attr("id") == "manager_box")
|
||||
{
|
||||
$("#data_files_big_container").css("height",( $("#manager_box").height())+"px");
|
||||
$("#data_files_big_container").css("top","0px");
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#data_files_big_container").css("height",( $(window).height() - 36)+"px");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function delete_multiple_files(){
|
||||
if(confirm("Voulez-vous vraiment supprimer ces fichiers ?"))
|
||||
{
|
||||
|
||||
var multiple_ids = multiple_data_selection_ids();
|
||||
$.each(multiple_ids, function(index, value)
|
||||
{
|
||||
$.ajax({
|
||||
url:"/admin/data_files/"+value+".js",
|
||||
type : "DELETE",
|
||||
success : function (){
|
||||
update_data_multiple_selection_text();
|
||||
}
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function select_all_files(){
|
||||
$('#data_files .data_file').each(function (){
|
||||
|
||||
|
||||
$(this).addClass("active");
|
||||
|
||||
|
||||
});
|
||||
update_data_multiple_selection_text();
|
||||
|
||||
}
|
||||
|
||||
function unselect_all_files(){
|
||||
|
||||
$('#data_files .data_file').each(function (){
|
||||
|
||||
|
||||
$(this).removeClass("active");
|
||||
|
||||
|
||||
});
|
||||
update_data_multiple_selection_text();
|
||||
}
|
||||
|
||||
function initialize_slider(){
|
||||
$("#grid_slider").slider({
|
||||
value: $('.data_file .img').width(),
|
||||
max: 250,
|
||||
min: 80,
|
||||
slide:
|
||||
function(event, ui)
|
||||
{
|
||||
slider_value = ui.value
|
||||
set_data_files_img_size();
|
||||
},
|
||||
create :
|
||||
function(event, ui)
|
||||
{
|
||||
slider_enabled = true
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function ($) {
|
||||
|
||||
|
||||
$(window).bind("resize", function() {
|
||||
set_data_files_big_container_size();
|
||||
})
|
||||
|
||||
|
||||
$("#left_buttons").live("click", function() {
|
||||
multiple_selection_ids();
|
||||
})
|
||||
|
||||
$(".data_file").live('dblclick', function (event){
|
||||
|
||||
|
||||
$.ajax({url : $(this).data('show_url'), success: function (){
|
||||
$('#data_file_container').addClass("data_file_container_active");
|
||||
$('#right_bar').hide();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
$("#data_files_container").live("click",function (e){
|
||||
|
||||
|
||||
|
||||
|
||||
if ($(e.target).parents(".data_file").length == 0){
|
||||
unselect_all_image();
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$("#data_file_container .img").live("dblclick",function (){
|
||||
close_data_file_container();
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
$('#data_files_big_container #main_workspace_view #data_file_container .form input').live('keydown', function(){
|
||||
$('#data_files_big_container #main_workspace_view #data_file_container .form .submit_tr').show();
|
||||
})
|
||||
$('#data_files_big_container #main_workspace_view #data_file_container .form textarea').live('keydown', function(){
|
||||
$('#data_files_big_container #main_workspace_view #data_file_container .form .submit_tr').show();
|
||||
})
|
||||
|
||||
$(".data_file").live("click",function (){
|
||||
if ($(this).hasClass('active')){
|
||||
$(this).removeClass('active');
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$(this).addClass('active');
|
||||
}
|
||||
|
||||
update_data_multiple_selection_text();
|
||||
|
||||
});
|
||||
|
||||
set_data_files_big_container_size();
|
||||
|
||||
|
||||
|
||||
initialize_slider();
|
||||
|
||||
|
||||
|
||||
data_files_load();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
});
|
272
app/assets/javascripts/admin/manager/image_files.js
Normal file
272
app/assets/javascripts/admin/manager/image_files.js
Normal file
@ -0,0 +1,272 @@
|
||||
|
||||
var slider_value = null;
|
||||
var slider_enabled = null;
|
||||
|
||||
function image_files_load()
|
||||
{
|
||||
update_multiple_selection_text();
|
||||
set_image_files_big_container_size();
|
||||
set_image_files_img_size();
|
||||
|
||||
if(!slider_enabled){
|
||||
|
||||
initialize_slider();
|
||||
|
||||
}
|
||||
|
||||
$( ".image_file" ).draggable({
|
||||
|
||||
revert:"invalid",
|
||||
opacity: 0.5,
|
||||
helper: 'clone',
|
||||
appendTo: '#main_workspace_view'
|
||||
|
||||
});
|
||||
|
||||
|
||||
$(".album:not(.active)").droppable({
|
||||
|
||||
hoverClass:"album_highlight",
|
||||
tolerance : "pointer",
|
||||
drop: function( event, ui ) {
|
||||
|
||||
ui.draggable.fadeOut().remove();
|
||||
|
||||
$.ajax({
|
||||
url:ui.draggable.attr('data_show_url'),
|
||||
type: "PUT",
|
||||
data: {
|
||||
image_file : {
|
||||
album_id : $(this).attr("data_album_id")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
$( this ).effect("highlight", {}, 3000);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
function set_image_files_img_size(){
|
||||
|
||||
$('.image_file .img').css('width',slider_value+"px");
|
||||
$('.image_file .img').css('height',slider_value+"px");
|
||||
|
||||
}
|
||||
|
||||
function update_multiple_selection_text(){
|
||||
|
||||
var multiple_ids = multiple_selection_ids()
|
||||
var text = ""
|
||||
|
||||
if (multiple_ids.length == 0)
|
||||
{
|
||||
text = "Aucune image séléctionnée";
|
||||
}
|
||||
else if(multiple_ids.length == 1)
|
||||
{
|
||||
text= "Une image séléctionnée";
|
||||
}
|
||||
else
|
||||
{
|
||||
text= multiple_ids.length+" images séléctionnées";
|
||||
}
|
||||
|
||||
$('#multiple_selection_text').html(text);
|
||||
|
||||
}
|
||||
|
||||
|
||||
function multiple_selection_ids()
|
||||
{
|
||||
var multiple_selection_ids = []
|
||||
|
||||
$('#image_files .active').each(function ()
|
||||
{
|
||||
multiple_selection_ids.push($(this).attr("data_id"))
|
||||
});
|
||||
|
||||
return multiple_selection_ids
|
||||
}
|
||||
|
||||
|
||||
function close_image_file_container(image_file_id)
|
||||
{
|
||||
$('#image_file_container').removeClass("image_file_container_active");
|
||||
$('#image_files_container').css("overflow", "");
|
||||
$('#right_bar').show();
|
||||
|
||||
}
|
||||
|
||||
function set_image_files_big_container_size(){
|
||||
|
||||
if($("#image_files_big_container").parent().attr("id") == "manager_box")
|
||||
{
|
||||
$("#image_files_big_container").css("height",( $("#manager_box").height())+"px");
|
||||
$("#image_files_big_container").css("top","0px");
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#image_files_big_container").css("height",( $(window).height() - 36)+"px");
|
||||
//alert($("#breadcrumb").outerHeight());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function delete_multiple_images(){
|
||||
if(confirm("Voulez-vous vraiment supprimer ces images ?"))
|
||||
{
|
||||
|
||||
var multiple_ids = multiple_selection_ids();
|
||||
$.each(multiple_ids, function(index, value)
|
||||
{
|
||||
$.ajax({
|
||||
url:"/admin/image_files/"+value+".js",
|
||||
type : "DELETE",
|
||||
success : function (){
|
||||
update_multiple_selection_text();
|
||||
}
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function select_all_image(){
|
||||
$('#image_files .image_file').each(function (){
|
||||
|
||||
|
||||
$(this).addClass("active");
|
||||
|
||||
|
||||
});
|
||||
update_multiple_selection_text();
|
||||
|
||||
}
|
||||
|
||||
function unselect_all_image(){
|
||||
|
||||
$('#image_files .image_file').each(function (){
|
||||
|
||||
|
||||
$(this).removeClass("active");
|
||||
|
||||
|
||||
});
|
||||
update_multiple_selection_text();
|
||||
}
|
||||
|
||||
function initialize_slider(){
|
||||
$("#grid_slider").slider({
|
||||
value: $('.image_file .img').width(),
|
||||
max: 250,
|
||||
min: 80,
|
||||
slide:
|
||||
function(event, ui)
|
||||
{
|
||||
slider_value = ui.value
|
||||
set_image_files_img_size();
|
||||
},
|
||||
create :
|
||||
function(event, ui)
|
||||
{
|
||||
slider_enabled = true
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function ($) {
|
||||
|
||||
|
||||
$(window).bind("resize", function() {
|
||||
set_image_files_big_container_size();
|
||||
})
|
||||
|
||||
|
||||
$("#left_buttons").live("click", function() {
|
||||
multiple_selection_ids();
|
||||
})
|
||||
|
||||
$(".image_file").live('dblclick', function (event){
|
||||
|
||||
|
||||
$.ajax({url : $(this).attr('data_show_url'), success: function (){
|
||||
$('#image_file_container').addClass("image_file_container_active");
|
||||
$('#right_bar').hide();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
$("#image_files_container").live("click",function (e){
|
||||
|
||||
|
||||
|
||||
|
||||
if ($(e.target).parents(".image_file").length == 0){
|
||||
unselect_all_image();
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$("#image_file_container .img").live("dblclick",function (){
|
||||
close_image_file_container();
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
$('#image_files_big_container #main_workspace_view #image_file_container .form input').live('keydown', function(){
|
||||
$('#image_files_big_container #main_workspace_view #image_file_container .form .submit_tr').show();
|
||||
})
|
||||
$('#image_files_big_container #main_workspace_view #image_file_container .form textarea').live('keydown', function(){
|
||||
$('#image_files_big_container #main_workspace_view #image_file_container .form .submit_tr').show();
|
||||
})
|
||||
|
||||
$(".image_file").live("click",function (){
|
||||
if ($(this).hasClass('active')){
|
||||
$(this).removeClass('active');
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$(this).addClass('active');
|
||||
}
|
||||
update_multiple_selection_text();
|
||||
|
||||
});
|
||||
|
||||
set_image_files_big_container_size();
|
||||
|
||||
|
||||
|
||||
initialize_slider();
|
||||
|
||||
|
||||
|
||||
image_files_load();
|
||||
|
||||
|
||||
|
||||
});
|
149
app/assets/javascripts/admin/manager/manager.js
Normal file
149
app/assets/javascripts/admin/manager/manager.js
Normal file
@ -0,0 +1,149 @@
|
||||
var manager_response = "";
|
||||
var manager_callback_function = null;
|
||||
|
||||
function manager_load() {
|
||||
|
||||
|
||||
$(document).bind("keydown",function(e) {
|
||||
// ESCAPE key pressed
|
||||
if (e.keyCode == 27) {
|
||||
manager_hide();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
function manager_show(url){
|
||||
manager_response = null;
|
||||
$('#manager_box').html("");
|
||||
|
||||
$("#manager_box_place").show("fast", function (){
|
||||
$("#manager_box_place").addClass("manager_box_place_active");
|
||||
$('#manager_box').load(url, function (){
|
||||
image_files_load();
|
||||
data_files_load();
|
||||
initialize_uploads();
|
||||
unset_busy();
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
function manager_hide(){
|
||||
$("#manager_box_place").removeClass("manager_box_place_active");
|
||||
|
||||
$("body").css("overflow", "auto");
|
||||
slider_enabled = null;
|
||||
|
||||
|
||||
|
||||
}
|
||||
$(document).ready(function ($) {
|
||||
manager_load();
|
||||
|
||||
$('#test_manager').live('click', function (){
|
||||
|
||||
|
||||
manager_prompt(function(m_return){alert(m_return);});
|
||||
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
function manager_prompt(url, callback) {
|
||||
manager_callback_function = callback;
|
||||
manager_show(url);
|
||||
}
|
||||
|
||||
function manager_send_response(send_value){
|
||||
|
||||
manager_hide();
|
||||
manager_callback_function(send_value);
|
||||
|
||||
|
||||
}
|
||||
|
||||
function select_image_from_manager(input_id){
|
||||
set_busy();
|
||||
manager_prompt("/admin/image_files/?manager=true",function(m_return){
|
||||
|
||||
$('#input_'+input_id).val(m_return.image_file_id);
|
||||
$('#img_'+input_id).attr("src",m_return.thumb);
|
||||
$('#name_'+input_id).val(m_return.name);
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function select_gallery_images_from_manager(gallery_content_id){
|
||||
|
||||
manager_prompt("/admin/image_files/?manager=true&multiple=true",function(m_return){
|
||||
|
||||
$.ajax({url:"/portlet/gallery_images/", type: "POST", data : { image_file_ids : m_return, gallery_content_id : gallery_content_id }});
|
||||
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
function select_file_from_manager(input_id){
|
||||
manager_prompt("/admin/data_files/?manager=true",function(m_return){
|
||||
|
||||
$('#input_'+input_id).val(m_return.data_file_id);
|
||||
|
||||
$('#name_'+input_id).html(m_return.name);
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
function manager_send_multiple_image_files(){
|
||||
|
||||
|
||||
|
||||
manager_send_response(multiple_selection_ids());
|
||||
}
|
||||
|
||||
|
||||
|
||||
function manager_send_image_file(image_file_id){
|
||||
|
||||
|
||||
var image_file_div = $('#image_file_'+image_file_id);
|
||||
|
||||
manager_send_response({thumb : image_file_div.attr("data_thumb"), image_file_id : image_file_div.attr("data_id"), name : image_file_div.attr("data_name")});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function manager_send_data_file(data_file_id){
|
||||
|
||||
|
||||
var image_file_div = $('#data_file_'+data_file_id);
|
||||
|
||||
manager_send_response({data_file_id : image_file_div.data("id"), name : image_file_div.data("name")});
|
||||
}
|
87
app/assets/javascripts/admin/manager/uploads.js
Normal file
87
app/assets/javascripts/admin/manager/uploads.js
Normal file
@ -0,0 +1,87 @@
|
||||
function initialize_uploads()
|
||||
{
|
||||
|
||||
|
||||
|
||||
$('#data_file_upload_field').fileUploadUI({
|
||||
uploadTable: $('#files'),
|
||||
namespace : "data_file_upload",
|
||||
downloadTable: $('#files'),
|
||||
dragDropSupport : true,
|
||||
onLoad : function (event, files, index, xhr, handler) {
|
||||
var json;
|
||||
if (typeof xhr.responseText !== "undefinied") {
|
||||
eval(xhr.responseText);
|
||||
} else {
|
||||
|
||||
eval(xhr.contents().text());
|
||||
}
|
||||
handler.uploadRow.remove();
|
||||
|
||||
|
||||
} ,
|
||||
onLoadAll: function (){
|
||||
$('#data_files .new').each(function (){
|
||||
|
||||
$(this).removeClass("new");
|
||||
|
||||
|
||||
});
|
||||
update_multiple_selection_text();
|
||||
|
||||
},
|
||||
buildUploadRow: function (files, index) {
|
||||
return $('<tr><td>' + files[index].name + '<\/td>' +
|
||||
'<td class="file_upload_progress"><div><\/div><\/td>' +
|
||||
'<td class="file_upload_cancel">' +
|
||||
'<img alt="Pen_alt_stroke_16x16" src="/assets/iconic/gray_light/denied_16x16.png" />' +
|
||||
|
||||
'<\/td><\/tr>');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
$('#image_upload_field').fileUploadUI({
|
||||
uploadTable: $('#files'),
|
||||
downloadTable: $('#files'),
|
||||
namespace : "image_file_upload",
|
||||
dragDropSupport : true,
|
||||
onLoad : function (event, files, index, xhr, handler) {
|
||||
var json;
|
||||
if (typeof xhr.responseText !== "undefinied") {
|
||||
eval(xhr.responseText);
|
||||
} else {
|
||||
|
||||
eval(xhr.contents().text());
|
||||
}
|
||||
handler.uploadRow.remove();
|
||||
|
||||
|
||||
} ,
|
||||
onLoadAll: function (){
|
||||
$('#image_files .new').each(function (){
|
||||
|
||||
$(this).removeClass("new");
|
||||
|
||||
|
||||
});
|
||||
update_multiple_selection_text();
|
||||
|
||||
},
|
||||
buildUploadRow: function (files, index) {
|
||||
return $('<tr><td>' + files[index].name + '<\/td>' +
|
||||
'<td class="file_upload_progress"><div><\/div><\/td>' +
|
||||
'<td class="file_upload_cancel">' +
|
||||
'<img alt="Pen_alt_stroke_16x16" src="/assets/iconic/gray_light/denied_16x16.png" />' +
|
||||
|
||||
'<\/td><\/tr>');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
};
|
||||
|
||||
$(document).ready(function ($) {
|
||||
initialize_uploads();
|
||||
});
|
81
app/assets/javascripts/admin/menu_items.js
Normal file
81
app/assets/javascripts/admin/menu_items.js
Normal file
@ -0,0 +1,81 @@
|
||||
function after_load_document(){
|
||||
$( ".menu_item_row" ).draggable({
|
||||
revert:"invalid",
|
||||
handle:".grip",
|
||||
zIndex: 2700,
|
||||
opacity: 0.35,
|
||||
cursorAt: { left: 400 },
|
||||
//snap: true,
|
||||
//snapTolerance: 40,
|
||||
helper: 'clone',
|
||||
start: function(event, ui) {
|
||||
$( this ).css("background", "#F9F9F9" );
|
||||
$( this ).next().droppable( "option", "disabled", true );
|
||||
$( this ).prev().droppable( "option", "disabled", true );
|
||||
},
|
||||
drag: function(){
|
||||
},
|
||||
stop: function(){
|
||||
$( this ).next().droppable( "option", "disabled", false );
|
||||
$( this ).prev().droppable( "option", "disabled", false );
|
||||
$( this ).css("background", "white" );
|
||||
}
|
||||
});
|
||||
|
||||
$(".receptable").droppable({
|
||||
hoverClass:"hoverhighlight",
|
||||
tolerance : "pointer",
|
||||
drop: function( event, ui ) {
|
||||
ui.draggable.fadeOut();
|
||||
set_busy();
|
||||
$.ajax({
|
||||
url:"/admin/menu_items/"+ui.draggable.attr("data-menu_item_id")+".js",
|
||||
type: "PUT",
|
||||
data: {
|
||||
reorder : true,
|
||||
menu_item : {
|
||||
parent_id : $(this).attr("data-parent_id")
|
||||
}
|
||||
},
|
||||
success : function (){
|
||||
after_load_document();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
$(".receptable_position").droppable({
|
||||
hoverClass:"hoverhighlight_position",
|
||||
tolerance : "pointer",
|
||||
drop: function( event, ui ) {
|
||||
ui.draggable.fadeOut();
|
||||
set_busy();
|
||||
|
||||
$.ajax({
|
||||
url:"/admin/menu_items/"+ui.draggable.attr("data-menu_item_id")+".js",
|
||||
type: "PUT",
|
||||
data: {
|
||||
reorder : true,
|
||||
menu_item : {
|
||||
position : $(this).attr("data-position")
|
||||
}
|
||||
},
|
||||
success : function (){
|
||||
after_load_document();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
$(document).ready(function(){
|
||||
after_load_document();
|
||||
|
||||
});
|
34
app/assets/javascripts/admin/pane_hover.js
Normal file
34
app/assets/javascripts/admin/pane_hover.js
Normal file
@ -0,0 +1,34 @@
|
||||
|
||||
|
||||
function show_pane_hover(content, width, height, zindex){
|
||||
|
||||
var width = width || 500;
|
||||
var height = height || 500;
|
||||
var zindex = zindex || 1000;
|
||||
|
||||
initialize_pane_hover()
|
||||
|
||||
$('#qi_pane_hover_content').html(content);
|
||||
$('#qi_pane_hover_content').css({"width" : width+"px","height" : height+"px","z-index" : zindex});
|
||||
$('#qi_pane_hover_content .actions').prepend('<a href="#" class="cancel button" onclick="close_pane_hover();return false;">Annuler</a>');
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function close_pane_hover(){
|
||||
|
||||
$('#qi_pane_hover').remove();
|
||||
|
||||
}
|
||||
|
||||
function initialize_pane_hover(){
|
||||
|
||||
if($('#qi_pane_hover').length == 0){
|
||||
|
||||
$('body').append('<div id="qi_pane_hover"><div id="qi_pane_hover_content"></div></div>');
|
||||
|
||||
}
|
||||
|
||||
}
|
7
app/assets/javascripts/connexion.js
Normal file
7
app/assets/javascripts/connexion.js
Normal file
@ -0,0 +1,7 @@
|
||||
/*
|
||||
|
||||
= require jquery_ujs
|
||||
=require jquery-reject
|
||||
=require admin/browser
|
||||
|
||||
*/
|
47
app/assets/javascripts/public/public.js
Normal file
47
app/assets/javascripts/public/public.js
Normal file
@ -0,0 +1,47 @@
|
||||
/*
|
||||
|
||||
= require jquery_ujs
|
||||
= require jquery-prettyPhoto
|
||||
= require jquery.bxSlider.min
|
||||
= require jquery.easing.1.3
|
||||
= require_tree .
|
||||
|
||||
*/
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
$("a[rel^='prettyPhoto']").prettyPhoto({
|
||||
show_title : false,
|
||||
slideshow :false,
|
||||
social_tools : false,
|
||||
|
||||
callback: function(){
|
||||
window.location = "#";
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
var events_slider = $('#top_events').bxSlider({
|
||||
controls: false,
|
||||
displaySlideQty: 2,
|
||||
moveSlideQty: 2,
|
||||
auto:true,
|
||||
speed: 1000,
|
||||
easing: 'easeInOutSine',
|
||||
pause: 5000
|
||||
});
|
||||
|
||||
|
||||
$('#go-prev').click(function() {
|
||||
events_slider.goToPreviousSlide();
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
$('#go-next').click(function() {
|
||||
events_slider.goToNextSlide();
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
});
|
2591
app/assets/stylesheets/admin/admin.css.scss
Normal file
2591
app/assets/stylesheets/admin/admin.css.scss
Normal file
File diff suppressed because it is too large
Load Diff
14
app/assets/stylesheets/admin/portlets.css.scss
Normal file
14
app/assets/stylesheets/admin/portlets.css.scss
Normal file
@ -0,0 +1,14 @@
|
||||
.img_link_portlet {
|
||||
|
||||
padding: 10px;
|
||||
margin-bottom: 10px;
|
||||
h3 {
|
||||
color: RGB(91, 67, 46); }
|
||||
.image_file {
|
||||
float: left;
|
||||
margin-right: 10px; }
|
||||
.title, .description {
|
||||
margin-left: 130px; }
|
||||
.title a, .description a {
|
||||
color: #604435;
|
||||
text-decoration: none; } }
|
7
app/assets/stylesheets/application.css
Normal file
7
app/assets/stylesheets/application.css
Normal file
@ -0,0 +1,7 @@
|
||||
/*
|
||||
* This is a manifest file that'll automatically include all the stylesheets available in this directory
|
||||
* and any sub-directories. 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 .
|
||||
*/
|
36
app/assets/stylesheets/connexion.css.scss
Normal file
36
app/assets/stylesheets/connexion.css.scss
Normal file
@ -0,0 +1,36 @@
|
||||
/*
|
||||
|
||||
*= require_self
|
||||
*= require qi/forms
|
||||
|
||||
*= require qi/general
|
||||
|
||||
|
||||
|
||||
|
||||
*/
|
||||
|
||||
body {
|
||||
background: #3f94eb;
|
||||
font-family: verdana;
|
||||
padding:0px;
|
||||
margin:0px;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
font-size: 13px;
|
||||
font-family: "Lucida Grande", arial, helvetica, sans-serif; }
|
||||
body #title {
|
||||
width: 520px;
|
||||
margin: auto;
|
||||
margin-top: 10%;
|
||||
color: #9fc9f5;
|
||||
text-shadow: 0 1px 1px #3f94eb;
|
||||
padding: 0px;
|
||||
text-transform: uppercase; }
|
||||
body #main {
|
||||
background: white;
|
||||
width: 500px;
|
||||
padding: 10px;
|
||||
margin: auto;
|
||||
-webkit-box-shadow: #666666 0px 0px 20px;
|
||||
-moz-box-shadow: #666666 0px 0px 20px;
|
||||
box-shadow: #666666 0px 0px 20px; }
|
75
app/assets/stylesheets/mixins/_css3.css.scss
Normal file
75
app/assets/stylesheets/mixins/_css3.css.scss
Normal file
@ -0,0 +1,75 @@
|
||||
// ==== CSS3 SASS MIXINS ====
|
||||
// https://github.com/madr/css3-sass-mixins
|
||||
|
||||
// Should IE filters be used or not?
|
||||
// PROS: gradients, drop shadows etc will be handled by css.
|
||||
// CONS: will harm the site performance badly,
|
||||
// especially on sites with heavy rendering and scripting.
|
||||
$useIEFilters: 0; // might be 0 or 1. disabled by default.
|
||||
|
||||
@mixin border-radius ($values) {
|
||||
-moz-border-radius: $values;
|
||||
-webkit-border-radius: $values;
|
||||
border-radius: $values;
|
||||
}
|
||||
|
||||
@mixin box-shadow ($x, $y, $offset, $hex, $ie: $useIEFilters) {
|
||||
-moz-box-shadow: $x $y $offset $hex;
|
||||
-o-box-shadow: $x $y $offset $hex;
|
||||
-webkit-box-shadow: $x $y $offset $hex;
|
||||
box-shadow: $x $y $offset $hex;
|
||||
|
||||
@if $ie == 1 {
|
||||
$iecolor: '#' + red($hex) + green($hex) + blue($hex);
|
||||
filter: progid:DXImageTransform.Microsoft.dropshadow(OffX=#{$x}, OffY=#{$y}, Color='#{$iecolor}');
|
||||
-ms-filter: quote(progid:DXImageTransform.Microsoft.dropshadow(OffX=#{$x}, OffY=#{$y}, Color='#{$iecolor}'));
|
||||
}
|
||||
}
|
||||
|
||||
@mixin linear-gradient($from, $to, $ie: $useIEFilters) {
|
||||
@if $ie != 1 {
|
||||
background-color: $to;
|
||||
}
|
||||
|
||||
background-image: -moz-linear-gradient(top, $from, $to);
|
||||
background-image: -webkit-gradient(linear,left top,left bottom,color-stop(0, $from),color-stop(1, $to));
|
||||
|
||||
@if $ie == 1 {
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#{$from}', endColorstr='#{$to}');
|
||||
-ms-filter: quote(progid:DXImageTransform.Microsoft.gradient(startColorstr='#{$from}', endColorstr='#{$to}'));
|
||||
}
|
||||
}
|
||||
|
||||
@mixin rgba($hex, $alpha, $ie: $useIEFilters) {
|
||||
@if $ie == 1 {
|
||||
// this formula is not accurate enough, will be fixed with sass 3.1
|
||||
$hexopac: '#' + ceil((($alpha * 255)/16) *10) + $hex;
|
||||
background-color: none;
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorStr='#{$hexopac}',EndColorStr='#{$hexopac}}');
|
||||
-ms-filter: quote(progid:DXImageTransform.Microsoft.gradient(startColorStr='#{$hexopac}',EndColorStr='#{$hexopac}'));
|
||||
}
|
||||
@else {
|
||||
background-color: $hex;
|
||||
background-color: rgba(red($hex), green($hex), blue($hex), $alpha);
|
||||
}
|
||||
}
|
||||
|
||||
@mixin rotate ($deg, $ie: $useIEFilters) {
|
||||
-moz-transform: rotate(#{$deg}deg);
|
||||
-o-transform: rotate(#{$deg}deg);
|
||||
-webkit-transform: rotate(#{$deg}deg);
|
||||
// not ready, impediment: cos required!
|
||||
//@if $ie == 1 {
|
||||
// filter: progid:DXImageTransform.Microsoft.Matrix(sizingMethod='auto expand', M11=0.99144486137381, M12=--0.130526192220052, M21=0.130526192220052, M22=0.99144486137381);
|
||||
// -ms-filter: quote(progid:DXImageTransform.Microsoft.Matrix(SizingMethod='auto expand', M11=0.99144486137381, M12=--0.130526192220052, M21=0.130526192220052, M22=0.99144486137381));
|
||||
// zoom: 1;
|
||||
//}
|
||||
}
|
||||
|
||||
@mixin transition ($value) {
|
||||
-moz-transition: $value;
|
||||
-o-transition: $value;
|
||||
-webkit-transition: $value;
|
||||
transition: $value;
|
||||
}
|
||||
// ==== /CSS3 SASS MIXINS ====
|
27
app/assets/stylesheets/public/portlet.css.scss
Normal file
27
app/assets/stylesheets/public/portlet.css.scss
Normal file
@ -0,0 +1,27 @@
|
||||
.portlet {
|
||||
&.table_content table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
td {
|
||||
border: 1px solid black; } }
|
||||
&.block_content .two_column .column {
|
||||
float: left;
|
||||
width: 50%;
|
||||
.block {
|
||||
padding: 10px; } } }
|
||||
|
||||
|
||||
|
||||
.img_link_portlet{
|
||||
border: 1px solid RGB(91, 67, 46);
|
||||
padding: 10px;
|
||||
margin-bottom: 10px;
|
||||
|
||||
.image_file {
|
||||
float: left;
|
||||
margin-right: 10px; }
|
||||
.title, .description {
|
||||
margin-left: 130px; }
|
||||
.title a, .description a {
|
||||
color: #604435;
|
||||
text-decoration: none; } }
|
82
app/assets/stylesheets/public/public.css.scss
Normal file
82
app/assets/stylesheets/public/public.css.scss
Normal file
@ -0,0 +1,82 @@
|
||||
/*
|
||||
* FIXME: Introduce SCSS & Sprockets
|
||||
*= require_self
|
||||
*= require prettyPhoto
|
||||
*= require formtastic
|
||||
|
||||
|
||||
*= require_tree .
|
||||
|
||||
*/
|
||||
|
||||
body {
|
||||
text-align: center;
|
||||
background: #eef4d8;
|
||||
font-family: arial;
|
||||
font-size: 12px;
|
||||
a {
|
||||
img {
|
||||
border: 0px; } }
|
||||
#flash_notice {
|
||||
background: #149816;
|
||||
color: white;
|
||||
padding: 10px; }
|
||||
.internal_link {
|
||||
display: block;
|
||||
padding: 5px; }
|
||||
.external_link {
|
||||
display: block;
|
||||
padding: 5px; }
|
||||
#main {
|
||||
margin: auto;
|
||||
margin-top: 10px;
|
||||
width: 950px;
|
||||
text-align: justify;
|
||||
border: 1px solid #005500;
|
||||
background: url("/images/style/fond.jpg");
|
||||
|
||||
#menu_haut {
|
||||
padding: 5px;
|
||||
border-bottom: 1px solid gray;
|
||||
a {
|
||||
color: black;
|
||||
text-decoration: none;
|
||||
padding: 20px;
|
||||
&:hover {
|
||||
color: gray;
|
||||
text-decoration: underline; } }
|
||||
.active {
|
||||
font-weight: bold; } }
|
||||
#droite {
|
||||
img{
|
||||
margin:10px;
|
||||
}
|
||||
width: 310px;
|
||||
float: right;
|
||||
padding-right: 10px;
|
||||
#menu {
|
||||
a {
|
||||
display: block;
|
||||
padding: 5px;
|
||||
background: #c9e9c6;
|
||||
margin-top: 5px;
|
||||
margin-right: 5px;
|
||||
border: 1px solid #064e06;
|
||||
color: #064e06;
|
||||
text-decoration: none;
|
||||
&:hover {
|
||||
color: black;
|
||||
border: 1px solid black; } }
|
||||
.active {
|
||||
color: black;
|
||||
border: 1px solid black; } } }
|
||||
#contenu {
|
||||
|
||||
img{
|
||||
margin:10px;
|
||||
}
|
||||
margin-right: 320px;
|
||||
padding: 10px; } } }
|
||||
|
||||
.clear {
|
||||
clear: both; }
|
138
app/assets/stylesheets/qi/forms.scss
Executable file
138
app/assets/stylesheets/qi/forms.scss
Executable file
@ -0,0 +1,138 @@
|
||||
|
||||
/* tutorial */
|
||||
|
||||
input[type=text],input[type=password], textarea {
|
||||
padding: 5px;
|
||||
border: solid 1px #C9C9C9;
|
||||
outline: 0;
|
||||
font: normal 13px/100% Verdana, Tahoma, sans-serif;
|
||||
width: 200px;
|
||||
|
||||
background: -webkit-gradient(linear, left top, left 25, from(#FFFFFF), color-stop(4%, #F7F7F7), to(#FFFFFF));
|
||||
background: -moz-linear-gradient(top, #FFFFFF, #F7F7F7 1px, #FFFFFF 25px);
|
||||
|
||||
}
|
||||
|
||||
textarea {
|
||||
width: 400px;
|
||||
max-width: 400px;
|
||||
height: 150px;
|
||||
line-height: 150%;
|
||||
}
|
||||
|
||||
input:hover, textarea:hover,
|
||||
input:focus, textarea:focus {
|
||||
box-shadow: rgba(0,0,0, 0.1) 0px 0px 8px;
|
||||
-moz-box-shadow: rgba(0,0,0, 0.1) 0px 0px 8px;
|
||||
-webkit-box-shadow: rgba(0,0,0, 0.1) 0px 0px 8px;
|
||||
|
||||
}
|
||||
|
||||
label {
|
||||
|
||||
|
||||
cursor:pointer;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
.button{
|
||||
display: inline-block;
|
||||
background: #3c74a8;
|
||||
background: -webkit-gradient(linear, 0% 100%, 0% 0%, from(rgb(239,242,242)), to(rgb(255,255,255)));
|
||||
background: -moz-linear-gradient(bottom, rgb(239,242,242), rgb(255,255,255));
|
||||
box-shadow: rgba(0,0,0, 0.4) 0px 0px 3px;
|
||||
-moz-box-shadow: rgba(0,0,0, 0.4) 0px 0px 3px;
|
||||
-webkit-box-shadow: rgba(0,0,0, 0.4) 0px 0px 3px;
|
||||
border: none;
|
||||
-moz-border-radius: 20px;
|
||||
-webkit-border-radius: 20px;
|
||||
border-radius: 20px;
|
||||
color: RGB(46,46,46);
|
||||
|
||||
|
||||
|
||||
|
||||
padding: 5px 15px;
|
||||
margin:0px 5px 0px 5px;
|
||||
font-weight:normal;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
.button:hover {
|
||||
box-shadow: rgba(0,0,0, 0.6) 0px 0px 5px;
|
||||
-moz-box-shadow: rgba(0,0,0, 0.6) 0px 0px 5px;
|
||||
-webkit-box-shadow: rgba(0,0,0, 0.6) 0px 0px 5px;
|
||||
color: RGB(46,46,46);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
|
||||
.actions{
|
||||
text-align:right;
|
||||
}
|
||||
|
||||
button,input[type=submit] {
|
||||
display: inline-block;
|
||||
background: #3c74a8;
|
||||
background: -webkit-gradient(linear, 0% 100%, 0% 0%, from(rgb(60,116,168)), to(rgb(103,146,187)));
|
||||
background: -moz-linear-gradient(bottom, rgb(60,116,168), rgb(103,146,187));
|
||||
box-shadow: rgba(0,0,0, 0.4) 0px 0px 3px;
|
||||
-moz-box-shadow: rgba(0,0,0, 0.4) 0px 0px 3px;
|
||||
-webkit-box-shadow: rgba(0,0,0, 0.4) 0px 0px 3px;
|
||||
border: none;
|
||||
-moz-border-radius: 20px;
|
||||
-webkit-border-radius: 20px;
|
||||
border-radius: 20px;
|
||||
color: white;
|
||||
|
||||
margin:0px 5px 0px 5px;
|
||||
|
||||
padding: 5px 15px;
|
||||
text-shadow: 0 1px 1px rgba(0,0,0,0.6);
|
||||
font-weight:normal;
|
||||
font-size:13px;
|
||||
|
||||
}
|
||||
|
||||
button:hover,input[type=submit]:hover {
|
||||
box-shadow: rgba(0,0,0, 0.6) 0px 0px 5px;
|
||||
-moz-box-shadow: rgba(0,0,0, 0.6) 0px 0px 5px;
|
||||
-webkit-box-shadow: rgba(0,0,0, 0.6) 0px 0px 5px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
.field_with_errors{
|
||||
display:inline;
|
||||
color:red;
|
||||
|
||||
}
|
||||
|
||||
.field_with_errors input{
|
||||
display:inline;
|
||||
border-color:red;
|
||||
|
||||
|
||||
}
|
||||
|
||||
.errorExplanation{
|
||||
border-top: 1px solid black;
|
||||
border-bottom: 1px solid black;
|
||||
padding:5px;
|
||||
border-color:#F2EDA1;
|
||||
background:#FEFCDB;
|
||||
|
||||
}
|
||||
.errorExplanation h2{
|
||||
font-size:13px;
|
||||
margin:0px;
|
||||
padding:0px;
|
||||
}
|
||||
|
47
app/assets/stylesheets/qi/general.scss
Normal file
47
app/assets/stylesheets/qi/general.scss
Normal file
@ -0,0 +1,47 @@
|
||||
.message{
|
||||
border: 4px solid black;
|
||||
border-radius:10px;
|
||||
padding:5px;
|
||||
margin:20px;
|
||||
-webkit-box-shadow: rgba(0,0,0,0.5) 1px 1px 40px;
|
||||
-moz-box-shadow: rgba(0,0,0,0.5) 1px 1px 40px;
|
||||
box-shadow: rgba(0,0,0,0.5) 1px 1px 40px;
|
||||
}
|
||||
.alert{
|
||||
border-color: rgb(242,237,161);
|
||||
background: rgba(254,252,219,0.8);
|
||||
}
|
||||
|
||||
.notice{
|
||||
border-color:rgb(205,230,245);
|
||||
background:rgba(236,248,254,0.8);
|
||||
}
|
||||
#flash{
|
||||
position:fixed;
|
||||
bottom:0px;
|
||||
width:100%;
|
||||
}
|
||||
|
||||
a img{
|
||||
border:0px;
|
||||
}
|
||||
|
||||
table{
|
||||
border-collapse:collapse;
|
||||
width:100%;
|
||||
}
|
||||
|
||||
h1, h2, h3, h4, h5, h6 {
|
||||
margin:0px;
|
||||
padding:0px;
|
||||
}
|
||||
|
||||
a{
|
||||
color : #3C74A8;
|
||||
text-decoration:none;
|
||||
}
|
||||
|
||||
a:hover{
|
||||
color:#3F94EB;
|
||||
}
|
||||
|
52
app/assets/stylesheets/qi/qi.scss
Normal file
52
app/assets/stylesheets/qi/qi.scss
Normal file
@ -0,0 +1,52 @@
|
||||
.QI_background_middle {
|
||||
background-color: #e2eef7; }
|
||||
|
||||
.QI_background_middle_alt1 {
|
||||
background-color: #a9d64b; }
|
||||
|
||||
.QI_padding_small {
|
||||
padding: 5px; }
|
||||
|
||||
.QI_padding {
|
||||
padding: 10px; }
|
||||
|
||||
.QI_table_alternate_alt1 tr:nth-child(odd) {
|
||||
background-color: #ebf4fa; }
|
||||
|
||||
.QI_background_resize {
|
||||
background-position: center center;
|
||||
background-repeat: no-repeat;
|
||||
background-size: contain;
|
||||
-moz-background-size: contain;
|
||||
-webkit-background-size: contain; }
|
||||
|
||||
.QI_box_shadow {
|
||||
-webkit-box-shadow: #AFAFAF 0px 0px 5px;
|
||||
-moz-box-shadow: #AFAFAF 0px 0px 5px;
|
||||
box-shadow: #AFAFAF 0px 0px 5px; }
|
||||
|
||||
.QI_font_alt1 {
|
||||
font-family: Georgia; }
|
||||
|
||||
.QI_font {
|
||||
font-family: Lucida grande; }
|
||||
|
||||
.QI_color_white {
|
||||
color: white; }
|
||||
|
||||
|
||||
|
||||
.bar_transparent_dark{
|
||||
background:rgba(0,0,0,0.8);
|
||||
|
||||
height:34px;
|
||||
|
||||
}
|
||||
|
||||
.position_absolute_bottom{
|
||||
position:absolute;
|
||||
bottom:0px;
|
||||
right:0px;
|
||||
left:0px;
|
||||
|
||||
}
|
86
app/controllers/admin/admins_controller.rb
Normal file
86
app/controllers/admin/admins_controller.rb
Normal file
@ -0,0 +1,86 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
|
||||
class Admin::AdminsController < ApplicationController
|
||||
|
||||
before_filter :authenticate_admin!
|
||||
|
||||
layout "admin"
|
||||
|
||||
navigation :admins
|
||||
|
||||
|
||||
def index
|
||||
|
||||
@admins = Admin.order( "email" )
|
||||
|
||||
end
|
||||
|
||||
|
||||
def new
|
||||
@admin = Admin.new
|
||||
|
||||
end
|
||||
|
||||
def edit
|
||||
@admin = Admin.find(params[:id])
|
||||
|
||||
end
|
||||
|
||||
|
||||
def create
|
||||
@admin = Admin.new(params[:admin])
|
||||
|
||||
if @admin.save
|
||||
flash[:notice] = "L'administrateur "+@admin.email.to_s+" à été ajouté avec succès."
|
||||
|
||||
else
|
||||
render :action => "new"
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
def update
|
||||
|
||||
@breadcrumb = [["liste des administrateurs", admin_admins_path],"Modifier un administrateur"]
|
||||
|
||||
@admin = Admin.find(params[:id])
|
||||
|
||||
if params[:admin][:password] == ""
|
||||
params[:admin].delete(:password)
|
||||
params[:admin].delete(:password_confirmation)
|
||||
end
|
||||
|
||||
|
||||
if @admin.update_attributes(params[:admin])
|
||||
|
||||
flash[:notice] = "L'administrateur "+@admin.email.to_s+" à été modifié avec succès."
|
||||
|
||||
else
|
||||
|
||||
render :action => "edit"
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
def destroy
|
||||
@admin = Admin.find(params[:id])
|
||||
|
||||
if @admin == current_admin
|
||||
|
||||
flash[:alert] = "Vous ne pouvez pas supprimer l'administrateur actuellement connecté."
|
||||
|
||||
else
|
||||
|
||||
@admin.destroy
|
||||
flash[:notice] = "L'utilisateur "+@admin.email.to_s+" à bien été supprimé."
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
end
|
62
app/controllers/admin/albums_controller.rb
Normal file
62
app/controllers/admin/albums_controller.rb
Normal file
@ -0,0 +1,62 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
|
||||
class Admin::AlbumsController < ApplicationController
|
||||
|
||||
before_filter :authenticate_admin!
|
||||
|
||||
def index
|
||||
@albums = Album.all(:order => :name)
|
||||
end
|
||||
|
||||
|
||||
def new
|
||||
@album = Album.new()
|
||||
end
|
||||
|
||||
|
||||
def create
|
||||
@album = Album.new(params[:album])
|
||||
@album_create = true
|
||||
|
||||
if @album.save
|
||||
@albums = Album.all(:order => :name)
|
||||
|
||||
else
|
||||
render :action => :new
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def edit
|
||||
@album = Album.find(params[:id])
|
||||
end
|
||||
|
||||
|
||||
def update
|
||||
@album = Album.find(params[:id])
|
||||
@album_update = true
|
||||
|
||||
if @album.update_attributes(params[:album])
|
||||
|
||||
@albums = Album.all(:order => :name)
|
||||
|
||||
else
|
||||
|
||||
render :action => :edit
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def destroy
|
||||
@album = Album.find(params[:id])
|
||||
|
||||
if @album.id != 1
|
||||
|
||||
@album.delete
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
end
|
83
app/controllers/admin/articles_controller.rb
Normal file
83
app/controllers/admin/articles_controller.rb
Normal file
@ -0,0 +1,83 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
|
||||
class Admin::ArticlesController < ApplicationController
|
||||
|
||||
before_filter :authenticate_admin!
|
||||
|
||||
layout "admin"
|
||||
|
||||
navigation :articles
|
||||
|
||||
before_filter :find_articles
|
||||
|
||||
def index
|
||||
|
||||
end
|
||||
|
||||
|
||||
def cible
|
||||
|
||||
render :layout => false
|
||||
|
||||
end
|
||||
|
||||
|
||||
def new
|
||||
|
||||
@article = Article.new(:published_at => Time.now)
|
||||
|
||||
end
|
||||
|
||||
|
||||
def edit
|
||||
|
||||
@article = Article.find(params[:id])
|
||||
|
||||
end
|
||||
|
||||
|
||||
def create
|
||||
|
||||
@article = Article.new(params[:article])
|
||||
|
||||
|
||||
if @article.save
|
||||
flash[:notice] = "L'article à été ajouté avec succès."
|
||||
self.find_articles
|
||||
|
||||
else
|
||||
render :action => "new"
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
def update
|
||||
|
||||
@article = Article.find(params[:id])
|
||||
|
||||
if @article.update_attributes(params[:article])
|
||||
flash[:notice] = "L'article à été modifié avec succès."
|
||||
else
|
||||
render :action => "edit"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def destroy
|
||||
|
||||
@article = Article.find(params[:id])
|
||||
@article.destroy
|
||||
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def find_articles
|
||||
|
||||
@articles = Article.all
|
||||
|
||||
end
|
||||
|
||||
end
|
17
app/controllers/admin/blocks_controller.rb
Normal file
17
app/controllers/admin/blocks_controller.rb
Normal file
@ -0,0 +1,17 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
|
||||
class Admin::BlocksController < ApplicationController
|
||||
|
||||
before_filter :authenticate_admin!
|
||||
|
||||
layout "admin"
|
||||
|
||||
def show
|
||||
@block = Block.find(params[:id])
|
||||
|
||||
if request.xhr?
|
||||
render :layout => false
|
||||
end
|
||||
end
|
||||
|
||||
end
|
10
app/controllers/admin/cibles_controller.rb
Normal file
10
app/controllers/admin/cibles_controller.rb
Normal file
@ -0,0 +1,10 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
class Admin::CiblesController < ApplicationController
|
||||
before_filter :authenticate_admin!
|
||||
|
||||
def index
|
||||
@cible_type = params[:cible_type] || "MenuItem"
|
||||
@cible_id = params[:cible_id] || nil
|
||||
end
|
||||
|
||||
end
|
52
app/controllers/admin/comments_controller.rb
Normal file
52
app/controllers/admin/comments_controller.rb
Normal file
@ -0,0 +1,52 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
|
||||
class Admin::CommentsController < ApplicationController
|
||||
|
||||
before_filter :authenticate_admin!
|
||||
|
||||
layout "admin"
|
||||
|
||||
navigation :comments
|
||||
|
||||
before_filter :find_comments
|
||||
|
||||
|
||||
def index
|
||||
|
||||
end
|
||||
|
||||
|
||||
def edit
|
||||
|
||||
@comment = Comment.find(params[:id])
|
||||
end
|
||||
|
||||
|
||||
def update
|
||||
|
||||
@comment = Comment.find(params[:id])
|
||||
|
||||
if @comment.update_attributes(params[:comment])
|
||||
|
||||
|
||||
else
|
||||
|
||||
render :action => "edit"
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def destroy
|
||||
|
||||
@comment = Comment.find(params[:id])
|
||||
@comment.destroy
|
||||
|
||||
end
|
||||
|
||||
|
||||
def find_comments
|
||||
@comments = Comment.all
|
||||
end
|
||||
|
||||
end
|
15
app/controllers/admin/dashboard_controller.rb
Normal file
15
app/controllers/admin/dashboard_controller.rb
Normal file
@ -0,0 +1,15 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
|
||||
class Admin::DashboardController < ApplicationController
|
||||
navigation :dahsboard
|
||||
|
||||
before_filter :authenticate_admin!
|
||||
|
||||
layout "admin"
|
||||
|
||||
|
||||
def index
|
||||
|
||||
end
|
||||
|
||||
end
|
75
app/controllers/admin/data_files_controller.rb
Normal file
75
app/controllers/admin/data_files_controller.rb
Normal file
@ -0,0 +1,75 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
|
||||
class Admin::DataFilesController < ApplicationController
|
||||
before_filter :authenticate_admin!
|
||||
|
||||
layout "admin"
|
||||
|
||||
navigation :data_files
|
||||
|
||||
|
||||
def index
|
||||
|
||||
params[:file_folder_id] = params[:file_folder_id] || 1
|
||||
|
||||
@file_folder = FileFolder.find(params[:file_folder_id])
|
||||
|
||||
@file_folders = FileFolder.all(:order => :name)
|
||||
|
||||
@data_files = DataFile.all(:order => "created_at DESC", :conditions => {:file_folder_id => @file_folder.id})
|
||||
|
||||
@data_file = DataFile.new(:file_folder_id => @file_folder.id)
|
||||
|
||||
if request.xhr?
|
||||
render :layout => false
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def new
|
||||
|
||||
end
|
||||
|
||||
def edit
|
||||
|
||||
end
|
||||
|
||||
def create
|
||||
|
||||
@data_file_create = true
|
||||
|
||||
@data_file = DataFile.new(:name => params[:data_file][:name], :file_folder_id => params[:data_file][:file_folder_id], :file =>params[:data_file][:file][0])
|
||||
|
||||
if @data_file.save
|
||||
flash[:notice] = "Le fichier a bien été ajoutée."
|
||||
else
|
||||
flash[:notice] = "Erreur lors de l'ajout du fichier."
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
def update
|
||||
@data_file = DataFile.find(params[:id])
|
||||
if @data_file.update_attributes(params[:data_file])
|
||||
flash[:notice] = "Les informations du fichier ont bien été modifiées."
|
||||
else
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def destroy
|
||||
@data_file = DataFile.find(params[:id])
|
||||
@data_file.destroy
|
||||
|
||||
flash[:notice] = "Le fichier à bien été supprimée."
|
||||
end
|
||||
|
||||
|
||||
def show
|
||||
@data_file = DataFile.find(params[:id])
|
||||
|
||||
end
|
||||
|
||||
end
|
78
app/controllers/admin/events_controller.rb
Normal file
78
app/controllers/admin/events_controller.rb
Normal file
@ -0,0 +1,78 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
|
||||
class Admin::EventsController < ApplicationController
|
||||
before_filter :authenticate_admin!
|
||||
|
||||
layout "admin"
|
||||
|
||||
navigation :events
|
||||
|
||||
before_filter :find_events
|
||||
|
||||
|
||||
def index
|
||||
|
||||
end
|
||||
|
||||
|
||||
def cible
|
||||
@events = Event.all
|
||||
|
||||
render :layout => false
|
||||
end
|
||||
|
||||
|
||||
def new
|
||||
@event = Event.new
|
||||
|
||||
end
|
||||
|
||||
def edit
|
||||
@event = Event.find(params[:id])
|
||||
end
|
||||
|
||||
|
||||
def create
|
||||
@event = Event.new(params[:event])
|
||||
|
||||
|
||||
if @event.save
|
||||
flash[:notice] = "L'événement à été ajouté avec succès."
|
||||
|
||||
self.find_events #reload events to show new events in the list sort by date.
|
||||
|
||||
else
|
||||
render :action => "new"
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
def update
|
||||
@event = Event.find(params[:id])
|
||||
|
||||
if @event.update_attributes(params[:event])
|
||||
flash[:notice] = "L'événement à été modifié avec succès."
|
||||
else
|
||||
render :action => "edit"
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
def destroy
|
||||
@event = Event.find(params[:id])
|
||||
@event.destroy
|
||||
|
||||
end
|
||||
|
||||
|
||||
protected
|
||||
|
||||
def find_events
|
||||
@events = Event.all
|
||||
|
||||
end
|
||||
end
|
64
app/controllers/admin/external_links_controller.rb
Normal file
64
app/controllers/admin/external_links_controller.rb
Normal file
@ -0,0 +1,64 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
|
||||
class Admin::ExternalLinksController < ApplicationController
|
||||
|
||||
before_filter :authenticate_admin!
|
||||
|
||||
layout "admin"
|
||||
|
||||
|
||||
def cible
|
||||
@external_links = ExternalLink.all
|
||||
|
||||
render :layout => false
|
||||
end
|
||||
|
||||
|
||||
def new
|
||||
@external_link = ExternalLink.new
|
||||
|
||||
end
|
||||
|
||||
|
||||
def edit
|
||||
@external_link = ExternalLink.find(params[:id])
|
||||
|
||||
end
|
||||
|
||||
|
||||
def create
|
||||
@external_link = ExternalLink.new(params[:external_link])
|
||||
|
||||
|
||||
if @external_link.save
|
||||
flash[:notice] = "Le lien a été ajouté avec succès."
|
||||
|
||||
else
|
||||
render :action => "new"
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
def update
|
||||
@external_link = ExternalLink.find(params[:id])
|
||||
|
||||
if @external_link.update_attributes(params[:external_link])
|
||||
flash[:notice] = "Le lien a été modifié avec succès."
|
||||
|
||||
else
|
||||
render :action => "edit"
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
def destroy
|
||||
@external_link = ExternalLink.find(params[:id])
|
||||
@external_link.destroy
|
||||
|
||||
end
|
||||
|
||||
end
|
66
app/controllers/admin/file_folders_controller.rb
Normal file
66
app/controllers/admin/file_folders_controller.rb
Normal file
@ -0,0 +1,66 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
|
||||
class Admin::FileFoldersController < ApplicationController
|
||||
|
||||
before_filter :authenticate_admin!
|
||||
|
||||
|
||||
def index
|
||||
@file_folders = FileFolder.all(:order => :name)
|
||||
|
||||
end
|
||||
|
||||
|
||||
def new
|
||||
@file_folder = FileFolder.new()
|
||||
|
||||
end
|
||||
|
||||
|
||||
def create
|
||||
@file_folder = FileFolder.new(params[:file_folder])
|
||||
@file_folder_create = true
|
||||
|
||||
if @file_folder.save
|
||||
@file_folders = FileFolder.all(:order => :name)
|
||||
|
||||
else
|
||||
render :action => :new
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def edit
|
||||
@file_folder = FileFolder.find(params[:id])
|
||||
|
||||
end
|
||||
|
||||
|
||||
def update
|
||||
@file_folder = FileFolder.find(params[:id])
|
||||
@file_folder_update = true
|
||||
|
||||
if @file_folder.update_attributes(params[:file_folder])
|
||||
@file_folders = FileFolder.all(:order => :name)
|
||||
|
||||
else
|
||||
render :action => :edit
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
def destroy
|
||||
if params[:id] != 1
|
||||
@file_folder = FileFolder.find(params[:id])
|
||||
|
||||
@file_folder.destroy
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
end
|
66
app/controllers/admin/image_files_controller.rb
Normal file
66
app/controllers/admin/image_files_controller.rb
Normal file
@ -0,0 +1,66 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
class Admin::ImageFilesController < ApplicationController
|
||||
before_filter :authenticate_admin!
|
||||
layout "admin"
|
||||
navigation :image_files
|
||||
|
||||
def index
|
||||
params[:album_id] = params[:album_id] || 1
|
||||
|
||||
@album = Album.find(params[:album_id])
|
||||
@albums = Album.all(:order => :name)
|
||||
@image_files = ImageFile.all(:order => "created_at DESC", :conditions => {:album_id => @album.id})
|
||||
@image_file = ImageFile.new(:album_id => @album.id)
|
||||
if request.xhr?
|
||||
render :layout => false
|
||||
end
|
||||
end
|
||||
|
||||
def new
|
||||
end
|
||||
|
||||
def edit
|
||||
end
|
||||
|
||||
def create
|
||||
@image_file_create = true
|
||||
@image_file = ImageFile.new(:name => params[:image_file][:name], :album_id => params[:image_file][:album_id], :file =>params[:image_file][:file][0])
|
||||
|
||||
if @image_file.save
|
||||
|
||||
else
|
||||
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
def update
|
||||
@image_file = ImageFile.find(params[:id])
|
||||
if @image_file.update_attributes(params[:image_file])
|
||||
|
||||
else
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@image_file = ImageFile.find(params[:id])
|
||||
@image_file.destroy
|
||||
|
||||
flash[:notice] = "L'image à bien été supprimée."
|
||||
end
|
||||
|
||||
def show
|
||||
@image_file = ImageFile.find(params[:id])
|
||||
|
||||
end
|
||||
|
||||
def rotate
|
||||
deg = params[:direction] == "right" ? -90 : 90
|
||||
|
||||
@image_file = ImageFile.find(params[:id])
|
||||
@image_file.rotate(deg)
|
||||
end
|
||||
|
||||
end
|
77
app/controllers/admin/inscrits_controller.rb
Normal file
77
app/controllers/admin/inscrits_controller.rb
Normal file
@ -0,0 +1,77 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
class Admin::InscritsController < ApplicationController
|
||||
before_filter :authenticate_admin!
|
||||
|
||||
|
||||
layout "admin"
|
||||
navigation :inscrits
|
||||
before_filter :find_inscrits
|
||||
|
||||
|
||||
def index
|
||||
|
||||
end
|
||||
|
||||
def cible
|
||||
@inscrits = Inscrit.all
|
||||
|
||||
render :layout => false
|
||||
|
||||
end
|
||||
|
||||
def new
|
||||
@inscrit = Inscrit.new
|
||||
|
||||
end
|
||||
|
||||
def edit
|
||||
@inscrit = Inscrit.find(params[:id])
|
||||
|
||||
end
|
||||
|
||||
|
||||
def create
|
||||
@inscrit = Inscrit.new(params[:inscrit])
|
||||
|
||||
|
||||
if @inscrit.save
|
||||
flash[:notice] = "L'inscrit a bien été ajouté."
|
||||
self.find_inscrits
|
||||
|
||||
else
|
||||
render :action => "new"
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
def update
|
||||
@inscrit = Inscrit.find(params[:id])
|
||||
|
||||
if @inscrit.update_attributes(params[:inscrit])
|
||||
flash[:notice] = "L'inscrit a bien été modifié."
|
||||
|
||||
else
|
||||
render :action => "edit"
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
def destroy
|
||||
@inscrit = Inscrit.find(params[:id])
|
||||
@inscrit.destroy
|
||||
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def find_inscrits
|
||||
@inscrits = Inscrit.all
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
76
app/controllers/admin/interests_controller.rb
Normal file
76
app/controllers/admin/interests_controller.rb
Normal file
@ -0,0 +1,76 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
|
||||
class Admin::InterestsController < ApplicationController
|
||||
before_filter :authenticate_admin!
|
||||
|
||||
layout "admin"
|
||||
|
||||
navigation :interests
|
||||
|
||||
before_filter :find_interests
|
||||
|
||||
def index
|
||||
|
||||
end
|
||||
|
||||
def cible
|
||||
@interests = Interest.all
|
||||
|
||||
render :layout => false
|
||||
|
||||
end
|
||||
|
||||
def new
|
||||
@interest = Interest.new
|
||||
|
||||
end
|
||||
|
||||
def edit
|
||||
@interest = Interest.find(params[:id])
|
||||
|
||||
end
|
||||
|
||||
|
||||
def create
|
||||
@interest = Interest.new(params[:interest])
|
||||
|
||||
|
||||
if @interest.save
|
||||
flash[:notice] = "Le centre d'intêret a bien été ajouté."
|
||||
self.find_interests
|
||||
|
||||
else
|
||||
render :action => "new"
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
def update
|
||||
@interest = Interest.find(params[:id])
|
||||
|
||||
if @interest.update_attributes(params[:interest])
|
||||
flash[:notice] = "Le centre d'intêret a bien été modifié."
|
||||
|
||||
else
|
||||
render :action => "edit"
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
def destroy
|
||||
@interest = Interest.find(params[:id])
|
||||
@interest.destroy
|
||||
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def find_interests
|
||||
@interests = Interest.all
|
||||
end
|
||||
|
||||
end
|
15
app/controllers/admin/menu_aliases_controller.rb
Normal file
15
app/controllers/admin/menu_aliases_controller.rb
Normal file
@ -0,0 +1,15 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
class Admin::MenuAliasesController < ApplicationController
|
||||
|
||||
before_filter :authenticate_admin!
|
||||
|
||||
|
||||
|
||||
def edit
|
||||
|
||||
end
|
||||
|
||||
def update
|
||||
end
|
||||
|
||||
end
|
207
app/controllers/admin/menu_items_controller.rb
Normal file
207
app/controllers/admin/menu_items_controller.rb
Normal file
@ -0,0 +1,207 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
class Admin::MenuItemsController < ApplicationController
|
||||
before_filter :authenticate_admin!
|
||||
|
||||
|
||||
layout "admin"
|
||||
navigation :menu_items
|
||||
|
||||
|
||||
def index
|
||||
|
||||
|
||||
|
||||
if params[:menu_id] and params[:menu_id] != "" and @menu = Menu.find(params[:menu_id])
|
||||
|
||||
|
||||
params[:parent_id] = nil if !params[:parent_id]
|
||||
|
||||
@menu_parent = MenuItem.find(params[:parent_id]) if params[:parent_id]
|
||||
|
||||
|
||||
|
||||
@order = "position ASC"
|
||||
|
||||
@menu_items = @menu.menu_items.where(:parent_id => params[:parent_id]).order(@order).page(magick_page()).per(magick_per_page())
|
||||
|
||||
if @menu_items.num_pages.to_i < magick_page().to_i
|
||||
params[:page] = @menu_items.num_pages
|
||||
@menu_items = @menu.menu_items.where(:parent_id => params[:parent_id]).order(@order).page(magick_page()).per(magick_per_page())
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
else
|
||||
redirect_to admin_root_path, :alert => "Un menu doit être séléctionné."
|
||||
end
|
||||
end
|
||||
|
||||
def new
|
||||
current_navigation :new_menu_items
|
||||
|
||||
|
||||
@menu_item = MenuItem.new(:menu_id => params[:menu_id],:parent_id => params[:parent_id])
|
||||
|
||||
params[:menu_item_content_type] = "Page" if !params[:menu_item_content_type]
|
||||
|
||||
@content = params[:menu_item_content_type].constantize.new()
|
||||
@menu_item.menu_content = @content
|
||||
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
def create
|
||||
|
||||
current_navigation :new_menu_items
|
||||
params_content = params[:menu_item].delete(:menu_content_attributes)
|
||||
content_type = params[:menu_item][:menu_content_type]
|
||||
|
||||
puts params[:menu_item][:menu_content_type]
|
||||
|
||||
@menu_item= MenuItem.new(params[:menu_item])
|
||||
content = content_type.constantize.new(params_content)
|
||||
|
||||
@menu_item.menu_content = content
|
||||
|
||||
|
||||
|
||||
respond_to do |format|
|
||||
if @menu_item.save
|
||||
MenuItem.all.each do |mi|
|
||||
mi.set_permalink
|
||||
end
|
||||
|
||||
flash[:notice] = "Le menu à été ajouté avec succès."
|
||||
format.html {
|
||||
redirect_to(admin_menu_items_path(:menu_id => @menu_item.menu_id, :parent_id => @menu_item.parent_id))
|
||||
}
|
||||
|
||||
else
|
||||
format.html { render :action => "new" }
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def edit
|
||||
current_navigation :edit_menu_items
|
||||
@menu_item= MenuItem.find(params[:id])
|
||||
|
||||
end
|
||||
|
||||
def update
|
||||
current_navigation :edit_menu_items
|
||||
@menu_item= MenuItem.find(params[:id])
|
||||
|
||||
@menu = @menu_item.menu
|
||||
|
||||
if request.xhr?
|
||||
@menu_parent = @menu_item.parent if @menu_item.parent
|
||||
@menu_items = MenuItem.where(:parent_id => @menu_item.parent_id, :menu_id => @menu_item.menu_id).order(:position)
|
||||
end
|
||||
|
||||
if params[:menu_item][:parent_id] and params[:menu_item][:parent_id] == "no-menu-selected"
|
||||
@menu_item.parent_id = nil
|
||||
@menu_item.save
|
||||
params[:menu_item].delete(:parent_id)
|
||||
|
||||
end
|
||||
|
||||
@reorder = true if params[:reorder]
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
respond_to do |format|
|
||||
if @menu_item.update_attributes(params[:menu_item])
|
||||
puts "TEST"
|
||||
MenuItem.all.each do |mi|
|
||||
mi.set_permalink
|
||||
|
||||
end
|
||||
|
||||
flash[:notice] = "Le menu à été modifié avec succès."
|
||||
format.html { redirect_to(admin_menu_items_path(:parent_id => @menu_item.parent_id, :menu_id => @menu_item.menu_id)) }
|
||||
if @reorder
|
||||
format.js {
|
||||
|
||||
render :action => "update" }
|
||||
else
|
||||
format.js {
|
||||
|
||||
render :action => "show" }
|
||||
end
|
||||
else
|
||||
|
||||
flash[:alert] = "Cet élément de menu n'a pas pu être déplacé. Vérifiez que sont lien permanent n'éxiste pas déjà dans l'élément cible."
|
||||
if @reorder
|
||||
format.js { render :action => "update_reorder_failled" }
|
||||
else
|
||||
format.html { render :action => "edit" }
|
||||
format.js { render :action => "edit" }
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def destroy
|
||||
@menu_item = MenuItem.find(params[:id])
|
||||
@menu_item.destroy
|
||||
flash[:notice] = "L'élément de menu a été supprimé avec succès."
|
||||
respond_to do |format|
|
||||
|
||||
|
||||
format.html { redirect_to(admin_menu_items_path(:menu_id => @menu_item.menu_id, :parent_id => @menu_item.parent_id)) }
|
||||
format.js
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
def show
|
||||
@menu_item= MenuItem.find(params[:id])
|
||||
end
|
||||
|
||||
def cible
|
||||
|
||||
params[:menu_id] = params[:menu_id] || 1
|
||||
|
||||
if params[:menu_id] and params[:menu_id] != "" and @menu = Menu.find(params[:menu_id])
|
||||
|
||||
|
||||
params[:parent_id] = nil if !params[:parent_id]
|
||||
|
||||
@menu_parent = MenuItem.find(params[:parent_id]) if params[:parent_id]
|
||||
|
||||
|
||||
|
||||
@order = "position ASC"
|
||||
|
||||
@menu_items = @menu.menu_items.where(:parent_id => params[:parent_id]).order(@order).page(magick_page()).per(magick_per_page())
|
||||
|
||||
if @menu_items.num_pages.to_i < magick_page().to_i
|
||||
params[:page] = @menu_items.num_pages
|
||||
@menu_items = @menu.menu_items.where(:parent_id => params[:parent_id]).order(@order).page(magick_page()).per(magick_per_page())
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
else
|
||||
redirect_to admin_root_path, :alert => "Un menu doit être séléctionné."
|
||||
end
|
||||
|
||||
render :layout => false
|
||||
|
||||
end
|
||||
|
||||
end
|
14
app/controllers/admin/menu_urls_controller.rb
Normal file
14
app/controllers/admin/menu_urls_controller.rb
Normal file
@ -0,0 +1,14 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
class Admin::MenuUrlsController < ApplicationController
|
||||
before_filter :authenticate_admin!
|
||||
|
||||
|
||||
def edit
|
||||
|
||||
|
||||
end
|
||||
|
||||
def update
|
||||
end
|
||||
|
||||
end
|
80
app/controllers/admin/menus_controller.rb
Normal file
80
app/controllers/admin/menus_controller.rb
Normal file
@ -0,0 +1,80 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
class Admin::MenusController < ApplicationController
|
||||
before_filter :authenticate_admin!
|
||||
layout "admin"
|
||||
|
||||
before_filter :authenticate_admin!
|
||||
|
||||
|
||||
|
||||
def index
|
||||
@breadcrumb = ["liste des menus"]
|
||||
|
||||
@order = magick_order("name", "ASC")
|
||||
|
||||
@menus = Menu.order(@order).page(magick_page()).per(magick_per_page())
|
||||
|
||||
if @menus.num_pages.to_i < magick_page().to_i
|
||||
params[:page] = @menus.num_pages
|
||||
@menus = Menu.order(@order).page(magick_page()).per(magick_per_page())
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def show
|
||||
end
|
||||
|
||||
def new
|
||||
@breadcrumb = [["liste des menus", admin_menus_path],"Ajouter un menu"]
|
||||
@menu = Menu.new
|
||||
|
||||
end
|
||||
|
||||
def create
|
||||
@breadcrumb = [["liste des menus", admin_menus_path],"Ajouter un menu"]
|
||||
@menu = Menu.new(params[:menu])
|
||||
|
||||
respond_to do |format|
|
||||
if @menu.save
|
||||
flash[:notice] = "Le menu à été ajouté avec succès."
|
||||
format.html { redirect_to(admin_menus_path) }
|
||||
else
|
||||
format.html { render :action => "new" }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
@breadcrumb = [["liste des menus", admin_menus_path],"Modifier un menu"]
|
||||
@menu = Menu.find(params[:id])
|
||||
|
||||
|
||||
end
|
||||
|
||||
def update
|
||||
@breadcrumb = [["liste des menus", admin_menus_path],"Modifier un menu"]
|
||||
@menu = Menu.find(params[:id])
|
||||
respond_to do |format|
|
||||
if @menu.update_attributes(params[:menu])
|
||||
|
||||
flash[:notice] = "Le menu à été modifié avec succès."
|
||||
format.html { redirect_to(admin_menus_path) }
|
||||
else
|
||||
format.html { render :action => "edit" }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@menu = Menu.find(params[:id])
|
||||
@menu.destroy
|
||||
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
redirect_to(admin_menus_url, :notice => "Le menu a bien été supprimé.")
|
||||
}
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
117
app/controllers/admin/newsletters_controller.rb
Normal file
117
app/controllers/admin/newsletters_controller.rb
Normal file
@ -0,0 +1,117 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
|
||||
class Admin::NewslettersController < ApplicationController
|
||||
before_filter :authenticate_admin!
|
||||
|
||||
|
||||
layout "admin"
|
||||
navigation :newsletters
|
||||
|
||||
|
||||
def index
|
||||
@newsletters = Newsletter.order('created_at DESC')
|
||||
if request.xhr?
|
||||
render :layout => false
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
def new
|
||||
|
||||
|
||||
@newsletter = Newsletter.new()
|
||||
end
|
||||
|
||||
def create
|
||||
|
||||
@newsletter = Newsletter.new(params[:newsletter])
|
||||
|
||||
puts params[:newsletter][:subject]
|
||||
if @newsletter.save
|
||||
flash[:notice] = "La newsletter à bien été créé."
|
||||
@newsletters = Newsletter.order('created_at DESC')
|
||||
respond_to do |format|
|
||||
format.js
|
||||
format.html{ redirect_to admin_newsletters_path}
|
||||
end
|
||||
|
||||
else
|
||||
|
||||
respond_to do |format|
|
||||
format.js { render :action => :new}
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def edit
|
||||
|
||||
|
||||
@newsletter = Newsletter.find(params[:id])
|
||||
|
||||
|
||||
end
|
||||
|
||||
def update
|
||||
|
||||
|
||||
@newsletter = Newsletter.find(params[:id])
|
||||
|
||||
if @newsletter.update_attributes(params[:newsletter])
|
||||
flash[:notice] = "La newsletter à bien été modifié."
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to(admin_newsletters_path()) }
|
||||
format.js
|
||||
end
|
||||
|
||||
else
|
||||
respond_to do |format|
|
||||
format.html { render :action => :edit}
|
||||
format.js { render :action => :edit}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def destroy
|
||||
@newsletter = Newsletter.find(params[:id])
|
||||
@newsletter.destroy
|
||||
|
||||
|
||||
flash[:notice] = "La newsletter à bien été supprimé."
|
||||
end
|
||||
|
||||
|
||||
def send_test
|
||||
|
||||
@newsletter = Newsletter.find(params[:id])
|
||||
@email = params[:email].to_s
|
||||
|
||||
General.send_newsletter(@email,@newsletter).deliver
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
redirect_to(admin_newsletters_path, :notice => "La newsletter a bien été envoyée à l'email de test")
|
||||
end
|
||||
|
||||
|
||||
def send_newsletter
|
||||
@newsletter = Newsletter.find(params[:id])
|
||||
@i = 0
|
||||
@inscrits = Inscrit.where(:enabled => true)
|
||||
@inscrits.each do |inscrit|
|
||||
General.send_newsletter(inscrit.email,@newsletter, inscrit).deliver
|
||||
end
|
||||
@newsletter.sended = true
|
||||
@newsletter.send_at = Time.now
|
||||
@newsletter.save
|
||||
|
||||
redirect_to(admin_newsletters_path, :notice => "La newsletter a la séléction d'emails ("+@i.to_s+" envois.)")
|
||||
end
|
||||
|
||||
|
||||
end
|
15
app/controllers/admin/pages_controller.rb
Normal file
15
app/controllers/admin/pages_controller.rb
Normal file
@ -0,0 +1,15 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
class Admin::PagesController < ApplicationController
|
||||
before_filter :authenticate_admin!
|
||||
|
||||
|
||||
|
||||
def edit
|
||||
@page = Page.find(params[:id])
|
||||
|
||||
end
|
||||
|
||||
def update
|
||||
end
|
||||
|
||||
end
|
81
app/controllers/admin/registrants_controller.rb
Normal file
81
app/controllers/admin/registrants_controller.rb
Normal file
@ -0,0 +1,81 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
class Admin::RegistrantsController < ApplicationController
|
||||
before_filter :authenticate_admin!
|
||||
layout "admin"
|
||||
|
||||
navigation :registrants
|
||||
|
||||
before_filter :find_registrants
|
||||
|
||||
def index
|
||||
|
||||
end
|
||||
|
||||
def cible
|
||||
@registrants = Registrant.all
|
||||
render :layout => false
|
||||
end
|
||||
|
||||
def new
|
||||
|
||||
@registrant = Registrant.new
|
||||
|
||||
respond_to do |format|
|
||||
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
|
||||
@registrant = Registrant.find(params[:id])
|
||||
end
|
||||
|
||||
|
||||
def create
|
||||
@registrant = Registrant.new(params[:registrant])
|
||||
|
||||
respond_to do |format|
|
||||
if @registrant.save
|
||||
flash[:notice] = "Le lien à été ajouté avec succès."
|
||||
self.find_registrants
|
||||
format.js
|
||||
else
|
||||
format.html { render :action => "new" }
|
||||
format.js { render :action => "new" }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def update
|
||||
|
||||
@registrant = Registrant.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
if @registrant.update_attributes(params[:registrant])
|
||||
|
||||
|
||||
format.js
|
||||
else
|
||||
|
||||
format.js { render :action => "edit" }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def destroy
|
||||
@registrant = Registrant.find(params[:id])
|
||||
@registrant.destroy
|
||||
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
def find_registrants
|
||||
@registrants = Registrant.all
|
||||
end
|
||||
end
|
17
app/controllers/admins/passwords_controller.rb
Normal file
17
app/controllers/admins/passwords_controller.rb
Normal file
@ -0,0 +1,17 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
class Admins::PasswordsController < ::Devise::PasswordsController
|
||||
layout "connexion"
|
||||
|
||||
def create
|
||||
self.resource = resource_class.send_reset_password_instructions(params[resource_name])
|
||||
|
||||
if resource.errors.empty?
|
||||
set_flash_message :notice, :send_instructions
|
||||
redirect_to new_session_path(resource_name)
|
||||
else
|
||||
@flash_i= {}
|
||||
@flash_i[:alert] = "Aucun compte associé à cette adresse mail n'a été trouvé."
|
||||
render_with_scope :new
|
||||
end
|
||||
end
|
||||
end
|
5
app/controllers/admins/sessions_controller.rb
Normal file
5
app/controllers/admins/sessions_controller.rb
Normal file
@ -0,0 +1,5 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
class Admins::SessionsController < ::Devise::SessionsController
|
||||
layout "connexion"
|
||||
|
||||
end
|
67
app/controllers/application_controller.rb
Normal file
67
app/controllers/application_controller.rb
Normal file
@ -0,0 +1,67 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
#encoding: utf-8
|
||||
|
||||
class ApplicationController < ActionController::Base
|
||||
protect_from_forgery
|
||||
helper_method :magick_order, :magick_search, :to_my_log
|
||||
|
||||
def magick_order(default_row, default_a_d, name="default")
|
||||
session_order_name = (params[:controller]+"/"+params[:action]).to_slug.gsub('-','_')+"_"+name+"_magick_order"
|
||||
|
||||
if params[:order]
|
||||
|
||||
session[session_order_name] = []
|
||||
|
||||
session[session_order_name][1] = params[:order]
|
||||
session[session_order_name][2] = params[:a_d]
|
||||
|
||||
|
||||
|
||||
elsif session[session_order_name]
|
||||
|
||||
params[:a_d] = session[session_order_name][2]
|
||||
params[:order] = session[session_order_name][1]
|
||||
else
|
||||
params[:order] = default_row
|
||||
params[:a_d] = default_a_d
|
||||
end
|
||||
|
||||
return params[:order]+" "+params[:a_d]
|
||||
end
|
||||
|
||||
def magick_per_page(per_page=20, name="defaut")
|
||||
session_search_name = (params[:controller]+"/"+params[:action]).to_slug.gsub('-','_')+"_"+name+"_magick_per_page"
|
||||
|
||||
if params[:per_page]
|
||||
session[session_search_name] = params[:per_page]
|
||||
elsif session[session_search_name]
|
||||
params[:per_page] = session[session_search_name]
|
||||
else
|
||||
params[:per_page] = per_page
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
def magick_page(name="defaut")
|
||||
session_search_name = (params[:controller]+"/"+params[:action]).to_slug.gsub('-','_')+"_"+name+"_magick_page"
|
||||
|
||||
if params[:page]
|
||||
session[session_search_name] = params[:page]
|
||||
elsif session[session_search_name]
|
||||
params[:page] = session[session_search_name]
|
||||
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
def to_my_log(message)
|
||||
#current_user.user_logs.create(:message => message)
|
||||
end
|
||||
|
||||
|
||||
def current_ability
|
||||
@current_ability ||= Ability.new(current_admin)
|
||||
end
|
||||
|
||||
end
|
14
app/controllers/download_data_files_controller.rb
Normal file
14
app/controllers/download_data_files_controller.rb
Normal file
@ -0,0 +1,14 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
class DownloadDataFilesController < ApplicationController
|
||||
def index
|
||||
end
|
||||
|
||||
|
||||
|
||||
def show
|
||||
@data_file = DataFile.find(params[:id])
|
||||
send_file @data_file.file.path, :filename => @data_file.abstract_file_name_slug #, :disposition => "inline"
|
||||
end
|
||||
|
||||
|
||||
end
|
111
app/controllers/portlet/block_contents_controller.rb
Normal file
111
app/controllers/portlet/block_contents_controller.rb
Normal file
@ -0,0 +1,111 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
class Portlet::BlockContentsController < ApplicationController
|
||||
layout "admin"
|
||||
|
||||
def new
|
||||
@block_content = BlockContent.new(:nbr_columns => 2)
|
||||
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
if request.xhr?
|
||||
render :layout => false
|
||||
end
|
||||
}
|
||||
format.js { render :template => "portlet/shared/new" }
|
||||
end
|
||||
end
|
||||
|
||||
def create
|
||||
@block_content = BlockContent.new(params[:block_content])
|
||||
|
||||
respond_to do |format|
|
||||
if @block_content.save
|
||||
@block_content.nbr_columns.times do
|
||||
@block = Block.new(:block_name => "")
|
||||
@block.blockable = @block_content
|
||||
@block.save
|
||||
end
|
||||
|
||||
@portlet = Portlet.create(:position => params[:position], :block_id => params[:block_id], :content => @block_content)
|
||||
|
||||
|
||||
if @portlet.block and @portlet.block.blockable
|
||||
@portlet.block.blockable.updated_at = Time.now
|
||||
@portlet.block.blockable.save
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
format.html { redirect_to([:admin, @portlet.block.blockable], :notice => 'Elément ajouté avec succès.') }
|
||||
format.js { render :template => "portlet/shared/create" }
|
||||
else
|
||||
format.html { render :action => "new" }
|
||||
format.js { render :template => "portlet/shared/new" }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
@block_content = BlockContent.find(params[:id])
|
||||
@portlet = Portlet.find(params[:portlet_id])
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
if request.xhr?
|
||||
render :template => "portlet/shared/edit", :layout => false
|
||||
end
|
||||
}
|
||||
format.js { render :template => "portlet/shared/edit" }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def show
|
||||
|
||||
|
||||
end
|
||||
|
||||
def update
|
||||
@block_content = BlockContent.find(params[:id])
|
||||
@portlet = Portlet.find(params[:portlet_id])
|
||||
|
||||
respond_to do |format|
|
||||
if @block_content.update_attributes(params[:block_content])
|
||||
if @portlet.block and @portlet.block.blockable
|
||||
@portlet.block.blockable.updated_at = Time.now
|
||||
@portlet.block.blockable.save
|
||||
|
||||
end
|
||||
|
||||
format.html { redirect_to([:admin, @portlet.block.blockable], :notice => 'Titre mis à jour.') }
|
||||
format.js { render :template => "portlet/shared/update" }
|
||||
else
|
||||
format.html { render :action => "portlet/shared/edit" }
|
||||
format.js { render :template => "portlet/shared/edit" }
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@portlet = Portlet.find(params[:portlet_id])
|
||||
@block_content = BlockContent.find(params[:id])
|
||||
@block_content.destroy
|
||||
|
||||
if @portlet.block and @portlet.block.blockable
|
||||
@portlet.block.blockable.updated_at = Time.now
|
||||
@portlet.block.blockable.save
|
||||
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.html {}
|
||||
format.js { render :template => "portlet/shared/destroy" }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
116
app/controllers/portlet/break_contents_controller.rb
Normal file
116
app/controllers/portlet/break_contents_controller.rb
Normal file
@ -0,0 +1,116 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
class Portlet::BreakContentsController < ApplicationController
|
||||
layout "admin"
|
||||
|
||||
def new
|
||||
@break_content = BreakContent.new(:line => true)
|
||||
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
if request.xhr?
|
||||
render :layout => false
|
||||
end
|
||||
}
|
||||
format.js { render :template => "portlet/shared/new" }
|
||||
end
|
||||
end
|
||||
|
||||
def create
|
||||
@break_content = BreakContent.new(params[:break_content])
|
||||
|
||||
respond_to do |format|
|
||||
if @break_content.save
|
||||
|
||||
|
||||
@portlet = Portlet.create(:position => params[:position], :block_id => params[:block_id], :content => @break_content)
|
||||
|
||||
|
||||
if @portlet.block and @portlet.block.blockable
|
||||
@portlet.block.blockable.updated_at = Time.now
|
||||
@portlet.block.blockable.save
|
||||
if @portlet.block.blockable_type == "Page"
|
||||
|
||||
to_my_log("[Page_"+@portlet.block.blockable.id.to_s+"] "+"Modification de la page "+@portlet.block.blockable.title.to_s+" (ajout d'un portlet)")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
format.html { redirect_to([:admin, @portlet.block.blockable], :notice => 'Elément ajouté avec succès.') }
|
||||
format.js { render :template => "portlet/shared/create" }
|
||||
else
|
||||
format.html { render :action => "new" }
|
||||
format.js { render :template => "portlet/shared/new" }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
@break_content = BreakContent.find(params[:id])
|
||||
@portlet = Portlet.find(params[:portlet_id])
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
if request.xhr?
|
||||
render :template => "portlet/shared/edit", :layout => false
|
||||
end
|
||||
}
|
||||
format.js { render :template => "portlet/shared/edit" }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def show
|
||||
|
||||
|
||||
end
|
||||
|
||||
def update
|
||||
@break_content = BreakContent.find(params[:id])
|
||||
@portlet = Portlet.find(params[:portlet_id])
|
||||
|
||||
respond_to do |format|
|
||||
if @break_content.update_attributes(params[:break_content])
|
||||
if @portlet.block and @portlet.block.blockable
|
||||
@portlet.block.blockable.updated_at = Time.now
|
||||
@portlet.block.blockable.save
|
||||
if @portlet.block.blockable_type == "Page"
|
||||
|
||||
to_my_log("[Page_"+@portlet.block.blockable.id.to_s+"] "+"Modification de la page "+@portlet.block.blockable.title.to_s+" (modification d'un portlet)")
|
||||
end
|
||||
end
|
||||
|
||||
format.html { redirect_to([:admin, @portlet.block.blockable], :notice => 'Titre mis à jour.') }
|
||||
format.js { render :template => "portlet/shared/update" }
|
||||
else
|
||||
format.html { render :action => "portlet/shared/edit" }
|
||||
format.js { render :template => "portlet/shared/edit" }
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@portlet = Portlet.find(params[:portlet_id])
|
||||
@break_content = BreakContent.find(params[:id])
|
||||
@break_content.destroy
|
||||
|
||||
if @portlet.block and @portlet.block.blockable
|
||||
@portlet.block.blockable.updated_at = Time.now
|
||||
@portlet.block.blockable.save
|
||||
if @portlet.block.blockable_type == "Page"
|
||||
|
||||
to_my_log("[Page_"+@portlet.block.blockable.id.to_s+"] "+"Modification de la page "+@portlet.block.blockable.title.to_s+" (suppression d'un portlet)")
|
||||
end
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.html {}
|
||||
format.js { render :template => "portlet/shared/destroy" }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
109
app/controllers/portlet/download_contents_controller.rb
Normal file
109
app/controllers/portlet/download_contents_controller.rb
Normal file
@ -0,0 +1,109 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
class Portlet::DownloadContentsController < ApplicationController
|
||||
layout "admin"
|
||||
|
||||
def new
|
||||
@download_content = DownloadContent.new
|
||||
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
if request.xhr?
|
||||
render :layout => false
|
||||
end
|
||||
}
|
||||
format.js { render :template => "portlet/shared/new" }
|
||||
end
|
||||
end
|
||||
|
||||
def create
|
||||
@download_content = DownloadContent.new(params[:download_content])
|
||||
|
||||
respond_to do |format|
|
||||
if @download_content.save
|
||||
|
||||
|
||||
@portlet = Portlet.create(:position => params[:position], :block_id => params[:block_id], :content => @download_content)
|
||||
|
||||
|
||||
if @portlet.block and @portlet.block.blockable
|
||||
@portlet.block.blockable.updated_at = Time.now
|
||||
@portlet.block.blockable.save
|
||||
if @portlet.block.blockable_type == "Page"
|
||||
|
||||
to_my_log("[Page_"+@portlet.block.blockable.id.to_s+"] "+"Modification de la page "+@portlet.block.blockable.title.to_s+" (ajout d'un portlet)")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
format.html { redirect_to([:admin, @portlet.block.blockable], :notice => 'Elément ajouté avec succès.') }
|
||||
format.js { render :template => "portlet/shared/create" }
|
||||
else
|
||||
format.html { render :action => "new" }
|
||||
format.js { render :template => "portlet/shared/new" }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
@download_content = DownloadContent.find(params[:id])
|
||||
@portlet = Portlet.find(params[:portlet_id])
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
if request.xhr?
|
||||
render :template => "portlet/shared/edit", :layout => false
|
||||
end
|
||||
}
|
||||
format.js { render :template => "portlet/shared/edit" }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def show
|
||||
|
||||
|
||||
end
|
||||
|
||||
def update
|
||||
@download_content = DownloadContent.find(params[:id])
|
||||
@portlet = @download_content.portlet
|
||||
|
||||
respond_to do |format|
|
||||
if @download_content.update_attributes(params[:download_content])
|
||||
|
||||
|
||||
format.html { redirect_to([:admin, @portlet.block.blockable], :notice => 'Titre mis à jour.') }
|
||||
format.js { render :template => "portlet/shared/update" }
|
||||
else
|
||||
format.html { render :action => "portlet/shared/edit" }
|
||||
format.js { render :template => "portlet/shared/edit" }
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@portlet = Portlet.find(params[:portlet_id])
|
||||
@download_content = DownloadContent.find(params[:id])
|
||||
@download_content.destroy
|
||||
|
||||
if @portlet.block and @portlet.block.blockable
|
||||
@portlet.block.blockable.updated_at = Time.now
|
||||
@portlet.block.blockable.save
|
||||
if @portlet.block.blockable_type == "Page"
|
||||
|
||||
to_my_log("[Page_"+@portlet.block.blockable.id.to_s+"] "+"Modification de la page "+@portlet.block.blockable.title.to_s+" (suppression d'un portlet)")
|
||||
end
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.html {}
|
||||
format.js { render :template => "portlet/shared/destroy" }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
116
app/controllers/portlet/dynamic_contents_controller.rb
Normal file
116
app/controllers/portlet/dynamic_contents_controller.rb
Normal file
@ -0,0 +1,116 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
class Portlet::DynamicContentsController < ApplicationController
|
||||
layout "admin"
|
||||
|
||||
def new
|
||||
@dynamic_content = DynamicContent.new
|
||||
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
if request.xhr?
|
||||
render :layout => false
|
||||
end
|
||||
}
|
||||
format.js { render :template => "portlet/shared/new" }
|
||||
end
|
||||
end
|
||||
|
||||
def create
|
||||
@dynamic_content = DynamicContent.new(params[:dynamic_content])
|
||||
|
||||
respond_to do |format|
|
||||
if @dynamic_content.save
|
||||
|
||||
|
||||
@portlet = Portlet.create(:position => params[:position], :block_id => params[:block_id], :content => @dynamic_content)
|
||||
|
||||
|
||||
if @portlet.block and @portlet.block.blockable
|
||||
@portlet.block.blockable.updated_at = Time.now
|
||||
@portlet.block.blockable.save
|
||||
if @portlet.block.blockable_type == "Page"
|
||||
|
||||
to_my_log("[Page_"+@portlet.block.blockable.id.to_s+"] "+"Modification de la page "+@portlet.block.blockable.title.to_s+" (ajout d'un portlet)")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
format.html { redirect_to([:admin, @portlet.block.blockable], :notice => 'Elément ajouté avec succès.') }
|
||||
format.js { render :template => "portlet/shared/create" }
|
||||
else
|
||||
format.html { render :action => "new" }
|
||||
format.js { render :template => "portlet/shared/new" }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
@dynamic_content = DynamicContent.find(params[:id])
|
||||
@portlet = Portlet.find(params[:portlet_id])
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
if request.xhr?
|
||||
render :template => "portlet/shared/edit", :layout => false
|
||||
end
|
||||
}
|
||||
format.js { render :template => "portlet/shared/edit" }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def show
|
||||
|
||||
|
||||
end
|
||||
|
||||
def update
|
||||
@dynamic_content = DynamicContent.find(params[:id])
|
||||
@portlet = Portlet.find(params[:portlet_id])
|
||||
|
||||
respond_to do |format|
|
||||
if @dynamic_content.update_attributes(params[:dynamic_content])
|
||||
if @portlet.block and @portlet.block.blockable
|
||||
@portlet.block.blockable.updated_at = Time.now
|
||||
@portlet.block.blockable.save
|
||||
if @portlet.block.blockable_type == "Page"
|
||||
|
||||
to_my_log("[Page_"+@portlet.block.blockable.id.to_s+"] "+"Modification de la page "+@portlet.block.blockable.title.to_s+" (modification d'un portlet)")
|
||||
end
|
||||
end
|
||||
|
||||
format.html { redirect_to([:admin, @portlet.block.blockable], :notice => 'Titre mis à jour.') }
|
||||
format.js { render :template => "portlet/shared/update" }
|
||||
else
|
||||
format.html { render :action => "portlet/shared/edit" }
|
||||
format.js { render :template => "portlet/shared/edit" }
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@portlet = Portlet.find(params[:portlet_id])
|
||||
@dynamic_content = DynamicContent.find(params[:id])
|
||||
@dynamic_content.destroy
|
||||
|
||||
if @portlet.block and @portlet.block.blockable
|
||||
@portlet.block.blockable.updated_at = Time.now
|
||||
@portlet.block.blockable.save
|
||||
if @portlet.block.blockable_type == "Page"
|
||||
|
||||
to_my_log("[Page_"+@portlet.block.blockable.id.to_s+"] "+"Modification de la page "+@portlet.block.blockable.title.to_s+" (suppression d'un portlet)")
|
||||
end
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.html {}
|
||||
format.js { render :template => "portlet/shared/destroy" }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
109
app/controllers/portlet/gallery_contents_controller.rb
Normal file
109
app/controllers/portlet/gallery_contents_controller.rb
Normal file
@ -0,0 +1,109 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
class Portlet::GalleryContentsController < ApplicationController
|
||||
layout "admin"
|
||||
|
||||
def new
|
||||
@gallery_content = GalleryContent.new
|
||||
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
if request.xhr?
|
||||
render :layout => false
|
||||
end
|
||||
}
|
||||
format.js { render :template => "portlet/shared/new" }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def create
|
||||
@gallery_content = GalleryContent.new(params[:gallery_content])
|
||||
|
||||
respond_to do |format|
|
||||
if @gallery_content.save
|
||||
|
||||
|
||||
@portlet = Portlet.create(:position => params[:position], :block_id => params[:block_id], :content => @gallery_content)
|
||||
|
||||
|
||||
if @portlet.block and @portlet.block.blockable
|
||||
@portlet.block.blockable.updated_at = Time.now
|
||||
@portlet.block.blockable.save
|
||||
if @portlet.block.blockable_type == "Page"
|
||||
|
||||
to_my_log("[Page_"+@portlet.block.blockable.id.to_s+"] "+"Modification de la page "+@portlet.block.blockable.title.to_s+" (ajout d'un portlet)")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
format.html { redirect_to([:admin, @portlet.block.blockable], :notice => 'Elément ajouté avec succès.') }
|
||||
format.js { render :template => "portlet/shared/create" }
|
||||
else
|
||||
format.html { render :action => "new" }
|
||||
format.js { render :template => "portlet/shared/new" }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
@gallery_content = GalleryContent.find(params[:id])
|
||||
@portlet = @gallery_content.portlet
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
if request.xhr?
|
||||
render :template => "portlet/shared/edit", :layout => false
|
||||
end
|
||||
}
|
||||
format.js { render :template => "portlet/shared/edit" }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def show
|
||||
|
||||
|
||||
end
|
||||
|
||||
def update
|
||||
@gallery_content = GalleryContent.find(params[:id])
|
||||
@portlet = @gallery_content.portlet
|
||||
|
||||
respond_to do |format|
|
||||
if @gallery_content.update_attributes(params[:gallery_content])
|
||||
|
||||
format.html { redirect_to([:admin, @portlet.block.blockable], :notice => 'Titre mis à jour.') }
|
||||
format.js { render :template => "portlet/shared/update" }
|
||||
else
|
||||
format.html { render :action => "portlet/shared/edit" }
|
||||
format.js { render :template => "portlet/shared/edit" }
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@portlet = Portlet.find(params[:portlet_id])
|
||||
@gallery_content = GalleryContent.find(params[:id])
|
||||
@gallery_content.destroy
|
||||
|
||||
if @portlet.block and @portlet.block.blockable
|
||||
@portlet.block.blockable.updated_at = Time.now
|
||||
@portlet.block.blockable.save
|
||||
if @portlet.block.blockable_type == "Page"
|
||||
|
||||
to_my_log("[Page_"+@portlet.block.blockable.id.to_s+"] "+"Modification de la page "+@portlet.block.blockable.title.to_s+" (suppression d'un portlet)")
|
||||
end
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.html {}
|
||||
format.js { render :template => "portlet/shared/destroy" }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
82
app/controllers/portlet/gallery_images_controller.rb
Normal file
82
app/controllers/portlet/gallery_images_controller.rb
Normal file
@ -0,0 +1,82 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
class Portlet::GalleryImagesController < ApplicationController
|
||||
layout "admin"
|
||||
|
||||
|
||||
def reorder
|
||||
i = 0
|
||||
params[:gallery_image].each do |gallery_image_id|
|
||||
i += 1
|
||||
gallery_image = GalleryImage.find(gallery_image_id)
|
||||
gallery_image.position = i
|
||||
gallery_image.save
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def create
|
||||
|
||||
@gallery_content = GalleryContent.find(params[:gallery_content_id])
|
||||
@gallery_images = []
|
||||
if params[:image_file_ids].kind_of?(Array)
|
||||
params[:image_file_ids].each do |image_file_id|
|
||||
image_file = ImageFile.find(image_file_id)
|
||||
gallery_image = GalleryImage.create(:image_file_id => image_file.id, :title => image_file.name, :description => image_file.description, :gallery_content_id => @gallery_content.id )
|
||||
|
||||
@gallery_images << gallery_image
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
respond_to do |format|
|
||||
|
||||
format.js
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
def edit
|
||||
@gallery_image = GalleryImage.find(params[:id])
|
||||
|
||||
if request.xhr?
|
||||
render :layout => false
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def show
|
||||
|
||||
|
||||
end
|
||||
|
||||
def update
|
||||
@gallery_image = GalleryImage.find(params[:id])
|
||||
respond_to do |format|
|
||||
if @gallery_image.update_attributes(params[:gallery_image])
|
||||
|
||||
format.js
|
||||
else
|
||||
format.html { render :action => "edit", :layout => false}
|
||||
format.js { render :action => "edit" }
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
|
||||
@gallery_image = GalleryImage.find(params[:id])
|
||||
@gallery_image.destroy
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
end
|
116
app/controllers/portlet/html_contents_controller.rb
Normal file
116
app/controllers/portlet/html_contents_controller.rb
Normal file
@ -0,0 +1,116 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
class Portlet::HtmlContentsController < ApplicationController
|
||||
layout "admin"
|
||||
|
||||
def new
|
||||
@html_content = HtmlContent.new
|
||||
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
if request.xhr?
|
||||
render :layout => false
|
||||
end
|
||||
}
|
||||
format.js { render :template => "portlet/shared/new" }
|
||||
end
|
||||
end
|
||||
|
||||
def create
|
||||
@html_content = HtmlContent.new(params[:html_content])
|
||||
|
||||
respond_to do |format|
|
||||
if @html_content.save
|
||||
|
||||
|
||||
@portlet = Portlet.create(:position => params[:position], :block_id => params[:block_id], :content => @html_content)
|
||||
|
||||
|
||||
if @portlet.block and @portlet.block.blockable
|
||||
@portlet.block.blockable.updated_at = Time.now
|
||||
@portlet.block.blockable.save
|
||||
if @portlet.block.blockable_type == "Page"
|
||||
|
||||
to_my_log("[Page_"+@portlet.block.blockable.id.to_s+"] "+"Modification de la page "+@portlet.block.blockable.title.to_s+" (ajout d'un portlet)")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
format.html { redirect_to([:admin, @portlet.block.blockable], :notice => 'Elément ajouté avec succès.') }
|
||||
format.js { render :template => "portlet/shared/create" }
|
||||
else
|
||||
format.html { render :action => "new" }
|
||||
format.js { render :template => "portlet/shared/new" }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
@html_content = HtmlContent.find(params[:id])
|
||||
@portlet = Portlet.find(params[:portlet_id])
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
if request.xhr?
|
||||
render :template => "portlet/shared/edit", :layout => false
|
||||
end
|
||||
}
|
||||
format.js { render :template => "portlet/shared/edit" }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def show
|
||||
|
||||
|
||||
end
|
||||
|
||||
def update
|
||||
@html_content = HtmlContent.find(params[:id])
|
||||
@portlet = Portlet.find(params[:portlet_id])
|
||||
|
||||
respond_to do |format|
|
||||
if @html_content.update_attributes(params[:html_content])
|
||||
if @portlet.block and @portlet.block.blockable
|
||||
@portlet.block.blockable.updated_at = Time.now
|
||||
@portlet.block.blockable.save
|
||||
if @portlet.block.blockable_type == "Page"
|
||||
|
||||
to_my_log("[Page_"+@portlet.block.blockable.id.to_s+"] "+"Modification de la page "+@portlet.block.blockable.title.to_s+" (modification d'un portlet)")
|
||||
end
|
||||
end
|
||||
|
||||
format.html { redirect_to([:admin, @portlet.block.blockable], :notice => 'Titre mis à jour.') }
|
||||
format.js { render :template => "portlet/shared/update" }
|
||||
else
|
||||
format.html { render :action => "portlet/shared/edit" }
|
||||
format.js { render :template => "portlet/shared/edit" }
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@portlet = Portlet.find(params[:portlet_id])
|
||||
@html_content = HtmlContent.find(params[:id])
|
||||
@html_content.destroy
|
||||
|
||||
if @portlet.block and @portlet.block.blockable
|
||||
@portlet.block.blockable.updated_at = Time.now
|
||||
@portlet.block.blockable.save
|
||||
if @portlet.block.blockable_type == "Page"
|
||||
|
||||
to_my_log("[Page_"+@portlet.block.blockable.id.to_s+"] "+"Modification de la page "+@portlet.block.blockable.title.to_s+" (suppression d'un portlet)")
|
||||
end
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.html {}
|
||||
format.js { render :template => "portlet/shared/destroy" }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
100
app/controllers/portlet/image_contents_controller.rb
Normal file
100
app/controllers/portlet/image_contents_controller.rb
Normal file
@ -0,0 +1,100 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
class Portlet::ImageContentsController < ApplicationController
|
||||
layout "admin"
|
||||
|
||||
def new
|
||||
@image_content = ImageContent.new
|
||||
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
if request.xhr?
|
||||
render :layout => false
|
||||
end
|
||||
}
|
||||
format.js { render :template => "portlet/shared/new" }
|
||||
end
|
||||
end
|
||||
|
||||
def create
|
||||
@image_content = ImageContent.new(params[:image_content])
|
||||
|
||||
respond_to do |format|
|
||||
if @image_content.save
|
||||
|
||||
|
||||
@portlet = Portlet.create(:content => @image_content)
|
||||
|
||||
|
||||
|
||||
|
||||
format.html { redirect_to([:admin, @portlet.block.blockable], :notice => 'Elément ajouté avec succès.') }
|
||||
format.js { render :template => "portlet/shared/create" }
|
||||
else
|
||||
format.html { render :action => "new" }
|
||||
format.js { render :template => "portlet/shared/new" }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
@image_content = ImageContent.find(params[:id])
|
||||
@portlet = Portlet.find(params[:portlet_id])
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
if request.xhr?
|
||||
render :template => "portlet/shared/edit", :layout => false
|
||||
end
|
||||
}
|
||||
format.js { render :template => "portlet/shared/edit" }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def show
|
||||
|
||||
|
||||
end
|
||||
|
||||
def update
|
||||
@image_content = ImageContent.find(params[:id])
|
||||
@portlet = @image_content.portlet
|
||||
|
||||
respond_to do |format|
|
||||
if @image_content.update_attributes(params[:image_content])
|
||||
if @portlet.block and @portlet.block.blockable
|
||||
@portlet.block.blockable.updated_at = Time.now
|
||||
@portlet.block.blockable.save
|
||||
if @portlet.block.blockable_type == "Page"
|
||||
|
||||
to_my_log("[Page_"+@portlet.block.blockable.id.to_s+"] "+"Modification de la page "+@portlet.block.blockable.title.to_s+" (modification d'un portlet)")
|
||||
end
|
||||
end
|
||||
|
||||
format.html { redirect_to([:admin, @portlet.block.blockable], :notice => 'Titre mis à jour.') }
|
||||
format.js { render :template => "portlet/shared/update" }
|
||||
else
|
||||
format.html { render :action => "portlet/shared/edit" }
|
||||
format.js { render :template => "portlet/shared/edit" }
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@portlet = Portlet.find(params[:portlet_id])
|
||||
@image_content = ImageContent.find(params[:id])
|
||||
@image_content.destroy
|
||||
|
||||
|
||||
|
||||
respond_to do |format|
|
||||
format.html {}
|
||||
format.js { render :template => "portlet/shared/destroy" }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
112
app/controllers/portlet/img_link_contents_controller.rb
Normal file
112
app/controllers/portlet/img_link_contents_controller.rb
Normal file
@ -0,0 +1,112 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
class Portlet::ImgLinkContentsController < ApplicationController
|
||||
layout "admin"
|
||||
|
||||
def new
|
||||
@img_link_content = ImgLinkContent.new
|
||||
|
||||
|
||||
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
if request.xhr?
|
||||
render :layout => false
|
||||
end
|
||||
}
|
||||
format.js { render :template => "portlet/shared/new" }
|
||||
end
|
||||
end
|
||||
|
||||
def create
|
||||
|
||||
|
||||
|
||||
|
||||
@img_link_content = ImgLinkContent.new(params[:img_link_content])
|
||||
|
||||
|
||||
|
||||
respond_to do |format|
|
||||
if @img_link_content.save
|
||||
|
||||
|
||||
@portlet = Portlet.create(:content => @img_link_content)
|
||||
|
||||
|
||||
format.html { redirect_to([:admin, @portlet.block.blockable], :notice => 'Elément ajouté avec succès.') }
|
||||
format.js { render :template => "portlet/shared/create" }
|
||||
else
|
||||
format.html { render :action => "new" }
|
||||
format.js { render :template => "portlet/shared/new" }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
@img_link_content = ImgLinkContent.find(params[:id])
|
||||
@portlet = @img_link_content.portlet
|
||||
|
||||
puts "TESt"
|
||||
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
if request.xhr?
|
||||
render :template => "portlet/shared/edit", :layout => false
|
||||
end
|
||||
}
|
||||
format.js { render :template => "portlet/shared/edit" }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def show
|
||||
|
||||
|
||||
end
|
||||
|
||||
def update
|
||||
@img_link_content = ImgLinkContent.find(params[:id])
|
||||
@portlet = @img_link_content.portlet
|
||||
|
||||
|
||||
|
||||
|
||||
respond_to do |format|
|
||||
if @img_link_content.update_attributes(params[:img_link_content])
|
||||
|
||||
|
||||
format.html { redirect_to([:admin, @portlet.block.blockable], :notice => 'Titre mis à jour.') }
|
||||
format.js { render :template => "portlet/shared/update" }
|
||||
else
|
||||
format.html { render :action => "portlet/shared/edit" }
|
||||
format.js { render :template => "portlet/shared/edit" }
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@portlet = Portlet.find(params[:portlet_id])
|
||||
@img_link_content = ImgLinkContent.find(params[:id])
|
||||
@img_link_content.destroy
|
||||
|
||||
if @portlet.block and @portlet.block.blockable
|
||||
@portlet.block.blockable.updated_at = Time.now
|
||||
@portlet.block.blockable.save
|
||||
if @portlet.block.blockable_type == "Page"
|
||||
|
||||
to_my_log("[Page_"+@portlet.block.blockable.id.to_s+"] "+"Modification de la page "+@portlet.block.blockable.title.to_s+" (suppression d'un portlet)")
|
||||
end
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.html {}
|
||||
format.js { render :template => "portlet/shared/destroy" }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
110
app/controllers/portlet/link_contents_controller.rb
Normal file
110
app/controllers/portlet/link_contents_controller.rb
Normal file
@ -0,0 +1,110 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
class Portlet::LinkContentsController < ApplicationController
|
||||
layout "admin"
|
||||
|
||||
def new
|
||||
@link_content = LinkContent.new
|
||||
|
||||
|
||||
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
if request.xhr?
|
||||
render :layout => false
|
||||
end
|
||||
}
|
||||
format.js { render :template => "portlet/shared/new" }
|
||||
end
|
||||
end
|
||||
|
||||
def create
|
||||
|
||||
|
||||
|
||||
|
||||
@link_content = LinkContent.new(params[:link_content])
|
||||
|
||||
|
||||
|
||||
respond_to do |format|
|
||||
if @link_content.save
|
||||
|
||||
|
||||
@portlet = Portlet.create(:content => @link_content)
|
||||
|
||||
|
||||
format.html { redirect_to([:admin, @portlet.block.blockable], :notice => 'Elément ajouté avec succès.') }
|
||||
format.js { render :template => "portlet/shared/create" }
|
||||
else
|
||||
format.html { render :action => "new" }
|
||||
format.js { render :template => "portlet/shared/new" }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
@link_content = LinkContent.find(params[:id])
|
||||
@portlet = @link_content.portlet
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
if request.xhr?
|
||||
render :template => "portlet/shared/edit", :layout => false
|
||||
end
|
||||
}
|
||||
format.js { render :template => "portlet/shared/edit" }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def show
|
||||
|
||||
|
||||
end
|
||||
|
||||
def update
|
||||
@link_content = LinkContent.find(params[:id])
|
||||
@portlet = @link_content.portlet
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
respond_to do |format|
|
||||
if @link_content.update_attributes(params[:link_content])
|
||||
|
||||
|
||||
format.html { redirect_to([:admin, @portlet.block.blockable], :notice => 'Titre mis à jour.') }
|
||||
format.js { render :template => "portlet/shared/update" }
|
||||
else
|
||||
format.html { render :action => "portlet/shared/edit" }
|
||||
format.js { render :template => "portlet/shared/edit" }
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@portlet = Portlet.find(params[:portlet_id])
|
||||
@link_content = LinkContent.find(params[:id])
|
||||
@link_content.destroy
|
||||
|
||||
if @portlet.block and @portlet.block.blockable
|
||||
@portlet.block.blockable.updated_at = Time.now
|
||||
@portlet.block.blockable.save
|
||||
if @portlet.block.blockable_type == "Page"
|
||||
|
||||
to_my_log("[Page_"+@portlet.block.blockable.id.to_s+"] "+"Modification de la page "+@portlet.block.blockable.title.to_s+" (suppression d'un portlet)")
|
||||
end
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.html {}
|
||||
format.js { render :template => "portlet/shared/destroy" }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
116
app/controllers/portlet/map_contents_controller.rb
Normal file
116
app/controllers/portlet/map_contents_controller.rb
Normal file
@ -0,0 +1,116 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
class Portlet::MapContentsController < ApplicationController
|
||||
layout "admin"
|
||||
|
||||
def new
|
||||
@map_content = MapContent.new(:zoom => 12, :view => 1)
|
||||
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
if request.xhr?
|
||||
render :layout => false
|
||||
end
|
||||
}
|
||||
format.js { render :template => "portlet/shared/new" }
|
||||
end
|
||||
end
|
||||
|
||||
def create
|
||||
@map_content = MapContent.new(params[:map_content])
|
||||
|
||||
respond_to do |format|
|
||||
if @map_content.save
|
||||
|
||||
|
||||
@portlet = Portlet.create(:position => params[:position], :block_id => params[:block_id], :content => @map_content)
|
||||
|
||||
|
||||
if @portlet.block and @portlet.block.blockable
|
||||
@portlet.block.blockable.updated_at = Time.now
|
||||
@portlet.block.blockable.save
|
||||
if @portlet.block.blockable_type == "Page"
|
||||
|
||||
to_my_log("[Page_"+@portlet.block.blockable.id.to_s+"] "+"Modification de la page "+@portlet.block.blockable.title.to_s+" (ajout d'un portlet)")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
format.html { redirect_to([:admin, @portlet.block.blockable], :notice => 'Elément ajouté avec succès.') }
|
||||
format.js { render :template => "portlet/shared/create" }
|
||||
else
|
||||
format.html { render :action => "new" }
|
||||
format.js { render :template => "portlet/shared/new" }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
@map_content = MapContent.find(params[:id])
|
||||
@portlet = @map_content.portlet
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
if request.xhr?
|
||||
render :template => "portlet/shared/edit", :layout => false
|
||||
end
|
||||
}
|
||||
format.js { render :template => "portlet/shared/edit" }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def show
|
||||
|
||||
|
||||
end
|
||||
|
||||
def update
|
||||
@map_content = MapContent.find(params[:id])
|
||||
@portlet = @map_content.portlet
|
||||
|
||||
respond_to do |format|
|
||||
if @map_content.update_attributes(params[:map_content])
|
||||
if @portlet.block and @portlet.block.blockable
|
||||
@portlet.block.blockable.updated_at = Time.now
|
||||
@portlet.block.blockable.save
|
||||
if @portlet.block.blockable_type == "Page"
|
||||
|
||||
to_my_log("[Page_"+@portlet.block.blockable.id.to_s+"] "+"Modification de la page "+@portlet.block.blockable.title.to_s+" (modification d'un portlet)")
|
||||
end
|
||||
end
|
||||
|
||||
format.html { redirect_to([:admin, @portlet.block.blockable], :notice => 'Titre mis à jour.') }
|
||||
format.js { render :template => "portlet/shared/update" }
|
||||
else
|
||||
format.html { render :action => "portlet/shared/edit" }
|
||||
format.js { render :template => "portlet/shared/edit" }
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@portlet = Portlet.find(params[:portlet_id])
|
||||
@map_content = MapContent.find(params[:id])
|
||||
@map_content.destroy
|
||||
|
||||
if @portlet.block and @portlet.block.blockable
|
||||
@portlet.block.blockable.updated_at = Time.now
|
||||
@portlet.block.blockable.save
|
||||
if @portlet.block.blockable_type == "Page"
|
||||
|
||||
to_my_log("[Page_"+@portlet.block.blockable.id.to_s+"] "+"Modification de la page "+@portlet.block.blockable.title.to_s+" (suppression d'un portlet)")
|
||||
end
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.html {}
|
||||
format.js { render :template => "portlet/shared/destroy" }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
122
app/controllers/portlet/portlets_controller.rb
Normal file
122
app/controllers/portlet/portlets_controller.rb
Normal file
@ -0,0 +1,122 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
class Portlet::PortletsController < ApplicationController
|
||||
layout "admin"
|
||||
|
||||
|
||||
|
||||
def new
|
||||
@portlet = Portlet.new(:block_id => params[:block_id])
|
||||
|
||||
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
if request.xhr?
|
||||
render :layout => false
|
||||
end
|
||||
}
|
||||
format.js
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
def show
|
||||
@portlet = Portlet.find(params[:id])
|
||||
end
|
||||
|
||||
|
||||
|
||||
def edit
|
||||
@portlet = Portlet.find(params[:id])
|
||||
if request.xhr?
|
||||
render :layout => false
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
def update
|
||||
@portlet = Portlet.find(params[:id])
|
||||
|
||||
flash[:notice] = "Le contenu à été mis à jour avec succès."
|
||||
if @portlet.update_attributes(params[:portlet])
|
||||
|
||||
if @portlet.block and @portlet.block.blockable
|
||||
@portlet.block.blockable.updated_at = Time.now
|
||||
@portlet.block.blockable.save
|
||||
if @portlet.block.blockable_type == "Page"
|
||||
|
||||
to_my_log("[Page_"+@portlet.block.blockable.id.to_s+"] "+"Modification de la page "+@portlet.block.blockable.title.to_s)
|
||||
end
|
||||
end
|
||||
render :action => "update"
|
||||
|
||||
else
|
||||
render :action => "edit"
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
def destroy
|
||||
@portlet = Portlet.find(params[:id])
|
||||
@portlet.destroy
|
||||
flash[:notice] = "Le contenu à été supprimé avec succès."
|
||||
if @portlet.block and @portlet.block.blockable
|
||||
@portlet.block.blockable.updated_at = Time.now
|
||||
@portlet.block.blockable.save
|
||||
end
|
||||
end
|
||||
|
||||
def ajax_create
|
||||
@t = params[:type]
|
||||
if @t == "Title"
|
||||
@content = TitleContent.new()
|
||||
elsif @t == "Text"
|
||||
@content = TextContent.new()
|
||||
elsif @t == "Image"
|
||||
@content = ImageContent.new()
|
||||
elsif @t == "Gallery"
|
||||
@content = GalleryContent.new()
|
||||
elsif @t == "Link"
|
||||
@content = LinkContent.new()
|
||||
elsif @t == "Break"
|
||||
@content = BreakContent.new()
|
||||
elsif @t == "Html"
|
||||
@content = HtmlContent.new()
|
||||
elsif @t == "Download"
|
||||
@content = DownloadContent.new()
|
||||
elsif @t == "DynamicContent"
|
||||
@content = DynamicContent.new()
|
||||
end
|
||||
@portlet = Portlet.new(:block_id => params[:block_id])
|
||||
@content.portlets << @portlet
|
||||
@content.save!
|
||||
if @portlet.block and @portlet.block.blockable
|
||||
@portlet.block.blockable.updated_at = Time.now
|
||||
@portlet.block.blockable.save
|
||||
end
|
||||
flash[:notice] = "Le contenu à été créé avec succès."
|
||||
end
|
||||
|
||||
def reorder
|
||||
|
||||
params[:blocks].each do |index, block|
|
||||
|
||||
block_id = block["block_id"].to_i
|
||||
i = 0
|
||||
if block["block_portlet_ids"].kind_of?(Array)
|
||||
block["block_portlet_ids"].each do |portlet_id|
|
||||
i += 1
|
||||
Portlet.find(portlet_id.to_i).update_attributes(:position => i, :block_id => block_id)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
render :inline => "ok"
|
||||
|
||||
end
|
||||
end
|
35
app/controllers/portlet/table_cols_controller.rb
Normal file
35
app/controllers/portlet/table_cols_controller.rb
Normal file
@ -0,0 +1,35 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
class Portlet::TableColsController < ApplicationController
|
||||
def create
|
||||
|
||||
@table_content = TableContent.find(params[:table_content_id])
|
||||
|
||||
@table_content.table_rows.each do |table_row|
|
||||
CelTable.create( :position => params[:position], :table_row_id => table_row.id)
|
||||
|
||||
|
||||
end
|
||||
@table_content.nbr_cols = @table_content.nbr_cols + 1
|
||||
@table_content.save
|
||||
end
|
||||
|
||||
def update
|
||||
end
|
||||
|
||||
def destroy
|
||||
@table_content = TableContent.find(params[:table_content_id])
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
CelTable.where(:table_row_id => @table_content.table_row_ids,:position => params[:id] ).each do |cel_table|
|
||||
cel_table.destroy
|
||||
|
||||
end
|
||||
|
||||
@table_content.nbr_cols = @table_content.nbr_cols - 1
|
||||
@table_content.save
|
||||
end
|
||||
|
||||
end
|
108
app/controllers/portlet/table_contents_controller.rb
Normal file
108
app/controllers/portlet/table_contents_controller.rb
Normal file
@ -0,0 +1,108 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
class Portlet::TableContentsController < ApplicationController
|
||||
layout "admin"
|
||||
|
||||
def new
|
||||
@table_content = TableContent.new
|
||||
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
if request.xhr?
|
||||
render :layout => false
|
||||
end
|
||||
}
|
||||
format.js { render :template => "portlet/shared/new" }
|
||||
end
|
||||
end
|
||||
|
||||
def create
|
||||
@table_content = TableContent.new(params[:table_content])
|
||||
|
||||
respond_to do |format|
|
||||
if @table_content.save
|
||||
|
||||
|
||||
@portlet = Portlet.create(:position => params[:position], :block_id => params[:block_id], :content => @table_content)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
format.html { redirect_to([:admin, @portlet.block.blockable], :notice => 'Elément ajouté avec succès.') }
|
||||
format.js { render :template => "portlet/shared/create" }
|
||||
else
|
||||
format.html { render :action => "new" }
|
||||
format.js { render :template => "portlet/shared/new" }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
@table_content = TableContent.find(params[:id])
|
||||
@portlet = Portlet.find(params[:portlet_id])
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
if request.xhr?
|
||||
render :template => "portlet/shared/edit", :layout => false
|
||||
end
|
||||
}
|
||||
format.js { render :template => "portlet/shared/edit" }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def show
|
||||
|
||||
|
||||
end
|
||||
|
||||
def update
|
||||
@table_content = TableContent.find(params[:id])
|
||||
@portlet = Portlet.find(params[:portlet_id])
|
||||
|
||||
respond_to do |format|
|
||||
if @table_content.update_attributes(params[:table_content])
|
||||
if @portlet.block and @portlet.block.blockable
|
||||
@portlet.block.blockable.updated_at = Time.now
|
||||
@portlet.block.blockable.save
|
||||
if @portlet.block.blockable_type == "Page"
|
||||
|
||||
to_my_log("[Page_"+@portlet.block.blockable.id.to_s+"] "+"Modification de la page "+@portlet.block.blockable.title.to_s+" (modification d'un portlet)")
|
||||
end
|
||||
end
|
||||
|
||||
format.html { redirect_to([:admin, @portlet.block.blockable], :notice => 'Titre mis à jour.') }
|
||||
format.js { render :template => "portlet/shared/update" }
|
||||
else
|
||||
format.html { render :action => "portlet/shared/edit" }
|
||||
format.js { render :template => "portlet/shared/edit" }
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@portlet = Portlet.find(params[:portlet_id])
|
||||
@table_content = TableContent.find(params[:id])
|
||||
@table_content.destroy
|
||||
|
||||
if @portlet.block and @portlet.block.blockable
|
||||
@portlet.block.blockable.updated_at = Time.now
|
||||
@portlet.block.blockable.save
|
||||
if @portlet.block.blockable_type == "Page"
|
||||
|
||||
to_my_log("[Page_"+@portlet.block.blockable.id.to_s+"] "+"Modification de la page "+@portlet.block.blockable.title.to_s+" (suppression d'un portlet)")
|
||||
end
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.html {}
|
||||
format.js { render :template => "portlet/shared/destroy" }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
106
app/controllers/portlet/table_rows_controller.rb
Normal file
106
app/controllers/portlet/table_rows_controller.rb
Normal file
@ -0,0 +1,106 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
class Portlet::TableRowsController < ApplicationController
|
||||
layout "admin"
|
||||
|
||||
def new
|
||||
@title_content = TitleContent.new
|
||||
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
if request.xhr?
|
||||
render :layout => false
|
||||
end
|
||||
}
|
||||
format.js { render :template => "portlet/shared/new" }
|
||||
end
|
||||
end
|
||||
|
||||
def create
|
||||
@table_row = TableRow.new(params[:table_row])
|
||||
|
||||
respond_to do |format|
|
||||
if @table_row.save
|
||||
|
||||
@table = @table_row.table_content
|
||||
@table.nbr_cols.times do
|
||||
cel_table = CelTable.new
|
||||
@table_row.cel_tables << cel_table
|
||||
end
|
||||
nbr_past = @table.nbr_rows
|
||||
@table.nbr_rows = nbr_past +1
|
||||
@table.save
|
||||
|
||||
|
||||
@portlet = Portlet.find(@table.portlet.id)
|
||||
|
||||
#format.html { redirect_to([:admin, @portlet.block.blockable], :notice => 'Elément ajouté avec succès.') }
|
||||
format.js
|
||||
else
|
||||
#format.html { render :action => "new" }
|
||||
#format.js { render :template => "portlet/shared/new" }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
@title_content = TitleContent.find(params[:id])
|
||||
@portlet = Portlet.find(params[:portlet_id])
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
if request.xhr?
|
||||
render :template => "portlet/shared/edit", :layout => false
|
||||
end
|
||||
}
|
||||
format.js { render :template => "portlet/shared/edit" }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def show
|
||||
|
||||
|
||||
end
|
||||
|
||||
def update
|
||||
@title_content = TitleContent.find(params[:id])
|
||||
@portlet = Portlet.find(params[:portlet_id])
|
||||
|
||||
respond_to do |format|
|
||||
if @title_content.update_attributes(params[:title_content])
|
||||
if @portlet.block and @portlet.block.blockable
|
||||
@portlet.block.blockable.updated_at = Time.now
|
||||
@portlet.block.blockable.save
|
||||
if @portlet.block.blockable_type == "Page"
|
||||
|
||||
to_my_log("[Page_"+@portlet.block.blockable.id.to_s+"] "+"Modification de la page "+@portlet.block.blockable.title.to_s+" (modification d'un portlet)")
|
||||
end
|
||||
end
|
||||
|
||||
format.html { redirect_to([:admin, @portlet.block.blockable], :notice => 'Titre mis à jour.') }
|
||||
format.js { render :template => "portlet/shared/update" }
|
||||
else
|
||||
format.html { render :action => "portlet/shared/edit" }
|
||||
format.js { render :template => "portlet/shared/edit" }
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
|
||||
@table_row = TableRow.find(params[:id])
|
||||
@table_content = @table_row.table_content
|
||||
@table_row.destroy
|
||||
|
||||
|
||||
respond_to do |format|
|
||||
format.html {}
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
116
app/controllers/portlet/text_contents_controller.rb
Normal file
116
app/controllers/portlet/text_contents_controller.rb
Normal file
@ -0,0 +1,116 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
class Portlet::TextContentsController < ApplicationController
|
||||
layout "admin"
|
||||
|
||||
def new
|
||||
@text_content = TextContent.new
|
||||
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
if request.xhr?
|
||||
render :layout => false
|
||||
end
|
||||
}
|
||||
format.js { render :template => "portlet/shared/new" }
|
||||
end
|
||||
end
|
||||
|
||||
def create
|
||||
@text_content = TextContent.new(params[:text_content])
|
||||
|
||||
respond_to do |format|
|
||||
if @text_content.save
|
||||
|
||||
|
||||
@portlet = Portlet.create(:position => params[:position], :block_id => params[:block_id], :content => @text_content)
|
||||
|
||||
|
||||
if @portlet.block and @portlet.block.blockable
|
||||
@portlet.block.blockable.updated_at = Time.now
|
||||
@portlet.block.blockable.save
|
||||
if @portlet.block.blockable_type == "Page"
|
||||
|
||||
to_my_log("[Page_"+@portlet.block.blockable.id.to_s+"] "+"Modification de la page "+@portlet.block.blockable.title.to_s+" (ajout d'un portlet)")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
format.html { redirect_to([:admin, @portlet.block.blockable], :notice => 'Elément ajouté avec succès.') }
|
||||
format.js { render :template => "portlet/shared/create" }
|
||||
else
|
||||
format.html { render :action => "new" }
|
||||
format.js { render :template => "portlet/shared/new" }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
@text_content = TextContent.find(params[:id])
|
||||
@portlet = Portlet.find(params[:portlet_id])
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
if request.xhr?
|
||||
render :template => "portlet/shared/edit", :layout => false
|
||||
end
|
||||
}
|
||||
format.js { render :template => "portlet/shared/edit" }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def show
|
||||
|
||||
|
||||
end
|
||||
|
||||
def update
|
||||
@text_content = TextContent.find(params[:id])
|
||||
@portlet = Portlet.find(params[:portlet_id])
|
||||
|
||||
respond_to do |format|
|
||||
if @text_content.update_attributes(params[:text_content])
|
||||
if @portlet.block and @portlet.block.blockable
|
||||
@portlet.block.blockable.updated_at = Time.now
|
||||
@portlet.block.blockable.save
|
||||
if @portlet.block.blockable_type == "Page"
|
||||
|
||||
to_my_log("[Page_"+@portlet.block.blockable.id.to_s+"] "+"Modification de la page "+@portlet.block.blockable.title.to_s+" (modification d'un portlet)")
|
||||
end
|
||||
end
|
||||
|
||||
format.html { redirect_to([:admin, @portlet.block.blockable], :notice => 'Titre mis à jour.') }
|
||||
format.js { render :template => "portlet/shared/update" }
|
||||
else
|
||||
format.html { render :action => "portlet/shared/edit" }
|
||||
format.js { render :template => "portlet/shared/edit" }
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@portlet = Portlet.find(params[:portlet_id])
|
||||
@text_content = TextContent.find(params[:id])
|
||||
@text_content.destroy
|
||||
|
||||
if @portlet.block and @portlet.block.blockable
|
||||
@portlet.block.blockable.updated_at = Time.now
|
||||
@portlet.block.blockable.save
|
||||
if @portlet.block.blockable_type == "Page"
|
||||
|
||||
to_my_log("[Page_"+@portlet.block.blockable.id.to_s+"] "+"Modification de la page "+@portlet.block.blockable.title.to_s+" (suppression d'un portlet)")
|
||||
end
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.html {}
|
||||
format.js { render :template => "portlet/shared/destroy" }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
116
app/controllers/portlet/title_contents_controller.rb
Normal file
116
app/controllers/portlet/title_contents_controller.rb
Normal file
@ -0,0 +1,116 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
class Portlet::TitleContentsController < ApplicationController
|
||||
layout "admin"
|
||||
|
||||
def new
|
||||
@title_content = TitleContent.new
|
||||
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
if request.xhr?
|
||||
render :layout => false
|
||||
end
|
||||
}
|
||||
format.js { render :template => "portlet/shared/new" }
|
||||
end
|
||||
end
|
||||
|
||||
def create
|
||||
@title_content = TitleContent.new(params[:title_content])
|
||||
|
||||
respond_to do |format|
|
||||
if @title_content.save
|
||||
|
||||
|
||||
@portlet = Portlet.create(:position => params[:position], :block_id => params[:block_id], :content => @title_content)
|
||||
|
||||
|
||||
if @portlet.block and @portlet.block.blockable
|
||||
@portlet.block.blockable.updated_at = Time.now
|
||||
@portlet.block.blockable.save
|
||||
if @portlet.block.blockable_type == "Page"
|
||||
|
||||
to_my_log("[Page_"+@portlet.block.blockable.id.to_s+"] "+"Modification de la page "+@portlet.block.blockable.title.to_s+" (ajout d'un portlet)")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
format.html { redirect_to([:admin, @portlet.block.blockable], :notice => 'Elément ajouté avec succès.') }
|
||||
format.js { render :template => "portlet/shared/create" }
|
||||
else
|
||||
format.html { render :action => "new" }
|
||||
format.js { render :template => "portlet/shared/new" }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
@title_content = TitleContent.find(params[:id])
|
||||
@portlet = Portlet.find(params[:portlet_id])
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
if request.xhr?
|
||||
render :template => "portlet/shared/edit", :layout => false
|
||||
end
|
||||
}
|
||||
format.js { render :template => "portlet/shared/edit" }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def show
|
||||
|
||||
|
||||
end
|
||||
|
||||
def update
|
||||
@title_content = TitleContent.find(params[:id])
|
||||
@portlet = Portlet.find(params[:portlet_id])
|
||||
|
||||
respond_to do |format|
|
||||
if @title_content.update_attributes(params[:title_content])
|
||||
if @portlet.block and @portlet.block.blockable
|
||||
@portlet.block.blockable.updated_at = Time.now
|
||||
@portlet.block.blockable.save
|
||||
if @portlet.block.blockable_type == "Page"
|
||||
|
||||
to_my_log("[Page_"+@portlet.block.blockable.id.to_s+"] "+"Modification de la page "+@portlet.block.blockable.title.to_s+" (modification d'un portlet)")
|
||||
end
|
||||
end
|
||||
|
||||
format.html { redirect_to([:admin, @portlet.block.blockable], :notice => 'Titre mis à jour.') }
|
||||
format.js { render :template => "portlet/shared/update" }
|
||||
else
|
||||
format.html { render :action => "portlet/shared/edit" }
|
||||
format.js { render :template => "portlet/shared/edit" }
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@portlet = Portlet.find(params[:portlet_id])
|
||||
@title_content = TitleContent.find(params[:id])
|
||||
@title_content.destroy
|
||||
|
||||
if @portlet.block and @portlet.block.blockable
|
||||
@portlet.block.blockable.updated_at = Time.now
|
||||
@portlet.block.blockable.save
|
||||
if @portlet.block.blockable_type == "Page"
|
||||
|
||||
to_my_log("[Page_"+@portlet.block.blockable.id.to_s+"] "+"Modification de la page "+@portlet.block.blockable.title.to_s+" (suppression d'un portlet)")
|
||||
end
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.html {}
|
||||
format.js { render :template => "portlet/shared/destroy" }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
69
app/controllers/public/inscrits_controller.rb
Normal file
69
app/controllers/public/inscrits_controller.rb
Normal file
@ -0,0 +1,69 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
class Public::InscritsController < ApplicationController
|
||||
layout "front"
|
||||
|
||||
|
||||
|
||||
|
||||
# GET /inscrits/new
|
||||
# GET /inscrits/new.xml
|
||||
def new
|
||||
@inscrit = Inscrit.new
|
||||
|
||||
respond_to do |format|
|
||||
format.html # new.html.erb
|
||||
format.xml { render :xml => @inscrit }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
# POST /inscrits
|
||||
# POST /inscrits.xml
|
||||
def create
|
||||
@inscrit = Inscrit.new(params[:inscrit])
|
||||
|
||||
|
||||
if @inscrit.save
|
||||
redirect_to(:back, :notice => "Votre inscription à bien été prise en compte, merci de bien vouloir confirmer celle-ci en cliquant sur le lien du mail qui vient de vous être envoyé.")
|
||||
General.confirm_inscription(@inscrit).deliver
|
||||
elsif
|
||||
@test_ins = Inscrit.find_by_email(params[:inscrit][:email])
|
||||
if @test_ins and @test_ins.enabled != true
|
||||
redirect_to(:back, :notice => "Votre inscription à bien été prise en compte, merci de bien vouloir confirmer celle-ci en cliquant sur le lien du mail qui vient de vous être envoyé.")
|
||||
General.confirm_inscription(@test_ins).deliver
|
||||
elsif @test_ins
|
||||
redirect_to(:back, :notice => "Vous êtes déjà inscrit à notre newsletter.")
|
||||
|
||||
end
|
||||
|
||||
else
|
||||
redirect_to(:back, :notice => "L'adresse mail n'est pas valide.")
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def verify_key
|
||||
@inscrit = Inscrit.find_by_verify_key(params[:id])
|
||||
@inscrit.enabled = true
|
||||
@inscrit.save
|
||||
General.valide_inscription(@inscrit).deliver
|
||||
|
||||
redirect_to("/", :notice => "Votre inscription a bien été validée.")
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
# DELETE /inscrits/1
|
||||
# DELETE /inscrits/1.xml
|
||||
def delete
|
||||
@inscrit = Inscrit.find(params[:id])
|
||||
@inscrit.destroy
|
||||
|
||||
General.destroy_inscription(@inscrit).deliver
|
||||
|
||||
redirect_to("/", :notice => "Votre adresse mail à bien été supprimée de nos fichiers.")
|
||||
end
|
||||
end
|
46
app/controllers/public/menu_items_controller.rb
Normal file
46
app/controllers/public/menu_items_controller.rb
Normal file
@ -0,0 +1,46 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
class Public::MenuItemsController < ApplicationController
|
||||
|
||||
layout "public"
|
||||
def show
|
||||
@menu_item = MenuItem.find_by_permalink(params[:url])
|
||||
if @menu_item
|
||||
|
||||
if !@menu_item.enabled
|
||||
redirect_to "/404.html"
|
||||
|
||||
elsif @menu_item.menu_content_type == "MenuAlias"
|
||||
if @menu_item.menu_content.menu_item
|
||||
redirect_to menu_item_path(:url => @menu_item.menu_content.menu_item_alias.permalink)
|
||||
else
|
||||
redirect_to "/404.html"
|
||||
end
|
||||
|
||||
|
||||
elsif @menu_item.menu_content_type == "Page"
|
||||
|
||||
|
||||
@page = @menu_item.menu_content
|
||||
|
||||
@title = @page.title
|
||||
|
||||
|
||||
end
|
||||
else
|
||||
redirect_to "/", :notice => "La page que vous demandez n'a pas pu être trouvée.<br /><br />Vous avez donc été redirigé sur notre page d'accueil"
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
def home
|
||||
if MenuItem.find_by_slug("accueil")
|
||||
|
||||
redirect_to "/pages/accueil.html"
|
||||
|
||||
else
|
||||
|
||||
render :file => "#{Rails.root}/public/404.html", :status => :not_found, :layout => false
|
||||
end
|
||||
end
|
||||
|
||||
end
|
35
app/helpers/admin/auto_load_div_helper.rb
Normal file
35
app/helpers/admin/auto_load_div_helper.rb
Normal file
@ -0,0 +1,35 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
module Admin::AutoLoadDivHelper
|
||||
|
||||
def auto_load_div(url,div=nil)
|
||||
|
||||
r = ""
|
||||
|
||||
|
||||
rand = (rand(99999999999999))
|
||||
|
||||
|
||||
|
||||
|
||||
content = content_tag(:div, "", :id => rand.to_s)
|
||||
|
||||
|
||||
content += content_tag(:div, image_tag('/quartz_admin/icons/load.gif'), :class => "loading")
|
||||
content += content_tag(:div, "", :class => "ajax_load_content")
|
||||
|
||||
javascript = "<script type='text/javascript'>"
|
||||
javascript += "\n//<![CDATA["
|
||||
javascript += "\n"
|
||||
javascript += 'auto_load_div($("#'+rand.to_s+'").parent());'
|
||||
|
||||
javascript += "\n //]]>"
|
||||
javascript += "\n</script>"
|
||||
|
||||
content += raw(javascript)
|
||||
|
||||
content_tag(:div, content, :"data-load" => true, :"data-url" => url, :id => div.to_s)
|
||||
|
||||
|
||||
|
||||
end
|
||||
end
|
3
app/helpers/admin/cibles_helper.rb
Normal file
3
app/helpers/admin/cibles_helper.rb
Normal file
@ -0,0 +1,3 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
module Admin::CiblesHelper
|
||||
end
|
3
app/helpers/admin/home_blocks_helper.rb
Normal file
3
app/helpers/admin/home_blocks_helper.rb
Normal file
@ -0,0 +1,3 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
module Admin::HomeBlocksHelper
|
||||
end
|
3
app/helpers/admin/home_pages_helper.rb
Normal file
3
app/helpers/admin/home_pages_helper.rb
Normal file
@ -0,0 +1,3 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
module Admin::HomePagesHelper
|
||||
end
|
19
app/helpers/admin/icon_helper.rb
Normal file
19
app/helpers/admin/icon_helper.rb
Normal file
@ -0,0 +1,19 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
module Admin::IconHelper
|
||||
|
||||
|
||||
def i(name,color=:gray_dark, size=16)
|
||||
|
||||
image_tag(i_path(name,color,size))
|
||||
end
|
||||
|
||||
def i_path(name,color=:gray_dark, size=16)
|
||||
if size.kind_of?(Integer)
|
||||
s = size.to_s+"x"+size.to_s
|
||||
else
|
||||
s = size.to_s
|
||||
end
|
||||
"/assets/iconic/"+color.to_s+"/"+name.to_s+"_"+s+".png"
|
||||
end
|
||||
|
||||
end
|
28
app/helpers/admin/javascripts_helper.rb
Normal file
28
app/helpers/admin/javascripts_helper.rb
Normal file
@ -0,0 +1,28 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
module Admin::JavascriptsHelper
|
||||
|
||||
def flash_notice()
|
||||
if flash[:notice]
|
||||
text = flash[:notice]
|
||||
flash[:notice] = nil
|
||||
return raw('flash_notice("'+escape_javascript(text)+'");')
|
||||
end
|
||||
end
|
||||
|
||||
def flash_alert()
|
||||
if flash[:alert]
|
||||
text = flash[:alert]
|
||||
flash[:alert] = nil
|
||||
return raw('flash_alert("'+escape_javascript(text)+'");')
|
||||
end
|
||||
end
|
||||
|
||||
def flashs()
|
||||
r= flash_notice().to_s
|
||||
r+= flash_alert().to_s
|
||||
|
||||
return raw(r)
|
||||
end
|
||||
|
||||
|
||||
end
|
36
app/helpers/admin/magick_order_helper.rb
Normal file
36
app/helpers/admin/magick_order_helper.rb
Normal file
@ -0,0 +1,36 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
module Admin::MagickOrderHelper
|
||||
|
||||
|
||||
def a_d(test=params[:a_d])
|
||||
if test == "DESC"
|
||||
"ASC"
|
||||
else
|
||||
"DESC"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
def link_to_sort_results(text, row)
|
||||
|
||||
new_params = {}
|
||||
|
||||
|
||||
new_params[:order] = row
|
||||
new_params[:a_d] = a_d
|
||||
params.each do |p|
|
||||
new_params[p[0].to_sym] = p[1]
|
||||
end
|
||||
new_params[:order] = row
|
||||
new_params[:a_d] = a_d
|
||||
#:page => (params[:page] if params[:page])
|
||||
|
||||
link_to( text, url_for(new_params ), :remote => true, :style => ("font-weight:bold" if row == params[:order]))
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
40
app/helpers/admin/pagination_helper.rb
Normal file
40
app/helpers/admin/pagination_helper.rb
Normal file
@ -0,0 +1,40 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
module Admin::PaginationHelper
|
||||
|
||||
|
||||
def per_page_link(per_page)
|
||||
new_params = {}
|
||||
new_params.merge!(params)
|
||||
new_params["per_page"] = per_page
|
||||
link_to per_page, new_params, :remote => true
|
||||
|
||||
end
|
||||
|
||||
def per_page_links(per_page, items)
|
||||
to_r = ""
|
||||
|
||||
|
||||
nbrs = [5, 10, 20, 50 ]
|
||||
|
||||
|
||||
max = ((items.to_i.to_f / 10).to_i*10)+10
|
||||
nbrs << max if !nbrs.include?(max)
|
||||
nbrs_to_show = nbrs
|
||||
nbrs_to_show.delete(per_page.to_i)
|
||||
nbrs.sort.each do |nbr|
|
||||
to_r += per_page_link(nbr)
|
||||
end
|
||||
to_r += "<em>"
|
||||
to_r += per_page.to_s
|
||||
to_r += "</em>"
|
||||
to_r += " lignes/pages"
|
||||
|
||||
raw(to_r)
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
end
|
3
app/helpers/admin/prescriptions_helper.rb
Normal file
3
app/helpers/admin/prescriptions_helper.rb
Normal file
@ -0,0 +1,3 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
module Admin::PrescriptionsHelper
|
||||
end
|
3
app/helpers/admin/promotions_helper.rb
Normal file
3
app/helpers/admin/promotions_helper.rb
Normal file
@ -0,0 +1,3 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
module Admin::PromotionsHelper
|
||||
end
|
3
app/helpers/admin/sliders_helper.rb
Normal file
3
app/helpers/admin/sliders_helper.rb
Normal file
@ -0,0 +1,3 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
module Admin::SlidersHelper
|
||||
end
|
3
app/helpers/admin/slides_helper.rb
Normal file
3
app/helpers/admin/slides_helper.rb
Normal file
@ -0,0 +1,3 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
module Admin::SlidesHelper
|
||||
end
|
3
app/helpers/application_helper.rb
Normal file
3
app/helpers/application_helper.rb
Normal file
@ -0,0 +1,3 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
module ApplicationHelper
|
||||
end
|
3
app/helpers/portlet/gallery_images_helper.rb
Normal file
3
app/helpers/portlet/gallery_images_helper.rb
Normal file
@ -0,0 +1,3 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
module Portlet::GalleryImagesHelper
|
||||
end
|
3
app/helpers/portlet/table_cols_helper.rb
Normal file
3
app/helpers/portlet/table_cols_helper.rb
Normal file
@ -0,0 +1,3 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
module Portlet::TableColsHelper
|
||||
end
|
3
app/helpers/public/articles_helper.rb
Normal file
3
app/helpers/public/articles_helper.rb
Normal file
@ -0,0 +1,3 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
module Public::ArticlesHelper
|
||||
end
|
3
app/helpers/public/folders_helper.rb
Normal file
3
app/helpers/public/folders_helper.rb
Normal file
@ -0,0 +1,3 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
module Public::FoldersHelper
|
||||
end
|
3
app/helpers/public/home_helper.rb
Normal file
3
app/helpers/public/home_helper.rb
Normal file
@ -0,0 +1,3 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
module Public::HomeHelper
|
||||
end
|
7
app/helpers/public/menu_items_helper.rb
Normal file
7
app/helpers/public/menu_items_helper.rb
Normal file
@ -0,0 +1,7 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
module Public::MenuItemsHelper
|
||||
def menu_item_link(menu_item)
|
||||
link_to menu_item.name, menu_item_path(:url => menu_item.url), :class => ("active" if @menu_item and (menu_item == @menu_item or @menu_item.ancestors.include?(menu_item)))
|
||||
end
|
||||
|
||||
end
|
3
app/helpers/public/prescriptions_helper.rb
Normal file
3
app/helpers/public/prescriptions_helper.rb
Normal file
@ -0,0 +1,3 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
module Public::PrescriptionsHelper
|
||||
end
|
3
app/helpers/slides_helper.rb
Normal file
3
app/helpers/slides_helper.rb
Normal file
@ -0,0 +1,3 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
module SlidesHelper
|
||||
end
|
0
app/mailers/.gitkeep
Normal file
0
app/mailers/.gitkeep
Normal file
40
app/mailers/general.rb
Normal file
40
app/mailers/general.rb
Normal file
@ -0,0 +1,40 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
class General < ActionMailer::Base
|
||||
default :from => "lamaisondelarbre@wanadoo.fr"
|
||||
self.default_url_options = {:host => HOSTNAME}
|
||||
|
||||
# Subject can be set in your I18n file at config/locales/en.yml
|
||||
# with the following lookup:
|
||||
#
|
||||
# en.general.send_newsletter.subject
|
||||
#
|
||||
def send_newsletter(email,newsletter, inscrit=nil)
|
||||
@newsletter = newsletter
|
||||
@inscrit = inscrit if inscrit
|
||||
|
||||
mail(:to => email, :subject => @newsletter.subject) do |format|
|
||||
format.html { render :action => "send_newsletter"}
|
||||
end
|
||||
end
|
||||
|
||||
def confirm_inscription(inscrit)
|
||||
@inscrit = inscrit
|
||||
mail(:to => inscrit.email, :subject => "Validation de votre inscription à la newsletter de la maison de l'arbre.") do |format|
|
||||
format.html { render :action => "confirm_inscription"}
|
||||
end
|
||||
end
|
||||
|
||||
def valide_inscription(inscrit)
|
||||
@inscrit = inscrit
|
||||
mail(:to => inscrit.email, :subject => "Votre inscription à la newsletter de la maison de l'arbre.") do |format|
|
||||
format.html { render :action => "valide_inscription"}
|
||||
end
|
||||
end
|
||||
|
||||
def destroy_inscription(inscrit)
|
||||
@inscrit = inscrit
|
||||
mail(:to => inscrit.email, :subject => "Votre inscription à la newsletter de la maison de l'arbre.") do |format|
|
||||
format.html { render :action => "destroy_inscription"}
|
||||
end
|
||||
end
|
||||
end
|
21
app/mailers/oldgeneral.rb
Normal file
21
app/mailers/oldgeneral.rb
Normal file
@ -0,0 +1,21 @@
|
||||
class General < ActionMailer::Base
|
||||
default :from => "R-Renaissance <contact@r-renaissance.fr>"
|
||||
self.default_url_options = {:host => HOSTNAME}
|
||||
|
||||
|
||||
def send_newsletter(email,newsletter )
|
||||
@newsletter = newsletter
|
||||
if email.kind_of?(String)
|
||||
email = email
|
||||
else
|
||||
@registrant = email
|
||||
email = email.email
|
||||
|
||||
end
|
||||
mail(:to => email, :subject => @newsletter.subject) do |format|
|
||||
format.html { render :action => "send_newsletter"}
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
0
app/models/.gitkeep
Normal file
0
app/models/.gitkeep
Normal file
49
app/models/ability.rb
Normal file
49
app/models/ability.rb
Normal file
@ -0,0 +1,49 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
class Ability
|
||||
include CanCan::Ability
|
||||
|
||||
def initialize(admin)
|
||||
admin ||= Admin.new # guest user
|
||||
|
||||
if admin.super_admin?
|
||||
can :manage, :all
|
||||
|
||||
else
|
||||
puts "TESTs"
|
||||
|
||||
if admin.is? :cms
|
||||
can :manage, [Article,Album,Block,Cible,DataFile,FileFolder,Folder,HomeBlock,Home,ImageFile,MenuAlias,MenuItem,MenuUrl,Menu,Page,Promotion,Slider,Slide]
|
||||
end
|
||||
if admin.is? :pharmacien
|
||||
|
||||
can :manage, [Prescription]
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
# Define abilities for the passed in user here. For example:
|
||||
#
|
||||
# user ||= User.new # guest user (not logged in)
|
||||
# if user.admin?
|
||||
# can :manage, :all
|
||||
# else
|
||||
# can :read, :all
|
||||
# end
|
||||
#
|
||||
# The first argument to `can` is the action you are giving the user permission to do.
|
||||
# If you pass :manage it will apply to every action. Other common actions here are
|
||||
# :read, :create, :update and :destroy.
|
||||
#
|
||||
# The second argument is the resource the user can perform the action on. If you pass
|
||||
# :all it will apply to every resource. Otherwise pass a Ruby class of the resource.
|
||||
#
|
||||
# The third argument is an optional hash of conditions to further filter the objects.
|
||||
# For example, here the user can only update published articles.
|
||||
#
|
||||
# can :update, Article, :published => true
|
||||
#
|
||||
# See the wiki for details: https://github.com/ryanb/cancan/wiki/Defining-Abilities
|
||||
end
|
||||
end
|
30
app/models/article.rb
Normal file
30
app/models/article.rb
Normal file
@ -0,0 +1,30 @@
|
||||
class Article < ActiveRecord::Base
|
||||
belongs_to :image_file
|
||||
validates :title, :presence => true
|
||||
validates :slug, :presence => true, :uniqueness => true
|
||||
has_one :block, :as => :blockable
|
||||
has_many :comments, :as => :commentable
|
||||
|
||||
has_many :enabled_comments,:conditions => {:enabled => true}, :source => :comments, :as => :commentable
|
||||
after_create :after_creation
|
||||
|
||||
before_validation do
|
||||
self.slug = self.slug.to_slug
|
||||
|
||||
end
|
||||
|
||||
def after_creation
|
||||
@block = Block.new(:block_name => "Contenu")
|
||||
@block.blockable = self
|
||||
@block.save
|
||||
|
||||
ContentType.all.each do |content_type|
|
||||
@block.content_types << content_type
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
scope :recents, where("enabled = ?",true ).order("published_at DESC")
|
||||
|
||||
end
|
43
app/models/authentification_admin/admin.rb
Normal file
43
app/models/authentification_admin/admin.rb
Normal file
@ -0,0 +1,43 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
class Admin < ActiveRecord::Base
|
||||
|
||||
|
||||
devise :database_authenticatable, :recoverable, :rememberable, :trackable, :validatable
|
||||
|
||||
attr_accessor :login
|
||||
|
||||
attr_accessible :login, :username, :surname, :firstname, :email, :password, :password_confirmation, :roles_mask, :roles, :super_admin
|
||||
|
||||
|
||||
validates :username, :presence => true, :uniqueness => true
|
||||
|
||||
ROLES = %w[SuperAdmin]
|
||||
|
||||
def super_admin?
|
||||
true if self.is? :SuperAdmin
|
||||
end
|
||||
|
||||
|
||||
def roles=(roles)
|
||||
self.roles_mask = (roles & ROLES).map { |r| 2**ROLES.index(r) }.sum
|
||||
end
|
||||
|
||||
def roles
|
||||
ROLES.reject do |r|
|
||||
((roles_mask || 0) & 2**ROLES.index(r)).zero?
|
||||
end
|
||||
end
|
||||
|
||||
def is?(role)
|
||||
roles.include?(role.to_s)
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def self.find_for_database_authentication(warden_conditions)
|
||||
conditions = warden_conditions.dup
|
||||
login = conditions.delete(:login)
|
||||
where(conditions).where(["username = :value OR email = :value", { :value => login }]).first
|
||||
end
|
||||
|
||||
end
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user