displayed attachments, added attachments filter to material admin view

This commit is contained in:
Bachir Soussi Chiadmi 2021-01-25 16:15:03 +01:00
parent 5d4c1d5449
commit 8945034b21
12 changed files with 390 additions and 57 deletions

View File

@ -79,6 +79,7 @@
"drupal/ultimate_cron": "^2.x-dev",
"drupal/url_to_video_filter": "^2.0",
"drupal/views_conditional": "^1.x-dev",
"drupal/views_ef_fieldset": "^1.5",
"drush/drush": "^9",
"kint-php/kint": "^3.3",
"symfony/event-dispatcher": "4.3.4 as 3.4.99",

32
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "18823c92aa8ab02c87f03c1d766c7d7a",
"content-hash": "a4d92f8abd2407b530d697757bf9b3d3",
"packages": [
{
"name": "alchemy/zippy",
@ -172,12 +172,12 @@
"version": "v1.5.0",
"source": {
"type": "git",
"url": "https://github.com/clue/php-stream-filter.git",
"url": "https://github.com/clue/stream-filter.git",
"reference": "aeb7d8ea49c7963d3b581378955dbf5bc49aa320"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/clue/php-stream-filter/zipball/aeb7d8ea49c7963d3b581378955dbf5bc49aa320",
"url": "https://api.github.com/repos/clue/stream-filter/zipball/aeb7d8ea49c7963d3b581378955dbf5bc49aa320",
"reference": "aeb7d8ea49c7963d3b581378955dbf5bc49aa320",
"shasum": ""
},
@ -12085,38 +12085,32 @@
},
{
"name": "drupal/views_ef_fieldset",
"version": "1.4.0",
"version": "1.5.0",
"source": {
"type": "git",
"url": "https://git.drupalcode.org/project/views_ef_fieldset.git",
"reference": "8.x-1.4"
"reference": "8.x-1.5"
},
"dist": {
"type": "zip",
"url": "https://ftp.drupal.org/files/projects/views_ef_fieldset-8.x-1.4.zip",
"reference": "8.x-1.4",
"shasum": "0165aae3ad6f067b0fd3138c0456f95300292458"
"url": "https://ftp.drupal.org/files/projects/views_ef_fieldset-8.x-1.5.zip",
"reference": "8.x-1.5",
"shasum": "72ca0b63028d0fe65e13c8472546a8803aa0d079"
},
"require": {
"drupal/core": "^8",
"drupal/core": "^8 || ^9",
"php": ">=7"
},
"require-dev": {
"drupol/drupal-conventions": "^1"
},
"type": "drupal-module",
"extra": {
"drupal": {
"version": "8.x-1.4",
"datestamp": "1561312086",
"version": "8.x-1.5",
"datestamp": "1604567512",
"security-coverage": {
"status": "covered",
"message": "Covered by Drupal's security advisory policy"
}
},
"grumphp": {
"config-default-path": "vendor/drupol/drupal-conventions/config/drupal8/grumphp.yml"
},
"composer-exit-on-patch-failure": true,
"enable-patching": true,
"patches": {
@ -18088,12 +18082,12 @@
"version": "1.9.1",
"source": {
"type": "git",
"url": "https://github.com/webmozart/assert.git",
"url": "https://github.com/webmozarts/assert.git",
"reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/webmozart/assert/zipball/bafc69caeb4d49c39fd0779086c03a3738cbb389",
"url": "https://api.github.com/repos/webmozarts/assert/zipball/bafc69caeb4d49c39fd0779086c03a3738cbb389",
"reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389",
"shasum": ""
},

View File

@ -29,6 +29,7 @@ dependencies:
- user.role.admin
- user.role.root
module:
- better_exposed_filters
- computed_field
- content_lock
- file
@ -74,7 +75,7 @@ display:
query_comment: ''
query_tags: { }
exposed_form:
type: basic
type: bef
options:
submit_button: Apply
reset_button: true
@ -83,6 +84,43 @@ display:
expose_sort_order: true
sort_asc_label: Asc
sort_desc_label: Desc
text_input_required: 'Sélectionnez n''importe quel filtre et cliquez sur Appliquer pour voir les résultats'
text_input_required_format: null
bef:
general:
autosubmit: false
autosubmit_exclude_textfield: false
autosubmit_textfield_delay: 500
autosubmit_hide: false
input_required: false
allow_secondary: false
secondary_label: 'Options avancées'
secondary_open: false
sort:
plugin_id: default
filter:
title:
plugin_id: default
field_reference_value:
plugin_id: default
tid:
plugin_id: default
field_famille_value:
plugin_id: default
field_workflow_value:
plugin_id: default
field_thesaurus_target_id:
plugin_id: default
field_tags_target_id:
plugin_id: default
field_samples_location:
plugin_id: default
field_attachments_target_id:
plugin_id: default
field_memo_value:
plugin_id: default
field_migration_value:
plugin_id: default
pager:
type: pagerer
options:
@ -2084,77 +2122,83 @@ display:
title: ''
description: ''
open: '1'
weight: '-25'
weight: '-26'
id: container-0
pid: root
depth: '1'
type: container
title:
weight: '-23'
weight: '-27'
id: title
pid: container-0
depth: '2'
type: filter
field_reference_value:
weight: '-22'
weight: '-26'
id: field_reference_value
pid: container-0
depth: '2'
type: filter
tid:
weight: '-21'
weight: '-25'
id: tid
pid: container-0
depth: '2'
type: filter
field_famille_value:
weight: '-20'
weight: '-24'
id: field_famille_value
pid: container-0
depth: '2'
type: filter
field_attachments_target_id:
weight: '-23'
id: field_attachments_target_id
pid: container-0
depth: '2'
type: filter
field_memo_value:
weight: '-22'
id: field_memo_value
pid: container-0
depth: '2'
type: filter
field_workflow_value:
weight: '-19'
weight: '-21'
id: field_workflow_value
pid: container-0
depth: '2'
type: filter
field_migration_value:
weight: '-20'
id: field_migration_value
pid: container-0
depth: '2'
type: filter
field_thesaurus_target_id:
weight: '-18'
weight: '-19'
id: field_thesaurus_target_id
pid: container-0
depth: '2'
type: filter
field_tags_target_id:
weight: '-17'
weight: '-18'
id: field_tags_target_id
pid: container-0
depth: '2'
type: filter
field_samples_location:
weight: '-16'
weight: '-17'
id: field_samples_location
pid: container-0
depth: '2'
type: filter
field_memo_value:
weight: '-15'
id: field_memo_value
pid: container-0
depth: '2'
type: filter
field_migration_value:
weight: '-14'
id: field_migration_value
pid: container-0
depth: '2'
type: filter
container-3:
container_type: container
title: ''
description: ''
open: '1'
weight: '-23'
weight: '-24'
id: container-3
pid: root
depth: '1'
@ -2170,7 +2214,7 @@ display:
title: ''
description: ''
open: '1'
weight: '-22'
weight: '-23'
id: container-2
pid: root
depth: '1'
@ -2179,7 +2223,7 @@ display:
container_type: container
title: ''
description: ''
weight: '-21'
weight: '-22'
open: 0
id: container-1
pid: root
@ -2189,7 +2233,7 @@ display:
container_type: details
title: 'Container 4'
description: ''
weight: '-19'
weight: '-21'
open: 0
id: container-4
pid: root
@ -2199,7 +2243,7 @@ display:
container_type: details
title: 'Container 5'
description: ''
weight: '-18'
weight: '-20'
open: 0
id: container-5
pid: root
@ -2209,7 +2253,7 @@ display:
container_type: details
title: 'Container 6'
description: ''
weight: '-17'
weight: '-19'
open: 0
id: container-6
pid: root
@ -2219,7 +2263,7 @@ display:
container_type: details
title: 'Container 8'
description: ''
weight: '-16'
weight: '-18'
open: 0
id: container-8
pid: root
@ -2229,7 +2273,7 @@ display:
container_type: details
title: 'Container 7'
description: ''
weight: '-15'
weight: '-17'
open: 0
id: container-7
pid: root
@ -2239,7 +2283,7 @@ display:
container_type: details
title: 'Container 10'
description: ''
weight: '-14'
weight: '-16'
open: 0
id: container-10
pid: root
@ -2249,12 +2293,22 @@ display:
container_type: details
title: 'Container 9'
description: ''
weight: '-13'
weight: '-15'
open: 0
id: container-9
pid: root
depth: '1'
type: container
container-11:
container_type: details
title: 'Container 11'
description: ''
weight: '-14'
open: 0
id: container-11
pid: root
depth: '1'
type: container
path: admin/content/materials
menu:
type: tab
@ -4167,6 +4221,71 @@ display:
default_group_multiple: { }
group_items: { }
plugin_id: string
field_attachments_target_id:
id: field_attachments_target_id
table: node__field_attachments
field: field_attachments_target_id
relationship: none
group_type: group
admin_label: ''
operator: '='
value:
min: ''
max: ''
value: ''
group: 1
exposed: true
expose:
operator_id: field_attachments_target_id_op
label: 'Attachments (field_attachments : target_id)'
description: null
use_operator: false
operator: field_attachments_target_id_op
operator_limit_selection: false
operator_list: { }
identifier: field_attachments_target_id
required: false
remember: false
multiple: false
remember_roles:
authenticated: authenticated
placeholder: null
min_placeholder: null
max_placeholder: null
is_grouped: true
group_info:
label: Attachments
description: ''
identifier: field_attachments_target_id
optional: true
widget: select
multiple: false
remember: true
default_group: All
default_group_multiple: { }
group_items:
1:
title: Empty
operator: empty
value:
value: ''
min: ''
max: ''
2:
title: 'Not Empty'
operator: 'not empty'
value:
value: ''
min: ''
max: ''
3:
title: ''
operator: '='
value:
value: ''
min: ''
max: ''
plugin_id: numeric
field_memo_value:
id: field_memo_value
table: node__field_memo

5
package-lock.json generated
View File

@ -9598,6 +9598,11 @@
}
}
},
"pretty-bytes": {
"version": "5.5.0",
"resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-5.5.0.tgz",
"integrity": "sha512-p+T744ZyjjiaFlMUZZv6YPC5JrkNj8maRmPaQCWFJFplUAzpIUTRaTcS+7wmZtUoFXHtESJb23ISliaWyz3SHA=="
},
"process-nextick-args": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz",

View File

@ -20,6 +20,7 @@
"dependencies": {
"axios": "^0.21.0",
"check-password-strength": "^1.0.15",
"pretty-bytes": "^5.5.0",
"vue": "^2.6.12",
"vue-autofocus-directive": "^1.0.4",
"vue-cool-lightbox": "^2.6.9",

View File

@ -2043,6 +2043,15 @@ article.card {
article.card.modal-card section.col-right section.tool.industriels div.tool-content > section p {
margin: 0;
font-size: 0.882em; }
article.card.modal-card section.col-right section.attachments a {
margin: 0;
font-size: 0.882em;
line-height: 0.6; }
article.card.modal-card section.col-right section.attachments a span {
font-size: 0.8em; }
article.card.modal-card section.col-right section.attachments p {
margin: 0;
font-size: 0.882em; }
#main-content > article.thematique div.cols {
display: flex;

File diff suppressed because one or more lines are too long

View File

@ -45,6 +45,16 @@ import { mapState } from 'vuex'
import 'vue-cool-lightbox/dist/vue-cool-lightbox.min.css'
import 'theme/assets/styles/main.scss'
// import prettyBytes from 'vuejs/plugins/prettyBytes'
// Vue.use(prettyBytes)
// Vue.filter('prettyBytes', function (value) {
// if (!value) return ''
// value = value.toString()
// return value + 'Mb'
// })
(function (Drupal, drupalSettings, drupalDecoupled) {
const MaterioTheme = function () {
let _v_sitebranding_block, _v_user_block, _v_header_menu,

View File

@ -1238,6 +1238,20 @@ article.card{
}
}
}
section.attachments{
a{
margin:0;
font-size: 0.882em;
line-height: 0.6;
span{
font-size: 0.8em
}
}
p{
margin: 0;
font-size: 0.882em;
}
}
}
}
}

View File

@ -63,6 +63,15 @@ fragment MateriauFields on Materiau {
family_name
}
}
attachments {
description
file{
fid
filename
url
filesize
}
}
body
samples{
showroom{

View File

@ -81,7 +81,18 @@
</section>
</nav>
<section class="body" v-html="material.body"/>
<section class="linked-materials">
<section v-if="material.attachments" class="attachments">
<span class="label">{{ $t("materio.Attachments") }}</span>
<ul>
<li
v-for="attachmt in material.attachments" :key="attachmt.file.fid"
>
<a target="_blank" :href="attachmt.file.url">{{ attachmt.file.filename}} <span>({{ prettyFileSize(attachmt.file.filesize) }})</span></a>
<p v-if="attachmt.description" class="description" v-html="attachmt.description" />
</li>
</ul>
</section>
<section v-if="material.linked_materials" class="linked-materials">
<span class="label">{{ $t("materio.Linked materials") }}</span>
<ul>
<li v-for="m in material.linked_materials" v-bind:key="m.id">
@ -130,6 +141,8 @@ import { print } from 'graphql/language/printer'
import gql from 'graphql-tag'
import materiauFields from 'vuejs/api/gql/materiaumodal.fragment.gql'
const prettyBytes = require('pretty-bytes')
export default {
name: "ModalCard",
props: ['item'],
@ -217,6 +230,9 @@ export default {
onCloseModalCard (e) {
// this.$modal.hideAll()
this.$modal.hide(`modal-${this.item.id}`)
},
prettyFileSize(bytes){
return prettyBytes(parseInt(bytes))
}
}
}

View File

@ -0,0 +1,24 @@
// plugins/prettyBytes.js
export default {
install: (app, options) => {
app.config.globalProperties.$prettyBytes = (value) => {
return value + 'Mb'
}
app.provide('prettyBytes', options)
// app.directive('my-directive', {
// mounted (el, binding, vnode, oldVnode) {
// // some logic ...
// }
// ...
// })
// app.mixin({
// created() {
// // some logic ...
// }
// ...
// })
}
}