Skip to content

Commit a866b08

Browse files
Merge pull request #124 from CfABrigadePhiladelphia/development
Release: laddr v2.1.0
2 parents 87af449 + e95584b commit a866b08

File tree

11 files changed

+160
-18
lines changed

11 files changed

+160
-18
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ Laddr -- pronounced "ladder" and named after the essential tool for fire brigade
3737
- [Creative Commons Korea](http://labs.cckorea.org/)
3838
- [Code for Cary](http://www.codeforcary.org/)
3939
- [Code for Charlotte](http://codeforcharlotte.org)
40+
- [Code for Durham](http://codefordurham.com/)
41+
- [Code for Raleigh](http://www.codeforraleigh.com/)
4042

4143
## Requirements
4244
Laddr is built on the Emergence PHP framework and deployement engine, and requires an Emergence server to host it.

html-templates/projects/project.tpl

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@
116116
<a class="btn btn-success" role="button" href="{$Project->DevelopersUrl|escape}"><span class="glyphicon glyphicon-link" style="margin-right:7px;"></span>Developers</a>
117117
</div>
118118
</aside>
119+
119120
<!-- MEMBERS BLOCK -->
120121
<aside class="col-md-4">
121122
{if $Project->Memberships}
@@ -141,6 +142,34 @@
141142
<li><a class="btn btn-success add-person" href="#add-member" data-toggle="modal">+ {_ "Add"}</a></li>
142143
</ul>
143144
{/if}
145+
<hr>
146+
<!-- TAGS BLOCK -->
147+
{if $Project->TechTags}
148+
{_ "Tech"}:
149+
<ul>
150+
{foreach item=Tag from=$Project->TechTags}
151+
<li>{contextLink $Tag}</li>
152+
{/foreach}
153+
</ul>
154+
{/if}
155+
156+
{if $Project->TopicTags}
157+
{_ "Topics"}:
158+
<ul>
159+
{foreach item=Tag from=$Project->TopicTags}
160+
<li>{contextLink $Tag}</li>
161+
{/foreach}
162+
</ul>
163+
{/if}
164+
165+
{if $Project->EventTags}
166+
{_ "Events"}:
167+
<ul>
168+
{foreach item=Tag from=$Project->EventTags}
169+
<li>{contextLink $Tag}</li>
170+
{/foreach}
171+
</ul>
172+
{/if}
144173

145174
<hr>
146175

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{extends designs/site.tpl}
2+
3+
{block title}Project Deleted &mdash; {$dwoo.parent}{/block}
4+
5+
{block content}
6+
<p>Project {$data->Title|escape} deleted.</p>
7+
{/block}

html-templates/projects/projects.tpl

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,25 @@
2323

2424
<div class="well">
2525
{if $Project->README}
26-
<div class="markdown readme">{$Project->README|escape|markdown}</div>
26+
<div class="markdown readme">{$Project->README|truncate:600|escape|markdown}</div>
2727
{/if}
2828
</div>
2929
</div>
3030

31-
{if $Project->Memberships}
3231
<div class="col-sm-4">
3332
<h4>Project Info</h4>
33+
3434

3535
<div class="btn-group btn-group-justified" role="group">
3636
{if $Project->UsersUrl}<a class="btn btn-primary" role="button" href="{$Project->UsersUrl|escape}">{glyph "link"}&nbsp;Public Site</a>{/if}
3737
{if $Project->DevelopersUrl}<a class="btn btn-success" role="button" href="{$Project->DevelopersUrl|escape}">{glyph "link"}Developers</a>{/if}
3838
</div>
39-
39+
40+
{if $Project->Stage}
41+
Stage: <span class="label label-info">{_ "$Project->Stage"}</span>
42+
{/if}
43+
44+
{if $Project->Memberships}
4045

4146
<h4>{_ "Members"}</h4>
4247

@@ -57,8 +62,8 @@
5762
<li class="muted">{_ "None registered"}</li>
5863
{/foreach}
5964
</ul>
65+
{/if}
6066
</div>
61-
{/if}
6267
</div> <!-- .row-fluid -->
6368
<hr>
6469
{foreachelse}

html-templates/register/register.tpl

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22

33
{block "title"}Register &mdash; {$dwoo.parent}{/block}
44

5+
{block js-top}
6+
{$dwoo.parent}
7+
8+
{if RemoteSystems\ReCaptcha::$siteKey}
9+
<script src='https://www.google.com/recaptcha/api.js'></script>
10+
{/if}
11+
{/block}
12+
513
{block "content"}
614
{$User = $data}
715
<form method="POST" id="register">
@@ -49,7 +57,11 @@
4957
<label for="PasswordConfirm">{_ "Password Confirmation"}</label>
5058
<input type="password" class="form-control" id="PasswordConfirm" name="PasswordConfirm" value="{refill field=PasswordConfirm}">
5159
</div>
52-
60+
61+
{if RemoteSystems\ReCaptcha::$siteKey}
62+
<div class="form-group g-recaptcha" data-sitekey="{RemoteSystems\ReCaptcha::$siteKey|escape}"></div>
63+
{/if}
64+
5365
<div class="form-group">
5466
<button type="submit" class="btn btn-primary">{_ "Create Account"}</button>
5567
<p class="help-block">{_ "Already have an account?"} <a href="/login{tif $.request.return ? cat('?return=', escape($.request.return, url))}">{_ "Log in"}</a></p>

php-classes/Laddr/Project.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,36 @@ class Project extends \VersionedRecord
9696
'linkClass' => \TagItem::class,
9797
'linkLocal' => 'ContextID',
9898
'conditions' => ['Link.ContextClass = "Laddr\\\\Project"']
99+
],
100+
'TopicTags' => [
101+
'type' => 'many-many',
102+
'class' => \Tag::class,
103+
'linkClass' => \TagItem::class,
104+
'linkLocal' => 'ContextID',
105+
'conditions' => [
106+
'Link.ContextClass = "Laddr\\\\Project"',
107+
'Related.Handle LIKE "topic.%"'
108+
]
109+
],
110+
'TechTags' => [
111+
'type' => 'many-many',
112+
'class' => \Tag::class,
113+
'linkClass' => \TagItem::class,
114+
'linkLocal' => 'ContextID',
115+
'conditions' => [
116+
'Link.ContextClass = "Laddr\\\\Project"',
117+
'Related.Handle LIKE "tech.%"'
118+
]
119+
],
120+
'EventTags' => [
121+
'type' => 'many-many',
122+
'class' => \Tag::class,
123+
'linkClass' => \TagItem::class,
124+
'linkLocal' => 'ContextID',
125+
'conditions' => [
126+
'Link.ContextClass = "Laddr\\\\Project"',
127+
'Related.Handle LIKE "event.%"'
128+
]
99129
]
100130
];
101131

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
namespace RemoteSystems;
4+
5+
class ReCaptcha
6+
{
7+
public static $siteKey;
8+
public static $secretKey;
9+
10+
protected static $instance;
11+
12+
public static function setInstance(\ReCaptcha\ReCaptcha $instance)
13+
{
14+
static::$instance = $instance;
15+
}
16+
17+
public static function getInstance()
18+
{
19+
if (!static::$instance && static::$secretKey) {
20+
static::$instance = new \ReCaptcha\ReCaptcha(static::$secretKey);
21+
}
22+
23+
return static::$instance;
24+
}
25+
}

php-config/Emergence/People/RegistrationRequestHandler.config.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,14 @@
1919
# 'replace_interests' => false,
2020
# 'send_welcome' => false
2121
# ]);
22-
#};
22+
#};
23+
24+
RegistrationRequestHandler::$applyRegistrationData = function(User $User, array $requestData, array &$additionalErrors) {
25+
if ($recaptcha = \RemoteSystems\ReCaptcha::getInstance()) {
26+
$recaptchaResponse = $recaptcha->verify($requestData['g-recaptcha-response'], $_SERVER['REMOTE_ADDR']);
27+
28+
if (!$recaptchaResponse->isSuccess()) {
29+
$additionalErrors['ReCaptcha'] = 'Please prove that you aren\'t a spam robot by completing the reCAPTCHA';
30+
}
31+
}
32+
};

php-config/Git.config.php

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,29 @@
11
<?php
22

33
Git::$repositories['laddr'] = [
4-
'remote' => 'https://github.com/CfABrigadePhiladelphia/laddr.git'
5-
,'originBranch' => 'releases/v2'
6-
,'workingBranch' => 'releases/v2'
7-
,'localOnly' => true
8-
,'trees' => [
4+
'remote' => 'https://github.com/CfABrigadePhiladelphia/laddr.git',
5+
'originBranch' => 'releases/v2',
6+
'workingBranch' => 'releases/v2',
7+
'localOnly' => true,
8+
'trees' => [
99
'html-templates',
1010
'locales',
11-
'php-classes',
11+
'php-classes' => [
12+
'exclude' => '#^/ReCaptcha/#' // exclude ReCaptcha library pulled from google repo
13+
],
1214
'php-config' => [
1315
'exclude' => '#^/Git\\.config\\.php$#' // don't sync this file
1416
],
1517
'php-migrations',
1618
'site-root'
1719
]
18-
];
20+
];
21+
22+
Git::$repositories['ReCaptcha'] = [
23+
'remote' => 'https://github.com/google/recaptcha.git',
24+
'originBranch' => 'master',
25+
'workingBranch' => 'master',
26+
'trees' => [
27+
'php-classes/ReCaptcha' => 'src/ReCaptcha'
28+
]
29+
];
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
3+
/**
4+
* Obtain site and secret keys from Google by registering
5+
* at https://www.google.com/recaptcha/admin
6+
*/
7+
8+
//RemoteSystems\ReCaptcha::$siteKey = 'YOUR_SITE_KEY';
9+
//RemoteSystems\ReCaptcha::$secretKey = 'YOUR_SECRET_KEY';

0 commit comments

Comments
 (0)