开发者

Define Custom Attributes for Spark View Engine

Is there any way (preferably without modifying the source) that you can define a custom attribute to apply to your spark elements?

For example, I'd like to define a "permission" attribute so that I can do something like:

<div permission="CanViewDivs">

</div>

which would then map to a specific bit of code that would determine if the current user can view divs and hide it if not.

I know about the condition attribute and the spark b开发者_如何学JAVAindings, but these don't quite accomplish what I want.


The answer is "No" I'm afraid. To do this, we'd have to have some kind of schema that we'd feed into the Special Node parser and compiler, and I just don't see that as tenable or pragmatic unless you can convince me otherwise :)

Happy to look at the use cases for this in more depth and decide if it's the kind of thing that can be added. But as Dave said in his comment, this kind of visual logic should come from the view models, or at least that's the way I build my projects. But then you're probably letting your users edit the templates themselves and you've got a rendering subsystem behind this I imagine which is why you're asking in the first place - i.e. you want to give more power to your users without having to recompile the software...

This sadly is something I don't think a view engine should be responsible for, but as I said, I'd be happy to chat about possible use cases...

You know how to get in touch...

Cheers,
Rob

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜