调用Script.Require从IResultFilter在果园CMS不工作返回形状看法? [英] Calling Script.Require in Shape view returned from IResultFilter not working in Orchard CMS?

查看:133
本文介绍了调用Script.Require从IResultFilter在果园CMS不工作返回形状看法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在写我自己的模块,需要在所有页面加载一些脚本,无论在前端和仪表板,其中授权用户编辑内容。我已经写了IResultFilter的实现,在该网站的主题增添了外形的'尾巴'区。

I'm currently writing my own module that needs some scripts to be loaded on all pages, both on the front-end and the dashboard, where the user is authorized to edit content. I've written an implementation of the IResultFilter that adds a shape to the 'tail' zone in the site's theme.

形状将被添加到正确的页面,都是除了一件事确定。在相同的形状,我也试图调用Script.Require上,我已经加入到ResourceManifest几个剧本,但他们不是在页面加载。

The shape is added to the page correctly and all is OK except for one thing. In the same shape I'm also trying to call Script.Require on a few scripts that I've added to the ResourceManifest, but they're not being loaded in to the page.

@{
    Script.Require("OrchardTinyMce");
    Script.Require("jQueryColorBox");
}

如果我把同样的code在并非使用我IResultsFilter实现,那么他们将被添加到页面呈现的视图。我宁愿保持code这一点在它的当前视图但正如两名候补进一步下跌需要相同的脚本行,我真的不希望复制它。

If I place this same code in a view that's not rendered using my IResultsFilter implementation then they are added to the page. I'd rather keep this bit of code in it's current view though as two alternates further down the line which require the same scripts and I don't really want to duplicate it.

没有人有任何想法如何,我拿到剧本登记?在此先感谢您的帮助。

Does anyone have any ideas how I get the scripts to register? Thanks in advance for you help.

推荐答案

我已经计算出如何做到这一点。我刚刚注入IResourceManager到我HtmlFilter,然后添加脚本如下:

I've worked out how to do this. I've just injected IResourceManager into my HtmlFilter and then added the scripts as follows:

_resourceManager.Require("OrchardTinyMce");
_resourceManager.Require("jQueryColorBox");

这篇关于调用Script.Require从IResultFilter在果园CMS不工作返回形状看法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆