'git', 'label' => 'Dépot git', 'icon' => 'fab fa-git-square', 'color' => '#ffffff', 'background' => '#bd2c00', 'description' => 'Dépot git associé', 'fromExtension' => array('.git'), 'toExtension' => '.zip', 'default' => '', ); } /* EDITION */ public static function toHtml($resource,$sketch=null){ $infos = self::manifest(); $json = json_decode($resource->content,true); $url = ''; $synchronise = false; if($json){ $url = $json['url']; $synchronise = $json['synchronise']; } return array( 'html'=>'
', 'javascript' => " window['hackpoint_resource_git_save'] = function(){ if($('.hackpoint').hasClass('readonly')) return; var data = {}; data.action = 'hackpoint_resource_save_content'; data.id = $('#sketch-editor').attr('data-id'); data.content = JSON.stringify({url:$('#content').val(),synchronise:$('#git-synchronise').prop('checked')}); $('.sketch-preloader').show(); $.action(data,function(r){ setTimeout(function(){ $('.sketch-preloader').fadeOut(200); },300); hackpoint_resource_git_explore(); }); } function hackpoint_resource_git_explore(){ console.log('ee'); var data = {}; data.action = 'hackpoint_resource_git_explore'; data.url = $('#content').val(); data.id = $('#sketch-editor').attr('data-id'); $('.sketch-preloader').show(); $.action(data,function(r){ setTimeout(function(){ $('.sketch-preloader').fadeOut(200); },300); $('#git-browser').html(r.html); init_components(); }); } $(document).ready(hackpoint_resource_git_explore()); " ); } //Export vers un fichier brut public static function toFile($resource){ $infos = self::manifest(); return array( 'name'=> slugify($resource->label).'.'.$infos['toExtension'], 'content' => html_entity_decode($resource->content) ); } } ?>