{% extends "base.html" %} {% load thumbnail %} {% block title %}{{ user.get_full_name }}{% endblock %} {% block content %}

{{ user.get_full_name }}

{% thumbnail user.profile.photo "180x180" crop="100%" as im %} {% endthumbnail %}
{% with total_followers=user.followers.count %} {{ total_followers }} obserwujący{{ total_followers|pluralize:"ch" }} {% if request.user not in user.followers.all %} Obserwuj {% else %} Nie obserwuj {% endif %}
{% include "images/image/list_ajax.html" with images=user.images_created.all %}
{% endwith %} {% endblock %} {% block domready %} $('a.follow').click(function(e){ e.preventDefault(); $.post('{% url "user_follow" %}', { id: $(this).data('id'), action: $(this).data('action') }, function(data){ if (data['status'] == 'ok') { var previous_action = $('a.follow').data('action'); // Zmiana wartości data-action. $('a.follow').data('action', previous_action == 'follow' ? 'unfollow' : 'follow'); // Zmiana tekstu wyświetlanego przez łącze. $('a.follow').text( previous_action == 'follow' ? 'Nie obserwuj' : 'Obserwuj'); // Uaktualnienie całkowitej liczby użytkowników obserwujących dany profil. var previous_followers = parseInt( $('span.count .total').text()); $('span.count .total').text(previous_action == 'follow' ? previous_followers + 1 : previous_followers - 1); } } ); }); {% endblock %}