1. 03 7月, 2014 1 次提交
  2. 20 5月, 2014 2 次提交
  3. 04 5月, 2014 1 次提交
  4. 15 4月, 2014 1 次提交
    • R
      Return null type format when format is not know · 4d21e496
      Rafael Mendonça França 提交于
      When requesting a controller with the following code with a unknown format:
      
          def my_action
            respond_to do |format|
              format.json { head :ok }
              format.any { render text: 'Default response' }
            end
          end
      
      we should render the default response instead of raising ActionController::UnknownFormat
      
      Fixes #14462
      
      Conflicts:
      	actionpack/CHANGELOG.md
      	actionpack/test/controller/mime/respond_with_test.rb
      
      Conflicts:
      	actionpack/CHANGELOG.md
      4d21e496
  5. 14 2月, 2014 1 次提交
  6. 13 2月, 2014 1 次提交
    • L
      Variant negotiation · f9b6b865
      Lukasz Strzalkowski 提交于
      Allow setting `request.variant` as an array - an order in which they will be
      rendered.
      
      For example:
      
        request.variant = [:tablet, :phone]
      
        respond_to do |format|
          format.html.none
          format.html.phone # this gets rendered
        end
      f9b6b865
  7. 27 12月, 2013 1 次提交
    • Ł
      Add any/all support for variants · a288cc1e
      Łukasz Strzałkowski 提交于
      Like `format.any`, you can do the same with variants.
      
      It works for both inline:
      
          respond_to do |format|
            format.html.any   { render text: "any"   }
            format.html.phone { render text: "phone" }
          end
      
      and block syntax:
      
          respond_to do |format|
            format.html do |variant|
              variant.any(:tablet, :phablet){ render text: "any" }
              variant.phone { render text: "phone" }
            end
          end
      a288cc1e
  8. 10 12月, 2013 1 次提交
    • Ł
      Inline variants syntax · edacdbfa
      Łukasz Strzałkowski 提交于
      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
      edacdbfa
  9. 09 12月, 2013 2 次提交
  10. 08 12月, 2013 2 次提交
  11. 04 12月, 2013 1 次提交
    • Ł
      Action Pack Variants · 2d3a6a0c
      Łukasz Strzałkowski 提交于
      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.
      2d3a6a0c
  12. 09 10月, 2013 1 次提交
  13. 25 8月, 2013 1 次提交
  14. 18 8月, 2013 2 次提交