From ea2e157518407a5975c1e126cf55e39540f75b57 Mon Sep 17 00:00:00 2001 From: "marcimat@rezo.net" <> Date: Fri, 13 Jan 2017 15:41:21 +0000 Subject: [PATCH] =?UTF-8?q?Int=C3=A9gration=20du=20plugin=20"Minidoc"=20da?= =?UTF-8?q?ns=20le=20plugin=20M=C3=A9dias.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Il permet d'avoir plusieurs types d'affichage différents pour les listes de documents attachés à des objets éditoriaux. --- .gitattributes | 3 + lang/medias_fr.php | 3 + paquet.xml | 2 +- .../inclure/portfolio-documents.html | 69 ++++++++- prive/style_prive_plugin_medias.html | 145 ++++++++++++++++++ .../themes/spip/images/documents-cases-16.png | Bin 0 -> 186 bytes .../themes/spip/images/documents-liste-16.png | Bin 0 -> 183 bytes .../spip/images/documents-liste-courte-16.png | Bin 0 -> 159 bytes 8 files changed, 220 insertions(+), 2 deletions(-) create mode 100644 prive/themes/spip/images/documents-cases-16.png create mode 100644 prive/themes/spip/images/documents-liste-16.png create mode 100644 prive/themes/spip/images/documents-liste-courte-16.png diff --git a/.gitattributes b/.gitattributes index e5de9d81..b97ca5dc 100644 --- a/.gitattributes +++ b/.gitattributes @@ -316,6 +316,9 @@ prive/themes/spip/images/document-new-16.png -text prive/themes/spip/images/document-new-24.png -text prive/themes/spip/images/document-new-32.png -text prive/themes/spip/images/document-vu-24.png -text +prive/themes/spip/images/documents-cases-16.png -text +prive/themes/spip/images/documents-liste-16.png -text +prive/themes/spip/images/documents-liste-courte-16.png -text prive/themes/spip/images/image-16.png -text prive/themes/spip/images/image-24.png -text prive/themes/spip/images/image-32.png -text diff --git a/lang/medias_fr.php b/lang/medias_fr.php index a8f57847..cb057fa4 100644 --- a/lang/medias_fr.php +++ b/lang/medias_fr.php @@ -8,6 +8,9 @@ if (!defined('_ECRIRE_INC_VERSION')) { $GLOBALS[$GLOBALS['idx_lang']] = array( // A + 'affichage_documents_en_grand' => 'Affichage en grand', + 'affichage_documents_en_cases' => 'Affichage en cases', + 'affichage_documents_en_liste_compacte' => 'Affichage en liste compacte', 'aucun_audio' => 'Aucune bande-son', 'aucun_document' => 'Aucun document', 'aucun_file' => 'Aucun document', diff --git a/paquet.xml b/paquet.xml index 43fb9b60..d745fbf8 100644 --- a/paquet.xml +++ b/paquet.xml @@ -1,7 +1,7 @@ <paquet prefix="medias" categorie="multimedia" - version="2.14.4" + version="2.15.0" etat="stable" compatibilite="[3.2.0-dev;]" logo="prive/themes/spip/images/portfolio-32.png" diff --git a/prive/squelettes/inclure/portfolio-documents.html b/prive/squelettes/inclure/portfolio-documents.html index 2a517595..30198d18 100644 --- a/prive/squelettes/inclure/portfolio-documents.html +++ b/prive/squelettes/inclure/portfolio-documents.html @@ -56,6 +56,7 @@ var multifile='[(#CHEMIN{javascript/jquery.multifile.js}|texte_script)]'; [(#INCLURE{javascript/medias_edit.js}|compacte{js})] [(#OBJET|=={rubrique}|et{#EVAL{_AJAX}}|et{#GET{nbdocs}|=={1}}|oui) if (window.jQuery) jQuery('#navigation .box.info').ajaxReload();] + function check_reload_page(){ var reload = false; if($('#illustrations[(#ENV{id_unique})]').length && !$('#illustrations[(#ENV{id_unique})] .item').length){ @@ -72,6 +73,72 @@ function check_reload_page(){ jQuery('#navigation .box.info').ajaxReload(); } } -if (window.jQuery) jQuery(function(){onAjaxLoad(check_reload_page);}); + +if (window.jQuery) { + jQuery(function(){onAjaxLoad(check_reload_page);}); + jQuery(function($) { + /** Choix des différents affichages des documents (grand, en case, en liste courte) */ + var affichages = function () { + $('#portfolios h3:not(:has(.affichages))').each(function () { + var titre = $(this); + var liste = titre.next('.liste_items.documents'); + + var identifiant = liste.attr('id'); + if ($.inArray(identifiant, ['illustrations', 'portfolio', 'documents']) < 0) { + identifiant = null; + } + + titre.append( + "<div class='affichages'>" + + "<span class='icone grand on' title='<:medias:affichage_documents_en_grand|attribut_html:>'></span>" + + "<span class='icone cases' title='<:medias:affichage_documents_en_cases|attribut_html:>'></span>" + + "<span class='icone liste' title='<:medias:affichage_documents_en_liste_compacte|attribut_html:>'></span>" + + "</div>" + ); + + var changer_affichage_documents = function (me, bouton, classe) { + $(me).parent().find('.icone').removeClass('on').end().end().addClass('on'); + var liste = $(me).parents('h3').next('.liste_items.documents'); + liste.removeClass('documents_cases').removeClass('documents_liste'); + if (classe) { + liste.addClass(classe); + } + if (identifiant) { + Cookies.set('affichage-' + identifiant, bouton); + } + + liste.trigger('affichage.documents.change', { + 'liste': liste, + 'icone': me, + 'bouton': bouton, + 'classe': classe + }); + + }; + + titre.find('.affichages > .grand').click(function () { + changer_affichage_documents(this, 'grand', null); + }); + + titre.find('.affichages > .cases').click(function () { + changer_affichage_documents(this, 'cases', 'documents_cases'); + }); + + titre.find('.affichages > .liste').click(function () { + changer_affichage_documents(this, 'liste', 'documents_liste'); + }); + + if (identifiant) { + var defaut = Cookies.get('affichage-' + identifiant); + if (defaut) { + titre.find('.affichages > .' + defaut).trigger('click'); + } + } + }); + } + affichages(); + onAjaxLoad(affichages); + }); +} /*]]>*/</script> </div> diff --git a/prive/style_prive_plugin_medias.html b/prive/style_prive_plugin_medias.html index 52579e8e..e4fb4ccf 100644 --- a/prive/style_prive_plugin_medias.html +++ b/prive/style_prive_plugin_medias.html @@ -183,3 +183,148 @@ p.actions {clear:both;} .portfolios .tout_supprimer span {display:block;text-align:#GET{right};} .item.vu_oui {background:#f9f9f9;} + + +/* Types d'affichages des listes de douments */ + +h3 .affichages { + float:#GET{right}; +} + +.affichages .icone { + width:16px; + height:16px; + margin:0; + padding:2px; + display:inline-block; + background:rgba(255, 255, 255, 0.5) center center no-repeat; + border-radius:3px; + cursor:pointer; +} +.affichages .icone + .icone { + margin-#GET{left}:5px; +} +.affichages .icone.grand { + background-image: url([(#CHEMIN_IMAGE{documents-liste-16.png})]); +} +.affichages .icone.liste { + background-image: url([(#CHEMIN_IMAGE{documents-liste-courte-16.png})]); +} +.affichages .icone.cases { + background-image: url([(#CHEMIN_IMAGE{documents-cases-16.png})]); +} +.affichages .icone.on { + background-color:rgba(255, 255, 255, 0.9); +} +.affichages .icone.on:hover, +.affichages .icone:hover { + background-color:rgba(255, 255, 255, 1); +} + +/* Liste courte de documents */ +.portfolios .documents_liste .tout_supprimer { + clear:both; + margin-top:.5em; + display:block; +} +.portfolios .documents_liste .item { + padding: 7px; + padding-#GET{right}: 100px; + padding-#GET{left}: 75px; + position:relative; +} +.portfolios .documents_liste .item .vignette { + width:65px; + margin-#GET{left}: -75px; +} +.portfolios .documents_liste .item .vignette img { + max-height: 36px; + max-width:65px; + height:auto; + width:auto; +} +.portfolios .documents_liste .item .tourner, +.portfolios .documents_liste .item .infos, +.portfolios .documents_liste .item .mode, +.portfolios .documents_liste .item .actions > * { + display:none; +} +.portfolios .documents_liste .item .titrem { + margin-bottom:0; +} +.portfolios .documents_liste .item .titrem .fichier, +.portfolios .documents_liste .item .titrem .titre { + max-height:1.2em; + line-height:1.2em; + overflow:hidden; + white-space: nowrap; + display:block; + text-overflow:ellipsis; +} +.portfolios .documents_liste .item .titrem .titre { + max-height:1.5em; + line-height:1.5em; +} +.portfolios .documents_liste .item .actions { + position:absolute; + #GET{right}:0; + top:1.2em; +} +.portfolios .documents_liste .item .actions .editbox, +.portfolios .documents_liste .item .actions .ordoc-deplacer { + display:inline-block; +} + + +/* Grille en cases des documents. */ +.portfolios .documents_cases { + display:flex; + flex-wrap: wrap; +} +.portfolios .documents_cases .item { + padding: 2px; + margin: 2px; + border:1px solid #eee; + border-radius:5px; + width:113px; + height:130px; + display:flex; + flex-direction:column; + +} +.portfolios .documents_cases .item .tourner, +.portfolios .documents_cases .item .infos, +.portfolios .documents_cases .item .mode, +.portfolios .documents_cases .item .titrem, +.portfolios .documents_cases .item .actions > * { + display:none; +} +.portfolios .documents_cases .item .actions .editbox { + display:inline-block; + float:#GET{right}; +} +.portfolios .documents_cases .item .actions .ordoc-deplacer { + display:inline-block; + float:#GET{left}; +} +.portfolios .documents_cases .item .vignette { + float: none; + margin-#GET{left}: 0; + width:auto; + height:auto; + flex-grow:1; +} +.portfolios .documents_cases .item .vignette img { + max-height:110px; + max-width:110px; + width: auto; + height: auto; +} + +.portfolios .documents_cases .item .actions { + display:block; + width:100%; +} +.portfolios .documents_cases .tout_supprimer { + flex-basis: 100%; +} \ No newline at end of file diff --git a/prive/themes/spip/images/documents-cases-16.png b/prive/themes/spip/images/documents-cases-16.png new file mode 100644 index 0000000000000000000000000000000000000000..80d989da31b02f8e3996a747bbac8690b596fa81 GIT binary patch literal 186 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4%caKYZ?lYt_f1s;*b zKpodXn9)gNb_Gz7y~NYkmHi<jCl9BxwzT;pppd(#i(`nz>Er|np9aBp31z#jFD9u= zN=WQ;x@p71!;{8xL^9$6&yTJp6C?`R)V%)ozGKQ$G2<6}G=*JBc<bUk6R{H=t&Qvq Ymt+Jqzc+Qa1C3<xboFyt=akR{03fI}Qvd(} literal 0 HcmV?d00001 diff --git a/prive/themes/spip/images/documents-liste-16.png b/prive/themes/spip/images/documents-liste-16.png new file mode 100644 index 0000000000000000000000000000000000000000..2d3d5069f4f8a61eb982a67ea51aa4b31153ac5b GIT binary patch literal 183 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4%caKYZ?lYt_f1s;*b zKpodXn9)gNb_Gz7y~NYkmHi<jCl9BUf5Chuppc8Fi(`nz>Er|npN5GtTVKrbGc+)$ zQCu*yy|M8i&#^?u$$t(VIPhVrNV;+0t9&t?bIA&axUX=#sAaj|&Ct1^cJs0X1H+XP V4#k3|I4z)g44$rjF6*2UngFl~II#c# literal 0 HcmV?d00001 diff --git a/prive/themes/spip/images/documents-liste-courte-16.png b/prive/themes/spip/images/documents-liste-courte-16.png new file mode 100644 index 0000000000000000000000000000000000000000..330ff51e44f6e0aaf87904be68cb842c48831312 GIT binary patch literal 159 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4%caKYZ?lYt_f1s;*b zKpodXn9)gNb_Gz7y~NYkmHi<jCl8lgM4W~JP)Ntq#WBR<baH}(Ps2o+tuJP+Gc+)$ wQCl!`dSjzwca~nlqHX)#_Zk@OHTb~5a7c_pv_h663#gC5)78&qol`;+05z;ENB{r; literal 0 HcmV?d00001 -- GitLab