Commit 10aca2929976a3ea35b2ef8a877756ef72c9d3da
1 parent
1059172a
Exists in
master
and in
2 other branches
finished pagination of table and added table header, still missing translation and styling to do
Showing
7 changed files
with
82 additions
and
12 deletions
Show diff stats
dashboards/static/dashboards/.sass-cache/d1f4112ca6d0e14bdf64d22b0b14a2322f24cc83/general.sassc
No preview for this file type
dashboards/static/dashboards/css/general.css
... | ... | @@ -137,14 +137,33 @@ li.selected { |
137 | 137 | #period-selector { |
138 | 138 | display: flex; } |
139 | 139 | |
140 | -#log-table tr { | |
141 | - height: 25px; } | |
142 | - #log-table tr:nth-child(odd) { | |
143 | - background-color: #bdbdbd; } | |
144 | - #log-table tr:nth-child(even) { | |
145 | - background-color: white; } | |
146 | - #log-table tr td { | |
147 | - margin-right: 1%; | |
148 | - padding-right: 1%; } | |
140 | +#log-table { | |
141 | + width: 100%; | |
142 | + border: 1px solid #bdbdbd; } | |
143 | + #log-table tr { | |
144 | + height: 25px; } | |
145 | + #log-table tr:nth-child(odd) { | |
146 | + background-color: #bdbdbd; } | |
147 | + #log-table tr:nth-child(even) { | |
148 | + background-color: white; } | |
149 | + #log-table tr td { | |
150 | + margin-right: 1%; | |
151 | + padding-right: 1%; } | |
152 | + | |
153 | +#log-count { | |
154 | + text-align: center; } | |
155 | + | |
156 | +.pagination { | |
157 | + display: inline-block; } | |
158 | + .pagination a { | |
159 | + color: black; | |
160 | + float: left; | |
161 | + padding: 8px 16px; | |
162 | + text-decoration: none; } | |
163 | + .pagination a.active { | |
164 | + background-color: #4CAF50; | |
165 | + color: white; } | |
166 | + .pagination a:hover:not(.active) { | |
167 | + background-color: #ddd; } | |
149 | 168 | |
150 | 169 | /*# sourceMappingURL=general.css.map */ | ... | ... |
dashboards/static/dashboards/css/general.css.map
1 | 1 | { |
2 | 2 | "version": 3, |
3 | -"mappings": "AAEA,YAAY;EACR,MAAM,EAAE,iBAAiB;EACzB,aAAa,EAAE,IAAI;EACnB,OAAO,EAAE,IAAI;EACb,QAAQ,EAAE,I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ACtB,YAAY,EAAE,IAAI;EAClB,WAAW,EAAE,IAAI;EACjB,YAAY,EAAE,sBAAsB;EACpC,mBAAmB,EAAE,OAAO;;AAEhC,yBAAyB;EACrB,gBAAgB,EAAE,OAAO;;AAG7B,mBAAmB;EACf,UAAU,EAAE,MAAM;EAClB,KAAK,EAAE,OAAO;;AAElB,aAAa;EACT,KAAK,EAAE,IAAI;EACX,MAAM,EAAE,IAAI;EACZ,UAAU,EAAE,OAAO;EACnB,KAAK,EAAE,KAAK;EACZ,UAAU,EAAE,MAAM;;AAKtB,gBAAgB;EACZ,OAAO,EAAE,IAAI;;AAIjB,UAAU;EACN,KAAK,EAAE,IAAI;EACX,MAAM,EAAE,iBAAiB;EACzB,aAAE;IACE,MAAM,EAAE,IAAI;IACZ,4BAAgB;MACZ,gBAAgB,EAAE,OAAO;IAC7B,6BAAiB;MACb,gBAAgB,EAAE,KAAK;IAE3B,gBAAE;MACE,YAAY,EAAE,EAAE;MAChB,aAAa,EAAE,EAAE;;AAE7B,UAAU;EACN,UAAU,EAAE,MAAM;;AAEtB,WAAW;EACP,OAAO,EAAE,YAAY;EACrB,aAAC;IACG,KAAK,EAAE,KAAK;IACZ,KAAK,EAAE,IAAI;IACX,OAAO,EAAE,QAAQ;IACjB,eAAe,EAAE,IAAI;EAEzB,oBAAQ;IACJ,gBAAgB,EAAE,OAAO;IACzB,KAAK,EAAE,KAAK;EAEhB,gCAAoB;IAChB,gBAAgB,EAAE,IAAI", | |
4 | 4 | "sources": ["general.sass"], |
5 | 5 | "names": [], |
6 | 6 | "file": "general.css" | ... | ... |
dashboards/static/dashboards/css/general.sass
... | ... | @@ -162,6 +162,8 @@ li.selected |
162 | 162 | $colors: gray, white |
163 | 163 | |
164 | 164 | #log-table |
165 | + width: 100% | |
166 | + border: 1px solid #bdbdbd | |
165 | 167 | tr |
166 | 168 | height: 25px |
167 | 169 | &:nth-child(odd) |
... | ... | @@ -172,3 +174,21 @@ $colors: gray, white |
172 | 174 | td |
173 | 175 | margin-right: 1% |
174 | 176 | padding-right: 1% |
177 | + | |
178 | +#log-count | |
179 | + text-align: center | |
180 | + | |
181 | +.pagination | |
182 | + display: inline-block | |
183 | + a | |
184 | + color: black | |
185 | + float: left | |
186 | + padding: 8px 16px | |
187 | + text-decoration: none | |
188 | + | |
189 | + a.active | |
190 | + background-color: #4CAF50 | |
191 | + color: white | |
192 | + | |
193 | + a:hover:not(.active) | |
194 | + background-color: #ddd | ... | ... |
dashboards/static/dashboards/js/jquery.table.hpaging.min.js
0 → 100644
... | ... | @@ -0,0 +1,21 @@ |
1 | +(function (b) { | |
2 | + b(function () { | |
3 | + b.widget("blk.hpaging", { | |
4 | + options: { limit: 5, activePage: 1, parentID: "", navBar: null, totalPages: "" }, _create: function () { var a = this._getNavBar(); b(this.element).after(a) }, _getNavBar: function () { var a; a = b(this.element).prop("id"); this.options.parentID = a; a = b("<div id=pg_" + a + ">").addClass("pagination").data("parentID", a); this.options.navBar = a; this.setPages(this.options.activePage); return a }, clearPages: function () { | |
5 | + b(this.options.navBar).empty(); b("#" + this.options.parentID + " > tbody > tr").show(); | |
6 | + b("#" + this.options.parentID + " > tbody > tr").removeData("page"); return !0 | |
7 | + }, newRow: function (a) { this.setPages(); var c = b("#" + this.options.parentID + " > tbody > tr"); a = b(c).eq(a).data("page"); this.activePage(a) }, newLimit: function (a) { this.options.limit = a; this.setPages() && this.activePage(1) }, setPages: function (a) { | |
8 | + var c = !1; if (this.clearPages()) { | |
9 | + var c = this.options.limit, h = b("#" + this.options.parentID + " > tbody > tr"), f, d = h.length / c; f = d; d = d.toString().split("."); 2 == d.length && (f = parseInt(d[0]) + 1); 0 == f && (f = 1); d = | |
10 | + this.options.parentID; this._setPage(d, 1, "<<"); this._setPage(d, "P-1", "<"); for (var g = 0, k = c, e, l = 1; l <= f; l++)g = h.slice(g, k), e = l, b(g).removeData("page"), b(g).data("page", e), this._setPage(d, e, e), g = k, k = parseInt(k) + parseInt(c); this._setPage(d, "P+1", ">"); this._setPage(d, e, ">>"); this.options.totalPages = e; void 0 !== a && this.activePage(a); c = !0 | |
11 | + } return c | |
12 | + }, _setPage: function (a, c, h) { a = b("<a>", { href: "#", text: h, "data-page": c }).appendTo(this.options.navBar); this._on(a, { click: "onPageClick" }) }, activePage: function (a) { | |
13 | + var c = | |
14 | + 1 * a; this.options.activePage = c; b("#" + this.options.parentID + " > tbody > tr").each(function () { b(this).data("page") == c ? b(this).show() : b(this).hide() }); this._selectActivePage() | |
15 | + }, _selectActivePage: function () { var a = this.options.activePage; b(this.options.navBar).find("a").each(function () { var c = b(this).text(); b(this).data("page") == a && "<<" != c && ">>" != c && (b(this).attr("class", "active"), b(this).siblings().attr("class", "")) }) }, onPageClick: function (a) { | |
16 | + a.preventDefault(); a = b(a.target).data("page"); "P-1" == a ? (a = this.options.activePage - | |
17 | + 1, 1 > a && (a = 1)) : "P+1" == a && (a = this.options.activePage + 1, a > this.options.totalPages && (a = this.options.totalPages)); this.activePage(a) | |
18 | + } | |
19 | + }) | |
20 | + }) | |
21 | +})(jQuery); | |
0 | 22 | \ No newline at end of file | ... | ... |
dashboards/static/dashboards/js/logbehavior.js
... | ... | @@ -29,13 +29,18 @@ var log = { |
29 | 29 | render_table: function(target_id, data){ |
30 | 30 | table_body = $('#' + target_id); |
31 | 31 | |
32 | + | |
33 | + | |
32 | 34 | content = "<table id='log-table'>"; |
33 | 35 | |
34 | 36 | //add register count |
35 | 37 | count = data.length; |
36 | 38 | |
39 | + $(table_body).append( "<h3 id='log-count'>"+count + " registros" + "</h3>"); | |
40 | + | |
37 | 41 | //load row names at the top |
38 | - | |
42 | + content += "<th> Datetime </th> <th> Usuário </th> <th> Components </th> <th> Recurso </th><th> Ação </th>" | |
43 | + + "<th> Categoria </th> <th> Assunto </th> <th> Contexto </th>" | |
39 | 44 | //build row html data |
40 | 45 | data.forEach(function(datum){ |
41 | 46 | content += "<tr>" + html_helper.row_builder(datum) + "</tr>"; |
... | ... | @@ -44,6 +49,11 @@ var log = { |
44 | 49 | content += "</table>"; |
45 | 50 | |
46 | 51 | $(table_body).append(content); |
52 | + | |
53 | + $('#log-table').hpaging({ | |
54 | + "limit": 20, //maximum number of elements per page | |
55 | + }); | |
56 | + | |
47 | 57 | }, |
48 | 58 | } |
49 | 59 | ... | ... |
dashboards/views.py
... | ... | @@ -110,7 +110,7 @@ class LogView(LogMixin, generic.TemplateView): |
110 | 110 | context = {} |
111 | 111 | self.createLog(actor = self.request.user) |
112 | 112 | |
113 | - context['javascript_files'] = ['dashboards/js/logbehavior.js'] | |
113 | + context['javascript_files'] = ['dashboards/js/logbehavior.js', "dashboards/js/jquery.table.hpaging.min.js"] | |
114 | 114 | context['child_template'] = "dashboards/log.html" |
115 | 115 | return context |
116 | 116 | ... | ... |