Skip to content

Commit

Permalink
Merge pull request #3006 from tchak/remove-legacy-carto
Browse files Browse the repository at this point in the history
Remove legacy carto module
  • Loading branch information
gregoirenovel committed Nov 27, 2018
2 parents b015d1c + 575a437 commit 85f9e1a
Show file tree
Hide file tree
Showing 55 changed files with 27 additions and 1,391 deletions.
8 changes: 1 addition & 7 deletions app/controllers/admin/procedures_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,11 @@ def destroy

def new
@procedure ||= Procedure.new
@procedure.module_api_carto ||= ModuleAPICarto.new
@availability = Procedure::PATH_AVAILABLE
end

def create
@procedure = Procedure.new(procedure_params)

if @procedure.valid?
@procedure.module_api_carto = ModuleAPICarto.new
end

@path = @procedure.path
@availability = Procedure.path_availability(current_administrateur, @procedure.path)

Expand Down Expand Up @@ -268,7 +262,7 @@ def procedure_params
if Flipflop.publish_draft?
editable_params << :path
end
params.require(:procedure).permit(*editable_params, :duree_conservation_dossiers_dans_ds, :duree_conservation_dossiers_hors_ds, :for_individual, :individual_with_siret, :ask_birthday, module_api_carto_attributes: [:id, :use_api_carto, :quartiers_prioritaires, :cadastre]).merge(administrateur_id: current_administrateur.id)
params.require(:procedure).permit(*editable_params, :duree_conservation_dossiers_dans_ds, :duree_conservation_dossiers_hors_ds, :for_individual, :individual_with_siret, :ask_birthday).merge(administrateur_id: current_administrateur.id)
end
end
end
6 changes: 1 addition & 5 deletions app/controllers/new_user/dossiers_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,7 @@ def update_identite
@dossier.update!(autorisation_donnees: true)
flash.notice = "Identité enregistrée"

if @dossier.use_legacy_carto?
redirect_to users_dossier_carte_path(@dossier.id)
else
redirect_to brouillon_dossier_path(@dossier)
end
redirect_to brouillon_dossier_path(@dossier)
else
flash.now.alert = @dossier.individual.errors.full_messages
render :identite
Expand Down
78 changes: 0 additions & 78 deletions app/controllers/users/carte_controller.rb

This file was deleted.

35 changes: 0 additions & 35 deletions app/controllers/users_controller.rb

This file was deleted.

52 changes: 0 additions & 52 deletions app/javascript/old_design/carto.js

This file was deleted.

2 changes: 0 additions & 2 deletions app/javascript/packs/application-old.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import '../shared/autocomplete';
import '../shared/remote-input';
import '../shared/franceconnect';

import '../old_design/carto';

// Start Rails helpers
Rails.start();
Turbolinks.start();
Expand Down
7 changes: 0 additions & 7 deletions app/models/cadastre.rb

This file was deleted.

14 changes: 0 additions & 14 deletions app/models/dossier.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ class Dossier < ApplicationRecord
has_many :pieces_justificatives, dependent: :destroy
has_many :champs, -> { public_only.ordered }, dependent: :destroy
has_many :champs_private, -> { private_only.ordered }, class_name: 'Champ', dependent: :destroy
has_many :quartier_prioritaires, dependent: :destroy
has_many :cadastres, dependent: :destroy
has_many :commentaires, dependent: :destroy
has_many :invites, dependent: :destroy
has_many :follows
Expand Down Expand Up @@ -74,8 +72,6 @@ class Dossier < ApplicationRecord
piece_justificative_file_attachment: :blob
],
pieces_justificatives: [],
quartier_prioritaires: [],
cadastres: [],
etablissement: [],
individual: [],
user: [])
Expand Down Expand Up @@ -247,20 +243,10 @@ def owner_name
end
end

def use_legacy_carto?
procedure.use_legacy_carto?
end

def expose_legacy_carto_api?
procedure.expose_legacy_carto_api?
end

def user_geometry
if json_latlngs.present?
UserGeometry.new(json_latlngs)
end
end

def geo_position
if etablissement.present?
point = ApiAdresse::PointAdapter.new(etablissement.geo_adresse).geocode
Expand Down
4 changes: 0 additions & 4 deletions app/models/module_api_carto.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
class ModuleAPICarto < ApplicationRecord
belongs_to :procedure

validates :use_api_carto, presence: true, allow_blank: true, allow_nil: false
validates :quartiers_prioritaires, presence: true, allow_blank: true, allow_nil: false
validates :cadastre, presence: true, allow_blank: true, allow_nil: false
end
8 changes: 1 addition & 7 deletions app/models/procedure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ class Procedure < ApplicationRecord

accepts_nested_attributes_for :types_de_champ, :reject_if => proc { |attributes| attributes['libelle'].blank? }, :allow_destroy => true
accepts_nested_attributes_for :types_de_piece_justificative, :reject_if => proc { |attributes| attributes['libelle'].blank? }, :allow_destroy => true
accepts_nested_attributes_for :module_api_carto
accepts_nested_attributes_for :types_de_champ_private

mount_uploader :logo, ProcedureLogoUploader
Expand Down Expand Up @@ -131,12 +130,8 @@ def publiee_ou_archivee?
publiee? || archivee?
end

def use_legacy_carto?
module_api_carto.use_api_carto? && !module_api_carto.migrated?
end

def expose_legacy_carto_api?
module_api_carto.use_api_carto? && module_api_carto.migrated?
module_api_carto&.use_api_carto? && module_api_carto&.migrated?
end

# Warning: dossier after_save build_default_champs must be removed
Expand Down Expand Up @@ -207,7 +202,6 @@ def clone(admin, from_library)
procedure = self.deep_clone(include:
{
types_de_piece_justificative: nil,
module_api_carto: nil,
attestation_template: nil,
types_de_champ: :drop_down_list,
types_de_champ_private: :drop_down_list
Expand Down
7 changes: 0 additions & 7 deletions app/models/quartier_prioritaire.rb

This file was deleted.

40 changes: 0 additions & 40 deletions app/models/user_geometry.rb

This file was deleted.

Loading

0 comments on commit 85f9e1a

Please sign in to comment.