Skip to content

Commit 90f8880

Browse files
committed
Merge pull request #2281 from learningequality/release-0.12.0
Release 0.12.3
2 parents d968f1a + 4797fde commit 90f8880

File tree

12 files changed

+1017
-10
lines changed

12 files changed

+1017
-10
lines changed

kalite/distributed/static/css/distributed/khan-lite.css

Lines changed: 69 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,17 @@ nav {
166166
display: none;
167167
}
168168

169+
#logged-in-name {
170+
display: inline-block;
171+
min-width: 10px;
172+
max-width: 100px;
173+
white-space: nowrap;
174+
overflow: hidden;
175+
text-overflow: ellipsis;
176+
vertical-align: bottom;
177+
*vertical-align: middle; /*Hack to properly align Username in IE6 & IE7 */
178+
}
179+
169180
/********** End of Top Navigation bar ***********/
170181

171182
h2 {
@@ -521,4 +532,61 @@ a.disabled {
521532

522533
input#search {
523534
width: 150px;
524-
}
535+
}
536+
537+
538+
/* BEGIN styles for software-keyboard */
539+
540+
#software-keyboard {
541+
border: 2px solid #cfcfcf;
542+
background: #c3c3c3;
543+
-moz-border-radius: 8px;
544+
-webkit-border-radius: 8px;
545+
border-radius: 8px;
546+
-webkit-box-shadow: 0 0 8px rgba(0, 0, 0, 1);
547+
text-align: center;
548+
padding: 0px;
549+
margin-top: 10px;
550+
}
551+
552+
#software-keyboard div {
553+
display: inline-block;
554+
/*min-width: 33%;*/
555+
padding: 3px;
556+
}
557+
558+
#software-keyboard div .key {
559+
width: 100%;
560+
text-align: center;
561+
line-height: 30px;
562+
font-size: 26px;
563+
}
564+
565+
#software-keyboard div .key-bs {
566+
font-size: 16px;
567+
}
568+
569+
/* TODO-BLOCKER (rtibbles): 0.13 - Remove extraneous css added here to make styling work without Bootstrap */
570+
571+
#show-keyboard {
572+
font-size: 10px;
573+
width: 90px;
574+
float: right;
575+
-webkit-border-radius: 5px;
576+
-moz-border-radius: 5px;
577+
border-radius: 5px;
578+
background-color: #816fba;
579+
font-family: Arial, Helvetica, sans-serif;
580+
color: #ffffff;
581+
padding: 5px 20px;
582+
border:0px;
583+
}
584+
585+
div .row {
586+
width: 100%;
587+
}
588+
div .col-xs-4 {
589+
width: 33%;
590+
}
591+
592+
/* END styles for software-keyboard */

kalite/distributed/static/js/distributed/exercises.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,18 @@ $(function() {
9090
$(Exercises).trigger("readyForNextProblem", {userExercise: exerciseData});
9191
});
9292
});
93+
94+
95+
// TODO-BLOCKER (rtibbles): Integrate with Backbone views for Practice/Quiz/Test - only rerender on change of question type.
96+
$(Exercises).bind("newProblem", function (ev, data) {
97+
if (data.answerType=="number"||data.answerType=="decimal"||data.answerType=="rational"||data.answerType=="improper"||data.answerType=="mixed"){
98+
window.softwareKeyboardView = new SoftwareKeyboardView({
99+
el: $("#solutionarea")
100+
});
101+
}
102+
});
103+
104+
93105
doRequest(GET_EXERCISE_LOGS_URL, [exerciseData.exerciseModel.name])
94106
.success(function(data) {
95107
if (data.length === 0) {
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
window.SoftwareKeyboardView = Backbone.View.extend({
2+
3+
events: {
4+
"click button.key" : "key_pressed",
5+
"click button#show-keyboard": "toggle_keypad"
6+
},
7+
8+
initialize: function () {
9+
10+
_.bindAll(this);
11+
12+
this.inputs = this.$el.find( ":input" )
13+
.prop( "readonly", true )
14+
.css( "-webkit-tap-highlight-color", "rgba(0, 0, 0, 0)" );
15+
this.field = this.inputs.first();
16+
this.touch = Modernizr.touch;
17+
this.enabled = true;
18+
this.render();
19+
20+
},
21+
22+
toggle_keypad: function() {
23+
this.enabled = !this.enabled;
24+
this.software_keyboard.toggle();
25+
this.inputs.prop("readonly", function(index, value){
26+
return !value;
27+
});
28+
this.$el.find("#show-keyboard").text(function(i, text){
29+
// TODO
30+
return text === gettext("Show Keypad") ? gettext("Hide Keypad") : gettext("Show Keypad");
31+
});
32+
return false;
33+
},
34+
35+
key_pressed: function( ev ) {
36+
if(!this.enabled) {
37+
return false;
38+
}
39+
var key = $(ev.target).val();
40+
// backspace key
41+
if ( key == "bs" ) {
42+
this.field.val( this.field.val().slice( 0, -1 ) );
43+
//clear key
44+
} else if(key == "c"){
45+
this.field.val('');
46+
} else {
47+
//normal key
48+
this.field.val( this.field.val() + key );
49+
}
50+
51+
this.field.trigger("keypress");
52+
53+
return false;
54+
},
55+
56+
render: function () {
57+
self = this;
58+
59+
// TODO-BLOCKER (rtibbles): 0.13 - Turn this into a handlebars template, conditionally render templates based on exercise types.
60+
61+
this.$el.append("<button id='show-keyboard'>" + gettext("Hide Keypad") + "</button>");
62+
63+
this.$el.append("<div class='container-fluid' id='software-keyboard'></div>");
64+
65+
// TODO-BLOCKER (rtibbles): 0.13 - Remove extraneous &nbsp; added here to make styling work without Bootstrap
66+
67+
var keys = [ [ "1", "2", "3" ], [ "4", "5", "6" ], [ "7", "8", "9" ], ["/&nbsp;", "0", "&nbsp;-" ],[ ".", "c", "bs" ] ];
68+
var corners = {
69+
"1": "ui-corner-tl",
70+
"3": "ui-corner-tr",
71+
".": "ui-corner-bl",
72+
"bs": "ui-corner-br"
73+
};
74+
75+
this.software_keyboard = this.$el.find("#software-keyboard");
76+
77+
jQuery.each( keys, function( i, row ) {
78+
var rowDiv = jQuery( "<div>" )
79+
.attr( "class", "row" )
80+
.appendTo( self.software_keyboard );
81+
82+
jQuery.each( row, function( j, key ) {
83+
var keySpan = $("<div class='.col-xs-4'><button class='key green_button " + (key === "bs" ? "key-bs" : "") + "' value='" + key + "'>" + (key === "bs" ? "Del" : key) + "</button></div>").appendTo( rowDiv );
84+
85+
} );
86+
} );
87+
88+
if(!this.touch){
89+
this.toggle_keypad();
90+
}
91+
92+
}
93+
94+
});

kalite/distributed/static/khan-exercises/utils/answer-types.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2169,4 +2169,4 @@ _.each(Khan.answerTypes, function(info, type) {
21692169
}
21702170
});
21712171

2172-
})();
2172+
})();

kalite/distributed/templates/distributed/base.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@
8585
</script>
8686
<script type="text/javascript" src="{% static 'js/sprintf.min.js' %}"></script>
8787
<script type="text/javascript" src="{% static 'js/purl.js' %}"></script>
88+
<script type="text/javascript" src="{% static 'js/modernizr.js' %}"></script>
8889
<script type="text/javascript" src="{% static 'js/jquery.ui.autocomplete.html.js' %}"></script>
8990
<script type="text/javascript" src="{% static 'js/khan-lite.js' True %}"></script>
9091
<script type="text/javascript" src="{% static 'js/distributed/distributed-server.js' True %}"></script>

kalite/distributed/templates/distributed/exercise.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@
6969
"lastCountHints": 0
7070
};
7171
</script>
72+
<script src="{% static 'js/distributed/software-keyboard.js' %}"></script>
7273
<script src="{% static 'js/distributed/exercises.js' %}"></script>
7374
{% endblock headjs %}
7475

kalite/i18n/__init__.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,9 @@ def get_dubbed_video_map(lang_code=None, force=False):
7171
try:
7272
if not os.path.exists(DUBBED_VIDEOS_MAPPING_FILEPATH) or force:
7373
try:
74-
# Generate from the spreadsheet
75-
response = requests.get("http://%s/api/i18n/videos/dubbed_video_map" % (settings.CENTRAL_SERVER_HOST))
74+
# Never call commands that could fail from the distributed server.
75+
# Always create a central server API to abstract things
76+
response = requests.get("%s://%s/api/i18n/videos/dubbed_video_map" % (settings.SECURESYNC_PROTOCOL, settings.CENTRAL_SERVER_HOST))
7677
response.raise_for_status()
7778
with open(DUBBED_VIDEOS_MAPPING_FILEPATH, "wb") as fp:
7879
fp.write(response.content.decode('utf-8')) # wait until content has been confirmed before opening file.
@@ -94,8 +95,9 @@ def get_dubbed_video_map(lang_code=None, force=False):
9495

9596
DUBBED_VIDEO_MAP = {}
9697
for lang_name, video_map in DUBBED_VIDEO_MAP_RAW.iteritems():
97-
logging.debug("Adding dubbed video map entry for %s (name=%s)" % (get_langcode_map(lang_name), lang_name))
98-
DUBBED_VIDEO_MAP[get_langcode_map(lang_name)] = video_map
98+
if lang_name:
99+
logging.debug("Adding dubbed video map entry for %s (name=%s)" % (get_langcode_map(lang_name), lang_name))
100+
DUBBED_VIDEO_MAP[get_langcode_map(lang_name)] = video_map
99101

100102
return DUBBED_VIDEO_MAP.get(lang_code, {}) if lang_code else DUBBED_VIDEO_MAP
101103

kalite/updates/static/css/updates/update_videos.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ ul.dynatree-container li, .ui-widget-content {
1414
float: left;
1515
margin-right: 10px;
1616
margin-top: 5px;
17-
height: 100px;
17+
min-height: 109px;
1818
padding: 10px;
1919
width: 45%;
2020
}

python-packages/debug_toolbar/urls.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@
1414
url(r'^%s/sql_explain/$' % _PREFIX, 'debug_toolbar.views.sql_explain', name='sql_explain'),
1515
url(r'^%s/sql_profile/$' % _PREFIX, 'debug_toolbar.views.sql_profile', name='sql_profile'),
1616
url(r'^%s/template_source/$' % _PREFIX, 'debug_toolbar.views.template_source', name='template_source'),
17-
)
17+
)

0 commit comments

Comments
 (0)