r1937 - in trunk/wao-web/src/main: resources/i18n webapp webapp/WEB-INF/content/obsmer
Author: bleny Date: 2014-05-14 10:13:27 +0200 (Wed, 14 May 2014) New Revision: 1937 Url: http://forge.codelutin.com/projects/wao/repository/revisions/1937 Log: refs #4487 use select2 for observers selection, show hide some form parts when necessary Modified: trunk/wao-web/src/main/resources/i18n/wao-web_en_GB.properties trunk/wao-web/src/main/resources/i18n/wao-web_fr_FR.properties trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/edit-contact-input.jsp trunk/wao-web/src/main/webapp/wao.js Modified: trunk/wao-web/src/main/resources/i18n/wao-web_en_GB.properties =================================================================== --- trunk/wao-web/src/main/resources/i18n/wao-web_en_GB.properties 2014-05-13 15:10:44 UTC (rev 1936) +++ trunk/wao-web/src/main/resources/i18n/wao-web_en_GB.properties 2014-05-14 08:13:27 UTC (rev 1937) @@ -218,7 +218,7 @@ wao.ui.field.Contact.restitution=Restitution wao.ui.field.Contact.sampleRow=Sample row wao.ui.field.Contact.samplingStrategy=Sampling strategy followed -wao.ui.field.Contact.secondaryObservers=Observers +wao.ui.field.Contact.secondaryObservers=Secondary observers wao.ui.field.Contact.terrestrialLocation=Observation's place wao.ui.field.Contact.validationCompany=Company validation wao.ui.field.Contact.validationProgram=Program validation Modified: trunk/wao-web/src/main/resources/i18n/wao-web_fr_FR.properties =================================================================== --- trunk/wao-web/src/main/resources/i18n/wao-web_fr_FR.properties 2014-05-13 15:10:44 UTC (rev 1936) +++ trunk/wao-web/src/main/resources/i18n/wao-web_fr_FR.properties 2014-05-14 08:13:27 UTC (rev 1937) @@ -218,7 +218,7 @@ wao.ui.field.Contact.restitution=Transmission de la restitution wao.ui.field.Contact.sampleRow=Ligne du plan wao.ui.field.Contact.samplingStrategy=Stratégie d'échantillonnage suivie -wao.ui.field.Contact.secondaryObservers=Observateurs +wao.ui.field.Contact.secondaryObservers=Observateurs secondaires wao.ui.field.Contact.terrestrialLocation=Lieu d'observation wao.ui.field.Contact.validationCompany=Validation société wao.ui.field.Contact.validationProgram=Validation programme Modified: trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/edit-contact-input.jsp =================================================================== --- trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/edit-contact-input.jsp 2014-05-13 15:10:44 UTC (rev 1936) +++ trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/edit-contact-input.jsp 2014-05-14 08:13:27 UTC (rev 1937) @@ -35,6 +35,35 @@ $(document).ready(function () { + var $mammalsCaptureCheckbox = $('#mammalsCaptureCheckbox'); + var $mammalsInfo = $('#mammalsInfo'); + + var showHideMammalsInfo = function () { + if ($mammalsCaptureCheckbox.prop('checked')) { + $mammalsInfo.show(); + } else { + $mammalsInfo.hide(); + } + }; + + $mammalsCaptureCheckbox.change(showHideMammalsInfo); + showHideMammalsInfo(); + + var $contactStateMotif = $('#contactStateMotif'); + var $contactStateSelect = $('select[name="updateContactCommand.contact.contactState"]'); + + var showHideContactStateMotif = function () { + var contactState = $contactStateSelect.val(); + if (contactState === 'CONTACT_REFUSED' || contactState == 'CONTACT_DEFINITELY_REFUSED') { + $contactStateMotif.show(); + } else { + $contactStateMotif.hide(); + } + }; + + $contactStateSelect.change(showHideContactStateMotif); + showHideContactStateMotif(); + }); </script> @@ -159,7 +188,9 @@ label="%{getText('wao.ui.field.Contact.mainObserver')}" list="observers" emptyOption="true" - disabled="%{!#editObservers}"/> + disabled="%{!#editObservers}" + cssClass="select2 input-large" + /> <s:if test="authenticatedWaoUser.isAuthorizedToDisplayContactSecondaryObservers(updateContactCommand.contact)"> <s:select name="updateContactCommand.contact.secondaryObservers" @@ -167,7 +198,9 @@ label="%{getText('wao.ui.field.Contact.secondaryObservers')}" list="observers" multiple="true" - disabled="%{!#editObservers}"/> + disabled="%{!#editObservers}" + cssClass="select2 input-xlarge" + /> </s:if> </fieldset> @@ -195,30 +228,33 @@ list="contactStates" disabled="%{!#editObservationReport}"/> - <s:select name="updateContactCommand.contact.contactStateMotif" - value="%{updateContactCommand.contact.contactState.topiaId}" - label="%{getText('wao.ui.field.Contact.contactStateMotif')}" - list="contactStateMotives" - emptyOption="true" - disabled="%{!#editObservationReport}"/> + <div id="contactStateMotif"> + <s:select name="updateContactCommand.contact.contactStateMotif" + value="%{updateContactCommand.contact.contactState.topiaId}" + label="%{getText('wao.ui.field.Contact.contactStateMotif')}" + list="contactStateMotives" + emptyOption="true" + disabled="%{!#editObservationReport}"/> + </div> <s:checkbox name="updateContactCommand.contact.mammalsObservation" label="%{getText('wao.ui.field.Contact.mammalsObservation')}" disabled="%{!#editObservationReport}"/> <s:checkbox name="updateContactCommand.contact.mammalsCapture" + id="mammalsCaptureCheckbox" label="%{getText('wao.ui.field.Contact.mammalsCapture')}" disabled="%{!#editObservationReport}"/> - <%--TODO onclick="updateMammalsInfoBox(this);" />--%> - <%--<span style="color: red;">--%> - <%--<s:text name="wao.ui.page.ContactForm.mammalsInfo.disclaimer"/>--%> - <%--</span>--%> + <div id="mammalsInfo"> + <s:textarea name="updateContactCommand.contact.mammalsInfo" + label="%{getText('wao.ui.field.Contact.mammalsInfo')}" + disabled="%{!#editObservationReport}"/> + <div class="alert"> + <s:text name="wao.ui.page.ContactForm.mammalsInfo.disclaimer"/> + </div> + </div> - <s:textarea name="updateContactCommand.contact.mammalsInfo" - label="%{getText('wao.ui.field.Contact.mammalsInfo')}" - disabled="%{!#editObservationReport}"/> - <s:textfield name="updateContactCommand.contact.dataInputDate" label="%{getText('wao.ui.field.Contact.dataInputDate')}" placeholder="%{getDatePlaceholder()}" Modified: trunk/wao-web/src/main/webapp/wao.js =================================================================== --- trunk/wao-web/src/main/webapp/wao.js 2014-05-13 15:10:44 UTC (rev 1936) +++ trunk/wao-web/src/main/webapp/wao.js 2014-05-14 08:13:27 UTC (rev 1937) @@ -270,6 +270,7 @@ // FIXME brendan 07/04/14 cannot enable select2 because we can't bind blur event without driving the application crazy, see https://github.com/ivaynberg/select2/issues/2193 //$('select').addClass('input-xlarge').select2(); + $('select.select2').select2(); WAO = new Wao();
participants (1)
-
bleny@users.forge.codelutin.com