From bb59dd6de38f773ccd37d55237f79e92324d2145 Mon Sep 17 00:00:00 2001 From: patrikx3 Date: Tue, 15 May 2018 13:00:40 +0200 Subject: [PATCH] p3x-robot sunday release 2018-5-15 13:00:40 --- public/img/ajax-loader.gif | Bin 11080 -> 0 bytes public/js/bundle.js | 19 +++++++++++++++++++ public/js/markdown.js | 1 + scripts/init.sh | 2 +- src/Controller/BlobController.php | 1 + src/Util/Repository.php | 14 ++++++++++++-- twig/file.twig | 20 ++++++++++++++++---- 7 files changed, 50 insertions(+), 7 deletions(-) delete mode 100644 public/img/ajax-loader.gif diff --git a/public/img/ajax-loader.gif b/public/img/ajax-loader.gif deleted file mode 100644 index 9796fb41fe8f09ac58bf9430796111aa8d01fd77..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 11080 zcmds-iCa_mw)b~-rk#+9%<~))a41@})OvbivI7B;F(4plltDm1MG#c1VIG_S5fKp) z5s_M_;zS+7q~LULsP!sZ2YRa3dTs5ow>>`X{l#EP+tYjA_dVX{dGF;9;CbNl`>gd{ zYi&P&U!Qm9$sswk3xX_>mc9G-7L^nY-5g5GNb5b*`{e19hWdtt`3WaZov5j<8UE{V z-io|ySFXMM@nuVMOYEH3jw2mw*RLJEKb*BJ>%yfA-@W)QEj2ARCbr{H$J&auLwAO< zGP5q6yYSt&-!(KgBqSyDcK6oQ);xLqB=3W~YuB&6{OM&&Ys=3+{|vo}AH~mZK_*MM zae9bp;&^W?2K-LN4>%GY(m`V#zu)m^LWCdnHH*#S`l-s$eoNZaZ5|jaS^jQg)Pj9kTfQ9S!9X=B6q1t^kSW`pXu9L{zjz}4?9~s=j zDMu9XVx#KfUoN8>jOqv%i4~lfiQT}b@4SafzkK-QYbmQMic99pNzt06@HauqSWT2V z``)g?XtZ-?zSU|jHj4Ro9@#ZlDoFxn*@>RD=WNT2 zN~>M(-s-;fUcu{shxV6$N3oMR0A5s3?w&cga9nBSM1Y({*GI z$%2iFuVKES&#!`%ycxScYq6K)TEp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)P&ZTIlJbvAtaGe)23L@FoK+T-Sb);G zxdVmP1r#82uI)zC{AH(p$?<&wDAgeLI12FVow_ruf-3u_fD-;Ty2L7!7uy!&ps^K1 ze^bmP!T8pD=8(Rc?xA>%C4F`)(^{83SUSvuUz9U!7Uv`W z+H@Ra$+M=yPYgLi&2noK`Vsvl#3(De-%~U%g?)H}ckgrzj(oLYp|N0VB{N4?hu+gq z=TM&?liawbMn=->@4a+3OF$A}bS`>a%@SY)UV;n@V7f@UJ}z)xEnQx^NCL=?FT7r< z>5Q?CUi;HaXR~}$7#+>>``2EotEY!erLS!+hwaJ2OAiQk#ru%e`(focn)hwRWXjW; zHG}i;J%qRJ_%lzAw`*D1kRU)!pa)U8X>h2&#wrbxY209PAX&(CpNaCUc?icOOK9#&D;?Czv$4UfZQ!&f{=x6>5V!68MhvEeajrVg%F6FAV!%G- zsdmEVO7P{NPp)Qq-F}wfhCH{=t}j_;Ff?z>`9=b*87pER7~YV$<#mkxFRTQL0h>UX z9ep4HH~|s{j9DjIn>FM3iqNXBYroN~N94-sWBY1KcX?KI5n}Hc&z0!f zSB7x3Fhb4slh21~GVy#ti9sVJuxDt~_{2(IIJ23ens|nB8?-W45VK5W z5<+}trHqZ;i^?#XrrudJl}Dd1J%-nF&ai6smO-65jr{4p*$k9Jfa7u*^ZAF3^z<(i zJ)|+DzZlEHT1w8IHi}4)`@pA$vuk~x`L*Z~iu?QesreWqq{Q~hy*s8;# $breadcrumbs, 'branches' => $repository->getBranches(), 'tags' => $repository->getTags(), + 'enforceCodemirror' => isset($_GET['codemirror']) )); })->assert('repo', $app['util.routing']->getRepositoryRegex()) ->assert('commitishPath', '.+') diff --git a/src/Util/Repository.php b/src/Util/Repository.php index 10d462e0..74cfb424 100644 --- a/src/Util/Repository.php +++ b/src/Util/Repository.php @@ -26,6 +26,7 @@ class Repository 'el' => 'erlang', 'go' => 'go', 'groovy' => 'groovy', + 'hbs' => 'handlebars', 'hs' => 'haskell', 'lhs' => 'haskell', 'jsp' => 'application/x-jsp', @@ -35,16 +36,20 @@ class Repository 'tpl' => 'htmlmixed', 'js' => 'javascript', 'json' => 'javascript', - 'less' => 'less', + 'jsx' => 'jsx', + 'less' => 'css', 'lua' => 'lua', 'md' => 'markdown', 'markdown' => 'markdown', - 'sql' => 'mysql', + 'sql' => 'sql', + 'swift' => 'swift', + 'twig' => 'twig', 'ml' => 'ocaml', 'mli' => 'ocaml', 'pl' => 'perl', 'pm' => 'perl', 'pas' => 'pascal', + 'ps1' => 'powershell', 'ini' => 'properties', 'cfg' => 'properties', 'nt' => 'ntriples', @@ -52,6 +57,7 @@ class Repository 'rb' => 'ruby', 'rst' => 'rst', 'r' => 'r', + 'lock' => 'javascript', 'sh' => 'shell', 'ss' => 'scheme', 'scala' => 'text/x-scala', @@ -120,6 +126,10 @@ public function __construct(Application $app) */ public function getFileType($file) { + if ($file === 'Dockerfile') { + return 'dockerfile'; + }; + if (($pos = strrpos($file, '.')) !== false) { $fileType = substr($file, $pos + 1); } else { diff --git a/twig/file.twig b/twig/file.twig index 58279333..6c19d590 100644 --- a/twig/file.twig +++ b/twig/file.twig @@ -7,8 +7,9 @@ {% block content %} {% include 'breadcrumb.twig' with {breadcrumbs: breadcrumbs} %} - {% if fileType != 'image' and fileType != 'markdown' %} -
+ +
+ {% if (fileType != 'image' and fileType != 'markdown') or enforceCodemirror %} @@ -17,9 +18,20 @@
-
{% endif %} + {% if fileType == 'markdown' %} + + {% if enforceCodemirror %} + Markdown rendered + {% else %} + Markdown code + {% endif %} + + + {% endif %} + +
Raw Blame @@ -32,7 +44,7 @@ {% if fileType == 'image' %}
{{ file }}
- {% elseif fileType == 'markdown' %} + {% elseif fileType == 'markdown' and enforceCodemirror != true %}
{{ blob }}
{% else %}