From 06271d5821bdf2ad2b1f072b51de65a6a3833418 Mon Sep 17 00:00:00 2001 From: danielvincent <danielgrippi@gmail.com> Date: Mon, 21 Jun 2010 14:03:03 -0700 Subject: [PATCH] added dumb partial switcher function in dashboard controller --- app/controllers/dashboard_controller.rb | 3 +- app/helpers/dashboard_helper.rb | 7 ++- app/views/blogs/_pane.html.haml | 11 ++++ app/views/blogs/index.html.haml | 18 +----- app/views/bookmarks/_pane.html.haml | 7 ++- app/views/bookmarks/index.html.haml | 5 +- app/views/dashboard/index.html.haml | 7 +-- app/views/layouts/application.html.haml | 41 ++++++++----- app/views/status_messages/_pane.html.haml | 2 +- app/views/status_messages/index.html.haml | 2 +- public/stylesheets/application.css | 73 +++++++++++----------- public/stylesheets/sass/application.sass | 75 +++++++++++------------ 12 files changed, 127 insertions(+), 124 deletions(-) create mode 100644 app/views/blogs/_pane.html.haml diff --git a/app/controllers/dashboard_controller.rb b/app/controllers/dashboard_controller.rb index ed96cf8669..2ed74e6317 100644 --- a/app/controllers/dashboard_controller.rb +++ b/app/controllers/dashboard_controller.rb @@ -4,8 +4,7 @@ class DashboardController < ApplicationController include ApplicationHelper def index - @bookmarks = Bookmark.all - @messages = StatusMessage.all + @posts = Post.all end diff --git a/app/helpers/dashboard_helper.rb b/app/helpers/dashboard_helper.rb index d06bca135c..3a3b0bfeaa 100644 --- a/app/helpers/dashboard_helper.rb +++ b/app/helpers/dashboard_helper.rb @@ -1,7 +1,8 @@ module DashboardHelper - - - + def type_partial(post) + class_name = post.class.name.to_s.underscore + "#{class_name.pluralize}/pane" + end end diff --git a/app/views/blogs/_pane.html.haml b/app/views/blogs/_pane.html.haml new file mode 100644 index 0000000000..a5270a1b2c --- /dev/null +++ b/app/views/blogs/_pane.html.haml @@ -0,0 +1,11 @@ +%li.message + %span.from + = link_to post.owner, "#" + %b wrote a new blog post + %br + %b= post.title + %br + = post.body + %div.time + = "#{time_ago_in_words(post.updated_at)} ago" + diff --git a/app/views/blogs/index.html.haml b/app/views/blogs/index.html.haml index 40eccd0145..655aa67eb3 100644 --- a/app/views/blogs/index.html.haml +++ b/app/views/blogs/index.html.haml @@ -1,17 +1,5 @@ -- title "Blogs" +%h1= link_to "new blog", new_blog_path -%table - %tr - %th Title - %th Body - %th Owner +%ul#stream - for blog in @blogs - %tr - %td= blog.title - %td= blog.body - %td= blog.owner - %td= link_to 'Show', blog - %td= link_to 'Edit', edit_blog_path(blog) - %td= link_to 'Destroy', blog, :confirm => 'Are you sure?', :method => :delete - -%p= link_to "New Blog", new_blog_path + = render "pane", :post => blog diff --git a/app/views/bookmarks/_pane.html.haml b/app/views/bookmarks/_pane.html.haml index cba4627c0e..8526bb91b1 100644 --- a/app/views/bookmarks/_pane.html.haml +++ b/app/views/bookmarks/_pane.html.haml @@ -1,7 +1,8 @@ %li.message - %span.from= link_to post.owner, "#" - %b shared a link - %br + %span.from + = link_to post.owner, "#" + %b shared a link + %br = post.title = link_to post.link %div.time= "#{time_ago_in_words(post.updated_at)} ago" diff --git a/app/views/bookmarks/index.html.haml b/app/views/bookmarks/index.html.haml index 5c0a355d77..4380e370a2 100644 --- a/app/views/bookmarks/index.html.haml +++ b/app/views/bookmarks/index.html.haml @@ -1,7 +1,4 @@ -- title "Bookmarks" - -%h1 - %p.description= link_to "New Bookmark", new_bookmark_path +%h1= link_to "new bookmark", new_bookmark_path %ul#stream - for bookmark in @bookmarks diff --git a/app/views/dashboard/index.html.haml b/app/views/dashboard/index.html.haml index a4fbeeb52c..3a892c6510 100644 --- a/app/views/dashboard/index.html.haml +++ b/app/views/dashboard/index.html.haml @@ -1,5 +1,4 @@ -%h3 home +%h1 your network stream %ul#stream - - for post in @messages - = render "status_messages/pane", :post => post - = render "status_messages/pane", :post => post + - for post in @posts + = render type_partial(post), :post => post diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index b14a363ffe..0e8bc9c66b 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -14,7 +14,6 @@ = csrf_meta_tag = yield(:head) - :javascript $(document).ready(function(){ $('a').hover(function(){ @@ -22,6 +21,11 @@ }, function(){ $(this).fadeTo(80, 1); }); + $('ul.nav li').hover(function(){ + $(this).fadeTo(60, 0.5); + }, function(){ + $(this).fadeTo(80, 1); + }); }); @@ -32,7 +36,9 @@ #session_action - if user_signed_in? - = link_to User.first.email, destroy_user_session_path + =User.first.email + | + = link_to "logout", destroy_user_session_path - else = link_to "login", new_user_session_path @@ -40,25 +46,28 @@ - if user_signed_in? %h1#user_name = link_to User.first.email, root_url - %span.description= StatusMessage.my_newest.message - - - %img{:src => '/images/mocks/bp.jpeg'} + %span.description + - if StatusMessage.my_newest + = StatusMessage.my_newest.message %nav %ul.nav - %li= link_to "home", root_path - %li= link_to "users", users_path - %li= link_to "status messages", status_messages_path - %li= link_to "bookmarks", bookmarks_path - %li= link_to "blogs", blogs_path - %li= link_to "friends", friends_path + %a{ :href => root_path, :title => "Your network stream."} + %li home + %a{ :href => users_path, :title => "Registered users on your seed."} + %li users + %a{ :href => status_messages_path, :title => "Recent status messages."} + %li status messages + %a{ :href => bookmarks_path, :title => "Recently shared links."} + %li bookmarks + %a{ :href => blogs_path, :title => "Recent blog posts."} + %li blogs + %a{ :href => friends_path, :title => "Your list of connections with other seeds."} + %li friends - flash.each do |name, msg| = content_tag :div, msg, :id => "flash_#{name}" - %br - %br - %br - %br + #content = yield + diff --git a/app/views/status_messages/_pane.html.haml b/app/views/status_messages/_pane.html.haml index 3b7048936b..f523dc7039 100644 --- a/app/views/status_messages/_pane.html.haml +++ b/app/views/status_messages/_pane.html.haml @@ -1,7 +1,7 @@ %li.message %span.from = link_to post.owner, "#" - = post.message + = post.message %div.time = "#{time_ago_in_words(post.updated_at)} ago" diff --git a/app/views/status_messages/index.html.haml b/app/views/status_messages/index.html.haml index b28edc5fe6..c6518c4d38 100644 --- a/app/views/status_messages/index.html.haml +++ b/app/views/status_messages/index.html.haml @@ -1,4 +1,4 @@ -%h1.big_text= link_to "New Status Message", new_status_message_path +%h1.big_text= link_to "new status message", new_status_message_path %ul#stream - for status_message in @status_messages = render "pane", :post => status_message diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index ddb7cf1927..c4d8f9a0af 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -50,7 +50,7 @@ a { header { z-index: 10; - position: absolute; + position: fixed; width: 100%; margin-top: -2em; margin-right: -2em; @@ -58,48 +58,42 @@ header { height: 30px; color: white; background-color: #1a1a21; - border-bottom: 2px solid white; + border-bottom: 2px solid #f2f8fc; padding-top: 5px; } header #diaspora_text { - position: absolute; + position: fixed; border: none; top: 8px; left: 1em; } header #session_action { - position: absolute; + position: fixed; right: 1em; font-size: 120%; - margin-top: 2px; } + top: 7px; } header #session_action a { color: #cccccc; border: none; } - header #session_action a:hover { - color: white; } ul.nav { position: absolute; padding: 0; margin: 0; width: 200px; - margin-top: 300px; } + top: 100px; + font-size: 130%; } ul.nav li { display: block; padding: 5px 10px; - background: #f2f8fc; + background-color: #f2f8fc; border: 1px solid white; } - ul.nav li:hover a { - color: #666666; } + ul.nav li:first-child { + border-top-right-radius: 5px; + border-top-left-radius: 5px; } + ul.nav li:last-child { + border-bottom-right-radius: 5px; + border-bottom-left-radius: 5px; } ul.nav a { - border-bottom: none; color: #b1cfe3; } - ul.nav a:hover { - color: black; } - ul.nav > li:first-child { - border-top-right-radius: 5px; - border-top-left-radius: 5px; } - ul.nav > li:last-child { - border-bottom-right-radius: 5px; - border-bottom-left-radius: 5px; } #header_below { z-index: 5; @@ -117,15 +111,17 @@ ul.nav { border-radius: 5px; } #content { - margin-left: 210px; } + position: absolute; + left: 250px; + top: 94px; + width: 60%; + min-width: 500px; + max-width: 700px; } ul#stream { margin: 0; padding: 0; - color: #666666; - width: 60%; - min-width: 500px; - max-width: 700px; } + color: #666666; } ul#stream > li { list-style: none; padding: 1em; @@ -150,12 +146,15 @@ h1 { font-weight: bold; line-height: 36px; } h1 p.description, h1 span.description { - font-weight: normal; - font-family: "lucida grande"; - color: #999999; } - h1 .big_number { - font-size: 300%; - line-height: 100%; } + font-weight: 200; + font-family: "helvetica neue", "lucida grande", "sans-serif"; + color: #999999; + padding: 0.1em; } + +.big_number { + font-weight: bold; + font-size: 500%; + line-height: 100%; } h3 { position: relative; @@ -170,7 +169,7 @@ h3 { margin-bottom: 1em; } form { - font-size: 430%; + font-size: 130%; margin: 1em; margin-left: 0em; } form input { @@ -178,7 +177,9 @@ form { padding: 0.2em; max-width: 100%; } -#user_name a { - color: black; } - #user_name a:hover { - color: #cc1e14; } +#user_name { + background-color: rgba(255, 255, 255, 0.5); } + #user_name a { + color: black; } + #user_name a:hover { + color: #cc1e14; } diff --git a/public/stylesheets/sass/application.sass b/public/stylesheets/sass/application.sass index c435819b45..d4c837e00f 100644 --- a/public/stylesheets/sass/application.sass +++ b/public/stylesheets/sass/application.sass @@ -54,7 +54,7 @@ a header :z-index 10 - :position absolute + :position fixed :width 100% :margin @@ -67,28 +67,25 @@ header :background :color #1A1A21 :border - :bottom 2px solid #fff + :bottom 2px solid #F2F8FC :padding :top 5px #diaspora_text - :position absolute + :position fixed :border none :top 8px :left 1em #session_action - :position absolute + :position fixed :right 1em :font :size 120% - :margin - :top 2px + :top 7px a :color #ccc :border none - &:hover - :color #fff ul.nav @@ -96,35 +93,28 @@ ul.nav :padding 0 :margin 0 :width 200px - - :margin-top 300px + :top 100px + :font + :size 130% li :display block :padding 5px 10px - :background #F2F8FC + :background + :color #F2F8FC :border 1px solid #fff - li:hover - a - :color #666 - - a - :border - :bottom none - :color #B1CFE3 - &:hover - :color #000 - - > li:first-child - :border-top-right-radius 5px - :border-top-left-radius 5px - > li:last-child - :border-bottom-right-radius 5px - :border-bottom-left-radius 5px + &:first-child + :border-top-right-radius 5px + :border-top-left-radius 5px + &:last-child + :border-bottom-right-radius 5px + :border-bottom-left-radius 5px + a + :color #B1CFE3 #header_below :z-index 5 @@ -144,15 +134,17 @@ ul.nav :border-radius 5px #content - :margin-left 210px + :position absolute + :left 250px + :top 94px + :width 60% + :min-width 500px + :max-width 700px ul#stream :margin 0 :padding 0 :color #666 - :width 60% - :min-width 500px - :max-width 700px > li :list-style none @@ -187,14 +179,16 @@ h1 p.description, span.description :font - :weight normal - :family 'lucida grande' + :weight 200 + :family 'helvetica neue', 'lucida grande', 'sans-serif' :color #999 + :padding 0.1em - .big_number - :font - :size 300% - :line-height 100% +.big_number + :font + :weight bold + :size 500% + :line-height 100% h3 :position relative @@ -214,7 +208,7 @@ h3 form :font - :size 430% + :size 130% :margin 1em :margin-left 0em @@ -229,3 +223,6 @@ form :color #000 &:hover :color #CC1E14 + :background + :color rgba( 255, 255, 255, 0.5) + -- GitLab