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) post.aspect_ids.include?(a.id)
end end
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={} def aspect_links aspects, opts={}
str = "" str = ""
aspects.each do |a| aspects.each do |a|

View file

@ -3,15 +3,15 @@
.from .from
%h2 %h2
= person.name = person.name
- if current_user.owns?(post)
.aspect - if post.public?
%span.arrow
%ul %span.aspect_badge.public
- if post.public? =t('the_world')
=t('the_world')
- else - elsif current_user.owns?(post)
- for aspect in post.aspects %span.arrow ➔
%li= link_to aspect.name, aspect =aspect_badge(aspects_with_post(post.aspects, post))
#person_nav_links #person_nav_links
= link_to t('layouts.header.view_profile'), person_path(person) = 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 -# licensed under the Affero General Public License version 3 or later. See
-# the COPYRIGHT file. -# the COPYRIGHT file.
%li.message{:data=>{:guid=>post.id}, :class => ('public' if post.public?)} %li.message{:data=>{:guid=>post.id}}
=person_image_link(person) =person_image_link(person)
.public_badge
- if post.public?
= image_tag 'icons/globe.png', :title => "public post"
.content .content
.from .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 %h4
=person_link(person) =person_link(person)
- if person.owner_id == current_user.id - if post.public?
.aspect %span.arrow ➔
%span.aspect_badge.public
%ul = t('the_world')
- if post.public?
%li= t('the_world') - elsif person.owner_id == current_user.id
- else %span.arrow ➔
=aspect_links(aspects_with_post(aspects, post)) =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 = render 'status_messages/status_message', :post => post, :photos => photos

View file

@ -12,7 +12,7 @@ a
:text :text
:decoration none :decoration none
&:hover &:hover
:color #22AAE0 :color #4CCAE0
&:active &:active
:color #005D9C :color #005D9C
@ -247,36 +247,17 @@ header
.from .from
:text :text
:shadow 0 1px #fff :shadow 0 1px #fff
h4
.aspect
:cursor default
:display inline :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 a
:font :font
:weight bold :weight bold
.arrow
:color #ccc
:font
:weight lighter
#author_info #author_info
:position relative :position relative
:margin :margin
@ -302,12 +283,6 @@ header
:margin :margin
:bottom -2px :bottom -2px
.aspect
ul > li a
:font
:weight 200
#person_nav_links #person_nav_links
a a
:margin :margin
@ -1398,7 +1373,6 @@ ul.aspects
:background :background
:color #fafafa :color #fafafa
.right .right
:top 12px :top 12px
:right 12px :right 12px
@ -1969,20 +1943,6 @@ h3,h4
:font :font
:size 12px :size 12px
.stream
.public_badge
:position absolute
:top 60px
:left 25px
.message.public
:background
:color #FEFFF0
&:hover
:background
:color #FEFFE3
#already_invited_pane #already_invited_pane
h4 h4
:color #666 :color #666
@ -1995,3 +1955,51 @@ h3,h4
.term .term
:font :font
:weight bold :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