Commit dadd000
Changed files (4)
app
assets
javascripts
templates
views
views
profiles
config
locales
app/assets/javascripts/templates/home_gym.ractive
@@ -24,7 +24,7 @@
<a href={{map_url}}><i class="fa fa-map-marker" aria-hidden=true></i></a>
</td>
<td>
- <button on-click="choose" class="button tiny">My Home Gym</button>
+ <button on-click="choose" class="button tiny">Mine</button>
</td>
</tr>
{{/each}}
app/assets/javascripts/views/home_gym.js.coffee
@@ -11,7 +11,8 @@ Stronglifters.HomeGym = Ractive.extend
oninit: ->
@on 'search', (event) -> @search(event)
@on 'choose', (event) -> @choose(event.context)
- @observe 'gym', -> @nameChanged()
+ @observe 'gym', -> @changed()
+ @observe 'city', -> @changed()
search: (event) ->
event.original.preventDefault()
@@ -21,7 +22,6 @@ Stronglifters.HomeGym = Ractive.extend
$.getJSON @buildSearchUrl(), (data) =>
@set(searching: false)
@displayResults(data)
- @enableSearchButton()
choose: (gym) ->
$.ajax
@@ -59,14 +59,14 @@ Stronglifters.HomeGym = Ractive.extend
disableSearchButton: ->
@set('search.button.disabled': true)
- nameChanged: ->
+ changed: ->
if @valid()
@enableSearchButton()
else
@disableSearchButton()
valid: ->
- @get('gym').trim().length >= 2
+ @get('gym').trim().length >= 2 && @get('city').trim().length >= 2
clearResults: ->
@set(gyms: [])
app/views/profiles/edit.html.erb
@@ -25,7 +25,7 @@
<legend><%= Profile.human_attribute_name(:home_gym) %></legend>
<p id="home-gym-name"><%= @profile.gym.try(:name) %></p>
<%= f.hidden_field(:gym_id) %>
- <a href="#" data-reveal-id="homeGymModal">Choose Home Gym</a>
+ <a href="#" data-reveal-id="homeGymModal"><%= t('.choose_home_gym') %></a>
</fieldset>
<%= f.submit t(".save"), class: "button" %>
<% end %>
config/locales/en.yml
@@ -71,8 +71,9 @@ en:
success: "Thank you for registering."
profiles:
edit:
- save: Save Profile
+ choose_home_gym: 'Choose Home Gym'
profile_update_success: "Profile updated. This is how your public profile appears."
+ save: Save Profile
home_gym_modal:
title: Home Gym
lead: Search for your regular gym.