This commit is contained in:
Nicolas Bally 2011-05-14 13:36:30 +02:00
commit 6abf7679fd
10441 changed files with 59488 additions and 0 deletions

10
.gitignore vendored Normal file
View File

@ -0,0 +1,10 @@
.bundle
db/*.sqlite3
db/schema.rb
log/*.log
tmp/**/*
public/assets/stylesheets/*
.sass-cache/**

4
Capfile Normal file
View 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

47
Gemfile Normal file
View File

@ -0,0 +1,47 @@
source 'http://rubygems.org'
gem 'rails', '3.0.6'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
# Asset template engines
gem 'sass'
gem 'jquery-rails'
# Use unicorn as the web server
# gem 'unicorn'
# Deploy with Capistrano
gem 'capistrano'
# To use debugger
# gem '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'
gem "devise"
gem "haml", ">= 3.0.0"

135
Gemfile.lock Normal file
View File

@ -0,0 +1,135 @@
GEM
remote: http://rubygems.org/
specs:
abstract (1.0.0)
actionmailer (3.0.6)
actionpack (= 3.0.6)
mail (~> 2.2.15)
actionpack (3.0.6)
activemodel (= 3.0.6)
activesupport (= 3.0.6)
builder (~> 2.1.2)
erubis (~> 2.6.6)
i18n (~> 0.5.0)
rack (~> 1.2.1)
rack-mount (~> 0.6.14)
rack-test (~> 0.5.7)
tzinfo (~> 0.3.23)
activemodel (3.0.6)
activesupport (= 3.0.6)
builder (~> 2.1.2)
i18n (~> 0.5.0)
activerecord (3.0.6)
activemodel (= 3.0.6)
activesupport (= 3.0.6)
arel (~> 2.0.2)
tzinfo (~> 0.3.23)
activeresource (3.0.6)
activemodel (= 3.0.6)
activesupport (= 3.0.6)
activesupport (3.0.6)
acts_as_list (0.1.2)
acts_as_tree (0.1.1)
arel (2.0.9)
bcrypt-ruby (2.1.4)
builder (2.1.2)
cancan (1.6.4)
capistrano (2.6.0)
highline
net-scp (>= 1.0.0)
net-sftp (>= 2.0.0)
net-ssh (>= 2.0.14)
net-ssh-gateway (>= 1.1.0)
carrierwave (0.5.3)
activesupport (~> 3.0)
devise (1.3.4)
bcrypt-ruby (~> 2.1.2)
orm_adapter (~> 0.0.3)
warden (~> 1.0.3)
erubis (2.6.6)
abstract (>= 1.0.0)
formtastic (1.2.3)
actionpack (>= 2.3.7)
activesupport (>= 2.3.7)
i18n (~> 0.4)
haml (3.1.1)
highline (1.6.1)
i18n (0.5.0)
jquery-rails (1.0.2)
railties (~> 3.0)
thor (~> 0.14)
kaminari (0.12.4)
rails (>= 3.0.0)
mail (2.2.19)
activesupport (>= 2.3.6)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
meta_search (1.0.5)
actionpack (~> 3.0.2)
activerecord (~> 3.0.2)
activesupport (~> 3.0.2)
arel (~> 2.0.2)
mime-types (1.16)
mimetype-fu (0.1.2)
net-scp (1.0.4)
net-ssh (>= 1.99.1)
net-sftp (2.0.5)
net-ssh (>= 2.0.9)
net-ssh (2.1.4)
net-ssh-gateway (1.1.0)
net-ssh (>= 1.99.1)
orm_adapter (0.0.5)
polyglot (0.3.1)
rack (1.2.2)
rack-mount (0.6.14)
rack (>= 1.0.0)
rack-test (0.5.7)
rack (>= 1.0)
rails (3.0.6)
actionmailer (= 3.0.6)
actionpack (= 3.0.6)
activerecord (= 3.0.6)
activeresource (= 3.0.6)
activesupport (= 3.0.6)
bundler (~> 1.0)
railties (= 3.0.6)
railties (3.0.6)
actionpack (= 3.0.6)
activesupport (= 3.0.6)
rake (>= 0.8.7)
thor (~> 0.14.4)
rake (0.8.7)
rmagick (2.13.1)
sass (3.1.1)
simple-navigation (3.2.0)
activesupport (>= 2.3.2)
sqlite3 (1.3.3)
thor (0.14.6)
treetop (1.4.9)
polyglot (>= 0.3.1)
tzinfo (0.3.27)
warden (1.0.4)
rack (>= 1.0)
PLATFORMS
ruby
DEPENDENCIES
acts_as_list
acts_as_tree
cancan
capistrano
carrierwave
devise
formtastic
haml (>= 3.0.0)
jquery-rails
kaminari
meta_search
mimetype-fu
rails (= 3.0.6)
rmagick
sass
simple-navigation
sqlite3

256
README Normal file
View File

@ -0,0 +1,256 @@
== 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
| |-- controllers
| |-- helpers
| |-- mailers
| |-- models
| `-- views
| `-- layouts
|-- config
| |-- environments
| |-- initializers
| `-- locales
|-- db
|-- doc
|-- lib
| `-- tasks
|-- log
|-- public
| |-- images
| |-- javascripts
| `-- stylesheets
|-- script
|-- test
| |-- fixtures
| |-- functional
| |-- integration
| |-- performance
| `-- unit
|-- tmp
| |-- cache
| |-- pids
| |-- sessions
| `-- sockets
`-- vendor
`-- plugins
app
Holds all the code that's specific to this particular application.
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. Contains subdirectories for
images, stylesheets, and javascripts. 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
View 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__)
PharmacieboissierCom::Application.load_tasks

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,35 @@
/*
*=require admin/core/reset
*= require_self
*= require admin/core/forms
*= require admin/core/elements
*= require admin/core/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; }

View 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 ====

View File

@ -0,0 +1,313 @@
/*
* FIXME: Introduce SCSS & Sprockets
*= require_self
*= require prettyPhoto
*= require formtastic
*= require_tree .
*/
body {
padding: 0px;
margin: 0px;
font-size: 14px;
font-family: "trebuchet MS";
color: RGB(96, 68, 53); }
body a img {
border: 0px; }
body a {
color: RGB(129, 178, 11);
text-decoration: none; }
body a:hover {
text-decoration: underline; }
body #public #menu_left h3 a {
color: inherit; }
body #public #menu_left ul {
list-style: none;
padding-left: 0px; }
body #public #menu_left ul ul {
padding-left: 20px; }
body #public h1, body #public h2, body #public h3, body #public h4, body #public h5, body #public h6 {
font-family: Georgia;
font-weight: normal;
margin-top: 0px; }
body #public .menu a {
color: RGB(100, 74, 60);
text-decoration: none;
padding: 5px; }
body #public .menu a:hover {
text-decoration: underline; }
body #public .menu a.selected {
font-weight: bold; }
body #public #header {
width: 960px;
margin: auto; }
body #public #header #logo {
padding: 10px 10px 10px 0px; }
body #public #header #menu_top {
float: right;
margin-top: 40px; }
body #public #bandeau {
background: RGB(91, 67, 46);
padding: 10px;
width: 940px;
margin: auto;
margin-bottom: 10px;
color: RGB(238, 238, 238);
font-family: Georgia;
font-size: 25px; }
body #public #slider {
position: relative;
width: 979px;
height: 309px;
padding: 0px;
margin: auto;
margin-bottom: 10px;
background-image: url("/images/front/fond-marron.png");
background-repeat: no-repeat;
background-position: center center; }
body #public #slider .slide {
width: 969px;
height: 309px;
position: relative;
margin: 0px 5px 0px 5px; }
body #public #slider .slide a {
color: inherit;
text-decoration: inherit; }
body #public #slider .slide .title {
width: 486px;
height: 46px;
background-image: url("/images/front/en-tete-gris.png");
background-repeat: no-repeat;
position: absolute;
top: 35px;
left: -5px;
z-index: 100;
color: RGB(50, 24, 10);
font-family: Georgia;
padding: 10px 10px 10px 45px;
font-size: 19px; }
body #public #slider .slide .cible {
position: absolute;
bottom: 30px;
left: 410px; }
body #public #slider .slide .description {
position: absolute;
top: 120px;
left: 40px;
width: 470px;
height: 125px;
color: RGB(238, 238, 238); }
body #public #slider .slide .image_file {
position: absolute;
top: 20px;
right: 40px;
width: 415px;
height: 275px;
overflow: hidden; }
body #public #slider .slide .image_file img {
width: 415px; }
body #public #slider .left-arrow {
position: absolute;
z-index: 150;
top: 140px;
left: 15px;
cursor: pointer; }
body #public #slider .right-arrow {
position: absolute;
z-index: 150;
top: 140px;
right: 15px;
cursor: pointer; }
body #public #main {
width: 960px;
margin: auto;
margin-bottom: 10px; }
body #public #main a {
color: inherit;
text-decoration: inherit; }
body #public #main .title {
font-family: georgia;
font-size: 18px;
text-align: center; }
body #public #main .description {
text-align: justify; }
body #public #main .column {
float: left;
min-height: 340px;
width: 319px;
border-left: 1px solid RGB(222, 236, 189);
position: relative; }
body #public #main .column .title {
min-height: 55px; }
body #public #main .column_1 {
border-left: 1px solid white; }
body #public #main .column_2 {
padding: 10px;
width: 299px;
border-left: 1px solid white; }
body #public #main .column_3 {
padding: 10px;
width: 299px; }
body #public #main .column_2 .cible, body #public #main .column_3 .cible {
position: absolute;
bottom: 10px;
right: 20px; }
body #public #contact_block {
height: 360px;
width: 319px;
background-image: url("/images/front/fond-vert.png");
background-repeat: no-repeat;
position: relative;
left: -2px; }
body #public #contact_block .content {
color: RGB(76, 42, 15);
width: 297px; }
body #public #contact_block #horaires {
position: absolute;
top: 20px;
left: 20px; }
body #public #contact_block #garde {
position: absolute;
top: 130px;
left: 20px; }
body #public #contact_block #contact {
position: absolute;
top: 210px;
left: 20px; }
body .clear {
clear: both; }
body .promotion {
position: relative;
border: 1px dotted black;
margin-bottom: 10px;
margin-left: 10px; }
body .promotion .img {
margin: 10px;
float: left; }
body .promotion .img img {
width: 120px; }
body .promotion .label {
position: absolute;
top: -10px;
left: -5px; }
body .promotion .title, body .promotion .description {
margin-left: 120px; }
body .promotion .title {
margin-top: 10px;
font-family: georgia;
font-size: 18px; }
body .promotion .description {
margin-top: 5px;
text-align: justify;
padding: 0px 20px 0px 20px; }
body .promotion .description p {
margin: 0px; }
body #home_promotions {
width: 960px;
margin: auto; }
body #home_promotions .column {
float: left;
min-height: 300px;
width: 319px;
border-left: 1px solid RGB(222, 236, 189);
position: relative;
background-image: url("/images/front/cadre-gris.png");
background-repeat: no-repeat;
background-position: center top;
text-align: center; }
body #home_promotions .column .img {
margin-top: 20px; }
body #home_promotions .column .img img {
height: 160px; }
body #home_promotions .column .label {
position: absolute;
top: -10px;
left: -5px; }
body #home_promotions .column .title {
margin-top: 10px;
font-family: georgia;
font-size: 18px; }
body #home_promotions .column .description {
margin-top: 5px;
text-align: justify;
padding: 0px 20px 0px 20px; }
body #home_promotions .column .description p {
margin: 0px; }
body #home_promotions .column_1 {
border-left: 1px solid white; }
body #home_promotions .column_2 {
border-left: 1px solid white; }
body #home_promotions .column_3 {
border-left: 1px solid white; }
body #page_main {
width: 960px;
margin: auto; }
body #page_main #sidebar {
float: left;
width: 240px;
position: relative;
min-height: 400px; }
body #page_main #content {
float: left;
width: 720px; }
body #menu_bottom {
margin: auto;
width: 960px;
margin-top: 20px;
margin-bottom: 20px; }
body #menu_bottom #left_bottom {
float: left; }
body #menu_bottom #right_bottom {
float: right; }
body .article {
border: 1px solid RGB(129, 178, 11);
padding: 10px;
margin-bottom: 10px; }
body .article h3 {
color: RGB(129, 178, 11); }
body .article .image_file {
float: left;
margin-right: 10px; }
body .article .title, body .article .description {
margin-left: 130px; }
body .article .title a, body .article .description a {
color: inherit;
text-decoration: inherit; }
body .folder {
border: 1px solid RGB(91, 67, 46);
padding: 10px;
margin-bottom: 10px; }
body .folder h3 {
color: RGB(91, 67, 46); }
body .folder .image_file {
float: left;
margin-right: 10px; }
body .folder .title, body .folder .description {
margin-left: 130px; }
body .folder .title a, body .folder .description a {
color: inherit;
text-decoration: inherit; }
#flash_notice{
border:3px solid #6bb800;
padding:10px;
}
#home_promotions a {
color: inherit;
text-decoration: inherit; }
.portlet.table_content table {
width: 100%;
border-collapse: collapse; }
.portlet.table_content table td {
border: 1px solid black; }
.portlet.block_content .two_column .column {
float: left;
width: 50%; }
.portlet.block_content .two_column .column .block {
padding: 10px; }

View 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;
}

View 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;
}

View 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;
}

View File

@ -0,0 +1,110 @@
# -*- encoding : utf-8 -*-
class Admin::AdminsController < ApplicationController
before_filter :authenticate_admin!
layout "admin"
navigation :admins
def index
@breadcrumb = ["liste des administrateurs"]
@order = magick_order("email", "DESC")
@admins = Admin.order(@order).page(magick_page()).per(magick_per_page())
if @admins.num_pages.to_i < magick_page().to_i
params[:page] = @admins.num_pages
@admins = Admin.order(@order).page(magick_page()).per(magick_per_page())
end
end
def show
@admin = Admin.find(params[:id])
respond_to do |format|
format.html
end
end
def new
@breadcrumb = [["liste des administrateurs", admin_admins_path],"Ajouter un administrateur"]
@admin = Admin.new
respond_to do |format|
format.js
end
end
def edit
@breadcrumb = [["liste des administrateurs", admin_admins_path],"Modifier un administrateur"]
@admin = Admin.find(params[:id])
end
def create
@admin = Admin.new(params[:admin])
respond_to do |format|
if @admin.save
flash[:notice] = "L'administrateur "+@admin.email.to_s+" à été ajouté avec succès."
format.html { redirect_to(admin_admins_path) }
format.js
else
format.html { render :action => "new" }
format.js { render :action => "new" }
end
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
respond_to do |format|
if @admin.update_attributes(params[:admin])
flash[:notice] = "L'administrateur "+@admin.email.to_s+" à été modifié avec succès."
format.html { redirect_to(admin_admins_path) }
format.js
else
format.html { render :action => "edit" }
format.js { render :action => "edit" }
end
end
end
def destroy
@admin = Admin.find(params[:id])
if @admin == current_admin
respond_to do |format|
format.html {
redirect_to(admin_admins_url, :alert => "Vous ne pouvez pas supprimer l'administrateur actuellement connecté.")
}
end
else
@admin.destroy
respond_to do |format|
format.html {
redirect_to(admin_admins_url, :notice => "L'utilisateur "+@admin.email.to_s+" à bien été supprimé.")
}
end
end
end
end

View File

@ -0,0 +1,48 @@
# -*- encoding : utf-8 -*-
class Admin::AlbumsController < ApplicationController
load_and_authorize_resource
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

View File

@ -0,0 +1,86 @@
# -*- encoding : utf-8 -*-
class Admin::ArticlesController < ApplicationController
before_filter :authenticate_admin!
layout "admin"
navigation :folders
load_and_authorize_resource
def index
@folder = Folder.find(params[:folder_id])
@articles = @folder.articles
if request.xhr?
render :layout => false
end
end
def new
current_navigation :new_articles
@folder = Folder.find(params[:folder_id])
@article = Article.new(:folder => @folder)
end
def create
current_navigation :new_articles
@article = Article.new(params[:article])
@folder = @article.folder
if @article.save
flash[:notice] = "L'article à bien été créé."
respond_to do |format|
format.js
end
else
respond_to do |format|
format.js { render :action => :new}
end
end
end
def edit
current_navigation :edit_articles
@article = Article.find(params[:id])
@folder = @article.folder
end
def update
current_navigation :edit_articles
@article = Article.find(params[:id])
@folder = @article.folder
if @article.update_attributes(params[:article])
flash[:notice] = "Le dossier à bien été modifié."
respond_to do |format|
format.html { redirect_to(admin_articles_path()) }
format.js
end
else
respond_to do |format|
format.html { render :action => :edit}
format.js { render :action => :edit}
end
end
end
def destroy
@article = Article.find(params[:id])
@article.destroy
@folder = @article.folder
flash[:notice] = "L'article à bien été supprimé."
end
end

View File

@ -0,0 +1,56 @@
# -*- encoding : utf-8 -*-
class Admin::BlocksController < ApplicationController
before_filter :authenticate_admin!
load_and_authorize_resource
layout "admin"
def index
end
def new
end
def edit
@block = Block.find(params[:id])
if request.xhr?
render :layout => false
end
end
def show
@block = Block.find(params[:id])
if request.xhr?
render :layout => false
end
end
def create
end
def update
end
def destroy
end
end

View File

@ -0,0 +1,19 @@
# -*- encoding : utf-8 -*-
class Admin::CiblesController < ApplicationController
before_filter :authenticate_admin!
def new
@resource = params[:resource_type].to_s.constantize.new()
@resource.cible = params[:cible_type].to_s.constantize.new()
if params[:resource_type] == "LinkContent"
@namespace = :portlet
else
@namespace = :admin
end
end
end

View File

@ -0,0 +1,12 @@
# -*- encoding : utf-8 -*-
class Admin::DashboardController < ApplicationController
navigation :dahsboard
before_filter :authenticate_admin!
layout "admin"
def index
end
end

View File

@ -0,0 +1,60 @@
# -*- encoding : utf-8 -*-
class Admin::DataFilesController < ApplicationController
before_filter :authenticate_admin!
# load_and_authorize_resource
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
else
end
end
def update
@data_file = DataFile.find(params[:id])
if @data_file.update_attributes(params[:data_file])
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

View File

@ -0,0 +1,50 @@
# -*- encoding : utf-8 -*-
class Admin::FileFoldersController < ApplicationController
before_filter :authenticate_admin!
load_and_authorize_resource
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
@file_folder = FileFolder.find(params[:id])
if @file_folder.id != 1
@file_folder.delete
end
end
end

View File

@ -0,0 +1,80 @@
# -*- encoding : utf-8 -*-
class Admin::FoldersController < ApplicationController
before_filter :authenticate_admin!
load_and_authorize_resource
layout "admin"
navigation :folders
def index
@folders = Folder.all
end
def new
current_navigation :new_folders
@folder = Folder.new
end
def create
current_navigation :new_folders
@folder = Folder.new(params[:folder])
if @folder.save
@folders = Folder.all
flash[:notice] = "Le dossier à bien été créé."
respond_to do |format|
format.html { redirect_to(admin_folders_path()) }
format.js
end
else
respond_to do |format|
format.html { render :action => :new}
format.js { render :action => :new}
end
end
end
def edit
current_navigation :edit_folders
@folder = Folder.find(params[:id])
end
def update
current_navigation :edit_folders
@folder = Folder.find(params[:id])
if @folder.update_attributes(params[:folder])
flash[:notice] = "Le dossier à bien été modifié."
respond_to do |format|
format.html { redirect_to(admin_folders_path()) }
format.js
end
else
respond_to do |format|
format.html { render :action => :edit}
format.js { render :action => :edit}
end
end
end
def destroy
@folder = Folder.find(params[:id])
@folder.destroy
flash[:notice] = "Le dossier à bien été supprimé."
end
end

View File

@ -0,0 +1,54 @@
# -*- encoding : utf-8 -*-
class Admin::HomeBlocksController < ApplicationController
before_filter :authenticate_admin!
load_and_authorize_resource
def show
end
def edit
@home_block = HomeBlock.find(params[:id])
params[:resource => "home_block"]
end
def update
@home_block = HomeBlock.find(params[:id])
params[:resource => "home_block"]
params_content = params[:home_block].delete(:cible_attributes)
content_type = params[:home_block][:cible_type]
cible_id = params[:home_block][:cible_id].to_i if params[:home_block][:cible_id].to_i != 0
puts cible_id.to_i
if !cible_id
content = content_type.constantize.new(params_content)
else
content = content_type.constantize.find(cible_id)
content.attributes = params_content
end
@home_block.cible = content
if @home_block.update_attributes(params[:home_block])
flash[:notice] = "Le bloc a bien été modifié."
respond_to do |format|
format.js
end
else
respond_to do |format|
format.js { render :action => :edit}
end
end
end
end

View File

@ -0,0 +1,35 @@
# -*- encoding : utf-8 -*-
class Admin::HomePagesController < ApplicationController
before_filter :authenticate_admin!
layout "admin"
navigation :home_pages
def show
@home = Home.find(params[:id])
end
def edit
@home = Home.find(params[:id])
end
def update
@home = Home.find(params[:id])
if @home.update_attributes(params[:home])
flash[:notice] = "Les promotions ont bien été modifiées."
respond_to do |format|
format.js
end
else
respond_to do |format|
format.js { render :action => :edit}
end
end
end
end

View File

@ -0,0 +1,59 @@
# -*- 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
end

View File

@ -0,0 +1,15 @@
# -*- encoding : utf-8 -*-
class Admin::MenuAliasesController < ApplicationController
before_filter :authenticate_admin!
load_and_authorize_resource
def edit
end
def update
end
end

View File

@ -0,0 +1,174 @@
# -*- encoding : utf-8 -*-
class Admin::MenuItemsController < ApplicationController
before_filter :authenticate_admin!
#load_and_authorize_resource
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
end

View File

@ -0,0 +1,14 @@
# -*- encoding : utf-8 -*-
class Admin::MenuUrlsController < ApplicationController
before_filter :authenticate_admin!
load_and_authorize_resource
def edit
end
def update
end
end

View File

@ -0,0 +1,80 @@
# -*- encoding : utf-8 -*-
class Admin::MenusController < ApplicationController
before_filter :authenticate_admin!
layout "admin"
before_filter :authenticate_admin!
load_and_authorize_resource
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

View File

@ -0,0 +1,15 @@
# -*- encoding : utf-8 -*-
class Admin::PagesController < ApplicationController
before_filter :authenticate_admin!
load_and_authorize_resource
def edit
@page = Page.find(params[:id])
end
def update
end
end

View File

@ -0,0 +1,88 @@
# -*- encoding : utf-8 -*-
class Admin::PrescriptionsController < ApplicationController
before_filter :authenticate_admin!
load_and_authorize_resource
before_filter :find_prescriptions
layout "admin"
navigation :prescriptions
def index
@prescription = @prescriptions[0]
end
def show
@prescription = Prescription.find(params[:id])
@prescription.read = true
@prescription.save
end
def delete
end
def update
@prescription = Prescription.find(params[:id])
if params[:prescription][:done_by] and params[:prescription][:done_by] != ""
params[:prescription][:done_at] = Time.now
params[:prescription][:done] = true
else
params[:prescription][:done_by] = nil
end
if @prescription.update_attributes(params[:prescription])
else
end
end
def done
@prescription = Prescription.find(params[:id])
if params[:prescription][:done_by] and params[:prescription][:done_by] != ""
params[:prescription][:done_at] = Time.now
params[:prescription][:done] = true
@prescription.update_attributes(params[:prescription])
end
end
def undone
@prescription = Prescription.find(params[:id])
params[:prescription] = {}
params[:prescription][:done_by]= ""
params[:prescription][:done_at] = Time.now
params[:prescription][:done] = false
@prescription.update_attributes(params[:prescription])
end
def file
@prescription = Prescription.find(params[:id])
@file = @prescription.file.path
send_file @file, :disposition => "inline"
end
def find_prescriptions
@prescriptions = Prescription.order("read ASC, done ASC, created_at DESC")
@last = Prescription.order("created_at DESC").first
end
def destroy
@prescription = Prescription.find(params[:id])
@prescription.destroy
redirect_to admin_prescriptions_path, :notice => "L'ordonnance à bien été supprimée"
end
end

View File

@ -0,0 +1,80 @@
# -*- encoding : utf-8 -*-
class Admin::PromotionsController < ApplicationController
before_filter :authenticate_admin!
load_and_authorize_resource
layout "admin"
navigation :promotions
def index
@promotions = Promotion.order("month DESC, title ASC")
if request.xhr?
render :layout => false
end
end
def new
@promotion = Promotion.new(:month => Date.today.beginning_of_month, :promotion_type_id => 1)
end
def create
@promotion = Promotion.new(params[:promotion])
@promotions = Promotion.order("month DESC, title ASC")
if @promotion.save
flash[:notice] = "La promotion à bien été créé."
respond_to do |format|
format.js
end
else
respond_to do |format|
format.js { render :action => :new}
end
end
end
def update
@promotion = Promotion.find(params[:id])
@promotions = Promotion.order("month DESC, title ASC")
if @promotion.update_attributes(params[:promotion])
flash[:notice] = "La promo à bien été modifiée."
respond_to do |format|
format.js
end
else
respond_to do |format|
format.js { render :action => :edit}
end
end
end
def edit
@promotion = Promotion.find(params[:id])
end
def show
@promotion = Promotion.find(params[:id])
end
def destroy
@promotion = Promotion.find(params[:id])
@promotion.destroy
flash[:notice] = "La promo à bien été supprimée."
end
end

View File

@ -0,0 +1,10 @@
# -*- encoding : utf-8 -*-
class Admin::SlidersController < ApplicationController
before_filter :authenticate_admin!
load_and_authorize_resource
def show
end
end

View File

@ -0,0 +1,149 @@
# -*- encoding : utf-8 -*-
class Admin::SlidesController < ApplicationController
before_filter :authenticate_admin!
load_and_authorize_resource
layout "admin"
navigation :home_pages
def new
@slide = Slide.new(:slider_id => params[:slider_id])
@slide.cible = CibleArticle.new()
end
def create
@slides = Slide.order(:position)
params[:resource => "slide"]
params_content = params[:slide].delete(:cible_attributes)
content_type = params[:slide][:cible_type]
cible_id = params[:slide][:cible_id].to_i if params[:slide][:cible_id].to_i != 0
if !cible_id
content = content_type.constantize.new(params_content)
else
content = content_type.constantize.find(cible_id)
content.attributes = params_content
end
@slide = Slide.new(params[:slide])
@slide.cible = content
if @slide.save
flash[:notice] = "La slide à bien été créé."
respond_to do |format|
format.js
end
else
respond_to do |format|
format.js { render :action => :new}
end
end
end
def update
@slide = Slide.find(params[:id])
@slides = Slide.order(:position)
params[:resource => "slide"]
params_content = params[:slide].delete(:cible_attributes)
content_type = params[:slide][:cible_type]
cible_id = params[:slide][:cible_id].to_i if params[:slide][:cible_id].to_i != 0
puts cible_id.to_i
if !cible_id
content = content_type.constantize.new(params_content)
else
content = content_type.constantize.find(cible_id)
content.attributes = params_content
end
@slide.cible = content
if @slide.update_attributes(params[:slide])
flash[:notice] = "Le slide à bien été modifiée."
respond_to do |format|
format.js
end
else
respond_to do |format|
format.js { render :action => :edit}
end
end
end
def edit
@slide = Slide.find(params[:id])
end
def show
@slide = Slide.find(params[:id])
end
def destroy
@slide = Slide.find(params[:id])
@slide.destroy
flash[:notice] = "Le slide à bien été supprimée."
end
def reorder
i = 0
params[:slide].each do |slide_id|
i += 1
slide = Slide.find(slide_id)
slide.position = i
slide.save
end
render :inline => "ok"
end
end

View 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

View File

@ -0,0 +1,5 @@
# -*- encoding : utf-8 -*-
class Admins::SessionsController < ::Devise::SessionsController
layout "connexion"
end

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View File

@ -0,0 +1,131 @@
# -*- encoding : utf-8 -*-
class Portlet::LinkContentsController < ApplicationController
layout "admin"
def new
@link_content = LinkContent.new
params[:link_content_cible_type] = "CibleUrl" if !params[:link_content_cible_type]
@cible = params[:link_content_cible_type].constantize.new()
@link_content.cible = @cible
respond_to do |format|
format.html {
if request.xhr?
render :layout => false
end
}
format.js { render :template => "portlet/shared/new" }
end
end
def create
params_cible = params[:link_content].delete(:cible_attributes)
cible_type = params[:link_content][:cible_type]
@link_content = LinkContent.new(params[:link_content])
cible = cible_type.constantize.new(params_cible)
@link_content.cible = cible
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
params_cible = params[:link_content].delete(:cible_attributes)
cible_type = params[:link_content][:cible_type]
if !(params[:link_content][:cible_id] and params[:link_content][:cible_id] != "")
cible = cible_type.constantize.new(params_cible)
@link_content.cible = cible
end
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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View File

@ -0,0 +1,12 @@
# -*- encoding : utf-8 -*-
class Public::ArticlesController < ApplicationController
layout "public"
def show
@article = Article.find_by_slug(params[:slug])
@folder = Folder.find_by_slug(params[:folder_slug])
@title = "Article : "+ @article.title.to_s
end
end

View File

@ -0,0 +1,12 @@
# -*- encoding : utf-8 -*-
class Public::FoldersController < ApplicationController
layout "public"
def show
@folder = Folder.find_by_slug(params[:slug])
@title = "Dossier : "+ @folder.title.to_s
end
end

View File

@ -0,0 +1,12 @@
# -*- encoding : utf-8 -*-
#encoding: utf-8
class Public::HomeController < ApplicationController
layout "public"
def show
@home = Home.find_by_slug("root")
end
end

View File

@ -0,0 +1,35 @@
# -*- 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 "/404.html"
end
end
end

View File

@ -0,0 +1,23 @@
# -*- encoding : utf-8 -*-
class Public::PrescriptionsController < ApplicationController
layout 'public'
def new
end
def create
@prescription = Prescription.new(params[:prescription])
@menu_item = MenuItem.find_by_permalink('ordonnances')
@title = @menu_item.name
if @prescription.save
redirect_to "/pages/ordonnances.html", :notice => "Nous avons bien enregistré votre demande, celle-ci sera traitée dans les meilleurs délais. Nous vous informerons par téléphone de la date à laquelle vous pourrez venir chercher votre commande à la pharmacie."
else
render :template => "public/menu_items/show"
end
end
end

View File

@ -0,0 +1,24 @@
# -*- encoding : utf-8 -*-
class SlidesController < ApplicationController
def index
end
def new
end
def create
end
def edit
end
def update
end
def destroy
end
def reorder
end
end

View 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

View File

@ -0,0 +1,3 @@
# -*- encoding : utf-8 -*-
module Admin::CiblesHelper
end

View File

@ -0,0 +1,3 @@
# -*- encoding : utf-8 -*-
module Admin::HomeBlocksHelper
end

View File

@ -0,0 +1,3 @@
# -*- encoding : utf-8 -*-
module Admin::HomePagesHelper
end

View 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
"/iconic/"+color.to_s+"/"+name.to_s+"_"+s+".png"
end
end

View 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

View 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

View 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

View File

@ -0,0 +1,3 @@
# -*- encoding : utf-8 -*-
module Admin::PrescriptionsHelper
end

View File

@ -0,0 +1,3 @@
# -*- encoding : utf-8 -*-
module Admin::PromotionsHelper
end

View File

@ -0,0 +1,3 @@
# -*- encoding : utf-8 -*-
module Admin::SlidersHelper
end

View File

@ -0,0 +1,3 @@
# -*- encoding : utf-8 -*-
module Admin::SlidesHelper
end

View File

@ -0,0 +1,3 @@
# -*- encoding : utf-8 -*-
module ApplicationHelper
end

View File

@ -0,0 +1,3 @@
# -*- encoding : utf-8 -*-
module Portlet::GalleryImagesHelper
end

View File

@ -0,0 +1,3 @@
# -*- encoding : utf-8 -*-
module Portlet::TableColsHelper
end

View File

@ -0,0 +1,3 @@
# -*- encoding : utf-8 -*-
module Public::ArticlesHelper
end

View File

@ -0,0 +1,3 @@
# -*- encoding : utf-8 -*-
module Public::FoldersHelper
end

View File

@ -0,0 +1,3 @@
# -*- encoding : utf-8 -*-
module Public::HomeHelper
end

View 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)
end
end

View File

@ -0,0 +1,3 @@
# -*- encoding : utf-8 -*-
module Public::PrescriptionsHelper
end

View File

@ -0,0 +1,3 @@
# -*- encoding : utf-8 -*-
module SlidesHelper
end

0
app/mailers/.gitkeep Normal file
View File

0
app/models/.gitkeep Normal file
View File

49
app/models/ability.rb Normal file
View 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

35
app/models/article.rb Normal file
View File

@ -0,0 +1,35 @@
# -*- encoding : utf-8 -*-
class Article < ActiveRecord::Base
belongs_to :image_file
belongs_to :folder
after_create :after_creation
has_one :block, :as => :blockable
belongs_to :folder
validates :title, :presence => true
validates :slug, :presence => true, :uniqueness => {:scope => :folder_id}
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
before_validation do
self.slug = self.slug.to_slug
end
end

View 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[cms pharmacien 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

View File

@ -0,0 +1,19 @@
# -*- encoding : utf-8 -*-
class CibleAlias < ActiveRecord::Base
include Rails.application.routes.url_helpers
belongs_to :menu_item
validates :menu_item_id, :presence => true
#has_one :link_content, :as => :cible
has_one :cibleable, :as => :cible
def url
if self.menu_item
menu_item_path(:url => self.menu_item.permalink)
end
end
end

View File

@ -0,0 +1,14 @@
# -*- encoding : utf-8 -*-
class CibleArticle < ActiveRecord::Base
include Rails.application.routes.url_helpers
belongs_to :article
def url
if self.article and self.article.folder
article_path(:slug => self.article.slug, :folder_slug => self.article.folder.slug)
end
end
end

View File

@ -0,0 +1,13 @@
# -*- encoding : utf-8 -*-
class CibleFolder < ActiveRecord::Base
include Rails.application.routes.url_helpers
belongs_to :folder
def url
if self.folder
folder_path(:slug => self.folder.slug)
end
end
end

View File

@ -0,0 +1,3 @@
# -*- encoding : utf-8 -*-
class CibleType < ActiveRecord::Base
end

View File

@ -0,0 +1,5 @@
# -*- encoding : utf-8 -*-
class CibleUrl < ActiveRecord::Base
validates :url, :presence => true
end

View File

@ -0,0 +1,5 @@
# -*- encoding : utf-8 -*-
class AllowedBlockContent < ActiveRecord::Base
belongs_to :block
belongs_to :content_type
end

14
app/models/cms/block.rb Normal file
View File

@ -0,0 +1,14 @@
# -*- encoding : utf-8 -*-
class Block < ActiveRecord::Base
belongs_to :blockable, :polymorphic => true
has_many :portlets, :order => :position, :dependent => :destroy
accepts_nested_attributes_for :portlets
has_many :allowed_block_contents
has_many :content_types, :through => :allowed_block_contents
end

View File

@ -0,0 +1,3 @@
# -*- encoding : utf-8 -*-
class ContentType < ActiveRecord::Base
end

28
app/models/cms/page.rb Normal file
View File

@ -0,0 +1,28 @@
# -*- encoding : utf-8 -*-
class Page < ActiveRecord::Base
has_one :menu_item, :as => :menu_content
has_many :blocks, :as => :blockable, :dependent => :destroy
validates :title, :presence => true
HUMAN_NAME = "Page"
after_create :after_creation
def after_creation
@block = Block.new(:block_name => "general")
@block.blockable = self
@block.save
ContentType.all.each do |content_type|
@block.content_types << content_type
end
end
end

30
app/models/cms/portlet.rb Normal file
View File

@ -0,0 +1,30 @@
# -*- encoding : utf-8 -*-
class Portlet < ActiveRecord::Base
belongs_to :block
belongs_to :content, :polymorphic => true
accepts_nested_attributes_for :content
attr_accessor :skip_before_update
before_create do
end
before_update do
end
before_destroy do
end
end

7
app/models/cms/tag.rb Normal file
View File

@ -0,0 +1,7 @@
# -*- encoding : utf-8 -*-
class Tag < ActiveRecord::Base
before_validation do
self.slug = self.name.to_slug
end
end

33
app/models/folder.rb Normal file
View File

@ -0,0 +1,33 @@
# -*- encoding : utf-8 -*-
class Folder < ActiveRecord::Base
belongs_to :image_file
after_create :after_creation
has_one :block, :as => :blockable
has_many :articles
validates :title, :presence => true
validates :slug, :presence => true, :uniqueness => true
def after_creation
@block = Block.new(:block_name => "en tête")
@block.blockable = self
@block.save
ContentType.all.each do |content_type|
@block.content_types << content_type
end
end
before_validation do
self.slug = self.slug.to_slug
end
end

10
app/models/home.rb Normal file
View File

@ -0,0 +1,10 @@
# -*- encoding : utf-8 -*-
class Home < ActiveRecord::Base
has_one :slider
has_many :home_blocks
belongs_to :promotion_1, :class_name => "Promotion"
belongs_to :promotion_2, :class_name => "Promotion"
belongs_to :promotion_3, :class_name => "Promotion"
end

7
app/models/home_block.rb Normal file
View File

@ -0,0 +1,7 @@
# -*- encoding : utf-8 -*-
class HomeBlock < ActiveRecord::Base
belongs_to :home
belongs_to :cible, :polymorphic => true
accepts_nested_attributes_for :cible
end

Some files were not shown because too many files have changed in this diff Show More