Skip to content

Commit

Permalink
Merge branch 'release-1.2b3'
Browse files Browse the repository at this point in the history
  • Loading branch information
bbengfort committed Jul 11, 2016
2 parents ebd553f + 027b7d9 commit 6ff3530
Show file tree
Hide file tree
Showing 82 changed files with 391 additions and 175 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ runserver:
# Clean build files
clean:
find . -name "*.pyc" -print0 | xargs -0 rm -rf
find . -name "__pycache__" -print0 | xargs -0 rm -rf
-rm -rf htmlcov
-rm -rf .coverage
-rm -rf build
Expand Down
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,21 @@ The release versions that are sent to the Python package index (PyPI) are also t

The versioning uses a three part version system, "a.b.c" - "a" represents a major release that may not be backwards compatible. "b" is incremented on minor releases that may contain extra features, but are backwards compatible. "c" releases are bug fixes or other micro changes that developers should feel free to immediately update to.

### Version 1.2 Beta 3

* **tag**: [v1.1b2](https://github.com/DistrictDataLabs/minimum-entropy/releases/tag/v1.2b3)
* **deployment**: Monday, July 11, 2016
* **commit**: [see tag](#)

The third beta fixes the tag grid system which got all wonky in the first implementation when actual data was put in. The new style is similar to the Stack Overflow tag grid style. Moreover, now tags are case insensitive, which should help eliminate duplicates. The activity stream was also updated to use templates for a bit more robust control. The "answered" activity now takes the answer as a target rather than as a theme, and answers have detail links to the question that they're on.

### Version 1.1 Beta 2

* **tag**: [v1.1b2](https://github.com/DistrictDataLabs/minimum-entropy/releases/tag/v1.1b2)
* **deployment**: Friday, July 8, 2016
* **commit**: [see tag](#)
* **commit**: [ebd553f](https://github.com/DistrictDataLabs/minimum-entropy/commit/ebd553fd8ec202de38fb3f27de2993770ac48960)

The second beta release fixes a couple of bugs with the older profile system, and a lingering topic item from Kyudo. This release goes a bit further and creates a tagging system for questions (replacing topics) and allows for the ordering and search of questions in a more meaningful way. Hopefully this is the last official Beta version and Minimum Entropy can actually start to be used in a more meaningful way.
The second beta release fixes a couple of bugs with the older profile system, and a lingering topic item from Kyudo. This release goes a bit further and creates a tagging system for questions (replacing topics) and allows for the ordering and search of questions in a more meaningful way. Hopefully this is the last official Beta version and Minimum Entropy can actually start to be used in a more meaningful way.

### Version 1.0 Beta 1

Expand Down
10 changes: 9 additions & 1 deletion docs/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,19 @@ The release versions that are sent to the Python package index (PyPI) are also t

The versioning uses a three part version system, "a.b.c" - "a" represents a major release that may not be backwards compatible. "b" is incremented on minor releases that may contain extra features, but are backwards compatible. "c" releases are bug fixes or other micro changes that developers should feel free to immediately update to.

### Version 1.2 Beta 3

* **tag**: [v1.1b2](https://github.com/DistrictDataLabs/minimum-entropy/releases/tag/v1.2b3)
* **deployment**: Monday, July 11, 2016
* **commit**: [see tag](#)

The third beta fixes the tag grid system which got all wonky in the first implementation when actual data was put in. The new style is similar to the Stack Overflow tag grid style. Moreover, now tags are case insensitive, which should help eliminate duplicates. The activity stream was also updated to use templates for a bit more robust control. The "answered" activity now takes the answer as a target rather than as a theme, and answers have detail links to the question that they're on.

### Version 1.1 Beta 2

* **tag**: [v1.1b2](https://github.com/DistrictDataLabs/minimum-entropy/releases/tag/v1.1b2)
* **deployment**: Friday, July 8, 2016
* **commit**: [see tag](#)
* **commit**: [ebd553f](https://github.com/DistrictDataLabs/minimum-entropy/commit/ebd553fd8ec202de38fb3f27de2993770ac48960)

The second beta release fixes a couple of bugs with the older profile system, and a lingering topic item from Kyudo. This release goes a bit further and creates a tagging system for questions (replacing topics) and allows for the ordering and search of questions in a more meaningful way. Hopefully this is the last official Beta version and Minimum Entropy can actually start to be used in a more meaningful way.

Expand Down
2 changes: 1 addition & 1 deletion fugato/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# Copyright (C) 2016 District Data Labs
# For license information, see LICENSE.txt
#
# ID: __init__.py [] benjamin@bengfort.com $
# ID: __init__.py [8eae6c4] benjamin@bengfort.com $

"""
The fugato app is designed to collect questions.
Expand Down
2 changes: 1 addition & 1 deletion fugato/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# Copyright (C) 2016 District Data Labs
# For license information, see LICENSE.txt
#
# ID: admin.py [] benjamin@bengfort.com $
# ID: admin.py [8eae6c4] benjamin@bengfort.com $

"""
Description of the app for the admin site and CMS.
Expand Down
2 changes: 1 addition & 1 deletion fugato/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# Copyright (C) 2016 District Data Labs
# For license information, see LICENSE.txt
#
# ID: apps.py [] benjamin@bengfort.com $
# ID: apps.py [8eae6c4] benjamin@bengfort.com $

"""
Describes the Fugato application for Django
Expand Down
2 changes: 1 addition & 1 deletion fugato/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# Copyright (C) 2016 District Data Labs
# For license information, see LICENSE.txt
#
# ID: exceptions.py [] benjamin@bengfort.com $
# ID: exceptions.py [8eae6c4] benjamin@bengfort.com $

"""
Custom exceptions for API
Expand Down
2 changes: 1 addition & 1 deletion fugato/managers.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# Copyright (C) 2016 District Data Labs
# For license information, see LICENSE.txt
#
# ID: managers.py [] benjamin@bengfort.com $
# ID: managers.py [8eae6c4] benjamin@bengfort.com $

"""
Custom managers for the fugato models
Expand Down
22 changes: 22 additions & 0 deletions fugato/migrations/0004_auto_20160710_0909.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-07-10 13:09
from __future__ import unicode_literals

import autoslug.fields
from django.db import migrations
from slugify import slugify


class Migration(migrations.Migration):

dependencies = [
('fugato', '0003_auto_20160707_2054'),
]

operations = [
migrations.AlterField(
model_name='question',
name='slug',
field=autoslug.fields.AutoSlugField(editable=False, populate_from='text', slugify=slugify, unique=True),
),
]
2 changes: 1 addition & 1 deletion fugato/migrations/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# Copyright (C) 2016 District Data Labs
# For license information, see LICENSE.txt
#
# ID: __init__.py [] benjamin@bengfort.com $
# ID: __init__.py [8eae6c4] benjamin@bengfort.com $

"""
Database migrations for the fugato application
Expand Down
41 changes: 31 additions & 10 deletions fugato/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# Copyright (C) 2016 District Data Labs
# For license information, see LICENSE.txt
#
# ID: models.py [] benjamin@bengfort.com $
# ID: models.py [8eae6c4] benjamin@bengfort.com $

"""
Models for the fugato app.
Expand All @@ -27,7 +27,7 @@
from model_utils.models import TimeStampedModel
from django.core.urlresolvers import reverse
from django.contrib.contenttypes.fields import GenericRelation

from slugify import slugify
from operator import itemgetter

##########################################################################
Expand All @@ -36,15 +36,15 @@

class Question(TimeStampedModel):

text = models.CharField( max_length=512, null=False ) # The text of the question
slug = AutoSlugField( populate_from='text', unique=True ) # The slug of the question
text = models.CharField( max_length=512, null=False ) # The text of the question
slug = AutoSlugField( populate_from='text', slugify=slugify, unique=True ) # The slug of the question
signature = models.CharField( max_length=28, unique=True, editable=False ) # The normalized signature
details = models.TextField( help_text="Edit in Markdown", **nullable ) # Additional details about the question
details_rendered = models.TextField( editable=False, **nullable ) # HTML rendered details text from MD
related = models.ManyToManyField( 'self', editable=True, blank=True ) # Links between related questions
author = models.ForeignKey( 'auth.User', related_name='questions' ) # The author of the question
votes = GenericRelation( Vote, related_query_name='questions' ) # Vote on whether or not the question is relevant
tags = models.ManyToManyField('tagging.Tag', related_name='questions') # Tag each question with terms for easy lookup
details = models.TextField( help_text="Edit in Markdown", **nullable ) # Additional details about the question
details_rendered = models.TextField( editable=False, **nullable ) # HTML rendered details text from MD
related = models.ManyToManyField( 'self', editable=True, blank=True ) # Links between related questions
author = models.ForeignKey( 'auth.User', related_name='questions' ) # The author of the question
votes = GenericRelation( Vote, related_query_name='questions' ) # Vote on whether or not the question is relevant
tags = models.ManyToManyField('tagging.Tag', related_name='questions') # Tag each question with terms for easy lookup

## Set custom manager on Question
objects = QuestionManager()
Expand All @@ -61,6 +61,12 @@ def get_api_detail_url(self):
"""
return reverse('api:question-detail', args=(self.pk,))

def get_stream_repr(self):
"""
Returns the object representation for the activity stream.
"""
return '“{}”'.format(self)

def has_tag(self, tag):
"""
Returns True if the tag (a string) is in the list of tags.
Expand Down Expand Up @@ -107,11 +113,26 @@ class Meta:
db_table = "answers"
order_with_respect_to = 'question'

def get_absolute_url(self):
"""
Return the detail view of the Answer object, that is the url of the
question with the vertical reference to the answer attached.
"""
url = self.question.get_absolute_url()
url += "#answer-{}".format(self.id)
return url

def get_api_detail_url(self):
"""
Returns the API detail endpoint for the object
"""
return reverse('api:answer-detail', args=(self.pk,))

def get_stream_repr(self):
"""
Returns the object representation for the activity stream.
"""
return self.question.get_stream_repr()

def __str__(self):
return self.text
2 changes: 1 addition & 1 deletion fugato/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# Copyright (C) 2016 District Data Labs
# For license information, see LICENSE.txt
#
# ID: serializers.py [] benjamin@bengfort.com $
# ID: serializers.py [8eae6c4] benjamin@bengfort.com $

"""
JSON Serializers for the Fugato app
Expand Down
5 changes: 2 additions & 3 deletions fugato/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# Copyright (C) 2016 District Data Labs
# For license information, see LICENSE.txt
#
# ID: signals.py [] benjamin@bengfort.com $
# ID: signals.py [8eae6c4] benjamin@bengfort.com $

"""
Signals for the fugato app
Expand Down Expand Up @@ -80,8 +80,7 @@ def send_answered_activity_signal(sender, instance, created, **kwargs):
'sender': sender,
'actor': instance.author,
'verb': 'answer',
'theme': instance,
'target': instance.question,
'target': instance,
'timestamp': instance.created,
}
stream.send(**activity)
2 changes: 1 addition & 1 deletion fugato/templatetags/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# Copyright (C) 2016 District Data Labs
# For license information, see LICENSE.txt
#
# ID: __init__.py [] benjamin@bengfort.com $
# ID: __init__.py [6f1c3bb] benjamin@bengfort.com $

"""
Template tags for fugato (though also generic usage as well).
Expand Down
2 changes: 1 addition & 1 deletion fugato/templatetags/paginator.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# Copyright (C) 2016 District Data Labs
# For license information, see LICENSE.txt
#
# ID: paginator.py [] benjamin@bengfort.com $
# ID: paginator.py [6f1c3bb] benjamin@bengfort.com $

"""
Provides a paginator tag context for digg-style pagination.
Expand Down
14 changes: 5 additions & 9 deletions fugato/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# Copyright (C) 2016 District Data Labs
# For license information, see LICENSE.txt
#
# ID: tests.py [] benjamin@bengfort.com $
# ID: tests.py [8eae6c4] benjamin@bengfort.com $

"""
Tests the fugato app
Expand Down Expand Up @@ -119,26 +119,22 @@ def test_question_answer_send_stream(self):

# Ensure that the signal was sent once with required arguments
handler.assert_called_once_with(verb='answer', sender=Answer,
timestamp=answer.created, actor=self.user, theme=answer,
target=self.question, signal=stream)
timestamp=answer.created, actor=self.user, target=answer,
signal=stream)

def test_question_answered_activity(self):
"""
Assert that when a question is answered, there is an activity stream item
"""
answer = Answer.objects.create(**fixtures['answer'])
target_content_type = ContentType.objects.get_for_model(answer.question)
target_object_id = answer.question.id
theme_content_type = ContentType.objects.get_for_model(answer)
theme_object_id = answer.id
target_content_type = ContentType.objects.get_for_model(answer)
target_object_id = answer.id

query = {
'verb': 'answer',
'actor': self.user,
'target_content_type': target_content_type,
'target_object_id': target_object_id,
'theme_content_type': theme_content_type,
'theme_object_id': theme_object_id,
}

query = StreamItem.objects.filter(**query)
Expand Down
11 changes: 7 additions & 4 deletions fugato/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# Copyright (C) 2016 District Data Labs
# For license information, see LICENSE.txt
#
# ID: views.py [] benjamin@bengfort.com $
# ID: views.py [8eae6c4] benjamin@bengfort.com $

"""
Views for the Fugato app
Expand Down Expand Up @@ -185,8 +185,8 @@ def tags(self, request, pk=None):
if question.has_tag(tag): continue

# Otherwise, get or create the tag
tag, _ = Tag.objects.get_or_create(
text = tag,
tag, _ = Tag.objects.tag(
tag,
defaults = {
'creator': request.user,
}
Expand All @@ -196,8 +196,11 @@ def tags(self, request, pk=None):
question.tags.add(tag)

# Next delete any tags that were removed from the question
slugs = [
slugify(t) for t in serializer.validated_data['csv_tags']
]
for tag in question.tags.all():
if tag.text not in serializer.validated_data['csv_tags']:
if tag.slug not in slugs:
question.tags.remove(tag)

return Response(CSVTagSerializer.serialize_question(question))
Expand Down
2 changes: 1 addition & 1 deletion manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# Copyright (C) 2016 District Data Labs
# For license information, see LICENSE.txt
#
# ID: manage.py [] benjamin@bengfort.com $
# ID: manage.py [916a654] benjamin@bengfort.com $

"""
Django default management commands, with some special sauce.
Expand Down
2 changes: 1 addition & 1 deletion minent/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# Copyright (C) 2016 District Data Labs
# For license information, see LICENSE.txt
#
# ID: __init__.py [] benjamin@bengfort.com $
# ID: __init__.py [916a654] benjamin@bengfort.com $

"""
The Minimum Entropy project definition module.
Expand Down
29 changes: 22 additions & 7 deletions minent/assets/css/taggrid.css
Original file line number Diff line number Diff line change
@@ -1,20 +1,35 @@
/* Styles for the tag grid page */

.tag-block {
min-height: 128px;
height: 192px;
position: relative;
border-bottom: 1px solid #ccc;
margin: 8px 0;
}

.tag-question-count {
border: 1px solid #ccc;
width: 64px;
height: 64px;
padding-top: 6px;
.tag-heading-left {
width: 80%;
}

.tag-name {
font-size: 0.90em;
}

.tag-count {
padding-left: 6px;
}

.tag-body {
margin: 6px 0;
}


.tag-description {
font-size: .9em;
font-size: .85em;
}

.tag-meta-list {
font-size: .8em;
position: absolute;
bottom: 0;
}
Loading

0 comments on commit 6ff3530

Please sign in to comment.