suggest default zones
This commit is contained in:
parent
b13e77650e
commit
1bda86be03
3 changed files with 13 additions and 3 deletions
|
@ -81,6 +81,12 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move checkbox to the top-left side of the label
|
// Move checkbox to the top-left side of the label
|
||||||
|
&.editable-champ-checkbox {
|
||||||
|
label.admin-default-zone {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
&.editable-champ-checkbox {
|
&.editable-champ-checkbox {
|
||||||
p,
|
p,
|
||||||
label {
|
label {
|
||||||
|
|
|
@ -27,8 +27,8 @@ class Zone < ApplicationRecord
|
||||||
label_at(date) != 'Non attribué'
|
label_at(date) != 'Non attribué'
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.available_at(date)
|
def self.available_at(date, without_zones = [])
|
||||||
Zone.all.filter { |zone| zone.available_at?(date) }.sort_by { |zone| zone.label_at(date) }
|
(Zone.all - without_zones).filter { |zone| zone.available_at?(date) }.sort_by { |zone| zone.label_at(date) }
|
||||||
.map do |zone|
|
.map do |zone|
|
||||||
OpenStruct.new(id: zone.id, label: zone.label_at(date))
|
OpenStruct.new(id: zone.id, label: zone.label_at(date))
|
||||||
end
|
end
|
||||||
|
|
|
@ -14,7 +14,11 @@
|
||||||
= f.label :zone do
|
= f.label :zone do
|
||||||
= t('zone', scope: 'activerecord.attributes.procedure')
|
= t('zone', scope: 'activerecord.attributes.procedure')
|
||||||
- if Rails.application.config.ds_zonage_enabled
|
- if Rails.application.config.ds_zonage_enabled
|
||||||
= f.collection_check_boxes :zone_ids, Zone.available_at(@procedure.published_or_created_at), :id, :label do |b|
|
= f.collection_check_boxes :zone_ids, current_administrateur.default_zones, :id, :current_label do |b|
|
||||||
|
.editable-champ.editable-champ-checkbox
|
||||||
|
= b.check_box
|
||||||
|
= b.label class: "admin-default-zone"
|
||||||
|
= f.collection_check_boxes :zone_ids, Zone.available_at(@procedure.published_or_created_at, current_administrateur.default_zones), :id, :label do |b|
|
||||||
.editable-champ.editable-champ-checkbox
|
.editable-champ.editable-champ-checkbox
|
||||||
= b.check_box
|
= b.check_box
|
||||||
= b.label
|
= b.label
|
||||||
|
|
Loading…
Reference in a new issue