Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Extracted portions of PagesController#home view to their own partials.

  • Loading branch information...
commit f464a7d8e4f5b888d91b367c8f2b853c77e7a5cb 1 parent 75cae20
Arttu Tervo arttu authored ljuti committed
15 app/views/pages/_drafts.html.haml
... ... @@ -0,0 +1,15 @@
  1 +.container_24.top_drafts
  2 + %h2 Luonnokset
  3 + - [["grid_8", "popular", "alpha"], ["grid_8", "popular"], ["grid_8", "popular", "omega"]][0, [3, @drafts.size].min].each_with_index do |klasses, i|
  4 + %div{:class => klasses}
  5 + - if recent_draft = @drafts[i]
  6 + %h3.title=link_to shorten(recent_draft.summary, 100, 20, "»"), idea_path(recent_draft)
  7 + %div{id: "draft_bar#{i}", class: "bar"}
  8 + - for_portion, for_, against_portion, against_ = @draft_counts[recent_draft.id]
  9 + - for_length = [35, (280-5-35)*for_portion].max
  10 + :javascript
  11 + var r = Raphael("draft_bar#{i}", 280, 20);
  12 + r.rect( 0, 0, #{for_length}, 20).attr({fill: "#8cc63f", stroke: "#fff", strokewidth: 5});
  13 + r.rect(#{for_length+5}, 0, #{280-5-for_length}, 20).attr({fill: "#a9003f", stroke: "#fff", strokewidth: 5});
  14 + r.text( 18,11, "#{for_}").attr({fill: "#fff", "font-size": 12});
  15 + r.text(261,11, "#{against_}").attr({fill: "#fff", "font-size": 12});
7 app/views/pages/_headline.html.haml
... ... @@ -0,0 +1,7 @@
  1 +.container_24.headline
  2 + %hgroup.grid_18
  3 + %h1 Tuulivoimalat pelastavat maailman?
  4 + %h2 Tee siitä laki
  5 + .actions.grid_6
  6 + = link_to "Listaa kaikki", ideas_path, class: "button"
  7 + %a.button{href: "/artikkelit/miten-palvelu-toimii"} Lisätietoa
19 app/views/pages/_ideas.html.haml
... ... @@ -0,0 +1,19 @@
  1 +.grid_16.top_ideas.alpha
  2 + %h2 Ajankohtaiset ideat
  3 + - @ideas.each do |idea|
  4 + .idea
  5 + .grid_16.info
  6 + %span.type
  7 + Idea/
  8 + %span.date
  9 + = finnishDate(idea.updated_at)
  10 + %h3=link_to shorten(idea.summary, 100, 20, "»"), idea_path(idea)
  11 + .grid_16.statistics
  12 + - for_, against, comments, total = @idea_counts[idea.id]
  13 + %span.total #{total} ääntä: 
  14 + %span.for #{for_}
  15 + |
  16 + %span.against #{against}
  17 + %span.comments= link_to "#{comments} kommenttia", idea_path(idea, anchor: "comments")
  18 +
  19 + =link_to "Listaa kaikki»", ideas_path, class: "list_ideas"
12 app/views/pages/_news.html.haml
... ... @@ -0,0 +1,12 @@
  1 +.grid_8.news.omega
  2 + %h2 Ministeriössä tapahtuu
  3 + %iframe{width: "310", height: "192", src: "http://www.youtube.com/embed/R2wa2O0EBTg?rel=0", frameborder: "0", allowfullscreen: ""}
  4 + - if @blog_articles.any?
  5 + - @blog_articles.each do |article|
  6 + .news_item
  7 + - author_name = (article.author && article.author.profile.name) || "Tuntematon"
  8 + =link_to author_name, article_path(article)
  9 + #{finnishTime(article.updated_at)}
  10 + .content=link_to shorten(article.title, 100, 20, "»"), article_path(article)
  11 + - else
  12 + %p Ei kirjoituksia tällä hetkellä
10 app/views/pages/_newsletter.html.haml
... ... @@ -0,0 +1,10 @@
  1 +.grid_8.newsletter.omega
  2 + %h2 Tilaa uutiskirje
  3 +
  4 + %div{:id => "mc_embed_signup"}
  5 + %form{ :action => "http://avoinministerio.us4.list-manage.com/subscribe/post?u=639187372f3d5221161f16dba&id=13448f1e4e", :method => "post", :id => "mc-embedded-subscribe-form", :name => "mc-embedded-subscribe-form", :class => "validate", :target => "_blank"}
  6 + %label{:for => "mce-EMAIL"} Pysy ajan tasalla Avoimen ministeriön toiminnasta tilaamalla uutiskirjeemme.
  7 + %br
  8 + %input{:type => "email", :name => "EMAIL", :class => "email", :id => "mce-EMAIL", :placeholder => "Sähköpostiosoitteesi", :required => true}
  9 + %br
  10 + %input{:type => "submit", :value => "Tilaa", :name => "subscribe", :id => "mc-embedded-subscribe", :class => "button"}
70 app/views/pages/home.html.haml
... ... @@ -1,65 +1,5 @@
1   -.container_24.headline
2   - %hgroup.grid_18
3   - %h1 Tuulivoimalat pelastavat maailman?
4   - %h2 Tee siitä laki
5   - .actions.grid_6
6   - = link_to "Listaa kaikki", ideas_path, class: "button"
7   - %a.button{href: "/artikkelit/miten-palvelu-toimii"} Lisätietoa
8   -.container_24.top_drafts
9   - %h2 Luonnokset
10   - - [["grid_8", "popular", "alpha"], ["grid_8", "popular"], ["grid_8", "popular", "omega"]][0, [3, @drafts.size].min].each_with_index do |klasses, i|
11   - %div{:class => klasses}
12   - - if recent_draft = @drafts[i]
13   - %h3.title=link_to shorten(recent_draft.summary, 100, 20, "»"), idea_path(recent_draft)
14   - %div{id: "draft_bar#{i}", class: "bar"}
15   - - for_portion, for_, against_portion, against_ = @draft_counts[recent_draft.id]
16   - - for_length = [35, (280-5-35)*for_portion].max
17   - :javascript
18   - var r = Raphael("draft_bar#{i}", 280, 20);
19   - r.rect( 0, 0, #{for_length}, 20).attr({fill: "#8cc63f", stroke: "#fff", strokewidth: 5});
20   - r.rect(#{for_length+5}, 0, #{280-5-for_length}, 20).attr({fill: "#a9003f", stroke: "#fff", strokewidth: 5});
21   - r.text( 18,11, "#{for_}").attr({fill: "#fff", "font-size": 12});
22   - r.text(261,11, "#{against_}").attr({fill: "#fff", "font-size": 12});
23   -
24   -.grid_16.top_ideas.alpha
25   - %h2 Ajankohtaiset ideat
26   - - @ideas.each do |idea|
27   - .idea
28   - .grid_16.info
29   - %span.type
30   - Idea/
31   - %span.date
32   - = finnishDate(idea.updated_at)
33   - %h3=link_to shorten(idea.summary, 100, 20, "»"), idea_path(idea)
34   - .grid_16.statistics
35   - - for_, against, comments, total = @idea_counts[idea.id]
36   - %span.total #{total} ääntä: 
37   - %span.for #{for_}
38   - |
39   - %span.against #{against}
40   - %span.comments= link_to "#{comments} kommenttia", idea_path(idea, anchor: "comments")
41   -
42   - =link_to "Listaa kaikki»", ideas_path, class: "list_ideas"
43   -
44   -.grid_8.news.omega
45   - %h2 Ministeriössä tapahtuu
46   - %iframe{width: "310", height: "192", src: "http://www.youtube.com/embed/R2wa2O0EBTg?rel=0", frameborder: "0", allowfullscreen: ""}
47   - - if @blog_articles.any?
48   - - @blog_articles.each do |article|
49   - .news_item
50   - - author_name = (article.author && article.author.profile.name) || "Tuntematon"
51   - =link_to author_name, article_path(article)
52   - #{finnishTime(article.updated_at)}
53   - .content=link_to shorten(article.title, 100, 20, "»"), article_path(article)
54   - - else
55   - %p Ei kirjoituksia tällä hetkellä
56   -.grid_8.newsletter.omega
57   - %h2 Tilaa uutiskirje
58   -
59   - %div{:id => "mc_embed_signup"}
60   - %form{ :action => "http://avoinministerio.us4.list-manage.com/subscribe/post?u=639187372f3d5221161f16dba&id=13448f1e4e", :method => "post", :id => "mc-embedded-subscribe-form", :name => "mc-embedded-subscribe-form", :class => "validate", :target => "_blank"}
61   - %label{:for => "mce-EMAIL"} Pysy ajan tasalla Avoimen ministeriön toiminnasta tilaamalla uutiskirjeemme.
62   - %br
63   - %input{:type => "email", :name => "EMAIL", :class => "email", :id => "mce-EMAIL", :placeholder => "Sähköpostiosoitteesi", :required => true}
64   - %br
65   - %input{:type => "submit", :value => "Tilaa", :name => "subscribe", :id => "mc-embedded-subscribe", :class => "button"}
  1 += render partial: 'headline'
  2 += render partial: 'drafts'
  3 += render partial: 'ideas'
  4 += render partial: 'news'
  5 += render partial: 'newsletter'

0 comments on commit f464a7d

Please sign in to comment.
Something went wrong with that request. Please try again.