Merge pull request #75 from Brobin/gold

Added gold to submissions
This commit is contained in:
michael-lazar
2015-04-04 12:33:07 -07:00
3 changed files with 13 additions and 4 deletions

View File

@@ -108,6 +108,7 @@ class BaseContent(object):
data['url_full'] = sub.url
data['url'] = ('selfpost' if is_selfpost(sub.url) else sub.url)
data['likes'] = sub.likes
data['gold'] = sub.gilded > 0
return data

View File

@@ -241,7 +241,11 @@ class SubmissionPage(BasePage):
win.addnstr(row, 1, text, n_cols)
row = len(data['split_title']) + len(split_text) + 3
text = clean(u'{score} {comments}'.format(**data))
text = clean(u'{score} {comments} '.format(**data))
win.addnstr(row, 1, text, n_cols, curses.A_BOLD)
if data['gold']:
text, attr = GOLD, (curses.A_BOLD | Color.YELLOW)
win.addnstr(text, n_cols - win.getyx()[1], attr)
win.border()

View File

@@ -9,8 +9,8 @@ from .submission import SubmissionPage
from .content import SubredditContent
from .helpers import clean, open_browser, open_editor
from .docs import SUBMISSION_FILE
from .curses_helpers import (BULLET, UARROW, DARROW, Color, LoadScreen,
show_notification)
from .curses_helpers import (BULLET, UARROW, DARROW, GOLD, Color,
LoadScreen, show_notification)
__all__ = ['opened_links', 'SubredditController', 'SubredditPage']
@@ -171,9 +171,13 @@ class SubredditPage(BasePage):
text, attr = DARROW, curses.A_BOLD | Color.RED
win.addnstr(text, n_cols - win.getyx()[1], attr)
text = clean(u' {created} {comments}'.format(**data))
text = clean(u' {created} {comments} '.format(**data))
win.addnstr(text, n_cols - win.getyx()[1])
if data['gold']:
text, attr = GOLD, (curses.A_BOLD | Color.YELLOW)
win.addnstr(text, n_cols - win.getyx()[1], attr)
row = n_title + offset + 2
if row in valid_rows:
text = clean(u'{author}'.format(**data))