Expose stable_id on champ
This commit is contained in:
parent
aad44dbac8
commit
ef2d9e1138
4 changed files with 7 additions and 3 deletions
|
@ -86,6 +86,10 @@ class Champ < ApplicationRecord
|
|||
true
|
||||
end
|
||||
|
||||
def stable_id
|
||||
type_de_champ.stable_id
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def needs_dossier_id?
|
||||
|
|
|
@ -74,7 +74,7 @@ class Champs::CarteChamp < Champ
|
|||
def to_feature_collection
|
||||
{
|
||||
type: 'FeatureCollection',
|
||||
id: type_de_champ.stable_id,
|
||||
id: stable_id,
|
||||
bbox: bounding_box,
|
||||
features: (legacy_selections_utilisateur + except_selections_utilisateur).map(&:to_feature)
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ class Champs::RepetitionChamp < Champ
|
|||
|
||||
# We have to truncate the label here as spreadsheets have a (30 char) limit on length.
|
||||
def libelle_for_export
|
||||
str = "(#{type_de_champ.stable_id}) #{libelle}"
|
||||
str = "(#{stable_id}) #{libelle}"
|
||||
# /\*?[] are invalid Excel worksheet characters
|
||||
ActiveStorage::Filename.new(str.delete('[]*?')).sanitized.truncate(30)
|
||||
end
|
||||
|
|
|
@ -10,4 +10,4 @@
|
|||
= render partial: 'shared/champs/carte/geo_areas', locals: { champ: champ, error: false }
|
||||
|
||||
= form.hidden_field :value,
|
||||
data: { remote: true, feature_collection_id: champ.type_de_champ.stable_id, url: champs_carte_path(form.index), params: champ_carte_params(champ).to_query, method: 'post' }
|
||||
data: { remote: true, feature_collection_id: champ.stable_id, url: champs_carte_path(form.index), params: champ_carte_params(champ).to_query, method: 'post' }
|
||||
|
|
Loading…
Reference in a new issue