Showing
4 changed files
with
67 additions
and
69 deletions
1 | -# gentelella | 1 | +# gentelella[https://github.com/puikinsh/gentelella] |
2 | 2 | ||
3 | Gentelella Admin is a free to use Bootstrap admin template. | 3 | Gentelella Admin is a free to use Bootstrap admin template. |
4 | This template uses the default Bootstrap 3 styles along with a variety of powerful jQuery plugins and tools to create a powerful framework for creating admin panels or back-end dashboards. | 4 | This template uses the default Bootstrap 3 styles along with a variety of powerful jQuery plugins and tools to create a powerful framework for creating admin panels or back-end dashboards. |
public/build/js/custom.js
100755 → 100644
1 | /** | 1 | /** |
2 | - * Resize function without multiple trigger | ||
3 | - * | ||
4 | - * Usage: | ||
5 | - * $(window).smartresize(function(){ | ||
6 | - * // code here | ||
7 | - * }); | ||
8 | - */ | ||
9 | -(function($,sr){ | ||
10 | - // debouncing function from John Hann | ||
11 | - // http://unscriptable.com/index.php/2009/03/20/debouncing-javascript-methods/ | ||
12 | - var debounce = function (func, threshold, execAsap) { | ||
13 | - var timeout; | ||
14 | - | ||
15 | - return function debounced () { | ||
16 | - var obj = this, args = arguments; | ||
17 | - function delayed () { | ||
18 | - if (!execAsap) | ||
19 | - func.apply(obj, args); | ||
20 | - timeout = null; | ||
21 | - } | ||
22 | - | ||
23 | - if (timeout) | ||
24 | - clearTimeout(timeout); | ||
25 | - else if (execAsap) | ||
26 | - func.apply(obj, args); | ||
27 | - | ||
28 | - timeout = setTimeout(delayed, threshold || 100); | ||
29 | - }; | ||
30 | - }; | ||
31 | - | ||
32 | - // smartresize | ||
33 | - jQuery.fn[sr] = function(fn){ return fn ? this.bind('resize', debounce(fn)) : this.trigger(sr); }; | ||
34 | - | ||
35 | -})(jQuery,'smartresize'); | ||
36 | -var loginFn = function() { | ||
37 | - $.ajax({ | ||
38 | - method: 'post', | ||
39 | - url: '/admin/api/login', | ||
40 | - data: { | ||
41 | - userName: 'admin', | ||
42 | - password: '123456' | ||
43 | - } | ||
44 | - }) | ||
45 | - .then(function(result) { | ||
46 | - if (result.code !== 200) { | ||
47 | - location.href = '/admin/login'; | ||
48 | - } | ||
49 | - | ||
50 | - location.href = '/admin'; | ||
51 | - }); | ||
52 | -}; | ||
53 | - | ||
54 | -var logoutFn = function() { | ||
55 | - $.ajax({ | ||
56 | - method: 'post', | ||
57 | - url: '/admin/api/logout' | ||
58 | - }) | ||
59 | - .then(function() { | ||
60 | - location.href = '/admin/login'; | ||
61 | - }); | ||
62 | -}; | ||
63 | - | ||
64 | -$('.login-btn').on('click', loginFn); | ||
65 | -$('.logout-btn').on('click', logoutFn); | ||
66 | - | ||
67 | - | ||
68 | -/** | ||
69 | * To change this license header, choose License Headers in Project Properties. | 2 | * To change this license header, choose License Headers in Project Properties. |
70 | * To change this template file, choose Tools | Templates | 3 | * To change this template file, choose Tools | Templates |
71 | * and open the template in the editor. | 4 | * and open the template in the editor. |
@@ -313,3 +246,36 @@ if (typeof NProgress != 'undefined') { | @@ -313,3 +246,36 @@ if (typeof NProgress != 'undefined') { | ||
313 | NProgress.done(); | 246 | NProgress.done(); |
314 | }); | 247 | }); |
315 | } | 248 | } |
249 | + | ||
250 | +var loginFn = function() { | ||
251 | + $.ajax({ | ||
252 | + method: 'post', | ||
253 | + url: '/admin/api/login', | ||
254 | + data: { | ||
255 | + userName: 'admin', | ||
256 | + password: '123456' | ||
257 | + } | ||
258 | + }) | ||
259 | + .then(function(result) { | ||
260 | + if (result.code !== 200) { | ||
261 | + location.href = '/admin/login'; | ||
262 | + } | ||
263 | + | ||
264 | + location.href = '/admin'; | ||
265 | + }); | ||
266 | +}; | ||
267 | + | ||
268 | +var logoutFn = function() { | ||
269 | + $.ajax({ | ||
270 | + method: 'post', | ||
271 | + url: '/admin/logout' | ||
272 | + }) | ||
273 | + .then(function() { | ||
274 | + location.href = '/admin/login'; | ||
275 | + }); | ||
276 | +}; | ||
277 | + | ||
278 | + | ||
279 | +$('.login-btn').on('click', loginFn); | ||
280 | +$('.logout-btn').on('click', logoutFn); | ||
281 | + |
public/build/js/custom.min.js
100755 → 100644
1 | -function countChecked(){"all"===checkState&&$(".bulk_action input[name='table_records']").iCheck("check"),"none"===checkState&&$(".bulk_action input[name='table_records']").iCheck("uncheck");var e=$(".bulk_action input[name='table_records']:checked").length;e?($(".column-title").hide(),$(".bulk-actions").show(),$(".action-cnt").html(e+" Records Selected")):($(".column-title").show(),$(".bulk-actions").hide())}!function(e,t){var n=function(e,t,n){var i;return function(){function a(){n||e.apply(o,c),i=null}var o=this,c=arguments;i?clearTimeout(i):n&&e.apply(o,c),i=setTimeout(a,t||100)}};jQuery.fn[t]=function(e){return e?this.bind("resize",n(e)):this.trigger(t)}}(jQuery,"smartresize");var loginFn=function(){$.ajax({method:"post",url:"/admin/api/login",data:{userName:"admin",password:"123456"}}).then(function(e){200!==e.code&&(location.href="/admin/login"),location.href="/admin"})},logoutFn=function(){$.ajax({method:"post",url:"/admin/api/logout"}).then(function(){location.href="/admin/login"})};$(".login-btn").on("click",loginFn),$(".logout-btn").on("click",logoutFn);var CURRENT_URL=window.location.href.split("#")[0].split("?")[0],$BODY=$("body"),$MENU_TOGGLE=$("#menu_toggle"),$SIDEBAR_MENU=$("#sidebar-menu"),$SIDEBAR_FOOTER=$(".sidebar-footer"),$LEFT_COL=$(".left_col"),$RIGHT_COL=$(".right_col"),$NAV_MENU=$(".nav_menu"),$FOOTER=$("footer");$(document).ready(function(){var e=function(){$RIGHT_COL.css("min-height",$(window).height());var e=$BODY.outerHeight(),t=$BODY.hasClass("footer_fixed")?-10:$FOOTER.height(),n=$LEFT_COL.eq(1).height()+$SIDEBAR_FOOTER.height(),i=e<n?n:e;i-=$NAV_MENU.height()+t,$RIGHT_COL.css("min-height",i)};$SIDEBAR_MENU.find("a").on("click",function(t){var n=$(this).parent();n.is(".active")?(n.removeClass("active active-sm"),$("ul:first",n).slideUp(function(){e()})):(n.parent().is(".child_menu")||($SIDEBAR_MENU.find("li").removeClass("active active-sm"),$SIDEBAR_MENU.find("li ul").slideUp()),n.addClass("active"),$("ul:first",n).slideDown(function(){e()}))}),$MENU_TOGGLE.on("click",function(){$BODY.hasClass("nav-md")?($SIDEBAR_MENU.find("li.active ul").hide(),$SIDEBAR_MENU.find("li.active").addClass("active-sm").removeClass("active")):($SIDEBAR_MENU.find("li.active-sm ul").show(),$SIDEBAR_MENU.find("li.active-sm").addClass("active").removeClass("active-sm")),$BODY.toggleClass("nav-md nav-sm"),e(),$(".dataTable").each(function(){$(this).dataTable().fnDraw()})}),$SIDEBAR_MENU.find('a[href="'+CURRENT_URL+'"]').parent("li").addClass("current-page"),$SIDEBAR_MENU.find("a").filter(function(){return this.href==CURRENT_URL}).parent("li").addClass("current-page").parents("ul").slideDown(function(){e()}).parent().addClass("active"),$(window).smartresize(function(){e()}),e(),$.fn.mCustomScrollbar&&$(".menu_fixed").mCustomScrollbar({autoHideScrollbar:!0,theme:"minimal",mouseWheel:{preventDefault:!0}})}),$(document).ready(function(){$(".collapse-link").on("click",function(){var e=$(this).closest(".x_panel"),t=$(this).find("i"),n=e.find(".x_content");e.attr("style")?n.slideToggle(200,function(){e.removeAttr("style")}):(n.slideToggle(200),e.css("height","auto")),t.toggleClass("fa-chevron-up fa-chevron-down")}),$(".close-link").click(function(){var e=$(this).closest(".x_panel");e.remove()})}),$(document).ready(function(){$('[data-toggle="tooltip"]').tooltip({container:"body"})}),$(document).ready(function(){$(".progress .progress-bar")[0]&&$(".progress .progress-bar").progressbar()}),$(document).ready(function(){if($(".js-switch")[0]){var e=Array.prototype.slice.call(document.querySelectorAll(".js-switch"));e.forEach(function(e){new Switchery(e,{color:"#26B99A"})})}}),$(document).ready(function(){$("input.flat")[0]&&$(document).ready(function(){$("input.flat").iCheck({checkboxClass:"icheckbox_flat-green",radioClass:"iradio_flat-green"})})}),$("table input").on("ifChecked",function(){checkState="",$(this).parent().parent().parent().addClass("selected"),countChecked()}),$("table input").on("ifUnchecked",function(){checkState="",$(this).parent().parent().parent().removeClass("selected"),countChecked()});var checkState="";$(".bulk_action input").on("ifChecked",function(){checkState="",$(this).parent().parent().parent().addClass("selected"),countChecked()}),$(".bulk_action input").on("ifUnchecked",function(){checkState="",$(this).parent().parent().parent().removeClass("selected"),countChecked()}),$(".bulk_action input#check-all").on("ifChecked",function(){checkState="all",countChecked()}),$(".bulk_action input#check-all").on("ifUnchecked",function(){checkState="none",countChecked()}),$(document).ready(function(){$(".expand").on("click",function(){$(this).next().slideToggle(200),$expand=$(this).find(">:first-child"),"+"==$expand.text()?$expand.text("-"):$expand.text("+")})}),"undefined"!=typeof NProgress&&($(document).ready(function(){NProgress.start()}),$(window).on("load",function(){NProgress.done()})); | ||
1 | +function countChecked(){"all"===checkState&&$(".bulk_action input[name='table_records']").iCheck("check"),"none"===checkState&&$(".bulk_action input[name='table_records']").iCheck("uncheck");var e=$(".bulk_action input[name='table_records']:checked").length;e?($(".column-title").hide(),$(".bulk-actions").show(),$(".action-cnt").html(e+" Records Selected")):($(".column-title").show(),$(".bulk-actions").hide())}var CURRENT_URL=window.location.href.split("#")[0].split("?")[0],$BODY=$("body"),$MENU_TOGGLE=$("#menu_toggle"),$SIDEBAR_MENU=$("#sidebar-menu"),$SIDEBAR_FOOTER=$(".sidebar-footer"),$LEFT_COL=$(".left_col"),$RIGHT_COL=$(".right_col"),$NAV_MENU=$(".nav_menu"),$FOOTER=$("footer");$(document).ready(function(){var e=function(){$RIGHT_COL.css("min-height",$(window).height());var e=$BODY.outerHeight(),t=$BODY.hasClass("footer_fixed")?-10:$FOOTER.height(),n=$LEFT_COL.eq(1).height()+$SIDEBAR_FOOTER.height(),i=e<n?n:e;i-=$NAV_MENU.height()+t,$RIGHT_COL.css("min-height",i)};$SIDEBAR_MENU.find("a").on("click",function(t){var n=$(this).parent();n.is(".active")?(n.removeClass("active active-sm"),$("ul:first",n).slideUp(function(){e()})):(n.parent().is(".child_menu")||($SIDEBAR_MENU.find("li").removeClass("active active-sm"),$SIDEBAR_MENU.find("li ul").slideUp()),n.addClass("active"),$("ul:first",n).slideDown(function(){e()}))}),$MENU_TOGGLE.on("click",function(){$BODY.hasClass("nav-md")?($SIDEBAR_MENU.find("li.active ul").hide(),$SIDEBAR_MENU.find("li.active").addClass("active-sm").removeClass("active")):($SIDEBAR_MENU.find("li.active-sm ul").show(),$SIDEBAR_MENU.find("li.active-sm").addClass("active").removeClass("active-sm")),$BODY.toggleClass("nav-md nav-sm"),e(),$(".dataTable").each(function(){$(this).dataTable().fnDraw()})}),$SIDEBAR_MENU.find('a[href="'+CURRENT_URL+'"]').parent("li").addClass("current-page"),$SIDEBAR_MENU.find("a").filter(function(){return this.href==CURRENT_URL}).parent("li").addClass("current-page").parents("ul").slideDown(function(){e()}).parent().addClass("active"),$(window).smartresize(function(){e()}),e(),$.fn.mCustomScrollbar&&$(".menu_fixed").mCustomScrollbar({autoHideScrollbar:!0,theme:"minimal",mouseWheel:{preventDefault:!0}})}),$(document).ready(function(){$(".collapse-link").on("click",function(){var e=$(this).closest(".x_panel"),t=$(this).find("i"),n=e.find(".x_content");e.attr("style")?n.slideToggle(200,function(){e.removeAttr("style")}):(n.slideToggle(200),e.css("height","auto")),t.toggleClass("fa-chevron-up fa-chevron-down")}),$(".close-link").click(function(){var e=$(this).closest(".x_panel");e.remove()})}),$(document).ready(function(){$('[data-toggle="tooltip"]').tooltip({container:"body"})}),$(document).ready(function(){$(".progress .progress-bar")[0]&&$(".progress .progress-bar").progressbar()}),$(document).ready(function(){if($(".js-switch")[0]){var e=Array.prototype.slice.call(document.querySelectorAll(".js-switch"));e.forEach(function(e){new Switchery(e,{color:"#26B99A"})})}}),$(document).ready(function(){$("input.flat")[0]&&$(document).ready(function(){$("input.flat").iCheck({checkboxClass:"icheckbox_flat-green",radioClass:"iradio_flat-green"})})}),$("table input").on("ifChecked",function(){checkState="",$(this).parent().parent().parent().addClass("selected"),countChecked()}),$("table input").on("ifUnchecked",function(){checkState="",$(this).parent().parent().parent().removeClass("selected"),countChecked()});var checkState="";$(".bulk_action input").on("ifChecked",function(){checkState="",$(this).parent().parent().parent().addClass("selected"),countChecked()}),$(".bulk_action input").on("ifUnchecked",function(){checkState="",$(this).parent().parent().parent().removeClass("selected"),countChecked()}),$(".bulk_action input#check-all").on("ifChecked",function(){checkState="all",countChecked()}),$(".bulk_action input#check-all").on("ifUnchecked",function(){checkState="none",countChecked()}),$(document).ready(function(){$(".expand").on("click",function(){$(this).next().slideToggle(200),$expand=$(this).find(">:first-child"),"+"==$expand.text()?$expand.text("-"):$expand.text("+")})}),"undefined"!=typeof NProgress&&($(document).ready(function(){NProgress.start()}),$(window).on("load",function(){NProgress.done()}));var loginFn=function(){$.ajax({method:"post",url:"/admin/api/login",data:{userName:"admin",password:"123456"}}).then(function(e){200!==e.code&&(location.href="/admin/login"),location.href="/admin"})},logoutFn=function(){$.ajax({method:"post",url:"/admin/logout"}).then(function(){location.href="/admin/login"})};$(".login-btn").on("click",loginFn),$(".logout-btn").on("click",logoutFn); |
public/src/js/login.js
0 → 100644
1 | +var loginFn = function() { | ||
2 | + $.ajax({ | ||
3 | + method: 'post', | ||
4 | + url: '/admin/api/login', | ||
5 | + data: { | ||
6 | + userName: 'admin', | ||
7 | + password: '123456' | ||
8 | + } | ||
9 | + }) | ||
10 | + .then(function(result) { | ||
11 | + if (result.code !== 200) { | ||
12 | + location.href = '/admin/login'; | ||
13 | + } | ||
14 | + | ||
15 | + location.href = '/admin'; | ||
16 | + }); | ||
17 | +}; | ||
18 | + | ||
19 | +var logoutFn = function() { | ||
20 | + $.ajax({ | ||
21 | + method: 'post', | ||
22 | + url: '/admin/logout' | ||
23 | + }) | ||
24 | + .then(function() { | ||
25 | + location.href = '/admin/login'; | ||
26 | + }); | ||
27 | +}; | ||
28 | + | ||
29 | + | ||
30 | +$('.login-btn').on('click', loginFn); | ||
31 | +$('.logout-btn').on('click', logoutFn); | ||
32 | + |
-
Please register or login to post a comment