Adding gmaps

This commit is contained in:
2013-10-09 05:14:30 -07:00
parent ebc696814e
commit 2b644e0b74
23 changed files with 1758 additions and 36 deletions

View File

@@ -17,12 +17,20 @@
</div>
<div class="field">
<%= f.label :category %><br>
<%= f.text_field :category %>
<%= f.text_field :category %> (suggested: <%= Space.categories.join(", ") %>)
</div>
<div class="field">
<%= f.label :address %><br>
<%= f.text_field :address %>
</div>
<div class="field">
<%= f.label :city %><br>
<%= f.text_field :city %>
</div>
<div class="field">
<%= f.label :state %><br>
<%= f.text_field :state %>
</div>
<div class="field">
<%= f.label :hours %><br>
<%= f.text_field :hours %>

View File

@@ -0,0 +1,20 @@
<div class="marker-container">
<h3><%= space.name %></h3>
<em><%= space.category %></em>
<p>
<%= space.full_address %><br/>
<strong>Hours:</strong> <%= space.hours %><br/>
<strong>Phone:</strong> <%= space.phone %><br/>
<strong>Email:</strong> <%= space.email %><br/>
<strong>Website:</strong> <%= link_to space.website, space.website_with_protocol %><br/>
</p>
<p>
<%= space.description %>
</p>
</div>

View File

@@ -11,7 +11,12 @@
<p>
<strong>Address:</strong>
<%= space.address %>
<%= space.full_address %>
</p>
<p>
<strong>Latitude/Longitude:</strong>
<%= space.latitude %>, <%= space.longitude %>
</p>
<p>

View File

@@ -1,10 +1,21 @@
<h1>Listing spaces</h1>
<%= stylesheet_link_tag 'gmaps4rails' %>
<h1>Collaborative Spaces in Arizona</h1>
<p>
<%= link_to 'Add Space', new_space_path %> |
<%= link_to 'JSON Feed', spaces_path("json") %>
</p>
<%= gmaps4rails(@json) %>
<%= yield :scripts %>
<br/>
<table>
<thead>
<tr>
<th>Name</th>
<th>Category</th>
<th>Address</th>
<th>Hours</th>
<th>Phone</th>
@@ -18,24 +29,24 @@
</thead>
<tbody>
<% @spaces.each do |space| %>
<tr>
<td><%= space.name %></td>
<td><%= space.category %></td>
<td><%= space.address %></td>
<td><%= space.hours %></td>
<td><%= space.phone %></td>
<td><%= space.email %></td>
<td><%= space.website %></td>
<td><%= space.description %></td>
<td><%= link_to 'Show', space %></td>
<td><%= link_to 'Edit', edit_space_path(space) %></td>
<td><%= link_to 'Destroy', space, method: :delete, data: { confirm: 'Are you sure?' } %></td>
</tr>
<% @spaces.group_by{|s| s.category}.each do |category, spaces| %>
<tr><th colspan="7" style="text-align: left;">
<span style="color: <%= spaces.first.dot_color %>">&bull;</span>
<%= category.titleize.pluralize %></th></tr>
<% spaces.each do |space| %>
<tr>
<td><%= space.name %></td>
<td><%= space.full_address %></td>
<td><%= space.hours %></td>
<td><%= space.phone %></td>
<td><%= space.email %></td>
<td><%= space.website %></td>
<td><%= space.description %></td>
<td><%= link_to 'Show', space %></td>
<td><%= link_to 'Edit', edit_space_path(space) %></td>
<td><%= link_to 'Destroy', space, method: :delete, data: { confirm: 'Are you sure?' } %></td>
</tr>
<% end %>
<% end %>
</tbody>
</table>
<br>
<%= link_to 'New Space', new_space_path %>

View File

@@ -1,4 +1,4 @@
json.array!(@spaces) do |space|
json.extract! space, :name, :type, :address, :hours, :phone, :email, :website, :description
json.extract! space, :name, :category, :address, :city, :state, :hours, :phone, :email, :website, :description, :dot_color
json.url space_url(space, format: :json)
end

View File

@@ -2,12 +2,11 @@
<%= render partial: "space", locals: {space: @space} %>
<%= link_to 'Edit', edit_space_path(@space) %> |
<%= link_to 'Back', spaces_path %>
<%= link_to 'Edit', edit_space_path(@space) %>
<h3>Revision history</h3>
<dl>
<% @space.versions.each do |v| %>
<% @space.versions.reverse!.each do |v| %>
<dt><b><%= v.event.capitalize %> <%= v.created_at %> <%= v.whodunnit if v.whodunnit %></b></dt>
<dd>
<% if v.reify %>

View File

@@ -1 +1 @@
json.extract! @space, :name, :type, :address, :hours, :phone, :email, :website, :description, :created_at, :updated_at
json.extract! @space, :name, :category, :address, :city, :state, :hours, :phone, :email, :website, :description, :created_at, :updated_at