All Projects → nbulaj → mapbox-gl-rails

nbulaj / mapbox-gl-rails

Licence: MIT license
A gem to provide Mapbox GL JS and it's ecosystem (plugins) for Rails applications 🚆

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to mapbox-gl-rails

Terrastories
Terrastories is a geostorytelling application built to enable local communities to locate and map their own oral storytelling traditions about places of significant meaning or value to them. Check out our Wiki for open source development information.
Stars: ✭ 158 (+393.75%)
Mutual labels:  mapbox-gl-js, ruby-on-rails
mapbox-gl-accessibility
An accessibility control for Mapbox GL JS
Stars: ✭ 64 (+100%)
Mutual labels:  mapbox-gl-js
lamby-cookiecutter
AWS SAM Cookiecutter to Quick Start Rails & Lambda 🐑🛤
Stars: ✭ 17 (-46.87%)
Mutual labels:  ruby-on-rails
prefixed ids
Friendly Prefixed IDs for your Ruby on Rails models
Stars: ✭ 159 (+396.88%)
Mutual labels:  ruby-on-rails
bioportal web ui
A Rails application for biological ontologies
Stars: ✭ 20 (-37.5%)
Mutual labels:  ruby-on-rails
stimulus reflex todomvc
An implementation of TodoMVC using Ruby on Rails, StimulusJS, and StimulusReflex
Stars: ✭ 50 (+56.25%)
Mutual labels:  ruby-on-rails
challenges-back-end
Repositório referente à desafios de Back End da womakerscode
Stars: ✭ 68 (+112.5%)
Mutual labels:  ruby-on-rails
nxt state machine
A simple but powerful state machine implementation.
Stars: ✭ 14 (-56.25%)
Mutual labels:  ruby-on-rails
guardrails
guardrails.cs.virginia.edu
Stars: ✭ 18 (-43.75%)
Mutual labels:  ruby-on-rails
railways
A plugin for RubyMine and IntelliJ IDEA Ultimate that adds a panel with routes of Ruby on Rails application.
Stars: ✭ 44 (+37.5%)
Mutual labels:  ruby-on-rails
i18n lazy scope
Use lazy lookup with custom i18n scopes.
Stars: ✭ 11 (-65.62%)
Mutual labels:  ruby-on-rails
active record-updated at
Touch `updated_at` by default with calls to `update_all` and `update_column(s)`
Stars: ✭ 27 (-15.62%)
Mutual labels:  ruby-on-rails
campaign-manager
The Camapign Management UI for RTB4Free, the open source bidder / DSP.
Stars: ✭ 24 (-25%)
Mutual labels:  ruby-on-rails
gitlabFAQ
🐧 Gitlab常见问题和有用信息、链接 📝
Stars: ✭ 21 (-34.37%)
Mutual labels:  ruby-on-rails
activerecord-setops
Union, Intersect, and Difference set operations for ActiveRecord (also, SQL's UnionAll).
Stars: ✭ 21 (-34.37%)
Mutual labels:  ruby-on-rails
docker-rails-demo
Demo app for Rails, Docker and Webpack
Stars: ✭ 29 (-9.37%)
Mutual labels:  ruby-on-rails
MyopicVicar
MyopicVicar (short-sighted clergyman!) is an open-source genealogy record database and search engine. It powers the FreeREG database of parish registers, the FreeCEN database of census records, the next version of FreeBMD database of Civil Registration indexes and other Genealogical applications.
Stars: ✭ 40 (+25%)
Mutual labels:  ruby-on-rails
graphql-ruby-sample
Sample application for demonstrating GraphQL Ruby on Rails integration
Stars: ✭ 16 (-50%)
Mutual labels:  ruby-on-rails
request store-sidekiq
Provides an easy integration between RequestStore and Sidekiq
Stars: ✭ 32 (+0%)
Mutual labels:  ruby-on-rails
lookbook
A tool to help browse, develop, test & document ViewComponents in Ruby on Rails apps 🛠
Stars: ✭ 420 (+1212.5%)
Mutual labels:  ruby-on-rails

Mapbox for Rails

Gem Version Build Status License

mapbox-gl-rails provides the Mapbox GL JS library as a Rails engine for use with the asset pipeline. It uses the same versioning as the Mapbox GL JS.

Supports Rails >= 3.2 (see Travis build matrix).

Installation

Add this to your Gemfile:

gem 'mapbox-gl-rails'

and run bundle install.

Usage

In your application.js, include the following:

//
//*= require mapbox-gl
//= require_tree .

In your application.css, include the css file:

/*
 *= require mapbox-gl
 */

Then restart your webserver if it was previously running.

Congrats! You now have Mapbox GL JS on board and check out the Mapbox Examples.

If you need to use any available plugins, then don't forget to add them to application.js and application.css:

JS:

//*= require mapbox-gl-geocoder
// ...

CSS:

/*
 *= require mapbox-gl-geocoder
 *= require mapbox-gl-draw
 *= require mapbox-gl-directions
 *= require mapbox-gl-compare
 ...
 */

Full list of integrated plugins you could find here.

Sass Support

If you prefer SCSS, add this to your application.css.scss file:

@import 'mapbox-gl';

If you use the Sass indented syntax, add this to your application.css.sass file:

@import mapbox-gl

Misc

Rails engines

When building a Rails engine that includes mapbox-gl-rails as a dependency, be sure to require "mapbox-gl-rails" somewhere during the intialization of your engine. Otherwise, Rails will not automatically pick up the load path of the mapbox-gl-rails assets and helpers.

Deploying to sub-folders

It is sometimes the case that deploying a Rails application to a production environment requires the application to be hosted at a sub-folder on the server. This may be the case, for example, if Apache HTTPD or Nginx is being used as a front-end proxy server, with Rails handling only requests that come in to a sub-folder such as http://example.com/myrailsapp. In this case, the MapboxRails gem (and other asset-serving engines) needs to know the sub-folder, otherwise you can experience a problem roughly described as "my app works fine in development, but fails when I deploy it".

To fix this, set the relative URL root for the application. In the environment file for the deployed version of the app, for example config/environments/production.rb, set the config option action_controller.relative_url_root:

MyApp::Application.configure do
  ...

  # set the relative root, because we're deploying to /myrailsapp
  config.action_controller.relative_url_root  = "/myrailsapp"

  ...
end

The default value of this variable is taken from ENV['RAILS_RELATIVE_URL_ROOT'], so configuring the environment to define RAILS_RELATIVE_URL_ROOT is an alternative strategy.

In addition you need to indicate the subfolder when you precompile the assets:

RAILS_ENV=production bundle exec rake assets:precompile RAILS_RELATIVE_URL_ROOT=/myrailsapp

Rails 3.2

Note: In Rails 3.2, make sure mapbox-gl-rails is outside the bundler asset group so that these helpers are automatically loaded in production environments.

Versioning

Versioning follows the core releases of Mapbox GL JS which follows Semantic Versioning 2.0 as defined at http://semver.org. We will do our best not to make any breaking changes until Mapbox core makes a major version bump.

Additional build number can be added to fix internal gem errors (like 0.43.0.0).

Releasing

  1. Update gem version in lib/mapbox-gl/rails/version.rb to match latest MapBox GL version.
  2. Run bundle exec rake update (this will automatically load and convert assets).
  3. Commit
  4. Create gem and push it to Rubygems
  5. Create a GitHub release.

License

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].