rule.html 32 KB

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