badges on stream elements. say 'all aspects' instead of listing out all user's aspect names

This commit is contained in:
danielvincent 2010-12-11 20:27:07 -08:00
parent 91c331d630
commit b4170dc991
4 changed files with 90 additions and 76 deletions

View file

@ -29,6 +29,16 @@ module ApplicationHelper
post.aspect_ids.include?(a.id)
end
end
def aspect_badge aspects
str = ''
if aspects.count > 1
str = "<span class='aspect_badge all'>All aspects</span>"
elsif aspects.count == 1
aspect = aspects.first
str = "<span class='aspect_badge single'><a href=#{aspect_path(aspect)}>#{aspect.name}</a></span>"
end
str.html_safe
end
def aspect_links aspects, opts={}
str = ""
aspects.each do |a|

View file

@ -3,15 +3,15 @@
.from
%h2
= person.name
- if current_user.owns?(post)
.aspect
%ul
- if post.public?
=t('the_world')
- else
- for aspect in post.aspects
%li= link_to aspect.name, aspect
- if post.public?
%span.arrow
%span.aspect_badge.public
=t('the_world')
- elsif current_user.owns?(post)
%span.arrow ➔
=aspect_badge(aspects_with_post(post.aspects, post))
#person_nav_links
= link_to t('layouts.header.view_profile'), person_path(person)

View file

@ -2,32 +2,28 @@
-# licensed under the Affero General Public License version 3 or later. See
-# the COPYRIGHT file.
%li.message{:data=>{:guid=>post.id}, :class => ('public' if post.public?)}
%li.message{:data=>{:guid=>post.id}}
=person_image_link(person)
.public_badge
- if post.public?
= image_tag 'icons/globe.png', :title => "public post"
.content
.from
.right
- reshare_aspects = aspects_without_post(aspects, post)
- unless reshare_aspects.empty?
= render 'shared/reshare', :aspects => reshare_aspects, :post => post
= link_to t('delete'), status_message_path(post), :confirm => t('are_you_sure'), :method => :delete, :remote => true, :class => "delete"
%h4
=person_link(person)
- if person.owner_id == current_user.id
.aspect
%ul
- if post.public?
%li= t('the_world')
- else
=aspect_links(aspects_with_post(aspects, post))
- if post.public?
%span.arrow ➔
%span.aspect_badge.public
= t('the_world')
- elsif person.owner_id == current_user.id
%span.arrow ➔
=aspect_badge(aspects_with_post(aspects, post))
.right
- reshare_aspects = aspects_without_post(aspects, post)
- unless reshare_aspects.empty?
= render 'shared/reshare', :aspects => reshare_aspects, :post => post
= link_to t('delete'), status_message_path(post), :confirm => t('are_you_sure'), :method => :delete, :remote => true, :class => "delete"
= render 'status_messages/status_message', :post => post, :photos => photos

View file

@ -12,7 +12,7 @@ a
:text
:decoration none
&:hover
:color #22AAE0
:color #4CCAE0
&:active
:color #005D9C
@ -247,36 +247,17 @@ header
.from
:text
:shadow 0 1px #fff
.aspect
:cursor default
h4
:display inline
:color #bbb
a
:font
:weight normal
:color #bbb
&:hover
:text
:decoration underline
&:active
:color #999
ul
:display inline
:margin 0
:padding 0
li
:display inline
&:after
:content ","
&:last-child:after
:content ""
a
:font
:weight bold
.arrow
:color #ccc
:font
:weight lighter
#author_info
:position relative
:margin
@ -302,12 +283,6 @@ header
:margin
:bottom -2px
.aspect
ul > li a
:font
:weight 200
#person_nav_links
a
:margin
@ -1398,7 +1373,6 @@ ul.aspects
:background
:color #fafafa
.right
:top 12px
:right 12px
@ -1969,20 +1943,6 @@ h3,h4
:font
:size 12px
.stream
.public_badge
:position absolute
:top 60px
:left 25px
.message.public
:background
:color #FEFFF0
&:hover
:background
:color #FEFFE3
#already_invited_pane
h4
:color #666
@ -1995,3 +1955,51 @@ h3,h4
.term
:font
:weight bold
.aspect_badge
:color #fff
:line-height auto
:padding 0 4px
:-webkit-border-radius 3px
:-moz-border-radius 3px
:border-radius 3px
:display inline-block
:font
:size smaller
:weight normal
:text
:shadow none
:cursor default
a
:color #fff
:font
:weight normal
&:hover
:color #eee
.aspect_badge.public
:background
:color #C0E76C
.aspect_badge.single
:background
:color #999
.aspect_badge.all
:background
:color #ccc
.stream
.arrow,
.aspect_badge
:position relative
.arrow
:top -0.1em
.aspect_badge
:top -0.2em