Converted "My Profile" page to Bootstrap with some JavaScript form validation. Also removed some no longer used pages.
Project: http://git-wip-us.apache.org/repos/asf/roller/repo Commit: http://git-wip-us.apache.org/repos/asf/roller/commit/8da2fc0b Tree: http://git-wip-us.apache.org/repos/asf/roller/tree/8da2fc0b Diff: http://git-wip-us.apache.org/repos/asf/roller/diff/8da2fc0b Branch: refs/heads/bootstrap-ui Commit: 8da2fc0b26a07220046e385fe63081a594b8cd98 Parents: 31e8022 Author: Dave Johnson <[email protected]> Authored: Sun Jun 5 15:15:45 2016 -0400 Committer: Dave Johnson <[email protected]> Committed: Sun Jun 5 15:15:45 2016 -0400 ---------------------------------------------------------------------- .../resources/ApplicationResources.properties | 6 +- .../main/webapp/WEB-INF/jsps/core/Profile.jsp | 192 +++++++++++-------- .../webapp/WEB-INF/jsps/editor/CategoryEdit.jsp | 72 ------- .../WEB-INF/jsps/editor/CategoryRemove.jsp | 51 ----- .../webapp/WEB-INF/jsps/editor/FolderEdit.jsp | 59 ------ .../WEB-INF/jsps/tiles/tiles-simplepage.jsp | 14 +- app/src/main/webapp/WEB-INF/tiles.xml | 26 +-- 7 files changed, 131 insertions(+), 289 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/roller/blob/8da2fc0b/app/src/main/resources/ApplicationResources.properties ---------------------------------------------------------------------- diff --git a/app/src/main/resources/ApplicationResources.properties b/app/src/main/resources/ApplicationResources.properties index f24c31f..4d7fdbb 100644 --- a/app/src/main/resources/ApplicationResources.properties +++ b/app/src/main/resources/ApplicationResources.properties @@ -1338,6 +1338,8 @@ userSettings.tip.username=Usernames can''t be changed. # ----------------------------------------------------------------- Your profile (profile.jsp) yourProfile.title=Your Profile +yourProfile.passwordsNotSame=Password and Password (confirm) do not match +yourProfile.requiredFields=Screen name, full name and email are required # ------------------------------------------------------------------- User admin @@ -1791,8 +1793,8 @@ yourWebsites.createWeblog=Create new weblog yourWebsites.createWeblog.desc=\ Feel like you''ve got more to say? Maybe another weblog is what you need. -yourWebsites.editProfile=Edit user profile -yourWebsites.editProfile.desc=Change user info, locale, timezone. +yourWebsites.editProfile=Update your user info including password, email, locale and timezone. +yourWebsites.editProfile.desc=Change user info, password, timezone yourWebsites.oauthKeys=OAuth Credentials yourWebsites.oauthKeys.desc=Enable other sites and programs to access your \ http://git-wip-us.apache.org/repos/asf/roller/blob/8da2fc0b/app/src/main/webapp/WEB-INF/jsps/core/Profile.jsp ---------------------------------------------------------------------- diff --git a/app/src/main/webapp/WEB-INF/jsps/core/Profile.jsp b/app/src/main/webapp/WEB-INF/jsps/core/Profile.jsp index c0c3e13..fd21232 100644 --- a/app/src/main/webapp/WEB-INF/jsps/core/Profile.jsp +++ b/app/src/main/webapp/WEB-INF/jsps/core/Profile.jsp @@ -17,7 +17,7 @@ --%> <%@ include file="/WEB-INF/jsps/taglibs-struts2.jsp" %> -<p class="subtitle"><s:text name="userAdmin.title.editUser" /></p> +<p class="subtitle"><s:text name="userAdmin.title.editUser"/></p> <s:if test="authMethod == 'DB_OPENID'"> <p class="pagetip"> @@ -25,83 +25,117 @@ </p> </s:if> -<s:form action="profile!save"> - <s:hidden name="salt" /> - - <table class="formtable"> - - <tr> - <td class="label"><label for="userName" /><s:text name="userSettings.username" /></label></td> - <td class="field"><s:textfield name="bean.userName" size="30" maxlength="30" readonly="true" cssStyle="background: #e5e5e5" /></td> - <td class="description"><s:text name="userSettings.tip.username" /></td> - </tr> - - <tr> - <td class="label"><label for="screenName" /><s:text name="userSettings.screenname" /></label></td> - <td class="field"><s:textfield name="bean.screenName" size="30" maxlength="30" /></td> - <td class="description"><s:text name="userRegister.tip.screenName" /></td> - </tr> - - <tr> - <td class="label"><label for="fullName" /><s:text name="userSettings.fullname" /></label></td> - <td class="field"><s:textfield name="bean.fullName" size="30" maxlength="30" /></td> - <td class="description"><s:text name="userRegister.tip.fullName" /></td> - </tr> - - <tr> - <td class="label"><label for="emailAddress" /><s:text name="userSettings.email" /></label></td> - <td class="field"><s:textfield name="bean.emailAddress" size="40" maxlength="40" /></td> - <td class="description"><s:text name="userRegister.tip.email" /></td> - </tr> - - <s:if test="authMethod == 'ROLLERDB' || authMethod == 'DB_OPENID'"> - <tr> - <td class="label"><label for="passwordText" /><s:text name="userSettings.password" /></label></td> - <td class="field"> - <s:password name="bean.passwordText" size="20" maxlength="20" /> - </td> - <td class="description"><s:text name="userRegister.tip.password" /></td> - </tr> - - <tr> - <td class="label"><label for="passwordConfirm" /><s:text name="userSettings.passwordConfirm" /></label></td> - <td class="field"><s:password name="bean.passwordConfirm" size="20" maxlength="20" /></td> - <td class="description"><s:text name="userRegister.tip.passwordConfirm" /></td> - </tr> - </s:if> - <s:else> - <s:hidden name="bean.password" /> - </s:else> - - <s:if test="authMethod == 'OPENID' || authMethod == 'DB_OPENID'"> - <tr> - <td class="label"><label for="openIdUrl" /><s:text name="userSettings.openIdUrl" /></label></td> - <td class="field"><s:textfield name="bean.openIdUrl" size="40" maxlength="255" style="width:75%" id="f_openid_identifier" /></td> - <td class="description"><s:text name="userRegister.tip.openIdUrl" /></td> - </tr> - </s:if> - - <tr> - <td class="label"><label for="locale" /><s:text name="userSettings.locale" /></label></td> - <td class="field"> - <s:select name="bean.locale" size="1" list="localesList" listValue="displayName" /> - </td> - <td class="description"><s:text name="userRegister.tip.locale" /></td> - </tr> - - <tr> - <td class="label"><label for="timeZone" /><s:text name="userSettings.timeZone" /></label></td> - <td class="field"> - <s:select name="bean.timeZone" size="1" list="timeZonesList" /> - </td> - <td class="description"><s:text name="userRegister.tip.timeZone" /></td> - </tr> - - </table> - - <br /> - - <s:submit value="%{getText('generic.save')}" /> - <input type="button" value="<s:text name="generic.cancel"/>" onclick="window.location='<s:url action="menu"/>'" /> + +<s:form action="profile!save" theme="bootstrap" cssClass="form-horizontal"> + <s:hidden name="salt"/> + + <s:textfield label="%{getText('userSettings.username')}" + tooltip="%{getText('userRegister.tip.userName')}" + onchange="formChanged()" onkeyup="formChanged()" + name="bean.userName" size="30" maxlength="30" readonly="true" /> + + <s:textfield label="%{getText('userSettings.screenname')}" + tooltip="%{getText('userRegister.tip.screenName')}" + onchange="formChanged()" onkeyup="formChanged()" + name="bean.screenName" size="30" maxlength="30"/> + + <s:textfield label="%{getText('userSettings.fullname')}" + tooltip="%{getText('')}" + onchange="formChanged()" onkeyup="formChanged()" + name="bean.fullName" size="30" maxlength="30"/> + + <s:textfield label="%{getText('userSettings.email')}" + tooltip="%{getText('userRegister.tip.email')}" + onchange="formChanged()" onkeyup="formChanged()" + name="bean.emailAddress" size="40" maxlength="40"/> + + <s:if test="authMethod == 'ROLLERDB' || authMethod == 'DB_OPENID'"> + <s:password label="%{getText('userSettings.password')}" + tooltip="%{getText('userRegister.tip.password')}" + onchange="formChanged()" onkeyup="formChanged()" + name="bean.passwordText" size="20" maxlength="20"/> + + <s:password label="%{getText('userSettings.passwordConfirm')}" + tooltip="%{getText('userRegister.tip.passwordConfirm')}" + onchange="formChanged()" onkeyup="formChanged()" + name="bean.passwordConfirm" size="20" maxlength="20"/> + </s:if> + <s:else> + <s:hidden name="bean.password"/> + </s:else> + + <s:if test="authMethod == 'OPENID' || authMethod == 'DB_OPENID'"> + <s:textfield label="%{getText('userSettings.openIdUrl')}" + tooltip="%{getText('userRegister.tip.openIdUrl')}" + name="bean.openIdUrl" size="40" maxlength="255" + style="width:75%" id="f_openid_identifier"/> + </s:if> + + <s:select label="%{getText('userSettings.locale')}" + tooltip="%{getText('userRegister.tip.locale')}" + name="bean.locale" size="1" list="localesList" listValue="displayName"/> + + <s:select label="%{getText('userSettings.timeZone')}" + tooltip="%{getText('userRegister.tip.timeZone')}" + name="bean.timeZone" size="1" list="timeZonesList"/> + + <s:submit cssClass="btn btn-default" value="%{getText('generic.save')}"/> + + <input class="btn" type="button" value="<s:text name="generic.cancel"/>" + onclick="window.location='<s:url action="menu"/>'"/> </s:form> + +<script> + + var saveButton; + + $( document ).ready(function() { + saveButton = $("#profile_0"); + formChanged(); + }); + + function formChanged() { + var valid = false; + + var screenName = $("#profile_bean_screenName:first").val(); + var fullName = $("#profile_bean_fullName:first").val(); + var email = $("#profile_bean_emailAddress:first").val(); + var password = $("#profile_bean_passwordText:first").val(); + var passwordConfirm = $("#profile_bean_passwordConfirm:first").val(); + + if ( screenName && screenName.trim().length > 0 + && fullName && fullName.trim().length > 0 + && email && fullName.trim().length > 0 && validateEmail(email) ) { + valid = true; + + } else { + saveButton.attr("disabled", true); + saveButton.addClass("btn-danger"); + return; + } + + if ( (password && password.trim().length) || (passwordConfirm && passwordConfirm.trim().length > 0 )) { + if ( password != passwordConfirm ) { + saveButton.attr("disabled", true ); + saveButton.addClass("btn-danger"); + return; + } + } + + if ( valid ) { + saveButton.attr("disabled", false); + saveButton.removeClass("btn-danger"); + } + + } + + function validateEmail(email) { + var re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; + return re.test(email); + } + + +</script> + + http://git-wip-us.apache.org/repos/asf/roller/blob/8da2fc0b/app/src/main/webapp/WEB-INF/jsps/editor/CategoryEdit.jsp ---------------------------------------------------------------------- diff --git a/app/src/main/webapp/WEB-INF/jsps/editor/CategoryEdit.jsp b/app/src/main/webapp/WEB-INF/jsps/editor/CategoryEdit.jsp deleted file mode 100644 index c57c59a..0000000 --- a/app/src/main/webapp/WEB-INF/jsps/editor/CategoryEdit.jsp +++ /dev/null @@ -1,72 +0,0 @@ -<%-- - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. The ASF licenses this file to You - under the Apache License, Version 2.0 (the "License"); you may not - use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. For additional information regarding - copyright in this work, please see the NOTICE file in the top level - directory of this distribution. ---%> -<%@ include file="/WEB-INF/jsps/taglibs-struts2.jsp" %> - -<%-- Titling, processing actions different between add and edit --%> -<s:if test="actionName == 'categoryEdit'"> - <s:set var="subtitleKey">categoryForm.edit.subtitle</s:set> - <s:set var="mainAction">categoryEdit</s:set> -</s:if> -<s:else> - <s:set var="subtitleKey">categoryForm.add.subtitle</s:set> - <s:set var="mainAction">categoryAdd</s:set> -</s:else> - -<p class="subtitle"> - <s:text name="%{#subtitleKey}" /> -</p> - -<p class="pagetip"> - <s:text name="categoryForm.requiredFields"> - <s:param><s:text name="generic.name"/></s:param> - </s:text> -</p> - -<s:form action="categoryEdit!save"> - <s:hidden name="salt" /> - <s:hidden name="weblog" /> - <s:if test="actionName == 'categoryEdit'"> - <%-- bean for add does not have a bean id yet --%> - <s:hidden name="bean.id" /> - </s:if> - - <table> - - <tr> - <td><s:text name="generic.name" /></td> - <td><s:textfield name="bean.name" size="70" maxlength="255" style="width:50%"/></td> - </tr> - - <tr> - <td><s:text name="generic.description" /></td> - <td><s:textfield name="bean.description" size="120" style="width:50%"/></td> - </tr> - - <tr> - <td><s:text name="categoryForm.image" /></td> - <td><s:textfield name="bean.image" size="120" style="width:50%"/></td> - </tr> - - </table> - - <p> - <s:submit value="%{getText('generic.save')}" action="%{#mainAction}!save"/> - <s:submit value="%{getText('generic.cancel')}" action="categoryEdit!cancel" /> - </p> - -</s:form> http://git-wip-us.apache.org/repos/asf/roller/blob/8da2fc0b/app/src/main/webapp/WEB-INF/jsps/editor/CategoryRemove.jsp ---------------------------------------------------------------------- diff --git a/app/src/main/webapp/WEB-INF/jsps/editor/CategoryRemove.jsp b/app/src/main/webapp/WEB-INF/jsps/editor/CategoryRemove.jsp deleted file mode 100644 index 43da075..0000000 --- a/app/src/main/webapp/WEB-INF/jsps/editor/CategoryRemove.jsp +++ /dev/null @@ -1,51 +0,0 @@ -<%-- - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. The ASF licenses this file to You - under the Apache License, Version 2.0 (the "License"); you may not - use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. For additional information regarding - copyright in this work, please see the NOTICE file in the top level - directory of this distribution. ---%> -<%@ include file="/WEB-INF/jsps/taglibs-struts2.jsp" %> - -<h3> - <s:text name="categoryDeleteOK.removeCategory" /> - [<s:property value="category.name" />] -</h3> - -<s:form action="categoryRemove!remove"> - <s:hidden name="salt" /> - <s:hidden name="weblog" /> - <s:hidden name="removeId" /> - - <s:if test="category.inUse" > - <br /> - <span class="warning"> - <s:text name="categoryDeleteOK.warningCatInUse" /> - </span> - <p><s:text name="categoryDeleteOK.youMustMoveEntries" /><p> - <s:text name="categoryDeleteOK.moveToWhere" /> - <s:select name="targetCategoryId" list="allCategories" listKey="id" listValue="name" /> - </p> - </s:if> - <s:else> - <p><s:text name="categoryDeleteOK.noEntriesInCat" /></p> - </s:else> - - <p> - <strong><s:text name="categoryDeleteOK.areYouSure" /></strong> - </p> - - <s:submit value="%{getText('generic.yes')}" /> - <s:submit value="%{getText('generic.no')}" action="categoryRemove!cancel" /> - -</s:form> http://git-wip-us.apache.org/repos/asf/roller/blob/8da2fc0b/app/src/main/webapp/WEB-INF/jsps/editor/FolderEdit.jsp ---------------------------------------------------------------------- diff --git a/app/src/main/webapp/WEB-INF/jsps/editor/FolderEdit.jsp b/app/src/main/webapp/WEB-INF/jsps/editor/FolderEdit.jsp deleted file mode 100644 index f7eda18..0000000 --- a/app/src/main/webapp/WEB-INF/jsps/editor/FolderEdit.jsp +++ /dev/null @@ -1,59 +0,0 @@ -<%-- - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. The ASF licenses this file to You - under the Apache License, Version 2.0 (the "License"); you may not - use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. For additional information regarding - copyright in this work, please see the NOTICE file in the top level - directory of this distribution. ---%> -<%@ include file="/WEB-INF/jsps/taglibs-struts2.jsp" %> - -<%-- Titling, processing actions different between add and edit --%> -<s:if test="actionName == 'folderEdit'"> - <s:set var="subtitleKey">folderForm.edit.subtitle</s:set> - <s:set var="mainAction">folderEdit</s:set> -</s:if> -<s:else> - <s:set var="subtitleKey">folderForm.add.subtitle</s:set> - <s:set var="mainAction">folderAdd</s:set> -</s:else> - - -<p class="subtitle"> - <s:text name="%{#subtitleKey}" > - <s:param value="folder.name" /> - </s:text> -</p> - -<s:form> - <s:hidden name="salt" /> - <s:hidden name="weblog" /> - <%-- folderId needed on cancel to determine folder to return to (see struts.xml) --%> - <s:hidden name="folderId" value="%{folderId}" /> - <s:if test="actionName == 'folderEdit'"> - <%-- bean for folder add does not have a bean id yet --%> - <s:hidden name="bean.id" /> - </s:if> - - <table> - <tr> - <td><s:text name="generic.name" /></td> - <td><s:textfield name="bean.name" size="70" maxlength="255" /></td> - </tr> - </table> - - <p> - <s:submit value="%{getText('generic.save')}" action="%{#mainAction}!save"/> - <s:submit value="%{getText('generic.cancel')}" action="folderEdit!cancel" /> - </p> - -</s:form> http://git-wip-us.apache.org/repos/asf/roller/blob/8da2fc0b/app/src/main/webapp/WEB-INF/jsps/tiles/tiles-simplepage.jsp ---------------------------------------------------------------------- diff --git a/app/src/main/webapp/WEB-INF/jsps/tiles/tiles-simplepage.jsp b/app/src/main/webapp/WEB-INF/jsps/tiles/tiles-simplepage.jsp index bbbcc09..1446961 100644 --- a/app/src/main/webapp/WEB-INF/jsps/tiles/tiles-simplepage.jsp +++ b/app/src/main/webapp/WEB-INF/jsps/tiles/tiles-simplepage.jsp @@ -32,9 +32,17 @@ <tiles:insertAttribute name="banner"/> <tiles:insertAttribute name="bannerStatus"/> -<h1 class="roller-page-title"><s:property value="pageTitle"/></h1> -<tiles:insertAttribute name="messages"/> -<tiles:insertAttribute name="content"/> +<div class="col-md-8 roller-column-left"> + <div class="row"> + <h1 class="roller-page-title"><s:property value="pageTitle"/></h1> + <tiles:insertAttribute name="messages"/> + <div class="panel"> + <div class="panel-body"> + <tiles:insertAttribute name="content"/> + </div> + </div> + </div> +</div> </body> </html> http://git-wip-us.apache.org/repos/asf/roller/blob/8da2fc0b/app/src/main/webapp/WEB-INF/tiles.xml ---------------------------------------------------------------------- diff --git a/app/src/main/webapp/WEB-INF/tiles.xml b/app/src/main/webapp/WEB-INF/tiles.xml index c9ef523..ba7f365 100644 --- a/app/src/main/webapp/WEB-INF/tiles.xml +++ b/app/src/main/webapp/WEB-INF/tiles.xml @@ -311,38 +311,18 @@ <put-attribute name="sidebar" value="/WEB-INF/jsps/editor/CategoriesSidebar.jsp" /> <put-attribute name="styles" value="/WEB-INF/jsps/tiles/empty.jsp" /> </definition> - - <definition name=".CategoryEdit" extends=".tiles-tabbedpage" > - <put-attribute name="content" value="/WEB-INF/jsps/editor/CategoryEdit.jsp" /> - <put-attribute name="styles" value="/WEB-INF/jsps/tiles/empty.jsp" /> - </definition> - - <definition name=".CategoryRemove" extends=".tiles-tabbedpage" > - <put-attribute name="content" value="/WEB-INF/jsps/editor/CategoryRemove.jsp" /> - <put-attribute name="styles" value="/WEB-INF/jsps/tiles/empty.jsp" /> - </definition> - + <definition name=".Bookmarks" extends=".tiles-tabbedpage" > <put-attribute name="content" value="/WEB-INF/jsps/editor/Bookmarks.jsp" /> <put-attribute name="sidebar" value="/WEB-INF/jsps/tiles/empty.jsp" /> <put-attribute name="styles" value="/WEB-INF/jsps/tiles/empty.jsp" /> </definition> - - <definition name=".BookmarkEdit" extends=".tiles-tabbedpage" > - <put-attribute name="content" value="/WEB-INF/jsps/editor/BookmarkEdit.jsp" /> - <put-attribute name="styles" value="/WEB-INF/jsps/tiles/empty.jsp" /> - </definition> - + <definition name=".BookmarksImport" extends=".tiles-tabbedpage" > <put-attribute name="content" value="/WEB-INF/jsps/editor/BookmarksImport.jsp" /> <put-attribute name="styles" value="/WEB-INF/jsps/tiles/empty.jsp" /> </definition> - - <definition name=".FolderEdit" extends=".tiles-tabbedpage" > - <put-attribute name="content" value="/WEB-INF/jsps/editor/FolderEdit.jsp" /> - <put-attribute name="styles" value="/WEB-INF/jsps/tiles/empty.jsp" /> - </definition> - + <definition name=".Resources" extends=".tiles-tabbedpage" > <put-attribute name="content" value="/WEB-INF/jsps/editor/Resources.jsp" /> </definition>
