Skip to content

Commit

Permalink
helper scope fix #2
Browse files Browse the repository at this point in the history
  • Loading branch information
Mirv committed May 31, 2017
1 parent 102977c commit 244a8da
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion app/helpers/recipes_helper.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module RecipesHelper

def owner?
def recipe_owner?
owner_check(@recipe.user_id)
end

Expand Down
3 changes: 1 addition & 2 deletions app/helpers/workouts_helper.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
module WorkoutsHelper

def owner?
# owner_check(@recipe.user_id)
def workout_owner?
owner_check(@workout.user_id)
end

Expand Down
4 changes: 2 additions & 2 deletions app/views/recipes/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
<% end %>
</div>
</div>
<% if logged_in? and owner? %>
<% if logged_in? and recipe_owner? %>
<%= link_to "Edit this Recipe", edit_recipe_path(@recipe), class: "btn btn-success pull-right edit" %>
<%= link_to "[Delete Recipe]", @recipe, method: :delete, data: { confirm: "Are you sure?" }, class: "btn btn-danger pull-right delete"%>
<% end %>
Expand All @@ -73,7 +73,7 @@
</div>
<p><%= c.body %></p>
<i><small><%= c.updated_at.strftime("%m/%d/%Y") %></small></i>
<% if owner? %>
<% if recipe_owner? %>
<%= link_to "Delete", review_recipe_path(:revid => c.id), class:"btn btn-danger btn-small pull-right", method: :delete, data: { confirm: "Are you sure you want to delete this review?" } %>
<% end %>
</div>
Expand Down
4 changes: 2 additions & 2 deletions app/views/workouts/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
<div class="social-share-button">
Share this workout!<%= social_share_button_tag( "#{@workout.user.username}'s Workout Plan") %>
</div>
<% if logged_in? and (owner? || current_user.admin?) %>
<% if logged_in? and (workout_owner? || current_user.admin?) %>
<%= link_to "Edit this Workout", edit_workout_path(@workout), class: "btn btn-success pull-right edit" %>
&nbsp&nbsp
<%= link_to "[Delete Workout]", @workout, method: :delete, data: { confirm: "Are you sure?" }, class: "btn btn-danger pull-right delete"%>
Expand All @@ -81,7 +81,7 @@
</div>
<p> <%= c.body %> </p>
<i><small><%= c.updated_at.strftime("%m/%d/%Y") %></small></i>
<% if owner_check(c.user) %>
<% if workout_owner? %>
<%= link_to "Delete Review", review_workout_path(:revid => c.id), class:"btn btn-danger btn-small pull-right", method: :delete, data: { confirm: "Are you sure you want to delete this review?" } %>
<% end %>
</div>
Expand Down

0 comments on commit 244a8da

Please sign in to comment.