rule.html 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  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. {% include rule-scripts.html %}
  7. <article class="post">
  8. <header class="post-header">
  9. <h1 class="post-title" id="title">
  10. {{ page.title }}
  11. </h1>
  12. <button class="pushButton" id="editToggle" onclick="toggleEditMode()">
  13. Preview</button>
  14. <div class="post-content">
  15. {{ content }}
  16. </div>
  17. </header>
  18. <div id="rulebox" class="rulebox">
  19. <span class="prompt">What is the community’s name?</span>
  20. <h1 contenteditable="true" class="editable output" id="communityname">{{ page.community-name }}</h1>
  21. <span class="prompt">Summarize its structure:</span>
  22. <p contenteditable="true" class="editable output" id="structure">{{ page.structure }}</p>
  23. <!-- RuleBuilder -->
  24. <div id="rule-builder" class="rulebuilder">
  25. <div id="module-input" class="rulebuilder_input"
  26. ondrop="drop(event)" ondragover="allowDrop(event)">
  27. <span class="prompt" id="drag-directions">Browse modules from below and drag them here.</span>
  28. </div>
  29. <div id="builder-field" class="rulebuilder_list">
  30. </div>
  31. <div id="module-menu" class="rulebuilder_modules">
  32. <!-- Load preset modules from _modules/ -->
  33. {% assign modules_array = site.modules | sort: "type" %}
  34. {% assign last_type = "" %}
  35. {% for module in modules_array %}
  36. {% if module.layout == "module" %}
  37. {% if module.type != last_type %}
  38. {% if last_type != "" %}</div>{% endif %}
  39. <div class="module-type-header">
  40. <img src="{{ site.baseurl }}/{{ site.data.module_types[module.type].icon }}" />
  41. {{ module.type }}
  42. <button onclick="toggleVisible('module-type-{{ module.type }}')" class="button chevrons"><img src="{% link assets/tabler_icons/chevrons-down.svg %}" title="Show/hide" /></button>
  43. </div>
  44. <p class="module-questions">{{ site.data.module_types[module.type].question }}</p>
  45. <div id="module-type-{{ module.type }}" class="module-type" style="display: none;">
  46. {% endif %}
  47. {% assign last_type = module.type %}
  48. <span class="module" id="module-{{ module.title | slugify }}"
  49. draggable="true" ondragstart="drag(event)" ondragend="dragEnd()">
  50. <span id="module-name" title="{{ module.summary }}">{{ module.title }}</span>
  51. <a target="_blank" href="{{ module.url }}" class="module-info">
  52. <img title="More info" draggable="false" class="module-logo"
  53. src="{% link assets/tabler_icons/info-circle.svg %}" /></a>
  54. <a onclick="this.parentNode.remove()" class="delete-module">
  55. <img src="{% link assets/tabler_icons/x.svg %}" /></a>
  56. </span>
  57. {% endif %}
  58. {% endfor %}
  59. </div>
  60. <div class="module-type-header">
  61. <img src="{% link assets/tabler_icons/bulb.svg %}" />
  62. Custom Module
  63. </div>
  64. <p class="module-questions">Create your own module.</p>
  65. <div id="module-custom-container" class="module-type">
  66. <!-- Customizable module -->
  67. <span class="module module-custom" id="module-custom"
  68. draggable="true" ondragstart="drag(event)" ondragend="dragEnd()">
  69. <img class="module-info" src="{% link assets/tabler_icons/grid-dots.svg %}" draggable="false" />
  70. <input contenteditable="true" draggable="false" placeholder="Custom module..."/>
  71. <img src="{% link assets/tabler_icons/bulb.svg %}"
  72. draggable="false" />
  73. <a onclick="this.parentNode.remove()" class="delete-module">
  74. <img src="{% link assets/tabler_icons/x.svg %}" /></a>
  75. </span>
  76. </div>
  77. </div><!-- END module-menu -->
  78. </div><!-- END RuleBuilder -->
  79. <div id="rulewriter-box">
  80. <span class="prompt"></span>
  81. <p id="rulewriter" contenteditable="true" class="editable output"></p>
  82. </div>
  83. <div class="metadata_input">
  84. <p class="prompt"><img src="{% link assets/tabler_icons/pencil.svg %}" /> Created by</p>
  85. <input contenteditable="true" class="editable" id="author-text" placeholder="Creator Name" />
  86. <p class="prompt"><img src="{% link assets/tabler_icons/globe.svg %}" /> Creator URL</p>
  87. <input contenteditable="true" class="editable" id="author-url" placeholder="Creator URL (http://, https://)" type="url" pattern="http://.*|https://.*" />
  88. </div>
  89. <div id="authorship" class="linkbox metadata_display">
  90. <span>Created by</span>
  91. <span class="link-divider"><img src="{% link assets/tabler_icons/pencil.svg %}" title="Add link" /></span>
  92. <span id="authorship-result" class="linkbox_result"></span>
  93. </div>
  94. </div><!--#rulebox-->
  95. <div id="lineage">
  96. <img src="{% link assets/tabler_icons/file.svg %}" title="Derivation lineage" />
  97. <span id="lineage-list"></span>
  98. </div>
  99. <button class="pushButton" id="publishRule" onclick="publishRule()"
  100. title="Add to the public Library">Publish</button>
  101. <button class="pushButton" id="fork" onclick="fork()"
  102. title="Edit this Rule into a new one">Fork</button>
  103. <button class="pushButton" id="discuss-button" onclick="toggleVisible('discuss')"
  104. title="Discuss this Rule with others">Discuss</button>
  105. <button class="pushButton" onclick="textOutput()"
  106. title="Download this Rule as a Markdown text file">Export</button>
  107. <button class="pushButton" id="trash" onclick="deleteRule()">
  108. <img src="{% link assets/tabler_icons/trash.svg %}" title="Rule deletion request" />
  109. </button>
  110. <div id="discuss" style="display:none;">
  111. <button onclick="toggleVisible('discuss')" class="button chevrons" style="display:block;"><img src="{% link assets/tabler_icons/chevrons-up.svg %}" title="Hide" /></button>
  112. <p>Comment function in development! Thanks for your patience.</p>
  113. <!--
  114. <script defer
  115. src="https://comment.medlab.host/js/commento.js"
  116. data-no-fonts="true"
  117. >
  118. </script>
  119. <div id="commento"></div>
  120. -->
  121. </div>
  122. <div id="attribution" style="display:none;">
  123. <br />
  124. <p><a href="https://communityrule.info">
  125. <img src="https://communityrule.info{% link assets/CommunityRule-derived-000000.svg %}" alt="CommunityRule derived"></a></p>
  126. <p id="dateTime"></p>
  127. <p>Created with <a href="https://communityrule.info">CommunityRule</a>,
  128. <a href="https://creativecommons.org/licenses/by-sa/4.0/">Creative Commons BY-SA</a></p>
  129. <p><strong>The Publish feature is experimental. Rules may be removed without notice</strong></p>
  130. </div>
  131. <div id="attributionMD" style="display:none;">
  132. [![CommunityRule derived](https://communityrule.info{% link assets/CommunityRule-derived-000000.svg %})](https://communityrule.info)
  133. [Creative Commons BY-SA](https://creativecommons.org/licenses/by-sa/4.0/)
  134. </div>
  135. </article>