edit_profile

NAML documentation   Watch a video
   Usages of this macro
The source code below doesn't have navigation links because no usage has been compiled yet. Navigation links depend on how and where the macro is used, so first you may try finding all usages of "edit_profile".
... in edit_profile.naml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<override_macro name="edit_profile" requires="servlet">
    <n.user_page.>
        <n.if.not.visitor.is_registered>
            <then>
                <n.login.><t>You must login to view this page.</t></n.login.>
            </then>
        </n.if.not.visitor.is_registered>
 
        <n.if.both condition1="[n.not.visitor.is_site_admin/]" condition2="[n.not.page_user.equals.visitor/]">
            <then>
                <n.login.><t>You must login to view this page.</t></n.login.>
            </then>
        </n.if.both>
 
        <n.if.is_submitted_form>
            <then>
                <n.catch_exception. id="save-profile">
                    <n.edit_page_user.>
                        <n.set_name name="[n.user_name_field.value/]"/>
                        <n.set_password password1="[n.password_field.value/]" password2="[n.password2_field.value/]"/>
                        <n.save_user/>
                    </n.edit_page_user.>
                    <n.if.page_user.equals.visitor>
                        <then.profile_update_with_redirection_to.page_user.url/>
                        <else.redirect_to.page_user.url/>
                    </n.if.page_user.equals.visitor>
                </n.catch_exception.>
            </then>
            <else>
                <n.user_name_field.set_value value="[n.page_user.name/]" />
            </else>
        </n.if.is_submitted_form>
 
        <n.html>
            <head>
                <META NAME="robots" CONTENT="noindex,nofollow"/>
                <n.title.><t>Edit Profile</t></n.title.>
            </head>
            <body>
                <style>
                    div.field-title {margin-top:0}
                </style>
                <h1><t>Edit Profile</t></h1>
 
                <div class="field-box light-border-color">
                    <div class="second-font field-title">Email</div>
                    <div class="weak-color">
                        <n.page_user.user_email/>
                        &#187; <a href="[n.page_user.change_email_path/]">Change Email</a>
                    </div>
                </div>
 
                <n.form.>
                    <div class="field-box light-border-color" id="username-field">
                        <div class="second-font field-title">User Name</div>
                        <div class="weak-color">
                            Your user name must be unique in <n.root_node.subject/>
                        </div>
                        <div>
                            <n.user_name_field.input size="25" maxlength="25"/>
                        </div>
                    </div>
 
                    <div class="field-box light-border-color">
                        <div class="second-font field-title">Change Password</div>
                        <n.comment.>Make sure user registered before changing password</n.comment.>
                        <n.if.page_user.is_registered>
                            <then>
                                <div class="weak-color">Nabble encrypts your password (<a href="[n.help.password/]">?</a>)</div>
                                <table style="margin:.4em 0" class="shaded-bg-color">
                                    <tr valign="top">
                                        <td class="form-label" style="padding-top:.6em">Password:&nbsp;</td>
                                        <td><n.password_field.input type="password" size="25" maxlength="25"/></td>
                                    </tr>
                                    <tr>
                                        <td class="form-label">Confirm Password:&nbsp;</td>
                                        <td><n.password2_field.input type="password" size="25" maxlength="25"/></td>
                                    </tr>
                                </table>
                            </then>
                            <else>
                                <div class="weak-color">User is not registered. Register user with desired password instead.</div>
                            </else>
                        </n.if.page_user.is_registered>  
                    </div>
 
                    <input type="submit" class="toolbar action-button" value="[t]Save Changes[/t]"/>
                    <t>or</t> <a href="[n.page_user.url/]"><t>Cancel</t></a>
                </n.form.>
            </body>
        </n.html>
    </n.user_page.>
</override_macro>
Overrides default macro
... in edit_profile.naml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<macro name="edit_profile" requires="servlet">
    <n.user_page.>
        <n.if.not.visitor.is_registered>
            <then>
                <n.login.><t>You must login to view this page.</t></n.login.>
            </then>
        </n.if.not.visitor.is_registered>
 
        <n.if.both condition1="[n.not.visitor.is_site_admin/]" condition2="[n.not.page_user.equals.visitor/]">
            <then>
                <n.login.><t>You must login to view this page.</t></n.login.>
            </then>
        </n.if.both>
 
        <n.if.is_submitted_form>
            <then>
                <n.catch_exception. id="save-profile">
                    <n.edit_page_user.>
                        <n.set_name name="[n.user_name_field.value/]"/>
                        <n.set_password password1="[n.password_field.value/]" password2="[n.password2_field.value/]"/>
                        <n.save_user/>
                    </n.edit_page_user.>
                    <n.if.page_user.equals.visitor>
                        <then.profile_update_with_redirection_to.page_user.url/>
                        <else.redirect_to.page_user.url/>
                    </n.if.page_user.equals.visitor>
                </n.catch_exception.>
            </then>
            <else>
                <n.user_name_field.set_value value="[n.page_user.name/]" />
            </else>
        </n.if.is_submitted_form>
 
        <n.html>
            <head>
                <META NAME="robots" CONTENT="noindex,nofollow"/>
                <n.title.><t>Edit Profile</t></n.title.>
            </head>
            <body>
                <style>
                    div.field-title {margin-top:0}
                </style>
                <h1><t>Edit Profile</t></h1>
 
                <div class="field-box light-border-color">
                    <div class="second-font field-title">Email</div>
                    <div class="weak-color">
                        <n.page_user.user_email/>
                        &#187; <a href="[n.page_user.change_email_path/]">Change Email</a>
                    </div>
                </div>
 
                <n.form.>
                    <div class="field-box light-border-color" id="username-field">
                        <div class="second-font field-title">User Name</div>
                        <div class="weak-color">
                            Your user name must be unique in <n.root_node.subject/>
                        </div>
                        <div>
                            <n.user_name_field.input size="25" maxlength="25"/>
                        </div>
                    </div>
 
                    <div class="field-box light-border-color">
                        <div class="second-font field-title">Change Password</div>
                        <div class="weak-color">Nabble encrypts your password (<a href="[n.help.password/]">?</a>)</div>
                        <table style="margin:.4em 0" class="shaded-bg-color">
                            <tr valign="top">
                                <td class="form-label" style="padding-top:.6em">Password:&nbsp;</td>
                                <td><n.password_field.input type="password" size="25" maxlength="25"/></td>
                            </tr>
                            <tr>
                                <td class="form-label">Confirm Password:&nbsp;</td>
                                <td><n.password2_field.input type="password" size="25" maxlength="25"/></td>
                            </tr>
                        </table>
                    </div>
 
                    <input type="submit" class="toolbar action-button" value="[t]Save Changes[/t]"/>
                    <t>or</t> <a href="[n.page_user.url/]"><t>Cancel</t></a>
                </n.form.>
            </body>
        </n.html>
    </n.user_page.>
</macro>