def find_current_poll(self): return queries.get_all_enabled_polls().first()
def initial_setup(self): poll = get_all_enabled_polls().first() if poll: self.poll = component.Component(Poll(poll.id)) else: self.poll = component.Component(None) self.locale_box.becomes(LocaleChoice()) self.idea_submit.becomes(SubmitIdeaBox(self)) self.search.becomes(SearchBlock(self)) self.idea_chart.becomes(IdeaBarChart(self)) self.welcome.becomes(Welcome(self)) self.online_shop.becomes(OnlineShop(self)) self.faq.becomes(FAQ(self)) self.terms_of_use.becomes(TermsOfUse(self)) self.login_box.becomes(Login()) # Note: setup done here because we need to access the current user and check the # permissions in order to setup the component but they are not available when # the Portal component is created. # password change modal dialog current_user = get_current_user() if current_user and current_user.should_change_password(): self.show_password_editor(current_user) current_user = get_current_user() if current_user: self.login_box.becomes(User(self, current_user), model='login_status') self.menu_items = [ (_(u'home'), _(u"Go to the home page"), 'home', self.show_home), (_(u'news'), None, 'news', self.show_articles_by_type), (_(u'challenge'), _(u"View, comment and vote for challenge ideas"), 'challenges', self.show_challenge_ideas), (_(u'ideas'), _(u"View, comment and vote for ideas"), 'ideas', self.show_ideas), ] self.menu_items.extend([ (_(u"discover eurêka"), None, 'welcome', self.show_welcome), (_(u'gifts'), None, 'shop', self.show_shop), (_(u'help'), None, 'help', self.show_help), (_(u'contact us'), None, 'contact_us', self.show_contact) ]) self.menu.becomes(Menu(self.menu_items), model='list') self.footer_menu_items = [ (_(u'Help'), None, 'help', self.show_help), (_(u'Suggestions'), None, 'improvements', self.show_suggestions), (_(u'Terms of use'), None, 'terms_of_use', self.show_terms_of_use), ] self.footer_menu.becomes(Menu(self.footer_menu_items), model='links') # initial the content if necessary (that is, when no presentation.init_for rule was # called) if not self.content(): self.select_tab(0)
def find_current_poll(self): return queries.get_all_enabled_polls().first()
def initial_setup(self): poll = get_all_enabled_polls().first() if poll: self.poll = component.Component(Poll(poll.id)) else: self.poll = component.Component(None) self.locale_box.becomes(LocaleChoice()) self.idea_submit.becomes(SubmitIdeaBox(self)) self.search.becomes(SearchBlock(self)) self.idea_chart.becomes(IdeaBarChart(self)) self.welcome.becomes(Welcome(self)) self.online_shop.becomes(OnlineShop(self)) self.faq.becomes(FAQ(self)) self.terms_of_use.becomes(TermsOfUse(self)) self.login_box.becomes(Login()) # Note: setup done here because we need to access the current user and check the # permissions in order to setup the component but they are not available when # the Portal component is created. # password change modal dialog current_user = get_current_user() if current_user and current_user.should_change_password(): self.show_password_editor(current_user) current_user = get_current_user() if current_user: self.login_box.becomes(User(self, current_user), model='login_status') self.menu_items = [ (_(u'home'), _(u"Go to the home page"), 'home', self.show_home), (_(u'news'), None, 'news', self.show_articles_by_type), (_(u'challenge'), _(u"View, comment and vote for challenge ideas"), 'challenges', self.show_challenge_ideas), (_(u'ideas'), _(u"View, comment and vote for ideas"), 'ideas', self.show_ideas), ] self.menu_items.extend([ (_(u"discover eurêka"), None, 'welcome', self.show_welcome), (_(u'gifts'), None, 'shop', self.show_shop), (_(u'help'), None, 'help', self.show_help), (_(u'contact us'), None, 'contact_us', self.show_contact) ]) self.menu.becomes(Menu(self.menu_items), model='list') self.footer_menu_items = [(_(u'Help'), None, 'help', self.show_help), (_(u'Suggestions'), None, 'improvements', self.show_suggestions), (_(u'Terms of use'), None, 'terms_of_use', self.show_terms_of_use), ] self.footer_menu.becomes(Menu(self.footer_menu_items), model='links') # initial the content if necessary (that is, when no presentation.init_for rule was # called) if not self.content(): self.select_tab(0)