sul_chrome 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.rdoc +8 -0
  4. data/Rakefile +43 -0
  5. data/app/assets/images/bg-nav.png +0 -0
  6. data/app/assets/images/body.png +0 -0
  7. data/app/assets/images/favicon.ico +0 -0
  8. data/app/assets/images/footer-stanford-logo.png +0 -0
  9. data/app/assets/images/sul.png +0 -0
  10. data/app/assets/images/top-container.png +0 -0
  11. data/app/assets/images/wrapper.png +0 -0
  12. data/app/assets/javascripts/sul_chrome/sul_chrome_base.js +1 -0
  13. data/app/assets/stylesheets/sul_chrome/sul_chrome_base.css.scss +151 -0
  14. data/app/assets/stylesheets/sul_chrome/sul_chrome_mixins.css.scss +46 -0
  15. data/app/controllers/sul_chrome/application_controller.rb +5 -0
  16. data/app/helpers/sul_chrome/application_helper.rb +4 -0
  17. data/app/views/layouts/sul_chrome/application.html.erb +49 -0
  18. data/app/views/shared/sul_chrome/_footer_addition.html.erb +0 -0
  19. data/app/views/shared/sul_chrome/_main_container.html.erb +1 -0
  20. data/app/views/shared/sul_chrome/_navigation.html.erb +0 -0
  21. data/app/views/shared/sul_chrome/_utility_links.html.erb +0 -0
  22. data/config/routes.rb +2 -0
  23. data/lib/generators/sul_chrome/sul_chrome_generator.rb +45 -0
  24. data/lib/sul_chrome.rb +5 -0
  25. data/lib/sul_chrome/controller.rb +11 -0
  26. data/lib/sul_chrome/engine.rb +5 -0
  27. data/lib/sul_chrome/version.rb +3 -0
  28. data/lib/tasks/sul_chrome_tasks.rake +4 -0
  29. data/test/dummy/README.rdoc +261 -0
  30. data/test/dummy/Rakefile +7 -0
  31. data/test/dummy/app/assets/javascripts/application.js +15 -0
  32. data/test/dummy/app/assets/stylesheets/application.css +13 -0
  33. data/test/dummy/app/controllers/application_controller.rb +3 -0
  34. data/test/dummy/app/helpers/application_helper.rb +2 -0
  35. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  36. data/test/dummy/config.ru +4 -0
  37. data/test/dummy/config/application.rb +56 -0
  38. data/test/dummy/config/boot.rb +10 -0
  39. data/test/dummy/config/database.yml +25 -0
  40. data/test/dummy/config/environment.rb +5 -0
  41. data/test/dummy/config/environments/development.rb +37 -0
  42. data/test/dummy/config/environments/production.rb +67 -0
  43. data/test/dummy/config/environments/test.rb +37 -0
  44. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  45. data/test/dummy/config/initializers/inflections.rb +15 -0
  46. data/test/dummy/config/initializers/mime_types.rb +5 -0
  47. data/test/dummy/config/initializers/secret_token.rb +7 -0
  48. data/test/dummy/config/initializers/session_store.rb +8 -0
  49. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  50. data/test/dummy/config/locales/en.yml +5 -0
  51. data/test/dummy/config/routes.rb +4 -0
  52. data/test/dummy/public/404.html +26 -0
  53. data/test/dummy/public/422.html +26 -0
  54. data/test/dummy/public/500.html +25 -0
  55. data/test/dummy/public/favicon.ico +0 -0
  56. data/test/dummy/script/rails +6 -0
  57. data/test/integration/navigation_test.rb +10 -0
  58. data/test/sul_chrome_test.rb +7 -0
  59. data/test/test_helper.rb +15 -0
  60. metadata +192 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 9df88f364e56ba6aaaf6bca20bd6e2cfdb3cb089
4
+ data.tar.gz: 9f5ff80f7c986c4e0ca6f9c24a6da6aedd160a53
5
+ SHA512:
6
+ metadata.gz: 49457245b28fb5dd89f1e238f34b921bd1a3fc7475dc93ad71e9845f006006362da09772be7e24321286c4edf7c1f3d5e07d20c7db037c40741ca27f48f3b430
7
+ data.tar.gz: 1ecca075f41730ca8a24656f2f288f9a08ee91da90c98e889d69b81eb2660769a6b4e3d5ae24165d94fe001096390121eefa3a11d30cf983e7fd8e9107bf0257
@@ -0,0 +1,20 @@
1
+ Copyright 2012 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.
@@ -0,0 +1,8 @@
1
+ = SULChrome
2
+
3
+ The SUL Chrome gem provides some basic styles for a rails app under the Stanford University Libraries visual design.
4
+
5
+ The mixins that are defined by by the SUL Chrome gem are abstracted out into their own file, which is then included into the base_css. You can use the mixins provided by importing the mixins file into your css:
6
+ @import "sul_chrome/sul_chrome_mixins";
7
+
8
+ This project rocks and uses MIT-LICENSE.
@@ -0,0 +1,43 @@
1
+ #!/usr/bin/env rake
2
+ begin
3
+ require 'bundler/setup'
4
+ rescue LoadError
5
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
+ end
7
+ begin
8
+ require 'rdoc/task'
9
+ rescue LoadError
10
+ require 'rdoc/rdoc'
11
+ require 'rake/rdoctask'
12
+ RDoc::Task = Rake::RDocTask
13
+ end
14
+
15
+ require 'dlss/rake/dlss_release'
16
+ Dlss::Release.new
17
+
18
+ RDoc::Task.new(:rdoc) do |rdoc|
19
+ rdoc.rdoc_dir = 'rdoc'
20
+ rdoc.title = 'SulChrome'
21
+ rdoc.options << '--line-numbers'
22
+ rdoc.rdoc_files.include('README.rdoc')
23
+ rdoc.rdoc_files.include('lib/**/*.rb')
24
+ end
25
+
26
+ APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
27
+ load 'rails/tasks/engine.rake'
28
+
29
+
30
+
31
+ Bundler::GemHelper.install_tasks
32
+
33
+ require 'rake/testtask'
34
+
35
+ Rake::TestTask.new(:test) do |t|
36
+ t.libs << 'lib'
37
+ t.libs << 'test'
38
+ t.pattern = 'test/**/*_test.rb'
39
+ t.verbose = false
40
+ end
41
+
42
+
43
+ task :default => :test
Binary file
@@ -0,0 +1 @@
1
+ // nothing here yet
@@ -0,0 +1,151 @@
1
+ $baseFontSize: 13px;
2
+ $baseLineHeight: 18px;
3
+
4
+ @import 'bootstrap';
5
+ @import 'bootstrap/responsive';
6
+
7
+ @import "sul_chrome/sul_chrome_mixins";
8
+
9
+ body {
10
+ background: url("/assets/body.png") repeat scroll 0 0 transparent;
11
+ font-family: Lucida Grande,Verdana,Arial,sans-serif;
12
+ line-height: 1.5em;
13
+ }
14
+ a {
15
+ color: #575246;
16
+ text-decoration: none;
17
+ border-bottom: 1px dotted #84785A;
18
+ }
19
+ a:hover, a:active {
20
+ color: #6D1308;
21
+ border-bottom: 1px dotted #6D1308;
22
+ text-decoration: none;
23
+ }
24
+ a.img-link {
25
+ border-bottom: none;
26
+ }
27
+ /* need to reset the bottom border on links styled as buttons */
28
+ a:hover.btn {
29
+ border-bottom:1px solid #CCCCCC;
30
+ }
31
+ .btn-primary {
32
+ background-color: #990000;
33
+ }
34
+ #sul-wrapper {
35
+ background: url("/assets/wrapper.png") repeat-x scroll 0 0 transparent;
36
+ text-align: center;
37
+ padding-top: 15px;
38
+ }
39
+
40
+ #container {
41
+ background: url("/assets/top-container.png") repeat-x scroll 0 0 #FFFFFF;
42
+ border-radius: 3px 3px 3px 3px;
43
+ border-top: 1px solid #FFFFFF;
44
+ margin: 0 auto;
45
+ padding: 10px 40px 40px;
46
+ // width: 960px;
47
+ text-align: left;
48
+ background-color: #FFFFFF;
49
+ }
50
+ #header {
51
+ margin-bottom: 12px;
52
+ #branding {
53
+ @media (max-width: 767px) {
54
+ text-align:center;
55
+ }
56
+ }
57
+ #utility-links {
58
+ text-align: right;
59
+ @media (max-width: 767px) {
60
+ text-align:center;
61
+ }
62
+ }
63
+ }
64
+ #links {
65
+ float: right;
66
+ }
67
+ #header #links span {
68
+ color: #999999;
69
+ }
70
+
71
+ footer {
72
+ font-size: 90%;
73
+ text-align: center;
74
+ padding: 25px 0;
75
+ }
76
+ footer img.footer-logo {
77
+ padding-bottom: 15px;
78
+ vertical-align: top;
79
+ }
80
+ footer a {
81
+ border-bottom: none;
82
+ color:#575347;
83
+ margin-right: 10px;
84
+ }
85
+ footer #footer-links {
86
+ display: inline-block;
87
+ font-style: italic;
88
+ line-height: 1.5em;
89
+ margin-left: 20px;
90
+ text-align: left;
91
+ }
92
+ footer #footer-links a:hover{
93
+ border-bottom: none;
94
+ }
95
+
96
+ /* main navigation with CSS ribbon */
97
+ $ribbon-offset-horizontal: 14px; // width of ribbon past main container
98
+ $ribbon-offset-vertical: 8px; // height of shadow
99
+ #navigation-ribbon {
100
+ @include border-top-radius(3px);
101
+ padding: 0 5px 0 54px;
102
+ position: relative;
103
+ margin: 0 -54px 30px -54px;
104
+ text-shadow: 0 1px rgba(0,0,0,.8);
105
+ background: #651006;
106
+ background: url("/assets/bg-nav.png") repeat-x;
107
+ @include box-shadow(rgba(0,0,0,.3) 0 1px 0);
108
+ &:before, &:after { // ribbon edge styling
109
+ content: '';
110
+ position: absolute;
111
+ border-style: solid;
112
+ border-color: transparent;
113
+ bottom: -$ribbon-offset-vertical;
114
+ }
115
+ &:before {
116
+ border-width: 0 $ribbon-offset-horizontal $ribbon-offset-vertical 0;
117
+ border-right-color: #222;
118
+ left: 0;
119
+ }
120
+ &:after {
121
+ border-width: 0 0 $ribbon-offset-vertical $ribbon-offset-horizontal;
122
+ border-left-color: #222;
123
+ right: 0;
124
+ }
125
+ .navbar-inner {
126
+ background: none;
127
+ border-radius: 0;
128
+ min-height: 35px;
129
+ padding: 0;
130
+ .container {
131
+ height: 35px;
132
+ .nav {
133
+ float: left; // nav menu alignment
134
+ margin-right: 25px;
135
+ li {
136
+ margin-right: 5px;
137
+ }
138
+ a {
139
+ background-color: inherit;
140
+ border-bottom: none;
141
+ color: #FFF;
142
+ padding: 9px 18px 8px 0;
143
+ text-decoration: none;
144
+ }
145
+ a:hover, .active > a {
146
+ color: #CCC;
147
+ }
148
+ }
149
+ }
150
+ }
151
+ }
@@ -0,0 +1,46 @@
1
+ @mixin primary-button {
2
+ background-color: #9D3225;
3
+ *background-color: #9D3225;
4
+ background-image: -ms-linear-gradient(top, #ee5f5b, #bd362f);
5
+ background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#9D3225), to(#7C1306));
6
+ background-image: -webkit-linear-gradient(top, #9D3225, #7C1306);
7
+ background-image: -o-linear-gradient(top, #ee5f5b, #bd362f);
8
+ background-image: -moz-linear-gradient(top, #ee5f5b, #bd362f);
9
+ background-image: linear-gradient(top, #9D3225, #7C1306);
10
+ background-repeat: repeat-x;
11
+ border-color: #bd362f #bd362f #802420;
12
+ border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
13
+ filter: progid:dximagetransform.microsoft.gradient(startColorstr='#ee5f5b', endColorstr='#bd362f', GradientType=0);
14
+ filter: progid:dximagetransform.microsoft.gradient(enabled=false);
15
+ color: #FFFFFF;
16
+
17
+ &:hover,
18
+ &:active,
19
+ &.active,
20
+ &.disabled,
21
+ &[disabled] {
22
+ background-color: #9D3225;
23
+ *background-color: #9D3225;
24
+ background: -webkit-gradient(linear, left top, left bottom, from(#9D3225), to(#510E06));
25
+ background: -moz-linear-gradient(center top , #9D3225, #510E06) repeat scroll 0 0 transparent;
26
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#9D3225', endColorstr='#510E06',GradientType=0 );
27
+ color: #FFFFFF;
28
+ }
29
+ &:active
30
+ &.active {
31
+ background-color: #9D3225 \9;
32
+ }
33
+ }
34
+
35
+ @mixin striped-table {
36
+ thead {
37
+ background-color: #DDDDDD;
38
+ border-top: 1px solid #CCCCCC;
39
+ }
40
+ tr.odd {
41
+ border-bottom: 1px solid #CCCCCC;
42
+ }
43
+ tr.even {
44
+ border-bottom: 1px solid #DDDDDD;
45
+ }
46
+ }
@@ -0,0 +1,5 @@
1
+ module SulChrome
2
+ class ApplicationController < ActionController::Base
3
+
4
+ end
5
+ end
@@ -0,0 +1,4 @@
1
+ module SulChrome
2
+ module ApplicationHelper
3
+ end
4
+ end
@@ -0,0 +1,49 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en" class="no-js">
3
+ <head>
4
+ <title><%= h(@page_title || "") %></title>
5
+ <link rel="shortcut icon" href="/assets/favicon.ico" type="image/x-icon" />
6
+ <%= stylesheet_link_tag "application", :media => "all" %>
7
+ <%= javascript_include_tag "application" %>
8
+ <%= csrf_meta_tags %>
9
+ <%= raw(render_head_content) if defined?(Blacklight) %>
10
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
11
+ </head>
12
+ <body id="<%= "#{params[:controller]}-#{params[:action]}" %>">
13
+ <div id="wrapper">
14
+ <div id="sul-wrapper">
15
+ <div id="container" class="container">
16
+ <header id="header">
17
+ <div class="row">
18
+ <div class="span6" id="branding">
19
+ <%= link_to(image_tag("sul.png"), "http://library.stanford.edu", :class=>"img-link") %>
20
+ </div>
21
+ <div class="span6" id="utility-links">
22
+ <%= render :partial => "shared/sul_chrome/utility_links" -%>
23
+ </div>
24
+ </div>
25
+ </header>
26
+ <%- navigation = render :partial => "shared/sul_chrome/navigation" -%>
27
+ <%- unless navigation.blank? -%>
28
+ <nav id="navigation-ribbon" class="navbar">
29
+ <div class="navbar-inner">
30
+ <div class="container">
31
+ <%= navigation %>
32
+ </div>
33
+ </div>
34
+ </nav>
35
+ <%- end -%>
36
+ <%= render :partial => "shared/sul_chrome/main_container" %>
37
+ </div>
38
+ </div>
39
+ <footer>
40
+ <%= image_tag("footer-stanford-logo.png", :class => "hidden-phone footer-logo") %>
41
+ <div id="footer-links">
42
+ <%= link_to("Stanford University Home", "http://www.stanford.edu") %> <%= link_to("Maps & Directions", "http://visit.stanford.edu/plan/maps.html") %> <%= link_to("Search Stanford", "http://www.stanford.edu/search/") %> <%= link_to("Terms of Use", "http://www.stanford.edu/site/terms.html") %> <%= link_to("Copyright Complaints", "http://www.stanford.edu/site/copyright.html") %><br/>
43
+ <span>&copy; Stanford University, Stanford, California 94305. (650) 723-2300</span>
44
+ </div>
45
+ <%= render "shared/sul_chrome/footer_addition" %>
46
+ </footer>
47
+ </div>
48
+ </body>
49
+ </html>
@@ -0,0 +1,2 @@
1
+ SulChrome::Engine.routes.draw do
2
+ end
@@ -0,0 +1,45 @@
1
+ # -*- encoding : utf-8 -*-
2
+ require 'rails/generators'
3
+ require 'rails/generators/migration'
4
+ class SulChromeGenerator < Rails::Generators::Base
5
+
6
+ #source_root File.expand_path('../templates', __FILE__)
7
+
8
+
9
+ desc """
10
+ This generator makes the following changes to your application:
11
+ 1. Adds Controller behavior to the application level ApplicationController.
12
+ 2. Adds a line in your application.css and application.js to load the SUL Chrome assets.
13
+ 3. Adds necessary lines into the application level Gemfile.
14
+ """
15
+
16
+ # Add SulChrome to the application controller.
17
+ def inject_sul_chrome_controller_behavior
18
+ unless IO.read("app/controllers/application_controller.rb").include?("SulChrome::Controller")
19
+ inject_into_class "app/controllers/application_controller.rb", "ApplicationController" do
20
+ " # Adds a few additional behaviors into the application controller\n" +
21
+ " include SulChrome::Controller\n\n"
22
+ end
23
+ end
24
+ end
25
+
26
+ # insert require statements into application level CSS/JS manifestes.
27
+ def assets
28
+ unless IO.read("app/assets/stylesheets/application.css").include?("Required by SULChrome")
29
+ insert_into_file "app/assets/stylesheets/application.css", :after => "/*" do
30
+ %q{
31
+ * Required by SULChrome:
32
+ *= require sul_chrome/sul_chrome_base
33
+ *}
34
+ end
35
+ end
36
+ unless IO.read("app/assets/javascripts/application.js").include?("Required by SULChrome")
37
+ insert_into_file "app/assets/javascripts/application.js", :before => "//= require_tree ." do
38
+ %q{// Required by SULChrome:
39
+ //= require sul_chrome/sul_chrome_base
40
+ }
41
+ end
42
+ end
43
+ end
44
+
45
+ end
@@ -0,0 +1,5 @@
1
+ require "sul_chrome/engine"
2
+
3
+ module SulChrome
4
+ autoload :Controller, "sul_chrome/controller"
5
+ end
@@ -0,0 +1,11 @@
1
+ module SulChrome::Controller
2
+ def self.included(base)
3
+ base.send :layout, :which_layout
4
+ end
5
+
6
+ protected
7
+
8
+ def which_layout
9
+ "sul_chrome/application"
10
+ end
11
+ end
@@ -0,0 +1,5 @@
1
+ module SulChrome
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace SulChrome
4
+ end
5
+ end