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

#324 Improve: Enable ON/OFF switch of attaching a title header
* commit changeset but it dosen't work...

Tatsuya Ise 8 лет назад
Родитель
Сommit
728e0de629

+ 1 - 0
lib/form/admin/customfeatures.js

@@ -6,5 +6,6 @@ var form = require('express-form')
 module.exports = form(
   field('settingForm[customize:isEnabledTimeline]').trim().toBooleanStrict(),
   field('settingForm[customize:isSavedStatesOfTabChanges]').trim().toBooleanStrict()
+  // field('settingForm[customize:isEnabledAttachTitleHeader]').trim().toBooleanStrict()
 );
 

+ 8 - 0
lib/models/config.js

@@ -32,6 +32,7 @@ module.exports = function(crowi) {
     config['customize:behavior'] = 'growi';
     config['customize:layout'] = 'growi';
     config['customize:isSavedStatesOfTabChanges'] = false;
+    // config['customize:isEnabledAttachTitleHeader'] = false;
 
     return config;
   }
@@ -91,6 +92,7 @@ module.exports = function(crowi) {
       'customize:layout' : 'crowi',
       'customize:isEnabledTimeline' : true,
       'customize:isSavedStatesOfTabChanges' : true,
+      // 'customize:isEnabledAttachTitleHeader' : true,
     };
   }
 
@@ -422,6 +424,12 @@ module.exports = function(crowi) {
     return getValueForCrowiNS(config, key);
   };
 
+  // configSchema.statics.isEnabledAttachTitleHeader = function(config)
+  // {
+  //   const key = 'customize:isEnabledAttachTitleHeader';
+  //   return getValueForCrowiNS(config, key);
+  // };
+
   configSchema.statics.fileUploadEnabled = function(config)
   {
     const Config = this;

+ 1 - 0
lib/routes/admin.js

@@ -132,6 +132,7 @@ module.exports = function(crowi, app) {
   actions.customize = {};
   actions.customize.index = function(req, res) {
     var settingForm;
+    debug("Here!");
     settingForm = Config.setupCofigFormData('crowi', req.config);
 
     const highlightJsCssSelectorOptions = {

+ 5 - 0
lib/util/swigFunctions.js

@@ -171,6 +171,11 @@ module.exports = function(crowi, app, req, locals) {
     return Config.isUploadable(config);
   };
 
+  // locals.isEnabledAttachTitleHeader = function() {
+  //   var config = crowi.getConfig()
+  //   return Config.isEnabledAttachTitleHeader(config);
+  // };
+
   locals.parentPath = function(path) {
     if (path == '/') {
       return path;

+ 1 - 0
lib/views/_form.html

@@ -17,6 +17,7 @@
 <form action="/_/edit" id="page-form" method="post" class="{% if isUploadable() %}uploadable{% endif %} page-form">
 
   <div id="page-editor">{% if pageForm.body %}{{ pageForm.body }}{% endif %}</div>
+  <!-- <div id="page-editor">{% if pageForm.body %}{{ pageForm.body }}{% elseif isEnabledAttachTitleHeader() %}# {{ path|path2name }}{% endif %}</div> -->
 
   <input type="hidden" id="form-body" name="pageForm[body]" value="{% if pageForm.body %}{{ pageForm.body }}{% endif %}">
   <input type="hidden" name="pageForm[path]" value="{{ path }}">

+ 23 - 0
lib/views/admin/customize.html

@@ -243,6 +243,29 @@
             </p>
           </div>
         </div>
+<!--
+        <div class="form-group">
+          <label for="settingForm[customize:isEnabledAttachTitleHeader]" class="col-xs-3 control-label">{{ t("customize_page.tab_switch") }}</label>
+          <div class="col-xs-9">
+            <div class="btn-group btn-toggle" data-toggle="buttons">
+              <label class="btn btn-default btn-rounded btn-outline {% if settingForm['customize:isEnabledAttachTitleHeader'] %}active{% endif %}"
+                data-active-class="primary">
+                <input name="settingForm[customize:isEnabledAttachTitleHeader]" value="true" type="radio" {% if true===s ettingForm[
+                  'customize:isEnabledAttachTitleHeader'] %}checked{% endif %}> ON
+              </label>
+              <label class="btn btn-default btn-rounded btn-outline {% if !settingForm['customize:isEnabledAttachTitleHeader'] %}active{% endif %}"
+                data-active-class="default">
+                <input name="settingForm[customize:isEnabledAttachTitleHeader]" value="false" type="radio" {% if !settingForm[
+                  'customize:isEnabledAttachTitleHeader'] %}checked{% endif %}> OFF
+              </label>
+            </div>
+
+            <p class="help-block">
+              {{ t("customize_page.save_edit") }}
+              <br> {{ t("customize_page.by_invalidating") }}
+            </p>
+          </div>
+        </div> -->
 
         <div class="form-group">
           <div class="col-xs-offset-3 col-xs-6">