<commit_before>#{extends themeInfo.get('themeLayout') /}

#{set title: messages.get('sdu.ListOfUploadedDocuments') /}

#{set bodyId: 'organization' /}

#{breadcrumbs crumbs: breadcrumbs /}

#{organizationNavBar isReadOnly: isReadOnly, isAdmin: isAdmin, orgId: orgId, active:"simple-document-upload", navigation: navigation /}

<div class="row">
    <div class="span12">
        <table class="table table-striped">
            <caption>&{'sdu.ListOfUploadedDocuments'}</caption>
            <thead>
                <th>&{'hubb.Name'}</th>
                <th>&{'hubb.Description'}</th>
                <th>&{'hubb.Action'}</th>
            </thead>
            <!-- ko if: documents().length > 0 -->
            <tbody data-bind="foreach: documents">
              <tr>
                  <td><a data-bind="text: name, attr: { href: '/' + id().replace(new RegExp('_', 'g'), '/') }"></a></td>
                  <td><span data-bind="text: description"></span></td>
                  <td>
                      <a class="btn btn-primary btn-mini" data-bind="attr: { href: '/organizations/${orgId}/simpledocument/' + id() + '/update' }">&{'hub.Edit'}</a>
                      <a class="btn btn-danger btn-mini delete" data-bind="attr: { id: 'remove-' + id(), 'data-remove': id() }">
                      ${messages.get('hub.Delete')}
                      </a>
                  </td>
              </tr>
            </tbody>
            <!-- /ko -->
            <!-- ko ifnot: documents().length > 0 -->
            <tbody>
              <tr>
                <td colspan="3">
                    No items defined
                    <a class="btn btn-primary btn-mini pull-right" href="/organizations/${orgId}/simpledocument/add">&{'hub.Create'}</a>
                </td>
              </tr>
            </tbody>
            <!-- /ko -->

        </table>
    </div>
</div>


<script type="text/javascript">

$(document).ready(function() {
    var viewModel = {};

    load(${data.raw()}, viewModel, null, function () {

        $('.delete:not(.disabled)').click(function () {
            var item = $(this).attr('data-remove');
            bootbox.dialog('<h3 class="shout beware">&{'hubb.AreYouSure'}</h3>&{'plugin.simpledocumentupload.deleteConfirmation'}',
            [
                {
                    "label":"No thanks!",
                    "class":"btn"
                },
                {
                    "label":"Yes, I'm sure",
                    "class":"btn-primary",
                    "callback": function () {
                        $.ajax({
                            url: '/organizations/${orgId}/simpledocument/' + item + '/remove',
                            type: "DELETE",
                            success: function () {<commit_msg>sdu: use proper message key for delete confirmation<commit_after>#{extends themeInfo.get('themeLayout') /}

#{set title: messages.get('sdu.ListOfUploadedDocuments') /}

#{set bodyId: 'organization' /}

#{breadcrumbs crumbs: breadcrumbs /}

#{organizationNavBar isReadOnly: isReadOnly, isAdmin: isAdmin, orgId: orgId, active:"simple-document-upload", navigation: navigation /}

<div class="row">
    <div class="span12">
        <table class="table table-striped">
            <caption>&{'sdu.ListOfUploadedDocuments'}</caption>
            <thead>
                <th>&{'hubb.Name'}</th>
                <th>&{'hubb.Description'}</th>
                <th>&{'hubb.Action'}</th>
            </thead>
            <!-- ko if: documents().length > 0 -->
            <tbody data-bind="foreach: documents">
              <tr>
                  <td><a data-bind="text: name, attr: { href: '/' + id().replace(new RegExp('_', 'g'), '/') }"></a></td>
                  <td><span data-bind="text: description"></span></td>
                  <td>
                      <a class="btn btn-primary btn-mini" data-bind="attr: { href: '/organizations/${orgId}/simpledocument/' + id() + '/update' }">&{'hub.Edit'}</a>
                      <a class="btn btn-danger btn-mini delete" data-bind="attr: { id: 'remove-' + id(), 'data-remove': id() }">
                      ${messages.get('hub.Delete')}
                      </a>
                  </td>
              </tr>
            </tbody>
            <!-- /ko -->
            <!-- ko ifnot: documents().length > 0 -->
            <tbody>
              <tr>
                <td colspan="3">
                    No items defined
                    <a class="btn btn-primary btn-mini pull-right" href="/organizations/${orgId}/simpledocument/add">&{'hub.Create'}</a>
                </td>
              </tr>
            </tbody>
            <!-- /ko -->

        </table>
    </div>
</div>


<script type="text/javascript">

$(document).ready(function() {
    var viewModel = {};

    load(${data.raw()}, viewModel, null, function () {

        $('.delete:not(.disabled)').click(function () {
            var item = $(this).attr('data-remove');
            bootbox.dialog('<h3 class="shout beware">&{'hubb.AreYouSure'}</h3>&{'sdu.AreYouSureYouWantToDelete'}',
            [
                {
                    "label":"No thanks!",
                    "class":"btn"
                },
                {
                    "label":"Yes, I'm sure",
                    "class":"btn-primary",
                    "callback": function () {
                        $.ajax({
                            url: '/organizations/${orgId}/simpledocument/' + item + '/remove',
                            type: "DELETE",
                            success: function () {
{'fraction_non_alphanumeric': 0.18515189645874527, 'fraction_numerical': 0.002516627718856732, 'mean_word_length': 1.523356009070295, 'pattern_counts': {'":': 10, '<': 101, '<?xml version=': 0, '>': 105, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '834223', 'n_tokens_mistral': 1605, 'n_tokens_neox': 1535, 'n_words': 287}