Skip to content

Commit

Permalink
Merge pull request #105 from CentreForDigitalHumanities/staging
Browse files Browse the repository at this point in the history
Release 3.2
  • Loading branch information
tymees authored Sep 3, 2024
2 parents 18c2105 + 1397a7e commit 4525a60
Show file tree
Hide file tree
Showing 107 changed files with 37,240 additions and 2,407 deletions.
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']

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",
"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

0 comments on commit 4525a60

Please sign in to comment.