我正在试验 Raphael、SVG 和 rails。我希望量具作为各种进度指示器动态更新,因为每个任务都通过完成按钮划掉。
诸如完成的任务/创建的总任务之类的东西。
附件是浏览器中的视图,下面是显示页面。
<h1 class="page-header"> Getting it up</h1>
<div class="well span9 offset2">
<h2 class="page-header"><%= @list.name %></h2>
<h2 class="lead"><%= @list.description %></h2>
<div class="pull-right" id="smallbuddy" style="width:340px; height:200px;"></div>
<h3>Still Not Finished</h3>
<ul>
<% @list.tasks.incomplete.each do |task| %>
<li style="list-style:none"><%= task.description %> <%= button_to "Completed", complete_task_path(@list.id,task.id), :class =>"btn-mini" %></li>
<% end %>
</ul>
<hr>
<h3>Finished</h3>
<ul id="completed">
<% @list.tasks.completed.each do |task| %>
<li style="list-style:none; opacity:.5; text-decoration:line-through;"><em><%= task.description %></em></li>
<% end %>
</ul>
<hr>
<%= form_for [@list, @list.tasks.new] do |form| %>
<p><%= form.text_field :description %><%= form.submit %></p>
<% end %>
</div>
<span class="btn affix"><%= link_to "Back to all Installs", lists_url %></span>
<div>
</div>
<script>
var g = new JustGage({
id: "smallbuddy",
value: 27,
min: 0,
max: 100,
title: "Until Complete"
});
</script>
我需要操纵 Raphael Lib 吗?还是 justgagejs 库?
我仍在努力解决它,但是一些资深的建议可以为我指出如何实现这一目标的正确方向会有所帮助。提前致谢。