]> _ Git - fluidbook-toolbox.git/commitdiff
wait #5750 @1
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 23 Feb 2023 13:50:09 +0000 (14:50 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 23 Feb 2023 13:50:09 +0000 (14:50 +0100)
app/Http/Controllers/Admin/Operations/Files/UploadOperation.php
resources/views/fluidbook_stats/loader.blade.php
resources/views/fluidbook_stats/summary.blade.php

index 7e63cf66462806bd365d466e6e494c48394d3270..dff622e2c4a0f3574d1f489b6a5fc011f585a7e8 100644 (file)
@@ -13,6 +13,7 @@ use Illuminate\Support\Facades\Route;
 use Prologue\Alerts\Facades\Alert;
 
 // __('!! Partage de fichiers')
+
 trait UploadOperation
 {
     protected function setupImportRoutes($segment, $routeName, $controller)
index 55e1c3aa73c06ae0b592203dfa016c8ca106aa48..408756b5b34be61fb5cb91546f2fda57fdde56fd 100644 (file)
     <div id="stats_loader">Loading...</div>
     <div id="stats_wrapper"></div>
     <div id="stats_error" style="display: none">
-        {{ __('Sorry, an error occured while fetching this report. Please try again later. ') }}
+        {{ __('Une erreur s\'est produite lors de la génération du rapport') }}
     </div>
 @endsection
 
index eb9060a345dee888dbd2c938cfe1806459c08e9e..24486aa0e264b9343156c604dbf4fcc45f4c972e 100644 (file)
@@ -3,11 +3,12 @@
 {{-- This doesn't extend any templates because it is fetched from loader.blade.php and injected via JS --}}
 
 <h2 class="mt-4">
-    {{ __('Statistics') }}
+    {{ __('Statistiques') }}
     <span class="heading-subtitle">{{ $fluidbook_settings->title }}</span>
 </h2>
 
-<div data-daterangepicker class="mb-4" style="cursor: pointer" title="{{ __('Statistics Period - click to choose a new date range') }}">
+<div data-daterangepicker class="mb-4" style="cursor: pointer"
+     title="{{ __('Période').' - '.__('Cliquer pour changer l\'intervalle') }}">
     <i class="las la-calendar-week align-middle mr-1" style="font-size: 32px;"></i>
     <span class="date-range-text">
         {!! $formatted_date_range !!}
 
 
 <dl class="summary">
-    <dt>{{ __('Fluidbook Name') }}</dt>
+    <dt>{{ __('Titre de la publication') }}</dt>
     <dd>{{ $fluidbook_settings->title }}</dd>
 
-    <dt>{{ __('Creation Date') }}</dt>
+    <dt>{{ __('Crée le') }}</dt>
     <dd>
         {{ $fluidbook->created_at->isoFormat('dddd, Do MMMM YYYY') }}
         <span style="opacity: 0.6; display: inline-block; margin-left: 0.5em;">
@@ -34,7 +35,7 @@
         </span>
     </dd>
 
-    <dt>{{ __('Page Count') }}</dt>
+    <dt>{{ __('Nombre de pages') }}</dt>
     <dd>{{ $page_count }}</dd>
 
     {{-- Summary of totals --}}
             @php
                 if ($summary_key === 'formatted_date') continue;
             @endphp
-            <dt>{{ sprintf(__('Total %s'), $summary_heading) }}</dt>
+            <dt>{{ $summary_heading }}</dt>
             <dd>{{ $formatter->format($period_details->sum($summary_key)) }}</dd>
         @endforeach
 
-        <dt>{{ __('Total Searches') }}</dt>
+        <dt>{{ __('Recherches') }}</dt>
         <dd>{{ $formatter->format($searches->sum()) }}</dd>
     @endif
 </dl>
@@ -66,7 +67,8 @@
                 @if($period_key === $period || $period_not_available)
                     <span @if($period_not_available)class="period_disabled"@endif>{{ $period_title['singular'] }}</span>
                 @else
-                    <a href="{{ route('stats', compact('fluidbook_id', 'hash') + ['date' => $date ?? '-', 'period_override' => $period_key]) }}" onclick="showStatsLoader()">
+                    <a href="{{ route('stats', compact('fluidbook_id', 'hash') + ['date' => $date ?? '-', 'period_override' => $period_key]) }}"
+                       onclick="showStatsLoader()">
                         {{ $period_title['singular'] }}
                     </a>
                 @endif
     {{-- Stats for each period entry (year, month, week or day) --}}
     <table class="sortable stats-details mt-5">
         <thead>
+        <tr>
+            @foreach ($table_map['summary'] as $summary_heading_key => $summary_heading)
+                <th @if($summary_heading_key === 'formatted_date')class="sorttable_sorted_ascending"@endif>
+                    {{ $summary_heading }}
+                </th>
+            @endforeach
+        </tr>
+        </thead>
+        <tbody>
+        @foreach($period_details as $date_key => $period_data)
             <tr>
-                @foreach ($table_map['summary'] as $summary_heading_key => $summary_heading)
-                    <th @if($summary_heading_key === 'formatted_date')class="sorttable_sorted_ascending"@endif>
-                        {{ $summary_heading }}
-                    </th>
+                @foreach (array_keys($table_map['summary']) as $summary_key)
+                    <td data-name="{{ $summary_key }}"
+                        @if($summary_key === 'formatted_date')data-sort-value="{{ $period_data['raw_date'] }}"@endif>
+                        {!! is_int($period_data[$summary_key]) ? $formatter->format($period_data[$summary_key]) : $period_data[$summary_key] !!}
+                    </td>
                 @endforeach
             </tr>
-        </thead>
-        <tbody>
-            @foreach($period_details as $date_key => $period_data)
-                <tr>
-                    @foreach (array_keys($table_map['summary']) as $summary_key)
-                        <td data-name="{{ $summary_key }}"
-                            @if($summary_key === 'formatted_date')data-sort-value="{{ $period_data['raw_date'] }}"@endif>
-                            {!! is_int($period_data[$summary_key]) ? $formatter->format($period_data[$summary_key]) : $period_data[$summary_key] !!}
-                        </td>
-                    @endforeach
-                </tr>
-            @endforeach
+        @endforeach
         </tbody>
     </table>
 
     {{-- Stats segregated by page number --}}
-    <h3 class="mt-5">{{ __('Details by page') }} <small>({!! $formatted_date_range !!})</small></h3>
+    <h3 class="mt-5">{{ __('Détails par page') }} <small>({!! $formatted_date_range !!})</small></h3>
 
     <table class="sortable stats-details mt-3">
         <thead>
+        <tr>
+            @foreach ($table_map['per-page'] as $page_data_heading_key => $page_data_heading)
+                {{-- In the case of the "page_group" data, we want it to be sorted in ascending order by default, even though it's a numeric column --}}
+                <th @if($page_data_heading_key === 'page_group')class="sorttable_sorted_ascending"
+                    data-sort-direction="ascending"@endif>
+                    {{ $page_data_heading }}
+                </th>
+            @endforeach
+        </tr>
+        </thead>
+        <tbody>
+        @foreach($pages as $page_group => $page_data)
             <tr>
-                @foreach ($table_map['per-page'] as $page_data_heading_key => $page_data_heading)
-                    {{-- In the case of the "page_group" data, we want it to be sorted in ascending order by default, even though it's a numeric column --}}
-                    <th @if($page_data_heading_key === 'page_group')class="sorttable_sorted_ascending"
-                        data-sort-direction="ascending"@endif>
-                        {{ $page_data_heading }}
-                    </th>
+                @foreach (array_keys($table_map['per-page']) as $summary_key)
+                    <td data-name="{{ $summary_key }}"
+                        @if($summary_key === 'page_group')data-sort-value="{{ $page_data['page_number'] }}"@endif>
+                        {!! is_int($page_data[$summary_key]) ? $formatter->format($page_data[$summary_key]) : $page_data[$summary_key] !!}
+                    </td>
                 @endforeach
             </tr>
-        </thead>
-        <tbody>
-            @foreach($pages as $page_group => $page_data)
-                <tr>
-                    @foreach (array_keys($table_map['per-page']) as $summary_key)
-                        <td data-name="{{ $summary_key }}" @if($summary_key === 'page_group')data-sort-value="{{ $page_data['page_number'] }}"@endif>
-                            {!! is_int($page_data[$summary_key]) ? $formatter->format($page_data[$summary_key]) : $page_data[$summary_key] !!}
-                        </td>
-                    @endforeach
-                </tr>
-            @endforeach
+        @endforeach
         </tbody>
     </table>
 
         {{-- Outgoing Links --}}
         @if($outlinks->isNotEmpty())
             <div>
-                <h3>{{ __('Outgoing Links') }}</h3>
+                <h3>{{ __('Liens sortants') }}</h3>
 
                 <table class="sortable stats-details mt-3">
                     <thead>
                     <tr>
                         <th>{{ __('URL') }}</th>
-                        <th class="sorttable_sorted_descending">{{ __('Clicks') }}</th>
+                        <th class="sorttable_sorted_descending">{{ __('Clics') }}</th>
                     </tr>
                     </thead>
                     <tbody>
         {{-- Search Keywords --}}
         @if($searches->isNotEmpty())
             <div>
-                <h3>{{ __('Search Keywords') }}</h3>
+                <h3>{{ __('Mots recherchés') }}</h3>
 
                 <table class="sortable stats-details mt-3">
                     <thead>
                     <tr>
-                        <th>{{ __('Query') }}</th>
-                        <th class="sorttable_sorted_descending">{{ __('Searches') }}</th>
+                        <th>{{ __('Requêtes') }}</th>
+                        <th class="sorttable_sorted_descending">{{ __('Nombre') }}</th>
                     </tr>
                     </thead>
                     <tbody>
         {{-- Visitor Countries --}}
         @if($countries->isNotEmpty())
             <div>
-                <h3>{{ __('Origin of Visitors') }}</h3>
+                <h3>{{ __('Origine des visiteurs') }}</h3>
 
                 <table class="sortable stats-details mt-3">
                     <thead>
                     <tr>
-                        <th>{{ __('Country') }}</th>
-                        <th class="sorttable_sorted_descending">{{ __('Visits') }}</th>
+                        <th>{{ __('Pays') }}</th>
+                        <th class="sorttable_sorted_descending">{{ __('Nombre de visites') }}</th>
                     </tr>
                     </thead>
                     <tbody>
                     @foreach($countries as $country)
                         <tr>
                             <td class="whitespace-nowrap" data-sort-value="{{ $country['label'] }}">
-                                <img src="{{ $country['flag'] }}" alt="{{ $country['label'] }}" style="width: 1.5em; margin-right: 0.75em;">
+                                <img src="{{ $country['flag'] }}" alt="{{ $country['label'] }}"
+                                     style="width: 1.5em; margin-right: 0.75em;">
                                 {{ $country['label'] }}
                             </td>
                             <td>{{ $formatter->format($country['nb_visits']) }}</td>
     </div>
 
 
-{{-- It's possible for there to be no statistics returned by the API --}}
+    {{-- It's possible for there to be no statistics returned by the API --}}
 @else
     <div class="no-statistics">
         <span style="vertical-align: middle; margin-right: 0.5em;">⚠</span>️
-        {{ __('Sorry, no statistics were found for this period.') }}
+        {{ __('Aucune visite ne correspond à cette période') }}
     </div>
 @endif
 
 {{-- Date Range picker setup: https://sensortower.github.io/daterangepicker/docs --}}
 <script>
     moment.locale('{{ $locale }}');
-     @if ($locale === 'en')
-         moment.updateLocale('{{ $locale }}', {
-             longDateFormat: {
-                 // Date range picker uses the 'L' format for displaying dates
-                 L: 'DD/MM/YYYY', // We don't like the default, backwards US date format
-             }
-         });
+    @if ($locale === 'en')
+    moment.updateLocale('{{ $locale }}', {
+        longDateFormat: {
+            // Date range picker uses the 'L' format for displaying dates
+            L: 'DD/MM/YYYY', // We don't like the default, backwards US date format
+        }
+    });
     @endif
 
     $('[data-daterangepicker]').daterangepicker({
-        callback: function(startDate, endDate, period) {
+        callback: function (startDate, endDate, period) {
             showStatsLoader();
             let range = startDate.format('YYYY-MM-DD') + ',' + endDate.format('YYYY-MM-DD');
             let segmentation = document.querySelector('.daterangepicker [name="segmentation"]')?.value || false;
         startDate: '{{ $start_date }}',
         endDate: '{{ $end_date }}',
 
-        {{-- TODO: add translations - check https://github.com/sensortower/daterangepicker/issues/42 --}}
-        {{--
+        // TODO: add translations - check https://github.com/sensortower/daterangepicker/issues/42
+
         locale: {
-            applyButtonTitle: '{{ __('Apply')  }}',
-            cancelButtonTitle: '{{ __('Cancel')  }}',
-            startLabel: '{{ __('Start')  }}',
-            endLabel: '{{ __('Start')  }}',
+            applyButtonTitle: '{{ __('Appliquer')  }}',
+            cancelButtonTitle: '{{ __('Annuler')  }}',
+            startLabel: '{{ __('Début')  }}',
+            endLabel: '{{ __('Fin')  }}',
         }
-        --}}
+
     });
 
     {{-- Inject the segmentation (period) dropdown into the date picker --}}
     let picker = document.querySelector('.daterangepicker');
 
-    let segmentOptions = '<option value="">{{ __('Segmentation:') }} {{ __('Automatic') }}</option>';
+    let segmentOptions = '<option value="">{{ __('Affichage').__(' : ').__('Automatique') }}</option>';
     @foreach ($period_map as $period_key => $period_title)
-        segmentOptions += '<option value="{{ $period_key }}">{{ __('Segmentation:') }} {{ $period_title['periodic'] }}</option>'
+        segmentOptions += '<option value="{{ $period_key }}">{{ __('Affichage').__(' : ').$period_title['periodic'] }}</option>'
     @endforeach
 
     let segmentation = document.createElement('select');
         beforeDatasetsDraw(chart, args, options) {
 
             // Create an offset between the stacked bars
-            chart.config.data.datasets.forEach(function(dataset, datasetIndex) {
+            chart.config.data.datasets.forEach(function (dataset, datasetIndex) {
 
                 const bar_offset_percentage = dataset.bar_offset || 0;
 
                 // Go through each data point (bar) and apply the horizontal positioning offset
-                chart.getDatasetMeta(datasetIndex).data.forEach(function(dataPoint, index) {
+                chart.getDatasetMeta(datasetIndex).data.forEach(function (dataPoint, index) {
 
                     let offset = Math.round(dataPoint.width * bar_offset_percentage / 100);
 
                     // Make sure offset amount isn't too small
                     if (offset > 0 && offset < 2) {
                         offset = 2;
-                    } else if(offset < 0 && offset > -2) {
+                    } else if (offset < 0 && offset > -2) {
                         offset = -2;
                     }
 
             maintainAspectRatio: true, // As above, also a library default
             maxBarThickness: 100, // Prevent bars being ridiculously wide when there isn't much data
             scales: {
-                x: { stacked: true },
-                y: { stacked: false }, // Don't stack y-axis: prevents datasets from adding
+                x: {stacked: true},
+                y: {stacked: false}, // Don't stack y-axis: prevents datasets from adding
             },
             plugins: {
                 tooltip: {
                     mode: 'index',
                     position: 'nearest',
                     callbacks: {
-                        title: function(context) {
+                        title: function (context) {
                             return tooltip_labels[context[0].label];
                         }
                     },