Skip to content

Commit

Permalink
improvment
Browse files Browse the repository at this point in the history
  • Loading branch information
golsch committed Jan 13, 2025
1 parent e2dd5b7 commit c005691
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 55 deletions.
8 changes: 4 additions & 4 deletions mir-module/src/main/js/src/common/modal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
* along with MyCoRe. If not, see <http://www.gnu.org/licenses/>.
*/

import $ from 'jquery';
import 'bootstrap';
// import $ from 'jquery';
// import 'bootstrap';

export abstract class MIRModalHandler {
private _isBusy = false;
Expand All @@ -28,7 +28,7 @@ export abstract class MIRModalHandler {
) {
this._modalDiv = modalDiv;
this.handleOpenModal = this.handleOpenModal.bind(this);
this.bindEvents();
this.bindBasicEvents();
}

protected get isBusy(): boolean {
Expand All @@ -43,7 +43,7 @@ export abstract class MIRModalHandler {
return this.modalDiv;
}

protected bindEvents(): void {
private bindBasicEvents(): void {
$(this._modalDiv).on('hide.bs.modal', this.handleClose);
$(this._modalDiv).on('show.bs.modal', this.handleOpenModal);
}
Expand Down
3 changes: 2 additions & 1 deletion mir-module/src/main/js/src/metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const createOrcidExportModalHandler = (accessToken: string): MIROrcidExportModal

let orcidExportModalHandlerInstance: MIROrcidExportModalHandler | null;;

const getOrcidExportModalHandlerInstance = async (): Promise<MIROrcidExportModalHandler> => {
const getOrcidExportModalHandlerInstance = async (): Promise<MIROrcidExportModalHandler > => {
if (!orcidExportModalHandlerInstance) {
const accessToken = await getAccessToken();
orcidExportModalHandlerInstance = createOrcidExportModalHandler(accessToken);
Expand Down Expand Up @@ -78,4 +78,5 @@ const initExportModal = async () => {
appendMenuButton();
}
};

document.addEventListener('DOMContentLoaded', initExportModal);
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export class MIROrcidExportModalHandler extends MIRModalHandler {
alertDiv: HTMLDivElement
) {
super(modalDiv);
console.log(exportBtn);
this._accessToken = accessToken;
this._orcidWorkService = orcidWorkService;
this._orcidUserService = orcidUserService;
Expand All @@ -60,8 +61,7 @@ export class MIROrcidExportModalHandler extends MIRModalHandler {
return this._objectId;
}

protected bindEvents(): void {
super.bindEvents();
private bindEvents(): void {
this._exportBtn.addEventListener('click', this.exportToOrcid);
this._orcidSelect.addEventListener('change', this.handleSelectChange);
}
Expand Down
5 changes: 4 additions & 1 deletion mir-module/src/main/js/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@ export default defineConfig({
build: {
rollupOptions: {
input: {
"user": 'src/user.ts',
// 'user': 'src/user.ts',
// 'result-list': 'src/result-list.ts'
'metadata': 'src/metadata.ts',
},
output: {
entryFileNames: '[name].js', // Jeder Entry Point bekommt eine eigene JavaScript-Datei
chunkFileNames: '[name].[hash].js', // Chunks werden mit Hashes benannt (falls vorhanden)
assetFileNames: '[name].[ext]', // Assets wie CSS, Bilder etc. bekommen ihren ursprünglichen Namen
dir: 'dist', // Alle Bundles werden im Verzeichnis 'dist' abgelegt
},
external: ['jquery', 'bootstrap'],
},
},
});
42 changes: 0 additions & 42 deletions mir-module/src/main/resources/META-INF/resources/js/mir/user.js

This file was deleted.

4 changes: 2 additions & 2 deletions mir-module/src/main/resources/xsl/metadata/mir-orcid.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
<xsl:if test="count($matchingTrustedIds) &gt; 0">
<xsl:call-template name="printExportToOrcidMenuItem"/>
<xsl:call-template name="printExportToOrcidModal"/>
<script type="module" src="{$WebApplicationBaseURL}js/mir/orcid/orcid-metadata.js"/>
<script type="module" src="{$WebApplicationBaseURL}js/mir/metadata.js"/>
</xsl:if>
</xsl:if>
</xsl:if>
Expand Down Expand Up @@ -110,4 +110,4 @@
</a>
</li>
</xsl:template>
</xsl:stylesheet>
</xsl:stylesheet>
4 changes: 1 addition & 3 deletions mir-module/src/main/resources/xsl/response-mir.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -264,9 +264,7 @@
</div>

</div>
<xsl:if test="$orcidIntegrationEnabled">
<script type="module" src="{$WebApplicationBaseURL}js/mir/orcid/orcid-response.js"/>
</xsl:if>
<script type="module" src="{$WebApplicationBaseURL}js/mir/result-list.js"/>
</xsl:template>

<xsl:template match="doc" priority="10" mode="resultList">
Expand Down

0 comments on commit c005691

Please sign in to comment.