Skip to content
This repository has been archived by the owner on Feb 8, 2018. It is now read-only.

Commit

Permalink
Merge pull request #3718 from gratipay/paint-the-walls
Browse files Browse the repository at this point in the history
paint the walls
  • Loading branch information
chadwhitacre committed Aug 28, 2015
2 parents 3a0d37b + 6804d4a commit 54d7d32
Show file tree
Hide file tree
Showing 85 changed files with 1,526 additions and 1,613 deletions.
4 changes: 2 additions & 2 deletions emails/charge_failed.spt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<pre>{{ exchange.note }}</pre>

<a href="{{ participant.profile_url+'routes/credit-card.html' }}"
<a href="{{ participant.profile_url+'routes/credit-card' }}"
style="{{ button_style }}">{{ _("Fix Credit Card") }}</a>

[---] text/plain
Expand All @@ -25,4 +25,4 @@

{{ exchange.note }}

{{ _("Follow this link to fix your credit card:") }} {{ participant.profile_url+'routes/credit-card.html' }}
{{ _("Follow this link to fix your credit card:") }} {{ participant.profile_url+'routes/credit-card' }}
2 changes: 2 additions & 0 deletions error.spt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ from gratipay.utils.i18n import HTTP_ERRORS

[----------------------------------------]

banner = _("Eep!")
code = response.code
msg = _(HTTP_ERRORS.get(code, status_strings.get(code, '')))
try:
Expand All @@ -20,6 +21,7 @@ err = response.body
if code == 500 and not err:
err = _("Looks like you've found a bug! Sorry for the inconvenience, we'll get it fixed ASAP!")

suppress_sidebar = True
[----------------------------------------] text/html
{% extends "templates/base.html" %}
{% set title = code %}
Expand Down
2 changes: 1 addition & 1 deletion gratipay/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
'b64encode': base64.b64encode,
'enumerate': enumerate,
'filter': filter,
'filter_profile_subnav': utils.filter_profile_subnav,
'filter_profile_nav': utils.filter_profile_nav,
'float': float,
'len': len,
'map': map,
Expand Down
2 changes: 1 addition & 1 deletion gratipay/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ def erase_cookie(cookies, key, **kw):
set_cookie(cookies, key, '', BEGINNING_OF_EPOCH, **kw)


def filter_profile_subnav(user, participant, pages):
def filter_profile_nav(user, participant, pages):
out = []
for foo, bar, show_them, show_others in pages:
if (user.participant == participant and show_them) \
Expand Down
8 changes: 4 additions & 4 deletions gratipay/utils/notifications.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
def paypal_withdrawal_failed(_, user):
href = '/~%s/routes/paypal.html' % user.participant.username
href = '/~%s/routes/paypal' % user.participant.username
return ('error',
['a',
{'href': href}, _("Your last PayPal payout failed!"),
Expand All @@ -8,7 +8,7 @@ def paypal_withdrawal_failed(_, user):


def credit_card_failed(_, user):
href = '/~%s/routes/credit-card.html' % user.participant.username
href = '/~%s/routes/credit-card' % user.participant.username
return ('error',
['span', _("Your credit card has failed!") + " ",
['a', {'href': href}, _("Fix your card")]
Expand All @@ -17,7 +17,7 @@ def credit_card_failed(_, user):


def credit_card_expires(_, user):
href = '/~%s/routes/credit-card.html' % user.participant.username
href = '/~%s/routes/credit-card' % user.participant.username
return ('error',
['span', _("Your credit card is about to expire!") + " ",
['a', {'href': href}, _("Update card")]
Expand All @@ -26,7 +26,7 @@ def credit_card_expires(_, user):


def email_missing(_, user):
href = '/~%s/settings/#emails' % user.participant.username
href = '/~%s/emails/' % user.participant.username
return ('notice',
['span', _('Your account does not have an associated email address.') + " ",
['a', {'href': href}, _('Add an email address')],
Expand Down
Binary file modified img-src/success.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions js/gratipay.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Gratipay.getCookie = function(key) {

Gratipay.init = function() {
Gratipay.warnOffUsersFromDeveloperConsole();
Gratipay.adaptToLongUsernames();
Gratipay.forms.initCSRF();
Gratipay.signIn();
Gratipay.signOut();
Expand All @@ -27,6 +28,16 @@ Gratipay.warnOffUsersFromDeveloperConsole = function() {
console.log("%cPlease close this window now.", "color: blue;");
};

Gratipay.adaptToLongUsernames = function() {
var h1 = $('#banner h1');
var nchars = h1.text().length;
if (nchars > 16)
h1.addClass('really-long');
else if (nchars > 8)
h1.addClass('long');
h1.show();
};

Gratipay.error = function(jqXHR, textStatus, errorThrown) {
var msg = null;
try {
Expand Down
73 changes: 73 additions & 0 deletions js/gratipay/emails.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
Gratipay.emails = {};

Gratipay.emails.post = function(e) {
e.preventDefault();
var $this = $(this);
var action = this.className;
var $inputs = $('.emails button, .emails input');
console.log($this);
var address = $this.parent().data('email') || $('input.add-email').val();

$inputs.prop('disabled', true);

$.ajax({
url: 'modify.json',
type: 'POST',
data: {action: action, address: address},
dataType: 'json',
success: function (msg) {
if (msg) {
Gratipay.notification(msg, 'success');
}
if (action == 'add-email') {
$('input.add-email').val('');
setTimeout(function(){ window.location.reload(); }, 3000);
return;
} else if (action == 'set-primary') {
$('.emails li').removeClass('primary');
$this.parent().addClass('primary');
} else if (action == 'remove') {
$this.parent().fadeOut();
}
$inputs.prop('disabled', false);
},
error: [
function () { $inputs.prop('disabled', false); },
Gratipay.error
],
});
};


Gratipay.emails.init = function () {

// Wire up email addresses list.
// =============================

$('.emails button, .emails input').prop('disabled', false);
$('.emails button[class]').on('click', Gratipay.emails.post);
$('form.add-email').on('submit', Gratipay.emails.post);


// Wire up notification preferences
// ================================

$('.email-notifications input').click(function(e) {
var field = $(e.target).data('field');
var bits = $(e.target).data('bits') || 1;
jQuery.ajax(
{ url: '../emails/notifications.json'
, type: 'POST'
, data: {toggle: field, bits: bits}
, dataType: 'json'
, success: function(data) {
Gratipay.notification(data.msg, 'success');
$(e.target).attr('checked', data.new_value & bits)
}
, error: [
Gratipay.error,
function(){ $(e.target).attr('checked', !$(e.target).attr('checked')) },
]
});
});
};
6 changes: 3 additions & 3 deletions js/gratipay/jump.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
$(document).ready(function() {
$('#jump').submit(function (e) {
$('.jump-box').submit(function (e) {
e.preventDefault();
e.stopPropagation();

var platform = Gratipay.trim($('#jump select').val()),
val = Gratipay.trim($('#jump input').val());
var platform = Gratipay.trim($('.jump-box select').val()),
val = Gratipay.trim($('.jump-box input').val());
if (val) window.location = '/on/' + platform + '/' + val + '/';
});
});
8 changes: 6 additions & 2 deletions js/gratipay/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ Gratipay.routes.lazyLoad = function(script_url) {
}).fail(Gratipay.error);
}

Gratipay.routes.redirectToOverview = function() {
window.location = './';
};

Gratipay.routes.deleteRoute = function(e) {
e.stopPropagation();
e.preventDefault();
Expand All @@ -35,7 +39,7 @@ Gratipay.routes.deleteRoute = function(e) {
{ url: "/~" + Gratipay.username + "/routes/delete.json"
, data: {network: $this.data('network'), address: $this.data('address')}
, type: "POST"
, success: function() { window.location.reload(); }
, success: Gratipay.routes.redirectToOverview
, error: Gratipay.error
}
);
Expand All @@ -44,7 +48,7 @@ Gratipay.routes.deleteRoute = function(e) {

Gratipay.routes.onSuccess = function(data) {
$('button#save').prop('disabled', false);
window.location.reload();
Gratipay.routes.redirectToOverview();
};

Gratipay.routes.associate = function (network, address) {
Expand Down
68 changes: 0 additions & 68 deletions js/gratipay/settings.js
Original file line number Diff line number Diff line change
@@ -1,43 +1,5 @@
Gratipay.settings = {};

Gratipay.settings.post_email = function(e) {
e.preventDefault();
var $this = $(this);
var action = this.className;
var $inputs = $('.emails button, .emails input');
console.log($this);
var address = $this.parent().data('email') || $('input.add-email').val();

$inputs.prop('disabled', true);

$.ajax({
url: '../emails/modify.json',
type: 'POST',
data: {action: action, address: address},
dataType: 'json',
success: function (msg) {
if (msg) {
Gratipay.notification(msg, 'success');
}
if (action == 'add-email') {
$('input.add-email').val('');
setTimeout(function(){ window.location.reload(); }, 3000);
return;
} else if (action == 'set-primary') {
$('.emails li').removeClass('primary');
$this.parent().addClass('primary');
} else if (action == 'remove') {
$this.parent().fadeOut();
}
$inputs.prop('disabled', false);
},
error: [
function () { $inputs.prop('disabled', false); },
Gratipay.error
],
});
};

Gratipay.settings.init = function() {

// Wire up username knob.
Expand Down Expand Up @@ -111,28 +73,6 @@ Gratipay.settings.init = function() {
});
});

// Wire up notification preferences
// ================================

$('.email-notifications input').click(function(e) {
var field = $(e.target).data('field');
var bits = $(e.target).data('bits') || 1;
jQuery.ajax(
{ url: '../emails/notifications.json'
, type: 'POST'
, data: {toggle: field, bits: bits}
, dataType: 'json'
, success: function(data) {
Gratipay.notification(data.msg, 'success');
$(e.target).attr('checked', data.new_value & bits)
}
, error: [
Gratipay.error,
function(){ $(e.target).attr('checked', !$(e.target).attr('checked')) },
]
});
});

// Wire up API Key
// ===============

Expand Down Expand Up @@ -162,14 +102,6 @@ Gratipay.settings.init = function() {
});


// Wire up email addresses list.
// =============================

$('.emails button, .emails input').prop('disabled', false);
$('.emails button[class]').on('click', Gratipay.settings.post_email);
$('form.add-email').on('submit', Gratipay.settings.post_email);


// Wire up close knob.
// ===================

Expand Down
Loading

0 comments on commit 54d7d32

Please sign in to comment.