DokuWiki

It's better when it's simple

User Tools

Site Tools


tips:summary_enforcement

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
tips:summary_enforcement [2011-03-09 22:45] – added version with popup 129.170.131.229tips:summary_enforcement [2016-03-07 14:20] – [Discussion] 147.65.4.95
Line 2: Line 2:
  
 This enhancement requires the user to either provide a summary or check "minor changes" before saving a section or a page, thus requiring that all major changes be given a description.  You may also tweak it to always require a summary, regardless of whether "minor changes" is checked. This enhancement requires the user to either provide a summary or check "minor changes" before saving a section or a page, thus requiring that all major changes be given a description.  You may also tweak it to always require a summary, regardless of whether "minor changes" is checked.
- 
- 
  
 ===== Description ===== ===== Description =====
Line 16: Line 14:
 It's possible to modify the code so that a summary is always required, as explained below. It's possible to modify the code so that a summary is always required, as explained below.
  
-===== The Javascript =====+===== Plugin available ===== 
 + 
 +There's also a plugin available, which provides the function: [[:plugin:enforcesummary|enforcesummary]] 
 + 
 +===== Dokuwiki 2011-11-10 “Angua” ===== 
 + 
 +To install this enhancement, put the following Javascript code into the ''script.js'' file in your template directory.  You'll need to create the file if it doesn't already exist. 
 + 
 +This code uses jQuery, which has been [[devel:javascript#jquery|included]] with Dokuwiki since 2011-11-10 “Angua”.  If you are using an older version, you should [[:install:upgrade]] (or use the older code for this enhancement, given below). 
 + 
 +<file javascript script.js> 
 +jQuery(document).ready(function() { 
 + minSummaryLength = 15; 
 + $editButton = jQuery("#edbtn__save"); 
 + $minorEdit = jQuery("#minoredit"); 
 + $summary = jQuery("#edit__summary"); 
 + $summary.keyup(enforceSummary).focus(enforceSummary); 
 + $minorEdit.change(enforceSummary); 
 + enforceSummary(); // To disable form submission on page load. 
 +}); 
 +function enforceSummary() { 
 + if ($summary.val() && $summary.val().length < minSummaryLength && !$minorEdit.is(':checked')) { 
 + $summary.addClass("missing"); 
 + $editButton.attr("disabled", true).css("color", "#999"); 
 + } else { 
 + $summary.removeClass("missing"); 
 + $editButton.removeAttr("disabled").css("color", "black"); 
 +
 +
 +</file> 
 + 
 +===== Older Dokuwiki versions =====
  
 To install this enhancement, put the following Javascript code into the ''script.js'' file in your template directory.  You'll need to create the file if it doesn't already exist. To install this enhancement, put the following Javascript code into the ''script.js'' file in your template directory.  You'll need to create the file if it doesn't already exist.
Line 68: Line 97:
 </code> </code>
  
-===== The CSS =====+==== The CSS ====
  
 Most browsers will not give you a visual indication that the button is disabled; they just won't let you click on the button.  If you want a disabled ''Save'' button to be grayed out, include the following CSS in one of your template's stylesheets: Most browsers will not give you a visual indication that the button is disabled; they just won't let you click on the button.  If you want a disabled ''Save'' button to be grayed out, include the following CSS in one of your template's stylesheets:
Line 232: Line 261:
 </code> </code>
 --- James 2011/3/9 --- James 2011/3/9
 +
 +Great plugin!
 +
 +But right now Dokuwiki fills the "Edit Summary" field automatically when someone uses the [[:section_editing|Section Editing]] feature (such as right now while I'm editing).
 +
 +How do I disable this feature, to enforce a really meaningful summary?
 +
 +--- Augusto 2016-03-07
 +
tips/summary_enforcement.txt · Last modified: 2023-06-19 15:20 by asheenlevrai

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki