[Masterview-users] Logging from within a directive [img element markup]

Jeff Barczewski
Sat, 10 Jun 2006 02:55:02 -0000

Yeah, I think we can easily make a tag that will intuit the path from the
src, and of course it can pick up the height and width from the settings.
Many times the wysiwyg editor will set those for you automatically, so if we
just pick those up then that would be a big help.

We could take it a step further and determine the image size ourself, cache
it, and if not specified auto use the image size.

Will start simple and then play around to see what we can do.

On 6/9/06, Deb Lewis <djlewis at acm.org> wrote:
>
> RE: mv:image_tag attribute notation and Ed''s remarks:
>
> >> Currently, to support image sizes and other attributes, I am
forced
> >> to do this for all my image tags:
> >> <img src="../../../public/images/my.gif"
height="17" width="16
> >>      mv:image_tag="''my.gif'', :size =>
''17x16''">
>
> Ed - we''ll probably have to think about that a bit before
responding
> further.
>
> In the meantime, you might consider some alternative techniques approaches
> using css style rules with your elements.
>
> Option 1: if you have a small set of specific images that you use in a
> number of places, consider defining a class in your css stylesheet for
> these
> so you don''t have to hard-code the size attributes in the
markup.
>
>     <img src="../../../public/images/my.gif"
height="17" width="16
>          mv:image_tag="''my.gif'', :size =>
''17x16''" />
>
> could be replaced with style rule and simplified markup:
>
>     img.my-gif {  width: 16px;  height: 17px; }
>     <img src="../../../public/images/my.gif"
class="my-gif"
>          mv:image_tag="''my.gif'', :class =>
''my-gif''" />
>
> (don''t like the need to duplicate the style rule class, but IMO
that''s
> still
> a better than bolting down image file size attributes directly in content
> pages)
>
> Option 2: if you have a number of standard-sized images that you use
> frequently, do a variation of the preceding with a style rule, say, some
> name by ''visual-cue-img'', whatever makes sense.
>
> And a possible option 3: create a custom masterview directive to
> encapsulate
> a standard pattern than you want to use across a number of pages in our
> site.
>
> (I actually have a situation that #3 solves nicely in I''m doing
right now,
> so after working out details will probably contribute it to the next
> MasterView release as an example of how to do a custom masterview
> directive)
>
> >>> So even <img src="../../../public/images/my.gif"
needs:
> >>  mv:image_tag="''my.gif''"
>
> Jeff - this might be interesting, let''s take a look at this case
when we
> have a chance.  It''s quite similar to the target substitution
magic we''re
> working on right now for mv:generate.  The template being processed
> already
> provides some info about what the directive should produce and it would be
> nice if the author didn''t have to repeat the image
asset''s name.  e.g.
> some
> sort of mv:image="{this_src}" notation, if we can specify a
sensible rule
> about how to determine the relevant portion of the
tag''s existing
> src
> attribute to use in the generated output.
>
> (?? mv:image_tag="{src_filename}" notation could work for images
directly
> contained in the std rails public/images dir; not sure how far to push on
> trying to automagically determine a relative path name w/in the images
> dir,
> there are issues of nesting in the template src dir that make ugly ..
> paths
> like the above tricky)
>
> ~ Deb
>
>
> _______________________________________________
> Masterview-users mailing list
> Masterview-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/masterview-users
>
-------------- next part --------------
An HTML attachment was scrubbed...