Alessandro Molina avatar Alessandro Molina committed 7a5d3d2

Remove unused partial and add documentation

Comments (0)

Files changed (3)

 About userprofile
 -------------------------
 
-userprofile is a Pluggable application for TurboGears2.
+userprofile is a Pluggable application for TurboGears2 which provides a basic user
+profile page with forms to allow users to edit their own profile or change their password.
 
 Installing
 -------------------------------
 You will be able to access the registration process at
 *http://localhost:8080/userprofile*.
 
-Available Hooks
+Options
 ----------------------
 
-userprofile makes available a some hooks which will be
-called during some actions to alter the default
-behavior of the appplications:
+``tgapp-userprofile`` supports some options that can be passed
+to the ``plug`` method to customize various aspects of the application:
 
-Exposed Partials
+- ``user_partial`` - Path of a partial to display into the user profile page.
+    Useful to add more data to the profile page without changing its template
+- ``custom_css`` - Path to a CSS file which will be used for the profile pages in place of the default one.
+
+User Properties
 ----------------------
 
-userprofile exposes a bunch of partials which can be used
-to render pieces of the blogging system anywhere in your
-application:
+``tgapp-userprofile`` looks for various properties into the User class instances
+to drive its default behavior, the most important property is the ``profile_data``
+property which can provide a dictionary with the user informations to display
+on the profile page, but other properties are available to tune the behavior:
 
-Exposed Templates
---------------------
+profile_data
+~~~~~~~~~~~~~~~~~~~~~~~
+A dictionary of entries to display into the profile page,
+the default dictionary is built with::
 
-The templates used by registration and that can be replaced with
-*tgext.pluggable.replace_template* are:
+    {'display_name':('Display Name', user.display_name),
+     'email_address':('Email Address', user.email_address)}
 
+each key of the dictionary if the id of the field, in most
+cases it will have the same name of the user property where
+that field is stored. Values of the dictionary are tuples
+where the first value is the name of the field which will
+be displayed and the second one is the real value of the field.
+
+If an ``avatar`` key is available that is expected to provide
+the url of the avatar image of the user. If it is not available
+userprofile will look for a ``tgapp-fbauth`` facebook avatar or will
+falleback to the default avatar.
+
+profile_form
+~~~~~~~~~~~~~~~~~~~~~~~
+
+A ToscaWidgets or tw2 form that can be used to edit the user profile.
+By default an autogenerated one with a text field for each entry in
+``profile_data`` is provided.
+
+save_profile
+~~~~~~~~~~~~~~~~~~~~~~~
+
+A callable which will receive the user data submitted by the edit
+form and is expected to update the user accordingly.
+
+By default values will be stored as they are into the user field
+with the same id provided into ``profile_data``.
+

userprofile/partials.py

 from tg import expose
 
-@expose('userprofile.templates.little_partial')
-def something(name):
-    return dict(name=name)

userprofile/templates/little_partial.html

-<div xmlns="http://www.w3.org/1999/xhtml"
-      xmlns:py="http://genshi.edgewall.org/"
-      xmlns:xi="http://www.w3.org/2001/XInclude">
-    <div>This is from partial: ${h.userprofile.bold(name)}</div>
-</div>
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.