Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

working spanish crc prototype #31

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
8796a3f
working spanish crc prototype
amitvakula Jul 21, 2014
aa86e50
Changed proofread.html, views.py, and forms.py to allow for English a…
angelaslin Aug 7, 2014
5b7a9f8
Added changes to save comments properly as either Spanish comments or…
angelaslin Aug 14, 2014
ea6df49
updated comments to top 70 and resolved issues with cafe button not w…
amitvakula Aug 22, 2014
74b03c0
buggy version for Sanjay to debug
amitvakula Aug 22, 2014
d835a69
fixed go-back id to work for spanish, updated translations, repositio…
amitvakula Aug 28, 2014
f418443
realligned Proximo button and added multilingual support to email req…
amitvakula Aug 28, 2014
4627218
added multi-lingual support for help pages. Made minor fixes listed i…
amitvakula Aug 29, 2014
66c2686
updated logout page, translated email errors, fixed toggling and posi…
amitvakula Aug 31, 2014
af5ac26
added spanish translation for email page Su dirección de correo elect…
amitvakula Aug 31, 2014
31d9d0c
fixed skip button so it doesn't reappear after selecting a value in s…
amitvakula Sep 1, 2014
9244c68
minor change from last commit
amitvakula Sep 1, 2014
d7b836b
added about the CRC help page information on the landing page
amitvakula Sep 2, 2014
a35753f
added about crc page, link on base html page
amitvakula Sep 2, 2014
bcb8376
fixed translation on about the crc page
amitvakula Sep 2, 2014
c123dd7
updated spelling error on about the crc page (consietes to conscientes)
amitvakula Sep 2, 2014
cd242d5
modifed translations on slider help pages (Gustavo 9-2 suggestions on…
amitvakula Sep 4, 2014
c5a7ce4
capitalized all spanish english buttons
amitvakula Sep 6, 2014
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
Hello and welcome to the California Report Card team!

This document is here to guide you through setting up the CRC on your local machine
and also give you an overview of how to change the files.

Important files:
Location File Name Purpose
src\server\opinion\templates mobile.html Here is where the entire website is laid out.

src\server\opinion settings_local.py Default settings and text replacement gets set
here!

src\server\opinion\opinion_core models.py Where the DiscussionStatement and other useful
Django models are defined

src\server\opinion\includes queryutils.py Commonly used queries - format_general_discussion_comment function

src\server\opinion\templates search.html All function relating to loading all the user comments

Change log:
opinion_core/models.py
Added fields to DiscussionComment class
-added spanish_comment - Spanish version of an English comment
-added original_language - Original language that the comment was written in - either "english" or "spanish"
-changed the SQL database to reflect these changes
Added fields to OpinionSpaceStatement class
-added spanish_statement - Spanish version of an English statement
-input type - the form of user input. For example, "slider" or "textbox"
Updated query_utils
-format_general_discussion_comment
Updated search.html
-updated populate_table added two table elements - spanish_comment and original_language
-changed table headers (in HTML) at the bottom of the file for the header
-added allowSpanishCommentEditing function which acts like allowCommentEditing() and called it in getSearchResults().
-changed both commentEditing functions to pass an additional parameter language as part of the request.
Updated views.py
-changed mobile function return value with a added key "spanish" with the value of a boolean (this is for later in mobile.html so that we can decide which language we are going to use). determined type of variable through parsing argument that will be providing in html of california report card
-proof_read_comments - added a variable language that tracks which language the comment we are editing is in.


Questions:
1. How do we store the two languages as two different tables?
11 changes: 11 additions & 0 deletions src/client/media/mobile/css/opinionspace.css
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,17 @@ table.pretty caption {
left: -9px;
}

.landing-translate-btn{
height:1px;
border: 1px;
color: #EEEEEE;
font-size: 10px;
text-shadow: none;
text-align: left;
padding-left: 10px;
margin-top: -30px;
}

.landing-img-title{
color: #FFFFFF;
padding: 5px;
Expand Down
45 changes: 38 additions & 7 deletions src/client/media/mobile/js/accounts.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,16 @@ var accounts = (function($, d3, console) {
else{

$("#email-error").show();
$("#email-error").text(data['error']);
console.log(data['error']);


if (window.spanish == "spanish") {
$("#email-error").text("Esta dirección de correo electrónico ya está en uso.");
console.log("Esta dirección de correo electrónico ya está en uso.");
} else {
$("#email-error").text(data['error']);
console.log(data['error']);
}


}
}
Expand Down Expand Up @@ -287,6 +295,7 @@ var accounts = (function($, d3, console) {
$('.dialog-email').hide();
$('.my-comment').hide();
$('.dialog-help-alt').hide();
$('.dialog-help-landing').hide();
$('.dialog-help-grade').hide();
$('.dialog-help-median').hide();
$('.dialog-help-zipcode').hide();
Expand Down Expand Up @@ -385,7 +394,14 @@ $(document).ready(function() {

if (data.hasOwnProperty('success')) {
accounts.setAuthenticated();
utils.showLoading("Loading", function() {

var loadingMsg = "Loading...";
console.log(window.spanish);
if (window.spanish=='spanish') {
loadingMsg = "Cargando...";
}

utils.showLoading(loadingMsg, function() {

accounts.loginAfterRegister(loginData);
blooms.populateBlooms();
Expand Down Expand Up @@ -433,7 +449,15 @@ $(document).ready(function() {
try {
//TODO: why doesn't this come up under form_errors[zip_code]
if (data['form_errors']['__all__'][0]) {
$("#zipcode-error").html(data['form_errors']['__all__'][0]);

if (window.spanish=='english')
{
$("#zipcode-error").html(data['form_errors']['__all__'][0]);
} else {
$("#zipcode-error").html('El código postal debe tener 5 dígitos');
}


$("#zipcode-error").show();
}
} catch(err) { }
Expand Down Expand Up @@ -465,15 +489,22 @@ $(document).ready(function() {

if (data.hasOwnProperty('success')) {
accounts.setAuthenticated();
utils.showLoading("Loading...", function() {

var loadingMsg = "Loading...";
console.log(window.spanish);
if (window.spanish=='spanish') {
loadingMsg = "Cargando..."; // not real function
}

utils.showLoading('hello', function() {
blooms.populateBlooms();
accounts.initLoggedInFeatures();
$('.top-bar').show();

setTimeout(function() { // d3 needs a little extra time to load
$('.login').hide();
}, 1000);
});

} else {
console.log("Failed login attempt");
$('#login-error').text(data['form_errors'].__all__[0]);
Expand Down Expand Up @@ -791,7 +822,7 @@ $(document).ready(function() {


$('.edit-comment-save-btn').click(function() {
rate.sendComment($('.edit-comment-box').val());
rate.sendComment($('.edit-comment-box').val(), window.spanish);
$('.menubar').find('.ui-btn-active').removeClass('ui-btn-active ui-focus');

$('.my-comment').hide();
Expand Down
51 changes: 50 additions & 1 deletion src/client/media/mobile/js/blooms.js
Original file line number Diff line number Diff line change
Expand Up @@ -403,12 +403,22 @@ var _blooms = blooms = (function($, d3, console) {

$('.rate-username').html('Suggested by Participant #'+d.uid);
var commentData = rate.pullComment(d.uid, 'uid', comments);

var content = commentData.comment;
var spanish_content = commentData.spanish_comment;


var cid = commentData.cid;
window.current_cid = cid;
window.current_uid = d.uid;
//$('.rate-loading').show();
rate.updateDescriptions(document.getElementById('commentInput'), content);
console.log("spanish_content")
console.log(spanish_content)


rate.updateDescriptions(document.getElementById('commentInputEnglish'), content);
rate.updateDescriptions(document.getElementById('commentInputSpanish'), spanish_content);

$('.rate').show();
/*$('.rate').slideDown(function() {
$('.rate-loading').hide();
Expand Down Expand Up @@ -528,9 +538,48 @@ $(document).ready(function() {
//_blooms.populateBlooms();
});

$('#go-back-spanish').click(function() {
//$('.scorebox').show();
//utils.showLoading("");
console.log("getting into go-back");
$('.menubar').show();
rate.doneRating();

try {
window.cur_clicked_mug.transition().duration(2000).style("opacity", "0").remove();
} catch (err) {
console.log(err);
}
//_this.transition().duration(500).style("opacity", "0");
/* Remove this bloom from our bookkeeping array. */
var index = jQuery.inArray(window.current_uid, window.blooms_list);
if (index >= 0) {
window.blooms_list.splice(index, 1);
}
/* Load more blooms if none left */
try {
if (window.blooms_list.length <= 2) {
console.log("here");
utils.showLoading("Loading More Mugs...");
window.blooms_list = undefined; //needed to avoid infinite recursing
setTimeout(blooms.populateBlooms, 500);
//utils.hideLoading();
// utils.showLoading("Loading More Ideas...", function() {
// populateBlooms();
//});
//utils.hideLoading(5000);
}
} catch (err) {
/* undefined variable blooms. */
console.log(err);
}

});

$('#go-back').click(function() {
//$('.scorebox').show();
//utils.showLoading("");
console.log("getting into go-back");
$('.menubar').show();
rate.doneRating();

Expand Down
13 changes: 10 additions & 3 deletions src/client/media/mobile/js/crc-transparent-slider.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,15 @@ $(".slider-grade-bubble").on("click",function(e){

$(this).parent().children(".bubble-"+median.replace("+","p")).css("border","2px solid #66FFFF");
if (statement_id == 1){
$(".median-grade-"+statement_id).html("The median grade so far is highlighted in blue.");
$(".median-grade-"+statement_id).fadeIn(500);
$(".median-grade-"+statement_id).fadeOut(6000);

if(window.spanish == "english") {
$(".median-grade-"+statement_id).html("The median grade so far is highlighted in blue.");
} else {
$(".median-grade-"+statement_id).html("La calificación media hasta <br/> el momento es destacada con bordes azules.");
}

$(".median-grade-"+statement_id).fadeIn(500);
$(".median-grade-"+statement_id).fadeOut(4000);
}

$(".skip-button-"+statement_id).hide();
Expand All @@ -78,6 +84,7 @@ $(".slider-grade-bubble").on("touchstart",function(e){
$(this).parent().children(".bubble-"+median.replace("+","p")).css("border","2px solid #66FFFF");
$(".median-grade-"+statement_id).html("Median grade so far: " + median);
$(".median-grade-"+statement_id).fadeIn(500);
$(".median-grade-"+statement_id).fadeOut(3000);
$(".skip-button-"+statement_id).hide();
}
catch(exception){}
Expand Down
10 changes: 10 additions & 0 deletions src/client/media/mobile/js/home.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
$(document).ready(function()
// {
// $('.spanish').hide();
// $('#message').hide();
$('#message').click(
function() {
console.log(window.spanish);
}
);
});
49 changes: 49 additions & 0 deletions src/client/media/mobile/js/multi-lingual.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
$(document).ready(function()
{
console.log('spanish');
console.log(window.spanish);
if (window.spanish=='spanish') {
$('.spanish').show();
$('.english').hide();
} else {
$('.english').show();
$('.spanish').hide();
}

$('.landing-translate-btn').click(
function()
{
if (window.spanish=='spanish') {
$('.english').show();
$('.spanish').hide();
$('.instructions').html('Click any mug to begin.');
$('.instructions2').html('We want to hear your idea. Please rate one more suggestion first.');
$('.instructions3').html('Click your mug (in green) to share your suggestion.');
$("#zipcode-error").html('Zipcode must be 5 digits');
$("#email-error").text("This email address is already in use.");
$(".median-grade-1").html("The median grade so far is highlighted in blue.");
$('#regzip').attr("placeholder","Zip Code");
$('#regemail').attr("placeholder","Email");
$(".skip-btn").text("Skip");
// $('#message').html('The California Report Card is optimized for mobile screen sizes.</br> Learn more about the project at <b><a href="http://californiareportcard.org">http://californiareportcard.org</a></b>.<br/>');
window.spanish = 'english';
} else {
$('.english').hide();
$('.spanish').show();
$('.instructions').html('Haga clic en cualquier taza para comenzar.');
$('.instructions2').html('Queremos escuchar tu idea pero primero, por favor, califique una sugerencia más.');
$('.instructions3').html('Haga clic en su taza (en verde) para compartir su sugerencia.');
$("#zipcode-error").html('El código postal debe tener 5 dígitos');
$("#email-error").text("Esta dirección de correo electrónico ya está en uso.");
$(".median-grade-1").html("La calificación media hasta el momento es destacada con bordes azules.");
$('#regzip').attr("placeholder","Código Postal");
$('#regemail').attr("placeholder","Correo Electrónico");
$(".skip-btn").text("Saltar");
// $('#message').html('El Reporte de California está optimizado para los tamaños de pantalla móvil. </br> Obtenga más información sobre el proyecto en <b><a href="http://californiareportcard.org">http://californiareportcard.org</a></b>.<br/>');
window.spanish = 'spanish';
}
}
);


});
Loading