Spinelzã®Calendarã®ãªãã·ã§ã³
Spinelzã®Calendarãããæããªã®ã§ã使ããã¨ã«ãããã§ããã©ã»ã»ã»
ããã¥ã¡ã³ããã»ã¨ãã©ãªãã
ãªãã§ï¼ããã¾äººæ°ãªãã®ããªï¼
ããã®ã¯ãscript.spinelz.org is Expired or Suspended.ã®ãã¢ãããã
ã¾ãèªåã®æ¤ç´¢ãçãã ãããããã¾ãããã
ã¦ããã½ã¼ã¹èªãã£ã¦ãã¨ãªãã§ããããã
ã¦ããã§ãã¨ããããããã©ã«ãã®ãªãã·ã§ã³ã¨ãã®åæå¤ãæ¸ãã¨ãã¾ãã
å·¦ããªãã·ã§ã³åã§ãå³ãããã©ã«ãå¤ã§ãã
ãªãã·ã§ã³ä¸è¦§
initDate : new Date(), cssPrefix : 'custom_', holidays : [], schedules : [], size : Calendar.size.large, regularHoliday : [0, 6], displayIndexes : [0, 1, 2, 3, 4, 5, 6], displayTime : [{hour: 0, min: 0}, {hour: 24, min: 0}], weekIndex : 0, dblclickListener : null, afterSelect : Prototype.emptyFunction, beforeRefresh : Prototype.emptyFunction, changeSchedule : Prototype.emptyFunction, changeCalendar : Prototype.emptyFunction, displayType : 'month', highlightDay : true, beforeRemoveSchedule : function(){return true;}, dblclickSchedule : null, updateTirm : Prototype.emptyFunction, displayTimeLine : true, clickDateText : null, monthHeaderFormat : null, weekHeaderFormat : null, weekSubHeaderFormat : null, dayHeaderFormat : null, dayOfWeek : DateUtil.dayOfWeek
ã¨ãªã£ã¦ã¾ãã
ããã§ã¯ãããã£ã¦ãç¯å²ã§ããã¤ããªãã·ã§ã³ã®èª¬æã
cssPrefix
ããã«ã¹ã¿ã ã¹ã¿ã¤ã«ã·ã¼ãã®åå
holidays
ããä¼æ¥ã®ãã¼ã¿
schedules
ããã¹ã±ã¸ã¥ã¼ã«ãã¼ã¿
size
ããã«ã¬ã³ãã¼ã®ãµã¤ãºãLargeã¨smallãé¸ã¹ã
regularHoliday
ããããã©ã«ãã®ä¼æ¥ã®ææ¥ã0ã6ãããããæ¥æãåæã«å¯¾å¿ãã¦ãã
displayIndexes
ããåæ表示ããææ¥
displayTime
ããé±ããã³æ¥è¡¨ç¤ºã®ã¨ãã®æéã®è¡¨ç¤ºé å
weekIndex
ããé±ã®ã¯ãã¾ãã®ææ¥
changeSchedule
ããã¹ã±ã¸ã¥ã¼ã«å¤æ´çµäºæãå®è¡ãããåä½
displayType
ããåæ表示ã¿ã¤ããmonthãweekãdayãé¸æå¯ã
dblclickSchedule
ããã¹ã±ã¸ã¥ã¼ã«ããã«ã¯ãªãã¯æã®åä½
updateTirm
ããã¹ã±ã¸ã¥ã¼ã«ã®æéé åå¤æ´çµäºæã«å®è¡ãããåä½
Railsç¨Helper
Railsã§ä½¿ãã¨ãã®Helperãä¸å¿æ¸ãã¨ãã¾ãã
Helper
def calendar(name, options = {}) options.stringify_keys! options["cssPrefix"] = %Q!'#{options["cssPrefix"]}'! if options["cssPrefix"] options["displayType"] = %Q!'#{options["displayType"]}'! if options["displayType"] cal = %Q!var calendar = new Calendar('#{name}', {#{hash_to_javascript_options(options)}});! javascript_tag(cal) end private def hash_to_javascript_options(hash_options) ary = Array.new hash_options.each do |key, value| ary << %Q!#{key}:#{value}! end ary.join(',') end
ãã§ãViewã¯ã
View
<div id="calendar1"></div> <%= calendar("calendar1", {:displayType => "week"}) %>
ã¨ãã£ãæãã§ã
nameã«ã«ã¬ã³ãã¼ã表示ããdivã®idãã
optionsã«ã¯Hashã§å¤æ´ããããªãã·ã§ã³ãå
¥ãã¦ãã ããã
ã¾ã
ãããªæãã§ããã
ããã¨ãæ¸ãã¦ãªããã¤ã¯ç¢ºèªãã¦ãªãã®ã§ãèªä¿¡ããªãã®ã§æ¸ãã¦ã¾ããã
確èªããã追è¨ããããã
ãªãã¨ãªãååãããããæ°ããã¾ããã»ã»ã»
ãã¨ãééã£ã¦ãã¨ããã£ããæãã¦ãã ããã
ä»ã®ã¨ãããRailsã§ä½¿ãã¨ãã«ãViewå
ã«ãã¿ã§JavaScriptæ¸ããããªãã®ã§ã
Helperã«è½ã¨ãè¾¼ãã§ãä½æ¥ä¸ãªãã§ããã©ã
誰ãRailsç¨ã®Helperæ¸ãã¦ããããªãã§ãããã
追è¨(6/22)
hash_to_javascript_optionsã¡ã½ãããæ¸ãå¿ãã¦ããã§è¿½è¨ã
ããã¯ãHashã§æ¸¡ããããªãã·ã§ã³ã
key : value
ã®å½¢å¼ã«å¤ãã¦ãã ãã§ãã