Ejemplo n.º 1
0
# ######################################################################3#######
# imports
from base import base_app, add_content_module, register_data_models, url_for
from base.module import ContentModule


# ######################################################################3#######
# Initialization
newsMod = ContentModule('news', __name__)

newsMod.add_menu('News', 'news.default' )
newsMod.add_side_menu(
    'News', 
    [
        ('Add Post', 'news.add_post'),
        ('List Posts', 'news.admin_list_posts')
    ],
    'admin'
)

import models
import views

# ######################################################################3#######
# Hooking into main website

add_content_module( newsMod )

# ######################################################################3#######
# Register data models
Ejemplo n.º 2
0
# is imported. In this case to import this module we would add the following 
# to main.py (in the module loading section): 
#    
#    import modules.organization
#

from base import add_content_module
from base import register_data_models
from base.module import ContentModule

org_mod = ContentModule('organization', __name__)

# ##############################################################################
# main menu

org_mod.add_menu('About Us', 'organization.default' )

# ##############################################################################
# side panel menu

org_mod.add_side_menu(
    'Organization/Officers', # Side panel title
    [
        ( 'Update Offices', 'organization.update_offices' ), 
        ( 'Update Officers', 'organization.edit_officer' ),
        ( 'Edit About Us', 'organization.edit_aboutus')
    ],
    'admin'
)

# ##############################################################################
Ejemplo n.º 3
0
# ######################################################################3#######
# imports
from base import base_app, add_content_module, register_data_models, url_for 
from base import register_user_role
from base.module import ContentModule


# ######################################################################3#######
# Initialization
articles_mod = ContentModule('articles', __name__)

articles_mod.add_menu('Articles', 'articles.default' )
articles_mod.add_side_menu(
    'Articles', 
    [
        ('Add Article', 'articles.add_article'),
        ('Edit Articles', 'articles.update_articles')
    ],
    'contributor'
)

import models
import views

# ######################################################################3#######
# Hooking into main website

add_content_module( articles_mod )

# ######################################################################3#######
Ejemplo n.º 4
0
from base import register_user_role
from base import url_for
from base.module import ContentModule

# ##############################################################################
# Define the ContentModule object which will hook into the main website
# the first argument specifies the modules 'name', and the second specifies the 
# package that contains the module.
#

seminar_mod = ContentModule('seminars', __name__)

# ##############################################################################
# Add a main menu entry

seminar_mod.add_menu('Seminars', 'seminars.default')

# ##############################################################################
# Add a side panel menu

seminar_mod.add_side_menu(
    'Seminars', # Side panel title
    [
        ( 'Add Seminar', 'seminars.add_seminar' ), 
        ( 'Edit Seminars', 'seminars.update_seminars' ),
        ( 'Edit Talks', 'seminars.update_talks' )
    ],
    'seminar-organizer'
)

# ##############################################################################
Ejemplo n.º 5
0
#

example_mod = ContentModule('example', __name__)

# ##############################################################################
# Add a main menu entry
#      The display name in this case will be: Example
#        And the target for the link will be: url_for('example.default')
#
# Note: when we specify a link for a view in a module, we do so with the 
#       convention: [module name].[function name]
# 
# Note: we can add more than one menu entry by calling this function again
#

example_mod.add_menu('Example', 'example.default')

# ##############################################################################
# Add a side panel menu
#    At this point it seems like a decent idea to give a user which has loggedin 
# a list of newly accessible functions they can use.
#   We accomplish this by using the add_side_menu function from ContentModule
# where the first argument is the title of the side panel section, and the 
# second is a list of links which will be injected into the panel

example_mod.add_side_menu(
    'Example Menu One', # Side panel title
    [
        # A link which will be in the side-menu
        # the format is: ([Name], [target])
        ( 'Item 1', 'example.callback' ),