Просмотр исходного кода

refs #276: Enable to select highlight.js style
WIP
can save custom highlight
can select highlight type to selector

大谷 東彦 8 лет назад
Родитель
Сommit
7842c69d29
3 измененных файлов с 9 добавлено и 5 удалено
  1. 1 1
      lib/models/config.js
  2. 5 0
      lib/util/swigFunctions.js
  3. 3 4
      lib/views/admin/customize.html

+ 1 - 1
lib/models/config.js

@@ -85,7 +85,7 @@ module.exports = function(crowi) {
       'customize:css' : '',
       'customize:script' : '',
       'customize:header' : '',
-      'customize:layout' : 'github',
+      'customize:highlight' : 'github',
       'customize:behavior' : 'crowi',
       'customize:layout' : 'crowi',
       'customize:isEnabledTimeline' : true,

+ 5 - 0
lib/util/swigFunctions.js

@@ -107,6 +107,11 @@ module.exports = function(crowi, app, req, locals) {
     return Config.layoutType(config);
   }
 
+  locals.highlightType = function() {
+    var config = crowi.getConfig()
+    return Config.highlightType(config);
+  }
+
   locals.isEnabledTimeline = function() {
     var config = crowi.getConfig()
     return Config.isEnabledTimeline(config);

+ 3 - 4
lib/views/admin/customize.html

@@ -148,7 +148,7 @@
           <legend>ハイライト設定</legend>
           <div class="form-group">
             <div class="col-xs-3">
-              <select class="form-control" id="number" name="number">
+              <select class="form-control" name="settingForm[customize:highlight]">
                 <option value="github">Github</option>
                 <option value="atom-one-dark">Atom One Dark</option>
                 <option value="atom-one-light">Atom One Light</option>
@@ -166,7 +166,6 @@
         </fieldset>
         </form>
 
-
       <form action="/_api/admin/customize/features" method="post" class="form-horizontal" id="customfeaturesSettingForm" role="form">
       <fieldset>
       <legend>機能</legend>
@@ -405,8 +404,8 @@ window.addEventListener('load', (event) => {
         return false;
       });
     });
-    // TODO 保存した highlight の値を selector に復元する
-    $('#cutomhighlightSettingForm select').val('github')
+    // 保存した highlight の値を selector に復元する
+    $('#cutomhighlightSettingForm select').val('{{ highlightType() }}');
 
   </script>