Эх сурвалжийг харах

Мелкий рефакторинг

Book Pauk 5 жил өмнө
parent
commit
1aebbbcabd

+ 2 - 2
client/components/Reader/Reader.vue

@@ -1030,7 +1030,7 @@ class Reader extends Vue {
         } catch (e) {
             progress.hide(); this.progressActive = false;
             this.loaderActive = true;
-            this.$root.stdDialog.alert(e.message, 'Ошибка', {type: 'negative'});
+            this.$root.stdDialog.alert(e.message, 'Ошибка', {color: 'negative'});
         }
     }
 
@@ -1054,7 +1054,7 @@ class Reader extends Vue {
         } catch (e) {
             progress.hide(); this.progressActive = false;
             this.loaderActive = true;
-            this.$root.stdDialog.alert(e.message, 'Ошибка', {type: 'negative'});
+            this.$root.stdDialog.alert(e.message, 'Ошибка', {color: 'negative'});
         }
     }
 

+ 1 - 1
client/components/Reader/RecentBooksPage/RecentBooksPage.vue

@@ -303,7 +303,7 @@ class RecentBooksPage extends Vue {
             let errMes = e.message;
             if (errMes.indexOf('404') >= 0)
                 errMes = 'Файл не найден на сервере (возможно был удален как устаревший)';
-            this.$root.stdDialog.alert(errMes, 'Ошибка', {type: 'negative'});
+            this.$root.stdDialog.alert(errMes, 'Ошибка', {color: 'negative'});
         }
     }
 

+ 2 - 2
client/components/Reader/TextPage/TextPage.vue

@@ -423,7 +423,7 @@ class TextPage extends Vue {
                     if (this.lazyParseEnabled)
                         this.lazyParsePara();
                 } catch (e) {
-                    this.$root.stdDialog.alert(e.message, 'Ошибка', {type: 'negative'});
+                    this.$root.stdDialog.alert(e.message, 'Ошибка', {color: 'negative'});
                 }
             })();
         }
@@ -1132,7 +1132,7 @@ class TextPage extends Vue {
         if (url && url.indexOf('file://') != 0) {
             window.open(url, '_blank');
         } else {
-            this.$root.stdDialog.alert('Оригинал недоступен, т.к. файл книги был загружен с локального диска.', ' ', {type: 'info'});
+            this.$root.stdDialog.alert('Оригинал недоступен, т.к. файл книги был загружен с локального диска.', ' ', {color: 'info'});
         }
     }
 

+ 10 - 5
client/components/share/StdDialog.vue

@@ -3,7 +3,7 @@
         <slot></slot>
 
         <!--------------------------------------------------->
-        <div v-show="type == 'alert'" class="dialog column bg-white no-wrap" style="min-height: 150px">
+        <div v-show="type == 'alert'" class="dialog column bg-white no-wrap" :style="dialogStyle">
             <div class="header row">
                 <div class="caption col row items-center q-ml-md">
                     <q-icon v-show="caption" class="q-mr-sm" :class="iconColor" name="las la-exclamation-circle" size="28px"></q-icon>
@@ -26,7 +26,7 @@
         </div>
 
         <!--------------------------------------------------->
-        <div v-show="type == 'confirm'" class="dialog column bg-white no-wrap" style="min-height: 150px">
+        <div v-show="type == 'confirm'" class="dialog column bg-white no-wrap" :style="dialogStyle">
             <div class="header row">
                 <div class="caption col row items-center q-ml-md">
                     <q-icon v-show="caption" class="q-mr-sm" :class="iconColor" name="las la-exclamation-circle" size="28px"></q-icon>
@@ -50,7 +50,7 @@
         </div>
 
         <!--------------------------------------------------->
-        <div v-show="type == 'prompt'" class="dialog column bg-white no-wrap" style="min-height: 250px">
+        <div v-show="type == 'prompt'" class="dialog column bg-white no-wrap" :style="dialogStyle">
             <div class="header row">
                 <div class="caption col row items-center q-ml-md">
                     <q-icon v-show="caption" class="q-mr-sm" :class="iconColor" name="las la-exclamation-circle" size="28px"></q-icon>
@@ -99,6 +99,7 @@ class StdDialog extends Vue {
     inputValue = '';
     error = '';
     iconColor = '';
+    style = '';
 
     created() {
         if (this.$root.addKeyHook) {
@@ -117,11 +118,15 @@ class StdDialog extends Vue {
         this.error = '';
 
         this.iconColor = 'text-warning';
-        if (opts && opts.type) {
-            this.iconColor = `text-${opts.type}`;
+        if (opts && opts.color) {
+            this.iconColor = `text-${opts.color}`;
         }
     }
 
+    get dialogStyle() {
+        return 'min-height: 150px';
+    }
+
     onHide() {
         if (this.hideTrigger) {
             this.hideTrigger();