Giter VIP home page Giter VIP logo

mmm-fullcalendario's Introduction

MMM-FullCalendarIO

A MagicMirror module that renders calendars using the fullcalendar.io javascript libraries.

Setting up to use this Module

There are a 2 things you will need to do in your overall configuration so you can then render these webview(s).

  1. Electron Options Referring to the MagicMirror Configuration, you will need to add the nodeIntegration: true to electronOptions. I am uncertain why this is needed (I have plenty of educated guesses), but if this value is false, things don't render.
	electronOptions: {
	/*  Note: MagicMirror uses Object.assign() to 'override' its defaults. In order to ensure
	    you get the defaults for webPreferences along with your 'override' you must fully define 
	    webPreferences to have all the MagicMirror defaults along with your override (nodeIntegration).
	    Thankfully, MagicMirror's default for webPreferences is zoomFactor: 1
	    and we are overriding the other default nodeIntegration
	*/
		webPreferences: {
			zoomFactor: 1, // default is actually zoomFactor: config.zoom, and zoom's default is 1.
			nodeIntegration: true, // the default for this is false. we are overriding this.
	},
  1. Custom CSS This is a kinda optional. Things do render without it, but the sizing is all crap. Basically what I am saying here is use CSS to style your webview; do not use the webview inline style. There are PLENTY of references/complaints online about how the webview isn't rendering fully as specified in the inline style. I wanted my entire screen to render as the webview. I finally came across a reference that presented a solution that actually worked (I hate css). This CSS did the trick; put this in your MagicMirror custom css css/custom.css.
.MMMFullCalendarIO {
  position: absolute;
  top: 30;
  left: 20;
  width: 90%;
  height: 100%;
  margin: 0 0 0 2em;
  display: inline-flex;
}

I did some adjustments based on the page I was loading as in my application the rendered webview was 'too wide' and then shifted too much to the left.

  1. Install and Build This module uses angular to render the calendar. After pulling down the module to your modules directory as MMM-FullCalendarIO, you will need to:

    • cd modules/MMM-FullCalendarIO
    • npm install
    • npm run build

Configuration

Add or Change 1 or more MMM-FullCalendarIO module configurations in ~/MagicMirror/config/config.js file:

```javascript
{
    module: "MMM-FullCalendarIO",
    position: "fullscreen_above",	
    config: {
        identifier: 'OurCalendar',
        cssClassname: 'MMMFullCalendarIO',
        fullcalendar: {
            // see https://fullcalendar.io/docs/initialization
            // document read function javascript
            //  see '// put your options and callbacks here'
        }
    }
}
```
Option Description
updateInterval the update interval for the HTML page.

Example for 30 seconds:30 * 1000
Default value: "0" (never update; except based on module lifecycle)
identifier unique id/name used in generating the html file.
This field is necessary to differentiate configurations
when more than 1 use if this module is present in the config.js

Default value: 'calendar'
cssClassname The name of the css definition for this Calendar.
If you created a CSS class definition in ***Custom CSS*** setup step above
you should provide that name for this option

Default value: 'webview' (no actual assignment as the element name matches the css class name)
Example using css class definition `.MMMFullCalendarIO`:'.MMMFullCalendarIO'
  • custom.css
    .MMMFullCalendarIO {
      position: absolute;
      top: 30;
      left: 20;
      width: 90%;
      height: 100%;
      margin: 0 0 0 2em;
      display: inline-flex;
    }
  • config.js:
    {
        module: "MMM-FullCalendarIO",
        position: "fullscreen_above",	
        config: {
            identifier: 'OurCalendar',
            cssClassname: 'MMMFullCalendarIO',
            fullcalendar: {
                // see https://fullcalendar.io/docs/initialization
                // document read function javascript
                //  see '// put your options and callbacks here'
            }
        }
    }
backgroundColor The background color of the rendered calendar area.
Default value:#A9A9A9 (grey)
themeName The name of the specific theme within the fullcalendar.themeSystem specified theme for css.
Default value:flatly (bootstrap4 themesystem theme)
fullcalendar The [fullcalendar IO option object](https://fullcalendar.io/docs/initialization) passed to the
fullcalendar function in the HTML.
This is passed without interpretation to the fullcalendar.io function call in the javascript of the generated HTML file.
Default value:
```javascript
{
    themeSystem: 'bootstrap4',
    views: {
        listDay: { buttonText: 'day' },
        listWeek: { buttonText: 'week'},
        threeMonths: { type: 'multimonth', duration: { weeks: 12 }, buttonText: '3-mos' },
    },
    defaultView: 'threeMonths',
    height: 'parent',
    contentHeight: 'auto',
    header: {
        left: '',
        center: 'title',
        right: ''
    },
    footer: {
        left: 'listDay,listWeek,month,threeMonths,  prev,today,next',
        center: '',
        right: '',
    },
}
```

Defaults result in following:

  • Bootstrap4 'flatly' theme style
  • 4 types of views used:
    • list events in current day
    • list events in current week
    • month view
    • 3 month view (Uses new custom multimonth view)
  • default view is 3 month view
  • scale height to limit of the calendar's parent container. Since this is rendered as an IFrame that covers a full screen, the limit is the full screen.
  • automatically scale the height of the calendar contents
  • show title of calendar in top center of calendar
  • On the bottom left of the calendar show 4 buttons for day, week, month, and 3 month views.
  • On the bottom left of the calendar, to the right of the 4 buttons show navigation buttons with today in the center.
  • On event click render the event data in a jquery 'popup' 'dialog' object.

All that is needed is the data for your events.

mmm-fullcalendario's People

Contributors

lpage30 avatar

Watchers

James Cloos avatar  avatar

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.