[RAILS] Easy calendar

Introduction

With a little slapstick, I added a calendar function to the app. I will introduce the flow. It's not a useful calendar yet, so I'll adjust it a little more.

Introduction flow

  1. Write Gem
  2. Installation
  3. CSS description
  4. Display
  5. (Generate view)

1. Write Gem

Gemfile


gem "simple_calendar", "~> 2.0"

2. Installation

Make sure the current directory is the application you are creating

% bundle install

3. CSS description

*
 *= require simple_calendar ← Describe this
 *= require_tree .
 *= require_self
*/

4. Display


<%= month_calendar do |date| %>
  <%= date %>
<% end %>

↑ At a minimum, you can create a calendar like this.

5. (Generate view)


rails g simple_calendar:views

If you edit the view generated by this command, you can fine-tune the view.

Recommended Posts

Easy calendar
Calendar related
Date () and Calendar ()