Merge branch 'group-top' of github.com:diaspora/diaspora_rails into friend-refactor
This commit is contained in:
commit
02f66d4c0e
21 changed files with 358 additions and 105 deletions
|
|
@ -16,6 +16,7 @@ class ApplicationController < ActionController::Base
|
|||
end
|
||||
|
||||
def set_friends_and_status
|
||||
@groups = current_user.groups
|
||||
@friends = current_user.friends if current_user
|
||||
@latest_status_message = StatusMessage.newest_for(current_user) if current_user
|
||||
end
|
||||
|
|
|
|||
44
app/controllers/groups_controller.rb
Normal file
44
app/controllers/groups_controller.rb
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
class GroupsController < ApplicationController
|
||||
before_filter :authenticate_user!
|
||||
|
||||
def create
|
||||
@group = current_user.group(params[:group])
|
||||
|
||||
if @group.created_at
|
||||
flash[:notice] = "Successfully created group."
|
||||
redirect_to root_url
|
||||
else
|
||||
render :action => 'new'
|
||||
end
|
||||
end
|
||||
|
||||
def new
|
||||
@group = Group.new
|
||||
end
|
||||
|
||||
def destroy
|
||||
@group = Group.first(:id => params[:id])
|
||||
@group.destroy
|
||||
flash[:notice] = "Successfully destroyed group."
|
||||
redirect_to groups_url
|
||||
end
|
||||
|
||||
def show
|
||||
@group = Group.first(:id => params[:id])
|
||||
end
|
||||
|
||||
def edit
|
||||
@group = Group.first(:id => params[:id])
|
||||
end
|
||||
|
||||
def update
|
||||
@group = Group.first(:id => params[:id])
|
||||
if @group.update_attributes(params[:group])
|
||||
flash[:notice] = "Successfully updated group."
|
||||
redirect_to @group
|
||||
else
|
||||
render :action => 'edit'
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
12
app/models/group.rb
Normal file
12
app/models/group.rb
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
class Group
|
||||
include MongoMapper::Document
|
||||
|
||||
key :name, String
|
||||
|
||||
many :people, :class_name => 'Person'
|
||||
belongs_to :user, :class_name => 'User'
|
||||
|
||||
timestamps!
|
||||
|
||||
end
|
||||
|
||||
|
|
@ -12,6 +12,8 @@ class User
|
|||
many :friends, :in => :friend_ids, :class_name => 'Person'
|
||||
many :pending_friends, :in => :pending_friend_ids, :class_name => 'Person'
|
||||
|
||||
many :groups, :class_name => 'Group'
|
||||
|
||||
before_validation_on_create :assign_key
|
||||
before_validation :do_bad_things
|
||||
|
||||
|
|
@ -28,9 +30,14 @@ class User
|
|||
"#{person.profile.first_name.to_s} #{person.profile.last_name.to_s}"
|
||||
end
|
||||
|
||||
######### Groups ######################
|
||||
|
||||
def group( opts = {} )
|
||||
opts[:user] = self
|
||||
Group.create(opts)
|
||||
end
|
||||
|
||||
######### Friend Requesting
|
||||
######### Friend Requesting ###########
|
||||
def send_friend_request_to(friend_url)
|
||||
unless self.friends.find{ |x| x.url == friend_url}
|
||||
p = Request.instantiate(:to => friend_url, :from => self.person)
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
.back
|
||||
= link_to "⇧ home", root_path
|
||||
Albums
|
||||
.button.right#add_album_button
|
||||
= link_to 'New Album', "#"
|
||||
.right#add_album_button
|
||||
= link_to 'New Album', "#", :class => "button"
|
||||
|
||||
#add_album_box.contextual_pane
|
||||
= render "albums/new_album"
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
#content_bottom
|
||||
.back
|
||||
= link_to "⇧ albums", albums_path
|
||||
|
||||
-if current_user.owns? @album
|
||||
.button.right
|
||||
= link_to 'Edit Album', edit_album_path(@album)
|
||||
|
|
|
|||
6
app/views/groups/_new_group.haml
Normal file
6
app/views/groups/_new_group.haml
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
= form_for Group.new do |f|
|
||||
= f.error_messages
|
||||
%p
|
||||
= f.label :name
|
||||
= f.text_field :name
|
||||
= f.submit 'create', :class => 'button'
|
||||
25
app/views/groups/edit.html.haml
Normal file
25
app/views/groups/edit.html.haml
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
%h1.big_text
|
||||
.back
|
||||
= link_to "⇧ #{@group.name}", @group
|
||||
|
||||
= "Editing #{@group.name}"
|
||||
|
||||
.sub_header
|
||||
="updated #{how_long_ago(@group)}"
|
||||
|
||||
- form_for @group do |a|
|
||||
= a.error_messages
|
||||
%p
|
||||
= a.text_field :name
|
||||
|
||||
#submit_block
|
||||
= link_to "Cancel", root_path
|
||||
or
|
||||
= a.submit
|
||||
|
||||
.button.delete
|
||||
= link_to 'Delete Album', @group, :confirm => 'Are you sure?', :method => :delete
|
||||
|
||||
#content_bottom
|
||||
.back
|
||||
= link_to "⇧ #{@group.name}", @group
|
||||
14
app/views/groups/new.html.haml
Normal file
14
app/views/groups/new.html.haml
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
%h1.big_text
|
||||
=link_to 'groups', groups_path
|
||||
>>
|
||||
new group
|
||||
|
||||
= form_for @group do |f|
|
||||
= f.error_messages
|
||||
%p
|
||||
= f.label :name
|
||||
= f.text_field :name
|
||||
%p
|
||||
= f.submit
|
||||
|
||||
%p= link_to "Back to List", groups_path
|
||||
|
|
@ -10,9 +10,8 @@
|
|||
= stylesheet_link_tag "application", "ui", 'bubble'
|
||||
/= javascript_include_tag "http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"
|
||||
= javascript_include_tag 'jquery142', 'rails', 'google'
|
||||
= javascript_include_tag 'tiny_mce/tiny_mce', 'jquery.infieldlabel'
|
||||
= javascript_include_tag 'jquery.cycle/jquery.cycle.min.js'
|
||||
= javascript_include_tag 'view', 'publisher', 'image_picker'
|
||||
= javascript_include_tag 'tiny_mce/tiny_mce', 'jquery.infieldlabel', 'jquery.cycle/jquery.cycle.min.js'
|
||||
= javascript_include_tag 'view', 'publisher', 'image_picker', 'group_nav'
|
||||
= render 'js/websocket_js'
|
||||
|
||||
= csrf_meta_tag
|
||||
|
|
@ -42,6 +41,9 @@
|
|||
- else
|
||||
= link_to "login", new_user_session_path
|
||||
|
||||
= render "shared/group_nav"
|
||||
|
||||
|
||||
.container
|
||||
- if user_signed_in?
|
||||
#user_name
|
||||
|
|
@ -62,12 +64,6 @@
|
|||
|
||||
.container
|
||||
.span-24.last
|
||||
.span-20.append-1.last
|
||||
|
||||
= yield
|
||||
|
||||
.span-3.last
|
||||
= render 'people/sidebar' if user_signed_in?
|
||||
|
||||
.span-24.last
|
||||
= render "posts/debug"
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@
|
|||
= link_to "⇧ #{@album.name}", album_path(@album)
|
||||
= @photo.image
|
||||
|
||||
.button.right
|
||||
= link_to 'Edit Photo', edit_photo_path(@photo)
|
||||
.right
|
||||
= link_to 'Edit Photo', edit_photo_path(@photo), :class => "button"
|
||||
|
||||
.sub_header
|
||||
= link_to "full size", @photo.image.url
|
||||
|
|
@ -25,6 +25,7 @@
|
|||
#content_bottom
|
||||
.back
|
||||
= link_to "⇧ #{@album.name}", album_path(@album)
|
||||
|
||||
-if current_user.owns? @album
|
||||
.button.right
|
||||
= link_to 'Delete Photo', @photo, :confirm => 'Are you sure?', :method => :delete
|
||||
|
|
|
|||
13
app/views/shared/_group_nav.haml
Normal file
13
app/views/shared/_group_nav.haml
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
#group
|
||||
%ul
|
||||
- for group in @groups
|
||||
%li= link_to group.name, group_path(group)
|
||||
|
||||
%li.new_group= link_to "NEW GROUP", new_group_path
|
||||
|
||||
#friend_pictures
|
||||
- for friend in @friends
|
||||
= person_image_link(friend)
|
||||
|
||||
.add_new
|
||||
= link_to "+", requests_path
|
||||
|
|
@ -14,4 +14,4 @@
|
|||
|
||||
- if current_user.owns?(post)
|
||||
.destroy_link
|
||||
= link_to 'Delete', status_message_path(post), :confirm => 'Are you sure?', :method => :delete, :remote => true
|
||||
= link_to 'Delete', status_message_path(post), :confirm => 'Are you sure?', :method => :delete, :remote => true, :class => "delete"
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ Diaspora::Application.routes.draw do |map|
|
|||
resources :requests
|
||||
resources :photos
|
||||
resources :albums
|
||||
resources :groups
|
||||
|
||||
match "/images/files/*path" => "gridfs#serve"
|
||||
|
||||
|
|
|
|||
16
public/javascripts/group_nav.js
Normal file
16
public/javascripts/group_nav.js
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
$(document).ready( function() {
|
||||
|
||||
var vars = [], hash;
|
||||
var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
|
||||
for(var i = 0; i < hashes.length; i++)
|
||||
{
|
||||
hash = hashes[i].split('=');
|
||||
vars.push(hash[0]);
|
||||
vars[hash[0]] = hash[1];
|
||||
}
|
||||
|
||||
$("."+vars['g']).addClass('selected');
|
||||
|
||||
$("#group img").load(function(){$(this).fadeIn("slow");});
|
||||
|
||||
});
|
||||
|
|
@ -23,14 +23,6 @@ $(document).ready(function(){
|
|||
};
|
||||
});
|
||||
|
||||
$('a').hover(function(){
|
||||
if( $(this).children("img").length < 1 )
|
||||
$(this).fadeTo(60, 0.5);
|
||||
}, function(){
|
||||
if( $(this).children("img").length < 1 )
|
||||
$(this).fadeTo(80, 1);
|
||||
});
|
||||
|
||||
$('#debug_info').click(function() {
|
||||
$('#debug_more').toggle('fast', function() {
|
||||
|
||||
|
|
@ -115,5 +107,8 @@ $(document).ready(function(){
|
|||
$(this).fadeIn("slow");
|
||||
});
|
||||
|
||||
$(".delete").hover(function(){
|
||||
$(this).toggleClass("button");
|
||||
});
|
||||
|
||||
});//end document ready
|
||||
|
|
|
|||
|
|
@ -12,10 +12,12 @@ body {
|
|||
|
||||
a {
|
||||
color: #018790;
|
||||
text-decoration: none;
|
||||
font-weight: bold; }
|
||||
color: #556270;
|
||||
text-decoration: none; }
|
||||
a:hover {
|
||||
color: #018790; }
|
||||
color: white;
|
||||
background-color: #018790;
|
||||
background-color: #556270; }
|
||||
|
||||
#flash_notice,
|
||||
#flash_error,
|
||||
|
|
@ -67,24 +69,24 @@ header {
|
|||
margin-bottom: 30px;
|
||||
color: #555555;
|
||||
background-color: #2b2726;
|
||||
background-color: black;
|
||||
background-color: white;
|
||||
border-bottom: 3px solid #333333;
|
||||
padding: 6px 0;
|
||||
padding-top: 0; }
|
||||
header #diaspora_text {
|
||||
margin-bottom: 1em;
|
||||
font-family: "BrandonGrotesqueLightRegular";
|
||||
font-size: 24px;
|
||||
position: absolute;
|
||||
font-size: 16px;
|
||||
border: none;
|
||||
color: white;
|
||||
text-shadow: 0 2px 0 black; }
|
||||
header #diaspora_text a {
|
||||
color: #666666; }
|
||||
header #diaspora_text span.sub_text {
|
||||
color: black;
|
||||
text-shadow: none; }
|
||||
header #session_action {
|
||||
float: right;
|
||||
margin-top: 9px;
|
||||
text-shadow: 0 1px 0 black;
|
||||
padding-right: 10px; }
|
||||
header #session_action a {
|
||||
|
|
@ -108,13 +110,12 @@ header {
|
|||
|
||||
ul#stream, ul#friend_stream {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
color: #666666; }
|
||||
padding: 0; }
|
||||
ul#stream > li, ul#friend_stream > li {
|
||||
list-style: none;
|
||||
padding: 15px 0;
|
||||
border-bottom: 1px solid #f1f1f1;
|
||||
margin-bottom: 5px; }
|
||||
margin-bottom: 5px;
|
||||
border-bottom: 1px solid #eeeeee; }
|
||||
|
||||
ul#friend_stream > li {
|
||||
padding: 0.2em 0; }
|
||||
|
|
@ -155,6 +156,7 @@ h3 {
|
|||
font-weight: bold; }
|
||||
|
||||
form {
|
||||
position: relative;
|
||||
font-size: 120%;
|
||||
margin: 1em;
|
||||
margin-left: 0em; }
|
||||
|
|
@ -300,7 +302,8 @@ label {
|
|||
color: #999999;
|
||||
position: absolute;
|
||||
top: 3px;
|
||||
left: 0.48em; }
|
||||
left: 0.48em;
|
||||
font-weight: normal; }
|
||||
|
||||
#publisher {
|
||||
background-color: rgba(10, 81, 109, 0.05);
|
||||
|
|
@ -375,7 +378,6 @@ ul#publisher_content_pickers li {
|
|||
h1.big_text {
|
||||
position: relative;
|
||||
line-height: auto;
|
||||
border-top: 2px solid #666666;
|
||||
border-bottom: 1px solid #666666;
|
||||
text-align: center; }
|
||||
|
||||
|
|
@ -385,7 +387,8 @@ h1.big_text {
|
|||
|
||||
.back {
|
||||
position: absolute;
|
||||
font-size: 12px; }
|
||||
font-size: 12px;
|
||||
font-weight: normal; }
|
||||
|
||||
#content_bottom {
|
||||
position: relative;
|
||||
|
|
@ -422,3 +425,37 @@ h1.big_text {
|
|||
|
||||
.image_cycle img {
|
||||
display: none; }
|
||||
|
||||
#group {
|
||||
color: #333333; }
|
||||
#group ul {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
font-size: 14px; }
|
||||
#group ul > li {
|
||||
display: inline;
|
||||
margin-right: 10px; }
|
||||
#group ul > li.selected, #group ul > li.selected a {
|
||||
color: white;
|
||||
color: black;
|
||||
font-weight: bold;
|
||||
font-size: 18px; }
|
||||
#group a {
|
||||
color: #333333;
|
||||
font-weight: normal; }
|
||||
#group #friend_pictures .add_new {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
height: 40px;
|
||||
width: 40px;
|
||||
background-color: #222222;
|
||||
text-align: center;
|
||||
font-size: 40px; }
|
||||
#group #friend_pictures .add_new a {
|
||||
display: block;
|
||||
position: absolute;
|
||||
top: -13px;
|
||||
left: 7px; }
|
||||
#group #friend_pictures img {
|
||||
display: none;
|
||||
height: 40px; }
|
||||
|
|
|
|||
|
|
@ -11,12 +11,14 @@ body
|
|||
:margin 0
|
||||
a
|
||||
:color #018790
|
||||
:color #556270
|
||||
:text
|
||||
:decoration none
|
||||
:font-weight bold
|
||||
&:hover
|
||||
:color #fff
|
||||
:background
|
||||
:color #018790
|
||||
|
||||
:color #556270
|
||||
|
||||
#flash_notice,
|
||||
#flash_error,
|
||||
|
|
@ -72,16 +74,19 @@ header
|
|||
:color #555
|
||||
:background
|
||||
:color #2B2726
|
||||
:color #000
|
||||
:color #fff
|
||||
:border
|
||||
:bottom 3px solid #333
|
||||
:padding 6px 0
|
||||
:top 0
|
||||
|
||||
#diaspora_text
|
||||
:margin
|
||||
:bottom 1em
|
||||
:font
|
||||
:family 'BrandonGrotesqueLightRegular'
|
||||
:size 24px
|
||||
:position absolute
|
||||
:size 16px
|
||||
:border none
|
||||
:color #fff
|
||||
:text
|
||||
|
|
@ -90,14 +95,11 @@ header
|
|||
:color #666
|
||||
|
||||
span.sub_text
|
||||
:color #000
|
||||
:text
|
||||
:shadow none
|
||||
|
||||
#session_action
|
||||
:float right
|
||||
:margin
|
||||
:top 9px
|
||||
:text-shadow 0 1px 0 #000
|
||||
a
|
||||
:color #777
|
||||
|
|
@ -121,13 +123,12 @@ header
|
|||
ul#stream, ul#friend_stream
|
||||
:margin 0
|
||||
:padding 0
|
||||
:color #666
|
||||
> li
|
||||
:list-style none
|
||||
:padding 15px 0
|
||||
:border
|
||||
:bottom 1px solid #f1f1f1
|
||||
:margin-bottom 5px
|
||||
:border
|
||||
:bottom 1px solid #eee
|
||||
|
||||
ul#friend_stream
|
||||
> li
|
||||
|
|
@ -181,11 +182,11 @@ h3
|
|||
:weight bold
|
||||
|
||||
form
|
||||
:position relative
|
||||
:font
|
||||
:size 120%
|
||||
:margin 1em
|
||||
:margin-left 0em
|
||||
|
||||
:left 0em
|
||||
|
||||
#user_name
|
||||
:margin
|
||||
|
|
@ -366,6 +367,8 @@ label
|
|||
:position absolute
|
||||
:top 3px
|
||||
:left 0.48em
|
||||
:font
|
||||
:weight normal
|
||||
|
||||
#publisher
|
||||
:background
|
||||
|
|
@ -465,7 +468,7 @@ h1.big_text
|
|||
:position relative
|
||||
:line-height auto
|
||||
:border
|
||||
:top 2px solid #666
|
||||
//:top 2px solid #666
|
||||
:bottom 1px solid #666
|
||||
:text
|
||||
:align center
|
||||
|
|
@ -479,6 +482,7 @@ h1.big_text
|
|||
:position absolute
|
||||
:font
|
||||
:size 12px
|
||||
:weight normal
|
||||
|
||||
#content_bottom
|
||||
:position relative
|
||||
|
|
@ -528,3 +532,46 @@ h1.big_text
|
|||
.image_cycle
|
||||
img
|
||||
:display none
|
||||
|
||||
#group
|
||||
:color #333
|
||||
ul
|
||||
:margin 0
|
||||
:padding 0
|
||||
:font
|
||||
:size 14px
|
||||
> li
|
||||
:display inline
|
||||
:margin
|
||||
:right 10px
|
||||
|
||||
&.selected, &.selected a
|
||||
:color #fff
|
||||
:color #000
|
||||
:font
|
||||
:weight bold
|
||||
:size 18px
|
||||
|
||||
a
|
||||
:color #333
|
||||
:font
|
||||
:weight normal
|
||||
|
||||
#friend_pictures
|
||||
.add_new
|
||||
:position relative
|
||||
:display inline-block
|
||||
:height 40px
|
||||
:width 40px
|
||||
:background
|
||||
:color #222
|
||||
:text-align center
|
||||
:font-size 40px
|
||||
a
|
||||
:display block
|
||||
:position absolute
|
||||
:top -13px
|
||||
:left 7px
|
||||
img
|
||||
:display none
|
||||
:height 40px
|
||||
|
|
|
|||
|
|
@ -5,21 +5,22 @@
|
|||
|
||||
:display inline
|
||||
|
||||
:color #777
|
||||
:padding 4px
|
||||
|
||||
:font-size 12px
|
||||
:line-height 100%
|
||||
|
||||
:text-shadow 0 1px 0 #fff
|
||||
|
||||
:min-height 14px
|
||||
:min-height 10px
|
||||
|
||||
:background -webkit-gradient(linear, 0% 29%, 0% 85%, from(#FAFAFA), to(#E0E0E0))
|
||||
:background -moz-linear-gradient(top, #FAFAFA, #E0E0E0)
|
||||
:background -webkit-gradient(linear, 0% 29%, 0% 85%, from(#FCFCFC), to(#F6F6F6))
|
||||
:background -moz-linear-gradient(top, #FCFCFC, #F6F6F6)
|
||||
|
||||
:border 1px solid #ccc
|
||||
:bottom 1px solid #666
|
||||
:left 1px solid #999
|
||||
:right 1px solid #999
|
||||
:border 1px solid #EEE
|
||||
:bottom 1px solid #999
|
||||
:left 1px solid #ccc
|
||||
:right 1px solid #ccc
|
||||
|
||||
:border-radius 3px
|
||||
:-moz-border-radius 3px
|
||||
|
|
@ -27,28 +28,31 @@
|
|||
|
||||
:cursor pointer
|
||||
|
||||
:box-shadow 0 1px 1px #eee
|
||||
:-webkit-box-shadow 0 1px 1px #eee
|
||||
:-moz-box-shadow 0 1px 1px #eee
|
||||
|
||||
:box-shadow 0 1px 1px #ccc
|
||||
:-webkit-box-shadow 0 1px 1px #ccc
|
||||
:-moz-box-shadow 0 1px 1px #ccc
|
||||
|
||||
a
|
||||
:font-weight normal
|
||||
:color #777
|
||||
|
||||
:color #666
|
||||
|
||||
.button
|
||||
:padding 5px
|
||||
&:hover
|
||||
:color #666
|
||||
:background -webkit-gradient(linear, 0% 29%, 0% 85%, from(#FAFAFA), to(#F0F0F0))
|
||||
:background -moz-linear-gradient(top, #FAFAFA, #F0F0F0)
|
||||
|
||||
&:active
|
||||
:box-shadow 0 0px 2px #000
|
||||
:-webkit-box-shadow 0 0px 2px #000
|
||||
:-moz-box-shadow 0 0px 2px #000
|
||||
:color #555
|
||||
:color #666
|
||||
:background -webkit-gradient(linear, 0% 29%, 0% 85%, from(#F0F0F0), to(#FAFAFA))
|
||||
:background -moz-linear-gradient(top, #F0F0F0, #FAFAFA)
|
||||
:border
|
||||
:top 1px solid #ccc
|
||||
|
||||
ul.button_set
|
||||
|
||||
:padding 5px 0
|
||||
:padding
|
||||
:left 0
|
||||
:right 0
|
||||
|
||||
> li
|
||||
:padding 5px
|
||||
|
|
@ -75,8 +79,8 @@ ul.button_set
|
|||
:right none
|
||||
|
||||
.button .selected, .button_set .selected
|
||||
:background -webkit-gradient(linear, 0% 29%, 0% 85%, from(#E0E0E0), to(#FAFAFA))
|
||||
:background -moz-linear-gradient(top, #e0e0e0, #fafafa)
|
||||
:background -webkit-gradient(linear, 0% 29%, 0% 85%, from(#F0F0F0), to(#FAFAFA))
|
||||
:background -moz-linear-gradient(top, #F0F0F0, #fafafa)
|
||||
|
||||
:border
|
||||
:top 1px solid #aaa
|
||||
|
|
|
|||
|
|
@ -2,38 +2,39 @@
|
|||
font-family: "Lucida Grande", sans-serif;
|
||||
font-style: normal;
|
||||
display: inline;
|
||||
color: #777777;
|
||||
padding: 4px;
|
||||
font-size: 12px;
|
||||
line-height: 100%;
|
||||
text-shadow: 0 1px 0 white;
|
||||
min-height: 14px;
|
||||
background: -webkit-gradient(linear, 0% 29%, 0% 85%, from(#fafafa), to(#e0e0e0));
|
||||
background: -moz-linear-gradient(top, #fafafa, #e0e0e0);
|
||||
border: 1px solid #cccccc;
|
||||
border-bottom: 1px solid #666666;
|
||||
border-left: 1px solid #999999;
|
||||
border-right: 1px solid #999999;
|
||||
min-height: 10px;
|
||||
background: -webkit-gradient(linear, 0% 29%, 0% 85%, from(#fcfcfc), to(#f6f6f6));
|
||||
background: -moz-linear-gradient(top, #fcfcfc, #f6f6f6);
|
||||
border: 1px solid #eeeeee;
|
||||
border-bottom: 1px solid #999999;
|
||||
border-left: 1px solid #cccccc;
|
||||
border-right: 1px solid #cccccc;
|
||||
border-radius: 3px;
|
||||
-moz-border-radius: 3px;
|
||||
-webkit-border-radius: 3px;
|
||||
cursor: pointer;
|
||||
box-shadow: 0 1px 1px #cccccc;
|
||||
-webkit-box-shadow: 0 1px 1px #cccccc;
|
||||
-moz-box-shadow: 0 1px 1px #cccccc; }
|
||||
.button a, .button_set a {
|
||||
box-shadow: 0 1px 1px #eeeeee;
|
||||
-webkit-box-shadow: 0 1px 1px #eeeeee;
|
||||
-moz-box-shadow: 0 1px 1px #eeeeee;
|
||||
font-weight: normal;
|
||||
color: #777777; }
|
||||
|
||||
.button {
|
||||
padding: 5px; }
|
||||
.button:active {
|
||||
box-shadow: 0 0px 2px black;
|
||||
-webkit-box-shadow: 0 0px 2px black;
|
||||
-moz-box-shadow: 0 0px 2px black;
|
||||
color: #555555; }
|
||||
color: #666666; }
|
||||
.button:hover, .button_set:hover {
|
||||
color: #666666;
|
||||
background: -webkit-gradient(linear, 0% 29%, 0% 85%, from(#fafafa), to(#f0f0f0));
|
||||
background: -moz-linear-gradient(top, #fafafa, #f0f0f0); }
|
||||
.button:active, .button_set:active {
|
||||
color: #666666;
|
||||
background: -webkit-gradient(linear, 0% 29%, 0% 85%, from(#f0f0f0), to(#fafafa));
|
||||
background: -moz-linear-gradient(top, #f0f0f0, #fafafa);
|
||||
border-top: 1px solid #cccccc; }
|
||||
|
||||
ul.button_set {
|
||||
padding: 5px 0; }
|
||||
padding-left: 0;
|
||||
padding-right: 0; }
|
||||
ul.button_set > li {
|
||||
padding: 5px;
|
||||
display: inline;
|
||||
|
|
@ -50,8 +51,8 @@ ul.button_set {
|
|||
border-right: none; }
|
||||
|
||||
.button .selected, .button_set .selected {
|
||||
background: -webkit-gradient(linear, 0% 29%, 0% 85%, from(#e0e0e0), to(#fafafa));
|
||||
background: -moz-linear-gradient(top, #e0e0e0, #fafafa);
|
||||
background: -webkit-gradient(linear, 0% 29%, 0% 85%, from(#f0f0f0), to(#fafafa));
|
||||
background: -moz-linear-gradient(top, #f0f0f0, #fafafa);
|
||||
border-top: 1px solid #aaaaaa; }
|
||||
|
||||
.right {
|
||||
|
|
|
|||
32
spec/models/group_spec.rb
Normal file
32
spec/models/group_spec.rb
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
require File.dirname(__FILE__) + '/../spec_helper'
|
||||
|
||||
describe Group do
|
||||
before do
|
||||
@user = Factory.create(:user)
|
||||
@friend = Factory.create(:person)
|
||||
end
|
||||
|
||||
describe 'creation' do
|
||||
it 'should have a name' do
|
||||
group = @user.group(:name => 'losers')
|
||||
group.name.should == "losers"
|
||||
end
|
||||
end
|
||||
|
||||
describe 'querying' do
|
||||
before do
|
||||
@group = @user.group(:name => 'losers', :people => [@friend])
|
||||
end
|
||||
|
||||
it 'belong to a user' do
|
||||
@group.user.id.should == @user.id
|
||||
@user.groups.size.should == 1
|
||||
@user.groups.first.id.should == @group.id
|
||||
end
|
||||
|
||||
it 'should have people' do
|
||||
@group.people.all.include?(@friend).should be true
|
||||
@group.people.size.should == 1
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
Reference in a new issue