Permalink
Browse files

a bunch of changes

- add resources (people)
- refactored all coffeescripts
- change some controller behavior
- changes some styles/views
- add seed-data
- ...
  • Loading branch information...
1 parent 2c2cf36 commit c072797bc4df8c95fd506130cf7b081faf21759e @twetzel committed Aug 17, 2012
Showing with 2,061 additions and 971 deletions.
  1. +6 −1 README.markdown
  2. +1 −9 app/assets/javascripts/application.js.coffee
  3. +0 −99 app/assets/javascripts/calendar.js.coffee
  4. +0 −65 app/assets/javascripts/calendar.old.js
  5. +52 −0 app/assets/javascripts/fc_defaults.js.coffee
  6. +23 −0 app/assets/javascripts/fc_dialog.js.coffee
  7. +200 −0 app/assets/javascripts/fc_helper.js.coffee
  8. +77 −0 app/assets/javascripts/fullcalendar_abletech.js.coffee
  9. +59 −0 app/assets/javascripts/fullcalendar_arshaw.js.coffee
  10. +73 −0 app/assets/javascripts/fullcalendar_buerofuerideen.js.coffee
  11. +76 −0 app/assets/javascripts/fullcalendar_jarnokurlin.js.coffee
  12. +802 −0 app/assets/javascripts/xdate.js
  13. +93 −7 app/assets/stylesheets/application.css
  14. +0 −56 app/assets/stylesheets/scaffold.css
  15. +6 −4 app/controllers/events_controller.rb
  16. +86 −0 app/controllers/people_controller.rb
  17. +2 −0 app/helpers/people_helper.rb
  18. +13 −2 app/models/event.rb
  19. +30 −0 app/models/person.rb
  20. +41 −0 app/views/calendar/_dialog.html.erb
  21. +16 −2 app/views/calendar/index.html.erb
  22. +3 −1 app/views/calendar/show.html.erb
  23. +30 −21 app/views/events/_form.html.erb
  24. +13 −1 app/views/events/edit.html.erb
  25. +3 −3 app/views/events/index.html.erb
  26. +13 −1 app/views/events/new.html.erb
  27. +44 −27 app/views/events/show.html.erb
  28. +12 −0 app/views/layouts/application.html.erb
  29. +42 −0 app/views/people/_form.html.erb
  30. +6 −0 app/views/people/edit.html.erb
  31. +40 −0 app/views/people/index.html.erb
  32. +17 −0 app/views/people/new.html.erb
  33. +51 −0 app/views/people/show.html.erb
  34. +2 −0 config/routes.rb
  35. +11 −22 db/migrate/20110409023947_create_events.rb
  36. +14 −0 db/migrate/20120815202044_create_people.rb
  37. +27 −0 db/seeds.rb
  38. +15 −0 test/fixtures/people.yml
  39. +49 −0 test/functional/people_controller_test.rb
  40. +4 −0 test/unit/helpers/people_helper_test.rb
  41. +7 −0 test/unit/person_test.rb
  42. BIN vendor/assets/.DS_Store
  43. +0 −2 vendor/assets/javascripts/fullcalendar.js.coffee
  44. +0 −165 vendor/assets/javascripts/fullcalendar_abletech.js.coffee
  45. +0 −131 vendor/assets/javascripts/fullcalendar_arshaw.js.coffee
  46. +0 −174 vendor/assets/javascripts/fullcalendar_buerofuerideen.js.coffee
  47. +0 −177 vendor/assets/javascripts/fullcalendar_jarnokurlin.js.coffee
  48. +2 −1 vendor/assets/src/AbleTech/common/SelectionManager.js
View
@@ -3,12 +3,15 @@
This is an example application showing how to use the JQuery FullCalendar plugin with Rails3, following RESTful rails practices as closely as possible, and forgoing 'cleverness' for clarity.
[Homepage](http://arshaw.com/fullcalendar/) | [DOKU](http://arshaw.com/fullcalendar/docs/) | [Source](https://github.com/arshaw/fullcalendar)
+This app compares 4 Versions of fullcallender to show how they can handle resources (people).
+
#### Usage:
git clone git://github.com/twetzel/rails3_fullcalendar.git
cd rails3_fullcalendar/
bundle install
bundle exec rake db:migrate
+ bundle exec rake db:seed .. if you want sample data
rails s
***
@@ -42,4 +45,6 @@ There will eventually be branches that support recurring events as well as multi
***
### More:
This is just an updated (and slightly improved) version of [David Bock`s rails3_fullcalendar](https://github.com/bokmann/rails3_fullcalendar).
-His project was inspired by an earlier attempt to do the same thing. https://github.com/vinsol/fullcalendar_rails demonstrates an older calendar integrations with Rails2; however it doesn't live up to Rails' RESTful ideals, and complicates the example with other uses of ajax and a more complex domain model to support recurring events. It is still a useful project, and kudos to vinsol for sharing it; it definitely made this Rails3 version easier
+His project was inspired by an earlier attempt to do the same thing. https://github.com/vinsol/fullcalendar_rails demonstrates an older calendar integrations with Rails2; however it doesn't live up to Rails' RESTful ideals, and complicates the example with other uses of ajax and a more complex domain model to support recurring events. It is still a useful project, and kudos to vinsol for sharing it; it definitely made this Rails3 version easier
+
+Some JS-Code is addopted from [Victor Tatai´s fork](https://github.com/vtatai/rails3_fullcalendar).
@@ -1,20 +1,12 @@
# This is a manifest file that'll be compiled into application.js, which will include all the files
# listed below.
#
-# Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
-# or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
-#
-# It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
-# the compiled file.
-#
-# WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
-# GO AFTER THE REQUIRES BELOW.
-#
//= require jquery
//= require jquery_ujs
//= require jquery.ui.all
//= require jquery.rest
//= require_self
+# fullcalendar is loaded in view .. to change versions !!!
# require fullcalendar
# require gcal
# require calendar
@@ -1,99 +0,0 @@
-date = new Date()
-d = date.getDate()
-m = date.getMonth()
-y = date.getFullYear()
-
-
-updateEvent = (the_event) ->
- $.update(
- "/events/" + the_event.id
- event:
- title: the_event.title
- starts_at: "" + the_event.start
- ends_at: "" + the_event.end
- description: the_event.description
- (reponse) -> alert "successfully updated event '#{reponse.title}'."
- )
-
-createEvent = (title, start, end, allday) ->
- $.create(
- "/events"
- event:
- title: title
- starts_at: start
- ends_at: end
- all_day: allday
- (reponse) ->
- $('#calendar').fullCalendar('renderEvent', reponse, true )
- )
-
-$ ->
- $('#calendar').fullCalendar
- selectable: true
- selectHelper: true
- select: (start, end, allDay) ->
- title = prompt('Event Title:')
- if title
- createEvent( title, start.toString(), end.toString(), allDay )
- console?.log? "New Event: #{title} ... #{start} - #{end}"
- $('#calendar').fullCalendar('unselect')
- editable: true
- header:
- left: 'prev,next today'
- center: 'title'
- right: 'month,agendaWeek,agendaDay'
- # time formats
- titleFormat:
- month: 'MMMM yyyy'
- week: "d.[ MMMM][ yyyy]{ - d. MMMM yyyy}"
- day: 'dddd, d.MMMM yyyy'
- columnFormat:
- month: 'ddd'
- week: 'ddd d.M.'
- day: 'dddd d.M.'
- # timeFormat:
- # '': 'H(:mm)' # default: 'h(:mm)t'
- # locale
- isRTL: false
- firstDay: 1
- monthNames: ["Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"]
- monthNamesShort: ["Jan","Feb","Mär","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Dez"]
- dayNames: ["Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag"]
- dayNamesShort: ["So","Mo","Di","Mi","Do","Fr","Sa"]
- buttonText:
- prev: " ◄ "
- next: " ► "
- prevYear: " << "
- nextYear: " >> "
- today: "heute"
- month: "Monat"
- week: "Woche"
- day: "Tag"
- axisFormat: 'H:mm'
- defaultView: 'month'
- # height: 500
- # slotMinutes: 15
- slotMinutes: 30
- loading: (bool) ->
- if bool
- $('#loading').show()
- else
- $('#loading').hide()
- # a future calendar might have many sources.
- eventSources: [
- url: '/events'
- color: '#ccc'
- textColor: '#333'
- ignoreTimezone: false
- ]
- timeFormat: 'H:mm { - H:mm} '
- dragOpacity: "0.5"
- # http://arshaw.com/fullcalendar/docs/event_ui/eventDrop/
- eventDrop: (event, dayDelta, minuteDelta, allDay, revertFunc) ->
- updateEvent(event)
- # http://arshaw.com/fullcalendar/docs/event_ui/eventResize/
- eventResize: (event, dayDelta, minuteDelta, revertFunc) ->
- updateEvent(event)
- # http://arshaw.com/fullcalendar/docs/mouse/eventClick/
- eventClick: (event, jsEvent, view) ->
- #would like a lightbox here.
@@ -1,65 +0,0 @@
-$(document).ready(function() {
-
- var date = new Date();
- var d = date.getDate();
- var m = date.getMonth();
- var y = date.getFullYear();
-
- $('#calendar').fullCalendar({
- editable: true,
- header: {
- left: 'prev,next today',
- center: 'title',
- right: 'month,agendaWeek,agendaDay'
- },
- defaultView: 'month',
- height: 500,
- slotMinutes: 15,
-
- loading: function(bool){
- if (bool)
- $('#loading').show();
- else
- $('#loading').hide();
- },
-
- // a future calendar might have many sources.
- eventSources: [{
- url: '/events',
- color: 'yellow',
- textColor: 'black',
- ignoreTimezone: false
- }],
-
- timeFormat: 'h:mm t{ - h:mm t} ',
- dragOpacity: "0.5",
-
- //http://arshaw.com/fullcalendar/docs/event_ui/eventDrop/
- eventDrop: function(event, dayDelta, minuteDelta, allDay, revertFunc){
- updateEvent(event);
- },
-
- // http://arshaw.com/fullcalendar/docs/event_ui/eventResize/
- eventResize: function(event, dayDelta, minuteDelta, revertFunc){
- updateEvent(event);
- },
-
- // http://arshaw.com/fullcalendar/docs/mouse/eventClick/
- eventClick: function(event, jsEvent, view){
- // would like a lightbox here.
- },
- });
-});
-
-function updateEvent(the_event) {
- $.update(
- "/events/" + the_event.id,
- { event: { title: the_event.title,
- starts_at: "" + the_event.start,
- ends_at: "" + the_event.end,
- description: the_event.description
- }
- },
- function (reponse) { alert('successfully updated task.'); }
- );
-};
@@ -0,0 +1,52 @@
+((window) ->
+
+ default_fc_options =
+ # Behavior
+ selectable: true
+ selectHelper: true
+ unselectCancel: "#event_dialog"
+ editable: true
+ # height: 500
+ dragOpacity: "0.5"
+ slotMinutes: 30 # slotMinutes: 10 15 20 30 60
+ # Source .. a future calendar might have many source
+ eventSources: [
+ url: '/events'
+ # color: '#ccc'
+ # textColor: '#333'
+ ignoreTimezone: false
+ ]
+ # loading info
+ loading: (bool) -> if bool then $('#loading').show() else $('#loading').hide()
+ # Default stuff Locale = de .. todo include i18n.js for that part !
+ titleFormat:
+ month: 'MMMM yyyy'
+ week: "d.[ MMMM][ yyyy]{ - d. MMMM yyyy}"
+ day: 'dddd, d.MMMM yyyy'
+ columnFormat:
+ month: 'ddd'
+ week: 'ddd d.M.'
+ day: 'dddd d.M.'
+ timeFormat: 'H:mm { - H:mm} '
+ isRTL: false
+ firstDay: 1
+ monthNames: ["Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"]
+ monthNamesShort: ["Jan","Feb","Mär","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Dez"]
+ dayNames: ["Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag"]
+ dayNamesShort: ["So","Mo","Di","Mi","Do","Fr","Sa"]
+ buttonText:
+ prev: " ◄ "
+ next: " ► "
+ prevYear: " << "
+ nextYear: " >> "
+ today: "heute"
+ month: "Monat"
+ week: "Woche"
+ day: "Tag"
+ axisFormat: 'H:mm'
+
+
+ @mergeOptions = ( options ) ->
+ $.extend({}, default_fc_options, options);
+
+)(window)
@@ -0,0 +1,23 @@
+(($, window, document) ->
+
+ $ ->
+ window.daDialog = $('#event_dialog').dialog
+ title: 'New Event'
+ autoOpen: false
+ width: 555
+ buttons:
+ 'Cancel': -> $(@).dialog('close')
+ 'Save': -> saveEventFromDialog()#
+
+ $('#all_day').change ->
+ checked = $(@).is(':checked')
+ if checked
+ disableDialogTimeFields()
+ else
+ enableDialogTimeFields()
+
+ $.datepicker.setDefaults({ dateFormat: 'd.m.yy' })
+ $('#start_date').datepicker()
+ $('#end_date').datepicker()
+
+)(jQuery, window, document)
Oops, something went wrong.

0 comments on commit c072797

Please sign in to comment.