+$(document).ready(function() {
+ var myprojects = JSON.parse(localStorage.getItem('projects'));
+ console.log(myprojects);
+ if (myprojects) {
+ $.each(myprojects, function (i, val){
+ console.log(val);
+ $('.project-list').append('<tr><td>'+ val +'</td></tr>');
+ });
+ } else {
+ $('.project-list').html('<tr><td>no projetcs</td></tr>');
+ }
+
+ $('.nav-tabs a').click(function (e) {
+ e.preventDefault();
+ $(this).tab('show');
+ });
+ $.post("/rest/myslice:authority/",{'fields':['authority_hrn','pi_users'],'filters':{'authority_hrn':'CONTAINS{{ root_authority_hrn }}' }}, function( data ) {
+
+ var projects = [];
+ project_row = "<option value=''> - </option>";
+ projects.push(project_row);
+
+ $.each( data, function( key, val ) {
+ if(val.authority_hrn.split('.').length > 2){
+ if($.inArray(val.authority_hrn, myprojects)==-1){
+ project_row = "<option value='"+val.authority_hrn+"'>"+val.authority_hrn+"</option>";
+ projects.push(project_row);
+ }
+ }
+ });
+ $("#projects").show();
+ $("#projects_button").css('margin-left', '50px');
+ $("#projects_button").css('display', 'inline-block');
+ $("#project_loading").hide();
+ $("#projects").html(projects.join( "" ));
+ $("#projects").combobox();
+ var $s = jQuery("#projects").next().attr('id','listProjects');
+ jQuery('#listProjects').bind("click",function(){
+ // show all items click
+ this.childNodes[1].click();
+ });
+
+ });