]> git.ktnx.net Git - lsl.git/blobdiff - public/javascripts/lsl.js
remove Cancel buttons from dialogs
[lsl.git] / public / javascripts / lsl.js
index 92e089763fb138fd5e1528ea56d1f3af90bf75dd..f7efa52f72236622f57796a2b84a501f4ec95e6e 100644 (file)
@@ -109,7 +109,10 @@ function edit_list() {
         autoOpen: true,
         modal: true,
         title: 'Edit list',
-        width: 'max-content',
+        width: 'min(calc(100% - 2em), 20em)',
+        close: (ev) => {
+            $(ev.target).dialog('destroy');
+        },
         buttons: [
             {
                 class: 'btn-delete',
@@ -118,10 +121,6 @@ function edit_list() {
                     delete_list(d);
                 },
             },
-            {
-                text: 'Cancel',
-                click: ()=>{ d.dialog('destroy'); },
-            },
             {
                 icon: 'ui-icon-disk',
                 text: 'OK',
@@ -335,7 +334,10 @@ function edit_list_item(li) {
         autoOpen: true,
         modal: true,
         title: 'Edit item',
-        width: 'max-content',
+        width: 'min(calc(100% - 2em), 20em)',
+        close: (ev) => {
+            $(ev.target).dialog('destroy');
+        },
         buttons: [
             {
                 class: 'btn-delete',
@@ -344,10 +346,6 @@ function edit_list_item(li) {
                     delete_list_item(d, li);
                 },
             },
-            {
-                text: 'Cancel',
-                click: ()=>{ d.dialog('destroy'); },
-            },
             {
                 icon: 'ui-icon-disk',
                 text: 'OK',
@@ -449,5 +447,8 @@ $(function(){
     });
     $('#list-items').on('change', '.list-item-row input[type="checkbox"]', handle_list_item_state_changed);
     load_lists();
+    $('body').on('click', '.ui-widget-overlay', (ev) => {
+        $(ev.target).siblings('.ui-dialog').find('.ui-dialog-content').dialog('close');
+    });
 });
 })();