Преглед изворни кода

add internal-implementation

itizawa пре 6 година
родитељ
комит
f8a1ffefb1

+ 1 - 0
src/server/form/admin/customfeatures.js

@@ -4,6 +4,7 @@ const field = form.field;
 
 
 module.exports = form(
 module.exports = form(
   field('settingForm[customize:isEnabledTimeline]').trim().toBooleanStrict(),
   field('settingForm[customize:isEnabledTimeline]').trim().toBooleanStrict(),
+  field('settingForm[customize:isEnabledDeleteCompletely]').trim().toBooleanStrict(),
   field('settingForm[customize:isSavedStatesOfTabChanges]').trim().toBooleanStrict(),
   field('settingForm[customize:isSavedStatesOfTabChanges]').trim().toBooleanStrict(),
   field('settingForm[customize:isEnabledAttachTitleHeader]').trim().toBooleanStrict(),
   field('settingForm[customize:isEnabledAttachTitleHeader]').trim().toBooleanStrict(),
   field('settingForm[customize:showRecentCreatedNumber]').trim().toInt(),
   field('settingForm[customize:showRecentCreatedNumber]').trim().toInt(),

+ 6 - 0
src/server/models/config.js

@@ -111,6 +111,7 @@ module.exports = function(crowi) {
       'customize:behavior' : 'crowi',
       'customize:behavior' : 'crowi',
       'customize:layout' : 'crowi',
       'customize:layout' : 'crowi',
       'customize:isEnabledTimeline' : true,
       'customize:isEnabledTimeline' : true,
+      'customize:isEnabledDeleteCompletely' : false,
       'customize:isSavedStatesOfTabChanges' : true,
       'customize:isSavedStatesOfTabChanges' : true,
       'customize:isEnabledAttachTitleHeader' : false,
       'customize:isEnabledAttachTitleHeader' : false,
       'customize:showRecentCreatedNumber' : 10,
       'customize:showRecentCreatedNumber' : 10,
@@ -545,6 +546,11 @@ module.exports = function(crowi) {
     return getValueForCrowiNS(config, key);
     return getValueForCrowiNS(config, key);
   };
   };
 
 
+  configSchema.statics.isEnabledDeleteCompletely = function(config) {
+    const key = 'isEnabledDeleteCompletely';
+    return getValueForCrowiNS(config, key);
+  };
+
   configSchema.statics.isSavedStatesOfTabChanges = function(config) {
   configSchema.statics.isSavedStatesOfTabChanges = function(config) {
     const key = 'customize:isSavedStatesOfTabChanges';
     const key = 'customize:isSavedStatesOfTabChanges';
     return getValueForCrowiNS(config, key);
     return getValueForCrowiNS(config, key);

+ 5 - 0
src/server/util/swigFunctions.js

@@ -257,6 +257,11 @@ module.exports = function(crowi, app, req, locals) {
     return Config.isEnabledTimeline(config);
     return Config.isEnabledTimeline(config);
   };
   };
 
 
+  locals.isEnabledDeleteCompletely = function() {
+    const config = crowi.getConfig();
+    return Config.isEnabledDeleteCompletely(config);
+  };
+
   locals.isUploadable = function() {
   locals.isUploadable = function() {
     const config = crowi.getConfig();
     const config = crowi.getConfig();
     return Config.isUploadable(config);
     return Config.isUploadable(config);

+ 21 - 0
src/server/views/admin/customize.html

@@ -242,6 +242,27 @@
             </div>
             </div>
           </div>
           </div>
 
 
+          <!-- GC-1755 Change Sentence -->
+          <div class="form-group">
+            <label for="settingForm[customize:isEnabledDeleteCompletely]" class="col-xs-3 control-label">ページを完全削除できるユーザーを制限する</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:isEnabledDeleteCompletely'] %}active{% endif %}" data-active-class="primary">
+                  <input name="settingForm[customize:isEnabledDeleteCompletely]" value="true" type="radio"
+                      {% if true === settingForm['customize:isEnabledDeleteCompletely'] %}checked{% endif %}> ON
+                </label>
+                <label class="btn btn-default btn-rounded btn-outline {% if !settingForm['customize:isEnabledDeleteCompletely'] %}active{% endif %}" data-active-class="default">
+                  <input name="settingForm[customize:isEnabledDeleteCompletely]" value="false" type="radio"
+                      {% if !settingForm['customize:isEnabledDeleteCompletely'] %}checked{% endif %}> OFF
+                </label>
+              </div>
+
+              <p class="help-block">
+                ページを完全削除できるユーザーを管理者のみに制限します。
+              </p>
+            </div>
+          </div>
+
           <div class="form-group">
           <div class="form-group">
             <label for="settingForm[customize:isSavedStatesOfTabChanges]" class="col-xs-3 control-label">{{ t("customize_page.tab_switch") }}</label>
             <label for="settingForm[customize:isSavedStatesOfTabChanges]" class="col-xs-3 control-label">{{ t("customize_page.tab_switch") }}</label>
             <div class="col-xs-9">
             <div class="col-xs-9">