| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260 |
- {% extends '../layout/admin.html' %}
- {% block html_title %}カスタマイズ · {% endblock %}
- {% block html_additional_headers %}
- <!-- CodeMirror -->
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/g/codemirror@4.5.0(codemirror.css+addon/hint/show-hint.css)">
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/jquery.ui/1.11.4/jquery-ui.min.css">
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/codemirror/4.5.0/theme/eclipse.css">
- <style>
- .CodeMirror {
- border: 1px solid #eee;
- }
- </style>
- {% endblock %}
- {% block content_head %}
- <div class="header-wrap">
- <header id="page-header">
- <h1 class="title" id="">カスタマイズ</h1>
- </header>
- </div>
- {% endblock %}
- {% block content_main %}
- <div class="content-main admin-customize">
- {% set smessage = req.flash('successMessage') %}
- {% if smessage.length %}
- <div class="alert alert-success">
- {{ smessage }}
- </div>
- {% endif %}
- {% set emessage = req.flash('errorMessage') %}
- {% if emessage.length %}
- <div class="alert alert-danger">
- {{ emessage }}
- </div>
- {% endif %}
- <div class="row">
- <div class="col-md-3">
- {% include './widget/menu.html' with {current: 'customize'} %}
- </div>
- <div class="col-md-9">
- <form action="/_api/admin/customize/behavior" method="post" class="form-horizontal" id="cutombehaviorSettingForm" role="form">
- <fieldset>
- <legend>挙動</legend>
- <div class="form-group">
- <div class="col-xs-6">
- <h4>
- <input type="radio" name="settingForm[customize:behavior]" value="crowi"
- {% if !settingForm['customize:behavior'] || 'crowi' === settingForm['customize:behavior'] %}checked="checked"{% endif %}>
- Official Crowi Behavior
- </h4>
- <ul>
- <li><code>/page</code> shows the page</li>
- <li><code>/page/</code> shows the list of sub pages</li>
- <ul>
- <li>If portal is applied to <code>/page/</code> , the portal and the list of sub pages are shown</li>
- </ul>
- <li><code>/nonexistent_page</code> shows editing form</li>
- <li><code>/nonexistent_page/</code> the list of sub pages</li>
- </ul>
- </div>
- <div class="col-xs-6">
- <h4>
- <input type="radio" name="settingForm[customize:behavior]" value="crowi-plus"
- {% if 'crowi-plus' === settingForm['customize:behavior'] %}checked="checked"{% endif %}>
- crowi-plus Simplified Behavior <small class="text-success">(Recommended)</small>
- </h4>
- <ul>
- <li><code>/page</code> and <code>/page/</code> both shows the page</li>
- <li><code>/nonexistent_page</code> shows editing form</li>
- <li>All pages shows the list of sub pages</li>
- </ul>
- </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>
- <form action="/_api/admin/customize/layout" method="post" class="form-horizontal" id="cutomlayoutSettingForm" role="form">
- <fieldset>
- <legend>レイアウト</legend>
- <div class="form-group">
- <div class="col-xs-6">
- <h4>
- <input type="radio" name="settingForm[customize:layout]" value="crowi"
- {% if !settingForm['customize:layout'] || 'crowi' === settingForm['customize:layout'] %}checked="checked"{% endif %}>
- Official Crowi Classic Layout
- </h4>
- <a href="/images/admin/customize/layout-classic.gif" class="ss-container">
- <img src="/images/admin/customize/layout-classic-thumb.gif" width="240px">
- </a>
- <ul>
- <li>Functional</li>
- <ul>
- <li>Collapsible Sidebar</li>
- <li>Show and post comments in Sidebar</li>
- <li>Collapsible Table-of-contents</li>
- </ul>
- </ul>
- </div>
- <div class="col-xs-6">
- <h4>
- <input type="radio" name="settingForm[customize:layout]" value="crowi-plus"
- {% if 'crowi-plus' === settingForm['customize:layout'] %}checked="checked"{% endif %}>
- crowi-plus Enhanced Layout <small class="text-success">(Recommended)</small>
- </h4>
- <a href="/images/admin/customize/layout-crowi-plus.gif" class="ss-container">
- <img src="/images/admin/customize/layout-crowi-plus-thumb.gif" width="240px">
- </a>
- <ul>
- <li>Simple and Clear</li>
- <ul>
- <li>Show and post comments from the bottom of the page</li>
- <li>Affix Table-of-contents</li>
- </ul>
- </ul>
- </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>
- <form action="/_api/admin/customize/css" method="post" class="form-horizontal" id="cutomcssSettingForm" role="form">
- <fieldset>
- <legend>カスタムCSS</legend>
- <p class="help-block">
- システム全体に適用されるCSSを記述できます。<br>
- 変更の反映はページの更新が必要です。
- </p>
- <div class="form-group">
- <div class="col-xs-12">
- <textarea id="taCustomCss" class="form-control" type="textarea" name="settingForm[customize:css]" rows="20">{{ settingForm['customize:css'] }}</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>
- <script>
- $('#cutomcssSettingForm, #cutomlayoutSettingForm, #cutombehaviorSettingForm').each(function() {
- $(this).submit(function()
- {
- function showMessage(formId, msg, status) {
- $('#' + formId + ' .alert').remove();
- if (!status) {
- status = 'success';
- }
- var $message = $('<p class="alert"></p>');
- $message.addClass('alert-' + status);
- $message.html(msg.replace('\n', '<br>'));
- $message.insertAfter('#' + formId + ' legend');
- if (status == 'success') {
- setTimeout(function()
- {
- $message.fadeOut({
- complete: function() {
- $message.remove();
- }
- });
- }, 5000);
- }
- }
- var $form = $(this);
- var $id = $form.attr('id');
- var $button = $('button', this);
- $button.attr('disabled', 'disabled');
- var jqxhr = $.post($form.attr('action'), $form.serialize(), function(data)
- {
- if (data.status) {
- showMessage($id, '更新しました');
- } else {
- showMessage($id, data.message, 'danger');
- }
- })
- .fail(function() {
- showMessage($id, 'エラーが発生しました', 'danger');
- })
- .always(function() {
- $button.prop('disabled', false);
- });
- return false;
- });
- });
- </script>
- <!-- 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>
- var editor = CodeMirror.fromTextArea(document.getElementById('taCustomCss'), {
- mode: "css",
- lineNumbers: true,
- tabSize: 2,
- indentUnit: 2,
- theme: 'eclipse',
- matchBrackets: true,
- autoCloseBrackets: true,
- extraKeys: {"Ctrl-Space": "autocomplete"},
- });
- editor.on('change', function(cm, change) {
- cm.save();
- });
- // resizable with jquery.ui
- $(editor.getWrapperElement()).resizable({
- resize: function() {
- editor.setSize($(this).width(), $(this).height());
- }
- });
- </script>
- </div>
- {% endblock content_main %}
- {% block content_footer %}
- {% endblock content_footer %}
|