Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Show document controls only when needed.

Also, default to preview mode when not authenticated. Closes #186.
  • Loading branch information...
commit 23a514f100e19915aef6acc63daa4be3584a3c02 1 parent 889dd23
Michael Aufreiter authored
View
1  _includes/styles/style.css
@@ -1095,7 +1095,6 @@ ul.site li a {
}
.document .metadata-content {
- padding: 20px 0px;
width: 960px;
margin: 0 auto;
}
View
16 _includes/templates/post._
@@ -1,3 +1,4 @@
+<% if (window.authenticated) { %>
<div class="document-menu">
<div class="document-menu-content">
@@ -6,14 +7,13 @@
<div class="state"></div>
</div>
- <% if (window.authenticated) { %>
- <div class="fr menu-item save-state">
- <div class="state fl">
- <a class='toggle-options button' href='#'>&nbsp;</a>
- <a class='save button inactive' href='#' title="CTRL+S">SAVE</a>
- </div>
+ <div class="fr menu-item save-state">
+ <div class="state fl">
+ <a class='toggle-options button' href='#'>&nbsp;</a>
+ <a class='save button inactive' href='#' title="CTRL+S">SAVE</a>
</div>
- <% } %>
+ </div>
+
<% if (jekyll) { %><a class="toggle meta fr menu-item" href="#" title="CTRL+SHIFT+M">Metadata</a> <% } %>
@@ -37,8 +37,8 @@
<br class="clear"/>
</div>
-
</div>
+<% } %>
<div class='inner clearfix'>
<div class='document prose'>
View
6 _includes/views/application.js
@@ -51,6 +51,8 @@ views.Application = Backbone.View.extend({
replaceMainView: function (name, view) {
$('body').removeClass().addClass('current-view '+name);
+ // Make sure the header gets shown
+ if (name !== "start") $('#header').show();
if (this.mainView) {
this.mainView.remove();
@@ -88,9 +90,9 @@ views.Application = Backbone.View.extend({
this.loaded();
this.header.render();
if (err) return this.notify('error', 'The requested resource could not be found.');
- data.preview = !(mode === "edit");
+ data.preview = !(mode === "edit") || !window.authenticated;
data.lang = _.mode(file);
- this.replaceMainView("post", new views.Post({ model: data, id: 'post' }).render());
+ this.replaceMainView(window.authenticated ? "post" : "read-post", new views.Post({ model: data, id: 'post' }).render());
var that = this;
}, this));
this.header.render();
View
3  _includes/views/post.js
@@ -263,7 +263,6 @@ views.Post = Backbone.View.extend({
theme: 'prose-bright',
onChange: _.bind(that._makeDirty, that)
});
-
}, 100);
},
@@ -271,7 +270,7 @@ views.Post = Backbone.View.extend({
var that = this;
$(this.el).html(templates.post(_.extend(this.model, { mode: this.mode })));
if (this.model.metadata && this.model.metadata.published) $(this.el).addClass('published');
- this.initEditor();
+ if (window.authenticated) this.initEditor();
return this;
}
});
Please sign in to comment.
Something went wrong with that request. Please try again.