-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove extra javascript content blocks. #1842
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,24 @@ | ||
<%= yield :before_javascript_libraries -%> | ||
<%= yield :javascript_libraries %> | ||
<%= yield :after_javascript_libraries %> | ||
<% if content_for :before_javascript_libraries %> | ||
<% Refinery.deprecate "content_for :before_javascript_libraries", :when => '2.2', :replacement => "content_for :javascripts" %> | ||
<% content_for :javascripts, yield(:before_javascript_libraries) %> | ||
<% end %> | ||
|
||
<% if content_for :javascript_libraries %> | ||
<% Refinery.deprecate "content_for :javascript_libraries", :when => '2.2', :replacement => "content_for :javascripts" %> | ||
<% content_for :javascripts, yield(:javascript_libraries) %> | ||
<% end %> | ||
|
||
<% if content_for :after_javascript_libraries %> | ||
<% Refinery.deprecate "content_for :after_javascript_libraries", :when => '2.2', :replacement => "content_for :javascripts" %> | ||
<% content_for :javascripts, yield(:after_javascript_libraries) %> | ||
<% end %> | ||
|
||
|
||
<%= javascript_include_tag 'application' %> | ||
<%= yield :javascripts -%> | ||
<% if request.env['HTTP_USER_AGENT'] =~ /MSIE/ %> | ||
<!--[if lt IE 7 ]> | ||
<%= javascript_include_tag 'dd_belatedpng' %> | ||
<script> DD_belatedPNG.fix('img, .png_bg'); //fix any <img> or .png_bg background-images </script> | ||
<![endif]--> | ||
<% end %> | ||
<%= javascript_include_tag 'application' %> | ||
<%= yield :javascripts -%> |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've rearranged this, but this might be in error. My rationale was that users should be given the opportunity to insert any stylesheets before Refinery's (albeit minimal) stylesheets are loaded, but I'm concerned that this might result in errors if the user is on IE6 and loads some library with PNGs. @parndt WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know about doing this without deprecating first. You can use this functionality to warn the user:
It complicates the view but is somewhat necessary.
Also this means you have no way to specify the order so you need to put all libraries inside
application.js
-- correct?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I guess it's somewhat necessary to deprecate. Alas.
As far as order goes, if you need to append anything, you can do it with content_for :javascripts. Anything beforehand needs to be in
application.js
... as it should be, in my opinion.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I agree with the application.js
If you can add the deprecation code that'd be awesome.
Should we take this opportunity to move to a helper method or PORO (Plain Old Ruby Object) or should we continue using content_for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll add those deprecation statements shortly.
content_for
should suffice. Let's not overcomplicate things — if we were keeping the ability to prepend or append scripts, I might be in favour of that, but as it stands, being able to just yield a block is pretty useful.