Skip to content

Commit

Permalink
Estimated Audience field fix mozillahispano#32
Browse files Browse the repository at this point in the history
  • Loading branch information
bbotella committed Nov 8, 2013
1 parent 12eb221 commit 618d588
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 7 deletions.
2 changes: 1 addition & 1 deletion mozbuzz/buzz/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ class Mention(SoftDeletableModel):
feedback = models.IntegerField(max_length=1, choices=FEEDBACK_TYPES)
previous_product_comments = models.IntegerField(max_length=1,
choices=PREVIOUS_PRODUCT_COMMENTS)
estimated_audience = models.IntegerField()
estimated_audience = models.IntegerField(null=True, blank=True)
relevant_audience = models.BooleanField()
update_rate = models.IntegerField(max_length=1, choices=UPDATE_RATE)
remarks = models.TextField(null=True, blank=True)
Expand Down
24 changes: 21 additions & 3 deletions mozbuzz/buzz/templates/buzz/mention.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@
{{field.errors}}
{{field.label_tag}}
{{field}}
{% if field.name == "estimated_audience" %}
<input type="checkbox" name="estimated_audience_null_check" id="estimated_audience_null_check" value="estimated_audience_null_check" checked=true>{%trans "Unknown"%}
{% endif %}
<div id="field_{{field.name}}_result"></div>
</div>
{% endif %}
Expand All @@ -47,11 +50,26 @@
{% endblock %}

{% block extrascript %}
<script src="{{MEDIA_URL}}js/readability.js" type="text/javascript"></script>
<script src="{{MEDIA_URL}}js/to-markdown.js" type="text/javascript"></script>
<script src="{{MEDIA_URL}}js/mozreadability.js" type="text/javascript"></script>
<script src="{{STATIC_URL}}js/readability.js" type="text/javascript"></script>
<script src="{{STATIC_URL}}js/to-markdown.js" type="text/javascript"></script>
<script src="{{STATIC_URL}}js/mozreadability.js" type="text/javascript"></script>
{% if is_new and form.initial.link|length > 10 %}
<script type="text/javascript">guessInformation();</script>
{% endif %}
<script>
$("#id_estimated_audience").keyup(function() {
if ($("#id_estimated_audience").val().length==0) {
$("#estimated_audience_null_check").attr('checked', true);
} else {
$("#estimated_audience_null_check").attr('checked', false);
}
});

$('#estimated_audience_null_check').change(function() {
if($(this).is(":checked")) {
$("#id_estimated_audience").val("");
}
});
</script>

{% endblock %}
4 changes: 2 additions & 2 deletions mozbuzz/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash.
# Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
MEDIA_URL = '/media/'
MEDIA_URL = '/mozbuzz/media/'

# Absolute path to the directory static files should be collected to.
# Don't put anything in this directory yourself; store your static files
Expand All @@ -64,7 +64,7 @@

# URL prefix for static files.
# Example: "http://media.lawrence.com/static/"
STATIC_URL = '/static/'
STATIC_URL = '/mozbuzz/static/'

# Additional locations of static files
STATICFILES_DIRS = (
Expand Down
2 changes: 1 addition & 1 deletion mozbuzz/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ <h1>
<script type="text/javascript">
var URL_ROOT = "{% url "index" %}";
</script>
<script src="{% static 'js/jquery.min.js' %}" type="text/javascript"></script>
<script src="{% static 'js/jquery-1.9.1.min.js' %}" type="text/javascript"></script>
<script src="{% static 'js/jquery-ui.min.js' %}" type="text/javascript"></script>
<script src="{% static 'js/mozbuzz.js' %}" type="text/javascript"></script>
{% browserid_js %}
Expand Down

0 comments on commit 618d588

Please sign in to comment.