From 0e47cd46ec1c59993e38b81fba46f808414a6f94 Mon Sep 17 00:00:00 2001 From: Cleverson Sacramento Date: Thu, 30 Apr 2015 15:25:44 -0300 Subject: [PATCH] FWK-223: Atualizar o arquétipo com os novos experimentos --- archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/bookmark-edit.html | 12 ++++-------- archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/home.html | 4 ++-- archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/js/controller/menu.js | 21 ++++++++++++++++----- archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/js/proxy/auth.js | 5 ++++- archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/menu.html | 10 ++++++---- 5 files changed, 32 insertions(+), 20 deletions(-) diff --git a/archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/bookmark-edit.html b/archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/bookmark-edit.html index ab08c85..872a630 100644 --- a/archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/bookmark-edit.html +++ b/archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/bookmark-edit.html @@ -15,17 +15,14 @@
- - +
- - +
@@ -41,7 +38,6 @@ - @@ -49,4 +45,4 @@ - + \ No newline at end of file diff --git a/archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/home.html b/archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/home.html index acd18bc..e1090b8 100644 --- a/archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/home.html +++ b/archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/home.html @@ -15,8 +15,8 @@

- Bem-vindo à aplicação de exemplo Bookmark usando arquétipo html-rest.
Este é o seu ponto de partida, portanto sinta-se à vontade para - modificar esta aplicação. + Bem-vindo à aplicação de exemplo Bookmark usando arquétipo html-rest.
Este é o seu ponto de partida, + portanto sinta-se à vontade para modificar esta aplicação.

diff --git a/archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/js/controller/menu.js b/archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/js/controller/menu.js index 9f0c409..b58e771 100644 --- a/archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/js/controller/menu.js +++ b/archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/js/controller/menu.js @@ -1,11 +1,22 @@ $(function() { $("#menu").load("menu.html", function() { - $("#username").html(App.auth.getLoggedInUser().name); + if (App.auth.isLoggedIn()) { + $("#username").html(App.auth.getLoggedInUser().name); - $("#logout").click(function(event) { - event.preventDefault(); - AuthProxy.logout().done(logoutOk); - }); + $("#logout").click(function(event) { + event.preventDefault(); + AuthProxy.logout().done(logoutOk); + }); + + $("#logout").parent().show(); + + } else { + $("#login").click(function(event) { + location.href = "login.html"; + }); + + $("#login").parent().show(); + } }); }); diff --git a/archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/js/proxy/auth.js b/archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/js/proxy/auth.js index 8da5f1b..2df9612 100644 --- a/archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/js/proxy/auth.js +++ b/archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/js/proxy/auth.js @@ -15,7 +15,10 @@ var AuthProxy = { logout : function() { return $.ajax({ url : this.url + "/logout", - type : "POST" + type : "POST", + beforeSend : function(jqXHR) { + App.auth.setHeader(jqXHR) + } }); } }; diff --git a/archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/menu.html b/archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/menu.html index 93a168a..cc76c0e 100644 --- a/archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/menu.html +++ b/archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/menu.html @@ -2,14 +2,15 @@
-- libgit2 0.21.2