Merge pull request #365 from sgmap/clean

Clean
This commit is contained in:
gregoirenovel 2017-05-31 10:03:28 +02:00 committed by GitHub
commit 082898af45
20 changed files with 50 additions and 60 deletions

View file

@ -1,5 +1,4 @@
class API::StatistiquesController < ApplicationController
def dossiers_stats
render json: {
total: total_dossiers,

View file

@ -1,5 +1,4 @@
class API::V1::DossiersController < APIController
api :GET, '/procedures/:procedure_id/dossiers/', 'Liste de tous les dossiers d\'une procédure'
param :procedure_id, Integer, desc: "L'identifiant de la procédure", required: true
param :token, String, desc: "Token administrateur", required: true

View file

@ -1,5 +1,4 @@
class Backoffice::Dossiers::ProcedureController < Backoffice::DossiersListController
def index
super

View file

@ -25,5 +25,4 @@ class BackofficeController < ApplicationController
partial: 'backoffice/dossiers/list_invitations',
array: true
end
end

View file

@ -1,5 +1,4 @@
class FranceConnect::ParticulierController < ApplicationController
def login
client = FranceConnectParticulierClient.new

View file

@ -1,5 +1,4 @@
class PingController < ApplicationController
def index
Rails.logger.silence do
if (ActiveRecord::Base.connected?)
@ -9,5 +8,4 @@ class PingController < ApplicationController
end
end
end
end

View file

@ -1,6 +1,5 @@
class RootController < ApplicationController
def index
begin
route = Rails.application.routes.recognize_path(request.referrer)
rescue ActionController::RoutingError

View file

@ -1,5 +1,4 @@
class Sessions::SessionsController < Devise::SessionsController
before_action :before_sign_in, only: [:create]
def before_sign_in

View file

@ -1,5 +1,4 @@
class Users::CarteController < UsersController
before_action only: [:show] do
authorized_routes? self.class
end

View file

@ -1,5 +1,4 @@
class Users::Dossiers::InvitesController < UsersController
def authenticate_user!
session["user_return_to"] = request.fullpath
return redirect_to new_user_registration_path(user_email: params[:email]) if !params[:email].blank? && User.find_by_email(params[:email]).nil?

View file

@ -1,5 +1,4 @@
class Users::RecapitulatifController < UsersController
before_action only: [:show] do
authorized_routes? self.class
end

View file

@ -27,5 +27,4 @@ class Administrateur < ActiveRecord::Base
break token unless Administrateur.find_by(api_token: token)
end
end
end

View file

@ -1,5 +1,4 @@
class Entreprise < ActiveRecord::Base
belongs_to :dossier
has_one :etablissement, dependent: :destroy
has_one :rna_information, dependent: :destroy

View file

@ -1,5 +1,4 @@
class Etablissement < ActiveRecord::Base
belongs_to :dossier
belongs_to :entreprise

View file

@ -2,5 +2,4 @@ class Exercice < ActiveRecord::Base
belongs_to :etablissement
validates :ca, presence: true, allow_blank: false, allow_nil: false
end

View file

@ -1,5 +1,4 @@
class FranceConnectParticulierClient < OpenIDConnect::Client
def initialize params={}
super(
identifier: FRANCE_CONNECT.particulier_identifier,

View file

@ -1,12 +1,14 @@
class Notification < ActiveRecord::Base
belongs_to :dossier
enum type_notif: {
commentaire: 'commentaire',
cerfa: 'cerfa',
piece_justificative: 'piece_justificative',
champs: 'champs',
submitted: 'submitted',
avis: 'avis'
}
commentaire: 'commentaire',
cerfa: 'cerfa',
piece_justificative: 'piece_justificative',
champs: 'champs',
submitted: 'submitted',
avis: 'avis'
}
belongs_to :dossier
scope :unread, -> { where(already_read: false) }
end

View file

@ -24,6 +24,9 @@ class Procedure < ActiveRecord::Base
mount_uploader :logo, ProcedureLogoUploader
scope :not_archived, -> { where(archived: false) }
scope :by_libelle, -> { order(libelle: :asc) }
validates :libelle, presence: true, allow_blank: false, allow_nil: false
validates :description, presence: true, allow_blank: false, allow_nil: false
@ -46,10 +49,6 @@ class Procedure < ActiveRecord::Base
alias_method_chain "#{name.underscore.to_sym}".to_s, :override
end
scope :not_archived, -> { where(archived: false) }
scope :by_libelle, -> { order(libelle: :asc) }
def path
procedure_path.path unless procedure_path.nil?
end
@ -67,7 +66,7 @@ class Procedure < ActiveRecord::Base
end
def self.active id
Procedure.where(archived: false, published: true).find(id)
not_archived.where(published: true).find(id)
end
def switch_types_de_champ index_of_first_element
@ -83,12 +82,17 @@ class Procedure < ActiveRecord::Base
end
def switch_list_order(list, index_of_first_element)
return false if index_of_first_element < 0
return false if index_of_first_element == list.count - 1
return false if list.count < 1
list[index_of_first_element].update_attributes(order_place: index_of_first_element + 1)
list[index_of_first_element + 1].update_attributes(order_place: index_of_first_element)
true
if index_of_first_element < 0 ||
index_of_first_element == list.count - 1 ||
list.count < 1
false
else
list[index_of_first_element].update_attributes(order_place: index_of_first_element + 1)
list[index_of_first_element + 1].update_attributes(order_place: index_of_first_element)
true
end
end
def locked?

View file

@ -1,26 +1,26 @@
class TypeDeChamp < ActiveRecord::Base
enum type_champs: {
text: 'text',
textarea: 'textarea',
date: 'date',
datetime: 'datetime',
number: 'number',
checkbox: 'checkbox',
civilite: 'civilite',
email: 'email',
phone: 'phone',
address: 'address',
yes_no: 'yes_no',
drop_down_list: 'drop_down_list',
multiple_drop_down_list: 'multiple_drop_down_list',
pays: 'pays',
regions: 'regions',
departements: 'departements',
engagement: 'engagement',
header_section: 'header_section',
explication: 'explication',
dossier_link: 'dossier_link'
}
text: 'text',
textarea: 'textarea',
date: 'date',
datetime: 'datetime',
number: 'number',
checkbox: 'checkbox',
civilite: 'civilite',
email: 'email',
phone: 'phone',
address: 'address',
yes_no: 'yes_no',
drop_down_list: 'drop_down_list',
multiple_drop_down_list: 'multiple_drop_down_list',
pays: 'pays',
regions: 'regions',
departements: 'departements',
engagement: 'engagement',
header_section: 'header_section',
explication: 'explication',
dossier_link: 'dossier_link'
}
belongs_to :procedure

View file

@ -1,6 +1,8 @@
class User < ActiveRecord::Base
enum loged_in_with_france_connect: {particulier: 'particulier',
entreprise: 'entreprise'}
enum loged_in_with_france_connect: {
particulier: 'particulier',
entreprise: 'entreprise'
}
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
@ -35,5 +37,4 @@ class User < ActiveRecord::Base
def invite? dossier_id
invites.pluck(:dossier_id).include?(dossier_id.to_i)
end
end