Пример #1
0
 def __init__(self, path, user):
     # CUSTOM
     buttons = [
         OffsiteButton(menu.ip_history, '/admin/iphistory?username='******'/admin/nukecontent?recipient=' + urllib.quote_plus(user.name)),
     ]
     NavMenu.__init__(self, buttons, base_path = path,
                      title = 'admin', type="tabdrop")
Пример #2
0
    def __init__(self, *args, **kwargs):
        nav_buttons = [
            NavButton(_('overview'), '/advertising'),
            OffsiteButton(_('getting started'), 'https://reddit.zendesk.com/hc/en-us/articles/205118995-Step-by-step-How-to-create-an-ad'),
            OffsiteButton(_('audience'), 'https://reddit.zendesk.com/hc/en-us/articles/205183225-Audience-and-Demographics'),
            OffsiteButton(_('best practices'), 'https://reddit.zendesk.com/hc/en-us/sections/200863319-Best-Practices-Tips'),
            OffsiteButton(_('help center'), 'https://reddit.zendesk.com/hc/en-us/categories/200352595-Advertising-'),
            NavButton(_('manage ads'), '/promoted?utm_source=advertising&utm_medium=button&utm_term=manage%20ads&utm_campaign=buttons'),
        ]

        self.create_ad_url = '/promoted/new_promo?utm_source=advertising&utm_medium=button&utm_term=create%20ads&utm_campaign=buttons'

        self.nav_menu = NavMenu(nav_buttons,
            type='flatlist',
            base_path='',
            css_class='advertising-menu',
            separator=None).render()

        sections = SelfServeContent.get_all(return_dict=True)
        self.banner = sections.get('banner')
        self.info = sections.get('info')
        self.advertisers = sections.get('advertisers')
        self.subreddit = sections.get('subreddit')
        self.help = sections.get('help')
        blurbs = SelfServeBlurb.get_all(return_dict=True)
        if 'platform' in blurbs:
            min_cpm = min([
                g.cpm_selfserve_collection.decimal,
                g.cpm_selfserve.decimal,
                g.cpm_selfserve_geotarget_metro.decimal,
            ])
            formatted_min_cpm = format_currency(min_cpm, 'USD', locale=c.locale)
            formatted_min_bid = format_currency(g.min_promote_bid, 'USD', locale=c.locale)
            blurbs['platform'].text = blurbs['platform'].text.replace(
                '[min_promote_bid]', formatted_min_bid).replace(
                '[cpm_selfserve]', formatted_min_cpm)
        self.blurbs = blurbs.values()
        self.advertiser_logos = SelfServeAdvertiser.get_all()
        self.quotes = SelfServeQuote.get_all()
        self.help_text = None
        try:
            self.help_text = WikiPage.get(Frontpage, g.wiki_page_selfserve_help).content
        except NotFound:
            pass
        Templated.__init__(self, *args, **kwargs)
Пример #3
0
def admin_menu(**kwargs):
    buttons = [
        OffsiteButton("traffic", "/traffic"),
        NavButton(menu.awards, "awards"),
        NavButton(menu.errors, "error log"),
    ]

    admin_menu = NavMenu(buttons, title='admin tools', base_path='/admin',
                         type="lightdrop", **kwargs)
    return admin_menu
Пример #4
0
def admin_menu(**kwargs):
    buttons = [
        OffsiteButton("traffic", "/traffic"),
        NavButton(menu.awards, "awards", sr_path=False),
        NavButton(menu.errors, "error log", sr_path=False),
        # SAIDIT
        NavButton(menu.global_user_bans, "globaluserbans", sr_path=False),
        NavButton(menu.ip_bans, "ipbans", sr_path=False),
        NavButton(menu.nuke_user_content, "nukecontent", sr_path=False),
    ]

    admin_menu = NavMenu(buttons, title='admin tools', base_path='/admin',
                         type="lightdrop", **kwargs)
    return admin_menu
Пример #5
0
    def __init__(self, team, alumni, sorts, extra_sorts):
        Templated.__init__(self, team=team, alumni=alumni, sorts=sorts + extra_sorts)

        sort_buttons = []
        extra_sort_index = random.randint(len(sorts), len(self.sorts)-1)
        for idx, sort in enumerate(self.sorts):
            css_class = 'choice-'+sort['id']
            if sort in extra_sorts and idx != extra_sort_index:
                css_class += ' hidden-sort'
            button = OffsiteButton(sort['title'], '#sort/'+sort['id'], css_class=css_class)
            sort_buttons.append(button)
        self.sort_menu = NavMenu(sort_buttons, title=_('sorted by'), base_path=request.path, type='lightdrop', default='#sort/random')

        # The caching check won't catch the hidden-sort classes
        self.sort_menu.cachable = False
Пример #6
0
    def __init__(self, sorts, team, alumni):
        Templated.__init__(self, sorts=sorts, team=team, alumni=alumni)

        sort_buttons = [
            OffsiteButton(
                sort["title"],
                "#sort/" + sort["id"],
                css_class="choice-" + sort["id"],
            )
            for sort in sorts.values()]
        self.sort_menu = NavMenu(
            sort_buttons, 
            title=_("sorted by"),
            base_path=request.path,
            type="lightdrop",
            default="#sort/random",
        )