added dumb partial switcher function in dashboard controller

This commit is contained in:
danielvincent 2010-06-21 14:03:03 -07:00
parent 26d675af11
commit 06271d5821
12 changed files with 127 additions and 124 deletions

View file

@ -4,8 +4,7 @@ class DashboardController < ApplicationController
include ApplicationHelper
def index
@bookmarks = Bookmark.all
@messages = StatusMessage.all
@posts = Post.all
end

View file

@ -1,7 +1,8 @@
module DashboardHelper
def type_partial(post)
class_name = post.class.name.to_s.underscore
"#{class_name.pluralize}/pane"
end
end

View file

@ -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"

View file

@ -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

View file

@ -1,5 +1,6 @@
%li.message
%span.from= link_to post.owner, "#"
%span.from
= link_to post.owner, "#"
%b shared a link
%br
= post.title

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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 a {
border-bottom: none;
color: #b1cfe3; }
ul.nav a:hover {
color: black; }
ul.nav > li:first-child {
ul.nav li:first-child {
border-top-right-radius: 5px;
border-top-left-radius: 5px; }
ul.nav > li:last-child {
ul.nav li:last-child {
border-bottom-right-radius: 5px;
border-bottom-left-radius: 5px; }
ul.nav a {
color: #b1cfe3; }
#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,11 +146,14 @@ 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%;
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 {
@ -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 {
#user_name {
background-color: rgba(255, 255, 255, 0.5); }
#user_name a {
color: black; }
#user_name a:hover {
color: #cc1e14; }

View file

@ -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
&:first-child
:border-top-right-radius 5px
:border-top-left-radius 5px
> li:last-child
&: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,13 +179,15 @@ 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
.big_number
:font
:size 300%
:weight bold
:size 500%
:line-height 100%
h3
@ -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)