def render_home_settings_editor(self, h, comp, *args): def commit_and_answer(): if self.commit(): comp.answer(True) with h.form(class_='home-settings-editor').pre_action(self.reset_fields): with h.div(class_='fields'): with h.div(class_='show-progressing-ideas field'): field_id = h.generate_id('field') h << h.input(type='checkbox', class_='checkbox').selected(self.show_progressing_ideas()).action(self.show_progressing_ideas) h << h.label(_("Show progressing ideas"), for_=field_id) with h.div(class_='show-tracked-ideas field'): field_id = h.generate_id('field') h << h.input(type='checkbox', class_='checkbox').selected(self.show_tracked_ideas()).action(self.show_tracked_ideas) h << h.label(_("Show tracked ideas"), for_=field_id) with h.div(class_='show-challenges-ideas field'): field_id = h.generate_id('field') h << h.input(type='checkbox', class_='checkbox').selected(self.show_challenges_ideas()).action(self.show_challenges_ideas) h << h.label(_("Show challenges published ideas"), for_=field_id) with h.div(class_='show-domains field'): with h.fieldset: with h.legend: h << _("Show domain ideas") domain_items = [(domain.i18n_label, domain.id) for domain in self.domains] h << component.Component( CheckboxChoice(self.domains_choice, domain_items)) with h.div(class_="field"): with h.label: h << _(u'Keyword filter') h << h.input(type='text', value=self.keyword_filter(), class_='text wide').action(self.keyword_filter).error(self.keyword_filter.error) with h.div(class_='recipients-field field'): with h.label: h << _(u'User filter') with h.span(class_='legend'): h << _(u"If there's more than one user, separate them with a comma") autocomplete = Autocomplete(lambda s: search_users_fulltext(s, limit=20), delim_char=",", type='text', class_='text wide', max_results_displayed=20, value=self.users_filter(), action=self.users_filter, error=self.users_filter.error) h << component.Component(autocomplete).render(h) with h.div(class_='buttons'): h << h.input(type='submit', value=_("Ok")).action(commit_and_answer) return h.root
def render_points_admin_form(self, h, comp, *args): def commit(): if self.commit(): comp.answer() with h.h1(class_="tab active big"): with h.span: h << h.a(_(u'Points management')) with h.form.post_action(self.check_users_have_enough_points): with h.div(class_='fields'): with h.fieldset: with h.legend: h << _(u'Category:') items = list((label, value) for value, label, _ in self._ActionList) h << component.Component(RadioChoice(self.category, items)) with h.div(class_='recipients-field field'): h << h.label(_(u'Recipients email addresses:')) autocomplete = Autocomplete(lambda s: search_users_fulltext(s, limit=20), delim_char=",", type='text', class_='text wide', max_results_displayed=20, value=self.users_emails(), action=self.users_emails, error=self.users_emails.error) h << component.Component(autocomplete).render(h) with h.div(class_='how-many-points-field field'): h << h.label(_(u'How many points?')) h << h.input(type='text', class_='text wide', value=self.points()).action(self.points).error(self.points.error) with h.div(class_='reason-field field'): h << h.label(_(u'Reason?')) h << h.input(type='text', class_='text wide', value=self.reason()).action(self.reason).error(self.reason.error) with h.div(class_='buttons'): h << h.input(type='submit', class_='confirm-button', value=_(u'Confirm')).action(commit) return h.root
def render_evaluation_menu_expert(self, h, comp, *args): label = _(u"I consulted experts") h << h.a(label, title=label).action(lambda: self.toggle_item('expert')) h << h.div(_(u"Write down the expert analysis"), class_="legend") if self.selected_item() == 'expert': h << comp.render(h, model='expert_comments') with h.form: with h.div(class_='fields'): with h.div(class_='expert-field field'): h << h.label(_(u'Expert email')) max_results_displayed = 20 h << component.Component(Autocomplete( lambda s: search_users_fulltext(s, limit=max_results_displayed), type='text', class_='text wide', name='expert_email', max_results_displayed=max_results_displayed, value=self.expert_email(), action=self.expert_email, error=self.expert_email.error)).render(h) h << h.div( _(u'I fill in the email of the expert I consulted'), class_='legend') with h.div(class_='comment-field field'): h << h.label(_(u'Comment')) h << h.textarea(self.comment() or u'', rows='', cols='').action(self.comment).error( self.comment.error) h << h.div( _(u'I fill in the expert comment about the idea'), class_='legend') with h.div(class_='buttons'): h << h.input(type='submit', value=_(u"Save"), class_="ok").action(self.update_expert) return h.root
def render_evaluation_menu_expert(self, h, comp, *args): label = _(u"I consulted experts") h << h.a(label, title=label).action(lambda: self.toggle_item('expert')) h << h.div(_(u"Write down the expert analysis"), class_="legend") if self.selected_item() == 'expert': h << comp.render(h, model='expert_comments') with h.form: with h.div(class_='fields'): with h.div(class_='expert-field field'): h << h.label(_(u'Expert email')) max_results_displayed = 20 h << component.Component( Autocomplete( lambda s: search_users_fulltext( s, limit=max_results_displayed), type='text', class_='text wide', name='expert_email', max_results_displayed=max_results_displayed, value=self.expert_email(), action=self.expert_email, error=self.expert_email.error)).render(h) h << h.div( _(u'I fill in the email of the expert I consulted'), class_='legend') with h.div(class_='comment-field field'): h << h.label(_(u'Comment')) h << h.textarea(self.comment() or u'', rows='', cols='').action(self.comment).error( self.comment.error) h << h.div( _(u'I fill in the expert comment about the idea'), class_='legend') with h.div(class_='buttons'): h << h.input(type='submit', value=_(u"Save"), class_="ok").action(self.update_expert) return h.root
def render_home_settings_editor(self, h, comp, *args): def commit_and_answer(): if self.commit(): comp.answer(True) with h.form(class_='home-settings-editor').pre_action(self.reset_fields): with h.div(class_='fields'): with h.div(class_='show-progressing-ideas field'): field_id = h.generate_id('field') h << h.input(type='checkbox', class_='checkbox').selected( self.show_progressing_ideas()).action( self.show_progressing_ideas) h << h.label(_("Show progressing ideas"), for_=field_id) with h.div(class_='show-tracked-ideas field'): field_id = h.generate_id('field') h << h.input(type='checkbox', class_='checkbox').selected( self.show_tracked_ideas()).action(self.show_tracked_ideas) h << h.label(_("Show tracked ideas"), for_=field_id) with h.div(class_='show-challenges-ideas field'): field_id = h.generate_id('field') h << h.input(type='checkbox', class_='checkbox').selected( self.show_challenges_ideas()).action( self.show_challenges_ideas) h << h.label(_("Show challenges published ideas"), for_=field_id) with h.div(class_='show-domains field'): with h.fieldset: with h.legend: h << _("Show domain ideas") domain_items = [(domain.i18n_label, domain.id) for domain in self.domains] h << component.Component( CheckboxChoice(self.domains_choice, domain_items)) with h.div(class_="field"): with h.label: h << _(u'Keyword filter') h << h.input(type='text', value=self.keyword_filter(), class_='text wide').action( self.keyword_filter).error( self.keyword_filter.error) with h.div(class_='recipients-field field'): with h.label: h << _(u'User filter') with h.span(class_='legend'): h << _( u"If there's more than one user, separate them with a comma" ) autocomplete = Autocomplete( lambda s: search_users_fulltext(s, limit=20), delim_char=",", type='text', class_='text wide', max_results_displayed=20, value=self.users_filter(), action=self.users_filter, error=self.users_filter.error) h << component.Component(autocomplete).render(h) with h.div(class_='buttons'): h << h.input(type='submit', value=_("Ok")).action(commit_and_answer) return h.root
def render_challenge_editor(self, h, comp, *args): with h.div(class_='challenge-editor'): h << render_title(h, _(u'Edit the challenge')) with h.form.post_action(self.post_validate): with h.div(class_='fields'): # title with h.div(class_='title'): field_id = h.generate_id('field') h << h.label(_(u'Title'), for_=field_id) << ' ' h << h.input(type='text', id=field_id, class_='text wide', value=self.title()).action(self.title).error(self.title.error) with h.div(class_='short-title'): field_id = h.generate_id('field') h << h.label(_(u'Short title'), for_=field_id) << ' ' h << h.input(type='text', id=field_id, class_='text wide', value=self.short_title()).action(self.short_title).error(self.short_title.error) with h.div(class_='tags'): field_id = h.generate_id('field') h << h.label(_(u'Tags'), for_=field_id) << ' ' h << h.input(type='text', id=field_id, class_='text wide', value=self.tags()).action(self.tags).error(self.tags.error) # author information with h.div(class_='created-by'): field_id = h.generate_id('field') h << h.label(_(u'Created by (email)'), for_=field_id) << ' ' autocomplete = Autocomplete(lambda s: search_users_fulltext(s, limit=20), ac_class='zindex999', type='text', class_='text wide', id=field_id, max_results_displayed=20, value=self.created_by(), action=self.created_by, error=self.created_by.error) h << component.Component(autocomplete).render(h) with h.div(class_='organization'): field_id = h.generate_id('field') h << h.label(_(u'Organization'), for_=field_id) << ' ' h << h.input(type='text', id=field_id, class_='text wide', value=self.organization()).action(self.organization).error(self.organization.error) with h.div(class_='associated-dis'): field_id = h.generate_id('field') h << h.label(_(u"Challenge's developers (emails)"), for_=field_id) << ' ' autocomplete = Autocomplete(lambda s: search_users_fulltext(s, limit=20), ac_class='zindex998', delim_char=",", type='text', class_='text wide', id=field_id, max_results_displayed=20, value=self.associated_dis(), action=self.associated_dis, error=self.associated_dis.error) h << component.Component(autocomplete).render(h) with h.div(class_='period'): # starting date with h.span(class_='starting-date'): starting_date_calendar = component.Component(Calendar('challenge_starting_date', title=_(u'Select a date'), close_button=True)) h << h.label(_(u'Start date (included)'), for_=starting_date_calendar().field_id) << ' ' h << h.input(type='text', id=starting_date_calendar().field_id, class_='date', value=self.starting_date()).action(self.starting_date) h << starting_date_calendar.render(h, model='date_picker') if self.starting_date.error: h << h.div(self.starting_date.error, class_='nagare-error-message') # ending date with h.span(class_='ending-date'): ending_date_calendar = component.Component(Calendar('challenge_ending_date', title=_(u'Select a date'), close_button=True)) h << h.label(_(u'End date (included)'), for_=ending_date_calendar().field_id) << ' ' h << h.input(type='text', id=ending_date_calendar().field_id, class_='date', value=self.ending_date()).action(self.ending_date) h << ending_date_calendar.render(h, model='date_picker') if self.ending_date.error: h << h.div(self.ending_date.error, class_='nagare-error-message') h << starting_date_calendar h << ending_date_calendar # summary with h.div(class_='summary'): field_id = h.generate_id('field') h << h.label(_(u'Summary'), for_=field_id) summary_rte = RichTextEditor(property=self.summary, height=150, id=field_id, gallery_url=self.gallery_url(field_id)) h << component.Component(summary_rte) # description with h.div(class_='desktop-description'): field_id = h.generate_id('field') h << h.label(_(u'Desktop Description'), for_=field_id) description_rte = RichTextEditor(property=self.description, height=300, id=field_id, gallery_url=self.gallery_url(field_id)) h << component.Component(description_rte) if self.mobile_access: # mobile description with h.div(class_='mobile-description'): field_id = h.generate_id('field') h << h.label(_(u'Mobile Description'), for_=field_id) mobile_description_rte = RichTextEditor(property=self.mobile_description, height=400, max_chars=200, id=field_id, gallery_url=self.gallery_url(field_id)) h << component.Component(mobile_description_rte) # outcome if self.finished: with h.div(class_='outcome'): field_id = h.generate_id('field') h << h.label(_(u'Outcome'), for_=field_id) outcome_rte = RichTextEditor(property=self.outcome, height=300, id=field_id, gallery_url=self.gallery_url(field_id)) h << component.Component(outcome_rte) # buttons with h.div(class_='buttons'): h << h.input(type='submit', class_='confirm-button', value=_(u'Save')).action(lambda: self.commit() and comp.answer()) return h.root
def render_challenge_editor(self, h, comp, *args): with h.div(class_='challenge-editor'): h << render_title(h, _(u'Edit the challenge')) with h.form.post_action(self.post_validate): with h.div(class_='fields'): # title with h.div(class_='title'): field_id = h.generate_id('field') h << h.label(_(u'Title'), for_=field_id) << ' ' h << h.input(type='text', id=field_id, class_='text wide', value=self.title()).action(self.title).error( self.title.error) with h.div(class_='short-title'): field_id = h.generate_id('field') h << h.label(_(u'Short title'), for_=field_id) << ' ' h << h.input(type='text', id=field_id, class_='text wide', value=self.short_title()).action( self.short_title).error( self.short_title.error) with h.div(class_='tags'): field_id = h.generate_id('field') h << h.label(_(u'Tags'), for_=field_id) << ' ' h << h.input(type='text', id=field_id, class_='text wide', value=self.tags()).action(self.tags).error( self.tags.error) # author information with h.div(class_='created-by'): field_id = h.generate_id('field') h << h.label(_(u'Created by (email)'), for_=field_id) << ' ' autocomplete = Autocomplete( lambda s: search_users_fulltext(s, limit=20), ac_class='zindex999', type='text', class_='text wide', id=field_id, max_results_displayed=20, value=self.created_by(), action=self.created_by, error=self.created_by.error) h << component.Component(autocomplete).render(h) with h.div(class_='organization'): field_id = h.generate_id('field') h << h.label(_(u'Organization'), for_=field_id) << ' ' h << h.input(type='text', id=field_id, class_='text wide', value=self.organization()).action( self.organization).error( self.organization.error) with h.div(class_='associated-dis'): field_id = h.generate_id('field') h << h.label(_(u"Challenge's developers (emails)"), for_=field_id) << ' ' autocomplete = Autocomplete( lambda s: search_users_fulltext(s, limit=20), ac_class='zindex998', delim_char=",", type='text', class_='text wide', id=field_id, max_results_displayed=20, value=self.associated_dis(), action=self.associated_dis, error=self.associated_dis.error) h << component.Component(autocomplete).render(h) with h.div(class_='period'): # starting date with h.span(class_='starting-date'): starting_date_calendar = component.Component( Calendar('challenge_starting_date', title=_(u'Select a date'), close_button=True)) h << h.label( _(u'Start date (included)'), for_=starting_date_calendar().field_id) << ' ' h << h.input(type='text', id=starting_date_calendar().field_id, class_='date', value=self.starting_date()).action( self.starting_date) h << starting_date_calendar.render(h, model='date_picker') if self.starting_date.error: h << h.div(self.starting_date.error, class_='nagare-error-message') # ending date with h.span(class_='ending-date'): ending_date_calendar = component.Component( Calendar('challenge_ending_date', title=_(u'Select a date'), close_button=True)) h << h.label( _(u'End date (included)'), for_=ending_date_calendar().field_id) << ' ' h << h.input(type='text', id=ending_date_calendar().field_id, class_='date', value=self.ending_date()).action( self.ending_date) h << ending_date_calendar.render(h, model='date_picker') if self.ending_date.error: h << h.div(self.ending_date.error, class_='nagare-error-message') h << starting_date_calendar h << ending_date_calendar # summary with h.div(class_='summary'): field_id = h.generate_id('field') h << h.label(_(u'Summary'), for_=field_id) summary_rte = RichTextEditor( property=self.summary, height=150, id=field_id, gallery_url=self.gallery_url(field_id)) h << component.Component(summary_rte) # description with h.div(class_='desktop-description'): field_id = h.generate_id('field') h << h.label(_(u'Desktop Description'), for_=field_id) description_rte = RichTextEditor( property=self.description, height=300, id=field_id, gallery_url=self.gallery_url(field_id)) h << component.Component(description_rte) if self.mobile_access: # mobile description with h.div(class_='mobile-description'): field_id = h.generate_id('field') h << h.label(_(u'Mobile Description'), for_=field_id) mobile_description_rte = RichTextEditor( property=self.mobile_description, height=400, max_chars=200, id=field_id, gallery_url=self.gallery_url(field_id)) h << component.Component(mobile_description_rte) # outcome if self.finished: with h.div(class_='outcome'): field_id = h.generate_id('field') h << h.label(_(u'Outcome'), for_=field_id) outcome_rte = RichTextEditor( property=self.outcome, height=300, id=field_id, gallery_url=self.gallery_url(field_id)) h << component.Component(outcome_rte) # buttons with h.div(class_='buttons'): h << h.input( type='submit', class_='confirm-button', value=_(u'Save') ).action(lambda: self.commit() and comp.answer()) return h.root