diff options
| author | mo khan <mo@mokhan.ca> | 2016-05-28 10:08:20 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2016-05-28 10:08:20 -0600 |
| commit | dadd0004fdbf4e36b640e4e34770d19333ab8e5c (patch) | |
| tree | 49813e657a16609b24e38876628e24a5852c15b9 | |
| parent | a5198388e641ece22a5b7aa40382ada0f3570fcf (diff) | |
validate city name and move text to translations.
| -rw-r--r-- | app/assets/javascripts/templates/home_gym.ractive | 2 | ||||
| -rw-r--r-- | app/assets/javascripts/views/home_gym.js.coffee | 8 | ||||
| -rw-r--r-- | app/views/profiles/edit.html.erb | 2 | ||||
| -rw-r--r-- | config/locales/en.yml | 3 |
4 files changed, 8 insertions, 7 deletions
diff --git a/app/assets/javascripts/templates/home_gym.ractive b/app/assets/javascripts/templates/home_gym.ractive index a5231a7..f4893a0 100644 --- a/app/assets/javascripts/templates/home_gym.ractive +++ b/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}} diff --git a/app/assets/javascripts/views/home_gym.js.coffee b/app/assets/javascripts/views/home_gym.js.coffee index cf9968e..717bb0d 100644 --- a/app/assets/javascripts/views/home_gym.js.coffee +++ b/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: []) diff --git a/app/views/profiles/edit.html.erb b/app/views/profiles/edit.html.erb index 9b7a26a..f309659 100644 --- a/app/views/profiles/edit.html.erb +++ b/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 %> diff --git a/config/locales/en.yml b/config/locales/en.yml index 4a4f4e7..981d058 100644 --- a/config/locales/en.yml +++ b/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. |
