Commit 28d6d567 by Anton Stupak

Merge pull request #2996 from edx/anton/add-selecton-on-focus-for-time-editors

Video: Add highlighting of start/end time field when clicking into it.
parents 817df15c 790d359b
......@@ -320,12 +320,14 @@ function(BaseView, _, MetadataModel, AbstractEditor, VideoList) {
Metadata.RelativeTime = AbstractEditor.extend({
defaultValue : '00:00:00',
defaultValue: '00:00:00',
// By default max value of RelativeTime field on Backend is 23:59:59,
// that is 86399 seconds.
maxTimeInSeconds : 86399,
maxTimeInSeconds: 86399,
events : {
events: {
"focus input" : "addSelection",
"mouseup input" : "mouseUpHandler",
"change input" : "updateModel",
"keypress .setting-input" : "showClearButton" ,
"click .setting-clear" : "clear"
......@@ -333,7 +335,7 @@ function(BaseView, _, MetadataModel, AbstractEditor, VideoList) {
templateName: "metadata-string-entry",
getValueFromEditor : function () {
getValueFromEditor: function () {
var $input = this.$el.find('#' + this.uniqueId);
return $input.val();
......@@ -384,18 +386,28 @@ function(BaseView, _, MetadataModel, AbstractEditor, VideoList) {
].join(':');
},
setValueInEditor : function (value) {
setValueInEditor: function (value) {
if (!value) {
value = this.defaultValue;
}
this.$el.find('input').val(value);
},
addSelection: function (event) {
$(event.currentTarget).select();
},
mouseUpHandler: function (event) {
// Prevents default behavior to make works selection in WebKit
// browsers
event.preventDefault();
}
});
Metadata.Dict = AbstractEditor.extend({
events : {
events: {
"click .setting-clear" : "clear",
"keypress .setting-input" : "showClearButton",
"change input" : "updateModel",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment