Skip to content
Browse files

smart collaboration sidebar that toggles depending on your setting

  • Loading branch information...
1 parent 94b633e commit 429df10339990733baec729b0b2bfff378e016d9 Dion Almaer committed
Showing with 33 additions and 5 deletions.
  1. +7 −2 frontend/css/editor.css
  2. +17 −3 frontend/editor.html
  3. +8 −0 frontend/js/bespin/client/session.js
  4. +1 −0 frontend/js/bespin/client/settings.js
View
9 frontend/css/editor.css
@@ -264,6 +264,10 @@ body {
background-repeat: repeat-y;
}
+#collab a {
+ color: #eee;
+}
+
#collab_header {
background-image: url("../images/collab_hdr_bg.gif");
height: 32px;
@@ -277,13 +281,13 @@ body {
padding: 5px 0 0 9px;
}
-.collab_subheader {
+#collab_on .collab_subheader {
background-image: url("../images/collab_categorybar_bg.gif");
margin-left: 10px;
height: 23px;
}
-.collab_subheader div {
+#collab_on .collab_subheader div {
font-family: Calibri, Arial, sans-serif;
font-size: 10pt;
color: #dad4ba;
@@ -291,6 +295,7 @@ body {
}
.collab_text {
+ margin-top: 10px;
margin-left: 10px;
font-family: Calibri, Arial, sans-serif;
font-size: 10pt;
View
20 frontend/editor.html
@@ -188,10 +188,24 @@
</div>
<div id="collab">
<div id="collab_header"><div>Collaboration</div></div>
- <div class="collab_subheader"><div>Users editing this file:</div></div>
- <div id="collab_list">
+ <div id="collab_off" style="display:none">
+ <div class="collab_text">
+ Collaboration is a beta feature. You have it turned off right now.
+ <p>
+ Would you like to <a href="javascript:void(0);" onclick="bespin.publish('settings:set:collaborate', { value: 'on' });" title="Runs: set collaborate on">turn it on?</a>
+ </p><p>
+ After you do so, check out the <a href="https://wiki.mozilla.org/Labs/Bespin/UserGuide#Collaboration">tutorial on how to use it</a>.
+ </p>
+ </div>
+ </div>
+ <div id="collab_on" style="display:none">
+ <div class="collab_subheader"><div>Users editing this file:</div></div>
+ <div id="collab_list">
+ </div>
+ <div class="collab_text">Collaboration is a beta feature. Thanks for trying it out.<br><br>
+ Would you like to <a href="javascript:void(0);" onclick="bespin.publish('settings:set:collaborate', { value: 'off' });" title="Runs: set collaborate off">turn it off?</a>
+ </div>
</div>
- <div class="collab_text" style="margin-top: 10px">Collaboration is a beta feature.</div>
</div>
<!-- debugbar HTML should move to a plugin -->
<div id="debugbar">
View
8 frontend/js/bespin/client/session.js
@@ -270,6 +270,14 @@ dojo.declare("bespin.client.session.EditSession", null, {
getStatus: function() {
var file = this.path || 'a new scratch file';
return 'Hey ' + this.username + ', you are editing ' + file + ' in project ' + this.project;
+ },
+
+ /**
+ * If true is passed in, turn off the collab_off "off mode" of the sidebar, and turn on the collab_on mode, else do the opposite
+ */
+ setCollaborateSidebar: function(on) {
+ dojo.style("collab_off", "display", on ? "none" : "block");
+ dojo.style("collab_on", "display", on ? "block" : "none");
}
});
View
1 frontend/js/bespin/client/settings.js
@@ -548,6 +548,7 @@ dojo.declare("bespin.client.settings.Events", null, {
// Turn on the collaboration system if set to be on
bespin.subscribe("settings:set:collaborate", function(event) {
editSession.collaborate = settings.isOn(event.value);
+ editSession.setCollaborateSidebar(settings.isOn(event.value));
});
// ** {{{ Event: settings:set:fontsize }}} **

0 comments on commit 429df10

Please sign in to comment.
Something went wrong with that request. Please try again.