Setup edit UI

master
Nick Sergeant 2012-02-23 15:01:06 -05:00
parent 33cd45480c
commit 06e2654b22
6 changed files with 51 additions and 2 deletions

View File

@ -1176,6 +1176,12 @@ div.pagination {
background: #FFF; }
div.pagination ul li a {
color: #3BAAF3; }
div.pagination ul li.next a {
line-height: 33px;
padding-bottom: 1px; }
div.pagination ul li.prev a {
line-height: 33px;
padding-bottom: 1px; }
div.modal .modal-header .close {
line-height: 20px;
@ -1233,6 +1239,8 @@ body.detail section.main div.inner {
height: 23px; }
body.detail section.main div.inner section.snipts article.snipt aside {
margin-right: 0; }
body.detail section.main div.inner section.snipts article.editing div.container {
width: 100%; }
body.detail div.rochester-made {
width: 840px; }

View File

@ -1088,9 +1088,13 @@ jQuery(function($) {
edit: function() {
if (!$('section.main-edit:visible').length) {
this.select();
var editPane = this.editTemplate(this.model.toJSON());
var editPane = this.editTemplate({
snipt: this.model.toJSON()
});
$('section#main').hide();
$('body').addClass('detail');
$('section#main-edit').html(editPane).show();
window.scrollTo(0, 0);
}
return false;
},
@ -1312,6 +1316,9 @@ jQuery(function($) {
});
$document.bind('keydown', 'esc', function() {
if ($('section#main-edit:visible').length) {
if (!$('html').hasClass('detail')) {
$('body').removeClass('detail');
}
$('section#main-edit').hide();
$('section#main').show();
if (SniptList.$snipts.index($selected) === 0) {

View File

@ -904,6 +904,11 @@ body.detail {
margin-right: 0;
}
}
article.editing {
div.container {
width: 100%;
}
}
}
}
}

View File

@ -62,9 +62,13 @@
edit: function() {
if (!$('section.main-edit:visible').length) {
this.select();
var editPane = this.editTemplate(this.model.toJSON());
var editPane = this.editTemplate({
snipt: this.model.toJSON()
});
$('section#main').hide();
$('body').addClass('detail');
$('section#main-edit').html(editPane).show();
window.scrollTo(0, 0);
}
return false;
},
@ -286,6 +290,9 @@
});
$document.bind('keydown', 'esc', function() {
if ($('section#main-edit:visible').length) {
if (!$('html').hasClass('detail')) {
$('body').removeClass('detail');
}
$('section#main-edit').hide();
$('section#main').show();
if (SniptList.$snipts.index($selected) === 0) {

View File

@ -1,6 +1,7 @@
{% extends "base.html" %}
{% block page-title %}/ {{ snipt.title }} / {{ user.username }} - {{ block.super }}{% endblock %}
{% block html-class %}detail{% endblock %}
{% block body-class %}detail{% endblock %}
{% block js %}

View File

@ -310,7 +310,28 @@
</script>
<script id="edit" type="text/html">
<div class="inner">
<section class="snipts" id="snipts">
<article id="snipt-<%= snipt.pk %>" class="snipt editing">
<div class="number">#<%= snipt.pk %></div>
<div class="group">
<div class="container">
<header>
<h2><%= snipt.lexer_name %></h2>
<h1><a href="<%= snipt.get_absolute_url %>"><%= snipt.title %></a></h1>
</header>
<section class="code autumn">
<%= snipt.stylized %>
<div class="raw"><%= snipt.code %></div>
</section>
<div class="ruler top-x"></div>
<div class="ruler bottom-x"></div>
</div>
</div>
</article>
</section>
</div>
<div class="left-y ruler"></div>
<div class="right-y ruler"></div>
</script>
</div>
{% endverbatim %}