Bugzilla – Attachment 149179 Details for
Bug 33066
We need a KohaTable Vue component
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33066: Use KohaTable for EHoldingsEBSCOPackageTitlesList
Bug-33066-Use-KohaTable-for-EHoldingsEBSCOPackageT.patch (text/plain), 11.37 KB, created by
Jonathan Druart
on 2023-04-05 07:22:57 UTC
(
hide
)
Description:
Bug 33066: Use KohaTable for EHoldingsEBSCOPackageTitlesList
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2023-04-05 07:22:57 UTC
Size:
11.37 KB
patch
obsolete
>From 90b6a04408e75581940d8cafb13c6c796faf2e61 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 17 Mar 2023 14:39:51 +0100 >Subject: [PATCH] Bug 33066: Use KohaTable for EHoldingsEBSCOPackageTitlesList >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com> > >Signed-off-by: AgustÃn Moyano <agustinmoyano@theke.io> >--- > .../ERM/EHoldingsEBSCOPackageTitlesList.vue | 213 ++++++++---------- > 1 file changed, 92 insertions(+), 121 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsEBSCOPackageTitlesList.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsEBSCOPackageTitlesList.vue >index 99b3060086a..c14992ddd4b 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsEBSCOPackageTitlesList.vue >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsEBSCOPackageTitlesList.vue >@@ -55,14 +55,15 @@ > /> > </fieldset> > </div> >- <table :id="table_id"></table> >+ <KohaTable ref="table" v-bind="tableOptions" @show="doShow"></KohaTable> > </div> > </template> > > <script> >-import { inject, createVNode, render } from "vue" >+import { inject, ref, reactive } from "vue" > import { storeToRefs } from "pinia" > import { useDataTable } from "../../composables/datatables" >+import KohaTable from "../KohaTable.vue" > > export default { > setup() { >@@ -70,160 +71,130 @@ export default { > const { av_title_publication_types } = storeToRefs(AVStore) > const { get_lib_from_av, map_av_dt_filter } = AVStore > >- const table_id = "title_list" >- useDataTable(table_id) >+ const table = ref() >+ const filters = reactive({ >+ publication_title: "", >+ publication_type: "", >+ selection_type: "", >+ }) > > return { > av_title_publication_types, > get_lib_from_av, >+ escape_str, > map_av_dt_filter, >- table_id, >+ table, > } > }, > data() { >+ this.filters = { >+ publication_title: this.$route.query.publication_title || "", >+ publication_type: this.$route.query.publication_type || "", >+ selection_type: this.$route.query.selection_type || "", >+ } >+ let filters = this.filters > return { >- filters: { >- publication_title: "", >- publication_type: "", >- selection_type: "", >+ tableOptions: { >+ columns: this.getTableColumns(), >+ url: >+ "/api/v1/erm/eholdings/ebsco/packages/" + >+ this.package_id + >+ "/resources", >+ options: { >+ embed: "title", >+ ordering: false, >+ dom: '<"top pager"<"table_entries"ilp>>tr<"bottom pager"ip>', >+ aLengthMenu: [ >+ [10, 20, 50, 100], >+ [10, 20, 50, 100], >+ ], >+ }, >+ filters_options: { >+ 1: () => >+ this.map_av_dt_filter("av_title_publication_types"), >+ }, >+ actions: { 0: ["show"] }, >+ default_filters: { >+ publication_title: function () { >+ return filters.publication_title || "" >+ }, >+ publication_type: function () { >+ return filters.publication_type || "" >+ }, >+ selection_type: function () { >+ return filters.selection_type || "" >+ }, >+ }, > }, > display_filters: false, > } > }, > methods: { >- show_resource: function (resource_id) { >+ doShow: function (resource, dt, event) { >+ event.preventDefault() > this.$router.push( >- "/cgi-bin/koha/erm/eholdings/ebsco/resources/" + resource_id >+ "/cgi-bin/koha/erm/eholdings/ebsco/resources/" + >+ resource.resource_id > ) > }, > filter_table: function () { >- $("#" + this.table_id) >- .DataTable() >- .draw() >+ this.$refs.table.redraw( >+ "/api/v1/erm/eholdings/ebsco/packages/" + >+ this.package_id + >+ "/resources" >+ ) > }, > toggle_filters: function (e) { > this.display_filters = !this.display_filters > }, >- build_datatable: function () { >- let show_resource = this.show_resource >- let package_id = this.package_id >+ getTableColumns: function () { > let get_lib_from_av = this.get_lib_from_av > let map_av_dt_filter = this.map_av_dt_filter >- let filters = this.filters >- let table_id = this.table_id >- >- window["av_title_publication_types"] = map_av_dt_filter( >- "av_title_publication_types" >- ) > >- let additional_filters = { >- publication_title: function () { >- return filters.publication_title || "" >- }, >- publication_type: function () { >- return filters.publication_type || "" >- }, >- selection_type: function () { >- return filters.selection_type || "" >- }, >- } >- >- $("#" + table_id).kohaTable( >+ return [ > { >- ajax: { >- url: >- "/api/v1/erm/eholdings/ebsco/packages/" + >- package_id + >- "/resources", >+ title: __("Name"), >+ data: "title.publication_title", >+ searchable: false, >+ orderable: false, >+ render: function (data, type, row, meta) { >+ let node = >+ '<a href="/cgi-bin/koha/erm/eholdings/ebsco/resources/' + >+ row.resource_id + >+ '" class="show">' + >+ escape_str(`${row.title.publication_title}`) + >+ "</a>" >+ if (row.is_selected) { >+ node += >+ " " + >+ '<i class="fa fa-check-square-o" style="color: green; float: right;" title="' + >+ __("Is selected") + >+ '" />' >+ } >+ return node > }, >- ordering: false, >- dom: '<"top pager"<"table_entries"ilp>>tr<"bottom pager"ip>', >- aLengthMenu: [ >- [10, 20, 50, 100], >- [10, 20, 50, 100], >- ], >- embed: ["title"], >- autoWidth: false, >- columns: [ >- { >- title: __("Name"), >- data: "title.publication_title", >- searchable: false, >- orderable: false, >- render: function (data, type, row, meta) { >- // Rendering done in drawCallback >- return "" >- }, >- }, >- { >- title: __("Publication type"), >- data: "title.publication_type", >- searchable: false, >- orderable: false, >- render: function (data, type, row, meta) { >- return escape_str( >- get_lib_from_av( >- "av_title_publication_types", >- row.title.publication_type >- ) >- ) >- }, >- }, >- ], >- drawCallback: function (settings) { >- var api = new $.fn.dataTable.Api(settings) >- >- $.each( >- $(this).find("tbody tr td:first-child"), >- function (index, e) { >- let tr = $(this).parent() >- let row = api.row(tr).data() >- if (!row) return // Happen if the table is empty >- let n = createVNode( >- "a", >- { >- role: "button", >- href: >- "/cgi-bin/koha/erm/eholdings/ebsco/resources/" + >- row.resource_id, >- onClick: e => { >- e.preventDefault() >- show_resource(row.resource_id) >- }, >- }, >- `${row.title.publication_title}` >- ) >- if (row.is_selected) { >- n = createVNode("span", {}, [ >- n, >- " ", >- createVNode("i", { >- class: "fa fa-check-square-o", >- style: { >- color: "green", >- float: "right", >- }, >- title: __("Is selected"), >- }), >- ]) >- } >- render(n, e) >- } >+ }, >+ { >+ title: __("Publication type"), >+ data: "title.publication_type", >+ searchable: false, >+ orderable: false, >+ render: function (data, type, row, meta) { >+ return escape_str( >+ get_lib_from_av( >+ "av_title_publication_types", >+ row.title.publication_type >+ ) > ) > }, > }, >- null, >- 0, >- additional_filters >- ) >+ ] > }, > }, >- mounted() { >- this.build_datatable() >- }, > props: { > package_id: String, > }, >+ components: { KohaTable }, > name: "EHoldingsEBSCOPackageTitlesList", > } > </script> >-- >2.25.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 33066
:
147352
|
147353
|
147354
|
147692
|
147693
|
147694
|
147713
|
147846
|
147847
|
147848
|
147849
|
147850
|
147851
|
147852
|
147853
|
147855
|
147856
|
147857
|
147858
|
147862
|
147865
|
147902
|
147903
|
147904
|
147905
|
147906
|
147907
|
147908
|
147909
|
147910
|
147911
|
147912
|
147913
|
147914
|
147915
|
147916
|
147917
|
147918
|
147921
|
147922
|
147923
|
147925
|
147926
|
147928
|
147957
|
147960
|
147971
|
147972
|
148718
|
149158
|
149159
|
149160
|
149161
|
149162
|
149163
|
149164
|
149165
|
149166
|
149167
|
149168
|
149169
|
149170
|
149171
|
149172
|
149173
|
149174
|
149175
|
149176
|
149177
|
149178
| 149179 |
149180
|
149181
|
149182
|
149183