Last active
May 17, 2019 05:36
-
-
Save webbingstudio/11c268649967cb249fe1ecfbb3503af5 to your computer and use it in GitHub Desktop.
a-blog cmsのエントリー基本項目を「edit.html」を編集せずカスタマイズする ref: https://qiita.com/webbingstudio@github/items/5ee65c3c68c859532627
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
<script> | |
ACMS.Ready(function() { | |
var f = $('form#entryForm'); | |
var current_rccd = '%{RCCD}'; | |
var current_ccd = '%{CCD}'; | |
var current_cname = '%{CATEGORY_NAME}'; | |
var current_eid = '%{EID}'; | |
// ここにスクリプトを書きます | |
}); | |
</script> |
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
// デフォルトのステータスを「公開」にする | |
$('select[name="status"]', f).val('open'); |
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
// タグ欄を非表示にする | |
$('input[name="tag"]', f).closest('tr') | |
.css({ | |
display: 'none' | |
}); |
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
// カテゴリーを変更不可にする | |
if(current_cname == '') { | |
current_label = "指定なし"; | |
} else { | |
current_label = current_cname; | |
} | |
$('select[name="category_id"]', f).closest('td') | |
.wrapInner('<div style="display: none;"></div>') | |
.append('<span class="acms-admin-text-danger">' + current_label + '</span>'); |
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
// 特定カテゴリーのときだけタイトル欄を変える | |
if(current_ccd == 'staff') { | |
$('input[name="title"]', f) | |
.css({ | |
maxWidth: '10em' | |
}) | |
.attr('placeholder', '山田 太郎') | |
.closest('td') | |
.siblings('th') | |
.text('氏名'); | |
} |
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
// インデキシングの後に説明文を追加する | |
$('input[name="indexing"]', f).closest('tr').find('th').append('<i class="acms-admin-icon-tooltip js-acms-tooltip acms-admin-margin-left-mini" data-acms-tooltip="チェックを外すと、このエントリーは一覧ページに表示されない「隠しページ」となります。"></i>'); |
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
// 新規作成時のタイトルを自動入力する | |
if(current_cname == '') { | |
current_label = ''; | |
} else { | |
current_label = current_cname + ':'; | |
} | |
if(current_eid == ''){ | |
var now = new Date(); | |
var timestamp = ''; | |
timestamp = | |
now.getFullYear() | |
+ '-' + ('0' + (now.getMonth() + 1)).slice(-2) | |
+ '-' + ('0' + now.getDate()).slice(-2) | |
+ ' ' + ('0' + now.getHours()).slice(-2) | |
+ ':' + ('0' + now.getMinutes()).slice(-2) | |
+ ':' + ('0' + now.getSeconds()).slice(-2); | |
$('input[name="title"]', f).val(current_label + timestamp); | |
} |
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
<!-- BEGIN_MODULE sample:veil --> | |
============================================= | |
jQueryによるフォーム項目修正 | |
/include/head/js.html を参照 | |
============================================= | |
<!-- END_MODULE sample:veil --> | |
<!-- BEGIN adminEntryEdit --> | |
<div class="acms-box-medium"> | |
<!--#include file="/admin/entry/edit.html"--> | |
<!--#include file="/admin/entry/add.html"--> | |
</div> | |
<!-- END adminEntryEdit --> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment