1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-01 23:20:51 +00:00

modified all comfirm popup

This commit is contained in:
llj
2012-11-09 19:16:31 +08:00
parent 9bbf0ee006
commit 30b4af22f5
19 changed files with 70 additions and 72 deletions

View File

@@ -31,7 +31,7 @@
<td>{{ contact.note }}</td>
<td>
<a href="#" data="{{ SITE_ROOT }}contacts/edit/?email={{ contact.contact_email }}" class="contact-edit op">{% trans "Edit"%}</a>
<a href="#" data="{{ SITE_ROOT }}contacts/delete/?email={{ contact.contact_email}}" class="contact-delete op">{% trans "Delete"%}</a>
<a href="#" data-url="{{ SITE_ROOT }}contacts/delete/?email={{ contact.contact_email}}" data-target="{{ contact.contact_email}}" class="contact-delete op">{% trans "Delete"%}</a>
</td>
</tr>
{% endfor %}
@@ -111,7 +111,7 @@ $('#contact-edit-form').submit(function() {
return false;
});
addConfirmTo($('.contact-delete'));
addConfirmTo($('.contact-delete'), '{% trans "Delete Contact" %}', '{% trans "Are you sure you want to delete" %}');
$('#contact-add')
.click(function() {

View File

@@ -55,7 +55,7 @@
{% if is_staff %}
<li><a id="group-mgr" href="{% url 'group.views.group_manage' group.id %}">{% trans "Administration" %}</a></li>
{% else %}
<li><a id="quit-group" href="#" data="{{ SITE_ROOT }}group/{{ group.id }}/?op=quit">{% trans "Quit" %}</a></li>
<li><a id="quit-group" href="#" data-url="{{ SITE_ROOT }}group/{{ group.id }}/?op=quit">{% trans "Quit" %}</a></li>
{% endif %}
</ul>
</div>
@@ -98,7 +98,7 @@
<td>
<img src="{{ MEDIA_URL }}img/download-20.png" class="download op-icon vh" data="{{ SITE_ROOT }}seafile_access_check/?repo_id={{ repo.props.id }}" alt="{% trans "Download" %}" title="{% trans "Download" %}" />
{% if is_staff or repo.share_from_me %}
<img src="{{ MEDIA_URL }}img/delete-20.png" class="cancel-share op-icon vh" data="{% url 'repo_remove_share' %}?repo_id={{ repo.props.id }}&from={{ repo.owner }}&gid={{ group.id }}" title="{% trans "Unshare" %}" alt="{% trans "Unshare" %}" />
<img src="{{ MEDIA_URL }}img/delete-20.png" class="cancel-share op-icon vh" data-url="{% url 'repo_remove_share' %}?repo_id={{ repo.props.id }}&from={{ repo.owner }}&gid={{ group.id }}" data-target="{{ repo.props.name }}" title="{% trans "Unshare" %}" alt="{% trans "Unshare" %}" />
{% endif %}
</td>
</tr>
@@ -193,8 +193,8 @@
{% block extra_script %}
{% include 'snippets/user_profile_js.html' %}
<script type="text/javascript">
addConfirmTo($('#quit-group'), '{% trans "Really want to quit this group?" %}');
addConfirmTo($('.cancel-share'), '{% trans "Really want to unshare this library?" %}');
addConfirmTo($('#quit-group'), '{% trans "Quit Group" %}', '{% trans "Are you sure you want to quit this group" %}');
addConfirmTo($('.cancel-share'), '{% trans "Unshare Library" %}', '{% trans "Are you sure you want to unshare" %}');
addAtAutocomplete('#message', '#group-message-form', {{ group.id }}, "{% url 'group_attention' %}", {'border':'1px solid #ddd', 'width':'600px', 'height': '80px', 'word-wrap':'break-word', 'overflow-y':'auto', 'line-height': '1.5em'}); // remember to add unit (px or em) to line-height, as js in ie will take 1.5 as 1.5, not 1.5em

View File

@@ -14,7 +14,7 @@
<div class="info-item-bottom">
<ul class="with-bg">
<li><a href="{% url 'avatar_group_add' group.id %}">{% trans "Avatar"%}</a></li>
<li><a id="group-remove" href="#" data="{{ SITE_ROOT }}group/{{ group.id }}/?op=dismiss">{% trans "Dismiss"%}</a></li>
<li><a id="group-dismiss" href="#" data-url="{{ SITE_ROOT }}group/{{ group.id }}/?op=dismiss">{% trans "Dismiss"%}</a></li>
<li><a href="{{ SITE_ROOT }}group/{{ group.id }}/">{% trans "Back"%}</a></li>
</ul>
</div>
@@ -37,7 +37,7 @@
<td>{% avatar member.user_name 20 %}</td>
<td>{{ member.user_name }}</td>
<td>
<a href="#" data="{{ SITE_ROOT }}group/{{ group.id }}/member/{{ member.user_name }}/?op=delete" class="member-remove-btn op">{% trans "Delete"%}</a>
<a href="#" data-url="{{ SITE_ROOT }}group/{{ group.id }}/member/{{ member.user_name }}/?op=delete" data-target="{{ member.user_name }}" class="member-remove-btn op">{% trans "Delete"%}</a>
</td>
</tr>
{% endfor %}
@@ -60,7 +60,7 @@
<td>{{ member.user_name }}</td>
<td>
{% if member.user_name != request.user.username %}
<a href="#" data="{% url 'group_remove_admin' group.id %}?u={{ member.user_name }}" class="member-remove-btn op">{% trans "Delete"%}</a>
<a href="#" data-url="{% url 'group_remove_admin' group.id %}?u={{ member.user_name }}" data-target="{{ member.user_name }}" class="member-remove-btn op">{% trans "Delete"%}</a>
{% endif %}
</td>
</tr>
@@ -73,8 +73,8 @@
{% block extra_script %}
<script type="text/javascript">
addConfirmTo($("#group-remove"), '{% trans "Really want to dismiss this group?" %}');
addConfirmTo($(".member-remove-btn"));
addConfirmTo($("#group-dismiss"), '{% trans "Dismiss Group" %}', '{% trans "Really want to dismiss this group" %}');
addConfirmTo($(".member-remove-btn"), '{% trans "Delete Member" %}', '{% trans "Really want to delete Member" %}');
var contact_list = [], contact_email;
{% for contact in contacts %}
contact_email = '{{ contact.contact_email }}';

View File

@@ -33,8 +33,6 @@
{% block extra_script %}
<script type="text/javascript">
addConfirmTo($('#quit-group'), '确定要退出?');
addConfirmTo($('.cancel-share'), '确定要取消共享该资料库?');
$("table tr:gt(0)").hover(
function() {

View File

@@ -167,7 +167,7 @@ p {
font-size:13px;
}
.op-target {
color:#633;
color:#803;
word-wrap:break-word;
}
.no-deco,
@@ -556,11 +556,11 @@ textarea:-moz-placeholder {/* for FF */
.simplemodal-close {
margin-left:5px;
}
#dialog-delete-confirm {
text-align:center;
#confirm-popup {
min-width:255px;
}
#confirm-con {
margin-bottom:6px;
#confirm-popup button {
margin-top:.8em;
}
/*ui-autocomplete*/

View File

@@ -1,20 +1,20 @@
//add op confirm dialog
var Op_url = '';
function addConfirmTo(ele, confirm_con) {
ele.each(function() {
$(this).click(function() {
if (confirm_con) {
$('#confirm-con').html(confirm_con);
}
$('#dialog-confirm').modal({appendTo:'#main'});
Op_url = $(this).attr('data');
return false;//in case ele is '<a>'
});
//add op confirm popup
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>';
}
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'); });
return false;//in case ele is '<a>'
});
}
$('#yes-btn').click(function() {
location.href = Op_url;
});
//highlight the tr when mouse hover on it
$("table tr:gt(0)").hover(

View File

@@ -3,10 +3,12 @@
{% block nav_notificationadmin_class %}class="cur"{% endblock %}
{% block left_panel %}
<h3>{% trans "Operations" %}</h3>
<ul class="with-bg">
<li><a href="{{ SITE_ROOT }}notification/add/">{% trans "Add new notification" %}</a></li>
</ul>
<div class="info-item">
<h3 class="info-item-top">{% trans "Operations" %}</h3>
<ul class="info-item-bottom with-bg">
<li><a href="{{ SITE_ROOT }}notification/add/">{% trans "Add new notification" %}</a></li>
</ul>
</div>
{% endblock %}
{% block right_panel %}
@@ -27,7 +29,7 @@
{% if note.primary != 1 %}
<a href="#" data="{{ SITE_ROOT }}notification/set-primary/{{ note.id }}/" class="note-change-btn op">{% trans "Set to current" %}</a>
{% endif %}
<a href="#" data="{{ SITE_ROOT }}notification/delete/{{ note.id }}/" class="note-delete-btn op">{% trans "Delete" %}</a>
<a href="#" data-url="{{ SITE_ROOT }}notification/delete/{{ note.id }}/" data-target="{{ note.message }}" class="note-delete-btn op">{% trans "Delete" %}</a>
</td>
</tr>
{% endfor %}
@@ -65,10 +67,10 @@
{% block extra_script %}
<script type="text/javascript">
addConfirmTo($('.note-delete-btn'));
addConfirmTo($('.note-delete-btn'), '{% trans "Delete Notification" %}', '{% trans "Are you sure you want to delete" %}');
$('.note-change-btn').click(function() {
window.location = $(this).attr('data');
window.location = $(this).attr('data');
})
</script>
{% endblock %}

View File

@@ -31,7 +31,7 @@
</td>
<td>
{% if not user.is_self %}
<a href="#" class="remove-user-btn op" data="{% url 'org_user_remove' request.user.org.url_prefix user.email %}">{% trans "Delete" %}</a>
<a href="#" class="remove-user-btn op" data-url="{% url 'org_user_remove' request.user.org.url_prefix user.email %}" data-target="{{ user.props.email }}">{% trans "Delete" %}</a>
{% endif %}
</td>
</tr>
@@ -96,6 +96,6 @@ $('#org-user-add').click(function() {
}
);
addConfirmTo($('.remove-user-btn'));
addConfirmTo($('.remove-user-btn'), '{% trans "Delete Member" %}', '{% trans "Are you sure you want to delete" %}');
</script>
{% endblock %}

View File

@@ -18,7 +18,7 @@
<td><a href="{{ SITE_ROOT }}group/{{ group.props.id }}/" target="_blank">{{ group.props.group_name }}</a></td>
<td>{{ group.props.creator_name }}</td>
<td>{{ group.props.timestamp|tsstr_sec }}</td>
<td><a href="#" data="{{ SITE_ROOT}}organizations/{{ org.url_prefix }}/group/remove/{{ group.id }}/" class="group-remove-btn op">{% trans "Delete" %}</a></td>
<td><a href="#" data-url="{{ SITE_ROOT}}organizations/{{ org.url_prefix }}/group/remove/{{ group.id }}/" data-target="{{ group.props.group_name }}" class="group-remove-btn op">{% trans "Delete" %}</a></td>
</tr>
{% endfor %}
</table>
@@ -57,7 +57,7 @@
{% block extra_script %}
<script type="text/javascript">
addConfirmTo($('.group-remove-btn'), '{% trans "Really want to delete this group?" %}');
addConfirmTo($('.group-remove-btn'), '{% trans "Delete Group" %}', '{% trans "Are you sure you want to delete" %}');
</script>
{% endblock %}

View File

@@ -20,7 +20,7 @@
<td><a href="{{ SITE_ROOT }}repo/{{ repo.props.id }}/" target="_blank">{{ repo.props.name }}</a></td>
<td><a href="{% url 'user_profile' repo.owner %}" target="_blank">{{ repo.owner }}</a></td>
<td>{{ repo.props.desc }}</td>
<td><a href="#" data="{{ SITE_ROOT }}repo/remove/{{ repo.props.id }}/" class="repo-delete-btn op">{% trans "Delete" %}</a></td>
<td><a href="#" data-url="{{ SITE_ROOT }}repo/remove/{{ repo.props.id }}/" data-target="{{repo.props.name}}" class="repo-delete-btn op">{% trans "Delete" %}</a></td>
</tr>
{% endfor %}
</table>
@@ -59,6 +59,6 @@
{% block extra_script %}
<script type="text/javascript">
addConfirmTo($('.repo-delete-btn'));
addConfirmTo($('.repo-delete-btn'), '{% trans "Delete Library" %}', '{% trans "Are you sure you want to delete" %}');
</script>
{% endblock %}

View File

@@ -109,6 +109,11 @@
{% block main_panel %} {% endblock %}
</div>
<div id="confirm-popup" class="hide">
<div id="confirm-con"></div>
<button id="confirm-yes">{% trans "Yes"%}</button>
<button class="simplemodal-close">{% trans "No"%}</button>
</div>
</div>
<div id="footer" class="ovhd">
@@ -141,11 +146,6 @@
</div>
</div>
<div id="dialog-confirm" class="hide">
<p id="confirm-con">{% trans "Really want to delete?" %}</p>
<button id="yes-btn">{% trans "Yes"%}</button>
<button class="simplemodal-close">{% trans "No"%}</button>
</div>
</div><!-- wrapper -->
<script type="text/javascript" src="{{ MEDIA_URL }}js/jquery.min.js"></script>

View File

@@ -41,7 +41,7 @@
</td>
<td>
<a href="{% url 'repo_history_view' repo.id %}?commit_id={{ commit.id }}" class="op">{% trans "View"%}</a>
<a href="#" data="{% url 'seahub.views.repo_history_revert' repo.id %}?commit_id={{ commit.id }}" class="repo-revert op">{% trans "Restore"%}</a>
<a href="#" data-url="{% url 'seahub.views.repo_history_revert' repo.id %}?commit_id={{ commit.id }}" class="repo-revert op">{% trans "Restore"%}</a>
</td>
</tr>
{% endfor %}
@@ -81,6 +81,6 @@
$('#back').click(function() {
location.href = $(this).attr('data');
});
addConfirmTo($(".repo-revert"), '{% trans "Really want to restore this library?" %}');
addConfirmTo($('.repo-revert'), '{% trans "Restore Library" %}', '{% trans "Are you sure you want to restore this library" %}');
</script>
{% endblock %}

View File

@@ -33,7 +33,7 @@
<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/delete-20.png" data="{{ SITE_ROOT }}repo/remove/{{ repo.props.id }}/?next={{ request.path }}" 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>
</tr>
{% endfor %}
@@ -79,7 +79,7 @@
<td>{{ repo.props.user|email2nickname }}</td>
<td>
<img src="{{ MEDIA_URL }}img/download-20.png" data="{{ repo.props.repo_id }}" class="download-btn op-icon vh" title="{% trans "Download" %}" alt="{% trans "Download" %}" />
<img src="{{ MEDIA_URL }}img/delete-20.png" data="{% url 'repo_remove_share' %}?repo_id={{ repo.props.repo_id }}&from={{ repo.props.user }}&to={{ request.user }}" class="unshare-btn op-icon vh" title="{% trans "Leave Share" %}" alt="{% trans "Leave Share" %}" />
<img src="{{ MEDIA_URL }}img/delete-20.png" data-url="{% url 'repo_remove_share' %}?repo_id={{ repo.props.repo_id }}&from={{ repo.props.user }}&to={{ request.user }}" data-target="{{repo.props.repo_name}}" class="unshare-btn op-icon vh" title="{% trans "Leave Share" %}" alt="{% trans "Leave Share" %}" />
</td>
</tr>
{% endfor %}

View File

@@ -29,11 +29,10 @@ $(function() {
}
});
addConfirmTo($('.repo-delete-btn'), '{% trans "Really want to delete?" %}');
$('.unshare-btn').click(function() {
location.href = $(this).attr('data');
});
addConfirmTo($('.repo-delete-btn'), '{% trans "Delete Library" %}', '{% trans "Are you sure you want to delete" %}');
$(".download-btn").click(function() {
window.open('{{ SITE_ROOT }}seafile_access_check/?repo_id=' + $(this).attr('data'));

View File

@@ -18,7 +18,7 @@
<td><a href="{{ SITE_ROOT }}group/{{ group.props.id }}/">{{ group.props.group_name }}</a></td>
<td>{{ group.props.creator_name }}</td>
<td>{{ group.props.timestamp|tsstr_sec }}</td>
<td><a href="#" data="{{ SITE_ROOT}}group/{{ group.id }}/?op=delete&src=sysgroupadmin" class="group-remove-btn op">{% trans "Delete" %}</a></td>
<td><a href="#" data-url="{{ SITE_ROOT}}group/{{ group.id }}/?op=delete&src=sysgroupadmin" data-target="{{ group.props.group_name }}" class="group-remove-btn op">{% trans "Delete" %}</a></td>
</tr>
{% endfor %}
</table>
@@ -57,7 +57,7 @@
{% block extra_script %}
<script type="text/javascript">
addConfirmTo($('.group-remove-btn'), '{% trans "Really delete this group?" %}')
addConfirmTo($('.group-remove-btn'), '{% trans "Delete Group" %}', '{% trans "Are you sure you want to delete" %}')
</script>
{% endblock %}

View File

@@ -20,7 +20,7 @@
<td>{{ org.url_prefix }}</td>
<td>{{ org.creator }}</td>
<td>{{ org.ctime|tsstr_sec }}</td>
<td><a href="#" data="{{ SITE_ROOT}}org/remove/{{ org.org_id }}/" class="org-remove-btn op">{% trans "Delete" %}</a></td>
<td><a href="#" data-url="{{ SITE_ROOT}}org/remove/{{ org.org_id }}/" data-target="{{ org.org_name }}" class="org-remove-btn op">{% trans "Delete" %}</a></td>
</tr>
{% endfor %}
</table>
@@ -58,7 +58,7 @@
{% block extra_script %}
<script type="text/javascript">
addConfirmTo($('.org-remove-btn'), '{% trans "Really delete this organization?" %}');
addConfirmTo($('.org-remove-btn'), '{% trans "Delete Organization" %}', '{% trans "Are you sure you want to delete" %}');
</script>
{% endblock %}

View File

@@ -15,11 +15,11 @@
</tr>
{% for repo in repos %}
<tr>
<td><img src="{{MEDIA_URL}}img/sync-folder-20.png" title="{% trans "Read-Write" %}" alt="目录icon" /></td>
<td><img src="{{MEDIA_URL}}img/sync-folder-20.png" title="{% trans "Read-Write" %}" alt="{% trans "directory icon" %}" /></td>
<td><a href="{{ SITE_ROOT }}repo/{{ repo.props.id }}/">{{ repo.props.name }}</a></td>
<td><a href="{{ SITE_ROOT }}useradmin/info/{{ repo.owner }}/">{{ repo.owner}}</a></td>
<td>{{ repo.props.desc }}</td>
<td><a href="#" data="{{ SITE_ROOT }}repo/remove/{{ repo.props.id }}/?next={{ request.path }}" class="repo-delete-btn op">{% trans "Delete" %}</a></td>
<td><a href="#" data-url="{{ SITE_ROOT }}repo/remove/{{ repo.props.id }}/?next={{ request.path }}" data-target="{{ repo.props.name }}" class="repo-delete-btn op">{% trans "Delete" %}</a></td>
</tr>
{% endfor %}
</table>
@@ -58,7 +58,7 @@
{% block extra_script %}
<script type="text/javascript">
addConfirmTo($('.repo-delete-btn'));
addConfirmTo($('.repo-delete-btn'), '{% trans "Delete Library" %}', '{% trans "Are you sure you want to delete" %}');
</script>
{% endblock %}

View File

@@ -27,8 +27,8 @@
{% endif %}
<td>
{% if not user.is_self %}
<a href="#" class="remove-user-btn op" data="{{ SITE_ROOT }}useradmin/remove/{{ user.props.id }}/">{% trans "Delete" %}</a>
<a href="#" class="reset-user-btn op" data="{{ SITE_ROOT }}useradmin/password/reset/{{ user.props.id }}/">{% trans "Password Reset" %}</a>
<a href="#" class="remove-user-btn op" data-url="{{ SITE_ROOT }}useradmin/remove/{{ user.props.id }}/" data-target="{{ user.props.email }}">{% trans "Delete" %}</a>
<a href="#" class="reset-user-btn op" data-url="{{ SITE_ROOT }}useradmin/password/reset/{{ user.props.id }}/" data-target="{{ user.props.email }}">{% trans "Password Reset" %}</a>
{% endif %}
</td>
</tr>
@@ -73,7 +73,7 @@ $('.activate').each(function(){
});
});
addConfirmTo($('.remove-user-btn'));
addConfirmTo($('.reset-user-btn'), '{% trans "Really reset?" %}');
addConfirmTo($('.remove-user-btn'), '{% trans "Delete User" %}', '{% trans "Are you sure you want to delete" %}');
addConfirmTo($('.reset-user-btn'), '{% trans "Password Reset" %}', '{% trans "Are you sure you want to reset password of" %}');
</script>
{% endblock %}

View File

@@ -42,11 +42,11 @@
{% for repo in owned_repos %}
<tr>
<td><img src="{{MEDIA_URL}}img/sync-folder-20.png" title="{% trans "Read-Write" %}" alt="目录icon" /></td>
<td><img src="{{MEDIA_URL}}img/sync-folder-20.png" title="{% trans "Read-Write" %}" alt="{% trans "directory icon" %}" /></td>
<td><a href="{{ SITE_ROOT }}repo/{{ repo.props.id }}/">{{ repo.props.name }}</a></td>
<td>{{ repo.props.desc }}</td>
<td>
<a href="#" data="{{ SITE_ROOT }}repo/remove/{{ repo.props.id }}/?next={{ request.path }}" class="remove-user-repo op">{% trans "Delete" %}</a>
<a href="#" data-url="{{ SITE_ROOT }}repo/remove/{{ repo.props.id }}/?next={{ request.path }}" data-target="{{ repo.props.name }}" class="remove-user-repo op">{% trans "Delete" %}</a>
</td>
</tr>
{% endfor %}
@@ -130,7 +130,6 @@ $('#set-quota-form .submit').click(function() {
return false;
});
addConfirmTo($('.remove-user-repo'), '{% trans "Really delete this library?" %}');
addConfirmTo($('.remove-user-repo'), '{% trans "Delete Library" %}', '{% trans "Are you sure you want to delete" %}');
</script>
{% endblock %}