Skip to content

Commit e15d8b2

Browse files
authored
Grey out depth field until a category is selected (#79)
Fixes #68
1 parent b52ddb1 commit e15d8b2

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

module/scripts/index/commons-source-ui.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@ Refine.CommonsSourceUI.prototype.addRow = function() {
77

88
var tr = $(`<tr id="categoryRow">
99
<td><input size="72" class="category-input-box"/></td>
10-
<td class="depth-input-td"><input type="number" min="0" max="6" class="depth-input-box"/></td>
10+
<td class="depth-input-td"><input type="number" value="0" min="0" max="6" class="depth-input-box"/></td>
1111
<td class="x-button-td"><a class="x-button" href><img src='images/close.png'></a></td></tr>`);
1212
$("#categoriesTable").append(tr);
1313

1414
tr.find('a.x-button').attr('title',$.i18n('commons-import/remove-category'));
15+
tr.find('input.depth-input-box').prop('disabled', true);
1516

1617
var endpoint = "https://commons.wikimedia.org/w/api.php"
1718
// FIXME: twik configuration to not use Freebase
@@ -20,10 +21,12 @@ Refine.CommonsSourceUI.prototype.addRow = function() {
2021
language: $.i18n("core-recon/wd-recon-lang")
2122
};
2223

24+
var depthBox = tr.find('input.depth-input-box');
2325
tr.find('input.category-input-box').suggestCategory(suggestConfig).bind("fb-select", function(evt, data) {
2426
tr.find('input.category-input-box').data("jsonValue", {
2527
id: data.id
2628
});
29+
depthBox.removeAttr('disabled');
2730
});
2831

2932
var xButton = tr.find('.x-button');

0 commit comments

Comments
 (0)