From: Michael Tremer Date: Wed, 25 Apr 2018 10:32:36 +0000 (+0200) Subject: Drop wishlist X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7c0605e89741c3b0792c0fe1;p=ipfire.org.git Drop wishlist This has been a nice experiment but unfortunately this has turned out to be more work than it actually gained Signed-off-by: Michael Tremer --- diff --git a/static/css/style.css b/static/css/style.css index 0544c35d..09cf0baa 100644 --- a/static/css/style.css +++ b/static/css/style.css @@ -6386,11 +6386,6 @@ section#news { section#news h2 { color: #263238; } -section#wishlist { - background-image: url("../img/wishlist-background.jpg"); - background-size: cover; - background-position: center center; } - .progress { background-color: rgba(255, 255, 255, 0.2); } diff --git a/static/img/wishlist-backgorund.jpg b/static/img/wishlist-backgorund.jpg deleted file mode 100644 index b8e0d963..00000000 Binary files a/static/img/wishlist-backgorund.jpg and /dev/null differ diff --git a/static/img/wishlist-background.jpg b/static/img/wishlist-background.jpg deleted file mode 100644 index b8e0d963..00000000 Binary files a/static/img/wishlist-background.jpg and /dev/null differ diff --git a/static/scss/style.scss b/static/scss/style.scss index 23b0c90a..066d99a4 100644 --- a/static/scss/style.scss +++ b/static/scss/style.scss @@ -236,12 +236,6 @@ section#news { } } -section#wishlist { - background-image: url('../img/wishlist-background.jpg'); - background-size: cover; - background-position: center center; -} - .progress { background-color: rgba(255, 255, 255, .2); } @@ -348,4 +342,4 @@ footer { @keyframes scroll { 0%, 100% { transform: translateY(30%); } 50% { transform: translateY(50%); } -} \ No newline at end of file +} diff --git a/templates/base.html b/templates/base.html index 55caadc9..f6692e46 100644 --- a/templates/base.html +++ b/templates/base.html @@ -44,9 +44,6 @@ IPFire {% elif hostname in ("planet.ipfire.org", "planet.dev.ipfire.org") %} IPFire Planet - {% elif hostname in ("wishlist.ipfire.org", "wishlist.dev.ipfire.org") %} - {{ _("IPFire Wishlist") }}   - {{ _("The IPFire Crowd-Funding Platform") }} {% else %} {{ hostname }} {% end %} @@ -182,13 +179,7 @@ {% if ssl_cipher %}({{ ssl_cipher }}){% end %}

{% end %} - - {% if hostname == "wishlist.ipfire.org" %} -

- {{ _("Terms & Conditions") }} -

- {% end %} - +

© {{ year }} - {{ _("IPFire is free software written by the IPFire Project") }}

diff --git a/templates/index.html b/templates/index.html index bf681241..50e9dfa2 100644 --- a/templates/index.html +++ b/templates/index.html @@ -205,39 +205,7 @@ - -
-
-

IPFire’s Wishlist

- - {% if hottest_wish %} -
-
{{ hottest_wish.title }}
- - {% if hottest_wish.is_new() %} - {{ _("NEW") }} - {% elif hottest_wish.remaining_days and hottest_wish.remaining_days <= 10 %} - - {{ _("one day left", "%(num)s days left", hottest_wish.remaining_days) % { "num" : hottest_wish.remaining_days } }} - - {% else %} - - {{ _("%d%% funded") % hottest_wish.percentage }} - - {% end %} -
- -
-
- {{ _("%.2f%% complete") % hottest_wish.percentage_bar }} -
-
- -

Read more about that wish.

- {% end %} -
-
- +

FireInfo Statistics

diff --git a/templates/modules/wishlist-items.html b/templates/modules/wishlist-items.html deleted file mode 100644 index 03383830..00000000 --- a/templates/modules/wishlist-items.html +++ /dev/null @@ -1,27 +0,0 @@ - - {% for item in wishlist_items %} - - - - {% end %} -
- {% if item.is_new() %} - {{ _("NEW") }} - {% elif item.remaining_days and item.remaining_days <= 10 %} - - {{ _("one day left", "%(num)s days left", item.remaining_days) % { "num" : item.remaining_days } }} - - {% else %} - - {{ _("%d%% funded") % item.percentage }} - - {% end %} - - {{ item.title }} - -
- -
-
-
-
diff --git a/templates/wishlist/base.html b/templates/wishlist/base.html deleted file mode 100644 index 6729591e..00000000 --- a/templates/wishlist/base.html +++ /dev/null @@ -1,12 +0,0 @@ -{% extends "../base-1.html" %} - -{% block header %} -
-
-

{{ _("IPFire Wishlist") }}

-

- {{ _("Crowd funding for the IPFire project") }} -

-
-
-{% end header %} diff --git a/templates/wishlist/closed.html b/templates/wishlist/closed.html deleted file mode 100644 index 3247195f..00000000 --- a/templates/wishlist/closed.html +++ /dev/null @@ -1,55 +0,0 @@ -{% extends "base.html" %} - -{% block title %}{{ _("Closed wishes") }}{% end block %} - -{% block body %} - - - {% if lang == "de" %} -

- Auf dieser Seite finden sich bereits ausgelaufene Sammlungen. -

- {% else %} -

- On this page, you will find all fundings that have already ended. -

- {% end %} - -
- - {% if wishes %} - {% module Wishlist(wishes) %} - -
- - - {% end %} -{% end %} diff --git a/templates/wishlist/donate.html b/templates/wishlist/donate.html deleted file mode 100644 index 738192c2..00000000 --- a/templates/wishlist/donate.html +++ /dev/null @@ -1,37 +0,0 @@ -{% extends "../base.html" %} - -{% block title %}{{ wish.title }} - {{ _("Donate") }}{% end block %} - -{% block container %} -
- - - {% if lang == "de" %} -

- Bevor du mit deiner Spende fortfährst, lies bitte die - {{ _("Terms & Conditions") }}. -

-

- Wähle dann deine präferierte Bezahlmethode aus, um deine Spende zu tätigen. -

- {% else %} -

- Before you make your donation, make sure that you - have read the {{ _("Terms & Conditions") }}. -

-

- Then pick one of the methods below to make your donation. -

- {% end %} - -
- -
-
- {% module DonationBox(wish.tag) %} -
-
-
-{% end block %} diff --git a/templates/wishlist/index.html b/templates/wishlist/index.html deleted file mode 100644 index 2da27db2..00000000 --- a/templates/wishlist/index.html +++ /dev/null @@ -1,84 +0,0 @@ -{% extends "base.html" %} - -{% block title %}{{ _("Home") }}{% end block %} - -{% block body %} -
- - - {% if lang == "de" %} -

- Dies ist die IPFire Crowdfunding-Platform, auf welcher du mittels - Spenden deinem bevorzugten Feature mehr Gewicht verleihen kannst. -

- -

- Es ist ganz einfach. Wähle einen Wunsch, über den du dich freuen - würdest, wenn er in Zukunft umgesetzt wird. - Klicke auf den Spenden-Knopf und spende deinen gewünschten Betrag. Teile - auch deinen Freunden und Kollegen mit, wie sie ihre Wünsche unterstützen - können. -

- {% else %} -

- The wishlist is the IPFire crowd funding platform where you can - donate to accelerate the development of your favorite features. -

- -

- It's easy! Just pick the wish you would to see implemented - in the future. Hit the donate button and donate the amount of - money this feature is worth for you. - After that tell your friends and collegues about it and - encourage them to promote your favourite wish as well. -

- {% end %} -
- - {% if wishes %} - {% module Wishlist(wishes) %} - {% else %} -
- {% if lang == "de" %} - Es tut uns Leid!
- Derzeit finden keine Finanzierungen statt. - Wenn du das Projekt unterstützen möchtest, so - tätige eine Spende. - {% else %} - We are sorry!
- There are currently no running fundings. - If you want to contribute to the project, please - make a donation. - {% end %} -
- {% end %} - -
- -
-
- {% if lang == "de" %} - Du hast eine Idee, oder glaubst ein wichtiges Feature fehlt - und wäre ideal von der Community finanziert? - Sende eine E-Mail an:
- wishlist@ipfire.org - {% else %} - Do you think we are missing a great feature that could be - funded by the community? Write us an email about it to:
- wishlist@ipfire.org - {% end %} -
- -
- {% if lang == "de" %} - Bereits fertiggestellte Sammlungen finden sich - hier. - {% else %} - Already closed fundings are to be found over - here. - {% end %} -
-
-{% end block %} diff --git a/templates/wishlist/modules/wish.html b/templates/wishlist/modules/wish.html deleted file mode 100644 index e8bbc434..00000000 --- a/templates/wishlist/modules/wish.html +++ /dev/null @@ -1,78 +0,0 @@ -
-
- {% if not short %} - {% if wish.remaining_days <= 10 and wish.remaining_days >= 0 %} - - {{ _("Only a few days left!") }} - - {% end %} - -

- {{ wish.title }} -

- -
- - {% raw wish.description %} - -
- {% end %} - -
-
-
-
- - -
diff --git a/templates/wishlist/modules/wishlist.html b/templates/wishlist/modules/wishlist.html deleted file mode 100644 index a1e6593f..00000000 --- a/templates/wishlist/modules/wishlist.html +++ /dev/null @@ -1,3 +0,0 @@ -{% for wish in wishes %} - {% module Wish(wish, short=short) %} -{% end %} diff --git a/templates/wishlist/terms.html b/templates/wishlist/terms.html deleted file mode 100644 index 8485e225..00000000 --- a/templates/wishlist/terms.html +++ /dev/null @@ -1,54 +0,0 @@ -{% extends "base.html" %} - -{% block title %}{{ _("Terms & Conditions") }}{% end block %} - -{% block body %} - - - {% if lang == "de" %} -

- Vielen Dank, dass du zum IPFire-Projekt beitragen möchtest. - Mit deiner Spende erklärst du dich mit den folgenden Regeln und Bedingungen - einverstanden. -

-

- Es wird nicht auf einen präferierten Wunsch gespendet, sondern eine - Spende an das Projekt entrichtet, die dir die Möglichkeit gibt - deinen Wunsch nach oben zu befördern. -

-

- Es kann nicht garantiert werden, dass dein favorisierter Wunsch - (z.B. aus technischen Gründen) implementiert wird. - Die gesammelte Spendensumme wird dann für die Finanzierung - anderer Teile des Projekts verwendet. -

-

- Mehr Informationen über Spenden finden sich auf unserer - Spenden-Seite. -

- {% else %} -

- Thank you for contributing to the IPFire project. - By donating, you agree to be bound by the following terms and conditions. - If you don't agree to be bound or cannot comply with any of the terms - and conditions, do not continue the donations. -

-

- You don't donate on a feature, you donate money to the project - and with that donation comes the option to recommend that a certain - feature should be implemented. -

-

- There is no guarantee that your favorite feature will ever be implemented - - e.g. because of technical reasons. - If your feature will not be implemented, - your donations will then be used to fund other parts of the project. -

-

- More information about donations can be found on our - donation page. -

- {% end %} -{% end block %} diff --git a/templates/wishlist/wish.html b/templates/wishlist/wish.html deleted file mode 100644 index fd4bb5b3..00000000 --- a/templates/wishlist/wish.html +++ /dev/null @@ -1,29 +0,0 @@ -{% extends "base.html" %} - -{% block title %}{{ wish.title }} - {{ _("Wish") }}{% end block %} - -{% block body %} - - - {% module Wishlist([wish,], short=True) %} - - {% raw wish.description %} - -
- -

- - {{ _("Launched: %s") % locale.format_date(wish.date_start, full_format=True) }} - - • - - {% if wish.date_end %} - - {{ _("Funding ends: %s") % locale.format_date(wish.date_end, full_format=True) }} - {% else %} - {{ _("This funding runs until the goal is reached.") }} - {% end %} -

-{% end block %} diff --git a/webapp/__init__.py b/webapp/__init__.py index 064f1939..551e7e41 100644 --- a/webapp/__init__.py +++ b/webapp/__init__.py @@ -65,9 +65,6 @@ class Application(tornado.web.Application): "TalkCallLog" : TalkCallLogModule, "TalkLines" : TalkLinesModule, "TalkOngoingCalls" : TalkOngoingCallsModule, - "Wish" : WishModule, - "Wishlist" : WishlistModule, - "WishlistItems" : WishlistItemsModule, }, xsrf_cookies = True, ) @@ -226,15 +223,6 @@ class Application(tornado.web.Application): (r"/view/(.*)", NopasteViewHandler), ] + authentication_handlers + static_handlers) - # wishlist.ipfire.org - self.add_handlers(r"wishlist(\.dev)?\.ipfire\.org", [ - (r"/", WishlistIndexHandler), - (r"/closed", WishlistClosedHandler), - (r"/wish/(.*)/donate", WishDonateHandler), - (r"/wish/(.*)", WishHandler), - (r"/terms", WishlistTermsHandler), - ] + static_handlers) - # geoip.ipfire.org self.add_handlers(r"geoip(\.dev)?\.ipfire\.org", [ (r"/", GeoIPHandler), diff --git a/webapp/backend/base.py b/webapp/backend/base.py index 97449d8b..1474e984 100644 --- a/webapp/backend/base.py +++ b/webapp/backend/base.py @@ -17,7 +17,6 @@ import planet import releases import settings import talk -import wishlist class Backend(object): def __init__(self, configfile, debug=False): @@ -46,7 +45,6 @@ class Backend(object): self.planet = planet.Planet(self) self.releases = releases.Releases(self) self.talk = talk.Talk(self) - self.wishlist = wishlist.Wishlist(self) def read_config(self, configfile): cp = configparser.ConfigParser() diff --git a/webapp/backend/wishlist.py b/webapp/backend/wishlist.py deleted file mode 100644 index 8743809f..00000000 --- a/webapp/backend/wishlist.py +++ /dev/null @@ -1,217 +0,0 @@ -#!/usr/bin/python - -from __future__ import division - -import datetime -import textile - -from misc import Object - -class Wishlist(Object): - def get(self, slug): - wish = self.db.get("SELECT * FROM wishlist WHERE slug = %s", slug) - - if wish: - return Wish(self, wish.id) - - def get_all_by_query(self, query, *args): - wishes = [] - - for row in self.db.query(query, *args): - wish = Wish(self, row.id, row) - wishes.append(wish) - - return wishes - - def get_all_running(self): - return self.get_all_by_query("SELECT * FROM wishlist \ - WHERE (CASE \ - WHEN date_end IS NULL THEN \ - NOW() >= date_start AND goal >= donated \ - ELSE \ - NOW() BETWEEN date_start AND date_end \ - END) AND status = 'running' \ - ORDER BY prio ASC, date_end ASC") - - def get_all_finished(self, limit=5, offset=None): - query = "SELECT * FROM wishlist \ - WHERE (CASE \ - WHEN date_end IS NULL THEN \ - donated >= goal \ - ELSE \ - NOW() > date_end \ - END) AND status IS NOT NULL \ - ORDER BY date_end DESC" - args = [] - - if limit: - query += " LIMIT %s" - args.append(limit) - - if offset: - query += " OFFSET %s" - args.append(offset) - - return self.get_all_by_query(query, *args) - - def get_hot_wishes(self, limit=3): - query = "SELECT * FROM wishlist \ - WHERE \ - status = %s \ - AND \ - date_start <= NOW() \ - AND \ - (CASE WHEN date_end IS NOT NULL THEN \ - NOW() BETWEEN date_start AND date_end \ - ELSE \ - TRUE \ - END) \ - AND \ - (AGE(NOW(), date_start) <= INTERVAL '10 days' \ - OR \ - AGE(date_end, NOW()) <= INTERVAL '14 days' \ - OR \ - (donated / goal) >= 0.85 \ - OR \ - goal >= 3000 \ - OR \ - prio <= 5 \ - ) \ - ORDER BY prio ASC, date_end ASC LIMIT %s" - - return self.get_all_by_query(query, "running", limit) - - def get_hottest_wish(self): - wishes = self.get_hot_wishes(limit=1) - - if wishes: - return wishes[0] - - -class Wish(object): - def __init__(self, wishlist, id, data=None): - self.wishlist = wishlist - self.id = id - - self.__data = data - - def __repr__(self): - return "<%s %s>" % (self.__class__.__name__, self.title) - - def __cmp__(self, other): - return cmp(self.date_end, other.date_end) - - @property - def db(self): - return self.wishlist.db - - @property - def data(self): - if self.__data is None: - self.__data = self.db.get("SELECT * FROM wishlist WHERE id = %s", self.id) - assert self.__data - - return self.__data - - @property - def title(self): - return self.data.title - - @property - def title_short(self): - if len(self.title) > 30: - return "%s..." % self.title[:30] - - return self.title - - @property - def slug(self): - return self.data.slug - - @property - def tag(self): - return self.data.tag - - @property - def description(self): - return textile.textile(self.data.description) - - @property - def goal(self): - return self.data.goal - - @property - def donated(self): - return self.data.donated - - @property - def percentage(self): - return (self.donated / self.goal) * 100 - - @property - def percentage_bar(self): - if self.percentage > 100: - return 100 - - return self.percentage - - @property - def progressbar_colour(self): - if self.is_new(): - return "bar-success" - - if self.percentage >= 90: - return "bar-danger" - - return "bar-warning" - - @property - def status(self): - if self.data.status == "running" and not self.running: - return "closed" - - return self.data.status - - @property - def running(self): - if self.date_end: - if self.remaining_days and self.remaining_days < 0: - return False - - else: - if self.donated >= self.goal: - return False - - return True - - @property - def date_start(self): - return self.data.date_start - - @property - def date_end(self): - return self.data.date_end - - @property - def running_days(self): - running = datetime.datetime.today() - self.date_start - return running.days - - @property - def remaining_days(self): - if self.date_end: - remaining = self.date_end - datetime.datetime.today() - return remaining.days - - def is_new(self): - return self.running_days < 10 - - def get_tweet(self, locale): - _ = locale.translate - - t = [ - _("Checkout this crowdfunding wish from #ipfire:"), - "http://wishlist.ipfire.org/wish/%s" % self.slug, - ] - - return " ".join(t) diff --git a/webapp/handlers.py b/webapp/handlers.py index 39205b74..81ed22bf 100644 --- a/webapp/handlers.py +++ b/webapp/handlers.py @@ -29,7 +29,6 @@ from handlers_nopaste import * from handlers_planet import * from handlers_rss import * from handlers_talk import * -from handlers_wishlist import * class RootHandler(BaseHandler): """ @@ -64,11 +63,8 @@ class IndexHandler(BaseHandler): # Get a list of the most recent news items and put them on the page. latest_news = self.get_latest_news() - # Interesting items from the wishlist. - hottest_wish = self.wishlist.get_hottest_wish() - return self.render("index.html", latest_news=latest_news, - latest_release=latest_release, hottest_wish=hottest_wish) + latest_release=latest_release) def get_latest_news(self, count=5): latest_news = [] @@ -133,13 +129,7 @@ class GeoIPHandler(BaseHandler): class DonateHandler(BaseHandler): def get(self): - reason_for_transfer = self.get_argument("reason_for_transfer", None) - - # Interesting items from the wishlist. - wishlist_items = self.wishlist.get_hot_wishes() - - self.render("donate.html", wishlist_items=wishlist_items, - reason_for_transfer=reason_for_transfer) + self.render("donate.html") class DownloadHandler(BaseHandler): diff --git a/webapp/handlers_base.py b/webapp/handlers_base.py index 6f1ec9d4..b784fa22 100644 --- a/webapp/handlers_base.py +++ b/webapp/handlers_base.py @@ -249,10 +249,6 @@ class BaseHandler(tornado.web.RequestHandler): def planet(self): return self.backend.planet - @property - def wishlist(self): - return self.backend.wishlist - class LoginHandler(BaseHandler): def get(self): diff --git a/webapp/handlers_wishlist.py b/webapp/handlers_wishlist.py deleted file mode 100644 index 00ded7e7..00000000 --- a/webapp/handlers_wishlist.py +++ /dev/null @@ -1,66 +0,0 @@ -#!/usr/bin/python - -import tornado.web - -from handlers_base import * - -class WishlistIndexHandler(BaseHandler): - def get(self): - wishes = self.wishlist.get_all_running() - - self.render("wishlist/index.html", wishes=wishes) - - -class WishlistClosedHandler(BaseHandler): - def get(self): - limit = self.get_argument("limit", None) - offset = self.get_argument("offset", None) - - try: - limit = int(limit) - except: - limit = 5 - - try: - offset = int(offset) - except: - offset = 0 - - wishes = self.wishlist.get_all_finished(limit=limit + 1, offset=offset) - - if len(wishes) > limit: - wishes = wishes[:limit] - has_next = True - else: - has_next = False - - if offset: - has_previous = True - else: - has_previous = False - - self.render("wishlist/closed.html", wishes=wishes, limit=limit, offset=offset, - has_next=has_next, has_previous=has_previous) - - -class WishlistTermsHandler(BaseHandler): - def get(self): - return self.render("wishlist/terms.html") - - -class WishHandler(BaseHandler): - def get(self, slug): - wish = self.wishlist.get(slug) - if not wish: - raise tornado.web.HTTPError(404, "Could not find wish %s" % slug) - - self.render("wishlist/wish.html", wish=wish) - - -class WishDonateHandler(BaseHandler): - def get(self, slug): - wish = self.wishlist.get(slug) - if not wish: - raise tornado.web.HTTPError(404, "Could not find wish %s" % slug) - - self.render("wishlist/donate.html", wish=wish) diff --git a/webapp/ui_modules.py b/webapp/ui_modules.py index 98f79ea0..945af36e 100644 --- a/webapp/ui_modules.py +++ b/webapp/ui_modules.py @@ -52,10 +52,6 @@ class UIModule(tornado.web.UIModule): def talk(self): return self.handler.talk - @property - def wishlist(self): - return self.handler.wishlist - class AdvertisementModule(UIModule): def render(self, where): @@ -375,29 +371,6 @@ class TalkOngoingCallsModule(UIModule): account=account, channels=channels, debug=debug) -class WishlistModule(UIModule): - def render(self, wishes, short=False): - return self.render_string("wishlist/modules/wishlist.html", - wishes=wishes, short=short) - - -class WishModule(UIModule): - def render(self, wish, short=False): - progress_bar = "progress-bar-warning" - - if wish.percentage >= 100: - progress_bar = "progress-bar-success" - - return self.render_string("wishlist/modules/wish.html", - wish=wish, short=short, progress_bar=progress_bar) - - -class WishlistItemsModule(UIModule): - def render(self, wishlist_items): - return self.render_string("modules/wishlist-items.html", - wishlist_items=wishlist_items) - - class DonationBoxModule(UIModule): def render(self, reason_for_transfer=None): if reason_for_transfer: