From fc58a2f977fe56cbdd865975fc9f7ec1cc9bbb1f Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 4 Nov 2020 12:18:28 +0000 Subject: [PATCH] Test with new dropdown --- epicyon-profile.css | 102 +++++++++++++++++++++++++++++++++++++ webinterface.py | 119 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 221 insertions(+) diff --git a/epicyon-profile.css b/epicyon-profile.css index ad284219a..c50ea41d1 100644 --- a/epicyon-profile.css +++ b/epicyon-profile.css @@ -711,6 +711,108 @@ input[type=submit]:hover { padding: 0px 30px; } +/* new post dropdown */ + +.newPostDropdown { + position: relative; + display: inline-block; +} + +.newPostDropdown > input[type="checkbox"] { + position: absolute; + left: -100vw; +} + +.newPostDropdown > label, +.newPostDropdown > a[role="button"] { + display: inline-block; + padding: 6px 15px; + color: #333; + line-height: 1.5em; + text-decoration: none; + border: 1px solid #8c8c8c; + cursor: pointer; + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + border-radius: 3px; +} + +.newPostDropdown > label:hover, +.newPostDropdown > a[role="button"]:hover, +.newPostDropdown > a[role="button"]:focus { + border-color: #333; +} + +.newPostDropdown > label:after, +.newPostDropdown > a[role="button"]:after { + content: "\f0d7"; + font-family: 'Bedstead'; + display: inline-block; + margin-left: 6px; +} + +.newPostDropdown > ul { + position: absolute; + z-index: 999; + display: block; + left: -100vw; + top: calc(1.5em + 14px); + border: 1px solid #8c8c8c; + background: #fff; + padding: 6px 0; + margin: 0; + list-style: none; + width: 100%; + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + border-radius: 3px; + -webkit-box-shadow: 0 3px 8px rgba(0,0,0,.15); + -moz-box-shadow: 0 3px 8px rgba(0,0,0,.15); + box-shadow: 0 3px 8px rgba(0,0,0,.15); +} + +.newPostDropdown > ul a { + display: block; + padding: 6px 15px; + text-decoration: none; + color: #333; +} + +.newPostDropdown > ul a:hover, +.newPostDropdown > ul a:focus { + background: #ececec; +} + +.newPostDropdown > input[type="checkbox"]:checked ~ ul, +.newPostDropdown > ul:target { + left: 0; +} + +.newPostDropdown > [type="checkbox"]:checked + label:after, +.newPostDropdown > ul:target ~ a:after { + content: "\f0d8"; +} + +.newPostDropdown a.close { + display: none; +} + +.newPostDropdown > ul:target ~ a.close { + display: block; + position: absolute; + left: 0; + top: 0; + height: 100%; + width: 100%; + text-indent: -100vw; + z-index: 1000; +} + +.newPostDropdown + h2 { + margin-top: 60px; +} + + /* Dropdown Content (Hidden by Default) */ .dropdown-content { display: none; diff --git a/webinterface.py b/webinterface.py index 2eb7b3039..eabee2aac 100644 --- a/webinterface.py +++ b/webinterface.py @@ -2413,6 +2413,109 @@ def htmlSuspended(cssCache: {}, baseDir: str) -> str: return suspendedForm +def htmlNewPostDropDown(replyStr: str, + translate: {}, + iconsDir: str, + showPublicOnDropdown: bool, + defaultTimeline: str, + pathBase: str, + dropdownNewPostSuffix: str, + dropdownNewBlogSuffix: str, + dropdownUnlistedSuffix: str, + dropdownFollowersSuffix: str, + dropdownDMSuffix: str, + dropdownReminderSuffix: str, + dropdownEventSuffix: str, + dropdownReportSuffix: str) -> str: + """Returns the html for a drop down list of new post types + """ + dropDownContent = '
\n' + dropDownContent += ' \n' + dropDownContent += '
\n' + return dropDownContent + + def htmlNewPost(cssCache: {}, mediaInstance: bool, translate: {}, baseDir: str, httpPrefix: str, path: str, inReplyTo: str, @@ -2944,6 +3047,22 @@ def htmlNewPost(cssCache: {}, mediaInstance: bool, translate: {}, dropDownContent += ' \n' dropDownContent += ' \n' dropDownContent += '\n' + + dropDownContent = \ + htmlNewPostDropDown(replyStr, + translate, + iconsDir, + showPublicOnDropdown, + defaultTimeline, + pathBase, + dropdownNewPostSuffix, + dropdownNewBlogSuffix, + dropdownUnlistedSuffix, + dropdownFollowersSuffix, + dropdownDMSuffix, + dropdownReminderSuffix, + dropdownEventSuffix, + dropdownReportSuffix) else: mentionsStr = 'Re: ' + reportUrl + '\n\n' + mentionsStr