neo-rails 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/.simplecov ADDED
@@ -0,0 +1,2 @@
1
+ SimpleCov.coverage_dir "tmp/coverage"
2
+ SimpleCov.start
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - jruby-19mode
5
+ - rbx-19mode
data/README.md CHANGED
@@ -1,6 +1,11 @@
1
- # Neo::Rails
1
+ # Neo::Rails [![Build Status](https://secure.travis-ci.org/neopoly/neo-rails.png?branch=master)](http://travis-ci.org/neopoly/neo-rails)
2
+ `neo-rails` contains some tools helping us doing Rails.
2
3
 
3
- TODO: Write a gem description
4
+ This gem includes:
5
+ * Mocks
6
+ * Presenters
7
+ * Exposure
8
+ * Scenarios
4
9
 
5
10
  ## Installation
6
11
 
@@ -22,40 +27,47 @@ Or install it yourself as:
22
27
 
23
28
  In app/presenters/presenter.rb
24
29
 
25
- class Presenter
26
- include Neo::Rails::Presenter
27
- end
30
+ ```ruby
31
+ class Presenter
32
+ include Neo::Rails::Presenter
33
+ end
28
34
 
35
+ class UserPresenter < Presenter
36
+ def initialize(user)
37
+ @user = user
38
+ end
29
39
 
30
- class UserPresenter < Presenter
31
- def initialize(user)
32
- @user = user
33
- end
40
+ def name
41
+ @user.name
42
+ end
34
43
 
35
- def name
36
- @user.name
37
- end
38
-
39
- def profile_path
40
- view_context.link_to view_context.user_profile_path(@user), name
41
- end
42
- end
44
+ def profile_path
45
+ view_context.link_to view_context.user_profile_path(@user), name
46
+ end
47
+ end
48
+ ```
43
49
 
44
50
  In test/test_helper.rb
45
51
 
46
- require 'neo/rails/presenter/test_helper'
52
+ ```ruby
53
+ require 'neo/rails/presenter/test_helper'
47
54
 
48
- Neo::Rails::Presenter::TestHelper.setup
55
+ Neo::Rails::Presenter::TestHelper.setup
56
+ ```
49
57
 
50
58
  ### Scenarios
51
59
 
52
60
  In app/assets/stylesheets/application.css:
53
61
 
62
+ /*= require neo-rails */
63
+
64
+ In app/assets/javascript/application.js
65
+
54
66
  //= require neo-rails
55
67
 
56
- In app/layouts/application.html.haml
68
+ In app/layouts/application.html.erb
57
69
 
58
- = render_scenarios_list
70
+ <%= render_scenarios_list %>
59
71
 
60
72
  ## Contributing
61
73
 
@@ -0,0 +1,25 @@
1
+ (function($){
2
+ var SEL = {
3
+ list : "neo-rails-scenarios-list",
4
+ open : "neo-rails-scenarios-list-open"
5
+ };
6
+
7
+ var url_param = function(name){
8
+ var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(window.location.href);
9
+ return results[1] || null;
10
+ };
11
+
12
+ $(function(){
13
+ $("."+SEL.list).each(function(){
14
+ var ui = $(this);
15
+ ui.on("click", "h2", function(evt){
16
+ ui.toggleClass(SEL.open);
17
+ });
18
+
19
+ var active_scenario = url_param("scenario");
20
+ if(active_scenario !== null){
21
+ ui.addClass(SEL.open);
22
+ };
23
+ });
24
+ })
25
+ })(jQuery);
@@ -0,0 +1 @@
1
+ //= require neo/rails/scenarios/render_scenarios_list
@@ -1,8 +1,72 @@
1
1
  .neo-rails-scenarios-list
2
2
  position: absolute
3
- right: 0
4
- top: 0
5
- width: 250px
6
- padding: 5px
7
- background: #AAFFAA
8
- border: 2px solid green
3
+ z-index: 100
4
+ right: 5px
5
+ top: 5px
6
+ width: 350px
7
+ font: 13px/16px Helvetica, Verdana, Arial, sans-serif
8
+ border: 1px solid #ddd
9
+ background: #f5f5f5
10
+ -moz-box-shadow: 1px 1px 2px #888
11
+ -webkit-box-shadow: 1px 1px 2px #888
12
+ box-shadow: 1px 1px 2px #888
13
+
14
+ h2
15
+ margin: 0
16
+ padding: 5px
17
+ font-size: 14px
18
+ color: #999
19
+ display: block
20
+ cursor: pointer
21
+
22
+ .caret
23
+ display: inline-block
24
+ float: right
25
+ margin: 5px 5px 0 0
26
+ content: " "
27
+ border-top: 4px solid #000
28
+ border-right: 4px solid transparent
29
+ border-left: 4px solid transparent
30
+ opacity: 0.3
31
+ filter: alpha(opacity=30)
32
+
33
+ ul
34
+ list-style: none
35
+ margin: 0
36
+ padding: 0
37
+ display: none
38
+ background: #bdbdbd
39
+ background-image: linear-gradient(bottom, rgb(227, 224, 226) 15%, rgb(245, 245, 245) 56%)
40
+ background-image: -o-linear-gradient(bottom, rgb(227, 224, 226) 15%, rgb(245, 245, 245) 56%)
41
+ background-image: -moz-linear-gradient(bottom, rgb(227, 224, 226) 15%, rgb(245, 245, 245) 56%)
42
+ background-image: -webkit-linear-gradient(bottom, rgb(227, 224, 226) 15%, rgb(245, 245, 245) 56%)
43
+ background-image: -ms-linear-gradient(bottom, rgb(227, 224, 226) 15%, rgb(245, 245, 245) 56%)
44
+ background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0.15, rgb(227, 224, 226)), color-stop(0.56, rgb(245, 245, 245)))
45
+
46
+ a
47
+ display: block
48
+ line-height: 25px
49
+ padding: 0 5px
50
+ border-bottom: 1px solid rgba(0, 0, 0, 0.1)
51
+
52
+ &:link, &:visited
53
+ text-decoration: none
54
+ color: #333
55
+ &:hover
56
+ color: #111
57
+ &:active
58
+ color: #000
59
+ li:last-child a
60
+ border: none
61
+
62
+
63
+ .neo-rails-scenarios-list-open
64
+ h2
65
+ border-bottom: 1px solid #ddd
66
+ .caret
67
+ border-top: none
68
+ border-right: 4px solid transparent
69
+ border-left: 4px solid transparent
70
+ border-bottom: 4px solid #000
71
+ ul
72
+ display: block
@@ -1 +1,3 @@
1
- //= require neo/rails/scenarios/render_scenarios_list
1
+ /*
2
+ *= require neo/rails/scenarios/render_scenarios_list
3
+ */
@@ -9,8 +9,9 @@ module Neo
9
9
  def render_scenarios_list
10
10
  if ::Rails.env.development? && respond_to?(:list_scenarios) && (list = list_scenarios).any?
11
11
  scenario_links = list.map { |scenario| content_tag(:li, scenario_link(scenario)) }
12
- ul = content_tag(:ul, scenario_links.join.html_safe)
13
- raw content_tag(:div, ul, :class => "neo-rails-scenarios-list")
12
+ ul = content_tag(:ul, scenario_links.join.html_safe)
13
+ title = content_tag(:h2, "Scenarios".html_safe + content_tag(:span, "", :class => "caret"))
14
+ content_tag(:div, title+ul, :class => "neo-rails-scenarios-list")
14
15
  end
15
16
  end
16
17
  end
@@ -1,5 +1,5 @@
1
1
  module Neo
2
2
  module Rails
3
- VERSION = "0.0.2"
3
+ VERSION = "0.0.3"
4
4
  end
5
5
  end
data/neo-rails.gemspec CHANGED
@@ -19,4 +19,5 @@ Gem::Specification.new do |gem|
19
19
  gem.add_development_dependency "minitest"
20
20
  gem.add_development_dependency "rails", "~> 3.2.7"
21
21
  gem.add_development_dependency "rack-test"
22
+ gem.add_development_dependency "simplecov"
22
23
  end
data/test/helper.rb CHANGED
@@ -1,3 +1,5 @@
1
+ require 'simplecov' if ENV['COVERAGE']
2
+
1
3
  require 'minitest/autorun'
2
4
 
3
5
  class NeoRailsCase < MiniTest::Spec
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: neo-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-08-09 00:00:00.000000000 Z
13
+ date: 2012-08-10 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rake
@@ -76,6 +76,22 @@ dependencies:
76
76
  - - ! '>='
77
77
  - !ruby/object:Gem::Version
78
78
  version: '0'
79
+ - !ruby/object:Gem::Dependency
80
+ name: simplecov
81
+ requirement: !ruby/object:Gem::Requirement
82
+ none: false
83
+ requirements:
84
+ - - ! '>='
85
+ - !ruby/object:Gem::Version
86
+ version: '0'
87
+ type: :development
88
+ prerelease: false
89
+ version_requirements: !ruby/object:Gem::Requirement
90
+ none: false
91
+ requirements:
92
+ - - ! '>='
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
79
95
  description: Some Rails helpers
80
96
  email:
81
97
  - jt@neopoly.de
@@ -85,10 +101,14 @@ extensions: []
85
101
  extra_rdoc_files: []
86
102
  files:
87
103
  - .gitignore
104
+ - .simplecov
105
+ - .travis.yml
88
106
  - Gemfile
89
107
  - LICENSE
90
108
  - README.md
91
109
  - Rakefile
110
+ - lib/assets/javascripts/neo-rails.js
111
+ - lib/assets/javascripts/neo/rails/scenarios/render_scenarios_list.js
92
112
  - lib/assets/stylesheets/neo-rails.css
93
113
  - lib/assets/stylesheets/neo/rails/scenarios/render_scenarios_list.css.sass
94
114
  - lib/neo-rails.rb