Giter Club home page Giter Club logo

grav-plugin-events's Introduction

Events Plugin for Grav CMS

Join the chat at https://gitter.im/grav-plugin-events/Lobby Build Status

This is an events plugin for Grav CMS 1.1.5+.

Create single and repeating events using event: frontmatter on any page you choose. The Events Plugin provides templates for calendar, events, and event views and supports creating events via the Admin plugin.

View our related Pages Repo to see how Calendar, Events, and Event pages are properly created.

Installation

From the root of your Grav install.

$ bin/gpm install events

You can also install this plugin from the Admin plugin using the plugins search feature.

Translations

Date translations can be enabled by setting date_format.translate to true in the config. They use the official Grav translation files, so if your language is missing, don't hesitate to contribute upstream.

Taxonomy

Events creates a few different taxonomy types and adds them programatically to Grav. You do not need to specify them in a config file as they are automatically inserted into the system based off of event frontmatter on event pages.

Currently, the following taxonomies are created and available for building page collections:

'@taxonomy.event_repeat' with params [M,T,W,R,F,S,U] When using this taxonomy, be sure to separate your repeat rules with a comma. When adding them to event.repeat: MTWRFSU do not separate the rules with a comma.

'@taxonomy.event_freq' with params [daily, weekly, monthly, yearly].

'@taxonomy.type' with param 'event'.

How it works

Events parses all of your markdown files for event: frontmatter and then automagically assigns taxonomies to your events based on whether they repeat through the week and through what intervals. This lets you build powerful collections based on the event_freq: and event_repeat: intervals. This lets you create custom displays. For example, if you want to build a list of all events that happen on Mondays you can filter on '@taxonomy.event_repeat':['M'] or pull out your Weekly events by filtering on '@taxonomy.event_freq':'weekly'.

It also adds any page found with event frontmatter to ''@taxonomy.type': 'event'. This allows you to build collections based on this taxonomy type.

The date: of a page will be set to event.start: automatically if not specified. This allows you to order your events by date using the order: paramater for collections.

If the event is a repeating event, pages will be added to the pages collection with the correct dates and times for use throughout the rest of a Grav site. Each virtual page is given a unique path with a 6 character tokenized suffix. The URL generated is safe to copy and paste on other sites and will go back to the specific reoccurring or repeating date of the event.

Specifying dates and times

The event.start: and event.end: dates can be specified using m/d/y or d-m-y formats along with times.

Repeating dates

This plugin supports creating repeating events using event.repeat:, event.freq:, and event.until:.

event.repeat: specifies what days you would like for your event to repeat horizontally across a calendar. This can be for Monday through Sunday as specified by MTWRFSU. (Monday, Tuesday, Wednesday, ThUrsday, Friday, Saturday, SUnday).

event.freq: can be set to daily, weekly, monthly, or yearly.

event.until: is a date and time specification like 01/01/2016 12:00am

Event frontmatter example

You can edit the front matter of your pages or use the Admin plugin with the supplied blueprints to update event information. If you use the Admin plugin, coordinates will automatically be geo-decoded from address that you enter.

event:
    start: '01/01/2015 6:00pm'
    end: '01/01/2015 7:00pm'
    repeat: 'MTWRFSU'
    freq: weekly
    until: '01/01/2020'
    location: 'Raleigh, NC'
    coordinates: '35.7795897, -78.6381787'

Collection frontmatter examples

A collection of weekend events.

collection:
    @items:
        @taxonomy.type: 'event'
        @taxonomy.event_repeat: [S, U]

A collection of weekly events.

collection:
  @items:
    @taxonomy.type: 'event'
    @taxonomy.event_freq: 'weekly'

A collection of featured events.

collection:
  @items:
    @taxonomy.type: 'event'
    @taxonomy.category: [ featured ]

Collection twig examples

A collection of weekend events with a dateRange using the DateTools Plugin. Note the use of limit for pagination. This plugin uses Grav's Pagination Plugin automatically if it is enabled.

{% set events =
  page.collection({
    'items': {
      '@taxonomy': {
        'type': 'event',
        'event_repeat': ['S','U']
      }
    },
    'dateRange': {
      'start': datetools.startOfWeek,
      'end': datetools.endOfWeek
    },
    'order': {
      'by': 'date',
      'dir': 'asc'
    },
    'limit': 10
  })
%}

<ul>
    {% for event in events %}
        <li>
            <a href="{{ event.url }}">{{ event.title }}</a>
            <time class="dt-start" datetime="{{ event.header.event.start|date('c') }}">
              {{ event.header.event.start|date('F j, Y') }}
            </time>
        </li>
    {% endfor %}
</ul>

DateTools Plugin

Be sure to checkout the DateTools Plugin. This plugin uses DateTools to filter date ranges on collection in twig templates.

grav-plugin-events's People

Contributors

aender6840 avatar kalebheitzman avatar paulcmal avatar piterden avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

grav-plugin-events's Issues

Calendar is displaying the start and end date wrong

Hey,

I set an start and end date for each event. In my calendar is just the start of the event shown and that twice. So it should be like in my apple calendar. Where the event is shown on every day between the start and end date.

Also on every 16th of the month it gives the current day class. That should be just today not the next 16th.

history calendar

config detail

I'm just after detail on how this should be configured.

I've set up:
Events page of type events. http://mermaids.woolnough.com.au/events/
Event pages underneath that http://mermaids.woolnough.com.au/events/sunday-training
Seperate calendar page (currently called schedule): http://mermaids.woolnough.com.au/schedule

The event pages do no display on the events page or the calendar.

I tried placing the following frontmatter in events, but didnt have any effect:

title: Events
collection:
    '@items':
        '@taxonomy.type': event

Breakdown menu in antimatter list also coming generated events

Hi,

So i assigned the event page type to a test page named "Presentation". Now, with menu, I see this page and all the coming events (which I would like to avoid). Is it a bug ? How can I fifter out the generated events from my menu ?

What I have when I'm on the "Presentation page":

bug-events

What I have when I click on an event (ie link to given event, http://localhost:8080/le-club/presentation/evt:73b402 and the original content is still as 1st result)):

bug-events2 2

If I'm on a non event content, rendering is:

bug-events3

Add `calendar` tag

If people search for a "calendar" plugin, Events doesn't show up. For this reason, I think the calendar tag should be added.

Event plug-in partially broken after GRAV update

This is a very strange situation as the GRAV update has partially broken event plug-in. After reversing the update, everything is ok. It doesn't work in parsing the events and displaying them on an event page using events.html.twig.

Changelog format causing problems

By modifying your changelog format, you are actually breaking it on the getgrav.org site. Changelog should be like this exactly:

# v1.0.10
## 02/11/2016

1. [](#new)
    * Added new `Page::contentMeta()` mechanism to store content-level meta data alongside content
    * Added Japanese language translation    
1. [](#improved)
    * Updated some vendor libraries
1. [](#bugfix)
    * Hide `streams` blueprint from Admin plugin
    * Fix translations of languages with `---` in YAML files

Yours is looking like this:

plugins grav 2016-02-28 18-07-00

Display passed events

I am trying to grasp the grav techniques and unfortunately got stuck. I am doing the website for culture center and it is essential to have some kind of events.
If I am making a collection with

content: items: '@taxonomy': type: event

I am getting only upcoming events. I tried to use

content: items: '@page.descendants': /events

and I do get the past events displayed but if I sort them by date

dateRange: start: 1/1/2014 end: 1/1/2016

I am not getting any.
I was hopping for archive plugin to sort it out somehow, but it doesn't show anything as well.
Probably I am missing something.

Coordinates

Sadly, since there's no demonstration page, it is hard for me to understand how this plugin "should" work. As for now I added an event. I expected to coordinates to be collected to display the google map or sth. Actually this doesn't work. And: when displaying a single event, the location is displayed nowhere. I there some documentation for the location feature?

How to contribute translation for this plugin?

Hi,

I would like to translate all the weekly, daily and other terms which are specific to your plugin in French to use your plugin in a clean way.

Is there a reference file in which I can find all labels and manage the translation ? I saw the languages.yml file but seems quite incomplete ; so what's the best way to contribute translation to your plugin ?

Thanks,
Nicolas

Install error

events-problem
I installed the plugin on my localhost-site running the latest grav-version with receptar-skeleton. Once installed the event-plugin it gives me an error "Undefined variable: eventPages"... see attachment
Can you help me?

Calendar template doesn't check for month when highlighting current day

In the calendar template, a current day is shown in each month (eg, on 22 June, the 22 August, September, October etc have the class 'current'.)

Quick fix is to add this before line 54 in calendar.html.twig: {% set month = "now"|date("F") %}
and add a check to line 58: {% if (day == calendar.currentDay) and (month == calendar.date|date("F")) %}

No end date causes site crash

I have a site with dozens of events on it (shows for a musician) and most have no end date, only a start date. This site works perfectly fine on a live server but I downloaded it today to make some changes on my local server and the site crashed with error: "Undefined index: end". This was highlighted in eventsProcessor.php:
image

On one hand this makes sense, it's looking for an event end date and none of my events have that. On the other hand, I have no problems on my live server. Any ideas why?

Perhaps a check could be added to eventsProcessor.php to only add the end date to the event object if the end date exists. I tried this out and it works great:

if ( isset( $event['end'] ) ) {
    $carbonEvent['end'] = Carbon::parse( $event['end'] );
}

Event Post Not Showing

Hey guys, I read through your readme and did as suggested but have had no success with getting an event to show up on my page. I used an example frontmatter from the readme and added new dates to it, and didn't add anything to the page content itself as I couldn't find anything in the readme suggesting I'd need to. Is there something I'm overlooking? Thanks.

URL in question
http://beta.thehouseofindie.com/events/indie-game-salon

Frontmatter in use

event:
title: 'Indie Game Salon'
start: '29/06/2016 8:00pm'
end: '29/06/2016 12:00am'
repeat: W
freq: monthly

does this plugin work yet?

Hi. This isn't exactly a bug, but this seemed like the best place to ask. I went to install this plugin with bin/gpm but got Nothing to install. Then I looked and realized you just published it yesterday so maybe it's not even finished, much less in the plugin directory.

But I'm looking for something to allow a non-developer client to easily create and delete events from grav admin, which would then populate an events page. Is that what this plugin is? And if so, is it usable yet?

Thanks.

iCal Support

I know this is far fetched, but this is a feature request for iCal support.

Extending events add the new event type to @taxonomy.type ?

Hi,

I would like to customise the event on admin side to add a few fields.

So I created a blueprint in my template named eventcvsq.yml containing:

title: Event CVSQ
'@extends':
    type: event
    context: blueprints://event

form:
  fields:
    tabs:
      fields:
    
        contact:
          type: tab
          title: Event
          fields:
            header.event.cvsq_type:
              type: select
              label: Event CVSQ
              options:
                'ml': 'Manches Libres Laser'
                'cf': 'Championnat de Flotte Laser'
                'fc': 'Fête du club'
                'al': 'Animation Libre Laser'
                'rc': 'Régate CVSQ'
                'ce': 'Coupe Entreprise'
                'au': 'Autre'

So on admin side, it works as expected.

My need would be at the end to filter on "@taxonomy.type": "eventcvsq" like this:

<div class="row actualite" data-equalizer data-equalize-on="medium" id="cvsq-actualite">
    <div class="small-12 medium-4 large-4 columns">
        <div class="cvsq-block" data-equalizer-watch>
        <h4>Prochains &eacute;v&eacute;nements</h4>
        {% set events =
            page.collection({
                'items': {
                    '@taxonomy.type': 'eventcvsq',
            },
                'dateRange': {
                    'start': datetools.today,
                    'end': datetools.endOfYear
                },
                'order': {
                    'by': 'date',
                    'dir': 'asc'
                },
                'limit': 15
            })
        %}
        {% for child in events %}
            {% include 'partials/event_homepage.html.twig' with {'eventcvsq':page, 'page':child, 'truncate':true} %}        
        {% endfor %}
    </div>
    </div>

I also added in the plugin setup the eventcvsq for the "Event template types"

But I have no output. When I use dump(child.taxonomy), I can see that my new events does not have the taxonomy.type added automatically, in opposite to defaults events.

How could I propagate the taxonomy.type to my custom events ? I don't strictly need that I have a type that match eventcvsq, I at least need that it's attached to type is equal to event.

And for the calendar and events page, it does not show up neither :(

Thanks,
Nicolas

virtual pages – 404 page not found

Dear maintainer, i can imagine this might be a minor configuration issue, but i couldn't come up with a solution myself:

Setup:

  • I'm currently only using the working examples: kalebheitzman/grav-pages-events
    • I have not costumized those files
      What does work:
  • Viewing the events listings
  • Viewing the event itself when removing the tokenized suffix
    What doesn't work:
  • The virtual pages are not working. I mean the pages with an unique path / a 6 character tokenized suffix.
    If i remove the tokenized suffix, the page itself is displayed correctly

Kind regards,

snapdeb

Issues with internationalizaion

Hi,

I love your plugin. It spared me lots and lots of time. However, my current project needs to be in German. The dates, however, I only get in English. They need to be German, as well. Where can I change the locale? I couldn't find that in your documentation.

Thanks in advance
Kim

admin crash on plugin save

admin crashes on save event plugin after installation 1.0.6 update

Whoops \ Exception \ ErrorException (E_RECOVERABLE_ERROR)
COPY
Argument 1 passed to Grav\Common\Data\Blueprint::mergeArrays() must be of the type array, string given, called in /Library/WebServer/Documents/ami/system/src/Grav/Common/Data/Blueprint.php on line 276 and defined

Note: 100% repeatable

Admin Event Creation

Just wanted to suggest that creating events via admin would be awesome. Grav now supports blueprints extensions so it may be possible to add on to existing page editing and add options to edit event.

If I have the time I might create a pull request

Missing Events

I am testing out this great extension as I am testing Grav. For some reason events past 12/25/2016 start date do not show up on the page designated as the events page. I also made sure the extensions setting "Months Out to Display Events" is set to 12. Are there any additional settings that I may have missed.

Please provide default page integration sample ?

Hi,

Starting with Grav, i'm not yet clear about how I should add your plugins to the default page ; could you please precise it ?

I read docs about blueprint but so far, I'm not clear about how I should manage this.

Thanks in advance,
Nicolas

Event on last day of each month.

I've been playing around with the settings of the events and I can't seem to get an event to repeat on the last day of a month. Is there a trick to make this work?

Invalid argument supplied for foreach()

v1.0.13 crashes on front page load

Whoops\Exception\ErrorException thrown with message "Invalid argument supplied for foreach()"

Stacktrace:
#16 Whoops\Exception\ErrorException in /var/www/public_html/classes/thesis/user/plugins/events/classes/events.php:297
#15 Whoops\Run:handleError in /var/www/public_html/classes/thesis/user/plugins/events/classes/events.php:297
#14 Events\Events:initEventStack in /var/www/public_html/classes/thesis/user/plugins/events/classes/events.php:216
#13 Events\Events:instances in /var/www/public_html/classes/thesis/user/plugins/events/events.php:196
#12 Grav\Plugin\EventsPlugin:onPagesInitialized in /var/www/public_html/classes/thesis/vendor/symfony/event-dispatcher/EventDispatcher.php:184
#11 call_user_func in /var/www/public_html/classes/thesis/vendor/symfony/event-dispatcher/EventDispatcher.php:184
#10 Symfony\Component\EventDispatcher\EventDispatcher:doDispatch in /var/www/public_html/classes/thesis/vendor/symfony/event-dispatcher/EventDispatcher.php:46
#9 Symfony\Component\EventDispatcher\EventDispatcher:dispatch in /var/www/public_html/classes/thesis/vendor/rockettheme/toolbox/Event/src/EventDispatcher.php:23
#8 RocketTheme\Toolbox\Event\EventDispatcher:dispatch in /var/www/public_html/classes/thesis/system/src/Grav/Common/Grav.php:310
#7 Grav\Common\Grav:fireEvent in /var/www/public_html/classes/thesis/system/src/Grav/Common/Processors/PagesProcessor.php:18
#6 Grav\Common\Processors\PagesProcessor:process in /var/www/public_html/classes/thesis/system/src/Grav/Common/Grav.php:121
#5 Grav\Common\Grav:Grav\Common\{closure} in /var/www/public_html/classes/thesis/system/src/Grav/Common/Grav.php:396
#4 Grav\Common\Grav:Grav\Common\{closure} in /var/www/public_html/classes/thesis/system/src/Grav/Common/Grav.php:372
#3 call_user_func_array in /var/www/public_html/classes/thesis/system/src/Grav/Common/Grav.php:372
#2 Grav\Common\Grav:__call in /var/www/public_html/classes/thesis/system/src/Grav/Common/Grav.php:122
#1 Grav\Common\Grav:measureTime in /var/www/public_html/classes/thesis/system/src/Grav/Common/Grav.php:122
#0 Grav\Common\Grav:process in /var/www/public_html/classes/thesis/index.php:45

v1.0.12 was working find, and everything else works once the plugin is removed.

Any ideas?

spuriously doubled events in event list after update to 1.0.6

After updating the event plugin to 1.0.6., about fifteen non-repeating events from a collection are shown with duplicates. Not all items are duplicated. The list is built by iterating over a collection of event pages. The pages themselves appear untouched. The uri's of the duplicates have the form original-event-uri-HEXNUM

Note: this never happened before the update.

Event on several day : link to event on starting day is fine but other return 404.

Hi,

If you look at this page, you will see event on several days like:

  • 18 March (Mars in French) - Régate de Ligue Laser Trophée Equinoxe
  • 19 March (Mars in French) - Régate de Ligue Laser Trophée Equinoxe

It leads to following code:

<li class="even">
    <a href="/calendriers_resultats/agenda/ligue-laser-trophee-equinoxe">Samedi 18 - Régate de Ligue Laser Trophée Equinoxe</a>
</li>
<li class="odd">
<a href="/calendriers_resultats/agenda/ligue-laser-trophee-equinoxe/16e910">Dimanche 19 - Régate de Ligue Laser Trophée Equinoxe</a>
</li>

The 1st link /calendriers_resultats/agenda/ligue-laser-trophee-equinoxe will work but not /calendriers_resultats/agenda/ligue-laser-trophee-equinoxe/16e910.

I'm up to date with Grav & plugins versions.

On template side, code is:

{% for event in events %}
[...]
<li class="{{ cycle(['odd','even'], loop.index0) }}"><a href="{{ event.url }}">{{ 'DAYS_OF_THE_WEEK'|ta(event.header.event.start|date("N")-1) }} {{ event.header.event.start|date("j") }} - {{ event.menu }}</a></li>
[...]
{% endfor %}

With events being:

{% set events =
    page.collection({
      'items': {
        '@taxonomy': {
          'type': 'event',
        }
      },
      'dateRange': {
        'start': datetools.today|date('m/d/Y'),
        'end': datetools.parseDate('+12 month')|date('m/d/Y')
      },
      'order': {
        'by': 'date',
        'dir': 'asc'
      },
      'pagination': true
    })
%}

How could we make it work ?

Let me know if you need more details.

Thanks,
Nicolas

css looks broken

Tried to add the Events plugin from the Admin to a vanilla Grav install, but the result (right on the screenshot) looks broken, compared to what is on the demo page (on the left).
It looks like a whole set of css-rules does not get applied (missing references to the stylesheet?). The only thing I detect that is different: in the demo, there is a section.calender-table around the table.calendar element.
Any idea if I might have done something wrong?

demo

Event plugin pages html is not valid

There are few code errors that leads to various issues when trying to validate event page. Here are some of them in events.html.twig
An img element must have an alt attribute, except under certain conditions.

          <div class="featured-event-masthead">
            {% set image = event.media.images|first %}
            {% if image != null %}
              {{ image.cropZoom(1200,400).html }}
            {% endif %}
            <h3 class="featured-event-title"><a href="{{ event.url }}">{{ event.title }}</a></h3>
          </div>

Self-closing syntax (/>) used on a non-void HTML element. Ignoring the slash and treating as a start tag.
<a href="{{ event.url }}" class="event-button" />{{ 'PLUGIN_EVENTS.EVENTS.BUTTON'|t }}</a>

Section lacks heading. Consider using h2-h6 elements to
<section class="featured-events">

I only tried validate page created by events.html.twig, haven't validate other pages.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.