Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into questions
Browse files Browse the repository at this point in the history
  • Loading branch information
miggol committed Feb 14, 2024
2 parents c9ffb92 + 07ecf50 commit 9c12658
Show file tree
Hide file tree
Showing 73 changed files with 32,064 additions and 228 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/"
]
}
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
# CDH Django libraries

A collection of Django apps for CDH/DH-IT Django projects. Developed by the
A collection of Django apps for CDH Django projects. Developed by the
[ILS Labs](https://github.com/UiL-OTS-labs) and the
[DH-IT Faculty Portal Development and Support Team](https://github.com/DH-IT-Portal-Development/django-shared-core)
[Humanities IT Portal Development and Support Team](https://github.com/orgs/CentreForDigitalHumanities/teams/portal-development)

Documentation provided here: https://dh-it-portal-development.github.io/django-shared-core/
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.0-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 @@ -21,7 +22,7 @@ specifics.

Add the following line to your python requirements:

``cdh-django-core[all] @ git+https://github.com/DH-IT-Portal-Development/django-shared-core.git@<version>``
``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``).

Expand All @@ -36,7 +37,7 @@ The library can be installed with a reduced dependency set for the apps your
project uses. To do this, replace the ``all`` with a comma-separated list of
the apps your project uses (sans ``cdh.``). For example:

``cdh-django-core[core,files,rest] @ git+https://github.com/DH-IT-Portal-Development/django-shared-core.git@[version]``
``cdh-django-core[core,files,rest] @ git+https://github.com/CentreForDigitalHumanities/django-shared-core.git@[version]``


## App collection
Expand Down
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"
]
}
48 changes: 48 additions & 0 deletions assets/vue/example-custom-uu-list/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import {defineConfig} from "vite";
import {resolve} from "path";
import vue from "@vitejs/plugin-vue";
import VueI18nPlugin from "@intlify/unplugin-vue-i18n/vite";

// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue(), VueI18nPlugin({})],
base: '/static/',
build: {
minify: false,
outDir: "../../../dev/dev_vue/static/dev_vue/example-custom-uu-list/", // TODO: change this to your desired static dir
emptyOutDir: true,
lib: {
// src/index.ts is where we have exported the component(s)
entry: resolve(__dirname, "src/index.ts"),
name: "CustomList", // TODO: CHANGE THIS FOR YOUR OWN COMPONENT
// the name of the output files when the build is run
fileName: "CustomList",// TODO: CHANGE THIS FOR YOUR OWN COMPONENT
formats: ['iife']
},
rollupOptions: {
// make sure to externalize deps that shouldn't be bundled
// into your library
external: ["vue", "vue-i18n"],
output: {
// Provide global variables to use in the UMD build
// for externalized deps
globals: {
vue: "Vue",
'vue-i18n': "VueI18n",
},
chunkFileNames: undefined,
},
},
},
resolve: {
alias: {
"@": resolve(__dirname, "./src"),
},
},
optimizeDeps: {
include: ['src/**/*.vue', 'src/index.ts'],
},
define: {
'process.env': {}
}
});
Loading

0 comments on commit 9c12658

Please sign in to comment.