Merge branch 'master' of github.com:Gluejar/regluit

pull/1/head
Raymond Yee 2012-02-04 12:50:51 -08:00
commit c1d5d86abf
19 changed files with 311 additions and 32 deletions

View File

@ -0,0 +1,92 @@
{% extends "base.html" %}
{% comment %}
realtime updating?
comments rss?
{% endcomment %}
{% block title %} Comments {% endblock %}
{% block extra_css %}
<link type="text/css" rel="stylesheet" href="/static/css/supporter_layout.css" />
<link type="text/css" rel="stylesheet" href="/static/css/comments.css" />
{% endblock %}
{% block extra_head %}
<script type="text/javascript" src="/static/js/wishlist.js"></script>
<script type="text/javascript" src="/static/js/jquery-1.6.3.min.js"></script>
<script type="text/javascript" src="/static/js/jquery-ui-1.8.16.custom.min.js"></script>
<script type="text/javascript" src="/static/js/greenpanel.js"></script>
<script type="text/javascript" src="/static/js/toggle.js"></script>
<script type="text/javascript" src="/static/js/tabs.js"></script>
{% endblock %}
{% block topsection %}
<div id="js-topsection">
<div class="js-main">
<div class="js-topnews">
<div class="js-topnews1">
<div class="js-topnews2">
<div class="js-topnews3">
<div class="user-block">
<div class="user-block1">
<div class="block-intro-text"><span class="special-user-name">Latest Comments</span></div>
</div>
<div class="user-block2"><span class="user-short-info">With your help we're raising money to buy the right to give these books to the world.</span>
</div>
<div class="user-block3">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
{% endblock %}
{% block content %}
<div id="main-container">
<div class="js-main">
<div id="js-leftcol">
{% include "explore.html" %}
</div>
<div id="js-maincol-fr">
<div class="js-maincol-inner">
<div class="content-block">
<div class="content-block-content">
<div style="height:46px;"></div>
{% for comment in latest_comments %}
{% with comment.content_object.id as id %}
<div class="comments {% cycle 'row1' 'row2' %}">
<div class="nonavatar">
<div class="image">
<a href="{% url work id %}?tab=2"><img src="{{ comment.content_object.cover_image_thumbnail }}"></a>
</div>
{% with comment.user as user %}
<span><a href={% url supporter supporter_username=user %}>{{ comment.name }}</a> on <a href="{% url work id %}">{{ comment.content_object.title }}</a></span><br/>
<span class="text">{{ comment.comment }}</span>
</div>
<div class="avatar">
<a href={% url supporter supporter_username=user %}>
{% if supporter.profile.pic_url %}
<img class="user-avatar" src="{{ comment.user.profile.pic_url }}" height="50" width="50" alt="Picture of {{ comment.user }}" title="{{ comment.user }}" />
{% else %}
<img class="user-avatar" src="/static/images/header/avatar.png" height="50" width="50" alt="Generic Ungluer Avatar" title="Ungluer" />
{% endif %}
{% endwith %}
</a>
</div>
</div>
{% endwith %}
{% endfor %}
</div>
</div>
</div>
</div>
</div>
</div>
{% endblock %}

View File

@ -14,7 +14,7 @@
{% endif %}
{% endfor %}
<input type="hidden" name="next" value="{{ request.get_full_path }}#" />
<input type="hidden" name="next" value="{{ request.get_full_path }}?tab=2" />
<p class="submit">
<input type="submit" name="post" class="submit-post" value="{% trans "Post" %}" />
</p>

View File

@ -17,7 +17,7 @@
<dd>TBA</dd>
<dt>What is Crowdfunding?</dt>
<a name="crowdfunding"></a><dt>What is Crowdfunding?</dt>
<dd>Crowdfunding is working together to support something you believe in. By pooling donations, big and small, from all over the world, we can make huge things happen.</dd>

View File

@ -101,7 +101,7 @@ var $j = jQuery.noConflict();
<h2 class="page-heading">Give ebooks to the world.</h2>
</div>
<div class="jsmod-content">
<img src="/static/images/landingpage/icon-group.png" alt="How does it work?" title="How does it work?" height="269" width="268" />
<a href="{{ faqurl }}#crowdfunding"><img src="/static/images/landingpage/icon-group.png" alt="How does it work?" title="How does it work?" height="269" width="268" /></a>
</div>
</div>
</div>

View File

@ -29,7 +29,7 @@
<div class="movingrightalong"></div>
<div class="quicktour"><span class="highlight">Unglue.it offers a win-win solution: Crowdfunding.</span> We run pledge campaigns for books; you chip in. When, together, we've reached the goal, we'll reward the book's creators and issue an unglued ebook.</div>
<div class="movingrightalong"></div>
<div class="quicktour last"><a href="https://creativecommons.org/">Creative Commons</a> licensing means everyone, everywhere can read and share the unglued book — freely and legally. <span class="highlight">You've given your favorite book to the world.</span></div>
<div class="quicktour last"><a href="https://creativecommons.org/">Creative Commons</a> licensing means everyone, everywhere can read and share the unglued book — freely and legally. <span class="highlight">You've given your favorite book to the world.</span><div class="signup">Sign up below. <img src="/static/images/landingpage/signmeup-arrow.png"></div></div>
</div>
</div>
</div>

View File

@ -46,17 +46,19 @@ jQuery(document).ready(function(){
{% else %}{% if status == 'WITHDRAWN' %}
Campaign withdrawn. <br />See <a href="/faq">FAQ</a>.
{% else %}{% if wishers == 1 %}
{{ wishers }} Ungluer is WISHING
<span class="findtheungluers">{{ wishers }} Ungluer is WISHING</span>
{% else %}
{{ wishers }} Ungluers are WISHING
<span class="findtheungluers">{{ wishers }} Ungluers are WISHING</span>
{% endif %}{% endif %}{% endif %}{% endif %}{% endif %}
{% endif %}
{% else %}
<span class="findtheungluers">
{% if wishers == 1 %}
{{ wishers }} Ungluer is WISHING
{% else %}
{{ wishers }} Ungluers are WISHING
{% endif %}
</span>
{% endif %}{% endif %}
</span>
<span class="spacer">&nbsp;<br />&nbsp;</span>
@ -163,7 +165,7 @@ jQuery(document).ready(function(){
<ul class="tabs">
<li class="tabs1 {% if activetab == '1' %}active{% endif %}"><a href="#">{% if status == 'ACTIVE' %}Campaign{% else %}Description{% endif %}</a></li>
<li class="tabs2 {% if activetab == '2' %}active{% endif %}"><a href="#">Comments ({{comment_count}})</a></li>
<li class="tabs3 {% if activetab == '3' %}active{% endif %}"><a href="#">Supporters</a></li>
<li class="tabs3 {% if activetab == '3' %}active{% endif %}" id="supporters"><a href="#">Supporters</a></li>
<li class="tabs4 {% if activetab == '4' %}active{% endif %}"><a href="#">Details</a></li>
</ul>

View File

@ -80,7 +80,7 @@
</div>
<div class="content-block-content">
{% ifequal work_list.count 0 %}
There aren't any works in this list. Why don't you add some?
There aren't any works in this list yet. Why not add your favorite books to your wishlist, so we can feature them here?
{% else %}
{% paginate 20 work_list %}
{% for work in work_list %}

View File

@ -60,6 +60,7 @@ urlpatterns = patterns(
name="press"),
url(r"^about/$", TemplateView.as_view(template_name="about.html"),
name="about"),
url(r"^comments/$", "comment", name="comment"),
)
if not settings.IS_PREVIEW:

View File

@ -20,6 +20,7 @@ from django.core.urlresolvers import reverse
from django.core.exceptions import ObjectDoesNotExist
from django.core.mail import send_mail
from django.contrib import messages
from django.contrib.comments import Comment
from django.forms import Select
from django.forms.models import modelformset_factory
from django.http import HttpResponseRedirect
@ -115,6 +116,8 @@ def work(request, work_id, action='display'):
try:
activetab = request.GET['tab']
if activetab not in ['1', '2', '3', '4']:
activetab = '1';
except:
activetab = '1';
@ -1299,3 +1302,6 @@ def feedback(request):
return render(request, "feedback.html", {'form':form, 'num1':num1, 'num2':num2})
def comment(request):
latest_comments = Comment.objects.all()[:20]
return render(request, "comments.html", {'latest_comments': latest_comments})

View File

@ -92,6 +92,9 @@
#js-leftcol .jsmodule.rounded .jsmod-content span.spacer {
visibility: none;
}
#js-leftcol .jsmodule.rounded .jsmod-content span.findtheungluers {
cursor: pointer;
}
.book-detail {
float: left;
width: 100%;

49
static/css/comments.css Normal file
View File

@ -0,0 +1,49 @@
.comments {
clear: both;
padding: 5px;
margin: 0 5px 0 0;
width: 95%;
}
.comments.row1 {
background: #f6f9f9;
}
.comments.row2 {
background: #fff;
}
.comments div {
float: left;
}
.comments div img {
margin: 0 5px;
}
.comments .image img {
height: 100px;
}
.comments:after {
content: ".";
display: block;
height: 0;
clear: both;
visibility: hidden;
}
.comments .nonavatar {
width: 620px;
}
.comments .nonavatar span {
padding-right: 5px;
}
.comments .nonavatar span.text:before {
content: "\201C";
font-size: 17px;
font-weight: bold;
}
.comments .nonavatar span.text:after {
content: "\201D";
font-size: 17px;
font-weight: bold;
}
.comments .avatar {
float: right;
margin: 0 auto;
padding-top: 5px;
}

View File

@ -131,8 +131,15 @@
.user-block-hide .quicktour.last {
padding-right: 0px;
width: 270px;
background: url("/static/images/landingpage/signmeup-arrow.png") no-repeat center bottom;
padding-bottom: 42px;
}
.user-block-hide .quicktour.last .signup {
color: #8dc63f;
font-weight: bold;
margin-top: 10px;
}
.user-block-hide .quicktour.last .signup img {
margin-left: 5px;
vertical-align: middle;
}
.user-block-hide .movingrightalong {
background: url("/static/images/landingpage/quicktour-arrow.png") no-repeat center;

View File

@ -131,8 +131,15 @@
.user-block-hide .quicktour.last {
padding-right: 0px;
width: 270px;
background: url("/static/images/landingpage/signmeup-arrow.png") no-repeat center bottom;
padding-bottom: 42px;
}
.user-block-hide .quicktour.last .signup {
color: #8dc63f;
font-weight: bold;
margin-top: 10px;
}
.user-block-hide .quicktour.last .signup img {
margin-left: 5px;
vertical-align: middle;
}
.user-block-hide .movingrightalong {
background: url("/static/images/landingpage/quicktour-arrow.png") no-repeat center;

View File

@ -68,8 +68,15 @@
.user-block-hide .quicktour.last {
padding-right: 0px;
width: 270px;
background: url("/static/images/landingpage/signmeup-arrow.png") no-repeat center bottom;
padding-bottom: 42px;
}
.user-block-hide .quicktour.last .signup {
color: #8dc63f;
font-weight: bold;
margin-top: 10px;
}
.user-block-hide .quicktour.last .signup img {
margin-left: 5px;
vertical-align: middle;
}
.user-block-hide .movingrightalong {
background: url("/static/images/landingpage/quicktour-arrow.png") no-repeat center;

View File

@ -37,4 +37,13 @@
$j('#tabs-1').hide(200);
$j('#tabs-3').hide(200);
});
$j('.findtheungluers').click(function(){
$j('#tabs').find('.active').removeClass('active');
$j('#supporters').addClass('active');
$j('.content-block-content').find('.active').removeClass('active');
$j('#tabs-3').addClass('active').show(300);
$j('#tabs-2').hide(200);
$j('#tabs-1').hide(200);
$j('#tabs-4').hide(200);
});
});

View File

@ -7,12 +7,19 @@ $j(document).ready(function() {
var span = $j(element).find("span");
var gb_id = span.attr('id')
if (!gb_id) return;
jQuery.post('/wishlist/', {'googlebooks_id': gb_id}, function(data) {
span.fadeOut();
var newSpan = $j('<span class="on-wishlist">On Wishlist!</span>').hide();
// give immediate feedback that action is in progress
newSpan = $j('<span>Adding...</span>').hide();
span.replaceWith(newSpan);
newSpan.fadeIn('slow');
newSpan.removeAttr("id");
newSpan.show();
// actually perform action
jQuery.post('/wishlist/', {'googlebooks_id': gb_id}, function(data) {
newSpan.fadeOut();
var nextSpan = $j('<span class="on-wishlist">On Wishlist!</span>').hide();
newSpan.replaceWith(nextSpan);
nextSpan.fadeIn('slow');
nextSpan.removeAttr("id");
});
});
});
@ -45,10 +52,17 @@ $j(document).ready(function() {
$j(element).click(function() {
var span = $j(element).find("span");
var work_id = span.attr('id')
// provide feedback
var newSpan = $j('<span>Removing...</span>').hide();
span.replaceWith(newSpan);
newSpan.show();
// perform action
jQuery.post('/wishlist/', {'remove_work_id': work_id}, function(data) {
span.parent().fadeOut();
newSpan.parent().fadeOut();
var newDiv = $j('<div class="add-wishlist-workpage"><span class="'+work_id+'">Add to Wishlist</span></div>').hide();
span.parent().replaceWith(newDiv);
newSpan.parent().replaceWith(newDiv);
newDiv.fadeIn('slow');
});
});
@ -64,12 +78,18 @@ $k(document).delegate(".add-wishlist-workpage span", "click", function() {
var span = $k(this);
var work_id = span.attr("class");
if (!work_id) return;
jQuery.post('/wishlist/', {'add_work_id': work_id}, function(data) {
span.fadeOut();
var newSpan = $k('<span class="on-wishlist">On Wishlist!</span>').hide();
// give immediate feedback that action is in progress
newSpan = $j('<span>Adding...</span>').hide();
span.replaceWith(newSpan);
newSpan.fadeIn('slow');
newSpan.removeAttr("id");
newSpan.show();
jQuery.post('/wishlist/', {'add_work_id': work_id}, function(data) {
newSpan.fadeOut();
var nextSpan = $k('<span class="on-wishlist">On Wishlist!</span>').hide();
newSpan.replaceWith(nextSpan);
nextSpan.fadeIn('slow');
nextSpan.removeAttr("id");
});
});

View File

@ -64,11 +64,16 @@
span {
display: inline-block;
vertical-align: middle;
}
span.spacer {
&.spacer {
visibility: none;
}
&.findtheungluers {
cursor: pointer;
}
}
}
}

62
static/less/comments.less Normal file
View File

@ -0,0 +1,62 @@
.comments {
clear: both;
padding: 5px;
margin: 0 5px 0 0;
//min-height: 105px;
width: 95%;
&.row1 {
background: #f6f9f9;
}
&.row2 {
background: #fff;
}
div {
float: left;
img {
margin: 0 5px;
}
}
.image img {
height: 100px;
}
// so div will stretch to height of content
&:after {
content: ".";
display: block;
height: 0;
clear: both;
visibility: hidden;
}
.nonavatar {
width: 620px;
span {
padding-right: 5px;
&.text:before {
content: "\201C";
font-size: 17px;
font-weight: bold;
}
&.text:after {
content: "\201D";
font-size: 17px;
font-weight: bold;
}
}
}
.avatar {
float: right;
margin: 0 auto;
padding-top: 5px;
}
}

View File

@ -22,8 +22,17 @@
&.last {
padding-right:0px;
width:270px;
background: url("@{image-base}landingpage/signmeup-arrow.png") no-repeat center bottom;
padding-bottom: 42px;
.signup {
color: @call-to-action;
font-weight: bold;
margin-top: 10px;
img {
margin-left: 5px;
vertical-align: middle;
}
}
}
}