Skip to content

Commit 9c4093d

Browse files
committed
Rev3224, Small cosmetic changes on sidebar Sign and publish button
1 parent acfe4de commit 9c4093d

File tree

7 files changed

+36
-20
lines changed

7 files changed

+36
-20
lines changed

plugins/Sidebar/SidebarPlugin.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -417,24 +417,22 @@ def sidebarRenderContents(self, body, site):
417417
"""))
418418

419419
# Choose content you want to sign
420+
body.append(_(u"""
421+
<div class='flex'>
422+
<input type='text' class='text' value="content.json" id='input-contents'/>
423+
<a href='#Sign-and-Publish' id='button-sign-publish' class='button'>{_[Sign and publish]}</a>
424+
<a href='#Sign-or-Publish' id='menu-sign-publish'>\u22EE</a>
425+
</div>
426+
"""))
427+
420428
contents = ["content.json"]
421429
contents += site.content_manager.contents.get("content.json", {}).get("includes", {}).keys()
422430
body.append(_(u"<div class='contents'>{_[Choose]}: "))
423431
for content in contents:
424432
content = cgi.escape(content, True)
425433
body.append(_("<a href='#{content}' onclick='$(\"#input-contents\").val(\"{content}\"); return false'>{content}</a> "))
426434
body.append("</div>")
427-
428-
body.append(_(u"""
429-
<div class='flex'>
430-
<input type='text' class='text' value="content.json" id='input-contents'/>
431-
<span id='wrapper-sign-publish' class='button'>
432-
<a href='#Sign-and-Publish' id='button-sign-publish'>{_[Sign and publish]}</a>
433-
<a href='#Sign-and-Publish' id='menu-sign-publish'>\u22EE</a>
434-
</span>
435-
</div>
436-
</li>
437-
"""))
435+
body.append("</li>")
438436

439437
def actionSidebarGetHtmlTag(self, to):
440438
site = self.site

plugins/Sidebar/media/Menu.coffee

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,12 @@ class Menu
1010
@hide()
1111
else
1212
button_pos = @button.offset()
13-
@elem.css({"top": button_pos.top+@button.outerHeight(), "left": button_pos.left})
13+
left = button_pos.left
14+
@elem.css({"top": button_pos.top+@button.outerHeight(), "left": left})
1415
@button.addClass("menu-active")
1516
@elem.addClass("visible")
17+
if @elem.position().left + @elem.width() + 20 > window.innerWidth
18+
@elem.css("left", window.innerWidth - @elem.width() - 20)
1619
if window.visible_menu then window.visible_menu.hide()
1720
window.visible_menu = @
1821

plugins/Sidebar/media/Sidebar.coffee

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,8 @@ class Sidebar extends Class
359359
@tag.find("#button-sign-publish-menu").removeClass("visible")
360360
@tag.find(".contents + .flex").removeClass("sign-publish-flex")
361361

362-
menu = new Menu(@tag.find("#wrapper-sign-publish"))
362+
menu = new Menu(@tag.find("#menu-sign-publish"))
363+
menu.elem.css("margin-top", "-130px") # Open upwards
363364
menu.addItem "Sign", =>
364365
inner_path = @tag.find("#input-contents").val()
365366

plugins/Sidebar/media/Sidebar.css

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@
124124
.globe.error { text-align: center; padding-top: 156px; box-sizing: border-box; opacity: 0.2; }
125125

126126
/* Sign publish */
127-
.contents { background-color: #3B3B3B; color: white; padding: 7px 10px; font-family: Consolas; font-size: 11px; display: inline-block; margin-bottom: 6px; }
127+
.contents { background-color: #3B3B3B; color: white; padding: 7px 10px; font-family: Consolas; font-size: 11px; display: inline-block; margin-bottom: 6px; margin-top: 10px }
128128
.contents a { color: white }
129129
.contents a:active { background-color: #6B6B6B }
130130

@@ -145,7 +145,11 @@
145145
}
146146
#menu-sign-publish {
147147
margin-left: 5px;
148+
color: #AAA;
149+
padding: 7px;
150+
margin: 0px;
148151
}
152+
#menu-sign-publish:hover { color: white }
149153

150154
/* Small screen */
151155
@media screen and (max-width: 600px) {

plugins/Sidebar/media/all.css

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@
202202
.globe.error { text-align: center; padding-top: 156px; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; -o-box-sizing: border-box; -ms-box-sizing: border-box; box-sizing: border-box ; opacity: 0.2; }
203203

204204
/* Sign publish */
205-
.contents { background-color: #3B3B3B; color: white; padding: 7px 10px; font-family: Consolas; font-size: 11px; display: inline-block; margin-bottom: 6px; }
205+
.contents { background-color: #3B3B3B; color: white; padding: 7px 10px; font-family: Consolas; font-size: 11px; display: inline-block; margin-bottom: 6px; margin-top: 10px }
206206
.contents a { color: white }
207207
.contents a:active { background-color: #6B6B6B }
208208

@@ -223,7 +223,11 @@
223223
}
224224
#menu-sign-publish {
225225
margin-left: 5px;
226+
color: #AAA;
227+
padding: 7px;
228+
margin: 0px;
226229
}
230+
#menu-sign-publish:hover { color: white }
227231

228232
/* Small screen */
229233
@media screen and (max-width: 600px) {

plugins/Sidebar/media/all.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,18 +73,22 @@
7373
}
7474

7575
Menu.prototype.show = function() {
76-
var button_pos;
76+
var button_pos, left;
7777
if (window.visible_menu && window.visible_menu.button[0] === this.button[0]) {
7878
window.visible_menu.hide();
7979
return this.hide();
8080
} else {
8181
button_pos = this.button.offset();
82+
left = button_pos.left;
8283
this.elem.css({
8384
"top": button_pos.top + this.button.outerHeight(),
84-
"left": button_pos.left
85+
"left": left
8586
});
8687
this.button.addClass("menu-active");
8788
this.elem.addClass("visible");
89+
if (this.elem.position().left + this.elem.width() + 20 > window.innerWidth) {
90+
this.elem.css("left", window.innerWidth - this.elem.width() - 20);
91+
}
8892
if (window.visible_menu) {
8993
window.visible_menu.hide();
9094
}
@@ -313,7 +317,8 @@ window.initScrollable = function () {
313317
@logStart("Preloading")
314318
wrapper.ws.cmd "sidebarGetHtmlTag", {}, (res) =>
315319
@logEnd("Preloading")
316-
@preload_html = res */
320+
@preload_html = res
321+
*/
317322
this.fixbutton.on("mousedown touchstart", (function(_this) {
318323
return function(e) {
319324
if (e.button > 0) {
@@ -692,7 +697,8 @@ window.initScrollable = function () {
692697
return _this.tag.find(".contents + .flex").removeClass("sign-publish-flex");
693698
};
694699
})(this));
695-
menu = new Menu(this.tag.find("#wrapper-sign-publish"));
700+
menu = new Menu(this.tag.find("#menu-sign-publish"));
701+
menu.elem.css("margin-top", "-130px");
696702
menu.addItem("Sign", (function(_this) {
697703
return function() {
698704
var inner_path;

src/Config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class Config(object):
1010

1111
def __init__(self, argv):
1212
self.version = "0.6.1"
13-
self.rev = 3223
13+
self.rev = 3224
1414
self.argv = argv
1515
self.action = None
1616
self.config_file = "zeronet.conf"

0 commit comments

Comments
 (0)