mirror of
https://github.com/haiwen/seahub.git
synced 2025-10-21 02:42:26 +00:00
[Terms] fix & improvement
This commit is contained in:
@@ -23,6 +23,7 @@
|
|||||||
* (...)
|
* (...)
|
||||||
* discussions/comments
|
* discussions/comments
|
||||||
* custom select2
|
* custom select2
|
||||||
|
* sf-panel
|
||||||
*
|
*
|
||||||
* Container
|
* Container
|
||||||
* Container ......... common container styles
|
* Container ......... common container styles
|
||||||
@@ -141,6 +142,7 @@
|
|||||||
.sf2-icon-trash:before { content:"\e016"; }
|
.sf2-icon-trash:before { content:"\e016"; }
|
||||||
.sf2-icon-security:before { content:"\e017"; }
|
.sf2-icon-security:before { content:"\e017"; }
|
||||||
.sf2-icon-edit:before { content:"\e018"; }
|
.sf2-icon-edit:before { content:"\e018"; }
|
||||||
|
.sf2-icon-edit2:before { content:"\e018"; } /* for some reason */
|
||||||
.sf2-icon-eye:before { content:"\e019"; }
|
.sf2-icon-eye:before { content:"\e019"; }
|
||||||
.sf2-icon-caret-down:before { content:"\e01a"; }
|
.sf2-icon-caret-down:before { content:"\e01a"; }
|
||||||
.sf2-icon-cog2:before { content:"\e01b"; }
|
.sf2-icon-cog2:before { content:"\e01b"; }
|
||||||
@@ -1506,6 +1508,12 @@ button.sf-dropdown-toggle:focus {
|
|||||||
.select2-result-label .text {
|
.select2-result-label .text {
|
||||||
vertical-align:middle;
|
vertical-align:middle;
|
||||||
}
|
}
|
||||||
|
/**** sf-panel ****/
|
||||||
|
.sf-panel {
|
||||||
|
padding:10px;
|
||||||
|
border: 1px solid #e8e8e8;
|
||||||
|
border-radius:3px;
|
||||||
|
}
|
||||||
|
|
||||||
/********** Container ***********/
|
/********** Container ***********/
|
||||||
#wrapper {
|
#wrapper {
|
||||||
|
@@ -1,33 +1,33 @@
|
|||||||
{% extends "sysadmin/base.html" %}
|
{% extends "sysadmin/base.html" %}
|
||||||
{% load i18n seahub_tags %}
|
{% load i18n seahub_tags %}
|
||||||
|
|
||||||
{% block cur_links %}tab-tc{% endblock %}
|
{% block cur_tc %}tab-cur{% endblock %}
|
||||||
|
|
||||||
{% block right_panel %}
|
{% block right_panel %}
|
||||||
<div class="tabnav ovhd">
|
<div class="hd ovhd">
|
||||||
<ul class="tabnav-tabs fleft">
|
<h3 class="fleft">{% trans "Terms and Conditions" %}</h3>
|
||||||
<li class="tabnav-tab tabnav-tab-cur">
|
<button id="add-btn" class="btn-white fright">{% trans "Add" %}</button>
|
||||||
{% trans "Terms and Conditions" %}
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
<button id="add-btn" class="fright">{% trans "Add" %}</button>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% if object_list %}
|
{% if object_list %}
|
||||||
<table>
|
<table>
|
||||||
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th width="15%">{% trans "Name" %}</th>
|
<th width="15%">{% trans "Name" %}</th>
|
||||||
<th width="10%">{% trans "Version number" %}</th>
|
<th width="10%">{% trans "Version" %}</th>
|
||||||
<th width="35%">{% trans "Text" %}</th>
|
<th width="35%">{% trans "Text" %}</th>
|
||||||
<th width="15%">{% trans "Active date" %}</th>
|
<th width="15%">{% trans "Created" %}</th>
|
||||||
<th width="15%">{% trans "Created date" %}</th>
|
<th width="15%">{% trans "Activated" %}</th>
|
||||||
<th width="10%">{% trans "Operations" %}</th>
|
<th width="10%"><!--Operations--></th>
|
||||||
</tr>
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
{% for tc in object_list %}
|
{% for tc in object_list %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ tc.name }}</td>
|
<td>{{ tc.name }}</td>
|
||||||
<td>{{ tc.version_number }}</td>
|
<td>{{ tc.version_number }}</td>
|
||||||
<td><a href="#" class="js-text" data-msg="{{ tc.text|linebreaksbr }}">{{ tc.text|truncatechars:50 }}</a></td>
|
<td><a href="#" class="js-text" data-msg="{{ tc.text|linebreaksbr }}">{{ tc.text|truncatechars:50 }}</a></td>
|
||||||
|
<td>{{ tc.date_created|translate_seahub_time }}</td>
|
||||||
<td>
|
<td>
|
||||||
{% if tc.date_active %}
|
{% if tc.date_active %}
|
||||||
{{ tc.date_active|translate_seahub_time }}
|
{{ tc.date_active|translate_seahub_time }}
|
||||||
@@ -35,12 +35,13 @@
|
|||||||
--
|
--
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
<td>{{ tc.date_created|translate_seahub_time }}</td>
|
<td>
|
||||||
<td><a href="#" class="js-update" data-pk="{{ tc.pk}}" data-name="{{ tc.name }}" data-version_number="{{ tc.version_number }}" data-text="{{ tc.text }}">{% trans "Update" %}</a>
|
<a href="#" class="js-update op-icon sf2-icon-edit2 vh" data-pk="{{ tc.pk}}" data-name="{{ tc.name }}" data-version="{{ tc.version_number }}" data-text="{{ tc.text }}" data-activated="{% if tc.date_active %}1{% else %}0{% endif %}" title="{% trans "Update" %}"></a>
|
||||||
<a href="#" class="remove-btn" data-url="{% url "sys_delete_terms" tc.pk %}" data-target="{{ tc.name }}">{% trans "Delete" %}</a>
|
<a href="#" class="remove-btn op-icon sf2-icon-delete vh" data-url="{% url "sys_delete_terms" tc.pk %}" data-target="{{ tc.name }}" title="{% trans "Delete" %}"></a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
{% else %}
|
{% else %}
|
||||||
@@ -48,9 +49,9 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<form id="tc-form" action="" method="post" class="hide">{% csrf_token %}
|
<form id="tc-form" action="" method="post" class="hide">{% csrf_token %}
|
||||||
|
<h3>{% trans "Add Terms and Conditions" %}</h3>
|
||||||
<input type="hidden" name="pk" value="" />
|
<input type="hidden" name="pk" value="" />
|
||||||
|
|
||||||
<h3>{% trans "Add Terms and Condistions" %}</h3>
|
|
||||||
<label for="id_name">{% trans "Name" %}</label><br />
|
<label for="id_name">{% trans "Name" %}</label><br />
|
||||||
<input type="text" name="name" id="id_name" class="input" /><br />
|
<input type="text" name="name" id="id_name" class="input" /><br />
|
||||||
|
|
||||||
@@ -58,11 +59,13 @@
|
|||||||
<input type="text" name="version_number" id="id_version_number" class="input" /><br />
|
<input type="text" name="version_number" id="id_version_number" class="input" /><br />
|
||||||
|
|
||||||
<label for="id_text">{% trans "Text" %}</label><br />
|
<label for="id_text">{% trans "Text" %}</label><br />
|
||||||
<textarea type="text" name="text" id="id_text" class="textarea"></textarea><br />
|
<textarea name="text" id="id_text" class="textarea"></textarea><br />
|
||||||
|
|
||||||
<label for="id_status">{% trans "Status" %}</label><br />
|
<label for="id_status">{% trans "Activated" %}</label><br />
|
||||||
<input type="radio" name="status" value="1" checked>{% trans "Enabled" %}
|
<input type="radio" name="status" value="1" checked="checked" class="vam">
|
||||||
<input type="radio" name="status" value="0">{% trans "Disabled" %}<br>
|
<span class="vam">{% trans "On" %}</span><br />
|
||||||
|
<input type="radio" name="status" value="0" class="vam">
|
||||||
|
<span class="vam">{% trans "Off" %}</span><br />
|
||||||
|
|
||||||
<p class="error hide"></p>
|
<p class="error hide"></p>
|
||||||
<button type="submit" class="submit">{% trans "Submit" %}</button>
|
<button type="submit" class="submit">{% trans "Submit" %}</button>
|
||||||
@@ -79,28 +82,17 @@ $('#add-btn').click(function() {
|
|||||||
$('#simplemodal-container').css({'width':'auto', 'height':'auto'});
|
$('#simplemodal-container').css({'width':'auto', 'height':'auto'});
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.js-update').click(function() {
|
|
||||||
var form = $('#tc-form');
|
|
||||||
form.children('[name="pk"]').val($(this).data('pk'));
|
|
||||||
form.children('[name="name"]').val($(this).data('name'));
|
|
||||||
form.children('[name="version_number"]').val($(this).data('version_number'));
|
|
||||||
form.children('[name="text"]').val($(this).data('text'));
|
|
||||||
|
|
||||||
$('#tc-form').modal();
|
|
||||||
$('#simplemodal-container').css({'width':'auto', 'height':'auto'});
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#tc-form').submit(function(){
|
$('#tc-form').submit(function(){
|
||||||
var form = $(this),
|
var $form = $(this),
|
||||||
form_id = form.attr('id'),
|
form_id = $form.attr('id'),
|
||||||
submit_btn = form.find('[type="submit"]'),
|
$submit_btn = $form.find('[type="submit"]'),
|
||||||
pk = form.children('[name="pk"]').val();
|
pk = $('[name="pk"]', $form).val(),
|
||||||
name = $.trim(form.children('[name="name"]').val()),
|
name = $.trim($('[name="name"]', $form).val()),
|
||||||
version_num = $.trim(form.children('[name="version_number"]').val()),
|
version = $.trim($('[name="version_number"]', $form).val()),
|
||||||
text = $.trim(form.children('[name="text"]').val()),
|
text = $.trim($('[name="text"]', $form).val()),
|
||||||
status = form.children('[name="status"]:checked').val();
|
activated = $('[name="status"]:checked', $form).val();
|
||||||
|
|
||||||
disable(submit_btn);
|
disable($submit_btn);
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '{% url 'sys_terms_admin' %}',
|
url: '{% url 'sys_terms_admin' %}',
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
@@ -109,15 +101,13 @@ $('#tc-form').submit(function(){
|
|||||||
beforeSend: prepareCSRFToken,
|
beforeSend: prepareCSRFToken,
|
||||||
data: {
|
data: {
|
||||||
'name': name,
|
'name': name,
|
||||||
'version_number': version_num,
|
'version_number': version,
|
||||||
'text': text,
|
'text': text,
|
||||||
'status': status,
|
'status': activated,
|
||||||
'pk': pk
|
'pk': pk
|
||||||
},
|
},
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
if (data['success']) {
|
|
||||||
location.reload(true);
|
location.reload(true);
|
||||||
}
|
|
||||||
},
|
},
|
||||||
error: function(jqXHR, textStatus, errorThrown) {
|
error: function(jqXHR, textStatus, errorThrown) {
|
||||||
if (jqXHR.responseText) {
|
if (jqXHR.responseText) {
|
||||||
@@ -125,14 +115,28 @@ $('#tc-form').submit(function(){
|
|||||||
} else {
|
} else {
|
||||||
apply_form_error(form_id, "{% trans "Failed. Please check the network." %}");
|
apply_form_error(form_id, "{% trans "Failed. Please check the network." %}");
|
||||||
}
|
}
|
||||||
|
enable($submit_btn);
|
||||||
}
|
}
|
||||||
}).complete(function() {
|
|
||||||
enable(submit_btn);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('.js-update').click(function() {
|
||||||
|
var $form = $('#tc-form');
|
||||||
|
$form.modal({focus: false});
|
||||||
|
$('#simplemodal-container').css({'width':'auto', 'height':'auto'});
|
||||||
|
|
||||||
|
$('h3', $form).html("{% trans "Update Terms and Conditions" %}");
|
||||||
|
$('[name="pk"]', $form).val($(this).attr('data-pk'));
|
||||||
|
$('[name="name"]', $form).val($(this).attr('data-name'));
|
||||||
|
$('[name="version_number"]', $form).val($(this).attr('data-version'));
|
||||||
|
$('[name="text"]', $form).val($(this).attr('data-text'));
|
||||||
|
$('[name="status"][value="' + $(this).attr('data-activated') + '"]', $form).prop('checked', true);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
addConfirmTo($('.remove-btn'), {
|
addConfirmTo($('.remove-btn'), {
|
||||||
'title': "Delete T&C",
|
'title': "Delete T&C",
|
||||||
'con':"{% trans "Are you sure you want to delete %s ?" %}",
|
'con':"{% trans "Are you sure you want to delete %s ?" %}",
|
||||||
@@ -140,8 +144,9 @@ addConfirmTo($('.remove-btn'), {
|
|||||||
});
|
});
|
||||||
|
|
||||||
$('.js-text').click(function() {
|
$('.js-text').click(function() {
|
||||||
$('#popup-msg').html($(this).data('msg'));
|
$('#popup-msg').html($(this).attr('data-msg')).modal({
|
||||||
$('#popup-msg').modal();
|
minWidth: 150
|
||||||
|
});
|
||||||
$('#simplemodal-container').css({'height':'auto'});
|
$('#simplemodal-container').css({'height':'auto'});
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@@ -1,29 +1,18 @@
|
|||||||
{% extends "base.html" %}
|
{% extends "base_wide_page.html" %}
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
|
|
||||||
{% block main_panel %}
|
{% block wide_page_content %}
|
||||||
<div class="wide-panel">
|
<div class="sf-panel">
|
||||||
<section title="termsandconditions" data-role="content">
|
|
||||||
<h1>{{ form.initial.terms.name|safe }}</h1>
|
<h1>{{ form.initial.terms.name|safe }}</h1>
|
||||||
{{ form.errors }}
|
{{ form.errors }}
|
||||||
<div id="tc-terms-html">
|
<div id="tc-terms-html">
|
||||||
{{ form.initial.terms.text|safe|linebreaksbr }}
|
{{ form.initial.terms.text|safe|linebreaksbr }}
|
||||||
</div>
|
</div>
|
||||||
<form action="{% url 'tc_accept_page' %}" method="post" id="tc-terms-form" data-ajax="false">{% csrf_token %}
|
<form action="{% url 'tc_accept_page' %}" method="post">{% csrf_token %}
|
||||||
{{ form.terms }}
|
{{ form.terms }}
|
||||||
{{ form.returnTo }}
|
{{ form.returnTo }}
|
||||||
<input type="submit" value="{% trans 'Accept' %}" />
|
<button type="submit" class="submit">{% trans "Accept" %}</button>
|
||||||
<button class="cancel-btn">{% trans 'Cancel' %}</button>
|
<a href="{% url 'auth_logout' %}" class="sf-btn-link">{% trans "Cancel" %}</a>
|
||||||
</form>
|
</form>
|
||||||
</section>
|
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block extra_script %}
|
|
||||||
<script type="text/javascript">
|
|
||||||
$('.cancel-btn').click(function() {
|
|
||||||
location.href = "{% url 'auth_logout' %}";
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
{% endblock %}
|
|
||||||
|
@@ -2264,7 +2264,7 @@ def sys_terms_admin(request):
|
|||||||
@require_POST
|
@require_POST
|
||||||
def sys_delete_terms(request, pk):
|
def sys_delete_terms(request, pk):
|
||||||
TermsAndConditions.objects.filter(pk=pk).delete()
|
TermsAndConditions.objects.filter(pk=pk).delete()
|
||||||
messages.success(request, _('Success'))
|
messages.success(request, _('Successfully deleted 1 item'))
|
||||||
|
|
||||||
return HttpResponseRedirect(reverse('sys_terms_admin'))
|
return HttpResponseRedirect(reverse('sys_terms_admin'))
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user