This is what I have for the moment, but I plan to implement this properly
using the variables from gluon.tools; consider this a PoC:
{{if response.flash:}}<header>
{{if 'errors' in response.flash:}}
<div class="alert alert-block alert-error fade in">
<button type="button" class="close" data-dismiss="alert">
×
</button>
<p>
{{=response.flash}}
</p>
</div>
{{else:}}
<div class="alert alert-block fade in">
<button type="button" class="close" data-dismiss="alert">
×
</button>
<p>
{{=response.flash}}
</p>
</div>
{{pass}}</header>
{{pass}}
Also will need to add in proper success ones as well. I'll get to it within
a week then send a pull request.
Until then, enjoy :)
On Sun, Sep 2, 2012 at 4:06 PM, Annet <[email protected]> wrote:
> Hi Alec,
>
>
>> I've got a better flash code using bootstrap components.
>>
>> It works quite nicely, giving different colours based on severity of
>> message. [alert-error, alert-success &etc]
>
>
> I am interested in your implementation of the flash and alert, would you
be
> willing to share your code with me?
>
> I have been trying to implement it myself, in the function I set
> alert='alert-block' and return it in a dict(alert=alert), in the view I
> have:
>
> {{if response.flash:}}
> <div class="alert {{if alert:}}{{=alert}}{{elif
> session.alert:}}{{=session.alert}}{{else:}}{{'alert-info'}}{{pass}}">
> <a class="close" data-dismiss="alert">x</a>
> {{=response.flash}}
> </div> <!-- /alert -->
> {{pass}}
>
> I need session.alert to set alerts cross functions, but I am not very
happy
> with this way of setting alert.
>
>
> Kind regards,
>
> Annet
--