aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/fixtures/respond_to
Commit message (Collapse)AuthorAgeFilesLines
* Inline variants syntaxŁukasz Strzałkowski2013-12-101-0/+1
| | | | | | | | | | | | | | | | | | | | | | | In most cases, when setting variant specific code, you're not sharing any code within format. Inline syntax can vastly simplify defining variants in those situations: respond_to do |format| format.js { render "trash" } format.html do |variant| variant.phone { redirect_to progress_path } variant.none { render "trash" } end end Becomes: respond_to do |format| format.js { render "trash" } format.html.phone { redirect_to progress_path } format.html.none { render "trash" } end
* Variants can be declared without a block to signify their presence in the ↵David Heinemeier Hansson2013-12-071-0/+1
| | | | controller
* Action Pack VariantsŁukasz Strzałkowski2013-12-041-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* fix respond_to without blocks not working if one of the blocks is allgrosser2013-02-241-0/+1
|
* removes the RJS template handlerXavier Noria2011-04-133-3/+0
|
* Please do rememberDavid Heinemeier Hansson2007-09-251-0/+1
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7633 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Doh, forgot this fileDavid Heinemeier Hansson2007-09-251-0/+1
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7631 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Better failing testsDavid Heinemeier Hansson2007-09-252-1/+1
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7630 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Added failing tests for iphoneDavid Heinemeier Hansson2007-09-251-0/+1
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7629 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fixed that default layouts did not take the format into account #9564 [lifofifo]David Heinemeier Hansson2007-09-181-0/+1
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7514 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Missed svn add from [6856]. References #8174.Jeremy Kemper2007-05-261-0/+1
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6857 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Change default respond_to templates for xml and rjs formats. [Rick]Rick Olson2007-04-088-0/+0
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6507 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Removed XML argument style for respond_to, so type.xml(object.to_xml) no ↵David Heinemeier Hansson2006-03-183-0/+3
| | | | | | longer works -- it wasnt worth the exception git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3944 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* fix broken respond_to testJamis Buck2006-03-183-0/+3
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3934 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Added defaults to respond_to [DHH]David Heinemeier Hansson2006-03-123-0/+3
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3842 5ecf4fe2-1ee6-0310-87b1-e25e094e27de