summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2013-07-01 11:44:53 -0700
committermo khan <mo@mokhan.ca>2013-07-01 11:44:53 -0700
commitd07f64c2435168339c2d3ca071395efa0eceffed (patch)
tree6c9b9200c1e6291f3b4dbea20cf8266eca76f4f8
parentaae581257b12d0c1dfdefb74b9d4349d4cfe6127 (diff)
highlight the appropriate tab in the settings section
-rw-r--r--app/helpers/application_helper.rb7
-rw-r--r--app/views/avatars/edit.html.erb2
-rw-r--r--app/views/passwords/index.html.erb3
-rw-r--r--app/views/settings/index.html.erb5
-rw-r--r--app/views/shared/_account_nav.html.erb6
5 files changed, 9 insertions, 14 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index b9a61e99..57d25f4c 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -1,10 +1,7 @@
module ApplicationHelper
def avatar_for(user, options = {size:260, class:''})
- if user.avatar == nil
- return gravatar_for(user, options)
- else
- image_tag(user.avatar.avatar.thumb.url, alt: user.name, class: options[:class], :style => "width:#{options[:size]}px;")
- end
+ return gravatar_for(user, options) unless user.avatar
+ image_tag(user.avatar.avatar.thumb.url, alt: user.name, class: options[:class], :style => "width:#{options[:size]}px;")
end
def gravatar_for(user, options = { size: 260 })
diff --git a/app/views/avatars/edit.html.erb b/app/views/avatars/edit.html.erb
index 92b803aa..58acf189 100644
--- a/app/views/avatars/edit.html.erb
+++ b/app/views/avatars/edit.html.erb
@@ -1,4 +1,4 @@
-<%= render :partial => "shared/account_nav" %>
+<%= render :partial => "shared/account_nav", :locals => { :selected => :picture } %>
<div class="row">
<div class="span12">
diff --git a/app/views/passwords/index.html.erb b/app/views/passwords/index.html.erb
index 00daca6e..a2df2de3 100644
--- a/app/views/passwords/index.html.erb
+++ b/app/views/passwords/index.html.erb
@@ -1,8 +1,7 @@
-<%= render :partial => "shared/account_nav" %>
+<%= render :partial => "shared/account_nav", :locals => { :selected => :password } %>
<div class="row">
<div class="span12">
- <h3>Change Password</h3>
<%= form_for(@user, :url => password_path(@user), :html => { :method => :put, :class => "form-horizontal" }) do |f| %>
<div class="control-group">
<%= f.label :password, "New password", :class => "control-label" %>
diff --git a/app/views/settings/index.html.erb b/app/views/settings/index.html.erb
index 5d3fcabe..ea3824f5 100644
--- a/app/views/settings/index.html.erb
+++ b/app/views/settings/index.html.erb
@@ -7,11 +7,10 @@ $(function(){
</script>
<% end %>
-<%= render :partial => "shared/account_nav" %>
+<%= render :partial => "shared/account_nav", :locals => { :selected => :basic_info } %>
<div class="row">
<div class="span12">
- <h1>My Settings</h1>
<%= form_for(@user, :url => setting_path(@user), :html => { :method => :put, :class => "form-horizontal" }) do |f| %>
<fieldset>
<div class="control-group">
@@ -28,7 +27,7 @@ $(function(){
</div>
<div class="control-group">
<%= f.label :website, :class => "control-label" %>
- <div class="controls"> <%= f.url_field :website, :class => "input-xlarge, url", :placeholder => "http://cakeside.com" %> </div>
+ <div class="controls"> <%= f.url_field :website, :class => "input-xlarge url", :placeholder => "http://cakeside.com" %> </div>
</div>
<div class="control-group">
<%= f.label :twitter, "Twitter username @", :class => "control-label" %>
diff --git a/app/views/shared/_account_nav.html.erb b/app/views/shared/_account_nav.html.erb
index d53ba5f6..4e6b758a 100644
--- a/app/views/shared/_account_nav.html.erb
+++ b/app/views/shared/_account_nav.html.erb
@@ -1,9 +1,9 @@
<div class="row">
<div class="span12">
<ul class="nav nav-tabs">
- <li><%= link_to "Basic info", settings_path %></li>
- <li><%= link_to "Password", passwords_path(@user) %></li>
- <li><%= link_to "Picture", edit_avatar_path(@user) %></li>
+ <li class="<%= selected == :basic_info ? "active" : "" %>"><%= link_to "Basic info", settings_path %></li>
+ <li class="<%= selected == :password ? "active" : "" %>"><%= link_to "Password", passwords_path(@user) %></li>
+ <li class="<%= selected == :picture ? "active" : "" %>"><%= link_to "Picture", edit_avatar_path(@user) %></li>
</ul>
</div>
</div>