further refactoring for multiple views

This commit is contained in:
Adam Lofting 2014-05-21 15:18:00 +01:00
Родитель 492bf6f2d1
Коммит fff65999db
6 изменённых файлов: 56 добавлений и 8 удалений

Просмотреть файл

@ -124,7 +124,7 @@ $("#contributionForm").validate({
valueNotEquals: "Which team is this for?"
},
"databucket": {
valueNotEquals: "Please select a bucket"
valueNotEquals: "What type of contribution was this?"
}
}
});

Просмотреть файл

@ -20,12 +20,12 @@
</div>
<div class="col-sm-8">
<h3>Who</h3>
<p class="small">Email addresses: seperated by a comma, semicolon, or new lines <span class="glyphicon glyphicon-question-sign tooltipActive" data-toggle="tooltip" data-placement="top" title="Just emails, no names. This alows us to de-dupe people."></span></p>
<p class="small">Email addresses: seperated by a comma, semicolon, or new lines <span class="glyphicon glyphicon-question-sign tooltipActive" data-toggle="tooltip" data-placement="top" title="Just emails, no names. This is the minimum data needed to de-dupe people."></span></p>
<textarea class="form-control" rows="12" name="contributors" required></textarea>
<p class="small terms"><br/><em>This tool will not email these contributors, and logging an address here does not give Mozilla permission to email these contributors. It is expected that as the person logging this contribution, you (or your team) have a direct relationship with the contributors.</em></p>
<br/>
<h5>Contribution Evidence (optional)</h5>
<input type="text" name="evidence" placeholder="http://example.com" class="form-control"><br />
{{> logging/clarify}}
<br />
{{> logging/evidence}}
<br />
<button type="submit" class="btn btn-primary btn-lg">Log this <span class="glyphicon glyphicon-ok-sign"></span></button>
<button class="btn btn-default btn-xs pull-right" id="btnQuicklink">Get pre-fill quick link <span class="glyphicon glyphicon-link"></span></button>
</div>

37
views/log-many.handlebars Normal file
Просмотреть файл

@ -0,0 +1,37 @@
<div class="row">
<div class="col-sm-10">
<h2>Contributions from multiple events</h2>
<p class="terms">Use this form to bulk load historic records of contributions across multiple events.</p>
</div>
</div>
<div class="row">
<form id="contributionForm" method="post" action="/log-em">
<input type="hidden" name="_csrf" value="{{{token}}}">
<div class="col-sm-4">
<h3>What</h3>
{{> logging/select-teams}}
{{> logging/select-type}}
</div>
<div class="col-sm-8">
<h3>Who, When, Description</h3>
<p class="small">One contribution per line<br/>
No quote marks<br/>
Comma seperated<br/>
Date must be formatted yyyy-mm-dd<br/>
email@address.com, yyyy-mm-dd, short description of the contribution activity<br />
</p>
<textarea class="form-control" rows="12" name="contributors" required></textarea>
{{> logging/clarify}}
<br />
{{> logging/evidence}}
<br />
<button type="submit" class="btn btn-primary btn-lg">Log these <span class="glyphicon glyphicon-ok-sign"></span></button>
</div>
</form>
</div>
{{> logging/recent}}
{{> logging/help}}
{{> logging/hidden}}

Просмотреть файл

@ -0,0 +1 @@
<p class="small terms"><br/><em>This tool will not email these contributors, and logging an address here does not give Mozilla permission to email these contributors. It is expected that as the person logging this contribution, you (or your team) have a direct relationship with the contributors.</em></p>

Просмотреть файл

@ -0,0 +1,2 @@
<h5>Contribution Evidence (optional)</h5>
<input type="text" name="evidence" placeholder="http://example.com" class="form-control">

12
web.js
Просмотреть файл

@ -111,7 +111,7 @@ app.get('/', function (req, res) {
}
});
app.get('/log-em', restrict, function (req, res) {
function renderLoggingPage(req, res, viewName) {
var email = req.session.email;
var username = email.replace("@mozillafoundation.org", "");
var templateValues = {
@ -137,8 +137,16 @@ app.get('/log-em', restrict, function (req, res) {
data.recentlyLogged(email, function gotRecentlyLogged(err, results) {
var recent = util.cleanRecentForPresentation(results);
templateValues.recentlyLogged = recent;
res.render('log-em', templateValues);
res.render(viewName, templateValues);
});
}
app.get('/log-em', restrict, function (req, res) {
renderLoggingPage(req, res, 'log-em');
});
app.get('/log-many', restrict, function (req, res) {
renderLoggingPage(req, res, 'log-many');
});
app.post('/log-em', restrict, function (req, res) {