ood_appkit 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +22 -0
  3. data/README.md +395 -0
  4. data/Rakefile +34 -0
  5. data/app/assets/stylesheets/_ood_appkit.scss +2 -0
  6. data/app/assets/stylesheets/ood_appkit/_bootstrap-overrides.scss.erb +3 -0
  7. data/app/assets/stylesheets/ood_appkit/_branding.scss +2 -0
  8. data/app/assets/stylesheets/ood_appkit/_markdown.scss +66 -0
  9. data/app/assets/stylesheets/ood_appkit/branding/_navbar.scss +96 -0
  10. data/app/controllers/concerns/ood_appkit/wiki_page.rb +23 -0
  11. data/app/controllers/ood_appkit/wiki_controller.rb +4 -0
  12. data/app/views/ood_appkit/wiki/show.html.erb +7 -0
  13. data/config/routes.rb +11 -0
  14. data/lib/ood_appkit/configuration.rb +100 -0
  15. data/lib/ood_appkit/dashboard_url.rb +26 -0
  16. data/lib/ood_appkit/engine.rb +23 -0
  17. data/lib/ood_appkit/files_rack_app.rb +21 -0
  18. data/lib/ood_appkit/files_url.rb +38 -0
  19. data/lib/ood_appkit/markdown_template_handler.rb +27 -0
  20. data/lib/ood_appkit/public_url.rb +26 -0
  21. data/lib/ood_appkit/shell_url.rb +29 -0
  22. data/lib/ood_appkit/version.rb +4 -0
  23. data/lib/ood_appkit.rb +16 -0
  24. data/lib/tasks/ood_appkit_tasks.rake +6 -0
  25. data/test/dummy/README.rdoc +28 -0
  26. data/test/dummy/Rakefile +6 -0
  27. data/test/dummy/app/assets/javascripts/application.js +13 -0
  28. data/test/dummy/app/assets/stylesheets/application.css +13 -0
  29. data/test/dummy/app/controllers/application_controller.rb +5 -0
  30. data/test/dummy/app/helpers/application_helper.rb +2 -0
  31. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  32. data/test/dummy/bin/bundle +3 -0
  33. data/test/dummy/bin/rails +4 -0
  34. data/test/dummy/bin/rake +4 -0
  35. data/test/dummy/config/application.rb +23 -0
  36. data/test/dummy/config/boot.rb +5 -0
  37. data/test/dummy/config/database.yml +25 -0
  38. data/test/dummy/config/environment.rb +5 -0
  39. data/test/dummy/config/environments/development.rb +29 -0
  40. data/test/dummy/config/environments/production.rb +80 -0
  41. data/test/dummy/config/environments/test.rb +36 -0
  42. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  43. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  44. data/test/dummy/config/initializers/inflections.rb +16 -0
  45. data/test/dummy/config/initializers/mime_types.rb +5 -0
  46. data/test/dummy/config/initializers/secret_token.rb +12 -0
  47. data/test/dummy/config/initializers/session_store.rb +3 -0
  48. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  49. data/test/dummy/config/locales/en.yml +23 -0
  50. data/test/dummy/config/routes.rb +56 -0
  51. data/test/dummy/config.ru +4 -0
  52. data/test/dummy/public/404.html +58 -0
  53. data/test/dummy/public/422.html +58 -0
  54. data/test/dummy/public/500.html +57 -0
  55. data/test/dummy/public/favicon.ico +0 -0
  56. data/test/integration/navigation_test.rb +10 -0
  57. data/test/ood_appkit_test.rb +28 -0
  58. data/test/test_helper.rb +16 -0
  59. metadata +193 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 1a7f419914552815e3d0bb2c9af6bd27c0fca870
4
+ data.tar.gz: 7a0f816f4127b63a478cd018b69e7ab01a82f50e
5
+ SHA512:
6
+ metadata.gz: 68fd62b19a15d3c5ab89a45ce538dd7ab14deb664d4d6df69de87ae34dbfed859821341f9c0efdadaba47c4405ec7196a00ef82451bd4de943261d8fe0a53a79
7
+ data.tar.gz: ec99f9ae001b642eb4e2dbbd7a47858037c7f6b085319c04029423325b5ed4c5126f5fded3b5d5a25aa168b2c4c6d0d3a3f230c5e78dc54ff7b7486ca8f507ee
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015-2016 Ohio Supercomputer Center
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,395 @@
1
+ ## Installation
2
+
3
+ To use, add this line to your application's Gemfile:
4
+
5
+ gem 'ood_appkit'
6
+
7
+ And then execute:
8
+
9
+ bundle install
10
+
11
+ ## Usage
12
+
13
+ ### Rake Tasks
14
+
15
+ #### reset
16
+
17
+ Running this rake task
18
+
19
+ ```bash
20
+ bin/rake ood_appkit:reset
21
+ ```
22
+
23
+ will clear the Rails cache and update the timestamp on the `tmp/restart.txt`
24
+ file that is used by Passenger to decide whether to restart the application.
25
+
26
+ ### URL Handlers for System Apps
27
+
28
+ #### Public URL
29
+
30
+ This is the URL used to access publicly available assets provided by the OOD
31
+ infrastructure, e.g., the `favicon.ico`.
32
+
33
+ ```erb
34
+ <%= favicon_link_tag nil, href: OodAppkit.public.url.join('favicon.ico') %>
35
+ ```
36
+
37
+ Note: We used `nil` here as the source otherwise Rails will try to prepend the
38
+ `RAILS_RELATIVE_URL_ROOT` to it. We explicitly define the link using `href:`
39
+ instead.
40
+
41
+ You can change the options using environment variables:
42
+
43
+ ```bash
44
+ OOD_PUBLIC_URL='/public'
45
+ OOD_PUBLIC_TITLE='Public Assets'
46
+ ```
47
+
48
+ Or by modifying the configuration in an initializer:
49
+
50
+ ```ruby
51
+ # config/initializers/ood_appkit.rb
52
+
53
+ OodAppkit.configure do |config|
54
+ # Defaults
55
+ config.public = OodAppkit::PublicUrl.new title: 'Public Assets', base_url: '/public'
56
+ end
57
+ ```
58
+
59
+ #### Dashboard URL
60
+
61
+ ```erb
62
+ <%= link_to OodAppkit.dashboard.title, OodAppkit.dashboard.url.to_s %>
63
+ ```
64
+
65
+ You can change the options using environment variables:
66
+
67
+ ```bash
68
+ OOD_DASHBOARD_URL='/pun/sys/dashboard'
69
+ OOD_DASHBOARD_TITLE='Dashboard'
70
+ ```
71
+
72
+ Or by modifying the configuration in an initializer:
73
+
74
+ ```ruby
75
+ # config/initializers/ood_appkit.rb
76
+
77
+ OodAppkit.configure do |config|
78
+ # Defaults
79
+ config.dashboard = OodAppkit::DashboardUrl.new title: 'Dashboard', base_url: '/pun/sys/dashboard'
80
+ end
81
+ ```
82
+
83
+ #### Files App
84
+
85
+ ```erb
86
+ <%# Link to the Files app %>
87
+ <%= link_to OodAppkit.files.title, OodAppkit.files.url.to_s %>
88
+
89
+ <%# Link to open files app to specified directory %>
90
+ <%= link_to "/path/to/file", OodAppkit.files.url(path: "/path/to/file").to_s %>
91
+ <%= link_to "/path/to/file", OodAppkit.files.url(path: Pathname.new("/path/to/file")).to_s %>
92
+
93
+ <%# Link to retrieve API info for given file %>
94
+ <%= link_to "/path/to/file", OodAppkit.files.api(path: "/path/to/file").to_s %>
95
+ ```
96
+
97
+ You can change the options using environment variables:
98
+
99
+ ```bash
100
+ OOD_FILES_URL='/pun/sys/files'
101
+ OOD_FILES_TITLE='Files'
102
+ ```
103
+
104
+ Or by modifying the configuration in an initializer:
105
+
106
+ ```ruby
107
+ # config/initializers/ood_appkit.rb
108
+
109
+ OodAppkit.configure do |config|
110
+ # Defaults
111
+ config.files = OodAppkit::FilesUrl.new title: 'Files', base_url: '/pun/sys/files'
112
+ end
113
+ ```
114
+
115
+ #### Shell App
116
+
117
+ ```erb
118
+ <%# Link to the Shell app %>
119
+ <%= link_to OodAppkit.shell.title, OodAppkit.shell.url.to_s %>
120
+
121
+ <%# Link to launch Shell app for specified host %>
122
+ <%= link_to "Ruby Shell", OodAppkit.shell.url(host: "ruby").to_s %>
123
+
124
+ <%# Link to launch Shell app in specified directory %>
125
+ <%= link_to "Shell in /path/to/dir", OodAppkit.shell.url(path: "/path/to/dir").to_s %>
126
+
127
+ <%# Link to launch Shell app for specified host in directory %>
128
+ <%= link_to "Ruby in /path/to/dir", OodAppkit.shell.url(host: "ruby", path: "/path/to/dir").to_s %>
129
+ ```
130
+
131
+ You can change the options using environment variables:
132
+
133
+ ```bash
134
+ OOD_SHELL_URL='/pun/sys/shell'
135
+ OOD_SHELL_TITLE='Shell'
136
+ ```
137
+
138
+ Or by modifying the configuration in an initializer:
139
+
140
+ ```ruby
141
+ # config/initializers/ood_appkit.rb
142
+
143
+ OodAppkit.configure do |config|
144
+ # Defaults
145
+ config.shell = OodAppkit::ShellUrl.new title: 'Shell', base_url: '/pun/sys/shell'
146
+ end
147
+ ```
148
+
149
+ ### Rack Middleware for handling Files under Dataroot
150
+
151
+ This mounts all the files under the `OodAppkit.dataroot` using the following route
152
+ by default:
153
+
154
+ ```ruby
155
+ # config/routes.rb
156
+
157
+ mount OodAppkit::FilesRackApp.new => '/files', as: :files
158
+ ```
159
+
160
+ To disable this generated route:
161
+
162
+ ```ruby
163
+ # config/initializers/ood_appkit.rb
164
+
165
+ OodAppkit.configure do |config|
166
+ config.routes.files_rack_app = false
167
+ end
168
+ ```
169
+
170
+ To add a new route:
171
+
172
+ ```ruby
173
+ # config/routes.rb
174
+
175
+ # rename URI from '/files' to '/dataroot'
176
+ mount OodAppkit::FilesRackApp.new => '/dataroot', as: :files
177
+
178
+ # create new route with root set to '/tmp' on filesystem
179
+ mount OodAppkit::FilesRackApp.new(root: '/tmp') => '/tmp', as: :tmp
180
+ ```
181
+
182
+ ### Wiki Static Page Engine
183
+
184
+ This gem comes with a wiki static page engine. It uses the supplied markdown
185
+ handler to display GitHub style wiki pages.
186
+
187
+ By default the route is generated for you:
188
+
189
+ ```ruby
190
+ # config/routes.rb
191
+
192
+ get 'wiki/*page' => 'ood_appkit/wiki#show', as: :wiki, content_path: 'wiki'
193
+ ```
194
+
195
+ and can be accessed within your app by
196
+
197
+ ```erb
198
+ <%= link_to "Documentation", wiki_path('Home') %>
199
+ ```
200
+
201
+ To disable this generated route:
202
+
203
+ ```ruby
204
+ # config/initializers/ood_appkit.rb
205
+
206
+ OodAppkit.configure do |config|
207
+ config.routes.wiki = false
208
+ end
209
+ ```
210
+
211
+ To change (disable route first) or add a new route:
212
+
213
+ ```ruby
214
+ # config/routes.rb
215
+
216
+ # can modify URI as well as file system content path where files reside
217
+ get 'tutorial/*page' => 'ood_appkit/wiki#show', as: :tutorial, content_path: '/path/to/my_tutorial'
218
+
219
+ # can use your own controller
220
+ get 'wiki/*page' => 'my_wiki#show', as: :wiki, content_path: 'wiki'
221
+ ```
222
+
223
+ You can use your own controller by including the appropriate concern:
224
+
225
+ ```ruby
226
+ # app/controllers/my_wiki_controller.rb
227
+ class MyWikiController < ApplicationController
228
+ include OodAppkit::WikiPage
229
+
230
+ layout :layout_for_page
231
+
232
+ private
233
+ def layout_for_page
234
+ 'wiki_layout'
235
+ end
236
+ end
237
+ ```
238
+
239
+ And add a show view for this controller:
240
+
241
+ ```erb
242
+ <%# app/views/my_wiki/show.html.erb %>
243
+
244
+ <div class="ood-appkit markdown">
245
+ <div class="row">
246
+ <div class="col-md-8 col-md-offset-2">
247
+ <%= render file: @page %>
248
+ </div>
249
+ </div>
250
+ </div>
251
+ ```
252
+
253
+ ### Override Bootstrap Variables
254
+
255
+ You can easily override any bootstrap variable using environment variables:
256
+
257
+ ```bash
258
+ # BOOTSTRAP_<variable>='<value>'
259
+
260
+ # Change font sizes
261
+ BOOTSTRAP_FONT_SIZE_H1='50px'
262
+ BOOTSTRAP_FONT_SIZE_H2='24px'
263
+
264
+ # Re-use variables
265
+ BOOTSTRAP_GRAY_BASE='#000'
266
+ BOOTSTRAP_GRAY_DARKER='lighten($gray-base, 13.5%)'
267
+ BOOTSTRAP_GRAY_DARK='lighten($gray-base, 20%)'
268
+ ```
269
+
270
+ The variables can also be overridden in an initializer:
271
+
272
+ ```ruby
273
+ # config/initializers/ood_appkit.rb
274
+
275
+ OodAppkit.configure do |config|
276
+ # These are the defaults
277
+ config.bootstrap.navbar_inverse_bg = '#53565a'
278
+ config.bootstrap.navbar_inverse_link_color = '#fff'
279
+ config.bootstrap.navbar_inverse_color = '$navbar-inverse-link-color'
280
+ config.bootstrap.navbar_inverse_link_hover_color = 'darken($navbar-inverse-link-color, 20%)'
281
+ config.bootstrap.navbar_inverse_brand_color = '$navbar-inverse-link-color'
282
+ config.bootstrap.navbar_inverse_brand_hover_color = '$navbar-inverse-link-hover-color'
283
+ end
284
+ ```
285
+
286
+ You **MUST** import the bootstrap overrides into your stylesheets
287
+ for these to take effect
288
+
289
+ ```scss
290
+ // app/assets/stylesheets/application.scss
291
+
292
+ // load the bootstrap sprockets first
293
+ @import "bootstrap-sprockets";
294
+
295
+ // this MUST occur before you import bootstrap
296
+ @import "ood_appkit/bootstrap-overrides";
297
+
298
+ // this MUST occur after the bootstrap overrides
299
+ @import "bootstrap";
300
+ ```
301
+
302
+ ### Markdown Handler
303
+
304
+ A simple markdown handler is included with this gem. Any views with the
305
+ extensions `*.md` or `*.markdown` will be handled using the `Redcarpet` gem.
306
+ The renderer can be modified as such:
307
+
308
+ ```ruby
309
+ # config/initializers/ood_appkit.rb
310
+
311
+ OodAppkit.configure do |config|
312
+ # Default
313
+ config.markdown = Redcarpet::Markdown.new(
314
+ Redcarpet::Render::HTML,
315
+ autolink: true,
316
+ tables: true,
317
+ strikethrough: true,
318
+ fenced_code_blocks: true,
319
+ no_intra_emphasis: true
320
+ )
321
+ end
322
+ ```
323
+
324
+ Really any object can be used that responds to `#render`.
325
+
326
+ Note: You will need to import the appropriate stylesheet if you want the
327
+ rendered markdown to resemble GitHub's display of markdown.
328
+
329
+ ```scss
330
+ // app/assets/stylesheets/application.scss
331
+
332
+ @import "ood_appkit/markdown";
333
+ ```
334
+
335
+ It is also included if you import the default stylesheet:
336
+
337
+
338
+ ```scss
339
+ // app/assets/stylesheets/application.scss
340
+
341
+ @import "ood_appkit";
342
+ ```
343
+
344
+ ## Branding Features
345
+
346
+ To take advantage of branding features you must import it in your stylesheet:
347
+
348
+ ```scss
349
+ // app/assets/stylesheets/application.scss
350
+
351
+ @import "ood_appkit/branding";
352
+ ```
353
+
354
+ It is also included if you import the default stylesheet:
355
+
356
+
357
+ ```scss
358
+ // app/assets/stylesheets/application.scss
359
+
360
+ @import "ood_appkit";
361
+ ```
362
+
363
+ ### Navbar Breadcrumbs
364
+
365
+ One such branding feature is the `navbar-breadcrumbs`. It is used to accentuate
366
+ the tree like style of the app in the navbar. It is used as such:
367
+
368
+ ```erb
369
+ <nav class="ood-appkit navbar navbar-inverse navbar-static-top" role="navigation">
370
+ <div class="navbar-header">
371
+ ...
372
+ <ul class="navbar-breadcrumbs">
373
+ <li><%= link_to OodAppkit.dashboard.title, OodAppkit.dashboard.url.to_s %></li>
374
+ <li><%= link_to 'MyApp', root_path %></li>
375
+ <li><%= link_to 'Meshes', meshes_path %></li>
376
+ </ul>
377
+ </div>
378
+
379
+ ...
380
+ </nav>
381
+ ```
382
+
383
+ Note that you must include `ood-appkit` as a class in the `nav` tag. The
384
+ breadcrumbs style will resemble the `navbar-brand` style.
385
+
386
+ ## Develop
387
+
388
+ Generated using:
389
+
390
+ rails plugin new ood_appkit --full --skip-bundle
391
+
392
+
393
+ ## License
394
+
395
+ This gem is released under the [MIT License](http://www.opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,34 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rdoc/task'
8
+
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'OodAppkit'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.rdoc')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+ APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
18
+ load 'rails/tasks/engine.rake'
19
+
20
+
21
+
22
+ Bundler::GemHelper.install_tasks
23
+
24
+ require 'rake/testtask'
25
+
26
+ Rake::TestTask.new(:test) do |t|
27
+ t.libs << 'lib'
28
+ t.libs << 'test'
29
+ t.pattern = 'test/**/*_test.rb'
30
+ t.verbose = false
31
+ end
32
+
33
+
34
+ task default: :test
@@ -0,0 +1,2 @@
1
+ @import "ood_appkit/branding";
2
+ @import "ood_appkit/markdown";
@@ -0,0 +1,3 @@
1
+ <% OodAppkit.bootstrap.each_pair do |k, v| %>
2
+ $<%= k.to_s.dasherize %>: <%= v %>;
3
+ <% end %>
@@ -0,0 +1,2 @@
1
+ // @import "branding/bootstrap-overrides";
2
+ @import "branding/navbar";
@@ -0,0 +1,66 @@
1
+ .ood-appkit.markdown {
2
+ font-size: 16px;
3
+ line-height: 1.6;
4
+ h1 {
5
+ margin-right: 150px;
6
+ font-size: 30px;
7
+ font-weight: normal;
8
+ line-height: 1.1;
9
+ }
10
+ h2 {
11
+ padding-bottom: 0.3em;
12
+ margin-top: 1em;
13
+ margin-bottom: 16px;
14
+ font-size: 1.75em;
15
+ font-weight: bold;
16
+ line-height: 1.225;
17
+ }
18
+ h3 {
19
+ margin-top: 1em;
20
+ margin-bottom: 16px;
21
+ font-size: 1.5em;
22
+ font-weight: bold;
23
+ line-height: 1.43;
24
+ }
25
+ h4 {
26
+ margin-top: 1em;
27
+ margin-bottom: 16px;
28
+ font-size: 1.25em;
29
+ font-weight: bold;
30
+ line-height: 1.4;
31
+ }
32
+ img {
33
+ border: 0;
34
+ max-width: 100%;
35
+ }
36
+ p {
37
+ margin-top: 0;
38
+ margin-bottom: 16px;
39
+ }
40
+ li > p {
41
+ margin-top: 16px;
42
+ }
43
+ table {
44
+ display: block;
45
+ width: 100%;
46
+ overflow: auto;
47
+ word-break: keep-all;
48
+
49
+ // .markdown p, .markdown table, ...
50
+ margin-top: 0;
51
+ margin-bottom: 16px;
52
+
53
+ tr {
54
+ border-top: 1px solid #ccc;
55
+ }
56
+
57
+ tr:nth-child(2n) td{
58
+ background-color: #f8f8f8;
59
+ }
60
+
61
+ th, td {
62
+ padding: 6px 13px;
63
+ border: 1px solid #ddd;
64
+ }
65
+ }
66
+ }
@@ -0,0 +1,96 @@
1
+ %navbar-brand {
2
+ float: left;
3
+ padding: $navbar-padding-vertical $navbar-padding-horizontal;
4
+ font-size: $font-size-large;
5
+ line-height: $line-height-computed;
6
+ height: $navbar-height;
7
+
8
+ &:hover,
9
+ &:focus {
10
+ text-decoration: none;
11
+ }
12
+
13
+ > img {
14
+ display: block;
15
+ }
16
+
17
+ @media (min-width: $grid-float-breakpoint) {
18
+ .navbar > .container &,
19
+ .navbar > .container-fluid & {
20
+ margin-left: -$navbar-padding-horizontal;
21
+ }
22
+ }
23
+ }
24
+
25
+ .ood-appkit.navbar {
26
+ ul.navbar-breadcrumbs {
27
+ list-style-type: none;
28
+ display: inline;
29
+ margin: 0;
30
+ padding: 0;
31
+
32
+ > li {
33
+ display: inline;
34
+
35
+ > a {
36
+ @extend %navbar-brand;
37
+ }
38
+
39
+ + li:before {
40
+ @extend %navbar-brand;
41
+ padding: $navbar-padding-vertical 0;
42
+ content: '/';
43
+ }
44
+ }
45
+ }
46
+
47
+ &.navbar-default {
48
+ ul.navbar-breadcrumbs > li {
49
+ > a {
50
+ color: $navbar-default-brand-hover-color;
51
+ &:hover,
52
+ &:focus {
53
+ color: $navbar-default-brand-color;
54
+ background-color: $navbar-default-brand-hover-bg;
55
+ }
56
+ }
57
+
58
+ &:last-child > a {
59
+ color: $navbar-default-brand-color;
60
+ &:hover,
61
+ &:focus {
62
+ color: $navbar-default-brand-hover-color;
63
+ }
64
+ }
65
+
66
+ + li:before {
67
+ color: $navbar-default-brand-hover-color;
68
+ }
69
+ }
70
+ }
71
+
72
+ &.navbar-inverse {
73
+ ul.navbar-breadcrumbs > li {
74
+ > a {
75
+ color: $navbar-inverse-brand-hover-color;
76
+ &:hover,
77
+ &:focus {
78
+ color: $navbar-inverse-brand-color;
79
+ background-color: $navbar-inverse-brand-hover-bg;
80
+ }
81
+ }
82
+
83
+ &:last-child > a {
84
+ color: $navbar-inverse-brand-color;
85
+ &:hover,
86
+ &:focus {
87
+ color: $navbar-inverse-brand-hover-color;
88
+ }
89
+ }
90
+
91
+ + li:before {
92
+ color: $navbar-inverse-brand-hover-color;
93
+ }
94
+ }
95
+ }
96
+ }
@@ -0,0 +1,23 @@
1
+ # A concern that can be included into an `ApplicationController` that displays
2
+ # static relative-linked pages.
3
+ module OodAppkit::WikiPage
4
+ extend ActiveSupport::Concern
5
+
6
+ # 'included do' causes the included code to be evaluated in the context where
7
+ # it is included (wiki_controller.rb), rather than being executed in the
8
+ # module's context (wiki_page.rb).
9
+ included do
10
+ # prepend_view_path "docs"
11
+ end
12
+
13
+ # GET /wiki/Home
14
+ # GET /wiki/uploads/project.zip
15
+ def show
16
+ @page = Rails.root.join(params['content_path']).join("#{params['page']}")
17
+
18
+ respond_to do |format|
19
+ format.html
20
+ format.all { send_file "#{@page}.#{params[:format]}", disposition: 'inline' }
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,4 @@
1
+ # A controller for a GitHub style wiki
2
+ class OodAppkit::WikiController < ApplicationController
3
+ include OodAppkit::WikiPage
4
+ end
@@ -0,0 +1,7 @@
1
+ <div class="ood-appkit markdown">
2
+ <div class="row">
3
+ <div class="col-md-8 col-md-offset-2">
4
+ <%= render file: @page %>
5
+ </div>
6
+ </div>
7
+ </div>
data/config/routes.rb ADDED
@@ -0,0 +1,11 @@
1
+ Rails.application.routes.draw do
2
+ # Route for a Rack::Directory middleware app
3
+ if OodAppkit.routes.files_rack_app
4
+ mount OodAppkit::FilesRackApp.new => '/files', as: :files
5
+ end
6
+
7
+ # Route for hosting GitHub style wiki
8
+ if OodAppkit.routes.wiki
9
+ get 'wiki/*page' => 'ood_appkit/wiki#show', as: :wiki, content_path: 'wiki'
10
+ end
11
+ end