From aa935c0f798e7346e1ee15ae940e206e4938f005 Mon Sep 17 00:00:00 2001 From: Massimiliano Assante Date: Thu, 10 Apr 2014 22:49:53 +0000 Subject: [PATCH] added addComment form if there is at least on comment already on a tweet git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/news-feed@94749 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../user/newsfeed/client/panels/NewsFeedPanel.java | 1 + .../newsfeed/client/templates/AddCommentTemplate.java | 9 ++++++--- .../newsfeed/client/templates/SuperPosedTextArea.java | 3 +-- .../user/newsfeed/client/templates/TweetTemplate.java | 7 +++++-- .../portlets/user/newsfeed/server/NewsServiceImpl.java | 4 ++++ src/main/webapp/NewsFeed.css | 6 +++--- 6 files changed, 20 insertions(+), 10 deletions(-) diff --git a/src/main/java/org/gcube/portlets/user/newsfeed/client/panels/NewsFeedPanel.java b/src/main/java/org/gcube/portlets/user/newsfeed/client/panels/NewsFeedPanel.java index 22c360c..29e07a8 100644 --- a/src/main/java/org/gcube/portlets/user/newsfeed/client/panels/NewsFeedPanel.java +++ b/src/main/java/org/gcube/portlets/user/newsfeed/client/panels/NewsFeedPanel.java @@ -882,6 +882,7 @@ public class NewsFeedPanel extends Composite { if (commentForm2Add) owner.showAddCommentForm(); owner.updateCommentsNumberCount(); + owner.showAddCommentForm(); } }); diff --git a/src/main/java/org/gcube/portlets/user/newsfeed/client/templates/AddCommentTemplate.java b/src/main/java/org/gcube/portlets/user/newsfeed/client/templates/AddCommentTemplate.java index 4e8f339..c58e27b 100644 --- a/src/main/java/org/gcube/portlets/user/newsfeed/client/templates/AddCommentTemplate.java +++ b/src/main/java/org/gcube/portlets/user/newsfeed/client/templates/AddCommentTemplate.java @@ -30,7 +30,7 @@ public class AddCommentTemplate extends Composite { private static CommentTemplateUiBinder uiBinder = GWT.create(CommentTemplateUiBinder.class); - public final static String COMMENT_TEXT = "Add a comment ... use @ to mention someone"; + public final static String COMMENT_TEXT = "Write a comment, use @ to mention someone"; public final static String ERROR_UPDATE_TEXT = "Looks like empty to me!"; public static final String avatar_default = GWT.getModuleBaseURL() + "../images/Avatar_default.png"; @@ -45,7 +45,7 @@ public class AddCommentTemplate extends Composite { @UiField SuperPosedTextArea commentTextArea; @UiField Div highlighterDIV; @UiField Button submitButton; - @UiField Button cancelButton; + @UiField Button cancelButton; //obsolete /** @@ -60,6 +60,8 @@ public class AddCommentTemplate extends Composite { owner = caller; avatarImage.setPixelSize(30, 30); avatarImage.setUrl(myUserInfo.getAvatarId()); + submitButton.setVisible(false); + cancelButton.setVisible(false); } /** * called on edit comment @@ -87,7 +89,7 @@ public class AddCommentTemplate extends Composite { } public void setFocus() { - commentTextArea.setFocus(true); + //commentTextArea.setFocus(true); } @UiHandler("submitButton") @@ -150,6 +152,7 @@ public class AddCommentTemplate extends Composite { commentTextArea.addStyleName("comment-dark-color"); commentTextArea.removeStyleName("error"); } + submitButton.setVisible(true); } @UiHandler("commentTextArea") diff --git a/src/main/java/org/gcube/portlets/user/newsfeed/client/templates/SuperPosedTextArea.java b/src/main/java/org/gcube/portlets/user/newsfeed/client/templates/SuperPosedTextArea.java index 48e6afb..d892bf4 100644 --- a/src/main/java/org/gcube/portlets/user/newsfeed/client/templates/SuperPosedTextArea.java +++ b/src/main/java/org/gcube/portlets/user/newsfeed/client/templates/SuperPosedTextArea.java @@ -61,7 +61,7 @@ public class SuperPosedTextArea extends TextArea { @Override public void onSuccess(ArrayList users) { - pickUserDlg = new PickUsersDialog(users, eventBus, 450); + pickUserDlg = new PickUsersDialog(users, eventBus, 460); } @Override @@ -74,7 +74,6 @@ public class SuperPosedTextArea extends TextArea { @Override public void run() { myAutoSize(areaId); - setCaretPositionToBegin(areaId); } }; t.schedule(200); diff --git a/src/main/java/org/gcube/portlets/user/newsfeed/client/templates/TweetTemplate.java b/src/main/java/org/gcube/portlets/user/newsfeed/client/templates/TweetTemplate.java index 505f55d..9c4e86b 100644 --- a/src/main/java/org/gcube/portlets/user/newsfeed/client/templates/TweetTemplate.java +++ b/src/main/java/org/gcube/portlets/user/newsfeed/client/templates/TweetTemplate.java @@ -218,7 +218,8 @@ public class TweetTemplate extends Composite { } for (Comment comment : myFeed.getComments()) { addComment(new SingleComment(comment, this, (comment.getUserid().equals(myUserInfo.getUsername())))); - } + } + showAddCommentForm(); } } @@ -335,7 +336,9 @@ public class TweetTemplate extends Composite { if (! commentsFetched && totalComments > 2) { //if so, need to load all comments before adding a comment fireSeeComments(true); } - showAddCommentForm(); + else { + showAddCommentForm(); + } } else GWT.log("Commenting disabled"); diff --git a/src/main/java/org/gcube/portlets/user/newsfeed/server/NewsServiceImpl.java b/src/main/java/org/gcube/portlets/user/newsfeed/server/NewsServiceImpl.java index 1142ef0..eb1ef93 100644 --- a/src/main/java/org/gcube/portlets/user/newsfeed/server/NewsServiceImpl.java +++ b/src/main/java/org/gcube/portlets/user/newsfeed/server/NewsServiceImpl.java @@ -110,6 +110,10 @@ public class NewsServiceImpl extends RemoteServiceServlet implements NewsService } return SessionManager.getInstance().getASLSession(sessionID, user); } + /** + * when packaging test will fail if the user is not set to test.user + * @return . + */ public String getDevelopmentUser() { String user = "test.user"; //user = "massimiliano.assante"; diff --git a/src/main/webapp/NewsFeed.css b/src/main/webapp/NewsFeed.css index 26cd67d..7ac6bb8 100644 --- a/src/main/webapp/NewsFeed.css +++ b/src/main/webapp/NewsFeed.css @@ -17,7 +17,7 @@ table { left: 0; top: 0; cursor: text; - width: 525px; + width: 460px; height: 54px; } @@ -38,7 +38,7 @@ table { border: 1px solid transparent; - width: 450px; + width: 460px; min-height: 40px; word-wrap: break-word; /* this is very important when usere paste long links*/ @@ -58,7 +58,7 @@ table { border: 1px solid #C3CDE7; - width: 450px; + width: 460px; min-height: 40px; }