Commit 10f02ec

mo khan <mo@mokhan.ca>
2016-04-30 05:09:39
list gyms in a table.
1 parent 5f4b782
Changed files (3)
app
views
config
locales
spec
app/views/gyms/index.html.erb
@@ -0,0 +1,14 @@
+<div class="row">
+  <div class="large-12 columns">
+    <h1>Gyms</h1>
+    <table>
+      <% @gyms.each do |gym| %>
+        <tr>
+        <td><%= gym.name %></td>
+        <td><%= gym.address %>, <%= gym.city %>, <%= gym.state %>, <%= gym.country %></td>
+        <td><a href="https://maps.google.com/?q=<%= gym.latitude %>,<%= gym.longitude %>" target="_blank"><%= t('.view_map') %></a></td>
+      </tr>
+    <% end %>
+    </table>
+  </div>
+</div>
config/locales/en.yml
@@ -30,6 +30,9 @@ en:
       log_out: "Log out"
       profile_edit: "Edit profile"
       profile_view: "View profile"
+  gyms:
+    index:
+      view_map: View map
   registrations:
     new:
       username: "Username"
spec/models/location_spec.rb
@@ -4,9 +4,10 @@ describe Location do
   describe '.from' do
     it 'returns the correct lat/long' do
       latitude, longitude = Location.
-        from('1817 Crowchild Trail NW', 'Calgary', 'AB', 'Canada')
-      expect(latitude).to be_within(0.1).of(51.0706973)
-      expect(longitude).to be_within(0.1).of(-114.1178249)
+        from('1301 16 Ave NW', 'Calgary', 'AB', 'Canada')
+
+      expect(latitude).to be_within(0.1).of(51.0647815)
+      expect(longitude).to be_within(0.1).of(-114.0927691)
     end
   end
 end