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 #3707 from gratipay/fold-explore-down
Browse files Browse the repository at this point in the history
fold explore down
  • Loading branch information
chadwhitacre committed Aug 22, 2015
2 parents 8f84a80 + c81a15d commit ed5b69a
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 244 deletions.
106 changes: 0 additions & 106 deletions scss/pages/homepage.scss
Original file line number Diff line number Diff line change
@@ -1,108 +1,2 @@
#homepage {
h1 {
font: bold 30px/40px $Ideal;
text-transform: none;
margin: 0;
padding: 0;
}

p {
font: normal 18px/24px $Ideal;
margin: 0;
padding: 0 0 24px 0;
&:last-child {
padding-bottom: 0;
}
}

#sidebar {
width: 480px;
padding: 256px 48px 128px 110px;
img {
width: 384px;
position: absolute;
top: 48px;
left: 48px;
}
a {
color: transparentize($gold, 0.2);
&:hover {
color: $gold;
}
}
span {
white-space: nowrap;
}
p {
color: transparentize($white, 0.3);
}
}

#content {
background: transparentize($white, 0.1);
padding: 256px 48px 128px;
color: transparentize($brown, 0.2);
h1 { color: $brown; }
a {
color: transparentize($green, 0.3);
&:hover {
color: $green;
}
}

form {
display: inline;
}

div.twitter {
margin-bottom: 48px;
button {
@include has-icon("twitter", 24px, 4px);
font-size: 24px;
padding: 10px 24px 10px 18px;
border-radius: 6px;
background: $green;
color: $white;
&:hover {
color: $gold;
border-color: $brown;
background: $brown;
}
}
}
.other {
padding-bottom: 24px;
font-size: 13px;
line-height: 18px;
max-width: 700px;
display: block;

.or {
font: normal 13px/16px $Ideal;
}

button {
border: 1px solid transparentize($brown, 0.2);
background: transparent;
color: transparentize($brown, 0.2);
&:hover {
color: $gold;
border-color: $brown;
background: $brown;
}
}
form.facebook button { @include has-icon("facebook", 13px); }
form.google button { @include has-icon("google", 13px); }
form.github button { @include has-icon("github", 13px); }
form.bitbucket button { @include has-icon("bitbucket", 13px); }
form.openstreetmap button { @include has-icon("openstreetmap", 13px); }
}
}

.sign-out {
float: right;
font-size: 14px;
line-height: 40px;
margin-top: -40px;
}
}
7 changes: 5 additions & 2 deletions templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,18 @@
<div id="header" class="clearfix">
<h1><a href="/"><img src="{{ website.asset('gratipay.svg') }}"
alt="Gratipay" /></a></h1>
{% set pages = [('/about/', _('About')), ('/explore/', _('Explore')), ('/search', _('Search'))] %}
{% set pages = [('/about/', _('About')), ('/search', _('Search'))] %}
{% set current_page = request.path.raw.split('/')[1] %}
{% include "templates/nav.html" %}
{% if user.ANON %}
{% include "templates/sign-in-using.html" %}
{% else %}
<ul class="nav you-are">
<li>
<a href="/"{% if request.path.raw == '/' or request.path.raw.split('/')[1] == user.participant.username %} class="selected"{% endif %}>
{% set parts = request.path.raw.split('/') %}
{% set on_profile = parts[1] == '~' %}
{% set on_own_profile = on_profile and parts[2] == user.participant.username %}
<a href="/~{{user.participant.username}}/"{% if on_own_profile %} class="selected"{% endif %}>
{{ user.participant.username }}
<div class="quick-stats">
<span class="my-total-giving">{{ format_currency(user.participant.get_giving_for_profile()[1], "USD") }}</span>/{{ _("wk") }}
Expand Down
12 changes: 5 additions & 7 deletions templates/profile-subnav.html
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
{% set current_page = '/' if request.path.raw == '/' else '/~' + request.path.raw[3:] %}
{% set show_members = participant.show_as_team(user) %}
{% set show_dashboard = (user.participant == participant) %}
{% set show_receiving = (user.participant == participant or not participant.anonymous_receiving) %}
{% set show_profile = show_members or show_receiving %}
{% set u = participant.username %}
{% set pages = [ ('/', _('Dashboard'), True, False)
, ('/~'+u+'/', _('Profile'), True, show_profile)
, ('/~'+u+'/giving/', _('Giving'), True, False)
, ('/~'+u+'/history/', _('History'), True, False)
, ('/~'+u+'/settings/', _('Settings'), True, False)
, ('/~'+u+'/events/', _('Events'), False, False)
{% set pages = [ ('/~'+u+'/', _('Profile'), True, show_profile)
, ('/~'+u+'/giving/', _('Giving'), True, False)
, ('/~'+u+'/history/', _('History'), True, False)
, ('/~'+u+'/settings/', _('Settings'), True, False)
, ('/~'+u+'/events/', _('Events'), False, False)
] %}
{% set pages = filter_profile_subnav(user, participant, pages) %}
{% if pages %}
Expand Down
2 changes: 1 addition & 1 deletion tests/js/test_authed_homepage.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe('authed homepage', function() {
browser
.url('http://localhost:8537')
.getText('#content h1', function(err, text) {
assert.equal(text, 'alice');
assert.equal(text, 'Teams (N=0)');
})
.deleteCookie('session')
.call(done);
Expand Down
12 changes: 6 additions & 6 deletions tests/py/test_teams.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,17 +125,17 @@ def test_error_message_for_slug_collision(self):
assert self.db.one("SELECT COUNT(*) FROM teams") == 1
assert "Sorry, there is already a team using 'gratiteam'." in r.body

def test_approved_team_shows_up_on_explore(self):
def test_approved_team_shows_up_on_homepage(self):
self.make_team(is_approved=True)
assert 'The Enterprise' in self.client.GET("/explore/").body
assert 'The Enterprise' in self.client.GET("/").body

def test_unreviewed_team_does_not_show_up_on_explore(self):
def test_unreviewed_team_does_not_show_up_on_homepage(self):
self.make_team(is_approved=None)
assert 'The Enterprise' not in self.client.GET("/explore/").body
assert 'The Enterprise' not in self.client.GET("/").body

def test_rejected_team_does_not_show_up_on_explore(self):
def test_rejected_team_does_not_show_up_on_homepage(self):
self.make_team(is_approved=False)
assert 'The Enterprise' not in self.client.GET("/explore/").body
assert 'The Enterprise' not in self.client.GET("/").body

def test_stripping_required_inputs(self):
self.make_participant('alice', claimed_time='now', email_address='[email protected]', last_paypal_result='')
Expand Down
33 changes: 1 addition & 32 deletions www/explore/index.html.spt
Original file line number Diff line number Diff line change
@@ -1,34 +1,3 @@
[-----------------------------]

teams = website.db.all("""

SELECT teams.*::teams
FROM teams
ORDER BY ctime DESC

""")
nteams = len(teams)
title = _("Explore Teams (N={0})", nteams)
subhead = _("Teams")

website.redirect('/')
[-----------------------------] text/html
{% extends "templates/base.html" %}
{% block content %}
<table class="table">
<tr>
<th>{{ _("Name") }}</th>
<th>{{ _("Owner") }}</th>
{% if user.ADMIN %}<th>{{ _("Status") }}</th>{% endif %}
</tr>
{% for team in teams %}
{% if team.is_approved or user.ADMIN %}
<tr>
<td><a href="/{{ team.slug }}/">{{ team.name }}</a></td>
<td><a href="/{{ team.owner }}/">{{ team.owner }}</a></td>
{% if user.ADMIN %}<td>{{ team.status }}</td>{% endif %}
</tr>
{% endif %}
{% endfor %}
</table>
{% endblock %}

114 changes: 24 additions & 90 deletions www/index.html.spt
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
[---]

if user.ANON:
website.redirect('/about/')
teams = website.db.all("""

if not user.ANON:
participant = user.participant
title = participant.username
giving = participant.get_giving_for_profile()[1]
SELECT teams.*::teams
FROM teams
ORDER BY ctime DESC

""")
nteams = len(teams)
title = _("Teams (N={0})", nteams)

[---]
{% extends "templates/base.html" %}
Expand All @@ -18,96 +20,28 @@ if not user.ANON:
{% block head %}
<link rel="publisher" href="https://plus.google.com/104524895706770139568">
<link type="application/opensearchdescription+xml" rel="search" href="/opensearch.osdd" />
<meta name="description" content="Weekly payments, motivated by gratitude. Sustainably crowdfund your business, personal projects, or charity, with no extra fees." />
<meta name="description" content="Voluntary payments and payroll for open work" />
<meta name="fb:app_id" content="229465400522758" />
<meta name="og:type" content="website" />
<meta name="og:url" content="https://gratipay.com/" />
<meta name="og:title" content="Gratipay" />
<meta name="og:image" content="{{ website.asset('gratipay.opengraph.png') }}" />
{% if user.ANON %}
<style>
#header, #footer { display: none; }
#upgrade_browser .container { display: block; }
</style>
{% endif %}
{% endblock %}

{% block sidebar %}
{% if user.ANON %}
<img src="{{ website.asset('gratipay.white.svg') }}" alt="Gratipay">
<h1>{{ _("Weekly Payments") }}</h1>
<p>{{ _("Motivated by Gratitude") }}</p>

<p>{{ _("Sustainably crowdfund your business, personal projects, or charity, with {0}no extra fees{1}.",
"<span>"|safe, "</span>"|safe) }}</p>

<p><a href="/about/">{{ _("Learn more") }}</a></p>
{% else %}
{% include "templates/profile-sidebar.html" %}
{% endif %}
{% endblock %}

{% block heading %}{{ super() if not user.ANON }}{% endblock %}
{% block subnav %}
{% if not user.ANON %}{% include "templates/profile-subnav.html" %}{% endif %}
{% endblock %}

{% block content %}
{% if user.ANON %}

{{ _("{0}Sign In{1} {2}to Accept Weekly Payments{3}",
"<h1>"|safe, "</h1>"|safe, "<p>"|safe, "</p>"|safe) }}
{% from 'templates/auth.html' import auth_button with context %}

<div class="twitter">
{% call auth_button('twitter', 'opt-in') %}
{{ _("Sign in with {0}", "Twitter") }}
{% endcall %}
</div>

<div class="other">
<div class="or">{{ _("Or sign in with:") }}</div>
<span>
{% call auth_button('google', 'opt-in') %}Google{% endcall %}
{% call auth_button('facebook', 'opt-in') %}Facebook{% endcall %}
{% call auth_button('github', 'opt-in') %}GitHub{% endcall %}
{% call auth_button('bitbucket', 'opt-in') %}Bitbucket{% endcall %}
{% call auth_button('openstreetmap', 'opt-in') %}OpenStreetMap{% endcall %}
</span>
</div>

<p class="other">{{
_("By signing in, you indicate that you have read and agree to our {0}Terms of Service{1}.",
"<a href='/about/terms/'>"|safe, "</a>"|safe) + " " +
_("You'll be joining {0} active users, who exchanged {1} {2}last week{3}.",
format_number(website.gnactive),
format_currency(website.gtransfer_volume, "USD"),
"<a href='/about/stats'>"|safe, "</a>"|safe) + " " +
_("Want to see who they are? Browse {0}our communities{1}.",
"<a href='/for/'>"|safe, "</a>"|safe) + " " +
_("Want to work for Gratipay? We are an {0}open company{1}.",
"<a href='http://inside.gratipay.com/big-picture/welcome'>"|safe,
"</a>"|safe) }}</p>

{% else %}

<div class="col0">
<h2>{{ _("Giving") }}</h2>

<p><a href="/{{ participant.username }}/giving/">{{
_("You give {0} per week.", format_currency(giving, 'USD'))
}}</a></p>

<p>{{ _("Who inspires you? See if they're on Gratipay:") }}</p>
{% include "templates/search-box.html" %}

<p>{{ _("Find your friends from social networks:") }}<br>
{% for p in website.friends_platforms %}
<a href="/on/{{ p.name }}/">{{ p.display_name }}</a
>{{ ',' if not loop.last }}
{% endfor %}
</p>
</div>

<table class="table">
<tr>
<th>{{ _("Name") }}</th>
<th>{{ _("Owner") }}</th>
{% if user.ADMIN %}<th>{{ _("Status") }}</th>{% endif %}
</tr>
{% for team in teams %}
{% if team.is_approved or user.ADMIN %}
<tr>
<td><a href="/{{ team.slug }}/">{{ team.name }}</a></td>
<td><a href="/{{ team.owner }}/">{{ team.owner }}</a></td>
{% if user.ADMIN %}<td>{{ team.status }}</td>{% endif %}
</tr>
{% endif %}
{% endfor %}
</table>
{% endblock %}

0 comments on commit ed5b69a

Please sign in to comment.