Browse Source

Eliminates headers of unused sections in displayMode

Nathan Schneider 4 years ago
parent
commit
2e915c590c
3 changed files with 47 additions and 22 deletions
  1. 34 16
      _layouts/rule.html
  2. 12 5
      about.md
  3. 1 1
      create.md

+ 34 - 16
_layouts/rule.html

@@ -137,13 +137,35 @@ These are the major functional buttons*/
           classDisplayAll("button","none");
           classDisplayAll("question","none");
           var editableFields = document.getElementsByClassName("editable");  
+          // de-editable-ize the editable fields
           for (var i = 0; i < editableFields.length; i++) {
               editableFields[i].contentEditable = "false";
               editableFields[i].style.borderStyle = "none";
+              // Remove empty fields entirely
               if (editableFields[i].innerHTML === "") {
                   editableFields[i].style.display = "none";
+              }   
+          }
+          // Remove headers of empty sections
+          // Inefficient! Might be merged with the above iteration
+          var sections = document.getElementsByClassName("section");
+          for (var i = 0; i < sections.length; i++) {
+              console.log(sections[i]);
+              var sectionQuestions = sections[i].getElementsByClassName("editable");
+              var blanks = 0;
+              for (var x = 0; x < sectionQuestions.length; x++) {
+                  console.log(sectionQuestions[x].innerHTML);
+                  if (sectionQuestions[x].innerHTML == "") { blanks++; }
+                  if (blanks == sectionQuestions.length) {
+                      console.log(sections[i].style.display)
+                      console.log("triggered!");
+                      var headerID = "header-s" + (i + 1);
+                      console.log("removing: " + headerID);
+                      document.getElementById(headerID).style.display = "none";
+                  }
               }
           }
+          // Finally, change button name
           document.getElementById("editToggle").innerHTML = "Customize";
       } else {
           editMode = true;
@@ -156,6 +178,7 @@ These are the major functional buttons*/
               editableFields[i].style.borderStyle = "none none dashed none";
               editableFields[i].contentEditable = "true";
           }
+          // Change button name
           document.getElementById("editToggle").innerHTML = "Preview";
       }
   }
@@ -194,7 +217,7 @@ These are the major functional buttons*/
       var content = '# CommunityRule: ' + document.getElementById('communityname').innerHTML + '\n\n';
       var elements = document.getElementsByClassName('output');
       for (var i = 1; i < elements.length; i++) {
-          if (elements[i].innerHTML != '') {
+          if (elements[i].innerHTML != "") {
               if (elements[i].classList.contains("subhead")) {
                   content += '## ';
               }
@@ -326,7 +349,8 @@ These are the major functional buttons*/
 
     <h1 contenteditable="true" class="editable output" id="communityname">{{ page.community-name }}</h1>
 
-    <h2 id="basics">
+    <!-- SECTION S1: BASICS -->
+    <h2 id="header-s1">
       <img src="{% link assets/tabler_icons/info-circle.svg %}"
            class="icons" />
       <span class="subhead output">Basics</span>
@@ -358,7 +382,7 @@ These are the major functional buttons*/
     </div><!--hiding section s1-->
 
     <!-- SECTION s2: PARTICIPANTS -->
-    <h2 id="participants">
+    <h2 id="header-s2">
       <img src="{% link assets/tabler_icons/user.svg %}"
            class="icons" />
       <span class="subhead output">Participants</span>
@@ -394,11 +418,11 @@ These are the major functional buttons*/
     
   </div><!--hiding section s2-->
 
-  <!--SECTION: POLICIES-->
-  <h2 id="policies">
+  <!--SECTION s3: POLICY-->
+  <h2 id="header-s3">
     <img src="{% link assets/tabler_icons/news.svg %}"
          class="icons" />
-    <span class="subhead output">Policies</span>
+    <span class="subhead output">Policy</span>
     <button onclick="toggleVisible('s3')" class="button plus"> + </button>
   </h2>
   <div class="section" id="s3" style="display:none">
@@ -412,12 +436,6 @@ These are the major functional buttons*/
     </div>
     <p contenteditable="true" class="editable output" id="decision">{{ page.decision }}</p>
   
-    <span class="question">Where do community members deliberate about potential policies?</span>
-    <div class="button">Modules
-      <span class="tooltiptext"><a target="_blank" href="https://democraticmediums.info/mediums/caucus/">caucus</a>, <a target="_blank" href="https://democraticmediums.info/mediums/coalition/">coalition</a>, <a target="_blank" href="https://democraticmediums.info/mediums/board/">board</a>, <a target="_blank" href="https://democraticmediums.info/mediums/debate/">debate</a>, <a target="_blank" href="https://democraticmediums.info/mediums/lobbying/">lobbying</a>, <a target="_blank" href="https://democraticmediums.info/mediums/recess/">recess</a>, <a target="_blank" href="https://democraticmediums.info/mediums/secrecy/">secrecy</a>, <a target="_blank" href="https://democraticmediums.info/mediums/transparency/">transparency</a></span>
-    </div>
-    <p contenteditable="true" class="editable output" id="deliberation">{{ page.deliberation }}</p>
-
     <span class="question">How are policies implemented?</span>
     <div class="button">Modules
       <span class="tooltiptext"><a target="_blank" href="https://democraticmediums.info/mediums/exclusion/">exclusion</a>, <a target="_blank" href="https://democraticmediums.info/mediums/lazy_consensus/">lazy consensus</a>, <a target="_blank" href="https://democraticmediums.info/mediums/restorative_justice/">restorative justice</a></span>
@@ -432,8 +450,8 @@ These are the major functional buttons*/
     
   </div><!--hiding section s3-->
 
-  <!-- SECTION: PROCESS -->
-  <h2 id="process">
+  <!-- SECTION s4: PROCESS -->
+  <h2 id="header-s4">
     <img src="{% link assets/tabler_icons/refresh.svg %}"
          class="icons" />
     <span class="subhead output">Process</span>
@@ -461,8 +479,8 @@ These are the major functional buttons*/
     
   </div><!--hiding section s4-->
 
-  <!-- SECTION: EVOLUTION -->
-  <h2 id="evolution">
+  <!-- SECTION s5: EVOLUTION -->
+  <h2 id="header-s5">
     <img src="{% link assets/tabler_icons/adjustments.svg %}"
          class="icons" />
     <span class="subhead output">Evolution</span>

+ 12 - 5
about.md

@@ -9,18 +9,25 @@ community-name:
 structure: CommunityRule is a governance toolkit for great communities.
 mission: Too many of our communities adopt default governance practices that rely on the authority of founders, admins, or moderators, lacking even basic features of small-scale democracy. The purpose of CommunityRule is to help communities establish appropriate norms for decision-making, stewardship, and culture.
 values:
-rights: This tool is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License, which means that anyone has the right to use and adapt it, the result of which must be shared under the same license. This gives communities using CommunityRule the right to learn from one another.
+legal: We acknowledge that the practices we share here have long roots in many cultures. To ensure this inheritance remains a commons, content on CommunityRule is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License, which means that anyone has the right to use and adapt it, the result of which must be shared under the same license.
 
 # PARTICIPANTS
-membership: CommunityRule is a project of the Media Enterprise Design Lab at the University of Colorado Boulder, in collaboration with the Metagovernance Project (metagov.org). Anyone who finds this project useful, or potentially so, is welcome to contribute suggestions, changes, and additions. To do so, post Issues and Merge Requests to the project on GitLab (see footer for link), or send an email to medlab@colorado.edu.
+membership: CommunityRule is a project of the Media Enterprise Design Lab at the University of Colorado Boulder, in collaboration with the Metagovernance Project (metagov.org). Anyone who finds this project useful, or potentially so, is welcome to contribute suggestions, changes, and additions.
 removal:
+roles: CommunityRule is currently administered and primarily authored by MEDLab director Nathan Schneider.
+limits: 
 
 # POLICIES
+rights: 
 decision: 
-deliberation: 
-implementation: CommunityRule is currently administered and primarily authored by MEDLab director Nathan Schneider.
+implementation: 
 oversight: 
-limits: 
+
+# PROCESSES
+access: 
+economics: 
+deliberation: To contribute to the project, post Issues and Merge Requests to the project on GitLab (see footer for link), or send an email to medlab@colorado.edu.
+grievances: 
 
 # EVOLUTION
 records: 

+ 1 - 1
create.md

@@ -15,7 +15,7 @@ legal:
 # PARTICIPANTS
 membership:
 removal:
-rules:
+roles:
 limits: 
 
 # POLICIES