我想在ActiveAdmin的控制面板中包含一個包含部分的部分。該部分出現,但它是空白的 - 我如何使部分出現?我想顯示一張Highcharts圖表。ActiveAdmin儀表板部分未顯示?
這裏是我的代碼:
dashboards.rb:
section "Business Summary", do
div do
render 'graph'
end
end
_graph.html.erb(位於應用程序/視圖/管理/儀表板):
<script src="http://code.highcharts.com/highcharts.js"></script>
<script src="http://code.highcharts.com/modules/exporting.js"></script>
<script type="text/javascript" charset="utf-8">
$(function() {
var chart;
$(document).ready(function() {
chart = new Highcharts.Chart({
chart: {
renderTo: 'container',
type: 'column'
},
xAxis: {
categories: ['Automotive', 'Agency', 'Contractor', 'Country Club', 'Other']
},
yAxis: {
min: 0,
title: {
text: 'Business Summary'
},
stackLabels: {
enabled: true,
style: {
fontWeight: 'bold',
color: (Highcharts.theme && Highcharts.theme.textColor) || 'gray'
}
}
},
legend: {
align: 'right',
x: 100,
verticalAlign: 'top',
y: 0,
floating: true,
backgroundColor: (Highcharts.theme && Highcharts.theme.legendBackgroundColorSolid) || 'white',
borderColor: '#CCC',
borderWidth: 1,
shadow: false
},
tooltip: {
formatter: function() {
return '<b>' + this.x + '</b><br/>' + this.series.name + ': ' + this.y + '<br/>' + 'Total: ' + this.point.stackTotal;
}
},
plotOptions: {
column: {
stacking: 'normal',
dataLabels: {
enabled: true,
color: (Highcharts.theme && Highcharts.theme.dataLabelsColor) || 'white'
}
}
},
series: [{
name: 'Mobile',
data: [5, 3, 4, 27, 2]},
{
name: 'Foursquare',
data: [2, 2, 3, 2, 1]},
{
name: 'Facebook',
data: [3, 4, 4, 2, 5]},
{
name: 'Yelp',
data: [3, 4, 4, 2, 5]},
{
name: 'Google',
data: [3, 4, 4, 2, 5]}]
});
});
});
</script>
<div id="container" style="min-width: 400px; height: 400px; margin: 0 auto"></div>
您是否嘗試過指定完整的路徑名稱(即'render'admin/dashboard/graph'')? – cdesrosiers
我只是試了一下,現在我得到這個錯誤='缺少部分渲染管理/儀表板/圖{:locale => [:en],:formats => [:html],:handlers => [:erb,: } – Slicekick
我可以得到一個虛擬的部分工作,所以我認爲問題是與實際的部分代碼... – Slicekick