diff --git a/app/views/devise/registrations/edit.html.erb b/app/views/devise/registrations/edit.html.erb index e507e92698c3a27266db427dbdf589e5fcede416..fb70cc98492874a423f4f9a2add673de3ccdc189 100644 --- a/app/views/devise/registrations/edit.html.erb +++ b/app/views/devise/registrations/edit.html.erb @@ -1,17 +1,4 @@ -<div class="tabs"> - <%= link_to user_path(current_user), class: "tabs--item" do %> - <i class="fas fa-user"></i> Profile - <% end %> - <%= link_to edit_user_registration_path, class: "tabs--item is-active" do %> - Account - <% end %> - <%= link_to edit_user_profile_path, class: "tabs--item" do %> - Edit - <% end %> - <%= link_to subscriptions_path, class: "tabs--item" do %> - Subscriptions - <% end %> -</div> +<%= render 'users/tabs', user: current_user %> <h1>Edit Account Settings</h1> diff --git a/app/views/subscriptions/index.html.erb b/app/views/subscriptions/index.html.erb index a0b6396719104d3d05d54261d38e254f6589b0b8..774017ba6f1ef0e5093ffffaeacda6d85aa043c1 100644 --- a/app/views/subscriptions/index.html.erb +++ b/app/views/subscriptions/index.html.erb @@ -1,17 +1,4 @@ -<div class="tabs"> - <%= link_to user_path(current_user), class: "tabs--item" do %> - <i class="fas fa-user"></i> Profile - <% end %> - <%= link_to edit_user_registration_path, class: "tabs--item" do %> - Account - <% end %> - <%= link_to edit_user_profile_path, class: "tabs--item" do %> - Edit - <% end %> - <%= link_to subscriptions_path, class: "tabs--item is-active" do %> - Subscriptions - <% end %> -</div> +<%= render 'users/tabs', user: current_user %> <h1>Your Subscriptions</h1> <p>These are all the email subscriptions you're currently signed up for. You can turn them off or remove them entirely from here.</p> diff --git a/app/views/users/_tabs.html.erb b/app/views/users/_tabs.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..b871dd4ad37f1cb2edae5a6f676ac4eb4dad2aee --- /dev/null +++ b/app/views/users/_tabs.html.erb @@ -0,0 +1,20 @@ +<div class="tabs"> + <% puts user %> + <%= link_to user_path(user), class: "tabs--item #{current_page?(user_path(user)) ? 'is-active' : ''}" do %> + <i class="fas fa-user"></i> Profile + <% end %> + <%= link_to user_activity_path(user), class: "tabs--item #{current_page?(user_activity_path(user)) ? 'is-active' : ''}" do %> + Activity + <% end %> + <% if user == current_user %> + <%= link_to edit_user_registration_path, class: "tabs--item #{current_page?(edit_user_registration_path) ? 'is-active' : ''}" do %> + Account + <% end %> + <%= link_to edit_user_profile_path, class: "tabs--item #{current_page?(edit_user_profile_path) ? 'is-active' : ''}" do %> + Edit + <% end %> + <%= link_to subscriptions_path, class: "tabs--item #{current_page?(subscriptions_path) ? 'is-active' : ''}" do %> + Subscriptions + <% end %> + <% end %> +</div> \ No newline at end of file diff --git a/app/views/users/activity.html.erb b/app/views/users/activity.html.erb index 6b98cd193b5026873a0afe35edfbae6e270db09f..bafce3f2f6083a032c75506b4a46e32fea8708a0 100644 --- a/app/views/users/activity.html.erb +++ b/app/views/users/activity.html.erb @@ -1,22 +1,4 @@ -<div class="tabs"> - <%= link_to user_path(@user), class: "tabs--item" do %> - <i class="fas fa-user"></i> Profile - <% end %> - <%= link_to user_activity_path(@user), class: "tabs--item is-active" do %> - Activity - <% end %> - <% if @user == current_user %> - <%= link_to edit_user_registration_path, class: "tabs--item" do %> - Account - <% end %> - <%= link_to edit_user_profile_path, class: "tabs--item" do %> - Edit - <% end %> - <%= link_to subscriptions_path, class: "tabs--item" do %> - Subscriptions - <% end %> - <% end %> -</div> +<%= render 'tabs', user: @user %> <h1>Activity for <%= link_to @user.username, user_path(@user) %></h1> diff --git a/app/views/users/edit_profile.erb b/app/views/users/edit_profile.erb index 62676fde1334bed1ea56bd4f7f8966ad4ef557ba..89f75ce2815c775925b9d9985970d9b2618fa72d 100644 --- a/app/views/users/edit_profile.erb +++ b/app/views/users/edit_profile.erb @@ -1,22 +1,4 @@ -<div class="tabs"> - <%= link_to user_path(current_user), class: "tabs--item" do %> - <i class="fas fa-user"></i> Profile - <% end %> - <%= link_to user_activity_path(current_user), class: "tabs--item" do %> - Activity - <% end %> - <% if @user == current_user %> - <%= link_to edit_user_registration_path, class: "tabs--item" do %> - Account - <% end %> - <%= link_to edit_user_profile_path, class: "tabs--item is-active" do %> - Edit - <% end %> - <%= link_to subscriptions_path, class: "tabs--item" do %> - Subscriptions - <% end %> - <% end %> -</div> +<%= render 'tabs', user: current_user %> <h1>Edit Profile</h1> diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index 7602fabb30d677949b8494237e4ba7c3364d7864..051fe0cd01bcc712ab8179d63df7bc4a8930fa73 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -12,25 +12,7 @@ </div> <% end %> -<div class="tabs"> - <%= link_to user_path(@user), class: "tabs--item is-active" do %> - <i class="fas fa-user"></i> Profile - <% end %> - <%= link_to user_activity_path(@user), class: "tabs--item" do %> - Activity - <% end %> - <% if @user == current_user %> - <%= link_to edit_user_registration_path, class: "tabs--item" do %> - Account - <% end %> - <%= link_to edit_user_profile_path, class: "tabs--item" do %> - Edit - <% end %> - <%= link_to subscriptions_path, class: "tabs--item" do %> - Subscriptions - <% end %> - <% end %> -</div> +<%= render 'tabs', user: @user %> <div class="user-profile"> <div class="user-profile--image">