Project

avgrund_to

0.0
No commit activity in last 3 years
No release in over 3 years
Wraps hakim's awesome Avgrund reimagining of the modal window into a Rails Engine
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

 Project Readme

AvgrundTo¶ ↑

Wraps hakim’s awesome Avgrund reimagining of the modal window into a Rails Engine.

I’ve had to make a few adjustments to make it work with scrollable content (the original sets the body to overflow:hideden, preventing scrolling).

To use, you’ll have to add the class “avgrund-contents” to the block container you’d like to blur (usually the div that’s the immediate child of body).

Then you’ll need to require avgrund in application.js

//= require avgrund_to/modal
//= require avgrund_to/avgrund

Same with your application.css

*= require avgrund

Then you’ll need to render the partial for the modal in your layout file

<%= render 'avgrund_to/modal' %>

Then you just use the helper method avgrund_to the same way you’d use link_to

<%= avgrund_to 'Edit', shipment, {:class=>'btn btn-primary'}, "Edit Shipment #{shipment.order_number.upcase}" %>

You’ll need to edit your controller to accept the .text format (behavior inherited from isieo’s modal-me Rails Engine, from which this gem was inspired)

def show
  @shipment = Shipment.unscoped.find(params[:id].downcase)

  respond_to do |format|
    format.html # show.html.erb
    format.json { render json: @shipment }
    format.text { render 'show', formats: [:html], layout: false }
  end
end

And that’s it :)

The gem is very rough and raw, and I’m sure there are lots of ways to improve it (it’s yet another modal window plugin after all). Suggestions and feedback are welcome, please use the Issue Tracker for them.