mountain_view 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +109 -0
  3. data/app/assets/javascripts/mountain_view/styleguide.js +2 -0
  4. data/app/assets/javascripts/mountain_view.js.erb +1 -0
  5. data/app/assets/stylesheets/mountain_view/styleguide.css +126 -0
  6. data/app/assets/stylesheets/mountain_view.css.erb +2 -1
  7. data/app/controllers/mountain_view/styleguide_controller.rb +9 -0
  8. data/app/helpers/mountain_view/component_helper.rb +0 -2
  9. data/app/helpers/mountain_view/styleguide_helper.rb +14 -0
  10. data/app/views/layouts/mountain_view.html.erb +30 -0
  11. data/app/views/mountain_view/styleguide/index.html.erb +8 -0
  12. data/app/views/mountain_view/styleguide/show.html.erb +19 -0
  13. data/config/routes.rb +5 -0
  14. data/lib/mountain_view/engine.rb +10 -0
  15. data/lib/mountain_view/version.rb +1 -1
  16. data/test/dummy/app/components/card/_card.html.erb +26 -0
  17. data/test/dummy/app/components/card/card.css +76 -0
  18. data/test/dummy/app/components/card/card.js +3 -0
  19. data/test/dummy/app/components/card/card.yml +33 -0
  20. data/test/dummy/app/components/header/_header.html.erb +4 -2
  21. data/test/dummy/app/components/header/header.css +23 -8
  22. data/test/dummy/app/components/header/header.js +3 -1
  23. data/test/dummy/app/components/header/header.yml +5 -0
  24. data/test/dummy/app/views/layouts/application.html.erb +1 -0
  25. data/test/dummy/config/application.rb +41 -1
  26. data/test/dummy/config/environment.rb +1 -1
  27. data/test/dummy/config/environments/development.rb +1 -35
  28. data/test/dummy/config/environments/production.rb +1 -80
  29. data/test/dummy/config/environments/test.rb +1 -37
  30. data/test/dummy/config/initializers/assets.rb +2 -2
  31. data/test/dummy/config/initializers/cookies_serializer.rb +1 -1
  32. data/test/dummy/config/initializers/filter_parameter_logging.rb +1 -1
  33. data/test/dummy/config/initializers/secret_token.rb +7 -0
  34. data/test/dummy/config/initializers/session_store.rb +1 -1
  35. data/test/dummy/config/routes.rb +4 -2
  36. data/test/dummy/log/development.log +611 -1338
  37. data/test/dummy/tmp/cache/assets/development/sprockets/05047392adf909e89a37882b1df46aa8 +0 -0
  38. data/test/dummy/tmp/cache/assets/development/sprockets/056a4da9bcd21e1bc54fc870c1bd1c93 +0 -0
  39. data/test/dummy/tmp/cache/assets/development/sprockets/0848104d612d68babe788b064bb6a773 +0 -0
  40. data/test/dummy/tmp/cache/assets/development/sprockets/0a5bb8ddcf321e88738e02ffb0cd02ef +0 -0
  41. data/test/dummy/tmp/cache/assets/development/sprockets/0c5cdad092202271d7dcd4a4e9434459 +0 -0
  42. data/test/dummy/tmp/cache/assets/development/sprockets/0ee705b1349b8360286fea9ed4e5e40e +0 -0
  43. data/test/dummy/tmp/cache/assets/development/sprockets/1025fb0f151fc866114ecf98044f10ee +0 -0
  44. data/test/dummy/tmp/cache/assets/development/sprockets/1358febedd4ca96d2bffd10daf71a841 +0 -0
  45. data/test/dummy/tmp/cache/assets/development/sprockets/13e30b9b47c795b0bf1c24f728ef72bb +0 -0
  46. data/test/dummy/tmp/cache/assets/development/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
  47. data/test/dummy/tmp/cache/assets/development/sprockets/19cd783e0750e55a88466eaf34cf8ee3 +0 -0
  48. data/test/dummy/tmp/cache/assets/development/sprockets/1a3befd27690385985935fbefadee114 +0 -0
  49. data/test/dummy/tmp/cache/assets/development/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
  50. data/test/dummy/tmp/cache/assets/development/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
  51. data/test/dummy/tmp/cache/assets/development/sprockets/37f90f006cee6a567571d9ef098f959c +0 -0
  52. data/test/dummy/tmp/cache/assets/development/sprockets/46844defcba01dc849d9b419893f98cc +0 -0
  53. data/test/dummy/tmp/cache/assets/development/sprockets/4b8ca8528217ffd457d34f6d3c10390e +0 -0
  54. data/test/dummy/tmp/cache/assets/development/sprockets/5288a3be9b42eac33a8c5107b2c1a3e7 +0 -0
  55. data/test/dummy/tmp/cache/assets/development/sprockets/6469b6494dfcb7811bd823eb37679edb +0 -0
  56. data/test/dummy/tmp/cache/assets/development/sprockets/646c70596539b146a28d3463b52e331d +0 -0
  57. data/test/dummy/tmp/cache/assets/development/sprockets/676413c50ebcc02f3683f0b74d03cd10 +0 -0
  58. data/test/dummy/tmp/cache/assets/development/sprockets/6b18a41e40b87e9cf56140076eaf8ee7 +0 -0
  59. data/test/dummy/tmp/cache/assets/development/sprockets/6d1c1dbe626c83b900adee3270c25207 +0 -0
  60. data/test/dummy/tmp/cache/assets/development/sprockets/7eb84ecf34a4f7e714d58448a8eb10bd +0 -0
  61. data/test/dummy/tmp/cache/assets/development/sprockets/895678836daa2e7d767a0b18998d3b32 +0 -0
  62. data/test/dummy/tmp/cache/assets/development/sprockets/90a2a412cf77f0878e811db239c79cbc +0 -0
  63. data/test/dummy/tmp/cache/assets/development/sprockets/9e3fff55e666e905677ea1ec03cbf90c +0 -0
  64. data/test/dummy/tmp/cache/assets/development/sprockets/a18133f41da2aa5e6c4ceeb0912758e4 +0 -0
  65. data/test/dummy/tmp/cache/assets/development/sprockets/a668b6ff88911a6fc7ee3ed2bce99925 +0 -0
  66. data/test/dummy/tmp/cache/assets/development/sprockets/adf63b8c230bec424832f299d6783649 +0 -0
  67. data/test/dummy/tmp/cache/assets/development/sprockets/b9bd83a3b44c1d3d3f3475bd4c0cba7f +0 -0
  68. data/test/dummy/tmp/cache/assets/development/sprockets/c6c9787ab538d56f0bf078335b046968 +0 -0
  69. data/test/dummy/tmp/cache/assets/development/sprockets/c7ee05b0bd8082e947e7f11a52d43d4d +0 -0
  70. data/test/dummy/tmp/cache/assets/development/sprockets/c8918b8c937b226f93f33acabc876a06 +0 -0
  71. data/test/dummy/tmp/cache/assets/development/sprockets/cd2a0221f05ca5fd45fa56d923f36195 +0 -0
  72. data/test/dummy/tmp/cache/assets/development/sprockets/cd456657bdefb4c3249301a5754fdbe2 +0 -0
  73. data/test/dummy/tmp/cache/assets/development/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
  74. data/test/dummy/tmp/cache/assets/development/sprockets/d6c936f92dce001a74c5de9eff308ea2 +0 -0
  75. data/test/dummy/tmp/cache/assets/development/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
  76. data/test/dummy/tmp/cache/assets/development/sprockets/d78f431479fa8ad43875544b8c50d206 +0 -0
  77. data/test/dummy/tmp/cache/assets/development/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
  78. data/test/dummy/tmp/cache/assets/development/sprockets/fd60d93b12b3001c215f1c6581eca777 +0 -0
  79. data/test/dummy/tmp/pids/server.pid +1 -1
  80. data/test/helpers/mountain_view/component_helper_test.rb +1 -1
  81. data/test/mountain_view_test.rb +1 -1
  82. metadata +95 -46
  83. data/test/dummy/db/development.sqlite3 +0 -0
  84. data/test/dummy/tmp/cache/assets/development/sprockets/1e8f75a6b5b33970fb8e397347caa0a1 +0 -0
  85. data/test/dummy/tmp/cache/assets/development/sprockets/24204f742af588c8166d3160b500d20f +0 -0
  86. data/test/dummy/tmp/cache/assets/development/sprockets/2739c7705f92af2c7a343bd3bec41ebf +0 -0
  87. data/test/dummy/tmp/cache/assets/development/sprockets/338f5f4fca22e174ca33d4951da6cb68 +0 -0
  88. data/test/dummy/tmp/cache/assets/development/sprockets/371bf96e99717688ed7313a0c53f4212 +0 -0
  89. data/test/dummy/tmp/cache/assets/development/sprockets/37643c71fe531f0952e5295acf215a42 +0 -0
  90. data/test/dummy/tmp/cache/assets/development/sprockets/416150dc3ac35079c94273cc46e90aa6 +0 -0
  91. data/test/dummy/tmp/cache/assets/development/sprockets/510da110ae528e2d22533be39ff696c5 +0 -0
  92. data/test/dummy/tmp/cache/assets/development/sprockets/5384ad85f52d3272dbc64d46ef3876a4 +0 -0
  93. data/test/dummy/tmp/cache/assets/development/sprockets/6fc757c2c8329244ca95d6909865bbc2 +0 -0
  94. data/test/dummy/tmp/cache/assets/development/sprockets/83cef341260a8fe947a452c98fe4e8e5 +0 -0
  95. data/test/dummy/tmp/cache/assets/development/sprockets/9968a5db588ce1b0eccde8ee4aa53070 +0 -0
  96. data/test/dummy/tmp/cache/assets/development/sprockets/ac40b40e96db620ce63bc31ea39a3a00 +0 -0
  97. data/test/dummy/tmp/cache/assets/development/sprockets/af58a5048930559efe210766e23cb33a +0 -0
  98. data/test/dummy/tmp/cache/assets/development/sprockets/b5fa5190a0392c201224fe65623c6b33 +0 -0
  99. data/test/dummy/tmp/cache/assets/development/sprockets/bd10fd095a0ad299793da5761647e6dd +0 -0
  100. data/test/dummy/tmp/cache/assets/development/sprockets/c85016e7bbd4f3adbb7635d01f85d39b +0 -0
  101. data/test/dummy/tmp/cache/assets/development/sprockets/d066c004d1fd26ae76a61303a7a18145 +0 -0
  102. data/test/dummy/tmp/cache/assets/development/sprockets/f63a83b6b75c46ab79854c53ebe1856a +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a8bc6bdc9168d7da291d91b40e86db6b4ece631b
4
- data.tar.gz: a9855a90415e16dc33bf1ae7bd4fe4a22c2b8c00
3
+ metadata.gz: dca4fc8566e7c7e8b7b91837b7a7d8964f06e3e4
4
+ data.tar.gz: 331ca8d3d5ce0eb17e749a3260d403660ff426bc
5
5
  SHA512:
6
- metadata.gz: 41f056c0573eb2268292a9f345b8e0ff94fa056decfd70e1d947b6b8d921d152bb9886fd7fabaf5bd906646869f373a3ebcf8080ab128db06854384c45f7ea85
7
- data.tar.gz: f83cd6723ca654f0277cf87344d47fa6bfe8e71a92ceed60eb27249e106b2e85a31514a7ff093770af6786eb1cc09b4d3e34dd385b1d1f075b9e0326a5e0db05
6
+ metadata.gz: 03154f5aa0096d4050a88fd912ba1f71ce4d5826ed828739104e090605bda7e1f66d1940a008719ea58ee095d4eebbd3ec56b3994ccfa8e9dd49162246c38a4f
7
+ data.tar.gz: b21584d536ab745a423adafafdba71be7cea7c70345725490f424d5ff128eceb84f079fd582f3eac5c3969303d8751c4d163bb4cc173d589bd938333a1010e17
data/README.md ADDED
@@ -0,0 +1,109 @@
1
+ # Mountain View
2
+
3
+ Mountain View helps you create reusable visual components on your Rails
4
+ Application.
5
+
6
+ ## Installation
7
+
8
+ Add this line to your application's Gemfile:
9
+
10
+ gem 'mountain_view'
11
+
12
+ Then execute:
13
+
14
+ $ bundle
15
+
16
+ ## Usage
17
+
18
+ ### Directory Structure
19
+ Create components following this directory structure
20
+
21
+ ```
22
+ app/
23
+ components/
24
+ header/
25
+ _header.html.erb
26
+ header.css
27
+ header.js
28
+ header.yml
29
+ ```
30
+
31
+ ### Component Example
32
+ You can write your own templates on erb, haml or any other templating language.
33
+ Same goes with stylesheets and javascripts. You can use scss, sass or
34
+ coffee-script as long as you have these preprocessors running on your app.
35
+
36
+ ```erb
37
+ <!-- app/components/header/_header.html.erb -->
38
+ <div class="header">
39
+ <h1>This is a header component with the title: <%= properties[:title] %></h1>
40
+ <h3>And subtitle <%= properties[:subtitle] %></h3>
41
+ </div>
42
+ ```
43
+
44
+ ### Using components on your views
45
+ You can then call your components on any view by using the following
46
+ helper:
47
+
48
+ ```erb
49
+ <%= ui_component "header", title: "This is a title", subtitle: "And this is a subtitle" %>
50
+ ```
51
+
52
+ ### Assets
53
+ You can require all the components CSS and JS automatically by requiring `mountain_view` in you main JS and CSS files.
54
+
55
+ ```
56
+ //= require mountain_view
57
+ ```
58
+
59
+ ### Automatically generated Style Guide
60
+ A style guide will be automatically generated. This styleguide never falls behind and it reflects your components in their latest version.
61
+
62
+ #### Setting up the style guide
63
+ 1) Add the following line to your `routes.rb` file.
64
+ ```ruby
65
+ mount MountainView::Engine => "/mountain_view"
66
+ ```
67
+ 2) Create stubs for your components. This stubs will be the examples in the styleguide.
68
+
69
+ E.g: `/app/components/card/card.yml`
70
+ ```yml
71
+ -
72
+ :title: "Aspen Snowmass"
73
+ :description: "Aspen Snowmass is a winter resort complex located in Pitkin County in western Colorado in the United States. Owned and operated by the Aspen Skiing Company it comprises four skiing/snowboarding areas on four adjacent mountains in the vicinity of the towns of Aspen and Snowmass Village."
74
+ :link: "http://google.com"
75
+ :image_url: "http://i.imgur.com/QzuIJTo.jpg"
76
+ :data:
77
+ -
78
+ :title: "Elevation"
79
+ :number: '7879ft'
80
+ -
81
+ :title: "Depth"
82
+ :number: '71"'
83
+ -
84
+ :title: "Sunset on the Mountain"
85
+ :description: "Three major ranges of the Alps – the Northern Calcareous Alps, Central Alps, and Southern Calcareous Alps – run west to east through Austria. The Central Alps, which consist largely of a granite base, are the largest and highest ranges in Austria."
86
+ :link: "http://google.com"
87
+
88
+ ```
89
+ 3) Vist `http://localhost:3000/mountain_view/styleguide`
90
+
91
+ #### Example Style Guide
92
+ ![mountain_view](https://cloud.githubusercontent.com/assets/623766/7099771/5b06d8da-dfd4-11e4-8558-1b7f026f28ad.gif)
93
+
94
+
95
+ ## Contributing
96
+
97
+ 1. Fork it ([https://github.com/jgnatch/mountain_view/fork](https://github.com/jgnatch/mountain_view/fork))
98
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
99
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
100
+ 4. Push to the branch (`git push origin my-new-feature`)
101
+ 5. Create new Pull Request
102
+
103
+ ## Team
104
+
105
+ ### Current Maintainers
106
+
107
+ * [Esteban Pastorino](https://github.com/kitop)
108
+ * [Ignacio Gutierrez](https://github.com/jgnatch)
109
+
@@ -0,0 +1,2 @@
1
+ //= require mountain_view
2
+ //= require mountain_view/prism
@@ -1,3 +1,4 @@
1
+ <% depend_on Rails.root.join('app', 'components') %>
1
2
  <% Dir.glob(Rails.root.join('app', 'components', '*')) do |component_dir|
2
3
  component = File.basename component_dir
3
4
  require_asset "#{component}/#{component}"
@@ -0,0 +1,126 @@
1
+ /*
2
+ *= require mountain_view
3
+ *= require mountain_view/prism
4
+ */
5
+
6
+ /* Eric Meyer's Reset CSS v2.0 - http://cssreset.com */
7
+ html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{border:0;font-size:100%;font:inherit;vertical-align:baseline;margin:0;padding:0}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:none}table{border-collapse:collapse;border-spacing:0}
8
+
9
+ body{
10
+ font-family: 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif;
11
+ padding: 0;
12
+ margin: 0;
13
+ }
14
+
15
+ /* HEADER */
16
+ .mv-header{
17
+ background: #777;
18
+ padding: 20px;
19
+ }
20
+ .mv-header__logo{
21
+ font-weight: bold;
22
+ color: white;
23
+ font-size: 20px;
24
+ }
25
+
26
+ /* FlEX WRAPPER */
27
+
28
+ .mv-flex-wrapper{
29
+ display: flex;
30
+ }
31
+
32
+ /* SIDEBAR */
33
+ .mv-sidebar{
34
+ background: #F7F7F7;
35
+ width: 18%;
36
+ box-sizing: border-box;
37
+ display: block;
38
+ float: left;
39
+ padding: 30px 20px;
40
+ flex:1;
41
+ min-height: 100vh;
42
+ }
43
+
44
+ .mv-sidebar h3{
45
+ font-weight: bold;
46
+ font-size: 16px;
47
+ margin-bottom: 25px;
48
+ color: #444;
49
+ }
50
+
51
+ .mv-sidebar ul{
52
+ }
53
+
54
+ .mv-sidebar ul li{
55
+ margin-bottom: 20px;
56
+ }
57
+
58
+ .mv-sidebar ul li a{
59
+ color:#555;
60
+ font-size: 14px;
61
+ text-decoration: none;
62
+ font-weight: 300;
63
+ }
64
+
65
+ .mv-sidebar ul li a:hover{
66
+ color:#000;
67
+ }
68
+
69
+ /* MAIN */
70
+ .mv-main{
71
+ box-sizing: border-box;
72
+ width: 82%;
73
+ float:left;
74
+ padding: 30px 60px;
75
+ }
76
+ .mv-main__header{
77
+ margin-bottom: 40px;
78
+ }
79
+
80
+ .mv-main__header h1{
81
+ font-weight: 100;
82
+ font-size: 55px;
83
+ color: #333;
84
+ }
85
+
86
+ .mv-main__description {
87
+ }
88
+
89
+ /* COMPONENT */
90
+ .mv-component{
91
+ margin-bottom: 150px;
92
+ }
93
+
94
+ .mv-component__item{
95
+ }
96
+
97
+ .mv-component__description{
98
+ padding: 25px;
99
+ background: #F7F7F7;
100
+ border: 1px solid #E4E4E4;
101
+ margin-top:30px;
102
+ }
103
+
104
+ .mv-component__description h2{
105
+ font-weight:bold;
106
+ margin-bottom:20px;
107
+ }
108
+
109
+ .mv-component__description__definition{
110
+ margin-bottom:20px;
111
+ }
112
+
113
+ .mv-component__description__definition code{
114
+ background: none !important;
115
+ font-size:14px;
116
+ }
117
+
118
+ .mv-component__description__properties{
119
+ background: #fff !important;
120
+ border:1px solid #e4e4e4;
121
+ max-height:230px;
122
+ overflow:auto;
123
+ font-size: 13px;
124
+ padding: 30px 20px;
125
+ }
126
+
@@ -1,4 +1,5 @@
1
- <% Dir.glob(Rails.root.join('app', 'components', '*')) do |component_dir|
1
+ <% depend_on Rails.root.join('app', 'components') %>
2
+ <% Dir.glob(Rails.root.join('app', 'components', '*')).each do |component_dir|
2
3
  component = File.basename component_dir
3
4
  require_asset "#{component}/#{component}"
4
5
  end %>
@@ -0,0 +1,9 @@
1
+ module MountainView
2
+ class StyleguideController < ::ApplicationController
3
+ layout "mountain_view"
4
+
5
+ def show
6
+ @component = params[:id]
7
+ end
8
+ end
9
+ end
@@ -1,9 +1,7 @@
1
1
  module MountainView
2
2
  module ComponentHelper
3
-
4
3
  def ui_component(slug, properties = {})
5
4
  render "#{slug}/#{slug}", properties: properties
6
5
  end
7
-
8
6
  end
9
7
  end
@@ -0,0 +1,14 @@
1
+ module MountainView
2
+ module StyleguideHelper
3
+ def mv_components
4
+ Dir.glob(Rails.root.join("app", "components", "*")).map do |component_dir|
5
+ File.basename component_dir
6
+ end
7
+ end
8
+
9
+ def styleguide_stubs(component_name)
10
+ stubs_file = Rails.root.join("app/components/#{component_name}/#{component_name}.yml")
11
+ YAML.load_file stubs_file
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,30 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Styleguide</title>
5
+ <%= stylesheet_link_tag 'mountain_view/styleguide', media: 'all', 'data-turbolinks-track' => true %>
6
+ <%= javascript_include_tag 'mountain_view/styleguide', 'data-turbolinks-track' => true %>
7
+
8
+ <%= csrf_meta_tags %>
9
+ </head>
10
+ <body>
11
+ <div class="mv-header">
12
+ <div class="mv-header__logo">STYLEGUIDE</div>
13
+ </div>
14
+ <div class="mv-flex-wrapper">
15
+ <div class="mv-sidebar">
16
+ <h3>COMPONENTS</h3>
17
+ <ul>
18
+ <%- mv_components.each do |component| %>
19
+ <li>
20
+ <%= link_to component.capitalize, styleguide_path(id: component) %>
21
+ </li>
22
+ <% end %>
23
+ </ul>
24
+ </div>
25
+ <div class="mv-main">
26
+ <%= yield %>
27
+ </div>
28
+ </div>
29
+ </body>
30
+ </html>
@@ -0,0 +1,8 @@
1
+ <div class="mv-main__header">
2
+ <h1>Styleguide</h1>
3
+ </div>
4
+
5
+ <div class="mv-main__description">
6
+ Select one of the components from the side to view its examples and documentation.
7
+ </div>
8
+
@@ -0,0 +1,19 @@
1
+ <div class="mv-main__header">
2
+ <h1><%= @component.capitalize %></h1>
3
+ </div>
4
+
5
+ <% styleguide_stubs(@component).each_with_index do |component_properties, index| %>
6
+ <div class="mv-component">
7
+ <div class="mv-component__item">
8
+ <%= ui_component @component, component_properties %>
9
+ </div>
10
+ <div class="mv-component__description">
11
+ <h2><%= @component.capitalize %> <%= index + 1 %></h2>
12
+ <div class="mv-component__description__definition">
13
+ <code class="language-ruby">&lt;%= ui_component("<%= @component %>", {properties as below}) %&gt;</code>
14
+ </div>
15
+ <%- formatted = JSON.pretty_generate component_properties %>
16
+ <pre class="mv-component__description__properties language-ruby"><code><%= formatted.gsub(/\"(\S+)?\":/, '\1:') %></code></pre>
17
+ </div>
18
+ </div>
19
+ <% end %>
data/config/routes.rb ADDED
@@ -0,0 +1,5 @@
1
+ MountainView::Engine.routes.draw do
2
+ root to: "styleguide#index"
3
+
4
+ resources :styleguide, only: [:index, :show]
5
+ end
@@ -3,8 +3,12 @@ require 'rails'
3
3
 
4
4
  module MountainView
5
5
  class Engine < ::Rails::Engine
6
+ isolate_namespace MountainView
7
+
6
8
  initializer "mountain_view.assets" do |app|
7
9
  Rails.application.config.assets.paths << app.root.join("app", "components")
10
+ Rails.application.config.assets.precompile += %w( mountain_view/styleguide.css
11
+ mountain_view/styleguide.js )
8
12
  end
9
13
 
10
14
  initializer "mountain_view.append_view_paths" do |app|
@@ -12,5 +16,11 @@ module MountainView
12
16
  append_view_path app.root.join("app", "components")
13
17
  end
14
18
  end
19
+
20
+ initializer "mountain_view.add_helpers" do
21
+ ActiveSupport.on_load :action_controller do
22
+ helper MountainView::ComponentHelper
23
+ end
24
+ end
15
25
  end
16
26
  end
@@ -1,3 +1,3 @@
1
1
  module MountainView
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -0,0 +1,26 @@
1
+ <div class="card <%= 'card--no-img' if properties[:image_url].nil? %>">
2
+ <%- if properties[:image_url] %>
3
+ <div class="card__image">
4
+ <a href="<%= properties[:link] %>"><img alt="<%= properties[:title] %>" src="<%= properties[:image_url] %>">
5
+ </a>
6
+ </div>
7
+ <% end %>
8
+ <div class="card__content">
9
+ <h3 class="card__content__title">
10
+ <a href="<%= properties[:link] %>"><%= properties[:title] %></a>
11
+ </h3>
12
+ <%- if properties[:description] %>
13
+ <p><%= properties[:description] %></p>
14
+ <%- end %>
15
+ <div class="card__content__data">
16
+ <%- if properties[:data] && properties[:data].any? %>
17
+ <%- properties[:data].each do |data| %>
18
+ <dl>
19
+ <dt><%= data[:number] %></dt>
20
+ <dd><%= data[:title] %></dd>
21
+ </dl>
22
+ <% end %>
23
+ <% end %>
24
+ </div>
25
+ </div>
26
+ </div>
@@ -0,0 +1,76 @@
1
+ .card{
2
+ max-width: 300px;
3
+ box-sizing: border-box;
4
+ background: #FFF;
5
+ border-radius: 4px;
6
+ margin-bottom: 20px;
7
+ box-shadow: 0px 0px 4px rgba(0, 0, 0, 0.2);
8
+ -moz-box-shadow: 0px 0px 4px rgba(0,0,0,0.2);
9
+ -webkit-box-shadow: 0px 0px 4px rgba(0, 0, 0, 0.2);
10
+ -o-box-shadow: 0px 0px 4px rgba(0,0,0,0.2);
11
+ }
12
+
13
+ .card--no-img{
14
+ padding: 20px;
15
+ }
16
+
17
+ .card__image img{
18
+ border-radius: 4px 4px 0 0;
19
+ max-width: 100%;
20
+ }
21
+
22
+ .card__content{
23
+ padding: 16px;
24
+ }
25
+
26
+
27
+ .card__content__title{
28
+ font-size: 17px;
29
+ margin:0;
30
+ line-height: 1;
31
+ color:#1D7657;
32
+ font-weight: bold;
33
+ margin-bottom: 10px;
34
+ }
35
+
36
+ .card__content__title a{
37
+ color:#1D7657;
38
+ font-size: 17px;
39
+ margin: 0 0 5px 0;
40
+ line-height: 1;
41
+ text-decoration: none;
42
+ }
43
+
44
+ .card__content__title a:hover{
45
+ color:#0B4A34;
46
+ }
47
+
48
+ .card__content p{
49
+ color: #B2B2B2;
50
+ margin: 0;
51
+ font-size: 13px;
52
+ line-height: 1.5;
53
+ }
54
+
55
+
56
+ .card__content__data{
57
+ padding: 10px 0;
58
+ }
59
+
60
+ .card__content__data dl{
61
+ display: inline-block;
62
+ width: 32%;
63
+ }
64
+
65
+ .card__content__data dl dt{
66
+ font-size: 20px;
67
+ margin-bottom: 6px;
68
+ color: #bbb;
69
+ }
70
+
71
+ .card__content__data dl dd{
72
+ text-transform: uppercase;
73
+ font-size: 11px;
74
+ color: #888;
75
+ font-weight: bold;
76
+ }
@@ -0,0 +1,3 @@
1
+ if(typeof console !== "undefined") {
2
+ console.log("card")
3
+ }
@@ -0,0 +1,33 @@
1
+ -
2
+ :title: "Aspen Snowmass"
3
+ :description: "Aspen Snowmass is a winter resort complex located in Pitkin County in western Colorado in the United States. Owned and operated by the Aspen Skiing Company it comprises four skiing/snowboarding areas on four adjacent mountains in the vicinity of the towns of Aspen and Snowmass Village."
4
+ :link: "http://google.com"
5
+ :image_url: "http://i.imgur.com/QzuIJTo.jpg"
6
+ :data:
7
+ -
8
+ :title: "Elevation"
9
+ :number: '7879ft'
10
+ -
11
+ :title: "Depth"
12
+ :number: '71"'
13
+
14
+
15
+ -
16
+ :title: "Breckenridge, Colorado"
17
+ :link: "http://facebook.com"
18
+ :image_url: "http://i.imgur.com/w7ZyWPg.jpg"
19
+ :data:
20
+ -
21
+ :title: "Open lifts"
22
+ :number: '30'
23
+ -
24
+ :title: "Base"
25
+ :number: '51"'
26
+ -
27
+ :title: "Top"
28
+ :number: '99"'
29
+
30
+ -
31
+ :title: "Sunset on the Mountain"
32
+ :description: "Three major ranges of the Alps – the Northern Calcareous Alps, Central Alps, and Southern Calcareous Alps – run west to east through Austria. The Central Alps, which consist largely of a granite base, are the largest and highest ranges in Austria."
33
+ :link: "http://google.com"
@@ -1,4 +1,6 @@
1
1
  <div class="header">
2
- <h1>This is a header component with the title: <%= properties[:title] %></h1>
3
- <h3>And subtitle <%= properties[:subtitle]</h3>
2
+ <h1><%= properties[:title] %></h1>
3
+ <%- if properties[:subtitle] %>
4
+ <h3><%= properties[:subtitle] %></h3>
5
+ <% end %>
4
6
  </div>
@@ -1,11 +1,26 @@
1
1
  .header {
2
- font-family: sans-serif;
3
- background: #F1F2F4;
4
- width: 800px;
5
- padding: 10px 100px;
6
- color: #257699;
7
- text-align: center;
8
- font-weight: lighter;
2
+ margin-bottom: 30px;
3
+ font-family: 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif;
4
+ position: relative;
5
+ }
6
+
7
+ .header h1{
9
8
  font-size: 30px;
10
- border: 1px solid #D0DFE5;
9
+ color: #333;
10
+ margin-bottom: 10px;
11
+ }
12
+
13
+ .header h3{
14
+ font-size: 20px;
15
+ font-family: 'Georgia';
16
+ color:#888;
11
17
  }
18
+
19
+ .header::after{
20
+ content: " ";
21
+ width: 100px;
22
+ position: absolute;
23
+ bottom: -17px;
24
+ left: 0;
25
+ border-bottom: 5px solid #2C9140;
26
+ }
@@ -1 +1,3 @@
1
- console && console.log('header')
1
+ if(typeof console !== "undefined") {
2
+ console.log("header")
3
+ }
@@ -0,0 +1,5 @@
1
+ -
2
+ :title: "20 Mountains you didn't know they even existed"
3
+ :subtitle: "Buzzfeed title"
4
+ -
5
+ :title: "You won't believe what happened to this man at Aspen"
@@ -7,6 +7,7 @@
7
7
  <%= csrf_meta_tags %>
8
8
  </head>
9
9
  <body>
10
+ <h1>HEADER</h1>
10
11
  <%= yield %>
11
12
 
12
13
  </body>
@@ -1,6 +1,9 @@
1
1
  require File.expand_path('../boot', __FILE__)
2
2
 
3
- require 'rails/all'
3
+ require "active_support"
4
+ require "action_controller"
5
+ require "action_view"
6
+ require "sprockets/railtie"
4
7
 
5
8
  Bundler.require(*Rails.groups)
6
9
  require "mountain_view"
@@ -18,6 +21,43 @@ module Dummy
18
21
  # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
19
22
  # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
20
23
  # config.i18n.default_locale = :de
24
+
25
+ # support newer rails without warnings
26
+ config.active_support.test_order = :random rescue nil
27
+
28
+ # Settings specified here will take precedence over those in config/application.rb.
29
+
30
+ # The test environment is used exclusively to run your application's
31
+ # test suite. You never need to work with it otherwise. Remember that
32
+ # your test database is "scratch space" for the test suite and is wiped
33
+ # and recreated between test runs. Don't rely on the data there!
34
+ config.cache_classes = true
35
+
36
+ # Do not eager load code on boot. This avoids loading your whole application
37
+ # just for the purpose of running a single test. If you are using a tool that
38
+ # preloads Rails for running tests, you may have to set it to true.
39
+ config.eager_load = false
40
+
41
+ # Configure static asset server for tests with Cache-Control for performance.
42
+ config.static_cache_control = 'public, max-age=3600'
43
+
44
+ config.assets.enabled = true
45
+
46
+ # Show full error reports and disable caching.
47
+ config.consider_all_requests_local = true
48
+ config.action_controller.perform_caching = false
49
+
50
+ # Raise exceptions instead of rendering exception templates.
51
+ config.action_dispatch.show_exceptions = false
52
+
53
+ # Disable request forgery protection in test environment.
54
+ config.action_controller.allow_forgery_protection = false
55
+
56
+ # Print deprecation notices to the stderr.
57
+ config.active_support.deprecation = :stderr
58
+
59
+ # Raises error for missing translations
60
+ # config.action_view.raise_on_missing_translations = true
21
61
  end
22
62
  end
23
63
 
@@ -2,4 +2,4 @@
2
2
  require File.expand_path('../application', __FILE__)
3
3
 
4
4
  # Initialize the Rails application.
5
- Rails.application.initialize!
5
+ Dummy::Application.initialize!