Now the user can edit his summary directly
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/social-profile@128490 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
686a1359c6
commit
e881a534a0
|
@ -95,11 +95,10 @@ public class DisplayProfile extends Composite {
|
|||
|
||||
myUserInfo = result.getUserInfo();
|
||||
avatarImage.getElement().getParentElement().setAttribute("href", myUserInfo.getAccountURL());
|
||||
avatarImage.setSize("100px", "100px");
|
||||
avatarImage.setUrl(myUserInfo.getAvatarId());
|
||||
userFullName.setText(myUserInfo.getFullName());
|
||||
|
||||
if (SocialProfile.getUserToShowId() == null) { //its him seeing his profile
|
||||
if (SocialProfile.getUserToShowId() == null || result.isOwner()) { //its him seeing his profile
|
||||
|
||||
String head = (result.getHeadline() == null || result.getHeadline().compareTo("") == 0) ? HEADLINE_TEXT : result.getHeadline();
|
||||
String isti = (result.getInstitution() == null ||result.getInstitution().compareTo("") == 0) ? ISTI_TEXT : result.getInstitution();
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<td width="110px;" align="middle">
|
||||
<a href="">
|
||||
<g:Image title="Edit Profile Picture" styleName="user-photo"
|
||||
url="" ui:field="avatarImage" width="100" height="100" />
|
||||
url="" ui:field="avatarImage"/>
|
||||
</a>
|
||||
</td>
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ import org.gcube.portlets.user.socialprofile.client.SocialServiceAsync;
|
|||
import com.github.gwtbootstrap.client.ui.AlertBlock;
|
||||
import com.github.gwtbootstrap.client.ui.constants.AlertType;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.dom.client.Style.Unit;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.safehtml.shared.SafeHtml;
|
||||
import com.google.gwt.safehtml.shared.SimpleHtmlSanitizer;
|
||||
|
@ -33,10 +34,12 @@ public class DisplaySummary extends Composite {
|
|||
@UiField HTML summary;
|
||||
@UiField TextArea summaryEditingArea;
|
||||
@UiField Button saveSummary;
|
||||
@UiField Button cancelEditSummary;
|
||||
@UiField AlertBlock alertBlock;
|
||||
|
||||
public DisplaySummary() {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
saveSummary.getElement().getStyle().setMarginRight(5, Unit.PX);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -52,10 +55,10 @@ public class DisplaySummary extends Composite {
|
|||
* Hide the summary field and show the summaryEditingArea one
|
||||
*/
|
||||
public void enableEditing(){
|
||||
|
||||
summary.setVisible(false);
|
||||
summaryEditingArea.setVisible(true);
|
||||
saveSummary.setVisible(true);
|
||||
cancelEditSummary.setVisible(true);
|
||||
}
|
||||
|
||||
@UiHandler("saveSummary")
|
||||
|
@ -83,6 +86,7 @@ public class DisplaySummary extends Composite {
|
|||
summary.setVisible(true);
|
||||
summaryEditingArea.setVisible(false);
|
||||
saveSummary.setVisible(false);
|
||||
cancelEditSummary.setVisible(false);
|
||||
alertBlock.setText("Background Summary successfully updated");
|
||||
alertBlock.setType(AlertType.SUCCESS);
|
||||
}else{
|
||||
|
@ -103,6 +107,7 @@ public class DisplaySummary extends Composite {
|
|||
alertBlock.setText("Background Summary not updated sorry");
|
||||
alertBlock.setType(AlertType.ERROR);
|
||||
alertBlock.setVisible(true);
|
||||
cancelEditSummary.setVisible(false);
|
||||
|
||||
}
|
||||
});
|
||||
|
@ -120,4 +125,15 @@ public class DisplaySummary extends Composite {
|
|||
// enable save button
|
||||
saveSummary.setEnabled(true);
|
||||
}
|
||||
|
||||
@UiHandler("cancelEditSummary")
|
||||
void onCancelClick(ClickEvent e){
|
||||
|
||||
// reset changes and exit
|
||||
summaryEditingArea.setText(summary.getText());
|
||||
summary.setVisible(true);
|
||||
summaryEditingArea.setVisible(false);
|
||||
saveSummary.setVisible(false);
|
||||
cancelEditSummary.setVisible(false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,9 +8,12 @@
|
|||
</div>
|
||||
<div width="100%;" align="left">
|
||||
<g:HTML ui:field="summary" styleName="summary"></g:HTML>
|
||||
<g:TextArea visible="false" width="100%" ui:field="summaryEditingArea"></g:TextArea>
|
||||
<g:TextArea visible="false" width="100%" ui:field="summaryEditingArea" visibleLines="5"></g:TextArea>
|
||||
</div>
|
||||
<b:AlertBlock ui:field="alertBlock" width="98%" visible="false" close="false"></b:AlertBlock>
|
||||
<g:FlowPanel>
|
||||
<g:Button ui:field="saveSummary" visible="false">Save</g:Button>
|
||||
<g:Button ui:field="cancelEditSummary" visible="false">Cancel</g:Button>
|
||||
</g:FlowPanel>
|
||||
</g:HTMLPanel>
|
||||
</ui:UiBinder>
|
|
@ -90,7 +90,7 @@ public class SocialServiceImpl extends RemoteServiceServlet implements SocialSer
|
|||
*/
|
||||
public String getDevelopmentUser() {
|
||||
String user = "test.user";
|
||||
//user = "massimiliano.assante";
|
||||
// user = "costantino.perciante";
|
||||
return user;
|
||||
}
|
||||
/**
|
||||
|
@ -109,7 +109,7 @@ public class SocialServiceImpl extends RemoteServiceServlet implements SocialSer
|
|||
}
|
||||
@Override
|
||||
public UserContext getUserContext(String userid) {
|
||||
if (userid == null || userid.equals("")) {
|
||||
if (userid == null || userid.equals("") || userid.equals(getASLSession().getUsername())) {
|
||||
System.out.println("Own Profile");
|
||||
_log.info("Own Profile");
|
||||
return getOwnProfile();
|
||||
|
@ -159,7 +159,7 @@ public class SocialServiceImpl extends RemoteServiceServlet implements SocialSer
|
|||
String company = user.getLocation_industry();
|
||||
String summary = transformSummary(um.getUserProfessionalBackground(user.getUserId()));
|
||||
|
||||
return new UserContext(userInfo, headline, company, summary, session.getScopeName(), true, isInfrastructureScope());
|
||||
return new UserContext(userInfo, headline, company, summary, session.getScopeName(), false, isInfrastructureScope());
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
@ -174,7 +174,7 @@ public class SocialServiceImpl extends RemoteServiceServlet implements SocialSer
|
|||
UserInfo user = new UserInfo(username, username+ "FULL", thumbnailURL, email, "fakeAccountUrl", true, false, fakeVreNames);
|
||||
return new UserContext(user, "", "", ""
|
||||
+ "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam."
|
||||
+ "", session.getScopeName(), true, isInfrastructureScope() );
|
||||
+ "", session.getScopeName(), false, isInfrastructureScope());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -17,9 +17,9 @@
|
|||
|
||||
.profile-section-title {
|
||||
padding: 1px 5px;
|
||||
color: #333;
|
||||
font-size: 18px;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
font-size: 18px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.summary {
|
||||
|
@ -40,10 +40,15 @@
|
|||
.user-details {
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
img.user-photo {
|
||||
display: block;
|
||||
padding: 2px;
|
||||
border: 1px solid #E6E6E6;
|
||||
min-width: 30px;
|
||||
min-height: 30px;
|
||||
width: 100px;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.full-name {
|
||||
|
@ -55,21 +60,21 @@ img.user-photo {
|
|||
|
||||
.edit {
|
||||
border: 1px solid #999 !important;
|
||||
cursor: text !important;
|
||||
opacity: 1.0 !important;
|
||||
width: 250px;
|
||||
cursor: text !important;
|
||||
opacity: 1.0 !important;
|
||||
width: 250px;
|
||||
}
|
||||
|
||||
.headline {
|
||||
font-family: 'Helvetica Neue', Arial, sans-serif;
|
||||
font-size: 16px;
|
||||
color: #444444;
|
||||
color: #444444;
|
||||
}
|
||||
|
||||
.institution {
|
||||
font-family: 'Helvetica Neue', Arial, sans-serif;
|
||||
font-size: 13px;
|
||||
color: #444444;
|
||||
color: #444444;
|
||||
}
|
||||
|
||||
.editImage {
|
||||
|
@ -88,12 +93,11 @@ img.user-photo {
|
|||
background: url(images/edit.png) 0px -32px no-repeat;
|
||||
}
|
||||
|
||||
|
||||
a.profile-link {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
a.profile-link,a.contact-link:visited {
|
||||
a.profile-link, a.contact-link:visited {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue