From 3efcac6d72f4f59e8ceb33bdcfdb04799c4c71ca Mon Sep 17 00:00:00 2001 From: lahiru Date: Wed, 9 Mar 2016 12:27:55 +0530 Subject: [PATCH 1/5] Add to favourit css issues fixed --- .../themes/store/js/logic/myapp/myapp.js | 33 ++++++------- .../store/partials/page-content-myapps.hbs | 49 ++++++++----------- .../store/partials/ribbons/favorite.hbs | 2 +- 3 files changed, 36 insertions(+), 48 deletions(-) diff --git a/features/org.wso2.carbon.appmgt.store.feature/src/main/resources/store/themes/store/js/logic/myapp/myapp.js b/features/org.wso2.carbon.appmgt.store.feature/src/main/resources/store/themes/store/js/logic/myapp/myapp.js index 43b5750d1..d25160af3 100644 --- a/features/org.wso2.carbon.appmgt.store.feature/src/main/resources/store/themes/store/js/logic/myapp/myapp.js +++ b/features/org.wso2.carbon.appmgt.store.feature/src/main/resources/store/themes/store/js/logic/myapp/myapp.js @@ -57,7 +57,6 @@ $( document ).ready(function() { appData['provider'] = $(this).data("provider"); appData['storeTenantDomain'] = storeTenantDomain; - $(this).hide(); var waitIconId = '#wait-' + appId; $(waitIconId).show(); @@ -77,7 +76,6 @@ $( document ).ready(function() { appData['provider'] = $(this).data("provider"); appData['storeTenantDomain'] = storeTenantDomain; - $(this).hide(); var waitIconId = '#wait-' + appId; $(waitIconId).show(); @@ -87,8 +85,6 @@ $( document ).ready(function() { var addToFavourite = function (data, appId) { var waitIconId = '#wait-' + appId; - var rmvIconId = '#rmv-' + appId; - var addIconId = '#add-' + appId; $.ajax({ url: API_ADD_TO_FAVOURITE, dataType: 'JSON', @@ -97,13 +93,17 @@ $( document ).ready(function() { success: function (response, textStatus, xhr) { if (response.error == false) { $(waitIconId).hide(); - $(rmvIconId).show(); var message = 'You have successfully added ' + data.name + ' to your favourite apps'; notify(message); + + document.getElementById("favRibbon-" + appId).style.visibility = "visible"; + document.getElementById("listItemAddFavorite-" + appId).className = ""; + document.getElementById("listItemAddFavorite-" + appId).classList.add("display-none-lg"); + document.getElementById("listItemRmvFavorite-" + appId).className = ""; + document.getElementById("listItemRmvFavorite-" + appId).classList.add("display-block-lg"); } else { $(waitIconId).hide(); - $(addIconId).show(); var message = 'Error occured in while adding web app: ' + data.name + ' to my favourite web apps'; notify(message); @@ -112,7 +112,6 @@ $( document ).ready(function() { }, error: function (response) { $(waitIconId).hide(); - $(addIconId).show(); if (response.status == 401) { var message = 'Your session has time out.Please login again'; notify(message); @@ -127,9 +126,6 @@ $( document ).ready(function() { var removeFromFavourite = function (data, appId) { var waitIconId = '#wait-' + appId; - var rmvIconId = '#rmv-' + appId; - var addIconId = '#add-' + appId; - $.ajax({ url: API_REMOVE_FROM_FAVOURITE, type: 'POST', @@ -137,29 +133,30 @@ $( document ).ready(function() { success: function (response, textStatus, xhr) { if (response.error == false) { $(waitIconId).hide(); - $(addIconId).show(); var message = 'You have successfully removed ' + data.name - + ' from your favourite apps'; + + ' from your favourite apps'; notify(message); - $('#btnRemoveFromFav').hide(); - $('#btnAddToFav').show(); + + document.getElementById("favRibbon-" + appId).style.visibility = "hidden"; + document.getElementById("listItemRmvFavorite-" + appId).className = ""; + document.getElementById("listItemRmvFavorite-" + appId).classList.add("display-none-lg"); + document.getElementById("listItemAddFavorite-" + appId).className = ""; + document.getElementById("listItemAddFavorite-" + appId).classList.add("display-block-lg"); } else { $(waitIconId).hide(); - $(rmvIconId).show(); var message = 'Error occured when remove web app: ' + data.name - + ' from my favourite web apps'; + + ' from my favourite web apps'; notify(message); } }, error: function (response) { $(waitIconId).hide(); - $(rmvIconId).show(); if (response.status == 401) { var message = 'Your session has time out.Please login again'; notify(message); } else { var message = 'Error occured when remove web app: ' + data.name - + ' from my favourite web apps'; + + ' from my favourite web apps'; notify(message); } } diff --git a/features/org.wso2.carbon.appmgt.store.feature/src/main/resources/store/themes/store/partials/page-content-myapps.hbs b/features/org.wso2.carbon.appmgt.store.feature/src/main/resources/store/themes/store/partials/page-content-myapps.hbs index 14455e287..d0b3ea950 100644 --- a/features/org.wso2.carbon.appmgt.store.feature/src/main/resources/store/themes/store/partials/page-content-myapps.hbs +++ b/features/org.wso2.carbon.appmgt.store.feature/src/main/resources/store/themes/store/partials/page-content-myapps.hbs @@ -8,13 +8,10 @@ data-name="{{attributes.overview_name}}" data-version="{{attributes.overview_version}}" data-context="{{attributes.overview_context}}" class="hover-overlay-container">
- {{#if isFavourite}} - {{> ribbons/favorite}} - {{else}} - {{#ifCond attributes.overview_advertiseOnly "==" "true"}} - {{> ribbons/advertise}} - {{/ifCond}} - {{/if}} + {{> ribbons/favorite}} + {{#ifCond attributes.overview_advertiseOnly "==" "true"}} + {{> ribbons/advertise}} + {{/ifCond}} {{#ifCond lifecycleState "==" "DEPRECATED"}} {{> ribbons/deprecated}} {{/ifCond}} @@ -52,23 +49,20 @@