{"id":15543818,"url":"https://github.com/amiel/can_haz_modal","last_synced_at":"2025-07-11T16:07:16.645Z","repository":{"id":996351,"uuid":"806375","full_name":"amiel/can_haz_modal","owner":"amiel","description":"Ruby on Rails plugin to automatically render without a layout on certain requests","archived":false,"fork":false,"pushed_at":"2010-09-30T19:01:20.000Z","size":96,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-03T12:33:15.569Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/amiel.png","metadata":{"files":{"readme":"README","changelog":null,"contributing":null,"funding":null,"license":"MIT-LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2010-07-29T22:42:39.000Z","updated_at":"2023-11-22T21:49:59.000Z","dependencies_parsed_at":"2022-07-06T00:33:44.753Z","dependency_job_id":null,"html_url":"https://github.com/amiel/can_haz_modal","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amiel%2Fcan_haz_modal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amiel%2Fcan_haz_modal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amiel%2Fcan_haz_modal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amiel%2Fcan_haz_modal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/amiel","download_url":"https://codeload.github.com/amiel/can_haz_modal/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247288819,"owners_count":20914438,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-02T12:28:30.989Z","updated_at":"2025-04-05T04:25:30.548Z","avatar_url":"https://github.com/amiel.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"Can Haz Modal\n=============\n\nRequests with the format of :partial will now render with no layout\nThe format will be adjusted back to :html so that your html views will be rendered even when the :partial format is specified\n\nTwo things you will need to do to take advantage of this plugin:\n  \n  1. add :format =\u003e :partial to links that you want to open in a modal\n  \n    Example: new_user_session_path(:format =\u003e :partial)\n    \n  2. Setup some sort of modal javascript library and make it open for links that end with .partial\n\n    Here is an example using jQuery and Boxy:\n\n      $('[href$=.partial]').boxy();\n\n  3. Profit\n\n\nRails 3\n=======\n\nThis plugin has not been ported to rails 3 yet. I promise I'll get to it soon.\n\nIn the mean time, it's really easy to just copy over the bits you need:\n\nAdd the mime type to your initializers (config/initializers/mime_types.rb):\n\n  Mime::Type.register_alias 'text/html', :partial\n\n\nPut this in your ApplicationController:\n\n  before_filter :adjust_format_for_partial\n  layout :no_layout_for_xhr\n  helper_method :is_partial?\n\n  private\n  def no_layout_for_xhr\n    is_partial? ? nil : 'application'\n  end\n\n  def adjust_format_for_partial\n    if request.format == :partial then\n      @__partial = !!request.xhr?\n      request.format = :html # reset format to html so that people don't have to rename their view files\n    else\n      @__partial = false\n    end\n  end\n\n  def is_partial?\n    @__partial\n  end\n\n\n\nCopyright (c) 2010 Amiel Martin, Carnes Media, released under the MIT license\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famiel%2Fcan_haz_modal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famiel%2Fcan_haz_modal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famiel%2Fcan_haz_modal/lists"}