Author: bleny Date: 2014-10-07 11:10:44 +0200 (Tue, 07 Oct 2014) New Revision: 2280 Url: http://forge.codelutin.com/projects/wao/repository/revisions/2280 Log: On utilise le cookie wao pour stocker le choix de la vue compacte/?\195?\169tendu dans le plan obsvente et dans les contacts (refs #5746) Modified: trunk/wao-web/src/main/java/fr/ifremer/wao/web/WaoJspActionSupport.java trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/ContactsAction.java trunk/wao-web/src/main/webapp/WEB-INF/content/contacts.jsp trunk/wao-web/src/main/webapp/WEB-INF/content/obsvente/sampling-plan.jsp Modified: trunk/wao-web/src/main/java/fr/ifremer/wao/web/WaoJspActionSupport.java =================================================================== --- trunk/wao-web/src/main/java/fr/ifremer/wao/web/WaoJspActionSupport.java 2014-10-07 08:56:34 UTC (rev 2279) +++ trunk/wao-web/src/main/java/fr/ifremer/wao/web/WaoJspActionSupport.java 2014-10-07 09:10:44 UTC (rev 2280) @@ -173,10 +173,16 @@ return fullView; } + public boolean isContactsListFullViewByDefault() { + boolean fullView = getAuthenticatedWaoUser().isAdmin() || getAuthenticatedWaoUser().isProfessional(); + return fullView; + } + public ImmutableMap<String, Object> getDefaultCookie() { return ImmutableMap.of( "version", (Object) "4.2", - "samplingPlanFullView", isSamplingPlanFullViewByDefault() + "samplingPlanFullView", isSamplingPlanFullViewByDefault(), + "contactsListFullView", isContactsListFullViewByDefault() ); } Modified: trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/ContactsAction.java =================================================================== --- trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/ContactsAction.java 2014-10-07 08:56:34 UTC (rev 2279) +++ trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/ContactsAction.java 2014-10-07 09:10:44 UTC (rev 2280) @@ -168,11 +168,6 @@ return placeholder; } - public boolean isFullView() { - boolean fullView = getAuthenticatedWaoUser().isAdmin() || getAuthenticatedWaoUser().isProfessional(); - return fullView; - } - public String getMammalsInfo(Contact contact) { return escapeForToolTip(contact.getMammalsInfo()); } Modified: trunk/wao-web/src/main/webapp/WEB-INF/content/contacts.jsp =================================================================== --- trunk/wao-web/src/main/webapp/WEB-INF/content/contacts.jsp 2014-10-07 08:56:34 UTC (rev 2279) +++ trunk/wao-web/src/main/webapp/WEB-INF/content/contacts.jsp 2014-10-07 09:10:44 UTC (rev 2280) @@ -156,6 +156,14 @@ $('table.contacts-list').toggleClass('full-view').toggleClass('compact-view'); }); + var $views = $('#switch-compact-full-view, table.contacts-list'); + $views.toggleCompactFullView(WAO.getCookie().contactsListFullView); + + $('#switch-compact-full-view').click(function () { + WAO.getCookie().contactsListFullView = ! WAO.getCookie().contactsListFullView; + $views.toggleCompactFullView(WAO.getCookie().contactsListFullView); + }); + $('.validation-action').click(function(e) { e.preventDefault(); var $action = $(this); @@ -322,10 +330,8 @@ </div> </s:set> -<s:set var="fullView" value="%{fullView}"/> - <div class="sticky-buttons"> - <button type="button" id="switch-compact-full-view" class="btn <s:if test="fullView">full-view</s:if><s:else>compact-view</s:else>"> + <button type="button" id="switch-compact-full-view" class="btn"> <span class="only-in-compact-view"> <i class="fa fa-expand"></i><span class="only-on-hover"> <s:text name="wao.ui.action.switchToFullView" /></span> </span> @@ -338,7 +344,7 @@ <s:property value="#pagination" escapeHtml="false"/> -<table id="contacts-list" class="contacts-list large-table table-striped <s:if test="fullView">full-view</s:if><s:else>compact-view</s:else>"> +<table id="contacts-list" class="contacts-list large-table table-striped"> <thead> <tr> <th><s:text name="wao.ui.field.Contact.creationDate"/></th> Modified: trunk/wao-web/src/main/webapp/WEB-INF/content/obsvente/sampling-plan.jsp =================================================================== --- trunk/wao-web/src/main/webapp/WEB-INF/content/obsvente/sampling-plan.jsp 2014-10-07 08:56:34 UTC (rev 2279) +++ trunk/wao-web/src/main/webapp/WEB-INF/content/obsvente/sampling-plan.jsp 2014-10-07 09:10:44 UTC (rev 2280) @@ -96,9 +96,12 @@ $('.estimated-differ-from-real').effect( "highlight", "slow" ) }); + var $views = $('#switch-compact-full-view, table.sampling-plan'); + $views.toggleCompactFullView(WAO.getCookie().samplingPlanFullView); + $('#switch-compact-full-view').click(function () { - $('#switch-compact-full-view').toggleClass('full-view').toggleClass('compact-view'); - $('table.sampling-plan').toggleClass('full-view').toggleClass('compact-view'); + WAO.getCookie().samplingPlanFullView = ! WAO.getCookie().samplingPlanFullView; + $views.toggleCompactFullView(WAO.getCookie().samplingPlanFullView); }); }); @@ -162,7 +165,7 @@ </s:form> <div class="sticky-buttons"> - <button type="button" id="switch-compact-full-view" class="btn <s:if test="fullView">full-view</s:if><s:else>compact-view</s:else>"> + <button type="button" id="switch-compact-full-view" class="btn"> <span class="only-in-compact-view"> <i class="fa fa-expand"></i><span class="only-on-hover"> <s:text name="wao.ui.action.switchToFullView" /></span> </span> @@ -184,7 +187,6 @@ </div> <s:set var="estimatedTides" value="true" /> -<s:set var="fullView" value="%{fullView}" /> <s:set var="displayTidesReal" value="true" /> <s:if test="authenticatedWaoUser.authorizedToViewOtherCompanies"> @@ -199,7 +201,7 @@ <s:set var="nbColumnsTotalInFullView" value="%{#nbColumnsForProfessionInFullView + #nbColumnsForMonths + #nbColumnsForOther}" /> <s:set var="nbColumnsTotalInCompactView" value="%{#nbColumnsForProfessionInCompactView + #nbColumnsForMonths + #nbColumnsForOther}" /> - <table id="sampling-plan" class="large-table sampling-plan show-estimated <s:if test="fullView">full-view</s:if><s:else>compact-view</s:else>"> + <table id="sampling-plan" class="large-table sampling-plan show-estimated"> <thead> <tr> <th colspan="<s:property value="#nbColumnsForProfessionInFullView" />" class="only-in-full-view firstline">