Skip to content

Instantly share code, notes, and snippets.

@universal
Forked from anonymous/groups_show.rb
Last active August 29, 2015 14:01
Show Gist options
  • Select an option

  • Save universal/2c31bf5a421bc60122a9 to your computer and use it in GitHub Desktop.

Select an option

Save universal/2c31bf5a421bc60122a9 to your computer and use it in GitHub Desktop.
<strong>Name:</strong>
<%= activity.name %><br/>
<br/>
<%= image_tag(activity.image_url, :size => '250x250') %>
<br/>
<strong>Location</strong>
<%= activity.location %><br/>
<strong>Duration:</strong><br/>
<%= activity.start_date %><br/>
<%= activity.end_date %><br/>
<strong>Description</strong>
<%= activity.description %><br/>
<strong>Votes</strong>
<%= pluralize(activity.votes.count, "vote") %>
<%= button_to '+1', upvote_group_activity_path(@group.id, activity.id), method: :post %>
<%if member_count > 0 %>
<div class="row-fluid">
<div class="span11 offset1">
<h3>Members:</h3>
</div>
</div>
<div class="row-fluid">
<% @members.each do |m| %>
<div class="span2 offset1">
<%=m.name%>
</div>
<div class="span2 offset1">
<%= link_to "View", user_path %>
</div>
<%end%>
</div>
<%else%>
<div class="row-fluid">
<div class="span11 offset1">
<h4>There is no members of this group yet</h4>
</div>
</div>
<%end%>
<% provide(:title, "Meetup Group") %>
<div class="row-fluid">
<div class="span4 offset1">
<h2>Topic</h2>
<p><%= @group.topic %></p>
</div>
<div class="span4 offset2">
<h3>Home Town</h3>
<p><%= @group.home_town %></p>
</div>
</div>
<%= render partial: "member_info", locals: {member_count: @members.count} %>
<% if @group.activities.count > 0 %>
<div class="row-fluid">
<h3>Activities: </h3>
<%= render partial: "activity", collection: @group.activities
<br/><br/>
</div>
<% end %>
<%if @group.owner_id == current_user.id %>
<h2>Add an Activtiy:</h2>
<%= form_for([@group, @group.activities.build]) do |f| %>
<%= f.label :name %>
<%= f.text_field :name %>
<%= f.label :Location %>
<%= f.text_field :location %>
<%= f.label :Start %>
<%= f.datetime_field :start_date %>
<%= f.label :End%>
<%= f.datetime_field :end_date%>
<%= f.label :Description %>
<%= f.text_field :description %>
<strong>Search Tags</strong>
<form action="image_search" >
<input type="text" name="search_input" value="Tags">
<button type="submit" value="Search">FLICKR</button>
</form>
<% results = flickr.photos.search(:tags => params["search_input"] )
#rand = Random.new.rand(results.length)
#info = flickr.photos.getInfo(:photo_id => results[rand].id)
#url = FlickRaw.url_b(info)
amount_images = 6
i = 0
list_url = [amount_images]
results.each do |r|
if i == amount_images
break
end
info = flickr.photos.getInfo(:photo_id => r.id)
url = FlickRaw.url_b(info)
list_url[i] = url
i = i + 1
%><%= image_tag(url,:size => '300x300') %>
<%= f.radio_button :image_url, url %>
<%end%><br/><br/>
<%= f.submit %>
<% end %>
<% end %>
<%= link_to 'Back', groups_path %>
| <%= link_to 'Edit', edit_group_path(@group) %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment