foundation-rails-helpers 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/Rakefile +1 -0
  4. data/app/helpers/foundation/rails/helpers/foundation_rails_helpers_application_helper.rb +34 -0
  5. data/lib/foundation-rails-helpers.rb +1 -0
  6. data/lib/foundation/rails/helpers.rb +6 -0
  7. data/lib/foundation/rails/helpers/alert.rb +18 -0
  8. data/lib/foundation/rails/helpers/element.rb +47 -0
  9. data/lib/foundation/rails/helpers/engine.rb +9 -0
  10. data/lib/foundation/rails/helpers/label.rb +18 -0
  11. data/lib/foundation/rails/helpers/panel.rb +14 -0
  12. data/lib/foundation/rails/helpers/version.rb +7 -0
  13. data/spec/alert_spec.rb +8 -0
  14. data/spec/dummy/Gemfile +5 -0
  15. data/spec/dummy/Gemfile.lock +87 -0
  16. data/spec/dummy/README.rdoc +28 -0
  17. data/spec/dummy/Rakefile +6 -0
  18. data/spec/dummy/app/assets/javascripts/application.js +8 -0
  19. data/spec/dummy/app/assets/stylesheets/application.css +4 -0
  20. data/spec/dummy/app/assets/stylesheets/foundation_and_overrides.scss +4 -0
  21. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  22. data/spec/dummy/app/controllers/styleguide_controller.rb +4 -0
  23. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  24. data/spec/dummy/app/helpers/styleguide_helper.rb +2 -0
  25. data/spec/dummy/app/views/layouts/application.html.erb +19 -0
  26. data/spec/dummy/app/views/styleguide/show.html.erb +109 -0
  27. data/spec/dummy/bin/bundle +3 -0
  28. data/spec/dummy/bin/rails +4 -0
  29. data/spec/dummy/bin/rake +4 -0
  30. data/spec/dummy/config.ru +4 -0
  31. data/spec/dummy/config/application.rb +23 -0
  32. data/spec/dummy/config/boot.rb +3 -0
  33. data/spec/dummy/config/database.yml +25 -0
  34. data/spec/dummy/config/environment.rb +5 -0
  35. data/spec/dummy/config/environments/development.rb +29 -0
  36. data/spec/dummy/config/environments/production.rb +80 -0
  37. data/spec/dummy/config/environments/test.rb +36 -0
  38. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  39. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  40. data/spec/dummy/config/initializers/inflections.rb +16 -0
  41. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  42. data/spec/dummy/config/initializers/secret_token.rb +12 -0
  43. data/spec/dummy/config/initializers/session_store.rb +3 -0
  44. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  45. data/spec/dummy/config/locales/en.yml +23 -0
  46. data/spec/dummy/config/routes.rb +2 -0
  47. data/spec/dummy/db/seeds.rb +7 -0
  48. data/spec/dummy/log/development.log +0 -0
  49. data/spec/dummy/public/404.html +58 -0
  50. data/spec/dummy/public/422.html +58 -0
  51. data/spec/dummy/public/500.html +57 -0
  52. data/spec/dummy/public/favicon.ico +0 -0
  53. data/spec/dummy/public/robots.txt +5 -0
  54. data/spec/dummy/test/controllers/styleguide_controller_test.rb +9 -0
  55. data/spec/dummy/test/helpers/styleguide_helper_test.rb +4 -0
  56. data/spec/dummy/test/test_helper.rb +15 -0
  57. data/spec/spec_helper.rb +4 -0
  58. metadata +188 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 9d66f248aef42db7afb8ecbe65f10dd2398b7ac7
4
+ data.tar.gz: d75db02c8b0385c26017a20adfba57f2ea5a16f5
5
+ SHA512:
6
+ metadata.gz: 7c99390a72d92d30187f3ad03fe3e136ff6b133ada9e7eec21b0cc8c5c0f00d2a838025c49fa9a4501e67d50681f81e28bbef99bb69eb4c6252c7b8e04625552
7
+ data.tar.gz: 96afb48787d860b50c811d6445083e00ac85aa22f4338cd6d8b8479afbecf7d14da1853b82ad465a00fd128df86637ee14752bbf078baea002f919d0d87849a3
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2014 YOURNAME
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,34 @@
1
+ module Foundation
2
+ module Rails
3
+ module Helpers
4
+ module FoundationRailsHelpersApplicationHelper
5
+
6
+ ##
7
+ # Generates a Foundation Panel
8
+ #
9
+ # http://foundation.zurb.com/docs/components/panels.html
10
+ #
11
+ # === Returns
12
+ #
13
+ # [Foundation::Rails::Helpers::Panel]
14
+ #
15
+ def foundation_panel(**options, &block)
16
+ Foundation::Rails::Helpers::Panel.new(**options, &block)
17
+ end
18
+
19
+ ##
20
+ # Generates a Foundation Alert
21
+ #
22
+ # http://foundation.zurb.com/docs/components/alerts.html
23
+ #
24
+ # === Returns
25
+ #
26
+ # [Foundation::Rails::Helpers::Alert]
27
+ #
28
+ def foundation_alert(**options, &block)
29
+ Foundation::Rails::Helpers::Alert.new(**options, &block)
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1 @@
1
+ require "foundation/rails/helpers"
@@ -0,0 +1,6 @@
1
+ require "foundation/rails/helpers/engine"
2
+
3
+ require "foundation/rails/helpers/element"
4
+ require "foundation/rails/helpers/panel"
5
+ require "foundation/rails/helpers/alert"
6
+ require "foundation/rails/helpers/label"
@@ -0,0 +1,18 @@
1
+ module Foundation
2
+ module Rails
3
+ module Helpers
4
+ class Alert < Foundation::Rails::Helpers::Element
5
+
6
+ private
7
+
8
+ def default_attributes
9
+ { data: { alert: true }, class: %w[alert-box] }
10
+ end
11
+
12
+ def close_link
13
+ link_to("&times;".html_safe, "#", class: :close)
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,47 @@
1
+ module Foundation
2
+ module Rails
3
+ module Helpers
4
+ class Element
5
+
6
+ include ActionView::Helpers
7
+ include ActionView::Context
8
+
9
+ extend ActionView::Helpers
10
+ extend ActionView::Context
11
+
12
+ ##
13
+ # If there is conflict while attempting to merge the attributes w/ the
14
+ # defaults and the key is the class then we'll combine the classes passed
15
+ # in w/ the defaults...otherwise we'll take the left side of the merge...
16
+ # this ensures that dropdown buttons always get the basic classes they
17
+ # need to display properly...
18
+ #
19
+ def attributes_merge(attributes = {}, defaults = {})
20
+ mergeable = %i[class]
21
+ attributes.merge(defaults) do |key, left, right|
22
+ key.in?(mergeable) ? [left, right].join(' ') : left
23
+ end
24
+ end
25
+
26
+ attr_accessor :attributes, :content
27
+
28
+ def initialize(attributes: {}, content: nil)
29
+ @attributes = attributes
30
+ @content = content
31
+
32
+ yield self if block_given?
33
+ end
34
+
35
+ def to_s
36
+ content_tag(tag_type, content, attributes_merge(attributes, default_attributes))
37
+ end
38
+
39
+ private
40
+
41
+ def tag_type; :div; end
42
+
43
+ def default_attributes; {}; end
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,9 @@
1
+ module Foundation
2
+ module Rails
3
+ module Helpers
4
+ class Engine < ::Rails::Engine
5
+ isolate_namespace Foundation::Rails::Helpers
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,18 @@
1
+ module Foundation
2
+ module Rails
3
+ module Helpers
4
+ class Label < Foundation::Rails::Helpers::Element
5
+
6
+ private
7
+
8
+ def tag_type
9
+ :span
10
+ end
11
+
12
+ def default_attributes
13
+ { class: ['label'] }
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,14 @@
1
+ module Foundation
2
+ module Rails
3
+ module Helpers
4
+ class Panel < Foundation::Rails::Helpers::Element
5
+
6
+ private
7
+
8
+ def default_attributes
9
+ { class: ['panel'] }
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,7 @@
1
+ module Foundation
2
+ module Rails
3
+ module Helpers
4
+ VERSION = "0.0.2"
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,8 @@
1
+ require 'spec_helper'
2
+
3
+ describe Foundation::Rails::Helpers::Alert do
4
+ subject { Foundation::Rails::Helpers::Alert.new }
5
+ it "returns the basic HTML" do
6
+ expect(subject.to_s).to eq "<div class=\"alert-box\" data-alert=\"true\"><a class=\"close\" href=\"#\">&times;</a></div>"
7
+ end
8
+ end
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'foundation-rails-helpers', :path => '../../'
4
+ gem 'rails', '4.0.4'
5
+ gem 'sqlite3'
@@ -0,0 +1,87 @@
1
+ PATH
2
+ remote: ../../
3
+ specs:
4
+ foundation-rails-helpers (0.0.2)
5
+ rails (> 4.0)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ actionmailer (4.0.4)
11
+ actionpack (= 4.0.4)
12
+ mail (~> 2.5.4)
13
+ actionpack (4.0.4)
14
+ activesupport (= 4.0.4)
15
+ builder (~> 3.1.0)
16
+ erubis (~> 2.7.0)
17
+ rack (~> 1.5.2)
18
+ rack-test (~> 0.6.2)
19
+ activemodel (4.0.4)
20
+ activesupport (= 4.0.4)
21
+ builder (~> 3.1.0)
22
+ activerecord (4.0.4)
23
+ activemodel (= 4.0.4)
24
+ activerecord-deprecated_finders (~> 1.0.2)
25
+ activesupport (= 4.0.4)
26
+ arel (~> 4.0.0)
27
+ activerecord-deprecated_finders (1.0.3)
28
+ activesupport (4.0.4)
29
+ i18n (~> 0.6, >= 0.6.9)
30
+ minitest (~> 4.2)
31
+ multi_json (~> 1.3)
32
+ thread_safe (~> 0.1)
33
+ tzinfo (~> 0.3.37)
34
+ arel (4.0.2)
35
+ builder (3.1.4)
36
+ erubis (2.7.0)
37
+ hike (1.2.3)
38
+ i18n (0.6.9)
39
+ mail (2.5.4)
40
+ mime-types (~> 1.16)
41
+ treetop (~> 1.4.8)
42
+ mime-types (1.25.1)
43
+ minitest (4.7.5)
44
+ multi_json (1.10.1)
45
+ polyglot (0.3.5)
46
+ rack (1.5.2)
47
+ rack-test (0.6.2)
48
+ rack (>= 1.0)
49
+ rails (4.0.4)
50
+ actionmailer (= 4.0.4)
51
+ actionpack (= 4.0.4)
52
+ activerecord (= 4.0.4)
53
+ activesupport (= 4.0.4)
54
+ bundler (>= 1.3.0, < 2.0)
55
+ railties (= 4.0.4)
56
+ sprockets-rails (~> 2.0.0)
57
+ railties (4.0.4)
58
+ actionpack (= 4.0.4)
59
+ activesupport (= 4.0.4)
60
+ rake (>= 0.8.7)
61
+ thor (>= 0.18.1, < 2.0)
62
+ rake (10.3.2)
63
+ sprockets (2.12.1)
64
+ hike (~> 1.2)
65
+ multi_json (~> 1.0)
66
+ rack (~> 1.0)
67
+ tilt (~> 1.1, != 1.3.0)
68
+ sprockets-rails (2.0.1)
69
+ actionpack (>= 3.0)
70
+ activesupport (>= 3.0)
71
+ sprockets (~> 2.8)
72
+ sqlite3 (1.3.9)
73
+ thor (0.19.1)
74
+ thread_safe (0.3.4)
75
+ tilt (1.4.1)
76
+ treetop (1.4.15)
77
+ polyglot
78
+ polyglot (>= 0.3.1)
79
+ tzinfo (0.3.39)
80
+
81
+ PLATFORMS
82
+ ruby
83
+
84
+ DEPENDENCIES
85
+ foundation-rails-helpers!
86
+ rails (= 4.0.4)
87
+ sqlite3
@@ -0,0 +1,28 @@
1
+ == README
2
+
3
+ This README would normally document whatever steps are necessary to get the
4
+ application up and running.
5
+
6
+ Things you may want to cover:
7
+
8
+ * Ruby version
9
+
10
+ * System dependencies
11
+
12
+ * Configuration
13
+
14
+ * Database creation
15
+
16
+ * Database initialization
17
+
18
+ * How to run the test suite
19
+
20
+ * Services (job queues, cache servers, search engines, etc.)
21
+
22
+ * Deployment instructions
23
+
24
+ * ...
25
+
26
+
27
+ Please feel free to use a different markup language if you do not plan to run
28
+ <tt>rake doc:app</tt>.
@@ -0,0 +1,6 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require File.expand_path('../config/application', __FILE__)
5
+
6
+ Foundation::Application.load_tasks
@@ -0,0 +1,8 @@
1
+ //= require jquery
2
+ //= require jquery_ujs
3
+ //= require foundation
4
+
5
+ $(function(){
6
+ $(document).foundation();
7
+ });
8
+ $(function(){ $(document).foundation(); });
@@ -0,0 +1,4 @@
1
+ /*
2
+ *= require_self
3
+ *= require foundation_and_overrides
4
+ */
@@ -0,0 +1,4 @@
1
+ // Foundation Sass Variables Go Here!
2
+ // More information about Foundation + Sass can be found here:
3
+ // http://foundation.zurb.com/docs/
4
+ @import 'foundation';
@@ -0,0 +1,5 @@
1
+ class ApplicationController < ActionController::Base
2
+ # Prevent CSRF attacks by raising an exception.
3
+ # For APIs, you may want to use :null_session instead.
4
+ protect_from_forgery with: :exception
5
+ end
@@ -0,0 +1,4 @@
1
+ class StyleguideController < ApplicationController
2
+ def show
3
+ end
4
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
@@ -0,0 +1,2 @@
1
+ module StyleguideHelper
2
+ end
@@ -0,0 +1,19 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+
7
+ <title><%= content_for?(:title) ? yield(:title) : "foundation-rails" %></title>
8
+
9
+ <%= stylesheet_link_tag "application" %>
10
+ <%= javascript_include_tag "vendor/custom.modernizr" %>
11
+ <%= csrf_meta_tags %>
12
+ </head>
13
+
14
+ <body>
15
+
16
+ <%= yield %>
17
+ <%= javascript_include_tag "application" %>
18
+ </body>
19
+ </html>
@@ -0,0 +1,109 @@
1
+ <nav class="top-bar" data-topbar>
2
+ <ul class="title-area">
3
+ <li class="name">
4
+ <h1><a href="http://foundation.zurb.com">Foundation</a></h1>
5
+ </li>
6
+ </ul>
7
+
8
+ <section class="top-bar-section">
9
+ <!-- Right Nav Section -->
10
+ <ul class="right">
11
+ <li class="active"><a href="https://github.com/zurb/foundation-rails">GitHub</a></li>
12
+ <li class="has-dropdown">
13
+ <a href="http://foundation.zurb.com/docs/">Foundation Docs</a>
14
+ <ul class="dropdown">
15
+ <li><a href="http://foundation.zurb.com/support/support.html">Support</a></li>
16
+ </ul>
17
+ </li>
18
+ <li class="has-form">
19
+ <a href="" class="button" data-reveal-id="signupModal">Sign Up</a>
20
+ </li>
21
+ </ul>
22
+ </section>
23
+ </nav>
24
+
25
+
26
+
27
+ <ul data-orbit="">
28
+ <li><img src="http://placehold.it/1800x350/0079a1/ffffff&text=foundation-rails"></li>
29
+ <li><img src="http://placehold.it/1800x350/0079a1/ffffff&text=foundation-rails"></li>
30
+ <li><img src="http://placehold.it/1800x350/0079a1/ffffff&text=foundation-rails"></li>
31
+ </ul>
32
+
33
+
34
+ <div class="row">
35
+ <div class="large-4 columns">
36
+ <ul class="pricing-table">
37
+ <li class="title">Freelancer</li>
38
+ <li class="price">$99.99</li>
39
+ <li class="description">An awesome description</li>
40
+ <li class="bullet-item">1 Database</li>
41
+ <li class="bullet-item">5GB Storage</li>
42
+ <li class="bullet-item">20 Users</li>
43
+ <li class="cta-button"><a class="button" href="#">Buy Now</a></li>
44
+ </ul>
45
+ </div>
46
+ <div class="large-4 columns">
47
+ <ul class="pricing-table">
48
+ <li class="title">Startup</li>
49
+ <li class="price">$199.99</li>
50
+ <li class="description">An awesome description</li>
51
+ <li class="bullet-item">1 Database</li>
52
+ <li class="bullet-item">5GB Storage</li>
53
+ <li class="bullet-item">20 Users</li>
54
+ <li class="cta-button"><a class="button" href="#">Buy Now</a></li>
55
+ </ul>
56
+ </div>
57
+ <div class="large-4 columns">
58
+ <ul class="pricing-table">
59
+ <li class="title">Enterprise</li>
60
+ <li class="price">$999.99</li>
61
+ <li class="description">An awesome description</li>
62
+ <li class="bullet-item">1 Database</li>
63
+ <li class="bullet-item">5GB Storage</li>
64
+ <li class="bullet-item">20 Users</li>
65
+ <li class="cta-button"><a class="button" href="#">Buy Now</a></li>
66
+ </ul>
67
+ </div>
68
+ </div>
69
+
70
+ <hr>
71
+
72
+ <div class="row">
73
+ <div class="large-12 columns">
74
+ <h3 class="subheader">Find out more!</h3>
75
+ </div>
76
+ </div>
77
+
78
+ <div class="row">
79
+ <div class="large-12 columns">
80
+ <dl class="tabs" data-tab>
81
+ <dd class="active"><a href="#panel2-1">Overview</a></dd>
82
+ <dd><a href="#panel2-2">Features</a></dd>
83
+ <dd><a href="#panel2-3">Testimonials</a></dd>
84
+ <dd><a href="#panel2-4">History</a></dd>
85
+ </dl>
86
+ <div class="tabs-content">
87
+ <div class="content active" id="panel2-1">
88
+ <p>This is the first panel of the basic tab example. This is the first panel of the basic tab example.</p>
89
+ </div>
90
+ <div class="content" id="panel2-2">
91
+ <p>This is the second panel of the basic tab example. This is the second panel of the basic tab example.</p>
92
+ </div>
93
+ <div class="content" id="panel2-3">
94
+ <p>This is the third panel of the basic tab example. This is the third panel of the basic tab example.</p>
95
+ </div>
96
+ <div class="content" id="panel2-4">
97
+ <p>This is the fourth panel of the basic tab example. This is the fourth panel of the basic tab example.</p>
98
+ </div>
99
+ </div>
100
+ </div>
101
+ </div>
102
+
103
+
104
+ <div id="signupModal" data-reveal-modal class="reveal-modal">
105
+ <h2>Awesome. I have it.</h2>
106
+ <p class="lead">Your couch. It is mine.</p>
107
+ <p>Im a cool paragraph that lives inside of an even cooler modal. Wins</p>
108
+ <a class="close-reveal-modal">&#215;</a>
109
+ </div>