Content:Toolbar 缺少添加按钮
add button is missing for Content:Toolbar
显示在 2sxc 项目上的添加按钮突然不见了。它在那里几天了,但现在当我登录到我的 DNN 实例中的任何门户时,“+”或添加按钮丢失了
这是一个屏幕截图:
如您所见,更改布局和编辑按钮就在那里。不知道为什么添加按钮消失了。
我从 2sxc.org 网站导入的应用程序也是如此。所以我知道它不仅仅是我的模板,因为它也发生在我创建的所有使用不同模板的应用程序上。
但为了彻底,这是我的模板代码,它基于令牌:
<div class="kr-gallery animation">
<p>Hover or touch image and click brush icon for more details</p>
<div class="isotope_grid isotope_grid2">
<div class="isotope_main animation" data-min-width="230">
<repeat repeat="Content in Data:Default">
<div class="isotope_item kr-gallery-item sc-element">[Content:Toolbar]
<div class="photo"><a href="[Tab:FullUrl]/details/[Content:EntityId]"> <img alt="" src="[Content:Image]?h=500" />
<span class="fa fa-paint-brush"></span></a>
</div>
</div>
</repeat>
</div>
</div>
</div>
知道这是为什么吗?
更新:
这是我的视觉查询:
解决方案:
根据回答,我改用了 razor,因为我使用的是自定义查询。现在这是我的简单模板代码:
@* this will show an "add" button if the current user is an editor *@
@Edit.Toolbar(actions: "new", contentType: "Image")
@{
// get all images as delived from the standard query
var images = AsDynamic(Data["Default"]);
}
<div class="kr-gallery animation">
<p>Hover or touch image and click brush icon for more details</p>
<div class="isotope_grid isotope_grid2">
<div class="isotope_main animation" data-min-width="230">
@foreach(var img in images)
{
<div class="isotope_item kr-gallery-item sc-element">@img.Toolbar
<div class="photo"><a href="@Link.To(parameters: "details=" + img.EntityId)"> <img alt="@img.Title" src="@img.Image?h=500" />
<span class="fa fa-paint-brush"></span></a>
</div>
</div>
}
</div>
</div>
</div>
我可能是错的,但您最近是否尝试过可视化查询设计器?因为这可能是原因。
最常见的原因是当您使用管道(可视化查询)将数据传送到未分配给此实例的模板时。原因是 "add" 在项目的实例列表中将其添加到特定位置(就像在第一个之后)。当您使用数据库之类的数据时,情况就不一样了——因为在那种情况下没有排序。所以如果这是原因,我会帮助你更多。
缺少 + 是设计使然,因为编辑者习惯于 + 在前一个项目之后添加一个项目。查询无法保证此行为,因为事物的顺序由查询确定。如果查询参数隐藏了该项目,则添加项目甚至可能不会显示。
所以设计模式是提供一个单独的+按钮。最简单的方法是在剃须刀中,我相信代码类似于
@Edit.Toolbar(动作:"new",内容类型:"your-content-type-name")
在 Tokens 中有点混乱,您不能有条件地检查用户是否具有编辑权限。
所以我建议你走 edit.toolbar 的路
您还可以在博客应用程序中找到这方面的示例:http://2sxc.org/en/apps/app/dnn-blog-app-for-dnn-dotnetnuke
显示在 2sxc 项目上的添加按钮突然不见了。它在那里几天了,但现在当我登录到我的 DNN 实例中的任何门户时,“+”或添加按钮丢失了
这是一个屏幕截图:
如您所见,更改布局和编辑按钮就在那里。不知道为什么添加按钮消失了。
我从 2sxc.org 网站导入的应用程序也是如此。所以我知道它不仅仅是我的模板,因为它也发生在我创建的所有使用不同模板的应用程序上。
但为了彻底,这是我的模板代码,它基于令牌:
<div class="kr-gallery animation">
<p>Hover or touch image and click brush icon for more details</p>
<div class="isotope_grid isotope_grid2">
<div class="isotope_main animation" data-min-width="230">
<repeat repeat="Content in Data:Default">
<div class="isotope_item kr-gallery-item sc-element">[Content:Toolbar]
<div class="photo"><a href="[Tab:FullUrl]/details/[Content:EntityId]"> <img alt="" src="[Content:Image]?h=500" />
<span class="fa fa-paint-brush"></span></a>
</div>
</div>
</repeat>
</div>
</div>
</div>
知道这是为什么吗?
更新:
这是我的视觉查询:
解决方案:
根据回答,我改用了 razor,因为我使用的是自定义查询。现在这是我的简单模板代码:
@* this will show an "add" button if the current user is an editor *@
@Edit.Toolbar(actions: "new", contentType: "Image")
@{
// get all images as delived from the standard query
var images = AsDynamic(Data["Default"]);
}
<div class="kr-gallery animation">
<p>Hover or touch image and click brush icon for more details</p>
<div class="isotope_grid isotope_grid2">
<div class="isotope_main animation" data-min-width="230">
@foreach(var img in images)
{
<div class="isotope_item kr-gallery-item sc-element">@img.Toolbar
<div class="photo"><a href="@Link.To(parameters: "details=" + img.EntityId)"> <img alt="@img.Title" src="@img.Image?h=500" />
<span class="fa fa-paint-brush"></span></a>
</div>
</div>
}
</div>
</div>
</div>
我可能是错的,但您最近是否尝试过可视化查询设计器?因为这可能是原因。
最常见的原因是当您使用管道(可视化查询)将数据传送到未分配给此实例的模板时。原因是 "add" 在项目的实例列表中将其添加到特定位置(就像在第一个之后)。当您使用数据库之类的数据时,情况就不一样了——因为在那种情况下没有排序。所以如果这是原因,我会帮助你更多。
缺少 + 是设计使然,因为编辑者习惯于 + 在前一个项目之后添加一个项目。查询无法保证此行为,因为事物的顺序由查询确定。如果查询参数隐藏了该项目,则添加项目甚至可能不会显示。
所以设计模式是提供一个单独的+按钮。最简单的方法是在剃须刀中,我相信代码类似于
@Edit.Toolbar(动作:"new",内容类型:"your-content-type-name")
在 Tokens 中有点混乱,您不能有条件地检查用户是否具有编辑权限。
所以我建议你走 edit.toolbar 的路
您还可以在博客应用程序中找到这方面的示例:http://2sxc.org/en/apps/app/dnn-blog-app-for-dnn-dotnetnuke