Skip to content

Commit 4ef9f5c

Browse files
authored
Merge pull request ietf-tools#3596 from painless-security/personal/jennifer/7.45.1.dev0.bootstrap-merge
feat: updated boostrap5 work
2 parents 709c123 + 64d6736 commit 4ef9f5c

1,478 files changed

Lines changed: 47122 additions & 189946 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.eslintrc.js

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,24 @@
11
module.exports = {
2+
extends: ["eslint:recommended"],
23
rules: {
3-
indent: [2, 4],
4-
camelcase: 0,
5-
"require-jsdoc": 0,
6-
quotes: [2, "double"],
7-
"no-multiple-empty-lines": [2, {max: 2}],
8-
"quote-props": [2, "as-needed"],
9-
"brace-style": [2, "1tbs", {allowSingleLine: true}]
4+
indent: ["error", 4],
5+
quotes: "off",
6+
"no-multiple-empty-lines": ["error", { max: 2, maxEOF: 0 }],
7+
"quote-props": ["error", "as-needed"],
8+
"brace-style": ["error", "1tbs", { allowSingleLine: true }],
9+
semi: ["error", "always"],
10+
"newline-per-chained-call": ["error"]
1011
},
1112
env: {
1213
browser: true,
13-
jquery: true
14+
jquery: true,
15+
node: true
1416
},
1517
globals: {
1618
d3: true
1719
},
18-
extends: "google"
19-
};
20+
parserOptions: {
21+
sourceType: "module",
22+
ecmaVersion: 2015
23+
}
24+
};

.gitignore

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,18 @@
1616
.DS_store
1717
# Simulated Subversion default ignores end here
1818
/.coverage
19+
/.factoryboy_random_state
1920
/.mypy_cache
21+
/.parcel-cache
2022
/.project
2123
/.pydevproject
2224
/.Python
2325
/.settings
2426
/.tmp
25-
/.factoryboy_random_state
2627
/attic
2728
/bin
28-
/etc
2929
/env
30+
/etc
3031
/ghostdriver.log
3132
/htmlcov
3233
/include
@@ -38,6 +39,7 @@
3839
/mergelog
3940
/mergequeue
4041
/minimum-requirements.txt
42+
/node_modules
4143
/pip-selfcheck.json
4244
/selenium
4345
/settings_local.py

LICENSE

Lines changed: 0 additions & 27 deletions
This file was deleted.

LICENSE.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
Copyright (c) 2008, 2018, The IETF Trust
2+
All rights reserved.
3+
4+
Redistribution and use in source and binary forms, with or without modification,
5+
are permitted provided that the following conditions are met:
6+
7+
1. Redistributions of source code must retain the above copyright notice, this
8+
list of conditions and the following disclaimer.
9+
10+
2. Redistributions in binary form must reproduce the above copyright notice,
11+
this list of conditions and the following disclaimer in the documentation
12+
and/or other materials provided with the distribution.
13+
14+
3. Neither the name of the copyright holder nor the names of its contributors
15+
may be used to endorse or promote products derived from this software without
16+
specific prior written permission.
17+
18+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
22+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
25+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

README.md

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
- [Docker Dev Environment](docker/README.md)
2727
- [Continuous Integration](#continuous-integration)
2828
- [Database & Assets](#database--assets)
29+
- [Bootstrap 5 Upgrade](#bootstrap-5-upgrade)
2930

3031
---
3132

@@ -154,3 +155,139 @@ Additional data files used by the datatracker (e.g. instance drafts, charters, r
154155
https://www.ietf.org/standards/ids/internet-draft-mirror-sites/
155156
156157
> A script is available at `docker/scripts/app-rsync-extras.sh` to automatically fetch these resources via rsync.
158+
159+
---
160+
161+
# Bootstrap 5 Update
162+
163+
An update of the UI to use Bootstrap 5 is under way. The following notes describe this work-in-progress and should
164+
be integrated with the rest of the document as the details and processes become final.
165+
166+
## Intro
167+
168+
We now use `npm` to manage assets for the Datatracker, and `parcel` to
169+
package them. `npm` maintains its `node` packages under `node_modules`.
170+
171+
The Datatracker includes these packages from the various Javascript and
172+
CSS files in `ietf/static/js` and `ietf/static/css`, respectively.
173+
Static images are likewise in `ietf/static/images`.
174+
175+
Whenever changes are made to the files under `ietf/static`, you must
176+
re-run `parcel` to package them:
177+
178+
``` shell
179+
npx parcel build
180+
```
181+
182+
This will create packages under `ietf/static/dist/ietf`, which are then
183+
served by the Django development server, and which must be uploaded to
184+
the CDN.
185+
186+
## Use Bootstrap Whenever You Can
187+
188+
The "new" datatracker uses Twitter Bootstrap for the UI.
189+
190+
Get familiar with <https://getbootstrap.com/getting-started/> and use
191+
those UI elements, CSS classes, etc. instead of cooking up your own.
192+
193+
Some ground rules:
194+
195+
- Think hard before tweaking the bootstrap CSS, it will make it harder
196+
to upgrade to future releases.
197+
- No `<style>` tags in the HTML! Put CSS into the "morecss" block of
198+
a template instead.
199+
- CSS that is used by multiple templates goes into static/css/ietf.css
200+
or a new CSS file.
201+
- Javascript that is only used on one template goes into the "js"
202+
block of that template.
203+
- Javascript that is used by multiple templates goes into
204+
static/js/ietf.js or a new js file.
205+
- Every template includes jquery, so write jquery code and not plain
206+
Javascript. It's shorter and often faster.
207+
- Avoid CSS, HTML styling or Javascript in the python code!
208+
209+
## Serving Static Files via CDN
210+
211+
### Production Mode
212+
213+
If resources served over a CDN and/or with a high max-age don't have
214+
different URLs for different versions, then any component upgrade which
215+
is accompanied by a change in template functionality will have a long
216+
transition time during which the new pages are served with old
217+
components, with possible breakage. We want to avoid this.
218+
219+
The intention is that after a release has been checked out, but before
220+
it is deployed, the standard django `collectstatic` management command
221+
will be run, resulting in all static files being collected from their
222+
working directory location and placed in an appropriate location for
223+
serving via CDN. This location will have the datatracker release version
224+
as part of its URL, so that after the deployment of a new release, the
225+
CDN will be forced to fetch the appropriate static files for that
226+
release.
227+
228+
An important part of this is to set up the `STATIC_ROOT` and
229+
`STATIC_URL` settings appropriately. In 6.4.0, the setting is as follows
230+
in production mode:
231+
232+
```
233+
STATIC_URL = "https://www.ietf.org/lib/dt/%s/"%__version__
234+
STATIC_ROOT = CDN_ROOT + "/a/www/www6s/lib/dt/%s/"%__version__
235+
```
236+
237+
The result is that all static files collected via the `collectstatic`
238+
command will be placed in a location served via CDN, with the release
239+
version being part of the URL.
240+
241+
### Development Mode
242+
243+
In development mode, `STATIC_URL` is set to `/static/`, and Django's
244+
`staticfiles` infrastructure makes the static files available under that
245+
local URL root (unless you set
246+
`settings.SERVE_CDN_FILES_LOCALLY_IN_DEV_MODE` to `False`). It is not
247+
necessary to actually populate the `static/` directory by running
248+
`collectstatic` in order for static files to be served when running
249+
`ietf/manage.py runserver` -- the `runserver` command has extra support
250+
for finding and serving static files without running collectstatic.
251+
252+
In order to work backwards from a file served in development mode to the
253+
location from which it is served, the mapping is as follows:
254+
255+
| Development URL | Working copy location |
256+
| --------------- | --------------------- |
257+
| localhost:8000/static/ietf/* | ietf/static/ietf/* |
258+
| localhost:8000/static/secr/* | ietf/secr/static/secr/*|
259+
260+
## Handling of External Javascript and CSS Components
261+
262+
In order to make it easy to keep track of and upgrade external
263+
components, these are now handled by a tool called `npm` via the
264+
configuration in `package.json`.
265+
266+
## Handling of Internal Static Files
267+
268+
Previous to this release, internal static files were located under
269+
`static/`, mixed together with the external components. They are now
270+
located under `ietf/static/ietf/` and `ietf/secr/static/secr`, and will
271+
be collected for serving via CDN by the `collectstatic` command. Any
272+
static files associated with a particular app will be handled the same
273+
way (which means that all `admin/` static files automatically will be
274+
handled correctly, too).
275+
276+
## Changes to Template Files
277+
278+
In order to make the template files refer to the correct versioned CDN
279+
URL (as given by the STATIC_URL root) all references to static files in
280+
the templates have been updated to use the `static` template tag when
281+
referring to static files. This will automatically result in both
282+
serving static files from the right place in development mode, and
283+
referring to the correct versioned URL in production mode and the
284+
simpler `/static/` URLs in development mode.
285+
286+
## Deployment
287+
288+
During deployment, it is now necessary to run the management command:
289+
290+
``` shell
291+
ietf/manage.py collectstatic
292+
````
293+
before activating a new release.

bin/mkrelease

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,6 @@ while true ; do
123123
shift
124124
done
125125

126-
# ----------------------------------------------------------------------
127-
# Check some requirements
128-
129-
check bower "It is required to update web resources. Install with npm."
130-
131126
# ----------------------------------------------------------------------
132127
# The program itself
133128

@@ -218,19 +213,15 @@ if [ -z "$PERMIT_MIGR_MIX" ]; then
218213
fi
219214

220215
if [ -z "$IGNORE_RESOURCES" ]; then
221-
note "Updating bower assets ..."
222-
$do ietf/manage.py bower_install > .mkrelease-bower-install.log
223-
$do rm .mkrelease-bower-install.log # This happens at once unless the previous command returns error
224-
$do svn st ietf/externals/static | grep -v '^\?' || true
225-
$do svn commit ietf/externals/static -m "Updated bower-managed static web assets"
226-
# Get rid of bower-installed files which we don't use:
227-
$do rm -rf ietf/externals/static/datatracker/
228-
$do rm -rf ietf/externals/static/jquery.cookie/
229-
$do rm -f $(svn st ietf/externals/ | grep '^\?' | awk '{print $2}')
216+
note "Updating assets ..."
217+
$do npm install > .mkrelease-npm-install.log
218+
$do rm .mkrelease-npm-install.log # This happens at once unless the previous command returns error
219+
$do npx parcel build > .mkrelease-parcel-build.log
220+
$do rm .mkrelease-parcel-build.log # This happens at once unless the previous command returns error
230221
fi
231222

232223
note "Collecting static files ..."
233-
$do ietf/manage.py collectstatic --noinput --ignore=bower.json --ignore='README.*' --ignore=rev | grep -v "Found another file with the destination path"
224+
$do ietf/manage.py collectstatic --noinput --ignore='README.*' --ignore=rev | grep -v "Found another file with the destination path"
234225
#$do svn commit static/lib/ -m "Updated static files under static/lib/"
235226

236227
# note "Checking that there's a recent test-crawler log"
@@ -344,5 +335,4 @@ cat ~/src/db/mail/release-mail-v$VER.txt | $do mail "${SEND_ARGS}" -s "New datat
344335

345336
# Removed at Henrik's suggestion
346337
#$do toolsfeed control changelog /www/tools.ietf.org/tools/atomfeed.xml
347-
#$do toolpush /www/tools.ietf.org/tools/atomfeed.xml
348-
338+
#$do toolpush /www/tools.ietf.org/tools/atomfeed.xml

bootstrap/.editorconfig

Lines changed: 0 additions & 14 deletions
This file was deleted.

bootstrap/.gitattributes

Lines changed: 0 additions & 15 deletions
This file was deleted.

bootstrap/.gitignore

Lines changed: 0 additions & 3 deletions
This file was deleted.

bootstrap/.travis.yml

Lines changed: 0 additions & 45 deletions
This file was deleted.

0 commit comments

Comments
 (0)