1.7 par kozlika & nikrou
This commit is contained in:
parent
a8692bb2e7
commit
8347589771
7 changed files with 89 additions and 28 deletions
|
@ -1,2 +1,7 @@
|
||||||
# shortArchives
|
# shortArchives
|
||||||
Afficher les archives du blog dans un menu accordéon, trié par années.
|
|
||||||
|
Widget d'affichage des archives pour le blog des news de Dotclear. Le principe de l'accordéon originel revisité pour un affichage des mois à côté de la date "ouverte".
|
||||||
|
|
||||||
|
Todo:
|
||||||
|
|
||||||
|
* Ajouter les attributs ARIA kivonbien.
|
||||||
|
|
|
@ -16,7 +16,7 @@ $this->registerModule(
|
||||||
/* Name */ "shortArchives",
|
/* Name */ "shortArchives",
|
||||||
/* Description*/ "Display blog archives in an accordion menu, sorted by year",
|
/* Description*/ "Display blog archives in an accordion menu, sorted by year",
|
||||||
/* Author */ "annso, Pierre Van Glabeke",
|
/* Author */ "annso, Pierre Van Glabeke",
|
||||||
/* Version */ "1.6",
|
/* Version */ "1.7",
|
||||||
/* Properties */
|
/* Properties */
|
||||||
array(
|
array(
|
||||||
'permissions' => 'usage,contentadmin',
|
'permissions' => 'usage,contentadmin',
|
||||||
|
|
16
_public.php
16
_public.php
|
@ -48,6 +48,11 @@ class tplShortArchives
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$active_year = null;
|
||||||
|
if (($core->url->type == 'archive') && preg_match('`^/([0-9]{4})/([0-9]{2})$`',$core->url->args,$matches)) {
|
||||||
|
$active_year = $matches[1];
|
||||||
|
}
|
||||||
|
|
||||||
$posts = array();
|
$posts = array();
|
||||||
while ($rs->fetch()) {
|
while ($rs->fetch()) {
|
||||||
$posts[dt::dt2str(__('%Y'),$rs->dt)][] = array('url' => $rs->url($core),
|
$posts[dt::dt2str(__('%Y'),$rs->dt)][] = array('url' => $rs->url($core),
|
||||||
|
@ -57,10 +62,15 @@ class tplShortArchives
|
||||||
|
|
||||||
$res =
|
$res =
|
||||||
($w->title ? $w->renderTitle(html::escapeHTML($w->title)) : '').
|
($w->title ? $w->renderTitle(html::escapeHTML($w->title)) : '').
|
||||||
'<ul>';
|
'<ul class="arch-years">';
|
||||||
|
|
||||||
foreach($posts as $annee=>$post) {
|
foreach($posts as $annee => $post) {
|
||||||
$res .= '<li><span>'.$annee.'</span><ul>';
|
if (!is_null($active_year) && $active_year == $annee) {
|
||||||
|
$res .= '<li class="open">';
|
||||||
|
} else {
|
||||||
|
$res .= '<li>';
|
||||||
|
}
|
||||||
|
$res .= '<span>'.$annee.'</span><ul class="arch-months">';
|
||||||
for($i=0; $i<sizeof($post); $i++) {
|
for($i=0; $i<sizeof($post); $i++) {
|
||||||
$res .=
|
$res .=
|
||||||
'<li><a href="'.$post[$i]['url'].'">'.$post[$i]['date'].'</a>'.
|
'<li><a href="'.$post[$i]['url'].'">'.$post[$i]['date'].'</a>'.
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
v1.7 - 28-05-2015 - Kozlika & Nikrou
|
||||||
|
* suppression d'image et gestion de l'indicateur via css
|
||||||
|
* ajout de classes sur chaque liste (année/mois)
|
||||||
|
* application de la class .open sur l'item ouvert par défaut
|
||||||
|
* application de la class .open sur l'item correspondant au mois actif en cas de consulation des archives
|
||||||
|
|
||||||
v1.6 - 25-04-2015 - Pierre Van Glabeke
|
v1.6 - 25-04-2015 - Pierre Van Glabeke
|
||||||
* modif appel css
|
* modif appel css
|
||||||
* ajout localisation
|
* ajout localisation
|
||||||
|
|
|
@ -1,5 +1,41 @@
|
||||||
.shortArchives li a.archives-year {
|
@charset "UTF-8";
|
||||||
background: url(index.php?pf=shortArchives/img/bullet_arrow_down.png) left center no-repeat;
|
|
||||||
padding-left: 20px;
|
/* ------------------------ shortArchives styles */
|
||||||
|
.shortArchives .arch-years,
|
||||||
|
.shortArchives .arch-months {
|
||||||
|
margin-left: 0;
|
||||||
|
list-style-type: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* liste années */
|
||||||
|
.shortArchives .arch-years > li {
|
||||||
|
padding-left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.shortArchives .arch-months {
|
||||||
|
margin: .5em 0 .5em 1.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* année fermée */
|
||||||
|
.shortArchives a.archives-year {
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
.shortArchives a.archives-year:before {
|
||||||
|
padding-right: .5em;
|
||||||
|
color: #aaa;
|
||||||
|
content: "\25b8";
|
||||||
|
speak: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* année ouverte */
|
||||||
|
.shortArchives .open .archives-year {
|
||||||
|
font-weight: bold;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.shortArchives .open .archives-year:before {
|
||||||
|
padding-right: .5em;
|
||||||
|
color: #333;
|
||||||
|
content: "\25be";
|
||||||
|
speak: none;
|
||||||
}
|
}
|
||||||
.shortArchives li ul li { list-style-type: none;}
|
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 201 B |
|
@ -1,14 +1,18 @@
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
$(".shortArchives li ul:not(:first)").hide();
|
if ($(".shortArchives li.open").length == 0) {
|
||||||
|
$(".shortArchives li:first").addClass('open');
|
||||||
|
}
|
||||||
|
$(".shortArchives li:not(.open) ul").hide();
|
||||||
|
|
||||||
$(".shortArchives li span").each( function () {
|
$(".shortArchives li span").each( function () {
|
||||||
var txt = $(this).text();
|
var txt = $(this).text();
|
||||||
$(this).replaceWith('<a href="" class="archives-year">' + txt + '<\/a>') ;
|
$(this).replaceWith('<a href="" class="archives-year">' + txt + '<\/a>') ;
|
||||||
} ) ;
|
});
|
||||||
|
|
||||||
$(".shortArchives li a.archives-year").click(function(){
|
$(".shortArchives li a.archives-year").click(function(){
|
||||||
if ($(this).next(".shortArchives li ul:visible").length != 0) {
|
if ($(this).next(".shortArchives li ul:visible").length != 0) {
|
||||||
$(".shortArchives li ul:visible").slideUp("normal", function () { $(this).parent().removeClass("open") });
|
$(".shortArchives li ul:visible").slideUp("normal", function () { $(this).parent().removeClass("open") });
|
||||||
|
$(".shortArchives li:first").removeClass('open');
|
||||||
} else {
|
} else {
|
||||||
$(".shortArchives li ul").slideUp("normal", function () { $(this).parent().removeClass("open") });
|
$(".shortArchives li ul").slideUp("normal", function () { $(this).parent().removeClass("open") });
|
||||||
$(this).next("ul").slideDown("normal", function () { $(this).parent().addClass("open") });
|
$(this).next("ul").slideDown("normal", function () { $(this).parent().addClass("open") });
|
||||||
|
|
Loading…
Reference in a new issue