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
This commit is contained in:
Massimiliano Assante 2014-04-10 22:49:53 +00:00
parent 3e9e5fb981
commit aa935c0f79
6 changed files with 20 additions and 10 deletions

View File

@ -882,6 +882,7 @@ public class NewsFeedPanel extends Composite {
if (commentForm2Add) if (commentForm2Add)
owner.showAddCommentForm(); owner.showAddCommentForm();
owner.updateCommentsNumberCount(); owner.updateCommentsNumberCount();
owner.showAddCommentForm();
} }
}); });

View File

@ -30,7 +30,7 @@ public class AddCommentTemplate extends Composite {
private static CommentTemplateUiBinder uiBinder = GWT.create(CommentTemplateUiBinder.class); 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 final static String ERROR_UPDATE_TEXT = "Looks like empty to me!";
public static final String avatar_default = GWT.getModuleBaseURL() + "../images/Avatar_default.png"; 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 SuperPosedTextArea commentTextArea;
@UiField Div highlighterDIV; @UiField Div highlighterDIV;
@UiField Button submitButton; @UiField Button submitButton;
@UiField Button cancelButton; @UiField Button cancelButton; //obsolete
/** /**
@ -60,6 +60,8 @@ public class AddCommentTemplate extends Composite {
owner = caller; owner = caller;
avatarImage.setPixelSize(30, 30); avatarImage.setPixelSize(30, 30);
avatarImage.setUrl(myUserInfo.getAvatarId()); avatarImage.setUrl(myUserInfo.getAvatarId());
submitButton.setVisible(false);
cancelButton.setVisible(false);
} }
/** /**
* called on edit comment * called on edit comment
@ -87,7 +89,7 @@ public class AddCommentTemplate extends Composite {
} }
public void setFocus() { public void setFocus() {
commentTextArea.setFocus(true); //commentTextArea.setFocus(true);
} }
@UiHandler("submitButton") @UiHandler("submitButton")
@ -150,6 +152,7 @@ public class AddCommentTemplate extends Composite {
commentTextArea.addStyleName("comment-dark-color"); commentTextArea.addStyleName("comment-dark-color");
commentTextArea.removeStyleName("error"); commentTextArea.removeStyleName("error");
} }
submitButton.setVisible(true);
} }
@UiHandler("commentTextArea") @UiHandler("commentTextArea")

View File

@ -61,7 +61,7 @@ public class SuperPosedTextArea extends TextArea {
@Override @Override
public void onSuccess(ArrayList<PickingUser> users) { public void onSuccess(ArrayList<PickingUser> users) {
pickUserDlg = new PickUsersDialog(users, eventBus, 450); pickUserDlg = new PickUsersDialog(users, eventBus, 460);
} }
@Override @Override
@ -74,7 +74,6 @@ public class SuperPosedTextArea extends TextArea {
@Override @Override
public void run() { public void run() {
myAutoSize(areaId); myAutoSize(areaId);
setCaretPositionToBegin(areaId);
} }
}; };
t.schedule(200); t.schedule(200);

View File

@ -218,7 +218,8 @@ public class TweetTemplate extends Composite {
} }
for (Comment comment : myFeed.getComments()) { for (Comment comment : myFeed.getComments()) {
addComment(new SingleComment(comment, this, (comment.getUserid().equals(myUserInfo.getUsername())))); 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 if (! commentsFetched && totalComments > 2) { //if so, need to load all comments before adding a comment
fireSeeComments(true); fireSeeComments(true);
} }
showAddCommentForm(); else {
showAddCommentForm();
}
} }
else else
GWT.log("Commenting disabled"); GWT.log("Commenting disabled");

View File

@ -110,6 +110,10 @@ public class NewsServiceImpl extends RemoteServiceServlet implements NewsService
} }
return SessionManager.getInstance().getASLSession(sessionID, user); return SessionManager.getInstance().getASLSession(sessionID, user);
} }
/**
* when packaging test will fail if the user is not set to test.user
* @return .
*/
public String getDevelopmentUser() { public String getDevelopmentUser() {
String user = "test.user"; String user = "test.user";
//user = "massimiliano.assante"; //user = "massimiliano.assante";

View File

@ -17,7 +17,7 @@ table {
left: 0; left: 0;
top: 0; top: 0;
cursor: text; cursor: text;
width: 525px; width: 460px;
height: 54px; height: 54px;
} }
@ -38,7 +38,7 @@ table {
border: 1px solid transparent; border: 1px solid transparent;
width: 450px; width: 460px;
min-height: 40px; min-height: 40px;
word-wrap: break-word; /* this is very important when usere paste long links*/ word-wrap: break-word; /* this is very important when usere paste long links*/
@ -58,7 +58,7 @@ table {
border: 1px solid #C3CDE7; border: 1px solid #C3CDE7;
width: 450px; width: 460px;
min-height: 40px; min-height: 40px;
} }