forked from OpenNeo/impress
Remove slightly-broken edit outfit links from user outfits page
The URL anchors were getting like. double-encoded? The `closet[]` part was encoding as `closet%255B%255D`. Maybe a thing in Rails, where you need to mark them `html_safe` to insert them in a URL like that? Well anyway, those URLs are redundant now, I just have it link straight to the same outfit page as the big link!
This commit is contained in:
parent
5ba711a413
commit
c06cea2a3c
3 changed files with 1 additions and 27 deletions
|
@ -10,20 +10,6 @@ module OutfitsHelper
|
|||
:user_link => link_to(user.name, user_contributions_path(user)),
|
||||
:contributed_description => contributed_description(contributed, false)
|
||||
end
|
||||
|
||||
def link_to_edit_outfit(content_or_outfit, outfit_or_options, options={}, &block)
|
||||
if block_given?
|
||||
content = capture_haml(&block)
|
||||
outfit = content_or_outfit
|
||||
options = outfit_or_options
|
||||
else
|
||||
content = content_or_outfit
|
||||
outfit = outfit_or_options
|
||||
end
|
||||
query = outfit.to_query
|
||||
query << "&outfit=#{outfit.id}" if user_signed_in? && outfit.user_id == current_user.id
|
||||
link_to content, wardrobe_path(:anchor => query), options
|
||||
end
|
||||
|
||||
def search_helper(filter, standard_key)
|
||||
key = translate("#{filter}.key")
|
||||
|
|
|
@ -83,18 +83,6 @@ class Outfit < ApplicationRecord
|
|||
pet_state.pet_type.species_id
|
||||
end
|
||||
|
||||
def to_query
|
||||
ids = self.worn_and_unworn_item_ids
|
||||
|
||||
{
|
||||
:closet => ids[:worn] + ids[:unworn],
|
||||
:color => color_id,
|
||||
:objects => ids[:worn],
|
||||
:species => species_id,
|
||||
:state => pet_state_id
|
||||
}.to_query
|
||||
end
|
||||
|
||||
def worn_and_unworn_item_ids
|
||||
{:worn => [], :unworn => []}.tap do |output|
|
||||
item_outfit_relationships.each do |rel|
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
= link_to outfit.name, outfit, :class => 'outfit-name'
|
||||
|
||||
%footer
|
||||
= link_to_edit_outfit t('.edit'), outfit, :class => 'outfit-edit-link'
|
||||
= link_to t('.edit'), outfit, :class => 'outfit-edit-link'
|
||||
= button_to t('.delete'), outfit, :method => 'delete',
|
||||
:class => 'outfit-delete-button',
|
||||
:confirm => t('.delete_confirmation',
|
||||
|
|
Loading…
Reference in a new issue