rule.html 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732
  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. var fields = document.getElementsByClassName("editable");
  390. for (var i = 0; i < fields.length; i++) {
  391. var key = fields[i].id;
  392. var value = "";
  393. if (fields[i].nodeName == "INPUT") { // for <input>
  394. value = fields[i].value.replace(/(<([^>]+)>)/ig,"");
  395. } else { // for other fields
  396. value = fields[i].innerHTML.replace(/(<([^>]+)>)/ig,"");
  397. }
  398. rule[0][key] = value;
  399. }
  400. const store = new SteinStore(
  401. "https://api.steinhq.com/v1/storages/5e8b937ab88d3d04ae0816a5"
  402. );
  403. store.append("rules", rule).then(data => {
  404. window.open("/create/?r=" + timeID, "_self", false);
  405. });
  406. }
  407. // displayRule(ID)
  408. // Displays content based on ID
  409. function displayRule(ID) {
  410. const store = new SteinStore(
  411. "https://api.steinhq.com/v1/storages/5e8b937ab88d3d04ae0816a5"
  412. );
  413. store.read("rules", { search: { ruleID: ID } }).then(data => {
  414. // only runs when we have the data from Goog:
  415. var rule = data[0];
  416. var fields = document.getElementsByClassName("editable");
  417. for (var i = 0; i < fields.length; i++) {
  418. var key = fields[i].id;
  419. var value = rule[key];
  420. if (typeof value === "undefined") {
  421. value = "";
  422. } else if (key.includes("-")) { // links
  423. document.getElementById(key).value = value;
  424. } else {
  425. document.getElementById(key).innerHTML = value;
  426. }
  427. }
  428. // Publish timestamp to Rule
  429. document.getElementById('dateTime').innerHTML = rule['timestamp'];
  430. // Finish
  431. displayMode = false;
  432. toggleDisplayMode();
  433. document.title = rule['communityname'] + " / CommunityRule";
  434. });
  435. }
  436. // deleteRule()
  437. // A temporary placeholder that sends an email requesting rule deletion
  438. function deleteRule() {
  439. var urlParamz = new URLSearchParams(window.location.search);
  440. var rID = urlParamz.get('r');
  441. window.open("mailto:medlab@colorado.edu?subject=Delete Rule request ("
  442. + rID + ")&body=Please explain your rationale:\n");
  443. }
  444. // END Publish tools
  445. // FINALLY, Page loading
  446. // First, grab the current URL
  447. var urlParams = new URLSearchParams(window.location.search);
  448. // Determine if it is a published Rule
  449. if (urlParams.has('r')) {
  450. // If so, grab the Rule from database and enter displayMode
  451. var rID = urlParams.get('r');
  452. displayRule(rID);
  453. } else {
  454. // Otherwise, open in editMode as default
  455. var editMode = true;
  456. // switch out of editMode in special cases
  457. window.onload = function() {
  458. if ((window.location.href.indexOf("/templates/") != -1) ||
  459. (window.location.href.indexOf("/about/") != -1)) {
  460. toggleEditMode();
  461. }
  462. }
  463. }
  464. </script>
  465. <article class="post">
  466. <header class="post-header">
  467. <h1 class="post-title" id="title">
  468. {{ page.title }}
  469. </h1>
  470. <button class="pushButton" id="editToggle" onclick="toggleEditMode()">
  471. Preview</button>
  472. <div class="post-content">
  473. {{ content }}
  474. </div>
  475. </header>
  476. <div id="rulebox">
  477. <span class="question">What is the community’s name?</span>
  478. <h1 contenteditable="true" class="editable output" id="communityname">{{ page.community-name }}</h1>
  479. <!-- BUILDER -->
  480. <h2 id="header-rb" class="metaheader">
  481. <span class="subhead output">RuleBuilder</span>
  482. <button onclick="toggleVisible('rule-builder')" class="button chevrons"><img src="{% link assets/tabler_icons/chevrons-down.svg %}" title="Show/hide" /></button>
  483. </h2>
  484. <div id="rule-builder">
  485. <button id="module-toggle" onclick="toggleVisible('module-menu')"
  486. class="button" title="Show/hide">
  487. <img src="{% link assets/tabler_icons/tool.svg %}" title="Modules" />
  488. </button>
  489. <div id="module-input"
  490. ondrop="drop(event)" ondragover="allowDrop(event)">
  491. <span class="question" id="drag-directions">
  492. </span>
  493. </div>
  494. <div id="builder-field">
  495. </div>
  496. <div id="module-menu" style="display:none;">
  497. <!-- Customizable module -->
  498. <span class="module" id="module-custom"
  499. draggable="true" ondragstart="drag(event)">
  500. <input contenteditable="true" placeholder="Custom..."/>
  501. <img src="{% link assets/tabler_icons/bulb.svg %}"
  502. draggable="false" />
  503. <a onclick="this.parentNode.remove()" class="delete-module"
  504. style="display:none">
  505. <img src="{% link assets/tabler_icons/x.svg %}" /></a>
  506. </span>
  507. <!-- Load preset modules from _data/modules.csv -->
  508. {% for module in site.data.modules %}
  509. <span class="module" id="module-{{ module.id }}"
  510. draggable="true" ondragstart="drag(event)">
  511. <span id="module-name"
  512. onclick="moduleEditField(this.parentNode.id)">{{ module.name }}</span>
  513. <a target="_blank" href="{{ module.url }}" class="module-link">
  514. <img title="{{ module.type }}" draggable="false"
  515. {% if module.type == "structure" %}
  516. src="{% link assets/tabler_icons/building.svg %}" {% endif %}
  517. {% if module.type == "process" %}
  518. src="{% link assets/tabler_icons/rotate.svg %}" {% endif %}
  519. {% if module.type == "decision" %}
  520. src="{% link assets/tabler_icons/thumb-up.svg %}" {% endif %}
  521. {% if module.type == "culture" %}
  522. src="{% link assets/tabler_icons/palette.svg %}" {% endif %}
  523. /></a>
  524. <a onclick="this.parentNode.remove()" class="delete-module"
  525. style="display:none">
  526. <img src="{% link assets/tabler_icons/x.svg %}" /></a>
  527. </span>
  528. {% endfor %}
  529. </div>
  530. </div>
  531. <h2 id="header-rw" class="metaheader">
  532. <span class="subhead output">RuleWriter</span>
  533. <button onclick="toggleVisible('rule-writer')" class="button chevrons"><img src="{% link assets/tabler_icons/chevrons-down.svg %}" title="Show/hide" /></button>
  534. </h2>
  535. <div id="rule-writer">
  536. <!-- SECTION S1: BASICS -->
  537. <h2 id="header-s1" class="header">
  538. <img src="{% link assets/tabler_icons/info-circle.svg %}"
  539. class="icons" />
  540. <span class="subhead output">Basics</span>
  541. <button onclick="toggleVisible('s1')" class="button chevrons"><img src="{% link assets/tabler_icons/chevrons-down.svg %}" title="Show/hide" /></button>
  542. </h2>
  543. <div class="section" id="s1" style="display:none">
  544. <span class="question">What is the basic structure of the community?</span>
  545. <p contenteditable="true" class="editable output" id="structure">{{ page.structure }}</p>
  546. <span class="question">What is the community’s mission?</span>
  547. <p contenteditable="true" class="editable output" id="mission">{{ page.mission }}</p>
  548. <span class="question">What core values does the community hold?</span>
  549. <p contenteditable="true" class="editable output" id="values">{{ page.values }}</p>
  550. <span class="question">What is the legal status of the community’s assets and creations?</span>
  551. <p contenteditable="true" class="editable output" id="legal">{{ page.legal }}</p>
  552. </div><!--hiding section s1-->
  553. <!-- SECTION s2: PARTICIPANTS -->
  554. <h2 id="header-s2" class="header">
  555. <img src="{% link assets/tabler_icons/user.svg %}"
  556. class="icons" />
  557. <span class="subhead output">Participants</span>
  558. <button onclick="toggleVisible('s2')" class="button chevrons"><img src="{% link assets/tabler_icons/chevrons-down.svg %}" title="Show/hide" /></button>
  559. </h2>
  560. <div class="section" id="s2" style="display:none">
  561. <span class="question">How does someone become a participant?</span>
  562. <p contenteditable="true" class="editable output" id="membership">{{ page.membership }}</p>
  563. <span class="question">How are participants suspended or removed?</span>
  564. <p contenteditable="true" class="editable output" id="removal">{{ page.removal }}</p>
  565. <span class="question">What special roles can participants hold, and how are roles assigned?</span>
  566. <p contenteditable="true" class="editable output" id="roles">{{ page.roles }}</p>
  567. <span class="question">Are there limits on the terms or powers of participant roles?</span>
  568. <p contenteditable="true" class="editable output" id="limits">{{ page.limits }}</p>
  569. </div><!--hiding section s2-->
  570. <!--SECTION s3: POLICY-->
  571. <h2 id="header-s3" class="header">
  572. <img src="{% link assets/tabler_icons/news.svg %}"
  573. class="icons" />
  574. <span class="subhead output">Policy</span>
  575. <button onclick="toggleVisible('s3')" class="button chevrons"><img src="{% link assets/tabler_icons/chevrons-down.svg %}" title="Show/hide" /></button>
  576. </h2>
  577. <div class="section" id="s3" style="display:none">
  578. <span class="question">What basic rights does this Rule guarantee?</span>
  579. <p contenteditable="true" class="editable output" id="rights">{{ page.rights }}</p>
  580. <span class="question">Who has the capacity to decide on policies, and how do they do so?</span>
  581. <p contenteditable="true" class="editable output" id="decision">{{ page.decision }}</p>
  582. <span class="question">How are policies implemented?</span>
  583. <p contenteditable="true" class="editable output" id="implementation">{{ page.implementation }}</p>
  584. <span class="question">How does the community monitor and evaluate its policy implementation? </span>
  585. <p contenteditable="true" class="editable output" id="oversight">{{ page.oversight }}</p>
  586. </div><!--hiding section s3-->
  587. <!-- SECTION s4: PROCESS -->
  588. <h2 id="header-s4" class="header">
  589. <img src="{% link assets/tabler_icons/refresh.svg %}"
  590. class="icons" />
  591. <span class="subhead output">Process</span>
  592. <button onclick="toggleVisible('s4')" class="button chevrons"><img src="{% link assets/tabler_icons/chevrons-down.svg %}" title="Show/hide" /></button>
  593. </h2>
  594. <div class="section" id="s4" style="display:none">
  595. <span class="question">Where does the community deliberate about policies and governance?</span>
  596. <p contenteditable="true" class="editable output" id="deliberation">{{ page.deliberation }}</p>
  597. <span class="question">How does the community manage access to administrative accounts and other tools?</span>
  598. <p contenteditable="true" class="editable output" id="access">{{ page.access }}</p>
  599. <span class="question">How does the community manage funds and economic flows?</span>
  600. <p contenteditable="true" class="editable output" id="economics">{{ page.economics }}</p>
  601. <span class="question">How are grievances among participants addressed?</span>
  602. <p contenteditable="true" class="editable output" id="grievances">{{ page.grievances }}</p>
  603. </div><!--hiding section s4-->
  604. <!-- SECTION s5: EVOLUTION -->
  605. <h2 id="header-s5" class="header">
  606. <img src="{% link assets/tabler_icons/adjustments.svg %}"
  607. class="icons" />
  608. <span class="subhead output">Evolution</span>
  609. <button onclick="toggleVisible('s5')" class="button chevrons"><img src="{% link assets/tabler_icons/chevrons-down.svg %}" title="Show/hide" /></button>
  610. </h2>
  611. <div class="section" id="s5" style="display:none">
  612. <span class="question">Where are policies and records kept?</span>
  613. <p contenteditable="true" class="editable output" id="records">{{ page.records }}</p>
  614. <span class="question">How can this Rule be modified?</span>
  615. <p contenteditable="true" class="editable output" id="modification">{{ page.modification }}</p>
  616. </div><!--hiding section s5-->
  617. </div><!--end: rule-writer-->
  618. <div id="authorship" class="linkbox">
  619. <span id="authorship-words">Created by</span>
  620. <input contenteditable="true" class="editable link-text" id="author-text" placeholder="Created by" />
  621. <span class="link-divider"><img src="{% link assets/tabler_icons/pencil.svg %}" title="Add link" /></span>
  622. <input contenteditable="true" class="editable link-url" id="author-url" placeholder="Creator URL (http://, https://)" type="url" pattern="http://.*|https://.*" />
  623. <span id="authorship-result"></span>
  624. </div>
  625. </div><!--#rulebox-->
  626. <div id="attribution" style="display:none;">
  627. <br />
  628. <p><a href="https://communityrule.info">
  629. <img src="https://communityrule.info{% link assets/CommunityRule-derived-000000.svg %}" alt="CommunityRule derived"></a></p>
  630. <p id="dateTime"></p>
  631. <p>Created with <a href="https://communityrule.info">CommunityRule</a><br />
  632. <a href="https://creativecommons.org/licenses/by-sa/4.0/">Creative Commons BY-SA</a></p>
  633. <p><strong>The Publish feature is experimental. Rules may be removed without notice</strong></p>
  634. </div>
  635. <div id="attributionMD" style="display:none;">
  636. ---
  637. [![CommunityRule derived](https://communityrule.info{% link assets/CommunityRule-derived-000000.svg %})](https://communityrule.info)
  638. [Creative Commons BY-SA](https://creativecommons.org/licenses/by-sa/4.0/)</div>
  639. <button class="pushButton" id="publishRule" onclick="publishRule()"
  640. title="Add to the public Library">Publish</button>
  641. <button class="pushButton" id="toggleDisplayMode" onclick="toggleDisplayMode()"
  642. title="Edit this Rule into a new one">Fork</button>
  643. <button class="pushButton" onclick="textOutput()"
  644. title="Download this Rule as a Markdown text file">Export</button>
  645. <button class="pushButton" id="trash" onclick="deleteRule()">
  646. <img src="{% link assets/tabler_icons/trash.svg %}" title="Rule deletion request" />
  647. </button>
  648. <button class="pushButton"
  649. onclick="javascript:location.href='https://www.colorado.edu/lab/medlab/content/communityrule-user-feedback'">
  650. Feedback
  651. </button>
  652. <div class="question">Publish and Export are not yet available for the RuleBuilder</div>
  653. </article>