Add a feature flag to wrap calendar event titles

Fixes CNVS-25348

Test plan:
 - Enable the "wrap calendar event titles" feature on an account
 - As a user on that account, make a calendar event with a really
   long title
 - Ensure that it wraps in month view
 - Disable the feature flag
 - Ensure that the event is now truncated at one line

Change-Id: If9d2bd7090c72596ebe30d9f5c8b68f7948cdcb7
Reviewed-on: https://gerrit.instructure.com/74707
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: Alex Boyd <aboyd@instructure.com>
This commit is contained in:
Alex Boyd 2016-03-16 17:41:23 -06:00
parent a55ff46440
commit 4e58faa8d4
5 changed files with 14 additions and 1 deletions

View File

@ -25,6 +25,7 @@ class CalendarsController < ApplicationController
@manage_contexts = @contexts.select{|c| c.grants_right?(@current_user, session, :manage_calendar) }.map(&:asset_string)
@feed_url = feeds_calendar_url((@context_enrollment || @context).feed_code)
@selected_contexts = params[:include_contexts].split(",") if params[:include_contexts]
@wrap_titles = @domain_root_account && @domain_root_account.feature_enabled?(:wrap_calendar_event_titles)
# somewhere there's a bad link that doesn't separate parameters properly.
# make sure we don't do a find on a non-numeric id.
if params[:event_id] && params[:event_id] =~ Api::ID_REGEX && (event = CalendarEvent.where(id: params[:event_id]).first) && event.start_at

View File

@ -1,3 +1,4 @@
@import "pages/calendar/calendar2";
@import "../../../public/javascripts/bower/fullcalendar/dist/fullcalendar";
@import "pages/calendar/mini_calendar";
@import "pages/calendar/sidebar";

View File

@ -0,0 +1,3 @@
.wrap-calendar-event-titles .fc-day-grid-event .fc-content {
white-space: normal;
}

View File

@ -58,6 +58,6 @@
</div>
<div id="calendar_header"></div>
<div id="calendar-app" role="tabpanel"></div>
<div id="calendar-app" role="tabpanel" class="<%= 'wrap-calendar-event-titles' if @wrap_titles %>"></div>
<div id="calendar-drag-and-drop-container"></div>

View File

@ -412,6 +412,14 @@ END
development: true,
root_opt_in: false,
},
'wrap_calendar_event_titles' =>
{
display_name: -> { I18n.t('Wrap event titles in Calendar month view') },
description: -> { I18n.t("Show calendar events in the month view on multiple lines if the title doesn't fit on a single line") },
applies_to: 'RootAccount',
state: 'allowed',
root_opt_in: true
}
)
def self.definitions