Permalink
Browse files

Work on groups index page and group show page.

  • Loading branch information...
1 parent 55fd984 commit 66006f4c7991bfc23086b27a1c318e7af28fec58 @seven1m seven1m committed Nov 10, 2010
View
@@ -15,6 +15,8 @@ public/images/logo*
public/system/production
public/system/development
public/system/test
+public/stylesheets/all.css
+public/javascripts/all.js
test/fixtures/settings.yml
config/query_reviewer.yml
vendor/plugins/query_reviewer
@@ -33,7 +33,7 @@ def index
end
# /groups
else
- @categories = Group.categories
+ @categories = Group.category_names
if @logged_in.admin?(:manage_groups)
@unapproved_groups = Group.find_all_by_approved(false)
else
@@ -66,6 +66,7 @@ def show
@stream_items = []
end
@show_map = Setting.get(:services, :yahoo) && @group.mapable?
+ @show_cal = @group.gcal_url
@can_post = @group.can_post?(@logged_in)
@can_share = @group.can_share?(@logged_in)
unless @group.approved? or @group.admin?(@logged_in)
@@ -66,9 +66,9 @@ def nav_links
end
html << "<li><div>#{tab_link t("nav.profile"), profile_link, params[:controller] == 'people' && me?, 'profile-tab'}</div></li>"
if Setting.get(:features, :groups) and (Site.current.max_groups.nil? or Site.current.max_groups > 0)
- html << "<li>#{ tab_link t("nav.groups"), groups_path, params[:controller] == 'groups'}</li>"
+ html << "<li>#{ tab_link t("nav.groups"), groups_path, params[:controller] == 'groups', 'group-tab'}</li>"
end
- html << "<li>#{tab_link t("nav.directory"), new_search_path, %w(searches printable_directories).include?(params[:controller])}</li>"
+ html << "<li>#{tab_link t("nav.directory"), new_search_path, %w(searches printable_directories).include?(params[:controller]), 'directory-tab'}</li>"
html
end
@@ -1,11 +1,11 @@
<script type="text/javascript" src="http://api.maps.yahoo.com/ajaxymap?v=3.4&amp;appid=<%= Setting.get(:services, :yahoo) %>"></script>
<script type="text/javascript">
- var address = <%= @group.location.inspect %>;
+ var address = '<%= escape_javascript @group.location %>';
map_loaded = false;
function load_map() {
if(map_loaded) return;
map_loaded = true;
- var map = new YMap($('map'));
+ var map = new YMap('map');
map.drawZoomAndCenter(address, 6);
map.addZoomLong();
map.setMapType(YAHOO_MAP_REG);
@@ -0,0 +1,9 @@
+<% if @logged_in.can_edit?(@group) %>
+ <div id="group-tab-menu" style="display:none;">
+ <ul class="popup-menu">
+ <% if @logged_in.can_edit?(@group) %>
+ <li><%= link_to t('menus.group.edit'), edit_group_path(@group), :class => 'edit-icon' %></li>
+ <% end %>
+ </ul>
+ </div>
+<% end %>
@@ -13,7 +13,7 @@
</td>
<td class="group">
<%= link_to group.name, group %><br/>
- <% if me? or @logged_in.admin?(:manage_groups) %>
+ <% if params[:controller] == 'people' and (me? or @logged_in.admin?(:manage_groups)) %>
<span>
<%= t('people.email') %>:
<% if membership.get_email %>
@@ -0,0 +1,7 @@
+<h3><%= t('groups.search_for_a_group') %></h3>
+<%= form_tag(groups_path, :method => 'get', :style => 'border:none;') do %>
+ <p>
+ <%= text_field_tag :name, params[:name], :style => 'width:120px;' %>
+ <%= submit_tag t('groups.search') %>
+ </p>
+<% end %>
@@ -1,22 +1,37 @@
-<% content_for :subnav do %>
- <li><%= link_to image_tag('plus.png', :alt => t('groups.add_group'), :class => 'icon') + ' ' + t('groups.add_group'), new_group_path %></li>
-<% end %>
-
<% if @unapproved_groups.any? %>
<p class="highlight">
<%= t('groups.following_are_pending_approval', :count => @unapproved_groups.length) %>
<%= @unapproved_groups.map { |g| link_to(g.name, group_path(g)) }.join(', ') %>
</p>
<% end %>
+<% content_for :sidebar do %>
+
+ <%= render :partial => 'search' %>
+
+ <h3><%= t('groups.browse_by_category') %></h3>
+ <p><%= select_tag 'category', options_for_select(@categories), :include_blank => true, :onchange => "location.href='?category='+this.value" %></p>
+
+ <h3><%= t('groups.create_a_group') %></h3>
+ <p>
+ <%= t('groups.if_cant_find_create_it') %>
+ </p>
+ <p>
+ <%= link_to t('groups.create_a_group'), new_group_path, :class => 'add-icon' %>
+ </p>
+
+<% end %>
+
+<h2><%= t('groups.your_groups') %></h2>
+<%= render :partial => 'person_groups' %>
+
+<% if nil %>
<table>
<tr>
<td style="padding-right:25px;">
- <h2 style="border:none;"><%= t('groups.your_groups') %></h2>
- <%= render :partial => 'person_groups' %>
</td>
<td style="padding-left:25px;border-left:1px dotted #ccc;padding-right:25px;">
- <h2 style="border:none;"><%= t('search.browse_by_category') %></h2>
+ <h3><%= t('search.browse_by_category') %></h3>
<ul>
<% @categories.keys.sort.each do |category| %>
<% group_count = @categories[category] %>
@@ -28,22 +43,7 @@
</ul>
</td>
<td style="padding-left:25px;border-left:1px dotted #ccc;">
- <h2 style="border:none;"><%= t('search.search_by_name') %></h2>
- <%= form_tag(groups_path, :method => 'get', :style => 'border:none;') %>
- <p><%= text_field_tag :name, nil, :style => 'width:120px;' %>
- <input type="submit" value="<%= t('search.search') %>" style="width:120px;"/></p>
- </form>
-
- <h2 style="border-top:1px dotted #ccc;border-bottom:none;padding-top:20px;"><%= t('groups.create_a_group') %></h2>
- <p>
- <%= t('groups.if_cant_find_create_it') %>
- </p>
- <p>
- <%= link_to image_tag('add_small.gif', :alt => t('groups.create_a_group'), :class => 'icon'), new_group_path %>
- <%= link_to t('groups.create_a_group'), new_group_path %>
- </p>
</td>
</tr>
</table>
-
-<% if session[:touring] %><%= tour_popup('Groups Tab', '/pages/help/tour_groups', 450, 'right') %><% end %>
+<% end %>
@@ -0,0 +1,181 @@
+<% content_for :subnav do %>
+ <li><%= link_to image_tag('group.png', :alt => t('groups.all_groups'), :class => 'icon') + ' ' + t('groups.all_groups'), groups_path %></li>
+ <% if @logged_in.can_edit?(@group) %>
+ <li><%= link_to image_tag('pencil.png', :alt => t('groups.edit_group'), :class => 'icon') + ' ' + t('groups.edit_group'), edit_group_path(@group) %></li>
+ <% if @group.attendance? %>
+ <li><%= link_to image_tag('checkmark.png', :alt => t('groups.attendance'), :class => 'icon') + ' ' + t('groups.attendance'), group_attendance_index_path(@group) %></li>
+ <% end %>
+ <% if not @group.approved? and @logged_in.admin?(:manage_groups) %>
+ <li><%= link_to image_tag('thumb_up.png', :alt => t('groups.approve_group'), :class => 'icon') + ' ' + t('groups.approve_group'), group_path(@group, :group => {:approved => true}), :confirm => t('are_you_sure'), :method => 'put', :class => 'very-strong' %></li>
+ <% end %>
+ <% end %>
+ <% if @member_of %>
+ <li><%= link_to image_tag('lock.png', :alt => t('privacies.group_privacy'), :class => 'icon') + ' ' + t('privacies.group_privacy'), group_membership_privacy_path(@group, @member_of) %></li>
+ <% end %>
+<% end %>
+
+<% content_for :sidebar do %>
+ <%= render :partial => 'photo' %>
+
+ <h1>
+ <%= @group.name %>
+ </h1>
+ <p><%= t('groups.category') %>: <%= link_to @group.category, groups_path(:category => @group.category) %></p>
+ <% if @group.leader %>
+ <p><%= t('groups.leader') %>: <%= link_to @group.leader.name, @group.leader %></p>
+ <% end %>
+
+ <% if @group.linked? or @group.parents_of %>
+ <p><em><%= t('groups.this_group_maintained_by_staff') %></em></p>
+ <% elsif not @group.approved %>
+ <p class="very-strong"><%= t('groups.this_group_is_pending_approval') %></p>
+ <% else %>
+ <% if @group.membership_requests.count(:conditions => ['person_id = ?', @logged_in.id]) > 0 %>
+ <p class="very-strong"><%= t('groups.you_requested_join_this_group') %></p>
+ <% elsif not @member_of %>
+ <p><%= link_to t('groups.join_this_group'), group_memberships_path(@group, :id => @logged_in), :method => 'post', :confirm => @group.admin?(@logged_in) ? t('are_you_sure') : t('groups.request_will_be_sent_to_admins') %></p>
+ <% elsif not @group.last_admin?(@logged_in) %>
+ <p><%= link_to t('groups.leave_this_group'), group_membership_path(@group, @logged_in), :method => 'delete', :confirm => t('are_you_sure') %></p>
+ <% end %>
+ <% end %>
+
+ <%= render :partial => 'people' %>
+<% end %>
+
+<% if @group.hidden? %><%= render :partial => 'hidden' %><% end %>
+
+<% if @group.admin?(@logged_in) and @group.membership_requests.count > 0 %>
+ <p class="highlight">
+ <%= t('groups.this_group_has_pending_html', :url => group_memberships_path(@group)) %>
+ </p>
+<% end %>
+
+<% if @group.description.to_s.any? or @group.meets.to_s.any? or @group.location.to_s.any? or @group.directions.to_s.any? or @group.other_notes.to_s.any? %>
+
+ <% if @show_map %>
+ <div id="map-container" style="display:none;">
+ <div id="map"></div>
+ <div id="map-link">
+ <%= t('people.only_an_approximation') %> |
+ <%= link_to t('people.show_full_screen'), "http://maps.yahoo.com/broadband/#mvt=m&q1=#{url_encode(@group.location)}", :target => '_new' %>
+ </div>
+ </div>
+ <% end %>
+
+ <div id="group-details" <% if @show_map %>style="margin-right:275px;"<% end %>>
+
+ <p>
+ <%= @group.description %>
+ <% if @group.private? %>
+ <%= image_tag('lock.gif', :alt => t('groups.this_group_is_private'), :class => 'icon') %>
+ <% end %>
+ </p>
+
+ <table>
+ <% if @group.meets.to_s.any? %>
+ <tr><td><%= t('groups.meets') %>:</td><td><%= @group.meets %></td></tr>
+ <% end %>
+ <% if @group.location.to_s.any? %>
+ <tr><td><%= t('groups.location') %>:</td><td><%= @group.location %></td></tr>
+ <% end %>
+ <% if @group.directions.to_s.any? %>
+ <tr><td><%= t('groups.directions') %>:</td><td><%= @group.directions %></td></tr>
+ <% end %>
+ <% if @group.other_notes.to_s.any? %>
+ <tr><td><%= t('groups.notes') %>:</td><td><%= @group.other_notes %></td></tr>
+ <% end %>
+ </table>
+
+ </div>
+
+<% end %>
+
+<div id="share" style="display:none;margin-bottom:20px;">
+
+ <% if @group.email? and @can_post %>
+ <h2 class="tab" id="email"><%= image_tag('message.gif', :alt => t('people.email'), :class => 'icon') %> <%= t('people.email') %></h2>
+ <div class="section">
+ <%= form_for Message.new(:group => @group), :html => {:enctype => 'multipart/form-data', :id => 'message'} do |form| %>
+ <%= form.hidden_field :group_id %>
+ <p>
+ <%= form.label :subject, t('messages.subject') %>
+ <%= form.text_field :subject %><br/>
+ <%= form.label :body, t('messages.message') %>
+ <%= form.text_area :body, :rows => 5, :cols => 80 %>
+ </p>
+ <p>
+ <%= submit_tag t('messages.send_message') %>
+ <%= link_to raw(t('people.advanced') + ' &raquo;'), new_group_message_path(@group), :onclick => "var f = document.createElement('form'); f.style.display = 'none'; this.parentNode.appendChild(f); f.method = 'POST'; f.action = this.href; var s = document.createElement('input'); s.setAttribute('name', 'message[subject]'); s.setAttribute('value', $('message_subject').value); f.appendChild(s); var b = document.createElement('input'); b.setAttribute('name', 'message[body]'); b.setAttribute('value', $('message_body').value); f.appendChild(b); f.submit(); return false;" %>
+ </p>
+ <% if @group.address.to_s.any? %>
+ <p class="discreet"><%= t('groups.or_send_from_your_email_html', :email => @group.full_address) %></p>
+ <% end %>
+ <% end %>
+ </div>
+ <% end %>
+
+ <% if @group.blog? and @can_post and @note = Note.new(:group => @group) %>
+ <%= render :partial => 'streams/share_note' %>
+ <% end %>
+
+ <% if @group.pictures? %>
+ <%= render :partial => 'streams/share_picture' %>
+ <% end %>
+
+ <% if @group.prayer? %>
+ <%= render :partial => 'streams/share_prayer' %>
+ <% end %>
+</div>
+
+<div style="float:right;width:150px;clear:right;">
+ <ul id="my-stuff">
+ <% if @group.gcal_url %><li><%= link_to image_tag('calendar.png', :alt => t('groups.group_calendar'), :class => 'icon') + ' ' + t('groups.group_calendar'), group_calendar_path(@group) %></li><% end %>
+ <% if @group.email? %><li><%= link_to image_tag('message.gif', :alt => t('groups.group_emails'), :class => 'icon') + ' ' + t('groups.group_emails'), group_messages_path(@group) %></li><% end %>
+ <% if Setting.get(:features, :notes ) and @group.blog? %><li><%= link_to image_tag('note.png', :alt => t('groups.group_notes'), :class => 'icon') + ' ' + t('groups.group_notes'), group_notes_path(@group) %></li><% end %>
+ <% if Setting.get(:features, :pictures ) and @group.pictures? %><li><%= link_to image_tag('picture.png', :alt => t('groups.group_pictures'), :class => 'icon') + ' ' + t('groups.group_pictures'), group_albums_path(@group) %></li><% end %>
+ <% if @group.prayer? %><li><%= link_to image_tag('heart.png', :alt => t('groups.group_prayer'), :class => 'icon') + ' ' + t('groups.group_prayer'), group_prayer_requests_path(@group) %></li><% end %>
+ </ul>
+
+ <% if @group.attachments.count > 0 %>
+ <div style="margin-left:20px;">
+ <p>
+ <strong><%= t('attachments.files') %></strong><br/>
+ <% @group.attachments.all(:order => 'name').each do |attachment| %>
+ <%= link_to attachment.name, get_attachment_path(attachment) %><br/>
+ <% end %>
+ </p>
+ </div>
+ <% end %>
+</div>
+
+<%# Main Content %>
+<div id="profile-body">
+
+ <% if @can_share %>
+ <p style="margin-bottom:20px;" id="share-something">
+ <%= link_to_function image_tag('add_small.gif', :alt => t('stream.share_something'), :class => 'icon'), "shareSomething('email')" %>
+ <%= t('stream.share_something_here_html', :js => "shareSomething('email')") %>
+ </p>
+ <% end %>
+
+ <%= render :partial => 'streams/stream_item', :collection => @stream_items %>
+
+ <% unless @stream_items.any? %>
+ <p><%= t('groups.no_online_group_activity') %></p>
+ <% end %>
+
+</div>
+
+<% unless @group.blog? or @group.email? or @group.prayer? %>
+ <p><em><%= t('groups.this_group_doesnot_offer') %></em></p>
+<% end %>
+
+<% content_for :head do %>
+ <script type="text/javascript"> ALBUMS_JSON_PATH = '<%= group_albums_path(@group.id) %>'; </script>
+<% end %>
+
+<script type="text/javascript"> set_up_tabs(); </script>
+
+<% if @show_map %>
+ <%= render :partial => 'map_scripts' %>
+<% end %>
@@ -1,8 +1,11 @@
-<p><%= link_to image_tag('back.gif', :alt => t('groups.back_to_homepage'), :class => 'icon') + ' ' + t('groups.back_to_homepage'), groups_path %></p>
+<% content_for :sidebar do %>
+ <p><%= link_to t('groups.back_to_homepage'), groups_path, :class => 'left-icon' %></p>
+ <%= render :partial => 'search' %>
+<% end %>
<% if @groups.any? %>
- <table class="iconed">
+ <table class="spaced">
<% @groups.each do |group| %>
<tr>
<td class="icon">
Oops, something went wrong.

0 comments on commit 66006f4

Please sign in to comment.