html.erbにJSのデータプログラムを入れ込みgon gemを使ってデータベースのデータを取得してガントチャートを表示させたいのですがうまくいきません.使い方間違っているでしょうか.
使っているプラグインはこちらです.
http://taitems.github.io/jQuery.Gantt
ちなみにproduction_start_timeとgon.production.production_end_timeは
Date型で2016-2-6-12:00等のデータが入っています.
<html lang="ja"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=Edge;chrome=IE8"> <%= stylesheet_link_tag "style", :media=> "all" %> <%= stylesheet_link_tag "style2", :media=> "all" %> </head> <body> <div class="contain"> <div class="gantt"></div> <%= include_gon %> <%= javascript_include_tag "index" %> <%= javascript_include_tag "jquery.min" %> <%= javascript_include_tag "jquery.fn.gantt"%> <%= javascript_include_tag "moment.min"%> <script type="text/javascript"> $(function() { "use strict"; var today = moment(); var andTwoHours = moment().add(2, "hours"); var today_friendly = "/Date(" + today.valueOf() + ")/"; var next_friendly = "/Date(" + andTwoHours.valueOf() + ")/"; $(".gantt").gantt({ source: [{ name: "gon.production.products_number", desc: "gon.production.branch_number", values: [{ from: "/Date(gon.production.production_start_time)/", to: "/Date(gon.production.production_end_time)/", label: "gon.production.products_number", customClass: "ganttRed" }] }], scale: "hours", minScale: "day", navigate: "scroll" }); }); </script>
class GantController < ApplicationController def index gon.production = Production.all end end
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。