예제 #1
0
 def create_idea_pager(self):
     """Get an idea pager that show ideas in this challenge"""
     # FIXME: late import to avoid circular dependencies problem
     from eureka.ui.desktop.idea import IdeaPager
     q = queries.get_published_challenge_ideas(self.challenge_id)
     pager = IdeaPager(self, q)
     pager.specific_challenge()
     return pager
예제 #2
0
 def create_idea_pager(self):
     """Get an idea pager that show ideas in this challenge"""
     # FIXME: late import to avoid circular dependencies problem
     from eureka.ui.desktop.idea import IdeaPager
     q = queries.get_published_challenge_ideas(self.challenge_id)
     pager = IdeaPager(self, q)
     pager.specific_challenge()
     return pager
예제 #3
0
def _handle_signal_view_idea_edit_user(self, sender, signal, *args, **kwds):
    # self.idea_submit.becomes(None)
    self.content.becomes(self, model='one_col')
    if security.has_permissions('view_unpublished_ideas', sender.user):
        p = IdeaPager(self, lambda: get_all_user_ideas(sender.uid), 9)
    else:
        p = IdeaPager(self, lambda: get_published_user_ideas(sender.uid), 9)

    p.goto(kwds.get('idea_id'))
예제 #4
0
    def get_idea_pager(self):
        # FIXME: late import to avoid circular dependencies problem

        if self.pager is None:

            idea_pager = IdeaPager(self, lambda: self._ideas)
            idea_pager.change_transform("user")
            idea_pager.change_order("publication_date_desc")
            self.pager = InfinitePager(component.Component(idea_pager, model='ideas-list'))
        return self.pager
예제 #5
0
 def search_ideas(self, pattern):
     if is_integer(pattern):
         idea_id = int(pattern)
         pager = IdeaPager(
             self,
             lambda idea_id=idea_id: get_all_published_ideas_unordered().filter(IdeaData.id == idea_id))
     else:
         pager = IdeaPager(
             self,
             lambda pattern=pattern: get_searched_ideas(pattern))
     pager.change_order("publication_date_desc")
     pager = InfinitePager(component.Component(pager, model='ideas-list'))
     box = IdeaPagerBox(pager, model='ideas-list')
     return self._show(box, selected_tab='search')
예제 #6
0
 def create_idea_box(idea_ids, page_title=_(u'Ideas on alert')):
     query = lambda: IdeaRepository().get_by_ids(idea_ids)
     pager = IdeaPager(self.parent, query)
     return IdeaPagerBox(pager,
                         model='simple',
                         title=page_title,
                         ok_button=_(u'Back to the dashboard'))
예제 #7
0
 def show_user_ideas_basket_with_state(self, state_id, user=None):
     uid = self._uid(user)
     pager = IdeaPager(self, get_all_user_ideas_with_state(uid, state_id))
     pager = InfinitePager(component.Component(pager, model='ideas-list'))
     return self._show(IdeaPagerBox(pager, model='list'),
                       selected_tab='my',
                       with_idea_submit=True)
예제 #8
0
    def show_ideas(self, user_uid, state_id, query_factory):
        self.show_proxy_ideas = False
        self.state_id = state_id
        query = query_factory(user_uid, state_id)
        pager = IdeaPager(self.parent, query)
        pager = InfinitePager(component.Component(pager, model='ideas-list'))

        self.pager.becomes(pager, model='list')
예제 #9
0
    def toggle_proxy_ideas(self, user_uid):
        self.state_id = None
        self.show_proxy_ideas = not self.show_proxy_ideas
        if self.show_proxy_ideas:
            query = lambda uid=user_uid: UserData.get_proxy_ideas(uid)
            pager = IdeaPager(self.parent, query)
            pager = InfinitePager(
                component.Component(pager, model='ideas-list'))

            self.pager.becomes(pager, model='list')
예제 #10
0
 def show_domain(self, domain_id, domain_label):
     pager = IdeaPager(self, get_all_published_ideas_unordered)
     # FIXME: should be moved into an appropriate method of the pager
     pager.change_filter_domain('domain_%d' % domain_id)
     pager.change_order('publication_date_desc')
     pager = InfinitePager(
         component.Component(pager, model='domain-ideas-list'))
     return self._show(IdeaPagerBox(pager, model='list'),
                       selected_tab='ideas')
예제 #11
0
    def show_launched_ideas(self):

        pager = IdeaPager(self, get_all_published_ideas_unordered)
        menu_items = (
            (_(u"Last published"), pager.last_published),
            (_(u"Progressing"), pager.progressing_ideas),
            (_(u"Most viewed"), pager.most_viewed),
            (_(u"Launched ideas"), pager.launched_ideas),
        )
        pager = InfinitePager(component.Component(pager, model='ideas-list'))
        box = IdeaPagerBox(pager, model='list', menu_items=menu_items)
        box.select_item(3)

        return self._show(box, selected_tab='ideas', with_idea_submit=True)
예제 #12
0
def _handle_signal_view_idea_edit_user(self, sender, signal, *args, **kwds):
    # self.idea_submit.becomes(None)
    self.content.becomes(self, model='one_col')
    if security.has_permissions('view_unpublished_ideas', sender.user):
        p = IdeaPager(self, lambda: get_all_user_ideas(sender.uid), 9)
    else:
        p = IdeaPager(self, lambda: get_published_user_ideas(sender.uid), 9)

    p.goto(kwds.get('idea_id'))
예제 #13
0
 def show_domain(self, domain_id, domain_label):
     pager = IdeaPager(self, get_all_published_ideas_unordered)
     # FIXME: should be moved into an appropriate method of the pager
     pager.change_filter_domain('domain_%d' % domain_id)
     pager.change_order('publication_date_desc')
     pager = InfinitePager(
         component.Component(pager, model='domain-ideas-list'))
     return self._show(IdeaPagerBox(pager, model='list'),
                       selected_tab='ideas')
예제 #14
0
 def search_ideas(self, pattern):
     if is_integer(pattern):
         idea_id = int(pattern)
         pager = IdeaPager(
             self,
             lambda idea_id=idea_id: get_all_published_ideas_unordered(
             ).filter(IdeaData.id == idea_id))
     else:
         pager = IdeaPager(
             self, lambda pattern=pattern: get_searched_ideas(pattern))
     pager.change_order("publication_date_desc")
     pager = InfinitePager(component.Component(pager, model='ideas-list'))
     box = IdeaPagerBox(pager, model='ideas-list')
     return self._show(box, selected_tab='search')
예제 #15
0
 def _create_pager_all_challenges(self, parent, challenge_id=None):
     q = get_published_challenge_ideas(challenge_id)
     pager = IdeaPager(parent, q)
     pager.all_challenges()
     return pager
예제 #16
0
def _handle_signal_view_idea_user(self, sender, signal, *args, **kwds):
    if security.has_permissions('view_unpublished_ideas', sender.user):
        p = IdeaPager(self, lambda: get_all_user_ideas(sender.uid), 9)
    else:
        p = IdeaPager(self, lambda: get_published_user_ideas(sender.uid), 9)
    p.goto(kwds.get('idea_id'))
예제 #17
0
 def show_tag_ideas(self, tag_label):
     pager = IdeaPager(self, get_published_tag_ideas(tag_label))
     pager.change_order('publication_date_desc')
     pager = InfinitePager(component.Component(pager, model='ideas-list'))
     box = IdeaPagerBox(pager)
     return self._show(box, selected_tab='ideas')
예제 #18
0
def _handle_signal_view_idea_user(self, sender, signal, *args, **kwds):
    if security.has_permissions('view_unpublished_ideas', sender.user):
        p = IdeaPager(self, lambda: get_all_user_ideas(sender.uid), 9)
    else:
        p = IdeaPager(self, lambda: get_published_user_ideas(sender.uid), 9)
    p.goto(kwds.get('idea_id'))
예제 #19
0
 def show_home(self):
     # FIXME: what is it used for?
     self.idea_pager.becomes(IdeaPager(self, get_all_published_ideas))
     return self._show(HomePage(self), selected_tab='home')
예제 #20
0
 def show_tag_ideas(self, tag_label):
     pager = IdeaPager(self, get_published_tag_ideas(tag_label))
     pager.change_order('publication_date_desc')
     pager = InfinitePager(component.Component(pager, model='ideas-list'))
     box = IdeaPagerBox(pager)
     return self._show(box, selected_tab='ideas')