# HG changeset patch # User Brian Neal # Date 1296096970 0 # Node ID 88b2b9cb8c1fec575aa6b90455d2fd2957a97dce # Parent b1c39788e511a6552bdf5c3d03901fbf77be8831 Fixing #142; cut over to the django.contrib.staticfiles app. diff -r b1c39788e511 -r 88b2b9cb8c1f gpp/bio/forms.py --- a/gpp/bio/forms.py Thu Jan 20 04:40:14 2011 +0000 +++ b/gpp/bio/forms.py Thu Jan 27 02:56:10 2011 +0000 @@ -31,9 +31,9 @@ interests = forms.CharField(required=False, widget=forms.TextInput(attrs={'size' : 64 })) time_zone = forms.CharField(required=False, widget=forms.HiddenInput()) use_24_time = forms.BooleanField(label='Show times in 24-hour mode', required=False) - profile_text = forms.CharField(required=False, + profile_text = forms.CharField(required=False, widget=forms.Textarea(attrs={'class': 'markItUp'})) - signature = forms.CharField(required=False, + signature = forms.CharField(required=False, widget=forms.Textarea(attrs={'class': 'markItUp'})) class Meta: @@ -95,7 +95,7 @@ s = StringIO() self.image.save(s, self.file_type) return name, ContentFile(s.getvalue()) - + return name, self.cleaned_data['avatar_file'] diff -r b1c39788e511 -r 88b2b9cb8c1f gpp/bio/static/css/bio.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gpp/bio/static/css/bio.css Thu Jan 27 02:56:10 2011 +0000 @@ -0,0 +1,38 @@ +div.user_profile th { + font-weight: bold; + text-align: left; + padding: 5px 5px; +} +div.user_profile td { + font-weight: normal; + text-align: left; + padding: 5px 5px; +} + +div.members-list table { + border-collapse: collapse; + width: 95%; + border: 1px solid black; + margin: 1em auto 1em auto; +} + +div.members-list th { + font-weight: bold; + text-align: center; + padding: 5px 5px; +} + +div.members-list tr { + border-top: 1px solid black; + border-bottom: 1px solid black; + text-align: center; +} + +div.members-list td { + padding: 5px 5px; + text-align: center; +} + +div.members-list tr.odd { + background-color: #ddd; +} diff -r b1c39788e511 -r 88b2b9cb8c1f gpp/bio/static/js/bio.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gpp/bio/static/js/bio.js Thu Jan 27 02:56:10 2011 +0000 @@ -0,0 +1,36 @@ +$(document).ready(function() { + var bday = $('#id_birthday'); + // jquery ui may not always be loaded + if (bday.length) { + bday.datepicker({changeMonth: true, + changeYear: true, + dateFormat: 'yy-mm-dd', + defaultDate: '-30y', + minDate: new Date(1909, 0, 1), + maxDate: new Date(), + yearRange: '-100:+0'}); + } + $('a.profile-flag').click(function() { + var id = this.id; + if (id.match(/fp-(\d+)/)) { + id = RegExp.$1; + if (confirm('Only report a profile if you feel it is spam, abuse, ' + + 'violates site rules, or is not appropriate. ' + + 'A moderator will be notified and will review the profile. ' + + 'Are you sure you want to report this profile?')) { + $.ajax({ + url: '/profile/flag/' + id + '/', + type: 'POST', + dataType: 'text', + success: function (response, textStatus) { + alert(response); + }, + error: function (xhr, textStatus, ex) { + alert('Oops, an error occurred: ' + xhr.statusText + ' - ' + xhr.responseText); + } + }); + } + } + return false; + }); +}); diff -r b1c39788e511 -r 88b2b9cb8c1f gpp/bio/templatetags/elsewhere_tags.py --- a/gpp/bio/templatetags/elsewhere_tags.py Thu Jan 20 04:40:14 2011 +0000 +++ b/gpp/bio/templatetags/elsewhere_tags.py Thu Jan 27 02:56:10 2011 +0000 @@ -1,5 +1,5 @@ """ -Template tags for the elsewhere application. +Template tags for the elsewhere application. """ from django import template from django.conf import settings @@ -7,11 +7,11 @@ register = template.Library() -@register.inclusion_tag('bio/elsewhere_links.html', takes_context=True) -def elsewhere_links(context, user): +@register.inclusion_tag('bio/elsewhere_links.html') +def elsewhere_links(user): return { 'social_nets': user.social_network_profiles.all(), 'ims': user.instant_messenger_profiles.all(), 'websites': user.website_profiles.all(), - 'MEDIA_URL': context['MEDIA_URL'], + 'STATIC_URL': settings.STATIC_URL, } diff -r b1c39788e511 -r 88b2b9cb8c1f gpp/comments/forms.py --- a/gpp/comments/forms.py Thu Jan 20 04:40:14 2011 +0000 +++ b/gpp/comments/forms.py Thu Jan 27 02:56:10 2011 +0000 @@ -12,7 +12,7 @@ class CommentForm(forms.Form): comment = forms.CharField(label='', - min_length=1, + min_length=1, max_length=COMMENT_MAX_LENGTH, widget=forms.Textarea(attrs={'class': 'markItUp smileyTarget'})) content_type = forms.CharField(widget=forms.HiddenInput) @@ -69,6 +69,6 @@ 'all': (settings.GPP_THIRD_PARTY_CSS['markitup'] + settings.GPP_THIRD_PARTY_CSS['jquery-ui']), } - js = (settings.GPP_THIRD_PARTY_JS['markitup'] + + js = (settings.GPP_THIRD_PARTY_JS['markitup'] + settings.GPP_THIRD_PARTY_JS['jquery-ui'] + ('js/comments.js', )) diff -r b1c39788e511 -r 88b2b9cb8c1f gpp/comments/static/css/comments.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gpp/comments/static/css/comments.css Thu Jan 27 02:56:10 2011 +0000 @@ -0,0 +1,28 @@ +div.comment-list { + float: left; + font-size: 18px; + font-weight: bold; + color: #999; + padding-right: .5em; +} +div.comment { + padding: 0.5em; + border-bottom: 1px dashed black; + font: 12px/18px "Lucida Grande", Verdana, sans-serif; + color: #333; +} +div.comment-avatar { + float: left; + padding-right: 1.5em; +} +div.comment-text { +} +div.comment-text-removed { + font-style: italic; +} +div.comment-details { + clear: both; + font-size: smaller; + font-style: italic; + padding-top: 0.5em; +} diff -r b1c39788e511 -r 88b2b9cb8c1f gpp/comments/static/js/comments.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gpp/comments/static/js/comments.js Thu Jan 27 02:56:10 2011 +0000 @@ -0,0 +1,66 @@ +$(document).ready(function() { + var postText = $('#id_comment'); + var postButton = $('#comment-form-post'); + postButton.click(function () { + var text = $.trim(postText.val()); + if (text.length == 0) { + alert('Please enter some text.'); + return false; + } + postButton.attr('disabled', 'disabled').val('Posting Comment...'); + $.ajax({ + url: '/comments/post/', + type: 'POST', + data: { + comment : text, + content_type : $('#id_content_type').val(), + object_pk : $('#id_object_pk').val() + }, + dataType: 'html', + success: function (data, textStatus) { + postText.val(''); + $('#comment-container').append(data); + var newDiv = $('#comment-container > div:last'); + newDiv.hide(); + var num = $('.comment-list', newDiv); + num.html($('#comment-container > div').size() + "."); + newDiv.fadeIn(3000); + postButton.removeAttr('disabled').val('Post Comment'); + var count = $('#comment-count'); + if (count.length) { + count.html(parseInt(count.html()) + 1); + } + }, + error: function (xhr, textStatus, ex) { + alert('Oops, an error occurred. ' + xhr.statusText + ' - ' + + xhr.responseText); + postButton.removeAttr('disabled').val('Post Comment'); + } + }); + return false; + }); + $('a.comment-flag').click(function () { + var id = this.id; + if (id.match(/fc-(\d+)/)) { + id = RegExp.$1; + if (confirm('Only flag a comment if you feel it is spam, abuse, violates site rules, ' + + 'or is not appropriate. ' + + 'A moderator will be notified and will review the comment. ' + + 'Are you sure you want to flag this comment?')) { + $.ajax({ + url: '/comments/flag/', + type: 'POST', + data: {id: id}, + dataType: 'text', + success: function (response, textStatus) { + alert(response); + }, + error: function (xhr, textStatus, ex) { + alert('Oops, an error occurred: ' + xhr.statusText + ' - ' + xhr.responseText); + } + }); + } + } + return false; + }); +}); diff -r b1c39788e511 -r 88b2b9cb8c1f gpp/comments/templatetags/comment_tags.py --- a/gpp/comments/templatetags/comment_tags.py Thu Jan 20 04:40:14 2011 +0000 +++ b/gpp/comments/templatetags/comment_tags.py Thu Jan 27 02:56:10 2011 +0000 @@ -8,6 +8,7 @@ {% render_comment_list [object] %} """ from django import template +from django.conf import settings from django.template.loader import render_to_string from django.contrib.contenttypes.models import ContentType @@ -32,7 +33,7 @@ @register.tag def get_comment_count(parser, token): """ - Gets the comment count for the specified object and makes it available in the + Gets the comment count for the specified object and makes it available in the template context under the variable name specified. Syntax: {% get_comment_count for [object] as [varname] %} @@ -66,7 +67,7 @@ @register.tag def get_comment_list(parser, token): """ - Gets a list of comments for the specified object and makes it available in the + Gets a list of comments for the specified object and makes it available in the template context under the variable name specified. Syntax: {% get_comment_list for [object] as [varname] %} @@ -99,7 +100,7 @@ @register.tag def get_comment_form(parser, token): """ - Gets the comment form for an object and makes it available in the + Gets the comment form for an object and makes it available in the template context under the variable name specified. Syntax: {% get_comment_form for [object] as [varname] %} @@ -136,7 +137,7 @@ @register.tag def render_comment_form(parser, token): """ - Renders a comment form for the specified object using the template + Renders a comment form for the specified object using the template comments/comment_form.html. Syntax: {% render_comment_form for [object] %} @@ -152,8 +153,8 @@ return RenderCommentFormNode(obj) -@register.inclusion_tag('comments/comment_list.html', takes_context=True) -def render_comment_list(context, object): +@register.inclusion_tag('comments/comment_list.html') +def render_comment_list(object): """ Renders the comments for the specified object using the template comments/comment_list.html. @@ -161,7 +162,8 @@ {% render_comment_list [object] %} """ qs = Comment.objects.for_object(object).select_related('user') - return {'comments': qs, - 'MEDIA_URL': context['MEDIA_URL'], - } + return { + 'comments': qs, + 'STATIC_URL': settings.STATIC_URL, + } diff -r b1c39788e511 -r 88b2b9cb8c1f gpp/core/templatetags/core_tags.py --- a/gpp/core/templatetags/core_tags.py Thu Jan 20 04:40:14 2011 +0000 +++ b/gpp/core/templatetags/core_tags.py Thu Jan 27 02:56:10 2011 +0000 @@ -15,8 +15,8 @@ register = template.Library() ICON_PARAMS = { - True: (settings.MEDIA_URL + 'icons/accept.png', 'Yes'), - False: (settings.MEDIA_URL + 'icons/delete.png', 'No'), + True: (settings.STATIC_URL + 'icons/accept.png', 'Yes'), + False: (settings.STATIC_URL + 'icons/delete.png', 'No'), } @register.simple_tag @@ -28,7 +28,7 @@ @register.inclusion_tag('core/comment_dialogs.html') def comment_dialogs(): - return {'MEDIA_URL': settings.MEDIA_URL} + return {'STATIC_URL': settings.STATIC_URL} @register.inclusion_tag('core/whos_online_tag.html') diff -r b1c39788e511 -r 88b2b9cb8c1f gpp/core/templatetags/script_tags.py --- a/gpp/core/templatetags/script_tags.py Thu Jan 20 04:40:14 2011 +0000 +++ b/gpp/core/templatetags/script_tags.py Thu Jan 27 02:56:10 2011 +0000 @@ -14,16 +14,14 @@ for path in settings.GPP_THIRD_PARTY_CSS[library]: prefix = '' if not path.startswith('http'): - prefix = settings.MEDIA_URL + prefix = settings.STATIC_URL s += '' % (prefix, path) if library in settings.GPP_THIRD_PARTY_JS: for path in settings.GPP_THIRD_PARTY_JS[library]: prefix = '' if not path.startswith('http'): - prefix = settings.MEDIA_URL + prefix = settings.STATIC_URL s += '' % (prefix, path) return s - -# vim: ts=4 sw=4 diff -r b1c39788e511 -r 88b2b9cb8c1f gpp/downloads/forms.py --- a/gpp/downloads/forms.py Thu Jan 20 04:40:14 2011 +0000 +++ b/gpp/downloads/forms.py Thu Jan 27 02:56:10 2011 +0000 @@ -12,9 +12,9 @@ class AddDownloadForm(forms.ModelForm): """Form to allow adding downloads.""" - title = forms.CharField(required=True, + title = forms.CharField(required=True, widget=forms.TextInput(attrs={'size': 64, 'maxlength': 64})) - description = forms.CharField(required=False, + description = forms.CharField(required=False, widget=forms.Textarea(attrs={'class': 'markItUp smileyTarget'})) def clean_file(self): @@ -28,7 +28,7 @@ class Meta: model = PendingDownload fields = ('title', 'category', 'description', 'file') - + class Media: css = { 'all': (settings.GPP_THIRD_PARTY_CSS['markitup'] + diff -r b1c39788e511 -r 88b2b9cb8c1f gpp/downloads/static/css/downloads.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gpp/downloads/static/css/downloads.css Thu Jan 27 02:56:10 2011 +0000 @@ -0,0 +1,8 @@ +#downloads-add td { + padding-bottom: 5px; +} + +#downloads-add fieldset { + margin: 1em 0 1em; + padding: 0.5em; +} diff -r b1c39788e511 -r 88b2b9cb8c1f gpp/downloads/static/js/rating.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gpp/downloads/static/js/rating.js Thu Jan 27 02:56:10 2011 +0000 @@ -0,0 +1,115 @@ +function dlRatingOver(event) +{ + var div = $(this).parent('div'); + var stars = $('img', div); + for (var i = 0; i <= event.data; ++i) + { + var star = $(stars[i]); + star.attr('src', '/static/icons/stars/rating_over.gif'); + } +} + +function dlRatingOut(event) +{ + var div = $(this).parent('div'); + var stars = $('img', div); + for (var i = 0; i <= event.data; ++i) + { + var star = $(stars[i]); + star.attr('src', '/static/icons/stars/rating_' + star.attr('class') + '.gif'); + } +} + +function dlRatingClick(event) +{ + var star = $(this); + var id = star.attr('id'); + if (id.match(/star-(\d+)-(\d+)/)) + { + $.ajax({ + url: '/downloads/rate/', + type: 'POST', + data: { id: RegExp.$1, rating: parseInt(RegExp.$2) + 1}, + dataType: 'text', + success: function(rating) { + rating = parseFloat(rating); + if (rating < 0) + { + alert("You've already rated this download."); + return; + } + alert('Thanks for rating this download!'); + var div = star.parent('div'); + var stars = $('img', div); + rating = parseFloat(rating); + for (var i = 0; i < 5; ++i) + { + var s = $(stars[i]); + s.removeClass(s.attr('class')); + if (rating >= 1.0) + { + s.attr('src', '/static/icons/stars/rating_on.gif'); + s.addClass('on') + rating -= 1.0; + } + else if (rating >= 0.5) + { + s.attr('src', '/static/icons/stars/rating_half.gif'); + s.addClass('half') + rating = 0; + } + else + { + s.attr('src', '/static/icons/stars/rating_off.gif'); + s.addClass('off') + } + } + }, + error: function (xhr, textStatus, ex) { + alert('Oops, an error occurred. ' + xhr.statusText + ' - ' + + xhr.responseText); + } + }); + } +} + +$(document).ready(function() { + $('.rating').each(function(n) { + var div = $(this); + var id = div.attr('id'); + var numeric_id = -1; + if (id.match(/rating-(\d+)/)) + { + numeric_id = RegExp.$1; + } + var rating = div.html(); + div.html(''); + for (var i = 0; i < 5; ++i) + { + var star = $(''); + if (rating >= 1) + { + star.attr('src', '/static/icons/stars/rating_on.gif'); + star.addClass('on') + --rating; + } + else if (rating >= 0.5) + { + star.attr('src', '/static/icons/stars/rating_half.gif'); + star.addClass('half') + rating = 0; + } + else + { + star.attr('src', '/static/icons/stars/rating_off.gif'); + star.addClass('off') + } + star.attr('alt', 'star'); + star.attr('id', 'star-' + numeric_id + '-' + i); + star.bind('mouseover', i, dlRatingOver); + star.bind('mouseout', i, dlRatingOut); + star.click(dlRatingClick); + div.append(star); + } + }); +}); diff -r b1c39788e511 -r 88b2b9cb8c1f gpp/forums/static/js/forums.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gpp/forums/static/js/forums.js Thu Jan 27 02:56:10 2011 +0000 @@ -0,0 +1,287 @@ +$(document).ready(function() { + var postText = $('#id_body'); + var postButton = $('#forums-reply-post'); + postButton.click(function () { + var text = $.trim(postText.val()); + $(this).attr('disabled', 'disabled').val('Posting reply...'); + + var attachments = new Array() + $('#attachment div input').each(function(index) { + attachments[index] = $(this).val(); + }); + + $.ajax({ + url: '/forums/quick-reply/', + type: 'POST', + data: { + body : postText.val(), + topic_id : $('#id_topic_id').val(), + attachment : attachments + }, + traditional: true, + dataType: 'html', + success: function (data, textStatus) { + postText.val(''); + $('#forum-topic tr:last').after(data); + var lastTr = $('#forum-topic tr:last'); + lastTr.hide(); + lastTr.fadeIn(3000); + postButton.removeAttr('disabled').val('Submit Reply'); + initAttachments(); + }, + error: function (xhr, textStatus, ex) { + alert('Oops, an error occurred. ' + xhr.statusText + ' - ' + + xhr.responseText); + postButton.removeAttr('disabled').val('Submit Reply'); + initAttachments(); + } + }); + return false; + }); + $('a.post-flag').click(function () { + var id = this.id; + if (id.match(/fp-(\d+)/)) { + id = RegExp.$1; + if (confirm('Only flag a post if you feel it is spam, abuse, violates site rules, ' + + 'or is not appropriate. ' + + 'A moderator will be notified and will review the post. ' + + 'Are you sure you want to flag this post?')) { + $.ajax({ + url: '/forums/flag-post/', + type: 'POST', + data: {id: id}, + dataType: 'text', + success: function (response, textStatus) { + alert(response); + }, + error: function (xhr, textStatus, ex) { + alert('Oops, an error occurred: ' + xhr.statusText + ' - ' + xhr.responseText); + } + }); + } + } + return false; + }); + $('a.post-delete').click(function () { + var id = this.id; + if (id.match(/dp-(\d+)/)) { + id = RegExp.$1; + if (confirm('Are you sure you want to delete this post?')) { + $.ajax({ + url: '/forums/delete-post/', + type: 'POST', + data: {id: id}, + dataType: 'text', + success: function (response, textStatus) { + alert(response); + $('#post-' + id).fadeOut(3000); + }, + error: function (xhr, textStatus, ex) { + alert('Oops, an error occurred: ' + xhr.statusText + ' - ' + xhr.responseText); + } + }); + } + } + return false; + }); + $('#forum-mod-del-topic').click(function () { + return confirm('Are you sure you want to delete this topic?\n' + + 'WARNING: all posts will be lost.'); + }); + + var vid = 0; + var vidDiv = $('#attachment'); + + function clearAttachments() + { + $('#attachment div').remove(); + $('#attach-another').remove(); + } + + function processEmbeds(data, textStatus) + { + vidDiv.find('img').remove(); + $.each(data, function(index, value) { + var html = '
' + value.html + + '' + + 'Remove ' + + 'Remove' + + ''; + '
'; + vidDiv.append(html); + $('#video-' + index + ' a').click(function() { + $('#video-' + index).remove(); + relabelAttachLink(); + return false; + }); + }); + vid = data.length; + $('#video-' + (vid-1)).after('Attach another video'); + $('#attach-another').click(function() { + addVideo(); + relabelAttachLink(); + return false; + }); + } + + function initAttachments() + { + clearAttachments(); + + var post_input = $('#id_post_id'); + var attachments = $("#forums_post_form input:hidden[name='attachment']"); + if (post_input.length == 1) + { + post_id = post_input.val(); + vidDiv.prepend('Busy'); + $.ajax({ + url: '/forums/fetch_attachments/', + type: 'GET', + data: { + pid : post_id + }, + dataType: 'json', + success: processEmbeds, + error: function (xhr, textStatus, ex) { + vidDiv.find('img').remove(); + alert('Oops, an error occurred. ' + xhr.statusText + ' - ' + + xhr.responseText); + } + }); + } + else if (attachments.length > 0) + { + vidDiv.prepend('Busy'); + var embeds = new Array(); + attachments.each(function(index) { + embeds[index] = $(this).val(); + }); + attachments.remove(); + $.ajax({ + url: '/oembed/fetch_saved/', + type: 'GET', + data: { + embeds: embeds + }, + traditional: true, + dataType: 'json', + success: processEmbeds, + error: function (xhr, textStatus, ex) { + vidDiv.find('img').remove(); + alert('Oops, an error occurred. ' + xhr.statusText + ' - ' + + xhr.responseText); + } + }); + } + else + { + vid = 0; + var s = '
' + + 'Add ' + + 'Attach Video
'; + vidDiv.prepend(s); + $('#attachment a').click(function () { + $('#init-add').remove(); + addVideo(); + return false; + }); + } + } + + function relabelAttachLink() + { + var another = $('#attach-another'); + var n = $('#attachment div').length; + if (n == 0) + { + another.html("Attach a video"); + } + else + { + another.html("Attach another video"); + } + } + + function addVideo() + { + var id = "video-" + vid; + + var fakeForm = '
' + + 'Attach ' + + ' ' + + 'Remove
'; + + var n = $('#attachment div').length; + + var another = $('#attach-another'); + if (n == 0) + { + if (another.length > 0) + { + another.before(fakeForm); + } + else + { + vidDiv.append(fakeForm); + } + } + else + { + $('#attachment div:last').after(fakeForm); + } + + $('#' + id + ' a').click(function() { + $('#' + id).remove(); + relabelAttachLink(); + return false; + }); + + var vidText = $('#' + id + ' input'); + + $('#' + id + ' button').click(function() { + var button = $(this); + button.attr('disabled', 'disabled'); + $.ajax({ + url: '/oembed/fetch/', + type: 'POST', + data: { + q : vidText.val() + }, + dataType: 'json', + success: function (data, textStatus) { + $('#' + id + " .r").remove(); + var myDiv = $('#' + id); + var html = '' + + 'Remove ' + + 'Remove' + + ''; + myDiv.prepend(html); + myDiv.prepend(data.embed); + $('#' + id + ' a').click(function() { + myDiv.remove(); + relabelAttachLink(); + return false; + }); + }, + error: function (xhr, textStatus, ex) { + alert('Oops, an error occurred. ' + xhr.statusText + ' - ' + + xhr.responseText); + button.removeAttr('disabled'); + } + }); + }); + + if (vid == 0) + { + $('#video-0').after('Attach another video'); + $('#attach-another').click(function() { + addVideo(); + relabelAttachLink(); + return false; + }); + } + ++vid; + } + + initAttachments(); +}); diff -r b1c39788e511 -r 88b2b9cb8c1f gpp/forums/static/js/forums_mod.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gpp/forums/static/js/forums_mod.js Thu Jan 27 02:56:10 2011 +0000 @@ -0,0 +1,15 @@ +$(document).ready(function() { + var master = $('#forums-master-topic'); + var topics = $('.forums-topic_check'); + master.click(function() { + var state = this.checked; + topics.each(function() { + this.checked = state; + }); + }); + topics.click(function() { + if (master[0].checked && !this.checked) { + master[0].checked = false; + } + }); +}); diff -r b1c39788e511 -r 88b2b9cb8c1f gpp/forums/templatetags/forum_tags.py --- a/gpp/forums/templatetags/forum_tags.py Thu Jan 20 04:40:14 2011 +0000 +++ b/gpp/forums/templatetags/forum_tags.py Thu Jan 27 02:56:10 2011 +0000 @@ -39,7 +39,7 @@ def last_post_info(context, post): return { 'post': post, - 'MEDIA_URL': context['MEDIA_URL'], + 'STATIC_URL': context['STATIC_URL'], 'user': context['user'], } @@ -50,12 +50,12 @@ @register.inclusion_tag('forums/post_edit_button.html') -def post_edit_button(post, user, can_moderate, media_url): +def post_edit_button(post, user, can_moderate): show_button = post.user.id == user.id or can_moderate return { 'post': post, 'show_button': show_button, - 'MEDIA_URL': media_url, + 'STATIC_URL': settings.STATIC_URL, } @@ -109,7 +109,7 @@ 'form': form, 'submit_value': submit_value, 'is_ajax': is_ajax, - 'MEDIA_URL': settings.MEDIA_URL, + 'STATIC_URL': settings.STATIC_URL, } @@ -160,7 +160,7 @@ """Displays the "unread", "sticky", and "locked" icons for a given topic.""" return { 'topic': topic, - 'MEDIA_URL': settings.MEDIA_URL, + 'STATIC_URL': settings.STATIC_URL, } @@ -199,4 +199,4 @@ if subtitle: nav_list.append(dict(name=subtitle, url=None)) - return dict(nav_list=nav_list, MEDIA_URL=settings.MEDIA_URL) + return dict(nav_list=nav_list, STATIC_URL=settings.STATIC_URL) diff -r b1c39788e511 -r 88b2b9cb8c1f gpp/gcalendar/forms.py --- a/gpp/gcalendar/forms.py Thu Jan 20 04:40:14 2011 +0000 +++ b/gpp/gcalendar/forms.py Thu Jan 27 02:56:10 2011 +0000 @@ -69,7 +69,7 @@ end_time = forms.TimeField(required=False, widget=forms.Select(choices=TIME_CHOICES)) time_zone = forms.CharField(required=False, widget=forms.HiddenInput()) where = forms.CharField(required=False, widget=forms.TextInput(attrs={'size': 60})) - description = forms.CharField(required=False, + description = forms.CharField(required=False, widget=forms.Textarea(attrs={'class': 'markItUp smileyTarget'})) DATE_FORMAT = '%m/%d/%Y' # must match the jQuery UI datepicker config diff -r b1c39788e511 -r 88b2b9cb8c1f gpp/gcalendar/static/css/gcalendar.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gpp/gcalendar/static/css/gcalendar.css Thu Jan 27 02:56:10 2011 +0000 @@ -0,0 +1,7 @@ +.markItUp { + width: 600px; +} +.markItUpEditor { + width:543px; + height:200px; +} diff -r b1c39788e511 -r 88b2b9cb8c1f gpp/gcalendar/static/js/gcalendar.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gpp/gcalendar/static/js/gcalendar.js Thu Jan 27 02:56:10 2011 +0000 @@ -0,0 +1,33 @@ +$(document).ready(function() { + $('#id_start_date').datepicker({constrainInput: true, + dateFormat: 'mm/dd/yy', + onClose: function () { + var end = $('#id_end_date'); + if (this.value > end.val()) + { + end.val(this.value); + } + } + }); + $('#id_end_date').datepicker({constrainInput: true, + dateFormat: 'mm/dd/yy', + onClose: function () { + var start = $('#id_start_date'); + if (this.value < start.val()) + { + start.val(this.value); + } + } + }); + if ($('#id_all_day:checked').length) + { + $('#id_start_time').hide(); + $('#id_end_time').hide(); + $('#id_tz_stuff').hide(); + } + $('#id_all_day').click(function () { + $('#id_start_time').toggle(); + $('#id_end_time').toggle(); + $('#id_tz_stuff').toggle(); + }); +}); diff -r b1c39788e511 -r 88b2b9cb8c1f gpp/gcalendar/static/js/gcalendar_edit.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gpp/gcalendar/static/js/gcalendar_edit.js Thu Jan 27 02:56:10 2011 +0000 @@ -0,0 +1,24 @@ +$(document).ready(function() { + $('.gcal-del').click(function () { + if (confirm('Really delete this event?')) { + var id = this.id; + if (id.match(/gcal-(\d+)/)) { + $.ajax({ + url: '/calendar/delete/', + type: 'POST', + data: { id : RegExp.$1 }, + dataType: 'text', + success: function (id) { + var id = '#gcal-' + id; + $(id).parents('li').hide('normal'); + }, + error: function (xhr, textStatus, ex) { + alert('Oops, an error occurred. ' + xhr.statusText + ' - ' + + xhr.responseText); + } + }); + } + } + return false; + }); +}); diff -r b1c39788e511 -r 88b2b9cb8c1f gpp/membermap/forms.py --- a/gpp/membermap/forms.py Thu Jan 20 04:40:14 2011 +0000 +++ b/gpp/membermap/forms.py Thu Jan 27 02:56:10 2011 +0000 @@ -8,9 +8,9 @@ class MapEntryForm(forms.ModelForm): - location = forms.CharField(required=True, + location = forms.CharField(required=True, widget=forms.TextInput(attrs={'size': 64, 'maxlength': 255})) - message = forms.CharField(required=False, + message = forms.CharField(required=False, widget=forms.Textarea(attrs={'class': 'markItUp smileyTarget'})) class Meta: diff -r b1c39788e511 -r 88b2b9cb8c1f gpp/membermap/static/css/membermap.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gpp/membermap/static/css/membermap.css Thu Jan 27 02:56:10 2011 +0000 @@ -0,0 +1,20 @@ +#member_map_members_column { + float: left; +} +#member_map_map { + width: 720px; + height: 540px; + border: 1px solid black; + margin: 0 auto; +} +#member_map_info { + padding-top: 1em; + clear: left; +} +.markItUp { + width: 600px; +} +.markItUpEditor { + width:543px; + height:200px; +} diff -r b1c39788e511 -r 88b2b9cb8c1f gpp/membermap/static/js/membermap.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gpp/membermap/static/js/membermap.js Thu Jan 27 02:56:10 2011 +0000 @@ -0,0 +1,173 @@ +var mmap = { + map: null, + geocoder: null, + users: Object, + userOnMap: false, + userClick: function() { + var name = $('option:selected', this).text(); + if (name != mmap.selectText) + { + mmap.clickUser(name); + } + }, + clickUser: function(name) { + pt = new GLatLng(mmap.users[name].lat, mmap.users[name].lon); + mmap.map.setCenter(pt); + mmap.users[name].marker.openInfoWindowHtml(mmap.users[name].message); + }, + clear: function() { + mmap.users.length = 0; + }, + selectText: "(select)", + onMapDir: 'You have previously added yourself to the member map. Your information appears below. You may change ' + + 'the information if you wish. To delete yourself from the map, click the Delete button.', + offMapDir: 'Your location is not on the map. If you would like to appear on the map, please fill out the form below ' + + 'and click the Submit button.' +}; +$(document).ready(function() { + if (GBrowserIsCompatible()) + { + $(window).unload(GUnload); + mmap.map = new GMap2($('#member_map_map')[0]); + mmap.map.setCenter(new GLatLng(15.0, -30.0), 2); + mmap.map.enableScrollWheelZoom(); + mmap.map.addControl(new GLargeMapControl()); + mmap.map.addControl(new GMapTypeControl()); + mmap.geocoder = new GClientGeocoder(); + + if (mmapUser.userName) + { + $.getJSON('/member_map/query/', + function(data) { + mmap.map.clearOverlays(); + var sel = $('#member_map_members'); + sel[0].length = 0; + sel.append($('