]> git.nbdom.net Git - nb.git/commitdiff
www/dbq/html/default.js
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Sat, 29 Sep 2018 23:47:21 +0000 (00:47 +0100)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Sat, 29 Sep 2018 23:47:21 +0000 (00:47 +0100)
lib/php/db/field.php
lib/php/db/table.php
lib/php/out.php
lib/php/out/div.php
www/dbq/html/default.css
www/dbq/html/default.js
www/dbq/html/default.min.css

index 578a0b3736ff64ba7e2e943781a2d9e937897a75..32f46499ce91bf2908b2f38fc4bffd984ba71479 100644 (file)
@@ -103,17 +103,14 @@ class field extends nb {
 
     $s_no = $checked = ' checked="checked"';
     if ( ( $s_yes = preg_match('/^(1|yes|on|true)/i',$checked_value) ? $checked : '' ) != '' ) $s_no = '';
+               $name = $this->preffix.$this->name;
 
-    $t1 = 'span'; $t2 = "</$t1>"; $t1 = "<$t1>";
-    #$t1 = "<$t1 id=\"$this->name\">";
-    #$t1 = $t2 = '';
-
-    return $t1
-      .'Yes <input type="radio" class="yes form-control" name="'.$this->preffix.$this->name.'" value="1"'.$s_yes.'>'
-      .' | '
-      .'No <input type="radio" class="no form-control" name="'.$this->preffix.$this->name.'" value="0"'.$s_no.'>'
+    return '<span class="form-check form-check-inline ml-1 mt-1">'
+      .'<input type="radio" class="yes form-check-input" name="'.$name.'" value="1"'.$s_yes.'><label class="form-check-label">Yes</label>'
+                       .'&nbsp;'
+      .'<input type="radio" class="no form-check-input" name="'.$name.'" value="0"'.$s_no.'><label class="form-check-label">No</label>'
       #.'<input type="text" id="'.$this->name.'" style="display:none" value="'.($s_yes ? 1 : 0).'">'
-    .$t2;
+    .'</span>';
 
   }
 
index 8e268439c0e75974cab12d27726a090e130b3e28..15df950505606b628d03eb51cf646c0fa917171a 100644 (file)
@@ -631,7 +631,7 @@ Class Table extends nb {
 
                echo ''
                        #.'<div class="btn-group-vertical mx-auto">'
-                       .'<div class="db buttons btn-group form-group mx-auto d-table bottom">'
+                       .'<div class="db buttons btn-group btn-group-sm form-group mx-auto d-table bottom">'
                        .( empty($_SERVER['HTTP_REFERER']) ? '' : '<input type="button" class="btn btn-danger" onclick="document.location=document.referrer" value="Cancel" />')
                        .'<input class="btn btn-warning" type="reset" />'
                        .'<input class="btn btn-primary" type="submit" />'
@@ -2163,7 +2163,7 @@ Class Table extends nb {
                $buttons = '<div class="btn-group"><input type="submit" class="button button-small btn btn-primary" value="Go"/></div>';
                if (!empty($opt['buttons'])) $buttons = $opt['buttons'];
 
-               $r = '<form class="menu card d-table list-group-item form-inline" id="db-table-html-menu-form" method="get" action="'.$this->request_uri().'">'.NB_EOL;
+               $r = '<form class="menu db-menu card d-table list-group-item form-inline" id="db-table-html-menu-form" method="get" action="'.$this->request_uri().'">'.NB_EOL;
 
                # See: http://html5doctor.com/html5-forms-input-types/
                #$r .= '<input id="skill" type="range" min="1" max="100" value="0" />';
index 6e8eb0f7b136847f14809cd751a06755da3a2c0b..10730504b658e757fdca44f17d4333060f918112 100644 (file)
@@ -498,17 +498,17 @@ Class Out extends Nb {
     self::row_parse($row,$o);
     foreach ($row as $k => $v) {
 
-      if (isset($o['tag_val'])) {
+      if (!empty($o['tag_val'])) {
         $v = '<'.$o['tag_val'].'>'.$v.'</'.preg_replace('/ .*$/','',$o['tag_val']).'>';
       }
 
       # Inside tag, ex: label
-      if (isset($o['tag_key'])) {
+      if (!empty($o['tag_key'])) {
         $v = '<'.$o['tag_key'].'>'.$k.'</'.preg_replace('/ .*$/','',$o['tag_key']).'>'.$v;
       }
 
       # Tag = o[tag] or key
-      if (isset($o['tag'])) {
+      if (!empty($o['tag'])) {
         $class = is_numeric($k) ? '' : ' class="'.$k.'"';
         $k = $o['tag'];
       } else {
index faf21721f0036e514510e33637b8079485e2aab0..38d3e73cbb576991f842bf7ca32f3261f64c1061 100644 (file)
@@ -2,10 +2,11 @@
 return [
   'is_html' => true,
   'enclose' => ["<div class=\"db-rows\">".NB_EOL,"</div>".NB_EOL],
-  'tag_enclose' => 'div class="db-row"',
-  'tag' => 'div',
+  'tag_enclose' => 'div class="db-row border rounded p-2 my-2"',
+  'tag' => 'div class="row"',
   'row' => 'out_tag',
-  'tag_key' => 'label',
-  'tag_val' => 'span',
+  'tag_key' => 'label class="col col-lg-1"',
+  'tag_val' => 'div   class="col col-lg-11"',
+  #'tag_val' => 'span',
 ];
 ?>
index 5eb0ec031f64815082fa14f8ad7fc69d1c4b0aa9..d6ba18b6c8564f8584006b4e2eac40f43f6842ec 100644 (file)
@@ -327,6 +327,10 @@ body.loader {
        display: none !important;
 }
 
+body {
+       font-size: 0.9rem;
+       line-height: 1.2;
+}
 h1 {
        margin: 0 0 0.2em 0;
        font-size: 140%;
index 5f4c4e0d04dca70043687944b50d6e215a6a0884..cf35857f68463108e33fbd5d59404235659e4501 100644 (file)
@@ -11,9 +11,18 @@ document.addEventListener("DOMContentLoaded", function() {
        document.querySelectorAll("form").forEach(function(e) {
                e.onsubmit = function() {
                        if (this.elements['limit']) {
-                                       var limit = this.elements['limit'];
-                                       if (window._dbq['default_limit'] != 'undefined' && limit.value == window._dbq['default_limit']) limit.removeAttribute("value");
+                               var limit = this.elements['limit'];
+                               if (window._dbq['default_limit'] != 'undefined' && limit.value == window._dbq['default_limit']) limit.removeAttribute("value");
                        }
+                       // NB 30.09.18: TODO 
+                       /*
+                       if (this.elements['format']) {
+                               this.elements['format'].removeAttribute('name');
+                               var ex = '';
+                               if (ex != window._dbq['default.format'] && ex != 'html') ex = '.'+this.elements['format']
+                               this.form.setAttribute('action',window._dbq['table.base']+ex);
+                       }
+                       */
                        return form_submit_clean(this);
                };
        });
@@ -25,16 +34,18 @@ document.addEventListener("DOMContentLoaded", function() {
                form.setAttribute('action',window.location.toString().replace(/\?.*$/,''));
 
                /* Format */
-               form.querySelectorAll("form.menu select.format").forEach(function(e) {
+               form.querySelectorAll("form.menu select[name=format]").forEach(function(e) {
                        e.removeAttribute('name');
                        e.onchange = function() {
-                               this.form.setAttribute('action',window._dbq['table.base']+'.'+this.value);
+                               var ex = '';
+                               if (ex != window._dbq['default.format'] && ex != 'html') ex = '.'+this.value
+                               this.form.setAttribute('action',window._dbq['table.base']+ex);
                                return this.form.onsubmit();
                        }
                });
 
                /* Table */
-               form.querySelectorAll("form.menu select.tables").forEach(function(e) {
+               form.querySelectorAll("form.menu select[name=table]").forEach(function(e) {
                        e.removeAttribute('name');
                        e.onchange = function() {
                                this.form.setAttribute('action',window._dbq['db.base']+'/'+this.value+ext);
index ee71ab9da9853e26b9ef0dac3028cbeffcdf5c2e..63ec449366e1865ac311d27d4b397f74f7101241 100644 (file)
@@ -1 +1 @@
-@keyframes spin{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}.loader{border:16px solid #fff;border-radius:50%;border-top:16px solid #000;padding:0;margin:0 auto 0 auto;width:8em;height:8em;animation:spin 2s linear infinite;display:block}body.loader{margin-top:8em}.loader *{display:none!important}h1{margin:0 0 .2em 0;font-size:140%;padding-bottom:.3em;margin-bottom:.5em}.menu *{font-size:90%}.menu .btn,.menu .form-control{max-width:5rem;height:1.7rem;padding-top:0;padding-bottom:0}
+@keyframes spin{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}.loader{border:16px solid #fff;border-radius:50%;border-top:16px solid #000;padding:0;margin:0 auto 0 auto;width:8em;height:8em;animation:spin 2s linear infinite;display:block}body.loader{margin-top:8em}.loader *{display:none!important}body{font-size:.9rem;line-height:1.2}h1{margin:0 0 .2em 0;font-size:140%;padding-bottom:.3em;margin-bottom:.5em}.menu *{font-size:90%}.menu .btn,.menu .form-control{max-width:5rem;height:1.7rem;padding-top:0;padding-bottom:0}