Exemple #1
0
  def context(self, data, check, mutator):
    current_timeline = data.timeline.currentPeriod()

    context = {
        'page_name': '%s - Home page' % data.program.name,
        'how_it_works': HowItWorks(data),
        'participating_orgs': ParticipatingOrgs(data),
        'timeline': common_templates.Timeline(data),
        'complete_percentage': data.timeline.completePercentage(),
        'current_timeline': current_timeline,
        'connect_with_us': ConnectWithUs(data),
        'program': data.program,
    }

    if current_timeline in ['student_signup_period',
        'working_period', 'offseason']:
      featured_task = task_logic.getFeaturedTask(data.program)

      if featured_task:
        context['featured_task'] = FeaturedTask(data, featured_task)

    if data.is_host or data.timeline.winnersAnnounced():
      context['winners'] = self._getWinnersTemplate(
          data, data.program.winner_selection_type)

    return context
Exemple #2
0
  def context(self):
    current_timeline = self.data.timeline.currentPeriod()

    context = {
        'page_name': '%s - Home page' % (self.data.program.name),
        'how_it_works': HowItWorks(self.data),
        'participating_orgs': ParticipatingOrgs(self.data),
        'timeline': common_templates.Timeline(self.data),
        'complete_percentage': self.data.timeline.completePercentage(),
        'current_timeline': current_timeline,
        'connect_with_us': ConnectWithUs(self.data),
        'program': self.data.program,
    }

    if current_timeline in ['student_signup_period',
        'working_period', 'offseason']:
      context['leaderboard'] = Leaderboard(self.data)
      featured_task = task_logic.getFeaturedTask(self.data.program)

      if featured_task:
        context['featured_task'] = FeaturedTask(self.data, featured_task)

    return context