Skip to content

Commit

Permalink
Kind of grotesque hack for overflow to the left on checklist elems
Browse files Browse the repository at this point in the history
Unfortunately there doesn't seem to be a great (at least not
google-able) solution to this?
  • Loading branch information
sz3 committed Feb 26, 2020
1 parent 34cab3c commit e3b0a22
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
2 changes: 1 addition & 1 deletion js_tests/test_create_archive.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ function getCreatePaths()
{
var sl = [];
$('#create-archive-list input[type=text]').each(function() {
sl.push($(this).val());
sl.push($(this).attr('data-entry'));
});
return sl;
}
Expand Down
4 changes: 2 additions & 2 deletions js_tests/test_settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function getStorageEntries()
{
var sl = [];
$('#settings-remote-storage input[type=text]').each(function() {
sl.push($(this).val());
sl.push($(this).attr('data-entry'));
});
return sl;
}
Expand All @@ -27,7 +27,7 @@ function getKeyfileEntries()
{
var kf = [];
$('#settings-keyfiles input[type=text]').each(function() {
kf.push($(this).val());
kf.push($(this).attr('data-entry'));
});
return kf;
}
Expand Down
18 changes: 13 additions & 5 deletions pogui/web/checklist/cl.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,19 @@ var _onRemove = onRemove;
function removeEntryClick()
{
var bg = $(this).parent();
var val = bg.find('input').val();
var val = bg.find('input').attr('data-entry');
if (_onRemove)
_onRemove(val, _id);
else {
bg.remove();
}
}

function ltrEncoding(value)
{
return "\u202A" + value + "\u202C";
}

return {
setOnRemove : function(onRemove)
{
Expand All @@ -38,8 +43,11 @@ return {
<button class="pure-button remove-pog-checklist" href="javascript:void(0)">🗙</button>\
</div>');
var input = bg.find('input');
input.val(entry);
input.attr('title', entry);
input.attr('data-entry', entry);

var encodedEntry = ltrEncoding(entry);
input.val(encodedEntry);
input.attr('title', encodedEntry);
bg.find('button').click(removeEntryClick);
root.append(bg);
}
Expand All @@ -49,7 +57,7 @@ return {
{
var current_items = [];
$('[id="' + _id + '"].pog-checklist input[type="text"]').each(function() {
current_items.push($(this).val());
current_items.push($(this).attr('data-entry'));
});
return current_items;
}
Expand Down Expand Up @@ -93,5 +101,5 @@ CheckList.init();

var sample = ['s3:test'];
CheckList.get('settings-remote-storage').update(sample);
CheckList.get('settings-keyfiles').update(['looooooooooooooooooong/path/to/keyfile.txt']);
CheckList.get('settings-keyfiles').update(['/looooooooooooooooooong/path/to/keyfile.txt']);
//*/

0 comments on commit e3b0a22

Please sign in to comment.