From 9457e13d34b9fb6f3d4df3aeafa14097ee683c43 Mon Sep 17 00:00:00 2001 From: dsc Date: Thu, 16 Feb 2012 11:46:37 -0800 Subject: [PATCH] checkpoint --- lib/server/view-helpers.co | 3 +++ www/css/colors.styl | 2 ++ www/css/forms.styl | 14 ++++++++++++++ www/css/graph.styl | 2 ++ www/graph.jade | 15 +++++++++++---- www/layout.jade | 3 ++- www/mixins/helpers.jade | 10 ++++++++++ 7 files changed, 44 insertions(+), 5 deletions(-) create mode 100644 www/mixins/helpers.jade diff --git a/lib/server/view-helpers.co b/lib/server/view-helpers.co index f7e7cbc..e33cfa7 100644 --- a/lib/server/view-helpers.co +++ b/lib/server/view-helpers.co @@ -1,5 +1,8 @@ # Utilities for use in templates +# maybe! +exports.require = require + fs = exports.fs = require 'fs' path = exports.path = require 'path' diff --git a/www/css/colors.styl b/www/css/colors.styl index 0069ec3..e6bd3b2 100644 --- a/www/css/colors.styl +++ b/www/css/colors.styl @@ -11,6 +11,8 @@ $foot_text = #505050 $body_link = #2d588f $foot_link = #666 +$border_color = #ccc + /* spot colors */ $hilite_dkblue = #182B53 $hilite_ltblue = #4596FF diff --git a/www/css/forms.styl b/www/css/forms.styl index e69de29..fd37163 100644 --- a/www/css/forms.styl +++ b/www/css/forms.styl @@ -0,0 +1,14 @@ +@import 'nib' +@import 'colors' + +fieldset + position relative + padding 1em + border 1px solid $border_color + border-radius 5px + + * + position relative + + legend + padding 0.25em 0.5em diff --git a/www/css/graph.styl b/www/css/graph.styl index e69de29..84f5d4b 100644 --- a/www/css/graph.styl +++ b/www/css/graph.styl @@ -0,0 +1,2 @@ +@import 'nib' +@import 'colors' diff --git a/www/graph.jade b/www/graph.jade index 7993c72..0707dbc 100644 --- a/www/graph.jade +++ b/www/graph.jade @@ -3,12 +3,19 @@ extends layout block title title Kraken: Graph Test Page -append content +append styles + mixin css('forms.css') + mixin css('graph.css') + //- + link(type='text/css', rel='stylesheet', media='screen', href='/css/forms.css') + link(type='text/css', rel='stylesheet', media='screen', href='/css/graph.css') + +block content section.graph .viewport - fieldset.settings + fieldset legend Settings - - mixin text_field('data', 'data/page_views_by_project.csv') + form.settings + mixin text_field('data', 'data/page_views_by_project.csv') diff --git a/www/layout.jade b/www/layout.jade index 374da14..a23055a 100644 --- a/www/layout.jade +++ b/www/layout.jade @@ -1,3 +1,4 @@ +include mixins/helpers include mixins/forms !!! html @@ -8,7 +9,7 @@ html block styles link(type='text/css', rel='stylesheet', media='screen', href='/css/reset.min.css') - link(type='text/css', rel='stylesheet', media='screen', href="/css/layout.css?#{version}") + mixin css('layout.css') link(type="image/ico", rel="icon", href="/favicon.ico") link(type="image/x-icon", rel="shortcut icon", href="/favicon.ico") diff --git a/www/mixins/helpers.jade b/www/mixins/helpers.jade new file mode 100644 index 0000000..39d433b --- /dev/null +++ b/www/mixins/helpers.jade @@ -0,0 +1,10 @@ +- if (typeof version == 'undefined' || version == null || !version || version === 'dev') { version = String(new Date().getTime()); } + +mixin css(href, media, root) + - media = media || 'screen' + - root = root || '/css' + - var ver = (version ? '?'+version : '') + - href = (root ? root+'/' : '') + href + ver + link(type='text/css', rel='stylesheet', media=media, href=href) + + -- 1.7.0.4