From 42b970f5e4cab8794c00e3389515e72865796be8 Mon Sep 17 00:00:00 2001 From: lusabo Date: Tue, 1 Jul 2014 09:55:06 -0300 Subject: [PATCH] Nome do usuário aparecendo no menu. --- archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/css/bookmark.css | 2 +- 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/index.html | 2 +- archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/js/controller/login.js | 2 +- archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/js/controller/menu.js | 4 +--- 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 | 2 +- 7 files changed, 11 insertions(+), 10 deletions(-) diff --git a/archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/css/bookmark.css b/archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/css/bookmark.css index 8accfad..184c4a3 100644 --- a/archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/css/bookmark.css +++ b/archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/css/bookmark.css @@ -1,7 +1,7 @@ body { padding-top: 20px; padding-bottom: 20px; - margin-top: 60px; + margin-top: 20px; } input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button { 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 0962de1..3e99b4d 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 @@ -21,8 +21,8 @@ - - + + \ No newline at end of file diff --git a/archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/index.html b/archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/index.html index db6afcc..68fd478 100644 --- a/archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/index.html +++ b/archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/index.html @@ -1,5 +1,5 @@ - + \ No newline at end of file diff --git a/archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/js/controller/login.js b/archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/js/controller/login.js index 9995307..9e37c0a 100644 --- a/archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/js/controller/login.js +++ b/archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/js/controller/login.js @@ -25,7 +25,7 @@ function make_base_auth(user, password) { function loginOk(data) { sessionStorage.setItem('credentials', make_base_auth($("#username").val().trim(), $("#password").val().trim())); - location.href = "bookmark-list.html"; + location.href = "home.html"; } function loginFail(request) { 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 970626d..e7e8be6 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,9 @@ $(function() { - AuthProxy.getUser(getUserOk, getUserFailed); - }); function getUserOk(data){ - console.log('getUserOk'); + $("#username").html(data.username); } function getUserFailed(request){ 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 c156cf4..2504cca 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 @@ -27,7 +27,10 @@ AuthProxy.getUser = function($success, $error) { url : this.url, type : "GET", success : $success, - error : $error + error : $error, + beforeSend : function(xhr) { + xhr.setRequestHeader("Authorization", AuthProxy.getCredentials()); + } }); }; 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 a703381..e71bc52 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 @@ -24,7 +24,7 @@ -- libgit2 0.21.2