1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-12 04:10:47 +00:00

improved popup(send-link, share-repo, grpmember/admin-add) and textarea

This commit is contained in:
llj
2012-12-12 19:43:17 +08:00
parent 09a070ca2e
commit 0ab3058a43
9 changed files with 84 additions and 64 deletions

View File

@@ -1,6 +1,7 @@
{% load i18n %}
$("#group-admin-add").click(function() {
$("#admin-add-form").modal({appendTo: "#main", focus: false});
$('#simplemodal-container').css({'height':'auto'});
addAutocomplete('#added-admin-name', '#admin-add-form', contact_list);
return false;
})
@@ -14,10 +15,13 @@ $("#group-admin-add").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.' %}');
return false;
}
var submit_btn = $(this);
disable(submit_btn);
$.ajax({
url: '{{ post_url }}',
type: 'POST',
@@ -35,6 +39,7 @@ $('#admin-add-submit').click(function() {
$.each(errors, function(index, value) {
apply_form_error('admin-add-form', value);
});
enable(submit_btn);
}
});

View File

@@ -1,7 +1,7 @@
{% load i18n %}
<form id="member-add-form" method="post" name="member-add-form" class="hide">
<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 }}" />
{% if cloud_mode and not org %}
<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" />
</form>
<form id="admin-add-form" method="post" name="admin-add-form" class="hide">
<label>{% trans "Add administrators "%}</label><br />
<textarea id="added-admin-name" name="user_name" placeholder="{% trans "Type emails, separated by ','"%}"></textarea><br />
<h3>{% trans "Add administrators"%}</h3>
<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 }}" />
<p class="error hide" id="admin-add-error"></p>
<input type="submit" value="{% trans "Submit"%}" id="admin-add-submit" />

View File

@@ -1,6 +1,7 @@
{% load i18n %}
$("#group-member-add").click(function() {
$("#member-add-form").modal({appendTo: "#main", focus:false});
$('#simplemodal-container').css({'height':'auto'});
addAutocomplete('#added-member-name', '#member-add-form', contact_list);
return false;
})
@@ -18,6 +19,9 @@ $('#member-add-submit').click(function() {
apply_form_error('member-add-form', '{% trans 'It can not be blank.' %}');
return false;
}
var submit_btn = $(this);
disable(submit_btn);
$.ajax({
url: '{{ post_url }}',
type: 'POST',
@@ -35,6 +39,7 @@ $('#member-add-submit').click(function() {
$.each(errors, function(index, value) {
apply_form_error('member-add-form', value);
});
enable(submit_btn);
}
});

View File

@@ -34,6 +34,7 @@ img { border:none; }
textarea {
border: 1px solid #ddd;
overflow: auto; /* rm default vertical scrollbar in ie */
resize: vertical; /* for drag */
}
input {
height:22px;
@@ -1088,15 +1089,17 @@ textarea:-moz-placeholder {/* for FF */
border-radius:2px;
}
/*repo-share-form*/
#email,
#link-send-input,
#email_or_group,
#share-link,
#added-member-name,
#added-admin-name {
width:260px;
height:80px;
padding: 2px;
resize: vertical;
padding:2px;
}
#added-member-name {
width:97%;
}
#repo-share-form {
width:266px;
@@ -1206,10 +1209,7 @@ textarea:-moz-placeholder {/* for FF */
font-size:12px;
color:#333;
}
#message,
#comment-input {
font: 13px/1.5 Arial, Helvetica, sans-serif;
word-wrap: break-word;
#message {
width: 600px;
height: 80px;
margin-top: 4px;
@@ -1524,10 +1524,8 @@ textarea:-moz-placeholder {/* for FF */
}
#comment-input {
width:315px;
max-width:315px;/*limit width when drag*/
padding-left:1px;
height:36px;
margin:0;
height:3em;
}
.comment {
width:380px;

View File

@@ -3,15 +3,15 @@ function addConfirmTo(ele, confirm_hd, confirm_con) {
ele.click(function() {
var con = '<h3>' + confirm_hd + '</h3>',
target = '';
if ($(this).attr('data-target')) {
target = ' <span class="op-target">' + $(this).attr('data-target') + '</span>';
if ($(this).data('target')) {
target = ' <span class="op-target">' + $(this).data('target') + '</span>';
}
con += '<p>' + confirm_con + target + ' ?</p>';
$('#confirm-con').html(con);
$('#confirm-popup').modal({appendTo:'#main'});
$('#confirm-yes')
.attr('data', $(this).attr('data-url'))
.click(function() { location.href = $(this).attr('data'); });
.data('url', $(this).data('url'))
.click(function() { location.href = $(this).data('url'); });
return false;//in case ele is '<a>'
});
}

View File

@@ -195,9 +195,10 @@
</div>
{% if not view_history %}
<form id="link-send-form" action="" method="post" name="link-send-form" class="hide">
<label>{% trans "Emails"%}</label><br />
<textarea id="email" name="email" placeholder="{% trans "Emails, Seperate by ','"%}"></textarea><br />
<form id="link-send-form" action="" method="post" class="hide">
<h3>Send Link</h3>
<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="submit" value="{% trans "Submit"%}" class="submit" />
<p class="error hide"></p>
@@ -341,16 +342,23 @@ $('#send-shared-link').click(function() {
contact_email = '{{ contact.contact_email }}';
share_list.push({value:contact_email, label:contact_email});
{% 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 .error').addClass('hide');
$('#sending').removeClass('hide');
var form = $(this),
file_shared_link = form.children('input[name="file_shared_link"]').val(),
email = $.trim(form.children('textarea[name="email"]').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');
$('#sending').removeClass('hide');
$.ajax({
type: "POST",
@@ -366,6 +374,7 @@ $("#link-send-form").submit(function(event) {
},
error: function(data, textStatus, jqXHR) {
$('#sending').addClass('hide');
enable(submit_btn);
var errors = $.parseJSON(data.responseText);
$.each(errors, function(index, value) {
if (index == 'error') {
@@ -378,7 +387,6 @@ $("#link-send-form").submit(function(event) {
});
return false;
});
$('#shared-link').click(function() {
$(this).select();
});

View File

@@ -32,7 +32,7 @@
{% endif %}
<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/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" %}" />
</td>
</tr>

View File

@@ -15,7 +15,8 @@ $(function() {
{% endfor %}
$(".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});
$('#simplemodal-container').css('height', 'auto');
addAutocomplete('#email_or_group', '#repo-share-form', share_list);
@@ -24,13 +25,15 @@ $(function() {
//check before post
$('#share-submit-btn').click(function() {
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;
}
$("#repo-share-form").submit();
disable($(this));
});
$('.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" %}');

View File

@@ -1,18 +1,19 @@
{% load i18n %}
<form id="repo-share-form" action="{{ post_url }}" method="post" name="repo-share-form" class="hide">
<p>{% trans "Share to"%}</p>
<textarea id="email_or_group" name="email_or_group" placeholder="{% trans "Emails or Groups, Seperate by ','"%}"></textarea>
{% if cloud_mode %}
{% 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 %}
<h3>{% trans "Share Library"%}</h3>
<p>{% trans 'Share <span class="op-target"></span> to' %}</p>
<textarea id="email_or_group" name="email_or_group" placeholder="{% trans "Emails or Groups, Seperated by ','"%}"></textarea>
<select name="permission" class="share-permission-select">
<option value="rw" selected="selected">{% trans "Read-Write"%}</option>
<option value="r">{% trans "Read-Only"%}</option>
</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="" />
<p class="error hide"></p>
<input type="submit" value="{% trans "Submit"%}" id="share-submit-btn" />