Add list views per week and month

Signed-off-by: Jean-Guilhem Rouel <jean-gui@w3.org>

Translation of buttons for list views

Signed-off-by: Jean-Guilhem Rouel <jean-gui@w3.org>

Show location in list views when available

Signed-off-by: Jean-Guilhem Rouel <jean-gui@w3.org>

Remove unneeded code per https://github.com/nextcloud/calendar/pull/2476#discussion_r479793226

Signed-off-by: Jean-Guilhem Rouel <jean-gui@w3.org>

Fix location, parent class changed

Signed-off-by: Jean-Guilhem Rouel <jean-gui@w3.org>

Show start of description in list views, if available.

Signed-off-by: Jean-Guilhem Rouel <jean-gui@w3.org>

Add start of description if available in list view

Signed-off-by: Jean-Guilhem Rouel <jean-gui@w3.org>

Remove week list view

Signed-off-by: Jean-Guilhem Rouel <jean-gui@w3.org>
This commit is contained in:
Jean-Guilhem Rouel 2020-08-19 18:36:27 +02:00 committed by Georg Ehrke
parent 12fc1b609e
commit 1a8cc8fd79
No known key found for this signature in database
GPG Key ID: 9D98FD9380A1CB43
10 changed files with 43 additions and 6 deletions

View File

@ -31,9 +31,9 @@ return [
['name' => 'view#index', 'url' => '/new/{isAllDay}/{dtStart}/{dtEnd}', 'verb' => 'GET', 'postfix' => 'direct.new.timerange'],
['name' => 'view#index', 'url' => '/edit/{objectId}', 'verb' => 'GET', 'postfix' => 'direct.edit'],
['name' => 'view#index', 'url' => '/edit/{objectId}/{recurrenceId}', 'verb' => 'GET', 'postfix' => 'direct.edit.recurrenceId'],
['name' => 'view#index', 'url' => '/{view}/{timeRange}', 'verb' => 'GET', 'requirements' => ['view' => 'timeGridDay|timeGridWeek|dayGridMonth'], 'postfix' => 'view.timerange'],
['name' => 'view#index', 'url' => '/{view}/{timeRange}/new/{mode}/{isAllDay}/{dtStart}/{dtEnd}', 'verb' => 'GET', 'requirements' => ['view' => 'timeGridDay|timeGridWeek|dayGridMonth'], 'postfix' => 'view.timerange.new'],
['name' => 'view#index', 'url' => '/{view}/{timeRange}/edit/{mode}/{objectId}/{recurrenceId}', 'verb' => 'GET', 'requirements' => ['view' => 'timeGridDay|timeGridWeek|dayGridMonth'], 'postfix' => 'view.timerange.edit'],
['name' => 'view#index', 'url' => '/{view}/{timeRange}', 'verb' => 'GET', 'requirements' => ['view' => 'timeGridDay|timeGridWeek|dayGridMonth|listMonth'], 'postfix' => 'view.timerange'],
['name' => 'view#index', 'url' => '/{view}/{timeRange}/new/{mode}/{isAllDay}/{dtStart}/{dtEnd}', 'verb' => 'GET', 'requirements' => ['view' => 'timeGridDay|timeGridWeek|dayGridMonth|listMonth'], 'postfix' => 'view.timerange.new'],
['name' => 'view#index', 'url' => '/{view}/{timeRange}/edit/{mode}/{objectId}/{recurrenceId}', 'verb' => 'GET', 'requirements' => ['view' => 'timeGridDay|timeGridWeek|dayGridMonth|listMonth'], 'postfix' => 'view.timerange.edit'],
// Public views
['name' => 'publicView#public_index_with_branding', 'url' => '/p/{token}', 'verb' => 'GET'],
['name' => 'publicView#public_index_with_branding', 'url' => '/p/{token}/{view}/{timeRange}', 'verb' => 'GET', 'postfix' => 'publicview.timerange'],

View File

@ -63,4 +63,4 @@
"Play" : "Play",
"Global" : "Global"
},"pluralForm" :"nplurals=2; plural=(n != 1);"
}
}

View File

@ -406,4 +406,4 @@
"Lunch" : "Repas",
"Global" : "Général"
},"pluralForm" :"nplurals=2; plural=(n > 1);"
}
}

View File

@ -102,7 +102,7 @@ class SettingsController extends Controller {
* @return JSONResponse
*/
private function setView(string $view):JSONResponse {
if (!\in_array($view, ['timeGridDay', 'timeGridWeek', 'dayGridMonth'])) {
if (!\in_array($view, ['timeGridDay', 'timeGridWeek', 'dayGridMonth', 'listMonth'])) {
return new JSONResponse([], Http::STATUS_UNPROCESSABLE_ENTITY);
}

View File

@ -151,6 +151,7 @@ export default {
break
case 'dayGridMonth':
case 'listMonth':
default: {
// modifyDate is just adding one month, so we have to manually
// set the date of month to 1. Otherwise if your date is set to

View File

@ -59,6 +59,10 @@ export default {
id: 'dayGridMonth',
icon: 'icon-view-module',
label: this.$t('calendar', 'Month'),
}, {
id: 'listMonth',
icon: 'icon-view-module',
label: this.$t('calendar', 'Month (list)'),
}]
},
shortKeyConf() {

View File

@ -31,6 +31,9 @@
<button :class="{primary: isMonthViewSelected}" class="button" @click="view('dayGridMonth')">
{{ $t('calendar', 'Month') }}
</button>
<button :class="{primary: isMonthListViewSelected}" class="button" @click="view('listMonth')">
{{ $t('calendar', 'Month (list)') }}
</button>
</div>
</template>
@ -47,6 +50,9 @@ export default {
isMonthViewSelected() {
return this.selectedView === 'dayGridMonth'
},
isMonthListViewSelected() {
return this.selectedView === 'listMonth'
},
selectedView() {
return this.$route.params.view
},

View File

@ -42,6 +42,7 @@ export default (value, view, locale) => {
})
case 'dayGridMonth':
case 'listMonth':
default:
return moment(value).locale(locale).format('MMMM YYYY')
}

View File

@ -141,6 +141,8 @@ export function eventSourceFunction(calendarObjects, calendar, start, end, timez
objectType: object.name,
percent: object.percent || null,
davUrl: calendarObject.dav.url,
location: object.location,
description: object.description,
},
}

View File

@ -73,4 +73,27 @@ export default function({ event, el }) {
el.dataset.objectId = event.extendedProps.objectId
el.dataset.recurrenceId = event.extendedProps.recurrenceId
}
if (event.extendedProps.location != null && el.classList.contains('fc-list-event')) {
const location = document.createElement('span')
location.appendChild(document.createTextNode(' (' + event.extendedProps.location + ')'))
el.lastChild.appendChild(location)
}
if (event.extendedProps.description != null && el.classList.contains('fc-list-event')) {
const description = document.createElement('p')
const descriptionLines = event.extendedProps.description.split('\n')
const nbLines = Math.min(2, descriptionLines.length)
for (let i = 0; i < nbLines; i++) {
description.appendChild(document.createTextNode(descriptionLines[i]))
if (i < nbLines - 1) {
description.appendChild(document.createElement('br'))
}
}
if (descriptionLines.length > 2) {
description.appendChild(document.createElement('br'))
description.appendChild(document.createTextNode('...'))
}
el.lastChild.appendChild(description)
}
}