2012-06-05 20 views
0

在用於龍捲風-CMS頁面的控制,我請執行下列操作:如何在tornado.no/cms中存儲對頁面的更改?

def res = Service.tornado.articles([ articleCategoryPath: "boker/ny"]); 
Service.tornado.loadFullArticles(res); 
res.sort { a,b -> 
    b.props.year <=> a.props.year 
} 
tornado.small_articles = res; 

或者更短:

tornado.small_articles = Service.tornado.articles([ 
    articleCategoryPath: "boker/ny", 
    full: true ]) 
.sort { a, b -> b.props.year <=> a.props.year }; 

這將填充內容框small_articles從一個特定的所有文章按文章道具year反向排序的文件夾「boker/ny」。

它工作正常,但可以保存對內容框tornado.small_articles所做的更改,以便從GUI中也可以看到文章的結果列表嗎?像Service.tornado.saveChangesToPageContentBox(page, content_box_nr, tornado.small_articles);

+0

我剛剛從文檔中瞭解到,我可以通過在搜索查詢中添加'full:true'來完成整個操作。 'tornado.small_articles = Service.tornado.articles([articleCategoryPath:「boker/ny」,full:true])。sort {a,b - > b.props.year <=> a.props.year } – ivar

回答

0

開始通過刪除當前綁定到small_articles物品箱這樣的:

tornado.small_articles.each { 
    Service.tornado.addPageBinding(new ArticlePageContainer(page.id, it.id, containerId)); 
} 

你不應該這樣做的每一個:

Integer containerId = <id-of-small-articles-container>; 

Service.tornado.getPageBindings(page.id).each { binding -> 
    if (binding.containerId == containerId) 
     Service.tornado.deletePageBinding(binding); 
} 

然後爲你收集的文章添加新的綁定請求到給定頁面,而是在內容更改時更新列表,或者更頻繁一些的標準。

相關問題