app/soc/templates/soc/role/edit.html
author Pawel Solyga <Pawel.Solyga@gmail.com>
Sun, 01 Feb 2009 16:10:20 +0000
changeset 1152 b82caf7bb17c
child 1155 44dcc941e199
permissions -rw-r--r--
Add Google Maps integration for Role profiles create/edit views. Now when editing/creating your Role Profile page Google Maps widget will show up at the bottom of the form as "Location" field. When you type in your Street, City, Country or State it will automatically update the map with the location based on your address. The zoom level depends on the address information you provided. So for example if you just select Country it will be different then when you select both Country and City. The longitude and latitude fields are hidden and are updated with the coordinates from the address you provided. Also if the map is not accurate enough you can adjust your location by dragging the red market, which will change your location and save new coordinates into hidden fields. This patch also includes some style fixes in soc.views.models.role module. Patch by: Mario Ferraro & Pawel Solyga Reviewed by: Pawel Solyga
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1152
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
     1
{% extends "soc/base.html" %}
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
     2
{% comment %}
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
     3
Licensed under the Apache License, Version 2.0 (the "License");
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
     4
you may not use this file except in compliance with the License.
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
     5
You may obtain a copy of the License at
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
     6
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
     7
  http://www.apache.org/licenses/LICENSE-2.0
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
     8
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
     9
Unless required by applicable law or agreed to in writing, software
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    10
distributed under the License is distributed on an "AS IS" BASIS,
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    11
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    12
See the License for the specific language governing permissions and
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    13
limitations under the License.
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    14
{% endcomment %}
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    15
{% load forms_helpers %}
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    16
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    17
{% block scripts %}
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    18
	<script type="text/javascript" src="/tiny_mce/tiny_mce_src.js"></script>
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    19
{% if gmaps_api_key %}
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    20
	<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key={{ gmaps_api_key }}" type="text/javascript"></script>
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    21
	<script type="text/javascript" src="/soc/content/js/map-090201.js"></script>
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    22
{% endif %}
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    23
{% endblock %}
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    24
{% block header_title %}
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    25
{{ page_name }}
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    26
 {% if entity %}
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    27
   <!-- TODO(srabbelier) use a generic entity name as link -->
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    28
   <a href="/{{ entity_type_url|lower }}/show/{{ entity_suffix }}"
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    29
>{% if entity.name %}{{ entity.name }} {% endif %}(public view)</a>
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    30
 {% endif %}
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    31
{% endblock %}
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    32
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    33
{% block body %}
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    34
{% block body_tag %}
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    35
  {% if gmaps_api_key %}
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    36
    <body onLoad="role_profile_gmap.map_load()" onunload="GUnload()">
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    37
  {% else %}
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    38
    {{ block.super }}
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    39
  {% endif %}
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    40
{% endblock %}
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    41
<p>
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    42
<p>
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    43
{% block instructions %}
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    44
Please use this form to edit the {{ entity_type }}.
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    45
{% if not gmaps_api_key %}
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    46
<br /><span class="error">Google Maps API key not present: please login as administrator and insert your key in Site, Edit Site Settings, Google Maps field</span>
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    47
{% endif %}
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    48
{% endblock %}
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    49
</p>
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    50
<form method="POST">
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    51
  <table>
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    52
    {% block form_table %}
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    53
      {% as_table form %}
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    54
    {% endblock %}
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    55
    {% if gmaps_api_key %}
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    56
    <tr title="your location">
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    57
      <td class="formfieldlabel">
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    58
        <label for="id_location">Location:</label>
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    59
      </td>
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    60
      <td>
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    61
        <div id="role_profile_map"></div>
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    62
      </td>
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    63
      <td></td>
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    64
      <td></td>
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    65
      <td></td>
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    66
    </tr>
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    67
    {% endif %}
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    68
  </table>
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    69
  <table>
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    70
  <tr>
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    71
   <td colspan="4">&nbsp;</td>
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    72
  </tr>
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    73
  <tr>
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    74
    {% block submit_buttons %}
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    75
   <td> 
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    76
    <input style="font-weight: bold" type="submit" value="Save Changes"/></span>
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    77
   </td>
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    78
   <td>
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    79
    <input type="button" onclick="location.href='/'" value="Cancel"/>
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    80
   </td>
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    81
   {% if entity %}
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    82
   <td>
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    83
    <input type="button" onclick="location.href='/{{ entity_type_url|lower }}/delete/{{ entity_suffix }}'" value="Delete"/>
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    84
   </td>
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    85
   {% endif %}
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    86
   {% endblock %}
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    87
  </tr>
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    88
 </table>
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    89
</form>
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    90
</p>
b82caf7bb17c Add Google Maps integration for Role profiles create/edit views.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    91
{% endblock %}