From 9eb53b2d78c166d87e8fcafd3eacff51a3e8638a Mon Sep 17 00:00:00 2001 From: Thomas Weng Date: Sat, 20 Sep 2014 23:39:48 -0400 Subject: [PATCH 01/34] Moved tooltip initialization function into jQuery document.ready. --- app/assets/javascripts/tooltip.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/app/assets/javascripts/tooltip.js b/app/assets/javascripts/tooltip.js index 39b0f8bd4..5a17c599a 100644 --- a/app/assets/javascripts/tooltip.js +++ b/app/assets/javascripts/tooltip.js @@ -1,9 +1,5 @@ $(document).ready(function(){ - $("div.timeslots li.click_to_add_new").click(function(e){ - e.preventDefault(); - window.location.href = newTimeSlotPath; - }); - + initialize("body"); }); @@ -15,7 +11,6 @@ $(document).ready(function(){ -initialize("body"); function initialize(element) { From aef9647b9f8175fa728d7e4c100fdb73546b38ce Mon Sep 17 00:00:00 2001 From: Thomas Weng Date: Sat, 20 Sep 2014 23:41:57 -0400 Subject: [PATCH 02/34] Removed deprecated submit_to_remote function and uncommented css layout for tooltip. Submit button not functional yet. --- app/assets/stylesheets/_timeline.css.scss | 28 +++++++++++------------ app/views/shifts/tooltips/_new.html.erb | 4 ++-- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/app/assets/stylesheets/_timeline.css.scss b/app/assets/stylesheets/_timeline.css.scss index c417fec32..054fcf24f 100644 --- a/app/assets/stylesheets/_timeline.css.scss +++ b/app/assets/stylesheets/_timeline.css.scss @@ -189,20 +189,20 @@ div.center_content { img.right_arrow { position:absolute; right:0; } img.left_arrow { position:absolute; left:0; } -// div#tooltip{ -// text-align: left; -// z-index: 1000; -// display: block; -// background: #DDDDFF; -// color: #000; -// padding: 5px; -// padding-top:15px; -// min-width: 200px; -// font-style: normal; -// font-weight: normal; -// font-family: "Trebuchet MS", Helvetica, sans-serif; -// font-size: 12px; -// } +div#tooltip{ + text-align: left; + z-index: 1000; + display: block; + background: #DDDDFF; + color: #000; + padding: 5px; + padding-top:15px; + min-width: 200px; + font-style: normal; + font-weight: normal; + font-family: "Trebuchet MS", Helvetica, sans-serif; + font-size: 12px; +} div#tooltip strong{ border: 0; diff --git a/app/views/shifts/tooltips/_new.html.erb b/app/views/shifts/tooltips/_new.html.erb index 27e56a8ae..2edeb95b2 100644 --- a/app/views/shifts/tooltips/_new.html.erb +++ b/app/views/shifts/tooltips/_new.html.erb @@ -12,7 +12,7 @@ <%= form_for @shift, remote: true do |f| %> <%= f.error_messages %> <%= render partial: 'shifts/form', locals: {f: f} %> -

<%= submit_to_remote "add_button", "Create New", url: { action: 'create', calendar: params[:calendar] } %>

+ <%#

<%= submit_to_remote "add_button", "Create New", url: { action: 'create', calendar: params[:calendar] } %> <% end %> @@ -22,7 +22,7 @@ <%= form_for(@repeating_event = RepeatingEvent.new, remote: true) do |f| %> <%= render partial: 'shifts/form_repeating', locals: {f: f, shift_start: params[:date].to_date.midnight, shift_end: params[:date].to_date.midnight } %> <%= hidden_field_tag 'rerender_date', params[:date] %> -

<%= submit_to_remote "add_button", "Create New Repeating Event", url: { controller: 'repeating_events', action: 'create', calendar: params[:calendar] }, loading: "$(this).val('creating...'); $(this).attr('disabled', 'true')" %>

+ <%#

<%= submit_to_remote "add_button", "Create New Repeating Event", url: { controller: 'repeating_events', action: 'create', calendar: params[:calendar] }, loading: "$(this).val('creating...'); $(this).attr('disabled', 'true')" %> <% end %> <% end %> From ab9d3aace2148c58d72c296944f447a7bfe981f5 Mon Sep 17 00:00:00 2001 From: Thomas Weng Date: Sun, 21 Sep 2014 00:11:43 -0400 Subject: [PATCH 03/34] Replaced submit_to_remote functions with submit_tag functions. --- app/views/shifts/tooltips/_new.html.erb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/views/shifts/tooltips/_new.html.erb b/app/views/shifts/tooltips/_new.html.erb index 2edeb95b2..c19f48320 100644 --- a/app/views/shifts/tooltips/_new.html.erb +++ b/app/views/shifts/tooltips/_new.html.erb @@ -12,8 +12,7 @@ <%= form_for @shift, remote: true do |f| %> <%= f.error_messages %> <%= render partial: 'shifts/form', locals: {f: f} %> - <%#

<%= submit_to_remote "add_button", "Create New", url: { action: 'create', calendar: params[:calendar] } %> - +

<%= submit_tag "Create New", url: { action: 'create', calendar: params[:calendar] } %>

<% end %> @@ -22,7 +21,7 @@ <%= form_for(@repeating_event = RepeatingEvent.new, remote: true) do |f| %> <%= render partial: 'shifts/form_repeating', locals: {f: f, shift_start: params[:date].to_date.midnight, shift_end: params[:date].to_date.midnight } %> <%= hidden_field_tag 'rerender_date', params[:date] %> - <%#

<%= submit_to_remote "add_button", "Create New Repeating Event", url: { controller: 'repeating_events', action: 'create', calendar: params[:calendar] }, loading: "$(this).val('creating...'); $(this).attr('disabled', 'true')" %> +

<%= submit_tag "Create New Repeating Event", url: { controller: 'repeating_events', action: 'create', calendar: params[:calendar] }, loading: "$(this).val('creating...'); $(this).attr('disabled', 'true')" %>

<% end %> <% end %> From caaeea8af37fcc7fe9cd3d4b57e9aefe7a78bd6d Mon Sep 17 00:00:00 2001 From: Thomas Weng Date: Sun, 21 Sep 2014 21:06:10 -0400 Subject: [PATCH 04/34] Made edit existing user tooltip appear and save properly. --- app/assets/javascripts/tooltip.js | 10 ---------- app/views/shifts/create.js.erb | 7 ++++++- app/views/shifts/tooltips/_show.html.erb | 4 ++-- app/views/shifts/update.js.erb | 11 ++++++++--- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/app/assets/javascripts/tooltip.js b/app/assets/javascripts/tooltip.js index 5a17c599a..c53f4e4d4 100644 --- a/app/assets/javascripts/tooltip.js +++ b/app/assets/javascripts/tooltip.js @@ -2,16 +2,6 @@ $(document).ready(function(){ initialize("body"); }); - - - - - - - - - - function initialize(element) { $(element+' td.click_to_show').click(function (e) { diff --git a/app/views/shifts/create.js.erb b/app/views/shifts/create.js.erb index d5f1c9572..59911a38f 100644 --- a/app/views/shifts/create.js.erb +++ b/app/views/shifts/create.js.erb @@ -1,8 +1,13 @@ $('#tooltip').remove(); -$('#<%= @shift.start.strftime("%Y-%m-%d") %>').html('<%= escape_javascript render partial: (params[:calendar] ? "calendars/schedule/day" : "shifts/schedule/day"), object: @shift.start.to_date %>') +$('#<%= @shift.start.strftime("%Y-%m-%d") %>').html( + '<%= escape_javascript render partial: + (params[:calendar] ? "calendars/schedule/day" : "shifts/schedule/day"), + object: @shift.start.to_date %>'); // TODO: Figure out how to make this work in jQuery // page["#shift#{@shift.id}"].visual_effect :highlight + initialize('body'); // display alert +// alert("shift created"); \ No newline at end of file diff --git a/app/views/shifts/tooltips/_show.html.erb b/app/views/shifts/tooltips/_show.html.erb index 3b806a364..6a241f669 100644 --- a/app/views/shifts/tooltips/_show.html.erb +++ b/app/views/shifts/tooltips/_show.html.erb @@ -60,7 +60,7 @@
<%= form_for @shift, remote: true do |f| %> <%= render partial: 'shifts/form', locals: {f: f} %> -

<%= submit_to_remote "edit_button", "Save Changes", url: { controller: 'shifts', action: 'update', calendar: params[:calendar] } %>

+

<%= submit_tag "Save Changes", url: { controller: 'shifts', action: 'update', calendar: params[:calendar] } %>

<% end %> <% if current_user == @shift.user and !@shift.has_passed? %> @@ -99,7 +99,7 @@ <%= form_for (@repeating_event = @shift.repeating_event), remote: true do |f| %> <%= render partial: 'shifts/form_repeating', locals: {f: f, shift_start: @shift.start, shift_end: @shift.end} %> <%= hidden_field_tag 'rerender_date', @shift.start.to_date.to_s %> -

<%= submit_to_remote "add_button", "Update Repeating Event", url: { controller: 'repeating_events', action: 'update', id: @repeating_event.id, calendar: params[:calendar] } %>

+

<%= submit_tag "Update Repeating Event", url: { controller: 'repeating_events', action: 'update', id: @repeating_event.id, calendar: params[:calendar] } %>

<% end %>
<% end %> diff --git a/app/views/shifts/update.js.erb b/app/views/shifts/update.js.erb index 58d001797..a2840771e 100644 --- a/app/views/shifts/update.js.erb +++ b/app/views/shifts/update.js.erb @@ -1,8 +1,13 @@ -$('#shift.start.strftime("%Y-%m-%d")').html('<%= escape_javascript render partial: (params[:calendar] ? "calendars/schedule/day" : "shifts/schedule/day"), object: @shift.start.to_date %>'); +$('#tooltip').remove(); +$('#<%= @shift.start.strftime("%Y-%m-%d") %>').html( + '<%= escape_javascript render partial: + (params[:calendar] ? "calendars/schedule/day" : "shifts/schedule/day"), + object: @shift.start.to_date %>'); + +// TODO: Figure out how to make this work in jQuery // page["#shift#{@shift.id}"].visual_effect :highlight -$("#tooltip").remove(); initialize('##{@shift.start.strftime("%Y-%m-%d")}'); // display alert -alert("shift updated"); +//alert("shift updated"); From 981ffe0a6d837465be7724ced4ce12ea4f16df4e Mon Sep 17 00:00:00 2001 From: David Yao Date: Thu, 25 Sep 2014 10:55:32 -0400 Subject: [PATCH 05/34] recurring shifts creation --- app/models/shift.rb | 6 +++--- app/views/shifts/tooltips/_new.html.erb | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/models/shift.rb b/app/models/shift.rb index 8d689f9db..ee58397b5 100644 --- a/app/models/shift.rb +++ b/app/models/shift.rb @@ -135,11 +135,11 @@ def self.make_future(end_date, cal_id, r_e_id, days, loc_id, start_time, end_tim seed_end_time = seed_start_time+diff while seed_end_time <= (end_date + 1.day) if active - inner_test.push "(user_id = #{user_id} AND active = #{true} AND department_id = #{department_id} AND start <= #{seed_end_time.utc} AND end >= #{seed_start_time.utc})" + inner_test.push "(user_id = #{user_id} AND active = #{true} AND department_id = #{department_id} AND start <= '#{seed_end_time.utc}' AND end >= '#{seed_start_time.utc}')" else - inner_test.push "(user_id = #{user_id} AND calendar_id = #{cal_id} AND department_id = #{department_id} AND start <= #{seed_end_time.utc} AND end >= #{seed_start_time.utc})" + inner_test.push "(user_id = #{user_id} AND calendar_id = #{cal_id} AND department_id = #{department_id} AND start <= '#{seed_end_time.utc}' AND end >= '#{seed_start_time.utc}')" end - inner_make.push "#{loc_id}, #{cal_id}, #{r_e_id}, #{seed_start_time.utc}, #{seed_end_time.utc}, #{Time.now.utc}, #{Time.now.utc}, #{user_id}, #{department_id}, #{active}" + inner_make.push "#{loc_id}, #{cal_id}, #{r_e_id}, '#{seed_start_time.utc}', '#{seed_end_time.utc}', '#{Time.now.utc}', '#{Time.now.utc}', #{user_id}, #{department_id}, #{active}" #Once the array becomes big enough that the sql call will insert 450 rows, start over w/ a new array #without this bit, sqlite freaks out if you are inserting a larger number of rows. Might need to be changed #for other databases (it can probably be higher for other ones I think, which would result in faster execution) diff --git a/app/views/shifts/tooltips/_new.html.erb b/app/views/shifts/tooltips/_new.html.erb index c19f48320..2d5453d1e 100644 --- a/app/views/shifts/tooltips/_new.html.erb +++ b/app/views/shifts/tooltips/_new.html.erb @@ -9,7 +9,7 @@ <% end %>
- <%= form_for @shift, remote: true do |f| %> + <%= form_for @shift do |f| %> <%= f.error_messages %> <%= render partial: 'shifts/form', locals: {f: f} %>

<%= submit_tag "Create New", url: { action: 'create', calendar: params[:calendar] } %>

@@ -18,7 +18,7 @@ <% if current_user.is_admin_of?(@department) %> <% if current_user.is_admin_of?(@department) and @shift.repeating_event %> <% if current_user.is_admin_of?(@department) %> <% end %> + From 8da1345c75da96f99208148a22da090c9dc4306a Mon Sep 17 00:00:00 2001 From: David Yao Date: Sat, 27 Sep 2014 14:19:10 -0400 Subject: [PATCH 10/34] fixed timeslot ajax edit --- app/views/time_slots/tooltips/_show.html.erb | 17 ++++++++--------- app/views/time_slots/update.js.erb | 12 ++++++------ 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/app/views/time_slots/tooltips/_show.html.erb b/app/views/time_slots/tooltips/_show.html.erb index 4dc5647cb..8f082d455 100644 --- a/app/views/time_slots/tooltips/_show.html.erb +++ b/app/views/time_slots/tooltips/_show.html.erb @@ -4,26 +4,26 @@ <% if params[:delete_options] and @time_slot.repeating_event %>

This time slot is part of a repeating event.
What do you wish to destroy?

- <%= button_to_remote "Just this time slot", {url: {controller: 'time_slots', action: 'destroy', id: @time_slot.id, calendar: (params[:calendar] || true)}, confirm: 'Are you sure?', method: :delete} %>
- <%= button_to_remote "This and all future time slots", {url: {controller: 'repeating_events', action: 'destroy', id: @time_slot.repeating_event.id, calendar: (params[:calendar] || true), delete_after_date: @time_slot.start}, confirm: 'Are you sure?', method: :delete} %>
- <%= button_to_remote "All events in this series", {url: {controller: 'repeating_events', action: 'destroy', id: @time_slot.repeating_event.id, calendar: (params[:calendar] || true), rerender_date: @time_slot.start}, confirm: 'Are you sure?', method: :delete} %> + <%= button_to "Just this time slot", {controller: 'time_slots', action: 'destroy', id: @time_slot.id, calendar: (params[:calendar] || true)}, data:{confirm: 'Are you sure?'}, method: :delete %>
+ <%= button_to "This and all future time slots", {controller: 'repeating_events', action: 'destroy', id: @time_slot.repeating_event.id, calendar: (params[:calendar] || true), delete_after_date: @time_slot.start}, data:{confirm: 'Are you sure?'}, method: :delete %>
+ <%= button_to "All events in this series", {controller: 'repeating_events', action: 'destroy', id: @time_slot.repeating_event.id, calendar: (params[:calendar] || true), rerender_date: @time_slot.start}, data:{confirm: 'Are you sure?'}, method: :delete %>
<% else %>

Edit Timeslot

<%= form_for @time_slot, remote: true do |f| %> <%= render partial: 'time_slots/form', locals: {f: f} %> -

<%= submit_to_remote "edit_button", "Save Changes", url: { controller: 'time_slots', action: 'update', calendar: (params[:calendar] || true) } %>

+

<%= submit_tag "Save Changes", url: { controller: 'time_slots', action: 'update', calendar: (params[:calendar] || true) } %>

<% end %>

<% unless @time_slot.repeating_event %> - <%= link_to "Destroy this time slot", {url: {controller: 'time_slots', action: 'destroy', id: @time_slot.id, calendar: (params[:calendar] || true)}, remote: true, confirm: 'Are you sure?', method: :delete} %> + <%= link_to "Destroy this time slot", time_slot_path(@time_slot, calendar: (params[:calendar] || true)), data:{confirm: 'Are you sure?'}, method: :delete %> <% else %> <%= link_to_function "Destroy this time slot", "$('#repeating_event_delete_options').toggle()" %>

<% end %>

@@ -41,6 +41,5 @@

<% end %> - <%= render partial: '/tooltips/close_tooltip'%> diff --git a/app/views/time_slots/update.js.erb b/app/views/time_slots/update.js.erb index 1815c1550..2da40f62d 100644 --- a/app/views/time_slots/update.js.erb +++ b/app/views/time_slots/update.js.erb @@ -1,10 +1,10 @@ -$("#timeslot<%= @time_slot.id %>").remove() -$("#location<%= @time_slot.location.id %>_<%= @time_slot_day.strftime("%Y-%m-%d") %>_timeslots %>").append('<%= escape_javascript render partial: "time_slots/time_slot", object: @time_slot, locals: {time_slot_day: @time_slot_day} %>'); -//TODO How to do this in jQuery (probably requires) -//page["#timeslot#{@time_slot.id}"].visual_effect :highlight +$("#timeslot<%= @time_slot.id %>").remove(); +<% ul_id = "location#{@time_slot.location.id}_#{@time_slot_day.strftime('%Y-%m-%d')}_timeslots" %> +<% new_li = escape_javascript render partial: "time_slots/time_slot", object: @time_slot, locals: {time_slot_day: @time_slot_day} %> + +$('#<%= ul_id %>').append("<%= new_li %>"); +$("#timeslot<%= @time_slot.id %>").effect("highlight", 1100); $("#tooltip").remove() $('#timeslot#{@time_slot.id}').click(function (e) {popup_edit_timeslot($(this), e); return false;}); -// display alert -alert("timeslot updated"); \ No newline at end of file From 591523d4a39ab6ca75286588a1eb7a9c3d181350 Mon Sep 17 00:00:00 2001 From: David Yao Date: Sat, 27 Sep 2014 14:26:58 -0400 Subject: [PATCH 11/34] Fixed timeslots creation ajax highlight effect --- app/views/time_slots/create.js.erb | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/app/views/time_slots/create.js.erb b/app/views/time_slots/create.js.erb index 521b7be11..4f8eed726 100644 --- a/app/views/time_slots/create.js.erb +++ b/app/views/time_slots/create.js.erb @@ -1,9 +1,6 @@ $("#tooltip").remove() $("#location<%= @time_slot.location.id %>_<%= @time_slot_day.strftime("%Y-%m-%d") %>_timeslots").append('<%= escape_javascript render partial: "time_slots/time_slot", object: @time_slot, locals: {time_slot_day: @time_slot_day} %>'); -//TODO How to do this in jQuery -//page["#timeslot#{@time_slot.id}"].visual_effect :highlight +$("#timeslot<%= @time_slot.id %>").effect("highlight", 1100); $('#timeslot<%= @time_slot.id %>').click(function (e) {popup_edit_timeslot($(this), e); return false;}); -// display alert -alert("timeslot created"); From 6d16216f622a41400d10a76bca2e49092680679e Mon Sep 17 00:00:00 2001 From: Thomas Weng Date: Wed, 1 Oct 2014 20:56:23 -0400 Subject: [PATCH 12/34] Clicking on calendar schedule opens 'Add New Timeslot' tooltip instead of 'Add New Shift' tooltip. --- app/views/calendars/schedule/_location_row.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/calendars/schedule/_location_row.html.erb b/app/views/calendars/schedule/_location_row.html.erb index 653e1c81a..b8dae3439 100644 --- a/app/views/calendars/schedule/_location_row.html.erb +++ b/app/views/calendars/schedule/_location_row.html.erb @@ -1,5 +1,5 @@
    -
  • +
  • <% unless location_row.compact.empty? %> <%= render partial: "calendars/schedule/shift", collection: location_row -%> <% end %> From e0d253a571718137030f4e9aed1b0188bfbc34d8 Mon Sep 17 00:00:00 2001 From: Thomas Weng Date: Wed, 1 Oct 2014 21:29:21 -0400 Subject: [PATCH 13/34] Fixed layout of timeslot schedule. --- app/helpers/shifts_helper.rb | 2 +- app/views/calendars/schedule/_location.html.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/helpers/shifts_helper.rb b/app/helpers/shifts_helper.rb index 55a464a8e..0c92d0fdd 100644 --- a/app/helpers/shifts_helper.rb +++ b/app/helpers/shifts_helper.rb @@ -351,7 +351,7 @@ def calendar_day_preprocessing(day) @timeslot_rows = 0 #counter - @row_height = 24 #pixels - this could be user-configurable + @row_height = 48 #pixels - this could be user-configurable @divider_height = 3 #pixels - this could be user-configurable @table_height = rowcount @table_pixels = @row_height * rowcount + rowcount+1 diff --git a/app/views/calendars/schedule/_location.html.erb b/app/views/calendars/schedule/_location.html.erb index b95b24560..24efc1fc9 100644 --- a/app/views/calendars/schedule/_location.html.erb +++ b/app/views/calendars/schedule/_location.html.erb @@ -1,4 +1,4 @@ -
    +
    <%# Why is the div on the next line there? where does it appear? You can't click on the box in this column to add anything %>
    From c4a6396e9460d24b3059311cd0d3b6939739090b Mon Sep 17 00:00:00 2001 From: Thomas Weng Date: Thu, 2 Oct 2014 01:06:19 -0400 Subject: [PATCH 14/34] Reverting previous commit so that clicking on timeslot schedule still opens new shift tooltip. --- app/views/calendars/schedule/_location_row.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/calendars/schedule/_location_row.html.erb b/app/views/calendars/schedule/_location_row.html.erb index b8dae3439..653e1c81a 100644 --- a/app/views/calendars/schedule/_location_row.html.erb +++ b/app/views/calendars/schedule/_location_row.html.erb @@ -1,5 +1,5 @@
      -
    • +
    • <% unless location_row.compact.empty? %> <%= render partial: "calendars/schedule/shift", collection: location_row -%> <% end %> From dc598dad58491e441d89c2e5dcf0626657b07501 Mon Sep 17 00:00:00 2001 From: David Yao Date: Sat, 4 Oct 2014 17:39:36 -0400 Subject: [PATCH 15/34] Fixed shift show page for scheduled shift in the future, as well as non-superuser shift-show tooltip --- app/views/shifts/show.html.erb | 2 +- app/views/shifts/show.js.erb | 2 +- app/views/shifts/tooltips/_show.html.erb | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/shifts/show.html.erb b/app/views/shifts/show.html.erb index fbde4b623..645e8897c 100644 --- a/app/views/shifts/show.html.erb +++ b/app/views/shifts/show.html.erb @@ -21,7 +21,7 @@ <%= link_to "View report", shift_report_path(@shift) %> <% elsif current_user==@shift.user %>

      - <%= link_to "Request a sub for this shift", new_shift_sub_path(@shift) %> + <%= link_to "Request a sub for this shift", new_shift_sub_request_path(@shift) %>

      <% if within_sign_in_window?(@shift) %>

      diff --git a/app/views/shifts/show.js.erb b/app/views/shifts/show.js.erb index 71a38c76f..755f3e5e9 100644 --- a/app/views/shifts/show.js.erb +++ b/app/views/shifts/show.js.erb @@ -1,3 +1,3 @@ $('#tooltip').html('<%= escape_javascript render partial: "shifts/tooltips/show", object: @shift %>'); -// page.replace_html "tooltip", partial: "shifts/tooltips/show", object: @shift \ No newline at end of file +// page.replace_html "tooltip", partial: "shifts/tooltips/show", object: @shift diff --git a/app/views/shifts/tooltips/_show.html.erb b/app/views/shifts/tooltips/_show.html.erb index 4ece2c251..5264ae266 100644 --- a/app/views/shifts/tooltips/_show.html.erb +++ b/app/views/shifts/tooltips/_show.html.erb @@ -139,8 +139,8 @@ <% elsif current_user == @shift.user %> <% unless @shift.has_passed? or @shift.submitted? %> <% if @shift.has_sub?%> - <%= link_to "Edit sub request", edit_sub_request_path(@shift.sub_request) %> | - <%= link_to 'Cancel Request and Sign In', sub_request_path(@sub_request, sign_in: true), method: :delete%> + <%= link_to "Edit sub request", edit_sub_request_path(@shift.sub_request) %> + <%= link_to 'Cancel Request and Sign In', sub_request_path(@shift.sub_request, sign_in: true), method: :delete%> <% else%> <%= link_to "Request a sub for this shift", new_shift_sub_request_path(@shift) %> <% end %> From bf53abc97d3b2b575671479fb89d874b99c0acea Mon Sep 17 00:00:00 2001 From: David Yao Date: Sat, 4 Oct 2014 21:14:09 -0400 Subject: [PATCH 16/34] ordinary shift creation wasn't ajax --- app/views/shifts/tooltips/_new.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/shifts/tooltips/_new.html.erb b/app/views/shifts/tooltips/_new.html.erb index 2d5453d1e..faf3dea13 100644 --- a/app/views/shifts/tooltips/_new.html.erb +++ b/app/views/shifts/tooltips/_new.html.erb @@ -9,7 +9,7 @@ <% end %>

      - <%= form_for @shift do |f| %> + <%= form_for @shift, remote: true do |f| %> <%= f.error_messages %> <%= render partial: 'shifts/form', locals: {f: f} %>

      <%= submit_tag "Create New", url: { action: 'create', calendar: params[:calendar] } %>

      From 524a91daac55fbbd61607eba404d9c71244d6e0e Mon Sep 17 00:00:00 2001 From: thomasweng15 Date: Sun, 12 Oct 2014 14:17:38 -0400 Subject: [PATCH 17/34] Fixed mysql errors with updating repeating events. --- app/models/shift.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/models/shift.rb b/app/models/shift.rb index ee58397b5..1e680538f 100644 --- a/app/models/shift.rb +++ b/app/models/shift.rb @@ -107,12 +107,12 @@ def self.delete_part_of_shift(shift, start_of_delete, end_of_delete) def self.mass_delete_with_dependencies(shifts_to_erase) array_of_shift_arrays = shifts_to_erase.batch(450) array_of_shift_arrays.each do |shifts| - subs_to_erase = SubRequest.where(shifts.collect{|shift| "(shift_id = #{shift})"}.join(" OR ")) + subs_to_erase = SubRequest.where(shifts.collect{|shift| "(shift_id = #{shift.id})"}.join(" OR ")) array_of_sub_arrays = subs_to_erase.batch(450) array_of_sub_arrays.each do |subs| - SubRequest.delete_all([subs.collect{|sub| "(id = #{sub})"}.join(" OR ")]) + SubRequest.delete_all([subs.collect{|sub| "(id = #{sub.id})"}.join(" OR ")]) end - Shift.delete_all([shifts.collect{|shift| "(id = #{shift})"}.join(" OR ")]) + Shift.delete_all([shifts.collect{|shift| "(id = #{shift.id})"}.join(" OR ")]) end end From 4cc2bab78d298169b373459938ad9bfe26eb3d4c Mon Sep 17 00:00:00 2001 From: Thomas Weng Date: Sat, 20 Sep 2014 23:39:48 -0400 Subject: [PATCH 18/34] Moved tooltip initialization function into jQuery document.ready. --- app/assets/javascripts/tooltip.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/app/assets/javascripts/tooltip.js b/app/assets/javascripts/tooltip.js index 39b0f8bd4..5a17c599a 100644 --- a/app/assets/javascripts/tooltip.js +++ b/app/assets/javascripts/tooltip.js @@ -1,9 +1,5 @@ $(document).ready(function(){ - $("div.timeslots li.click_to_add_new").click(function(e){ - e.preventDefault(); - window.location.href = newTimeSlotPath; - }); - + initialize("body"); }); @@ -15,7 +11,6 @@ $(document).ready(function(){ -initialize("body"); function initialize(element) { From 16d40cd00e1db1bf231f58a57c203999c568364f Mon Sep 17 00:00:00 2001 From: Thomas Weng Date: Sat, 20 Sep 2014 23:41:57 -0400 Subject: [PATCH 19/34] Removed deprecated submit_to_remote function and uncommented css layout for tooltip. Submit button not functional yet. --- app/assets/stylesheets/_timeline.css.scss | 28 +++++++++++------------ app/views/shifts/tooltips/_new.html.erb | 4 ++-- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/app/assets/stylesheets/_timeline.css.scss b/app/assets/stylesheets/_timeline.css.scss index c417fec32..054fcf24f 100644 --- a/app/assets/stylesheets/_timeline.css.scss +++ b/app/assets/stylesheets/_timeline.css.scss @@ -189,20 +189,20 @@ div.center_content { img.right_arrow { position:absolute; right:0; } img.left_arrow { position:absolute; left:0; } -// div#tooltip{ -// text-align: left; -// z-index: 1000; -// display: block; -// background: #DDDDFF; -// color: #000; -// padding: 5px; -// padding-top:15px; -// min-width: 200px; -// font-style: normal; -// font-weight: normal; -// font-family: "Trebuchet MS", Helvetica, sans-serif; -// font-size: 12px; -// } +div#tooltip{ + text-align: left; + z-index: 1000; + display: block; + background: #DDDDFF; + color: #000; + padding: 5px; + padding-top:15px; + min-width: 200px; + font-style: normal; + font-weight: normal; + font-family: "Trebuchet MS", Helvetica, sans-serif; + font-size: 12px; +} div#tooltip strong{ border: 0; diff --git a/app/views/shifts/tooltips/_new.html.erb b/app/views/shifts/tooltips/_new.html.erb index 27e56a8ae..2edeb95b2 100644 --- a/app/views/shifts/tooltips/_new.html.erb +++ b/app/views/shifts/tooltips/_new.html.erb @@ -12,7 +12,7 @@ <%= form_for @shift, remote: true do |f| %> <%= f.error_messages %> <%= render partial: 'shifts/form', locals: {f: f} %> -

      <%= submit_to_remote "add_button", "Create New", url: { action: 'create', calendar: params[:calendar] } %>

      + <%#

      <%= submit_to_remote "add_button", "Create New", url: { action: 'create', calendar: params[:calendar] } %> <% end %>

      @@ -22,7 +22,7 @@ <%= form_for(@repeating_event = RepeatingEvent.new, remote: true) do |f| %> <%= render partial: 'shifts/form_repeating', locals: {f: f, shift_start: params[:date].to_date.midnight, shift_end: params[:date].to_date.midnight } %> <%= hidden_field_tag 'rerender_date', params[:date] %> -

      <%= submit_to_remote "add_button", "Create New Repeating Event", url: { controller: 'repeating_events', action: 'create', calendar: params[:calendar] }, loading: "$(this).val('creating...'); $(this).attr('disabled', 'true')" %>

      + <%#

      <%= submit_to_remote "add_button", "Create New Repeating Event", url: { controller: 'repeating_events', action: 'create', calendar: params[:calendar] }, loading: "$(this).val('creating...'); $(this).attr('disabled', 'true')" %> <% end %>

    <% end %> From 86a1f9ed665ff36e667b42c811da6669b380078e Mon Sep 17 00:00:00 2001 From: Thomas Weng Date: Sun, 21 Sep 2014 00:11:43 -0400 Subject: [PATCH 20/34] Replaced submit_to_remote functions with submit_tag functions. --- app/views/shifts/tooltips/_new.html.erb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/views/shifts/tooltips/_new.html.erb b/app/views/shifts/tooltips/_new.html.erb index 2edeb95b2..c19f48320 100644 --- a/app/views/shifts/tooltips/_new.html.erb +++ b/app/views/shifts/tooltips/_new.html.erb @@ -12,8 +12,7 @@ <%= form_for @shift, remote: true do |f| %> <%= f.error_messages %> <%= render partial: 'shifts/form', locals: {f: f} %> - <%#

    <%= submit_to_remote "add_button", "Create New", url: { action: 'create', calendar: params[:calendar] } %> - +

    <%= submit_tag "Create New", url: { action: 'create', calendar: params[:calendar] } %>

    <% end %>
    @@ -22,7 +21,7 @@ <%= form_for(@repeating_event = RepeatingEvent.new, remote: true) do |f| %> <%= render partial: 'shifts/form_repeating', locals: {f: f, shift_start: params[:date].to_date.midnight, shift_end: params[:date].to_date.midnight } %> <%= hidden_field_tag 'rerender_date', params[:date] %> - <%#

    <%= submit_to_remote "add_button", "Create New Repeating Event", url: { controller: 'repeating_events', action: 'create', calendar: params[:calendar] }, loading: "$(this).val('creating...'); $(this).attr('disabled', 'true')" %> +

    <%= submit_tag "Create New Repeating Event", url: { controller: 'repeating_events', action: 'create', calendar: params[:calendar] }, loading: "$(this).val('creating...'); $(this).attr('disabled', 'true')" %>

    <% end %>
    <% end %> From a5badab2308571aac9759c2d871bbb98d94e4633 Mon Sep 17 00:00:00 2001 From: Thomas Weng Date: Sun, 21 Sep 2014 21:06:10 -0400 Subject: [PATCH 21/34] Made edit existing user tooltip appear and save properly. --- app/assets/javascripts/tooltip.js | 10 ---------- app/views/shifts/create.js.erb | 7 ++++++- app/views/shifts/tooltips/_show.html.erb | 4 ++-- app/views/shifts/update.js.erb | 11 ++++++++--- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/app/assets/javascripts/tooltip.js b/app/assets/javascripts/tooltip.js index 5a17c599a..c53f4e4d4 100644 --- a/app/assets/javascripts/tooltip.js +++ b/app/assets/javascripts/tooltip.js @@ -2,16 +2,6 @@ $(document).ready(function(){ initialize("body"); }); - - - - - - - - - - function initialize(element) { $(element+' td.click_to_show').click(function (e) { diff --git a/app/views/shifts/create.js.erb b/app/views/shifts/create.js.erb index d5f1c9572..59911a38f 100644 --- a/app/views/shifts/create.js.erb +++ b/app/views/shifts/create.js.erb @@ -1,8 +1,13 @@ $('#tooltip').remove(); -$('#<%= @shift.start.strftime("%Y-%m-%d") %>').html('<%= escape_javascript render partial: (params[:calendar] ? "calendars/schedule/day" : "shifts/schedule/day"), object: @shift.start.to_date %>') +$('#<%= @shift.start.strftime("%Y-%m-%d") %>').html( + '<%= escape_javascript render partial: + (params[:calendar] ? "calendars/schedule/day" : "shifts/schedule/day"), + object: @shift.start.to_date %>'); // TODO: Figure out how to make this work in jQuery // page["#shift#{@shift.id}"].visual_effect :highlight + initialize('body'); // display alert +// alert("shift created"); \ No newline at end of file diff --git a/app/views/shifts/tooltips/_show.html.erb b/app/views/shifts/tooltips/_show.html.erb index 2367bb8a9..c8922efe1 100644 --- a/app/views/shifts/tooltips/_show.html.erb +++ b/app/views/shifts/tooltips/_show.html.erb @@ -60,7 +60,7 @@
    <%= form_for @shift, remote: true do |f| %> <%= render partial: 'shifts/form', locals: {f: f} %> -

    <%= submit_to_remote "edit_button", "Save Changes", url: { controller: 'shifts', action: 'update', calendar: params[:calendar] } %>

    +

    <%= submit_tag "Save Changes", url: { controller: 'shifts', action: 'update', calendar: params[:calendar] } %>

    <% end %> <% if current_user == @shift.user and !@shift.has_passed? %> @@ -99,7 +99,7 @@ <%= form_for (@repeating_event = @shift.repeating_event), remote: true do |f| %> <%= render partial: 'shifts/form_repeating', locals: {f: f, shift_start: @shift.start, shift_end: @shift.end} %> <%= hidden_field_tag 'rerender_date', @shift.start.to_date.to_s %> -

    <%= submit_to_remote "add_button", "Update Repeating Event", url: { controller: 'repeating_events', action: 'update', id: @repeating_event.id, calendar: params[:calendar] } %>

    +

    <%= submit_tag "Update Repeating Event", url: { controller: 'repeating_events', action: 'update', id: @repeating_event.id, calendar: params[:calendar] } %>

    <% end %>
    <% end %> diff --git a/app/views/shifts/update.js.erb b/app/views/shifts/update.js.erb index 58d001797..a2840771e 100644 --- a/app/views/shifts/update.js.erb +++ b/app/views/shifts/update.js.erb @@ -1,8 +1,13 @@ -$('#shift.start.strftime("%Y-%m-%d")').html('<%= escape_javascript render partial: (params[:calendar] ? "calendars/schedule/day" : "shifts/schedule/day"), object: @shift.start.to_date %>'); +$('#tooltip').remove(); +$('#<%= @shift.start.strftime("%Y-%m-%d") %>').html( + '<%= escape_javascript render partial: + (params[:calendar] ? "calendars/schedule/day" : "shifts/schedule/day"), + object: @shift.start.to_date %>'); + +// TODO: Figure out how to make this work in jQuery // page["#shift#{@shift.id}"].visual_effect :highlight -$("#tooltip").remove(); initialize('##{@shift.start.strftime("%Y-%m-%d")}'); // display alert -alert("shift updated"); +//alert("shift updated"); From fe1aa4b5a331538b8817bc69fe3a08d9efd6ab02 Mon Sep 17 00:00:00 2001 From: David Yao Date: Thu, 25 Sep 2014 10:55:32 -0400 Subject: [PATCH 22/34] recurring shifts creation --- app/models/shift.rb | 6 +++--- app/views/shifts/tooltips/_new.html.erb | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/models/shift.rb b/app/models/shift.rb index 8d689f9db..ee58397b5 100644 --- a/app/models/shift.rb +++ b/app/models/shift.rb @@ -135,11 +135,11 @@ def self.make_future(end_date, cal_id, r_e_id, days, loc_id, start_time, end_tim seed_end_time = seed_start_time+diff while seed_end_time <= (end_date + 1.day) if active - inner_test.push "(user_id = #{user_id} AND active = #{true} AND department_id = #{department_id} AND start <= #{seed_end_time.utc} AND end >= #{seed_start_time.utc})" + inner_test.push "(user_id = #{user_id} AND active = #{true} AND department_id = #{department_id} AND start <= '#{seed_end_time.utc}' AND end >= '#{seed_start_time.utc}')" else - inner_test.push "(user_id = #{user_id} AND calendar_id = #{cal_id} AND department_id = #{department_id} AND start <= #{seed_end_time.utc} AND end >= #{seed_start_time.utc})" + inner_test.push "(user_id = #{user_id} AND calendar_id = #{cal_id} AND department_id = #{department_id} AND start <= '#{seed_end_time.utc}' AND end >= '#{seed_start_time.utc}')" end - inner_make.push "#{loc_id}, #{cal_id}, #{r_e_id}, #{seed_start_time.utc}, #{seed_end_time.utc}, #{Time.now.utc}, #{Time.now.utc}, #{user_id}, #{department_id}, #{active}" + inner_make.push "#{loc_id}, #{cal_id}, #{r_e_id}, '#{seed_start_time.utc}', '#{seed_end_time.utc}', '#{Time.now.utc}', '#{Time.now.utc}', #{user_id}, #{department_id}, #{active}" #Once the array becomes big enough that the sql call will insert 450 rows, start over w/ a new array #without this bit, sqlite freaks out if you are inserting a larger number of rows. Might need to be changed #for other databases (it can probably be higher for other ones I think, which would result in faster execution) diff --git a/app/views/shifts/tooltips/_new.html.erb b/app/views/shifts/tooltips/_new.html.erb index c19f48320..2d5453d1e 100644 --- a/app/views/shifts/tooltips/_new.html.erb +++ b/app/views/shifts/tooltips/_new.html.erb @@ -9,7 +9,7 @@ <% end %>
    - <%= form_for @shift, remote: true do |f| %> + <%= form_for @shift do |f| %> <%= f.error_messages %> <%= render partial: 'shifts/form', locals: {f: f} %>

    <%= submit_tag "Create New", url: { action: 'create', calendar: params[:calendar] } %>

    @@ -18,7 +18,7 @@ <% if current_user.is_admin_of?(@department) %> <% if current_user.is_admin_of?(@department) and @shift.repeating_event %> <% if current_user.is_admin_of?(@department) %> <% end %> + From ac716f439f1e911a7c305487fbddba4bcbad0411 Mon Sep 17 00:00:00 2001 From: David Yao Date: Sat, 27 Sep 2014 14:19:10 -0400 Subject: [PATCH 27/34] fixed timeslot ajax edit --- app/views/time_slots/tooltips/_show.html.erb | 17 ++++++++--------- app/views/time_slots/update.js.erb | 12 ++++++------ 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/app/views/time_slots/tooltips/_show.html.erb b/app/views/time_slots/tooltips/_show.html.erb index 4dc5647cb..8f082d455 100644 --- a/app/views/time_slots/tooltips/_show.html.erb +++ b/app/views/time_slots/tooltips/_show.html.erb @@ -4,26 +4,26 @@ <% if params[:delete_options] and @time_slot.repeating_event %>

    This time slot is part of a repeating event.
    What do you wish to destroy?

    - <%= button_to_remote "Just this time slot", {url: {controller: 'time_slots', action: 'destroy', id: @time_slot.id, calendar: (params[:calendar] || true)}, confirm: 'Are you sure?', method: :delete} %>
    - <%= button_to_remote "This and all future time slots", {url: {controller: 'repeating_events', action: 'destroy', id: @time_slot.repeating_event.id, calendar: (params[:calendar] || true), delete_after_date: @time_slot.start}, confirm: 'Are you sure?', method: :delete} %>
    - <%= button_to_remote "All events in this series", {url: {controller: 'repeating_events', action: 'destroy', id: @time_slot.repeating_event.id, calendar: (params[:calendar] || true), rerender_date: @time_slot.start}, confirm: 'Are you sure?', method: :delete} %> + <%= button_to "Just this time slot", {controller: 'time_slots', action: 'destroy', id: @time_slot.id, calendar: (params[:calendar] || true)}, data:{confirm: 'Are you sure?'}, method: :delete %>
    + <%= button_to "This and all future time slots", {controller: 'repeating_events', action: 'destroy', id: @time_slot.repeating_event.id, calendar: (params[:calendar] || true), delete_after_date: @time_slot.start}, data:{confirm: 'Are you sure?'}, method: :delete %>
    + <%= button_to "All events in this series", {controller: 'repeating_events', action: 'destroy', id: @time_slot.repeating_event.id, calendar: (params[:calendar] || true), rerender_date: @time_slot.start}, data:{confirm: 'Are you sure?'}, method: :delete %>
    <% else %>

    Edit Timeslot

    <%= form_for @time_slot, remote: true do |f| %> <%= render partial: 'time_slots/form', locals: {f: f} %> -

    <%= submit_to_remote "edit_button", "Save Changes", url: { controller: 'time_slots', action: 'update', calendar: (params[:calendar] || true) } %>

    +

    <%= submit_tag "Save Changes", url: { controller: 'time_slots', action: 'update', calendar: (params[:calendar] || true) } %>

    <% end %>

    <% unless @time_slot.repeating_event %> - <%= link_to "Destroy this time slot", {url: {controller: 'time_slots', action: 'destroy', id: @time_slot.id, calendar: (params[:calendar] || true)}, remote: true, confirm: 'Are you sure?', method: :delete} %> + <%= link_to "Destroy this time slot", time_slot_path(@time_slot, calendar: (params[:calendar] || true)), data:{confirm: 'Are you sure?'}, method: :delete %> <% else %> <%= link_to_function "Destroy this time slot", "$('#repeating_event_delete_options').toggle()" %>

    <% end %>

    @@ -41,6 +41,5 @@

    <% end %> - <%= render partial: '/tooltips/close_tooltip'%> diff --git a/app/views/time_slots/update.js.erb b/app/views/time_slots/update.js.erb index 1815c1550..2da40f62d 100644 --- a/app/views/time_slots/update.js.erb +++ b/app/views/time_slots/update.js.erb @@ -1,10 +1,10 @@ -$("#timeslot<%= @time_slot.id %>").remove() -$("#location<%= @time_slot.location.id %>_<%= @time_slot_day.strftime("%Y-%m-%d") %>_timeslots %>").append('<%= escape_javascript render partial: "time_slots/time_slot", object: @time_slot, locals: {time_slot_day: @time_slot_day} %>'); -//TODO How to do this in jQuery (probably requires) -//page["#timeslot#{@time_slot.id}"].visual_effect :highlight +$("#timeslot<%= @time_slot.id %>").remove(); +<% ul_id = "location#{@time_slot.location.id}_#{@time_slot_day.strftime('%Y-%m-%d')}_timeslots" %> +<% new_li = escape_javascript render partial: "time_slots/time_slot", object: @time_slot, locals: {time_slot_day: @time_slot_day} %> + +$('#<%= ul_id %>').append("<%= new_li %>"); +$("#timeslot<%= @time_slot.id %>").effect("highlight", 1100); $("#tooltip").remove() $('#timeslot#{@time_slot.id}').click(function (e) {popup_edit_timeslot($(this), e); return false;}); -// display alert -alert("timeslot updated"); \ No newline at end of file From b06158266ece2ce99cc355752659745667a7f62d Mon Sep 17 00:00:00 2001 From: David Yao Date: Sat, 27 Sep 2014 14:26:58 -0400 Subject: [PATCH 28/34] Fixed timeslots creation ajax highlight effect --- app/views/time_slots/create.js.erb | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/app/views/time_slots/create.js.erb b/app/views/time_slots/create.js.erb index 521b7be11..4f8eed726 100644 --- a/app/views/time_slots/create.js.erb +++ b/app/views/time_slots/create.js.erb @@ -1,9 +1,6 @@ $("#tooltip").remove() $("#location<%= @time_slot.location.id %>_<%= @time_slot_day.strftime("%Y-%m-%d") %>_timeslots").append('<%= escape_javascript render partial: "time_slots/time_slot", object: @time_slot, locals: {time_slot_day: @time_slot_day} %>'); -//TODO How to do this in jQuery -//page["#timeslot#{@time_slot.id}"].visual_effect :highlight +$("#timeslot<%= @time_slot.id %>").effect("highlight", 1100); $('#timeslot<%= @time_slot.id %>').click(function (e) {popup_edit_timeslot($(this), e); return false;}); -// display alert -alert("timeslot created"); From 40ae32740f0eec04be7b3e111bfd4dbaf83898a3 Mon Sep 17 00:00:00 2001 From: Thomas Weng Date: Wed, 1 Oct 2014 20:56:23 -0400 Subject: [PATCH 29/34] Clicking on calendar schedule opens 'Add New Timeslot' tooltip instead of 'Add New Shift' tooltip. --- app/views/calendars/schedule/_location_row.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/calendars/schedule/_location_row.html.erb b/app/views/calendars/schedule/_location_row.html.erb index 9364d34fd..fd602f0e6 100644 --- a/app/views/calendars/schedule/_location_row.html.erb +++ b/app/views/calendars/schedule/_location_row.html.erb @@ -1,5 +1,5 @@
      -
    • +
    • <% unless location_row.compact.empty? %> <%= render partial: "calendars/schedule/shift", collection: location_row %> <% end %> From 3bf11087f64892366137cfcd7ab1afd493e43f58 Mon Sep 17 00:00:00 2001 From: Thomas Weng Date: Wed, 1 Oct 2014 21:29:21 -0400 Subject: [PATCH 30/34] Fixed layout of timeslot schedule. --- app/helpers/shifts_helper.rb | 2 +- app/views/calendars/schedule/_location.html.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/helpers/shifts_helper.rb b/app/helpers/shifts_helper.rb index 55a464a8e..0c92d0fdd 100644 --- a/app/helpers/shifts_helper.rb +++ b/app/helpers/shifts_helper.rb @@ -351,7 +351,7 @@ def calendar_day_preprocessing(day) @timeslot_rows = 0 #counter - @row_height = 24 #pixels - this could be user-configurable + @row_height = 48 #pixels - this could be user-configurable @divider_height = 3 #pixels - this could be user-configurable @table_height = rowcount @table_pixels = @row_height * rowcount + rowcount+1 diff --git a/app/views/calendars/schedule/_location.html.erb b/app/views/calendars/schedule/_location.html.erb index b95b24560..24efc1fc9 100644 --- a/app/views/calendars/schedule/_location.html.erb +++ b/app/views/calendars/schedule/_location.html.erb @@ -1,4 +1,4 @@ -
      +
      <%# Why is the div on the next line there? where does it appear? You can't click on the box in this column to add anything %>
      From 84dce9642ce975e7107174940d8e1767b86443af Mon Sep 17 00:00:00 2001 From: Thomas Weng Date: Thu, 2 Oct 2014 01:06:19 -0400 Subject: [PATCH 31/34] Reverting previous commit so that clicking on timeslot schedule still opens new shift tooltip. --- app/views/calendars/schedule/_location_row.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/calendars/schedule/_location_row.html.erb b/app/views/calendars/schedule/_location_row.html.erb index fd602f0e6..9364d34fd 100644 --- a/app/views/calendars/schedule/_location_row.html.erb +++ b/app/views/calendars/schedule/_location_row.html.erb @@ -1,5 +1,5 @@
        -
      • +
      • <% unless location_row.compact.empty? %> <%= render partial: "calendars/schedule/shift", collection: location_row %> <% end %> From 59e5ac3db66f9bef3fb25fe4e903bd93286fa5c6 Mon Sep 17 00:00:00 2001 From: David Yao Date: Sat, 4 Oct 2014 17:39:36 -0400 Subject: [PATCH 32/34] Fixed shift show page for scheduled shift in the future, as well as non-superuser shift-show tooltip --- app/views/shifts/show.html.erb | 2 +- app/views/shifts/show.js.erb | 2 +- app/views/shifts/tooltips/_show.html.erb | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/shifts/show.html.erb b/app/views/shifts/show.html.erb index 2bce9ba21..335452357 100644 --- a/app/views/shifts/show.html.erb +++ b/app/views/shifts/show.html.erb @@ -21,7 +21,7 @@ <%= link_to "View report", shift_report_path(@shift) %> <% elsif current_user==@shift.user %>

        - <%= link_to "Request a sub for this shift", new_shift_sub_path(@shift) %> + <%= link_to "Request a sub for this shift", new_shift_sub_request_path(@shift) %>

        <% if within_sign_in_window?(@shift) %>

        diff --git a/app/views/shifts/show.js.erb b/app/views/shifts/show.js.erb index 71a38c76f..755f3e5e9 100644 --- a/app/views/shifts/show.js.erb +++ b/app/views/shifts/show.js.erb @@ -1,3 +1,3 @@ $('#tooltip').html('<%= escape_javascript render partial: "shifts/tooltips/show", object: @shift %>'); -// page.replace_html "tooltip", partial: "shifts/tooltips/show", object: @shift \ No newline at end of file +// page.replace_html "tooltip", partial: "shifts/tooltips/show", object: @shift diff --git a/app/views/shifts/tooltips/_show.html.erb b/app/views/shifts/tooltips/_show.html.erb index 520a783a8..8c8a3adef 100644 --- a/app/views/shifts/tooltips/_show.html.erb +++ b/app/views/shifts/tooltips/_show.html.erb @@ -139,8 +139,8 @@ <% elsif current_user == @shift.user %> <% unless @shift.has_passed? or @shift.submitted? %> <% if @shift.has_sub?%> - <%= link_to "Edit sub request", edit_sub_request_path(@shift.sub_request) %> | - <%= link_to 'Cancel Request and Sign In', sub_request_path(@sub_request, sign_in: true), method: :delete%> + <%= link_to "Edit sub request", edit_sub_request_path(@shift.sub_request) %> + <%= link_to 'Cancel Request and Sign In', sub_request_path(@shift.sub_request, sign_in: true), method: :delete%> <% else%> <%= link_to "Request a sub for this shift", new_shift_sub_request_path(@shift) %> <% end %> From 149f9156ccbea56fae60c74ae2dcb64f39e1a1a5 Mon Sep 17 00:00:00 2001 From: David Yao Date: Sat, 4 Oct 2014 21:14:09 -0400 Subject: [PATCH 33/34] ordinary shift creation wasn't ajax --- app/views/shifts/tooltips/_new.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/shifts/tooltips/_new.html.erb b/app/views/shifts/tooltips/_new.html.erb index 2d5453d1e..faf3dea13 100644 --- a/app/views/shifts/tooltips/_new.html.erb +++ b/app/views/shifts/tooltips/_new.html.erb @@ -9,7 +9,7 @@ <% end %>

        - <%= form_for @shift do |f| %> + <%= form_for @shift, remote: true do |f| %> <%= f.error_messages %> <%= render partial: 'shifts/form', locals: {f: f} %>

        <%= submit_tag "Create New", url: { action: 'create', calendar: params[:calendar] } %>

        From 67abf09854a678b351eda1b6e5987be0674cbb72 Mon Sep 17 00:00:00 2001 From: thomasweng15 Date: Sun, 12 Oct 2014 14:17:38 -0400 Subject: [PATCH 34/34] Fixed mysql errors with updating repeating events. --- app/models/shift.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/models/shift.rb b/app/models/shift.rb index ee58397b5..1e680538f 100644 --- a/app/models/shift.rb +++ b/app/models/shift.rb @@ -107,12 +107,12 @@ def self.delete_part_of_shift(shift, start_of_delete, end_of_delete) def self.mass_delete_with_dependencies(shifts_to_erase) array_of_shift_arrays = shifts_to_erase.batch(450) array_of_shift_arrays.each do |shifts| - subs_to_erase = SubRequest.where(shifts.collect{|shift| "(shift_id = #{shift})"}.join(" OR ")) + subs_to_erase = SubRequest.where(shifts.collect{|shift| "(shift_id = #{shift.id})"}.join(" OR ")) array_of_sub_arrays = subs_to_erase.batch(450) array_of_sub_arrays.each do |subs| - SubRequest.delete_all([subs.collect{|sub| "(id = #{sub})"}.join(" OR ")]) + SubRequest.delete_all([subs.collect{|sub| "(id = #{sub.id})"}.join(" OR ")]) end - Shift.delete_all([shifts.collect{|shift| "(id = #{shift})"}.join(" OR ")]) + Shift.delete_all([shifts.collect{|shift| "(id = #{shift.id})"}.join(" OR ")]) end end