mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-15 23:00:57 +00:00
improved popup(send-link, share-repo, grpmember/admin-add) and textarea
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
$("#group-admin-add").click(function() {
|
$("#group-admin-add").click(function() {
|
||||||
$("#admin-add-form").modal({appendTo: "#main", focus: false});
|
$("#admin-add-form").modal({appendTo: "#main", focus: false});
|
||||||
|
$('#simplemodal-container').css({'height':'auto'});
|
||||||
addAutocomplete('#added-admin-name', '#admin-add-form', contact_list);
|
addAutocomplete('#added-admin-name', '#admin-add-form', contact_list);
|
||||||
return false;
|
return false;
|
||||||
})
|
})
|
||||||
@@ -14,10 +15,13 @@ $("#group-admin-add").click(function() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
$('#admin-add-submit').click(function() {
|
$('#admin-add-submit').click(function() {
|
||||||
if (!$.trim($('#added-admin-name').attr('value'))) {
|
if (!$.trim($('#added-admin-name').val())) {
|
||||||
apply_form_error('admin-add-form', '{% trans 'It can not be blank.' %}');
|
apply_form_error('admin-add-form', '{% trans 'It can not be blank.' %}');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var submit_btn = $(this);
|
||||||
|
disable(submit_btn);
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '{{ post_url }}',
|
url: '{{ post_url }}',
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
@@ -35,6 +39,7 @@ $('#admin-add-submit').click(function() {
|
|||||||
$.each(errors, function(index, value) {
|
$.each(errors, function(index, value) {
|
||||||
apply_form_error('admin-add-form', value);
|
apply_form_error('admin-add-form', value);
|
||||||
});
|
});
|
||||||
|
enable(submit_btn);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
<form id="member-add-form" method="post" name="member-add-form" class="hide">
|
<form id="member-add-form" method="post" name="member-add-form" class="hide">
|
||||||
<h3>{% trans "Add members"%}</h3>
|
<h3>{% trans "Add members"%}</h3>
|
||||||
<textarea id="added-member-name" name="user_name" placeholder="{% trans "Type emails, separated by ','"%}"></textarea><br />
|
<textarea id="added-member-name" name="user_name" placeholder="{% trans "emails, separated by ','" %}"></textarea><br />
|
||||||
<input type="hidden" id="group_id" name="group_id" value="{{ group.id }}" />
|
<input type="hidden" id="group_id" name="group_id" value="{{ group.id }}" />
|
||||||
{% if cloud_mode and not org %}
|
{% if cloud_mode and not org %}
|
||||||
<p class="tip">{% trans "Tip: an invitation will be sent if the email is not registered."%}</p>
|
<p class="tip">{% trans "Tip: an invitation will be sent if the email is not registered."%}</p>
|
||||||
@@ -12,8 +12,8 @@
|
|||||||
<input type="submit" value="{% trans "Submit"%}" id="member-add-submit" />
|
<input type="submit" value="{% trans "Submit"%}" id="member-add-submit" />
|
||||||
</form>
|
</form>
|
||||||
<form id="admin-add-form" method="post" name="admin-add-form" class="hide">
|
<form id="admin-add-form" method="post" name="admin-add-form" class="hide">
|
||||||
<label>{% trans "Add administrators "%}</label><br />
|
<h3>{% trans "Add administrators"%}</h3>
|
||||||
<textarea id="added-admin-name" name="user_name" placeholder="{% trans "Type emails, separated by ','"%}"></textarea><br />
|
<textarea id="added-admin-name" name="user_name" placeholder="{% trans "emails, separated by ',' " %}"></textarea><br />
|
||||||
<input type="hidden" id="group_id" name="group_id" value="{{ group.id }}" />
|
<input type="hidden" id="group_id" name="group_id" value="{{ group.id }}" />
|
||||||
<p class="error hide" id="admin-add-error"></p>
|
<p class="error hide" id="admin-add-error"></p>
|
||||||
<input type="submit" value="{% trans "Submit"%}" id="admin-add-submit" />
|
<input type="submit" value="{% trans "Submit"%}" id="admin-add-submit" />
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
$("#group-member-add").click(function() {
|
$("#group-member-add").click(function() {
|
||||||
$("#member-add-form").modal({appendTo: "#main", focus:false});
|
$("#member-add-form").modal({appendTo: "#main", focus:false});
|
||||||
|
$('#simplemodal-container').css({'height':'auto'});
|
||||||
addAutocomplete('#added-member-name', '#member-add-form', contact_list);
|
addAutocomplete('#added-member-name', '#member-add-form', contact_list);
|
||||||
return false;
|
return false;
|
||||||
})
|
})
|
||||||
@@ -18,6 +19,9 @@ $('#member-add-submit').click(function() {
|
|||||||
apply_form_error('member-add-form', '{% trans 'It can not be blank.' %}');
|
apply_form_error('member-add-form', '{% trans 'It can not be blank.' %}');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var submit_btn = $(this);
|
||||||
|
disable(submit_btn);
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '{{ post_url }}',
|
url: '{{ post_url }}',
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
@@ -35,6 +39,7 @@ $('#member-add-submit').click(function() {
|
|||||||
$.each(errors, function(index, value) {
|
$.each(errors, function(index, value) {
|
||||||
apply_form_error('member-add-form', value);
|
apply_form_error('member-add-form', value);
|
||||||
});
|
});
|
||||||
|
enable(submit_btn);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -34,6 +34,7 @@ img { border:none; }
|
|||||||
textarea {
|
textarea {
|
||||||
border: 1px solid #ddd;
|
border: 1px solid #ddd;
|
||||||
overflow: auto; /* rm default vertical scrollbar in ie */
|
overflow: auto; /* rm default vertical scrollbar in ie */
|
||||||
|
resize: vertical; /* for drag */
|
||||||
}
|
}
|
||||||
input {
|
input {
|
||||||
height:22px;
|
height:22px;
|
||||||
@@ -1088,15 +1089,17 @@ textarea:-moz-placeholder {/* for FF */
|
|||||||
border-radius:2px;
|
border-radius:2px;
|
||||||
}
|
}
|
||||||
/*repo-share-form*/
|
/*repo-share-form*/
|
||||||
#email,
|
#link-send-input,
|
||||||
#email_or_group,
|
#email_or_group,
|
||||||
#share-link,
|
#share-link,
|
||||||
#added-member-name,
|
#added-member-name,
|
||||||
#added-admin-name {
|
#added-admin-name {
|
||||||
width:260px;
|
width:260px;
|
||||||
height:80px;
|
height:80px;
|
||||||
padding: 2px;
|
padding:2px;
|
||||||
resize: vertical;
|
}
|
||||||
|
#added-member-name {
|
||||||
|
width:97%;
|
||||||
}
|
}
|
||||||
#repo-share-form {
|
#repo-share-form {
|
||||||
width:266px;
|
width:266px;
|
||||||
@@ -1206,10 +1209,7 @@ textarea:-moz-placeholder {/* for FF */
|
|||||||
font-size:12px;
|
font-size:12px;
|
||||||
color:#333;
|
color:#333;
|
||||||
}
|
}
|
||||||
#message,
|
#message {
|
||||||
#comment-input {
|
|
||||||
font: 13px/1.5 Arial, Helvetica, sans-serif;
|
|
||||||
word-wrap: break-word;
|
|
||||||
width: 600px;
|
width: 600px;
|
||||||
height: 80px;
|
height: 80px;
|
||||||
margin-top: 4px;
|
margin-top: 4px;
|
||||||
@@ -1524,10 +1524,8 @@ textarea:-moz-placeholder {/* for FF */
|
|||||||
}
|
}
|
||||||
#comment-input {
|
#comment-input {
|
||||||
width:315px;
|
width:315px;
|
||||||
max-width:315px;/*limit width when drag*/
|
|
||||||
padding-left:1px;
|
padding-left:1px;
|
||||||
height:36px;
|
height:3em;
|
||||||
margin:0;
|
|
||||||
}
|
}
|
||||||
.comment {
|
.comment {
|
||||||
width:380px;
|
width:380px;
|
||||||
|
@@ -3,15 +3,15 @@ function addConfirmTo(ele, confirm_hd, confirm_con) {
|
|||||||
ele.click(function() {
|
ele.click(function() {
|
||||||
var con = '<h3>' + confirm_hd + '</h3>',
|
var con = '<h3>' + confirm_hd + '</h3>',
|
||||||
target = '';
|
target = '';
|
||||||
if ($(this).attr('data-target')) {
|
if ($(this).data('target')) {
|
||||||
target = ' <span class="op-target">' + $(this).attr('data-target') + '</span>';
|
target = ' <span class="op-target">' + $(this).data('target') + '</span>';
|
||||||
}
|
}
|
||||||
con += '<p>' + confirm_con + target + ' ?</p>';
|
con += '<p>' + confirm_con + target + ' ?</p>';
|
||||||
$('#confirm-con').html(con);
|
$('#confirm-con').html(con);
|
||||||
$('#confirm-popup').modal({appendTo:'#main'});
|
$('#confirm-popup').modal({appendTo:'#main'});
|
||||||
$('#confirm-yes')
|
$('#confirm-yes')
|
||||||
.attr('data', $(this).attr('data-url'))
|
.data('url', $(this).data('url'))
|
||||||
.click(function() { location.href = $(this).attr('data'); });
|
.click(function() { location.href = $(this).data('url'); });
|
||||||
return false;//in case ele is '<a>'
|
return false;//in case ele is '<a>'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@@ -195,9 +195,10 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% if not view_history %}
|
{% if not view_history %}
|
||||||
<form id="link-send-form" action="" method="post" name="link-send-form" class="hide">
|
<form id="link-send-form" action="" method="post" class="hide">
|
||||||
<label>{% trans "Emails"%}</label><br />
|
<h3>Send Link</h3>
|
||||||
<textarea id="email" name="email" placeholder="{% trans "Emails, Seperate by ','"%}"></textarea><br />
|
<label>{% trans "Send to:"%}</label><br />
|
||||||
|
<textarea id="link-send-input" name="email" placeholder="{% trans "Emails, Seperate by ','"%}"></textarea><br />
|
||||||
<input type="hidden" name="file_shared_link" value="{{ file_shared_link }}" />
|
<input type="hidden" name="file_shared_link" value="{{ file_shared_link }}" />
|
||||||
<input type="submit" value="{% trans "Submit"%}" class="submit" />
|
<input type="submit" value="{% trans "Submit"%}" class="submit" />
|
||||||
<p class="error hide"></p>
|
<p class="error hide"></p>
|
||||||
@@ -341,44 +342,51 @@ $('#send-shared-link').click(function() {
|
|||||||
contact_email = '{{ contact.contact_email }}';
|
contact_email = '{{ contact.contact_email }}';
|
||||||
share_list.push({value:contact_email, label:contact_email});
|
share_list.push({value:contact_email, label:contact_email});
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
addAutocomplete('#email', '#link-send-form', share_list);
|
addAutocomplete('#link-send-input', '#link-send-form', share_list);
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#link-send-form").submit(function(event) {
|
$("#link-send-form").submit(function(event) {
|
||||||
|
var form = $(this),
|
||||||
|
file_shared_link = form.children('input[name="file_shared_link"]').val(),
|
||||||
|
email = $.trim(form.children('textarea[name="email"]').val()),
|
||||||
|
submit_btn = form.children('input[type="submit"]');
|
||||||
|
|
||||||
|
if (!email) {
|
||||||
|
apply_form_error('link-send-form', '{% trans "Please input at least an email." %}');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
disable(submit_btn);
|
||||||
$('#link-send-form .error').addClass('hide');
|
$('#link-send-form .error').addClass('hide');
|
||||||
$('#sending').removeClass('hide');
|
$('#sending').removeClass('hide');
|
||||||
|
|
||||||
var form = $(this),
|
$.ajax({
|
||||||
file_shared_link = form.children('input[name="file_shared_link"]').val(),
|
type: "POST",
|
||||||
email = $.trim(form.children('textarea[name="email"]').val());
|
url: "{% url 'send_shared_link' %}",
|
||||||
|
dataType: 'json',
|
||||||
$.ajax({
|
cache: false,
|
||||||
type: "POST",
|
contentType: 'application/json; charset=utf-8',
|
||||||
url: "{% url 'send_shared_link' %}",
|
beforeSend: prepareCSRFToken,
|
||||||
dataType: 'json',
|
data: {file_shared_link: file_shared_link, email: email},
|
||||||
cache: false,
|
success: function(data) {
|
||||||
contentType: 'application/json; charset=utf-8',
|
$.modal.close();
|
||||||
beforeSend: prepareCSRFToken,
|
feedback('{% trans "Sending successfully" %}', "success");
|
||||||
data: {file_shared_link: file_shared_link, email: email},
|
},
|
||||||
success: function(data) {
|
error: function(data, textStatus, jqXHR) {
|
||||||
$.modal.close();
|
$('#sending').addClass('hide');
|
||||||
feedback('{% trans "Sending successfully" %}', "success");
|
enable(submit_btn);
|
||||||
},
|
var errors = $.parseJSON(data.responseText);
|
||||||
error: function(data, textStatus, jqXHR) {
|
$.each(errors, function(index, value) {
|
||||||
$('#sending').addClass('hide');
|
if (index == 'error') {
|
||||||
var errors = $.parseJSON(data.responseText);
|
apply_form_error('link-send-form', value);
|
||||||
$.each(errors, function(index, value) {
|
} else {
|
||||||
if (index == 'error') {
|
apply_form_error('link-send-form', value[0]);
|
||||||
apply_form_error('link-send-form', value);
|
}
|
||||||
} else {
|
});
|
||||||
apply_form_error('link-send-form', value[0]);
|
}
|
||||||
}
|
});
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#shared-link').click(function() {
|
$('#shared-link').click(function() {
|
||||||
$(this).select();
|
$(this).select();
|
||||||
});
|
});
|
||||||
|
@@ -32,7 +32,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
<td>
|
<td>
|
||||||
<img src="{{ MEDIA_URL }}img/download-20.png" data="{{ repo.props.id }}" class="download-btn op-icon vh" title="{% trans "Download" %}" alt="{% trans "Download" %}" />
|
<img src="{{ MEDIA_URL }}img/download-20.png" data="{{ repo.props.id }}" class="download-btn op-icon vh" title="{% trans "Download" %}" alt="{% trans "Download" %}" />
|
||||||
<img src="{{ MEDIA_URL }}img/share-20.png" data="{{ repo.props.id }}" class="repo-share-btn op-icon vh" title="{% trans "Share" %}" alt="{% trans "Share" %}" />
|
<img src="{{ MEDIA_URL }}img/share-20.png" data-id="{{ repo.props.id }}" data-name="{{ repo.props.name }}" class="repo-share-btn op-icon vh" title="{% trans "Share" %}" alt="{% trans "Share" %}" />
|
||||||
<img src="{{ MEDIA_URL }}img/delete-20.png" data-url="{{ SITE_ROOT }}repo/remove/{{ repo.props.id }}/?next={{ request.path }}" data-target="{{ repo.props.name }}" class="repo-delete-btn op-icon vh" title="{% trans "Delete" %}" alt="{% trans "Delete" %}" />
|
<img src="{{ MEDIA_URL }}img/delete-20.png" data-url="{{ SITE_ROOT }}repo/remove/{{ repo.props.id }}/?next={{ request.path }}" data-target="{{ repo.props.name }}" class="repo-delete-btn op-icon vh" title="{% trans "Delete" %}" alt="{% trans "Delete" %}" />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@@ -15,7 +15,8 @@ $(function() {
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
$(".repo-share-btn").click(function() {
|
$(".repo-share-btn").click(function() {
|
||||||
$("#repo_id").val($(this).attr("data"));
|
$("#repo_id").val($(this).data("id"));
|
||||||
|
$("#repo-share-form .op-target").html($(this).data("name"));
|
||||||
$("#repo-share-form").modal({appendTo: "#main", focus:false});
|
$("#repo-share-form").modal({appendTo: "#main", focus:false});
|
||||||
$('#simplemodal-container').css('height', 'auto');
|
$('#simplemodal-container').css('height', 'auto');
|
||||||
addAutocomplete('#email_or_group', '#repo-share-form', share_list);
|
addAutocomplete('#email_or_group', '#repo-share-form', share_list);
|
||||||
@@ -24,13 +25,15 @@ $(function() {
|
|||||||
//check before post
|
//check before post
|
||||||
$('#share-submit-btn').click(function() {
|
$('#share-submit-btn').click(function() {
|
||||||
if (!$.trim($('#email_or_group').attr('value'))) {
|
if (!$.trim($('#email_or_group').attr('value'))) {
|
||||||
apply_form_error('repo-share-form', '{% trans "Input cannot be empty" %}');
|
apply_form_error('repo-share-form', '{% trans "Please enter emails or groups." %}');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
$("#repo-share-form").submit();
|
||||||
|
disable($(this));
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.unshare-btn').click(function() {
|
$('.unshare-btn').click(function() {
|
||||||
location.href = $(this).attr('data-url');
|
location.href = $(this).data('url');
|
||||||
});
|
});
|
||||||
addConfirmTo($('.repo-delete-btn'), '{% trans "Delete Library" %}', '{% trans "Are you sure you want to delete" %}');
|
addConfirmTo($('.repo-delete-btn'), '{% trans "Delete Library" %}', '{% trans "Are you sure you want to delete" %}');
|
||||||
|
|
||||||
|
@@ -1,18 +1,19 @@
|
|||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
<form id="repo-share-form" action="{{ post_url }}" method="post" name="repo-share-form" class="hide">
|
<form id="repo-share-form" action="{{ post_url }}" method="post" name="repo-share-form" class="hide">
|
||||||
<p>{% trans "Share to"%}</p>
|
<h3>{% trans "Share Library"%}</h3>
|
||||||
<textarea id="email_or_group" name="email_or_group" placeholder="{% trans "Emails or Groups, Seperate by ','"%}"></textarea>
|
<p>{% trans 'Share <span class="op-target"></span> to' %}</p>
|
||||||
{% if cloud_mode %}
|
<textarea id="email_or_group" name="email_or_group" placeholder="{% trans "Emails or Groups, Seperated by ','"%}"></textarea>
|
||||||
{% if org %}
|
|
||||||
<p class="tip">{% trans "Tip: must be org members or org groups, type all to share to public library."%}</p>
|
|
||||||
{% endif %}
|
|
||||||
{% else %}
|
|
||||||
<p class="tip">{% trans "Tip: type all to share to public library."%}</p>
|
|
||||||
{% endif %}
|
|
||||||
<select name="permission" class="share-permission-select">
|
<select name="permission" class="share-permission-select">
|
||||||
<option value="rw" selected="selected">{% trans "Read-Write"%}</option>
|
<option value="rw" selected="selected">{% trans "Read-Write"%}</option>
|
||||||
<option value="r">{% trans "Read-Only"%}</option>
|
<option value="r">{% trans "Read-Only"%}</option>
|
||||||
</select>
|
</select>
|
||||||
|
{% if cloud_mode %}
|
||||||
|
{% if org %}
|
||||||
|
<p class="tip">{% trans 'Tip: must be organization members or organization groups, enter "all" to share to public library.' %}</p>
|
||||||
|
{% endif %}
|
||||||
|
{% else %}
|
||||||
|
<p class="tip">{% trans 'Tip: enter "all" to share to public library.' %}</p>
|
||||||
|
{% endif %}
|
||||||
<input id="repo_id" type="hidden" name="repo_id" value="" />
|
<input id="repo_id" type="hidden" name="repo_id" value="" />
|
||||||
<p class="error hide"></p>
|
<p class="error hide"></p>
|
||||||
<input type="submit" value="{% trans "Submit"%}" id="share-submit-btn" />
|
<input type="submit" value="{% trans "Submit"%}" id="share-submit-btn" />
|
||||||
|
Reference in New Issue
Block a user