Add a 'remove this day' button

This commit is contained in:
Antonin 2016-08-07 12:22:58 +02:00
parent 5c11e5fe4d
commit d762c38e81
10 changed files with 69 additions and 46 deletions

View File

@ -487,6 +487,15 @@ table.results > tbody > tr:hover > td .glyphicon {
border:none;
background:transparent;
}
#selected-days legend .input-group-addon:last-of-type {
padding-top: 0;
padding-bottom: 0;
}
#selected-days legend {
height: 33px;
}
/* create_classic_poll.php */
.md-a-img {
text-decoration:none !important;

View File

@ -214,16 +214,12 @@ $(document).ready(function () {
newDateFields();
});
// Button "Remove a day"
// Button "Remove the current day"
$('#remove-a-day').on('click', function () {
$selected_days.find('fieldset:last').remove();
var nb_days = $selected_days.find('fieldset').length;
$('#day' + (nb_days - 1)).focus();
if (nb_days == 1) {
$removeaday_and_copyhours.addClass('disabled');
$(document).on('click', '.remove-day', function () {
if ($('#days_container').find('fieldset').length > 1) {
$(this).parents('fieldset').remove();
}
submitDaysAvalaible();
});
// Add an range of dates

View File

@ -259,6 +259,7 @@
"Copy hours of the first day": "Eilañ eurioù an devezh kentañ war an devezhioù all",
"Remove a day": "Dilemel an devezh diwezhañ",
"Add a day": "Ouzhpennañ un devezh",
"Remove this day": "BR_Supprimer ce jour",
"Remove all days": "Dilemel an holl zevezhioù",
"Remove all hours": "Dilemel an holl eurioù"
},

View File

@ -265,6 +265,7 @@
"Copy hours of the first day": "Uhrzeiten des ersten Tags kopieren",
"Remove a day": "Einen Tag entfernen",
"Add a day": "Einen Tag hinzufügen",
"Remove this day": "DE_Supprimer ce jour",
"Remove all days": "Alle Tage entfernen",
"Remove all hours": "Alle Uhrzeiten entfernen"
},

View File

@ -265,6 +265,7 @@
"Copy hours of the first day": "Copy times from the first day",
"Remove a day": "Remove a day",
"Add a day": "Add a day",
"Remove this day": "Remove this day",
"Remove all days": "Remove all days",
"Remove all hours": "Remove all times"
},

View File

@ -265,6 +265,7 @@
"Copy hours of the first day": "Copiar los horarios del primer día en los otros días",
"Remove a day": "Borrar el último día",
"Add a day": "Añadir un día",
"Remove this day": "ES_Supprimer ce jour",
"Remove all days": "Borrar todos los días",
"Remove all hours": "Borrar todos los horarios"
},

View File

@ -265,6 +265,7 @@
"Copy hours of the first day": "Reporter les horaires du premier jour sur les autres jours",
"Remove a day": "Supprimer le dernier jour",
"Add a day": "Ajouter un jour",
"Remove this day": "Supprimer ce jour",
"Remove all days": "Effacer tous les jours",
"Remove all hours": "Effacer tous les horaires"
},

View File

@ -265,6 +265,7 @@
"Copy hours of the first day": "Copiare gli orari del primo giorno",
"Remove a day": "Eliminare l'ultimo giorno",
"Add a day": "Aggiungere un giorno",
"Remove this day": "IT_Supprimer ce jour",
"Remove all days": "Cancellare tutti i giorni",
"Remove all hours": "Cancellare tutti gli orari"
},

View File

@ -265,6 +265,7 @@
"Copy hours of the first day": "Reportar los oraris del primièr jorn suls autres jorns",
"Remove a day": "Suprimir lo darrièr jorn",
"Add a day": "Ajustar un jorn",
"Remove this day": "OC_Supprimer ce jour",
"Remove all days": "Suprimir totes los jorns",
"Remove all hours": "Suprimir totes los oraris"
},

View File

@ -36,6 +36,7 @@
<p>{__('Step 2 date', 'For each selected day, you can choose, or not, meeting hours (e.g.: "8h", "8:30", "8h-10h", "evening", etc.)')}</p>
</div>
<div id="days_container">
{foreach $choices as $i=>$choice}
{if $choice->getName()}
{$day_value = $choice->getName()|date_format:$date_format['txt_date']}
@ -47,12 +48,21 @@
<legend>
<label class="sr-only" for="day{$i}">{__('Generic', 'Day')} {$i+1}</label>
<div class="input-group date col-xs-7">
<div class="col-xs-10 col-sm-11">
<div class="input-group date">
<span class="input-group-addon"><i class="glyphicon glyphicon-calendar text-info"></i></span>
<input type="text" class="form-control" id="day{$i}" title="{__('Generic', 'Day')} {$i+1}"
data-date-format="{__('Date', 'dd/mm/yyyy')}" aria-describedby="dateformat{$i}" name="days[]" value="{$day_value}"
size="10" maxlength="10" placeholder="{__('Date', 'dd/mm/yyyy')}" autocomplete="nope"/>
</div>
</div>
<div class="col-xs-1 col-sm-1">
<button type="button" title="{__('Step 2 date', 'Remove this day')}" class="remove-day btn btn-sm btn-link">
<span class="glyphicon glyphicon-remove text-danger"></span>
<span class="sr-only">{__('Step 2 date', 'Remove this day')}</span>
</button>
</div>
<span id="dateformat{$i}" class="sr-only">({__('Date', 'dd/mm/yyyy')})</span>
</legend>
@ -79,6 +89,7 @@
</div>
</fieldset>
{/foreach}
</div>
<div class="col-md-4">