add main.js

pull/2818/head
Alex Aragón 6 years ago
parent bc244822f2
commit f35ef3a9a6
  1. 6
      assets/js/app.js
  2. 60
      assets/js/main.js
  3. 21
      main/template/default/create_course/add_course.html.twig
  4. 147
      src/ThemeBundle/Resources/views/Layout/header.html.twig

@ -4,19 +4,19 @@ import Routing from '../../vendor/friendsofsymfony/jsrouting-bundle/Resources/pu
Routing.setRoutingData(routes);
require('./main');
require('./vendor');
// @todo rework url naming
var homePublicUrl = Routing.generate('home') + 'public/';
var legacyIndex = Routing.generate('legacy_index');
var mainUrl = Routing.generate('web.main');
var webAjax = Routing.generate('web.ajax');
console.log(homePublicUrl);
/*console.log(homePublicUrl);
console.log(legacyIndex);
console.log(mainUrl);
console.log(webAjax);
console.log(webAjax);*/
var ajax_url = webAjax + 'chat.ajax.php';

@ -0,0 +1,60 @@
console.log("Hello");
// HEADER
$(window).resize(function(){
var widthScreen = $(window).width();
if(widthScreen >= 1400){
$('body').addClass('sidebar-lg-show');
} else {
$('body').removeClass('sidebar-lg-show');
}
var main = $('#app-main');
var cardMain = $('#card-container');
var highAverage = main.height() - cardMain.height()-100;
cardMain.css("height", highAverage+cardMain.height()+"px");
if(cardMain.height()>850){
cardMain.css("height", "auto");
}
});
$(function () {
//Width calculation for Sidebar
var widthScreen = $(window).width();
if(widthScreen >= 1400){
$('body').addClass('sidebar-lg-show');
}
// Calculation of Width for Card Container
var main = $('#app-main');
var cardMain = $('#card-container');
var highAverage = main.height() - cardMain.height()-100;
//cardMain.css("height", highAverage+cardMain.height()+"px");
cardMain.css("height", highAverage+cardMain.height()+"px");
if(cardMain.height()>850 || widthScreen <= 600){
cardMain.css("height", "auto");
}
var $inputTitle = $("#add_course_title");
$inputTitle.keyup(function () {
var value = $(this).val();
var titleDefault = "Course Title";
if (value.length > 0) {
$("#title_course_card").text(value);
} else {
$("#title_course_card").text(titleDefault);
}
}).keyup();
$("select[name=category_code]").change(function () {
$(".category").show();
var $category = $('select[name=category_code] option:selected').html();
$(".category").text($category);
});
});

@ -1,25 +1,4 @@
{% autoescape false %}
<script type="text/javascript">
$(function () {
var $inputTitle = $("#add_course_title");
$inputTitle.keyup(function () {
var value = $(this).val();
var titleDefault = "{{ "Course Title"|trans }}";
if (value.length > 0) {
$("#title_course_card").text(value);
} else {
$("#title_course_card").text(titleDefault);
}
}).keyup();
$("select[name=category_code]").change(function () {
$(".category").show();
var $category = $('select[name=category_code] option:selected').html();
$(".category").text($category);
});
});
</script>
{% set name %}
{{ app.user.firstname }} {{ app.user.lastname }}
{% endset %}

@ -1,106 +1,71 @@
{% autoescape false %}
<script type="text/javascript">
$(window).resize(function(){
var widthScreen = $(window).width();
if(widthScreen >= 1400){
$('body').addClass('sidebar-lg-show');
} else {
$('body').removeClass('sidebar-lg-show');
}
var main = $('#app-main');
var cardMain = $('#card-container');
var highAverage = main.height() - cardMain.height()-100;
cardMain.css("height", highAverage+cardMain.height()+"px");
if(cardMain.height()>850){
cardMain.css("height", "auto");
}
});
$(document).ready(function() {
//Width calculation for Sidebar
var widthScreen = $(window).width();
if(widthScreen >= 1400){
$('body').addClass('sidebar-lg-show');
}
// Calculation of Width for Card Container
var main = $('#app-main');
var cardMain = $('#card-container');
var highAverage = main.height() - cardMain.height()-100;
//cardMain.css("height", highAverage+cardMain.height()+"px");
cardMain.css("height", highAverage+cardMain.height()+"px");
if(cardMain.height()>850 || widthScreen <= 600){
cardMain.css("height", "auto");
<script type="text/javascript">
$(function () {
/**
* Notifications Systems
*/
$.get(
'{{ url('legacy_main', { name : 'inc/ajax/message.ajax.php'}) }}',
{'a': 'get_count_message'},
function (data) {
var countFriends = data.ms_friends;
var countInbox = data.ms_inbox
if (countFriends != 0) {
$("#notifications-social").removeClass('d-none');
$("#notifications-social").append(countFriends);
}
if (countInbox != 0) {
$("#notifications-inbox").removeClass('d-none');
$("#notifications-inbox").append(countInbox);
}
}
);
/**
* Notifications Systems
*/
$('#list_notifications_friends').on('click', e => {
const $listFriends = $('#list_friends .content');
let $html;
$.get(
'{{ url('legacy_main', { name : 'inc/ajax/message.ajax.php'}) }}',
{'a': 'get_count_message'},
{'a': 'get_notifications_friends'},
function (data) {
var countFriends = data.ms_friends;
var countInbox = data.ms_inbox
if (countFriends != 0) {
$("#notifications-social").removeClass('d-none');
$("#notifications-social").append(countFriends);
}
if(countInbox != 0){
$("#notifications-inbox").removeClass('d-none');
$("#notifications-inbox").append(countInbox);
$listFriends.empty();
for (let i in data) {
$html = '<a class="dropdown-item preview-item">';
$html += '<div class="preview-thumbnail"><img class="rounded-circle" src="' + data[i].avatar + '"/></div>';
$html += '<div class="preview-item-content flex-grow">';
$html += '<h6 class="preview-subject">' + data[i].fullname + '<span class="date-ago float-right">' + data[i].date + '</span></h6>';
$html += '<p class="preview-text">' + data[i].content + '</p>';
$html += '</div></a>';
$listFriends.append($html);
}
}
);
});
$('#list_notifications_friends').on('click', e => {
const $listFriends = $('#list_friends .content');
let $html;
$.get(
'{{ url('legacy_main', { name : 'inc/ajax/message.ajax.php'}) }}',
{'a': 'get_notifications_friends'},
function (data) {
$listFriends.empty();
for (let i in data){
$html = '<a class="dropdown-item preview-item">';
$html += '<div class="preview-thumbnail"><img class="rounded-circle" src="'+data[i].avatar+'"/></div>';
$html += '<div class="preview-item-content flex-grow">';
$html += '<h6 class="preview-subject">' + data[i].fullname + '<span class="date-ago float-right">'+data[i].date+'</span></h6>';
$html += '<p class="preview-text">' + data[i].content + '</p>';
$html += '</div></a>';
$listFriends.append($html);
}
}
);
});
$('#list_notifications_inbox').on('click', e => {
const $listInbox = $('#list_inbox .content');
let $html;
$.get(
'{{ url('legacy_main', { name : 'inc/ajax/message.ajax.php'}) }}',
{'a': 'get_notifications_inbox'},
function (data) {
$listInbox.empty();
for (let i in data){
$html = '<a class="dropdown-item preview-item" href="'+data[i].url+'">';
$html += '<div class="preview-thumbnail"><div class="preview-icon bg-info">';
$html += '<i class="far fa-envelope"></i>';
$html += '</div></div>';
$html += '<div class="preview-item-content flex-grow">';
$html += '<h6 class="preview-subject">' + data[i].fullname + '<span class="date-ago float-right">'+data[i].date+'</span></h6>';
$html += '<p class="preview-text">' + data[i].title + '</p>';
$html += '</div></a>';
$listInbox.append($html);
}
$('#list_notifications_inbox').on('click', e => {
const $listInbox = $('#list_inbox .content');
let $html;
$.get(
'{{ url('legacy_main', { name : 'inc/ajax/message.ajax.php'}) }}',
{'a': 'get_notifications_inbox'},
function (data) {
$listInbox.empty();
for (let i in data) {
$html = '<a class="dropdown-item preview-item" href="' + data[i].url + '">';
$html += '<div class="preview-thumbnail"><div class="preview-icon bg-info">';
$html += '<i class="far fa-envelope"></i>';
$html += '</div></div>';
$html += '<div class="preview-item-content flex-grow">';
$html += '<h6 class="preview-subject">' + data[i].fullname + '<span class="date-ago float-right">' + data[i].date + '</span></h6>';
$html += '<p class="preview-text">' + data[i].title + '</p>';
$html += '</div></a>';
$listInbox.append($html);
}
);
});
}
);
});
</script>
});
</script>
<header class="app-header navbar">
<button class="navbar-toggler sidebar-toggler d-lg-none mr-auto" type="button" data-toggle="sidebar-show">
<span class="navbar-toggler-icon"></span>

Loading…
Cancel
Save