Explorar o código

updated procesEditor

Piotr Labudda %!s(int64=9) %!d(string=hai) anos
pai
achega
1db3b2d1e1
Modificáronse 2 ficheiros con 71 adicións e 39 borrados
  1. 24 1
      SE/se-lib/Route/UrlAction/ProcesEditor.php
  2. 47 38
      SE/static/procesEditor.js

+ 24 - 1
SE/se-lib/Route/UrlAction/ProcesEditor.php

@@ -357,6 +357,9 @@ width:290px;
     .drop {
         margin-top: 10px;
     }
+		.sdesc{
+			margin-bottom:10px;
+		}
     .hdesc textarea,
     .sdesc textarea {
         min-width: 100%;
@@ -364,9 +367,15 @@ width:290px;
     }
     .step,
     .sDescAdd {
+				margin-top:5px;
         color: grey;
         cursor: pointer;
+				display:block;
     }
+
+		.sDescAdd:hover{
+			color:black;
+		}
 		.goto{
 
 		}
@@ -379,7 +388,6 @@ width:290px;
     }
     .hDescAdd {
         cursor: pointer;
-        color: grey;
     }
     #saveBtn {} .changable {
         padding-left: 10px;
@@ -394,6 +402,21 @@ width:290px;
 
     }
 
+		.liRes:hover{
+			background-color:#fafafa;
+		}
+
+		span.glyphicon{
+			opacity:0.6;
+			cursor:pointer;
+			margin-left:3px;
+
+		}
+
+		span.glyphicon:hover{
+			opacity:1;
+		}
+
 		.delRes:hover{
 			color:red;
 		}

+ 47 - 38
SE/static/procesEditor.js

@@ -579,7 +579,7 @@ $(document).ready(function() {
             type = "res";
 
 
-        var id = getResById(parent, $(this).parent().data("id"), type);
+        var id = getResById(parent, $(this).closest("li").data("id"), type);
         //alert(id);
         arraymove(state[parent][type], id, id + 1);
         updateAll();
@@ -739,9 +739,8 @@ $(document).ready(function() {
         if ($(action).find("textarea").length == 0) {
 
             //alert($(action).text());
-            $(action).empty();
-            $(action).append("<textarea placeholder='Opis kroku'></textarea>");
-            $(this).remove();
+            $(action).html("<textarea placeholder='Opis kroku'>"+$(action).text()+"</textarea>");
+
             selectedArea = $(action).find("textarea");
             return false;
         }
@@ -753,13 +752,13 @@ $(document).ready(function() {
             return;
 
         var action = $(this).parents(".drop").find(".hdesc");
-
+        console.log(action);
         if ($(action).find("textarea").length == 0) {
 
             //alert($(action).text());
-            $(action).empty();
-            $(action).append("<textarea placeholder='Tytuł kroku'></textarea>");
-            $(this).remove();
+
+            $(action).html("<textarea placeholder='Tytuł kroku'>"+$(action).text()+"</textarea>");
+
             selectedArea = $(action).find("textarea");
             return false;
         }
@@ -1509,7 +1508,7 @@ $(document).ready(function() {
         console.log(arr);
         $.each(arr, function(i, e) {
             result += "<div class='drop container-fluid' data-id=" + e["id"] + " id='proc" + e["id"] + "'>";
-            result += "<div class='col-xs-1 options' id=opt" + e["id"] + ">";
+            result += "<div class='col-xs-1 options' style=text-align:right;padding-top:2px; id=opt" + e["id"] + ">";
             if (i > 0) {
                 result += "<span class='glyphicon glyphicon-remove-sign ico del' title='Usuń krok' aria-hidden='true'></span>";
                 //Arrows
@@ -1524,13 +1523,15 @@ $(document).ready(function() {
 
                 if (i != state.length - 1)
                     result += "<span class='glyphicon glyphicon-arrow-down ico dArrow' aria-hidden='true' title='Przesuń krok w dół'></span>";
-
-
             } else {
-
-
-            }
+      }
+            result += "<span class='hDescAdd glyphicon glyphicon-edit ico' title='Edytuj tytuł'></span>";
             result += "<div class='clearfix'></div>";
+
+            if (e["opis"] == "")
+                result += "<span class=sDescAdd>Dodaj opis</span>";
+            else
+                result += "<span class=sDescAdd>Edytuj opis</span>";
             result += "</div>";
             result += "<div class='col-xs-10 desc' id='desc" + e["id"] + "' ><h4 class='changable " + (e["C-desc"] ? "changed" : "") + "'><span class='stepDesc'>" + e["stepDesc"] + "</span><span class=hdesc>" + e["desc"] + "</span> <span class=ids>{" + (e["id"] >= 0 ? e["id"] : "?") + "}</span></h4><span  class='sdesc changable " + (e["C-opis"] ? "changed" : "") + "'>" + e["opis"] + "</span>";
 
@@ -1542,61 +1543,69 @@ $(document).ready(function() {
             var anyProf = false;
             $.each(e["prof"], function(i2, e2) {
                 if (!anyProf) {
-                    result += "<dl class='dl-horizontal'><dt>Stanowiska</dt><dd><ul class=professions>";
+                    result += "<div class=row><div class=col-sm-2 style=font-size:1.2em;text-align:right;opacity:1>Stanowiska</div></div><ul class=professions style=padding:0;>";
                     anyProf = true;
                 }
-                result += "<li class='" + (e2["changed"] ? "changed" : "") + "' data-zasob=" + e2["id_zasob"] + " data-id=" + e2["id"] + " data-przypadek=" + e2["id_przypadek"] + " data-komentarz='" + e2["komentarz"] + "'><b>" + e2["desc"] + "</b> " + e2["opis"] + " [" + e2["id_zasob"] + "] <span aria-hidden='true' class='glyphicon glyphicon-edit btnEdit' title='Edytuj wskaźnik' style=font-size:12px;></span>  <span class='glyphicon glyphicon-remove-sign delRes' title='Usuń wskaźnik' style=font-size:12px; aria-hidden='true' ></span>";
+
+                result += "<li style=padding-top:5px;paddig-bottom:5px; class='liRes' data-zasob=" + e2["id_zasob"] + " data-id=" + e2["id"] + " data-przypadek=" + e2["id_przypadek"] + " data-komentarz='" + e2["komentarz"] + "'><div class=row>";
+                result += "<div class=col-sm-2 style=text-align:right;>";
                 if (i2 != 0)
                     result += "<span class='glyphicon glyphicon-arrow-up uArrowRes' title='Przesuń wskaźnik w górę' aria-hidden='true'></span>";
                 if (i2 != e["prof"].length - 1)
                     result += "<span class='glyphicon glyphicon-arrow-down dArrowRes' title='Przesuń wskaźnik w dół' aria-hidden='true'></span>";
+                result += "<span aria-hidden='true' class='glyphicon glyphicon-edit btnEdit' title='Edytuj wskaźnik' style=font-size:12px;></span><span class='glyphicon glyphicon-remove-sign delRes' title='Usuń wskaźnik' style=font-size:12px; aria-hidden='true' ></span>";
+                result += "</div>";
+                result += "<div class='col-sm-10 changable " + (e2["changed"] ? "changed" : "") + " '><b>" + e2["desc"] + "</b> " + e2["opis"] + " [" + e2["id_zasob"] + "] </div>";
+
 
-                result += "</li>";
+                result += "</div></li>";
 
             });
             if (anyProf) {
-                result += "</ul></dd></dl>";
+                result += "</ul>";
             }
             var anyRes = false;
             $.each(e["res"], function(i2, e2) {
-                if (!anyRes) {
-                    result += "<dl class='dl-horizontal'><dt>Użyte zasoby</dt><dd><ul class=resources>";
-                    anyRes = true;
-                }
-                result += "<li class='" + (e2["changed"] ? "changed" : "") + "' data-zasob=" + e2["id_zasob"] + " data-id=" + e2["id"] + " data-przypadek=" + e2["id_przypadek"] + " data-komentarz='" + e2["komentarz"] + "'><b>" + e2["desc"] + "</b> " + e2["opis"] + " [" + e2["id_zasob"] + "] <span aria-hidden='true' class='glyphicon glyphicon-edit btnEdit' title='Edytuj wskaźnik' style=font-size:12px;></span>  <span class='glyphicon glyphicon-remove-sign delRes' title='Usuń wskaźnik' style=font-size:12px; aria-hidden='true' ></span>";
-                if (i2 != 0)
-                    result += "<span class='glyphicon glyphicon-arrow-up uArrowRes' title='Przesuń wskaźnik w górę' aria-hidden='true'></span>";
-                if (i2 != e["prof"].length - 1)
-                    result += "<span class='glyphicon glyphicon-arrow-down dArrowRes' title='Przesuń wskaźnik w dół' aria-hidden='true'></span>";
-
-                result += "</li>";
+              if (!anyRes) {
+                  result += "<div class=row><div class=col-sm-2 style=font-size:1.2em;text-align:right;opacity:1>Użyte zasoby</div></div><ul class=resources style=padding:0;>";
+                  anyRes = true;
+              }
+              result += "<li style=padding-top:5px;paddig-bottom:5px; class='liRes' data-zasob=" + e2["id_zasob"] + " data-id=" + e2["id"] + " data-przypadek=" + e2["id_przypadek"] + " data-komentarz='" + e2["komentarz"] + "'><div class=row>";
+              result += "<div class=col-sm-2 style=text-align:right;>";
+              if (i2 != 0)
+                  result += "<span class='glyphicon glyphicon-arrow-up uArrowRes' title='Przesuń wskaźnik w górę' aria-hidden='true'></span>";
+              if (i2 != e["prof"].length - 1)
+                  result += "<span class='glyphicon glyphicon-arrow-down dArrowRes' title='Przesuń wskaźnik w dół' aria-hidden='true'></span>";
+              result += "<span aria-hidden='true' class='glyphicon glyphicon-edit btnEdit' title='Edytuj wskaźnik' style=font-size:12px;></span><span class='glyphicon glyphicon-remove-sign delRes' title='Usuń wskaźnik' style=font-size:12px; aria-hidden='true' ></span>";
+              result += "</div>";
+              result += "<div class='col-sm-10 changable " + (e2["changed"] ? "changed" : "") + " '><b>" + e2["desc"] + "</b> " + e2["opis"] + " [" + e2["id_zasob"] + "] </div>";
+
+
+              result += "</div></li>";
             });
             if (anyRes) {
-                result += "</ul></dd></dl>";
+                result += "</ul>";
             }
             if (typeof e["goto"] !== typeof undefined && e["goto"]["id"] != null && e["goto"]["id"] != 0) {
                 var name;
                 switch (e["goto"]["flag"]) {
                     case "GOTO":
-                        name = "Jeżeli TAK to należy przejść do procesu " + e["goto"]["id"] + ".";
+                        name = "Przejdź do procesu " + e["goto"]["id"] + ".";
                         break;
                     case "GOTO_AND_RETURN":
-                        name = "Jeżeli TAK to należy przejść do procesu " + e["goto"]["id"] + ", a następnie wrócić.";
+                        name = "Przejdź do procesu " + e["goto"]["id"] + ", a następnie wróć.";
                         break;
                     case "FORK":
-                        name = "FORK" + e["goto"]["id"];
+                        name = "&mdash; FORK" + e["goto"]["id"];
                         break;
                     default:
                         name = e["goto"]["id"];
                 }
 
-                result += "<span class=goto>" + name + "</span> <span class='glyphicon glyphicon-remove-sign delGoto' title='Usuń GOTO' style=font-size:12px; aria-hidden='true' ></span><br><br>";
+                result += "<span style=color:grey; class=goto>&mdash; " + name + "</span> <span class='glyphicon glyphicon-remove-sign delGoto' title='Usuń GOTO' style=font-size:12px; aria-hidden='true' ></span>";
             }
 
-            if (e["desc"] == "")
-                result += "<span class=hDescAdd>Dodaj tytuł</span><br>";
-            if (e["opis"] == "")
-                result += "<span class=sDescAdd>Dodaj opis</span>";
+
 
             result += "<br><span class=step>Dodaj nowy krok</span>";
             result += "</div>"