This commit is contained in:
Marwann 2016-07-24 12:12:01 +02:00
commit afe601026c
22 changed files with 333 additions and 163 deletions

2
.gitignore vendored
View file

@ -20,6 +20,4 @@
/public/uploads
db/schema.rb
*.lock
Gemfile.lock
db/seeds.rb

View file

@ -20,6 +20,8 @@ gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
# Custom responders (https://github.com/plataformatec/responders)
gem "responders"
# Paginate
gem "will_paginate"
@ -45,9 +47,9 @@ gem 'rails-jquery-autocomplete' # Rails JQuery Autocomplete
gem 'sass-rails', '~> 5.0' # Use SCSS for stylesheets
gem 'bootstrap-sass' # Boostrap with SASS
gem 'bootstrap-datepicker-rails' # Date picker
gem 'fuelux-rails-sass' # Fuel UX components
gem 'best_in_place' # in-place editing
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
@ -64,6 +66,7 @@ end
group :development do
gem 'faker'
gem 'ruby-debug-ide'
end
group :test do
@ -79,4 +82,4 @@ group :production, :staging do
gem 'puma'
end
ruby '2.1.5'
ruby '2.1.8'

View file

@ -38,17 +38,15 @@ GEM
tzinfo (~> 1.1)
ansi (1.5.0)
arel (6.0.3)
autoprefixer-rails (6.1.1)
autoprefixer-rails (6.3.7)
execjs
json
bcrypt (3.1.10-x64-mingw32)
bcrypt (3.1.10-x86-mingw32)
best_in_place (3.0.3)
bcrypt (3.1.11-x64-mingw32)
best_in_place (3.1.0)
actionpack (>= 3.2)
railties (>= 3.2)
binding_of_caller (0.7.2)
debug_inspector (>= 0.0.1)
bootstrap-datepicker-rails (1.5.0)
bootstrap-datepicker-rails (1.6.0)
railties (>= 3.0)
bootstrap-sass (3.3.6)
autoprefixer-rails (>= 5.2.1)
@ -56,28 +54,28 @@ GEM
bootstrap-will_paginate (0.0.10)
will_paginate
builder (3.2.2)
byebug (8.2.1)
byebug (9.0.5)
carrierwave (0.10.0)
activemodel (>= 3.2.0)
activesupport (>= 3.2.0)
json (>= 1.7)
mime-types (>= 1.16)
coderay (1.1.0)
coffee-rails (4.1.0)
coderay (1.1.1)
coffee-rails (4.1.1)
coffee-script (>= 2.2.0)
railties (>= 4.0.0, < 5.0)
railties (>= 4.0.0, < 5.1.x)
coffee-script (2.4.1)
coffee-script-source
execjs
coffee-script-source (1.8.0)
concurrent-ruby (1.0.2)
debug_inspector (0.0.2)
erubis (2.7.0)
excon (0.45.4)
execjs (2.6.0)
faker (1.6.1)
excon (0.51.0)
execjs (2.7.0)
faker (1.6.5)
i18n (~> 0.5)
ffi (1.9.10-x64-mingw32)
ffi (1.9.10-x86-mingw32)
ffi (1.9.14-x64-mingw32)
fog (1.23.0)
fog-brightbox
fog-core (~> 1.23)
@ -85,23 +83,26 @@ GEM
fog-softlayer
ipaddress (~> 0.5)
nokogiri (~> 1.5, >= 1.5.11)
fog-brightbox (0.9.0)
fog-brightbox (0.10.1)
fog-core (~> 1.22)
fog-json
inflecto (~> 0.0.2)
fog-core (1.35.0)
fog-core (1.42.0)
builder
excon (~> 0.45)
excon (~> 0.49)
formatador (~> 0.2)
fog-json (1.0.2)
fog-core (~> 1.0)
multi_json (~> 1.10)
fog-softlayer (1.0.2)
fog-softlayer (1.1.0)
fog-core
fog-json
formatador (0.2.5)
friendly_id (5.1.0)
activerecord (>= 4.0.0)
fuelux-rails-sass (3.14.2)
railties (>= 3.1)
sass-rails
globalid (0.3.6)
activesupport (>= 4.1.0)
guard (2.13.0)
@ -114,16 +115,16 @@ GEM
shellany (~> 0.0)
thor (>= 0.18.1)
guard-compat (1.2.1)
guard-minitest (2.4.4)
guard-minitest (2.4.5)
guard-compat (~> 1.2)
minitest (>= 3.0)
i18n (0.7.0)
inflecto (0.0.2)
ipaddress (0.8.0)
jbuilder (2.3.2)
activesupport (>= 3.0.0, < 5)
ipaddress (0.8.3)
jbuilder (2.6.0)
activesupport (>= 3.0.0, < 5.1)
multi_json (~> 1.2)
jquery-rails (4.0.5)
jquery-rails (4.1.0)
rails-dom-testing (~> 1.0)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
@ -133,45 +134,46 @@ GEM
jquery-ui-rails (5.0.5)
railties (>= 3.2.16)
json (1.8.3)
listen (3.0.5)
listen (3.0.6)
rb-fsevent (>= 0.9.3)
rb-inotify (>= 0.9)
rb-inotify (>= 0.9.7)
loofah (2.0.3)
nokogiri (>= 1.5.9)
lumberjack (1.0.9)
mail (2.6.3)
mime-types (>= 1.16, < 3)
lumberjack (1.0.10)
mail (2.6.4)
mime-types (>= 1.16, < 4)
method_source (0.8.2)
mime-types (2.99)
mime-types (3.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2016.0521)
mini_backtrace (0.1.3)
minitest (> 1.2.0)
rails (>= 2.3.3)
mini_magick (3.8.0)
subexec (~> 0.2.1)
mini_portile (0.6.2)
minitest (5.8.3)
minitest-reporters (1.1.7)
mini_portile2 (2.1.0)
minitest (5.9.0)
minitest-reporters (1.1.10)
ansi
builder
minitest (>= 5.0)
ruby-progressbar
multi_json (1.11.2)
nenv (0.2.0)
net-ssh (3.0.1)
nokogiri (1.6.6.4-x64-mingw32)
mini_portile (~> 0.6.0)
nokogiri (1.6.6.4-x86-mingw32)
mini_portile (~> 0.6.0)
notiffany (0.0.8)
multi_json (1.12.1)
nenv (0.3.0)
net-ssh (3.2.0)
nokogiri (1.6.8-x64-mingw32)
mini_portile2 (~> 2.1.0)
pkg-config (~> 1.1.7)
notiffany (0.1.0)
nenv (~> 0.1)
shellany (~> 0.0)
pg (0.18.4-x64-mingw32)
pg (0.18.4-x86-mingw32)
pry (0.10.3)
pkg-config (1.1.7)
pry (0.10.4)
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
puma (2.15.3)
puma (3.5.2)
rack (1.6.4)
rack-test (0.6.3)
rack (>= 1.0)
@ -192,28 +194,32 @@ GEM
activesupport (>= 4.2.0.beta, < 5.0)
nokogiri (~> 1.6.0)
rails-deprecated_sanitizer (>= 1.0.1)
rails-html-sanitizer (1.0.2)
rails-html-sanitizer (1.0.3)
loofah (~> 2.0)
rails-jquery-autocomplete (1.0.3)
rails (>= 3.2)
rails_12factor (0.0.3)
rails_serve_static_assets
rails_stdout_logging
rails_serve_static_assets (0.0.4)
rails_stdout_logging (0.0.4)
rails_serve_static_assets (0.0.5)
rails_stdout_logging (0.0.5)
railties (4.2.3)
actionpack (= 4.2.3)
activesupport (= 4.2.3)
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rake (10.4.2)
rb-fsevent (0.9.6)
rb-inotify (0.9.5)
rake (11.2.2)
rb-fsevent (0.9.7)
rb-inotify (0.9.7)
ffi (>= 0.5.0)
rdoc (4.2.0)
rdoc (4.2.2)
json (~> 1.4)
ruby-progressbar (1.7.5)
sass (3.4.19)
responders (2.2.0)
railties (>= 4.2.0, < 5.1)
ruby-debug-ide (0.6.0)
rake (>= 0.8.1)
ruby-progressbar (1.8.1)
sass (3.4.22)
sass-rails (5.0.4)
railties (>= 4.0.0, < 5.0)
sass (~> 3.1)
@ -225,37 +231,36 @@ GEM
rdoc (~> 4.0)
shellany (0.0.1)
slop (3.6.0)
sprockets (3.4.1)
sprockets (3.7.0)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-rails (2.3.3)
actionpack (>= 3.0)
activesupport (>= 3.0)
sprockets (>= 2.8, < 4.0)
sprockets-rails (3.0.4)
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
sqlite3 (1.3.11-x64-mingw32)
sqlite3 (1.3.11-x86-mingw32)
subexec (0.2.3)
thor (0.19.1)
thread_safe (0.3.5)
tilt (2.0.1)
turbolinks (2.5.3)
coffee-rails
tilt (2.0.5)
turbolinks (5.0.0)
turbolinks-source (~> 5)
turbolinks-source (5.0.0)
tzinfo (1.2.2)
thread_safe (~> 0.1)
tzinfo-data (1.2015.7)
tzinfo-data (1.2016.6)
tzinfo (>= 1.0.0)
uglifier (2.7.2)
execjs (>= 0.3.0)
json (>= 1.8.0)
web-console (2.2.1)
uglifier (3.0.0)
execjs (>= 0.3.0, < 3)
web-console (2.3.0)
activemodel (>= 4.0)
binding_of_caller (>= 0.7.2)
railties (>= 4.0)
sprockets-rails (>= 2.0, < 4.0)
will_paginate (3.0.7)
will_paginate (3.1.0)
PLATFORMS
x64-mingw32
x86-mingw32
DEPENDENCIES
bcrypt (~> 3.1.7)
@ -270,6 +275,7 @@ DEPENDENCIES
faker
fog (= 1.23.0)
friendly_id
fuelux-rails-sass
guard
guard-minitest
jbuilder (~> 2.0)
@ -285,6 +291,8 @@ DEPENDENCIES
rails (= 4.2.3)
rails-jquery-autocomplete
rails_12factor
responders
ruby-debug-ide
sass-rails (~> 5.0)
sdoc (~> 0.4.0)
sqlite3
@ -294,5 +302,8 @@ DEPENDENCIES
web-console (~> 2.0)
will_paginate
RUBY VERSION
ruby 2.1.8p440
BUNDLED WITH
1.11.2
1.12.5

View file

@ -24,3 +24,4 @@
//= require jquery.jtruncate
//= require bootstrap-datepicker
//= require bootstrap-datepicker/locales/bootstrap-datepicker.fr
//= require fuelux

View file

@ -0,0 +1,30 @@
$ ->
modal_holder_selector = '#modal-holder'
modal_selector = '.modal'
$(document).on 'click', 'a[data-modal]', ->
location = $(this).attr('href')
#Load modal dialog from server
$.get location, (data)->
$(modal_holder_selector).html(data).
find(modal_selector).modal()
wizard = $(".wizard").wizard()
wizard.on 'finished.fu.wizard', (e, data) ->
$("#addStatementModal").submit()
false
$(document).on 'ajax:success',
'form[data-modal]', (event, data, status, xhr)->
url = xhr.getResponseHeader('Location')
if url
# Redirect to url
window.location = url
else
# Remove old modal backdrop
$('.modal-backdrop').remove()
# Replace old modal with new one
$(modal_holder_selector).html(data).
find(modal_selector).modal()
false

View file

@ -14,4 +14,5 @@
*= require_self
*= require jquery-ui
*= require bootstrap-datepicker3
*= require fuelux
*/

View file

@ -1,10 +1,10 @@
.btn-custom {
.btn-primary-custom {
border-radius: 0px;
padding: 4px 8px;
font-size: 8px;
}
.btn-primary-custom {
color: #616161;
color: #e63c14;
background-color: #fff;
border-color: #ededea;
border-color: #e63c14;
}

View file

@ -0,0 +1,3 @@
.fuelux .modal .wizard > .actions {
position: inherit;
}

View file

@ -8,6 +8,12 @@ class ApplicationController < ActionController::Base
before_action :set_locale
def respond_modal_with(*args, &blk) #TODO blk ?
options = args.extract_options!
options[:responder] = Responders::ModalResponder
respond_with *args, options, &blk
end
private
# Before Filters

View file

@ -1,4 +1,5 @@
class PublicFiguresController < ApplicationController
respond_to :html, :json
before_action :find_public_figure, only: :show
before_action :check_reputation_to_destroy, only: :destroy
before_action :check_reputation_to_add, only: [:new, :create]
@ -10,18 +11,19 @@ class PublicFiguresController < ApplicationController
end
def show
@public_figure = PublicFigure.find(params[:id])
@public_figure = PublicFigure.find(params[:public_figure_id])
@new_statement = @public_figure.statements.build
end
def new
@public_figure = PublicFigure.new
respond_modal_with @public_figure
end
def create
@public_figure = PublicFigure.new(public_figure_params)
if @public_figure.save
flash[:success] = "Personnalité \"#{@public_figure.name}\" créé ! "
flash[:success] = "Personnalité \"#{@public_figure.name}\" référencée ! "
redirect_to @public_figure
else
render "new"
@ -29,7 +31,7 @@ class PublicFiguresController < ApplicationController
end
def destroy
public_figure = PublicFigure.find(params[:id])
public_figure = PublicFigure.find(params[:public_figure_id])
name = public_figure.name
public_figure.destroy #TODO Mark deleted instead of really deleting record
flash[:success] = "\"#{name}\" supprimé"
@ -49,7 +51,7 @@ class PublicFiguresController < ApplicationController
redirect_to login_url
elsif !allowed_to? :delete_personality
flash[:danger] = "Vous n'avez pas assez de réputation pour supprimer une personnalité"
redirect_to(PublicFigure.find(params[:id]))
redirect_to(PublicFigure.find(params[:public_figure_id]))
end
end
@ -65,7 +67,7 @@ class PublicFiguresController < ApplicationController
end
def find_public_figure
@public_figure = PublicFigure.find params[:id]
@public_figure = PublicFigure.find params[:public_figure_id]
if request.path != public_figure_path(@public_figure) # If old URL
redirect_to @public_figure, status: :moved_permanently # Redirect to new URL
end

View file

@ -1,6 +1,20 @@
class StatementsController < ApplicationController
respond_to :html, :json
before_action :logged_in_user, only: [:create, :update, :destroy]
def new
if params.include? :subject_id
@subject = Subject.find params[:subject_id]
@new_statement = @subject.statements.build
elsif params.include? :public_figure_id
@public_figure = PublicFigure.find params[:public_figure_id]
@new_statement = @public_figure.statements.build
else
@new_statement = Statement.new
end
respond_modal_with @new_statement
end
def create
@position = Position.find_by_id(statement_params[:position_id])
@public_figure = PublicFigure.find_by_id(statement_params[:public_figure_id])
@ -9,7 +23,7 @@ class StatementsController < ApplicationController
@statement = @position.statements.build(statement_params)
@evidence = @statement.evidences.build(statement_evidence_params)
if ( @evidence.valid? && @statement.valid? )
if @evidence.valid? && @statement.valid?
if @statement.save && @evidence.save
flash[:success] = "Prise de position et preuve enregistrées !"
else

View file

@ -32,7 +32,7 @@ class SubjectsController < ApplicationController
end
def update
@subject = Subject.find(params[:id])
@subject = Subject.find(params[:subject_id])
respond_to do |format|
if @subject.update(subject_params)
grant_reputation_for!(:edited_subject)
@ -46,7 +46,7 @@ class SubjectsController < ApplicationController
end
def destroy
subject = Subject.find(params[:id])
subject = Subject.find(params[:subject_id])
title = subject.title
subject.destroy
flash[:success] = "Sujet \"#{title}\" supprimé"
@ -63,7 +63,7 @@ class SubjectsController < ApplicationController
redirect_not_logged_with_message "Vous devez être identifié pour éditer un sujet"
if ! allowed_to? :edit_minor_subject
flash[:danger] = "Vous n'avez pas assez de réputation pour éditer un sujet"
redirect_to(Subject.find(params[:id]))
redirect_to(Subject.find(params[:subject_id]))
end
end
@ -71,7 +71,7 @@ class SubjectsController < ApplicationController
redirect_not_logged_with_message "Vous devez être identifié pour créer un sujet"
if ! allowed_to? :edit_minor_subject
flash[:danger] = "Vous n'avez pas assez de réputation pour éditer un sujet"
redirect_to(Subject.find(params[:id]))
redirect_to(Subject.find(params[:subject_id]))
end
end
@ -79,12 +79,12 @@ class SubjectsController < ApplicationController
redirect_not_logged_with_message "Vous devez être identifié pour supprimer un sujet"
if ! allowed_to? :delete_minor_subject
flash[:danger] = "Vous n'avez pas assez de réputation pour supprimer un sujet"
redirect_to(Subject.find(params[:id]))
redirect_to(Subject.find(params[:subject_id]))
end
end
def find_subject
@subject = Subject.find params[:id]
@subject = Subject.find params[:subject_id]
if request.path != subject_path(@subject) # If old URL
redirect_to @subject, status: :moved_permanently # Redirect to new URL
end

View file

@ -9,8 +9,8 @@ class Position < ActiveRecord::Base
private
def at_least_one_statement
if statements.size < 1
errors.add("Il faut au moins une prise de position pour cette position")
if statements.length < 1
errors.add(:statements, "Il faut au moins une prise de position pour cette position")
end
end

View file

@ -8,18 +8,7 @@
<%= csrf_meta_tags %>
<%= render 'layouts/shim' %>
</head>
<body>
<!-- Google Tag Manager -->
<noscript><iframe src="//www.googletagmanager.com/ns.html?id=GTM-N4M2L9"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-N4M2L9');</script>
<!-- End Google Tag Manager -->
<body class="fuelux">
<%= render 'layouts/header' %>
<div class="container-fluid">
<%= flash_messages %>
@ -29,6 +18,15 @@ j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
<%= render 'layouts/footer' %>
<%= debug(params) if Rails.env.development? %>
</div>
<div id="modal-holder"></div>
<!-- Google Tag Manager -->
<noscript><iframe src="//www.googletagmanager.com/ns.html?id=GTM-N4M2L9"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-N4M2L9');</script>
<!-- End Google Tag Manager -->
</body>
</html>

View file

@ -0,0 +1,13 @@
<div id="myModal" class="modal fade" role="dialog" aria-labelledby="mainModalLabel" aria-hidden="true">
<div class="modal-dialog ui-front">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title" id="mainModalLabel">
<%= yield :title if content_for? :title %>&nbsp;
</h4>
</div>
<%= yield %>
</div>
</div>
</div>

View file

@ -1,19 +1,17 @@
<div class="container-fluid" style="width:100vw; position:relative; margin-left:-50vw;left:50%;">
<% provide(:title, "Personnalités") %>
<div class="col-md-1"></div>
<div class="col-md-7">
<h1>Les Personnalités
<%= link_to "Référencer une personnalité", new_public_figure_path, class: "btn btn-primary" if allowed_to?(:add_personality) %>
</h1>
<div class="public-figures-index">
<%= render @public_figures %>
</div></div>
<div class="col-md-3">
<%= render 'layouts/last_statements' %>
<%= will_paginate %></div>
<div class="col-md-1"></div>
<div class="container-fluid" style="width:100vw; position:relative; margin-left:-50vw;left:50%;">
<div class="col-md-7 col-md-offset-1">
<h1>Les Personnalités
<%= link_to "Référencer une personnalité", new_public_figure_path, class: "btn btn-primary", data: { modal: true } if allowed_to?(:add_personality) %>
</h1>
<p><%= link_to "Test : modal d'ajout", new_statement_path, data: { modal: true } %> </p>
<div class="public-figures-index">
<%= render @public_figures %>
</div>
</div>
<div class="col-md-3">
<%= render 'layouts/last_statements' %>
<%= will_paginate %>
</div>
<div class="col-md-1"></div>
</div>

View file

@ -0,0 +1,93 @@
<% provide(:title, "Recenser une prise de position") %>
<p><%= @subject.title if @subject %></p>
<p><%= @public_figure.name if @public_figure %></p>
<div class="row">
<div class="col-xs-10 col-xs-offset-1" >
<div class="wizard" data-initialize="wizard" id="myWizard">
<div class="steps-container">
<ul class="steps">
<li data-step="1" data-name="public_figure" class="active">
Personnalité
<span class="chevron"></span>
</li>
<li data-step="2">
Sujet
<span class="chevron"></span>
</li>
<li data-step="3" data-name="template">
Position
<span class="chevron"></span>
</li>
<li data-step="4" data-name="template">
Prise de position
<span class="chevron"></span>
</li>
</ul>
</div>
<%= form_for(
@new_statement,
remote: request.xhr?,
html: {
data: { modal: true },
:id => "addStatementModal",
multipart:true
}) do |f| %>
<%= render "shared/error_messages", object: f.object %>
<div class="step-content">
<div class="step-pane active sample-pane alert" data-step="1">
<h4>De qui parlons-nous ?</h4>
<%= f.collection_select :public_figure, PublicFigure.all, :id, :name %>
</div>
<div class="step-pane sample-pane bg-info alert" data-step="2">
<h4>Quel est le sujet qui fait débat ?</h4>
<%= label_tag "Sujet" %>
<%= autocomplete_field_tag 'Subject', '',
autocomplete_autocomplete_subject_title_path,
id_element: '#statement_subject_id',
class: "Autocomplete"
%>
<%= f.hidden_field :subject_id, value: "",
data: {
dynamic_selectable_url: subjects_positions_path(':subject_id', format: :json),
dynamic_selectable_target: '#statement_position_id'
}
%>
</div>
<div class="step-pane sample-pane bg-danger alert" data-step="3">
<h4>Quelle position a été prise ?</h4>
<%= f.label :position_id, "Position prise" %>
<%= f.select :position_id, {} %>
</div>
<div class="step-pane sample-pane bg-danger alert" data-step="4">
<h4>Donnez-nous quelques détails : </h4>
<%= f.fields_for @new_statement.evidences.build do |e| %>
<%= e.label :url, "Lien internet ..." %>
<%= e.text_field :url, placeholder: "http://" %>
<%= e.label :file, "... ou pièce jointe" %>
<%= e.file_field :file, accept: 'image/jpeg,image/gif,image/png,application/pdf,audio/mpeg3,audio/x-mpeg3,video/avi,video/quicktime,audio/wav' %>
<%= e.label :title, "Intitulé de la preuve" %>
<%= e.text_field :title, placeholder: "Explicitez la référence" %>
<%= e.label :fact_date, "Date des faits" %>
<%= e.text_field :fact_date, placeholder: "jj/mm/yyyy", class: "Datepicker" %>
<% end %>
</div>
</div>
<% end %>
<div class="actions">
<button type="button" class="btn btn-default btn-prev">
<span class="glyphicon glyphicon-arrow-left"></span>Revenir
</button>
<button type="button" class="btn btn-primary btn-next" data-last="Enregistrer">Suivant
<span class="glyphicon glyphicon-arrow-right"></span>
</button>
</div>
</div>
</div>
</div>

View file

@ -18,40 +18,4 @@
<div class="col-md-1"></div>
<!-- MODALE COMMENTEE
<!-- Trigger the modal with a button ->
<button type="button" class="btn btn-primary btn-info btn-lg" data-toggle="modal" data-target="#myModal">Open Modal</button>
<!-- Modal ->
<div id="myModal" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">Nouveau sujet</h4>
</div>
<div class="modal-body">
<div class="form-group">
<label for="usr">Titre :</label>
<input type="text" class="form-control" id="usr">
</div>
<div class="form-group">
<label for="comment">Présentation :</label>
<textarea class="form-control" rows="5" id="comment"></textarea>
</div>
<p>Some text in the modal.</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div> -->
<% # = react_component 'MultiAddForm', mode:'AddSubject' %>

View file

@ -24,6 +24,9 @@ module Debats
# Do not swallow errors in after_commit/after_rollback callbacks.
config.active_record.raise_in_transactional_callbacks = true
# Auto-load libs
config.autoload_paths << Rails.root.join('lib')
# 404, 500 personnalisées
config.exceptions_app = self.routes

View file

@ -9,3 +9,4 @@ Rails.application.config.assets.version = '1.0'
# Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
# Rails.application.config.assets.precompile += %w( search.js )
Rails.application.config.assets.precompile << /\.(?:svg|eot|woff|ttf)$/

View file

@ -11,14 +11,19 @@ Rails.application.routes.draw do
resources :account_activations, path: 'activation', only: [:edit]
resources :password_resets, only: [:new, :create, :edit, :update]
resources :subjects, path: 'sujets' do
resources :subjects, path: 's', param: :subject_id do
member do
resources :positions, as: 'subjects_positions', only: [:index]
resources :statements, as: 'subjects_statements'
end
end
resources :public_figures, path:'p', param: :public_figure_id do
member do
resources :statements, as: 'public_figures_statements'
end
end
resources :public_figures, path:'personnalites'
resources :positions, only: [:create, :update, :destroy]
resources :statements, only: [:create, :update, :destroy]
resources :statements, only: [:new, :create, :update, :destroy]
resources :arguments, only: [:create, :update, :destroy]
# AUTOCOMPLETE

View file

@ -0,0 +1,26 @@
class Responders::ModalResponder < ActionController::Responder
cattr_accessor :modal_layout
self.modal_layout = 'modal'
def render(*args)
options = args.extract_options!
if request.xhr?
options.merge! layout: modal_layout
end
controller.render *args, options
end
def default_render(*args)
render(*args)
end
def redirect_to(options)
if request.xhr?
head :ok, location: controller.url_for(options)
else
controller.redirect_to(options)
end
end
end