]> git.ipfire.org Git - ipfire.org.git/commitdiff
people: Make space for a description
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 29 Oct 2019 15:40:32 +0000 (15:40 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 29 Oct 2019 15:40:32 +0000 (15:40 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/backend/accounts.py
src/templates/people/user-edit.html
src/templates/people/user.html
src/web/__init__.py
src/web/people.py
src/web/ui_modules.py

index 70b53acdb6ce1ce6750d8806c9b33647c055ae91..37eedd5011c4be961b9aefaf333c60dd4f85c79f 100644 (file)
@@ -940,6 +940,18 @@ class Account(Object):
 
                return ret
 
+       # Description
+
+       def get_description(self):
+               return self._get_string("description")
+
+       def set_description(self, description):
+               self._set_string("description", description)
+
+       description = property(get_description, set_description)
+
+       # Avatar
+
        def has_avatar(self):
                has_avatar = self.memcache.get("accounts:%s:has-avatar" % self.uid)
                if has_avatar is None:
index 28e548c089eae4f064ff9be0e1d92ebdb62cf064..d831ed2e14b1f1610b6c3a6af383881793affdf4 100644 (file)
                        </select>
                </div>
 
-               <div class="form-group">
-                       <label>{{ _("Avatar") }}</label>
+               <fieldset>
+                       <legend>{{ _("Tell Us Who You Are") }}</legend>
 
-                       <input type="file" class="form-control-file" name="avatar">
+                       <div class="form-group">
+                               <textarea type="text" class="form-control" name="description" rows="5"
+                                       placeholder="{{ _("Tell Us Who You Are") }}">{{ account.description }}</textarea>
 
-                       <small class="form-text text-muted">
-                               {{ _("Upload a new avatar") }}
-                       </small>
-               </div>
+                               <small class="form-text text-muted">
+                                       {{ _("You can use Markdown syntax as you know it from the IPFire Wiki") }}
+                               </small>
+                       </div>
+
+                       <div class="form-group">
+                               <label>{{ _("Avatar") }}</label>
+
+                               <input type="file" class="form-control-file" name="avatar">
+
+                               <small class="form-text text-muted">
+                                       {{ _("Upload a new avatar") }}
+                               </small>
+                       </div>
+               </fieldset>
 
                {% if account.has_mail() %}
                        <fieldset>
index b2a6f32a2a949fe21b37f56607501735e0595ff0..a94fbdf5d7ccb49fcdc21fdd1d1af862abfaeffc 100644 (file)
@@ -5,6 +5,14 @@
 
        <div class="card mb-3">
                <div class="card-body">
+                       {% if account.description %}
+                               <div class="row">
+                                       <div class="col">
+                                               {% module Markdown(account.description) %}
+                                       </div>
+                               </div>
+                       {% end %}
+
                        <div class="row">
                                <div class="col">
                                        <a class="btn btn-dark btn-block" href="mailto:{{ account.email }}">
index b40de8159adf16c9de2c9a83b635431c83861a77..c5527166b8ab1982f5a4799ec9376838de1e430e 100644 (file)
@@ -96,6 +96,7 @@ class Application(tornado.web.Application):
                                "WikiList"             : wiki.WikiListModule,
 
                                # Misc
+                               "Markdown"             : ui_modules.MarkdownModule,
                                "Map"                  : ui_modules.MapModule,
                                "ProgressBar"          : ui_modules.ProgressBarModule,
                        },
index fe167763e7eba8a3bb95a6eaf4c7a4edbfc544fe..d1a9a1ac06d9d34cced1dedf4c3021f387d1e328 100644 (file)
@@ -220,6 +220,7 @@ class UserEditHandler(auth.CacheMixin, base.BaseHandler):
                        account.city         = self.get_argument("city", None)
                        account.postal_code  = self.get_argument("postal_code", None)
                        account.country_code = self.get_argument("country_code", None)
+                       account.description  = self.get_argument("description", None)
 
                        # Avatar
                        try:
index e50d1ac8474745e529b4a80570daabe2709edfba..a0ae5e352e9996b909aa6c376528506d25a130df 100644 (file)
@@ -10,6 +10,11 @@ class UIModule(tornado.web.UIModule):
                return self.handler.backend
 
 
+class MarkdownModule(UIModule):
+       def render(self, markdown):
+               return self.backend.blog._render_text(markdown)
+
+
 class MapModule(UIModule):
        def render(self, latitude, longitude):
                return self.render_string("modules/map.html", latitude=latitude, longitude=longitude)