From 23d5a9f627de4464f5bb7a02625754e00f6ee08a Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Tue, 2 Apr 2013 02:40:44 -0400 Subject: [PATCH] BOOTSTRAP it --- Gemfile | 4 + Gemfile.lock | 16 ++++ app/assets/javascripts/application.js | 1 + app/assets/javascripts/bootstrap.js.coffee | 4 + .../bootstrap_and_overrides.css.less | 31 ++++++ app/views/layouts/application.html.erb | 95 +++++++++++++++++-- config/locales/en.bootstrap.yml | 17 ++++ 7 files changed, 158 insertions(+), 10 deletions(-) create mode 100644 app/assets/javascripts/bootstrap.js.coffee create mode 100644 app/assets/stylesheets/bootstrap_and_overrides.css.less create mode 100644 config/locales/en.bootstrap.yml diff --git a/Gemfile b/Gemfile index c9c619b..f79ef83 100644 --- a/Gemfile +++ b/Gemfile @@ -20,6 +20,10 @@ group :assets do # gem 'therubyracer', :platforms => :ruby gem 'uglifier', '>= 1.0.3' + + gem 'therubyracer', '~> 0.10.2' + gem "less-rails" #Sprockets (what Rails 3.1 uses for its asset pipeline) supports LESS + gem "twitter-bootstrap-rails" end gem 'jquery-rails' diff --git a/Gemfile.lock b/Gemfile.lock index 8af1630..12dbd36 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -54,6 +54,7 @@ GEM coffee-script-source execjs coffee-script-source (1.6.2) + commonjs (0.2.6) daemons (1.1.9) debug_inspector (0.0.2) erubis (2.7.0) @@ -71,6 +72,12 @@ GEM railties (>= 3.0, < 5.0) thor (>= 0.14, < 2.0) json (1.7.7) + less (2.3.1) + commonjs (~> 0.2.6) + less-rails (2.3.2) + actionpack (>= 3.1) + less (~> 2.3.1) + libv8 (3.3.10.4) mail (2.4.4) i18n (>= 0.4.0) mime-types (~> 1.16) @@ -134,6 +141,8 @@ GEM sqlite3 (1.3.7) temple (0.5.5) terminal-table (1.4.5) + therubyracer (0.10.2) + libv8 (~> 3.3.10) thin (1.5.1) daemons (>= 1.0.9) eventmachine (>= 0.12.6) @@ -143,6 +152,10 @@ GEM treetop (1.4.12) polyglot polyglot (>= 0.3.1) + twitter-bootstrap-rails (2.2.6) + actionpack (>= 3.1) + execjs + railties (>= 3.1) tzinfo (0.3.37) uglifier (1.3.0) execjs (>= 0.3.0) @@ -157,11 +170,14 @@ DEPENDENCIES brakeman coffee-rails (~> 3.2.1) jquery-rails + less-rails meta_request rack-mini-profiler rails (= 3.2.11) rails-footnotes sass-rails (~> 3.2.3) sqlite3 + therubyracer (~> 0.10.2) thin + twitter-bootstrap-rails uglifier (>= 1.0.3) diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 9097d83..5733810 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -12,4 +12,5 @@ // //= require jquery //= require jquery_ujs +//= require twitter/bootstrap //= require_tree . diff --git a/app/assets/javascripts/bootstrap.js.coffee b/app/assets/javascripts/bootstrap.js.coffee new file mode 100644 index 0000000..c9404a8 --- /dev/null +++ b/app/assets/javascripts/bootstrap.js.coffee @@ -0,0 +1,4 @@ +jQuery -> + $("a[rel=popover]").popover() + $(".tooltip").tooltip() + $("a[rel=tooltip]").tooltip() \ No newline at end of file diff --git a/app/assets/stylesheets/bootstrap_and_overrides.css.less b/app/assets/stylesheets/bootstrap_and_overrides.css.less new file mode 100644 index 0000000..53da7a4 --- /dev/null +++ b/app/assets/stylesheets/bootstrap_and_overrides.css.less @@ -0,0 +1,31 @@ +@import "twitter/bootstrap/bootstrap"; +@import "twitter/bootstrap/responsive"; + +// Set the correct sprite paths +@iconSpritePath: asset-path("twitter/bootstrap/glyphicons-halflings.png"); +@iconWhiteSpritePath: asset-path("twitter/bootstrap/glyphicons-halflings-white.png"); + +// Set the Font Awesome (Font Awesome is default. You can disable by commenting below lines) +// Note: If you use asset_path() here, your compiled bootstrap_and_overrides.css will not +// have the proper paths. So for now we use the absolute path. +@fontAwesomeEotPath: asset-path("fontawesome-webfont.eot?v=3.0.2"); +@fontAwesomeEotPath_iefix: asset-path("fontawesome-webfont.eot?#iefix&v=3.0.2"); +@fontAwesomeWoffPath: asset-path("fontawesome-webfont.woff?v=3.0.2"); +@fontAwesomeTtfPath: asset-path("fontawesome-webfont.ttf?v=3.0.2"); + +// Font Awesome +@import "fontawesome"; + +// Glyphicons +//@import "twitter/bootstrap/sprites.less"; + +// Your custom LESS stylesheets goes here +// +// Since bootstrap was imported above you have access to its mixins which +// you may use and inherit here +// +// If you'd like to override bootstrap's own variables, you can do so here as well +// See http://twitter.github.com/bootstrap/customize.html#variables for their names and documentation +// +// Example: +// @linkColor: #ff0000; diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 860c430..2534fa0 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -1,14 +1,89 @@ - - - MsuCourseAlerter - <%= stylesheet_link_tag "application", :media => "all" %> - <%= javascript_include_tag "application" %> - <%= csrf_meta_tags %> - - + + + + + + <%= content_for?(:title) ? yield(:title) : "MsuCourseAlerter" %> + <%= csrf_meta_tags %> -<%= yield %> + + - + <%= stylesheet_link_tag "application", :media => "all" %> + + + + <%= favicon_link_tag 'images/apple-touch-icon-144x144-precomposed.png', :rel => 'apple-touch-icon-precomposed', :type => 'image/png', :sizes => '144x144' %> + + + + <%= favicon_link_tag 'images/apple-touch-icon-114x114-precomposed.png', :rel => 'apple-touch-icon-precomposed', :type => 'image/png', :sizes => '114x114' %> + + + + <%= favicon_link_tag 'images/apple-touch-icon-72x72-precomposed.png', :rel => 'apple-touch-icon-precomposed', :type => 'image/png', :sizes => '72x72' %> + + + + <%= favicon_link_tag 'images/apple-touch-icon-precomposed.png', :rel => 'apple-touch-icon-precomposed', :type => 'image/png' %> + + + + <%= favicon_link_tag 'favicon.ico', :rel => 'shortcut icon' %> + + + + + +
+
+
+ +
+
+ <%= bootstrap_flash %> + <%= yield %> +
+
+ +
+

© Company 2013

+
+ +
+ + + + <%= javascript_include_tag "application" %> + + diff --git a/config/locales/en.bootstrap.yml b/config/locales/en.bootstrap.yml new file mode 100644 index 0000000..271b49c --- /dev/null +++ b/config/locales/en.bootstrap.yml @@ -0,0 +1,17 @@ +# Sample localization file for English. Add more files in this directory for other locales. +# See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points. + +en: + helpers: + actions: "Actions" + links: + back: "Back" + cancel: "Cancel" + confirm: "Are you sure?" + destroy: "Delete" + new: "New" + titles: + edit: "Edit" + save: "Save" + new: "New" + delete: "Delete"