| # Copyright 2011 the Melange authors. |
| # |
| # Licensed under the Apache License, Version 2.0 (the "License"); |
| # you may not use this file except in compliance with the License. |
| # You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| # See the License for the specific language governing permissions and |
| # limitations under the License. |
| |
| """Module for templates with sidebar actions.""" |
| |
| from soc.views import template |
| |
| |
| class SidebarActions(template.Template): |
| """Template to render the left side user actions.""" |
| |
| def __init__( |
| self, data, title, toggle_buttons, assign_mentor_field=None, |
| set_status_field=None): |
| """Initializes a new instance of this class. |
| |
| Args: |
| data: request_data.RequestData for the current request. |
| title: A string containing the title for the actions. |
| toggle_buttons: List of toggle buttons to use for the actions. |
| assign_mentor_field: Optional field to assign mentors for the proposal. |
| set_status_field: Optional field to set status for the proposal. |
| """ |
| super(SidebarActions, self).__init__(data) |
| self.title = title |
| self.toggle_buttons = toggle_buttons |
| self.assign_mentor_field = assign_mentor_field |
| self.set_status_field = set_status_field |
| |
| def templatePath(self): |
| """See template.Template.templatPath for specification""" |
| return 'modules/gsoc/proposal/_user_action.html' |
| |
| def context(self): |
| """See template.Template.context for specification.""" |
| return { |
| # TODO(daniel): this item below should have a more generic name |
| 'assign_mentor_field': self.assign_mentor_field, |
| 'set_status_field': self.set_status_field, |
| 'title': self.title, |
| 'toggle_buttons': self.toggle_buttons, |
| } |