stylesheets_for_all 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/.rvmrc +1 -0
- data/Gemfile +8 -0
- data/LICENSE.txt +22 -0
- data/README.md +29 -0
- data/Rakefile +9 -0
- data/lib/stylesheets_for_all/version.rb +3 -0
- data/lib/stylesheets_for_all.rb +16 -0
- data/stylesheets_for_all.gemspec +19 -0
- data/test/test_stylesheets_for_all.rb +27 -0
- metadata +63 -0
data/.gitignore
ADDED
data/.rvmrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rvm use @rubygems
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Philip Hallstrom
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# StylesheetsForAll
|
2
|
+
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/stylesheets_for_all.png)](http://badge.fury.io/rb/stylesheets_for_all)
|
4
|
+
|
5
|
+
In a call to `stylesheet_link_tag` Rails will set `media=screen` which means that
|
6
|
+
by default if you print a web page it will look nothing like what it looks like one
|
7
|
+
the screen. This plugin changes it so the default is `method=all`.
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
Add this line to your application's Gemfile:
|
12
|
+
|
13
|
+
gem 'stylesheets_for_all'
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install stylesheets_for_all
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
1. Fork it
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
require "stylesheets_for_all/version"
|
2
|
+
require "action_view"
|
3
|
+
|
4
|
+
module StylesheetsForAll
|
5
|
+
module ActionViewExtensions
|
6
|
+
|
7
|
+
def stylesheet_link_tag(*sources)
|
8
|
+
options = sources.last.is_a?(Hash) ? sources.pop.stringify_keys : { }
|
9
|
+
sources << {'media' => 'all'}.merge(options)
|
10
|
+
super
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
ActionView::Base.send :include, StylesheetsForAll::ActionViewExtensions
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'stylesheets_for_all/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = "stylesheets_for_all"
|
8
|
+
gem.version = StylesheetsForAll::VERSION
|
9
|
+
gem.authors = ["Philip Hallstrom"]
|
10
|
+
gem.email = ["philip@pjkh.com"]
|
11
|
+
gem.description = %q{Enable stylesheets for all media (screen,print, etc.) by default.}
|
12
|
+
gem.summary = %q{Enable stylesheets for all media (screen,print, etc.) by default by defaulting to media=all}
|
13
|
+
gem.homepage = "https://github.com/phallstrom/stylesheets_for_all"
|
14
|
+
|
15
|
+
gem.files = `git ls-files`.split($/)
|
16
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
17
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
|
+
gem.require_paths = ["lib"]
|
19
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'test/unit'
|
3
|
+
|
4
|
+
require 'action_controller'
|
5
|
+
require 'action_view'
|
6
|
+
require 'action_view/template'
|
7
|
+
require 'action_view/test_case'
|
8
|
+
|
9
|
+
require 'stylesheets_for_all'
|
10
|
+
|
11
|
+
class TestStylesheetsForAll < ActionView::TestCase
|
12
|
+
tests ActionView::Helpers::AssetTagHelper
|
13
|
+
tests StylesheetsForAll::ActionViewExtensions
|
14
|
+
|
15
|
+
StyleLinkToTag = {
|
16
|
+
%(stylesheet_link_tag("style")) => %(<link href="/stylesheets/style.css" media="all" rel="stylesheet" type="text/css" />),
|
17
|
+
%(stylesheet_link_tag("style", :type => "foo/bar")) => %(<link href="/stylesheets/style.css" media="all" rel="stylesheet" type="foo/bar" />),
|
18
|
+
%(stylesheet_link_tag("style", :media => "screen")) => %(<link href="/stylesheets/style.css" media="screen" rel="stylesheet" type="text/css" />),
|
19
|
+
%(stylesheet_link_tag("style", :media => "screen", :type => "foo/bar")) => %(<link href="/stylesheets/style.css" media="screen" rel="stylesheet" type="foo/bar" />),
|
20
|
+
}
|
21
|
+
|
22
|
+
def test_stylesheet_link_tag
|
23
|
+
ENV["RAILS_ASSET_ID"] = ""
|
24
|
+
StyleLinkToTag.each { |method, tag| assert_dom_equal(tag, eval(method)) }
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
metadata
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: stylesheets_for_all
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Philip Hallstrom
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-01-24 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
14
|
+
description: Enable stylesheets for all media (screen,print, etc.) by default.
|
15
|
+
email:
|
16
|
+
- philip@pjkh.com
|
17
|
+
executables: []
|
18
|
+
extensions: []
|
19
|
+
extra_rdoc_files: []
|
20
|
+
files:
|
21
|
+
- .gitignore
|
22
|
+
- .rvmrc
|
23
|
+
- Gemfile
|
24
|
+
- LICENSE.txt
|
25
|
+
- README.md
|
26
|
+
- Rakefile
|
27
|
+
- lib/stylesheets_for_all.rb
|
28
|
+
- lib/stylesheets_for_all/version.rb
|
29
|
+
- stylesheets_for_all.gemspec
|
30
|
+
- test/test_stylesheets_for_all.rb
|
31
|
+
homepage: https://github.com/phallstrom/stylesheets_for_all
|
32
|
+
licenses: []
|
33
|
+
post_install_message:
|
34
|
+
rdoc_options: []
|
35
|
+
require_paths:
|
36
|
+
- lib
|
37
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
38
|
+
none: false
|
39
|
+
requirements:
|
40
|
+
- - ! '>='
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '0'
|
43
|
+
segments:
|
44
|
+
- 0
|
45
|
+
hash: -665988447778940222
|
46
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
47
|
+
none: false
|
48
|
+
requirements:
|
49
|
+
- - ! '>='
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
version: '0'
|
52
|
+
segments:
|
53
|
+
- 0
|
54
|
+
hash: -665988447778940222
|
55
|
+
requirements: []
|
56
|
+
rubyforge_project:
|
57
|
+
rubygems_version: 1.8.24
|
58
|
+
signing_key:
|
59
|
+
specification_version: 3
|
60
|
+
summary: Enable stylesheets for all media (screen,print, etc.) by default by defaulting
|
61
|
+
to media=all
|
62
|
+
test_files:
|
63
|
+
- test/test_stylesheets_for_all.rb
|