Skip to content

Commit

Permalink
Release 0.9.2 (#171)
Browse files Browse the repository at this point in the history
* update language files

* fix closing modal after create concept

* fix scrolling in language dropdown

* update changelog

* fix concept search

* fix node dropdown show/hide

* add back delete functionality

Signed-off-by: Vinzenz Rosenkranz <vinzenz.rosenkranz@uni-tuebingen.de>
  • Loading branch information
v1r0x authored Nov 7, 2022
1 parent 427d700 commit 6222e2d
Show file tree
Hide file tree
Showing 11 changed files with 375 additions and 142 deletions.
34 changes: 34 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,40 @@
# Changelog
All notable changes to this project will be documented in this file.

## 0.9.2
### Fixed
- Updated language files
- Closing modal on adding concept
- Search did not work if no concept was selected
- Node dropdown not closed on outside click
- Added missing delete functionality

## 0.9.1
### Added
- Logo image
### Fixed
- Reload on node item click

## 0.9 - Isfahan
### Added
- Show badge what tree the selected concept is from
- Switch to make a concept a top level concept
- Show icon and info text if a concept has only one broader relation (and thus is not deletable)
### Fixed
### Changed
- Revamp Role Permission Configuration
- Add Presets to Derive Role Permission Set from
- Update Laravel to Version 9
- Update VueJS to Version 3
- Restructure Bootstrapping and Setup of App
- Restructure Layout of Preference Pages
- Replace most of Checkboxes with Switches
- Update Dependencies
- Bootstrap 5
- Multiselect (switched from [vue-multiselect](https://github.com/shentao/vue-multiselect) to [multiselect](https://github.com/vueform/multiselect))
- Modals (switched from [vue-js-modal](https://github.com/euvl/vue-js-modal) to [vue-final-modal](https://github.com/vue-final/vue-final-modal))
- Renamed eScience-Center to DH-Center

## 0.6.3
### Added
- Sorting of concepts in tree
Expand Down
21 changes: 13 additions & 8 deletions resources/js/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ export async function deleteLabel(id, tree, concept_id) {
updated_label: response.data,
});
handleConceptChange(concept_id, tree);
return response.data;
})
);
};
Expand All @@ -327,12 +328,13 @@ export async function deleteConcept(id, tree, action, actionParams) {
}
}
await $httpQueue.add(
() => http.delete(`/tree/concept/${id}?${urlParams}`).then(_ => {
// store.dispatch('deleteNote', {
// id: id,
// concept_id: concept_id,
// tree: tree,
// });
() => http.delete(`/tree/concept/${id}?t=${tree}&${urlParams}`).then(_ => {
store.dispatch('deleteConcept', {
id: id,
tree: tree,
action: action,
params: actionParams,
});
})
);
};
Expand All @@ -352,6 +354,7 @@ export async function addConcept(concept, tree, broader_id) {
tree: tree,
});
handleConceptChange(response.data.id, tree);
return response.data;
})
)
};
Expand Down Expand Up @@ -450,7 +453,9 @@ function handleConceptChange(conceptId, tree) {
sortTree(store.getters.conceptsFromTree(tree));
}
parents.forEach(p => {
const parentConcept = store.getters.conceptsFromMap(tree)[p.id];
sortTree(parentConcept.children);
const parentConcept = store.getters.conceptsFromMap(tree)[p];
if(!!parentConcept) {
sortTree(parentConcept.children);
}
});
}
248 changes: 165 additions & 83 deletions resources/js/bootstrap/store.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion resources/js/components/modals/concept/Create.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<button type="button" class="btn-close" aria-label="Close" data-bs-dismiss="modal" @click="closeModal()">
</button>
</div>
<div class="modal-body">
<div class="modal-body nonscrollable">
<form role="form" class="mb-2" id="create-concept-form" name="create-concept-form" @submit.prevent="onAdd()">
<div class="input-group">
<div class="input-group-prepend">
Expand Down
10 changes: 5 additions & 5 deletions resources/js/components/modals/concept/Delete.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
<p class="text-muted">
{{ t('modals.delete_concept.actions.cascade.description') }}
</p>
<!-- This action also deletes all descendants that have no other remaining relations. -->
</label>
</div>
<div class="form-check">
Expand All @@ -42,7 +41,6 @@
</span>
</div>
<p class="text-muted" v-html="t('modals.delete_concept.actions.level.description')" />
<!-- This action does not delete the descendants, but rather create a relation to <span class="fw-bold">all</span> broader concepts of the deleted concept. -->
</label>
</div>
<div class="form-check">
Expand All @@ -56,7 +54,6 @@
</span>
</div>
<p class="text-muted" v-html="t('modals.delete_concept.actions.top.description')" />
<!-- This action is similar to <span class="fst-italic">Delete level</span>, but instead of relating it's descendants to the deleted concept's broaders they <span class="fw-bold">all</span> become <span class="fst-italic">top level concepts</span>. -->
</label>
</div>
<div class="form-check">
Expand All @@ -69,7 +66,6 @@
</span>
</div>
<p class="text-muted mb-0" v-html="t('modals.delete_concept.actions.rerelate.description')" />
<!-- This action works similar to <span class="fst-italic">Delete level</span> and <span class="fst-italic">Delete top</span>, but instead allows to relate the descendants to another concept from the search. -->
</label>
<div v-if="state.action == 'rerelate'">
<hr class="my-2" />
Expand Down Expand Up @@ -160,7 +156,11 @@
};
const onConfirm = _ => {
state.show = false;
context.emit('confirm', state.concept);
context.emit('confirm', {
nid: state.concept.nid,
action: state.action,
params: state.params,
});
};
const handleConnect = e => {
if(!e.option) return;
Expand Down
17 changes: 7 additions & 10 deletions resources/js/components/tree/Node.vue
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
<template>
<div :ref="el => nodeRef = el" @dragenter="onDragEnter" @dragleave="onDragLeave"
:id="`${data.tree}-tree-node-${data.id}`" v-show="!data.is_placeholder">
:id="`${data.tree}-tree-node-${data.id}`" class="dropdown" v-show="!data.is_placeholder">
<a href="" :id="`${data.tree}-tree-node-cm-toggle-${data.id}`" @click.prevent @contextmenu.stop.prevent="togglePopup()"
class="text-body text-decoration-none disabled" data-bs-toggle="dropdown" data-bs-auto-close="true"
aria-expanded="false" :data-path="join(data.path)">
class="text-body text-decoration-none disabled" data-bs-toggle="dropdown" :data-path="join(data.path)">
<span :class="{'fw-bold': state.isSelected}">
{{ state.label }}
</span>
</a>
<ul class="dropdown-menu" :id="`${data.tree}-tree-node-${data.id}-contextmenu`" v-if="state.ddVisible">
<ul class="dropdown-menu" :id="`${data.tree}-tree-node-${data.id}-contextmenu`">
<li>
<h6 class="dropdown-header" @click.stop.prevent="" @dblclick.stop.prevent="">
{{ state.label }}
Expand Down Expand Up @@ -116,21 +115,18 @@
};
const hidePopup = _ => {
state.bsElem.hide();
state.bsElem.dispose();
state.bsElem = null;
state.ddVisible = false;
state.ddDomElem.classList.add('disabled');
};
const showPopup = _ => {
state.ddVisible = true;
nextTick(_ => {
// To prevent opening the dropdown on normal click on Node,
// the DD toggle must have class 'disabled'
// This also prevents BS API call .show() to work...
// Thus we remove the 'disabled' class before the API call and add it back afterwards
state.bsElem = new Dropdown(state.ddDomElem);
// Thus we remove the 'disabled' class before the API call and add it back on hide
state.ddDomElem.classList.remove('disabled');
state.bsElem.show();
state.ddDomElem.classList.add('disabled');
})
};
const togglePopup = _ => {
Expand Down Expand Up @@ -183,7 +179,7 @@
canDeleteBroader: computed(_ => state.hasBroaders && (state.concept.broaders.length >= 2 || state.isTopConcept)),
hasParent: computed(_ => !!state.parent),
parent: computed(_ => {
if(!nodeRef) return;
if(!nodeRef || !nodeRef.value.parentElement) return;
const path = nodeRef.value.parentElement.getAttribute('data-path').split(',');
// pop element itself, because we want parent node
Expand Down Expand Up @@ -213,6 +209,7 @@
state.ddDomElem.addEventListener('hidden.bs.dropdown', _ => {
hidePopup();
});
state.bsElem = new Dropdown(state.ddDomElem);
});
// RETURN
Expand Down
2 changes: 1 addition & 1 deletion resources/js/components/tree/Search.vue
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@
state.query = '';
state.entry = {};
if(!context.attrs.onSelect) {
gotoConcept(option.id);
gotoConcept(option.id, treeName.value);
} else if(option) {
context.emit('select', {
option: option
Expand Down
5 changes: 3 additions & 2 deletions resources/js/helpers/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -349,12 +349,13 @@ export function languageList() {
return list;
};

export function gotoConcept(id) {
export function gotoConcept(id, tree = null) {
const query = tree ? {...router.currentRoute.value.query, t: tree} : router.currentRoute.value.query;
router.push({
name: 'conceptdetail',
params: {
id: id
},
query: router.currentRoute.value.query,
query: query,
});
}
12 changes: 6 additions & 6 deletions resources/js/helpers/modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
addLanguage,
deleteLanguage,
addConcept,
deleteConcept,
} from '@/api.js';

import {
Expand Down Expand Up @@ -292,13 +293,12 @@ export function showDeleteConcept(tree, conceptId) {
conceptId: conceptId,
},
on: {
confirm(_) {
// if(!can('thesaurus_create')) return;
confirm(e) {
if(!can('thesaurus_delete')) return;

// addConcept(concept, tree, pid).then(_ => {
// store.getters.vfm.hide(uid);
// });
store.getters.vfm.hide(uid);
deleteConcept(e.nid, tree, e.action, e.params).then(_ => {
store.getters.vfm.hide(uid);
});
},
cancel(e) {
store.getters.vfm.hide(uid);
Expand Down
2 changes: 1 addition & 1 deletion resources/js/i18n/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
"placeholder": "Baum nach Konzept durchsuchen",
"empty_term_info": "Gib einen Suchbegriff ein um den Baum zu durchsuchen",
"no_results": "Keine Suchergebnisse für den Begriff <span class=\"fst-italic fw-bold\">{term}</span>",
"is_top_level": "Top-Level Concept"
"is_top_level": "Top-Level-Konzept"
},
"import": {
"label": "RDF importieren",
Expand Down
Loading

0 comments on commit 6222e2d

Please sign in to comment.