Skip to content

Commit

Permalink
Add sidebar to hunch show pages.
Browse files Browse the repository at this point in the history
  • Loading branch information
adammck committed Dec 19, 2011
1 parent 577ca48 commit 2d89fb0
Show file tree
Hide file tree
Showing 11 changed files with 83 additions and 83 deletions.
3 changes: 3 additions & 0 deletions hunchworks/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,9 @@ def comment_count(self):

def contributor_count(self):
return self.contributors().count()

def get_related_hunches(self):
return Hunch.objects.all()


post_save.connect(
Expand Down
3 changes: 1 addition & 2 deletions hunchworks/static/css/global/nav.scss
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,7 @@ nav.site {
nav.tabs {

> ul {
border-bottom: 1px solid #bbb;
background: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#eee));
border-bottom: 1px solid #ccc;
padding-left: $spacing*2;

/* To force the last pixel of the nested <li>s to overlap the bottom
Expand Down
40 changes: 40 additions & 0 deletions hunchworks/static/css/pages/hunches.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
#hunch-show {

article.hunch {
background: #f8f8f8 url("../../img/bg2.png");
overflow: hidden;

> header {
color: #999;
Expand Down Expand Up @@ -45,6 +47,7 @@
padding: 0.25em 0;

> div {
background: #fff;
border: 2px solid #ccc;
border-radius: 5px;
-moz-border-radius: 5px;
Expand Down Expand Up @@ -78,8 +81,45 @@


div.inner {
background: #fff;
overflow: hidden;
padding: $spacing*2;
border-right: 1px solid #ccc;
box-shadow: 0 0 20px #ccc;
}


nav.tabs {
width: 70%;
}


aside {
@include border-box;
float: right;
width: 30%;
padding: $spacing*2;

> h2 {
text-align: center;
font-size: 160%;
color: #999;
margin-bottom: $spacing;

> span {
font-weight: bold;
color: #000;
}
}

article.hunch {
background: #fff;
}
}


div.links {
border-top: 1px solid #ddd;
}


Expand Down
Binary file added hunchworks/static/img/bg2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions hunchworks/static/js/jquery-equal-height.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
$.fn.equalHeight = function() {
var heights = $(this).map(function() {
return $(this).height();
});

var max = Math.max.apply(Math, heights);
$(this).height(max);
};
1 change: 1 addition & 0 deletions hunchworks/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@

<!-- misc -->
<script src="{% get_static_prefix %}js/comment-forms.js"></script>
<script src="{% get_static_prefix %}js/jquery-equal-height.js"></script>
{% endcompress %}

{% block js %}{% endblock %}
Expand Down
Empty file.
19 changes: 18 additions & 1 deletion hunchworks/templates/hunches/edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,24 @@ <h1>Edit a Hunch</h1>

{% block content %}
<form action="" method="post" class="edit hunch">
{% include "hunches/form.html" %}
{{ form.non_field_errors }}
{% csrf_token %}

{% for field in form.hidden_fields %}
{{ field }}
{% endfor %}

<div class="fields">
<div class="left">
{% include "includes/fields/base.html" with field=form.title %}
{% include "includes/fields/base.html" with field=form.description %}
{% include "includes/fields/base.html" with field=form.evidences %}
</div>
<div class="right">
{% include "includes/fields/base.html" with field=form.location %}
{% include "includes/fields/base.html" with field=form.tags %}
</div>
</div>

<div class="actions">
<input type="submit" value="Edit Hunch">
Expand Down
62 changes: 0 additions & 62 deletions hunchworks/templates/hunches/evidences.html

This file was deleted.

18 changes: 0 additions & 18 deletions hunchworks/templates/hunches/form.html

This file was deleted.

12 changes: 12 additions & 0 deletions hunchworks/templates/hunches/show/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,24 @@ <h2>{{ hunch.privacy_text }}</h2>
</ul>
</nav>

<aside class="sidebar">
{% if hunch.get_related_hunches %}
<h2>Related <span>Hunches</span></h2>
{% include "includes/hunches/list.html" with object_list=hunch.get_related_hunches %}
{% endif %}
</aside>


<div class="inner">
{% block secondary_content %}{% endblock %}
</div>


<script>
$("div.inner, aside.sidebar").equalHeight();
</script>


{% bookmarks hunch %}
</article>

Expand Down

0 comments on commit 2d89fb0

Please sign in to comment.