diff --git a/seahub/templates/myhome.html b/seahub/templates/myhome.html index 33e604a917..08900ddf01 100644 --- a/seahub/templates/myhome.html +++ b/seahub/templates/myhome.html @@ -92,7 +92,7 @@ {% include "snippets/my_owned_repos.html" %} -{% if events %} +{% if ENABLE_EVENTS %} {% include "snippets/events.html" %} {% endif %} @@ -124,7 +124,7 @@ {% include "snippets/repo_create_js.html" %} {% endwith %} -{% if events %} +{% if ENABLE_EVENTS %} {% include "snippets/events_js.html" %} {% endif %} diff --git a/seahub/templates/snippets/events.html b/seahub/templates/snippets/events.html index dc75a8dc3e..cdb1f8b6f4 100644 --- a/seahub/templates/snippets/events.html +++ b/seahub/templates/snippets/events.html @@ -5,9 +5,7 @@ {% include "snippets/events_body.html" %}
{% trans 'Loading...' %}
-{% if events_more %} - -{% endif %} +

{% csrf_token %}

{% trans 'Library' %} {% trans 'is encrypted' %}

diff --git a/seahub/templates/snippets/events_js.html b/seahub/templates/snippets/events_js.html index d5857dea61..0719dac459 100644 --- a/seahub/templates/snippets/events_js.html +++ b/seahub/templates/snippets/events_js.html @@ -1,5 +1,6 @@ {% load i18n %} {% include 'snippets/list_commit_detail.html' %} + function reqEvents(start) { $('#events-loading').removeClass('hide'); $.ajax({ @@ -71,14 +72,12 @@ function showDetailForEncrypRepo(obj) { } } -var events_more_offset = {{events_more_offset}}; - $('.lsch-encrypted').click(function() { showDetailForEncrypRepo($(this)); return false; }); -$('#events-more').data('start', events_more_offset).click(function() { +$('#events-more').click(function() { $(this).addClass('hide'); reqEvents($(this).data('start')); }); @@ -86,3 +85,8 @@ $('.updated-repo').each(function() { $(this).next().css({'margin-right':$(this).width() + 10}); }); {% include 'snippets/repo_decrypt_js.html' %} + +$(function() { + reqEvents(0); +}); + diff --git a/seahub/views/__init__.py b/seahub/views/__init__.py index e587a28e24..61cf84e67e 100644 --- a/seahub/views/__init__.py +++ b/seahub/views/__init__.py @@ -870,18 +870,6 @@ def myhome(request): allow_public_share = False if request.cloud_mode else True - # events - if EVENTS_ENABLED: - events_count = 15 - events, events_more_offset = get_user_events(email, 0, events_count) - events_more = True if len(events) == events_count else False - event_groups = group_events_data(events) - else: - events, events_more_offset = None, None - events_more = False - event_groups = None - events_count = 0 - starred_files = get_starred_files(request.user.username) traffic_stat = 0 @@ -908,16 +896,12 @@ def myhome(request): "grpmsg_reply_list": grpmsg_reply_list, "create_shared_repo": False, "allow_public_share": allow_public_share, - "events": events, - "events_more_offset": events_more_offset, - "events_more": events_more, - "event_groups": event_groups, - "events_count": events_count, "starred_files": starred_files, "TRAFFIC_STATS_ENABLED": TRAFFIC_STATS_ENABLED, "traffic_stat": traffic_stat, "ENABLE_PAYMENT": getattr(settings, 'ENABLE_PAYMENT', False), "ENABLE_SUB_LIBRARY": ENABLE_SUB_LIBRARY, + "ENABLE_EVENTS": EVENTS_ENABLED, "sub_repos": sub_repos, }, context_instance=RequestContext(request))