added dumb partial switcher function in dashboard controller
This commit is contained in:
parent
26d675af11
commit
06271d5821
12 changed files with 127 additions and 124 deletions
|
|
@ -4,8 +4,7 @@ class DashboardController < ApplicationController
|
||||||
include ApplicationHelper
|
include ApplicationHelper
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@bookmarks = Bookmark.all
|
@posts = Post.all
|
||||||
@messages = StatusMessage.all
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
module DashboardHelper
|
module DashboardHelper
|
||||||
|
|
||||||
|
def type_partial(post)
|
||||||
|
class_name = post.class.name.to_s.underscore
|
||||||
|
"#{class_name.pluralize}/pane"
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
11
app/views/blogs/_pane.html.haml
Normal file
11
app/views/blogs/_pane.html.haml
Normal 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"
|
||||||
|
|
||||||
|
|
@ -1,17 +1,5 @@
|
||||||
- title "Blogs"
|
%h1= link_to "new blog", new_blog_path
|
||||||
|
|
||||||
%table
|
%ul#stream
|
||||||
%tr
|
|
||||||
%th Title
|
|
||||||
%th Body
|
|
||||||
%th Owner
|
|
||||||
- for blog in @blogs
|
- for blog in @blogs
|
||||||
%tr
|
= render "pane", :post => blog
|
||||||
%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
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
%li.message
|
%li.message
|
||||||
%span.from= link_to post.owner, "#"
|
%span.from
|
||||||
%b shared a link
|
= link_to post.owner, "#"
|
||||||
%br
|
%b shared a link
|
||||||
|
%br
|
||||||
= post.title
|
= post.title
|
||||||
= link_to post.link
|
= link_to post.link
|
||||||
%div.time= "#{time_ago_in_words(post.updated_at)} ago"
|
%div.time= "#{time_ago_in_words(post.updated_at)} ago"
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,4 @@
|
||||||
- title "Bookmarks"
|
%h1= link_to "new bookmark", new_bookmark_path
|
||||||
|
|
||||||
%h1
|
|
||||||
%p.description= link_to "New Bookmark", new_bookmark_path
|
|
||||||
|
|
||||||
%ul#stream
|
%ul#stream
|
||||||
- for bookmark in @bookmarks
|
- for bookmark in @bookmarks
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
%h3 home
|
%h1 your network stream
|
||||||
%ul#stream
|
%ul#stream
|
||||||
- for post in @messages
|
- for post in @posts
|
||||||
= render "status_messages/pane", :post => post
|
= render type_partial(post), :post => post
|
||||||
= render "status_messages/pane", :post => post
|
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,6 @@
|
||||||
= csrf_meta_tag
|
= csrf_meta_tag
|
||||||
= yield(:head)
|
= yield(:head)
|
||||||
|
|
||||||
|
|
||||||
:javascript
|
:javascript
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
$('a').hover(function(){
|
$('a').hover(function(){
|
||||||
|
|
@ -22,6 +21,11 @@
|
||||||
}, function(){
|
}, function(){
|
||||||
$(this).fadeTo(80, 1);
|
$(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
|
#session_action
|
||||||
- if user_signed_in?
|
- if user_signed_in?
|
||||||
= link_to User.first.email, destroy_user_session_path
|
=User.first.email
|
||||||
|
|
|
||||||
|
= link_to "logout", destroy_user_session_path
|
||||||
- else
|
- else
|
||||||
= link_to "login", new_user_session_path
|
= link_to "login", new_user_session_path
|
||||||
|
|
||||||
|
|
@ -40,25 +46,28 @@
|
||||||
- if user_signed_in?
|
- if user_signed_in?
|
||||||
%h1#user_name
|
%h1#user_name
|
||||||
= link_to User.first.email, root_url
|
= link_to User.first.email, root_url
|
||||||
%span.description= StatusMessage.my_newest.message
|
%span.description
|
||||||
|
- if StatusMessage.my_newest
|
||||||
|
= StatusMessage.my_newest.message
|
||||||
%img{:src => '/images/mocks/bp.jpeg'}
|
|
||||||
|
|
||||||
%nav
|
%nav
|
||||||
%ul.nav
|
%ul.nav
|
||||||
%li= link_to "home", root_path
|
%a{ :href => root_path, :title => "Your network stream."}
|
||||||
%li= link_to "users", users_path
|
%li home
|
||||||
%li= link_to "status messages", status_messages_path
|
%a{ :href => users_path, :title => "Registered users on your seed."}
|
||||||
%li= link_to "bookmarks", bookmarks_path
|
%li users
|
||||||
%li= link_to "blogs", blogs_path
|
%a{ :href => status_messages_path, :title => "Recent status messages."}
|
||||||
%li= link_to "friends", friends_path
|
%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|
|
- flash.each do |name, msg|
|
||||||
= content_tag :div, msg, :id => "flash_#{name}"
|
= content_tag :div, msg, :id => "flash_#{name}"
|
||||||
%br
|
|
||||||
%br
|
|
||||||
%br
|
|
||||||
%br
|
|
||||||
#content
|
#content
|
||||||
= yield
|
= yield
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
%li.message
|
%li.message
|
||||||
%span.from
|
%span.from
|
||||||
= link_to post.owner, "#"
|
= link_to post.owner, "#"
|
||||||
= post.message
|
= post.message
|
||||||
%div.time
|
%div.time
|
||||||
= "#{time_ago_in_words(post.updated_at)} ago"
|
= "#{time_ago_in_words(post.updated_at)} ago"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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
|
%ul#stream
|
||||||
- for status_message in @status_messages
|
- for status_message in @status_messages
|
||||||
= render "pane", :post => status_message
|
= render "pane", :post => status_message
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ a {
|
||||||
|
|
||||||
header {
|
header {
|
||||||
z-index: 10;
|
z-index: 10;
|
||||||
position: absolute;
|
position: fixed;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
margin-top: -2em;
|
margin-top: -2em;
|
||||||
margin-right: -2em;
|
margin-right: -2em;
|
||||||
|
|
@ -58,48 +58,42 @@ header {
|
||||||
height: 30px;
|
height: 30px;
|
||||||
color: white;
|
color: white;
|
||||||
background-color: #1a1a21;
|
background-color: #1a1a21;
|
||||||
border-bottom: 2px solid white;
|
border-bottom: 2px solid #f2f8fc;
|
||||||
padding-top: 5px; }
|
padding-top: 5px; }
|
||||||
header #diaspora_text {
|
header #diaspora_text {
|
||||||
position: absolute;
|
position: fixed;
|
||||||
border: none;
|
border: none;
|
||||||
top: 8px;
|
top: 8px;
|
||||||
left: 1em; }
|
left: 1em; }
|
||||||
header #session_action {
|
header #session_action {
|
||||||
position: absolute;
|
position: fixed;
|
||||||
right: 1em;
|
right: 1em;
|
||||||
font-size: 120%;
|
font-size: 120%;
|
||||||
margin-top: 2px; }
|
top: 7px; }
|
||||||
header #session_action a {
|
header #session_action a {
|
||||||
color: #cccccc;
|
color: #cccccc;
|
||||||
border: none; }
|
border: none; }
|
||||||
header #session_action a:hover {
|
|
||||||
color: white; }
|
|
||||||
|
|
||||||
ul.nav {
|
ul.nav {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
width: 200px;
|
width: 200px;
|
||||||
margin-top: 300px; }
|
top: 100px;
|
||||||
|
font-size: 130%; }
|
||||||
ul.nav li {
|
ul.nav li {
|
||||||
display: block;
|
display: block;
|
||||||
padding: 5px 10px;
|
padding: 5px 10px;
|
||||||
background: #f2f8fc;
|
background-color: #f2f8fc;
|
||||||
border: 1px solid white; }
|
border: 1px solid white; }
|
||||||
ul.nav li:hover a {
|
ul.nav li:first-child {
|
||||||
color: #666666; }
|
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 {
|
ul.nav a {
|
||||||
border-bottom: none;
|
|
||||||
color: #b1cfe3; }
|
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 {
|
#header_below {
|
||||||
z-index: 5;
|
z-index: 5;
|
||||||
|
|
@ -117,15 +111,17 @@ ul.nav {
|
||||||
border-radius: 5px; }
|
border-radius: 5px; }
|
||||||
|
|
||||||
#content {
|
#content {
|
||||||
margin-left: 210px; }
|
position: absolute;
|
||||||
|
left: 250px;
|
||||||
|
top: 94px;
|
||||||
|
width: 60%;
|
||||||
|
min-width: 500px;
|
||||||
|
max-width: 700px; }
|
||||||
|
|
||||||
ul#stream {
|
ul#stream {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
color: #666666;
|
color: #666666; }
|
||||||
width: 60%;
|
|
||||||
min-width: 500px;
|
|
||||||
max-width: 700px; }
|
|
||||||
ul#stream > li {
|
ul#stream > li {
|
||||||
list-style: none;
|
list-style: none;
|
||||||
padding: 1em;
|
padding: 1em;
|
||||||
|
|
@ -150,12 +146,15 @@ h1 {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
line-height: 36px; }
|
line-height: 36px; }
|
||||||
h1 p.description, h1 span.description {
|
h1 p.description, h1 span.description {
|
||||||
font-weight: normal;
|
font-weight: 200;
|
||||||
font-family: "lucida grande";
|
font-family: "helvetica neue", "lucida grande", "sans-serif";
|
||||||
color: #999999; }
|
color: #999999;
|
||||||
h1 .big_number {
|
padding: 0.1em; }
|
||||||
font-size: 300%;
|
|
||||||
line-height: 100%; }
|
.big_number {
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 500%;
|
||||||
|
line-height: 100%; }
|
||||||
|
|
||||||
h3 {
|
h3 {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
@ -170,7 +169,7 @@ h3 {
|
||||||
margin-bottom: 1em; }
|
margin-bottom: 1em; }
|
||||||
|
|
||||||
form {
|
form {
|
||||||
font-size: 430%;
|
font-size: 130%;
|
||||||
margin: 1em;
|
margin: 1em;
|
||||||
margin-left: 0em; }
|
margin-left: 0em; }
|
||||||
form input {
|
form input {
|
||||||
|
|
@ -178,7 +177,9 @@ form {
|
||||||
padding: 0.2em;
|
padding: 0.2em;
|
||||||
max-width: 100%; }
|
max-width: 100%; }
|
||||||
|
|
||||||
#user_name a {
|
#user_name {
|
||||||
color: black; }
|
background-color: rgba(255, 255, 255, 0.5); }
|
||||||
#user_name a:hover {
|
#user_name a {
|
||||||
color: #cc1e14; }
|
color: black; }
|
||||||
|
#user_name a:hover {
|
||||||
|
color: #cc1e14; }
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ a
|
||||||
header
|
header
|
||||||
:z-index 10
|
:z-index 10
|
||||||
|
|
||||||
:position absolute
|
:position fixed
|
||||||
:width 100%
|
:width 100%
|
||||||
|
|
||||||
:margin
|
:margin
|
||||||
|
|
@ -67,28 +67,25 @@ header
|
||||||
:background
|
:background
|
||||||
:color #1A1A21
|
:color #1A1A21
|
||||||
:border
|
:border
|
||||||
:bottom 2px solid #fff
|
:bottom 2px solid #F2F8FC
|
||||||
:padding
|
:padding
|
||||||
:top 5px
|
:top 5px
|
||||||
|
|
||||||
#diaspora_text
|
#diaspora_text
|
||||||
:position absolute
|
:position fixed
|
||||||
:border none
|
:border none
|
||||||
:top 8px
|
:top 8px
|
||||||
:left 1em
|
:left 1em
|
||||||
|
|
||||||
#session_action
|
#session_action
|
||||||
:position absolute
|
:position fixed
|
||||||
:right 1em
|
:right 1em
|
||||||
:font
|
:font
|
||||||
:size 120%
|
:size 120%
|
||||||
:margin
|
:top 7px
|
||||||
:top 2px
|
|
||||||
a
|
a
|
||||||
:color #ccc
|
:color #ccc
|
||||||
:border none
|
:border none
|
||||||
&:hover
|
|
||||||
:color #fff
|
|
||||||
|
|
||||||
|
|
||||||
ul.nav
|
ul.nav
|
||||||
|
|
@ -96,35 +93,28 @@ ul.nav
|
||||||
:padding 0
|
:padding 0
|
||||||
:margin 0
|
:margin 0
|
||||||
:width 200px
|
:width 200px
|
||||||
|
:top 100px
|
||||||
:margin-top 300px
|
:font
|
||||||
|
:size 130%
|
||||||
|
|
||||||
li
|
li
|
||||||
:display block
|
:display block
|
||||||
:padding 5px 10px
|
:padding 5px 10px
|
||||||
:background #F2F8FC
|
:background
|
||||||
|
:color #F2F8FC
|
||||||
:border 1px solid #fff
|
:border 1px solid #fff
|
||||||
|
|
||||||
li:hover
|
|
||||||
a
|
&:first-child
|
||||||
:color #666
|
:border-top-right-radius 5px
|
||||||
|
:border-top-left-radius 5px
|
||||||
|
|
||||||
|
&:last-child
|
||||||
|
:border-bottom-right-radius 5px
|
||||||
|
:border-bottom-left-radius 5px
|
||||||
|
|
||||||
a
|
a
|
||||||
:border
|
|
||||||
:bottom none
|
|
||||||
:color #B1CFE3
|
: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
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#header_below
|
#header_below
|
||||||
:z-index 5
|
:z-index 5
|
||||||
|
|
@ -144,15 +134,17 @@ ul.nav
|
||||||
:border-radius 5px
|
:border-radius 5px
|
||||||
|
|
||||||
#content
|
#content
|
||||||
:margin-left 210px
|
:position absolute
|
||||||
|
:left 250px
|
||||||
|
:top 94px
|
||||||
|
:width 60%
|
||||||
|
:min-width 500px
|
||||||
|
:max-width 700px
|
||||||
|
|
||||||
ul#stream
|
ul#stream
|
||||||
:margin 0
|
:margin 0
|
||||||
:padding 0
|
:padding 0
|
||||||
:color #666
|
:color #666
|
||||||
:width 60%
|
|
||||||
:min-width 500px
|
|
||||||
:max-width 700px
|
|
||||||
|
|
||||||
> li
|
> li
|
||||||
:list-style none
|
:list-style none
|
||||||
|
|
@ -187,14 +179,16 @@ h1
|
||||||
|
|
||||||
p.description, span.description
|
p.description, span.description
|
||||||
:font
|
:font
|
||||||
:weight normal
|
:weight 200
|
||||||
:family 'lucida grande'
|
:family 'helvetica neue', 'lucida grande', 'sans-serif'
|
||||||
:color #999
|
:color #999
|
||||||
|
:padding 0.1em
|
||||||
|
|
||||||
.big_number
|
.big_number
|
||||||
:font
|
:font
|
||||||
:size 300%
|
:weight bold
|
||||||
:line-height 100%
|
:size 500%
|
||||||
|
:line-height 100%
|
||||||
|
|
||||||
h3
|
h3
|
||||||
:position relative
|
:position relative
|
||||||
|
|
@ -214,7 +208,7 @@ h3
|
||||||
|
|
||||||
form
|
form
|
||||||
:font
|
:font
|
||||||
:size 430%
|
:size 130%
|
||||||
:margin 1em
|
:margin 1em
|
||||||
:margin-left 0em
|
:margin-left 0em
|
||||||
|
|
||||||
|
|
@ -229,3 +223,6 @@ form
|
||||||
:color #000
|
:color #000
|
||||||
&:hover
|
&:hover
|
||||||
:color #CC1E14
|
:color #CC1E14
|
||||||
|
:background
|
||||||
|
:color rgba( 255, 255, 255, 0.5)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue