Remove dead calendar editing code
closes CNVS-19307 closes CNVS-19308 refs CNVS-15543 As part of an accessibility review, we've been visiting date pickers. The one in "full_calendar_event.html.erb" never seemed to get used, and after a moderate investigation out into the surrounding process it seems there are many things related that don't get used anymore, so let's just kill them all. TEST PLAN: - jenkins should pass - check creating/editing calendar events for regressions, there should be no behavior change - check viewing the calendar for various contexts (events, assignments) for regressions, no behavior changes Change-Id: I05cbe93700664c485a77a164c56bd36db0aaeae3 Reviewed-on: https://gerrit.instructure.com/50509 Tested-by: Jenkins Reviewed-by: Jonathan Featherstone <jfeatherstone@instructure.com> Reviewed-by: Jacob Fugal <jacob@instructure.com> QA-Review: Derek Hansen <dhansen@instructure.com> Product-Review: Ethan Vizitei <evizitei@instructure.com>
This commit is contained in:
parent
1e676439fe
commit
b146324e9a
|
@ -1,2 +0,0 @@
|
|||
require ['calendar_event']
|
||||
|
|
@ -48,7 +48,6 @@ class CalendarEventsController < ApplicationController
|
|||
@event = @context.calendar_events.build
|
||||
add_crumb(t('crumbs.new', "New Calendar Event"), named_context_url(@context, :new_context_calendar_event_url))
|
||||
@event.update_attributes!(params.slice(:title, :start_at, :end_at, :location_name, :location_address))
|
||||
@editing = true
|
||||
js_env(:DIFFERENTIATED_ASSIGNMENTS_ENABLED => @context.feature_enabled?(:differentiated_assignments))
|
||||
authorized_action(@event, @current_user, :create)
|
||||
end
|
||||
|
@ -76,7 +75,6 @@ class CalendarEventsController < ApplicationController
|
|||
if @event.grants_right?(@current_user, session, :update)
|
||||
@event.update_attributes!(params.slice(:title, :start_at, :end_at, :location_name, :location_address))
|
||||
end
|
||||
@editing = true
|
||||
js_env(:DIFFERENTIATED_ASSIGNMENTS_ENABLED => @context.feature_enabled?(:differentiated_assignments))
|
||||
if authorized_action(@event, @current_user, :update_content)
|
||||
render :action => 'new'
|
||||
|
|
|
@ -18,53 +18,6 @@
|
|||
|
||||
class CalendarsController < ApplicationController
|
||||
before_filter :require_user, :except => [ :public_feed ]
|
||||
before_filter :check_preferred_calendar, :only => [ :show, :show2 ]
|
||||
|
||||
def show
|
||||
get_context
|
||||
if @context != @current_user
|
||||
# we used to have calendar pages under contexts, like
|
||||
# /courses/X/calendar, but these all redirect to /calendar now.
|
||||
# we shouldn't have any of these URLs anymore, but let's leave in this
|
||||
# fail-safe in case somebody has a bookmark or something.
|
||||
return redirect_to(calendar_url_for([@context]))
|
||||
end
|
||||
get_all_pertinent_contexts(include_groups: true)
|
||||
# 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 = nil if event && event.start_at.nil?
|
||||
@active_event_id = event.id if event
|
||||
end
|
||||
build_calendar_dates(event)
|
||||
|
||||
respond_to do |format|
|
||||
format.html do
|
||||
@events = []
|
||||
@undated_events = []
|
||||
@show_left_side = false
|
||||
@calendar_event = @contexts[0].calendar_events.new
|
||||
@contexts.each do |context|
|
||||
log_asset_access("dashboard_calendar:#{context.asset_string}", "calendar", 'other')
|
||||
end
|
||||
calendarManagementContexts = @contexts.select{|c| can_do(c, @current_user, :manage_calendar) }.map(&:asset_string)
|
||||
canCreateEvent = calendarManagementContexts.length > 0
|
||||
js_env(calendarManagementContexts: calendarManagementContexts,
|
||||
canCreateEvent: canCreateEvent)
|
||||
render :action => "show"
|
||||
end
|
||||
# this unless @dont_render_again stuff is ugly but I wanted to send back a 304 but it started giving me "Double Render errors"
|
||||
format.json do
|
||||
events = calendar_events_for_request_format
|
||||
render :json => events unless @dont_render_again
|
||||
end
|
||||
format.ics {
|
||||
events = calendar_events_for_request_format
|
||||
render :text => events unless @dont_render_again
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
def show2
|
||||
get_context
|
||||
|
@ -217,34 +170,4 @@ class CalendarsController < ApplicationController
|
|||
end
|
||||
protected :build_calendar_dates
|
||||
|
||||
def switch_calendar
|
||||
if @domain_root_account.enable_scheduler?
|
||||
if params[:preferred_calendar] == '2'
|
||||
@current_user.preferences.delete(:use_calendar1)
|
||||
else
|
||||
@current_user.preferences[:use_calendar1] = true
|
||||
end
|
||||
@current_user.save!
|
||||
end
|
||||
check_preferred_calendar(true)
|
||||
end
|
||||
|
||||
def check_preferred_calendar(always_redirect=false)
|
||||
preferred_calendar = 'show'
|
||||
if (@domain_root_account.enable_scheduler? &&
|
||||
!@current_user.preferences[:use_calendar1]) ||
|
||||
@domain_root_account.calendar2_only?
|
||||
preferred_calendar = 'show2'
|
||||
end
|
||||
if always_redirect || params[:action] != preferred_calendar
|
||||
redirect_to({ :action => preferred_calendar, :anchor => ' ' }.merge(params.slice(:include_contexts, :event_id)))
|
||||
return false
|
||||
end
|
||||
if @domain_root_account.enable_scheduler?
|
||||
if preferred_calendar == 'show'
|
||||
add_crumb view_context.link_to(t(:use_new_calendar, "Try out the new calendar"), switch_calendar_url('2'), :method => :post), nil, :id => 'change_calendar_version_link_holder'
|
||||
end
|
||||
end
|
||||
end
|
||||
protected :check_preferred_calendar
|
||||
end
|
||||
|
|
|
@ -1533,14 +1533,6 @@ class Account < ActiveRecord::Base
|
|||
false
|
||||
end
|
||||
|
||||
def calendar2_only?
|
||||
true
|
||||
end
|
||||
|
||||
def enable_scheduler?
|
||||
true
|
||||
end
|
||||
|
||||
def change_root_account_setting!(setting_name, new_value)
|
||||
root_account.settings[setting_name] = new_value
|
||||
root_account.save!
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<%
|
||||
js_bundle :calendar_event
|
||||
jammit_css :tinymce
|
||||
%>
|
||||
|
||||
<% calendar_event = full_calendar_event %>
|
||||
<div id="full_calendar_event_holder" class="<%= 'editing' if @editing %>">
|
||||
<div id="full_calendar_event_holder">
|
||||
<div class="calendar_event" id="full_calendar_event">
|
||||
<div style="float: right; text-align: right; font-size: 0.8em;">
|
||||
<div class="date_text" style="<%= hidden unless calendar_event && calendar_event.start_at %>">
|
||||
|
@ -29,69 +24,4 @@
|
|||
<div class="description user_content"><%= calendar_event && calendar_event.description && !calendar_event.description.empty? ? user_content(calendar_event.description) : t(:no_content, "No Content") %></div>
|
||||
<div class="course_id" style="display: none;"><%= @context.id if @context && @context.is_a?(Course) %></div>
|
||||
</div>
|
||||
<% if can_do(calendar_event, @current_user, :update_content) %>
|
||||
<% url = calendar_event.new_record? ? context_url(@context, :context_calendar_events_url) : context_url(@context, :context_calendar_event_url, calendar_event.id) %>
|
||||
<%= form_for calendar_event, :url => url, :html => {:method => (calendar_event.new_record? ? 'POST' : 'PUT'), :style => 'display: none;', :id => 'edit_calendar_event_form', :class => (calendar_event.new_record? ? 'new_event' : '')} do |f| %>
|
||||
<table class="formtable full_calendar_event_table" style="width: 100%;">
|
||||
<% if can_do(calendar_event, @current_user, :update) %>
|
||||
<tr>
|
||||
<td><%= f.blabel :title, :en => "Title" %></td>
|
||||
<td><%= f.text_field :title, :size => 20 %></td>
|
||||
</tr><tr>
|
||||
<td style="vertical-align: top;"><%= before_label :date, "Date" %></td>
|
||||
<td>
|
||||
<input type="text" name="start_date" value="<%= date_string(calendar_event.start_at) %>" style="width: 120px;" class="date_field"/>
|
||||
</td>
|
||||
</tr><tr>
|
||||
<td style="vertical-align: top;"><%= before_label :from, "From" %></td>
|
||||
<td>
|
||||
<% ot(:timespan, "%{start_time} *to* %{end_time}", :start_time => capture { %>
|
||||
<div style="float: left;">
|
||||
<input type="text" name="start_time" value="<%= time_string(calendar_event.start_at) unless calendar_event.all_day %>" style="width: 60px;" class="time_field"/>
|
||||
</div>
|
||||
<% }, :end_time => capture { %>
|
||||
<div style="float: left;">
|
||||
<input type="text" name="end_time" value="<%= time_string(calendar_event.end_at) unless calendar_event.all_day %>" style="width: 60px;" class="time_field"/>
|
||||
</div>
|
||||
<% }, :wrapper => '<div style="float: left;"> \1 </div>') %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<tr>
|
||||
<td colspan="4">
|
||||
<div style="font-size: 0.8em; float: right;">
|
||||
<a href="#" class="switch_full_calendar_event_view"><%= t '#editor.switch_editor_html', "HTML Editor" %></a>
|
||||
<a href="#" class="switch_full_calendar_event_view" style="display:none;"><%= t '#editor.switch_editor_rich_text', "Rich Content Editor" %></a>
|
||||
</div>
|
||||
<div>
|
||||
<%= before_label :event_description, "Event Description" %>
|
||||
</div>
|
||||
<div><%= f.text_area :description, :style => 'width: 100%;' %></div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div>
|
||||
<table id="calendar_event_location_info">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="calendar_event_location_name"><%= t 'labels.location', "Location" %></label>
|
||||
<input id="calendar_event_location_name" name="location_name" size="30" maxlength="255" type="text" value="<%= calendar_event.location_name %>"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="calendar_event_location_address"><%= t 'labels.address', "Address" %>:</label>
|
||||
<input id="calendar_event_location_address" name="location_address" size="30" maxlength="255" type="text" value="<%= calendar_event.location_address %>"/>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="form-actions">
|
||||
<button type="button" class="btn cancel_button"><%= t '#buttons.cancel', "Cancel" %></button>
|
||||
<button type="submit" class="btn btn-primary submit_button"><%= calendar_event.new_record? ? t('buttons.create', "Create Event") : t('buttons.update', "Update Event") %></button>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
content_for :page_title, @event.title || t(:page_title, "New Calendar Event")
|
||||
return_to_url = return_to_calendar(:context => @context, :event => @event)
|
||||
|
||||
if @domain_root_account.enable_scheduler?
|
||||
event_attrs = {
|
||||
:id => @event.id,
|
||||
:context_code => @context.asset_string,
|
||||
|
@ -16,23 +15,4 @@
|
|||
js_bundle :edit_calendar_event
|
||||
jammit_css :tinymce, :edit_calendar_event_full
|
||||
content_for :right_side, render(:partial => 'shared/wiki_sidebar')
|
||||
else
|
||||
content_for :right_side do
|
||||
%>
|
||||
<div id="sidebar_content" class="rs-margin-all">
|
||||
<a class="btn button-sidebar-wide return_url calendar_url" href="<%= return_to_url %>"><%= image_tag "back.png" %> <%= t 'links.back_to_calendar', "Back to Calendar" %></a>
|
||||
<a class="base_calendar_url" href="<%= calendar_url_for(@context) %>" style="display: none;"> </a>
|
||||
<% if can_do(@event, @current_user, :update) %>
|
||||
<div style="margin-top: 10px;">
|
||||
<a href="#" class="btn button-sidebar-wide edit_calendar_event_link"><%= image_tag "edit.png" %> <%= t 'links.edit', "Edit Calendar Event"%></a><br/>
|
||||
<% unless @event.new_record? %>
|
||||
<a href="<%= context_url(@context, :context_calendar_event_url, @event.id) %>" class="btn button-sidebar-wide delete_event_link"><%= image_tag "delete.png" %> <%= t 'links.delete', "Delete the Event" %></a>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<%= render :partial => 'shared/wiki_sidebar' %>
|
||||
<% end %>
|
||||
|
||||
<%= render :partial => 'full_calendar_event', :object => @event %>
|
||||
<% end %>
|
|
@ -1,245 +0,0 @@
|
|||
<%
|
||||
js_env :CALENDAR => { :ACTIVE_EVENT => @active_event_id }
|
||||
js_bundle :calendar
|
||||
jammit_css :calendar
|
||||
@body_classes << "full-width"
|
||||
%>
|
||||
<% content_for :stylesheets do %>
|
||||
<style type="text/css">
|
||||
<% @contexts.each_with_index do |c, idx| %>
|
||||
.group_<%= "#{c.class.to_s.downcase}_#{c.id}" %> {
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
border-color: <%= dark_color_pastel_index(idx) %>;
|
||||
background-color: <%= light_color_pastel_index(idx) %> !important;
|
||||
}
|
||||
<% end %>
|
||||
</style>
|
||||
<% end %>
|
||||
<% content_for :right_side do %>
|
||||
<div class="calendar_links rs-margin-lr rs-margin-top">
|
||||
<div style="margin-bottom: 10px;">
|
||||
<a href="#" class="wizard_popup_link <%= 'auto_open' if params[:wizard] %> help"><%= t 'links.how_do_i', "How Do I...?" %></a>
|
||||
</div>
|
||||
|
||||
<%= render :partial => 'calendars/mini_calendar', :locals => {:current => current, :first_day => first_day } %>
|
||||
<hr />
|
||||
<div class="text-right" style="font-size: 0.8em;">
|
||||
<%= t :calendars_count, { :one => "1 calendar, %{open_count} open", :other => "%{count} calendars, %{open_count} open" },
|
||||
:count => @contexts.length, :open_count => '<span class="calendars_open_count"></span>'.html_safe %>
|
||||
</div>
|
||||
<div style="max-height: 215px; overflow: auto;">
|
||||
<% @contexts.each_with_index do |c, idx| %>
|
||||
<div>
|
||||
<div class="group_reference group_<%= "#{c.class.to_s.downcase}_#{c.id}" %> <%= 'default_context' if c == @context %>">
|
||||
<a href="<%= context_url(c, :new_context_calendar_event_url) %>" class="add_event_link btn btn-small" ><%= image_tag "add-small.png" %> <%= t 'links.add_event', "Add Event" %></a>
|
||||
|
||||
|
||||
<div style="position: absolute; top: 2px; left: 2px;">
|
||||
<input type="checkbox" class="group_reference_checkbox" id="group_<%= "#{c.class.to_s.downcase}_#{c.id}" %>" <%= 'readonly="true"' if @contexts.length > 1 %>/>
|
||||
<label for="group_<%= "#{c.class.to_s.downcase}_#{c.id}" %>"><%= c.name %></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<div style=" margin-bottom: 10px; font-size: 0.7em;">
|
||||
<div id="max_calendar_count" style="display: none;"><%= CalendarEvent.max_visible_calendars %></div>
|
||||
<% if @contexts.length > 10 %><%= t 'messages.max_visible', "You can show up to %{count} calendars at a time", :count => CalendarEvent.max_visible_calendars %><% end %>
|
||||
</div>
|
||||
|
||||
<div class="undated_link" style="margin: 0 0 10px 10px;">
|
||||
<a href="#" class="show_undated_link"><%= t 'links.show_undated_events', "show %{count} undated events", :count => '<span class=\'undated_count\'></span>'.html_safe %></a>
|
||||
</div>
|
||||
<div class="undated_content" style="display: none;">
|
||||
<b><%= before_label :undated_events, "Undated Events" %></b>
|
||||
<div class="calendar_undated">
|
||||
<div class="calendar_day calendar_day_undated">
|
||||
<%= render :partial => 'event', :collection => @undated_events %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="text-right" style="font-size: 0.8em;">
|
||||
<a href="#" class="add_event_link add-small"><%= t 'links.add_event', "Add Event" %></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<% if @context_enrollment %>
|
||||
<a class="calendar_feed_link small-calendar" href="<%= feeds_calendar_url(@context_enrollment.feed_code) %>.ics"> <%= t :feed_title, "Calendar Feed" %></a>
|
||||
<% elsif @context.available? %>
|
||||
<a class="calendar_feed_link small-calendar" href="<%= feeds_calendar_url(@context.feed_code) %>.ics"> <%= t :feed_title, "Calendar Feed" %></a>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<div style="display: none;" id="context_urls">
|
||||
<% @contexts.each do |context| %>
|
||||
<% cache([context, 'assignment_groups_for_cal']) do %>
|
||||
<a href="<%= context_url(context, :context_calendar_events_url) %>" class="<%= context.class.to_s.downcase %>_<%= context.id %>_add_event_url"> </a>
|
||||
<a href="<%= context_url(context, :context_calendar_event_url, "{{ id }}") %>" class="<%= context.class.to_s.downcase %>_<%= context.id %>_event_url"> </a>
|
||||
<% if context.respond_to?("assignments") %>
|
||||
<a href="<%= context_url(context, :context_assignments_url) %>" class="<%= context.class.to_s.downcase %>_<%= context.id %>_add_assignment_url"> </a>
|
||||
<a href="<%= context_url(context, :context_assignment_url, "{{ id }}") %>" class="<%= context.class.to_s.downcase %>_<%= context.id %>_assignment_url"> </a>
|
||||
<%= select :assignment, :assignment_group_id, (context.assignment_groups.active.select("id, name").map {|g| [g.name, g.id]} << [t('options.new_group', "[ New Group ]"), "new"]), {}, {:class => "assignment_group_id #{context.try_rescue(:weight_assignment_groups) ? 'weight' : ''}", :id => "#{ context.class.to_s.downcase }_#{ context.id }_assignment_groups"} %>
|
||||
<a href="<%= context_url(context, :context_assignment_groups_url) %>" class="<%= context.class.to_s.downcase %>_<%= context.id %>_add_assignment_group_url"> </a>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="calendar_container">
|
||||
<div class="hidden-readable">
|
||||
<a href="#calendar"><%= t 'links.jump_to_calendar', "Jump to Calendar" %></a>
|
||||
</div>
|
||||
<a name="calendar"></a>
|
||||
<table class="calendar_month">
|
||||
<tr>
|
||||
<td colspan="7" class="month_title">
|
||||
<span style="display: none;" class="month_number"><%= @current.month %></span>
|
||||
<a href="#" class="prev_month_link no-hover"><%= image_tag "arrow_left.png", :alt => t('alts.previous', "Previous") %></a>
|
||||
<span id="month_and_year">
|
||||
<span class="month_name"><%= I18n.t('date.month_names')[current.month] %></span>
|
||||
<span class="year_number"><%= @current.year %></span>
|
||||
</span>
|
||||
<a href="#" class="next_month_link no-hover"><%= image_tag "arrow_right.png", :alt => t('alts.next', "Next") %></a>
|
||||
<a href="#" class="refresh_calendar_link"><%= image_tag "ajax-reload.gif", :class => "static" %><%= image_tag "ajax-reload-animated.gif", :class => "animated", :style => "display: none;" %></a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="calendar-days">
|
||||
<% I18n.t('date.day_names').each do |d| %>
|
||||
<td><%= d %></td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<% day = first_day %>
|
||||
<% cache(['calendar_render', day.to_s].cache_key) do %>
|
||||
<% 6.times do %>
|
||||
<tr class="calendar_week visible">
|
||||
<% 7.times do %>
|
||||
<td id="day_<%= day.strftime("%Y_%m_%d") %>" tabindex="0" class="calendar_day_holder <%= day <= last_day ? 'visible' : '' %>"><div class="calendar_day <%= day.month == current.month ? 'current_month' : 'other_month' %>">
|
||||
<div class="day_number" title="<%= day.strftime("%m/%d/%Y") %>"><%= day.day %></div>
|
||||
</div></td>
|
||||
<% day = day.next %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</table>
|
||||
</div>
|
||||
<%= render :partial => 'event', :object => nil %>
|
||||
<table id="calendar_blank" style="display: none;">
|
||||
<tr class="calendar_week">
|
||||
<td class="calendar_day_holder"><div class="calendar_day">
|
||||
<div class="day_number" title=""></div>
|
||||
</div></td>
|
||||
</tr>
|
||||
</table>
|
||||
<div id="event_details" style="display: none;">
|
||||
<div class="content">
|
||||
<div class="details_time time_string"> </div>
|
||||
<div class="details_title title"> </div>
|
||||
<div class="details_description description user_content" style="min-height: 20px; max-height: 150px; overflow: auto;"></div>
|
||||
<div class="details_description lock_explanation"></div>
|
||||
<!--a href="#" class="assignment_link" style="display: none;">View Assignment Details</a-->
|
||||
<div class="links">
|
||||
<a href="/{{ context_type }}s/{{ context_id }}/assignments/{{ id }}" class="assignment_url" style="display: none;"> </a>
|
||||
<a href="/{{ context_type }}s/{{ context_id }}/calendar_events/{{ id }}" class="calendar_event_url" style="display: none;"> </a>
|
||||
<a href="<%= context_url(@context, :new_context_calendar_event_url) %>" class="new_calendar_event_url" style="display: none;"> </a>
|
||||
<a href="<%= context_url(@context, :new_context_assignment_url) rescue '#' %>" class="new_assignment_url" style="display: none;"> </a>
|
||||
<a href="#" class="view_event_link"><%= t 'links.full_details', "Full Details" %></a>
|
||||
<span class="edit_event"> | <a href="#" class="edit_event_link"><%= t 'links.edit', "Edit" %></a> | </span>
|
||||
<span class="delete_event"><a href="#" class="delete_event_link"><%= t 'links.delete', "Delete" %></a></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="edit_event" style="display: none;">
|
||||
<div class="content" id="edit_event_tabs">
|
||||
<ul>
|
||||
<li><a href="#edit_calendar_event_form" class="edit_calendar_event_option"><%= t 'tabs.event', "Event" %></a></li>
|
||||
<li><a href="#edit_assignment_form" class="edit_assignment_option"><%= t 'tabs.assignment', "Assignment" %></a></li>
|
||||
</ul>
|
||||
<%= form_for(:calendar_event, :url => context_url(@context, :context_calendar_events_url), :html => {:id => 'edit_calendar_event_form', :style => 'padding: 5px;'}) do |f| %>
|
||||
<table class="formtable" style="width: 100%;">
|
||||
<tr>
|
||||
<td style="vertical-align: top;"><%= before_label :title, "Title" %></td>
|
||||
<td>
|
||||
<%= f.text_field :title, :style => "width: 150px;" %>
|
||||
</td>
|
||||
</tr><tr>
|
||||
<td style="vertical-align: top;"><%= before_label :date, "Date" %></td>
|
||||
<td><input type="text" name="date" style="width: 100px;" class="date_field"/></td>
|
||||
</tr><tr style="display: none;">
|
||||
<td style="vertical-align: top;"><%= before_label :details, "Details" %></td>
|
||||
<td><!--textarea type="text" name="description" style="width: 150px; height: 40px;"></textarea--></td>
|
||||
</tr><tr>
|
||||
<td style="vertical-align: top;"><%= before_label :from, "From" %></td>
|
||||
<td>
|
||||
<% ot(:timespan, "%{start_time} *to* %{end_time}", :start_time => capture { %>
|
||||
<div style="float: left;"><input type="text" name="start_time" style="width: 60px;" class="time_field start_time"/></div>
|
||||
<% }, :wrapper => '<div style="float: left;"> \1 </div>', :end_time => capture { %>
|
||||
<div style="float: left;"><input type="text" name="end_time" style="width: 60px;" class="time_field end_time"/></div>
|
||||
<% }) %>
|
||||
<div class="clear"></div>
|
||||
</td>
|
||||
</tr><tr class="context_select" style="<%= hidden unless @contexts.length > 1 %>">
|
||||
<td><%= before_label :calendar, "Calendar" %></td>
|
||||
<td>
|
||||
<select class="context_id">
|
||||
<% @contexts.select{|c| c.respond_to?("calendar_events") && c.calendar_events.build.grants_right?(@current_user, session, :create)}.each do |context| %>
|
||||
<option value="<%= context.class.to_s.downcase %>_<%= context.id %>"><%= context.name %></option>
|
||||
<% end %>
|
||||
</select>
|
||||
</td>
|
||||
</tr><tr>
|
||||
<td colspan="2" class="text-right">
|
||||
<a href="#" class="btn btn-secondary more_options_link"><%= t 'links.more_options', "More Options" %></a>
|
||||
<button type="submit" class="btn btn-primary"><%= t '#buttons.submit', "Submit" %></button>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<% end %>
|
||||
<%= form_for(:assignment, :url => ".", :html => {:id => 'edit_assignment_form', :style => 'padding: 5px;'}) do |f| %>
|
||||
<table class="formtable" style="width: 100%;">
|
||||
<tr>
|
||||
<td><%= before_label :title, "Title" %></td>
|
||||
<td><%= f.text_field :title, :style => "width: 200px;" %></td>
|
||||
</tr><tr>
|
||||
<td><%= before_label :due, "Due" %></td>
|
||||
<td>
|
||||
<%= f.text_field :due_at, :style => "width: 150px;", :class => "datetime_field", :"aria-label" => t("Due on Date") %>
|
||||
</td>
|
||||
</tr><tr class="context_select" style="<%= hidden unless @contexts.length > 1 %>">
|
||||
<td><%= before_label :calendar, "Calendar" %></td>
|
||||
<td>
|
||||
<select class="context_id">
|
||||
<% @contexts.select{|c| c.respond_to?("assignments") && c.assignments.build.grants_right?(@current_user, session, :create)}.each do |context| %>
|
||||
<option value="<%= context.class.to_s.downcase %>_<%= context.id %>"><%= context.name %></option>
|
||||
<% end %>
|
||||
</select>
|
||||
</td>
|
||||
</tr><tr>
|
||||
<td><%= before_label :group, "Group" %></td>
|
||||
<td class="assignment_group_select">
|
||||
</td>
|
||||
</tr><tr>
|
||||
<td colspan="2" class="text-right">
|
||||
<a href="#" class="btn btn-secondary more_options_link"><%= t 'links.more_options', "More Options" %></a>
|
||||
<button type="submit" class="btn btn-primary"><%= t '#buttons.submit', "Submit" %></button>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<div style="position: absolute; left: -1000;" id="offside_box">
|
||||
</div>
|
||||
<%= render :partial => "shared/add_assignment_group" %>
|
||||
<div id="calendar_feed_box" style="display: none;">
|
||||
<div>
|
||||
<%= image_tag "ical_big.png", :style => "float: left; margin: 0px 3px;" %>
|
||||
<%= t 'instructions.ics_link', "Copy the link below and paste it into any calendar app that takes
|
||||
iCal feeds (Google Calendar, iCal, Outlook, etc.)" %>
|
||||
</div>
|
||||
<div style="text-align: center; margin: 10px 2px 5px;">
|
||||
<input type="text" style="width: 330px;" class="calendar_feed_url"/><br/>
|
||||
<a href="#" class="show_calendar_feed_link"><%= t 'links.feed', "click here to view the feed" %></a>
|
||||
</div>
|
||||
</div>
|
|
@ -1,76 +0,0 @@
|
|||
<% content_for :page_title do %><%= join_title t(:page_title, "Calendar"), @context.name %><% end %>
|
||||
<% add_crumb t('crumbs.my_calendar', "My Calendar"), calendar_url %>
|
||||
|
||||
<% content_for :auto_discovery do %>
|
||||
<% if @context_enrollment %>
|
||||
<%= auto_discovery_link_tag(:atom, feeds_calendar_format_url(@context_enrollment.feed_code, :atom), {:title => t(:feed_title, "Course Calendar Atom Feed")}) %>
|
||||
<% elsif @context.available? %>
|
||||
<%= auto_discovery_link_tag(:atom, feeds_calendar_format_url(@context.feed_code, :atom), {:title => t(:feed_title, "Course Calendar Atom Feed")}) %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<%= render :partial => "calendar", :object => @events, :locals => { :first_day => @first_day, :last_day => @last_day, :current => @current } %>
|
||||
|
||||
<% content_for :wizard_box do %>
|
||||
<%= render :partial => "calendars/wizard_box" %>
|
||||
<% end %>
|
||||
|
||||
<% content_for :keyboard_navigation do %>
|
||||
<ul class="navigation_list" tabindex="-1">
|
||||
<li>
|
||||
<span class="keycode"><%= t 'keycodes.next_event', 'j' %></span>
|
||||
<span class="colon">:</span>
|
||||
<span class="description"><%= t 'keycode_descriptions.next_event', "Next Calendar Day/Event" %></span>
|
||||
</li>
|
||||
<li>
|
||||
<span class="keycode"><%= t 'keycodes.previous_event', 'k' %></span>
|
||||
<span class="colon">:</span>
|
||||
<span class="description"><%= t 'keycode_descriptions.previous_event', "Previous Calendar Day/Event" %></span>
|
||||
</li>
|
||||
<li>
|
||||
<span class="keycode"><%= t 'keycodes.open', 'o' %></span>
|
||||
<span class="colon">:</span>
|
||||
<span class="description"><%= t 'keycode_descriptions.open', "Open Current Event" %></span>
|
||||
</li>
|
||||
<li>
|
||||
<span class="keycode"><%= t 'keycodes.edit', 'e' %></span>
|
||||
<span class="colon">:</span>
|
||||
<span class="description"><%= t 'keycode_descriptions.edit', "Edit Current Event" %></span>
|
||||
</li>
|
||||
<li>
|
||||
<span class="keycode"><%= t 'keycodes.delete', 'd' %></span>
|
||||
<span class="colon">:</span>
|
||||
<span class="description"><%= t 'keycode_descriptions.delete', "Delete Current Event" %></span>
|
||||
</li>
|
||||
<li>
|
||||
<span class="keycode"><%= t 'keycodes.new', 'n' %></span>
|
||||
<span class="colon">:</span>
|
||||
<span class="description"><%= t 'keycode_descriptoins.new', "New Event for Current Day" %></span>
|
||||
</li>
|
||||
<li>
|
||||
<span class="keycode"><%= t 'keycodes.refresh', 'r' %></span>
|
||||
<span class="colon">:</span>
|
||||
<span class="description"><%= t 'keycode_descriptions.refresh', "Refresh Calendar" %></span>
|
||||
</li>
|
||||
<li>
|
||||
<span class="keycode"><%= t 'keycodes.next_day', 'ctrl+right' %></span>
|
||||
<span class="colon">:</span>
|
||||
<span class="description"><%= t 'keycode_descriptions.next_day', "Next Calendar Day" %></span>
|
||||
</li>
|
||||
<li>
|
||||
<span class="keycode"><%= t 'keycodes.previous_day', 'ctrl+left' %></span>
|
||||
<span class="colon">:</span>
|
||||
<span class="description"><%= t 'keycode_descriptions.previous_day', "Previous Calendar Day" %></span>
|
||||
</li>
|
||||
<li>
|
||||
<span class="keycode"><%= t 'keycodes.next_week', 'ctrl+down' %></span>
|
||||
<span class="colon">:</span>
|
||||
<span class="description"><%= t 'keycode_descriptions.next_week', "Next Week" %></span>
|
||||
</li>
|
||||
<li>
|
||||
<span class="keycode"><%= t 'keycodes.previous_week', 'ctrl+up' %></span>
|
||||
<span class="colon">:</span>
|
||||
<span class="description"><%= t 'keycode_descriptions.previous_week', "Previous Week" %></span>
|
||||
</li>
|
||||
</ul>
|
||||
<% end %>
|
|
@ -6,7 +6,7 @@
|
|||
:SELECTED_CONTEXTS => @selected_contexts,
|
||||
:ACTIVE_EVENT => @active_event_id,
|
||||
:VIEW_START => @view_start,
|
||||
:CAL2_ONLY => @domain_root_account.calendar2_only?,
|
||||
:CAL2_ONLY => true,
|
||||
:SHOW_SCHEDULER => @domain_root_account.show_scheduler?
|
||||
}
|
||||
js_bundle :calendar2
|
||||
|
|
|
@ -209,7 +209,7 @@ CanvasRails::Application.routes.draw do
|
|||
get 'grading_rubrics' => 'gradebooks#grading_rubrics'
|
||||
get 'grades/:id' => 'gradebooks#grade_summary', as: :student_grades
|
||||
concerns :announcements
|
||||
get 'calendar' => 'calendars#show', as: :old_calendar
|
||||
get 'calendar' => 'calendars#show2', as: :old_calendar
|
||||
get :locks
|
||||
concerns :discussions
|
||||
resources :assignments do
|
||||
|
@ -460,7 +460,7 @@ CanvasRails::Application.routes.draw do
|
|||
concerns :media
|
||||
|
||||
resources :collaborations
|
||||
get 'calendar' => 'calendars#show', as: :old_calendar
|
||||
get 'calendar' => 'calendars#show2', as: :old_calendar
|
||||
end
|
||||
|
||||
resources :accounts do
|
||||
|
@ -683,10 +683,9 @@ CanvasRails::Application.routes.draw do
|
|||
|
||||
resources :plugins, only: [:index, :show, :update]
|
||||
|
||||
get 'calendar' => 'calendars#show'
|
||||
get 'calendar' => 'calendars#show2'
|
||||
get 'calendar2' => 'calendars#show2'
|
||||
get 'course_sections/:course_section_id/calendar_events/:id' => 'calendar_events#show', as: :course_section_calendar_event
|
||||
post 'switch_calendar/:preferred_calendar' => 'calendars#switch_calendar', as: :switch_calendar
|
||||
get 'files' => 'files#index'
|
||||
get "files/folder#{full_path_glob}", controller: 'files', action: 'react_files', format: false
|
||||
get "files/search", controller: 'files', action: 'react_files', format: false
|
||||
|
|
|
@ -1,193 +0,0 @@
|
|||
/**
|
||||
* Copyright (C) 2011 Instructure, Inc.
|
||||
*
|
||||
* This file is part of Canvas.
|
||||
*
|
||||
* Canvas is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License as published by the Free
|
||||
* Software Foundation, version 3 of the License.
|
||||
*
|
||||
* Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
* A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
define([
|
||||
'timezone',
|
||||
'i18n!calendar_events',
|
||||
'jquery' /* jQuery, $ */,
|
||||
'wikiSidebar',
|
||||
'jquery.instructure_date_and_time' /* dateString, timeString, date_field, time_field, /\$\.datetime/ */,
|
||||
'jquery.instructure_forms' /* formSubmit, fillFormData, formErrors */,
|
||||
'jquery.instructure_misc_helpers' /* encodeToHex, scrollSidebar */,
|
||||
'jquery.instructure_misc_plugins' /* confirmDelete, fragmentChange, showIf */,
|
||||
'jquery.loadingImg' /* loadingImg, loadingImage */,
|
||||
'jquery.templateData' /* fillTemplateData, getTemplateData */,
|
||||
'compiled/tinymce',
|
||||
'tinymce.editor_box' /* editorBox */,
|
||||
'vendor/date' /* Date.parse */
|
||||
], function(tz, I18n, $, wikiSidebar) {
|
||||
|
||||
var noContentText = I18n.t('no_content', "No Content");
|
||||
|
||||
$(function($) {
|
||||
var $full_calendar_event = $("#full_calendar_event"),
|
||||
$edit_calendar_event_form = $("#edit_calendar_event_form"),
|
||||
$full_calendar_event_holder = $("#full_calendar_event_holder");
|
||||
|
||||
|
||||
function hideEditCalendarEventForm(redirect) {
|
||||
$full_calendar_event.show();
|
||||
$edit_calendar_event_form.hide()
|
||||
.find("textarea").editorBox('destroy');
|
||||
if (wikiSidebar) {
|
||||
wikiSidebar.hide();
|
||||
$("#sidebar_content").show();
|
||||
}
|
||||
if (redirect && $edit_calendar_event_form.hasClass('new_event')) {
|
||||
window.location.href = $(".calendar_url").attr('href');
|
||||
}
|
||||
};
|
||||
function editCalendarEventForm() {
|
||||
$full_calendar_event.hide();
|
||||
var data = $full_calendar_event.getTemplateData({
|
||||
textValues: ['start_at_date_string', 'start_at_time_string', 'end_at_time_string', 'title', 'all_day', 'all_day_date']
|
||||
});
|
||||
if (data.description == noContentText) {
|
||||
data.description = "";
|
||||
}
|
||||
data.start_date = data.start_at_date_string;
|
||||
data.start_time = data.start_at_time_string;
|
||||
data.end_time = data.end_at_time_string;
|
||||
if (data.all_day == 'true') {
|
||||
if (data.all_day_date) {
|
||||
data.start_date = data.all_day_date;
|
||||
}
|
||||
data.start_time = '';
|
||||
data.end_time = '';
|
||||
}
|
||||
$edit_calendar_event_form
|
||||
.fillFormData(data, {object_name: 'calendar_event'})
|
||||
.show()
|
||||
.find("textarea").editorBox();
|
||||
if (wikiSidebar) {
|
||||
wikiSidebar.attachToEditor($edit_calendar_event_form.find("textarea:first"));
|
||||
wikiSidebar.show();
|
||||
$("#sidebar_content").hide();
|
||||
}
|
||||
};
|
||||
|
||||
if (wikiSidebar) {
|
||||
wikiSidebar.init();
|
||||
}
|
||||
$(".date_field").date_field();
|
||||
$(".time_field").time_field();
|
||||
$(".delete_event_link").click(function(event) {
|
||||
event.preventDefault();
|
||||
$("#full_calendar_event_holder").confirmDelete({
|
||||
message: "Are you sure you want to delete this event?",
|
||||
url: $(this).attr('href'),
|
||||
success: function() {
|
||||
$(this).fadeOut('slow');
|
||||
window.location.href = $(".calendar_url").attr('href');
|
||||
}
|
||||
});
|
||||
});
|
||||
$(".switch_full_calendar_event_view").click(function() {
|
||||
$("#calendar_event_description").editorBox('toggle');
|
||||
// todo: replace .andSelf with .addBack when JQuery is upgraded.
|
||||
$(this).siblings(".switch_full_calendar_event_view").andSelf().toggle();
|
||||
return false;
|
||||
});
|
||||
$(".edit_calendar_event_link").click(function() {
|
||||
editCalendarEventForm();
|
||||
return false;
|
||||
});
|
||||
$edit_calendar_event_form.find(".cancel_button").click(function() {
|
||||
hideEditCalendarEventForm(true);
|
||||
return false;
|
||||
});
|
||||
$edit_calendar_event_form.formSubmit({
|
||||
object_name: 'calendar_event',
|
||||
processData: function(data) {
|
||||
data['calendar_event[start_at]'] = $.datetime.process(data.start_date + " " + data.start_time);
|
||||
data['calendar_event[end_at]'] = $.datetime.process(data.start_date + " " + data.end_time);
|
||||
data['calendar_event[description]'] = $(this).find("textarea").editorBox('get_code');
|
||||
$full_calendar_event_holder.fillTemplateData({
|
||||
data: data,
|
||||
except: ['description']
|
||||
});
|
||||
return data;
|
||||
},
|
||||
beforeSubmit: function(data) {
|
||||
hideEditCalendarEventForm();
|
||||
$full_calendar_event_holder.loadingImage();
|
||||
},
|
||||
success: function(data) {
|
||||
var calendar_event = data.calendar_event,
|
||||
start_at = tz.parse(calendar_event.start_at);
|
||||
|
||||
|
||||
calendar_event.start_at_date_string = $.dateString(start_at);
|
||||
calendar_event.start_at_time_string = $.timeString(start_at);
|
||||
calendar_event.end_at_time_string = $.timeString(calendar_event.end_at);
|
||||
calendar_event.all_day_date = $.dateString(calendar_event.all_day_date);
|
||||
|
||||
$full_calendar_event_holder.find(".from_string,.to_string,.end_at_time_string").showIf(calendar_event.end_at && calendar_event.end_at != calendar_event.start_at);
|
||||
$full_calendar_event_holder.find(".at_string").showIf(!calendar_event.end_at || calendar_event.end_at == calendar_event.start_at);
|
||||
$full_calendar_event_holder.find(".not_all_day").showIf(!calendar_event.all_day);
|
||||
$full_calendar_event_holder
|
||||
.loadingImage('remove')
|
||||
.fillTemplateData({
|
||||
data: calendar_event,
|
||||
htmlValues: ['description']
|
||||
});
|
||||
$(this).find("textarea").editorBox('set_code', calendar_event.description);
|
||||
var month = null, year = null;
|
||||
if (calendar_event.start_at) {
|
||||
year = calendar_event.start_at.substring(0, 4);
|
||||
month = calendar_event.start_at.substring(5, 7);
|
||||
}
|
||||
var calendar_url = $(".base_calendar_url").attr('href'),
|
||||
split = calendar_url.split(/#/),
|
||||
anchor = split[1],
|
||||
base_url = split[0],
|
||||
json = {};
|
||||
|
||||
try{
|
||||
json = $.parseJSON(anchor) || {};
|
||||
} catch(e) {
|
||||
json = {};
|
||||
}
|
||||
if (month && year) {
|
||||
json.month = month;
|
||||
json.year = year;
|
||||
}
|
||||
$(".calendar_url").attr('href', base_url + "#" + $.encodeToHex(JSON.stringify(json)));
|
||||
|
||||
window.location.href = $(".calendar_url").attr('href');
|
||||
},
|
||||
error: function(data) {
|
||||
$full_calendar_event_holder.loadingImage('remove');
|
||||
$(".edit_calendar_event_link:first").click();
|
||||
$edit_calendar_event_form.formErrors(data);
|
||||
}
|
||||
});
|
||||
setTimeout(function() {
|
||||
if ($full_calendar_event_holder.hasClass('editing')) {
|
||||
$(".edit_calendar_event_link:first").click();
|
||||
}
|
||||
}, 500);
|
||||
$(document).fragmentChange(function(event, hash) {
|
||||
if (hash == "#edit") {
|
||||
$(".edit_calendar_event_link:first").click();
|
||||
}
|
||||
});
|
||||
$.scrollSidebar();
|
||||
|
||||
});
|
||||
});
|
|
@ -62,41 +62,6 @@ describe CalendarsController do
|
|||
end
|
||||
end
|
||||
|
||||
describe "POST 'switch_calendar'" do
|
||||
it "should not switch to the old calendar anymore" do
|
||||
expect(@user.preferences[:use_calendar1]).to be_nil
|
||||
|
||||
post 'switch_calendar', {:preferred_calendar => '1'}
|
||||
expect(response).to redirect_to(calendar2_url(anchor: ' '))
|
||||
expect(@user.reload.preferences[:use_calendar1]).to be_truthy
|
||||
end
|
||||
|
||||
it "should not switch to the old calendar if not allowed" do
|
||||
expect(@user.preferences[:use_calendar1]).to be_nil
|
||||
post 'switch_calendar', {:preferred_calendar => '1'}
|
||||
expect(response).to redirect_to(calendar2_url(anchor: ' '))
|
||||
|
||||
# not messing with their preference in case they prefer cal1 in a
|
||||
# different account
|
||||
expect(@user.reload.preferences[:use_calendar1]).to be_truthy
|
||||
end
|
||||
|
||||
it "should redirect to new calendar regardless of old preference settings" do
|
||||
expect(@user.preferences[:use_calendar1]).to be_nil
|
||||
|
||||
post 'switch_calendar', {:preferred_calendar => '2'}
|
||||
expect(response).to redirect_to(calendar2_url(anchor: ' '))
|
||||
expect(@user.reload.preferences[:use_calendar1]).to be_nil
|
||||
end
|
||||
|
||||
it "should switch to the new calendar if allowed" do
|
||||
@user.update_attribute(:preferences, {:use_calendar1 => true})
|
||||
|
||||
post 'switch_calendar', {:preferred_calendar => '2'}
|
||||
expect(response).to redirect_to(calendar2_url(anchor: ' '))
|
||||
expect(@user.reload.preferences[:use_calendar1]).to be_nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe CalendarEventsApiController do
|
||||
|
|
|
@ -1,37 +0,0 @@
|
|||
#
|
||||
# Copyright (C) 2011 Instructure, Inc.
|
||||
#
|
||||
# This file is part of Canvas.
|
||||
#
|
||||
# Canvas is free software: you can redistribute it and/or modify it under
|
||||
# the terms of the GNU Affero General Public License as published by the Free
|
||||
# Software Foundation, version 3 of the License.
|
||||
#
|
||||
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
# details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License along
|
||||
# with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
||||
require File.expand_path(File.dirname(__FILE__) + '/../views_helper')
|
||||
|
||||
describe "/calendars/_calendar" do
|
||||
it "should render" do
|
||||
today = Time.zone.today
|
||||
course_with_student
|
||||
view_context(@course, @user)
|
||||
assigns[:contexts] = [@course]
|
||||
assigns[:first_day] = today
|
||||
assigns[:last_day] = today + 30
|
||||
assigns[:current] = today + 2
|
||||
assigns[:events] = [@course.calendar_events.create!(:title => "some event", :start_at => Time.now)]
|
||||
assigns[:assignment_groups_for] = {}
|
||||
assigns[:body_classes] = []
|
||||
render :partial => 'calendars/calendar', :object => assigns[:events], :locals => {:current => today, :first_day => today - 3, :last_day => today + 30, :request => OpenObject.new(:path_parameters => {:controller => 'calendars', :action => 'show'}, :query_parameters => {})}
|
||||
end
|
||||
end
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
#
|
||||
# Copyright (C) 2011 Instructure, Inc.
|
||||
#
|
||||
# This file is part of Canvas.
|
||||
#
|
||||
# Canvas is free software: you can redistribute it and/or modify it under
|
||||
# the terms of the GNU Affero General Public License as published by the Free
|
||||
# Software Foundation, version 3 of the License.
|
||||
#
|
||||
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
# details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License along
|
||||
# with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
||||
require File.expand_path(File.dirname(__FILE__) + '/../views_helper')
|
||||
|
||||
describe "/calendars/show" do
|
||||
it "should render" do
|
||||
today = Time.zone.today
|
||||
course_with_student
|
||||
view_context(@course, @user)
|
||||
assigns[:events] = []
|
||||
assigns[:events] << @course.calendar_events.create!(:title => "some event", :start_at => Time.now, :end_at => Time.now)
|
||||
assigns[:events] << @course.assignments.create!(:title => "some assignment", :due_at => Time.now + 1000)
|
||||
assigns[:contexts] = [@course]
|
||||
assigns[:first_day] = today
|
||||
assigns[:last_day] = today + 30
|
||||
assigns[:current] = today + 2
|
||||
assigns[:assignment_groups_for] = {}
|
||||
assigns[:body_classes] = []
|
||||
render 'calendars/show'
|
||||
expect(response).not_to be_nil
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue