~xibo-maintainers/xibo/tempel

410 by Dan Garner
Continue building core pages
1
{#
2
/*
3
 * Spring Signage Ltd - http://www.springsignage.com
4
 * Copyright (C) 2015 Spring Signage Ltd
5
 * (${FILE_NAME})
6
 */
7
8
#}
9
{% extends "authed.twig" %}
10
{% import "inline.twig" as inline %}
11
12
{% block actionMenu %}
13
    <ul class="nav nav-pills pull-right">
513 by Dan Garner
Button improvements (#183)
14
        <li class="btn btn-success btn-xs"><a class="XiboFormButton btns" title="{% trans "Add an Application" %}" href="{{ urlFor("application.add.form") }}"> <i class="fa fa-plus-circle" aria-hidden="true"></i> {% trans "Add Application" %}</a></li>
410 by Dan Garner
Continue building core pages
15
    </ul>
16
{% endblock %}
17
18
19
{% block pageContent %}
20
    <div class="widget">
21
        <div class="widget-title">{% trans "Applications" %}</div>
22
        <div class="widget-body">
23
            <div class="XiboGrid" id="{{ random() }}">
24
                <div class="XiboFilter">
25
                    <div class="FilterDiv" id="Filter">
26
                        <form class="form-inline">
27
                        </form>
28
                    </div>
29
                </div>
30
                <div class="XiboData">
31
                    <table id="applications" class="table table-striped">
32
                        <thead>
33
                            <tr>
437.1.2 by Dan Garner
Applications routes.
34
                                <th>{% trans "Name" %}</th>
551.2.12 by Mauro Filipe Martins Ferrão
Applications - Show Owner column xibosignage/xibo#1008
35
                                <th>{% trans "Owner" %}</th>
410 by Dan Garner
Continue building core pages
36
                                <th></th>
37
                            </tr>
38
                        </thead>
39
                        <tbody>
40
41
                        </tbody>
42
                    </table>
43
                </div>
44
            </div>
45
        </div>
46
    </div>
47
{% endblock %}
48
49
{% block javaScript %}
50
    <script type="text/javascript">
454.4.20 by Dan Garner
Added i18n for dataTables library
51
        var table = $("#applications").DataTable({ "language": dataTablesLanguage,
605.2.9 by Dan Garner
Set an unlimited save state duration for dataTables.
52
            serverSide: true, stateSave: true, stateDuration: 0,
591.1.37 by Dan Garner
Apply settings saving out to other grids.
53
            stateLoadCallback: function (settings, callback) {
54
                var data;
55
                $.ajax({
56
                    type: "GET",
57
                    async: false,
58
                    url: "{{ urlFor("user.pref") }}?preference=applicationsGrid",
59
                    dataType: 'json',
60
                    success: function (json) {
61
                        if (json.success)
62
                            data = JSON.parse(json.data.value);
63
                    }
64
                });
65
                return data;
66
            },
67
            stateSaveCallback: function (settings, data) {
68
                $.ajax({
69
                    type: "POST",
70
                    url: "{{ urlFor("user.pref") }}",
71
                    data: {
72
                        preference: [{
73
                            option: "applicationsGrid",
74
                            value: JSON.stringify(data)
75
                        }]
76
                    }
77
                });
78
            },
437.1.2 by Dan Garner
Applications routes.
79
            filter: false,
410 by Dan Garner
Continue building core pages
80
            searchDelay: 3000,
454.1.138 by Dan Garner
Added the client_credentials grant to the API and improved the applications user interface.
81
            "order": [[ 0, "asc"]],
421 by Dan Garner
Changed route name naming convention so we can better support ACL
82
            ajax: "{{ urlFor("application.search") }}",
410 by Dan Garner
Continue building core pages
83
            "columns": [
581.1.13 by Dan Garner
Formatting for double spaces on key fields.
84
                { "data": "name", "render": dataTableSpacingPreformatted },
551.2.12 by Mauro Filipe Martins Ferrão
Applications - Show Owner column xibosignage/xibo#1008
85
                { "data": "owner" },
410 by Dan Garner
Continue building core pages
86
                {
87
                    "orderable": false,
88
                    "data": dataTableButtonsColumn
89
                }
90
            ]
91
        });
92
93
        table.on('draw', dataTableDraw);
94
        table.on('processing.dt', dataTableProcessing);
548 by Dan Garner
1.8.0-rc2 bug fixes and small enchancements (#228)
95
        
96
        function copyFromSecretInput() {
97
            // Initialize the tooltip.
98
            $('#copy-button').tooltip();
99
552.1.2 by Mauro Filipe Martins Ferrão
Need a "copy" button to put application secret on the clipboard - Fix for Google Chrome xibosignage/xibo#939
100
101
548 by Dan Garner
1.8.0-rc2 bug fixes and small enchancements (#228)
102
            $('#copy-button').bind('click', function() {
103
                
552.1.2 by Mauro Filipe Martins Ferrão
Need a "copy" button to put application secret on the clipboard - Fix for Google Chrome xibosignage/xibo#939
104
              var input = $('#clientSecret');
548 by Dan Garner
1.8.0-rc2 bug fixes and small enchancements (#228)
105
              
106
              // Select the input to copy 
552.1.2 by Mauro Filipe Martins Ferrão
Need a "copy" button to put application secret on the clipboard - Fix for Google Chrome xibosignage/xibo#939
107
              input.focus();
108
              input.select();
548 by Dan Garner
1.8.0-rc2 bug fixes and small enchancements (#228)
109
              
110
              // Try to copy to clipboard and give feedback
111
              try {
112
                var success = document.execCommand('copy');
113
                if (success) {
114
                  $('#copy-button').trigger('copied', ['Copied!']);
115
                } else {
116
                  $('#copy-button').trigger('copied', ['Could not copy']);
117
                }
118
              } catch (err) {
119
                $('#copy-button').trigger('copied', ['Could not copy']);
120
              }
121
              
122
              // Unselect the input
552.1.2 by Mauro Filipe Martins Ferrão
Need a "copy" button to put application secret on the clipboard - Fix for Google Chrome xibosignage/xibo#939
123
              input.blur();
548 by Dan Garner
1.8.0-rc2 bug fixes and small enchancements (#228)
124
            });
125
126
            // Handler for updating the tooltip message.
127
            $('#copy-button').bind('copied', function(event, message) {
128
              $(this).attr('title', message)
129
                  .tooltip('fixTitle')
130
                  .tooltip('show')
131
                  .attr('title', "Copy to Clipboard")
132
                  .tooltip('fixTitle');
133
            });
134
            
135
        }
410 by Dan Garner
Continue building core pages
136
    </script>
137
{% endblock %}