From f521ca9b3ff309c12e44c55bc72bcaabb2c62245 Mon Sep 17 00:00:00 2001 From: Jain Date: Wed, 13 Sep 2017 11:48:00 -0500 Subject: [PATCH 1/3] Allow task due date inplace editing if no date - Added place holder text for Due date so the inline editing is available for nil due date --- app/assets/stylesheets/application.scss | 3 +++ app/views/network_event_tasks/index.html.erb | 2 +- app/views/network_events/show.html.erb | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index 55e0170..e45a1a2 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -29,3 +29,6 @@ body { text-align: center; } +.date-view { + cursor: pointer; +} \ No newline at end of file diff --git a/app/views/network_event_tasks/index.html.erb b/app/views/network_event_tasks/index.html.erb index 70a4d30..37c35a1 100644 --- a/app/views/network_event_tasks/index.html.erb +++ b/app/views/network_event_tasks/index.html.erb @@ -123,7 +123,7 @@ data-source="<%= User.editable_options %>"><%= task.owner.try(:email) %> <%= task.network_event.schools.map {|school| school.name}.join(", ") %> - <%= task.formatted_due_date %> + <%= task.formatted_due_date.present? ? task.formatted_due_date : 'Add Due Date' %>
<%= date_field_tag :due_date, if task.due_date then task.due_date.in_time_zone("Central Time (US & Canada)").strftime('%Y-%m-%d') end, class: "date-input" %>
diff --git a/app/views/network_events/show.html.erb b/app/views/network_events/show.html.erb index b7601ad..85bf24b 100644 --- a/app/views/network_events/show.html.erb +++ b/app/views/network_events/show.html.erb @@ -146,7 +146,7 @@ <%= content_tag_for(:tr, @network_event.network_event_tasks) do |task| %> <%= task.name %> - <%= task.formatted_due_date %> + <%= task.formatted_due_date.present? ? task.formatted_due_date : 'Add due date' %>
<%= date_field_tag :due_date, if task.due_date then task.due_date.in_time_zone("Central Time (US & Canada)").strftime('%Y-%m-%d') end, class: "date-input" %>
From 08ef1ee5496edb528f281768eb403a26a26f8030 Mon Sep 17 00:00:00 2001 From: Jain Date: Wed, 13 Sep 2017 11:56:10 -0500 Subject: [PATCH 2/3] Fix event page New Task Form dropdown widths --- app/views/network_events/show.html.erb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/network_events/show.html.erb b/app/views/network_events/show.html.erb index 85bf24b..9d57638 100644 --- a/app/views/network_events/show.html.erb +++ b/app/views/network_events/show.html.erb @@ -186,11 +186,11 @@
<%= f.label :owner %> - <%= f.collection_select :owner_id, User.all, :id, :email, {:include_blank => "No owner selected"}, class: "select2 form-control"%> + <%= f.collection_select :owner_id, User.all, :id, :email, {:include_blank => "No owner selected"}, class: "select2"%>
<%= f.label :common_task %> - <%= f.collection_select :common_task_id, CommonTask.all, :id, :name, {:include_blank => "No common task selected" }, class: "select2 form-control"%> + <%= f.collection_select :common_task_id, CommonTask.all, :id, :name, {:include_blank => "No common task selected" }, class: "select2"%>
<%= f.label :date_modifier, "Due date" %> @@ -199,7 +199,7 @@ :to_s, :titleize, {}, - class: "select2 form-control task-field", + class: "select2 task-field", multiple: false, data: {placeholder: 'Select Date Modifier'} %>
From 719e4ccd84f532da0c61204b116e7af0ae01772a Mon Sep 17 00:00:00 2001 From: Jain Date: Wed, 13 Sep 2017 12:44:33 -0500 Subject: [PATCH 3/3] Moved placeholder for no due date from the view file to the formatted_due_date with the date_modifier value --- app/models/network_event_task.rb | 22 ++++++++++---------- app/views/network_event_tasks/index.html.erb | 2 +- app/views/network_events/show.html.erb | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/app/models/network_event_task.rb b/app/models/network_event_task.rb index 754c8df..f7e9a92 100644 --- a/app/models/network_event_task.rb +++ b/app/models/network_event_task.rb @@ -1,6 +1,6 @@ class NetworkEventTask < ApplicationRecord include PgSearch - + pg_search_scope :search_by_task_name, :against => [:name], :using => { :tsearch => {:prefix => true} } @@ -8,35 +8,35 @@ class NetworkEventTask < ApplicationRecord belongs_to :owner, :class_name => "User" belongs_to :network_event belongs_to :common_task - + validates_presence_of :name - + def self.in_date_range(start_date, end_date) start_date = Date.strptime(start_date, '%A %B %d %Y') end_date = Date.strptime(end_date, '%A %B %d %Y') where(due_date: [start_date.beginning_of_day..end_date.end_of_day, nil]) end - + def formatted_due_date if due_date.present? - due_date.in_time_zone("Central Time (US & Canada)").strftime(' %a, %B %e %Y') + due_date.in_time_zone("Central Time (US & Canada)").strftime(' %a, %B %e %Y') else - nil + date_modifier end end - + def formatted_completed_at if completed_at.present? - completed_at.in_time_zone("Central Time (US & Canada)").strftime(' %a, %B %e %Y') + completed_at.in_time_zone("Central Time (US & Canada)").strftime(' %a, %B %e %Y') else nil end end - + def completed? return completed_at.present? end - + def as_json(options) result = super if completed_at? @@ -44,4 +44,4 @@ def as_json(options) end result end -end \ No newline at end of file +end diff --git a/app/views/network_event_tasks/index.html.erb b/app/views/network_event_tasks/index.html.erb index 37c35a1..70a4d30 100644 --- a/app/views/network_event_tasks/index.html.erb +++ b/app/views/network_event_tasks/index.html.erb @@ -123,7 +123,7 @@ data-source="<%= User.editable_options %>"><%= task.owner.try(:email) %> <%= task.network_event.schools.map {|school| school.name}.join(", ") %> - <%= task.formatted_due_date.present? ? task.formatted_due_date : 'Add Due Date' %> + <%= task.formatted_due_date %>
<%= date_field_tag :due_date, if task.due_date then task.due_date.in_time_zone("Central Time (US & Canada)").strftime('%Y-%m-%d') end, class: "date-input" %>
diff --git a/app/views/network_events/show.html.erb b/app/views/network_events/show.html.erb index 9d57638..c6c10c5 100644 --- a/app/views/network_events/show.html.erb +++ b/app/views/network_events/show.html.erb @@ -146,7 +146,7 @@ <%= content_tag_for(:tr, @network_event.network_event_tasks) do |task| %> <%= task.name %> - <%= task.formatted_due_date.present? ? task.formatted_due_date : 'Add due date' %> + <%= task.formatted_due_date %>
<%= date_field_tag :due_date, if task.due_date then task.due_date.in_time_zone("Central Time (US & Canada)").strftime('%Y-%m-%d') end, class: "date-input" %>