Last active
December 14, 2015 07:09
-
-
Save benjaminrau/5048490 to your computer and use it in GitHub Desktop.
Edit objectstorage inline
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
Model: | |
----- | |
Item | |
Property: availabilityRanges | |
@var ObjectStorage<availabilityRanges> | |
Annotations on the updateAction: | |
-------------------------------- | |
/** | |
* action update | |
* | |
* @param Tx_Hcbookings_Domain_Model_Item | |
* We need the next annoation because we change the fields rendered for the form after the fluid rendering | |
* @dontverifyrequesthash | |
* @return void | |
*/ | |
JQuery: | |
------- | |
var NARainmbr = 99980; | |
$('.content').on('click',".addNewAvailabilityRange", function(e) { | |
e.preventDefault(); | |
rawTpl = $('.newAvailabilityRange-raw').html(); | |
NARainmbr = NARainmbr+1; | |
$(this).before(rawTpl.replace(/AINMBR/g,NARainmbr)); | |
}); | |
View: | |
----- | |
<f:form action="update" name="item" object="{item}" class="form form-horizontal" > | |
<f:render partial="Item/FormFields" arguments="{newItem:item,permissions:permissions,currentFeUser:currentFeUser}" /> | |
<f:for each="{availabilityRanges}" iteration="i" as="availabilityRange"> | |
<div> | |
<a href="#" class="removeAvailabilityRange inlineblock" title="Entfernen"><i class="icon-remove"></i></a> | |
<f:form.hidden name="item[availabilityRanges][{availabilityRange.uid}][__identity]" value="{availabilityRange.uid}" /> | |
<div class="control-group"> | |
<label class="control-label" for="startDate">Aktiv von</label> | |
<div class="controls"> | |
<div class="input-append date datetimepicker"> | |
<f:form.textfield name="item[availabilityRanges][{availabilityRange.uid}][startDate]" value="{availabilityRange.startDate -> f:format.date(format:'Y-m-d H:i')}" class="span2" /> | |
<span class="add-on"><i data-time-icon="icon-time" data-date-icon="icon-calendar"></i></span> | |
</div> | |
bis | |
<div class="input-append date datetimepicker"> | |
<f:form.textfield name="item[availabilityRanges][{availabilityRange.uid}][endDate]" value="{availabilityRange.endDate -> f:format.date(format:'Y-m-d H:i')}" class="span2" /> | |
<span class="add-on"><i data-time-icon="icon-time" data-date-icon="icon-calendar"></i></span> | |
</div><br> | |
<small>Schränken die die Gültigkeit dieser Regel auf einen bestimmten Zeitraum ein.</small> | |
</div> | |
</div> | |
<div class="control-group"> | |
<label class="control-label" for="fromTime">an diesen Wochetagen</label> | |
<div class="controls"> | |
<f:for each="{availabilityRange.possibleWeekdays}" key="key" as="weekday"> | |
<label class="checkbox inline"> | |
<f:form.checkbox name="item[availabilityRanges][{availabilityRange.uid}][weekday][]" id="inlineWeekday{key}" value="{weekday}" checked="{hcb:inArray(haystack:availabilityRange.weekday,needle:weekday,then:'checked',else:'')}" /> {weekday} | |
</label> | |
</f:for> | |
<div><small>Geben Sie an, an welchen Wochentagen die unten angegebenen Öffnungszeiten gelten.</small></div> | |
</div> | |
</div> | |
<div class="control-group"> | |
<label class="control-label" for="fromTime">von</label> | |
<div class="controls"> | |
<div class="input-append onlytimepicker"> | |
<f:form.textfield name="item[availabilityRanges][{availabilityRange.uid}][fromTime]" value="{f:format.date(format:'H:i',date:'@{availabilityRange.fromTimeRaw}')}" class="span2" /> | |
<span class="add-on"><i data-time-icon="icon-time" data-date-icon="icon-calendar"></i></span> | |
</div> | |
bis | |
<div class="input-append onlytimepicker"> | |
<f:form.textfield name="item[availabilityRanges][{availabilityRange.uid}][untilTime]" value="{f:format.date(format:'H:i',date:'@{availabilityRange.untilTimeRaw}')}" class="span2" /> | |
<span class="add-on"><i data-time-icon="icon-time" data-date-icon="icon-calendar"></i></span> | |
</div><br> | |
<small>Innerhalb dieses Zeitraums ist das Objekt an den angegebenen Wochentagen buchbar, solange die Regel aktiv ist.</small> | |
</div> | |
</div> | |
</div> | |
</f:for> | |
<button type="submit" class="btn btn-warning">Änderungen speichern</button> | |
</form> | |
// NOTE THAT! THIS IS OUTSIDE THE FORM | |
<div class="newAvailabilityRange-raw" style="display:none;"> | |
<div> | |
<div class="hdividerbigger"></div> | |
<div class="vspacer10"></div> | |
<a href="#" class="removeAvailabilityRange inlineblock" title="Entfernen"><i class="icon-remove"></i></a> | |
<div class="control-group"> | |
<label class="control-label" for="startDate">Aktiv von</label> | |
<div class="controls"> | |
<div class="input-append date datetimepicker"> | |
<f:form.textfield name="tx_hcbookings_booking[item][availabilityRanges][AINMBR][startDate]" value="{f:format.date(format:'Y-m-d H:i',date:'now')}" class="span2" /> | |
<span class="add-on"><i data-time-icon="icon-time" data-date-icon="icon-calendar"></i></span> | |
</div> | |
bis | |
<div class="input-append date datetimepicker"> | |
<f:form.textfield name="tx_hcbookings_booking[item][availabilityRanges][AINMBR][endDate]" value="{f:format.date(format:'Y-m-d H:i')}" class="span2" /> | |
<span class="add-on"><i data-time-icon="icon-time" data-date-icon="icon-calendar"></i></span> | |
</div><br> | |
<small>Schränken die die Gültigkeit dieser Regel auf einen bestimmten Zeitraum ein.</small> | |
</div> | |
</div> | |
<div class="control-group"> | |
<label class="control-label" for="fromTime">an diesen Wochetagen</label> | |
<div class="controls"> | |
<f:for each="{newAvailabilityRange.possibleWeekdays}" key="key" as="weekday"> | |
<label class="checkbox inline"> | |
<f:form.checkbox name="tx_hcbookings_booking[item][availabilityRanges][AINMBR][weekday][]" id="inlineWeekday{key}" value="{weekday}" /> {weekday} | |
</label> | |
</f:for> | |
<div><small>Geben Sie an, an welchen Wochentagen die unten angegebenen Öffnungszeiten gelten.</small></div> | |
</div> | |
</div> | |
<div class="control-group"> | |
<label class="control-label" for="fromTime">Buchbar von</label> | |
<div class="controls"> | |
<div class="input-append onlytimepicker"> | |
<f:form.textfield name="tx_hcbookings_booking[item][availabilityRanges][AINMBR][fromTime]" value="00:00" class="span2" /> | |
<span class="add-on"><i data-time-icon="icon-time" data-date-icon="icon-calendar"></i></span> | |
</div> | |
bis | |
<div class="input-append onlytimepicker"> | |
<f:form.textfield name="tx_hcbookings_booking[item][availabilityRanges][AINMBR][untilTime]" value="23:59" class="span2" /> | |
<span class="add-on"><i data-time-icon="icon-time" data-date-icon="icon-calendar"></i></span> | |
</div><br> | |
<small>Innerhalb dieses Zeitraums ist das Objekt an den angegebenen Wochentagen buchbar, solange die Regel aktiv ist.</small> | |
</div> | |
</div> | |
</div> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment