Exemplo n.º 1
0
            project.homepage = c.homepage
            project.is_public = c.is_public
            project.identifier = c.identifier
            db.add(project)
            db.commit()
            redirect_to(action='show', id=c.identifier)
        
        return render('/projects/add.mao')
    
    def show(self):
        return render('/projects/show.mao')
    
    def activity(self):
        return render('/projects/activity.mao')
    
    def settings(self):
        c.tabs = [
            ('info', 'Information'),
            ('modules', 'Modules'),
            ('members', 'Members'),
            ('versions', 'Versions')
        ]
        return render('/projects/settings.mao')

ProjectsBaseController.register_menu_item('overview',
    ProjectsMenuItem('Overview', 0, controller='projects', action='show'))
ProjectsBaseController.register_menu_item('activity',
    ProjectsMenuItem('Activity', 1, controller='projects', action='activity'))
ProjectsBaseController.register_menu_item('settings',
    ProjectsMenuItem('Settings', 99, controller='projects', action='settings'))
Exemplo n.º 2
0
    def edit(self):
        title = request.urlvars.get('page')
        if not title:
            title = c.project.wiki.start_page

        page = db.query(WikiPage).filter_by(title=title,
                                            wiki_id=c.project.wiki.id).first()
        c.page = page
        c.title = title
        if not page:
            c.contents = DEFAULT % {'title': title}
        return render('/wiki/edit.mao')

    def view(self):
        title = request.urlvars.get('page')
        if not title:
            title = c.project.wiki.start_page

        page = db.query(WikiPage).filter_by(title=title,
                                            wiki_id=c.project.wiki.id).first()
        c.page = page
        c.title = title
        if not page:
            c.contents = DEFAULT % {'title': title}
        return render('/wiki/view.mao')

connect('/wiki/{project}', controller='wiki', action='view', page=None)
connect('/wiki/{project}/{page:.*?}/edit', controller='wiki', action='edit')
connect('/wiki/{project}/{page:.*?}', controller='wiki', action='view')
ProjectsBaseController.register_menu_item('wiki',
    ProjectsMenuItem('Wiki', 5, controller='wiki', action='view'))