Leiden top Amsterdam CS moving towards twitter bootstrap

This commit is contained in:
2012-11-23 18:02:58 +01:00
parent 7ea8b7b0df
commit bb8efcb616
15 changed files with 368 additions and 1444 deletions
+11 -7
View File
@@ -5,8 +5,14 @@ source "http://rubygems.org"
# development dependencies will be added by default to the :development group.
gemspec
# jquery-rails is used by the dummy application
gem "jquery-rails"
group :assets do
gem 'sass-rails'
#gem 'bourbon'
gem 'coffee-script'
gem 'therubyracer', :platforms => :ruby
gem 'less-rails'
gem 'twitter-bootstrap-rails'
end
gem 'couch_potato' , :git => 'git://github.com/bterkuile/couch_potato.git'
gem 'simply_stored' , :git => 'git://github.com/bterkuile/simply_stored.git'
@@ -14,18 +20,16 @@ gem 'devise', '2.0.4'
gem 'devise_simply_stored'
gem 'tinymce-rails'
gem 'haml-rails'
gem 'slim-rails'
gem 'paperclip'
gem 'email_validator'
group :assets do
gem 'sass-rails'
gem 'bourbon'
gem 'coffee-script'
end
# Declare any dependencies that are still in development here instead of in
# your gemspec. These might include edge Rails or gems from your path or
# Git. Remember to move these dependencies to your gemspec before releasing
# your gem to rubygems.org.
# jquery-rails is used by the dummy application
gem "jquery-rails"
# To use debugger
group :test do
gem 'steak'
+26 -1
View File
@@ -83,6 +83,7 @@ GEM
coffee-script-source
execjs
coffee-script-source (1.4.0)
commonjs (0.2.6)
couchrest (1.1.3)
mime-types (~> 1.15)
multi_json (~> 1.0)
@@ -121,6 +122,12 @@ GEM
railties (>= 3.1.0, < 5.0)
thor (~> 0.14)
json (1.6.7)
less (2.2.2)
commonjs (~> 0.2.6)
less-rails (2.2.6)
actionpack (>= 3.1)
less (~> 2.2.0)
libv8 (3.3.10.4)
libwebsocket (0.1.6.1)
websocket
mail (2.4.4)
@@ -192,6 +199,14 @@ GEM
libwebsocket (~> 0.1.3)
multi_json (~> 1.0)
rubyzip
slim (1.3.4)
temple (~> 0.5.5)
tilt (~> 1.3.3)
slim-rails (1.0.3)
actionpack (~> 3.0)
activesupport (~> 3.0)
railties (~> 3.0)
slim (~> 1.0)
slop (3.3.3)
sprockets (2.2.1)
hike (~> 1.2)
@@ -201,6 +216,9 @@ GEM
steak (2.0.0)
capybara (>= 1.0.0)
rspec-rails (>= 2.5.0)
temple (0.5.5)
therubyracer (0.10.2)
libv8 (~> 3.3.10)
thin (1.5.0)
daemons (>= 1.0.9)
eventmachine (>= 0.12.6)
@@ -212,6 +230,10 @@ GEM
treetop (1.4.12)
polyglot
polyglot (>= 0.3.1)
twitter-bootstrap-rails (2.1.6)
actionpack (>= 3.1)
execjs
railties (>= 3.1)
tzinfo (0.3.35)
warden (1.1.1)
rack (>= 1.0)
@@ -223,7 +245,6 @@ PLATFORMS
ruby
DEPENDENCIES
bourbon
cmtool!
coffee-script
couch_potato!
@@ -233,10 +254,14 @@ DEPENDENCIES
factory_girl_rails
haml-rails
jquery-rails
less-rails
paperclip
pry
sass-rails
simply_stored!
slim-rails
steak
therubyracer
thin
tinymce-rails
twitter-bootstrap-rails
@@ -13,5 +13,6 @@
//= require jquery
//= require jquery_ujs
//= require jquery-ui
//= require twitter/bootstrap
//= require tinymce-jquery
//= require_directory .
File diff suppressed because it is too large Load Diff
@@ -9,5 +9,6 @@
* compiled file, but it's generally better to create a new file per style scope.
*
*= require_self
*= require 'bootstrap-devise-rails'
*= require_directory .
*/
@@ -0,0 +1,32 @@
@import "twitter/bootstrap/bootstrap";
body { padding-top: 60px; }
@import "twitter/bootstrap/responsive";
// Set the correct sprite paths
@iconSpritePath: asset-path("twitter/bootstrap/glyphicons-halflings");
@iconWhiteSpritePath: asset-path("twitter/bootstrap/glyphicons-halflings-white");
// Set the Font Awesome (Font Awesome is default. You can disable by commenting below lines)
// Note: If you use asset_path() here, your compiled boostrap_and_overrides.css will not
// have the proper paths. So for now we use the absolute path.
@fontAwesomeEotPath: asset-path("fontawesome-webfont.eot");
@fontAwesomeWoffPath: asset-path("fontawesome-webfont.woff");
@fontAwesomeTtfPath: asset-path("fontawesome-webfont.ttf");
@fontAwesomeSvgPath: asset-path("fontawesome-webfont.svg");
// 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;
@@ -1,7 +1,5 @@
@import jquery-ui
#errorExplanation
background-color: #faa
border: 2px solid #800
padding: 8px
@extend .ui-state-error
+26
View File
@@ -1,9 +1,35 @@
module Cmtool
module ApplicationHelper
# Return the title of the application
def application_title
'Cmtool'
end
# Standard return content when empty listing is found
# called with the model as argument
# = no_content_given Album
def no_content_given(model)
t('helpers.no_content_given', models: model.model_name.human_plural)
end
# overwrite i18n l, to handle nil values
def l(*args)
return '' unless args.first
super(*args)
end
def site_title
'Cmtool'
end
# Set the page title, allow setting a resource title like:
# - title :index, Album
# or
# - title :show, Album
# or normal text behaviour:
# - title "Home"
def title(*args)
content_for :title do
if args.first.is_a?(Symbol) && (args[1].respond_to?(:model_name) || args[1].class.respond_to?(:model_name))
+1 -1
View File
@@ -1,5 +1,5 @@
- title :index, Page
%table.index-table
%table.index-table.table.table-striped
%thead
%tr
%th= Page.human_attribute_name(:name)
@@ -0,0 +1,83 @@
doctype html
html lang="en"
head
title= content_for?(:title) ? yield(:title) : application_title
meta charset="utf-8"
meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1"
meta name="viewport" content="width=device-width, initial-scale=1.0"
link href="/favicon.ico" rel="shortcut icon"
= csrf_meta_tags
javascript:
var tinymce_language = '#{I18n.locale}';
/! Le HTML5 shim, for IE6-8 support of HTML elements
/[if lt IE 9]
= javascript_include_tag "http://html5shim.googlecode.com/svn/trunk/html5.js"
= stylesheet_link_tag "cmtool/application", :media => "all"
= javascript_include_tag "cmtool/application"
= yield(:head)
javascript:
$(function(){
//Onload
#{yield(:onload_javascript)}
});
body
.navbar.navbar-fixed-top
.navbar-inner
.container
a.btn.btn-navbar data-target=".nav-collapse" data-toggle="collapse"
span.icon-bar
span.icon-bar
span.icon-bar
a.brand href=root_path = application_title
.container.nav-collapse
- if user_signed_in?
ul.nav
li[ class=(controller_name == 'pages' ? 'ui-state-active' : 'ui-state-default') ]=link_to Page.model_name.human_plural, cmtool.pages_path
li[ class=(controller_name == 'news' ? 'ui-state-active' : 'ui-state-default') ]=link_to Cmtool::News.model_name.human_plural, cmtool.news_index_path
li[ class=(controller_name == 'keywords' ? 'ui-state-active' : 'ui-state-default') ]=link_to Cmtool::Keyword.model_name.human_plural, cmtool.keywords_path
li[ class=(controller_name == 'faqs' ? 'ui-state-active' : 'ui-state-default') ]=link_to Cmtool::Faq.model_name.human_plural, cmtool.faqs_path
li[ class=(controller_name == 'quotes' ? 'ui-state-active' : 'ui-state-default') ]=link_to Cmtool::Quote.model_name.human_plural, cmtool.quotes_path
li[ class=(%w[contact_forms demo_requests call_requests newsletter_subscriptions].include?(controller_name) ? ['ui-state-active', 'parent'] : ['ui-state-default', 'parent']) ]
span.title= t('cmtool.menu.forms.title')
ul.child-menu
li[ class=(controller_name == 'contact_forms' ? 'ui-state-active' : 'ui-state-default') ]=link_to Cmtool::ContactForm.model_name.human_plural, cmtool.contact_forms_path
li[ class=(controller_name == 'newsletter_subscriptions' ? 'ui-state-active' : 'ui-state-default') ]=link_to Cmtool::NewsletterSubscription.model_name.human_plural, cmtool.newsletter_subscriptions_path
li[ class=(controller_name == 'users' ? 'ui-state-active' : 'ui-state-default') ]=link_to User.model_name.human_plural, cmtool.users_path
li[ class=(controller_name == 'images' ? 'ui-state-active' : 'ui-state-default') ]=link_to Cmtool::Image.model_name.human_plural, cmtool.images_path
li[ class=(controller_name == 'directories' ? 'ui-state-active' : 'ui-state-default') ]=link_to Cmtool::Directory.model_name.human_plural, cmtool.directories_path
.btn-group.pull-right
a.btn.dropdown-toggle[data-toggle="dropdown" href="#"]
i.icon-user
= current_user.email
span.caret
ul.dropdown-menu
li.log-out= link_to t('helpers.links.logout'), destroy_user_session_path
.container
.content
- if flash[:alert].present?
.alert.alert-error
a.close data-dismiss="alert" &#215;
div= flash[:alert]
- if flash[:notice].present?
.alert.alert-success
a.close data-dismiss="alert" &#215;
div= flash[:notice]
.row
.span9
= content_for?(:content) ? yield(:content) : yield
.span3
.well.sidebar-nav
h3= content_for?(:page_title) ? yield(:page_title) : application_title
ul.nav.nav-list
li.nav-header Links
li= link_to "Home", root_path
= yield :sidebar
footer
p &copy; KPN 2012
= yield :footer
#hidden-html.hide= yield :hidden_html
@@ -0,0 +1,3 @@
- content_for :content do
.devise= yield
= render :template => 'layouts/application'
+51
View File
@@ -0,0 +1,51 @@
// require 'twitter/bootstrap/bootstrap'
@import "twitter/bootstrap/variables";
@import "twitter/bootstrap/mixins";
@import "twitter/bootstrap/alerts";
@import "twitter/bootstrap/buttons";
@import "twitter/bootstrap/forms";
.devise {
br { display:none; }
// Copied from forms.less's legend
> h2, > h3 {
display: block;
width: 100%;
padding: 0;
margin-bottom: @baseLineHeight * 1.5;
font-size: @baseFontSize * 1.5;
line-height: @baseLineHeight * 2;
color: @grayDark;
border: 0;
border-bottom: 1px solid #eee;
}
> h2, >h3 {
margin-bottom: @baseLineHeight;
}
form {
// Base form styles
margin:0;
label[for=user_remember_me] { display: inline; }
input[type=submit] {
.btn-primary;
.btn-large;
margin:6px 0;
}
i { display: block; }
// Errors
#error_explanation {
h2 {
line-height: @baseLineHeight;
font-size: 14px;
.alert-error;
}
ul { margin-bottom: 0; }
.alert;
.alert-error;
}
.field_with_errors {
.control-group .error;
}
}
a:last-of-type:after { content: ''; }
a:after { content: '\0020\007c'; }
}
+119
View File
@@ -0,0 +1,119 @@
$baseline: 14px
$gray: #666
$wellBackground: #f5f5f5
$baseBorderRadius: 4px
$grayDark: #333
$baseLineHeight: 20px
@mixin transition($transitions...)
transition: $transitions
@mixin box-shadow($shadows...)
box-shadow: $shadows
@mixin border-radius($str)
border-radius: $str
@mixin opacity($str)
opacity: $str
@mixin well
min-height: 20px
padding: 19px
margin-bottom: 20px
background-color: $wellBackground
border: 1px solid darken($wellBackground, 7%)
+border-radius($baseBorderRadius)
+box-shadow(inset 0 1px 1px rgba(0,0,0,.05))
blockquote
border-color: #ddd
border-color: rgba(0,0,0,.15)
@mixin close
float: right
font-size: 20px
font-weight: bold
line-height: $baseLineHeight
color: black
text-shadow: 0 1px 0 rgba(255,255,255,1)
+opacity(.20)
&:hover
color: black
text-decoration: none
cursor: pointer
+opacity(.40)
.devise
form
// This is all copy/pasted. I can't get element-based rulesets to work
input[type=email]
display: inline-block
width: 210px
margin: 0
padding: 4px
font-size: 13px
line-height: $baseline
height: $baseline
color: $gray
border: 1px solid #ccc
+border-radius(3px)
// Focus states
input[type=email]
+transition(border linear .2s, box-shadow linear .2s)
+box-shadow(inset 0 1px 3px rgba(0,0,0,.1))
&:focus
outline: none
border-color: rgba(82,168,236,.8)
+box-shadow(inset 0 1px 3px rgba(0,0,0,.1), 0 0 8px rgba(82,168,236,.6))
margin-top: 20px
//.columns(7)
//.offset(4)
//.well
+well
h2
margin-left: 150px
margin-bottom: 15px
font-size: 20px
font-weight: normal
color: $grayDark
form
div
margin-bottom: baseline
a
margin: 0
&:after
content: '\0000a0'
&:before
content: none
br, i
display: none
input
margin-left: 20px
//* Oh, dear... *
label[for=user_remember_me]
padding: 0
position: relative
left: 130px
input[type=submit]
margin-left: 150px
//+btn
//+primary
a, h3, p
margin-left: 150px
p
a
margin: 0
&:before
content: none
a:before, p:before
content: '\002022\0000a0'
#error_explanation
//.alert-message.error
//.block-message
margin-left: 150px
text-shadow: none
h2
font-size: 13px
line-height: 18px
font-weight: bold
margin: 0 0 6px 0
h2, li
color: white
a
+close
//.alert-message.close
+14
View File
@@ -0,0 +1,14 @@
$ ->
$('.close').live 'click', (e) ->
e.preventDefault()
$(this).parent().hide()
$('.devise form div i').each ->
$this = $(this)
text = $this.text()
sibling = $this.prev('label')
a = $("<a>").text("*").attr('title', text)
a.prependTo(sibling)
devise_errors = $('.devise #error_explanation')
if devise_errors.length
close_link = $('<a>').addClass('close').attr('href', '#').text('\u00d7')
devise_errors.prepend(close_link)