Database Reference
In-Depth Information
Now that the user is logged in, they can edit their settings, create relationships with other users in the graph and
create their own content.
Updating a User
To access the page for updating a user, click on the “User Settings” link in the social graph section, as shown in
Figure
12-8
. In this example, the front-end code uses an AJAX request via POST and will add or—in the case of the
ajordan
user—update the first and last name of the user.
Figure 12-8.
The User Settings Page
User Update Form
The user settings form is located in
{PROJECTROOT}/WebContent/mustache/html/graphs/social/user.html
and is
similar in structure to the other forms presented in the Sign Up and Login sections. One difference is that I have added
the
value
property to the input element and used Mustache variables for displaying the respective stored values. If
none exist, the form fields will be empty (Listing 12-22).
Listing 12-22.
User Update Form
<form class="form-horizontal" id="userform">
<div class="form-group">
<label for="firstname" class="col-sm-2 control-label">First Name</label>
<div class="col-sm-10">
<input type="text" class="form-control input-sm" id="firstname" name="
user.firstname
"
value
="{{
graphStory.user.firstname
}}" />
</div>
</div>
<div class="form-group">
<label for="lastname" class="col-sm-2 control-label">Last Name</label>
<div class="col-sm-10">
<input type="text" class="form-control input-sm" id="lastname" name="
user.lastname
"
value
="{{
graphStory.user.lastname
}}" />
</div>