Permalink
Browse files

groups : sidebar, members, show, index, new

  • Loading branch information...
mcansky
mcansky committed Feb 7, 2011
1 parent 224e30e commit fe7f4c47386e842763ce0f8d9661349d39e3a421
@@ -26,6 +26,8 @@ def create
@group = Group.new
@group.name = params[:group][:name]
@group.desc = params[:group][:desc]
+ @group.owner = current_user
+ @group.users << current_user
if @group.save
redirect_to :action => :show, :id => @group.id
return
View
@@ -32,6 +32,7 @@ def initialize(user)
if user.guest?
can :read, Bookmark
can :read, Stat
+ can :read, Group
end
if user.beta?
@@ -19,6 +19,7 @@
%h4.sidebar
Groups
+ = render "applications/sidebar_groups", :groups => current_user.groups
%div.side_bar_tags
%h4.sidebar
@@ -41,6 +42,8 @@
%h4.sidebar
Groups
+ = link_to "+", {:controller => "/groups", :action => :new}, {:class => "sidebar_new_group"}
+ = render "application/sidebar_groups", :groups => current_user.groups
%div.side_bar_tags
%h4.sidebar
@@ -0,0 +1,2 @@
+- groups.each do |group|
+ = link_to group.name, {:controller => :groups, :action => :show, :id => group.id}, {:class => "title"}
@@ -0,0 +1,11 @@
+%div.link
+ = link_to group.name, {:controller => :groups, :action => :show, :id => group.id}, {:class => "title"}
+ %span.manage
+ - if (current_user && (group.owner == current_user))
+ = link_to 'e', {:controller => "groups", :action => "edit", :id => group.id}, {:class => "edit", :title => "edit"}
+ = link_to 'd!', group, {:confirm => "Deleting, You sure ?", :method => :delete, :title => "destroy"}
+ - elsif (current_user && group.user != current_user)
+ = link_to 'c', :controller => "posts", :action => "create", :id => post.id, :method => :post
+
+%div.desc
+ = group.desc
@@ -0,0 +1,2 @@
+- group.users.each do |person|
+ = link_to image_tag("http://www.gravatar.com/avatar/#{person.hash}?s=20", :alt => person.name), {:controller => "/posts", :action => :index, :username => person.name}, {:title => person.name, :alt => person.name}
View
@@ -0,0 +1,17 @@
+%div
+ %h2
+ Edit
+ = @group.name
+
+ = form_for(:group, :url => { :action => "create" }) do |f|
+ %p
+ = f.label :name
+ = f.text_field :name
+
+ %p
+ = f.label :desc
+ %br
+ = f.text_area :desc, :cols => 40, :rows => 3
+
+ %p
+ = f.submit("Add group")
@@ -6,4 +6,7 @@
- else
= params[:username] + "'s groups "
- else
- Groups
+ Groups
+
+ - @groups.each do |group|
+ - render "groups/group_short", :group => group
View
@@ -0,0 +1,15 @@
+%div
+ %h2 New group
+
+ = form_for(:group, :url => { :action => "create" }) do |f|
+ %p
+ = f.label :name
+ = f.text_field :name
+
+ %p
+ = f.label :desc
+ %br
+ = f.text_area :desc, :cols => 40, :rows => 3
+
+ %p
+ = f.submit("Add group")
View
@@ -0,0 +1,13 @@
+%div
+ %h2
+ = @group.name
+ group
+
+ %p
+ Owned by :
+ = link_to image_tag("http://www.gravatar.com/avatar/#{@group.owner.hash}?s=20", :alt => @group.owner.name), {:controller => "/posts", :action => :index, :username => @group.owner.name}, {:title => @group.owner.name, :alt => @group.owner.name}
+ %p= @group.desc
+
+ %h3 Members
+
+ = render "groups/members", :group => @group

0 comments on commit fe7f4c4

Please sign in to comment.