Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
54c62b8
Quick initial integration of software keyboard into KA Lite exercises.
jamalex Jul 21, 2013
b224194
Merge branch 'css_cleanup' into software-keyboard
jamalex Jul 21, 2013
6218bcf
Tweaks to styling for software keyboard.
jamalex Jul 21, 2013
1b7640c
Adding other mather notations.
gmindmint Jul 21, 2013
3ebbdc4
Adding clear input field function.
gmindmint Jul 21, 2013
1a78b6c
Fixed "next question" displaying issue
gmindmint Jul 21, 2013
95c4883
Showing Numberpad
gmindmint Jul 21, 2013
f54a7f1
Only show the numberpad if it is an andriod device.
gmindmint Jul 21, 2013
200e3f7
Fix some formats
gmindmint Jul 22, 2013
177145a
Signed-off-by: wangguan59 <wangguan59@gmail.com>
gmindmint Sep 5, 2013
1b8c9e9
Merge branch 'develop' into software-keyboard
gmindmint Oct 5, 2013
7a1ad82
Show up on all the devices.
gmindmint Oct 5, 2013
594141f
Fix for #356
DragoonHP Jul 24, 2014
56f1c1e
Using vw instead of em in caption sizes
DragoonHP Jul 24, 2014
a39c7ee
Using vw instead of em in caption sizes
DragoonHP Jul 24, 2014
54699c1
Fix for overflowing buttons in Update Videos page
DragoonHP Jul 24, 2014
5995d82
Quick initial integration of software keyboard into KA Lite exercises.
rtibbles Jul 29, 2014
4d37b2b
Moves software-keyboard to new location.
rtibbles Jul 11, 2014
0c41b04
Implements first pass of Backbone driven software keyboard.
rtibbles Jul 29, 2014
8e4086f
Makes numpad appear for all applicable answer types.
rtibbles Jul 11, 2014
487acca
Fixes on screen keyboard to only appear for Android devices.
rtibbles Jul 11, 2014
98d14ff
Removes erroneously included file.
rtibbles Jul 11, 2014
286a9d6
Adds modernizr.js as static library and to base.html import.
rtibbles Jul 14, 2014
af98e56
Fixes styling for keypad buttons to make not as high.
rtibbles Jul 29, 2014
e42c035
Fixes variable and function names to underscore convention.
rtibbles Jul 15, 2014
87e76d8
Adds styling for keyboard that does not rely on bootstrap.
rtibbles Jul 29, 2014
c32ac98
Fixes numpad styling for firefox.
rtibbles Jul 30, 2014
c4ca138
Merge pull request #2279 from rtibbles/numpad-release
aronasorman Jul 30, 2014
153ba53
Skip empty lang_name entries in dubbed vid mapping.
jamalex Jul 30, 2014
992cf50
Merge branch 'master' of github.com:learningequality/ka-lite into rel…
jamalex Jul 31, 2014
153f9ce
Update video-js.css
DragoonHP Jul 31, 2014
85a0f4e
Update video-js.css
DragoonHP Jul 31, 2014
53f9b17
Update khan-lite.css
DragoonHP Jul 31, 2014
4797fde
Merge PR #2264 into release-0.12.0
jamalex Jul 31, 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
70 changes: 69 additions & 1 deletion kalite/distributed/static/css/distributed/khan-lite.css
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,17 @@ nav {
display: none;
}

#logged-in-name {
display: inline-block;
min-width: 10px;
max-width: 100px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
vertical-align: bottom;
*vertical-align: middle; /*Hack to properly align Username in IE6 & IE7 */
}

/********** End of Top Navigation bar ***********/

h2 {
Expand Down Expand Up @@ -521,4 +532,61 @@ a.disabled {

input#search {
width: 150px;
}
}


/* BEGIN styles for software-keyboard */

#software-keyboard {
border: 2px solid #cfcfcf;
background: #c3c3c3;
-moz-border-radius: 8px;
-webkit-border-radius: 8px;
border-radius: 8px;
-webkit-box-shadow: 0 0 8px rgba(0, 0, 0, 1);
text-align: center;
padding: 0px;
margin-top: 10px;
}

#software-keyboard div {
display: inline-block;
/*min-width: 33%;*/
padding: 3px;
}

#software-keyboard div .key {
width: 100%;
text-align: center;
line-height: 30px;
font-size: 26px;
}

#software-keyboard div .key-bs {
font-size: 16px;
}

/* TODO-BLOCKER (rtibbles): 0.13 - Remove extraneous css added here to make styling work without Bootstrap */

#show-keyboard {
font-size: 10px;
width: 90px;
float: right;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
background-color: #816fba;
font-family: Arial, Helvetica, sans-serif;
color: #ffffff;
padding: 5px 20px;
border:0px;
}

div .row {
width: 100%;
}
div .col-xs-4 {
width: 33%;
}

/* END styles for software-keyboard */
12 changes: 12 additions & 0 deletions kalite/distributed/static/js/distributed/exercises.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,18 @@ $(function() {
$(Exercises).trigger("readyForNextProblem", {userExercise: exerciseData});
});
});


// TODO-BLOCKER (rtibbles): Integrate with Backbone views for Practice/Quiz/Test - only rerender on change of question type.
$(Exercises).bind("newProblem", function (ev, data) {
if (data.answerType=="number"||data.answerType=="decimal"||data.answerType=="rational"||data.answerType=="improper"||data.answerType=="mixed"){
window.softwareKeyboardView = new SoftwareKeyboardView({
el: $("#solutionarea")
});
}
});


doRequest(GET_EXERCISE_LOGS_URL, [exerciseData.exerciseModel.name])
.success(function(data) {
if (data.length === 0) {
Expand Down
94 changes: 94 additions & 0 deletions kalite/distributed/static/js/distributed/software-keyboard.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
window.SoftwareKeyboardView = Backbone.View.extend({

events: {
"click button.key" : "key_pressed",
"click button#show-keyboard": "toggle_keypad"
},

initialize: function () {

_.bindAll(this);

this.inputs = this.$el.find( ":input" )
.prop( "readonly", true )
.css( "-webkit-tap-highlight-color", "rgba(0, 0, 0, 0)" );
this.field = this.inputs.first();
this.touch = Modernizr.touch;
this.enabled = true;
this.render();

},

toggle_keypad: function() {
this.enabled = !this.enabled;
this.software_keyboard.toggle();
this.inputs.prop("readonly", function(index, value){
return !value;
});
this.$el.find("#show-keyboard").text(function(i, text){
// TODO
return text === gettext("Show Keypad") ? gettext("Hide Keypad") : gettext("Show Keypad");
});
return false;
},

key_pressed: function( ev ) {
if(!this.enabled) {
return false;
}
var key = $(ev.target).val();
// backspace key
if ( key == "bs" ) {
this.field.val( this.field.val().slice( 0, -1 ) );
//clear key
} else if(key == "c"){
this.field.val('');
} else {
//normal key
this.field.val( this.field.val() + key );
}

this.field.trigger("keypress");

return false;
},

render: function () {
self = this;

// TODO-BLOCKER (rtibbles): 0.13 - Turn this into a handlebars template, conditionally render templates based on exercise types.

this.$el.append("<button id='show-keyboard'>" + gettext("Hide Keypad") + "</button>");

this.$el.append("<div class='container-fluid' id='software-keyboard'></div>");

// TODO-BLOCKER (rtibbles): 0.13 - Remove extraneous &nbsp; added here to make styling work without Bootstrap

var keys = [ [ "1", "2", "3" ], [ "4", "5", "6" ], [ "7", "8", "9" ], ["/&nbsp;", "0", "&nbsp;-" ],[ ".", "c", "bs" ] ];
var corners = {
"1": "ui-corner-tl",
"3": "ui-corner-tr",
".": "ui-corner-bl",
"bs": "ui-corner-br"
};

this.software_keyboard = this.$el.find("#software-keyboard");

jQuery.each( keys, function( i, row ) {
var rowDiv = jQuery( "<div>" )
.attr( "class", "row" )
.appendTo( self.software_keyboard );

jQuery.each( row, function( j, key ) {
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 );

} );
} );

if(!this.touch){
this.toggle_keypad();
}

}

});
Original file line number Diff line number Diff line change
Expand Up @@ -2169,4 +2169,4 @@ _.each(Khan.answerTypes, function(info, type) {
}
});

})();
})();
1 change: 1 addition & 0 deletions kalite/distributed/templates/distributed/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
</script>
<script type="text/javascript" src="{% static 'js/sprintf.min.js' %}"></script>
<script type="text/javascript" src="{% static 'js/purl.js' %}"></script>
<script type="text/javascript" src="{% static 'js/modernizr.js' %}"></script>
<script type="text/javascript" src="{% static 'js/jquery.ui.autocomplete.html.js' %}"></script>
<script type="text/javascript" src="{% static 'js/khan-lite.js' True %}"></script>
<script type="text/javascript" src="{% static 'js/distributed/distributed-server.js' True %}"></script>
Expand Down
1 change: 1 addition & 0 deletions kalite/distributed/templates/distributed/exercise.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
"lastCountHints": 0
};
</script>
<script src="{% static 'js/distributed/software-keyboard.js' %}"></script>
<script src="{% static 'js/distributed/exercises.js' %}"></script>
{% endblock headjs %}

Expand Down
10 changes: 6 additions & 4 deletions kalite/i18n/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,9 @@ def get_dubbed_video_map(lang_code=None, force=False):
try:
if not os.path.exists(DUBBED_VIDEOS_MAPPING_FILEPATH) or force:
try:
# Generate from the spreadsheet
response = requests.get("http://%s/api/i18n/videos/dubbed_video_map" % (settings.CENTRAL_SERVER_HOST))
# Never call commands that could fail from the distributed server.
# Always create a central server API to abstract things
response = requests.get("%s://%s/api/i18n/videos/dubbed_video_map" % (settings.SECURESYNC_PROTOCOL, settings.CENTRAL_SERVER_HOST))
response.raise_for_status()
with open(DUBBED_VIDEOS_MAPPING_FILEPATH, "wb") as fp:
fp.write(response.content.decode('utf-8')) # wait until content has been confirmed before opening file.
Expand All @@ -94,8 +95,9 @@ def get_dubbed_video_map(lang_code=None, force=False):

DUBBED_VIDEO_MAP = {}
for lang_name, video_map in DUBBED_VIDEO_MAP_RAW.iteritems():
logging.debug("Adding dubbed video map entry for %s (name=%s)" % (get_langcode_map(lang_name), lang_name))
DUBBED_VIDEO_MAP[get_langcode_map(lang_name)] = video_map
if lang_name:
logging.debug("Adding dubbed video map entry for %s (name=%s)" % (get_langcode_map(lang_name), lang_name))
DUBBED_VIDEO_MAP[get_langcode_map(lang_name)] = video_map

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

Expand Down
2 changes: 1 addition & 1 deletion kalite/updates/static/css/updates/update_videos.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ ul.dynatree-container li, .ui-widget-content {
float: left;
margin-right: 10px;
margin-top: 5px;
height: 100px;
min-height: 109px;
padding: 10px;
width: 45%;
}
Expand Down
2 changes: 1 addition & 1 deletion python-packages/debug_toolbar/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
url(r'^%s/sql_explain/$' % _PREFIX, 'debug_toolbar.views.sql_explain', name='sql_explain'),
url(r'^%s/sql_profile/$' % _PREFIX, 'debug_toolbar.views.sql_profile', name='sql_profile'),
url(r'^%s/template_source/$' % _PREFIX, 'debug_toolbar.views.template_source', name='template_source'),
)
)
Loading