From 1008d6460e5df6f8b7ca94d7b038316afb5e5c00 Mon Sep 17 00:00:00 2001 From: patrikx3 Date: Mon, 9 Jul 2018 16:03:47 +0200 Subject: [PATCH] p3x-robot sunday release 7/9/2018, 4:03:47 PM --- INSTALL.md | 2 +- README.md | 4 +- artifacts/php-7.2-ubuntu.md | 2 +- changelog.md | 2 +- package.json | 4 +- src/GitList/Controller/TreeController.php | 7 +++ src/browser/bundle.js | 2 +- src/browser/js/blame.js | 55 +---------------- src/browser/js/file-fragment.js | 61 +++++++++++++++++++ src/browser/js/file.js | 10 +++ src/browser/js/global.js | 8 +-- src/browser/js/themes.js | 36 +++++------ src/browser/layout.tpl.twig | 2 +- src/browser/less/blame-and-search.less | 3 + src/browser/less/default.less | 2 +- .../less/{blame.less => file-fragment.less} | 8 +-- src/twig/blame.twig | 12 ++-- src/twig/search.twig | 42 +++++++++++-- todo.md | 2 +- 19 files changed, 164 insertions(+), 100 deletions(-) create mode 100644 src/browser/js/file-fragment.js create mode 100644 src/browser/less/blame-and-search.less rename src/browser/less/{blame.less => file-fragment.less} (64%) diff --git a/INSTALL.md b/INSTALL.md index 463be62d..ce10ca71 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -116,7 +116,7 @@ UrlToolkit { --- -[**P3X-GITLIST**](https://pages.corifeus.com/gitlist) Build v2.9.8-888 +[**P3X-GITLIST**](https://pages.corifeus.com/gitlist) Build v2.9.12-890 [![Like Corifeus @ Facebook](https://img.shields.io/badge/LIKE-Corifeus-3b5998.svg)](https://www.facebook.com/corifeus.software) [![Donate for Corifeus / P3X](https://img.shields.io/badge/Donate-Corifeus-003087.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QZVM4V6HVZJW6) [![Contact Corifeus / P3X](https://img.shields.io/badge/Contact-P3X-ff9900.svg)](https://www.patrikx3.com/en/front/contact) diff --git a/README.md b/README.md index ceb58384..b2a9aedc 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ -# 🤖 P3X Gitlist v2.9.8-888 +# 🤖 P3X Gitlist v2.9.12-890 This is an open-source project. Star this repository if you like it, or even donate! Thank you so much! :) @@ -171,7 +171,7 @@ npm run watch --- -[**P3X-GITLIST**](https://pages.corifeus.com/gitlist) Build v2.9.8-888 +[**P3X-GITLIST**](https://pages.corifeus.com/gitlist) Build v2.9.12-890 [![Like Corifeus @ Facebook](https://img.shields.io/badge/LIKE-Corifeus-3b5998.svg)](https://www.facebook.com/corifeus.software) [![Donate for Corifeus / P3X](https://img.shields.io/badge/Donate-Corifeus-003087.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QZVM4V6HVZJW6) [![Contact Corifeus / P3X](https://img.shields.io/badge/Contact-P3X-ff9900.svg)](https://www.patrikx3.com/en/front/contact) diff --git a/artifacts/php-7.2-ubuntu.md b/artifacts/php-7.2-ubuntu.md index cb0d28ec..941860f0 100644 --- a/artifacts/php-7.2-ubuntu.md +++ b/artifacts/php-7.2-ubuntu.md @@ -20,7 +20,7 @@ sudo apt upgrade -y --- -[**P3X-GITLIST**](https://pages.corifeus.com/gitlist) Build v2.9.8-888 +[**P3X-GITLIST**](https://pages.corifeus.com/gitlist) Build v2.9.12-890 [![Like Corifeus @ Facebook](https://img.shields.io/badge/LIKE-Corifeus-3b5998.svg)](https://www.facebook.com/corifeus.software) [![Donate for Corifeus / P3X](https://img.shields.io/badge/Donate-Corifeus-003087.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QZVM4V6HVZJW6) [![Contact Corifeus / P3X](https://img.shields.io/badge/Contact-P3X-ff9900.svg)](https://www.patrikx3.com/en/front/contact) diff --git a/changelog.md b/changelog.md index de76dfb6..f3aa801c 100644 --- a/changelog.md +++ b/changelog.md @@ -139,7 +139,7 @@ require('codemirror/mode/yaml/yaml'); --- -[**P3X-GITLIST**](https://pages.corifeus.com/gitlist) Build v2.9.8-888 +[**P3X-GITLIST**](https://pages.corifeus.com/gitlist) Build v2.9.12-890 [![Like Corifeus @ Facebook](https://img.shields.io/badge/LIKE-Corifeus-3b5998.svg)](https://www.facebook.com/corifeus.software) [![Donate for Corifeus / P3X](https://img.shields.io/badge/Donate-Corifeus-003087.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QZVM4V6HVZJW6) [![Contact Corifeus / P3X](https://img.shields.io/badge/Contact-P3X-ff9900.svg)](https://www.patrikx3.com/en/front/contact) diff --git a/package.json b/package.json index 8b0a46ce..7137ddba 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,9 @@ { "name": "p3x-gitlist", - "version": "2.9.9-889", + "version": "2.9.13-892", "corifeus": { "prod-dir": "prod", - "postfix": "2607a7cb45c1136298a2a2ccb0a3d49ec147c7dab987b6dd4ec124a716e92c92", + "postfix": "435184d6305e289329e6552e2041505e35b22c41535a8d79f41f4e2af0568de2", "prefix": "p3x-", "publish": false, "type": "p3x", diff --git a/src/GitList/Controller/TreeController.php b/src/GitList/Controller/TreeController.php index b827acbf..f516d7bf 100644 --- a/src/GitList/Controller/TreeController.php +++ b/src/GitList/Controller/TreeController.php @@ -61,6 +61,12 @@ public function connect(Application $app) $breadcrumbs = array(array('dir' => 'Search results for: ' . $query, 'path' => '')); $results = $repository->searchTree($query, $branch); + for($i = 0; $i < count($results); $i++) { + $result = $results[$i]; + $results[$i]['type'] = $app['util.repository']->getFileType($result['file']); + } + + return $app['twig']->render('search.twig', array( 'results' => $results, 'repo' => $repo, @@ -72,6 +78,7 @@ public function connect(Application $app) 'tags' => $repository->getTags(), 'query' => $query )); + })->assert('repo', $app['util.routing']->getRepositoryRegex()) ->assert('branch', $app['util.routing']->getBranchRegex()) ->convert('branch', 'escaper.argument:escape') diff --git a/src/browser/bundle.js b/src/browser/bundle.js index 18706947..801c8c8e 100644 --- a/src/browser/bundle.js +++ b/src/browser/bundle.js @@ -95,7 +95,7 @@ require('./js/file') require('./js/theme-switcher.js') require('./js/commit') require('./js/commits-list') -require('./js/blame') +require('./js/file-fragment') require('./js/global') diff --git a/src/browser/js/blame.js b/src/browser/js/blame.js index aadfbbd0..406bcb18 100644 --- a/src/browser/js/blame.js +++ b/src/browser/js/blame.js @@ -1,52 +1,3 @@ -$(() => { - const $blamePanel = $('.p3x-gitlist-blame-panel') - if ($blamePanel.length > 0) { - - let $buttonToggleCodeMirrorCurrent; - let $textareaCurrent; - let $textCurrent - - for(let blame of $blamePanel) { - const index = blame.dataset.index - const $buttonToggleCodeMirror = $(`#p3x-gitlilst-blame-heading-button-codemirror-${ index }`) - const $text = $(`#p3x-gitlist-blame-text-${ index }`) - const $textarea = $(`#p3x-gitlist-blame-codemirror-${ index }`) - - $buttonToggleCodeMirror.on('click', function(event) { - if ($buttonToggleCodeMirrorCurrent !== undefined) { - $('.CodeMirror-wrap').remove() - const wasActive = $buttonToggleCodeMirror.hasClass('active') - window.gitlist.blameCodeMirror = undefined - $buttonToggleCodeMirrorCurrent.removeClass('active') - $textCurrent.removeClass('hidden') - $textareaCurrent.addClass('hidden') - if (wasActive) { - return; - } - } - - $buttonToggleCodeMirrorCurrent = $buttonToggleCodeMirror - $textCurrent = $text; - $textareaCurrent = $textarea; - $text.addClass('hidden'); - $textarea.removeClass('hidden') - $buttonToggleCodeMirror.addClass('active') - - const cm = CodeMirror.fromTextArea($textarea.get(0), { - styleActiveLine: true, - styleSelectedText: true, - value: blame.value, - lineNumbers: true, - matchBrackets: true, - lineWrapping: true, - readOnly: true, - height: 'auto', - mode: blame.dataset.mode, - theme: window.gitlist.getActualThemeCodemirror(), - }); - window.gitlist.blameCodeMirror = cm - }) - } - - } -}) \ No newline at end of file +/* +It uses the file-fragement + */ \ No newline at end of file diff --git a/src/browser/js/file-fragment.js b/src/browser/js/file-fragment.js new file mode 100644 index 00000000..877badaa --- /dev/null +++ b/src/browser/js/file-fragment.js @@ -0,0 +1,61 @@ +$(() => { + const $fragmentFilePanel = $('.p3x-gitlist-file-fragment-panel') + if ($fragmentFilePanel.length > 0) { + + let $buttonToggleCodeMirrorCurrent; + let $textareaCurrent; + let $textCurrent + + for(let fragmentFile of $fragmentFilePanel) { + const index = fragmentFile.dataset.index + const $buttonToggleCodeMirror = $(`#p3x-gitlilst-file-fragment-heading-button-codemirror-${ index }`) + const $text = $(`#p3x-gitlist-file-fragment-text-${ index }`) + const $textarea = $(`#p3x-gitlist-file-fragment-codemirror-${ index }`) + + const $buttonEditor = $(`#p3x-gitlilst-file-fragment-heading-button-edit-${ index}`) + if ($buttonEditor.length > 0) { + $buttonEditor.on('click', function(event) { + const url = $buttonEditor.get(0).dataset.url + location = url; + }) + + } + + $buttonToggleCodeMirror.on('click', function(event) { + if ($buttonToggleCodeMirrorCurrent !== undefined) { + $('.CodeMirror-wrap').remove() + const wasActive = $buttonToggleCodeMirror.hasClass('active') + window.gitlist.fragmentFileCodeMirror = undefined + $buttonToggleCodeMirrorCurrent.removeClass('active') + $textCurrent.removeClass('hidden') + $textareaCurrent.addClass('hidden') + if (wasActive) { + return; + } + } + + $buttonToggleCodeMirrorCurrent = $buttonToggleCodeMirror + $textCurrent = $text; + $textareaCurrent = $textarea; + $text.addClass('hidden'); + $textarea.removeClass('hidden') + $buttonToggleCodeMirror.addClass('active') + + const cm = CodeMirror.fromTextArea($textarea.get(0), { + styleActiveLine: true, + styleSelectedText: true, + value: fragmentFile.value, + lineNumbers: true, + matchBrackets: true, + lineWrapping: true, + readOnly: true, + height: 'auto', + mode: fragmentFile.dataset.mode, + theme: window.gitlist.getActualThemeCodemirror(), + }); + window.gitlist.fragmentFileCodeMirror = cm + }) + } + + } +}) \ No newline at end of file diff --git a/src/browser/js/file.js b/src/browser/js/file.js index 5a5f0f47..8e32fd02 100644 --- a/src/browser/js/file.js +++ b/src/browser/js/file.js @@ -252,6 +252,16 @@ ${branchInfo} if (line !== undefined) { setTimeout(() => { cm.scrollIntoView({line: line, char:0}, isReallyFull ? window.innerHeight / 2 : 100) + /* + const codes = $('.CodeMirror-linenumber') + for(let codeLinenumber of codes) { + const $codeLinenumber = $(codeLinenumber) + const findLine = $codeLinenumber.text(); + if(findLine === line ) { + break; + } + } + */ }, 250) } } diff --git a/src/browser/js/global.js b/src/browser/js/global.js index 5aea6fb7..bc860ea7 100644 --- a/src/browser/js/global.js +++ b/src/browser/js/global.js @@ -113,9 +113,9 @@ window.gitlist.setTheme = () => { currentTheme = theme; /* - const themeBlameCodeMirror = (options) => { + const themeFragmentFileCodeMirror = (options) => { const { theme } = options - for(let cm of window.gitlist.blameCodeMirror) { + for(let cm of window.gitlist.fragmentFileCodeMirror) { cm.setOption("theme", theme); } } @@ -140,8 +140,8 @@ window.gitlist.setTheme = () => { if (gitlist.viewer !== undefined) { gitlist.viewer.setOption("theme", codeMirrorTheme); } - if (gitlist.blameCodeMirror !== undefined) { - gitlist.blameCodeMirror.setOption("theme", codeMirrorTheme); + if (gitlist.fragmentFileCodeMirror !== undefined) { + gitlist.fragmentFileCodeMirror.setOption("theme", codeMirrorTheme); } diff --git a/src/browser/js/themes.js b/src/browser/js/themes.js index 4a172969..e5ea6354 100644 --- a/src/browser/js/themes.js +++ b/src/browser/js/themes.js @@ -1,22 +1,22 @@ const themes = { - "bootstrap-default": "prod/css/bootstrap-default.2607a7cb45c1136298a2a2ccb0a3d49ec147c7dab987b6dd4ec124a716e92c92.css", - "bootstrap-solar": "prod/css/bootstrap-solar.2607a7cb45c1136298a2a2ccb0a3d49ec147c7dab987b6dd4ec124a716e92c92.css", - "bootstrap-cerulean": "prod/css/bootstrap-cerulean.2607a7cb45c1136298a2a2ccb0a3d49ec147c7dab987b6dd4ec124a716e92c92.css", - "bootstrap-cosmo": "prod/css/bootstrap-cosmo.2607a7cb45c1136298a2a2ccb0a3d49ec147c7dab987b6dd4ec124a716e92c92.css", - "bootstrap-cyborg": "prod/css/bootstrap-cyborg.2607a7cb45c1136298a2a2ccb0a3d49ec147c7dab987b6dd4ec124a716e92c92.css", - "bootstrap-darkly": "prod/css/bootstrap-darkly.2607a7cb45c1136298a2a2ccb0a3d49ec147c7dab987b6dd4ec124a716e92c92.css", - "bootstrap-flatly": "prod/css/bootstrap-flatly.2607a7cb45c1136298a2a2ccb0a3d49ec147c7dab987b6dd4ec124a716e92c92.css", - "bootstrap-journal": "prod/css/bootstrap-journal.2607a7cb45c1136298a2a2ccb0a3d49ec147c7dab987b6dd4ec124a716e92c92.css", - "bootstrap-lumen": "prod/css/bootstrap-lumen.2607a7cb45c1136298a2a2ccb0a3d49ec147c7dab987b6dd4ec124a716e92c92.css", - "bootstrap-paper": "prod/css/bootstrap-paper.2607a7cb45c1136298a2a2ccb0a3d49ec147c7dab987b6dd4ec124a716e92c92.css", - "bootstrap-readable": "prod/css/bootstrap-readable.2607a7cb45c1136298a2a2ccb0a3d49ec147c7dab987b6dd4ec124a716e92c92.css", - "bootstrap-sandstone": "prod/css/bootstrap-sandstone.2607a7cb45c1136298a2a2ccb0a3d49ec147c7dab987b6dd4ec124a716e92c92.css", - "bootstrap-simplex": "prod/css/bootstrap-simplex.2607a7cb45c1136298a2a2ccb0a3d49ec147c7dab987b6dd4ec124a716e92c92.css", - "bootstrap-slate": "prod/css/bootstrap-slate.2607a7cb45c1136298a2a2ccb0a3d49ec147c7dab987b6dd4ec124a716e92c92.css", - "bootstrap-spacelab": "prod/css/bootstrap-spacelab.2607a7cb45c1136298a2a2ccb0a3d49ec147c7dab987b6dd4ec124a716e92c92.css", - "bootstrap-superhero": "prod/css/bootstrap-superhero.2607a7cb45c1136298a2a2ccb0a3d49ec147c7dab987b6dd4ec124a716e92c92.css", - "bootstrap-united": "prod/css/bootstrap-united.2607a7cb45c1136298a2a2ccb0a3d49ec147c7dab987b6dd4ec124a716e92c92.css", - "bootstrap-yeti": "prod/css/bootstrap-yeti.2607a7cb45c1136298a2a2ccb0a3d49ec147c7dab987b6dd4ec124a716e92c92.css" + "bootstrap-default": "prod/css/bootstrap-default.435184d6305e289329e6552e2041505e35b22c41535a8d79f41f4e2af0568de2.css", + "bootstrap-solar": "prod/css/bootstrap-solar.435184d6305e289329e6552e2041505e35b22c41535a8d79f41f4e2af0568de2.css", + "bootstrap-cerulean": "prod/css/bootstrap-cerulean.435184d6305e289329e6552e2041505e35b22c41535a8d79f41f4e2af0568de2.css", + "bootstrap-cosmo": "prod/css/bootstrap-cosmo.435184d6305e289329e6552e2041505e35b22c41535a8d79f41f4e2af0568de2.css", + "bootstrap-cyborg": "prod/css/bootstrap-cyborg.435184d6305e289329e6552e2041505e35b22c41535a8d79f41f4e2af0568de2.css", + "bootstrap-darkly": "prod/css/bootstrap-darkly.435184d6305e289329e6552e2041505e35b22c41535a8d79f41f4e2af0568de2.css", + "bootstrap-flatly": "prod/css/bootstrap-flatly.435184d6305e289329e6552e2041505e35b22c41535a8d79f41f4e2af0568de2.css", + "bootstrap-journal": "prod/css/bootstrap-journal.435184d6305e289329e6552e2041505e35b22c41535a8d79f41f4e2af0568de2.css", + "bootstrap-lumen": "prod/css/bootstrap-lumen.435184d6305e289329e6552e2041505e35b22c41535a8d79f41f4e2af0568de2.css", + "bootstrap-paper": "prod/css/bootstrap-paper.435184d6305e289329e6552e2041505e35b22c41535a8d79f41f4e2af0568de2.css", + "bootstrap-readable": "prod/css/bootstrap-readable.435184d6305e289329e6552e2041505e35b22c41535a8d79f41f4e2af0568de2.css", + "bootstrap-sandstone": "prod/css/bootstrap-sandstone.435184d6305e289329e6552e2041505e35b22c41535a8d79f41f4e2af0568de2.css", + "bootstrap-simplex": "prod/css/bootstrap-simplex.435184d6305e289329e6552e2041505e35b22c41535a8d79f41f4e2af0568de2.css", + "bootstrap-slate": "prod/css/bootstrap-slate.435184d6305e289329e6552e2041505e35b22c41535a8d79f41f4e2af0568de2.css", + "bootstrap-spacelab": "prod/css/bootstrap-spacelab.435184d6305e289329e6552e2041505e35b22c41535a8d79f41f4e2af0568de2.css", + "bootstrap-superhero": "prod/css/bootstrap-superhero.435184d6305e289329e6552e2041505e35b22c41535a8d79f41f4e2af0568de2.css", + "bootstrap-united": "prod/css/bootstrap-united.435184d6305e289329e6552e2041505e35b22c41535a8d79f41f4e2af0568de2.css", + "bootstrap-yeti": "prod/css/bootstrap-yeti.435184d6305e289329e6552e2041505e35b22c41535a8d79f41f4e2af0568de2.css" }; module.exports = themes; diff --git a/src/browser/layout.tpl.twig b/src/browser/layout.tpl.twig index bc61e8e3..5e0ac48f 100644 --- a/src/browser/layout.tpl.twig +++ b/src/browser/layout.tpl.twig @@ -7,7 +7,7 @@ {% block title %}Welcome!{% endblock %} - + diff --git a/src/browser/less/blame-and-search.less b/src/browser/less/blame-and-search.less new file mode 100644 index 00000000..93c117fa --- /dev/null +++ b/src/browser/less/blame-and-search.less @@ -0,0 +1,3 @@ +/* +they are using the file-fragment.less file + */ \ No newline at end of file diff --git a/src/browser/less/default.less b/src/browser/less/default.less index c1abb7a1..73470876 100644 --- a/src/browser/less/default.less +++ b/src/browser/less/default.less @@ -114,4 +114,4 @@ img.emoji { @import "commit"; @import "tree"; @import "navigation"; -@import "blame"; \ No newline at end of file +@import "file-fragment"; \ No newline at end of file diff --git a/src/browser/less/blame.less b/src/browser/less/file-fragment.less similarity index 64% rename from src/browser/less/blame.less rename to src/browser/less/file-fragment.less index 620ed13d..59279d77 100644 --- a/src/browser/less/blame.less +++ b/src/browser/less/file-fragment.less @@ -1,13 +1,13 @@ -.p3x-gitlilst-blame-heading-right { +.p3x-gitlilst-file-fragment-heading-right { float: right; } -.p3x-gitlist-blame-panel { +.p3x-gitlist-file-fragment-panel { .panel-body { padding: 0 !important; - .p3x-gitlist-blame-text { + .p3x-gitlist-file-fragment-text { padding: @panel-body-padding !important; } .CodeMirror-wrap { @@ -17,7 +17,7 @@ } } -.p3x-gitlist-blame-text { +.p3x-gitlist-file-fragment-text { overflow-x: auto; white-space: pre; margin: 0; diff --git a/src/twig/blame.twig b/src/twig/blame.twig index 163d817a..b6cc2675 100644 --- a/src/twig/blame.twig +++ b/src/twig/blame.twig @@ -33,16 +33,16 @@ {% for blame in blames %} -
+
- +
@@ -50,8 +50,8 @@
-
{{ blame.line }}
- +
{{ blame.line }}
+
diff --git a/src/twig/search.twig b/src/twig/search.twig index fb3cd8be..33a6c157 100644 --- a/src/twig/search.twig +++ b/src/twig/search.twig @@ -10,7 +10,7 @@ {% block left %} {% if results %} - + File count: {{ results | length }} {% endif %} {% endblock %} @@ -19,17 +19,49 @@ {% if results %} +
+
+ +
+
+
+ Hang on, we reloading big blames... +
+
+ {% for result in results %} -
+ +
   {{ blame.commitShort }} -
+ + + + +
+   {{ result.file }} on line {{ result.line }} + + + +    + +
+
-
{{ result.match }}
+
+
{{ result.match }}
+ +
+
{% endfor %} {% else %}

- The search found no result. + No result.

{% endif %} diff --git a/todo.md b/todo.md index 7d5fd0ac..98cb9ee2 100644 --- a/todo.md +++ b/todo.md @@ -13,7 +13,7 @@ --- -[**P3X-GITLIST**](https://pages.corifeus.com/gitlist) Build v2.9.8-888 +[**P3X-GITLIST**](https://pages.corifeus.com/gitlist) Build v2.9.12-890 [![Like Corifeus @ Facebook](https://img.shields.io/badge/LIKE-Corifeus-3b5998.svg)](https://www.facebook.com/corifeus.software) [![Donate for Corifeus / P3X](https://img.shields.io/badge/Donate-Corifeus-003087.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QZVM4V6HVZJW6) [![Contact Corifeus / P3X](https://img.shields.io/badge/Contact-P3X-ff9900.svg)](https://www.patrikx3.com/en/front/contact)