Skip to content

Commit

Permalink
Merge pull request #21 from berkmancenter/dev
Browse files Browse the repository at this point in the history
Merge branch 'dev' for v0.4 release
  • Loading branch information
jsdiaz committed Dec 18, 2015
2 parents 26302f2 + ee98090 commit 9d41f8f
Show file tree
Hide file tree
Showing 25 changed files with 318 additions and 207 deletions.
1 change: 1 addition & 0 deletions .meteor/packages
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ linto:jquery-ui
steeve:reactive-cookie
email
meteorhacks:fast-render
todda00:friendly-slugs
3 changes: 1 addition & 2 deletions client/styles/global.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ body {

* {
text-indent:0px!important;
font-weight:normal!important;
}

a {
Expand Down Expand Up @@ -156,7 +155,7 @@ div #wrapper {
bottom: 0;
right:0;
left:0;
opacity:.6;
opacity:.9;
overflow:hidden;
z-index:999999999999999;
cursor:pointer;
Expand Down
16 changes: 12 additions & 4 deletions client/views/add/add.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
Template.add.onCreated(function () {
// Checks whether the user has a valid table cookie
Meteor.call('listCookieCheck', Session.get("tablename"), function (error, result) {
Meteor.call('listCookieCheck', Session.get("id"), function (error, result) {
if(!result) {
// If not, return the user to the chooser page
window.location.href = "/";
} else {
Meteor.call('adminCheck', Session.get("tablename"), function (error, result) {
Meteor.call('adminCheck', Session.get("id"), function (error, result) {
if(!result) {
// If not, return the user to the chooser page
window.location.href = "/";
Expand Down Expand Up @@ -66,7 +66,7 @@ Template.add.events({
},
"click .removebutton": function(event, template) {
var mod = event.currentTarget.previousElementSibling.value;
Meteor.call('removeMods', mod, Session.get("tablename"));
Meteor.call('removeMods', mod, Session.get("id"));
},
// When the submit button is clicked...
"click #modsdonebutton": function(event, template) {
Expand All @@ -78,7 +78,15 @@ Template.add.events({
mods.push(modsInput[m].value);
}
}
Meteor.call('addMods', mods, Session.get("tablename"), function(error, result) {
Meteor.call('addMods', mods, Session.get("id"), function(error, result) {
console.log(Meteor.user().emails[0].address);
for(var m = 0; m < mods.length; m++) {
Meteor.call('sendEmail',
mods[m],
Meteor.user().emails[0].address,
'You have been added as a moderator on Question Tool',
Meteor.user().profile.name + ' added you as a moderator on Question Tool. You are able to modify, combine, and hide questions. You must use this email address when registering to be considered a moderator.');
}
// If the result is an object, there was an error
if(typeof result === 'object') {
// Alert the error
Expand Down
4 changes: 2 additions & 2 deletions client/views/combine/combine.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Template.combine.onCreated(function () {
window.location.href = "/";
} else {
// Checks whether the current user has admin privileges
Meteor.call('adminCheck', Session.get("tablename"), function (error, result) {
Meteor.call('adminCheck', Session.get("id"), function (error, result) {
if(!result) {
// If not, redirects back to the list page
window.location.href = "/list";
Expand Down Expand Up @@ -44,7 +44,7 @@ Template.combine.events({
// Calls the combine function on the server to update the DBs
var id2 = Template.instance().data.second;
var id1 = Template.instance().data.first;
Meteor.call('combine', question, id1, id2, Session.get("tablename"), function (error, result) {
Meteor.call('combine', question, id1, id2, Session.get("id"), function (error, result) {
// If successful
if(!error) {
// Hides the second question (combined -> first)
Expand Down
21 changes: 16 additions & 5 deletions client/views/create/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,13 @@ Template.create.events({
if(!Meteor.user()) {
return false;
}
//document.getElementById("buttonarea").disabled = true;
var anonElement = document.getElementById("allowanoncheck");
var anonymous;
if(anonElement.style.display) {
var anonymous = (anonElement.style.display != "none");
anonymous = (anonElement.style.display != "none");
} else {
var anonymous = false;
anonymous = false;
}
// Retrieve data from the form
var tablename = document.getElementById("instancenameinput").value;
Expand Down Expand Up @@ -111,14 +113,13 @@ Template.create.events({
"description": "Please enter a valid description under 255 characters.",
"modlength": "You have entered too many moderators. Please try again."/*,
"password": "Please enter a valid password using letters, numbers, *, #, @, and between 4 and 10 characters."*/
}
};
// Alert the error
showCreateError(errorCodes[result[0].name]);
return false;
} else {
// Redirects to the newly-created table's list page
Blaze.remove(dropDownTemplate);
Router.go("/list/" + result);
}
});
},
Expand All @@ -140,4 +141,14 @@ Template.create.events({
last.previousSibling.focus();
}
}
});
});

function showCreateError(reason) {
if(typeof currentError != "undefined") {
Blaze.remove(currentError);
document.getElementById("buttonarea").disabled = false;
}
var parentNode = document.getElementById("creatediv");
var nextNode = document.getElementById("instancebottominputcontainer");
currentError = Blaze.renderWithData(Template.form_error, reason, parentNode, nextNode);
}
47 changes: 36 additions & 11 deletions client/views/credits/credits.css
Original file line number Diff line number Diff line change
@@ -1,17 +1,42 @@
#creditstext {
color:#777777;
font-family:regular;
text-align:center;
font-size:14px;
display:block;
margin:0px auto;
padding:0px;
line-height:1.5em;
width:80%;
margin-top:25px;
margin-bottom:35px;
color: #777777;
font-family: regular;
text-align: center;
font-size: 14px;
display: block;
margin: 0 auto;
padding: 0;
line-height: 1.5em;
width: 80%;
margin-top: 25px;
margin-bottom: 35px;
}

#creditstext a {
text-decoration:underline;
}

.creditsformcontainer {
position: fixed;
background-color:black;
top: 1%;
left: 30%;
width: 40%;
opacity:.9;
overflow:hidden;
z-index:999999999999999;
cursor:pointer;
}

@media screen and (max-width: 667px) {
.creditsformcontainer {
background-color:black;
top: 0;
left: 0;
width: 100%;
opacity:.9;
overflow:hidden;
z-index:999999999999999;
cursor:pointer;
}
}
55 changes: 16 additions & 39 deletions client/views/credits/credits.html
Original file line number Diff line number Diff line change
@@ -1,76 +1,53 @@
<template name="credits">
<div id="darker">
</div>
<div class="creditsformcontainer">
{{> close_button}}
<h1 class="formtitle">About Question Tool</h1>
<div id="creditstext">
<span class="boldcreditstext">Version:</span>
<br/>
1.6
0.4
<br/>
<br/>
Source:
<br/>
<a href="#" target="_blank">Github Repository</a>
<a href="https://github.com/berkmancenter/question_tool" target="_blank">Github Repository</a>
<br/>
<br/>
<span class="boldcreditstext">Thanks to:</span>
<br/>
Dan Collis-Puro - First Lead Developer
<a href="http://twitter.com/nickrubin" target="_blank">Nick Rubin</a> - JS version Developer
<br/>
Dan Cohen - PHP version Developer
<br/>
David Russcol - PHP version Developer
<br/>
Justin Clark - Second Lead Developer
Jonathan Zittrain - Father of the Question Tool
<br/>
Tomas Reimers - Developer
<a href="https://cyber.law.harvard.edu" target="_blank">The Berkman Center for Internet & Society</a> - Hosting, Funding and Support
<br/>
Brian 'Phunk' Gadoury - Developer
<a href="http://law.harvard.edu/about/administration/its/">HLS ITS</a> - Support
<br/>
<br/>
<span class="creditstitle">Bugs</span>
<br/>
Please report them to the <a href="#" target="_blank">github issue tracker</a>.
Please report them to the <a href="https://github.com/berkmancenter/question_tool/issues" target="_blank">github issue tracker</a>.
<br/>
<br/>
<span class="creditstitle">Administrative</span>
<span class="boldcreditstext">Copyright</span>
<br/>
© 2011 - 2015 President and Fellows of Harvard College
© 2015 President and Fellows of Harvard College
<br/>
<br/>
<span class="boldcreditstext">License</span>
<br/>
Question Tool is licensed under the...
<br/>
Question Tool is licensed under the <a href="http://www.gnu.org/licenses/gpl-3.0.en.html" target="_blank">GNU General Public License</a>.
<!--<br/>
<br/>
<span class="boldcreditstext">Terms of service</span>
<br/>
The Question Tool terms of service can be found on the...
The Question Tool terms of service needs to be written.
-->
</div>
</div>
</template>

<!--<template name="credits">
<body>
<div id="banner">
Question Tool Credits
</div>
<br />
<br />
<div id="wrapper">
<center>
<div class="center">
<br/>
<p>The question tool was conceived by Professor Jonathan Zittrain and first coded by David Russcol. This version, published in August of 2015, was coded by <a href="http://twitter.com/nickrubin" target="_blank">Nick Rubin</a>. Additional thanks and huge props to Team Nesson and the folks at the Berkman Center, and especially to Denise Grey and Ken Martin and everyone at Harvard Law School ITS.
<br />
</p>
<p>
This software is available under the GNU Public License.
<br />
<br />
<a href="/list">Return to the list</a>
</p>
</div>
</center>
</div>
</body>
</template>-->
8 changes: 7 additions & 1 deletion client/views/credits/credits.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
Template.credits.onRendered(function() {
// Sets the document title when the template is rendered
$(".formcontainer").hide().fadeIn(400);
$("#darker").hide().fadeIn(400);

});

Template.credits.events({
"click .closecontainer": function(event, template) {
Blaze.remove(popoverTemplate);
}
});
6 changes: 0 additions & 6 deletions client/views/footer/footer.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,5 @@ Template.footer.events({
"click #creditsbutton": function(event, template) {
var parentNode = document.getElementById("banner");
popoverTemplate = Blaze.render(Template.credits, parentNode);
},
"click #darker": function(event, template) {
$(".formcontainer").fadeOut(400);
$("#darker").fadeOut(400, function() {
Blaze.remove(popoverTemplate);
});
}
});
1 change: 0 additions & 1 deletion client/views/helpers/chunks/question_div/question_div.css
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,6 @@

.replybottom {
width:340px;
height:158px;
display:none;
margin:0px auto;
margin-top:55px;
Expand Down
17 changes: 13 additions & 4 deletions client/views/helpers/chunks/question_div/question_div.html
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,24 @@
{{#if currentUser}}
<input type="text" class="replyname" id="name{{_id}}" value="{{currentUser.profile.name}}" readonly>
<input type="text" class="replyemail" id="email{{_id}}" value="{{currentUser.emails.[0].address}}" readonly>
<div id="checkarea1">
<div class="checkarealeft">
<div class="checkbox" id="anonbox">
<div class="checked" id="anoncheck">
</div>
</div>
</div>
<div class="checkarearight">
<p class="checkboxlabel">Post as anonymous?</p>
</div>
</div>
{{else}}
<input type="text" class="replyname" id="name{{_id}}" value="{{responseName}}" placeholder="Name...">
<input type="text" class="replyemail" id="email{{_id}}" value="{{responseEmail}}" placeholder="Email...">
{{/if}}
</div>
<div class="replybottomcheck">
<div class="checkarealeft" style="{{#if anonymous}}{{else}}visibility:hidden!important{{/if}}">
<div class="checkarealeft" style="{{#if anonymous}}{{else}}display: none{{/if}}">
<div class="checkbox" id="replyanonbox" style="{{#if anonymous}}{{else}}visibility:hidden!important{{/if}}">
<div class="checked anonchecked" id="{{_id}}">
</div>
Expand All @@ -130,10 +141,8 @@
</div>
{{#if adminButtons}}
<div class="adminbottom">
<!--<a class="hideQuestion" id="{{_id}}">Hide</a>
<a href="{{modifylink}}">Modify</a>-->
<div class="adminquestionhide" id="{{_id}}">
Hide
{{#if isDisabled}}Unhide{{else}}Hide{{/if}}
</div>
<div class="adminquestionmodify" id="{{_id}}">
Modify
Expand Down
8 changes: 7 additions & 1 deletion client/views/helpers/chunks/question_div/question_div.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,10 @@ Template.question_div.helpers({
return 150;
}
},
})
isDisabled: function() {
if(Questions.findOne({ _id: this._id}).state === "disabled") {
return true;
}
return false;
}
});
Loading

0 comments on commit 9d41f8f

Please sign in to comment.