Created
October 3, 2016 02:12
-
-
Save steelydylan/f01e7a528a64b61fd5ba0edf4f15a77c to your computer and use it in GitHub Desktop.
カスタムフィールドグループでjs-datepickerを使用する
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
<h2 class="acms-admin-admin-title2">日付グループ</h2> | |
<table class="js-fieldgroup-sortable adminTable acms-admin-table-admin-edit"> | |
<thead class="acms-admin-hide-sp"> | |
<tr> | |
<th class="acms-admin-table-left acms-admin-admin-config-table-item-handle"> </th> | |
<th class="acms-admin-table-left">日付</th> | |
<th class="acms-admin-table-left acms-admin-admin-config-table-action">削除</th> | |
</tr> | |
</thead> | |
<tbody> | |
<!-- BEGIN dategroup:loop --> | |
<tr class="sortable-item"> | |
<td class="item-handle"><i class="acms-admin-icon-sort"></i></td> | |
<td> | |
<input type="text" name="dateitem[{i}]" value="{dateitem}" class="acms-admin-form-width-full js-datepicker"/> | |
</td> | |
<td><input type="button" class="item-delete acms-admin-btn-admin acms-admin-btn-admin-danger" value="削除" /></td> | |
</tr> | |
<!-- END dategroup:loop --> | |
<tr class="sortable-item item-template"> | |
<td class="item-handle"><i class="acms-admin-icon-sort"></i></td> | |
<td> | |
<input type="text" name="dateitem[]" value="" class="acms-admin-form-width-full js-datepicker"/> | |
</td> | |
<td><input type="button" class="item-delete acms-admin-btn-admin acms-admin-btn-admin-danger" value="削除" /></td> | |
</tr> | |
</tbody> | |
<tfoot> | |
<tr><td colspan="3"><input type="button" class="item-insert acms-admin-btn-admin" value="追加" /></td> | |
</tr> | |
</tfoot> | |
</table> | |
<input type="hidden" name="@dategroup[]" value="dateitem" /> | |
<input type="hidden" name="field[]" value="dateitem" /> | |
<input type="hidden" name="field[]" value="@dategroup" /> | |
<script> | |
ACMS.addListener("acmsAddCustomFieldGroup",function(){ | |
$(".js-datepicker").removeClass("hasDatepicker"); | |
$(".js-datepicker").each(function(i){ | |
var id = $(this).attr("id"); | |
$(this).attr("id",id+i); | |
$(this).datepicker(ACMS.Config.dpicConfig); | |
}); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment