1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
Commit graph

16 commits

Author SHA1 Message Date
Zachary Scott
77a7c4bf7d Merge pull request #17512 from JackDanger/danger/use-default-view-pattern-in-docs
[docs] Using the real resolver pattern in docs
2015-04-10 17:03:48 -07:00
Rafael Mendonça França
dc7ed96adc Remove version conditional for find_template_paths
Now that we only support Ruby 2.2+ we don't need this conditional
anymore
2015-01-04 15:54:21 -03:00
Rafael Mendonça França
bf7b8c193f Remove unneeded requires
These requires were added only to change deprecation message
2015-01-04 12:11:03 -03:00
Rafael Mendonça França
4be859f0fd Change the default template handler from ERB to Raw.
Files without a template handler in their extension will be rended
using the raw handler instead of ERB.
2015-01-04 11:58:42 -03:00
Erik Michaels-Ober
d1374f99bf Pass symbol as an argument instead of a block 2014-11-29 11:53:24 +01:00
Jack Danger Canty
d692b829b5 Using the real resolver pattern in docs
If someone copies the docs into their app they'll find it simply doesn't
work because the locale pattern doesn't have the same logic. This makes
the doc examples work exactly as written.

[ci skip]
2014-11-04 17:52:13 -08:00
Xavier Noria
b3bfa361c5 let's warn with heredocs
The current style for warning messages without newlines uses
concatenation of string literals with manual trailing spaces
where needed.

Heredocs have better readability, and with `squish` we can still
produce a single line.

This is a similar use case to the one that motivated defining
`strip_heredoc`, heredocs are super clean.
2014-10-28 16:35:24 -07:00
Felipe Oliveira
0d49841187 Add +variants to ActionView::FileSystemResolver documentation. 2014-09-26 14:26:16 -03:00
Aaron Patterson
239f560630 Feature detect based on Ruby version.
I didn't want to do this, FNM_EXTGLOB is defined on 2.1.x, but Dir.glob
returns the wrong value on Ruby less than 2.2.0.  Checking for a
case-insensitive FS seems too hard, so just check Ruby version  Checking
for a case-insensitive FS seems too hard, so just check Ruby version.
2014-05-18 12:00:12 -07:00
Aaron Patterson
35864db961 feature detect for FNM_EXTGLOB for older Ruby. Fixes #15053 2014-05-10 11:52:23 -07:00
Aaron Patterson
727ae97793 use fnmatch to test for case insensitive file systems
this is due to:

  https://bugs.ruby-lang.org/issues/5994
2014-05-09 14:45:43 -07:00
Prathamesh Sonpatki
1d6fb054fc Fix documentation of extract_handler_and_format_and_variant [ci skip] 2014-04-26 06:40:05 +05:30
Łukasz Strzałkowski
c63b18de18 Add variants to Template class 2014-03-14 13:18:14 +01:00
Łukasz Strzałkowski
2d3a6a0cb8 Action Pack Variants
By default, variants in the templates will be picked up if a variant is set
and there's a match. The format will be:

  app/views/projects/show.html.erb
  app/views/projects/show.html+tablet.erb
  app/views/projects/show.html+phone.erb

If request.variant = :tablet is set, we'll automatically be rendering the
html+tablet template.

In the controller, we can also tailer to the variants with this syntax:

  class ProjectsController < ActionController::Base
    def show
      respond_to do |format|
        format.html do |html|
          @stars = @project.stars

          html.tablet { @notifications = @project.notifications }
          html.phone  { @chat_heads    = @project.chat_heads }
        end

        format.js
        format.atom
      end
    end
  end

The variant itself is nil by default, but can be set in before filters, like
so:

  class ApplicationController < ActionController::Base
    before_action do
      if request.user_agent =~ /iPad/
        request.variant = :tablet
      end
    end
  end

This is modeled loosely on custom mime types, but it's specifically not
intended to be used together. If you're going to make a custom mime type,
you don't need a variant. Variants are for variations on a single mime
types.
2013-12-04 00:13:16 +01:00
Genadi Samokovarov
6329d9fa8b Remove deprecated cattr_* requires 2013-12-03 00:28:15 +02:00
Piotr Sarnacki
0d6e8edc2a Move actionpack/lib/action_view* into actionview/lib 2013-06-20 17:23:15 +02:00
Renamed from actionpack/lib/action_view/template/resolver.rb (Browse further)