Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:dotKom/onlineweb4 into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
christiansyoung committed Apr 30, 2014
2 parents 714df06 + 4b6484c commit 795eb02
Show file tree
Hide file tree
Showing 10 changed files with 97 additions and 21 deletions.
2 changes: 1 addition & 1 deletion apps/authentication/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
4 changes: 2 additions & 2 deletions apps/authentication/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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, ' + e)
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.'))
Expand Down
27 changes: 25 additions & 2 deletions apps/events/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion apps/profiles/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class PrivacyForm(forms.ModelForm):

class Meta:
model = Privacy
exclude = ['user']
exclude = ['user', 'expose_nickname']


class MailSettingsForm(forms.ModelForm):
Expand Down
7 changes: 6 additions & 1 deletion apps/profiles/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
messages.error(request, u'Det oppstod en kritisk feil, epostadressen er ugyldig!')
return redirect('home')


@login_required
def save_membership_details(request):
Expand Down
7 changes: 6 additions & 1 deletion files/static/js/EventWidget.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ function EventWidget (Utils){
$('#event-items').html('<p class="ingress">Ingen arrangementer funnet</p>');
}

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)
) {
$('.event-list li').addClass('border');
}

// Calling the callback
$('.carousel').carousel();
Expand Down Expand Up @@ -104,6 +109,6 @@ function EventWidget (Utils){
}

function createEventListitem (item) {
return '<li><a href="events/' + item.id + '/' + item.slug + '">'+item.title+'</a><span>'+moment(item.event_start).lang('nb').format('DD.MM')+'</span></li> ';
return '<li><span>'+moment(item.event_start).lang('nb').format('DD.MM')+'</span><a href="events/' + item.id + '/' + item.slug + '">'+item.title+'</a></li> ';
}
}
48 changes: 39 additions & 9 deletions templates/profiles/dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,44 @@ <h4>Din profilinformasjon</h4>
<div class="row attribute-list">
<div class="col-md-4">
<b>Adresse</b><br />
{% if user.privacy.expose_address %}
{% if user.address %}
<div id="address">{{ user.address|striptags }}</div>
<div id="zip-code">{{ user.zip_code|striptags }}</div>
<div id="city"><div class="refresh"></div></div>
{% else %}
Ikke tilgjenglig
{% endif %}
{% if user.address %}
<div id="address">{{ user.address|striptags }}</div>
<div id="zip-code">{{ user.zip_code|striptags }}</div>
<div id="city"><div class="refresh"></div></div>
{% else %}
Ikke tilgjenglig
{% endif %}
</div>
<div class="col-md-4">
<b>Telefonnummer</b><br />
{% if user.phone_number %}
{{ user.phone_number|striptags }}
{% else %}
Ikke tilgjengelig
{% endif %}
</div>
<div class="col-md-4">
<b>Kallenavn</b><br />
{% if user.nickname %}
{{ user.nickname }}
{% else %}
Ikke tilgjengelig
{% endif %}
</div>
</div>
<div class="row attribute-list">
<div class="col-md-4">
<b>E-post</b><br />
{% if user.get_email %}
{{ user.get_email }}
{% else %}
Ikke tilgjengelig
{% endif %}
</div>
<div class="col-md-4">
<b>NTNU-brukernavn</b><br />
{% if user.ntnu_username %}
{{ user.ntnu_username }}
{% else %}
Ikke tilgjengelig
{% endif %}
Expand Down Expand Up @@ -92,4 +122,4 @@ <h4>Din profilinformasjon</h4>
</div>
</div>
</div>
</div>
</div>
1 change: 0 additions & 1 deletion templates/profiles/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ <h2>Min side</h2>
var user_search_template = [
'<img width="100%" src="{{ image }}" alt="" />',
'<span data-id="{{ id }}" class="user-meta"><h4>{{ name }}</h4>',
'<span class="phone"><b>Telefon</b> {{ phone }}</span></span>',
].join('');
{% endverbatim %}

Expand Down
4 changes: 2 additions & 2 deletions templates/profiles/privacy.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ <h3 class="header-inline">Personvern</h3>
</div>
</div>
</div>
<div class="col-md-12 form-actions" style="margin-left: 0px">
<div class="col-md-12 form-actions" style="margin-left: 0px; margin-top: 15px;">
<button class="btn btn-success pull-right" type="submit">Lagre personvern</button>
</div>
</form>
</div>
</div>
16 changes: 15 additions & 1 deletion templates/profiles/view_profile.html
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,20 @@ <h2>Profil for {{ user.get_full_name|striptags }}</h2>
{% endif %}
</div>
</div>
<div class="row attribute-list">
<div class="col-md-4">
<b>E-Post</b><br />
{% if user.privacy.expose_email %}
{% firstof user.get_email|striptags 'Ikke tilgjengelig' %}
{% else %}
Ikke tilgjengelig
{% endif %}
</div>
<div class="col-md-4">
<b>NTNU-brukernavn</b><br />
{{ user.ntnu_username }}
</div>
</div>
<div class="row" style="margin-bottom:40px;">
<div class="col-md-12">
{% if user.positions.all %}
Expand Down Expand Up @@ -126,4 +140,4 @@ <h2>Profil for {{ user.get_full_name|striptags }}</h2>
{% compress js %}
<script type="text/javascript" src="{{ STATIC_URL }}js/zipcodecity.js"></script>
{% endcompress %}
{% endblock %}
{% endblock %}

0 comments on commit 795eb02

Please sign in to comment.