Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

727743 add field wiki profile #8

Merged
merged 1 commit into from

2 participants

remo/profiles/templates/profiles_edit.html
@@ -135,7 +135,14 @@
{{ profileform.mozillians_profile_url.errors }}
</small>
{% endif %}
- <select name="mentor">
+ <input type="text" placeholder="Wiki profile" value="{{ profileform.wiki_profile_url.value }}"

line up 'value' attr and the other ones below 'type'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
remo/profiles/templates/profiles_view.html
@@ -297,4 +303,4 @@ <h5 class="grayed">
markers.addMarker(new OpenLayers.Marker(lonlat, icon.clone()));
markers.setOpacity(0.7);
</script>

is there any way to non-inline this javascript, even if it has to be an additional js file? :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
media/js/profiles_view.js
((2 lines not shown))
+ var map = new OpenLayers.Map('map', {
+ controls: [
+ new OpenLayers.Control.Navigation(),
+ new OpenLayers.Control.ArgParser(),
+ new OpenLayers.Control.Attribution()],
+ projection: new OpenLayers.Projection('EPSG:900913')
+ });
+ var panel = new OpenLayers.Control.Panel();
+ var markers = new OpenLayers.Layer.Markers('Reps');
+ var osm = new OpenLayers.Layer.OSM();
+
+ map.addLayers([osm]);
+ map.zoomToMaxExtent();
+ map.addLayer(markers);
+
+ var lonlat = new OpenLayers.LonLat($('#map').data('lon'),

one small nit! :) set $('#map') in a var so it's cached once and not called twice. e.g. var map_el = $('#map');

new OpenLayers.LonLat(map_el.data('lon') ....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@glogiotatidis glogiotatidis merged commit f85f9e6 into mozilla:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 21, 2012
  1. @glogiotatidis
This page is out of date. Refresh to see the latest.
View
27 media/js/profiles_view.js
@@ -0,0 +1,27 @@
+$(document).ready( function () {
+ var map = new OpenLayers.Map('map', {
+ controls: [
+ new OpenLayers.Control.Navigation(),
+ new OpenLayers.Control.ArgParser(),
+ new OpenLayers.Control.Attribution()],
+ projection: new OpenLayers.Projection('EPSG:900913')
+ });
+ var panel = new OpenLayers.Control.Panel();
+ var markers = new OpenLayers.Layer.Markers('Reps');
+ var osm = new OpenLayers.Layer.OSM();
+
+ map.addLayers([osm]);
+ map.zoomToMaxExtent();
+ map.addLayer(markers);
+
+ var map_el = $('#map');
+ var lonlat = new OpenLayers.LonLat(map_el.data('lon'),
+ map_el.data('lat'));
+ map.setCenter(lonlat, 8); // Zoom level
+ var size = new OpenLayers.Size(21, 33);
+ var offset = new OpenLayers.Pixel(-(size.w / 2), -size.h);
+ var icon = new OpenLayers.Icon(map_el.data('mediaurl') +
+ 'img/remo/marker.png', size, offset);
+ markers.addMarker(new OpenLayers.Marker(lonlat, icon.clone()));
+ markers.setOpacity(0.7);
+})
View
7 remo/profiles/fixtures/demo_users.json
@@ -112,6 +112,7 @@
"region":"attika",
"country": "Greece",
"mozillians_profile_url":"http://mozillians.org/en-US/about/",
+ "wiki_profile_url": "https://wiki.mozilla.org/User:",
"irc_name": "admin",
"irc_channels": "",
"lon": 13.41,
@@ -139,6 +140,7 @@
"region": "CA",
"country": "USA",
"mozillians_profile_url":"http://mozillians.org/en-US/about/",
+ "wiki_profile_url": "https://wiki.mozilla.org/User:",
"irc_name": "babis",
"irc_channels": "",
"lon": 13.41,
@@ -167,6 +169,7 @@
"region": "NY",
"country": "USA",
"mozillians_profile_url":"http://mozillians.org/en-US/about/",
+ "wiki_profile_url": "https://wiki.mozilla.org/User:",
"irc_name": "md",
"irc_channels": "",
"lon": 13.41,
@@ -175,7 +178,7 @@
"user": 6,
"birth_date": "1992-03-09",
"personal_website_url": "",
- "diaspora_url": "http://joindiaspora.com/md",
+ "diaspora_url": "https://joindiaspora.com/",
"personal_blog_feed": "",
"facebook_url": "",
"mentor": 4,
@@ -196,6 +199,7 @@
"region": "Marmara",
"country": "Turkey",
"mozillians_profile_url":"http://mozillians.org/en-US/about/",
+ "wiki_profile_url": "https://wiki.mozilla.org/User:",
"irc_name": "koki",
"irc_channels": "",
"lon": 13.41,
@@ -236,6 +240,7 @@
"diaspora_url": "",
"personal_blog_feed": "",
"mozillians_profile_url": "",
+ "wiki_profile_url": "",
"mentor": 6,
"added_by": 5,
"bio": "This is my bio",
View
2  remo/profiles/forms.py
@@ -66,7 +66,7 @@ class Meta:
'twitter_account', 'jabber_id', 'irc_name',
'irc_channels', 'facebook_url', 'linkedin_url',
'diaspora_url', 'personal_website_url', 'personal_blog_feed',
- 'bio', 'gender', 'mentor')
+ 'bio', 'gender', 'mentor', 'wiki_profile_url')
def clean_twitter_account(self):
"""Make sure that twitter_account does not start with a '@'."""
View
90 remo/profiles/migrations/0014_auto__add_field_userprofile_wiki_profile_url.py
@@ -0,0 +1,90 @@
+# encoding: utf-8
+import datetime
+from south.db import db
+from south.v2 import SchemaMigration
+from django.db import models
+
+class Migration(SchemaMigration):
+
+ def forwards(self, orm):
+
+ # Adding field 'UserProfile.wiki_profile_url'
+ db.add_column('profiles_userprofile', 'wiki_profile_url', self.gf('django.db.models.fields.URLField')(default='', max_length=200), keep_default=False)
+
+
+ def backwards(self, orm):
+
+ # Deleting field 'UserProfile.wiki_profile_url'
+ db.delete_column('profiles_userprofile', 'wiki_profile_url')
+
+
+ models = {
+ 'auth.group': {
+ 'Meta': {'object_name': 'Group'},
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
+ 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
+ },
+ 'auth.permission': {
+ 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
+ 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
+ },
+ 'auth.user': {
+ 'Meta': {'object_name': 'User'},
+ 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
+ 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
+ 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
+ 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
+ 'password': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+ 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
+ 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
+ },
+ 'contenttypes.contenttype': {
+ 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
+ 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
+ },
+ 'profiles.userprofile': {
+ 'Meta': {'object_name': 'UserProfile'},
+ 'added_by': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'users_added'", 'null': 'True', 'to': "orm['auth.User']"}),
+ 'bio': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}),
+ 'birth_date': ('django.db.models.fields.DateField', [], {'null': 'True'}),
+ 'city': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '30'}),
+ 'country': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '30'}),
+ 'diaspora_url': ('django.db.models.fields.URLField', [], {'default': "''", 'max_length': '200', 'blank': 'True'}),
+ 'display_name': ('django.db.models.fields.CharField', [], {'default': "''", 'unique': 'True', 'max_length': '15', 'blank': 'True'}),
+ 'facebook_url': ('django.db.models.fields.URLField', [], {'default': "''", 'max_length': '200', 'blank': 'True'}),
+ 'gender': ('django.db.models.fields.NullBooleanField', [], {'default': 'None', 'null': 'True', 'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'irc_channels': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}),
+ 'irc_name': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '30'}),
+ 'jabber_id': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '50', 'blank': 'True'}),
+ 'lat': ('django.db.models.fields.FloatField', [], {'null': 'True'}),
+ 'linkedin_url': ('django.db.models.fields.URLField', [], {'default': "''", 'max_length': '200', 'blank': 'True'}),
+ 'local_name': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '50', 'blank': 'True'}),
+ 'lon': ('django.db.models.fields.FloatField', [], {'null': 'True'}),
+ 'mentor': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'mentors_users'", 'null': 'True', 'to': "orm['auth.User']"}),
+ 'mozillians_profile_url': ('django.db.models.fields.URLField', [], {'max_length': '200'}),
+ 'personal_blog_feed': ('django.db.models.fields.URLField', [], {'default': "''", 'max_length': '200', 'blank': 'True'}),
+ 'personal_website_url': ('django.db.models.fields.URLField', [], {'default': "''", 'max_length': '200', 'blank': 'True'}),
+ 'private_email': ('django.db.models.fields.EmailField', [], {'default': "''", 'max_length': '75', 'null': 'True'}),
+ 'region': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '30'}),
+ 'registration_complete': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'twitter_account': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '16', 'blank': 'True'}),
+ 'user': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['auth.User']", 'unique': 'True'}),
+ 'wiki_profile_url': ('django.db.models.fields.URLField', [], {'default': "''", 'max_length': '200'})
+ }
+ }
+
+ complete_apps = ['profiles']
View
5 remo/profiles/models.py
@@ -86,6 +86,11 @@ class UserProfile(models.Model):
verify_exists=True)
personal_blog_feed = models.URLField(blank=True, null=False, default='',
verify_exists=True)
+ wiki_profile_url = models.URLField(
+ blank=False, null=False, default='', verify_exists=True,
+ validators=[
+ RegexValidator(regex=r'^http(s)?://wiki.mozilla.org/User:',
+ message='Please provide a valid wiki url.')])
added_by = models.ForeignKey(User, null=True, blank=True,
related_name='users_added')
bio = models.TextField(blank=True, default='')
View
20 remo/profiles/templates/profiles_edit.html
@@ -128,21 +128,31 @@
{{ userform.email.errors }}
</small>
{% endif %}
- <input type="text" placeholder="Mozillians.org profile" value="{{ profileform.mozillians_profile_url.value }}"
+ <input type="text" placeholder="Mozillians.org profile"
+ value="{{ profileform.mozillians_profile_url.value }}"
name="mozillians_profile_url" class="input-text big">
{% if profileform.mozillians_profile_url.errors %}
<small class="error">
{{ profileform.mozillians_profile_url.errors }}
</small>
{% endif %}
+ <input type="text" placeholder="Wiki profile"
+ value="{{ profileform.wiki_profile_url.value }}"
+ name="wiki_profile_url" class="input-text big">
+ {% if profileform.wiki_profile_url.errors %}
+ <small class="error">
+ {{ profileform.wiki_profile_url.errors }}
+ </small>
+ {% endif %}
<select name="mentor">
{% if not profileform.mentor.value %}
<option selected="selected" value="">
Choose mentor
</option>
- {% endif %} {% for mentor in mentors %}
- <option value="{{ mentor.id }}" {% if mentor.id == profileform.mentor.value %} selected="selected"
- {% endif %}>
+ {% endif %}
+ {% for mentor in mentors %}
+ <option value="{{ mentor.id }}" {% if mentor.id == profileform.mentor.value %}
+ selected="selected" {% endif %}>
{{ mentor.get_full_name }}
</option>
{% endfor %}
@@ -412,4 +422,4 @@
{% block bottomextra %}
<script src="{{ MEDIA_URL }}openlayers/OpenLayers.js"></script>
<script src="{{ MEDIA_URL }}js/map-point.js" type="text/javascript"></script>
-{% endblock %}
+{% endblock %}
View
44 remo/profiles/templates/profiles_view.html
@@ -1,7 +1,7 @@
{% extends "base.html" %}
{% load markup %}
-{% block pagetitle %} Mozilla Reps - Profile of {{ pageuser.userprofile.display_name }} {% endblock %}
+{% block pagetitle %} Mozilla Reps - Profile of {{ pageuser.userprofile.display_name }} {% endblock %}
{% block content %}
<div class="row">
@@ -47,7 +47,10 @@ <h5 class="grayed">
<img src="{{ pageuser.userprofile.get_avatar_url }}" width="128">
</div>
<div class="eight columns smallmap-profile-container">
- <div id="map" class="smallmap-profile">
+ <div id="map" class="smallmap-profile"
+ data-lon="{{ pageuser.userprofile.lon }}"
+ data-lat="{{ pageuser.userprofile.lat }}"
+ data-mediaurl="{{ MEDIA_URL}}">
</div>
</div>
</div>
@@ -122,9 +125,15 @@ <h5 class="grayed">
<span class="white radius label">
Mozillians Profile
</span>
- &nbsp;<a href="{{ pageuser.userprofile.mozillians_profile_url }}">{{ pageuser.userprofile.mozillians_profile_url }}</a>
+ &nbsp;{{ pageuser.userprofile.mozillians_profile_url|urlizetrunc:50 }}
</p>
- {% if pageuser.userprofile.mentor %}
+ <p class="profile-item">
+ <span class="white radius label">
+ Wiki Profile
+ </span>
+ &nbsp;{{ pageuser.userprofile.wiki_profile_url|urlizetrunc:50 }}
+ </p>
+ {% if pageuser.userprofile.mentor %}
<p class="profile-item">
<span class="white radius label">
Mentor
@@ -273,28 +282,5 @@ <h5 class="grayed">
{% block bottomextra %}
<script type="text/javascript" src="{{ MEDIA_URL }}openlayers/OpenLayers.js"></script>
-<script type="text/javascript">
- var map = new OpenLayers.Map('map', {
- controls: [
- new OpenLayers.Control.Navigation(),
- new OpenLayers.Control.ArgParser(),
- new OpenLayers.Control.Attribution()],
- projection: new OpenLayers.Projection("EPSG:900913")
- });
- var panel = new OpenLayers.Control.Panel();
- var markers = new OpenLayers.Layer.Markers("Reps");
- var osm = new OpenLayers.Layer.OSM();
-
- map.addLayers([osm]);
- map.zoomToMaxExtent();
- map.addLayer(markers);
-
- var lonlat = new OpenLayers.LonLat({{ pageuser.userprofile.lon }}, {{ pageuser.userprofile.lat }});
- map.setCenter(lonlat, 8); // Zoom level
- var size = new OpenLayers.Size(21, 33);
- var offset = new OpenLayers.Pixel(-(size.w / 2), -size.h);
- var icon = new OpenLayers.Icon('{{ MEDIA_URL }}img/remo/marker.png', size, offset);
- markers.addMarker(new OpenLayers.Marker(lonlat, icon.clone()));
- markers.setOpacity(0.7);
-</script>
-{% endblock %}
+<script type="text/javascript" src="{{ MEDIA_URL }}js/profiles_view.js"></script>
+{% endblock %}
View
5 remo/profiles/tests/test_views.py
@@ -29,11 +29,12 @@ def setUp(self):
'lon': 12.23,
'lat': 12.23,
'mozillians_profile_url': u'http://mozillians.org/',
+ 'wiki_profile_url': u'https://wiki.mozilla.org/User:',
'jabber_id': u'foo@jabber.org',
'irc_name': u'ircname',
'linkedin_url': u'http://www.linkedin.com/',
'facebook_url': u'http://www.facebook.com/',
- 'diaspora_url': u'http://www.example.com/',
+ 'diaspora_url': u'https://joindiaspora.com/',
'personal_website_url': u'http://www.example.com/',
'personal_blog_feed': u'http://example.com/',
'bio': u'bio foo',
@@ -170,7 +171,7 @@ def test_edit_profile(self):
mandatory_fields = ['first_name', 'last_name', 'email',
'birth_date', 'private_email', 'city', 'region',
'country', 'lon', 'lat', 'mozillians_profile_url',
- 'irc_name']
+ 'irc_name', 'wiki_profile_url']
for field in mandatory_fields:
# remove a mandatory field and ensure that edit fails
temp_data = self.data.copy()
Something went wrong with that request. Please try again.