Просмотр исходного кода

updated ViewObject namespaces dropdown

Piotr Labudda 9 лет назад
Родитель
Сommit
bb68bdccd1
2 измененных файлов с 30 добавлено и 10 удалено
  1. 1 2
      SE/se-lib/Route/ViewObject.php
  2. 29 8
      SE/se-lib/Route/ViewObject.php.instancesDropdown.js

+ 1 - 2
SE/se-lib/Route/ViewObject.php

@@ -191,7 +191,7 @@ class Route_ViewObject extends Route_ViewTableAjax {
 					}, $items)
 				]);
 				echo UI::h('style', ['type' => "text/css"], "
-					.p5UI__dropdown-content { min-width:400px; padding:8px; background-color: #f6f6f6; box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2) }
+					.p5UI__dropdown-content { min-width:400px; border:1px solid #ccc; background-color: #fff; box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2) }
 					.p5UI__dropdown-content .p5UI__dropdown-item { display:block; color:#000; padding:4px; text-decoration:none }
 					.p5UI__dropdown-content .p5UI__dropdown-item:hover { background-color:#ebebeb }
 				");
@@ -374,7 +374,6 @@ class Route_ViewObject extends Route_ViewTableAjax {
 	}
 
 	public function setInstanceAjaxAction() {
-		sleep(3); // TODO: DBG
 		Response::sendTryCatchJson(array($this, 'setInstanceAjax'), $args = 'JSON_FROM_REQUEST_BODY');
 	}
 	public function setInstanceAjax($args) {

+ 29 - 8
SE/se-lib/Route/ViewObject.php.instancesDropdown.js

@@ -166,33 +166,54 @@ var buildDropdown = function(pk) {
   )
 
   var render = function () {
+    // <div class="popover fade right in" role="tooltip" style="max-width: 600px; width: 400px; display: block; top: 281.5px; left: 68px;" id="popover623735">
+    //   <div class="arrow" style="top: 53.5px;"></div>
+    //   <div style="display:block;position:relative;">
+    //     <div class="popover-title">Więcej funkcji dla rekordu nr 163</div>
+    //     <button type="button" class="close" onclick="return hidePopover();" style="position:absolute;right:8px;top:6px;">×</button>
+    //   </div>
+    //   <div class="popover-content">
+    //     <ul class="list-unstyled popoverRowFunctions">
+    //       <li><a href="index.php?_route=TableMsgs&amp;_task=tableRow&amp;idTable=25873&amp;idRow=163" style="margin:0 2px;" title="Wiadomości" class="func_name-msgs"><span class="glyphicon glyphicon-envelope"></span> Wiadomości</a></li>
+    //       <li><a href="#HIST/163" style="margin:0 2px;" title="Historia" class="func_name-hist"><span class="glyphicon glyphicon-book"></span> Historia</a></li>
+    //     </ul>
+    //     <div class="popoverCellContent" style="white-space:normal">
+    //       <p class="text-muted">Pobieranie funkcji...</p><p></p>
+    //     </div>
+    //   </div>
+    // </div>
     var state = store.getState()
     if(DBG)console.log('RX:render()...')
     if (!_dropdownNode) return // throw 'Missing dropdownNode'
     if (!_btnNode) return // throw 'Missing btnNode'
     ReactDOM.render(
-      h('div', {}, [].concat(
+      h('div', {}, [
+        h('div', { style: { backgroundColor: '#f7f7f7', padding: '8px', borderBottom: '1px solid #ddd' } }, [
           h('input', { type: 'text',
             placeholder: 'Szukaj...',
-            className: 'p5UI__dropdown-input',
+            className: 'p5UI__dropdown-input input-sm',
             onChange: function (e) { store.dispatch({ type: 'filter', payload: e.target.value }); },
             autoFocus: true,
             value: state.query,
           })
-        ).concat(
+        ]),
+        h('div', { style: { backgroundColor: '#fff', padding: '0' } },
           state.filter.map(function (inst) {
-            return h('div', { className: 'p5UI__dropdown-item', style: {padding: '4px 0'} }, [
+            return h('div', { className: 'p5UI__dropdown-item', style: {padding: '8px'} }, [
               _renderReactBtnToggleInstance({ namespace: inst.namespace, store: store }),
               inst.label,
             ])
           })
-        )
-      ),
+        ),
+      ]),
       _dropdownNode
     );
     setTimeout(function () {
-      if (_dropdownNode.firstChild && _dropdownNode.firstChild.firstChild)
-        _dropdownNode.firstChild.firstChild.focus()
+      if (!_dropdownNode) return false
+      if (!_dropdownNode.firstChild) return false
+      if (!_dropdownNode.firstChild.firstChild) return false
+      if (!_dropdownNode.firstChild.firstChild.firstChild) return false
+      _dropdownNode.firstChild.firstChild.firstChild.focus()
     }, 100)
   }
   var _renderReactBtnToggleInstance = function (props) {