Commit bf2ed65

mo khan <mo@mokhan.ca>
2017-02-12 23:51:04
fix up profile#edit.
1 parent c0e734e
Changed files (4)
app/views/application/_footer.html.erb
@@ -1,7 +1,7 @@
 <footer class="footer">
   <div class="container">
     <div class="content has-text-centered">
-      <p><%= t("footer.copyright") %></p>
+      <p><%= t(".copyright") %></p>
       <p>
       <a class="icon" href="https://github.com/stronglifters">
         <i class="fa fa-github"></i>
app/views/dashboards/show.html.erb
@@ -1,27 +1,8 @@
-<div class="container">
-  <div class="columns">
-    <div class="column is-3">
-      <aside class="menu">
-        <p class="menu-label">
-        General
-        </p>
-        <ul class="menu-list">
-          <li><%= link_to t(".dashboard"), dashboard_path, class: 'is-active' %></li>
-        </ul>
-        <p class="menu-label">
-        Administration
-        </p>
-        <ul class="menu-list">
-          <li><%= link_to "Edit Profile", edit_profile_path(current_user) %></li>
-        </ul>
-      </aside>
-    </div>
-    <div class="column is-9">
-      <% unless @completed_workout %>
-        <p>welcome back</p>
-      <% else %>
-        <%= render partial: 'import_address_modal' %>
-      <% end %>
-    </div>
-  </div>
-</div>
+<% content_for :content do %>
+  <% if @completed_workout %>
+    <p>welcome back</p>
+  <% else %>
+    <%= render partial: 'import_address_modal' %>
+  <% end %>
+<% end %>
+<%= render template: "layouts/administration" %>
app/views/layouts/administration.html.erb
@@ -0,0 +1,24 @@
+<div class="container">
+  <div class="columns">
+    <div class="column is-3">
+      <aside class="menu">
+        <p class="menu-label">
+        General
+        </p>
+        <ul class="menu-list">
+          <li><%= link_to t(".dashboard"), dashboard_path, class: 'is-active' %></li>
+        </ul>
+        <p class="menu-label">
+        Administration
+        </p>
+        <ul class="menu-list">
+          <li><%= link_to "Edit Profile", edit_profile_path(current_user) %></li>
+        </ul>
+      </aside>
+    </div>
+    <div class="column is-9">
+      <%= yield :content %>
+    </div>
+  </div>
+</div>
+
app/views/profiles/edit.html.erb
@@ -1,44 +1,33 @@
-<div class="row">
-  <div class="columns text-center">
+<% content_for :content do %>
+  <figure class="image is-128x128">
     <%= gravatar_for(@current_user, size: 128) %>
-    <h1><%= @current_user.username %></h1>
-    <%= form_for(@profile) do |f| %>
-      <fieldset class="fieldset">
-        <legend><%= Profile.human_attribute_name(:gender) %></legend>
-        <% Profile.genders.keys.each do |gender| %>
-          <%= f.radio_button(:gender, gender) %>
-          <%= f.label("gender_#{gender}", Profile.human_attribute_name(gender)) %>
-        <% end %>
-      </fieldset>
-      <fieldset class="fieldset">
-        <legend><%= Profile.human_attribute_name(:social_tolerance) %></legend>
-        <% Profile.social_tolerances.keys.each do |social_tolerance| %>
-          <%= f.radio_button(:social_tolerance, social_tolerance) %>
-          <%= f.label("social_tolerance_#{social_tolerance}", Profile.human_attribute_name(social_tolerance)) %>
-        <% end %>
-      </fieldset>
-      <fieldset class="fieldset">
-        <legend><%= Profile.human_attribute_name(:time_zone) %></legend>
-        <%= f.time_zone_select(:time_zone, ActiveSupport::TimeZone.us_zones) %>
-      </fieldset>
-      <fieldset class="fieldset">
-        <legend><%= Profile.human_attribute_name(:home_gym) %></legend>
-        <p id="home-gym-name"><%= @profile.gym.try(:name) %></p>
-        <%= f.hidden_field(:gym_id) %>
-        <button data-open="homeGymModal" class="button" type="button"><%= t('.choose_home_gym') %></button>
-      </fieldset>
-      <%= f.submit t(".save"), class: "button"  %>
-    <% end %>
-  </div>
-</div>
+  </figure>
+  <h1 class="title"><%= @current_user.username %></h1>
+  <%= form_for @profile do |form| %>
+    <%= form.label :gender, class: 'label' %>
+    <p class="control">
+      <% Profile.genders.keys.each do |gender| %>
+        <%= form.radio_button(:gender, gender, class: 'radio') %>
+        <%= form.label("gender_#{gender}", Profile.human_attribute_name(gender), class: 'radio') %>
+      <% end %>
+    </p>
+    <%= form.label :social_tolerance, class: 'label' %>
+    <p class="control">
+      <% Profile.social_tolerances.keys.each do |social_tolerance| %>
+        <%= form.radio_button(:social_tolerance, social_tolerance, class: 'radio') %>
+        <%= form.label("social_tolerance_#{social_tolerance}", Profile.human_attribute_name(social_tolerance), class: 'radio') %>
+      <% end %>
+    </p>
 
-<%= render partial: "home_gym_modal", locals: { id: 'homeGymModal' } %>
+    <%= form.label :time_zone, class: 'label' %>
+    <p class="control">
+      <%= form.time_zone_select(:time_zone, ActiveSupport::TimeZone.us_zones, class: 'input') %>
+    </p>
 
-<script type="text/javascript" charset="utf-8">
-window.currentView = new Stronglifters.HomeGym({
-  el: 'gym-search',
-  data: function() {
-    return { city: '<%= current_session.location.try(:city) %>' };
-  }
-})
-</script>
+    <p class="control">
+      <%= form.submit t(".save"), class: "button is-primary"  %>
+    </p>
+  <% end %>
+<% end %>
+
+<%= render template: "layouts/administration" %>