Giter Site home page Giter Site logo

angularjschile / angular-bootstrap-calendar Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mattlewis92/angular-bootstrap-calendar

0.0 2.0 0.0 1.31 MB

A port of the bootstrap calendar widget to AngularJS (no jQuery required!)

Home Page: http://mattlewis92.github.io/angular-bootstrap-calendar/

License: MIT License

angular-bootstrap-calendar's Introduction

Angular Bootstrap Calendar

Table of contents

About

This plugin is an AngularJS port of the original jQuery bootstrap calendar that can be found here: http://bootstrap-calendar.azurewebsites.net/

The layout and functionality is intended to be exactly the same, but without the overhead of including jQuery just for a calendar.

All credits for the UI/UX of the calendar go to the original author.

Pull requests are welcome.

Installation

The calendar has a few dependencies, these are as follows, and must be included BEFORE the plugin files:

It is recommended that you install the plugin and its dependencies through bower:

bower install --save angular-bootstrap-calendar

You will then need to include the JS and CSS files for the plugin:

<link rel="stylesheet" href="bower_components/angular-bootstrap-calendar/dist/css/angular-bootstrap-calendar.min.css">
<script src="bower_components/angular-bootstrap-calendar/dist/js/angular-bootstrap-calendar.min.js">

And finally add the module dependency in your AngularJS app:

angular.module('myModule', ['mwl.calendar']);

Documentation

There is a single directive exposed to create the calendar, use it like so:

<mwl-calendar
    calendar-events="events"
    calendar-view="calendarView"
    calendar-current-day="calendarDay"
    calendar-control="calendarControl"
    calendar-event-click="eventClicked($event)"
    calendar-edit-event-html="'<i class=\'glyphicon glyphicon-pencil\'></i>'"
    calendar-delete-event-html="'<i class=\'glyphicon glyphicon-remove\'></i>'"
    calendar-edit-event-click="eventEdited($event)"
    calendar-delete-event-click="eventDeleted($event)"
    ></mwl-calendar>

An explanation of the properties is as follows:

calendar-events

An array of events to display on the calendar. For example:

$scope.events = [
  {
    title: 'My event title', // The title of the event
    type: 'info', // The type of the event (determines its color). Can be important, warning, info, inverse, success or special
    starts_at: new Date(2013,5,1,1), // A javascript date object for when the event starts
    ends_at: new Date(2014,8,26,15) // A javascript date object for when the event ends
  }
];

The 4 properties listed are required for all events.

calendar-view

This variable is a string that can be either 'year', 'month', 'week' or 'day. Changing it will change the view of the calendar.

calendar-current-day

This variable holds the current day the calendar is centralised on. Each view will decide on its current year / month / week / day depending on the value of this variable.

calendar-control

The directive will instantiate this variable for you and add the following methods to it:

  • prev - Goes to the previous page of the view
  • next - Goes to the next page of the view
  • getTitle - Gets the title of the calendar depending on the current date and view.

calendar-event-click

This function is called when an event is clicked on the calendar. $event contains the calendar event that was clicked on.

calendar-edit-event-html

If provided this piece of html will be displayed next to an event on the year and month view and will fire the function passed to edit-event-click.

calendar-delete-event-html

If provided this piece of html will be displayed next to an event on the year and month view and will fire the function passed to delete-event-click.

calendar-edit-event-click

This function is called when an event edit link is clicked on the calendar. $event contains the calendar event that was clicked on.

calendar-delete-event-click

This function is called when an event delete link is clicked on the calendar. $event contains the calendar event that was clicked on.

Demo

http://mattlewis92.github.io/angular-bootstrap-calendar/

Development

Prepare your environment

  • Install Node.js and NPM (should come with)
  • Install global dev dependencies: npm install -g gulp
  • Install local dev dependencies: npm install while current directory is this repo

Build

Run gulp to build the project files in the dist folder

Development server

Run gulp watch to start a development server with livereload on port 8000.

License

The MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

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.