Commit 85a473c
Changed files (6)
app
assets
javascripts
templates
controllers
helpers
views
layouts
profiles
config
locales
app/assets/javascripts/templates/workout_view.ractive
@@ -1,5 +1,5 @@
{{#if clock}}
- <div class="alert callout warning">
+ <div class="alert callout {{alertStatus}}">
<p> {{message}} </p>
<p> Rest Clock: {{clock}} </p>
</div>
app/controllers/profiles_controller.rb
@@ -3,6 +3,7 @@ class ProfilesController < ApplicationController
@user = User.find_by(username: params[:id])
@profile = @user.profile
@program = Program.stronglifts
+ flash[:notice] = t("profiles.edit.profile_update_success")
end
def edit
app/helpers/application_helper.rb
@@ -27,4 +27,17 @@ module ApplicationHelper
iframe = content_tag(:iframe, "", width: 560, height: 315, src: "https://www.youtube-nocookie.com/embed/#{video}", frameborder: 0, allowfullscreen: true)
content_tag(:div, iframe, class: "flex-video")
end
+
+ def class_for_flash(type)
+ case type.to_sym
+ when :notice
+ "primary"
+ when :error
+ "alert"
+ when :warning
+ "warning"
+ when :success
+ "success"
+ end
+ end
end
app/views/layouts/_flash.html.erb
@@ -1,13 +1,12 @@
<% if flash.any? %>
<div class="row align-center">
<div class="columns">
- <% flash.each do |name, errors| %>
- <div class="alert callout <%= name %>" data-closable>
- <ul>
- <% Array(errors).each do |error| %>
- <%= content_tag :li, error %>
- <% end %>
- </ul>
+ <% flash.each do |type, messages| %>
+ <div class="callout <%= class_for_flash(type) %>" data-closable>
+ <h5><%= t(".#{type}") %></h5>
+ <% Array(messages).each do |message| %>
+ <%= content_tag :p, message %>
+ <% end %>
<button class="close-button" aria-label="Dismiss alert" type="button" data-close>
<span aria-hidden="true">×</span>
</button>
app/views/profiles/show.html.erb
@@ -1,5 +1,4 @@
<div class="row">
-
<div class="shrink columns">
<%= link_to profile_path(@user), class: "th [radius] gender_#{@profile.gender} social_#{@profile.social_tolerance}" do %>
<%= gravatar_for(@user, size: 128) %>
config/locales/en.yml
@@ -58,6 +58,11 @@ en:
profile_edit: "Edit profile"
profile_view: "View profile"
title: Strong Lifters
+ flash:
+ notice: 'Yay!'
+ warning: 'Uh oh!'
+ error: 'Oops...'
+ success: 'Yeah Buddy!'
gyms:
index:
title: Gyms