forked from demarches-simplifiees/demarches-simplifiees.fr
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
30 changed files
with
462 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
class EditableChamp::LexpolComponent < EditableChamp::EditableChampBaseComponent | ||
end |
15 changes: 15 additions & 0 deletions
15
app/components/editable_champ/lexpol_component/lexpol_component.html.haml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
-# # %div.lexpol-champ | ||
-# - if @champ.value.blank? | ||
-# = form_with url: lexpol_create_dossier_instructeur_dossier_path(@champ.dossier.revision.procedure.id, @champ.dossier.id, champ_id: @champ.id), method: :post do |form| | ||
-# = form.submit 'Créer le dossier dans LexPol', class: 'fr-btn' | ||
-# - else | ||
-# %p | ||
-# %strong Numéro NOR : | ||
-# = @champ.value | ||
-# %p | ||
-# %strong Statut du dossier : | ||
-# = @champ.lexpol_status | ||
-# - if @champ.lexpol_dossier_url.present? | ||
-# = link_to 'Aller sur LexPol', @champ.lexpol_dossier_url, target: '_blank', class: 'fr-btn fr-btn--secondary' | ||
-# = form_with url: lexpol_update_dossier_instructeur_dossier_path(@champ.dossier.revision.procedure.id, @champ.dossier.id, champ_id: @champ.id), method: :post do |form| | ||
-# = form.submit 'Mettre à jour le dossier', class: 'fr-btn fr-btn--secondary' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
module Instructeurs | ||
class LexpolController < ApplicationController | ||
before_action :authenticate_instructeur! | ||
before_action :set_dossier_and_champ | ||
|
||
def create_dossier | ||
if @champ.lexpol_create_dossier | ||
redirect_to annotations_instructeur_dossier_path(@dossier.procedure, @dossier), notice: 'Dossier LexPol créé avec succès.' | ||
else | ||
redirect_to annotations_instructeur_dossier_path(@dossier.procedure, @dossier), alert: @champ.errors.full_messages.join(', ') | ||
end | ||
end | ||
|
||
def update_dossier | ||
if @champ.lexpol_update_dossier | ||
redirect_to annotations_instructeur_dossier_path(@dossier.procedure, @dossier), notice: 'Dossier LexPol mis à jour avec succès.' | ||
else | ||
redirect_to annotations_instructeur_dossier_path(@dossier.procedure, @dossier), alert: @champ.errors.full_messages.join(', ') | ||
end | ||
end | ||
|
||
private | ||
|
||
def set_dossier_and_champ | ||
@dossier = Dossier.find(params[:dossier_id]) | ||
@champ = @dossier.champs.find(params[:champ_id]) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
app/graphql/types/champs/descriptor/lexpol_champ_descriptor_type.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module Types::Champs::Descriptor | ||
class LexpolChampDescriptorType < Types::BaseObject | ||
implements Types::ChampDescriptorType | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
module Types::Champs | ||
class LexpolChampType < Types::BaseObject | ||
implements Types::ChampType | ||
|
||
field :nor, String, null: true, description: "Numéro NOR du dossier Lexpol", method: :value | ||
field :status, String, null: true, description: "Statut du dossier Lexpol", method: :lexpol_status | ||
field :dossier_url, String, null: true, description: "Lien vers le dossier Lexpol", method: :lexpol_dossier_url | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
class Champs::LexpolChamp < Champ | ||
def generate_or_update_lexpol_dossier | ||
if vale.blank? | ||
nor_number = APILexpol.new.create_dossier(model_id: '598706') | ||
self.value = nor_number | ||
else | ||
APILexpol.new.update_dossier(nor_number: value) | ||
end | ||
save! | ||
end | ||
end |
Oops, something went wrong.