]> git.ipfire.org Git - people/shoehn/ipfire.org.git/commitdiff
planet: Remove tags.
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 16 Apr 2014 15:54:22 +0000 (17:54 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 16 Apr 2014 15:55:52 +0000 (17:55 +0200)
templates/admin-planet-compose.html
templates/planet/posting.html
webapp/backend/planet.py
webapp/handlers_admin.py

index 49a30e4a1d7f2f691caa2dec9e3d62d8fe509adc..a549954c629730ed130115f64f8d86880e3d1d86 100644 (file)
 
                <hr>
 
-               <div class="form-group">
-                       <label class="control-label col-sm-2" for="inputTags">{{ _("Tags") }}</label>
-                       <div class="col-sm-10">
-                               <input class="form-control planet-search-autocomplete" type="text"
-                                       name="tags" id="inputTags" {% if entry %}value="{{ " ".join(entry.tags) }}"{% end %}
-                                       placeholder="{{ _("Tags") }}" autocomplete="off">
-                       </div>
-               </div>
-
                <div class="form-group">
                        <label class="control-label col-sm-2">{{ _("Status") }}</label>
                        <div class="col-sm-10">
index 9c622b0d48691440a539d3577afcd3f53432a98f..aff4f1aed17fdd09dd23452ce3ac124e0d8c009b 100644 (file)
        {% raw entry.text %}
 
        <p class="clear pull-right">
-               {% if entry.tags %}
-                       {{ _("Tags") }}:
-                       {% for tag in entry.tags %}
-                               <a href="/search?q={{ tag }}">{{ tag }}</a>
-                       {% end %} &bull;
-               {% end %}
                {{ _("Posted by") }} <a href="/user/{{ entry.author.uid }}">{{ entry.author.cn }}</a>
                {{ _("on") }} {{ locale.format_date(entry.published, shorter=True) }}
        </p>
index 47036a10fb0d4af0b766ed11c77c88e544e8c131..e063d3bd43a962deee88dfaf881649ff606afa9c 100644 (file)
@@ -115,31 +115,6 @@ class PlanetEntry(Object):
        def is_published(self):
                return self.status == "published"
 
-       # Tags
-
-       def get_tags(self):
-               if not hasattr(self, "__tags"):
-                       res = self.db.query("SELECT tag FROM planet_tags \
-                               WHERE post_id = %s ORDER BY tag", self.id)
-                       self.__tags = []
-                       for row in res:
-                               self.__tags.append(row.tag)
-
-               return self.__tags
-
-       def set_tags(self, tags):
-               # Delete all existing tags.
-               self.db.execute("DELETE FROM planet_tags WHERE post_id = %s", self.id)
-
-               self.db.executemany("INSERT INTO planet_tags(post_id, tag) VALUES(%s, %s)",
-                       ((self.id, tag) for tag in tags))
-
-               # Update cache.
-               self.__tags = tags
-               self.__tags.sort()
-
-       tags = property(get_tags, set_tags)
-
 
 class Planet(Object):
        def get_authors(self):
@@ -237,7 +212,7 @@ class Planet(Object):
 
                return slug
 
-       def create(self, title, markdown, author, status="published", tags=None, published=None):
+       def create(self, title, markdown, author, status="published", published=None):
                slug = self._generate_slug(title)
                markup = self.render(markdown)
 
@@ -245,15 +220,11 @@ class Planet(Object):
                        published = datetime.datetime.utcnow()
 
                id = self.db.execute("INSERT INTO planet(author_id, slug, title, status, \
-                       markdown, markup, published) VALUES(%s, %s, %s, %s, %s, %s, %s)",
+                       markdown, markup, published) VALUES(%s, %s, %s, %s, %s, %s, %s) RETURNING id",
                        author.uid, slug, title, status, markdown, markup, published)
 
-               entry = self.get_entry_by_id(id)
-
-               if tags:
-                       entry.tags = tags
-
-               return entry
+               if id:
+                       return self.get_entry_by_id(id)
 
        def update_entry(self, entry):
                self.db.execute("UPDATE planet SET title = %s, markdown = %s WHERE id = %s",
index e7c72177ef0e2d9a03ff2a158b54205531ed7418..600a6273fda44567f0e008b5ec4b774a6976929a 100644 (file)
@@ -77,7 +77,6 @@ class AdminPlanetComposeHandler(AdminBaseHandler):
        def post(self):
                title = self.get_argument("title")
                markdown = self.get_argument("markdown")
-               tags = self.get_argument("tags", "")
 
                status = self.get_argument("status", "draft")
                assert status in ("draft", "published")
@@ -85,7 +84,7 @@ class AdminPlanetComposeHandler(AdminBaseHandler):
                author = self.accounts.find(self.current_user)
 
                entry = self.planet.create(title=title, markdown=markdown,
-                       author=author, status=status, tags=tags.split())
+                       author=author, status=status)
 
                self.redirect("/planet")
 
@@ -99,7 +98,6 @@ class AdminPlanetEditHandler(AdminPlanetComposeHandler):
 
                entry.title = self.get_argument("title")
                entry.markdown = self.get_argument("markdown")
-               entry.tags = self.get_argument("tags", "").split()
 
                entry.status = self.get_argument("status", "draft")