No commit activity in last 3 years
No release in over 3 years
Add a CanvasField to point out errors in three different colors
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 1.15
~> 10.0
 Project Readme

AjaxCanvasField

Installation

Add this line to your application's Gemfile:

gem 'ajax_canvas_field'

And then execute:

$ bundle

Or install it yourself as:

$ gem install ajax_canvas_field
After bundle
$ rails g ajax_canvas_field

This add the following:

  • initializers/ajax_canvas_field.rb
AjaxCanvasField.configure(default_height: 400,
                            default_width: 400,
                            default_left_color: '#ff0000',
                            default_middle_color: '#00ff00',
                            default_right_color: '#0000ff')
  • assets/javascripts/application.js
//= require ajax_canvas_field
  • assets/stylesheets/application.scss assets/stylesheets/application.scss.erb assets/stylesheets/application.css.scss
*= require ajax_canvas_field

Usage

This Gem provides you with some View-Helper for Rails

  1. canvas_field Provides the main canvas_field with id: #canvas_field
# options
:namespace # URL Namespace for ajax-POST e.g. 'api/v1'
:controller # URL Controller for ajax-POST e.g. 'canvas_fields'
:background_url # File-Path for background image
  1. canvas_data_field(active) Provides a data-Field for different datasets
# args
:active (bool) # Is this the active data field?
# options
:additional_data # Additional Data to provide to the AJAX-POST
:initial_data # The Initial-Data that is loaded
:content # Symbol that appears in the Dot
  1. canvas_legend_field Renders a Legend Table for the Field
# options
:left_text # Text for left Click
:middle_text # Text for middle Click
:right_text # Text for right Click
:left_color # Color for left Click e.g. '#ffff00'
:middle_color # Color for middle Click e.g. '#ffff00'
:right_color # Color for right Click e.g. '#ffff00'
:no_icon # Hide Mouse-Icon-Row
:no_header # Hide Header
  1. ro_canvas_field Provides readonly canvas_fields with class: .canvas_field, for showing the results of all datasets on one Page
# options
:background_url # File-Path for background image

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/datyv/ajax_canvas_field. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.