New delete user button
refactored confirm dialogs
This commit is contained in:
		
							parent
							
								
									9a20faf640
								
							
						
					
					
						commit
						f6538b6110
					
				
							
								
								
									
										39
									
								
								cps/admin.py
									
									
									
									
									
								
							
							
						
						
									
										39
									
								
								cps/admin.py
									
									
									
									
									
								
							| 
						 | 
					@ -244,6 +244,21 @@ def update_view_configuration():
 | 
				
			||||||
    return view_configuration()
 | 
					    return view_configuration()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@admi.route("/ajax/loaddialogtexts/<element_id>")
 | 
				
			||||||
 | 
					@login_required
 | 
				
			||||||
 | 
					def load_dialogtexts(element_id):
 | 
				
			||||||
 | 
					    texts = { "header": "", "main": "" }
 | 
				
			||||||
 | 
					    if element_id == "config_delete_kobo_token":
 | 
				
			||||||
 | 
					        texts["main"] = _('Do you really want to delete the Kobo Token?')
 | 
				
			||||||
 | 
					    elif element_id == "btndeletedomain":
 | 
				
			||||||
 | 
					        texts["main"] = _('Do you really want to delete this domain?')
 | 
				
			||||||
 | 
					    elif element_id == "btndeluser":
 | 
				
			||||||
 | 
					        texts["main"] = _('Do you really want to delete this user?')
 | 
				
			||||||
 | 
					    elif element_id == "delete_shelf":
 | 
				
			||||||
 | 
					        texts["main"] = _('Are you sure you want to delete this shelf?')
 | 
				
			||||||
 | 
					    return json.dumps(texts)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@admi.route("/ajax/editdomain/<int:allow>", methods=['POST'])
 | 
					@admi.route("/ajax/editdomain/<int:allow>", methods=['POST'])
 | 
				
			||||||
@login_required
 | 
					@login_required
 | 
				
			||||||
@admin_required
 | 
					@admin_required
 | 
				
			||||||
| 
						 | 
					@ -283,20 +298,23 @@ def add_domain(allow):
 | 
				
			||||||
@login_required
 | 
					@login_required
 | 
				
			||||||
@admin_required
 | 
					@admin_required
 | 
				
			||||||
def delete_domain():
 | 
					def delete_domain():
 | 
				
			||||||
    domain_id = request.form.to_dict()['domainid'].replace('*', '%').replace('?', '_').lower()
 | 
					 | 
				
			||||||
    ub.session.query(ub.Registration).filter(ub.Registration.id == domain_id).delete()
 | 
					 | 
				
			||||||
    try:
 | 
					    try:
 | 
				
			||||||
        ub.session.commit()
 | 
					        domain_id = request.form.to_dict()['domainid'].replace('*', '%').replace('?', '_').lower()
 | 
				
			||||||
    except OperationalError:
 | 
					        ub.session.query(ub.Registration).filter(ub.Registration.id == domain_id).delete()
 | 
				
			||||||
        ub.session.rollback()
 | 
					 | 
				
			||||||
    # If last domain was deleted, add all domains by default
 | 
					 | 
				
			||||||
    if not ub.session.query(ub.Registration).filter(ub.Registration.allow==1).count():
 | 
					 | 
				
			||||||
        new_domain = ub.Registration(domain="%.%",allow=1)
 | 
					 | 
				
			||||||
        ub.session.add(new_domain)
 | 
					 | 
				
			||||||
        try:
 | 
					        try:
 | 
				
			||||||
            ub.session.commit()
 | 
					            ub.session.commit()
 | 
				
			||||||
        except OperationalError:
 | 
					        except OperationalError:
 | 
				
			||||||
            ub.session.rollback()
 | 
					            ub.session.rollback()
 | 
				
			||||||
 | 
					        # If last domain was deleted, add all domains by default
 | 
				
			||||||
 | 
					        if not ub.session.query(ub.Registration).filter(ub.Registration.allow==1).count():
 | 
				
			||||||
 | 
					            new_domain = ub.Registration(domain="%.%",allow=1)
 | 
				
			||||||
 | 
					            ub.session.add(new_domain)
 | 
				
			||||||
 | 
					            try:
 | 
				
			||||||
 | 
					                ub.session.commit()
 | 
				
			||||||
 | 
					            except OperationalError:
 | 
				
			||||||
 | 
					                ub.session.rollback()
 | 
				
			||||||
 | 
					    except KeyError:
 | 
				
			||||||
 | 
					        pass
 | 
				
			||||||
    return ""
 | 
					    return ""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -569,7 +587,8 @@ def list_restriction(res_type):
 | 
				
			||||||
    return response
 | 
					    return response
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@admi.route("/basicconfig/pathchooser/")
 | 
					@admi.route("/basicconfig/pathchooser/")
 | 
				
			||||||
@unconfigured
 | 
					# @unconfigured
 | 
				
			||||||
 | 
					@login_required
 | 
				
			||||||
def config_pathchooser():
 | 
					def config_pathchooser():
 | 
				
			||||||
    return pathchooser()
 | 
					    return pathchooser()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -110,6 +110,34 @@ $(document).ready(function() {
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function ConfirmDialog(id, dataValue, yesFn, noFn) {
 | 
				
			||||||
 | 
					    var pathname = document.getElementsByTagName("script"), src = pathname[pathname.length - 1].src;
 | 
				
			||||||
 | 
					    var path = src.substring(0, src.lastIndexOf("/"));
 | 
				
			||||||
 | 
					    var $confirm = $("#GeneralDeleteModal");
 | 
				
			||||||
 | 
					    // var dataValue= e.data('value'); // target.data('value');
 | 
				
			||||||
 | 
					    $confirm.modal('show');
 | 
				
			||||||
 | 
					    $.ajax({
 | 
				
			||||||
 | 
					        method:"get",
 | 
				
			||||||
 | 
					        dataType: "json",
 | 
				
			||||||
 | 
					        url: path + "/../../ajax/loaddialogtexts/" + id,
 | 
				
			||||||
 | 
					        success: function success(data) {
 | 
				
			||||||
 | 
					            $("#header").html(data.header);
 | 
				
			||||||
 | 
					            $("#text").html(data.main);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    $("#btnConfirmYes").off('click').click(function () {
 | 
				
			||||||
 | 
					        yesFn(dataValue);
 | 
				
			||||||
 | 
					        $confirm.modal("hide");
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					    $("#btnConfirmNo").off('click').click(function () {
 | 
				
			||||||
 | 
					        if (typeof noFn !== 'undefined') {
 | 
				
			||||||
 | 
					            noFn(dataValue);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        $confirm.modal("hide");
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
$("#delete_confirm").click(function() {
 | 
					$("#delete_confirm").click(function() {
 | 
				
			||||||
    //get data-id attribute of the clicked element
 | 
					    //get data-id attribute of the clicked element
 | 
				
			||||||
| 
						 | 
					@ -452,6 +480,52 @@ $(function() {
 | 
				
			||||||
            $("#config_delete_kobo_token").show();
 | 
					            $("#config_delete_kobo_token").show();
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    $("#config_delete_kobo_token").click(function() {
 | 
				
			||||||
 | 
					        ConfirmDialog(
 | 
				
			||||||
 | 
					            $(this).attr('id'),
 | 
				
			||||||
 | 
					            $(this).data('value'),
 | 
				
			||||||
 | 
					            function (value) {
 | 
				
			||||||
 | 
					                var pathname = document.getElementsByTagName("script");
 | 
				
			||||||
 | 
					                var src = pathname[pathname.length - 1].src;
 | 
				
			||||||
 | 
					                var path = src.substring(0, src.lastIndexOf("/"));
 | 
				
			||||||
 | 
					                $.ajax({
 | 
				
			||||||
 | 
					                    method: "get",
 | 
				
			||||||
 | 
					                    url: path + "/../../kobo_auth/deleteauthtoken/" + value,
 | 
				
			||||||
 | 
					                });
 | 
				
			||||||
 | 
					                $("#config_delete_kobo_token").hide();
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        );
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    $("#btndeluser").click(function() {
 | 
				
			||||||
 | 
					        ConfirmDialog(
 | 
				
			||||||
 | 
					            $(this).attr('id'),
 | 
				
			||||||
 | 
					            $(this).data('value'),
 | 
				
			||||||
 | 
					            function(value){
 | 
				
			||||||
 | 
					                var subform = $('#user_submit').closest("form");
 | 
				
			||||||
 | 
					                subform.submit(function(eventObj) {
 | 
				
			||||||
 | 
					                    $(this).append('<input type="hidden" name="delete" value="True" />');
 | 
				
			||||||
 | 
					                    return true;
 | 
				
			||||||
 | 
					                });
 | 
				
			||||||
 | 
					                subform.submit();
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        );
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					    $("#user_submit").click(function() {
 | 
				
			||||||
 | 
					        this.closest("form").submit();
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    $("#delete_shelf").click(function() {
 | 
				
			||||||
 | 
					        ConfirmDialog(
 | 
				
			||||||
 | 
					            $(this).attr('id'),
 | 
				
			||||||
 | 
					            $(this).data('value'),
 | 
				
			||||||
 | 
					            function(value){
 | 
				
			||||||
 | 
					                window.location.href = window.location.pathname + "/../../shelf/delete/" + value
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    $("#fileModal").on("show.bs.modal", function(e) {
 | 
					    $("#fileModal").on("show.bs.modal", function(e) {
 | 
				
			||||||
| 
						 | 
					@ -487,19 +561,6 @@ $(function() {
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    $("#btndeletetoken").click(function() {
 | 
					 | 
				
			||||||
        //get data-id attribute of the clicked element
 | 
					 | 
				
			||||||
        var pathname = document.getElementsByTagName("script"), src = pathname[pathname.length - 1].src;
 | 
					 | 
				
			||||||
        var path = src.substring(0, src.lastIndexOf("/"));
 | 
					 | 
				
			||||||
        $.ajax({
 | 
					 | 
				
			||||||
            method:"get",
 | 
					 | 
				
			||||||
            url: path + "/../../kobo_auth/deleteauthtoken/" + this.value,
 | 
					 | 
				
			||||||
        });
 | 
					 | 
				
			||||||
        $("#modalDeleteToken").modal("hide");
 | 
					 | 
				
			||||||
        $("#config_delete_kobo_token").hide();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    $(window).resize(function() {
 | 
					    $(window).resize(function() {
 | 
				
			||||||
        $(".discover .row").isotope("layout");
 | 
					        $(".discover .row").isotope("layout");
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -208,15 +208,13 @@ $(function() {
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        striped: false
 | 
					        striped: false
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
    $("#btndeletedomain").click(function() {
 | 
					
 | 
				
			||||||
        //get data-id attribute of the clicked element
 | 
					    function domain_handle(domainId) {
 | 
				
			||||||
        var domainId = $(this).data("domainId");
 | 
					 | 
				
			||||||
        $.ajax({
 | 
					        $.ajax({
 | 
				
			||||||
            method:"post",
 | 
					            method:"post",
 | 
				
			||||||
            url: window.location.pathname + "/../../ajax/deletedomain",
 | 
					            url: window.location.pathname + "/../../ajax/deletedomain",
 | 
				
			||||||
            data: {"domainid":domainId}
 | 
					            data: {"domainid":domainId}
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
        $("#DeleteDomain").modal("hide");
 | 
					 | 
				
			||||||
        $.ajax({
 | 
					        $.ajax({
 | 
				
			||||||
            method:"get",
 | 
					            method:"get",
 | 
				
			||||||
            url: window.location.pathname + "/../../ajax/domainlist/1",
 | 
					            url: window.location.pathname + "/../../ajax/domainlist/1",
 | 
				
			||||||
| 
						 | 
					@ -235,12 +233,16 @@ $(function() {
 | 
				
			||||||
                $("#domain-deny-table").bootstrapTable("load", data);
 | 
					                $("#domain-deny-table").bootstrapTable("load", data);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    $("#domain-allow-table").on("click-cell.bs.table", function (field, value, row, $element) {
 | 
				
			||||||
 | 
					        if (value === 2) {
 | 
				
			||||||
 | 
					            ConfirmDialog("btndeletedomain", $element.id, domain_handle);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
    //triggered when modal is about to be shown
 | 
					    $("#domain-deny-table").on("click-cell.bs.table", function (field, value, row, $element) {
 | 
				
			||||||
    $("#DeleteDomain").on("show.bs.modal", function(e) {
 | 
					        if (value === 2) {
 | 
				
			||||||
        //get data-id attribute of the clicked element and store in button
 | 
					            ConfirmDialog("btndeletedomain", $element.id, domain_handle);
 | 
				
			||||||
        var domainId = $(e.relatedTarget).data("domain-id");
 | 
					        }
 | 
				
			||||||
        $(e.currentTarget).find("#btndeletedomain").data("domainId", domainId);
 | 
					 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    $("#restrictModal").on("hidden.bs.modal", function () {
 | 
					    $("#restrictModal").on("hidden.bs.modal", function () {
 | 
				
			||||||
| 
						 | 
					@ -347,7 +349,7 @@ $(function() {
 | 
				
			||||||
/* Function for deleting domain restrictions */
 | 
					/* Function for deleting domain restrictions */
 | 
				
			||||||
function TableActions (value, row) {
 | 
					function TableActions (value, row) {
 | 
				
			||||||
    return [
 | 
					    return [
 | 
				
			||||||
        "<a class=\"danger remove\" data-toggle=\"modal\" data-target=\"#DeleteDomain\" data-domain-id=\"" + row.id
 | 
					        "<a class=\"danger remove\"  data-value=\"" + row.id
 | 
				
			||||||
        + "\" title=\"Remove\">",
 | 
					        + "\" title=\"Remove\">",
 | 
				
			||||||
        "<i class=\"glyphicon glyphicon-trash\"></i>",
 | 
					        "<i class=\"glyphicon glyphicon-trash\"></i>",
 | 
				
			||||||
        "</a>"
 | 
					        "</a>"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -197,7 +197,8 @@
 | 
				
			||||||
{% endblock %}
 | 
					{% endblock %}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
{% block modal %}
 | 
					{% block modal %}
 | 
				
			||||||
{{ delete_book(book.id) }}
 | 
					{{ delete_book() }}
 | 
				
			||||||
 | 
					{{ delete_confirm_modal() }}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<div class="modal fade" id="metaModal" tabindex="-1" role="dialog" aria-labelledby="metaModalLabel">
 | 
					<div class="modal fade" id="metaModal" tabindex="-1" role="dialog" aria-labelledby="metaModalLabel">
 | 
				
			||||||
  <div class="modal-dialog modal-lg" role="document">
 | 
					  <div class="modal-dialog modal-lg" role="document">
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -89,20 +89,7 @@
 | 
				
			||||||
{% endblock %}
 | 
					{% endblock %}
 | 
				
			||||||
{% block modal %}
 | 
					{% block modal %}
 | 
				
			||||||
{% if g.allow_registration %}
 | 
					{% if g.allow_registration %}
 | 
				
			||||||
<div id="DeleteDomain" class="modal fade" role="dialog">
 | 
					{{ delete_confirm_modal() }}
 | 
				
			||||||
  <div class="modal-dialog modal-sm">
 | 
					 | 
				
			||||||
    <!-- Modal content-->
 | 
					 | 
				
			||||||
    <div class="modal-content">
 | 
					 | 
				
			||||||
      <div class="modal-header bg-danger">
 | 
					 | 
				
			||||||
      </div>
 | 
					 | 
				
			||||||
      <div class="modal-body text-center">
 | 
					 | 
				
			||||||
        <p>{{_('Are you sure you want to delete this domain?')}}</p>
 | 
					 | 
				
			||||||
        <button type="button" class="btn btn-danger" id="btndeletedomain" >{{_('Delete')}}</button>
 | 
					 | 
				
			||||||
        <button type="button" class="btn btn-default" id="btncancel" data-dismiss="modal">{{_('Cancel')}}</button>
 | 
					 | 
				
			||||||
      </div>
 | 
					 | 
				
			||||||
    </div>
 | 
					 | 
				
			||||||
  </div>
 | 
					 | 
				
			||||||
</div>
 | 
					 | 
				
			||||||
{% endif %}
 | 
					{% endif %}
 | 
				
			||||||
{% endblock %}
 | 
					{% endblock %}
 | 
				
			||||||
{% block js %}
 | 
					{% block js %}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,4 +1,4 @@
 | 
				
			||||||
{% from 'modal_dialogs.html' import restrict_modal, delete_book, filechooser_modal %}
 | 
					{% from 'modal_dialogs.html' import restrict_modal, delete_book, filechooser_modal, delete_confirm_modal %}
 | 
				
			||||||
<!DOCTYPE html>
 | 
					<!DOCTYPE html>
 | 
				
			||||||
<html lang="{{ g.user.locale }}">
 | 
					<html lang="{{ g.user.locale }}">
 | 
				
			||||||
  <head>
 | 
					  <head>
 | 
				
			||||||
| 
						 | 
					@ -189,8 +189,6 @@
 | 
				
			||||||
      </div>
 | 
					      </div>
 | 
				
			||||||
    </div>
 | 
					    </div>
 | 
				
			||||||
    {% block modal %}{% endblock %}
 | 
					    {% block modal %}{% endblock %}
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
 | 
					    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
 | 
				
			||||||
    <script src="{{ url_for('static', filename='js/libs/jquery.min.js') }}"></script>
 | 
					    <script src="{{ url_for('static', filename='js/libs/jquery.min.js') }}"></script>
 | 
				
			||||||
    <!-- Include all compiled plugins (below), or include individual files as needed -->
 | 
					    <!-- Include all compiled plugins (below), or include individual files as needed -->
 | 
				
			||||||
| 
						 | 
					@ -200,14 +198,7 @@
 | 
				
			||||||
    <script src="{{ url_for('static', filename='js/libs/context.min.js') }}"></script>
 | 
					    <script src="{{ url_for('static', filename='js/libs/context.min.js') }}"></script>
 | 
				
			||||||
    <script src="{{ url_for('static', filename='js/libs/plugins.js') }}"></script>
 | 
					    <script src="{{ url_for('static', filename='js/libs/plugins.js') }}"></script>
 | 
				
			||||||
    <script src="{{ url_for('static', filename='js/libs/jquery.form.js') }}"></script>
 | 
					    <script src="{{ url_for('static', filename='js/libs/jquery.form.js') }}"></script>
 | 
				
			||||||
    <script src="{{ url_for('static', filename='js/main.js') }}"></script>
 | 
					 | 
				
			||||||
    <script src="{{ url_for('static', filename='js/uploadprogress.js') }}"> </script>
 | 
					    <script src="{{ url_for('static', filename='js/uploadprogress.js') }}"> </script>
 | 
				
			||||||
    {% if g.current_theme == 1 %}
 | 
					 | 
				
			||||||
      <script src="{{ url_for('static', filename='js/libs/jquery.visible.min.js') }}"></script>
 | 
					 | 
				
			||||||
      <script src="{{ url_for('static', filename='js/libs/compromise.min.js') }}"></script>
 | 
					 | 
				
			||||||
      <script src="{{ url_for('static', filename='js/libs/readmore.min.js') }}"></script>
 | 
					 | 
				
			||||||
      <script src="{{ url_for('static', filename='js/caliBlur.js') }}"></script>
 | 
					 | 
				
			||||||
    {% endif %}
 | 
					 | 
				
			||||||
    <script type="text/javascript">
 | 
					    <script type="text/javascript">
 | 
				
			||||||
        $(function() {
 | 
					        $(function() {
 | 
				
			||||||
            $("#form-upload").uploadprogress({
 | 
					            $("#form-upload").uploadprogress({
 | 
				
			||||||
| 
						 | 
					@ -219,6 +210,13 @@
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
    </script>
 | 
					    </script>
 | 
				
			||||||
 | 
					    <script src="{{ url_for('static', filename='js/main.js') }}"></script>
 | 
				
			||||||
 | 
					    {% if g.current_theme == 1 %}
 | 
				
			||||||
 | 
					      <script src="{{ url_for('static', filename='js/libs/jquery.visible.min.js') }}"></script>
 | 
				
			||||||
 | 
					      <script src="{{ url_for('static', filename='js/libs/compromise.min.js') }}"></script>
 | 
				
			||||||
 | 
					      <script src="{{ url_for('static', filename='js/libs/readmore.min.js') }}"></script>
 | 
				
			||||||
 | 
					      <script src="{{ url_for('static', filename='js/caliBlur.js') }}"></script>
 | 
				
			||||||
 | 
					    {% endif %}
 | 
				
			||||||
    {% block js %}{% endblock %}
 | 
					    {% block js %}{% endblock %}
 | 
				
			||||||
  </body>
 | 
					  </body>
 | 
				
			||||||
</html>
 | 
					</html>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -37,7 +37,7 @@
 | 
				
			||||||
  </div>
 | 
					  </div>
 | 
				
			||||||
</div>
 | 
					</div>
 | 
				
			||||||
{% endmacro %}
 | 
					{% endmacro %}
 | 
				
			||||||
{% macro delete_book(bookid) %}
 | 
					{% macro delete_book() %}
 | 
				
			||||||
{% if g.user.role_delete_books() %}
 | 
					{% if g.user.role_delete_books() %}
 | 
				
			||||||
<div class="modal fade" id="deleteModal" role="dialog" aria-labelledby="metaDeleteLabel">
 | 
					<div class="modal fade" id="deleteModal" role="dialog" aria-labelledby="metaDeleteLabel">
 | 
				
			||||||
  <div class="modal-dialog">
 | 
					  <div class="modal-dialog">
 | 
				
			||||||
| 
						 | 
					@ -102,3 +102,22 @@
 | 
				
			||||||
  </div>
 | 
					  </div>
 | 
				
			||||||
</div>
 | 
					</div>
 | 
				
			||||||
{% endmacro %}
 | 
					{% endmacro %}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					{% macro delete_confirm_modal() %}
 | 
				
			||||||
 | 
					<div id="GeneralDeleteModal" class="modal fade" role="Dialog">
 | 
				
			||||||
 | 
					  <div class="modal-dialog modal-sm">
 | 
				
			||||||
 | 
					    <div class="modal-content">
 | 
				
			||||||
 | 
					      <div class="modal-header bg-danger text-center">
 | 
				
			||||||
 | 
					      <span id="header"></span>
 | 
				
			||||||
 | 
					      </div>
 | 
				
			||||||
 | 
					      <div class="modal-body text-center">
 | 
				
			||||||
 | 
					        <span id="text"></span>
 | 
				
			||||||
 | 
					          <p></p>
 | 
				
			||||||
 | 
					        <button id="btnConfirmYes" type="button" class="btn btn btn-danger">{{_('Delete')}}</button>
 | 
				
			||||||
 | 
					        <button id="btnConfirmNo" type="button" class="btn btn-default">{{_('Cancel')}}</button>
 | 
				
			||||||
 | 
					      </div>
 | 
				
			||||||
 | 
					    </div>
 | 
				
			||||||
 | 
					  </div>
 | 
				
			||||||
 | 
					</div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					{% endmacro %}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -7,7 +7,8 @@
 | 
				
			||||||
      {% endif %}
 | 
					      {% endif %}
 | 
				
			||||||
  {% if g.user.is_authenticated %}
 | 
					  {% if g.user.is_authenticated %}
 | 
				
			||||||
    {% if (g.user.role_edit_shelfs() and shelf.is_public ) or not shelf.is_public  %}
 | 
					    {% if (g.user.role_edit_shelfs() and shelf.is_public ) or not shelf.is_public  %}
 | 
				
			||||||
      <div id="delete_shelf" data-toggle="modal" data-target="#DeleteShelfDialog" class="btn btn-danger">{{ _('Delete this Shelf') }} </div>
 | 
					      <!--div id="delete_shelf" data-toggle="modal" data-target="#DeleteShelfDialog" class="btn btn-danger"></div-->
 | 
				
			||||||
 | 
					      <div class="btn btn-danger" id="delete_shelf" data-value="{{ shelf.id }}">{{ _('Delete this Shelf') }}</div>
 | 
				
			||||||
      <a id="edit_shelf" href="{{ url_for('shelf.edit_shelf', shelf_id=shelf.id) }}" class="btn btn-primary">{{ _('Edit Shelf') }} </a>
 | 
					      <a id="edit_shelf" href="{{ url_for('shelf.edit_shelf', shelf_id=shelf.id) }}" class="btn btn-primary">{{ _('Edit Shelf') }} </a>
 | 
				
			||||||
      {% if entries.__len__() %}
 | 
					      {% if entries.__len__() %}
 | 
				
			||||||
        <div class="filterheader hidden-xs hidden-sm">
 | 
					        <div class="filterheader hidden-xs hidden-sm">
 | 
				
			||||||
| 
						 | 
					@ -80,7 +81,7 @@
 | 
				
			||||||
    {% endfor %}
 | 
					    {% endfor %}
 | 
				
			||||||
  </div>
 | 
					  </div>
 | 
				
			||||||
</div>
 | 
					</div>
 | 
				
			||||||
<div id="DeleteShelfDialog" class="modal fade" role="dialog">
 | 
					<!--div id="DeleteShelfDialog" class="modal fade" role="dialog">
 | 
				
			||||||
  <div class="modal-dialog modal-sm">
 | 
					  <div class="modal-dialog modal-sm">
 | 
				
			||||||
    <div class="modal-content">
 | 
					    <div class="modal-content">
 | 
				
			||||||
      <div class="modal-header bg-danger text-center">
 | 
					      <div class="modal-header bg-danger text-center">
 | 
				
			||||||
| 
						 | 
					@ -94,6 +95,9 @@
 | 
				
			||||||
      </div>
 | 
					      </div>
 | 
				
			||||||
    </div>
 | 
					    </div>
 | 
				
			||||||
  </div>
 | 
					  </div>
 | 
				
			||||||
</div>
 | 
					</div-->
 | 
				
			||||||
 | 
					
 | 
				
			||||||
{% endblock %}
 | 
					{% endblock %}
 | 
				
			||||||
 | 
					{% block modal %}
 | 
				
			||||||
 | 
					{{ delete_confirm_modal() }}
 | 
				
			||||||
 | 
					{% endblock %}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -63,7 +63,7 @@
 | 
				
			||||||
    <label>{{ _('Kobo Sync Token')}}</label>
 | 
					    <label>{{ _('Kobo Sync Token')}}</label>
 | 
				
			||||||
    <div class="form-group col">
 | 
					    <div class="form-group col">
 | 
				
			||||||
      <a class="btn btn-default" id="config_create_kobo_token" data-toggle="modal" data-target="#modal_kobo_token" data-remote="false" href="{{ url_for('kobo_auth.generate_auth_token', user_id=content.id) }}">{{_('Create/View')}}</a>
 | 
					      <a class="btn btn-default" id="config_create_kobo_token" data-toggle="modal" data-target="#modal_kobo_token" data-remote="false" href="{{ url_for('kobo_auth.generate_auth_token', user_id=content.id) }}">{{_('Create/View')}}</a>
 | 
				
			||||||
      <div class="btn btn-danger" id="config_delete_kobo_token" data-toggle="modal" data-target="#modalDeleteToken" data-remote="false" {% if not content.remote_auth_token.first() %} style="display: none;" {% endif %}>{{_('Delete')}}</div>
 | 
					      <div class="btn btn-danger" id="config_delete_kobo_token" data-value="{{ content.id }}" data-remote="false" {% if not content.remote_auth_token.first() %} style="display: none;" {% endif %}>{{_('Delete')}}</div>
 | 
				
			||||||
    </div>
 | 
					    </div>
 | 
				
			||||||
    {% endif %}
 | 
					    {% endif %}
 | 
				
			||||||
    </div>
 | 
					    </div>
 | 
				
			||||||
| 
						 | 
					@ -125,19 +125,15 @@
 | 
				
			||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
      {% endif %}
 | 
					      {% endif %}
 | 
				
			||||||
    {% endif %}
 | 
					    {% endif %}
 | 
				
			||||||
    {% if g.user and g.user.role_admin() and not profile and not new_user and not content.role_anonymous() %}
 | 
					 | 
				
			||||||
      <div class="checkbox">
 | 
					 | 
				
			||||||
        <label>
 | 
					 | 
				
			||||||
          <input type="checkbox" id="delete" name="delete"> {{_('Delete User')}}
 | 
					 | 
				
			||||||
        </label>
 | 
					 | 
				
			||||||
      </div>
 | 
					 | 
				
			||||||
    {% endif %}
 | 
					 | 
				
			||||||
    </div>
 | 
					    </div>
 | 
				
			||||||
      <div class="col-sm-12">
 | 
					      <div class="col-sm-12">
 | 
				
			||||||
    <button type="submit" id="submit" class="btn btn-default">{{_('Save')}}</button>
 | 
					    <div id="user_submit" class="btn btn-default">{{_('Save')}}</div>
 | 
				
			||||||
    {% if not profile %}
 | 
					    {% if not profile %}
 | 
				
			||||||
      <a href="{{ url_for('admin.admin') }}" id="back" class="btn btn-default">{{_('Cancel')}}</a>
 | 
					      <a href="{{ url_for('admin.admin') }}" id="back" class="btn btn-default">{{_('Cancel')}}</a>
 | 
				
			||||||
    {% endif %}
 | 
					    {% endif %}
 | 
				
			||||||
 | 
					    {% if g.user and g.user.role_admin() and not profile and not new_user and not content.role_anonymous() %}
 | 
				
			||||||
 | 
					      <div class="btn btn-danger" id="btndeluser" data-value="{{ content.id }}" data-remote="false" >{{_('Delete User')}}</div>
 | 
				
			||||||
 | 
					    {% endif %}
 | 
				
			||||||
    </div>
 | 
					    </div>
 | 
				
			||||||
  </form>
 | 
					  </form>
 | 
				
			||||||
</div>
 | 
					</div>
 | 
				
			||||||
| 
						 | 
					@ -157,23 +153,10 @@
 | 
				
			||||||
      </div>
 | 
					      </div>
 | 
				
			||||||
    </div>
 | 
					    </div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<div id="modalDeleteToken" class="modal fade" role="dialog">
 | 
					 | 
				
			||||||
  <div class="modal-dialog modal-sm">
 | 
					 | 
				
			||||||
    <div class="modal-content">
 | 
					 | 
				
			||||||
      <div class="modal-header bg-danger">
 | 
					 | 
				
			||||||
      </div>
 | 
					 | 
				
			||||||
      <div class="modal-body text-center">
 | 
					 | 
				
			||||||
        <p>{{_('Do you really want to delete the Kobo Token?')}}</p>
 | 
					 | 
				
			||||||
        <button type="button" class="btn btn-danger" id="btndeletetoken" value="{{content.id}}">{{_('Delete')}}</button>
 | 
					 | 
				
			||||||
        <button type="button" class="btn btn-default" id="btncancel" data-dismiss="modal">{{_('Back')}}</button>
 | 
					 | 
				
			||||||
      </div>
 | 
					 | 
				
			||||||
    </div>
 | 
					 | 
				
			||||||
  </div>
 | 
					 | 
				
			||||||
</div>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
{% endblock %}
 | 
					{% endblock %}
 | 
				
			||||||
{% block modal %}
 | 
					{% block modal %}
 | 
				
			||||||
{{ restrict_modal() }}
 | 
					{{ restrict_modal() }}
 | 
				
			||||||
 | 
					{{ delete_confirm_modal() }}
 | 
				
			||||||
{% endblock %}
 | 
					{% endblock %}
 | 
				
			||||||
{% block js %}
 | 
					{% block js %}
 | 
				
			||||||
<script src="{{ url_for('static', filename='js/libs/bootstrap-table/bootstrap-table.min.js') }}"></script>
 | 
					<script src="{{ url_for('static', filename='js/libs/bootstrap-table/bootstrap-table.min.js') }}"></script>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user