rule.html 32 KB

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