|
@@ -236,11 +236,43 @@
|
|
|
</fieldset>
|
|
</fieldset>
|
|
|
</form>
|
|
</form>
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+ <form action="/_api/admin/customize/script" method="post" class="form-horizontal" id="cutomscriptSettingForm" role="form">
|
|
|
|
|
+ <fieldset>
|
|
|
|
|
+ <legend>カスタムスクリプト</legend>
|
|
|
|
|
+
|
|
|
|
|
+ <p class="help-block">
|
|
|
|
|
+ システム全体に適用されるJavaScriptを記述できます。<br>
|
|
|
|
|
+ 変更の反映はページの更新が必要です。
|
|
|
|
|
+ </p>
|
|
|
|
|
+
|
|
|
|
|
+ <div class="form-group">
|
|
|
|
|
+ <div class="col-xs-12">
|
|
|
|
|
+ <textarea id="taCustomScript" class="form-control" type="textarea" name="settingForm[customize:script]" rows="20">{{ settingForm['customize:script'] }}</textarea>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="col-xs-12">
|
|
|
|
|
+ <p class="help-block text-right">
|
|
|
|
|
+ <i class="fa fa-fw fa-keyboard-o" aria-hidden="true"></i>
|
|
|
|
|
+ Ctrl+Space でコード補完
|
|
|
|
|
+ </p>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+
|
|
|
|
|
+ <div class="form-group">
|
|
|
|
|
+ <div class="col-xs-offset-5 col-xs-6">
|
|
|
|
|
+ <input type="hidden" name="_csrf" value="{{ csrf() }}">
|
|
|
|
|
+ <button type="submit" class="btn btn-primary">更新</button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+
|
|
|
|
|
+ </fieldset>
|
|
|
|
|
+ </form>
|
|
|
|
|
+
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
- $('#cutomcssSettingForm, #cutomlayoutSettingForm, #cutombehaviorSettingForm, #customfeaturesSettingForm').each(function() {
|
|
|
|
|
|
|
+ $('#cutomcssSettingForm, #cutomscriptSettingForm, #cutomlayoutSettingForm, #cutombehaviorSettingForm, #customfeaturesSettingForm').each(function() {
|
|
|
$(this).submit(function()
|
|
$(this).submit(function()
|
|
|
{
|
|
{
|
|
|
function showMessage(formId, msg, status) {
|
|
function showMessage(formId, msg, status) {
|
|
@@ -291,9 +323,10 @@
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
<!-- CodeMirror -->
|
|
<!-- CodeMirror -->
|
|
|
- <script src="https://cdn.jsdelivr.net/g/codemirror@4.5.0(codemirror.min.js+addon/lint/css-lint.js+mode/css/css.js+addon/hint/css-hint.js+addon/hint/show-hint.js+addon/edit/matchbrackets.js+addon/edit/closebrackets.js),jquery.ui@1.11.4"></script>
|
|
|
|
|
|
|
+ <script src="https://cdn.jsdelivr.net/g/codemirror@4.5.0(codemirror.min.js+addon/lint/css-lint.js+addon/lint/javascript-lint.js+mode/css/css.js+mode/javascript/javascript.js+addon/hint/css-hint.js+addon/hint/javascript-hint.js+addon/hint/show-hint.js+addon/edit/matchbrackets.js+addon/edit/closebrackets.js),jquery.ui@1.11.4"></script>
|
|
|
<script>
|
|
<script>
|
|
|
- var editor = CodeMirror.fromTextArea(document.getElementById('taCustomCss'), {
|
|
|
|
|
|
|
+ // Configure for CSS editor
|
|
|
|
|
+ var editorCss = CodeMirror.fromTextArea(document.getElementById('taCustomCss'), {
|
|
|
mode: "css",
|
|
mode: "css",
|
|
|
lineNumbers: true,
|
|
lineNumbers: true,
|
|
|
tabSize: 2,
|
|
tabSize: 2,
|
|
@@ -303,13 +336,34 @@
|
|
|
autoCloseBrackets: true,
|
|
autoCloseBrackets: true,
|
|
|
extraKeys: {"Ctrl-Space": "autocomplete"},
|
|
extraKeys: {"Ctrl-Space": "autocomplete"},
|
|
|
});
|
|
});
|
|
|
- editor.on('change', function(cm, change) {
|
|
|
|
|
|
|
+ editorCss.on('change', function(cm, change) {
|
|
|
|
|
+ cm.save();
|
|
|
|
|
+ });
|
|
|
|
|
+ // resizable with jquery.ui
|
|
|
|
|
+ $(editorCss.getWrapperElement()).resizable({
|
|
|
|
|
+ resize: function() {
|
|
|
|
|
+ editorCss.setSize($(this).width(), $(this).height());
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ // Configure for JavaScript editor
|
|
|
|
|
+ var editorScript = CodeMirror.fromTextArea(document.getElementById('taCustomScript'), {
|
|
|
|
|
+ mode: "javascript",
|
|
|
|
|
+ lineNumbers: true,
|
|
|
|
|
+ tabSize: 2,
|
|
|
|
|
+ indentUnit: 2,
|
|
|
|
|
+ theme: 'eclipse',
|
|
|
|
|
+ matchBrackets: true,
|
|
|
|
|
+ autoCloseBrackets: true,
|
|
|
|
|
+ extraKeys: {"Ctrl-Space": "autocomplete"},
|
|
|
|
|
+ });
|
|
|
|
|
+ editorScript.on('change', function(cm, change) {
|
|
|
cm.save();
|
|
cm.save();
|
|
|
});
|
|
});
|
|
|
// resizable with jquery.ui
|
|
// resizable with jquery.ui
|
|
|
- $(editor.getWrapperElement()).resizable({
|
|
|
|
|
|
|
+ $(editorScript.getWrapperElement()).resizable({
|
|
|
resize: function() {
|
|
resize: function() {
|
|
|
- editor.setSize($(this).width(), $(this).height());
|
|
|
|
|
|
|
+ editorScript.setSize($(this).width(), $(this).height());
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
|
|
|