Permalink
Browse files

update to compass

  • Loading branch information...
1 parent d62248c commit 09d83556e0069e89a7029f6bfa57364c60487f71 @halida committed Oct 14, 2011
Showing with 175 additions and 122 deletions.
  1. +2 −0 Gemfile
  2. +22 −0 main.rb
  3. +12 −0 views/_nav.haml
  4. +45 −0 views/_side.haml
  5. +7 −66 views/layout.haml
  6. +87 −11 views/main.sass
  7. +0 −45 views/side.html
View
@@ -8,7 +8,9 @@ gem 'sqlite3'
gem "dm-sqlite-adapter"
gem 'RbST'
gem 'sass'
+gem 'compass'
gem 'coffee-script'
gem 'execjs'
gem 'therubyracer'
+gem 'thin'
View
@@ -1,12 +1,34 @@
# -*- coding: utf-8 -*-
require 'sinatra'
+
require 'haml'
require 'sass'
+require 'compass'
+
require 'coffee-script'
require './rst'
require './db'
+configure do
+ Compass.configuration do |config|
+ config.project_path = File.dirname(__FILE__)
+ config.sass_dir = 'views'
+ end
+
+ set :haml, { :format => :html5 }
+ set :sass, Compass.sass_engine_options
+end
+
+module Sinatra
+ module RenderPartial
+ def partial(page, options={})
+ haml page, options.merge!(:layout => false)
+ end
+ end
+ helpers RenderPartial
+end
+
set :port, 8181
set :host, "0.0.0.0"
# set :environment, :production
View
@@ -0,0 +1,12 @@
+#nav
+ %ul
+ %li
+ =link_to "网络寻租", "/", true
+ %li
+ =link_to "列表", "/list", true
+ %li
+ =link_to "关于", "/about", true
+
+ %ul.secondary-nav
+ %li
+ =link_to "feed", "/feed"
View
@@ -0,0 +1,45 @@
+#sidebar
+ <!-- search -->
+ <div id="cse" style="width: 100%">Loading</div>
+ <script src="http://www.google.com/jsapi" type="text/javascript"></script>
+ <script type="text/javascript">
+ google.load('search', '1', {language : 'zh-CN'});
+ google.setOnLoadCallback(function() {
+ var customSearchControl = new google.search.CustomSearchControl('002734431627809209205:lri3bo2cxbs');
+ customSearchControl.setResultSetSize(google.search.Search.FILTERED_CSE_RESULTSET);
+ customSearchControl.draw('cse');
+ }, true);
+ </script>
+
+ <!-- for twitter -->
+ <script src="http://widgets.twimg.com/j/2/widget.js"></script>
+ <script>
+ new TWTR.Widget({
+ version: 2,
+ type: 'profile',
+ rpp: 4,
+ interval: 6000,
+ width: 300,
+ height: 300,
+ theme: {
+ shell: {
+ background: '#f0f0f0',
+ color: '#000000'
+ },
+ tweets: {
+ background: '#f0f0f0',
+ color: '#000000',
+ links: '#008000'
+ }
+ },
+ features: {
+ scrollbar: false,
+ loop: false,
+ live: false,
+ hashtags: true,
+ timestamp: true,
+ avatars: false,
+ behavior: 'all'
+ }
+ }).render().setUser('linjunhalida').start();
+ </script>
View
@@ -4,7 +4,6 @@
%title= @title || "网络寻租"
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="author" content="halida" />
- <link rel="stylesheet" href="/bootstrap-1.1.1.min.css">
<link rel="stylesheet" type="text/css" href="/pygments-default.css" media="screen" />
<link rel="stylesheet" type="text/css" href="/main.css" media="screen" />
<link rel="alternate" type="application/rss+xml" title="网络寻租 - RSS" href="http://blog.linjunhalida.com/feed" />
@@ -17,72 +16,14 @@
</script>
%body
+ = partial :_nav
- .topbar
- .fill
- .container
- %h3
- =link_to "网络寻租", "/", true
- %ul
- %li
- =link_to "列表", "/list", true
- %li
- =link_to "关于", "/about", true
- %ul.secondary-nav
- %li
- =link_to "feed", "/feed"
-
- .container-fluid
-
- .sidebar
- <!-- search -->
- <div id="cse" style="width: 100%">Loading</div>
- <script src="http://www.google.com/jsapi" type="text/javascript"></script>
- <script type="text/javascript">
- google.load('search', '1', {language : 'zh-CN'});
- google.setOnLoadCallback(function() {
- var customSearchControl = new google.search.CustomSearchControl('002734431627809209205:lri3bo2cxbs');
- customSearchControl.setResultSetSize(google.search.Search.FILTERED_CSE_RESULTSET);
- customSearchControl.draw('cse');
- }, true);
- </script>
-
- <!-- for twitter -->
- <script src="http://widgets.twimg.com/j/2/widget.js"></script>
- <script>
- new TWTR.Widget({
- version: 2,
- type: 'profile',
- rpp: 4,
- interval: 6000,
- width: 300,
- height: 300,
- theme: {
- shell: {
- background: '#f0f0f0',
- color: '#000000'
- },
- tweets: {
- background: '#f0f0f0',
- color: '#000000',
- links: '#008000'
- }
- },
- features: {
- scrollbar: false,
- loop: false,
- live: false,
- hashtags: true,
- timestamp: true,
- avatars: false,
- behavior: 'all'
- }
- }).render().setUser('linjunhalida').start();
- </script>
-
- .content
+ .two-col
+ #content
=yield
- %footer
- %p @2010 linjunhalida, all right reserved
+ = partial :_side
+
+ %footer
+ %p @2010 linjunhalida, all right reserved
View
@@ -1,17 +1,93 @@
+@import compass/reset
+@import compass/utilities
+@import compass/css3
+@import compass/reset.scss
+@import compass/layout.scss
+@import blueprint
+
+// Base font
+=font-default
+ font: 16px Arial, Helvetica, sans-serif
+=font-header
+ font: 40px Arial, Helvetica, sans-serif
+=font-footer
+ font: 10px Arial, Helvetica, sans-serif
+ color: #aaaaaa
+
+//layouts
+$content-width: 980px
+
+// Links
+a
+ text-decoration: none
+ color: #3366CC
+ &:hover
+ color: #3366CC
+ text-decoration: none
+ &:focus,
+ &:active
+ outline: none
+ &:visited
+ // Default style for visited links
+ &:hover
+ color: #444444
+
+
body
- color: #303030
-li
- color: #101010
+ +font-default
+ background: white
+ color: #0d0d0d
+ align: center
+
+#nav
+ +border-radius(6px)
+ background: #323232
+ border: 1px solid #ccc
+ width: $content-width
+ height: 30px
+ margin: 10px auto
-.container-fluid
- margin-top: 60px
+ a
+ color: white
-.container-fluid .sidebar
- float: right
- width: 300px
+ ul.secondary-nav
+ float: right
-.container-fluid .content
- width: 700px
+ ul
+ float: left
+ li
+ display: inline
+ line-height: 30px
+ padding: 0 15px
+
+.two-col
+ $blueprint_grid_columns : 8
+ $blueprint_grid_width : 80px
+ h1
+ +font-header
+ +container
+ #header, #footer
+ +column(8)
+ #sidebar
+ +column(2, true)
+ #content
+ +column(6)
-footer.p
+
+
++sticky-footer(72px, "#layout", "#layout_footer", "footer")
+
+footer
+ width: $content-width
+ margin: 10px auto
align: center
+ +font-footer
+
+ $blueprint_grid_columns : 8
+ $blueprint_grid_width : 80px
+
+ .info
+ +column(3)
+
+ .time
+ +column(5)
View
@@ -1,45 +0,0 @@
-<!-- side.html -->
-<div id="cse" style="width: 100%">Loading</div>
-<script src="http://www.google.com/jsapi" type="text/javascript"></script>
-<script type="text/javascript">
- google.load('search', '1', {language : 'zh-CN'});
- google.setOnLoadCallback(function() {
- var customSearchControl = new google.search.CustomSearchControl('002734431627809209205:lri3bo2cxbs');
- customSearchControl.setResultSetSize(google.search.Search.FILTERED_CSE_RESULTSET);
- customSearchControl.draw('cse');
- }, true);
-</script>
-<link rel="stylesheet" href="http://www.google.com/cse/style/look/default.css" type="text/css" />
-
-<!-- for twitter -->
-<script src="http://widgets.twimg.com/j/2/widget.js"></script>
-<script>
- new TWTR.Widget({
- version: 2,
- type: 'profile',
- rpp: 4,
- interval: 6000,
- width: 200,
- height: 300,
- theme: {
- shell: {
- background: '#f0f0f0',
- color: '#000000'
- },
- tweets: {
- background: '#f0f0f0',
- color: '#000000',
- links: '#008000'
- }
- },
- features: {
- scrollbar: false,
- loop: false,
- live: false,
- hashtags: true,
- timestamp: true,
- avatars: false,
- behavior: 'all'
- }
- }).render().setUser('linjunhalida').start();
-</script>

0 comments on commit 09d8355

Please sign in to comment.