You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@roller.apache.org by sn...@apache.org on 2017/03/06 01:00:22 UTC
roller git commit: Fix some bugs in the bookmarks page.
Repository: roller
Updated Branches:
refs/heads/bootstrap-ui 525400ba4 -> 5cd3b9be7
Fix some bugs in the bookmarks page.
Project: http://git-wip-us.apache.org/repos/asf/roller/repo
Commit: http://git-wip-us.apache.org/repos/asf/roller/commit/5cd3b9be
Tree: http://git-wip-us.apache.org/repos/asf/roller/tree/5cd3b9be
Diff: http://git-wip-us.apache.org/repos/asf/roller/diff/5cd3b9be
Branch: refs/heads/bootstrap-ui
Commit: 5cd3b9be710e8c2d00c740caa80e3c1c24c999ac
Parents: 525400b
Author: Dave Johnson <sn...@gmail.com>
Authored: Sun Mar 5 20:00:19 2017 -0500
Committer: Dave Johnson <sn...@gmail.com>
Committed: Sun Mar 5 20:00:19 2017 -0500
----------------------------------------------------------------------
.../weblogger/ui/struts2/editor/Bookmarks.java | 7 +-
.../webapp/WEB-INF/jsps/editor/Bookmarks.jsp | 128 ++++++++++++-------
.../WEB-INF/jsps/editor/BookmarksSidebar.jsp | 22 +---
3 files changed, 86 insertions(+), 71 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/roller/blob/5cd3b9be/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/Bookmarks.java
----------------------------------------------------------------------
diff --git a/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/Bookmarks.java b/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/Bookmarks.java
index 6893915..3c06416 100644
--- a/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/Bookmarks.java
+++ b/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/Bookmarks.java
@@ -214,17 +214,16 @@ public class Bookmarks extends UIAction {
public String move() {
try {
- BookmarkManager bmgr = WebloggerFactory.getWeblogger()
- .getBookmarkManager();
+ BookmarkManager bmgr = WebloggerFactory.getWeblogger().getBookmarkManager();
if (log.isDebugEnabled()) {
- log.debug("Moving bookmarks to folder - "
- + getTargetFolderId());
+ log.debug("Moving bookmarks to folder - " + getTargetFolderId());
}
// Move bookmarks to new parent folder.
WeblogBookmarkFolder newFolder = bmgr.getFolder(getTargetFolderId());
String bookmarks[] = getSelectedBookmarks();
+
if (null != bookmarks && bookmarks.length > 0) {
for (int j = 0; j < bookmarks.length; j++) {
WeblogBookmark bd = bmgr.getBookmark(bookmarks[j]);
http://git-wip-us.apache.org/repos/asf/roller/blob/5cd3b9be/app/src/main/webapp/WEB-INF/jsps/editor/Bookmarks.jsp
----------------------------------------------------------------------
diff --git a/app/src/main/webapp/WEB-INF/jsps/editor/Bookmarks.jsp b/app/src/main/webapp/WEB-INF/jsps/editor/Bookmarks.jsp
index c4bcdfd..49db264 100644
--- a/app/src/main/webapp/WEB-INF/jsps/editor/Bookmarks.jsp
+++ b/app/src/main/webapp/WEB-INF/jsps/editor/Bookmarks.jsp
@@ -91,6 +91,7 @@ We used to call them Bookmarks and Folders, now we call them Blogroll links and
</s:if>
<%-- allow user to select the bookmark folder to view --%>
+
<s:select name="viewFolderId" list="allFolders" listKey="id" listValue="name"
label="%{getText('bookmarksForm.switchTo')}" onchange="viewChanged()" onmouseup="viewChanged()"/>
@@ -245,8 +246,8 @@ We used to call them Bookmarks and Folders, now we call them Blogroll links and
// add the "New Blogroll" option to blogroll selectors
viewSelector.append(
new Option('<s:text name="bookmarksForm.newBlogroll"/>', "new_blogroll" ));
- moveToSelector.append(
- new Option( '<s:text name="bookmarksForm.newBlogroll"/>', "new_blogroll" ));
+ //moveToSelector.append(
+ //new Option( '<s:text name="bookmarksForm.newBlogroll"/>', "new_blogroll" ));
});
@@ -349,7 +350,9 @@ We used to call them Bookmarks and Folders, now we call them Blogroll links and
}
function onMoveToFolder() {
- $('#move-links-modal').modal({show: true});
+ var bookmarksForm = $("#bookmarks")[0];
+ bookmarksForm.action = "bookmarks!move.rol";
+ bookmarksForm.submit();
}
function viewChanged() {
@@ -358,14 +361,7 @@ We used to call them Bookmarks and Folders, now we call them Blogroll links and
var folderEditForm = $("#folderEditForm")[0];
if ( "new_blogroll" == bookmarksForm.viewFolderId.value ) {
-
- // user selected New Blogroll option, show the add/edit blogroll modal
- $('#blogroll-edit-title').html('<s:text name="bookmarksForm.addBlogroll.title" />');
-
- folderEditForm.action = "folderAdd!save.rol";
- folderEditForm.actionName.value = "folderAdd";
-
- $('#addedit-bookmarkfolder-modal').modal({show: true});
+ newBlogroll();
} else {
// user changed the blogroll/folder, post to "view" action to get new page
@@ -374,6 +370,21 @@ We used to call them Bookmarks and Folders, now we call them Blogroll links and
}
}
+ function newBlogroll() {
+
+ // user selected New Blogroll option, show the add/edit blogroll modal
+ $('#blogroll-edit-title').html('<s:text name="bookmarksForm.addBlogroll.title" />');
+
+ folderEditForm.action = "folderAdd!save.rol";
+ folderEditForm.actionName.value = "folderAdd";
+
+ // disable save button until valid name is entered
+
+ $('#addedit-bookmarkfolder-modal').modal({show: true});
+
+ onBlogrollFormChanged();
+ }
+
</script>
@@ -392,7 +403,7 @@ We used to call them Bookmarks and Folders, now we call them Blogroll links and
</div>
<div class="modal-body">
- <s:form action="#" id="folderEditForm" theme="bootstrap" cssClass="form-horizontal">
+ <s:form action="blogroll" id="folderEditForm" theme="bootstrap" cssClass="form-horizontal">
<s:hidden name="salt" />
<s:hidden name="actionName" />
<s:hidden name="weblog" />
@@ -401,13 +412,16 @@ We used to call them Bookmarks and Folders, now we call them Blogroll links and
<%-- action needed here because we are using AJAX to post this form --%>
<s:hidden name="action:folderEdit!save" value="save"/>
- <s:textfield name="bean.name" label="%{getText('generic.name')}" maxlength="255"/>
+ <s:textfield name="bean.name" label="%{getText('generic.name')}" maxlength="255"
+ onchange="onBlogrollFormChanged()"
+ onkeyup ="onBlogrollFormChanged()"
+ />
</s:form>
</div> <!-- modal-body-->
<div class="modal-footer">
<p id="feedback-area-blogroll-edit"></p>
- <button onclick="submitEditedBlogroll()" class="btn btn-primary">
+ <button id="save_blogroll" onclick="submitEditedBlogroll()" class="btn btn-primary">
<s:text name="generic.save"/>
</button>
<button type="button" class="btn" data-dismiss="modal">
@@ -425,6 +439,24 @@ We used to call them Bookmarks and Folders, now we call them Blogroll links and
<%-- JavaScript for add/edit blogroll modal --%>
+ function onBlogrollFormChanged() {
+
+ var saveBlogrollButton = $('#save_blogroll:first');
+
+ var name = $('#folderEditForm_bean_name:first').val().trim();
+
+ if (name.length > 0) {
+ saveBlogrollButton.attr("disabled", false);
+ console.log("Button enabled!");
+
+ } else {
+ saveBlogrollButton.attr("disabled", true);
+ console.log("Button disabled!");
+ }
+
+ }
+
+
function submitEditedBlogroll() {
var folderEditForm = $("#folderEditForm")[0];
@@ -590,40 +622,40 @@ We used to call them Bookmarks and Folders, now we call them Blogroll links and
<div class="modal-body">
<s:form action="bookmark" theme="bootstrap" cssClass="form-horizontal">
- <s:hidden name="salt" />
- <s:hidden name="weblog" />
- <%--
- Edit action uses folderId for redirection back to proper bookmarks folder on cancel
- (as configured in struts.xml); add action also, plus to know which folder to put new
- bookmark in.
- --%>
- <s:hidden name="folderId" />
- <s:hidden name="bean.id" />
-
- <s:textfield name="bean.name" maxlength="255"
- onchange="onBookmarkFormChanged()"
- onkeyup ="onBookmarkFormChanged()"
- label="%{getText('generic.name')}" />
-
- <s:textfield name="bean.url" maxlength="255"
- onchange="onBookmarkFormChanged()"
- onkeyup ="onBookmarkFormChanged()"
- label="%{getText('bookmarkForm.url')}" />
-
- <s:textfield name="bean.feedUrl" maxlength="255"
- onchange="onBookmarkFormChanged()"
- onkeyup ="onBookmarkFormChanged()"
- label="%{getText('bookmarkForm.rssUrl')}" />
-
- <s:textfield name="bean.description" maxlength="255"
- onchange="onBookmarkFormChanged()"
- onkeyup ="onBookmarkFormChanged()"
- label="%{getText('generic.description')}" />
-
- <s:textfield name="bean.image" maxlength="255"
- onchange="onBookmarkFormChanged()"
- onkeyup ="onBookmarkFormChanged()"
- label="%{getText('bookmarkForm.image')}" />
+ <s:hidden name="salt" />
+ <s:hidden name="weblog" />
+ <%--
+ Edit action uses folderId for redirection back to proper bookmarks folder on cancel
+ (as configured in struts.xml); add action also, plus to know which folder to put new
+ bookmark in.
+ --%>
+ <s:hidden name="folderId" />
+ <s:hidden name="bean.id" />
+
+ <s:textfield name="bean.name" maxlength="255"
+ onchange="onBookmarkFormChanged()"
+ onkeyup ="onBookmarkFormChanged()"
+ label="%{getText('generic.name')}" />
+
+ <s:textfield name="bean.url" maxlength="255"
+ onchange="onBookmarkFormChanged()"
+ onkeyup ="onBookmarkFormChanged()"
+ label="%{getText('bookmarkForm.url')}" />
+
+ <s:textfield name="bean.feedUrl" maxlength="255"
+ onchange="onBookmarkFormChanged()"
+ onkeyup ="onBookmarkFormChanged()"
+ label="%{getText('bookmarkForm.rssUrl')}" />
+
+ <s:textfield name="bean.description" maxlength="255"
+ onchange="onBookmarkFormChanged()"
+ onkeyup ="onBookmarkFormChanged()"
+ label="%{getText('generic.description')}" />
+
+ <s:textfield name="bean.image" maxlength="255"
+ onchange="onBookmarkFormChanged()"
+ onkeyup ="onBookmarkFormChanged()"
+ label="%{getText('bookmarkForm.image')}" />
</s:form>
</div>
http://git-wip-us.apache.org/repos/asf/roller/blob/5cd3b9be/app/src/main/webapp/WEB-INF/jsps/editor/BookmarksSidebar.jsp
----------------------------------------------------------------------
diff --git a/app/src/main/webapp/WEB-INF/jsps/editor/BookmarksSidebar.jsp b/app/src/main/webapp/WEB-INF/jsps/editor/BookmarksSidebar.jsp
index ea21b7c..cc5b506 100644
--- a/app/src/main/webapp/WEB-INF/jsps/editor/BookmarksSidebar.jsp
+++ b/app/src/main/webapp/WEB-INF/jsps/editor/BookmarksSidebar.jsp
@@ -20,29 +20,13 @@
<h3><s:text name="mainPage.actions"/></h3>
<hr size="1" noshade="noshade"/>
-<%-- Add Bookmark link
<p>
- <s:url var="addBookmark" action="bookmarkAdd">
- <s:param name="weblog" value="%{actionWeblog.handle}"/>
- <s:param name="folderId" value="%{folder.id}"/>
- </s:url>
- <s:a href="%{addBookmark}">
- <span class="glyphicon glyphicon-plus"></span>
- <s:text name="bookmarksForm.addBookmark"/>
- </s:a>
-</p>
---%>
+ <%-- Add Blogroll --%>
-<p>
- <%-- Add Folder link --%>
- <s:url var="addFolder" action="folderAdd">
- <s:param name="weblog" value="%{actionWeblog.handle}"/>
- <s:param name="folderId" value="%{folder.id}"/>
- </s:url>
- <s:a href="%{addFolder}">
+ <a href="#" onclick="newBlogroll()">
<span class="glyphicon glyphicon-plus"></span>
<s:text name="bookmarksForm.addFolder"/>
- </s:a>
+ <a>
</p>
<%-- Import bookmarks