Browse Source

Merge pull request #72 from synrc/comboLookupText_adjacent

adjacent
TotallyNotMay 4 years ago
parent
commit
313de35ff0
4 changed files with 6 additions and 49 deletions
  1. 1 1
      mix.exs
  2. 0 24
      priv/js/comboLookup.js
  3. 4 23
      src/elements/combo/element_comboLookupText.erl
  4. 1 1
      src/nitro.app.src

+ 1 - 1
mix.exs

@@ -4,7 +4,7 @@ defmodule NITRO.Mixfile do
   def project do
     [
       app: :nitro,
-      version: "6.5.0",
+      version: "6.6.0",
       description: "NITRO Nitrogen Web Framework",
       package: package(),
       deps: deps()

+ 0 - 24
priv/js/comboLookup.js

@@ -16,30 +16,6 @@ function comboSelect(dom, row, feed, mod, id) {
                  atom(mod)));
 }
 
-function displayTextarea(parent, input, textarea) {
-  const value = querySourceRaw(input);
-  let parentDom = qi(parent);
-  let textareaDom = qi(textarea);
-  if (parentDom && textareaDom) {
-    parentDom.style.display = 'none';
-    textareaDom.style.display = 'flex';
-    textareaDom.children[0].value = value.text ? value.text :
-                                    typeof value === 'string' ? value : "";
-  }
-}
-
-function hideTextarea(parent, input, textarea) {
-  let parentDom = qi(parent);
-  let inputDom = qi(input)
-  let textareaDom = qi(textarea);
-  if (parentDom && textareaDom && inputDom) {
-    parentDom.style.display = 'flex';
-    const value = textareaDom.children[0].value;
-    inputDom.value = value ? value : "";
-    textareaDom.style.display = 'none';
-  }
-}
-
 function comboLookupChange(dom) {
   let elem = qi(dom);
   if (elem && elem.value == "" && elem.getAttribute("data-bind")) {

+ 4 - 23
src/elements/combo/element_comboLookupText.erl

@@ -8,11 +8,6 @@ render_element(#comboLookupText{id=Id, input=Input, disabled=Disabled, validatio
   LookupId = "wrap_" ++ Id ++ "_lookup",
   TextareaId = "wrap_" ++ Id ++ "_textarea",
   WrapId = "wrap_" ++ Id ++ "_comboLookupText",
-  TextAreaDisplay =
-    case Disabled of
-      true -> "flex";
-      _ -> "none"
-    end,
   nitro:render(
         #panel{
           id = WrapId,
@@ -25,23 +20,9 @@ render_element(#comboLookupText{id=Id, input=Input, disabled=Disabled, validatio
               body =
                 case Disabled of
                   true -> [];
-                  _ -> [
-                    Input,
-                    #link{
-                      class = [button, sgreen],
-                      style = "min-width: 40px; text-align: center; height: fit-content; margin-left: 5px;",
-                      onclick = nitro:jse("displayTextarea('" ++ LookupId ++ "', '" ++ InputId ++ "', '" ++ TextareaId ++ "')"),
-                      body = <<"+">>} ] end },
+                  _ -> [Input]
+                end},
             #panel{
               id = TextareaId,
-              style = "width: 100%; justify-content: center; display: " ++ TextAreaDisplay ++ ";",
-              body = [
-                Textarea |
-                case Disabled of
-                  true -> [];
-                  false ->
-                    [#link{
-                      class = [button, sgreen, back],
-                      style = "min-width: 40px; text-align: center; height: fit-content; margin-left: 5px;",
-                      onclick = nitro:jse("hideTextarea('" ++ LookupId ++ "', '" ++ InputId ++ "', '" ++ TextareaId ++ "')"),
-                      body = <<"+">>}] end]}]}).
+              style = "display: flex; width: 100%; justify-content: center;",
+              body = [Textarea]}]}).

+ 1 - 1
src/nitro.app.src

@@ -1,6 +1,6 @@
 {application, nitro, [
     {description,  "NITRO Nitrogen Web Framework"},
-    {vsn,          "6.5.0"},
+    {vsn,          "6.6.0"},
     {applications, [kernel, stdlib]},
     {modules, []},
     {registered,   []},