rule.html 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762
  1. ---
  2. layout: default
  3. # This is where most of the code for CommunityRule lives
  4. # Follow comments below in various sections for further explanation
  5. ---
  6. <script>
  7. // Enter JavaScript-land!
  8. // First, some functions, followed by initialization commands
  9. // Begin BUILDER functions
  10. // source: https://www.codecanal.com/html5-drag-and-copy/
  11. function allowDrop(ev) {
  12. ev.preventDefault();
  13. }
  14. function drag(ev) {
  15. ev.dataTransfer.setData("text", ev.target.id);
  16. }
  17. function drop(ev) {
  18. ev.preventDefault();
  19. var target = ev.target;
  20. // First, confirm target location is valid
  21. function targetCheck () {
  22. if (target.id == "module-input") {
  23. return true;
  24. } else if (!document.getElementById("module-input").contains(target)) {
  25. // Ignore destinations not in the correct area
  26. return false;
  27. } else if (target.id == "drag-directions") {
  28. // Prevents dropping into dummy text field
  29. target = target.parentElement;
  30. return true;
  31. } else if (target.classList[0] == "module") {
  32. return true;
  33. } else {
  34. // be sure we're adding to module, not its children
  35. target = target.parentElement;
  36. return targetCheck();
  37. }
  38. }
  39. if (!targetCheck()) { return; }
  40. // Set up transfer
  41. var data = ev.dataTransfer.getData("text");
  42. // Iff module is from the menu clone it
  43. var module = document.getElementById(data);
  44. if (module.parentElement.id == "module-menu") {
  45. module = module.cloneNode(true);
  46. var name = null;
  47. if (module.id == "module-custom") {
  48. // For custom modules: replace the <input> with text
  49. name = module.getElementsByTagName("input")[0].value;
  50. module.getElementsByTagName("input")[0].remove();
  51. var customText = document.createElement("span");
  52. customText.onClick = "moduleEditField(this.parentNode.id)";
  53. customText.id = "module-name";
  54. customText.append(name);
  55. module.prepend(customText);
  56. }
  57. // append id with unique timestamp
  58. var nowModule = new Date();
  59. module.id += "-" + nowModule.getTime();
  60. }
  61. // display the deletion button
  62. module.children[2].style.display = "inline";
  63. // pop it in!
  64. target.appendChild(module);
  65. // set up the editing field
  66. moduleEditField(module.id);
  67. // be sure the dummy text is gone
  68. if (document.contains(document.getElementById("drag-directions"))) {
  69. document.getElementById("drag-directions").remove();
  70. }
  71. }
  72. // Edits the title field of a given module based on #custom-field
  73. function moduleTitleEdit(moduleID) {
  74. var module = document.getElementById(moduleID).children[0];
  75. var content =
  76. stripHTML(document.getElementById("custom-field").innerHTML);
  77. module.title = content;
  78. }
  79. // Sets up a field for displaying and editing module details
  80. function moduleEditField(moduleID) {
  81. var module = document.getElementById(moduleID);
  82. var moduleName = module.children[0].innerHTML;
  83. var moduleTitle = module.children[0].title;
  84. if (editMode) {
  85. var query = "Explain how the <strong>" + moduleName
  86. + "</strong> module works.";
  87. var destination = document.getElementById("builder-field");
  88. if (moduleName == null) { moduleName = ""; }
  89. var output = '\n<div id="custom-field-container">';
  90. output += '<span class="question">' + query + '</span>';
  91. output += '<div class="field-controls"><a onclick="this.parentNode.parentNode.remove()"><img src="{% link assets/tabler_icons/x.svg %}" class="delete-module" /></a></div>';
  92. output += '<p contenteditable="true" class="editable" id="custom-field" oninput="moduleTitleEdit(\'' + moduleID + '\')">' + moduleTitle + '</p>';
  93. output += '</div>\n';
  94. destination.innerHTML = output;
  95. } else {
  96. var output = '\n<div id="custom-field-container">';
  97. output += '<div class="field-controls"><a onclick="this.parentNode.parentNode.remove()"><img src="{% link assets/tabler_icons/x.svg %}" class="delete-module" /></a></div>';
  98. output += '<p class="editable" id="custom-field">'
  99. + moduleTitle + '</p>';
  100. }
  101. }
  102. // Tests if the RuleBuilder is empty
  103. function builderEmpty() {
  104. var builder = document.getElementById("module-input");
  105. var childs = builder.children;
  106. if (builder.getElementsByClassName("module").length > 0) {
  107. return false;
  108. } else {
  109. return true;
  110. }
  111. }
  112. // Turns RuleBuilder contents into an output-ready nested array
  113. // Returns empty array if no modules
  114. function builderArray() {
  115. var modules = document.getElementById("module-input").children;
  116. // takes an array of children
  117. // returns an array with all modules in the array, recursively nested
  118. function iterateArray (childs) {
  119. var moduleArray = [];
  120. if (childs.length > 0) {
  121. for (var i = 0; i < childs.length; i++) {
  122. module = childs[i];
  123. if (module.classList[0] == "module") {
  124. var moduleName = module.children.item("module-name");
  125. var moduleData = moduleName.title;
  126. var moduleChilds = module.children;
  127. moduleArray.push(
  128. [stripHTML(moduleName.innerHTML),
  129. stripHTML(moduleData),
  130. iterateArray(moduleChilds)]);
  131. }
  132. }
  133. }
  134. return moduleArray;
  135. } // end function
  136. return iterateArray(modules);
  137. }
  138. // returns HTML version of Builder content
  139. function displayBuilderHTML() {
  140. var output = "";
  141. var mainArray = builderArray();
  142. function arrayHTML(thisArray) {
  143. var thisOutput = "";
  144. if (thisArray.length > 0) {
  145. thisOutput += '<ul class="builder-list">\n';
  146. for (var i = 0; i < thisArray.length; i++) {
  147. var item = thisArray[i];
  148. thisOutput += '<li><strong>' + item[0] + '</strong> ';
  149. thisOutput += item[1] + '</li>\n';
  150. if (item[2].length > 0) {
  151. thisOutput += arrayHTML(item[2]);
  152. }
  153. }
  154. thisOutput += '</ul>\n';
  155. }
  156. return thisOutput
  157. }
  158. return arrayHTML(mainArray);
  159. }
  160. // returns Markdown version of Builder content
  161. function displayBuilderMD() {
  162. var mainArray = builderArray();
  163. var indentLevel = 0;
  164. function arrayMD(thisArray) {
  165. var thisOutput = "";
  166. if (thisArray.length > 0) {
  167. for (var i = 0; i < thisArray.length; i++) {
  168. var item = thisArray[i];
  169. for (var x = 0; x < indentLevel; x++) {
  170. thisOutput += " ";
  171. }
  172. thisOutput += "* **" + item[0] + "** ";
  173. thisOutput += item[1] + "\n";
  174. if (item[2].length > 0) {
  175. indentLevel++;
  176. thisOutput += arrayMD(item[2]);
  177. indentLevel--;
  178. }
  179. }
  180. }
  181. return thisOutput;
  182. }
  183. return arrayMD(mainArray);
  184. }
  185. // end RuleBuilder functions
  186. // Removes all HTML content
  187. function stripHTML(input) {
  188. input = input.replace(/(<([^>]+)>)/ig,'');
  189. return input;
  190. }
  191. // toggleVisible(id)
  192. // Toggles the visibility of a given element by given ID
  193. function toggleVisible(id) {
  194. var x = document.getElementById(id);
  195. if (x.style.display === "none") {
  196. x.style.display = "block";
  197. } else {
  198. x.style.display = "none";
  199. }
  200. }
  201. // classDisplayAll(className, value)
  202. // Assigns given display value to all elements with a given className
  203. function classDisplayAll(className, value) {
  204. var elements = document.getElementsByClassName(className);
  205. for (var i = 0; i < elements.length; i++) {
  206. elements[i].style.display = value;
  207. }
  208. }
  209. // toggleEditMode()
  210. // Toggles whether editable fields are editable or not
  211. // and removes editing tools.
  212. function toggleEditMode() {
  213. if (editMode === true) { // switch to preview mode
  214. editMode = false;
  215. classDisplayAll("section","block");
  216. classDisplayAll("button","none");
  217. classDisplayAll("question","none");
  218. classDisplayAll("metaheader","none");
  219. classDisplayAll("delete-module","none");
  220. var editableFields = document.getElementsByClassName("editable");
  221. // de-editable-ize the editable fields
  222. for (var i = 0; i < editableFields.length; i++) {
  223. editableFields[i].contentEditable = "false";
  224. editableFields[i].style.borderStyle = "none";
  225. // Remove empty fields entirely
  226. var content = editableFields[i].innerHTML;
  227. content = stripHTML(content);
  228. if (content === "") {
  229. editableFields[i].style.display = "none";
  230. }
  231. }
  232. // RuleBuilder sections
  233. if (builderEmpty()) {
  234. document.getElementById("rule-builder").style.display = "none";
  235. } else {
  236. document.getElementById("builder-field").innerHTML = displayBuilderHTML();
  237. document.getElementById("module-input").style.border = "none";
  238. }
  239. if (document.contains(document.getElementById("custom-field-container"))) {
  240. document.getElementById("custom-field-container").remove();
  241. }
  242. document.getElementById("module-menu").style.display = "none";
  243. // RuleWriter: Remove headers of empty sections
  244. var sections = document.getElementsByClassName("section");
  245. for (var i = 0; i < sections.length; i++) {
  246. var sectionQuestions = sections[i].getElementsByClassName("editable");
  247. var blanks = 0;
  248. for (var x = 0; x < sectionQuestions.length; x++) {
  249. var content = sectionQuestions[x].innerHTML;
  250. content = content.replace(/(<([^>]+)>)/ig,''); // strips stray tags
  251. if (content == "") { blanks++; }
  252. if (blanks == sectionQuestions.length) {
  253. var headerID = "header-s" + (i + 1);
  254. document.getElementById(headerID).style.display = "none";
  255. }
  256. }
  257. }
  258. // Handle author link
  259. var authorName = document.getElementById("author-text").value;
  260. var authorURL = document.getElementById("author-url").value;
  261. if (authorName != "") {
  262. document.getElementById("authorship-words").style.display = "inline";
  263. if (authorURL != "") { // both author and URL present
  264. document.getElementById("authorship-result").innerHTML = "<a href='" + authorURL +"'>" + authorName + "</a>";
  265. document.getElementById("authorship-result").style.display = "inline";
  266. } else { // only authorName present
  267. document.getElementById("authorship-result").innerHTML = authorName;
  268. document.getElementById("authorship-result").style.display = "inline";
  269. }
  270. } else {
  271. document.getElementById("authorship").style.display = "none";
  272. }
  273. // Finally, change button name
  274. document.getElementById("editToggle").innerHTML = "Customize";
  275. } else { // Switch to editMode
  276. editMode = true;
  277. classDisplayAll("button","block");
  278. classDisplayAll("question","block");
  279. classDisplayAll("editable","block");
  280. classDisplayAll("header","block");
  281. classDisplayAll("section","none");
  282. classDisplayAll("metaheader","block");
  283. classDisplayAll("link-text","inline");
  284. classDisplayAll("link-url","inline");
  285. classDisplayAll("delete-module","inline");
  286. // builder handling
  287. document.getElementById("rule-builder").style.display = "block";
  288. document.getElementById("module-input").style.border = "";
  289. document.getElementById("builder-field").innerHTML = "";
  290. // author handling
  291. document.getElementById("authorship-result").style.display = "none";
  292. document.getElementById("authorship-words").style.display = "none";
  293. document.getElementById("authorship").style.display = "block";
  294. // make all editable fields visible
  295. var editableFields = document.getElementsByClassName("editable");
  296. for (var i = 0; i < editableFields.length; i++) {
  297. editableFields[i].style.borderStyle = "none none dashed none";
  298. editableFields[i].contentEditable = "true";
  299. }
  300. // Change button name
  301. document.getElementById("editToggle").innerHTML = "Preview";
  302. }
  303. }
  304. // toggleDisplayMode()
  305. // toggles full displayMode, the Rule-only display for a published Rule
  306. // first, initialize variable:
  307. var displayMode = false;
  308. function toggleDisplayMode() {
  309. if (displayMode == false) {
  310. editMode = true;
  311. toggleEditMode(); // turns off editMode
  312. classDisplayAll("site-nav","none");
  313. classDisplayAll("post-header","none");
  314. classDisplayAll("site-footer","none");
  315. document.getElementById("attribution").style.display = "block";
  316. document.getElementById("toggleDisplayMode").style.display = "inline-block";
  317. document.getElementById("publishRule").style.display = "none";
  318. document.getElementById("trash").style.display = "inline-block";
  319. displayMode = true;
  320. } else {
  321. toggleEditMode() // turns on editMode
  322. classDisplayAll("site-nav","block");
  323. classDisplayAll("post-header","block");
  324. classDisplayAll("site-footer","block");
  325. document.getElementById("attribution").style.display = "none";
  326. document.getElementById("toggleDisplayMode").style.display = "none";
  327. document.getElementById("publishRule").style.display = "inline-block";
  328. document.getElementById("trash").style.display = "none";
  329. displayMode = false;
  330. }
  331. }
  332. // textOutput()
  333. // Produces Markdown rendition of Rule from Export button
  334. function textOutput() {
  335. var filename = 'GOVERNANCE.md';
  336. // First, add title, whether there is one or not
  337. var content = '# '+ document.getElementById('communityname').innerHTML + '\n\n';
  338. content = stripHTML(content);
  339. // Add Builder content
  340. if (!builderEmpty()) {
  341. content += displayBuilderMD() + "\n\n";
  342. }
  343. // Now, begin adding other elements
  344. var elements = document.getElementsByClassName('output');
  345. for (var i = 1; i < elements.length; i++) {
  346. var thisBit = elements[i].innerHTML;
  347. thisBit = stripHTML(thisBit);
  348. if (thisBit != "") {
  349. if (elements[i].classList.contains("subhead")) {
  350. // Before printing subhead, make sure it's not empty
  351. var i2 = i + 1;
  352. while ((i2 < elements.length) &&
  353. (!(elements[i2].classList.contains("subhead")))) {
  354. if (elements[i2].innerHTML != "") {
  355. // in this case, it's not empty, so print and move on
  356. content += '## ';
  357. content += thisBit + '\n\n';
  358. break;
  359. } else { i2++; }
  360. } // won't print anything if a subhead has only empty children
  361. } else {
  362. // Non-subhead elements can just go ahead and print
  363. content += thisBit + '\n\n';
  364. }
  365. }
  366. }
  367. // Add authorship block
  368. var authorName = document.getElementById("author-text").value;
  369. var authorURL = document.getElementById("author-url").value;
  370. var authorshipBlock = "---\n\nCreated by ";
  371. if (authorName != "") {
  372. if (authorURL != "") { // both author and URL present
  373. authorshipBlock += ("[" + authorName + "](" + authorURL + ")");
  374. } else { // only authorName present
  375. authorshipBlock += authorName;
  376. }
  377. content += (authorshipBlock + "\n");
  378. }
  379. // Add attribution block
  380. content += document.getElementById('attributionMD').innerHTML;
  381. // Starting here, see https://stackoverflow.com/a/33542499
  382. var blob = new Blob([content], {type: 'text/plain'});
  383. if(window.navigator.msSaveOrOpenBlob) {
  384. window.navigator.msSaveBlob(blob, filename);
  385. }
  386. else{
  387. var elem = window.document.createElement('a');
  388. elem.href = window.URL.createObjectURL(blob);
  389. elem.download = filename;
  390. document.body.appendChild(elem);
  391. elem.click();
  392. document.body.removeChild(elem);
  393. URL.revokeObjectURL(); // This needs an arg but I can't figure out what
  394. }
  395. var myFile = new Blob([fileContent], {type: 'text/plain'});
  396. window.URL = window.URL || window.webkitURL; document.getElementById('download').setAttribute('href',window.URL.createObjectURL(myFile));
  397. document.getElementById('download').setAttribute('download', fileName);
  398. }
  399. // BEGIN Publish tools, via SteinHQ.com
  400. // publishRule()
  401. // Publishes existing fields to new page, /builder/?rule=[ruleID]
  402. // Opens new page in Display mode
  403. function publishRule() {
  404. // Confirm user knows what they're getting into
  405. var r = confirm("Publish to the public Library?");
  406. if (r == false) { return; }
  407. // Proceed with publication
  408. var now = new Date();
  409. // Numerical ID for published Rule
  410. var timeID = now.getTime();
  411. // Readable UTC timestamp
  412. var dateTime = now.getUTCFullYear()+'.'+(now.getUTCMonth()+1)+'.'+now.getUTCDate()
  413. +' '+now.getUTCHours()+":"+ now.getUTCMinutes()+":"+now.getUTCSeconds()
  414. + ' UTC';
  415. // TKTK: Check if ruleID exists; while yes, replace and repeat
  416. var rule = [{
  417. ruleID: timeID,
  418. timestamp: dateTime,
  419. }];
  420. // begin adding data
  421. // first, RuleBuilder data
  422. document.getElementById("builder-field").innerHTML = ""; // so it doesn't publish
  423. if (!builderEmpty()) {
  424. rule[0]["builder"] = document.getElementById("module-input").innerHTML;
  425. }
  426. // next, RuleWriter data
  427. var fields = document.getElementsByClassName("editable");
  428. for (var i = 0; i < fields.length; i++) {
  429. var key = fields[i].id;
  430. var value = "";
  431. if (fields[i].nodeName == "INPUT") { // for <input>
  432. value = fields[i].value.replace(/(<([^>]+)>)/ig,"");
  433. } else { // for other fields
  434. value = fields[i].innerHTML.replace(/(<([^>]+)>)/ig,"");
  435. }
  436. rule[0][key] = value;
  437. }
  438. const store = new SteinStore(
  439. "https://api.steinhq.com/v1/storages/5e8b937ab88d3d04ae0816a5"
  440. );
  441. store.append("rules", rule).then(data => {
  442. window.open("/create/?r=" + timeID, "_self", false);
  443. });
  444. }
  445. // displayRule(ID)
  446. // Displays content based on ID
  447. function displayRule(ID) {
  448. const store = new SteinStore(
  449. "https://api.steinhq.com/v1/storages/5e8b937ab88d3d04ae0816a5"
  450. );
  451. store.read(sheet, { search: { ruleID: ID } }).then(data => {
  452. // reads sheet variable from below
  453. // only runs when we have the data from Goog:
  454. var rule = data[0];
  455. var fields = document.getElementsByClassName("editable");
  456. for (var i = 0; i < fields.length; i++) {
  457. var key = fields[i].id;
  458. var value = rule[key];
  459. if (typeof value === "undefined") {
  460. value = "";
  461. } else if (key.includes("-")) { // links
  462. document.getElementById(key).value = value;
  463. } else {
  464. document.getElementById(key).innerHTML = value;
  465. }
  466. }
  467. // Add Builder content
  468. document.getElementById("module-input").innerHTML = rule["builder"];
  469. // Publish timestamp to Rule
  470. document.getElementById('dateTime').innerHTML = rule['timestamp'];
  471. // Finish
  472. displayMode = false;
  473. toggleDisplayMode();
  474. document.title = rule['communityname'] + " / CommunityRule";
  475. });
  476. }
  477. // deleteRule()
  478. // A temporary placeholder that sends an email requesting rule deletion
  479. function deleteRule() {
  480. var urlParamz = new URLSearchParams(window.location.search);
  481. var rID = urlParamz.get('r');
  482. window.open("mailto:medlab@colorado.edu?subject=Delete Rule request ("
  483. + rID + ")&body=Please explain your rationale:\n");
  484. }
  485. // END Publish tools
  486. // FINALLY, Page loading
  487. // First, grab the current URL
  488. var urlParams = new URLSearchParams(window.location.search);
  489. // Determine if it is a published Rule
  490. if (urlParams.has('r')) {
  491. // If so, grab the Rule from database and enter displayMode
  492. var rID = urlParams.get('r');
  493. displayRule(rID);
  494. } else {
  495. // Otherwise, open in editMode as default
  496. var editMode = true;
  497. // switch out of editMode in special cases
  498. window.onload = function() {
  499. if ((window.location.href.indexOf("/templates/") != -1) ||
  500. (window.location.href.indexOf("/about/") != -1)) {
  501. toggleEditMode();
  502. }
  503. }
  504. }
  505. </script>
  506. <article class="post">
  507. <header class="post-header">
  508. <h1 class="post-title" id="title">
  509. {{ page.title }}
  510. </h1>
  511. <button class="pushButton" id="editToggle" onclick="toggleEditMode()">
  512. Preview</button>
  513. <div class="post-content">
  514. {{ content }}
  515. </div>
  516. </header>
  517. <div id="rulebox">
  518. <span class="question">What is the community’s name?</span>
  519. <h1 contenteditable="true" class="editable output" id="communityname">{{ page.community-name }}</h1>
  520. <!-- RuleBuilder -->
  521. <div id="rule-builder">
  522. <button id="module-toggle" onclick="toggleVisible('module-menu')"
  523. class="button" title="Show/hide">
  524. <img src="{% link assets/tabler_icons/tool.svg %}" title="Modules" />
  525. </button>
  526. <div id="module-input"
  527. ondrop="drop(event)" ondragover="allowDrop(event)">
  528. <span class="question" id="drag-directions">Browse modules with the tool button and drag them here.</span>
  529. </div>
  530. <div id="builder-field">
  531. </div>
  532. <div id="module-menu" style="display:none;">
  533. <!-- Customizable module -->
  534. <span class="module" id="module-custom"
  535. draggable="true" ondragstart="drag(event)">
  536. <input contenteditable="true" placeholder="Custom..."/>
  537. <img src="{% link assets/tabler_icons/bulb.svg %}" class="module-logo"
  538. draggable="false" />
  539. <a onclick="this.parentNode.remove()" class="delete-module"
  540. style="display:none">
  541. <img src="{% link assets/tabler_icons/x.svg %}" /></a>
  542. </span>
  543. <!-- Load preset modules from _data/modules.csv -->
  544. {% for module in site.data.modules %}
  545. <span class="module" id="module-{{ module.id }}"
  546. draggable="true" ondragstart="drag(event)">
  547. <span id="module-name"
  548. onclick="moduleEditField(this.parentNode.id)">{{ module.name }}</span>
  549. <a target="_blank" href="{{ module.url }}">
  550. <img title="{{ module.type }}" draggable="false" class="module-logo"
  551. {% if module.type == "structure" %}
  552. src="{% link assets/tabler_icons/building.svg %}" {% endif %}
  553. {% if module.type == "process" %}
  554. src="{% link assets/tabler_icons/rotate.svg %}" {% endif %}
  555. {% if module.type == "decision" %}
  556. src="{% link assets/tabler_icons/thumb-up.svg %}" {% endif %}
  557. {% if module.type == "culture" %}
  558. src="{% link assets/tabler_icons/palette.svg %}" {% endif %}
  559. /></a>
  560. <a onclick="this.parentNode.remove()" class="delete-module"
  561. style="display:none">
  562. <img src="{% link assets/tabler_icons/x.svg %}" /></a>
  563. </span>
  564. {% endfor %}
  565. </div>
  566. </div>
  567. <div id="rule-writer">
  568. <!-- SECTION S1: BASICS -->
  569. <h2 id="header-s1" class="header">
  570. <img src="{% link assets/tabler_icons/info-circle.svg %}"
  571. class="icons" />
  572. <span class="subhead output">Basics</span>
  573. <button onclick="toggleVisible('s1')" class="button chevrons"><img src="{% link assets/tabler_icons/chevrons-down.svg %}" title="Show/hide" /></button>
  574. </h2>
  575. <div class="section" id="s1" style="display:none">
  576. <span class="question">What is the basic structure of the community?</span>
  577. <p contenteditable="true" class="editable output" id="structure">{{ page.structure }}</p>
  578. <span class="question">What is the community’s mission?</span>
  579. <p contenteditable="true" class="editable output" id="mission">{{ page.mission }}</p>
  580. <span class="question">What core values does the community hold?</span>
  581. <p contenteditable="true" class="editable output" id="values">{{ page.values }}</p>
  582. <span class="question">What is the legal status of the community’s assets and creations?</span>
  583. <p contenteditable="true" class="editable output" id="legal">{{ page.legal }}</p>
  584. </div><!--hiding section s1-->
  585. <!-- SECTION s2: PARTICIPANTS -->
  586. <h2 id="header-s2" class="header">
  587. <img src="{% link assets/tabler_icons/user.svg %}"
  588. class="icons" />
  589. <span class="subhead output">Participants</span>
  590. <button onclick="toggleVisible('s2')" class="button chevrons"><img src="{% link assets/tabler_icons/chevrons-down.svg %}" title="Show/hide" /></button>
  591. </h2>
  592. <div class="section" id="s2" style="display:none">
  593. <span class="question">How does someone become a participant?</span>
  594. <p contenteditable="true" class="editable output" id="membership">{{ page.membership }}</p>
  595. <span class="question">How are participants suspended or removed?</span>
  596. <p contenteditable="true" class="editable output" id="removal">{{ page.removal }}</p>
  597. <span class="question">What special roles can participants hold, and how are roles assigned?</span>
  598. <p contenteditable="true" class="editable output" id="roles">{{ page.roles }}</p>
  599. <span class="question">Are there limits on the terms or powers of participant roles?</span>
  600. <p contenteditable="true" class="editable output" id="limits">{{ page.limits }}</p>
  601. </div><!--hiding section s2-->
  602. <!--SECTION s3: POLICY-->
  603. <h2 id="header-s3" class="header">
  604. <img src="{% link assets/tabler_icons/news.svg %}"
  605. class="icons" />
  606. <span class="subhead output">Policy</span>
  607. <button onclick="toggleVisible('s3')" class="button chevrons"><img src="{% link assets/tabler_icons/chevrons-down.svg %}" title="Show/hide" /></button>
  608. </h2>
  609. <div class="section" id="s3" style="display:none">
  610. <span class="question">What basic rights does this Rule guarantee?</span>
  611. <p contenteditable="true" class="editable output" id="rights">{{ page.rights }}</p>
  612. <span class="question">Who has the capacity to decide on policies, and how do they do so?</span>
  613. <p contenteditable="true" class="editable output" id="decision">{{ page.decision }}</p>
  614. <span class="question">How are policies implemented?</span>
  615. <p contenteditable="true" class="editable output" id="implementation">{{ page.implementation }}</p>
  616. <span class="question">How does the community monitor and evaluate its policy implementation? </span>
  617. <p contenteditable="true" class="editable output" id="oversight">{{ page.oversight }}</p>
  618. </div><!--hiding section s3-->
  619. <!-- SECTION s4: PROCESS -->
  620. <h2 id="header-s4" class="header">
  621. <img src="{% link assets/tabler_icons/refresh.svg %}"
  622. class="icons" />
  623. <span class="subhead output">Process</span>
  624. <button onclick="toggleVisible('s4')" class="button chevrons"><img src="{% link assets/tabler_icons/chevrons-down.svg %}" title="Show/hide" /></button>
  625. </h2>
  626. <div class="section" id="s4" style="display:none">
  627. <span class="question">Where does the community deliberate about policies and governance?</span>
  628. <p contenteditable="true" class="editable output" id="deliberation">{{ page.deliberation }}</p>
  629. <span class="question">How does the community manage access to administrative accounts and other tools?</span>
  630. <p contenteditable="true" class="editable output" id="access">{{ page.access }}</p>
  631. <span class="question">How does the community manage funds and economic flows?</span>
  632. <p contenteditable="true" class="editable output" id="economics">{{ page.economics }}</p>
  633. <span class="question">How are grievances among participants addressed?</span>
  634. <p contenteditable="true" class="editable output" id="grievances">{{ page.grievances }}</p>
  635. </div><!--hiding section s4-->
  636. <!-- SECTION s5: EVOLUTION -->
  637. <h2 id="header-s5" class="header">
  638. <img src="{% link assets/tabler_icons/adjustments.svg %}"
  639. class="icons" />
  640. <span class="subhead output">Evolution</span>
  641. <button onclick="toggleVisible('s5')" class="button chevrons"><img src="{% link assets/tabler_icons/chevrons-down.svg %}" title="Show/hide" /></button>
  642. </h2>
  643. <div class="section" id="s5" style="display:none">
  644. <span class="question">Where are policies and records kept?</span>
  645. <p contenteditable="true" class="editable output" id="records">{{ page.records }}</p>
  646. <span class="question">How can this Rule be modified?</span>
  647. <p contenteditable="true" class="editable output" id="modification">{{ page.modification }}</p>
  648. </div><!--hiding section s5-->
  649. </div><!--end: rule-writer-->
  650. <div id="authorship" class="linkbox">
  651. <span id="authorship-words">Created by</span>
  652. <input contenteditable="true" class="editable link-text" id="author-text" placeholder="Created by" />
  653. <span class="link-divider"><img src="{% link assets/tabler_icons/pencil.svg %}" title="Add link" /></span>
  654. <input contenteditable="true" class="editable link-url" id="author-url" placeholder="Creator URL (http://, https://)" type="url" pattern="http://.*|https://.*" />
  655. <span id="authorship-result"></span>
  656. </div>
  657. </div><!--#rulebox-->
  658. <div id="attribution" style="display:none;">
  659. <br />
  660. <p><a href="https://communityrule.info">
  661. <img src="https://communityrule.info{% link assets/CommunityRule-derived-000000.svg %}" alt="CommunityRule derived"></a></p>
  662. <p id="dateTime"></p>
  663. <p>Created with <a href="https://communityrule.info">CommunityRule</a><br />
  664. <a href="https://creativecommons.org/licenses/by-sa/4.0/">Creative Commons BY-SA</a></p>
  665. <p><strong>The Publish feature is experimental. Rules may be removed without notice</strong></p>
  666. </div>
  667. <div id="attributionMD" style="display:none;">
  668. ---
  669. [![CommunityRule derived](https://communityrule.info{% link assets/CommunityRule-derived-000000.svg %})](https://communityrule.info)
  670. [Creative Commons BY-SA](https://creativecommons.org/licenses/by-sa/4.0/)</div>
  671. <button class="pushButton" id="publishRule" onclick="publishRule()"
  672. title="Add to the public Library">Publish</button>
  673. <button class="pushButton" id="toggleDisplayMode" onclick="toggleDisplayMode()"
  674. title="Edit this Rule into a new one">Fork</button>
  675. <button class="pushButton" onclick="textOutput()"
  676. title="Download this Rule as a Markdown text file">Export</button>
  677. <button class="pushButton" id="trash" onclick="deleteRule()">
  678. <img src="{% link assets/tabler_icons/trash.svg %}" title="Rule deletion request" />
  679. </button>
  680. <button class="pushButton"
  681. onclick="javascript:location.href='https://www.colorado.edu/lab/medlab/content/communityrule-user-feedback'">
  682. Feedback
  683. </button>
  684. </article>