Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 3.2 #105

Merged
merged 44 commits into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
3952cee
feature: new Vue 3 based list-view
tymees Aug 16, 2023
5ddf522
feature: setup Vue-i18n if loaded as a global
tymees Oct 19, 2023
87a035a
feature: provide global versions of Vue and Vue-i18n
tymees Oct 19, 2023
3c51435
chore: add missing dependency
tymees Oct 20, 2023
b70a010
feature: UU-Bootstrap 1.5.0-alpha.0
tymees Oct 20, 2023
5271454
feature: New cat!
tymees Oct 20, 2023
d06eb7b
feature: saver thread-local storage
tymees Oct 20, 2023
e03f246
chore: deprecate file_loading utils
tymees Oct 20, 2023
1040fc4
feature: use Django media to load in widget dependencies
tymees Oct 20, 2023
4650693
Merge branch 'develop' into feature/uu-list
tymees Oct 20, 2023
0854871
fix: use the DjangoJSONEnconder as base
tymees Oct 20, 2023
3b14659
chore: use cdh-vue-lib 0.2.2
tymees Oct 20, 2023
f3dd309
fix: ordering was always set to default
tymees Oct 20, 2023
8b3c007
feature: fake form field for headers etc
tymees Oct 23, 2023
4466820
fix: From -> Form typo
tymees Oct 23, 2023
4c622ee
docs: added HTML injection warning
tymees Oct 23, 2023
f1b3c1a
Merge pull request #90 from DH-IT-Portal-Development/feature/fake-for…
tymees Oct 23, 2023
5865efa
fix: custom date(time) fields were not using ISO formatting
tymees Oct 23, 2023
4cfb0fd
Merge pull request #92 from CentreForDigitalHumanities/docs/update-re…
tymees Oct 24, 2023
8a11768
chore: update cdh-vue-lib to 0.3.1
tymees Nov 20, 2023
d53b7d6
feat: added custom DSC list example
tymees Nov 20, 2023
89d20a5
Merge branch 'develop' into feature/uu-list
tymees Nov 20, 2023
47b471b
Merge pull request #89 from CentreForDigitalHumanities/feature/uu-list
tymees Nov 20, 2023
81c076d
feat: added Django 5 support
tymees Nov 20, 2023
5c4e9a5
Merge pull request #93 from CentreForDigitalHumanities/support/django-5
tymees Nov 20, 2023
3b19d5d
Upped package version
tymees Nov 20, 2023
1cc2c2f
feat: added select2 widget
tymees Dec 7, 2023
f013dda
deps: update to uu bootstrap 1.5 alpha 1
tymees Dec 7, 2023
8831dea
Merge pull request #95 from CentreForDigitalHumanities/feature/js-sea…
tymees Dec 7, 2023
07ecf50
fix: remove broken experiment
tymees Jan 2, 2024
f3dfe3c
use window.jQuery instead of window.$ to avoid clashes
bbonf Apr 4, 2024
b5d7e79
fix: use new mixin name for LogoutInitView
tymees Apr 4, 2024
40d30d3
docs: upped the minimum required versions to 2024 standards
tymees Apr 4, 2024
9c56f9d
Merge pull request #99 from CentreForDigitalHumanities/fix/jquery-dollar
bbonf Apr 9, 2024
a326f5e
feat: new (semi) stand-alone mail app
tymees Apr 9, 2024
51de62c
chore: mark cdh.core.mail as deprecated
tymees Apr 9, 2024
26bb7aa
Merge remote-tracking branch 'origin/develop' into develop
tymees Apr 9, 2024
0ce5c6b
fix: added missing template
tymees Apr 9, 2024
7dd75d9
feat: new custom date-inputs in NL format
tymees Apr 25, 2024
b43c065
refactor: remove old datepicker library
tymees Apr 25, 2024
b73c97c
fix: show form feedback for SearchableSelectWidget
tymees Jul 30, 2024
7aab132
fix: make sure select2 uses the width it has
tymees Jul 30, 2024
74a3b3a
chore: bump versions
tymees Jul 30, 2024
1397a7e
Merge pull request #104 from CentreForDigitalHumanities/develop
tymees Jul 30, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/django-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
strategy:
max-parallel: 2
matrix:
python-version: ['3.9', '3.10']
python-version: ['3.11']
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason tests don't all suported Python versions named in README.md?

I can imagine it eats up lots of runner minutes.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Testing is now done using Django 5, which does not support Python 3.9;

At some point I had multiple requirements.txt per Django version, which would allow proper testing of all version combinations, but that was a lot of (annoying) upkeep.


steps:
- uses: actions/checkout@v2
Expand Down
6 changes: 6 additions & 0 deletions .sassrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"includePaths": [
".",
"assets/scss/"
]
}
35 changes: 23 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ A collection of Django apps for CDH Django projects. Developed by the
Documentation provided here: https://centrefordigitalhumanities.github.io/django-shared-core/

## Currently targeting:
- Python 3.9
- Python 3.10
- Django 4.0
- Python 3.9 (Django 4 only)
- Python 3.11
- Django 4.2
- Django 5.0

Tests are run using these versions; Some apps have lower requirements, but are
not tested against these lower versions. check the app collection below for
Expand All @@ -23,7 +24,7 @@ Add the following line to your python requirements:

``cdh-django-core[all] @ git+https://github.com/CentreForDigitalHumanities/django-shared-core.git@<version>``

Replacing ``<version>`` with the latest DSC release tag. (e.g. ``v3.1.0``).
Replacing ``<version>`` with the latest DSC release tag. (e.g. ``v3.2.0``).

This will install the entire library with all required dependencies.

Expand All @@ -46,14 +47,14 @@ the apps your project uses (sans ``cdh.``). For example:
Base block for pure-Django projects, containing base templates, generic views,
extra form/model fields and other miscellaneous code.

Requires Django >= 4;
Requires Django >= 4.2;

### Federated authentication (``cdh.federated_auth``)

Helper app to connect a Django application as a Service Provider to a Federated
Authentication realm. Currently only supports SAML.

Requires Django >= 2;
Requires Django >= 4.2;

### Files (``cdh.files``)

Expand All @@ -63,14 +64,24 @@ allows arbitrary metadata to be added and most-importantly makes sysadmins
happy.

Soft requirement on ``cdh.core``, can work standalone if needed.
Required Django >= 4.
Required Django >= 4.2.

### Integration platform (``cdh.integration_platform``)

Ready-to-use API clients for the UU's integration platform.

Requires ``cdh.rest``;
Requires Django >= 3;
Requires Django >= 4.2.

### Mail (``cdh.mail``)

Helper app to send emails with Django, both in-code and as user defined/written. Supports generating plain/html
emails from templates without having to define separate templates for each.

Replaces `cdh.core.mail`.

Requires Django >= 4.2.
Soft-requires `cdh.core`, when using the mail-editor widget.

### Rest (``cdh.rest``)

Expand All @@ -80,14 +91,14 @@ JWT authentication support and other helpfull snippits.
Client code contains a full Django-ORM inspired REST client, for easy
(de)serialization and transactions with REST APIs.

Requires Django >= 3;
Requires Django >= 4.2;

### System messages (``cdh.systemmessages``)

Simple app to quickly add a 'system message' system to your app, useful for
temporary announcements.

Requires Django >= 2;
Requires Django >= 4.2;

### Vue (``cdh.vue``)

Expand All @@ -96,14 +107,14 @@ Requires Django >= 2;
Helper app to (more) easily integrate small(-ish) Vue 2 components in your Django
templates.

Requires Django >= 3;
Requires Django >= 4.2;

### Vue 3 (``cdh.vue3``)

Helper app to (more) easily integrate small(-ish) Vue 3 components in your Django
templates.

Requires Django >= 2;
Requires Django >= 4.2;

# Included libraries
These libraries have been completely integrated into this codebase
Expand Down
4 changes: 4 additions & 0 deletions assets/scss/bootstrap.scss
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,8 @@ $open-sans-font-dir: '/static/cdh.core/fonts/open-sans/';
& ~ .invalid-feedback, & ~ .valid-feedback {
display: block;
}
}

.select2 ~ .invalid-feedback, .select2 ~ .valid-feedback {
display: block;
}
4 changes: 4 additions & 0 deletions assets/scss/vanillajs-datepicker.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

@import "node_modules/uu-bootstrap/scss/configuration";

@import "node_modules/vanillajs-datepicker/sass/datepicker-bs5";
47 changes: 47 additions & 0 deletions assets/vue/example-custom-uu-list/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"root": true,
"extends": [
"eslint:recommended",
"plugin:vue/vue3-recommended",
"plugin:@typescript-eslint/recommended",
"prettier"
],
"parserOptions": {
"ecmaVersion": "latest",
"parser": "@typescript-eslint/parser",
"sourceType": "module",
"extraFileExtensions": [".vue"]
},
"overrides": [
{
"files": ["*.ts"],

"parserOptions": {
"project": ["./tsconfig.json"] // Specify it only for TypeScript files
}
}
],
"plugins": [
"vue",
"@typescript-eslint"
],
"rules": {
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-inferrable-types": "off",
"vue/html-self-closing": ["error", {
"html": {
"void": "any",
"normal": "always",
"component": "always"
},
"svg": "always",
"math": "always"
}],
"@typescript-eslint/no-unused-vars": ["warn", {
"varsIgnorePattern": "(props)|(emits?)|_"
}],
"vue/require-v-for-key": "warn",
"vue/no-v-model-argument": "off" // NO idea why this rule exists
},
"ignorePatterns": ["**/*.test.ts", "dist/*", "node_modules/*"]
}
15 changes: 15 additions & 0 deletions assets/vue/example-custom-uu-list/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.sass-cache/
*.css.map
*.sass.map
*.scss.map
!dist/css/*.css.map

node_modules
vite.config.d.ts
*.log*
.cache
.output
.env
generated

.idea
13 changes: 13 additions & 0 deletions assets/vue/example-custom-uu-list/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Custom UU-List example

An example of a custom DSCList-based UU-List. You can copy this folder
as a basis.

## Use as a template:

1. Copy the contents of this dir to a folder in your project
2. Install deps (yarn install)
3. Update cdh-vue-lib to latest release using yarn
4. Rename `CustomList.vue` to a more descriptive name, and update the `index.ts` import
5. Change the indicated values in `vite.config.ts`; use the name you used for the file above
6. Go make your own implementation!
22 changes: 22 additions & 0 deletions assets/vue/example-custom-uu-list/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "uu-list",
"version": "1.0.0",
"author": "Humanities IT Portal development",
"license": "Apache-2.0",
"scripts": {
"dev": "vite dev",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you give me a quick rundown of how you develop a component that uses whole stack at once? Is it just running the Django test project with both Vite and sass watching for changes in the background?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, sort off. Writing a Vue component just involves running yarn dev (and the dev-app), and a lot of 'full-refreshing'.

The dev command starts a watcher that compiles everything configured in the vite.config.ts (in this case src/index.ts, which is just a small set of imports/exports) into the configured output dir (the static-dir of the django app).
Any component or imported (S)CSS is compiled by Vite as well, so no extra command needed for that.

However, that's only for the Vue components. If you want to build any of the 'root stylesheets' shipped in the library (read: the full UU-bootstrap project + django specific additions), you'll need the build-css, watch-css and build-fedauth-css commands in the root package.json.
(The last one is a very minimal build of the UU-Bootstrap with only a small subset of the whole thing, to 1) have an independent build for the fed-auth app and 2) keep that build as small as possible).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cheers!

"build": "vite build",
"preview": "vite preview"
},
"dependencies": {
"@intlify/unplugin-vue-i18n": "^1.5.0",
"cdh-vue-lib": "git+https://github.com/CentreForDigitalHumanities/Vue-lib.git#v0.3.2",
"vue-i18n": "9"
},
"devDependencies": {
"@vitejs/plugin-vue": "^4.3.4",
"typescript": "^5.2.2",
"vite": "^4.4.9",
"vue": "^3.3.4"
}
}
87 changes: 87 additions & 0 deletions assets/vue/example-custom-uu-list/src/CustomList.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
<script setup>
import {DSCList} from "cdh-vue-lib/components";
import {useI18n} from "vue-i18n";

// Required stuff
const props = defineProps(['config']);

const {t} = useI18n()

// Demo stuff
function statusColor(status) {
switch (status) {
case "C":
return "green"

case "R":
return "orange"

case "O":
return "red"

default:
return ""
}
}
</script>

<!-- Here you can define your translations. Please remember to use `t` in your template instead of `$t` -->
<i18n>
{
"en": {
"name": "Name",
"refnum": "Reference Number",
"status": "Status"
},
"nl": {
"name": "Naam",
"refnum": "Referentie Nummer",
"status": "Status"
}
}
</i18n>

<template>
<!-- Required stuff -->
<DSCList :config="config">
<template #data="{data, isLoading}">
<!-- Custom stuff -->
<!-- Add your table here -->
<div>
<div v-if="isLoading">
<!-- Show a 'loading' message if data is being loaded -->
Loading...
</div>
<table class="table" v-else>
<thead>
<tr>
<th>
{{ t('name') }}
</th>
<th>
{{ t('refnum') }}
</th>
<th>
{{ t('status') }}
</th>
</tr>
</thead>
<tbody>
<tr v-for="datum in data">
<td>
{{ datum.project_name }}
</td>
<td>
{{ datum.reference_number }}
</td>
<td :class="`text-bg-${statusColor(datum.status)}`">
{{ datum.get_status_display }}
</td>
</tr>
</tbody>
</table>
</div>
<!-- end custom stuff, begin required stuff -->
</template>
</DSCList>
</template>
4 changes: 4 additions & 0 deletions assets/vue/example-custom-uu-list/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import CustomList from "./CustomList.vue";
import "cdh-vue-lib/dist/style.css"

export default CustomList;
44 changes: 44 additions & 0 deletions assets/vue/example-custom-uu-list/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"compilerOptions": {
"target": "esnext",
"module": "esnext",
"strict": true,
"jsx": "preserve",
"moduleResolution": "node",
"declaration": true,
"outDir": "dist",
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"forceConsistentCasingInFileNames": true,
"useDefineForClassFields": true,
"resolveJsonModule": true,
"sourceMap": true,
"baseUrl": ".",
"typeRoots": [
"src/stubs.d.ts"
],
"paths": {
"@/*": [
"./src/*"
]
},
"lib": [
"esnext",
"dom",
"dom.iterable",
"scripthost"
]
},
"include": [
"src/**/*.ts",
"src/**/*.tsx",
"src/**/*.vue",
"tests/**/*.ts",
"tests/**/*.tsx"
],
"exclude": [
"node_modules",
"vite.config.ts"
]
}
Loading
Loading