Skip to content

Commit

Permalink
Bug 600660, removed email sharing woot
Browse files Browse the repository at this point in the history
  • Loading branch information
potch committed Oct 4, 2010
1 parent 218381c commit c54ac06
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 91 deletions.
2 changes: 1 addition & 1 deletion apps/addons/templates/addons/listing/items.html
Expand Up @@ -12,7 +12,7 @@
<div class="collection_widgets widgets condensed">
{{ favorites_widget(addon, condensed=True) }}
{{ collection_add_widget(addon, condensed=True) }}
{{ sharing_widget(addon, show_email=True, condensed=True) }}
{{ sharing_widget(addon, condensed=True) }}
</div>
{% endif %}
</div>
Expand Down
2 changes: 1 addition & 1 deletion apps/bandwagon/templates/bandwagon/collection_widgets.html
Expand Up @@ -6,7 +6,7 @@
class="widget tooltip watch{{ ' watching' if is_watching }}{{ ' condensed' if condensed }}"
href="{{ c.watch_url() }}">{{ watch_msg if not condensed }}</a>
{% endif %}
{{ sharing_widget(c, show_email=False, condensed=condensed) }}
{{ sharing_widget(c, condensed=condensed) }}
{% if request.user.is_authenticated() %}
{#
<a title="{{ _('Copy this Collection') }}" class="copy" href="#"></a>
Expand Down
3 changes: 1 addition & 2 deletions apps/sharing/__init__.py
Expand Up @@ -5,6 +5,5 @@


SERVICES_LIST = (models.DIGG, models.FACEBOOK, models.DELICIOUS,
models.MYSPACE, models.FRIENDFEED, models.TWITTER,
models.EMAIL)
models.MYSPACE, models.FRIENDFEED, models.TWITTER)
SERVICES = dict((service.shortname, service) for service in SERVICES_LIST)
6 changes: 1 addition & 5 deletions apps/sharing/helpers.py
Expand Up @@ -8,12 +8,10 @@

@register.inclusion_tag('sharing/sharing_widget.html')
@jinja2.contextfunction
def sharing_widget(context, obj, show_email=True, condensed=False):
def sharing_widget(context, obj, condensed=False):
c = dict(context.items())

services = list(sharing.SERVICES_LIST)
if not show_email:
services.remove(EMAIL)

share_counts = obj.share_counts()
counts = {}
Expand All @@ -23,7 +21,6 @@ def sharing_widget(context, obj, show_email=True, condensed=False):

c.update({
'condensed': condensed,
'show_email': show_email,
'base_url': obj.share_url(),
'counts': counts,
'services': services,
Expand All @@ -42,6 +39,5 @@ def sharing_box(context):
'request': request,
'user': request.user,
'services': sharing.SERVICES_LIST,
'email_service': EMAIL,
})
return c
42 changes: 1 addition & 41 deletions apps/sharing/templates/sharing/sharing_box.html
Expand Up @@ -4,7 +4,7 @@
{% for service in services %}
<li class="{{ service.shortname }}">
<span class="share-link">
<a class="uniquify" target="{{ '_self' if service==EMAIL else '_blank' }}" href="#">
<a class="uniquify" target="_self">
{{ service.label }}
</a>
</span>
Expand All @@ -14,44 +14,4 @@
{% endfor %}
</ul>
</div>{# /share-networks #}

{% if request.user.is_authenticated() or True %}
<div class="share-email share-content">
<form action=""
method="post">
{{ cake_csrf_token() }}
{# TODO uncakeify #}
<p class="container">
<label for="FriendEmails">
{# L10n: Refers to recipients of an add-on recommendation email #}
{{ _('Enter Email Addresses') }}
</label>
<input id="FriendEmails" type="text" value="" name="data[Friend][emails]"
placeholder="{{ email_service.placeholders|join(', ') }}"/>
</p>
<p class="container emailerror error" style="display:none">
</p>
<p class="container">
<label for="FriendMessage">
{# L10n: When recommending add-ons by email, users can specify a
personal message #}
{{ _('Message') }}
<span class="optional">{{ _('(optional)') }}</span>
</label>
<textarea id="FriendMessage" name="data[Friend][message]"></textarea>
</p>
<p class="container buttons">
<a href="#" class="close">{{ _('Cancel') }}</a>
<button type="submit">
{# L10n: Refers to an email #}
{{ _('Send') }}
</button>
</p>
</form>

<div class="share-email-success">
<p>{{ _('Emails sent!') }}</p>
</div>
</div>{# /share-email #}
{% endif %}
</div>
3 changes: 1 addition & 2 deletions apps/sharing/templates/sharing/sharing_widget.html
Expand Up @@ -6,8 +6,7 @@
{% set listed = obj.listed %}
{% endif %}
{% if listed %}
{% set email_class = ' no-email' if not (show_email and request.user.is_authenticated()) %}
<a class="share widget{{ ' condensed tooltip' if condensed }}{{ email_class }}"
<a class="share widget{{ ' condensed tooltip' if condensed }}"
data-share-counts="{{ counts|json }}"
data-base-url="{{ obj.share_url() }}?service="
title="{{ sharemsg }}"
Expand Down
39 changes: 0 additions & 39 deletions media/js/zamboni/collections.js
Expand Up @@ -747,8 +747,6 @@ $(document).ready(function () {
});

//New sharing interaction
var $email = $("#sharing-popup li.email");
var old_email_text = $("#sharing-popup .share-email-success p");
$("#sharing-popup").popup(".share.widget", {
width: 280,
offset: {x: 8},
Expand All @@ -759,43 +757,6 @@ $(document).ready(function () {
var base_url = el.attr('data-base-url');
var counts = $.parseJSON(el.attr("data-share-counts"));
$popup.hideMe();
$email.detach();
if (!el.hasClass("no-email")) {
$("#sharing-popup .share-networks ul").append($email);
$popup.delegate(".email a", "click", function(e) {
e.preventDefault();
$(".share-email", $popup).show();
$(".share-networks", $popup).hide();
});
$popup.delegate(".share-email a.close", "click", function(e) {
e.preventDefault();
$(".share-networks", $popup).show();
$(".share-email", $popup).hide();
$(".emailerror", $popup).hide();
});
$popup.delegate(".share-email form", "submit", function(e) {
e.preventDefault();
var form_data = $(this).serialize();
$(".emailerror", $popup).hide();
$(".share-email-success p", $popup).text(gettext('Sending Emails...'));
$(".share-email-success", $popup).show();
$.post(base_url + 'email', form_data, function(d) {
if (d.success) {
$(".share-email-success p", $popup).text(old_email_text);
setTimeout(function() {
$(".share-networks", $popup).show();
$(".share-email", $popup).hide();
$(".share-email-success", $popup).hide();
$popup.hideMe();
}, 800);
} else {
$(".share-email-success", $popup).hide();
$(".emailerror", $popup).text(d.error || gettext('Oh no! Please try again later.'));
$(".emailerror", $popup).show();
}
}, 'json');
});
}
if (counts) {
for (s in counts) {
if (!counts.hasOwnProperty(s)) continue;
Expand Down

0 comments on commit c54ac06

Please sign in to comment.