Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
This gem helps load and display a calendar from google calendar in an agenda or month style view.
The gem consists of mainly three models and views. One - the event loader model - is focusing on loading the events from the google server via a restfull api and an api key. The other two are the agenda and month model wich offer functionality to organize the data for an agenda or month view. Next to the models are the views wich come with a _frame.slim
view. This view can be included in a host view as a partial. This way one can display a calendar inside of another page. The _frame.slim
is the entry point that prepares the model and view for the respective view type (month/agenda). (It does not come with a seperate week view.)
This gem depends on a few other gems that are quite common so your application may already depend on them. To make dependency matters easier this gem will not depend on them on its own but rather expects these dependencies to be present in your application. This way there should be less dependency version collisions since you get to define them. (This gem does depend on them but it only uses base level functionality so that it shouldn't matter much what version you use.)
These dependencies are:
So make sure to also have these gems in your gemfile and installed them via bundle install
.
Add this line to your application's Gemfile:
gem 'candl'
And then execute:
$ bundle
Or install it yourself as:
$ gem install candl
Additionally:
Require the library in the ./app/assets/stylesheets/application.scss
(or .css) of your ruby on rails application like so:
# ./app/assets/stylesheets/application.scss
/*
...
*= require material_icons
*= require candl
...
*/
And also require the library in the ./app/assets/javascripts/application.js
of your ruby on rails application like so:
# ./app/assets/javascripts/application.js
// ...
//= require jquery3
//= require turbolinks
//= require bootstrap
//= require candl
// ...
Hint: The ...
Ellipsis is there to indicate left out other entries. The relevant entries (asset requirements of gems this gem depends on) are also included here to give a suggested order in wich to require them, since a wrong order here can lead to confusing errors.
You may look in ./spec/dummy/app/assets/
and there in ./javascripts
and ./stylesheets
to see how it is done there. An example inclusion of the _frame.slim
partial in a view can be found in ./spec/dummy/app/views/sample/show.slim
. Or to see the calendar in action run rails server
in your command line interface (while beeing in the gems root folder) and when the server is started navigate to localhost:3000/calendar
and load the page.
This example uses .slim instead of .erb if you need help with the syntax try some of the online .slim to .erb syntax converters.
The partial needs to set a local config variable that is a hash containing the needed configuration. Create the hash in the view you want to render the partial in like this:
ruby:
config = {
calendar: {
google_calendar_api_host_base_path: "https://www.googleapis.com/calendar/v3/calendars/",
calendar_id: "schau-hnh%40web.de",
api_key: "AIzaSyB5F1X5hBi8vPsmt1itZTpMluUAjytf6hI"
},
agenda: {
display_day_count: 14,
days_shift_coefficient: 7
},
month: {
summary_teaser_length_in_characters: 42,
delta_start_of_weekday_from_sunday: 1
},
general: {
maps_query_host: "https://www.google.de/maps",
maps_query_parameter: "q",
cache_update_interval_in_s: 7200
}
}
Hints:
Then at the position in your view where the calendar is supposed to show itself:
= render partial: "candl/calendar/frame", locals: { config: config }
Bug reports and pull requests are welcome on GitHub at this repository.
The gem is available as open source under the terms of the MIT License.
FAQs
Unknown package
We found that candl demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.