Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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.'); }
- );
- $('#calendar').fullCalendar({
- ...
- editable: true,
- eventDrop: function(event,dayDelta,minuteDelta,allDay,revertFunc) {
- $.ajax({
- type:"PUT",
- url: "/events/"+event.id,
- data: "minute_delta="+minuteDelta+"&day_delta="+dayDelta,
- ..
- });
- }
- });
- I am new in Rails,i want to update this below calendar code.It's been a while since built it.so please guide me,how to update this code,Now i am using Rails version 4.0.2
- <% if current_siteuser.role == "attorney" && session[:activeclient] %>
- <h3>Calendar for Current Client: <%= @client_profile.first.humanize %> <%= @client_profile.last.humanize%> <b><font size=-2>
- </font></b></h3>
- <% end %>
- <script>
- $(document).on('ready page:load', function() {
- $('#erikcalendar').fullCalendar({
- <% if current_siteuser == "attorney" %>
- <% else %>
- <% end %>
- header: {
- center: 'title',
- right: 'month,basicWeek,basicDay',
- left: 'today prev,next agendaWeek,agendaDay'
- },
- events: [
- <% if !@events.nil? %>
- <% @events.each do |event| %>
- <% if !event.recurrence_id.blank? %>
- <% @recur = Recurrence.find(event.recurrence_id) %>
- <% if @recur.repeat_unit == 'daily' then %>
- <% @rstart_date = event.start_date.to_date %>
- <% until @rstart_date > @recur.until_date %>
- {
- <% if @rstart_date and event.title then %>
- title: '<%= raw event.title.gsub("'", "\\'") %>',
- start: '<%= @rstart_date.strftime('%Y/%m/%d') %>',
- url: '<%= edit_event_path(event) %>'
- <% if event.created_by == current_siteuser.id then %>
- ,color: '#ffc90e'
- <% elsif event.created_by == current_siteuser.attorney_id %>
- ,color: '#94D4E9'
- <% end %>
- <% end %>
- <% if event.end_date then %>
- ,end: '<%= event.end_date.strftime('%Y/%m/%d') %>'
- <% end %>
- },
- <% @rstart_date = @rstart_date + 1.day %>
- <% end %>
- <% elsif @recur.repeat_unit == 'weekly' then %>
- <% @rstart_date = event.start_date.to_date %>
- <% until @rstart_date > @recur.until_date %>
- {
- <% if @rstart_date and event.title then %>
- title: '<%= raw event.title.gsub("'", "\\'") %>',
- start: '<%= @rstart_date.strftime('%Y/%m/%d') %>',
- url: '<%= edit_event_path(event) %>'
- <% if event.created_by == current_siteuser.id then %>
- ,color: '#ffc90e'
- <% elsif event.created_by == current_siteuser.attorney_id %>
- ,color: '#94D4E9'
- <% end %>
- <% end %>
- <% if event.end_date then %>
- ,end: '<%= event.end_date.strftime('%Y/%m/%d') %>'
- <% end %>
- },
- <% @rstart_date = @rstart_date + 7.days %>
- <% end %>
- <% end %>
- <% else %>
- {
- <% if event.start_date and event.title then %>
- title: '<%= raw event.title.gsub("'", "\\'") %>',
- start: '<%= event.start_date.strftime('%Y/%m/%d') %>',
- url: '<%= edit_event_path(event) %>'
- <% if event.created_by == current_siteuser.id then %>
- ,color: '#ffc90e'
- <% elsif event.created_by == current_siteuser.attorney_id %>
- ,color: '#94D4E9'
- <% end %>
- <% end %>
- <% if event.end_date then %>
- ,end: '<%= event.end_date.strftime('%Y/%m/%d') %>'
- <% end %>
- },
- <% end %>
- <% end %>
- <% end %>
- {
- title: 'test',
- start: '2012/09/12',
- color: '#ff0000'
- }
- ]
- })
- });
- </script>
- </center>
- <br />
- <div id='erikcalendar'></div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement