merge from master

pull/1/head
eric 2013-03-21 08:44:43 -04:00
commit cc48ef8362
6 changed files with 47 additions and 21 deletions

View File

@ -25,7 +25,6 @@
<ul class="menu level3">
<li class="first"><a href="{% url bypub_list 'popular' pubname %}"><span>Most popular</span></a></li>
<li><a href="{% url bypub_list pubname %}"><span>By Title</span></a></li>
<li><a href="{% url bypub_list 'pubdate' pubname %}"><span>By Date Published</span></a></li>
</ul>
</li>
{% endif %}

View File

@ -48,8 +48,9 @@ $j(document).ready(function() {
<div id="js-maincol-fr">
<div class="js-maincol-inner">
<div id="content-block">
{% if campaign_works %}
<div class="content-block-heading">
<h2 class="content-heading">Google Books search results</span></h2>
<h2 class="content-heading">Unglue.it Campaigns</span></h2>
<ul class="book-list-view">
<li>View As:</li>
<li class="view-list">
@ -64,8 +65,39 @@ $j(document).ready(function() {
</li>
</ul>
</div>
<div id="content-block-content-1"><div id="unglueit-results">
{% for work in campaign_works %}
<div class="{% cycle 'row1' 'row2' %} book">
{% with work.googlebooks_id as googlebooks_id %}
{% with work.last_campaign_status as status %}
{% with work.last_campaign.deadline as deadline %}
{% include "book_panel.html" %}
{% endwith %}{% endwith %}{% endwith %}
</div>
{% endfor %}
</div></div>
{% endif %}
<div class="content-block-heading">
<h2 class="content-heading"><a href="https://www.google.com/search?q={{q }}&amp;tbm=bks">Google Books</a> search results</span></h2>
{% if not campaign_works %}
<ul class="book-list-view">
<li>View As:</li>
<li class="view-list">
<a href="#" id="toggle-list">
<img src="/static/images/booklist/view-list.png" align="view list" title="view list" height="21" width="24" alt="use list view" />
</a>
</li>
<li class="view-list">
<a href="#" id="toggle-panel">
<img src="/static/images/booklist/view-icon.png" align="view icon" title="view icon" height="22" width="22" alt="use panel view" />
</a>
</li>
</ul>
{% endif %}
</div>
<div id="content-block-content"><div id="results">
{% for work in results %}
{% if not work.campaigns %}
<div class="{% cycle 'row1' 'row2' %} book">
{% with work.googlebooks_id as googlebooks_id %}
{% with work.last_campaign_status as status %}
@ -74,6 +106,7 @@ $j(document).ready(function() {
{% include "book_panel.html" %}
{% endwith %}{% endwith %}{% endwith %}{% endwith %}
</div>
{% endif %}
{% empty %}
<h2>Sorry, couldn't find that!</h2>
<div class="js-search">

View File

@ -1568,6 +1568,12 @@ def search(request):
page = int(request.GET.get('page', 1))
results = gluejar_search(q, user_ip=request.META['REMOTE_ADDR'], page=page)
if page==1:
work_query = Q(title__icontains=q) | Q(editions__authors__name__icontains=q) | Q(subjects__name__iexact=q)
campaign_works = models.Work.objects.exclude(campaigns = None).filter(work_query).distinct()
else:
campaign_works = None
# flag search result as on wishlist as appropriate
if not request.user.is_anonymous():
ungluers = userlists.other_users(request.user, 5)
@ -1584,7 +1590,8 @@ def search(request):
context = {
"q": q,
"results": works,
"ungluers": ungluers
"ungluers": ungluers,
"campaign_works": campaign_works
}
return render(request, 'search.html', context)

File diff suppressed because one or more lines are too long

View File

@ -656,7 +656,7 @@ div#content-block {
font-weight:normal;
}
div#content-block-content {
div#content-block-content, div#content-block-content-1 {
width:100%;
overflow:hidden;
padding-left: 10px;

View File

@ -582,19 +582,6 @@ INSERT INTO `core_identifier` VALUES (1,'goog','wtPxGztYx-UC',1,1),(2,'isbn','97
/*!40000 ALTER TABLE `core_identifier` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Create empty core_key
--
DROP TABLE IF EXISTS `core_key`;
CREATE TABLE `core_key` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`encrypted_value` longtext,
PRIMARY KEY (`id`),
UNIQUE KEY `core_key_name_2fdc7c2d_uniq` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Table structure for table `core_premium`
--
@ -1680,7 +1667,7 @@ CREATE TABLE `south_migrationhistory` (
`migration` varchar(255) NOT NULL,
`applied` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=44 DEFAULT CHARSET=utf8;
) ENGINE=InnoDB AUTO_INCREMENT=45 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
@ -1689,7 +1676,7 @@ CREATE TABLE `south_migrationhistory` (
LOCK TABLES `south_migrationhistory` WRITE;
/*!40000 ALTER TABLE `south_migrationhistory` DISABLE KEYS */;
INSERT INTO `south_migrationhistory` VALUES (1,'core','0001_initial','2012-03-02 17:50:54'),(2,'core','0002_add_goodreads_id','2012-03-02 17:50:55'),(3,'core','0003_add_librarything_ids','2012-03-02 17:50:55'),(4,'core','0004_auto__add_field_campaign_status','2012-03-02 17:50:56'),(5,'core','0005_set_status','2012-03-02 17:50:56'),(6,'core','0006_wishes','2012-03-02 17:50:56'),(7,'core','0007_auto__add_field_wishes_created__add_field_wishes_source','2012-03-02 17:50:57'),(8,'core','0008_add_work_language_col','2012-03-02 17:50:58'),(9,'core','0009_add_work_language_data','2012-03-02 17:50:58'),(10,'core','0010_remove_edition_language','2012-03-02 17:50:58'),(11,'core','0011_auto__add_campaignaction__del_field_campaign_suspended_reason__del_fie','2012-03-02 17:50:59'),(12,'core','0012_auto__add_field_campaign_left','2012-03-02 17:51:00'),(13,'core','0013_move_subject_to_work','2012-03-02 17:51:01'),(14,'core','0015_auto__chg_field_subject_name__add_unique_subject_name','2012-03-02 17:51:01'),(15,'core','0016_auto__add_field_work_openlibrary_lookup','2012-03-02 17:51:02'),(16,'core','0017_isbn_to_13','2012-03-02 17:51:02'),(17,'core','0018_auto__del_field_edition_isbn_10','2012-03-02 17:51:02'),(18,'core','0019_googlebooks_id_must_be_unique','2012-03-02 17:51:02'),(19,'core','0020_auto__add_identifier__add_unique_identifier_type_value','2012-03-02 17:51:03'),(20,'core','0021_auto__del_field_work_librarything_id__del_field_work_openlibrary_id__d','2012-03-02 17:51:04'),(21,'core','0022_auto__chg_field_edition_publisher__chg_field_edition_publication_date','2012-03-02 17:51:05'),(22,'core','0023_auto__add_waswork','2012-03-02 17:51:05'),(23,'core','0024_auto__add_field_work_num_wishes','2012-03-02 17:51:06'),(24,'core','0025_count_wishes','2012-03-02 17:51:06'),(25,'core','0026_auto__add_field_ebook_user__add_field_waswork_moved__add_field_waswork','2012-03-02 17:51:08'),(26,'payment','0001_initial','2012-03-02 17:51:10'),(27,'payment','0002_auto__add_paymentresponse__del_field_transaction_reference__add_field_','2012-03-02 17:51:13'),(28,'payment','0003_auto__add_field_transaction_max_amount','2012-03-02 17:51:13'),(29,'payment','0004_auto__add_field_transaction_approved','2012-03-02 17:51:14'),(30,'tastypie','0001_initial','2012-03-02 17:51:14'),(31,'djcelery','0001_initial','2012-03-02 17:51:18'),(32,'payment','0005_auto__add_field_transaction_premium','2012-03-21 22:17:45'),(33,'core','0027_auto__add_field_campaign_license__chg_field_ebook_url','2012-03-28 15:24:25'),(34,'core','0028_auto__add_field_premium_limit','2012-03-28 15:24:25'),(35,'core','0029_https_facebook_avatars','2012-05-03 18:11:34'),(36,'core','0030_twitter_rewrite','2012-05-03 18:11:34'),(37,'core','0031_auto__add_field_campaign_edition','2012-05-03 18:11:35'),(38,'payment','0006_auto__add_field_transaction_local_status__add_field_paymentresponse_st','2012-05-03 18:11:36'),(39,'core','0032_auto__add_field_work_description','2012-05-07 23:51:10'),(40,'core','0033_move_descriptions','2012-05-07 23:51:10'),(41,'core','0034_auto__del_field_edition_description','2012-05-07 23:51:10'),(42,'core','0035_auto__add_key','2012-05-09 17:59:56'),(43,'core','0036_auto__add_unique_key_name','2012-05-09 17:59:56');
INSERT INTO `south_migrationhistory` VALUES (1,'core','0001_initial','2012-03-02 17:50:54'),(2,'core','0002_add_goodreads_id','2012-03-02 17:50:55'),(3,'core','0003_add_librarything_ids','2012-03-02 17:50:55'),(4,'core','0004_auto__add_field_campaign_status','2012-03-02 17:50:56'),(5,'core','0005_set_status','2012-03-02 17:50:56'),(6,'core','0006_wishes','2012-03-02 17:50:56'),(7,'core','0007_auto__add_field_wishes_created__add_field_wishes_source','2012-03-02 17:50:57'),(8,'core','0008_add_work_language_col','2012-03-02 17:50:58'),(9,'core','0009_add_work_language_data','2012-03-02 17:50:58'),(10,'core','0010_remove_edition_language','2012-03-02 17:50:58'),(11,'core','0011_auto__add_campaignaction__del_field_campaign_suspended_reason__del_fie','2012-03-02 17:50:59'),(12,'core','0012_auto__add_field_campaign_left','2012-03-02 17:51:00'),(13,'core','0013_move_subject_to_work','2012-03-02 17:51:01'),(14,'core','0015_auto__chg_field_subject_name__add_unique_subject_name','2012-03-02 17:51:01'),(15,'core','0016_auto__add_field_work_openlibrary_lookup','2012-03-02 17:51:02'),(16,'core','0017_isbn_to_13','2012-03-02 17:51:02'),(17,'core','0018_auto__del_field_edition_isbn_10','2012-03-02 17:51:02'),(18,'core','0019_googlebooks_id_must_be_unique','2012-03-02 17:51:02'),(19,'core','0020_auto__add_identifier__add_unique_identifier_type_value','2012-03-02 17:51:03'),(20,'core','0021_auto__del_field_work_librarything_id__del_field_work_openlibrary_id__d','2012-03-02 17:51:04'),(21,'core','0022_auto__chg_field_edition_publisher__chg_field_edition_publication_date','2012-03-02 17:51:05'),(22,'core','0023_auto__add_waswork','2012-03-02 17:51:05'),(23,'core','0024_auto__add_field_work_num_wishes','2012-03-02 17:51:06'),(24,'core','0025_count_wishes','2012-03-02 17:51:06'),(25,'core','0026_auto__add_field_ebook_user__add_field_waswork_moved__add_field_waswork','2012-03-02 17:51:08'),(26,'payment','0001_initial','2012-03-02 17:51:10'),(27,'payment','0002_auto__add_paymentresponse__del_field_transaction_reference__add_field_','2012-03-02 17:51:13'),(28,'payment','0003_auto__add_field_transaction_max_amount','2012-03-02 17:51:13'),(29,'payment','0004_auto__add_field_transaction_approved','2012-03-02 17:51:14'),(30,'tastypie','0001_initial','2012-03-02 17:51:14'),(31,'djcelery','0001_initial','2012-03-02 17:51:18'),(32,'payment','0005_auto__add_field_transaction_premium','2012-03-21 22:17:45'),(33,'core','0027_auto__add_field_campaign_license__chg_field_ebook_url','2012-03-28 15:24:25'),(34,'core','0028_auto__add_field_premium_limit','2012-03-28 15:24:25'),(35,'core','0029_https_facebook_avatars','2012-05-03 18:11:34'),(36,'core','0030_twitter_rewrite','2012-05-03 18:11:34'),(37,'core','0031_auto__add_field_campaign_edition','2012-05-03 18:11:35'),(38,'payment','0006_auto__add_field_transaction_local_status__add_field_paymentresponse_st','2012-05-03 18:11:36'),(39,'core','0032_auto__add_field_work_description','2012-05-07 23:51:10'),(40,'core','0033_move_descriptions','2012-05-07 23:51:10'),(41,'core','0034_auto__del_field_edition_description','2012-05-07 23:51:10'),(42,'core','0035_auto__add_key','2012-05-09 17:59:56'),(43,'core','0036_auto__add_unique_key_name','2012-05-09 17:59:56'),(44,'social_auth','0001_initial','2013-03-19 22:22:28');
/*!40000 ALTER TABLE `south_migrationhistory` ENABLE KEYS */;
UNLOCK TABLES;
@ -1756,4 +1743,4 @@ UNLOCK TABLES;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2012-05-09 11:35:52
-- Dump completed on 2013-03-19 19:28:33