Last active
March 28, 2017 21:56
-
-
Save abdullahseba/d97d2e6ec6c7750af8ed6f1b27ba14a0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% extends "layouts/dashboard.html.twig" %} | |
{% block body_matter %} | |
<table> | |
<thead> | |
<th>Name</th> | |
<th>Job Title</th> | |
<th>Twitter</th> | |
</thead> | |
<tbody id="test"> | |
</tbody> | |
</table> | |
{% endblock %} | |
{% block scripts_page%} | |
<script id="some-template" type="text/x-handlebars-template"> | |
{% verbatim %} | |
{{#Result}} | |
<tr> | |
<td>{{fullName person}}</td> | |
</tr> | |
{{/Result}} | |
{% endverbatim %} | |
</script> | |
{#<script> | |
var source = $("#some-template").html(); | |
var template = Handlebars.compile(source); | |
var data = { | |
Result: [ { | |
person: { | |
firstName: "Garry", | |
lastName: "Finch" | |
}, | |
jobTitle: "Front End Technical Lead", | |
twitter: "gazraa" | |
}, { | |
person: { | |
firstName: "Garry", | |
lastName: "Finch" | |
}, | |
jobTitle: "Photographer", | |
twitter: "photobasics" | |
}, { | |
person: { | |
firstName: "Garry", | |
lastName: "Finch" | |
}, | |
jobTitle: "LEGO Geek", | |
twitter: "minifigures" | |
} ] | |
}; | |
Handlebars.registerHelper('fullName', function(person) { | |
return person.firstName + " " + person.lastName; | |
}); | |
$('#test').append(template(data)); | |
</script>#} | |
<script> | |
$.ajax({ | |
type: "POST", | |
url: "http://192.168.1.146/webmail/?/Ajax/", | |
data: "Action=SystemLogin&Email=abdullahseba%40gmail.com&IncLogin=&IncPassword=abdullahseba123&SignMe=1&AccountID=0&Token=4ca3435dc07bfdcf3c82919ed270b872", | |
crossDomain: true, | |
dataType: "json" | |
}) | |
.done(function( data ) { | |
console.log(data.Result.AuthToken); | |
}); | |
$.ajax({ | |
type: "POST", | |
url: "http://192.168.1.146/webmail/?/Ajax/", | |
data: "Action=MessagesGetList&Folder=INBOX&Offset=0&Limit=1&Search=&Filters=&UseThreads=1&AccountID=1&Token=4ca3435dc07bfdcf3c82919ed270b872", | |
crossDomain: true, | |
dataType: "json" | |
}) .done(function( data ) { | |
var source = $("#some-template").html(); | |
var template = Handlebars.compile(source); | |
Handlebars.registerHelper('fullName', function(person) { | |
return ["@Collection"]["0"].Subject ; | |
}); | |
$('#test').append(template(data)); | |
console.log(data); | |
}); | |
</script> | |
{#{<script> | |
var data = '{"name": "mkyong","age": 30,"address": {"streetAddress": "88 8nd Street","city": "New York"},"phoneNumber": [{"type": "home","number": "111 111-1111"},{"type": "fax","number": "222 222-2222"}]}'; | |
var json = JSON.parse(data); | |
alert(json["name"]); //mkyong | |
alert(json.name); //mkyong | |
alert(json.address.streetAddress); //88 8nd Street | |
alert(json["address"].city); //New York | |
alert(json.phoneNumber[0].number); //111 111-1111 | |
alert(json.phoneNumber[1].type); //fax | |
alert(json.phoneNumber.number); //undefined | |
</script>#} | |
{#<script> | |
setTimeout(function(){ | |
}, 5000); | |
</script> | |
<script src="https://almsaeedstudio.com/themes/AdminLTE/plugins/iCheck/icheck.min.js"></script> | |
<script> | |
jQuery(document).ready(function($) { | |
$.ajax({ | |
url: 'http://192.168.1.146/webmail/test.php', | |
type: 'GET', | |
crossDomain: true, | |
dataType: 'html', | |
data : "test=parameter", | |
}).done(function ( data ) { | |
$('#tbody').append(data); | |
$(function () { | |
//Enable iCheck plugin for checkboxes | |
//iCheck for checkbox and radio inputs | |
$('.mailbox-messages input[type="checkbox"]').iCheck({ | |
checkboxClass: 'icheckbox_flat-blue', | |
radioClass: 'iradio_flat-blue' | |
}); | |
//Enable check and uncheck all functionality | |
$(".checkbox-toggle").click(function () { | |
var clicks = $(this).data('clicks'); | |
if (clicks) { | |
//Uncheck all checkboxes | |
$(".mailbox-messages input[type='checkbox']").iCheck("uncheck"); | |
$(".fa", this).removeClass("fa-check-square-o").addClass('fa-square-o'); | |
} else { | |
//Check all checkboxes | |
$(".mailbox-messages input[type='checkbox']").iCheck("check"); | |
$(".fa", this).removeClass("fa-square-o").addClass('fa-check-square-o'); | |
} | |
$(this).data("clicks", !clicks); | |
}); | |
//Handle starring for glyphicon and font awesome | |
$(".mailbox-star").click(function (e) { | |
e.preventDefault(); | |
//detect type | |
var $this = $(this).find("a > i"); | |
var glyph = $this.hasClass("glyphicon"); | |
var fa = $this.hasClass("fa"); | |
//Switch states | |
if (glyph) { | |
$this.toggleClass("glyphicon-star"); | |
$this.toggleClass("glyphicon-star-empty"); | |
} | |
if (fa) { | |
$this.toggleClass("fa-star"); | |
$this.toggleClass("fa-star-o"); | |
} | |
}); | |
}); | |
}); | |
}); | |
</script>#} | |
{% endblock %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment