Commit Graph

156 Commits

Author SHA1 Message Date
Vijay Dev
a3b1105ada Merge branch 'master' of github.com:lifo/docrails 2013-12-20 00:10:30 +05:30
abhishek
21f0c580f3 duplication removed(DRY) 2013-12-18 16:17:11 +05:30
Guillermo Iguaran
76f8d31046 Merge pull request #13363 from kuldeepaggarwal/f-video-options
allow video_tag to accept `size` as `Number` for square shaped videos
2013-12-17 23:42:05 -08:00
Kuldeep Aggarwal
cd58745a7d allow video_tag to accept size as Number for square shaped videos 2013-12-18 12:24:08 +05:30
David Heinemeier Hansson
c0a2d474c5 Get ready to release 4.1.0.beta1 2013-12-17 16:05:28 -08:00
Aayush khandelwal
4a9e54ef35 typos rectified [ci skip] 2013-12-12 11:29:23 +05:30
Semyon Perepelitsa
1cd965000b Fix typo in docs, missing colon in Symbol literal [ci skip] 2013-12-11 03:03:49 +08:00
Rafael Mendonça França
a220b1518d Merge pull request #13059 from imkmf/cycle-accepts-array
Cycle object should accept an array

Conflicts:
	actionview/CHANGELOG.md
2013-12-06 17:05:59 -02:00
Kristian Freeman
1eaa521273 A Cycle object should accept an array and cycle through it as it would
with a set of comma-separated objects.
2013-12-06 10:57:37 -08:00
Andriel Nuernberg
ec19c77ca5 Label only accepts :index and :namespace attributes from the input 2013-12-05 20:27:38 -02:00
Rafael Mendonça França
fe13e71162 Remove the explicit order set for the initializer
This will fix the regression added on
b068e20b35797aa6deaa377a48c990759734f515.

See tests added at ff08d31 to a better understanding about the problem
2013-12-05 16:37:10 -02:00
Jeremy Kemper
5086c8c211 Merge pull request #13189 from strzalek/retain-ap-av-dep
Retain ActionPack dependency on ActionView. Fixes #12979.
2013-12-05 07:25:17 -08:00
Shota Fukumori (sora_h)
c1d5477b63 Escalate missing error when :raise is true
Before ec16ba75a5493b9da972eea08bae630eba35b62f,
ActionView::Helpers::TranslationHelper#translate has raised errors with
specifying options[:raise] to true.

This should work by this fix:

     begin
       t(:"translations.missing", raise: true)
     rescue I18n::MissingTranslationData
       p :hello!
     end
2013-12-05 09:20:58 +09:00
Łukasz Strzałkowski
e064658d64 Include AV::Layouts directly in AM::Base
No need to do this in railtie as AM depends on AV either way
2013-12-05 01:03:03 +01:00
Łukasz Strzałkowski
d8888b94b3 Retain ActionPack dependency on ActionView 2013-12-05 01:02:46 +01:00
Mario Visic
a156562762 Fix issue where TextHelper#simple_format was calling missing 'raw' method 2013-12-05 00:21:55 +11:00
Rafael Mendonça França
d261c5cc28 Fix documentation of number_to_currency helper
Now users have to explicit mark the unit as safe if they trust it.

Closes #13161

Conflicts:
	actionpack/lib/action_view/helpers/number_helper.rb
	actionpack/test/template/number_helper_i18n_test.rb
2013-12-04 10:27:14 -02: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
Aaron Patterson
4d648819c5 optimize string literals in erb templates 2013-12-03 14:56:14 -08:00
Rafael Mendonça França
da633f81eb Remove the escaping skip
We are generating safe strings in the paragraph, so we can escape the
tags
2013-12-03 17:26:49 -02:00
Lauro Caetano
b1b9a0aeca Typos. return -> returns. [ci skip] 2013-12-03 13:31:36 -02:00
Michael Koziarski
0c7ac34aed Stop using i18n's built in HTML error handling.
i18n doesn't depend on active support which means it can't use our html_safe
code to do its escaping when generating the spans.  Rather than try to sanitize
the output from i18n, just revert to our old behaviour of rescuing the error
and constructing the tag ourselves.

Fixes: CVE-2013-4491
2013-12-02 16:42:16 -08:00
Michael Koziarski
bea9c9b4c0 Ensure simple_format escapes its html attributes
The previous behavior equated the sanitize option for simple_format with the
escape option of content_tag, however these are two distinct concepts.

This fixes CVE-2013-6416

Conflicts:
	actionview/lib/action_view/helpers/text_helper.rb
2013-12-02 16:42:07 -08:00
Michael Koziarski
b31a7a6f1e Escape the unit value provided to number_to_currency
Previously the unit values were trusted leading to potential XSS vulnerabilities.

Fixes: CVE-2013-6415
2013-12-02 16:41:14 -08:00
Aaron Patterson
2e3c3a87d8 Only use valid mime type symbols as cache keys
CVE-2013-6414
2013-12-02 16:41:09 -08:00
Guillermo Iguaran
b40faf423c Merge pull request #13138 from gsamokovarov/remove-cattr-requires
Remove deprecated cattr_* requires
2013-12-02 14:30:39 -08:00
Genadi Samokovarov
6329d9fa8b Remove deprecated cattr_* requires 2013-12-03 00:28:15 +02:00
Rafael Mendonça França
83e4f33ea1 Make ActionView::Tags loading tread safe 2013-12-02 20:27:50 -02:00
Xavier Noria
d362ee17db Merge pull request #13117 from akshay-vishnoi/typo
Typo and grammatical fixes [ci skip]
2013-12-02 06:17:09 -08:00
Akshay Vishnoi
ef0f633c66 Typo and grammatical fixes [ci skip] 2013-12-02 19:35:02 +05:30
Yves Senn
543ccf740d ActionView::MissingTemplate for partials includes underscore.
Missing partial folder/_partial instead of folder/partial.

Closes #13002.
2013-12-02 08:35:34 +01:00
Kuldeep Aggarwal
fff0309081 unnecessary checking of size with second regex if matched with first one 2013-11-27 15:51:47 +05:30
Akira Matsuda
499b602c8e Minor typo fixes 2013-11-27 02:27:38 +09:00
Carlos Antonio da Silva
b2c7d2345f Revert "Merge pull request #13027 from akshay-vishnoi/f-refactor"
This reverts commit f4a5a9ea4d183f4102796215d4502c46dbe3e52b, reversing
changes made to 7ccb482181ee6c47c765406009018a15172812de.

Reason:

The logic is different, the first call to #option_value_selected? is for
the :selected option (the argument is the "selected" variable), the second
call is for the :disabled option (the argument is the "disabled" variable).
2013-11-25 09:32:32 -02:00
Akshay Vishnoi
0f2ef7b929 avoiding calling of #option_value_selected? two times 2013-11-25 15:36:27 +05:30
Rafael Mendonça França
4f28e54424 _implied_layout_name should be private 2013-11-19 22:55:19 -02:00
Rafael Mendonça França
5487f62741 Use the right indentation 2013-11-19 22:53:32 -02:00
Rafael Mendonça França
ed7e4932f4 Renderer#_render_template should be private
Closes #12831
2013-11-19 22:52:06 -02:00
Mac Martine
6251eb992f Improve readability of sentence in partial-renderer docs [ci skip] 2013-11-19 15:46:00 -08:00
Shimpei Makimoto
1e848906c5 Use set_backtrace instead of @backtrace in ActionView error 2013-11-16 04:41:28 +09:00
Rafael Mendonça França
f6f4bed34d Merge pull request #12853 from joshjordan/master
Allocate one less object using html_safe during content_tag construction
2013-11-15 09:45:14 -08:00
Andrey Ognevsky
d04c4fac3b Take Hash with options inside Array in #url_for 2013-11-15 15:50:42 +04:00
Josh Jordan
ea6640d05d Allocate one less object using html_safe during content_tag construction 2013-11-14 23:51:40 -05:00
David Heinemeier Hansson
07996ebc50 Revert "Used Yield instead of block.call" -- this causes all of atom_feed_helper_test.rb to fail with "SystemStackError: stack level too deep".
This reverts commit d3a1ce1cdc60d593de1682c5f4e3230c8db9a0fd.
2013-11-14 15:31:27 -08:00
Rafael Mendonça França
84961dc5df Merge pull request #12889 from kuldeepaggarwal/speed_ups
Used Yield instead of block.call
2013-11-14 11:29:28 -08:00
Kuldeep Aggarwal
d3a1ce1cdc Used Yield instead of block.call 2013-11-15 00:53:57 +05:30
Saulius Grigaliunas
07d99335b3 Fix syntax error in atom_feed example [ci skip]
Builder's #tag! takes either String or Symbol as the first parameter
2013-11-13 13:56:13 +02:00
Rafael Mendonça França
452d746006 Make the method name the first argument
This is the only argument that changes over the method calls so it is
better to it be the first one
2013-11-09 18:28:32 -02:00
Rafael Mendonça França
87d0bde03f Drop one more string allocation 2013-11-09 18:28:32 -02:00
Yves Senn
675304b478 Merge pull request #12760 from pseidemann/master
fix simple_format escapes own output when sanitize is set to true
2013-11-09 04:07:50 -08:00