From 5ccb76770646d8eb13ea379f5042670a8376d21e Mon Sep 17 00:00:00 2001 From: hukl Date: Sat, 31 Jan 2009 23:14:54 +0100 Subject: added everything needed to render a page --- app/controllers/content_controller.rb | 6 +- app/models/node.rb | 21 ++ app/views/content/render_page.html.erb | 3 +- app/views/layouts/application.html.erb | 199 ++++++++++++++ public/images/bg.gif | Bin 0 -> 1091 bytes public/images/bg.png | Bin 0 -> 171 bytes public/images/bg_teaser.gif | Bin 0 -> 853 bytes public/images/chaosknot.gif | Bin 0 -> 3535 bytes public/images/chaosknot.ico | Bin 0 -> 3382 bytes public/images/hr.png | Bin 0 -> 150 bytes public/images/ohne_styles.gif | Bin 0 -> 6842 bytes public/images/ohne_styles.png | Bin 0 -> 150703 bytes public/images/ohne_styles_big.gif | Bin 0 -> 81119 bytes public/images/snafu_sm.png | Bin 0 -> 3134 bytes public/images/t_chinese_wall.png | Bin 0 -> 2531 bytes public/images/t_congress.png | Bin 0 -> 2729 bytes public/images/t_fingers.png | Bin 0 -> 5538 bytes public/stylesheets/ie.css | 16 ++ public/stylesheets/safari.css | 3 + public/stylesheets/styled.css | 486 +++++++++++++++++++++++++++++++++ 20 files changed, 729 insertions(+), 5 deletions(-) create mode 100755 public/images/bg.gif create mode 100755 public/images/bg.png create mode 100755 public/images/bg_teaser.gif create mode 100755 public/images/chaosknot.gif create mode 100755 public/images/chaosknot.ico create mode 100755 public/images/hr.png create mode 100755 public/images/ohne_styles.gif create mode 100755 public/images/ohne_styles.png create mode 100755 public/images/ohne_styles_big.gif create mode 100755 public/images/snafu_sm.png create mode 100755 public/images/t_chinese_wall.png create mode 100755 public/images/t_congress.png create mode 100755 public/images/t_fingers.png create mode 100755 public/stylesheets/ie.css create mode 100755 public/stylesheets/safari.css create mode 100755 public/stylesheets/styled.css diff --git a/app/controllers/content_controller.rb b/app/controllers/content_controller.rb index 8059fab..a78b8b5 100644 --- a/app/controllers/content_controller.rb +++ b/app/controllers/content_controller.rb @@ -1,12 +1,12 @@ class ContentController < ApplicationController def render_page - path = params[:page_path].join('/') + path = params[:pagepath].join('/') - @node = Node.find_by_unique_name(path) + @page = Node.find_page(path) # Replace with real 404 - render :status => 404 unless @node + render :status => 404 unless @page end end diff --git a/app/models/node.rb b/app/models/node.rb index 6e54004..5acf563 100644 --- a/app/models/node.rb +++ b/app/models/node.rb @@ -3,6 +3,27 @@ class Node < ActiveRecord::Base has_many :pages, :order => "revision ASC" + # Class methods + + def self.find_page path, revision = :current + + node = Node.find_by_unique_name(path) + + if node + + case revision + when :current + return node.pages.last + when /\d+/ + return node.pages.find_by_revision revision + end + end + + nil + end + + # Instance Methods + # returns array with pages up to root excluding root def path_to_root parent.nil? && [slug] || parent.path_to_root.push(slug) diff --git a/app/views/content/render_page.html.erb b/app/views/content/render_page.html.erb index af7ef88..2c65a6c 100644 --- a/app/views/content/render_page.html.erb +++ b/app/views/content/render_page.html.erb @@ -1,2 +1 @@ -

Content#render_page

-

Find me in app/views/content/render_page.html.erb

+<%= @page.body %> \ No newline at end of file diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index e69de29..f9f7faa 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -0,0 +1,199 @@ + + + + + CCC Template + + <%= stylesheet_link_tag 'styled' %> + <%= stylesheet_link_tag 'safari' %> + <%= stylesheet_link_tag 'ie' %> + + + + + + + + +
+
+
+

Precontent

+

+ Rhabarber, brable, bra..., bla, bla... (fasel) +

+
+ +
+
+
+
+

<%= @page.title %>

+

<%= @page.published_at.to_s(:db) %>, gregoa

+
+ <%= @page.body %> +
+
+ + + +
+
+
    +
  • + Congress +
  • +
  • + www.chinesewall.ccc.de +
  • +
  • + Fingerabrdrücke +
  • +
+

+ +
+
+

Sponsoren

+
    +
  • + snafu: So geht man ins Netz +
  • +
+
+
+ + + + +
+ + + +
+
+ + + \ No newline at end of file diff --git a/public/images/bg.gif b/public/images/bg.gif new file mode 100755 index 0000000..c2e3805 Binary files /dev/null and b/public/images/bg.gif differ diff --git a/public/images/bg.png b/public/images/bg.png new file mode 100755 index 0000000..ac55f29 Binary files /dev/null and b/public/images/bg.png differ diff --git a/public/images/bg_teaser.gif b/public/images/bg_teaser.gif new file mode 100755 index 0000000..c84c0d7 Binary files /dev/null and b/public/images/bg_teaser.gif differ diff --git a/public/images/chaosknot.gif b/public/images/chaosknot.gif new file mode 100755 index 0000000..f6b5c3a Binary files /dev/null and b/public/images/chaosknot.gif differ diff --git a/public/images/chaosknot.ico b/public/images/chaosknot.ico new file mode 100755 index 0000000..cd6afd2 Binary files /dev/null and b/public/images/chaosknot.ico differ diff --git a/public/images/hr.png b/public/images/hr.png new file mode 100755 index 0000000..024b190 Binary files /dev/null and b/public/images/hr.png differ diff --git a/public/images/ohne_styles.gif b/public/images/ohne_styles.gif new file mode 100755 index 0000000..4c1560e Binary files /dev/null and b/public/images/ohne_styles.gif differ diff --git a/public/images/ohne_styles.png b/public/images/ohne_styles.png new file mode 100755 index 0000000..262174d Binary files /dev/null and b/public/images/ohne_styles.png differ diff --git a/public/images/ohne_styles_big.gif b/public/images/ohne_styles_big.gif new file mode 100755 index 0000000..a59ebf0 Binary files /dev/null and b/public/images/ohne_styles_big.gif differ diff --git a/public/images/snafu_sm.png b/public/images/snafu_sm.png new file mode 100755 index 0000000..3b19d9c Binary files /dev/null and b/public/images/snafu_sm.png differ diff --git a/public/images/t_chinese_wall.png b/public/images/t_chinese_wall.png new file mode 100755 index 0000000..b76a8f0 Binary files /dev/null and b/public/images/t_chinese_wall.png differ diff --git a/public/images/t_congress.png b/public/images/t_congress.png new file mode 100755 index 0000000..58b8178 Binary files /dev/null and b/public/images/t_congress.png differ diff --git a/public/images/t_fingers.png b/public/images/t_fingers.png new file mode 100755 index 0000000..d692b1e Binary files /dev/null and b/public/images/t_fingers.png differ diff --git a/public/stylesheets/ie.css b/public/stylesheets/ie.css new file mode 100755 index 0000000..05ec223 --- /dev/null +++ b/public/stylesheets/ie.css @@ -0,0 +1,16 @@ +* html #topnav { + margin: 0.9em 0 0 3.48em; +} + +* html #main { + background: url(../images/bg_teaser.gif) +} + +* html #teaserbar { + border: 0; +} + +/* +div { + border: solid 1px red; +} */ diff --git a/public/stylesheets/safari.css b/public/stylesheets/safari.css new file mode 100755 index 0000000..5a5c824 --- /dev/null +++ b/public/stylesheets/safari.css @@ -0,0 +1,3 @@ +.quell { + font-size: 1.2em; +} diff --git a/public/stylesheets/styled.css b/public/stylesheets/styled.css new file mode 100755 index 0000000..8af3299 --- /dev/null +++ b/public/stylesheets/styled.css @@ -0,0 +1,486 @@ +/* CCC CSS: + * Start: 29. Oct. 2008 + * Url: http://ccc.de//css/style.css + * + * Body fontsize: 11px = 0.69em + * em calc: http://riddle.pl/emcalc/ + * + * Colors: + * #EEE = Header BG + * #FFCA08 = Yellow + * #999 = h2 Precontent + * #4d4d4d = Navigation + * #eab407 = Content Headers + * #fbb03b = Orange, Teaserbar Subheaders + */ + +#wrapper { + margin:0; + padding: 0; + top: 0; + bottom: 0; +} + +/* HEADER */ +#header { + background: #EEE; + height: 7.08em; + border: solid silver; + border-width: 0 0 .09em .09em; +} + +#yellow { + background: #FFCA08; + height: 1.27em; +} + +#title { + width: 68em; + margin: .68em 0 0 7em; +} + +#title h1 { + float: left; + padding: 0; + margin: 0; + font-size: 1.91em; + font-weight: normal; + color: #000; +} + +#topnav { + clear: left; + width: 68em; + padding: 0; + margin: 0.9em 0 0 7em; + float: left; + text-transform: uppercase; +} + +#topnav ul { + margin: 0; + padding: 0; +} + +#navlist li { + display: inline; + list-style-type: none; + padding-right: .7em; + color: #4d4d4d; +} + +#navlist a { + text-decoration: none; + color: #4d4d4d; +} + +#navlist a:hover { + text-decoration: underline; + color: #4d4d4d; +} + +#logo { + position: absolute; + top: 2em; + left: 79.2em; + width: 12.27em; + height: 8.73em; +} + +#logo img { + width: 12.27em; + height: 8.73em; +} +/* HEADER END */ + +/* CONTENT */ +#main { + position: relative; + bottom: 3.5em; + width: 91.3em; + top: 0; +} + +#content { + position: relative; + padding: .9em 6em 2em 8em; + width: 41.75em; + border-right: solid .09em silver; +} + +#content .article { + position: relative; + padding-top: 1em; + clear: both; +} + +#content .article img { + float:left; + margin: .5em 1em 1em; + border: .09em solid silver; +} + +#content h2.first { + padding: .28em 0 .45em 0; + margin: 0; + /* text-align: center; + /* color: #eab407; */ +} + +#content h2 { + padding: 1.2em 0 .45em 0; + margin: 0; + text-align: center; + color: #eab407; +} + +#precontent h2 { + color: #999; + text-align: left; +} + +#content h2 a { + margin: 0; + padding: 0; + text-align: center; + color: #eab407; + font-family: Georgia; + font-weight: normal; +} + +#content h2 a:hover { + padding: 0; + text-decoration: underline; +} + +#content h3 { + padding: 0 0 .45em 0; + margin: 0; + text-align: center; + color: #666; + font-family: Times; + font-size: 1.18em; + font-style: italic; + font-weight: normal; +} + +hr.subtitle { + background: silver; + height: .09em; + width: 10.91em; +} + +.quell { + color: #0000C0; + font-size: 1em; + line-height: 1.3em; + font-family: "Courier New",Courier,monospace; + +} + +#content p { + color: #4d4d4d; + font-family: Verdana; + line-height: 1.8em; + margin: 0; + padding: 0; +} + +#precontent p { + margin-top: 0; + line-height: 1.8em; +} + +#content a { + padding: 1em; + margin: -1em; + color: #4d4d4d; + font-family: Verdana; + text-decoration: none; +} + +#content a:hover { + padding: 1em; + text-decoration: underline; +} + +div.teaserruler { + background: url(../images/hr.png); + border: 0 none; + height: .09em; +} + +div.teaserruler hr { + display: none; +} +/* CONTENT END */ + +/* TEASERBAR */ +#teaserbar { + position: absolute; + top: 0; + left: 55.88em; + bottom: 0; + float: left; + padding-top: 1.8em; + width: 19.9em; + border-right: solid .09em silver; +} + +.teaserimg ul { + list-style-type: none; + padding: 0; + margin: 0; + text-align: center; +} + +.teaserimg img { + /* Size: 170px x 58px */ + width: 15.45em; + height: 5.27em; +} + +.teaserimg li { + padding-bottom: 1.1em; +} + +.teasertext ul { + list-style-type: none; + padding: 0 1em; + margin: 0; +} + +.teasertext li { + padding-bottom: 1.2em; +} + +.teasertext a { + color: #fbb03b; + text-decoration: none; +} + +.teasertext a:hover { + text-decoration: underline; +} + +#foerderer { +} + +#foerderer h2 { + padding: 0.686em 0pt 0.8em 0.7em; + margin: 0; +} + +#foerderer ul { + list-style-type: none; + padding: 0; + margin: 0; + text-align: center; +} + +#sponsorlist img { + /* Size: 160px x 49px */ + width: 14.55em; + height: 4.45em; +} + +#sponsorlist li { + padding-bottom: 1.1em; +} +/* TEASERBAR END */ + +/* NAVBAR */ +#navbar { + position: absolute; + top: 0; + bottom: 0; + left: 75.9em; + padding: 0.9em 1.5em; + width: 12.3em; +} + +#navbar h2 { + padding: .28em 0 .45em 0; + margin: 0; + color: #999; +} + +/* SEARCHFORM */ +form { + padding: 0 0 .3em .24em; + margin-top: -.23em; +} + +form p { + margin: 0; +} + +label { + color: #999; + font-family: Georgia; + font-size: 1.64em; + font-weight: normal; + margin-left: -.2em; + line-height: 2em; +} + +input { + font-size: 1em; + width: 9em; + border:.09em solid #000; +} + +input.check { + float:left; + width: 1em; + height: 1em; + margin: 0.3em 0; + color: #000; + background: #fff; + border: solid .09em #000; +} + +label.foren { + padding-left: .4em; + color: #4d4d4d; + font-family: Verdana; + font-size: 1em; + line-height: 1.7em; +} + +div.navbarruler { + margin: 1.3em -.2em .8em; + background: url(../images/hr.png); + border: 0 none; + height: .09em; +} +div.navbarruler hr { + display: none; +} + +/* 1ST NAV RIGHT */ +.firstnavbar ul { + padding:0; + margin:0; + list-style: none +} + +.firstnavbar li { + padding-bottom: 1em; + margin:0; + list-style: none +} + +.firstnavbar li a { + color: #6f8745; + text-decoration: none; +} + +.firstnavbar li a:hover { + color: #6f8745; + text-decoration: underline; +} + +#secondnavbar ul { + padding-left: 1.1em; + margin: 0; +} + +/* 2ND NAV RIGHT */ +#secnavbar li { + padding-bottom: 1em; + margin:0; + color: #6f8745; +} + +#secnavbar a { + color: #6f8745; + text-decoration: none; +} + +#secnavbar a:hover { + color: #6f8745; + text-decoration: underline; +} +/* NAVBAR END */ + +/* FOOTER */ +#footer { + clear: both; + border: solid silver; + border-width: .09em 0 .09em 0; + height: 2.5em; + background: #fff; + width: 100%; +} + +#footer_left { + float: left; + width: 16.7em; + height: 2.5em; + background: #FFCA08; + text-transform: uppercase; + text-align: center; + line-height: 2.3em; + border-right: solid .09em silver; +} + +#footer_rest { + float: left; + padding-left: 1.9em; + line-height: 2.3em; +} + +#fnord { + height: 1em; +} +/* FOOTER END */ + +/* SYSTEMWEITE DEFS */ +.black { + color: #4d4d4d; +} + +.orange { + color: #fbb03b; +} + +h2 { + padding: .686em 0 .8em .7em; + margin: 0; + text-align: left; + color: #999; +} + +a { + color: #999; + text-decoration: none; +} + +a:hover { + text-decoration: underline; +} + +hr { + border: 0; + background: silver; + height: .09em; +} + +img { + border: 0; +} + +h2 { + font-family: Georgia; + font-size: 1.64em; + font-weight: normal; +} + +body { + margin: 0; + padding: 0; + background: #fff url(../images/bg.png) repeat-x; + font-family: Verdana; + font-size: 0.69em; +} \ No newline at end of file -- cgit v1.3