1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-25 14:50:29 +00:00

show guide when there is no owned repos

This commit is contained in:
zhengxie
2015-04-17 10:42:44 +08:00
committed by Daniel Pan
parent d286452e2b
commit c870a61d0c
3 changed files with 11 additions and 6 deletions

View File

@@ -6,7 +6,6 @@
{% block extra_style %}
<style type="text/css">
{% if need_guide %}
#guide-for-new {
padding: 0 20px;
width: 450px;
@@ -18,7 +17,6 @@
#guide-for-new .txt {
margin-left:6.4em;
}
{% endif %}
</style>
{% endblock %}
@@ -121,7 +119,6 @@
<img class="loading-tip" src="{{MEDIA_URL}}img/loading-icon.gif" alt="{% trans 'Loading...' %}" />
</div>
{% if need_guide %}
<div id="guide-for-new" class="hide">
<span class="icon-lightbulb fleft"></span>
<div class="txt">
@@ -134,7 +131,7 @@
<button class="simplemodal-close" style="margin:8px 0 0 0;">{% trans "Close" %}</button>
</div>
</div>
{% endif %}
{% if sub_lib_enabled %}
<form id="sublib-create-form" class="file-choose-form hide">
@@ -251,10 +248,10 @@ app["pageOptions"] = {
can_add_repo: {% if user.permissions.can_add_repo %} true {% else %} false {% endif %},
is_staff: {% if request.user.is_staff %} true {% else %} false {% endif %},
repo_password_min_length: {{ repo_password_min_length }},
guide_enabled: {% if guide_enabled %} true {% else %} false {% endif %},
enable_upload_folder: {% if enable_upload_folder %} true {% else %} false {% endif %},
max_upload_file_size: {% if max_upload_file_size %} {{ max_upload_file_size }} {% else %} '' {% endif %}
};
</script>
{% if debug %}
<script data-main="{% static "scripts/main.js" %}" src="{% static "scripts/lib/require.js" %}"></script>

View File

@@ -1133,8 +1133,11 @@ def libraries(request):
else:
allow_public_share = True
sub_lib_enabled = UserOptions.objects.is_sub_lib_enabled(username)
guide_enabled = UserOptions.objects.is_user_guide_enabled(username)
max_upload_file_size = get_max_upload_file_size()
guide_enabled = UserOptions.objects.is_user_guide_enabled(username)
if guide_enabled:
# only show guide once
UserOptions.objects.disable_user_guide(username)
return render_to_response('libraries.html', {
"allow_public_share": allow_public_share,

View File

@@ -49,6 +49,11 @@ define([
} else {
this.$emptyTip.show();
this.$table.hide();
// Show guide popup when there is no owned repos and guide flag is true.
if (app.pageOptions.guide_enabled) {
$('#guide-for-new').modal({appendTo: '#main', focus:false});
app.pageOptions.guide_enabled = false;
}
}
this.$loadingTip.hide();
},