Commit 352e2b64 authored by Clément Damiens's avatar Clément Damiens
Browse files

Merged branch development into development

parents b2d09cc6 53edd7d7
......@@ -14,21 +14,74 @@ $(document).ready(function() {
selectProject();
selectProjectChildren();
selectProjectStart()
toggleDesription();
toggleDescription();
initDescs();
loadMyStream(type, idElt);
//isContributor();
//loadMyStream(type, idElt);
calendar.init("#profil-content-calendar");
$("#profil-content-calendar").fullCalendar('destroy');
calendar.showCalendar("#profil-content-calendar", events, "month");
$("#profil-content-calendar").fullCalendar("gotoDate", moment(Date.now()));
$(window).on('resize', function(){
$("#profil-content-calendar").fullCalendar('destroy');
calendar.showCalendar("#profil-content-calendar", events, "month");
//loadCalendar(events);
$('#follows').click(function(){
var id = $(this).data("id");
var isco = $(this).data("isco");
if(isco == false){
links.connectAjax('projects',id,userId,'citoyens','contributors', null, function(){
$('#follows').html("Désinscrire");
$('#follows').data("isco", true);
});
}else{
links.disconnectAjax('projects',id,userId,'citoyens','contributors', null, function(){
$('#follows').html("S'inscrire");
$('#follows').data("isco", false);
});
}
});
});
function loadCalendar(typeElt, id) {
mylog.log("loadCalendar",typeElt, id);
$.ajax({
type: "POST",
url: baseUrl+'/co2/element/getdatadetail/type/'+typeElt+
'/id/'+id+'/dataName/events',
data: {},
dataType: "json"
}).done(function(data){
mylog.log("loadCalendar", data);
$("#profil-content-calendar").fullCalendar('destroy');
calendar.showCalendar("#profil-content-calendar", data, "month");
$("#profil-content-calendar").fullCalendar("gotoDate", moment(Date.now()));
$(window).on('resize', function(){
$("#profil-content-calendar").fullCalendar('destroy');
calendar.showCalendar("#profil-content-calendar", data, "month");
});
}).fail(function(error) {
$('.ret').html(error);
});
}
function isContributor() {
mylog.log("isContributor", userId, elt);
if( typeof userId != "undefined" &&
userId != null &&
userId != "" &&
typeof elt != "undefined" &&
typeof elt.links != "undefined" &&
typeof elt.links.contributors != "undefined" &&
typeof elt.links.contributors[userId] != "undefined" ) {
$('#follows').html("Désinscrire");
$('#follows').data("isco", true);
} else {
$('#follows').html("S'inscrire");
$('#follows').data("isco", false);
}
}
function initDescs() {
mylog.log("inintDescs");
......@@ -40,7 +93,7 @@ function initDescs() {
mylog.log("descHtml", descHtml);
}
function toggleDesription(){
function toggleDescription(){
$('#projectDescription button.customBtnTrigger').click(function(){
if($(this).hasClass('open')){
$('#projectDescription #descriptionAbout').css({'max-height': '148px', 'overflow': 'hidden'});
......@@ -208,8 +261,12 @@ function feedProject(el, countMembers, countEvents, countProjects){
//mylog.log('AJAX return : ' + el.toSource());
// name
elt = el.map;
var id = el.map._id.$id ;
$(".projectName, .projectNameParent").html(el.map.name);
$("#follows").data( "id", id);
// shortdecription
var shortDescription = el.map.shortDescription ? el.map.shortDescription : "";
if(el.map.shortDescription){
......@@ -295,14 +352,19 @@ function feedProject(el, countMembers, countEvents, countProjects){
$(htmlContacts).appendTo('#projectContacts .row');
});
}
else{
} else{
$('.customTabTriggerContacts').hide();
}
isContributor();
loadMyStream('projects', id);
loadCalendar('projects', id);
}
function loadMyStream(typeElt, id){
var url = "news/co/index/type/"+typeElt+"/id/"+idElt;///date/"+dateLimit;
mylog.log("loadMyStream", typeElt, id);
$('#journal').html("");
var url = "news/co/index/type/"+typeElt+"/id/"+id;///date/"+dateLimit;
setTimeout(function(){ //attend que le scroll retourn en haut (kscrollto)
showLoader('#journal');
ajaxPost('#journal', baseUrl+'/'+url,
......@@ -311,7 +373,7 @@ function loadMyStream(typeElt, id){
inline : true
},
function(){
loadLiveNow();
// loadLiveNow();
},"html");
}, 700);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment