Ah brilliant!
Thank you that is perfect!
I was thinking the context was still within the table, and not the heading
'state' element!
On a similar subject - when you have transition buttons in <controls:> is
it possible for these to have a heading within that table - as by default
it is blank?
Pete
On Monday, 19 May 2014 13:02:14 UTC+1, Ignacio Huerta wrote:
>
> Hi Pete,
>
> You code looks great, there's just a small detail missing: instead of
> "this.state", you should use "this", when you are inside the
> <state-view:> tag. Like this:
>
> <state-view:>
>
> <% if this == "passed" %>
>
> <%= image_tag("icon-tick.png", :style => "vertical-align:middle",
> :border => "0") %>
> <% elsif this == "failed" %>
>
> <%= image_tag("icon-cross.png", :style => "vertical-align:middle",
> :border => "0") %>
>
> <% end %>
>
> </state-view:>
>
> Or if you want something shorter:
>
> <state-view:>
> <%= image_tag((this == 'passed' ? "icon-tick.png" :
> "icon-cross.png"), :style => "vertical-align:middle", :border => "0") %>
> </state-view:>
>
> Warm regards,
> Ignacio
>
> El 19/05/14 13:39, Pete escribió:
> > Hi,
> >
> > Been a while since I was on here, glad to see Hobo still going strong!
> >
> > I am trying to manipulate the view within a table plus, and use an image
> > instead - this is easily achieved with
> >
> > <state-view:>
> > <%= image_tag("icon-tick.png", :style => "vertical-align:middle",
> > :border => "0") %>
> > </state-view:>
> >
> > and then the 'state' gets the image view
> >
> > However, I would like this to change depending on the 'state' (this is a
> > transition set up in the model)
> >
> > So two states are 'passed' and 'failed'
> >
> > is there a way of using conditionals to use a different image depending
> > on the result of the state?
> >
> > i.e like this:
> >
> > <table-plus:results fields="test, test.description, test.test_group,
> > state" without-search-form>
> >
> > <state-view:>
> >
> > <% if this.state == "passed" %>
> >
> > <%= image_tag("icon-tick.png", :style => "vertical-align:middle",
> > :border => "0") %>
> > <% elsif this.state == "failed" %>
> >
> > <%= image_tag("icon-cross.png", :style => "vertical-align:middle",
> > :border => "0") %>
> >
> > <% end %>
> >
> > </state-view:>
> >
> > Many thanks in advance
> >
> > Pete
> >
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Hobo Users" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> > an email to [email protected] <javascript:>
> > <mailto:[email protected] <javascript:>>.
> > To post to this group, send email to [email protected]<javascript:>
> > <mailto:[email protected] <javascript:>>.
> > Visit this group at http://groups.google.com/group/hobousers.
> > For more options, visit https://groups.google.com/d/optout.
>
--
You received this message because you are subscribed to the Google Groups "Hobo
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/hobousers.
For more options, visit https://groups.google.com/d/optout.