# HG changeset patch # User Sverre Rabbelier # Date 1232724582 0 # Node ID e499cc2641f6db845685cf89829184163aca99ed # Parent 39badbfb80be2856ebbd17e89f6ea5285355d694 Create a new 'home' view for Presences This also restores the 'show' view for Presences as there is no need to hide it with the 'home' view anymore. Patch by: Sverre Rabbelier diff -r 39badbfb80be -r e499cc2641f6 app/soc/templates/soc/home/public.html --- a/app/soc/templates/soc/home/public.html Fri Jan 23 12:00:48 2009 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,62 +0,0 @@ -{% extends "soc/base.html" %} -{% comment %} -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. -{% endcomment %} - -{% block scripts %} -{% if entity.feed_url %} - - - -{% endif %} -{% endblock %} - -{% block page_title %} -{% if home_document %} -{{ home_document.title }} -{% else %} -{{ page_name }} -{% endif %} -{% endblock %} - -{% block header_title %} -{% if home_document %} -{{ home_document.short_name }} -{% else %} -{{ page_name }} -{% endif %} -{% endblock %} - -{% block body %} - {% if home_document %} -
Last modified on {{ home_document.modified }} by {{ home_document.modified_by.name }}
- {{ home_document.content|safe }} - {% else %} -{% block missing_doc %} -This is the default home page can be edited via Edit Site Settings.
-{% endblock %} - {% endif %} - {% if entity.feed_url %} -
- {% endif %} -{% endblock %} diff -r 39badbfb80be -r e499cc2641f6 app/soc/templates/soc/presence/home.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/soc/templates/soc/presence/home.html Fri Jan 23 15:29:42 2009 +0000 @@ -0,0 +1,62 @@ +{% extends "soc/base.html" %} +{% comment %} +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. +{% endcomment %} + +{% block scripts %} +{% if entity.feed_url %} + + + +{% endif %} +{% endblock %} + +{% block page_title %} +{% if home_document %} +{{ home_document.title }} +{% else %} +{{ page_name }} +{% endif %} +{% endblock %} + +{% block header_title %} +{% if home_document %} +{{ home_document.short_name }} +{% else %} +{{ page_name }} +{% endif %} +{% endblock %} + +{% block body %} + {% if home_document %} +
Last modified on {{ home_document.modified }} by {{ home_document.modified_by.name }}
+ {{ home_document.content|safe }} + {% else %} +{% block missing_doc %} +This is the default home page, it can be edited via Edit Site Settings.
+{% endblock %} + {% endif %} + {% if entity.feed_url %} +
+ {% endif %} +{% endblock %} diff -r 39badbfb80be -r e499cc2641f6 app/soc/templates/soc/presence/public.html --- a/app/soc/templates/soc/presence/public.html Fri Jan 23 12:00:48 2009 +0000 +++ b/app/soc/templates/soc/presence/public.html Fri Jan 23 15:29:42 2009 +0000 @@ -1,4 +1,4 @@ -{% extends "soc/home/public.html" %} +{% extends "soc/base.html" %} {% comment %} Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -12,16 +12,22 @@ See the License for the specific language governing permissions and limitations under the License. {% endcomment %} +{% load forms_helpers %} -{% block missing_doc %} -The contents of this default Site home page can be changed by -creating a new Document or -editing an existing Document and then selecting -that Document in the -Site Settings interface. -Other elements of this page, such as a feed to be displayed below this -content, can also be set using the -Site Settings interface. -You need to sign in as site Developer in order to change -Site Settings. +{% block header_title %} +{{ page_name }} for {{ entity.link_id }} {% endblock %} + +{% block body %} +

+ + {% readonly_field_as_table_row entity.fields.link_id.label entity.link_id %} + {% readonly_field_as_table_row entity.fields.home.label entity.home.key.name %} + {% readonly_field_as_table_row entity.fields.feed_url.label entity.feed_url %} + {% readonly_field_as_table_row entity.fields.tos.label entity.tos %} + {% readonly_field_as_table_row entity.fields.ga_tracking_num.label entity.ga_tracking_num %} + {% readonly_field_as_table_row entity.fields.gmaps_api_key.label entity.gmaps_api_key %} + +
+

+{% endblock %} diff -r 39badbfb80be -r e499cc2641f6 app/soc/templates/soc/site/home.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/soc/templates/soc/site/home.html Fri Jan 23 15:29:42 2009 +0000 @@ -0,0 +1,27 @@ +{% extends "soc/presence/home.html" %} +{% comment %} +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. +{% endcomment %} + +{% block missing_doc %} +The contents of this default Site home page can be changed by +creating a new Document or +editing an existing Document and then selecting +that Document in the +Site Settings interface. +Other elements of this page, such as a feed to be displayed below this +content, can also be set using the +Site Settings interface. +You need to sign in as site Developer in order to change +Site Settings. +{% endblock %} diff -r 39badbfb80be -r e499cc2641f6 app/soc/views/models/presence.py --- a/app/soc/views/models/presence.py Fri Jan 23 12:00:48 2009 +0000 +++ b/app/soc/views/models/presence.py Fri Jan 23 15:29:42 2009 +0000 @@ -33,6 +33,7 @@ from soc.logic.models import document as document_logic from soc.views import helper from soc.views.helper import access +from soc.views.helper import decorators from soc.views.helper import redirects from soc.views.models import base @@ -58,6 +59,7 @@ new_params = {} new_params['extra_dynaexclude'] = ['home', 'tos'] + new_params['home_template'] = 'soc/presence/home.html' new_params['create_extra_dynafields'] = { # override some editors @@ -78,6 +80,22 @@ super(View, self).__init__(params=params) + @decorators.check_access + def home(self, request, access_type, + page_name=None, params=None, **kwargs): + """See base.View.public(). + + Overrides public_template to point at 'home_template'. + """ + + new_params = {} + new_params['public_template'] = self._params['home_template'] + + params = dicts.merge(params, new_params) + + return self.public(request, access_type, + page_name=page_name, params=params, **kwargs) + def _public(self, request, entity, context): """See base.View._public(). """ diff -r 39badbfb80be -r e499cc2641f6 app/soc/views/models/site.py --- a/app/soc/views/models/site.py Fri Jan 23 12:00:48 2009 +0000 +++ b/app/soc/views/models/site.py Fri Jan 23 15:29:42 2009 +0000 @@ -62,7 +62,8 @@ new_params['sidebar_defaults'] = [('/%s/edit', 'Edit %(name)s', 'edit')] new_params['sidebar_heading'] = new_params['name_short'] - new_params['public_template'] = 'soc/home/public.html' + new_params['public_template'] = 'soc/presence/public.html' + new_params['home_template'] = 'soc/site/home.html' new_params['create_extra_dynafields'] = { 'link_id': forms.CharField(widget=forms.HiddenInput, required=True), @@ -121,7 +122,7 @@ values = self._logic.getKeyValues(None) key_values = dicts.zip(keys, values) - return self.public(request, "show", page_name, **key_values) + return self.home(request, "home", page_name=page_name, **key_values) def mainEdit(self, request, page_name=None, **kwargs): """Displays the edit page for the main site settings page. @@ -138,7 +139,7 @@ # Site singleton, so pass in None to match parent method footprint. values = self._logic.getKeyValues(None) key_values = dicts.zip(keys, values) - + return self.edit(request, "edit", page_name, seed=key_values, **key_values)