コード例 #1
0
ファイル: org_app.py プロジェクト: rhyolight/nupic.son
 def __init__(self, data):
     """See template.Template.__init__ for specification."""
     super(PublicOrganizationList, self).__init__(data)
     self._list_config = lists.ListConfiguration()
     self._list_config.addPlainTextColumn("name", "Name", lambda e, *args: e.name.strip())
     self._list_config.addPlainTextColumn("tags", "Tags", lambda e, *args: ", ".join(e.tags))
     self._list_config.addPlainTextColumn(
         "ideas", "Ideas", lambda e, *args: url_helper.urlize(e.ideas, name="[ideas page]"), hidden=True
     )
コード例 #2
0
 def __init__(self, data):
   """See template.Template.__init__ for specification."""
   super(PublicOrganizationList, self).__init__(data)
   self._list_config = lists.ListConfiguration()
   self._list_config.addPlainTextColumn(
       'name', 'Name', lambda e, *args: e.name.strip())
   self._list_config.addPlainTextColumn(
       'tags', 'Tags', lambda e, *args: ', '.join(e.tags))
   self._list_config.addPlainTextColumn('ideas', 'Ideas',
       lambda e, *args: url_helper.urlize(e.ideas, name='[ideas page]'),
       hidden=True)
コード例 #3
0
ファイル: accepted_orgs.py プロジェクト: adviti/melange
  def __init__(self, request, data):
    self.request = request
    self.data = data
    r = data.redirect

    list_config = lists.ListConfiguration()
    list_config.addColumn('name', 'Name',
        lambda e, *args: e.name.strip())
    list_config.addSimpleColumn('link_id', 'Link ID', hidden=True)
    list_config.setRowAction(
        lambda e, *args: r.organization(e).urlOf(url_names.GCI_ORG_HOME))
    list_config.addColumn(
        'ideas', 'Ideas',
        (lambda e, *args: url_helper.urlize(e.ideas, name="[ideas page]")),
        hidden=True)
    list_config.setDefaultPagination(False)
    list_config.setDefaultSort('name')

    self._list_config = list_config
コード例 #4
0
ファイル: accepted_orgs.py プロジェクト: rhyolight/nupic.son
  def _getListConfig(self):
    # TODO(nathaniel): squeeze this back into a lambda expression in
    # the call to setRowAction below.
    def RowAction(e, *args):
      # TODO(nathaniel): make this .organization call unnecessary.
      self.data.redirect.organization(organization=e)

      return self.data.redirect.urlOf(url_names.GCI_ORG_HOME)

    list_config = lists.ListConfiguration()
    list_config.addPlainTextColumn('name', 'Name',
        lambda e, *args: e.name.strip())
    list_config.addSimpleColumn('link_id', 'Organization ID', hidden=True)
    list_config.setRowAction(RowAction)
    list_config.addPlainTextColumn(
        'ideas', 'Ideas',
        (lambda e, *args: url_helper.urlize(e.ideas, name="[ideas page]")),
        hidden=True)
    list_config.setDefaultPagination(False)
    list_config.setDefaultSort('name')
    return list_config
コード例 #5
0
    def _getListConfig(self):
        # TODO(nathaniel): squeeze this back into a lambda expression in
        # the call to setRowAction below.
        def RowAction(e, *args):
            # TODO(nathaniel): make this .organization call unnecessary.
            self.data.redirect.organization(organization=e)

            return self.data.redirect.urlOf(url_names.GCI_ORG_HOME)

        list_config = lists.ListConfiguration()
        list_config.addPlainTextColumn('name', 'Name',
                                       lambda e, *args: e.name.strip())
        list_config.addSimpleColumn('link_id', 'Organization ID', hidden=True)
        list_config.setRowAction(RowAction)
        list_config.addPlainTextColumn(
            'ideas',
            'Ideas',
            (lambda e, *args: url_helper.urlize(e.ideas, name="[ideas page]")),
            hidden=True)
        list_config.setDefaultPagination(False)
        list_config.setDefaultSort('name')
        return list_config
コード例 #6
0
ファイル: lists.py プロジェクト: rhyolight/nupic.son
 def getValue(self, entity):
   """See Column.getValue for specification."""
   return url_helper.urlize(entity.ideas_page, name='Ideas page')
コード例 #7
0
  def __init__(self, data):
    self.data = data
    self.idx = 1

    list_config = lists.ListConfiguration()

    list_config.setRowAction(
        lambda entity, *args: data.redirect.profile(
            entity.profile_id).urlOf(url_names.GCI_STUDENT_TASKS))

    list_config.addSimpleColumn('public_name', 'Public Name')

    list_config.addSimpleColumn('profile_id', 'Username')
    list_config.addPlainTextColumn(
        'email', 'Email', lambda entity, *args: entity.contact.email)
    list_config.addSimpleColumn('first_name', 'First Name', hidden=True)
    list_config.addSimpleColumn('last_name', 'Last Name')
    list_config.addBirthDateColumn(
        'birth_date', 'Birth date', lambda entity, *args: entity.birth_date,
        hidden=True)
    list_config.addSimpleColumn('gender', 'Gender')

    addresses.addAddressColumns(list_config)

    list_config.addPlainTextColumn(
        'school_id', 'School name',
        lambda entity, *args: entity.student_data.education.school_id,
        hidden=True)
    list_config.addPlainTextColumn(
        'school_country', 'School Country',
        lambda entity, *args: entity.student_data.education.school_country,
        hidden=True)
    list_config.addPlainTextColumn(
        'grade', 'Grade',
        lambda entity, *args: entity.student_data.education.grade, hidden=True)
    list_config.addPlainTextColumn(
        'expected_graduation', 'Expected Graduation',
        lambda entity, *args: entity.student_data.education.expected_graduation,
        hidden=True)
    list_config.addPlainTextColumn(
        'number_of_completed_tasks', 'Completed tasks',
        lambda entity, *args: entity.student_data.number_of_completed_tasks)

    def formsSubmitted(entity, form_type):
      """Returns "Yes" if form has been submitted otherwise "No".

      form takes either 'consent' or 'student_id' as values which stand
      for parental consent form and student id form respectively.
      """
      if form_type == 'consent':
        return 'Yes' if entity.student_data.consent_form else 'No'
      elif form_type == 'enrollment':
        return 'Yes' if entity.student_data.enrollment_form else 'No'
      else:
        raise ValueError('Unsupported form type: %s' % form_type)

    list_config.addPlainTextColumn(
        'consent_form', 'Consent Form Submitted',
        lambda entity, *args: formsSubmitted(entity, 'consent'))
    list_config.addPlainTextColumn(
        'enrollment_form', 'Student ID Form Submitted',
        lambda entity, *args: formsSubmitted(entity, 'enrollment'))

    list_config.addPlainTextColumn(
        'home_page', 'Home Page',
        lambda entity, *args: entity.contact.web_page, hidden=True)
    list_config.addPlainTextColumn(
        'blog', 'Blog',
        lambda entity, *args: entity.contact.blog, hidden=True)
    list_config.addSimpleColumn('tee_style', 'T-Shirt Style')
    list_config.addSimpleColumn('tee_size', 'T-Shirt Size')

    list_config.addHtmlColumn(
        'photo_url', 'Photo URL',
        (lambda entity, *args: urlize(entity.photo_url)), hidden=True)
    list_config.addSimpleColumn(
        'program_knowledge', 'Program Knowledge', hidden=True)

    self._list_config = list_config
コード例 #8
0
ファイル: lists.py プロジェクト: rhyolight/nupic.son
 def getValue(self, entity):
     """See Column.getValue for specification."""
     return url_helper.urlize(entity.ideas_page, name='Ideas page')