diff --git a/app/assets/javascripts/repositories/repository_datatable.js b/app/assets/javascripts/repositories/repository_datatable.js index cc6ef6a23..d45953006 100644 --- a/app/assets/javascripts/repositories/repository_datatable.js +++ b/app/assets/javascripts/repositories/repository_datatable.js @@ -430,6 +430,13 @@ var RepositoryDatatable = (function(global) { }); } + function addRepositorySearch() { + $(`
+ +
`).appendTo('.repository-search-container'); + initRepositorySearch(); + } + function dataTableInit() { TABLE = $(TABLE_ID).DataTable({ dom: "R<'repository-toolbar hidden'<'repository-search-container'f>>t<'pagination-row hidden'<'pagination-info'li><'pagination-actions'p>>", @@ -643,8 +650,8 @@ var RepositoryDatatable = (function(global) { initBSTooltips(); DataTableHelpers.initLengthAppearance($(TABLE_ID).closest('.dataTables_wrapper')); - $('').appendTo($('.search-container')); - + $('.dataTables_filter').addClass('hidden'); + addRepositorySearch(); if ($('.repository-show').length) { $('.dataTables_scrollBody, .dataTables_scrollHead').css('overflow', ''); } diff --git a/app/assets/stylesheets/shared_styles/elements/buttons.scss b/app/assets/stylesheets/shared_styles/elements/buttons.scss index fb31a9346..52431aee7 100644 --- a/app/assets/stylesheets/shared_styles/elements/buttons.scss +++ b/app/assets/stylesheets/shared_styles/elements/buttons.scss @@ -186,6 +186,10 @@ .fas { margin: 0; } + + img { + margin: 0; + } } &.btn-large { diff --git a/app/controllers/navigator/base_controller.rb b/app/controllers/navigator/base_controller.rb index 241b385e1..836806c79 100644 --- a/app/controllers/navigator/base_controller.rb +++ b/app/controllers/navigator/base_controller.rb @@ -71,7 +71,7 @@ module Navigator end current_team.projects .where(project_folder_id: folder) - .viewable_by_user(current_user, current_team) + .visible_to(current_user, current_team) .with_children_viewable_by_user(current_user) .where(' projects.archived = :archived OR diff --git a/app/javascript/packs/vue/repository_search.js b/app/javascript/packs/vue/repository_search.js new file mode 100644 index 000000000..14eb2a225 --- /dev/null +++ b/app/javascript/packs/vue/repository_search.js @@ -0,0 +1,16 @@ +import TurbolinksAdapter from 'vue-turbolinks'; +import Vue from 'vue/dist/vue.esm'; +import RepositorySearchContainer from '../../vue/repository_search/container.vue'; + +Vue.use(TurbolinksAdapter); +Vue.prototype.i18n = window.I18n; + +window.initRepositorySearch = () => { + window.RepositorySearchComponent = new Vue({ + el: '#inventorySearchComponent', + name: 'RepositorySearchComponent', + components: { + 'repository_search_container': RepositorySearchContainer + } + }); +} diff --git a/app/javascript/vue/repository_search/container.vue b/app/javascript/vue/repository_search/container.vue new file mode 100644 index 000000000..a81c8c730 --- /dev/null +++ b/app/javascript/vue/repository_search/container.vue @@ -0,0 +1,104 @@ + + + diff --git a/app/views/repositories/show.html.erb b/app/views/repositories/show.html.erb index 0cb40f533..83ba8f7d7 100644 --- a/app/views/repositories/show.html.erb +++ b/app/views/repositories/show.html.erb @@ -89,6 +89,7 @@ <%= render partial: 'save_repository_filter_modal' %> <% end %> +<%= javascript_include_tag 'vue_repository_search' %> <%= javascript_include_tag 'repositories/edit' %> <%= javascript_include_tag 'repositories/repository_datatable' %> <%= javascript_include_tag "repositories/show" %> diff --git a/config/locales/en.yml b/config/locales/en.yml index ac8e78365..ceae4c5d6 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1735,6 +1735,7 @@ en: archived_on: "Inventory archived on" archived_by: "by" filter_inventory_items: "Filter items" + filter_inventory_items_with_ean: "Search with EAN code" no_items: "No items here" no_items_matched: "No items here" no_archived_items: "No archived items here" diff --git a/config/webpack/webpack.config.js b/config/webpack/webpack.config.js index 804d18195..323d18830 100644 --- a/config/webpack/webpack.config.js +++ b/config/webpack/webpack.config.js @@ -30,6 +30,7 @@ const entryList = { vue_label_template: './app/javascript/packs/vue/label_template.js', vue_protocol: './app/javascript/packs/vue/protocol.js', vue_repository_filter: './app/javascript/packs/vue/repository_filter.js', + vue_repository_search: './app/javascript/packs/vue/repository_search.js', vue_repository_print_modal: './app/javascript/packs/vue/repository_print_modal.js', vue_navigation_top_menu: './app/javascript/packs/vue/navigation/top_menu.js', vue_navigation_navigator: './app/javascript/packs/vue/navigation/navigator.js',