denny/ShinyCMS

View on GitHub
root/user/edit_user.tt

Summary

Maintainability
Test Coverage
[%-    meta.title = 'Edit user details' -%]

<script type="text/javascript">
function changeSrc() {
    document.getElementById('user_profile_pic').src="[% c.uri_for( '/static', 'images', '1x1.gif' ) %]";
}
</script>

<h2>
    Edit details for [% user.username | html %]
</h2>

<form id="edit_user" method="post" enctype="multipart/form-data" action="[% c.uri_for( 'edit-do' ) %]">
    <p>
        <label for="email">
            Real Email (private - only seen by you and site admins - must be a valid email address)
        </label>
        <br><input type="text" class="textlong" id="email" name="email" value="[% user.email | html %]" size="50" maxlength="200">
    </p>
    <p>
        <label for="display_email">
            Display email (public - will be seen by other users - can be obfuscated or left blank)
        </label>
        <br><input type="text" class="textlong" id="display_email" name="display_email" value="[% user.display_email | html %]" size="50" maxlength="200">
    </p>
    <p>
        <label for="profile_pic">
            Profile picture
        </label>
        <br><input type="file" id="profile_pic" name="profile_pic" onChange="javascript:changeSrc()">
    </p>
    <p>
        <img id="user_profile_pic"
            [%- IF user.profile_pic -%]
            src="[% c.uri_for( '/static/cms-uploads/user-profile-pics', user.username, user.profile_pic ) %]"
            class="outlined"
            alt="Picture of [% user.display_name || user.username | html %]">
            [%- ELSE -%]
            src="[% c.uri_for( '/static', 'images', '1x1.gif' ) %]" alt="">
            [%- END %]
    </p>
    <p>
        <label for="display_name">
            Display name (displayed on your posts and comments)
        </label>
        <br><input type="text" class="textshort" id="display_name" name="display_name" value="[% user.display_name | html %]" size="50">
    </p>
    <p>
        <label for="website">
            Website (displayed on your profile)
        </label>
        <br><input type="text" class="textshort" id="website" name="website" value="[% user.website | url %]" size="200">
    </p>
    <p>
        <label for="website">
            Location (displayed on your profile)
        </label>
        <br><input type="text" class="textshort" id="location" name="location" value="[% user.location | html %]" size="100">
    </p>
    <p>
        <label for="website">
            Postcode (creates Google Maps link on your profile)
        </label>
        <br><input type="text" class="textveryshort" id="postcode" name="postcode" value="[% user.postcode | html %]" size="10">
    </p>
    <p>
        <label for="bio">
            Bio (displayed on your profile)
        </label>
        <br><textarea columns="80" rows="5" name="bio">[% user.bio | html %]</textarea>
    </p>
    <p>
        <label for="firstname">
            First name
        </label>
        <br><input type="text" class="textshort" id="firstname" name="firstname" value="[% user.firstname | html %]" size="50">
    </p>
    <p>
        <label for="firstname">
            Surname
        </label>
        <br><input type="text" class="textshort" id="surname" name="surname" value="[% user.surname | html %]" size="50">
    </p>
    <p>
        <label for="allow_comments">Allow profile comments (disabling this will delete any existing comments)</label>
        <br><input type="checkbox" id="allow_comments" name="allow_comments" [% 'checked="checked"' IF user.discussion %]>
    </p>
    <p>
        <input name="user_id" type="hidden" value="[% user.id %]">
        <input name="submit"  type="submit" value="Save changes">
        <input name="reset"   type="reset"  value="Reset">
    </p>
</form>

<p>
    Click here to <a href="[% c.uri_for( 'change-password' ) %]">change your password</a>
</p>