Skip to content

Commit

Permalink
release(2.31.0): aggiunte viste progetti, sistemati tassi di assenza,…
Browse files Browse the repository at this point in the history
… personale non a tid, vari fix
  • Loading branch information
arturu committed Jan 27, 2025
1 parent ee0db0a commit 22daeb8
Show file tree
Hide file tree
Showing 7 changed files with 203 additions and 29 deletions.
37 changes: 36 additions & 1 deletion src/Helper/Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

namespace Drupal\skenografia\Helper;

use Drupal\Component\Utility\Html;
use Drupal\node\Entity\Node;

/**
* Helper class for Skenografia theme.
*
Expand Down Expand Up @@ -33,7 +36,7 @@ public static function getLocality(): array {
$nodes = $nodeStorage->loadMultiple($ids);

if (count($nodes) === 1) {
/** @var Drupal\node\Entity\Node $sede_legale */
/** @var Node $sede_legale */
$sede_legale = $nodes[array_key_first($nodes)];
if ($sede_legale->hasField('field_indirizzo')) {
$indirizzo = $sede_legale->get('field_indirizzo')->first();
Expand Down Expand Up @@ -113,4 +116,36 @@ public static function getAnnoScolastico(array $opzioni = NULL): string {
return $parte_sinistra_formattata . $separatore . $parte_destra_formattata;
}

/**
* Pulisce un titolo per l'uso in un URL.
*
* - Translittera caratteri speciali.
* - Rimuove caratteri non validi.
* - Limita a n parole.
*
* @param string $title
* Il titolo originale.
* @param int $word_truncate
* Eventualmente se bisogna troncare
* @param string $language
* La lingua da usare
*
* @return string
* Il titolo pulito.
*/
static function cleanTitleForUrl(string $title, int $word_truncate = 4, string $language = 'it'): string {
$transliteration = \Drupal::service('transliteration');
$title = $transliteration->transliterate($title, 'en');

// Rimuovo i caratteri non alfanumerici suddivido in parole
$words = preg_split('/\s+/', Html::cleanCssIdentifier($title));

if ($word_truncate > 0) {
$words = array_slice($words, 0, $word_truncate);
}

// Converto in minuscolo e unisco con "-"
return strtolower(implode('-', $words));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
{% if _obbligo_pubblicazione %}
<p class="text-greendark d-flex">
<span>{% include '@bi-bcl/icon/icon.html.twig' with {name: 'it-check', color: 'greendark', icon_classes: ['me-2']} %}</span>
<span>La scuola è soggetta a questo obbligo.</span>
{% if _obbligo_pubblicazione != 'Dirigente scolastico' %}
<span>La scuola è soggetta a questo obbligo che viene assolto tramite un collegamento.</span>
{% else %}
<span>La scuola è soggetta a questo obbligo.</span>
{% endif %}
</p>
{% else %}
<p class="text-muted d-flex">
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
*/
#}
{% apply spaceless %}
{% set _obbligo_pubblicazione = content.field_persona_responsabile[0] is iterable %}
{% set _section_classes = [
'section',
'bg-primary',
Expand Down Expand Up @@ -65,6 +64,8 @@
<section{{ attributes.addClass(['section', 'bg-gray-light', 'py-5']) }}>
<div class="container">

{% set _obbligo_pubblicazione = content.field_persona_responsabile[0]|render|striptags|trim %}

{% set _obbligo_pubblicazione_contenuto %}
{% block obbligoContent %}
{% embed '@skenografia/modules/keryx/amministrazione_trasparente/_partial.descrizione-e-riferimenti--obbligo-pubblicazione.html.twig' %}
Expand All @@ -75,7 +76,7 @@
{% endblock %}
{% endset %}

{% if _obbligo_pubblicazione %}
{% if _obbligo_pubblicazione and _obbligo_pubblicazione == 'Dirigente scolastico' %}
{% embed '@bi-bcl/accordion/accordion.html.twig' with {left_icon: true} %}
{% block accordionItems %}
{% embed '@bi-bcl/accordion/accordion-item.html.twig' with {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
'cols-' ~ header|length,
responsive ? 'responsive-enabled',
sticky ? 'sticky-enabled',
'mb-5'
] %}

{% set thead_classes = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,9 @@
</div>
{% endif %}

<div class="col-lg-9 pt-2 card-wrapper card-teaser-wrapper">
<div class="col-lg-9 pt-2 card-wrapper card-teaser-wrapper card-teaser-wrapper-3-col justify-content-start">
{% for row in rows %}
{%
set row_classes = [
default_row_class ? 'views-row',
'mb-3'
]
%}
<div{{ row.attributes.addClass(row_classes) }}>
{{- row.content -}}
</div>
{{- row.content -}}
{% endfor %}
</div>
</div>
Expand Down
156 changes: 156 additions & 0 deletions templates/views/views-view-table.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
{#
/**
* @file
* Default theme implementation for displaying a view as a table.
*
* Available variables:
* - attributes: Remaining HTML attributes for the element.
* - class: HTML classes that can be used to style contextually through CSS.
* - title : The title of this group of rows.
* - header: The table header columns.
* - attributes: Remaining HTML attributes for the element.
* - content: HTML classes to apply to each header cell, indexed by
* the header's key.
* - default_classes: A flag indicating whether default classes should be
* used.
* - caption_needed: Is the caption tag needed.
* - caption: The caption for this table.
* - accessibility_description: Extended description for the table details.
* - accessibility_summary: Summary for the table details.
* - rows: Table row items. Rows are keyed by row number.
* - attributes: HTML classes to apply to each row.
* - columns: Row column items. Columns are keyed by column number.
* - attributes: HTML classes to apply to each column.
* - content: The column content.
* - default_classes: A flag indicating whether default classes should be
* used.
* - responsive: A flag indicating whether table is responsive.
* - sticky: A flag indicating whether table header is sticky.
* - summary_element: A render array with table summary information (if any).
*
* @see template_preprocess_views_view_table()
*
* @ingroup themeable
*/
#}
{% apply spaceless %}
{# Set defaults #}

{# Set options #}
{% set classes = [
'table',
table_striped ? 'table-striped',
table_striped_columns ? 'table-striped-columns',
table_bg and table_bg is not empty ? 'table-' ~ table_bg,
table_hover ? 'table-hover',
table_bordered ? 'table-bordered',
table_border_color and table_border_color is not empty ? 'border-' ~ table_border_color,
table_borderless ? 'table-borderless',
table_sm ? 'table-sm',
table_align_middle ? 'align-middle',
table_caption_top ? 'caption-top',
'cols-' ~ header|length,
responsive ? 'responsive-enabled',
sticky ? 'sticky-enabled',
'mb-5'
] %}

{% set thead_classes = [
table_thead_variant and table_thead_variant is not empty ? 'table-' ~ table_thead_variant
] %}

{% if title|render|striptags|trim is not empty %}
<h2 class="fw-lighter">
{{ title|striptags|trim }}
</h2>
{% endif %}

{# Component #}

{% if table_responsive and table_responsive is not empty %}
<div class="{{ table_responsive }}">
{% endif %}

<table{{ attributes.addClass(classes) }}>
{% if caption_needed %}
<caption>
{% if caption %}
{{ caption }}
{% else %}
{{ title }}
{% endif %}
{% if (summary_element is not empty) %}
{{ summary_element }}
{% endif %}
</caption>
{% endif %}
{% if header %}
<thead class="{{ thead_classes|join(' ') }}">
<tr>
{% for key, column in header %}
{% if column.default_classes %}
{%
set column_classes = [
'views-field',
'views-field-' ~ fields[key],
]
%}
{% endif %}
<th{{ column.attributes.addClass(column_classes).setAttribute('scope', 'col') }}>
{%- if column.wrapper_element -%}
<{{ column.wrapper_element }}>
{%- if column.url -%}
<a href="{{ column.url }}" title="{{ column.title }}" rel="nofollow">{{ column.content }}{{ column.sort_indicator }}</a>
{%- else -%}
{{ column.content }}{{ column.sort_indicator }}
{%- endif -%}
</{{ column.wrapper_element }}>
{%- else -%}
{%- if column.url -%}
<a href="{{ column.url }}" title="{{ column.title }}" rel="nofollow">{{ column.content }}{{ column.sort_indicator }}</a>
{%- else -%}
{{- column.content }}{{ column.sort_indicator }}
{%- endif -%}
{%- endif -%}
</th>
{% endfor %}
</tr>
</thead>
{% endif %}
<tbody>
{% for row in rows %}
<tr{{ row.attributes }}>
{% for key, column in row.columns %}
{% if column.default_classes %}
{%
set column_classes = [
'views-field'
]
%}
{% for field in column.fields %}
{% set column_classes = column_classes|merge(['views-field-' ~ field]) %}
{% endfor %}
{% endif %}
<td{{ column.attributes.addClass(column_classes) }}>
{%- if column.wrapper_element -%}
<{{ column.wrapper_element }}>
{% for content in column.content %}
{{ content.separator }}{{ content.field_output }}
{% endfor %}
</{{ column.wrapper_element }}>
{%- else -%}
{% for content in column.content %}
{{- content.separator }}{{ content.field_output -}}
{% endfor %}
{%- endif %}
</td>
{% endfor %}
</tr>
{% endfor %}
</tbody>
</table>

{% if table_responsive and table_responsive is not empty %}
</div>
{% endif %}
{% endapply %}

0 comments on commit 22daeb8

Please sign in to comment.