Esempio n. 1
0
    def menus(self):
        filters = [
            NamedButton('all_promos', dest=''),
            NamedButton('future_promos'),
            NamedButton('unpaid_promos'),
            NamedButton('rejected_promos'),
            NamedButton('pending_promos'),
            NamedButton('live_promos'),
        ]
        menus = [NavMenu(filters, base_path='/promoted', title='show',
                        type='lightdrop')]

        if self.sort == 'live_promos' and c.user_is_sponsor:
            srnames = promote.all_live_promo_srnames()
            buttons = [NavButton('all', '')]
            try:
                srnames.remove(Frontpage.name)
                frontbutton = NavButton('FRONTPAGE', Frontpage.name,
                                        aliases=['/promoted/live_promos/%s' %
                                                 urllib.quote(Frontpage.name)])
                buttons.append(frontbutton)
            except KeyError:
                pass

            srnames = sorted(srnames, key=lambda name: name.lower())
            buttons.extend([NavButton(name, name) for name in srnames])
            menus.append(NavMenu(buttons, base_path='/promoted/live_promos',
                                 title='subreddit', type='lightdrop'))

        return menus
Esempio n. 2
0
    def menus(self):
        filters = [
            NamedButton('all_promos', dest=''),
            NamedButton('future_promos'),
            NamedButton('unpaid_promos'),
            NamedButton('rejected_promos'),
            NamedButton('pending_promos'),
            NamedButton('live_promos'),
        ]
        menus = [NavMenu(filters, base_path='/promoted', title='show',
                        type='lightdrop')]

        if self.sort == 'live_promos' and c.user_is_sponsor:
            srnames = promote.all_live_promo_srnames()
            buttons = [NavButton('all', '')]
            try:
                srnames.remove(Frontpage.name)
                frontbutton = NavButton('FRONTPAGE', Frontpage.name,
                                        aliases=['/promoted/live_promos/%s' %
                                                 urllib.quote(Frontpage.name)])
                buttons.append(frontbutton)
            except KeyError:
                pass

            srnames = sorted(srnames, key=lambda name: name.lower())
            buttons.extend([NavButton(name, name) for name in srnames])
            menus.append(NavMenu(buttons, base_path='/promoted/live_promos',
                                 title='subreddit', type='lightdrop'))

        return menus
Esempio n. 3
0
    def menus(self):
        if self.sort in {'underdelivered', 'reported', 'house', 'fraud'}:
            menus = []
        else:
            menus = super(SponsorListingController, self).menus
            menus.append(NavMenu([
                QueryButton("exclude managed", dest=None,
                            query_param='include_managed'),
                QueryButton("include managed", dest="yes",
                            query_param='include_managed'),
            ], base_path=request.path, type='lightdrop'))

        if self.sort == 'live_promos':
            srnames = promote.all_live_promo_srnames()
            buttons = [NavButton('all', '', use_params=True)]
            try:
                srnames.remove(Frontpage.name)
                frontbutton = NavButton('FRONTPAGE', Frontpage.name,
                                        use_params=True,
                                        aliases=['/promoted/live_promos/%s' %
                                                 urllib.quote(Frontpage.name)])
                buttons.append(frontbutton)
            except KeyError:
                pass

            srnames = sorted(srnames, key=lambda name: name.lower())
            buttons.extend(
                NavButton(name, name, use_params=True) for name in srnames)
            base_path = self.base_path + '/live_promos'
            menus.append(NavMenu(buttons, base_path=base_path,
                                 title='subreddit', type='lightdrop'))
        return menus
Esempio n. 4
0
    def menus(self):
        if self.sort in {'underdelivered', 'reported', 'house'}:
            menus = []
        else:
            menus = super(SponsorListingController, self).menus
            menus.append(NavMenu([
                QueryButton("exclude managed", dest=None,
                            query_param='include_managed'),
                QueryButton("include managed", dest="yes",
                            query_param='include_managed'),
            ], base_path=request.path, type='lightdrop'))

        if self.sort == 'live_promos':
            srnames = promote.all_live_promo_srnames()
            buttons = [NavButton('all', '', use_params=True)]
            try:
                srnames.remove(Frontpage.name)
                frontbutton = NavButton('FRONTPAGE', Frontpage.name,
                                        use_params=True,
                                        aliases=['/promoted/live_promos/%s' %
                                                 urllib.quote(Frontpage.name)])
                buttons.append(frontbutton)
            except KeyError:
                pass

            srnames = sorted(srnames, key=lambda name: name.lower())
            buttons.extend(
                NavButton(name, name, use_params=True) for name in srnames)
            base_path = self.base_path + '/live_promos'
            menus.append(NavMenu(buttons, base_path=base_path,
                                 title='subreddit', type='lightdrop'))
        return menus
Esempio n. 5
0
    def menus(self):
        if self.sort in {"underdelivered", "reported", "house"}:
            menus = []
        else:
            menus = super(SponsorListingController, self).menus
            menus.append(
                NavMenu(
                    [
                        QueryButton("exclude managed", dest=None, query_param="include_managed"),
                        QueryButton("include managed", dest="yes", query_param="include_managed"),
                    ],
                    base_path=request.path,
                    type="lightdrop",
                )
            )

        if self.sort == "live_promos":
            srnames = promote.all_live_promo_srnames()
            buttons = [NavButton("all", "", use_params=True)]
            try:
                srnames.remove(Frontpage.name)
                frontbutton = NavButton(
                    "FRONTPAGE",
                    Frontpage.name,
                    use_params=True,
                    aliases=["/promoted/live_promos/%s" % urllib.quote(Frontpage.name)],
                )
                buttons.append(frontbutton)
            except KeyError:
                pass

            srnames = sorted(srnames, key=lambda name: name.lower())
            buttons.extend(NavButton(name, name, use_params=True) for name in srnames)
            base_path = self.base_path + "/live_promos"
            menus.append(NavMenu(buttons, base_path=base_path, title="subreddit", type="lightdrop"))
        return menus