Commit 0e4e96932435f74ec8d772f7a71a97275e7e2cd9
1 parent
039b775f
Exists in
master
FWK-223: Atualizar o arquétipo com os novos experimentos
Task-Url: https://demoiselle.atlassian.net/browse/FWK-223
Showing
3 changed files
with
16 additions
and
14 deletions
Show diff stats
archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/js/controller/bookmark-edit.js
| @@ -3,7 +3,7 @@ $(function() { | @@ -3,7 +3,7 @@ $(function() { | ||
| 3 | $("#description").focus(); | 3 | $("#description").focus(); |
| 4 | 4 | ||
| 5 | if (id = App.getUrlParameterByName('id')) { | 5 | if (id = App.getUrlParameterByName('id')) { |
| 6 | - BookmarkProxy.load(id).done(loadOk).fail(loadFailed); | 6 | + BookmarkProxy.load(id).done(loadOk).fail(loadFail); |
| 7 | } | 7 | } |
| 8 | 8 | ||
| 9 | MetadataProxy.getDemoiselleVersion().done(function(data) { | 9 | MetadataProxy.getDemoiselleVersion().done(function(data) { |
| @@ -21,9 +21,9 @@ $(function() { | @@ -21,9 +21,9 @@ $(function() { | ||
| 21 | }; | 21 | }; |
| 22 | 22 | ||
| 23 | if (id = $("#id").val()) { | 23 | if (id = $("#id").val()) { |
| 24 | - BookmarkProxy.update(id, data).done(saveOk).fail(saveFailed); | 24 | + BookmarkProxy.update(id, data).done(saveOk).fail(saveFail); |
| 25 | } else { | 25 | } else { |
| 26 | - BookmarkProxy.insert(data).done(saveOk).fail(saveFailed); | 26 | + BookmarkProxy.insert(data).done(saveOk).fail(saveFail); |
| 27 | } | 27 | } |
| 28 | }); | 28 | }); |
| 29 | 29 | ||
| @@ -49,8 +49,8 @@ function loadOk(data) { | @@ -49,8 +49,8 @@ function loadOk(data) { | ||
| 49 | $("#delete").show(); | 49 | $("#delete").show(); |
| 50 | } | 50 | } |
| 51 | 51 | ||
| 52 | -function loadFailed(request) { | ||
| 53 | - switch (request.status) { | 52 | +function loadFail(jqXHR) { |
| 53 | + switch (jqXHR.status) { | ||
| 54 | case 404: | 54 | case 404: |
| 55 | bootbox.alert("Você está tentando acessar um registro inexistente!", function() { | 55 | bootbox.alert("Você está tentando acessar um registro inexistente!", function() { |
| 56 | location.href = "bookmark-list.html"; | 56 | location.href = "bookmark-list.html"; |
| @@ -62,18 +62,18 @@ function loadFailed(request) { | @@ -62,18 +62,18 @@ function loadFailed(request) { | ||
| 62 | } | 62 | } |
| 63 | } | 63 | } |
| 64 | 64 | ||
| 65 | -function saveOk(data) { | 65 | +function saveOk() { |
| 66 | location.href = 'bookmark-list.html'; | 66 | location.href = 'bookmark-list.html'; |
| 67 | } | 67 | } |
| 68 | 68 | ||
| 69 | -function saveFailed(request) { | ||
| 70 | - switch (request.status) { | 69 | +function saveFail(jqXHR) { |
| 70 | + switch (jqXHR.status) { | ||
| 71 | case 422: | 71 | case 422: |
| 72 | $($("form input").get().reverse()).each(function() { | 72 | $($("form input").get().reverse()).each(function() { |
| 73 | var id = $(this).attr('id'); | 73 | var id = $(this).attr('id'); |
| 74 | var message = null; | 74 | var message = null; |
| 75 | 75 | ||
| 76 | - $.each(request.responseJSON, function(index, value) { | 76 | + $.each(jqXHR.responseJSON, function(index, value) { |
| 77 | if (id == value.property) { | 77 | if (id == value.property) { |
| 78 | message = value.message; | 78 | message = value.message; |
| 79 | return; | 79 | return; |
| @@ -94,6 +94,6 @@ function saveFailed(request) { | @@ -94,6 +94,6 @@ function saveFailed(request) { | ||
| 94 | } | 94 | } |
| 95 | } | 95 | } |
| 96 | 96 | ||
| 97 | -function removeOk(data) { | 97 | +function removeOk() { |
| 98 | location.href = 'bookmark-list.html'; | 98 | location.href = 'bookmark-list.html'; |
| 99 | } | 99 | } |
archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/js/controller/home.js
| 1 | $(function() { | 1 | $(function() { |
| 2 | - MetadataProxy.getDemoiselleVersion().done(function(data) { | ||
| 3 | - $("#demoiselle-version").html(data); | ||
| 4 | - }); | 2 | + MetadataProxy.getDemoiselleVersion().done(getVersionOk); |
| 5 | }); | 3 | }); |
| 4 | + | ||
| 5 | +function getVersionOk(data) { | ||
| 6 | + $("#demoiselle-version").html(data); | ||
| 7 | +} |
archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/js/controller/login.js
| @@ -26,7 +26,7 @@ function loginOk(data, textStatus, jqXHR) { | @@ -26,7 +26,7 @@ function loginOk(data, textStatus, jqXHR) { | ||
| 26 | App.restoreSavedLocation(); | 26 | App.restoreSavedLocation(); |
| 27 | } | 27 | } |
| 28 | 28 | ||
| 29 | -function loginFail(jqXHR, textStatus, errorThrown) { | 29 | +function loginFail(jqXHR) { |
| 30 | switch (jqXHR.status) { | 30 | switch (jqXHR.status) { |
| 31 | case 401: | 31 | case 401: |
| 32 | $("#global-message").html(jqXHR.responseText).show(); | 32 | $("#global-message").html(jqXHR.responseText).show(); |