rack-dev-mark 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fff2b9a8075587a3cd9e845a0c894cdb3ba57aca
4
- data.tar.gz: 740888ac9204d53a0956cec0379c9c401f06b538
3
+ metadata.gz: a3f1987ff1683e8ab9d12a05e0ecd3f0a301f995
4
+ data.tar.gz: a6ca469cb2b2a620b519df065856b0e4e5b3ba37
5
5
  SHA512:
6
- metadata.gz: 975b82a47ccc2761bdb6015d8982a929db6cc8f299ac7d32bd5d0ba0e39ade48d848958622ede56463defffc347046137e2c7ed1284bd92fd45d2bae641651f3
7
- data.tar.gz: 5987c26f01630eaf4dd057d415facb884887f1799d3d41d50bbcdcf1bc44957844b14ea0dea25f1cbba6ac0ea694123d7b029d5039cb0223417ef5c86bafe190
6
+ metadata.gz: 7e1bac00b221687581ccf57ce0bdbb495e2857e4ab0d035a20f2e500af16295f01d9b78515aae80b62ddd4abc688e817fa984072de27e4a6bc72d73a22bc8dd2
7
+ data.tar.gz: 348e35319467a0d7117b8d2cca8737c7f58ebcfda1167245aaeacad0d7db0c957a778dec3c04321ca2301d3f0f155a29dd719e0abbcf11a9d8c6ea99fc3b78f7
@@ -5,13 +5,19 @@ module Rack
5
5
  module DevMark
6
6
  module Theme
7
7
  class GithubForkRibbon < Base
8
+ def initialize(options = {})
9
+ @options = options
10
+ end
11
+
8
12
  def insert_into(html, env, revision)
13
+ position = @options[:position] || 'left'
14
+ color = @options[:color] || 'red'
9
15
  s = <<-EOS
10
16
  #{stylesheet_link_tag "github-fork-ribbon-css/gh-fork-ribbon.css"}
11
17
  <!--[if lt IE 9]>
12
18
  #{stylesheet_link_tag "github-fork-ribbon-css/gh-fork-ribbon.ie.css"}
13
19
  <![endif]-->
14
- <div class="github-fork-ribbon-wrapper left" onClick="this.style.display='none'" title="#{revision}"><div class="github-fork-ribbon"><span class="github-fork-ribbon-text">#{env}</span></div></div>
20
+ <div class="github-fork-ribbon-wrapper #{position}" onClick="this.style.display='none'" title="#{revision}"><div class="github-fork-ribbon #{color}"><span class="github-fork-ribbon-text">#{env}</span></div></div>
15
21
  EOS
16
22
  html.sub %r{(<body[^>]*>)}i, "\\1#{s.strip}"
17
23
  end
@@ -1,5 +1,5 @@
1
1
  module Rack
2
2
  module DevMark
3
- VERSION = '0.1.2'
3
+ VERSION = '0.1.3'
4
4
  end
5
5
  end
@@ -8,11 +8,43 @@ describe Rack::DevMark::Theme::GithubForkRibbon do
8
8
  <!--[if lt IE 9]>
9
9
  <style>#{read_stylesheet "github-fork-ribbon-css/gh-fork-ribbon.ie.css"}</style>
10
10
  <![endif]-->
11
- <div class="github-fork-ribbon-wrapper left" onClick="this.style.display='none'" title="rev"><div class="github-fork-ribbon"><span class="github-fork-ribbon-text">env</span></div></div>body</body></html>
11
+ <div class="github-fork-ribbon-wrapper left" onClick="this.style.display='none'" title="rev"><div class="github-fork-ribbon red"><span class="github-fork-ribbon-text">env</span></div></div>body</body></html>
12
12
  EOS
13
13
  s.strip
14
14
  end
15
15
 
16
16
  subject { Rack::DevMark::Theme::GithubForkRibbon.new }
17
17
  end
18
+ context "position option" do
19
+ it_behaves_like "theme" do
20
+ let :out do
21
+ s = <<-EOS
22
+ <html><head>head<title>title</title></head><body><style>#{read_stylesheet "github-fork-ribbon-css/gh-fork-ribbon.css"}</style>
23
+ <!--[if lt IE 9]>
24
+ <style>#{read_stylesheet "github-fork-ribbon-css/gh-fork-ribbon.ie.css"}</style>
25
+ <![endif]-->
26
+ <div class="github-fork-ribbon-wrapper right" onClick="this.style.display='none'" title="rev"><div class="github-fork-ribbon red"><span class="github-fork-ribbon-text">env</span></div></div>body</body></html>
27
+ EOS
28
+ s.strip
29
+ end
30
+
31
+ subject { Rack::DevMark::Theme::GithubForkRibbon.new(position: 'right') }
32
+ end
33
+ end
34
+ context "color option" do
35
+ it_behaves_like "theme" do
36
+ let :out do
37
+ s = <<-EOS
38
+ <html><head>head<title>title</title></head><body><style>#{read_stylesheet "github-fork-ribbon-css/gh-fork-ribbon.css"}</style>
39
+ <!--[if lt IE 9]>
40
+ <style>#{read_stylesheet "github-fork-ribbon-css/gh-fork-ribbon.ie.css"}</style>
41
+ <![endif]-->
42
+ <div class="github-fork-ribbon-wrapper left" onClick="this.style.display='none'" title="rev"><div class="github-fork-ribbon orange"><span class="github-fork-ribbon-text">env</span></div></div>body</body></html>
43
+ EOS
44
+ s.strip
45
+ end
46
+
47
+ subject { Rack::DevMark::Theme::GithubForkRibbon.new(color: 'orange') }
48
+ end
49
+ end
18
50
  end
@@ -29,6 +29,22 @@
29
29
  pointer-events: auto;
30
30
  }
31
31
 
32
+ .github-fork-ribbon.red {
33
+ background-color: #a00;
34
+ }
35
+
36
+ .github-fork-ribbon.green {
37
+ background-color: #090;
38
+ }
39
+
40
+ .github-fork-ribbon.black {
41
+ background-color: #333;
42
+ }
43
+
44
+ .github-fork-ribbon.orange {
45
+ background-color: #f80;
46
+ }
47
+
32
48
  .github-fork-ribbon .github-fork-ribbon-text,
33
49
  .github-fork-ribbon .github-fork-ribbon-text:hover {
34
50
  /* Set the text properties */
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-dev-mark
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daisuke Taniwaki
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-03 00:00:00.000000000 Z
11
+ date: 2014-06-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack