2016-08-19 04:07:45 +03:00
|
|
|
Description
|
|
|
|
============================================================
|
|
|
|
|
|
|
|
The “summary” section of an item.
|
|
|
|
|
|
|
|
Required context:
|
|
|
|
|
|
|
|
* item
|
|
|
|
|
|
|
|
|
|
|
|
HTML
|
|
|
|
============================================================
|
|
|
|
<div class="item-description">
|
|
|
|
<div class="section normal shown noscript-shown">
|
|
|
|
<strong>Summary</strong>
|
|
|
|
{{> space em=0.5 }}
|
|
|
|
{{> small-control
|
|
|
|
src = "/pencil.svg"
|
|
|
|
title = "edit summary"
|
2016-09-14 01:02:32 +03:00
|
|
|
class = "edit-item-description"
|
2016-08-19 04:07:45 +03:00
|
|
|
action = [| editItemDescription(
|
2017-10-08 19:10:45 +03:00
|
|
|
{{{%js item.uid.uidToText}}},
|
2016-08-19 04:07:45 +03:00
|
|
|
{{{%js item.description.text}}}); |] }}
|
|
|
|
<div class="notes-like">
|
|
|
|
{{# item.description.text}}
|
|
|
|
{{{item.description.html}}}
|
|
|
|
{{/ item.description.text}}
|
|
|
|
{{^ item.description.text}}
|
|
|
|
<p>write something here!</p>
|
|
|
|
{{/ item.description.text}}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="section editing">
|
|
|
|
<strong>Summary</strong>
|
|
|
|
{{> space em=0.5 }}
|
|
|
|
{{> small-control
|
|
|
|
src = "/pencil.svg"
|
|
|
|
title = "quit editing summary"
|
2016-09-14 01:02:32 +03:00
|
|
|
class = "edit-item-description"
|
2017-10-08 19:10:45 +03:00
|
|
|
action = [| stopEditingItemDescription({{{%js item.uid.uidToText}}}); |] }}
|
2016-08-19 04:07:45 +03:00
|
|
|
<div class="editor"></div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
JS
|
|
|
|
============================================================
|
|
|
|
function editItemDescription(itemUid, descrText) {
|
|
|
|
var descrNode = "#item-" + itemUid + " .item-description";
|
|
|
|
switchSection(descrNode, "editing");
|
|
|
|
var editor = bigEditor({
|
|
|
|
rows: 10,
|
|
|
|
text: descrText,
|
|
|
|
hint: "or press Ctrl+Enter to save",
|
|
|
|
saveAction: function(newDescrText) {
|
|
|
|
submitItemDescription(descrNode, itemUid, descrText, newDescrText); },
|
|
|
|
cancelAction: function() {
|
|
|
|
switchSection(descrNode, "normal"); }
|
|
|
|
});
|
|
|
|
$(descrNode + " .editor").html(editor);
|
|
|
|
focusOn(descrNode + " .editor-area");
|
|
|
|
}
|
|
|
|
function stopEditingItemDescription(itemUid) {
|
|
|
|
var descrNode = "#item-" + itemUid + " .item-description";
|
|
|
|
switchSection(descrNode, "normal");
|
|
|
|
}
|