app/soc/views/user/roles.py
changeset 512 aae25d2b4464
parent 500 44ea4620c5c0
equal deleted inserted replaced
511:52557918ec8f 512:aae25d2b4464
    29 from soc.views.helper import decorators
    29 from soc.views.helper import decorators
    30 from soc.views.helper import responses
    30 from soc.views.helper import responses
    31 
    31 
    32 
    32 
    33 @decorators.view
    33 @decorators.view
    34 def dashboard(request, page_name=None, link_name=None,
    34 def dashboard(request, page_name=None, link_id=None,
    35               template='soc/user/roles/dashboard.html'):
    35               template='soc/user/roles/dashboard.html'):
    36   """A per-User dashboard of that User's Roles on the site.
    36   """A per-User dashboard of that User's Roles on the site.
    37 
    37 
    38   Args:
    38   Args:
    39     request: the standard django request object
    39     request: the standard django request object
    40     page_name: the page name displayed in templates as page and header title
    40     page_name: the page name displayed in templates as page and header title
    41     link_name: the User's site-unique "link_name" extracted from the URL
    41     link_id: the User's site-unique "link_id" extracted from the URL
    42     template: the template path to use for rendering the template
    42     template: the template path to use for rendering the template
    43 
    43 
    44   Returns:
    44   Returns:
    45     A subclass of django.http.HttpResponse with generated template.
    45     A subclass of django.http.HttpResponse with generated template.
    46   """
    46   """
    47   #TODO(tlarsen): this module is currently a placeholder for future work
    47   #TODO(tlarsen): this module is currently a placeholder for future work
    48   
    48   
    49   # TODO: check that user is logged in and "owns" the link_name;
    49   # TODO: check that user is logged in and "owns" the link_id;
    50   #   if not, call public() view instead
    50   #   if not, call public() view instead
    51   #   This might be tricky, since we want to use the same style
    51   #   This might be tricky, since we want to use the same style
    52   #   of template that was passed to us, but how do we figure out
    52   #   of template that was passed to us, but how do we figure out
    53   #   what the equivalent public.html template is?  Perhaps this
    53   #   what the equivalent public.html template is?  Perhaps this
    54   #   view needs to require that, for a foo/bar/dashboard.html
    54   #   view needs to require that, for a foo/bar/dashboard.html
    58   return responses.respond(request,
    58   return responses.respond(request,
    59       template, {'template': template})
    59       template, {'template': template})
    60 
    60 
    61 
    61 
    62 @decorators.view
    62 @decorators.view
    63 def public(request, page_name=None, link_name=None,
    63 def public(request, page_name=None, link_id=None,
    64            template='soc/user/roles/public.html'):
    64            template='soc/user/roles/public.html'):
    65   """A "general public" view of a User's Roles on the site.
    65   """A "general public" view of a User's Roles on the site.
    66 
    66 
    67   Args:
    67   Args:
    68     request: the standard django request object
    68     request: the standard django request object
    69     page_name: the page name displayed in templates as page and header title
    69     page_name: the page name displayed in templates as page and header title
    70     link_name: the User's site-unique "link_name" extracted from the URL
    70     link_id: the User's site-unique "link_id" extracted from the URL
    71     template: the template path to use for rendering the template
    71     template: the template path to use for rendering the template
    72 
    72 
    73   Returns:
    73   Returns:
    74     A subclass of django.http.HttpResponse with generated template.
    74     A subclass of django.http.HttpResponse with generated template.
    75   """
    75   """
    76   #TODO(tlarsen): this module is currently a placeholder for future work
    76   #TODO(tlarsen): this module is currently a placeholder for future work
    77   
    77   
    78   # TODO: if link_name is empty or not a valid link_name on the site, display
    78   # TODO: if link_id is empty or not a valid link_id on the site, display
    79   # some sort of "user does not exist" page (a custom 404 page, maybe?).
    79   # some sort of "user does not exist" page (a custom 404 page, maybe?).
    80   
    80   
    81   return responses.respond(request,
    81   return responses.respond(request,
    82       template, {'template': template})
    82       template, {'template': template})