Пример #1
0
def view_vote(self, request):
    query = request.session.query(SwissVote)
    prev = query.order_by(SwissVote.bfs_number.desc())
    prev = prev.filter(SwissVote.bfs_number < self.bfs_number).first()
    next = query.order_by(SwissVote.bfs_number.asc())
    next = next.filter(SwissVote.bfs_number > self.bfs_number).first()

    bfs_map = self.bfs_map(request.locale)
    bfs_map_host = self.bfs_map_host(request.locale)
    if bfs_map_host:
        request.content_security_policy.default_src |= {bfs_map_host}

    return {
        'layout': VoteLayout(self, request),
        'brief_description': self.get_file('brief_description'),
        'voting_text': self.get_file('voting_text'),
        'federal_council_message': self.get_file('federal_council_message'),
        'parliamentary_debate': self.get_file('parliamentary_debate'),
        'voting_booklet': self.get_file('voting_booklet'),
        'resolution': self.get_file('resolution'),
        'realization': self.get_file('realization'),
        'ad_analysis': self.get_file('ad_analysis'),
        'results_by_domain': self.get_file('results_by_domain'),
        'bfs_map': bfs_map,
        'prev': prev,
        'next': next,
        'map_preview': request.link(StaticFile('images/map-preview.png')),
    }
Пример #2
0
 def url_for(self, request, path):
     assert path.startswith('sponsors/')
     return request.link(StaticFile(path, version=request.app.version))
Пример #3
0
    def logo_path(self):
        static_file = StaticFile.from_application(self.app, 'logo.svg')

        return self.request.link(static_file)
Пример #4
0
 def town_names_path(self):
     static_file = StaticFile.from_application(self.app, 'towns.json')
     return self.request.link(static_file)
Пример #5
0
    def font_awesome_path(self):
        static_file = StaticFile.from_application(
            self.app, 'font-awesome/css/font-awesome.min.css')

        return self.request.link(static_file)
Пример #6
0
    def font_awesome_path(self):
        static_file = StaticFile.from_application(
            self.app, 'font-awesome/css/font-awesome.min.css')

        return self.request.link(static_file)
Пример #7
0
 def static_file(self, path):
     return StaticFile(path, version=self.version)
Пример #8
0
 def town_names_path(self):
     static_file = StaticFile.from_application(self.app, 'towns.json')
     return self.request.link(static_file)
Пример #9
0
    def logo_path(self):
        static_file = StaticFile.from_application(self.app, 'logo.svg')

        return self.request.link(static_file)