From e7f25b84664c158343621c391b8653042d5be53c Mon Sep 17 00:00:00 2001 From: Mario Date: Wed, 26 Feb 2020 09:51:40 +0000 Subject: implement poll UI in jot --- view/css/conversation.css | 20 ++++++++++++-------- view/theme/redbasic/css/style.css | 4 ++++ view/tpl/jot-header.tpl | 19 +++++++++++++++++++ view/tpl/jot.tpl | 40 ++++++++++++++++++++++++++++++++++++--- 4 files changed, 72 insertions(+), 11 deletions(-) (limited to 'view') diff --git a/view/css/conversation.css b/view/css/conversation.css index f7804f5dd..287d662ae 100644 --- a/view/css/conversation.css +++ b/view/css/conversation.css @@ -1,15 +1,18 @@ /* jot */ +.jothidden { + display:none; +} -.jothidden input[type="text"] { - border: 0px; - margin: 0px; - height: 2.5rem; - width: 100%; +.jot-poll-option { + position: relative; } -.jothidden { - display:none; +.poll-option-close { + position: absolute; + right: 0; + top: 0; + padding: 0.25rem 0 0.25rem 0.5rem; } #jot-title-wrap, @@ -18,7 +21,8 @@ border-bottom: 1px solid rgba(0, 0, 0, .2); } -#jot-attachment-wrap { +#jot-attachment-wrap, +#jot-poll-wrap { border-top: 1px solid rgba(0, 0, 0, .2); } diff --git a/view/theme/redbasic/css/style.css b/view/theme/redbasic/css/style.css index 3bee84378..1ababecfc 100644 --- a/view/theme/redbasic/css/style.css +++ b/view/theme/redbasic/css/style.css @@ -1605,6 +1605,10 @@ dl.bb-dl > dd > li { font-size: 100%; } +.bootstrap-tagsinput input { + height: 2.5rem; +} + /* Abusing theme-green is less work than makeing a new new one */ .theme-green .back-bar .selected-bar { background-color: #000000; diff --git a/view/tpl/jot-header.tpl b/view/tpl/jot-header.tpl index 7b1f4ee05..d519fd666 100755 --- a/view/tpl/jot-header.tpl +++ b/view/tpl/jot-header.tpl @@ -58,6 +58,9 @@ var activeCommentText = ''; $('#id_mimetype').on('load', jotSetMime); $('#id_mimetype').on('change', jotSetMime); + $('#jot-add-option').on('click', jotAddOption); + $(document).on('click', '.poll-option-close', jotRemoveOption); + function jotSetMime() { var mtype = $('#id_mimetype').val(); if(mtype == 'text/bbcode') @@ -122,6 +125,7 @@ var activeCommentText = ''; activeCommentID = 0; }, }); + }); function deleteCheckedItems() { @@ -309,6 +313,7 @@ var activeCommentText = ''; function itemCancel() { $("#jot-title").val(''); $("#profile-jot-text").val(''); + $(".jot-poll-option input").val(''); $("#jot-category").tagsinput('removeAll'); postSaveChanges('clean'); @@ -317,6 +322,7 @@ var activeCommentText = ''; $(".jothidden").hide(); $("#profile-jot-text").removeClass('jot-expanded'); $("#profile-jot-tools").addClass('d-none'); + $("#jot-poll-wrap").addClass('d-none'); $("#jot-preview-content").html('').hide(); editor = false; {{else}} @@ -512,6 +518,19 @@ var activeCommentText = ''; } + function initPoll() { + $('#jot-poll-wrap').toggleClass('d-none'); + } + + function jotAddOption() { + var option = '
'; + $('#jot-poll-options').append(option); + } + + function jotRemoveOption(e) { + $(this).closest('.jot-poll-option').remove(); + } +