Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5c86554
commit 39030db
Showing
22 changed files
with
396 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
class GroupInvitesController < ApplicationController | ||
# GET /group_invites | ||
# GET /group_invites.xml | ||
# def index | ||
# @group_invites = GroupInvite.all | ||
# | ||
# respond_to do |format| | ||
# format.html # index.html.erb | ||
# format.xml { render :xml => @group_invites } | ||
# end | ||
# end | ||
# | ||
# # GET /group_invites/1 | ||
# # GET /group_invites/1.xml | ||
# def show | ||
# @group_invite = GroupInvite.find(params[:id]) | ||
# | ||
# respond_to do |format| | ||
# format.html # show.html.erb | ||
# format.xml { render :xml => @group_invite } | ||
# end | ||
# end | ||
|
||
# GET /group_invites/new | ||
# GET /group_invites/new.xml | ||
def new | ||
@group = Group.find(params[:group_id]) | ||
@group_invite = GroupInvite.new | ||
|
||
respond_to do |format| | ||
format.html # new.html.erb | ||
format.xml { render :xml => @group_invite } | ||
end | ||
end | ||
|
||
# GET /group_invites/1/edit | ||
# def edit | ||
# @group_invite = GroupInvite.find(params[:id]) | ||
# end | ||
# | ||
# # POST /group_invites | ||
# # POST /group_invites.xml | ||
def create | ||
# do nothing for now | ||
@group = Group.find(params[:group_id]) | ||
redirect_to(@group, :notice => 'Your invitations have been sent!') | ||
return | ||
|
||
@group_invite = GroupInvite.new(params[:group_invite]) | ||
|
||
respond_to do |format| | ||
if @group_invite.save | ||
format.html { redirect_to(@group_invite, :notice => 'Group invite was successfully created.') } | ||
format.xml { render :xml => @group_invite, :status => :created, :location => @group_invite } | ||
else | ||
format.html { render :action => "new" } | ||
format.xml { render :xml => @group_invite.errors, :status => :unprocessable_entity } | ||
end | ||
end | ||
end | ||
# | ||
# # PUT /group_invites/1 | ||
# # PUT /group_invites/1.xml | ||
# def update | ||
# @group_invite = GroupInvite.find(params[:id]) | ||
# | ||
# respond_to do |format| | ||
# if @group_invite.update_attributes(params[:group_invite]) | ||
# format.html { redirect_to(@group_invite, :notice => 'Group invite was successfully updated.') } | ||
# format.xml { head :ok } | ||
# else | ||
# format.html { render :action => "edit" } | ||
# format.xml { render :xml => @group_invite.errors, :status => :unprocessable_entity } | ||
# end | ||
# end | ||
# end | ||
# | ||
# # DELETE /group_invites/1 | ||
# # DELETE /group_invites/1.xml | ||
# def destroy | ||
# @group_invite = GroupInvite.find(params[:id]) | ||
# @group_invite.destroy | ||
# | ||
# respond_to do |format| | ||
# format.html { redirect_to(group_invites_url) } | ||
# format.xml { head :ok } | ||
# end | ||
# end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,36 @@ | ||
class GroupsController < ApplicationController | ||
before_filter :login_required, :except => [ :show, :index ] | ||
|
||
def new | ||
@page_title = 'Create a New OpenCongress Group' | ||
@group = Group.new | ||
@group.join_type = 'ANYONE' | ||
@group.invite_type = 'ANYONE' | ||
end | ||
|
||
|
||
def create | ||
@group = Group.new(params[:group]) | ||
@group.user = current_user | ||
|
||
respond_to do |format| | ||
if @group.save | ||
format.html { redirect_to(new_group_group_invite_path(@group), :notice => 'Group was successfully created.') } | ||
format.xml { render :xml => @group, :status => :created, :location => @group } | ||
else | ||
format.html { render :action => "new" } | ||
format.xml { render :xml => @group.errors, :status => :unprocessable_entity } | ||
end | ||
end | ||
end | ||
|
||
def show | ||
@group = Group.find(params[:id]) | ||
|
||
@page_title = "#{@group.name} - MyOC Groups" | ||
end | ||
|
||
def index | ||
@page_title = 'OpenCongress Groups' | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
module GroupInvitesHelper | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,21 @@ | ||
class Group < ActiveRecord::Base | ||
has_attached_file :group_image, :styles => { :medium => "300x300>", :thumb => "100x100>" }, :path => "#{Settings.group_images_path}/:id/:style/:filename" | ||
|
||
validates_presence_of :name | ||
validates_uniqueness_of :name | ||
validates_presence_of :user_id | ||
|
||
belongs_to :user | ||
has_many :group_invites | ||
belongs_to :pvs_category | ||
|
||
has_many :comments, :as => :commentable | ||
|
||
def to_param | ||
"#{id}_#{name.gsub(/[^A-Za-z]+/i, '_').gsub(/\s/, '_')}" | ||
end | ||
|
||
def display_object_name | ||
'Group' | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
class GroupInvite < ActiveRecord::Base | ||
belongs_to :group | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
= form_for @group_invite, :url => group_group_invites_path(@group) do |f| | ||
= render "shared/error_messages", :target => @group | ||
|
||
.actions | ||
%p | ||
= text_area_tag :invites, '', { :class => 'field', :rows => 5, :cols => 70 } | ||
|
||
%p | ||
= f.submit 'Invite', :class => 'button huge blue' | ||
= link_to 'Not Now', group_path(@group), :class => 'button huge silver' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
%h1 Editing group_invite | ||
|
||
= render 'form' | ||
|
||
= link_to 'Show', @group_invite | ||
\| | ||
= link_to 'Back', group_invites_path |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
%h1 Listing group_invites | ||
|
||
%table | ||
%tr | ||
%th | ||
%th | ||
%th | ||
|
||
- @group_invites.each do |group_invite| | ||
%tr | ||
%td= link_to 'Show', group_invite | ||
%td= link_to 'Edit', edit_group_invite_path(group_invite) | ||
%td= link_to 'Destroy', group_invite, :confirm => 'Are you sure?', :method => :delete | ||
|
||
%br | ||
|
||
= link_to 'New Group invite', new_group_invite_path |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
= render 'groups/heading', :subtitle => 'Send Invitations' | ||
|
||
.padding | ||
.instructions | ||
%strong Now that you've created your group, invite some people to join it! | ||
%br | ||
%br | ||
Enter email addresses or OpenCongress usernames in the box below and click "Invite". | ||
- if @facebook_user | ||
You can also invite your friends on Facebook in the selector below. | ||
|
||
|
||
= render 'form' | ||
|
||
- if @facebook_user | ||
- fb_connect_async_js | ||
/ | ||
<fb:serverFbml> | ||
<script type="text/fbml"> | ||
<fb:fbml> | ||
<fb:request-form | ||
action="<URL for post invite action, see fb:request-form docs for details>" | ||
method="POST" | ||
invite="true" | ||
type="XFBML" | ||
content='Join my group on OpenCongress | ||
<fb:req-choice url="#{url_for :controller => 'groups', :only_path => false}" | ||
label="Join!" /> | ||
'> | ||
</fb:request-form> | ||
<fb:multi-friend-selector | ||
showborder="false" | ||
actiontext="Invite your friends to join #{@group.name}." /> | ||
</fb:fbml> | ||
</script> | ||
</fb:serverFbml> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
%p#notice= notice | ||
|
||
|
||
= link_to 'Edit', edit_group_invite_path(@group_invite) | ||
\| | ||
= link_to 'Back', group_invites_path |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
- subtitle ||= nil | ||
#heading.group | ||
= image_tag @group.group_image.url(:thumb) | ||
%h2= subtitle.nil? ? @group.name : "#{@group.name} : #{subtitle}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#heading | ||
%h2 Create a new OC Group | ||
%h2 Create a New OpenCongress Group | ||
|
||
.padding | ||
= render 'form' |
Oops, something went wrong.