EZCalendar v0.1.5 EZCalendar.HTML

Functions for rendering the calendars with HTML.

For easy access to the HTML render functions add EZCalendar to your view.

defmodule MyApp.ShiftView do
  use MyApp.Web, :view
  import EZCalendar.HTML
end

This will import the functions in EZCalendar.HTML and EZCalendar.HTML.Navigation

View example:

<%= calendar_prev @calendar, "/shifts/:year/:month" %>
<%= @calendar.title %>
<%= calendar_next @calendar, "/shifts/:year/:month" %>

<%= month_calendar @calendar, fn(date)-> %>
  <!-- calendar date -->
  <%= for shift <- date.data do %>
    <!-- query results for date -->
  <% end %> 
<% end %> 

Summary

Functions

Calls calendar/3 with EZCalendar.HTML.BiweeklyCalendar as the first argument

Renders a calendar struct for a given module

Calls calendar/3 with EZCalendar.HTML.DayCalendar as the first argument

Calls calendar/3 with EZCalendar.HTML.MonthCalendar as the first argument

Calls calendar/3 with EZCalendar.HTML.WeekCalendar as the first argument

Functions

biweekly_calendar(calendar_struct, render_func)

Calls calendar/3 with EZCalendar.HTML.BiweeklyCalendar as the first argument

calendar(html_module, calendar_struct, render_func)

Renders a calendar struct for a given module.

Takes a HTML calendar module, a calendar struct and a function as arguments. The provided function will be called with each calendar date to render its contents

<%= calendar EZCalendar.MonthCalendar, @calendar, fn(date)-> %>
  <!-- calendar date -->
  <%= for shift <- date.data do %>
    <!-- query results for date -->
  <% end %>
<% end %>
day_calendar(calendar_struct, render_func)

Calls calendar/3 with EZCalendar.HTML.DayCalendar as the first argument

month_calendar(calendar_struct, render_func)

Calls calendar/3 with EZCalendar.HTML.MonthCalendar as the first argument

week_calendar(calendar_struct, render_func)

Calls calendar/3 with EZCalendar.HTML.WeekCalendar as the first argument