From 15fb0e0c320422b5059206e4dd58ab747fa6217b Mon Sep 17 00:00:00 2001 From: "Tri M. Nguyen" Date: Fri, 18 Apr 2014 01:56:44 +0200 Subject: [PATCH 1/9] Fix title overflow in mobile view --- files/static/js/EventWidget.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/files/static/js/EventWidget.js b/files/static/js/EventWidget.js index 040b2bc6a..4bf862678 100644 --- a/files/static/js/EventWidget.js +++ b/files/static/js/EventWidget.js @@ -5,7 +5,7 @@ function EventWidget (Utils){ /* Render the widget */ EventWidget.prototype.render = function(callback) { callback = callback || function () {}; - + var now = moment(); Utils.makeApiRequest({ @@ -60,7 +60,7 @@ function EventWidget (Utils){ // Display text if no data was found $('#event-items').html('

Ingen arrangementer funnet

'); } - + if ( ($($('.event-list')[0]).children().length <= 1 && $($('.event-list')[1]).children().length == 1) || ($($('.event-list')[0]).children().length == 1 && $($('.event-list')[1]).children().length <= 1) ) { @@ -119,6 +119,6 @@ function EventWidget (Utils){ } function createEventListitem (item) { - return '
  • '+item.title+''+moment(item.event_start).lang('nb').format('DD.MM')+'
  • '; + return '
  • '+moment(item.event_start).lang('nb').format('DD.MM')+''+item.title+'
  • '; } } From 43e209690fd4302c93485136cfbabbb9ba67babe Mon Sep 17 00:00:00 2001 From: Nicolas Date: Wed, 30 Apr 2014 21:24:31 +0200 Subject: [PATCH 2/9] Handle SMTPEXceptions correctly in auth register, recover and add email. #732 --- apps/authentication/views.py | 2 +- apps/profiles/views.py | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/apps/authentication/views.py b/apps/authentication/views.py index 70edb2ecf..80536099b 100644 --- a/apps/authentication/views.py +++ b/apps/authentication/views.py @@ -97,7 +97,7 @@ def register(request): try: send_mail(_(u'Verifiser din konto'), email_message, settings.DEFAULT_FROM_EMAIL, [email.email,]) except SMTPException as e: - messages.error(request, u'Det oppstod en kritisk feil, ' + e) + messages.error(request, u'Det oppstod en kritisk feil, epostadressen er ugjyldig!') return redirect('home') messages.success(request, _(u'Registreringen var vellykket. Se tilsendt epost for verifiseringsinstrukser.')) diff --git a/apps/profiles/views.py b/apps/profiles/views.py index 9d400d1f4..d6712fae4 100644 --- a/apps/profiles/views.py +++ b/apps/profiles/views.py @@ -338,7 +338,12 @@ def _send_verification_mail(request, email): kan dette gjøres ved å klikke på knappen for verifisering på din profil. """) % (request.META['HTTP_HOST'], token) - send_mail(_(u'Verifiser din epost %s') % email, email_message, settings.DEFAULT_FROM_EMAIL, [email,]) + try: + send_mail(_(u'Verifiser din epost %s') % email, email_message, settings.DEFAULT_FROM_EMAIL, [email,]) + except SMTPException as e: + messages.error(request, u'Det oppstod en kritisk feil, epostadressen er ugjyldig!') + return redirect('home') + @login_required def save_membership_details(request): From 58426eed4310b88924ef4fdc1bb305dac9f074b1 Mon Sep 17 00:00:00 2001 From: mythern Date: Wed, 30 Apr 2014 22:13:04 +0200 Subject: [PATCH 3/9] Removed full exposure of user object through watson indexed search, added ntnu username to profile, removed nickname filter --- apps/authentication/models.py | 2 +- apps/profiles/forms.py | 2 +- templates/profiles/privacy.html | 4 ++-- templates/profiles/view_profile.html | 8 +++++++- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/apps/authentication/models.py b/apps/authentication/models.py index 394f0d7fb..ee9f826e6 100644 --- a/apps/authentication/models.py +++ b/apps/authentication/models.py @@ -298,4 +298,4 @@ class Meta: # Register OnlineUser in watson index for searching -watson.register(OnlineUser) +watson.register(OnlineUser, fields=('first_name', 'last_name', 'ntnu_username', 'nickname')) diff --git a/apps/profiles/forms.py b/apps/profiles/forms.py index db684817f..d0d0c8c95 100644 --- a/apps/profiles/forms.py +++ b/apps/profiles/forms.py @@ -35,7 +35,7 @@ class PrivacyForm(forms.ModelForm): class Meta: model = Privacy - exclude = ['user'] + exclude = ['user', 'expose_nickname'] class MailSettingsForm(forms.ModelForm): diff --git a/templates/profiles/privacy.html b/templates/profiles/privacy.html index 1e7fd6f5e..07cda8368 100644 --- a/templates/profiles/privacy.html +++ b/templates/profiles/privacy.html @@ -30,8 +30,8 @@

    Personvern

    -
    +
    -
    \ No newline at end of file + diff --git a/templates/profiles/view_profile.html b/templates/profiles/view_profile.html index cc0960ebb..044591184 100644 --- a/templates/profiles/view_profile.html +++ b/templates/profiles/view_profile.html @@ -66,6 +66,12 @@

    Profil for {{ user.get_full_name|striptags }}

    {% endif %} +
    +
    + NTNU-brukernavn
    + {{ user.ntnu_username }} +
    +
    {% if user.positions.all %} @@ -126,4 +132,4 @@

    Profil for {{ user.get_full_name|striptags }}

    {% compress js %} {% endcompress %} -{% endblock %} \ No newline at end of file +{% endblock %} From 22b238c8bbc640c03bd3b9279ba9262d9b0c434d Mon Sep 17 00:00:00 2001 From: mythern Date: Wed, 30 Apr 2014 22:17:56 +0200 Subject: [PATCH 4/9] Added display of email, so the privacy stuff actually makes sense... --- templates/profiles/view_profile.html | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/templates/profiles/view_profile.html b/templates/profiles/view_profile.html index 044591184..478181a60 100644 --- a/templates/profiles/view_profile.html +++ b/templates/profiles/view_profile.html @@ -67,6 +67,14 @@

    Profil for {{ user.get_full_name|striptags }}

    +
    + E-Post
    + {% if user.privacy.expose_email %} + {% firstof user.get_email|striptags 'Ikke tilgjengelig' %} + {% else %} + Ikke tilgjengelig + {% endif %} +
    NTNU-brukernavn
    {{ user.ntnu_username }} From 5783457d3cef22ffbbe8435fc252100f63bffbce Mon Sep 17 00:00:00 2001 From: mythern Date: Wed, 30 Apr 2014 22:22:37 +0200 Subject: [PATCH 5/9] Removed phone number from typeahead result template --- templates/profiles/index.html | 1 - 1 file changed, 1 deletion(-) diff --git a/templates/profiles/index.html b/templates/profiles/index.html index 062007417..d3ea857e8 100755 --- a/templates/profiles/index.html +++ b/templates/profiles/index.html @@ -132,7 +132,6 @@

    Min side

    var user_search_template = [ '', '

    {{ name }}

    ', - 'Telefon {{ phone }}
    ', ].join(''); {% endverbatim %} From 952bbe9867e207f7424d0f35b28687547807617a Mon Sep 17 00:00:00 2001 From: mythern Date: Wed, 30 Apr 2014 22:42:47 +0200 Subject: [PATCH 6/9] Removed nonsense privacy checks in profile dashboard. Hide information from yourself? Added more fields to reflect public profile and privacy settings --- templates/profiles/dashboard.html | 48 +++++++++++++++++++++++++------ 1 file changed, 39 insertions(+), 9 deletions(-) diff --git a/templates/profiles/dashboard.html b/templates/profiles/dashboard.html index f84e12751..dd81972c9 100644 --- a/templates/profiles/dashboard.html +++ b/templates/profiles/dashboard.html @@ -39,14 +39,44 @@

    Din profilinformasjon

    Adresse
    - {% if user.privacy.expose_address %} - {% if user.address %} -
    {{ user.address|striptags }}
    -
    {{ user.zip_code|striptags }}
    -
    - {% else %} - Ikke tilgjenglig - {% endif %} + {% if user.address %} +
    {{ user.address|striptags }}
    +
    {{ user.zip_code|striptags }}
    +
    + {% else %} + Ikke tilgjenglig + {% endif %} +
    +
    + Telefonnummer
    + {% if user.phone_number %} + {{ user.phone_number|striptags }} + {% else %} + Ikke tilgjengelig + {% endif %} +
    +
    + Kallenavn
    + {% if user.nickname %} + {{ user.nickname }} + {% else %} + Ikke tilgjengelig + {% endif %} +
    +
    +
    +
    + E-post
    + {% if user.get_email %} + {{ user.get_email }} + {% else %} + Ikke tilgjengelig + {% endif %} +
    +
    + NTNU-brukernavn
    + {% if user.ntnu_username %} + {{ user.ntnu_username }} {% else %} Ikke tilgjengelig {% endif %} @@ -92,4 +122,4 @@

    Din profilinformasjon

    -
    \ No newline at end of file + From cebc5182ba7af52117304657dabdae7251c0843b Mon Sep 17 00:00:00 2001 From: nixolas1 Date: Wed, 30 Apr 2014 22:46:02 +0200 Subject: [PATCH 7/9] Fixed typo and removed unused "e" --- apps/authentication/views.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/authentication/views.py b/apps/authentication/views.py index 80536099b..6c8284d21 100644 --- a/apps/authentication/views.py +++ b/apps/authentication/views.py @@ -96,8 +96,8 @@ def register(request): """) % (request.META['HTTP_HOST'], token) try: send_mail(_(u'Verifiser din konto'), email_message, settings.DEFAULT_FROM_EMAIL, [email.email,]) - except SMTPException as e: - messages.error(request, u'Det oppstod en kritisk feil, epostadressen er ugjyldig!') + except SMTPException: + messages.error(request, u'Det oppstod en kritisk feil, epostadressen er ugyldig!') return redirect('home') messages.success(request, _(u'Registreringen var vellykket. Se tilsendt epost for verifiseringsinstrukser.')) From c459e8574192d15410660aa120640f05cc0689bd Mon Sep 17 00:00:00 2001 From: nixolas1 Date: Wed, 30 Apr 2014 22:47:53 +0200 Subject: [PATCH 8/9] Fixed typo and removed unused "e" --- apps/profiles/views.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/profiles/views.py b/apps/profiles/views.py index d6712fae4..87769bbba 100644 --- a/apps/profiles/views.py +++ b/apps/profiles/views.py @@ -340,8 +340,8 @@ def _send_verification_mail(request, email): try: send_mail(_(u'Verifiser din epost %s') % email, email_message, settings.DEFAULT_FROM_EMAIL, [email,]) - except SMTPException as e: - messages.error(request, u'Det oppstod en kritisk feil, epostadressen er ugjyldig!') + except SMTPException: + messages.error(request, u'Det oppstod en kritisk feil, epostadressen er ugyldig!') return redirect('home') From 0f1c66987122dd26adbc41a45eaccabc01c77ec3 Mon Sep 17 00:00:00 2001 From: Christian Duvholt Date: Wed, 30 Apr 2014 23:12:14 +0200 Subject: [PATCH 9/9] Added batch update of paid and attended for attendees. Added paid to the list. --- apps/events/admin.py | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/apps/events/admin.py b/apps/events/admin.py index dfbd8bcc8..5a15cf61f 100644 --- a/apps/events/admin.py +++ b/apps/events/admin.py @@ -40,11 +40,34 @@ class RuleBundleInline(admin.TabularInline): inline_classes = ('grp-collapse grp-open',) # style +def mark_paid(modeladmin, request, queryset): + queryset.update(paid=True) +mark_paid.short_description = "Merk som betalt" + +def mark_not_paid(modeladmin, request, queryset): + queryset.update(paid=False) +mark_not_paid.short_description = "Merk som ikke betalt" + +def mark_attended(modeladmin, request, queryset): + queryset.update(attended=True) +mark_attended.short_description = "Merk som møtt" + +def mark_not_attended(modeladmin, request, queryset): + queryset.update(attended=False) +mark_not_attended.short_description = "Merk som ikke møtt" + class AttendeeAdmin(admin.ModelAdmin): model = Attendee - list_display = ('user', 'event', 'paid', 'note') + list_display = ('user', 'event', 'paid', 'attended', 'note') list_filter = ('event__event__title',) - actions = None + actions = [mark_paid, mark_attended, mark_not_paid, mark_not_attended] + + # Disable delete_selected http://bit.ly/1o4nleN + def get_actions(self, request): + actions = super(AttendeeAdmin, self).get_actions(request) + if 'delete_selected' in actions: + del actions['delete_selected'] + return actions def delete_model(self, request, obj): event = obj.event.event