マックな色々・・・・。

温泉、山登り、キノコ、山菜、釣り、DTM、そして何よりマック

過去の投稿日別表示

[ リスト | 詳細 ]

2009年10月10日

←2009年10月9日 | 2009年10月11日→

全1ページ

[1]

FullCalendarプラグイン その4

イメージ 1

イメージ 2

イベントの背景カラーを設定出来るように変更
modelにclassnameを追加

1.app/controllers/events_cintroller.rb

@events = Event.find(:all, :select => 'id, title, start, end, allday, classname',
:conditions => ["start >= ? AND end <= ?",searchstart, searchend]).map{|e|
{
:id => e.id,
:title => e.title,
:start => e.start,
:end => e.end,
:allDay => e.allday,
:url => event_path(e.id),
#追加
:className => e.classname
}
}


2.app/views/events/new.html.erbとapp/views/events/edit.html.erb
以下を追加
<div class="group">
<%= f.label :classname, Event.human_attribute_name('classname'), :class => :label %>
<%= f.select(:classname, [["red","classname_red"],["blue","classname_blue"],["yellow","classname_yellow"],["green","classname_green"]]) %>
<span class="description">Ex: a simple text</span>
</div>


3.public/fullcalendar/fullcalendar.css
以下を追加
/* Use the 'className' CalEvent property and the following
* example CSS to change event color on a per-event basis:
*
* .my-event-class,
* .my-event-class a {
* border-color: black;
* background-color: black;
* color: red;
* }
*/
.classname_red,
.classname_red a {
border-color: #FF0000;
background-color: #FF0000;
color: #fff;
}
.classname_blue,
.classname_blue a {
border-color: #36c;
background-color: #36c;
color: #fff;
}
.classname_yellow,
.classname_yellow a {
border-color: #FFFF99;
background-color: #FFFF99;
color: black;
}
.classname_green,
.classname_green a {
border-color: #99FF99;
background-color: #99FF99;
color: black;
}

閉じる コメント(0)

閉じる トラックバック(0)

全1ページ

[1]


.
検索 検索

ちょっと違うマック
人気度

ヘルプ

Yahoo Image

  今日 全体
訪問者 0 21578
ブログリンク 0 2
コメント 0 60
トラックバック 0 6

開設日: 2008/4/26(土)


プライバシーポリシー -  利用規約 -  ガイドライン -  順守事項 -  ヘルプ・お問い合わせ

Copyright (C) 2012 Yahoo Japan Corporation. All Rights Reserved.