Permalink
Browse files

added some helper functions for adding javascripts, webfonts and styl…

…esheets globally or per page
  • Loading branch information...
1 parent 8118274 commit 40823bbc661f3905ef043c660c52c4c506f21113 @daz4126 committed Mar 4, 2012
View
BIN .sass-cache/71559642e0c4a15b113d2ed01655104a7a0a34ba/main.rbc
Binary file not shown.
View
BIN .sass-cache/ef2c5f486331413205371f5527ea96357a786bfb/_mixins.scssc
Binary file not shown.
View
BIN .sass-cache/ef2c5f486331413205371f5527ea96357a786bfb/responsive.scssc
Binary file not shown.
View
BIN .sass-cache/ef2c5f486331413205371f5527ea96357a786bfb/settings.scssc
Binary file not shown.
View
BIN .sass-cache/ef2c5f486331413205371f5527ea96357a786bfb/styles.scssc
Binary file not shown.
View
50 main.rb
@@ -4,19 +4,43 @@
########### configuration & settings ###########
configure do
- set :name, ENV['name'] || 'DAZ4126'
- set :author, ENV['author'] || 'DAZ'
+ set :name, ENV['NAME'] || 'DAZ4126'
+ set :author, ENV['AUTHOR'] || 'DAZ'
set :analytics, ENV['ANALYTICS'] || 'UA-XXXXXXXX-X'
- set :javascripts, %w[ ]
+ set :javascripts, %w[ http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js ]
+ set :styles, %w[ main ]
set :fonts, %w[ Abel ]
set :markdown, :layout_engine => :slim
end
+helpers do
+ def javascripts
+ javascripts = ""
+ (@javascripts?settings.javascripts+@javascripts:settings.javascripts).uniq.each do |script|
+ javascripts << "<script src=\"#{script}\"></script>"
+ end
+ javascripts
+ end
+
+ def styles
+ styles = ""
+ (@styles?settings.styles+@styles:settings.styles).uniq.each do |style|
+ styles << "<link href=\"/#{style}.css\" media=\"screen, projection\" rel=\"stylesheet\" />"
+ end
+ styles
+ end
+
+ def webfonts
+ "<link href=\"http://fonts.googleapis.com/css?family=#{(@fonts?settings.fonts+@fonts:settings.fonts).uniq.*'|'}\" rel=\"stylesheet\" />"
+ end
+
+end
+
########### Routes ###########
not_found { slim :'404' }
error { slim :'500' }
-get('/styles.css'){ scss :styles }
+get('/main.css'){ scss :styles }
get('/application.js') { coffee :script }
# home page
@@ -34,7 +58,7 @@
post '/' do
require 'pony'
Pony.mail(
- from: "DAZ4126<daz4126@gmail.com>",
+ from: params[:name] + "<" + params[:email] + ">",
to: 'daz4126@gmail.com',
subject: "A message from the DAZ4126 website",
body: params[:message],
@@ -67,15 +91,9 @@
@@index
h1 title='Traditional Mancunian Greeting' Alright Mate!
-
-p Welcome to my website! My name is DAZ and I work, rest and play in Manchester,UK.
-
-p I enjoy building websites that are simple, but brilliant.
-
-p I also like water polo, maths and burgers.
-
+p Welcome to my website!
+P My name is DAZ and I work, rest and play in Manchester,UK. I build websites, play water polo and eat burgers.
p Thanks for visiting. Have a nice day!
-
== slim :contact
@@about
@@ -101,6 +119,10 @@
#contact
h2 Contact Me
form action='/' method='post'
+ label for='name' Name:
+ input type='text' name='name'
+ label for='email' Email:
+ input type='text' name='email'
label for='message' Write me a short message below
textarea rows='12' cols='40' name='message'
input#send.button type='submit' value='Send'
@@ -111,7 +133,7 @@
@@500
h1 500 Error!
-p Something has gone wrong!
+p Oops, something has gone terribly wrong!
@@script
alert 'Coffeescript is working!'
View
2 views/_mixins.scss
@@ -39,7 +39,7 @@
margin: 0 0 0.2em;
}
-@mixin links($color:white,$hovercolor:red,$background:$color){
+@mixin links($color:$text,$hovercolor:$yellow,$background:$color){
a,a:link,a:visited{
text-decoration: underline;
text-shadow: none;
View
8 views/layout.slim
@@ -7,12 +7,12 @@ html
meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0"
title= @title || settings.name || "Untitled"
link rel="shortcut icon" href="/favicon.ico"
- - (@javascripts?settings.javascripts+@javascripts:settings.javascripts).uniq.each do |link|
- script src==link
+
/[if lt IE 9]
script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"
- link href="http://fonts.googleapis.com/css?family=#{(@fonts?settings.fonts+@fonts:settings.fonts).uniq.*'|'}" rel='stylesheet'
- link rel="stylesheet" media="screen, projection" href="/styles.css"
+ == webfonts
+ == javascripts
+ == styles
body
header role="banner"
hgroup
View
12 views/responsive.scss
@@ -1,19 +1,19 @@
// Landscape phones and down
@media screen and (max-width: 480px) {
#main{
- .content,.sidebar{width:100%;float:none;}
- h1{font-size:2.6em;}
- h2{font-size:2em;}
+ .content,.sidebar{width:auto;float:none;}
+ .sidebar,#contact{margin-top: 20px;}
+ h1{font-size:2.2em;}
+ h2{font-size:1.8em;}
p,li{font-size:1.1em;}
form label{font-size:1.1em;}
form textarea{width:90%;}
}
#banner{
- padding:20px 2px;
- blockquote{font-size: 2em;}
+ padding:10px 2px;
+ blockquote{font-size: 1.6em;}
cite{font-size: 1.1em;}
}
- .sidebar,#contact{margin-top: 40px;}
}
// Landscape phone to portrait tablet
View
4 views/settings.scss
@@ -19,6 +19,10 @@ $purple:#7A6577;
$black:#444;
$white:#ececec;
+$brightyellow:#F1DC3A;
+$brightorange:#F6A523;
+$brightblack:#222;
+
$border:$white;
$text:$black;
$html:$olive;
View
8 views/styles.scss
@@ -83,7 +83,7 @@ header{
#main{
@include clearfix;
- padding: 20px 5%;
+ padding: 20px;
background:$main;
border-bottom: $thickness solid $border;
@include links($black,$black,$yellow);
@@ -105,8 +105,7 @@ header{
p{font-size: 1.1em;}
}
p{
- max-width:26em;
- text-shadow: 1px 1px 0 rgba($white,0.3);
+ text-shadow: 1px 1px 0 rgba($white,0.2);
}
form{
width:100%;
@@ -122,7 +121,8 @@ header{
font-family:$normalfont;
background: transparent;
display: block;
- padding: 10px;
+ padding: 4px;
+ overflow: auto;
&:focus{outline:none;border-color:$yellow;}
}
#send{

0 comments on commit 40823bb

Please sign in to comment.