From a24eeb97f47769ef89275da6cc57911cb13daff2 Mon Sep 17 00:00:00 2001 From: Leandro Roberto Date: Thu, 17 Jan 2019 01:39:16 -0200 Subject: [PATCH] ajustes eslint --- sapl-frontend/src/global/functions.js | 177 ++++++++++++++------------ sapl-frontend/src/global/main.js | 6 +- 2 files changed, 100 insertions(+), 83 deletions(-) diff --git a/sapl-frontend/src/global/functions.js b/sapl-frontend/src/global/functions.js index 14b83b257..612acf8db 100644 --- a/sapl-frontend/src/global/functions.js +++ b/sapl-frontend/src/global/functions.js @@ -2,21 +2,20 @@ import $ from "jquery"; window.getCookie = function(name) { var cookieValue = null; - if (document.cookie && document.cookie !== '') { - var cookies = document.cookie.split(';'); + if (document.cookie && document.cookie !== "") { + var cookies = document.cookie.split(";"); for (var i = 0; i < cookies.length; i++) { var cookie = $.trim(cookies[i]); - if (cookie.substring(0, name.length + 1) === (name + '=')) { + if (cookie.substring(0, name.length + 1) === name + "=") { cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); break; } } } return cookieValue; -} +}; window.autorModal = function() { - $(function() { var dialog = $("#modal_autor").dialog({ autoOpen: false, @@ -25,7 +24,8 @@ window.autorModal = function() { height: 340, show: { effect: "blind", - duration: 500}, + duration: 500 + }, hide: { effect: "explode", duration: 500 @@ -33,11 +33,11 @@ window.autorModal = function() { }); $("#button-id-limpar").click(function() { - $("#nome_autor").text(''); + $("#nome_autor").text(""); function clean_if_exists(fieldname) { if ($(fieldname).length > 0) { - $(fieldname).val(''); + $(fieldname).val(""); } } @@ -46,87 +46,104 @@ window.autorModal = function() { }); $("#button-id-pesquisar").click(function() { - $("#q").val(''); - $("#div-resultado").children().remove(); - $("#modal_autor").dialog( "open" ); + $("#q").val(""); + $("#div-resultado") + .children() + .remove(); + $("#modal_autor").dialog("open"); $("#selecionar").attr("hidden", "hidden"); }); $("#pesquisar").click(function() { - var name_in_query = $("#q").val() - //var q_0 = "q_0=nome__icontains" - //var q_1 = name_in_query - //query = q_1 - - $.get("/api/autor?q=" + name_in_query, function(data, status) { - $("#div-resultado").children().remove(); - if (data.pagination.total_entries == 0) { - $("#selecionar").attr("hidden", "hidden"); - $("#div-resultado").html( - "Nenhum resultado"); - return; - } - - var select = $( - '' + ); + + data.results.forEach(function(item) { + select.append( + $("