Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

r:asset tag is broken in lib/asset_tags.rb (proposed fix) #53

Open
joshie opened this issue Dec 4, 2011 · 7 comments
Open

r:asset tag is broken in lib/asset_tags.rb (proposed fix) #53

joshie opened this issue Dec 4, 2011 · 7 comments

Comments

@joshie
Copy link

joshie commented Dec 4, 2011

when using <r:asset [name,id]="foo">bar/r:asset, there is breakage

This is fixed for me with the following modification to line 17 in lib/asset_tags.rb

    16:  tag 'asset' do |tag|
    17:    tag.locals.asset = find_asset unless tag.attr.empty?

to

16:  tag 'asset' do |tag|
17:    tag.locals.asset, options = asset_and_options(tag) unless tag.attr.empty?

... At least for me. I don't have a firm enough grasp on the code to know if there are any negatives to this fix.

@saturnflyer
Copy link
Member

I'm not sure I understand the problem. Can you elaborate?

@joshie
Copy link
Author

joshie commented Jan 7, 2012

Okay
If I do

<r:asset title="something">
  <r:asset:url />
</r:asset>

r:asset:url would not return the url for "something".

After my fix, it does.

@saturnflyer
Copy link
Member

Thanks for the clarification.

Why not just do

<r:asset title="something">
  <r:url />
</r:asset>

Does that not work? Or am I misunderstanding the use case?

@joshie
Copy link
Author

joshie commented Jan 7, 2012

What I am stating is that the <r:asset > block simply does not work unless you put the code fix in there. Anything you reference inside won't be referencing that asset, r:asset:url was just an example. The r:asset tag in it's current state is useless and nonfunctional.

It is so you can do a bunch of things with a single asset without having to keep referencing which asset with every command . (this is handy if, for example, you want to make a snippet that needs a bunch of arguments about the asset to interface to a fancy js that displays it, the snippet can be reused because it just goes inside the block and the snippet code can be generic. You can reference the url, the comment associated with the asset, etc).

@saturnflyer
Copy link
Member

Thank you for explaining. Got it. Thanks for reporting this.
I'll try to write the supporting specs this weekend unless someone beats me to it.

@joshie
Copy link
Author

joshie commented Jan 7, 2012

I do need to note that I may have misunderstood you, and this is the case that you would be telling that that inside the block, that r:url is actually referencing r:asset:url and something like r:caption would do what I expect it to.

However, I am pretty sure (i can't test because my live site actually has my fix in there), that you do get an error message output on your page simply by using the tag.

@joshie
Copy link
Author

joshie commented May 15, 2012

I just wanted to update that your suggestion does not work. That line of code needs to be updated as per my suggestion (or some other solution) for me to get something usable. Sorry for taking so long to check that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants