Changeset - 12455b1a1a6f
[Not reviewed]
default
6 7 0
Mads Kiilerich (mads) - 7 years ago 2018-12-11 01:22:56
mads@kiilerich.com
front-end: Use select2 from node_modules and stop bundling it

select2 3.5.4 was added in 304e83e9bcde ... but the latest npm release in the 3
series is 3.5.1, so we use that one instead. We should probably upgrade to the
4 series.

The select2 images were not in the location the generated css pointed - now we
copy them from node_modules to the right location, next to the generated css.

Note: this will drop 190cb30841de "branches: fix performance of branch
selectors with many branches - only show the first 200 results" ... but it
should no longer be relevant now when we use server side filtering.

15e507047bae introduced select2-bootstrap.css - it is not clear what version
was used, but we use the latest 1.4.6 which also is very old.
13 files changed with 27 insertions and 4563 deletions:
0 comments (0 inline, 0 general)
.hgignore
Show inline comments
 
@@ -24,12 +24,17 @@ syntax: regexp
 
^kallithea/front-end/node_modules$
 
^kallithea/front-end/package-lock\.json$
 
^kallithea/front-end/tmp$
 
^kallithea/public/css/style\.css(\.map)?$
 
^kallithea/public/css/select2-spinner\.gif$
 
^kallithea/public/css/select2\.png$
 
^kallithea/public/css/select2x2\.png$
 
^kallithea/public/css/style\.css$
 
^kallithea/public/css/style\.css\.map$
 
^kallithea/public/js/bootstrap\.js$
 
^kallithea/public/js/jquery\.flot\.js$
 
^kallithea/public/js/jquery\.flot\.selection\.js$
 
^kallithea/public/js/jquery\.flot\.time\.js$
 
^kallithea/public/js/jquery\.min\.js$
 
^kallithea/public/js/select2\.js$
 
^theme\.less$
 
^kallithea\.db$
 
^test\.db$
LICENSE.md
Show inline comments
 
@@ -113,7 +113,7 @@ tri-license.
 
Select2
 
-------
 

	
 
Kallithea incorporates parts of the Javascript system called
 
Kallithea uses the Javascript system called
 
[Select2](http://ivaynberg.github.io/select2/), which is:
 

	
 
Copyright 2012 Igor Vaynberg (and probably others)
 
@@ -132,12 +132,15 @@ in this distribution.
 
Kallithea will take the Apache license fork of the dual license, since
 
Kallithea is GPLv3'd.
 

	
 
It is not distributed with Kallithea, but will be downloaded
 
using the ''kallithea-cli front-end-build'' command.
 

	
 

	
 

	
 
Select2-Bootstrap-CSS
 
---------------------
 

	
 
Kallithea incorporates some CSS from a system called
 
Kallithea uses some CSS from a system called
 
[Select2-bootstrap-css](https://github.com/t0m/select2-bootstrap-css), which
 
is:
 

	
 
@@ -146,6 +149,9 @@ Copyright © 2013 Tom Terrace (and l
 
and licensed under the MIT-permissive license, which is
 
[included in this distribution](MIT-Permissive-License.txt).
 

	
 
It is not distributed with Kallithea, but will be downloaded
 
using the ''kallithea-cli front-end-build'' command.
 

	
 

	
 

	
 
History.js
kallithea/bin/kallithea_cli_front_end.py
Show inline comments
 
@@ -72,6 +72,12 @@ def front_end_build(install_deps, genera
 
        shutil.copy(os.path.join(front_end_dir, 'node_modules', 'jquery.flot', 'jquery.flot.selection.js'), os.path.join(public_dir, 'js', 'jquery.flot.selection.js'))
 
        shutil.copy(os.path.join(front_end_dir, 'node_modules', 'jquery.flot', 'jquery.flot.time.js'), os.path.join(public_dir, 'js', 'jquery.flot.time.js'))
 

	
 
        click.echo("Preparing Select2 JS")
 
        shutil.copy(os.path.join(front_end_dir, 'node_modules', 'select2', 'select2.js'), os.path.join(public_dir, 'js', 'select2.js'))
 
        shutil.copy(os.path.join(front_end_dir, 'node_modules', 'select2', 'select2.png'), os.path.join(public_dir, 'css', 'select2.png'))
 
        shutil.copy(os.path.join(front_end_dir, 'node_modules', 'select2', 'select2x2.png'), os.path.join(public_dir, 'css', 'select2x2.png'))
 
        shutil.copy(os.path.join(front_end_dir, 'node_modules', 'select2', 'select2-spinner.gif'), os.path.join(public_dir, 'css', 'select2-spinner.gif'))
 

	
 
        click.echo("Generating LICENSES.txt")
 
        check_licensing_json_path = os.path.join(tmp_dir, 'licensing.json')
 
        licensing_txt_path = os.path.join(public_dir, 'LICENSES.txt')
kallithea/front-end/package.json
Show inline comments
 
@@ -4,7 +4,9 @@
 
  "dependencies": {
 
    "bootstrap": "3.3.7",
 
    "jquery": "1.12.3",
 
    "jquery.flot": "0.8.3"
 
    "jquery.flot": "0.8.3",
 
    "select2": "3.5.1",
 
    "select2-bootstrap-css": "1.2.4"
 
  },
 
  "devDependencies": {
 
    "less": "~2.7",
kallithea/public/js/select2/select2-bootstrap.css
Show inline comments
 
deleted file
kallithea/public/js/select2/select2-spinner.gif
Show inline comments
 
deleted file
 
binary diff not shown
Show images
kallithea/public/js/select2/select2.css
Show inline comments
 
deleted file
kallithea/public/js/select2/select2.js
Show inline comments
 
deleted file
kallithea/public/js/select2/select2.png
Show inline comments
 
deleted file
 
binary diff not shown
Show images
kallithea/public/js/select2/select2x2.png
Show inline comments
 
deleted file
 
binary diff not shown
Show images
kallithea/public/less/main.less
Show inline comments
 
@@ -11,8 +11,8 @@
 
/* 3rd party styles */
 
@import "node_modules/bootstrap/less/bootstrap.less";
 
@import (inline) "3rd-party/dataTables.bootstrap.css";
 
@import (less) "../js/select2/select2.css";
 
@import (less) "../js/select2/select2-bootstrap.css";
 
@import (less) "node_modules/select2/select2.css";
 
@import (less) "node_modules/select2-bootstrap-css/select2-bootstrap.css";
 
@import (less) "tmp/pygments.css";
 
@import (less) "../fontello/css/kallithea.css";
 

	
kallithea/templates/base/root.html
Show inline comments
 
@@ -72,7 +72,7 @@
 
        <script type="text/javascript" src="${h.url('/js/jquery.dataTables.min.js', ver=c.kallithea_version)}"></script>
 
        <script type="text/javascript" src="${h.url('/js/dataTables.bootstrap.js', ver=c.kallithea_version)}"></script>
 
        <script type="text/javascript" src="${h.url('/js/bootstrap.js', ver=c.kallithea_version)}"></script>
 
        <script type="text/javascript" src="${h.url('/js/select2/select2.js', ver=c.kallithea_version)}"></script>
 
        <script type="text/javascript" src="${h.url('/js/select2.js', ver=c.kallithea_version)}"></script>
 
        <script type="text/javascript" src="${h.url('/js/native.history.js', ver=c.kallithea_version)}"></script>
 
        <script type="text/javascript" src="${h.url('/js/base.js', ver=c.kallithea_version)}"></script>
 
        ## EXTRA FOR JS
scripts/whitespacecleanup.sh
Show inline comments
 
@@ -2,7 +2,7 @@
 

	
 
# Enforce some consistency in whitespace - just to avoid spurious whitespaces changes
 

	
 
files=`hg mani | egrep -v '/codemirror/|/fontello/|/email_templates/|(/lockfiles.py|^LICENSE-MERGELY.html|^docs/Makefile|^scripts/whitespacecleanup.sh|/(graph|mergely|native.history|select2/select2|yui.2.9|jquery.dataTables)\.js|/test_dump_html_mails.ref.html|\.png|\.gif|\.ico|\.pot|\.po|\.mo|\.tar\.gz|\.diff)$'`
 
files=`hg mani | egrep -v '/codemirror/|/fontello/|/email_templates/|(/lockfiles.py|^LICENSE-MERGELY.html|^docs/Makefile|^scripts/whitespacecleanup.sh|/(graph|mergely|native.history|yui.2.9|jquery.dataTables)\.js|/test_dump_html_mails.ref.html|\.png|\.gif|\.ico|\.pot|\.po|\.mo|\.tar\.gz|\.diff)$'`
 

	
 
sed -i "s/`printf '\r'`//g" $files
 
sed -i -e "s,`printf '\t'`,    ,g" $files
0 comments (0 inline, 0 general)