1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-05-13 02:15:59 +00:00

[lib decrypt] modified form UI & used popup

This commit is contained in:
llj 2015-04-02 10:58:59 +08:00 committed by Daniel Pan
parent 2f6065260b
commit c4dabb0220
4 changed files with 35 additions and 10 deletions
media
css
img
scripts/app/views
seahub/templates/js

View File

@ -3496,3 +3496,20 @@ textarea:-moz-placeholder {/* for FF */
#dir-private-share .submit {
margin-top:18px;
}
.lib-decrypt-form {
padding:25px 40px 30px;
}
.lib-decrypt-form .intro {
font-size:19px;
color:#464646;
}
.lib-decrypt-form .input {
height:30px;
width:194px;
margin-top:10px;
}
.lib-decrypt-form .submit {
width:202px;
height:36px;
margin:21px 0 10px;
}

BIN
media/img/lock.png Normal file

Binary file not shown.

After

(image error) Size: 817 B

View File

@ -101,16 +101,24 @@ define([
var $el_con = _this.$('.repo-file-list-topbar, .repo-file-list').hide();
var $error = _this.$('.error');
var err_msg;
var decrypt_lib = false;
if (response.responseText) {
err_msg = response.responseJSON.error;
if (response.responseJSON.lib_need_decrypt) {
decrypt_lib = true;
} else {
err_msg = response.responseJSON.error;
}
} else {
err_msg = gettext('Please check the network.');
}
$error.html(err_msg).show();
if (err_msg) {
$error.html(err_msg).show();
}
if (response.responseJSON.lib_need_decrypt) {
if (decrypt_lib) {
var form = $($('#repo-decrypt-form-template').html());
_this.$el.append(form);
form.modal({containerCss: {'padding': '1px'}});
$('#simplemodal-container').css({'height':'auto'});
form.submit(function() {
var passwd = $.trim($('[name="password"]', form).val());
if (!passwd) {
@ -127,8 +135,7 @@ define([
username: app.pageOptions.username
},
after_op_success: function() {
form.remove();
$error.html('').hide();
$.modal.close();
$el_con.show();
_this.showDir(category, repo_id, path);
}

View File

@ -104,12 +104,13 @@
<!--/script-->
<script type="text/template" id="repo-decrypt-form-template">
<form id="repo-decrypt-form" action="">
<label>{% trans 'Password' %}</label><br />
<input type="password" name="password" class="input" />
<p class="tip">{% trans 'The password will be kept in the server for only 1 hour.' %}</p>
<form id="repo-decrypt-form" action="" class="alc lib-decrypt-form">
<img src="{{MEDIA_URL}}img/lock.png" alt="" />
<p class="intro">{% trans "This library is password protected" %}</p>
<p class="error hide"></p>
<input type="password" name="password" class="input" placeholder="{% trans "Password" %}" /><br />
<button type="submit" class="submit">{% trans "Submit" %}</button>
<p class="tip">{% trans '*The password will be kept in the server for only 1 hour.' %}</p>
</form>
</script>