remove non-draft-state everything

test plan:
* basic regression test on assignments, discussion topics
 gradebook, and modules (mostly make sure the basic
 index/show/edit views aren't broken)

closes #CNVS-15563

Change-Id: I3411bfb7645b3c4bf8a4663e3e052b4402f899ba
Reviewed-on: https://gerrit.instructure.com/43609
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
This commit is contained in:
James Williams 2014-10-30 06:49:55 -06:00
parent d378436b59
commit 2c69f3966b
287 changed files with 309 additions and 2853 deletions

View File

@ -23,14 +23,13 @@ require [
.render()
new PublishButtonView(model: model, el: $el).render()
if ENV.DRAFT_STATE
# Add module sequence footer
$('#sequence_footer').moduleSequenceFooter(
courseID: ENV.COURSE_ID
assetType: 'Assignment'
assetID: ENV.ASSIGNMENT_ID
location: location
)
# Add module sequence footer
$('#sequence_footer').moduleSequenceFooter(
courseID: ENV.COURSE_ID
assetType: 'Assignment'
assetID: ENV.ASSIGNMENT_ID
location: location
)
vddTooltip()

View File

@ -1,71 +0,0 @@
require [
"i18n!assignments.assignments_list_content",
"jquery",
"jquery.instructure_misc_plugins",
"jquery.templateData",
"vendor/date"
], (I18n, $) ->
window.managedAssignments = null
$(document).ready ->
if managedAssignments
for idx of managedAssignments
assignment = managedAssignments[idx].assignment
$assignment = $(".assignment_" + assignment.id)
$assignment.fillTemplateData data:
submitted_count: assignment.submitted_count or "0"
graded_count: assignment.graded_count or "0"
if assignment.submitted_count or assignment.graded_count
$assignment.find(".submitted").showIf !!assignment.submitted_count and not assignment.graded_count
$assignment.find(".graded").showIf !!assignment.graded_count and not assignment.submitted_count
$assignment.find(".submitted_and_graded").showIf assignment.submitted_count and assignment.graded_count
$assignment.find(".submitted_details").showIf !!(assignment.submitted_count or assignment.graded_count)
if ENV.submissions_hash
for idx of ENV.submissions_hash
submission = ENV.submissions_hash[idx].submission
$assignment = $(".assignment_" + idx)
if submission and (submission.score or submission.score is 0)
$assignment.addClass "group_assignment_graded"
$assignment.find(".grade").show()
else
$assignment.removeClass "group_assignment_graded"
$assignment.find(".grade").hide()
if submission and submission.submission_type and not submission.score
$assignment.addClass "group_assignment_ungraded"
cnt = parseInt($assignment.find(".needs_grading_count").text(), 10) or 0
cnt++
$assignment.find(".needs_grading_count").text cnt
$assignment.fillTemplateData
data: submission
hrefValues: ["assignment_id", "user_id"]
$assignment.find(".submission_comment_link").showIf submission and submission.submission_comments_count
$assignment.find(".rubric_assessment_link").showIf submission and submission.has_rubric_assessment
data = $assignment.filter(":first").getTemplateData(textValues: ["due_date_string", "due_time_string"])
due = Date.parse(data.due_date_string + " " + data.due_time_string)
now = new Date()
$assignment.addClass "group_assignment_submitted" if submission and submission.submitted_at
$assignment.addClass "group_assignment_overdue" if due and (not submission or not submission.submitted_at) and due < now
#.find(".more_info_link").show().end()
$("#groups_for_student .assignment_group").find(".more_info").hide().end().find(".more_info_brief").showIf($("#group_weighting_scheme").text() is "percent").append " of final grade"
$(".show_groups_link,.hide_groups_link").click (event) ->
event.preventDefault()
if $(this).hasClass("show_groups_link") and not $("#groups_for_student").hasClass("populated")
$("#assignments_for_student .group_assignment").each ->
$assignment = $(this).clone(true)
group_id = $assignment.find(".assignment_group_id").text()
$group = $("#groups_for_student .group_" + group_id)
$group.find(".assignment_list").append $assignment
$("#groups_for_student").addClass "populated"
$("#groups_for_student").showIf $(this).hasClass("show_groups_link")
$("#assignments_for_student").showIf $(this).hasClass("hide_groups_link")
$(".show_groups_link").showIf $(this).hasClass("hide_groups_link")
$(".hide_groups_link").showIf $(this).hasClass("show_groups_link")
$(".group_assignment").hover (->
if $(this).hasClass("group_assignment_overdue")
$(this).attr "title", I18n.t("assignments.overdue", "This assignment is overdue")
else if $(this).hasClass("group_assignment_ungraded")
needs_grading_count = $(this).getTemplateData(textValues: ["needs_grading_count"]).needs_grading_count
$(this).attr "title", I18n.t("assignments.needs_grading_count", "%{needs_grading_count} submissions for this assignment still need grading", { needs_grading_count: needs_grading_count })
else $(this).attr "title", I18n.t("assignments.graded", "This assignment has been graded") if $(this).hasClass("group_assignment_graded")
), ->
$(this).attr "title", ""

View File

@ -1,83 +0,0 @@
require [
"i18n!assignments.peer_reviews",
"jquery",
"jquery.ajaxJSON",
"jquery.instructure_date_and_time", # $.datetimeString
"jquery.instructure_forms",
"jquery.instructure_misc_helpers",
"jquery.instructure_misc_plugins",
"jquery.loadingImg",
"jquery.templateData"
], (I18n, $) ->
$(document).ready ->
$(".peer_review").hover (->
$(".peer_review.submission-hover").removeClass "submission-hover"
$(this).addClass "submission-hover"
), ->
$(this).removeClass "submission-hover"
# $(document).mouseover(function(event) {
# if(!$(event.target).hasClass('peer_review')) {
# $(".peer_review.submission-hover").removeClass('submission-hover');
# }
# });
$(".peer_review .delete_review_link").click (event) ->
event.preventDefault()
$(this).parents(".peer_review").confirmDelete
url: $(this).attr("href")
message: I18n.t("messages.cancel_peer_review", "Cancel this peer review?")
$(".assign_peer_review_link").click (event) ->
event.preventDefault()
#if the form is there and is being shown, then slide it up.
if $(this).parents(".student_reviews").find(".form_content form:visible").length
$(this).parents(".student_reviews").find(".form_content form:visible").slideUp()
else #otherwise make it and inject it then slide it down
$form = $("#assign_peer_review_form").clone(true).removeAttr("id")
url = $(".assign_peer_review_url").attr("href")
user_id = $(this).parents(".student_reviews").getTemplateData(textValues: ["student_review_id"]).student_review_id
url = $.replaceTags(url, "reviewer_id", user_id)
$form.find("select option.student_" + user_id).attr "disabled", true
$(this).parents(".student_reviews").find(".peer_review").each ->
user_id = $(this).getTemplateData(textValues: ["user_id"]).user_id
$form.find("select option.student_" + user_id).attr "disabled", true
$form.attr "action", url
$(this).parents(".student_reviews").find(".form_content").empty().append $form
$form.slideDown()
$("#assign_peer_review_form").formSubmit
beforeSubmit: (data) ->
return false unless data.reviewee_id
$(this).loadingImage()
success: (data) ->
$(this).loadingImage "remove"
$(this).slideUp ->
$(this).remove()
$review = $("#review_request_blank").clone(true).removeAttr("id")
$review.fillTemplateData
data: data.assessment_request
hrefValues: ["id", "user_id"]
$(this).parents(".student_reviews").find(".no_requests_message").slideUp().end().find(".peer_reviews").append $review
$review.slideDown()
assessor_name = $(this).parents(".student_reviews").find(".assessor_name").text()
time = $.datetimeString(data.assessment_request.updated_at)
$review.find(".reminder_peer_review_link").attr "title", I18n.t("titles.reminder", "Remind %{assessor} about Assessment, last notified %{time}", { assessor: assessor_name, time: time })
$(this).slideUp ->
$(this).remove()
error: (data) ->
$(this).loadingImage "remove"
$(this).formErrors data
$(".remind_peer_review_link").click (event) ->
event.preventDefault()
$link = $(this)
$link.parents(".peer_review").loadingImage image_size: "small"
$.ajaxJSON $link.attr("href"), "POST", {}, (data) ->
$link.parents(".peer_review").loadingImage "remove"
assessor_name = $link.parents(".student_reviews").find(".assessor_name").text()
time = $.datetimeString(data.assessment_request.updated_at)
$link.attr "title", I18n.t("titles.remind", "Remind %{assessor} about Assessment, last notified %{time}", { assessor: assessor_name, time: time })
$(".remind_peer_reviews_link").click (event) ->
event.preventDefault()
$(".peer_review.assigned .remind_peer_review_link").click()

View File

@ -1,59 +0,0 @@
require [
"jquery",
'compiled/userSettings',
"jquery.instructure_misc_plugins",
"vendor/jquery.scrollTo"
], ($, userSettings) ->
$(document).ready ->
$(document).bind("add_assignment", ->
$("#wizard_box .edit_assignment_option").click() if $("#wizard_box .option.create_assignment_option.selected").length > 0
).bind "assignment_update", ->
$("#wizard_box .review_assignment_option").click() if $("#wizard_box .option.edit_assignment_option.selected").length > 0
closeWizard = ->
pathname = window.location.pathname
userSettings.set('hide_wizard_' + pathname, true)
$("#wizard_box").slideUp('fast')
$(".wizard_popup_link").slideDown('fast')
$("#wizard_spacer_box").height($("#wizard_box").height() || 0)
screenreaderFocus = (elem) ->
$("html,body").scrollTo elem
closeWizard()
elem.focus()
$(".highlight_add_assignment_icon").hover (->
$link = $(".assignment_group:visible:first").find(".add_assignment_link")
$(".no_groups_message").show() if $link.length is 0
$("html,body").scrollTo $link
$link.indicate()
), ->
$(".no_groups_message").hide()
$(".highlight_add_assignment_group_icon").hover (->
$link = $(".add_group_link:visible:first")
$("html,body").scrollTo $link
$link.indicate()
), ->
$(".highlight_weight_groups").hover (->
$item = $("#class_weighting_box")
$("html,body").scrollTo $item
$item.indicate()
), ->
$(".show_me_add_assignment_group").click (e) ->
e.preventDefault()
screenreaderFocus $(".add_group_link:visible:first")
$(".show_me_weight_final_grade").click (e) ->
e.preventDefault()
screenreaderFocus $("#class_weighting_policy")
$(".show_me_add_assignment").click (e) ->
e.preventDefault()
$link = $(".assignment_group:visible:first").find(".add_assignment_link")
if $link.length is 0
$(".no_groups_message").show()
else
screenreaderFocus $link

View File

@ -61,23 +61,5 @@ require [
$("#wizard_box").slideDown "slow", ->
$(this).find(".option.publish_step").click()
unless ENV.DRAFT_STATE
$("#edit_course_home_content_select").change(->
$(this).parents("form").find(".options_details").hide().end().find("." + $(this).val() + "_details").show().end().find(".select_details").show()
).triggerHandler "change"
$(".edit_course_home_content_link").click (event) ->
event.preventDefault()
$("#edit_course_home_content").show()
$("#course_home_content").hide()
$("#edit_course_home_content .cancel_button").click ->
$("#edit_course_home_content").hide()
$("#course_home_content").show()
$("[aria-controls=edit_course_home_content_form]").click ->
setTimeout (->
$("#edit_course_home_content_select").focus()
), 0

View File

@ -1,2 +0,0 @@
require ['wiki']

View File

@ -86,9 +86,6 @@ define [
ENV.GRADEBOOK_OPTIONS.show_total_grade_as_points
).property()
isDraftState: ->
ENV.GRADEBOOK_OPTIONS.draft_state_enabled
publishToSisEnabled: (->
ENV.GRADEBOOK_OPTIONS.publish_to_sis_enabled
).property()
@ -507,7 +504,7 @@ define [
return if assignmentsProxy.findBy('id', as.id)
@processAssignment(as, assignmentGroups)
shouldRemoveAssignment = (@isDraftState() and as.published is false) or
shouldRemoveAssignment = (as.published is false) or
as.submission_types.contains 'not_graded' or
as.submission_types.contains 'attendance' and !@get('showAttendance')
if shouldRemoveAssignment

View File

@ -19,7 +19,6 @@ define [
fixtures.create()
setup = (isDraftState=false, sortOrder='assignment_group') ->
window.ENV.GRADEBOOK_OPTIONS.draft_state_enabled = isDraftState
originalWeightingScheme = window.ENV.GRADEBOOK_OPTIONS.group_weighting_scheme
@contextGetStub = sinon.stub(userSettings, 'contextGet')
@contextSetStub = sinon.stub(userSettings, 'contextSet')
@ -38,7 +37,6 @@ define [
})
teardown = ->
window.ENV.GRADEBOOK_OPTIONS.draft_state_enabled = false
window.ENV.GRADEBOOK_OPTIONS.group_weighting_scheme = originalWeightingScheme
@contextGetStub.restore()
@contextSetStub.restore()

View File

@ -203,8 +203,7 @@ define [
for group in assignmentGroups
# note that assignmentGroups are not yet htmlEscaped like assignments and sections
@assignmentGroups[group.id] = group
if ENV.GRADEBOOK_OPTIONS.draft_state_enabled
group.assignments = _.select group.assignments, (a) -> a.published
group.assignments = _.select group.assignments, (a) -> a.published
for assignment in group.assignments
htmlEscape(assignment)
assignment.assignment_group = group

View File

@ -75,7 +75,6 @@ htmlEscape, DiscussionTopic, Announcement, Assignment, $, preventDefault, Missin
canModerate: @permissions.CAN_MODERATE
isLargeRoster: ENV?.IS_LARGE_ROSTER || false
threaded: data.discussion_type is "threaded"
draftStateEnabled: ENV.DRAFT_STATE && ENV.DISCUSSION_TOPIC.PERMISSIONS.CAN_MODERATE
differentiatedAssignmentsEnabled: @model.differentiatedAssignmentsEnabled()
json.assignment = json.assignment.toView()
json

View File

@ -599,7 +599,7 @@ class ApplicationController < ActionController::Base
fake.workflow_state = 'unpublished'
assignment_scope = :active_assignments
if @context.feature_enabled?(:draft_state) && !fake.grants_right?(@current_user, session, :read)
if !fake.grants_right?(@current_user, session, :read)
# user should not see unpublished assignments
assignment_scope = :published_assignments
end

View File

@ -521,7 +521,7 @@ class AssignmentsApiController < ApplicationController
fake = @context.assignments.scoped.new
fake.workflow_state = 'unpublished'
if @context.feature_enabled?(:draft_state) && !fake.grants_right?(@current_user, session, :read)
unless fake.grants_right?(@current_user, session, :read)
# user should not see unpublished assignments
scope = scope.published
end
@ -760,7 +760,7 @@ class AssignmentsApiController < ApplicationController
# @returns Assignment
def create
@assignment = @context.assignments.build
@assignment.workflow_state = 'unpublished' if @context.feature_enabled?(:draft_state)
@assignment.workflow_state = 'unpublished'
if authorized_action(@assignment, @current_user, :create)
save_and_render_response
end

View File

@ -32,7 +32,7 @@ class AssignmentsController < ApplicationController
before_filter :normalize_title_param, :only => [:new, :edit]
def index
return old_index if @context == @current_user || !@context.feature_enabled?(:draft_state)
return redirect_to(dashboard_url) if @context == @current_user
if authorized_action(@context, @current_user, :read)
return unless tab_enabled?(@context.class::TAB_ASSIGNMENTS)
@ -72,39 +72,6 @@ class AssignmentsController < ApplicationController
end
end
def old_index
return redirect_to(dashboard_url) if @context == @current_user
if authorized_action(@context, @current_user, :read)
get_all_pertinent_contexts # NOTE: this crap is crazy. can we get rid of it?
get_sorted_assignments
add_crumb(t('#crumbs.assignments', "Assignments"), (@just_viewing_one_course ? named_context_url(@context, :context_assignments_url) : "/assignments" ))
@context = (@just_viewing_one_course ? @context : @current_user)
return if @just_viewing_one_course && !tab_enabled?(@context.class::TAB_ASSIGNMENTS)
respond_to do |format|
if @contexts.empty?
if @context
format.html { redirect_to @context == @current_user ? dashboard_url : named_context_url(@context, :context_url) }
else
format.html { redirect_to root_url }
end
elsif @just_viewing_one_course && @context.assignments.scoped.new.grants_right?(@current_user, session, :update)
format.html {
render :action => :index
}
else
@current_user_submissions ||= @current_user && @current_user.submissions.
select([:id, :assignment_id, :score, :workflow_state]).
where(:assignment_id => @upcoming_assignments)
js_env(:submissions_hash => @submissions_hash)
format.html { render :action => :student_index }
end
# TODO: eager load the rubric associations
format.json { render :json => @assignments.map{ |a| a.as_json(include: [:rubric_association, :rubric]) } }
end
end
end
def show
@assignment ||= @context.assignments.find(params[:id])
if @assignment.deleted?
@ -137,7 +104,6 @@ class AssignmentsController < ApplicationController
js_env({
:ROOT_OUTCOME_GROUP => outcome_group_json(@context.root_outcome_group, @current_user, session),
:DRAFT_STATE => @context.feature_enabled?(:draft_state),
:COURSE_ID => @context.id,
:ASSIGNMENT_ID => @assignment.id,
:EXTERNAL_TOOLS => external_tools_json(@external_tools, @context, @current_user, session)
@ -349,7 +315,7 @@ class AssignmentsController < ApplicationController
params[:assignment][:time_zone_edited] = Time.zone.name if params[:assignment]
group = get_assignment_group(params[:assignment])
@assignment ||= @context.assignments.build(params[:assignment])
@assignment.workflow_state ||= @context.feature_enabled?(:draft_state) ? "unpublished" : "published"
@assignment.workflow_state ||= "unpublished"
@assignment.post_to_sis ||= @context.feature_enabled?(:post_to_sis) ? true : false
@assignment.updating_user = @current_user
@assignment.content_being_saved_by(@current_user)
@ -372,7 +338,7 @@ class AssignmentsController < ApplicationController
def new
@assignment ||= @context.assignments.scoped.new
@assignment.workflow_state = 'unpublished' if @context.feature_enabled?(:draft_state)
@assignment.workflow_state = 'unpublished'
add_crumb t :create_new_crumb, "Create new"
if params[:submission_types] == 'online_quiz'

View File

@ -355,10 +355,8 @@ class ContextModuleItemsApiController < ApplicationController
item_params[:url] = params[:module_item][:external_url]
if (@tag = @module.add_item(item_params)) && set_position && set_completion_requirement
if @context.feature_enabled?(:draft_state)
@tag.workflow_state = 'unpublished'
@tag.save
end
@tag.workflow_state = 'unpublished'
@tag.save
@module.touch
render :json => module_item_json(@tag, @current_user, session, @module, nil)
elsif @tag

View File

@ -526,11 +526,7 @@ class ContextModulesApiController < ApplicationController
if ids = params[:module][:prerequisite_module_ids]
@module.prerequisites = ids.map{|id| "module_#{id}"}.join(',')
end
if @context.feature_enabled?(:draft_state)
@module.workflow_state = 'unpublished'
else
@module.workflow_state = 'active'
end
@module.workflow_state = 'unpublished'
if @module.save && set_position
render :json => module_json(@module, @current_user, session, nil)

View File

@ -101,11 +101,7 @@ class ContextModulesController < ApplicationController
def create
if authorized_action(@context.context_modules.scoped.new, @current_user, :create)
@module = @context.context_modules.build
if @context.feature_enabled?(:draft_state)
@module.workflow_state = 'unpublished'
else
@module.workflow_state = 'active'
end
@module.workflow_state = 'unpublished'
@module.attributes = params[:context_module]
respond_to do |format|
if @module.save
@ -396,8 +392,6 @@ class ContextModulesController < ApplicationController
@progressions = []
end
render :json => @progressions
elsif !@context.feature_enabled?(:draft_state)
redirect_to named_context_url(@context, :context_context_modules_url, :anchor => "student_progressions")
elsif !@context.grants_right?(@current_user, session, :view_all_grades)
@restrict_student_list = true
student_ids = @context.observer_enrollments.for_user(@current_user).map(&:associated_user_id)

View File

@ -1346,7 +1346,6 @@ class CoursesController < ApplicationController
@context = api_find(Course.active, params[:id])
assign_localizer
js_env :DRAFT_STATE => @context.feature_enabled?(:draft_state)
if request.xhr?
if authorized_action(@context, @current_user, [:read, :read_as_admin])
render :json => @context
@ -1397,11 +1396,9 @@ class CoursesController < ApplicationController
when "wiki"
@wiki = @context.wiki
@page = @wiki.front_page
if @context.feature_enabled?(:draft_state)
set_js_rights [:wiki, :page]
set_js_wiki_data :course_home => true
@padless = true
end
set_js_rights [:wiki, :page]
set_js_wiki_data :course_home => true
@padless = true
when 'assignments'
add_crumb(t('#crumbs.assignments', "Assignments"))
set_urls_and_permissions_for_assignment_index

View File

@ -309,14 +309,13 @@ class DiscussionTopicsController < ApplicationController
moderate: user_can_moderate,
change_settings: user_can_edit_course_settings?,
manage_content: @context.grants_right?(@current_user, session, :manage_content),
publish: user_can_moderate && @context.feature_enabled?(:draft_state)
publish: user_can_moderate
},
:discussion_topic_menu_tools => external_tools_display_hashes(:discussion_topic_menu)
}
append_sis_data(hash)
js_env(hash.merge(
DRAFT_STATE: @context.feature_enabled?(:draft_state),
POST_GRADES: @context.feature_enabled?(:post_grades)
))
if user_can_edit_course_settings?
@ -385,7 +384,6 @@ class DiscussionTopicsController < ApplicationController
map { |category| { id: category.id, name: category.name } },
CONTEXT_ID: @context.id,
CONTEXT_ACTION_SOURCE: :discussion_topic,
DRAFT_STATE: @topic.draft_state_enabled?,
POST_GRADES: @context.feature_enabled?(:post_grades),
DIFFERENTIATED_ASSIGNMENTS_ENABLED: @context.feature_enabled?(:differentiated_assignments)}
append_sis_data(js_hash)
@ -855,7 +853,7 @@ class DiscussionTopicsController < ApplicationController
@errors[:published] = t(:error_draft_state_unauthorized, "You do not have permission to set this topic to draft state.")
end
end
elsif @topic.new_record? && !@topic.is_announcement && @topic.draft_state_enabled? && user_can_moderate
elsif @topic.new_record? && !@topic.is_announcement && user_can_moderate
@topic.unpublish
end
end

View File

@ -205,7 +205,6 @@ class GradebooksController < ApplicationController
:publish_to_sis_enabled => @context.allows_grade_publishing_by(@current_user) && @gradebook_is_editable,
:publish_to_sis_url => context_url(@context, :context_details_url, :anchor => 'tab-grade-publishing'),
:speed_grader_enabled => @context.allows_speed_grader?,
:draft_state_enabled => @context.feature_enabled?(:draft_state),
:differentiated_assignments_enabled => @context.feature_enabled?(:differentiated_assignments),
:outcome_gradebook_enabled => @context.feature_enabled?(:outcome_gradebook),
:custom_columns_url => api_v1_course_custom_gradebook_columns_url(@context),
@ -343,7 +342,7 @@ class GradebooksController < ApplicationController
return unless authorized_action(@context, @current_user, [:manage_grades, :view_all_grades])
@assignment = @context.assignments.active.find(params[:assignment_id])
if @context.feature_enabled?(:draft_state) && @assignment.unpublished?
if @assignment.unpublished?
flash[:notice] = t(:speedgrader_enabled_only_for_published_content,
'Speedgrader is enabled only for published content.')
return redirect_to polymorphic_url([@context, @assignment])

View File

@ -17,10 +17,10 @@
#
module ContextModulesHelper
def cache_if_module(context_module, editable, draft_state, differentiated_assignments, user, &block)
def cache_if_module(context_module, editable, differentiated_assignments, user, &block)
if context_module
visible_assignments = differentiated_assignments ? user.assignment_and_quiz_visibilities(course_id: context_module.context_id) : []
cache_key_items = ['context_module_render_11_', context_module.cache_key, editable, draft_state, Time.zone]
cache_key_items = ['context_module_render_11_', context_module.cache_key, editable, true, Time.zone]
cache_key_items << Digest::MD5.hexdigest(visible_assignments.to_s) if differentiated_assignments
cache_key = cache_key_items.join('/')
cache_key = add_menu_tools_to_cache_key(cache_key)

View File

@ -49,7 +49,11 @@ module QuizzesHelper
end
def quiz_published_state_warning(quiz=@quiz)
!quiz.available? ? unpublished_quiz_warning : unsaved_changes_warning
if !quiz.available?
unpublished_quiz_warning
else
unsaved_changes_warning
end
end
def display_save_button?(quiz=@quiz)

View File

@ -1,5 +1,5 @@
<% define_content :link do %>
<%= HostUrl.protocol %>://<%= HostUrl.context_host(asset.context) %>/<%= asset.context.class.to_s.downcase.pluralize %>/<%= asset.context.id %>/wiki/<%= asset.url %>
<%= HostUrl.protocol %>://<%= HostUrl.context_host(asset.context) %>/<%= asset.context.class.to_s.downcase.pluralize %>/<%= asset.context.id %>/pages/<%= asset.url %>
<% end %>
<% define_content :subject do %>

View File

@ -1,5 +1,5 @@
<% define_content :link do %>
<%= HostUrl.protocol %>://<%= HostUrl.context_host(asset.context) %>/<%= asset.context.class.to_s.downcase.pluralize %>/<%= asset.context.id %>/wiki/<%= asset.url %>
<%= HostUrl.protocol %>://<%= HostUrl.context_host(asset.context) %>/<%= asset.context.class.to_s.downcase.pluralize %>/<%= asset.context.id %>/pages/<%= asset.url %>
<% end %>
<% define_content :subject do %>

View File

@ -1,5 +1,5 @@
<% define_content :link do %>
<%= HostUrl.protocol %>://<%= HostUrl.context_host(asset.context) %>/<%= asset.context.class.to_s.downcase.pluralize %>/<%= asset.context.id %>/wiki/<%= asset.url %>
<%= HostUrl.protocol %>://<%= HostUrl.context_host(asset.context) %>/<%= asset.context.class.to_s.downcase.pluralize %>/<%= asset.context.id %>/pages/<%= asset.url %>
<% end %>
<%= t :body, "A page has been updated on the wiki for %{title}.", :title => asset.context.name %>

View File

@ -1,5 +1,5 @@
<% define_content :link do %>
<%= HostUrl.protocol %>://<%= HostUrl.context_host(asset.context) %>/<%= asset.context.class.to_s.downcase.pluralize %>/<%= asset.context.id %>/wiki/<%= asset.url %>
<%= HostUrl.protocol %>://<%= HostUrl.context_host(asset.context) %>/<%= asset.context.class.to_s.downcase.pluralize %>/<%= asset.context.id %>/pages/<%= asset.url %>
<% end %>
<% define_content :subject do %>

View File

@ -1,4 +1,4 @@
<% define_content :link do -%>
<%= HostUrl.protocol %>://<%= HostUrl.context_host(asset.context) %>/<%= asset.context.class.to_s.downcase.pluralize %>/<%= asset.context.id %>/wiki/<%= asset.url %>
<%= HostUrl.protocol %>://<%= HostUrl.context_host(asset.context) %>/<%= asset.context.class.to_s.downcase.pluralize %>/<%= asset.context.id %>/pages/<%= asset.url %>
<% end -%>
<%= t :tweet, "Canvas Alert - Page Updated: %{title}, %{user}.", :title => asset.title, :user => asset.context.name %>

View File

@ -114,10 +114,6 @@ class Announcement < DiscussionTopic
false
end
def draft_state_enabled?
false
end
def published?
true
end

View File

@ -426,9 +426,7 @@ class Assignment < ActiveRecord::Base
quiz.assignment_group_id = self.assignment_group_id
quiz.workflow_state = 'created' if quiz.deleted?
quiz.saved_by = :assignment
if self.context.feature_enabled?(:draft_state)
quiz.workflow_state = published? ? 'available' : 'unpublished'
end
quiz.workflow_state = published? ? 'available' : 'unpublished'
quiz.save if quiz.changed?
elsif self.submission_types == "discussion_topic" && @saved_by != :discussion_topic
topic = self.discussion_topic || self.context.discussion_topics.build(:user => @updating_user)
@ -438,9 +436,7 @@ class Assignment < ActiveRecord::Base
topic.saved_by = :assignment
topic.updated_at = Time.now
topic.workflow_state = 'active' if topic.deleted?
if self.context.feature_enabled?(:draft_state)
topic.workflow_state = published? ? 'active' : 'unpublished'
end
topic.workflow_state = published? ? 'active' : 'unpublished'
topic.save
self.discussion_topic = topic
end
@ -566,11 +562,7 @@ class Assignment < ActiveRecord::Base
end
def restore(from=nil)
if !self.context.feature_enabled?(:draft_state) || self.has_student_submissions?
self.workflow_state = "published"
elsif self.context.feature_enabled?(:draft_state)
self.workflow_state = "unpublished"
end
self.workflow_state = self.has_student_submissions? ? "published" : "unpublished"
self.save
self.discussion_topic.restore(:assignment) if from != :discussion_topic && self.discussion_topic
self.quiz.restore(:assignment) if from != :quiz && self.quiz

View File

@ -225,5 +225,4 @@ class AssignmentGroup < ActiveRecord::Base
new_group.touch
self.reload
end
end

View File

@ -26,11 +26,7 @@ module BroadcastPolicies
def should_dispatch_assignment_created?
return false unless context_sendable?
if assignment.context.feature_enabled?(:draft_state)
published_on_create? || just_published?
else
assignment.just_created
end
published_on_create? || just_published?
end
private

View File

@ -126,7 +126,7 @@ class ContextModule < ActiveRecord::Base
end
def restore
self.workflow_state = context.feature_enabled?(:draft_state) ? 'unpublished' : 'active'
self.workflow_state = 'unpublished'
self.save
end
@ -380,7 +380,7 @@ class ContextModule < ActiveRecord::Base
added_item.content_type = 'ExternalUrl'
added_item.context_module_id = self.id
added_item.indent = params[:indent] || 0
added_item.workflow_state = (self.context.feature_enabled?(:draft_state) ? 'unpublished' : workflow_state)
added_item.workflow_state = 'unpublished'
added_item.save
added_item
elsif params[:type] == 'context_external_tool' || params[:type] == 'external_tool' || params[:type] == 'lti/message_handler'
@ -403,7 +403,7 @@ class ContextModule < ActiveRecord::Base
}
added_item.context_module_id = self.id
added_item.indent = params[:indent] || 0
added_item.workflow_state = (self.context.feature_enabled?(:draft_state) ? 'unpublished' : workflow_state)
added_item.workflow_state = 'unpublished'
added_item.save
added_item
elsif params[:type] == 'context_module_sub_header' || params[:type] == 'sub_header'
@ -419,7 +419,7 @@ class ContextModule < ActiveRecord::Base
added_item.content_type = 'ContextModuleSubHeader'
added_item.context_module_id = self.id
added_item.indent = params[:indent] || 0
added_item.workflow_state = (self.context.feature_enabled?(:draft_state) ? 'unpublished' : 'active')
added_item.workflow_state = 'unpublished'
added_item.save
added_item
else

View File

@ -178,10 +178,6 @@ class DiscussionTopic < ActiveRecord::Base
end
end
def draft_state_enabled?
context = self.context
context && context.respond_to?(:feature_enabled?) && context.feature_enabled?(:draft_state)
end
attr_accessor :saved_by
def update_assignment
return if self.deleted?
@ -197,7 +193,7 @@ class DiscussionTopic < ActiveRecord::Base
self.assignment.submission_types = "discussion_topic"
self.assignment.saved_by = :discussion_topic
self.assignment.workflow_state = 'published' if self.assignment.deleted?
if self.draft_state_enabled?
unless is_announcement
self.assignment.workflow_state = published? ? 'published' : 'unpublished'
end
self.assignment.save
@ -549,7 +545,7 @@ class DiscussionTopic < ActiveRecord::Base
def active?
# using state instead of workflow_state so this works with new records
self.state == :active || (self.draft_state_enabled? && self.state == :post_delayed)
self.state == :active || (!self.is_announcement && self.state == :post_delayed)
end
def publish
@ -598,7 +594,7 @@ class DiscussionTopic < ActiveRecord::Base
def published?
return false if workflow_state == 'unpublished'
return false if workflow_state == 'post_delayed' && !draft_state_enabled?
return false if workflow_state == 'post_delayed' && is_announcement
true
end
@ -642,7 +638,7 @@ class DiscussionTopic < ActiveRecord::Base
end
on_update_send_to_streams do
if should_send_to_stream && (@content_changed || changed_state(:active, draft_state_enabled? ? :unpublished : :post_delayed))
if should_send_to_stream && (@content_changed || changed_state(:active, !is_announcement ? :unpublished : :post_delayed))
self.active_participants
end
end
@ -717,7 +713,7 @@ class DiscussionTopic < ActiveRecord::Base
end
def restore(from=nil)
self.workflow_state = self.context.feature_enabled?(:draft_state) ? 'post_delayed' : 'active'
self.workflow_state = 'post_delayed'
self.save
if from != :assignment && self.for_assignment? && self.root_topic_id.blank?
@ -870,7 +866,7 @@ class DiscussionTopic < ActiveRecord::Base
p.whenever { |record|
record.context.available? and
!record.context.concluded? and
((record.just_created && record.active?) || record.changed_state(:active, record.draft_state_enabled? ? :unpublished : :post_delayed))
((record.just_created && record.active?) || record.changed_state(:active, !record.is_announcement ? :unpublished : :post_delayed))
}
end
@ -950,7 +946,7 @@ class DiscussionTopic < ActiveRecord::Base
def available_for?(user, opts = {})
return false if !published?
return false if !draft_state_enabled? && locked?
return false if is_announcement && locked?
!locked_for?(user, opts)
end
@ -975,7 +971,7 @@ class DiscussionTopic < ActiveRecord::Base
# topic is not published
if !published?
false
elsif !draft_state_enabled? && unlock_at = available_from_for(user)
elsif is_announcement && unlock_at = available_from_for(user)
# unlock date exists and has passed
unlock_at < Time.now.utc
# everything else
@ -988,7 +984,7 @@ class DiscussionTopic < ActiveRecord::Base
return true if self.locked? && !(opts[:check_policies] && self.grants_right?(user, :update))
lock = self.locked_for?(user, opts)
return false unless lock
return false if self.draft_state_enabled? && lock.include?(:unlock_at)
return false if !self.is_announcement && lock.include?(:unlock_at)
lock
end

View File

@ -137,7 +137,7 @@ module Importers
# be very explicit about draft state courses, but be liberal toward legacy courses
course.wiki.check_has_front_page
if course.feature_enabled?(:draft_state) && course.wiki.has_no_front_page
if course.wiki.has_no_front_page
if migration.for_course_copy? && (source = migration.source_course || Course.where(id: migration.migration_settings[:source_course_id]).first)
mig_id = CC::CCHelper.create_key(source.wiki.front_page)
if new_front_page = course.wiki.wiki_pages.where(migration_id: mig_id).first
@ -146,7 +146,7 @@ module Importers
end
end
front_page = course.wiki.front_page
course.wiki.unset_front_page! if front_page.nil? || (course.feature_enabled?(:draft_state) && front_page.new_record?)
course.wiki.unset_front_page! if front_page.nil? || front_page.new_record?
syllabus_should_be_added = everything_selected || migration.copy_options[:syllabus_body] || migration.copy_options[:all_syllabus_body]
if syllabus_should_be_added

View File

@ -275,7 +275,7 @@ module Importers
end
end
if context.feature_enabled?(:draft_state) && item.for_assignment? && !item.assignment
if item.for_assignment? && !item.assignment
item.workflow_state = 'unpublished'
end

View File

@ -105,7 +105,7 @@ module Importers
sub_item = sub_item.with_indifferent_access
if ['folder', 'FOLDER_TYPE'].member? sub_item[:type]
obj = context.wiki.wiki_pages.where(migration_id: sub_item[:migration_id]).first
contents += " <li><a href='/courses/#{context.id}/wiki/#{obj.url}'>#{obj.title}</a></li>\n" if obj
contents += " <li><a href='/courses/#{context.id}/pages/#{obj.url}'>#{obj.title}</a></li>\n" if obj
elsif sub_item[:type] == 'embedded_content'
if contents && contents.length > 0
description += "<ul>\n#{contents}\n</ul>"
@ -130,7 +130,7 @@ module Importers
contents += " <li><a href='/courses/#{context.id}/quizzes/#{obj.id}'>#{obj.title}</a></li>\n" if obj
when /PAGE_TYPE|WIKI_TYPE/
obj = context.wiki.wiki_pages.where(migration_id: sub_item[:linked_resource_id]).first
contents += " <li><a href='/courses/#{context.id}/wiki/#{obj.url}'>#{obj.title}</a></li>\n" if obj
contents += " <li><a href='/courses/#{context.id}/pages/#{obj.url}'>#{obj.title}</a></li>\n" if obj
when 'FILE_TYPE'
file = context.attachments.where(migration_id: sub_item[:linked_resource_id]).first
if file
@ -210,7 +210,7 @@ module Importers
missing_links.each do |field, missing_links|
migration.add_missing_content_links(:class => item.class.to_s,
:id => item.id, :field => field, :missing_links => missing_links,
:url => "/#{context.class.to_s.underscore.pluralize}/#{context.id}/wiki/#{item.url}")
:url => "/#{context.class.to_s.underscore.pluralize}/#{context.id}/pages/#{item.url}")
end
end
return item

View File

@ -195,8 +195,7 @@ class Wiki < ActiveRecord::Base
end
def path
if self.context.respond_to?(:feature_enabled?)
self.context.feature_enabled?(:draft_state) ? 'pages' : 'wiki'
end
# was a shim for draft state, can be removed
'pages'
end
end

View File

@ -355,7 +355,7 @@ class WikiPage < ActiveRecord::Base
entry.published = self.created_at
entry.id = "tag:#{HostUrl.default_host},#{self.created_at.strftime("%Y-%m-%d")}:/wiki_pages/#{self.feed_code}_#{self.updated_at.strftime("%Y-%m-%d")}"
entry.links << Atom::Link.new(:rel => 'alternate',
:href => "http://#{HostUrl.context_host(context)}/#{self.context.class.to_s.downcase.pluralize}/#{self.context.id}/wiki/#{self.url}")
:href => "http://#{HostUrl.context_host(context)}/#{self.context.class.to_s.downcase.pluralize}/#{self.context.id}/pages/#{self.url}")
entry.content = Atom::Content::Html.new(self.body || t('defaults.no_content', "no content"))
end
end

View File

@ -96,10 +96,6 @@ class DiscussionTopicPresenter
#
# Returns a boolean.
def allows_speed_grader?
!large_roster? && draft_state_allows_speedgrader?
end
def draft_state_allows_speedgrader?
topic.context.feature_enabled?(:draft_state) ? topic.assignment.published? : true
!large_roster? && topic.assignment.published?
end
end

View File

@ -1,63 +0,0 @@
<div id="add_assignment" style="display: none;">
<%= form_for :assignment,
:url => context_url(@context, :controller => :assignments, :action => :create),
:html => { :style => 'display: none;',
:id => 'add_assignment_form',
:class => 'add_assignment_form form-inline' } do |f| %>
<%= f.hidden_field :assignment_group_id %>
<%= hidden_field_tag :assignment_group_id %>
<div class="pad-box-micro">
<div class="row-fluid">
<div class="span6">
<%= f.text_field :title,
:maxlength => '254',
:class => 'span10',
'aria-label' => t(:assignment_name, 'Assignment Name')
%>
</div>
<div class="span4">
<%= f.label :due_at, t('labels.due', 'due:') %>
<%= f.text_field :due_at, :class => 'datetime_field span5' %>
</div>
<div class="span2 align-right">
<span class="points">
<%= f.label :points_possible, t('labels.points', 'points:') %>
<%= f.text_field :points_possible, :size => 2, :class => 'span6' %>
</span>
<span class="no_points nobr" title="<%= t 'tooltips.assignment_is_quiz', "This assignment is a quiz, so points possible comes from the questions and can't be set manually." %>">
<%= t('labels.quiz_points', 'quiz pts.') %>
</span>
</div>
</div>
</div>
<div class="pad-box-micro">
<div class="row-fluid">
<div class="span6">
<label for="assignment_submission_types"><%= t('labels.type', 'type') %>:</label>
<select name="assignment[submission_types]" class="assignment_submission_types span8" id="assignment_submission_types">
<option value="" class="current_submission_types"><%= t 'options.assignment', "Assignment" %></option>
<option value="discussion_topic"><%= t 'options.discussion', "Discussion" %></option>
<option value="online_quiz"><%= t 'options.quiz', "Quiz" %></option>
<option value="external_tool"><%= t 'options.external_tool', "External Tool" %></option>
<% if feature_enabled?(:attendance) %>
<option value="attendance"><%= t 'options.attendance', "Attendance" %></option>
<% end %>
<option value="not_graded"><%= t 'options.not_graded', "Not Graded" %></option>
</select>
</div>
<div class="span6 align-right">
<a href="#" class="more_options_link btn btn-small"><%= t 'links.more_options', "More options" %></a>
<button type="button" class="btn btn-small cancel_button"><%= t('#buttons.cancel', 'Cancel') %></button>
<button type="submit" class="btn btn-small btn-primary"><%= t('#buttons.update', 'Update') %></button>
<a href="#" style="font-size: 0.8em; display: none;"><%= t 'links.full_edit', "Full Edit" %></a>
</div>
</div>
</div>
<% end %>
<a href="<%= context_url(@context, :controller => :assignments, :action => :create) %>" class="assignments_url">&nbsp;</a>
</div>

View File

@ -1,58 +0,0 @@
<div id="add_group" style="display: none;">
<%= form_for :assignment_group, :url => context_url(@context, :context_assignment_groups_url), :html => {:id => 'add_group_form', :style => 'display: none;'} do |form| %>
<div class="form-inline pad-box-micro">
<% group_name = t('labels.group_name', "Group Name") %>
<%= form.text_field :name, :maxlength => "255", :'aria-labeled-by' => group_name, :placeholder => group_name %>
<span class="percent_weighting"><%= form.text_field(:group_weight, :class => 'span1 align-right') %> <%= t(:percent_of_total_grade, "% of total grade") %></span>
<span class="pull-right">
<button type="button" class="btn btn-small cancel_button"><%= t('#buttons.cancel', "Cancel") %></button>
<button type="submit" class="btn btn-primary btn-small"><%= t '#buttons.update', "Update" %></button>
</span>
</div>
<span class="weighting">
<%= before_label :assignments, "Assignments" %>
<%= form.select :assignment_weighting_scheme,
{ t('options.weighted_by_points', "Weighted By Points") => "by_points",
t('options.equally_weighted', "Equally Weighted") => "equal" } %>
</span>
<div class="form_rules"></div>
<div class="rule pad-box-micro" id="assignment_group_rule_blank" style="display: none;">
<a href="#" class="delete_rule_link no-hover pull-right pad-box-micro"><i class="icon-end standalone-icon"></i><span class="screen-reader-text"><%= t('links.delete_assignment', "Delete") %></span></a>
<select name="rule_type" class="group_rule_type">
<option value="drop_lowest"><%= t 'options.drop_lowest', "Drop the Lowest" %></option>
<option value="drop_highest"><%= t 'options.drop_highest', "Drop the Highest" %></option>
<option value="never_drop"><%= t 'options.never_drop', "Never Drop" %></option>
</select>
<span class="drop_scores">
<span>
<%= t :drop_x_scores_for_each_student, "%{scores} scores for each student",
:scores => '<input type="text" class="drop_count align-right span1" name="scores_to_drop" title="#" size="2"/>'.html_safe %>
</span>
</span>
<span class="never_drop_assignment" style="display: none;">
<select name="assignment_to_never_drop" class="assignment_to_never_drop">
<option value="0"><%= t 'options.no_assignments', "[No Assignments]" %></option>
</select>
</span>
</div>
<div class="pad-box-micro">
<a href="#" class="add_rule_link btn"><%= t 'links.add_grading_rule', "Add grading rule" %></a>
</div>
<div class="clear"></div>
<% end %>
<a href="<%= context_url(@context, :controller => :assignment_groups, :action => :index) %>" class="assignment_groups_url">&nbsp;</a>
</div>

View File

@ -1,15 +0,0 @@
<div class="rs-margin-lr rs-margin-top">
<% if @assignment.unlock_at && @assignment.lock_at %>
<%= t :assignment_unlocked_from_to, "This assignment is only unlocked from *%{unlock_at}* to *%{lock_at}*",
:unlock_at => datetime_string(@assignment.unlock_at), :lock_at => datetime_string(@assignment.lock_at),
:wrapper => '<span class="lock_date">\1</span>' %>
<% elsif @assignment.unlock_at %>
<%= t :assignment_unlocked_from, "This assignment is locked until *%{unlock_at}*",
:unlock_at => datetime_string(@assignment.unlock_at),
:wrapper => '<span class="lock_date">\1</span>' %>
<% else %>
<%= t :assignment_locked, "This assignment is locked as of *%{lock_at}*",
:lock_at => datetime_string(@assignment.lock_at),
:wrapper => '<span class="lock_date">\1</span>' %>
<% end %>
</div>

View File

@ -1,41 +0,0 @@
<%= render :partial => "assignments/add_assignment_form" %>
<%= render :partial => "assignments/add_assignment_group_form" %>
<div style="<%= "display: none;" unless can_do(@context, @current_user, :manage_grades) %>margin-bottom: 16px; padding-left: 16px;" id="class_weighting_box">
<input type="checkbox" id="class_weighting_policy" name="class_weighting_policy" <%= "checked" if (@context.group_weighting_scheme == 'percent') %>/>
<label for="class_weighting_policy"><%= t 'labels.class_weighting_policy', "Weight the final grade based on assignment groups" %></label>
<a href="<%= url_for (@context) %>" class="context_url" style="display: none;">&nbsp;</a>
</div>
<div id="groups" class="<%= 'groups_editable' if can_do(@context, @current_user, :manage_assignments) %>">
<%= render :partial => "shared/assignment_group", :collection => @groups, :locals => { :multiple_groups => @groups.length > 1 } %>
</div>
<%= render :partial => "shared/assignment_group", :object => nil %>
<%= render :partial => "shared/assignment", :object => nil, :locals => {:context => @context} %>
<div style="display: none;">
<a href="<%= context_url(@context, :controller => "assignment_groups", :action => "reorder") %>" class="reorder_groups_url">&nbsp;</a>
<div id="delete_assignments_dialog" title="<%= t 'titles.delete_assignment_group', "Delete Assignment Group?" %>">
<h2><%= t 'titles.delete_assignment_group', "Delete Assignment Group?" %></h2>
<p><%= t('warnings.delete_assignment_group',
"The assignment group %{group} has %{assignment_count} in it. You can either delete these assignments or move them to another assignment group.",
:group => '<span class="name" style="font-weight: bold;">&nbsp;</span>'.html_safe,
:assignment_count => '<span class="assignment_count" style="font-weight: bold;">&nbsp;</span>'.html_safe) %>
</p>
<p>
<input type="radio" name="action" value="delete" id="assignment_group_delete"/>
<label for="assignment_group_delete"><%= t 'labels.delete_assignments_in_group', "Delete assignments in this group" %></label>
</p>
<p>
<input type="radio" name="action" value="move" id="assignment_group_move"/>
<label for="assignment_group_move"><%= t 'labels.move_assignments_to', "Move assignments from this group to " %></label>
<select name="group_id" class="group_select" title="<%= t 'tooltips.target_group', "Select a group to move this assignment to" %>">
<option value="" class="blank"><%= t 'options.select_group', "[ Select a Group ]" %></option>
</select>
</p>
<div class="button-container">
<button class="btn cancel_button"><%= t '#buttons.cancel', "Cancel" %></button>
<button class="btn btn-primary delete_button"><%= t 'buttons.delete_group', "Delete Group" %></button>
</div>
</div>
</div>
<%= image_tag "graded.png", :style => "width: 16px; display: none;", :id => "submitted_icon", :class => "submitted_icon" %>

View File

@ -1,38 +0,0 @@
<% if @assignments.empty? %>
<h2><%= t 'titles.assignments', "Assignments" %></h2>
<%= t :no_assignments, "No Assignments created for this course." %>
<% else %>
<% if @just_viewing_one_course %>
<div id="groups_for_student" style="display: none;">
<h2><%= t 'titles.course_assignments', "Course Assignments" %></h2>
<%= render :partial => "shared/assignment_group",
:collection => @groups,
:locals => {
:skip_assignments => true,
:multiple_groups => @groups.length > 1
} %>
</div>
<% end %>
<div id="assignments_for_student">
<% [ { :label => t('titles.overdue_assignments', "Overdue Assignments"), :variable => @overdue_assignments},
{ :label => t('titles.ungraded_assignments', "Ungraded Assignments"), :variable => @ungraded_assignments},
{ :label => t('titles.upcoming_assignments', "Upcoming Assignments"), :variable => @future_assignments},
{ :label => t('titles.undated_assignments', "Undated Assignments"), :variable => @undated_assignments},
{ :label => t('titles.past_assignments', "Past Assignments"), :variable => @past_assignments}
].each do |group| %>
<div style="margin-bottom: 25px; <%= hidden if !group[:variable] || group[:variable].empty? %>" class="assignment_list <%= 'show_context' unless @just_viewing_one_course %>">
<h2><%= group[:label] %></h2>
<%= render :partial => "shared/assignment",
:collection => group[:variable],
:locals => {
:submissions_hash => @submissions_hash,
:assignment_count => group[:variable].length
} %>
</div>
<% end %>
</div>
<% end %>
<% if @just_viewing_one_course %>
<div id="group_weighting_scheme" style="display: none;"><%= @context.group_weighting_scheme %></div>
<% end %>
<% js_bundle 'legacy/assignments_list_content' %>

View File

@ -1,10 +1,6 @@
<% course_home ||= false %>
<% if @just_viewing_one_course %>
<div class="rs-margin-lr rs-margin-top">
<% unless @context.feature_enabled?(:draft_state) %>
<a href="#" class="show_groups_link btn button-sidebar-wide"><%= t 'links.group_assignments_by_type', "Group Assignments by Type" %></a>
<a href="#" class="hide_groups_link btn button-sidebar-wide" style="display: none;"><%= t 'links.just_show_assignment_list', "Just Show the Assignment List" %></a>
<% end %>
<% if @courses.length == 1 && can_do(@courses.first, @current_user, :participate_as_student) %>
<a href="<%= context_url(@context, :context_grades_url) %>" class="btn button-sidebar-wide"><%= image_tag "grading_icon.png" %> <%= t 'links.see_current_grades', "See my grades so far" %></a>
<% end %>

View File

@ -1,21 +0,0 @@
<% course_home ||= false %>
<p>
<b><span class="assignment_count"><%= t '#assignments.assignment_count', "Assignment", :count => @context.assignments.active.length %></span></b>
<span style="font-size: 0.8em;">
<%= t :assignment_groups_wrapper, "( in %{number_of_groups})",
:number_of_groups => content_tag(:span, t("#assignments.assignment_groups_count", "Group", :count => @groups.length), :class => "assignment_group_count")
%>
</span>
</p>
<p>
<% if can_do(@context.assignments.scoped.new, @current_user, :create) %>
<%= t :add_assignment_to_group, "*Add Assignment* to %{group}",
:wrapper => "<a href=\"#{context_url(@context, :new_context_assignment_url)}\" class=\"add_assignment_link add groupless_link\">\\1</a>",
:group => "<select class=\"assignment_groups_select\">#{options_for_select(@groups.map { |group| [group.name, "group_#{group.id}"] })}</select>".html_safe %>
<br/>
<% end %>
<% if can_do(@context.assignment_groups.scoped.new, @current_user, :create) %>
<a href="#" class="add_group_link add"> <%= t 'links.add_assignment_group', "Add Assignment Group" %></a>
<% end %>
</p>
<%= render :partial => 'assignments/group_weights', :locals => {:editable => can_do(@context, @current_user, :manage_assignments)} %>

View File

@ -2,7 +2,7 @@
<h2><%= t 'titles.related_items', "Related Items" %></h2>
<% if @context.allows_speed_grader? %>
<li id="assignment-speedgrader-link"
<% if @context.feature_enabled?(:draft_state) && @assignment.unpublished? %>
<% if @assignment.unpublished? %>
class="hidden"
<% end %>
>

View File

@ -1,112 +0,0 @@
<div class="wizard_options">
<h3><%= t 'titles.wizard_box', "I would like to:" %></h3>
<ul class="wizard_options_list">
<li class="option create_assignment_option add_step">
<a href="#" class="icon-assignment" aria-describedby="wizard_create_assignment"><%= t 'links.create_assignment', "Create a New Assignment" %></a>
<div class="details" style="display: none;" >
<%= t 'instructions.wizard.step1', %(Assignments are always organized into groups, so to add an assignment you first
need to know what group you want to add it to. Select the group and click
"Add Assignment to" or Click the %{add_icon} icon to start
a new assignment for a group.), :add_icon => '<i class="icon-add"></i>'.html_safe %>
<div style="text-align: center; margin-top: 5px; font-size: 1.5em;">
<a href="#" class="highlight_add_assignment_icon"><%= t 'links.show_me_where', "Show Me Where" %></a>
</div>
<div style="display: none;" class="no_groups_message">
<%= t 'errors.no_assignment_group', 'Oops. You need to add an assignment group first. Click "Create an
Assignment Group" to see how.' %>
</div>
</div>
<div class="hidden" id="wizard_create_assignment">
<%= t 'instructions.wizard.screenreader_step1', %(Assignments are always organized into groups, so to add an assignment you first
need to know what group you want to add it to. Select the group and click
"Add Assignment to" or Click the add icon to start
a new assignment for a group.) %>
</div>
<div class="screenreader-only">
<a href="#" class="show_me_add_assignment"><%= t 'links.screenreader_show_me_add_assignment', "Take me to the add assignment button" %></a>
</div>
</li>
<li class="option edit_assignment_option" style="display: none;">
<a href="#" class="wizard_edit_assignment_details" aria-describedby="wizard_edit_assignment_details"></a>
<div class="details" style="display: none;" id="wizard_edit_assignment_details">
<%= t 'instructions.wizard.step2', "Great! Now fill in your details. You can enter a title for your assignment,
a due date and the number of points possible. If you want to do more than that
you can, but only after the assignment has been created."%>
</div>
</li>
<li class="option review_assignment_option" style="display: none;">
<a href="#" class="wizard_edit_assignment_details" aria-describedby="wizard_review_assignment_details"></a>
<div class="details" style="display: none;" id="wizard_review_assignment_details">
<%= t 'instructions.wizard.step3', "Done! The assignment is now added to the group! If you hover your mouse over the
assignment, you'll see a bunch of options. Here's what they mean:" %>
<ul style="list-style-type: none;">
<li><%= t 'descriptions.move_icon', "%{icon}: Move the assignment to another group", :icon => image_tag("move.png") %></li>
<li><%= t 'descriptions.preview_icon', "%{icon}: Preview the assignment and edit it in full", :icon => image_tag("preview.png") %></li>
<li><%= t 'descriptions.edit_icon', "%{icon}: Edit the basic options again", :icon => image_tag("edit.png") %></li>
<li><%= t 'descriptions.delete_icon', "%{icon}: Delete the assignment", :icon => image_tag("delete.png") %></li>
</ul>
</div>
</li>
<li class="option add_step">
<a href="#" class="icon-group-new" aria-describedby='wizard_create_assignment_group' ><%= t 'links.create_assignment_group', "Create an Assignment Group" %></a>
<div class="details" style="display: none;">
<%= t 'instructions.wizard.group.step1', 'Assignment groups are used to organize assignments. You provide a name for each
group. If you choose to weight the final grade based on groups (*where?*) then
you can also set a percentage score for each group. Click "Add Assignment Group"
to create a group.', :wrapper => '<a href="#" class="highlight_weight_groups"><b>\1</b></a>' %>
<div style="text-align: center; margin-top: 5px; font-size: 1.5em;">
<a href="#" class="highlight_add_assignment_group_icon"><%= t 'links.show_me_where', "Show Me Where" %></a>
</div>
</div>
<div class="hidden" id="wizard_create_assignment_group">
<%= t 'instructions.wizard.group.screenreader_step1', 'Assignment groups are used to organize assignments. You provide a name for each
group. If you choose to weight the final grade based on groups then you can also set a
percentage score for each group. Click "Add Assignment Group" to create a group.' %>
</div>
<div class="screenreader-only">
<a href="#" class="show_me_add_assignment_group"><%= t 'links.screenreader_show_me_add_assignment_group', "Take me to the add assignment group button" %></a>
<a href="#" class="show_me_weight_final_grade"><%= t 'links.screenreader_show_me_weight_final_grade', "Take me to the weight final grade checkbox" %></a>
</div>
</li>
<li class="option edit_step" style="line-height: 1.1em;">
<a href="#" class="icon-edit" aria-describedby='wizard_edit_assignments_in_detail'><%= t 'links.edit_assignment_in_detail', "Edit Assignments in Detail" %></a>
<div style="font-size: 0.6em; padding-left: 10px;"><%= t 'subtitles.edit_assignment_in_detail', "(allow uploads, edit description, etc.)" %></div>
<div class="details" style="display: none;" >
<%= t 'instructions.wizard.details', %(There's a lot more that goes into an assignment than due dates and points. If you
want to type up a description of the assignment, allow file uploads, change the
grading type or a bunch of other things, click the assignment's name
or click the %{edit_icon} icon and then "more options".), :edit_icon => '<i class="icon-edit"></i>'.html_safe %>
</div>
<div class="hidden" id='wizard_edit_assignments_in_detail'>
<%= t 'instructions.wizard.screenreader_details', %(There's a lot more that goes into an assignment than due dates and points. If you
want to type up a description of the assignment, allow file uploads, change the
grading type or a bunch of other things, click the assignment's name
or click the edit icon and then "more options".) %>
</div>
</li>
<li class="option quiz_step">
<a href="#" class="icon-quiz" aria-describedby="wizard_quizzes_create_import"><%= t 'links.create_or_import_quiz', "Create/Import a Quiz" %></a>
<div class="details" style="display: none;" id="wizard_quizzes_create_import">
<%= t 'instructions.wizard.quizzes', 'Quizzes are special types of assignments. You can create or import quizzes by
clicking the "Quizzes" link on the left sidebar.' %>
</div>
</li>
<li class="option introduction" style="display: none;">
<a href="#" class="wizard_introduction" aria-describedby="wizard_introduction"></a>
<div class="details" style="display: none;" id="wizard_introduction">
<%= t 'instructions.wizard.overview', "This page is for setting up your course at a high level. You can add assignments,
group them and then weight those groups. The idea is to get yourself organized
first, dive into the specifics second. Even still, there's a lot you can do
from here." %>
</div>
</li>
</ul>
</div>
<div class="wizard_details">
<div aria-live="polite" aria-relevant="all">
<div class="header"></div>
</div>
</div>
<div class="clear"></div>
<% js_bundle 'legacy/assignments_wizard_box' %>

View File

@ -8,10 +8,8 @@
js_bundle :assignment_edit
%>
<% if @context.feature_enabled?(:draft_state) %>
<div id="edit_assignment_header" class="header-bar">
</div>
<% end %>
<div id="edit_assignment_header" class="header-bar">
</div>
<div id="edit_assignment_wrapper">
<form id="edit_assignment_form" class="form-horizontal bootstrap-form">

View File

@ -1,60 +0,0 @@
<% content_for :page_title do %><%= join_title @context.name, t(:page_title, "Assignments") %><% end %>
<% js_bundle :assignments %>
<% content_for :right_side do %>
<div class="rs-margin-all">
<a href="#" class="wizard_popup_link <%= 'auto_open' if params[:wizard] %> help"> <%= t 'links.wizard', "How Do I...?" %></a>
<%= render :partial => 'assignments/assignments_right_side' %>
</div>
<% end %>
<%= render :partial => 'assignments/assignments_content' %>
<% content_for :wizard_box do %>
<%= render :partial => "assignments/wizard_box" %>
<% end %>
<% content_for :keyboard_navigation do %>
<ul class="navigation_list" tabindex="-1">
<li>
<span class="keycode"><%= t 'keycodes.next_assignment_or_group', 'j' %></span>
<span class="colon">:</span>
<span class="description"><%= t 'keycode_descriptions.next_assignment_or_group', "Next Assignment/Group" %></span>
</li>
<li>
<span class="keycode"><%= t 'keycodes.previous_assignment_or_group', 'k' %></span>
<span class="colon">:</span>
<span class="description"><%= t 'keycode_descriptions.previous_assignment_or_group', "Previous Assignment/Group" %></span>
</li>
<li>
<span class="keycode"><%= t 'keycodes.edit_assignment_or_group', 'e' %></span>
<span class="colon">:</span>
<span class="description"><%= t 'keycode_descriptions.edit_assignment_or_group', "Edit Current Assignment/Group" %></span>
</li>
<li>
<span class="keycode"><%= t 'keycodes.delete_assignment_or_group', 'd' %></span>
<span class="colon">:</span>
<span class="description"><%= t 'keycode_descriptions.delete_assignment_or_group', "Delete Current Assignment/Group"%></span>
</li>
<li>
<span class="keycode"><%= t 'keycodes.add_assignment_or_group', 'a' %></span>
<span class="colon">:</span>
<span class="description"><%= t 'keycode_descriptions.add_assignment_or_group', "Add Assignment to Current Group" %></span>
</li>
<li>
<span class="keycode"><%= t 'keycodes.full_preview', 'f' %></span>
<span class="colon">:</span>
<span class="description"><%= t 'keycode_descriptions.full_preview', "Full Preview/Edit Assignment" %></span>
</li>
<li>
<span class="keycode"><%= t 'keycodes.close_active_dialog', 'esc' %></span>
<span class="colon">:</span>
<span class="description"><%= t 'keycode_descriptions.close_active_dialog', "Close the active dialog" %></span>
</li>
</ul>
<% end %>
<% if @context.try_rescue(:module_based?) && !can_do(@context, @current_user, :manage_content) %>
<a href="<%= context_url(@context, :context_locks_url) %>" id="assignment_locks_url" style="display: none;">&nbsp;</a>
<%= image_tag "lock.png", :style => "display: none;", :id => "assignment_lock_icon", :title => t(:assignment_locked, "This assignment is currently locked. Visit the assignment details page for more information."), :alt => t(:assignment_locked_tooltip, "locked") %>
<% end %>

View File

@ -25,13 +25,11 @@
</h1>
</div>
<div class='edit-content'>
<% if @context.feature_enabled?(:draft_state) %>
<button
id="assignment_publish_button"
data-id='<%= @assignment.id %>'
class='btn <%= "published" if @assignment.published? %> <%= "disabled" if @assignment.has_student_submissions? %>'>
</button>
<% end %>
<button
id="assignment_publish_button"
data-id='<%= @assignment.id %>'
class='btn <%= "published" if @assignment.published? %> <%= "disabled" if @assignment.has_student_submissions? %>'>
</button>
<a href="<%= edit_polymorphic_path([@context, @assignment]) %>" class='btn edit_assignment_link'>
<i class='icon-edit'></i> <%= t('links.edit', 'Edit') %>
</a>

View File

@ -1,25 +0,0 @@
<% content_for :page_title do %><%= before_label :assignments, "Assignments" %> <%= @context.name %><% end %>
<% content_for :leading_content do %>
<h1 class='screenreader-only'><%= t(:assignments, "Assignments") %></h1>
<% end %>
<% content_for :stylesheets do %>
<% unless @just_viewing_one_course %>
<style type="text/css">
<% @courses.each_with_index do |c, idx| %>
.course_name.<%= dom_id(c) %>, .show-only-from a.<%= dom_id(c) %>, .show-only-from a.<%= dom_id(c) %>:hover, .show-only-from a.<%= dom_id(c) %>:focus {
border-width: 1px;
border-style: solid;
border-color: <%= dark_color_pastel_index(idx) %>;
background-color: <%= light_color_pastel_index(idx) %> !important;
}
<% end %>
</style>
<% end %>
<% end %>
<% js_bundle :global_assignments %>
<% content_for :right_side do %>
<%= render :partial => "assignments/assignments_list_right_side" %>
<% end %>
<%= render :partial => 'assignments/assignments_list_content' %>

View File

@ -1,416 +0,0 @@
<% course_home ||= false %>
<% js_env :COLLAPSED_MODULES => @collapsed_modules %>
<% js_env :CAN_MANAGE_MODULES => can_do(@context, @current_user, :manage_content) %>
<% js_env :COURSE_ID => @context.id %>
<% js_env :NO_MODULE_PROGRESSIONS => @context.large_roster %>
<% js_bundle :context_modules %>
<% jammit_css :context_modules %>
<% if course_home %>
<div class="h2"><%= @context.name %></div>
<% end %>
<div class="context-modules-main-header clearfix">
<h2 class="context-modules-title">
<%= t('headings.course_modules', %{Course Modules}) %>
</h2>
<% if can_do(@context, @current_user, :manage_content) %>
<div class="context-modules-main-toolbar">
<button class="btn btn-small module_progressions_link"><%= t('links.student_progress', 'View Progress') %></button>
<button class="btn btn-small btn-primary add_module_link"><%= t('#context_modules.buttons.add_module', 'Create a Module') %></button>
</div>
<% end %>
</div>
<div id="no_context_modules_message" style="display:none; clear: both;">
<% if can_do(@context.context_modules.scoped.new, @current_user, :create) %>
<%= mt 'help.create', <<TEXT, :button => t('#context_modules.buttons.add_module_first', 'Add a New Module')
Course modules let you organize your assignments, pages, files, etc. into smaller sections or units. Modules could be centered around a theme, focused on a specific topic, or even just grouped chronologically.
You can also sequence modules by defining criteria and prerequisites for each module. Students won't be able to access modules until they have unlocked all their prerequisites. That way you can prevent students from accessing certain content or files until they have, say, gotten at least 75% on a review quiz.
To start organizing your course into modules, click the "%{button}" button to the right.
TEXT
%>
<% else %>
<p><%= t('help.no_modules', %{No modules have been defined for this course.}) %></p>
<% end %>
</div>
<div class="hidden-readable" tabindex="0" aria-label="keyboard instructions">
<%= t('modules_keyboard_hint',
'To change the order of the course modules and module items,
first turn the cursor off on your screen reader. Insert-z in JAWS.
Press tab to select the first module.
Press up and down to choose a module or module item.
Press space to select the module or module item to start dragging.
Then press up and down to select a destination.
Then press space a second time to drop selection after destination.') %>
</div>
<% keyboard_navigation([
{:key => t('keycodes.next_module_item', 'Up'), :description => t('keycode_descriptions.next_module_item', 'Select next module or module item')},
{:key => t('keycodes.previous_module_item', 'Down'), :description => t('keycode_descriptions.previous_module_item', 'Select previous module or module item')},
{:key => t('keycodes.toggle_module_dragging', 'Space'), :description => t('keycode_descriptions.toggle_module_dragging', 'Select item to begin dragging, or drop previously selected item')}
]) %>
<div id="context_modules_sortable_container">
<div id="context_modules" tabindex="0" aria-label="<%= t('headings.course_modules', %{Course Modules}) %>" class="<%= 'editable' if can_do(@context, @current_user, :manage_content) %>">
<% editable = can_do(@context, @current_user, :manage_content) %>
<% cache([@context.cache_key, editable, 'all_context_modules_6', collection_cache_key(@modules)].join('/')) do %>
<% ActiveRecord::Associations::Preloader.new(@modules, :content_tags => :content).run %>
<% @modules.each do |m| %>
<%= render :partial => 'context_modules/context_module', :object => m, :locals => {:editable => editable } %>
<% end %>
<% end %>
</div>
</div>
<%= render :partial => 'context_modules/context_module', :object => nil %>
<%= render :partial => 'context_modules/module_item', :object => nil %>
<% if can_do(@context, @current_user, :manage_content) %>
<%= form_for :context_module, :url => context_url(@context, :context_context_modules_url), :html => {:id => "add_context_module_form", :style => "display: none;"} do |f| %>
<table class="formtable">
<tr>
<td colspan="2">
<div class="module_name">
<%= f.text_field :name, :placeholder => t('module_name', %{Module Name}), :class => 'input-block-level' %>
</div>
</td>
</tr><tr>
<td colspan="2">
<input type="checkbox" id="unlock_module_at"/>
<label for="unlock_module_at"><%= t('#labels.lock_module_until', %{Lock module until a given date}) %></label>
</td>
</tr><tr class="unlock_module_at_details">
<td>
<%= before_label('unlock_at', %{Unlock At}) %>
</td><td>
<%= f.text_field :unlock_at, :class => "datetime_field" %>
</td>
</tr><tr>
<td colspan="2">
<div class="prerequisites_entry">
<b><%= before_label('modules.before_students_view', %{Before students can view this module}) %></b>
<div class="prerequisites_list">
<div class="no_prerequisites_message"><%= t('no_preprequisites', %{No prerequisites defined}) %></div>
<div class="criteria_list" style="display: none;">
</div>
<div id="criterion_blank" class="criterion clearfix" style="display: none;">
<div style="float: left">
<span class="prereq_desc"><%= t('must_complete_prerequisites', %{They must complete}) %></span>
<span class="option">
</span>
</div>
<div style="float: right;">
<a href="#" class="delete_criterion_link dim-till-hover"><i class="icon-end standalone-icon" title="Delete"></i></a>
</div>
<div class="clear"></div>
</div>
<div style="font-size: 0.9em;">
<a href="#" class="add_prerequisite_link icon-add"><%= t('links.add_prerequisite', %{Add prerequisite}) %></a>
</div>
</div>
</div>
<div class="completion_entry">
<b><%= before_label('module_complete_when', %{This module is complete when}) %></b>
<div class="completion_criteria_list">
<div class="no_items_message"><%= t('prerequisites_need_item', %{You'll need to add items before you can specify how a user will complete this module}) %></div>
<div class="no_criteria_message" style="display: none;"><%= t('no_requirements', %{No requirements defined}) %></div>
<div class="criteria_list" style="display: none;">
</div>
<div style="font-size: 0.9em;">
<a href="#" class="add_completion_criterion_link icon-add"><%= t('links.add_requirement', %{Add requirement}) %></a>
</div>
</div>
</div>
</td>
</tr>
<% if Canvas::Plugin.find!('grade_export').enabled? %>
<tr>
<td colspan="2">
<%= f.check_box :publish_final_grade, :id => "publish_final_grade" %>
<%= f.label :publish_final_grade, :en => "publish final grade for the student when this module is completed", :for => "publish_final_grade" %>
</td>
</tr>
<% end %>
<tr>
<td colspan="2">
<%= f.check_box :require_sequential_progress, :id => "require_sequential_progress" %>
<%= f.label :require_sequential_progress, :en => "Students must move through requirements in this module in sequential order", :for => "require_sequential_progress" %>
</td>
</tr><tr>
<td colspan="2">
<div class="button-container">
<button type="button" class="btn cancel_button"><%= t('#buttons.cancel', %{Cancel}) %></button>
<button type="submit" class="btn btn-primary submit_button"><%= t('buttons.add_module', %{Add Module}) %></button>
</div>
<a href="<%= context_url(@context, :context_context_modules_url) %>" style="display: none;" class="add_context_module_url">&nbsp;</a>
</td>
</tr>
</table>
<% end %>
<div id="add_module_prerequisite_dialog" style="display: none;">
<span class="context_module_id" style="display: none;">&nbsp;</span>
<div>
<%= t 'add_prerequisite', "Add prerequisite to *%{module}*", :wrapper => '<span class="module_name">\1</span>', :module => 'module' %>
</div>
<div style="text-align: center;" class="prerequisite_module_select">
</div>
<div class="button-container">
<button type="button" class="btn submit_button"><%= t('buttons.add_prerequisite', %{Add Prerequisite}) %></button>
<button type="button" class="btn button-secondary cancel_button"><%= t('#buttons.cancel', %{Cancel}) %></button>
</div>
</div>
<%= render :partial => "shared/select_content_dialog", :locals => {:for_modules => true, lti_app_placements: [Lti::ResourcePlacement::LINK_SELECTION, Lti::ResourcePlacement::RESOURCE_SELECTION]} %>
<div id="edit_item_dialog" style="display: none;">
<%= form_for :content_tag, :url => "", :html => {:id => "edit_item_form", :method => :put, :style => "margin: 20px 10px;"} do |f| %>
<table class="formtable">
<tr>
<td><%= f.blabel :title, :en => "Title" %></td>
<td><%= f.text_field :title, :style => "width: 150px;" %></td>
</tr>
<tr class="external_url">
<td><%= f.blabel :url, :en => "URL" %></td>
<td><%= f.text_field :url, :style => "width: 200px;" %></td>
</tr>
<tr>
<td><label for="content_tag_indent_select"><%= before_label('indent', %{Indent}) %></label></td>
<td>
<select name="content_tag[indent]" id="content_tag_indent_select">
<% 0.upto(3) do |i| %>
<option value="<%= i %>"><%= t('indent.n', { :zero => %{Don't Indent}, :one => %{Indent 1 Level}, :other => %{Indent %{count} Levels} }, :count => i) %></option>
<% end %>
</select>
</td>
</tr>
<tr class="external">
<td colspan="2">
<%= f.check_box :new_tab %>
<%= f.label :new_tab, :en => "Load in a new tab" %>
</td>
</tr>
<tr>
<td colspan="2">
<div class="button-container">
<button type="button" class="btn cancel_button"><%= t('#buttons.cancel', %{Cancel}) %></button>
<button type="submit" class="btn btn-primary"><%= t('#buttons.update', %{Update}) %></button>
</div>
</td>
</tr>
</table>
<% end %>
<form>
<table>
</table>
</form>
</div>
<div id="add_prerequisite_dialog" style="display: none;">
<h3><%= t 'headings.add_prerequisite', 'Add Prerequisite to %{name}', :name => '<span class="name">&nbsp;</span>'.html_safe %></h3>
<p style="display: none;"><%= t('select_prerequisite', %{Select the type of prerequisite. Students cannot see a module until all prerequisites are satisfied.}) %>
<div>
<select class="type" style="display: none;">
<option value="module"><%= t('prerequisites.another_module', %{Another Module}) %></option>
</select>
</div>
</p>
<p class="module_details"><%= t 'module_details', %{Modules are shown in sequential order, so only modules that are above %{name} can be set as prerequisites.}, :name => '<span class="name">&nbsp;</span>'.html_safe %>
<div>
<select class="module_id">
</select>
</div>
</p>
</div>
<div id="student_progression_dialog" style="display: none;" title="<%= t 'titles.student_progression', 'Module Progression by Student' %>">
<h2 style="margin-top: 0;"><%= t('headings.student_progress', %{Module Progress by Student}) %></h2>
<table class="side_tabs_table" style="width: 100%;">
<tr>
<td class="left">
<div style="display: none;">
<%= before_label('sort_by', %{Sort By}) %>
<a href="#"><%= t('links.sort_by_name', %{Name}) %></a> |
<a href="#"><%= t('links.sort_by_progress', %{Progress}) %></a>
</div>
<ul class="side_tabs student_list">
<li class="student blank" style="display: none;">
<a href="#">
<span class="name"><%= t('student_name', %{Student Name}) %></span>
<span class="id" style="display: none;">&nbsp;</span>
</a>
<div class="sub_content current_module"></div>
</li>
</ul>
</td>
<td class="right">
<div class="side_tabs_content">
<div style="text-align: right; padding-right: 5px;">
<a href="#" class="refresh refresh_progressions_link"><%= t('links.reload_student', %{Reload Student's Progress}) %></a>
</div>
<table class="module_progressions" style="width: 100%;">
<thead>
<tr>
<th>&nbsp;</th>
<th><%= t('table_headings.module', %{Module}) %></th>
<th><%= t('table_headings.state', %{State}) %></th>
</tr>
</thead>
<tbody>
<tr class="module blank" style="display: none;">
<td class="icon">
<i class="icon-check"></i>
<i class="icon-lock"></i>
</td>
<td class="details">
<span class="name">&nbsp;</span>
<span class="id" style="display: none;">&nbsp;</span>
<div class="still_need_completing" style="font-size: 0.6em; padding-left: 10px; color: #888; font-weight: normal;">
</div>
</td>
<td class="progress" style="vertical-align: top;">&nbsp;</td>
</tr>
</tbody>
</table>
</div>
</td>
</tr>
</table>
</div>
<div id="module_progression_dialog" style="display: none;">
<h2 style="margin-top: 0;"><%= t 'headings.student_progress_for_module', "Student Progress for %{module}", :module => '<span class="module_name">&nbsp;</span>'.html_safe %></h2>
<div style="max-height: 200px; overflow: auto;">
<div>
<div class="completed_list progression_list" style="margin-bottom: 10px;">
<h3 style="margin: 0;"><%= t('headings.students_completed', %{Students who have Completed the Module}) %></h3>
<ul>
</ul>
</div>
<div class="started_list progression_list" style="margin-bottom: 10px;">
<h3 style="margin: 0;"><%= t('headings.students_in_progress', %{Students who are Working on the Module}) %></h3>
<ul>
</ul>
</div>
<div class="unlocked_list progression_list" style="margin-bottom: 10px;">
<h3 style="margin: 0;"><%= t('headings.students_unlocked', %{Students who have Unlocked (but not started) the Module}) %></h3>
<ul>
</ul>
</div>
<div class="locked_list progression_list" style="margin-bottom: 10px;">
<h3 style="margin: 0;"><%= t('headings.students_locked', %{Students who haven't Unlocked the Module}) %></h3>
<ul>
</ul>
</div>
</div>
</div>
</div>
<% end %>
<div style="display: none;">
<a href="<%= context_url(@context, :progressions_context_context_modules_url) %>" class="progression_list_url">&nbsp;</a>
<a href="<%= context_url(@context, :context_context_modules_assignment_info_url) %>" class="assignment_info_url">&nbsp;</a>
<select id="module_list">
<option value="">[ <%= t('select_module.instructions', %{Select Module}) %> ]</option>
<% @modules.each do |m| %>
<option value="<%= m.id %>" class="context_module_option context_module_<%= m.id %>"><%= t 'select_module.name', 'the module, %{module}', :module => m.name %></option>
<% end %>
</select>
<div id="display_criterion_blank" class="criterion" style="display: none; float: left;">
<span class="id" style="display: none;">&nbsp;</span>
<span class="type" style="display: none;">&nbsp;</span>
<span class="name"><%= t('module', %{module}) %></span>
<span><a href="#" class="delete_prerequisite_link" title="<%= t('links.title.remove_prerequisite', %{Remove this prerequisite}) %>">&#215;</a></span>
</div>
<div id="completion_criterion_option" class="completion_criterion_option">
<% ot 'criterion_for_assignment', 'For %{assignment} users must %{select_criterion}', :assignment => capture { %>
<span style="padding: 0 4px;">
<select class="id assignment_picker">
</select>
</span>
<% }, :select_criterion => capture { %>
<span style="padding: 0 4px;">
<select class="type assignment_requirement_picker">
<option class="any" value="must_view"><%= t('requirements.must_view', %{view the item}) %></option>
<option class="wiki_page discussion_topic" value="must_contribute"><%= t('requirements.must_contribute', %{contribute to the page}) %></option>
<option class="assignment quiz graded" value="must_submit"><%= t('requirements.must_submit', %{submit the assignment}) %></option>
<option class="assignment quiz graded" value="min_score"><%= t('requirements.must_score_at_least', %{score at least}) %></option>
</select>
</span>
<% } %>
<span class="min_score_box" style="display: none;">
<input type="text" class="min_score" style="width: 35px;"/>
<span class="points_possible_parent"><%= t 'assignment_points_possible', 'out of %{points_possible}', :points_possible => '<span class="points_possible">&nbsp;</span>'.html_safe %></span>
</span>
</div>
<%= image_tag "flagged_question_dim.png", :id => "criterion_image_min_score", :class => "image not_blank", :alt => t('images.alt.min_score', "minimum score"), :title => t('images.title.min_score', "Students must get at least a %{min_score} on this item before the module is considered complete", :min_score => "{{ min_score }}") %>
<%= image_tag "preview_dim.png", :id => "criterion_image_must_view", :class => "image not_blank", :alt => t('images.alt.must_view', "must view"), :title => t('images.title.must_view', "Students must view this item before the module is considered complete") %>
<%= image_tag "text_entry_dim.png", :id => "criterion_image_must_submit", :class => "image not_blank", :alt => t('images.alt.must_submit', "must submit"), :title => t('images.title.must_submit', "Students must submit this assignment before the module is considered complete") %>
<%= image_tag "text_entry_dim.png", :id => "criterion_image_must_contribute", :class => "image not_blank", :alt => t('images.alt.must_contribute', "must contribute"), :title => t('images.title.must_contribute', "Students must contribute to this item before the module is considered complete") %>
<%= image_tag "blank.png", :id => "criterion_image_blank", :class => "image", :alt => "" %>
<a href="<%= context_url(@context, :reorder_context_context_modules_url) %>" class="reorder_modules_url">&nbsp;</a>
</div>
<div id="current_user_progression_list" class="user_<%= @current_user && @current_user.id %>" style="display: none;">
<div class="progression progression_blank">
<div class="context_module_id">&nbsp;</div>
<div class="workflow_state">&nbsp;</div>
<div class="requirements_met">&nbsp;</div>
<div class="current_position">&nbsp;</div>
<div class="collapsed">&nbsp;</div>
</div>
</div>
<% if can_do(@context, @current_user, :manage_grades) %>
<div style="display: none;" id="progression_list">
<a href="#" class="progression_list_url">&nbsp;</a>
<% cache([@context, @current_user, 'students_visible_to_user'].cache_key, :no_locale => true) do %>
<% @context.students_visible_to(@current_user).except(:select).select("users.id, users.name").order_by_sortable_name.each do |student| %>
<div class="student student_<%= student.id %>">
<div class="id"><%= student.id %></div>
<div class="name"><%= student.last_name_first %></div>
<div class="current_module">&nbsp;</div>
<div class="progressions">
</div>
</div>
<% end %>
<% end %>
<div class="progression" id="progression_list_blank">
<div class="context_module_id">&nbsp;</div>
<div class="workflow_state">&nbsp;</div>
</div>
</div>
<% end %>
<% content_for :keyboard_navigation do %>
<ul class="navigation_list" tabindex="-1">
<li>
<span class="keycode"><%= t('keycodes.next', %{j}) %></span>
<span class="colon">:</span>
<span class="description"><%= t('key.description.next', %{Next Module/Item}) %></span>
</li>
<li>
<span class="keycode"><%= t('keycodes.previous', %{k}) %></span>
<span class="colon">:</span>
<span class="description"><%= t('key.description.previous', %{Previous Module/Item}) %></span>
</li>
<li>
<span class="keycode"><%= t('keycodes.edit', %{e}) %></span>
<span class="colon">:</span>
<span class="description"><%= t('key.description.edit', %{Edit Module/Item}) %></span>
</li>
<li>
<span class="keycode"><%= t('keycodes.delete', %{d}) %></span>
<span class="colon">:</span>
<span class="description"><%= t('key.description.delete', %{Delete Current Module/Item}) %></span>
</li>
<li>
<span class="keycode"><%= t('keycodes.indent', %{i}) %></span>
<span class="colon">:</span>
<span class="description"><%= t('key.description.indent', %{Indent Current Item}) %></span>
</li>
<li>
<span class="keycode"><%= t('keycodes.outdent', %{o}) %></span>
<span class="colon">:</span>
<span class="description"><%= t('key.description.outdent', %{Outdent Current Item}) %></span>
</li>
<li>
<span class="keycode"><%= t('keycodes.new', %{n}) %></span>
<span class="colon">:</span>
<span class="description"><%= t('key.description.new', %{New Module}) %></span>
</li>
</ul>
<% end %>

View File

@ -6,7 +6,6 @@
:CAN_MANAGE_MODULES => can_do(@context, @current_user, :manage_content),
:COURSE_ID => @context.id,
:NO_MODULE_PROGRESSIONS => @context.large_roster,
:ENABLE_DRAFT => @context.feature_enabled?(:draft_state),
})
%>
<% js_bundle :context_modules %>

View File

@ -1,108 +0,0 @@
<%
editable ||= can_do(@context, @current_user, :manage_content)
workflow_state = context_module && context_module.workflow_state
differentiated_assignments_on = @context.feature_enabled?(:differentiated_assignments)
@modules ||= []
%>
<% cache_if_module(context_module, editable, false, differentiated_assignments_on, @current_user) do %>
<div class="context_module bordered <%= 'unpublished_module' if workflow_state == "unpublished" %> <%= 'editable_context_module' if editable %>" tabindex="0" aria-label="<%= context_module ? context_module.name : "" %>" data-workflow-state="<%= context_module ? context_module.workflow_state : "{{ workflow_state }}"%>" data-module-url="<%= context_url(@context, :context_url) %>/modules/<%= context_module ? context_module.id : "{{ id }}" %>" data-module-id="<%= context_module ? context_module.id : "{{ id }}" %>" id="context_module_<%= context_module ? context_module.id : "blank" %>" style="<%= hidden unless context_module %>">
<a name="module_<%= context_module.id if context_module %>"></a>
<div class="header context-module-header clearfix">
<div class="context-module-left-toolbar">
<span class="reorder_module_link" aria-hidden="true" title="<%= t('reorder_modules', %{Drag to reorder modules}) %>" style="cursor: move; <%= hidden unless @modules.length > 1 && editable %>"><%= image_tag "move.png", :alt => t('reorder_modules', 'Drag to reorder modules') %></span>
<span class="completion_status" style="<%= "visibility: hidden;" if !context_module || (context_module.completion_requirements || []).empty? %>">
<%= image_tag "pass.png", :alt => t('images.alt.complete', "done"), :title => t('images.title.complete', "Module Completed"), :class => "complete_icon" %>
<%= image_tag "blank.png", :alt => t('images.alt.incomplete', "incomplete"), :title => t('images.title.incomplete', "Module Incomplete"), :class => "incomplete_icon" %>
<%= image_tag "lock.png", :alt => t('images.alt.locked', "locked"), :title => t('images.title.locked', "Module Locked"), :class => "locked_icon" %>
</span>
<span class="name" role="heading" aria-level="3"> <%= context_module.try_rescue(:name) || nbsp %></span>
<!--<span class="draft-text <%= 'hide' if workflow_state == "active" %>"><%= t("context_module.draft", "(Draft)") %></span>-->
</div><!-- context-module-left-toolbar -->
<ul class="context-module-toolbar" aria-label='<%= t("module_toolbar.aria.module_options.label", "Module Options") %>'>
<% if editable %>
<li class="context-module-toolbar-item">
<div class="inline-block">
<a class="al-trigger admin-links" role="button" style="padding: 1px" href="#" aria-haspopup="true" title="<%= t('admin_links.module_options_title','Manage Module') %>" aria-describedby='<%= t("admin_links.module_options_label","Manage Module")%>'>
<span class="screenreader-only"><%= t('manage', 'Manage Module') %></span>
<i class="icon-settings"></i><i class="icon-mini-arrow-down"></i>
</a>
<ul class="al-options" role="menubar" aria-hidden="true">
<li role="menuitem">
<a href="#" rel="<%= context_url(@context, :context_url) %>/modules/<%= context_module ? context_module.id : "{{ id }}" %>/items" class="add_module_item_link icon-plus"><%= t('links.add_item', %{Add Content}) %></a>
</li>
<li role="menuitem">
<a href="<%= context_url(@context, :context_url) %>/modules/<%= context_module ? context_module.id : "{{ id }}" %>" class="icon-edit edit_module_link" title="<%= t('links.title.edit_module', %{Edit}) %>"><%= t('links.text.edit_module', %{Edit}) %></a>
</li>
<li role="menuitem">
<a href="<%= context_url(@context, :context_url) %>/modules/<%= context_module ? context_module.id : "{{ id }}" %>" class="delete_module_link icon-trash" title="<%= t('links.title.delete_module', %{Delete this module}) %>"><%= t('links.text.delete_module', %{Delete}) %></a>
</li>
</ul>
</div>
</li>
<% end %>
<li class="context-module-toolbar-item adjust-top" aria-atomic="true" aria-live="assertive">
<a href="<%= context_url(@context, :context_url) %>/modules/<%= context_module ? context_module.id : "{{ id }}" %>/collapse" class="expand_module_link icon icon-expand" title="<%= t('links.show_contents', %{Show module contents}) %>">
<span class="screenreader-only"><%= t('links.show_contents', %{Show module contents}) %></span>
</a>
<a href="<%= context_url(@context, :context_url) %>/modules/<%= context_module ? context_module.id : "{{ id }}" %>/collapse" class="collapse_module_link icon icon-collapse" title="<%= t('links.hide_contents', %{Hide module contents}) %>">
<span class="screenreader-only"><%= t('links.hide_contents', %{Hide module contents}) %></span>
</a>
</li>
<li class="context-module-toolbar-item"><span class="id" style="display: none;"><%= context_module ? context_module.id : nbsp %></span></li>
<li class="context-module-toolbar-item">
<% if context_module.try_rescue(:unlock_at) %>
<%= friendly_datetime(context_module.unlock_at, {context: @context, tag_type: :span}, {class: 'unlock_at'}) %>
<% else %>
<span class="unlock_at"><%= nbsp %></span>
<% end %>
</li>
</ul><!-- end context-module-toolbar -->
<div class="clear"></div>
<div style="display: none;">
<span class="publish_final_grade"><%= context_module.try_rescue(:publish_final_grade?) || nbsp %></span>
<span class="require_sequential_progress"><%= context_module.try_rescue(:require_sequential_progress) || nbsp %></span>
<a href="<%= context_url(@context, :context_url) %>/modules/<%= context_module ? context_module.id : "{{ id }}" %>/reorder" rel="nofollow" class="reorder_items_url" style="display: none;">&nbsp;</a>
</div>
</div>
<div class="content">
<div class="items context_module_items <%= 'manageable' if editable %>" style="min-height: 10px;">
<% if context_module %>
<%
tags = context_module.content_tags_visible_to(@current_user)
tags.each do |tag|
%>
<%= render :partial => 'context_modules/module_item', :object => tag, :locals => {:completion_criteria => context_module.completion_requirements, :editable => editable} %>
<% end %>
<% end %>
</div>
<div class="collapsed">
</div>
</div>
<div class="footer">
<div class="manage_module">
<a href="#" class="add_prerequisite_link edit-small" style="display: none;"><%= t('links.settings', %{Module Settings}) %></a>
</div>
<div class="progression_container">
<a href="#" class="progression_details_link" title="<%= t('links.title.student_progress', %{See Student Progress for this Module}) %>" style="display: none;">
<span class="progression_started"><%= t 'progression_started_count', '*%{count}* In Progress', :count => 0, :wrapper => '<span class="progression_started_count">\1</span>' %></span> <span class="progression_complete"><%= t'progression_complete_count', '*%{count}* Complete', :count => 0, :wrapper => '<span class="progression_complete_count">\1</span>' %></span>
</a>
<span class="progression_state" style="<%= hidden if editable || !context_module || ((context_module.prerequisites || []).empty? && (context_module.completion_requirements || []).empty?) %>"></span>
<div class="unlock_details" style="<%= hidden unless context_module && context_module.to_be_unlocked %>">
<%= t 'module_will_unlock_at', 'Will unlock *%{unlock_date}*', :wrapper => "<span class=\"unlock_at\" #{context_sensitive_datetime_title(context_module.try_rescue(:unlock_at), @context)}>\\1</span>", :unlock_date => (datetime_string(context_module.try_rescue(:unlock_at)) || nbsp) %>
</div>
</div><!-- progression_container -->
<div class="clear"></div>
<%= render :partial => "context_modules/prerequisits_footer", :locals => {:editable => editable, :context_module => context_module} %>
<div class="clear"></div>
</div><!-- footer -->
</div>
<% end %>

View File

@ -7,7 +7,7 @@
differentiated_assignments_on = @context.feature_enabled?(:differentiated_assignments)
@modules ||= []
%>
<% cache_if_module(context_module, editable, true, differentiated_assignments_on, @current_user) do %>
<% cache_if_module(context_module, editable, differentiated_assignments_on, @current_user) do %>
<div
class="item-group-condensed context_module

View File

@ -1,96 +0,0 @@
<% tag = module_item || nil; completion_criteria ||= nil; editable ||= false
@module_item_image_tags ||= {
'min_score' => image_tag("flagged_question_dim.png", :class => "image not_blank", :alt => t('images.alt.min_score', "minimum score"), :title => t('images.title.min_score', "Students must reach the minimum score on this item before the module is considered complete"), :style => "vertical-align: top; padding-top: 2px;"),
'max_score' => image_tag("flagged_question_dim.png", :class => "image not_blank", :alt => t('images.alt.max_score', "maximum score"), :title => t('images.title.max_score', "Students must not exceed the maximum score on this item before the module is considered complete"), :style => "vertical-align: top; padding-top: 2px;"),
'must_view' => image_tag("preview_dim.png", :class => "image not_blank", :alt => t('images.alt.must_view', "must view"), :title => t('images.title.must_view', "Students must view this item before the module is considered complete"), :style => "vertical-align: top; padding-top: 2px;"),
'must_contribute' => image_tag("text_entry_dim.png", :class => "image not_blank", :alt => t('images.alt.must_contribute', "must contribute"), :title => t('images.title.must_contribute', "Students must contribute to this item before the module is considered complete"), :style => "vertical-align: top; padding-top: 2px;"),
'must_submit' => image_tag("text_entry_dim.png", :class => "image not_blank", :alt => t('images.alt.must_submit', "must submit"), :title => t('images.title.must_submit', "Students must submit this assignment before the module is considered complete"), :style => "vertical-align: top; padding-top: 2px;"),
'indent' => "<i class='icon-arrow-right standalone-icon'></i>".html_safe,
'outdent' => "<i class='icon-arrow-left standalone-icon'></i>".html_safe,
'edit' => "<i class='icon-edit standalone-icon'></i>".html_safe,
'delete' => "<i class='icon-end standalone-icon'></i>".html_safe,
'other' => image_tag("blank.png", :class => "image", :alt => '')
}
%>
<% criterion = completion_criteria && completion_criteria.find{|c| c[:id] == tag.id} %>
<table id="context_module_item_<%= tag ? tag.id : "blank" %>" tabindex="0" aria-label='<%= t('module.item_aria_label', "%{item_label} Module Item", :item_label => (tag ? tag.title : "")) %>' class="context_module_item <%= module_item.content_type_class if module_item %> <%= 'also_assignment' if module_item && module_item.graded? %> indent_<%= tag.try_rescue(:indent) || '0' %> <%= 'progression_requirement' if criterion %> <%= criterion[:type] if criterion %>_requirement <%= module_item.item_class if module_item %>" style="<%= hidden unless module_item %>">
<tr>
<td class="module_item_icons nobr">
<span style="cursor: move;" aria-hidden="true" title="<%= t('drag_to_reorder', %{Drag to reorder or move item to another module}) %>" class="move_item_link"><%= image_tag "move.png" %></span>
<span class="completion_status">
<%= image_tag "blank.png", :alt => t('images.alt.complete', "done"), :title => t('images.title.complete', "Module Item Completed"), :class => "complete_item_icon" %>
<%= image_tag "blank.png", :alt => t('images.alt.incomplete', "incomplete"), :title => t('images.title.incomplete', "Module Item Incomplete"), :class => "incomplete_item_icon" %>
</span>
<span class="type_icon" title="<%= module_item.content_type if module_item %>">
<i class="icon-document" aria-label="Item type: Document"></i>
<i class="icon-download" aria-label="Item type: Download"></i>
<i class="icon-discussion" aria-label="Item type: Discussion"></i>
<i class="icon-assignment" aria-label="Item type: Assignment"></i>
<i class="icon-quiz" aria-label="Item type: Quiz"></i>
<i class="icon-link" aria-label="Item type: Link"></i>
</span>
<span class="criterion <%= 'defined' if criterion %>">
<span class="min_score" style="display: none;"><%= (criterion && criterion[:min_score]) || nbsp %></span>
<span class="criterion_type" style="display: none;"><%= (criterion && criterion[:type]) || nbsp %></span>
</span>
<span class="type" style="display: none;"><%= tag ? tag.content_type_class : nbsp %></span>
<span class="id" style="display: none;"><%= tag ? tag.id : nbsp %></span>
<span class="graded" style="display: none;"><%= tag && tag.graded? ? '1' : '0' %></span>
</td><!-- module_item_icons -->
<td style="text-align: left;" class="item_name">
<% if tag && tag.content_type == 'ExternalUrl' && tag.new_tab %>
<a aria-label='<%= tag.title %>' class="title external_url_link" target="_blank" href="<%= tag.url %>"
data-item-href="<%= context_url(@context, :context_url) %>/modules/items/<%= tag.id %>"><%= tag.title %></a>
<% else %>
<a aria-label='<%= tag && tag.title %>' class="title" href="<%= context_url(@context, :context_url) %>/modules/items/<%= tag ? tag.id : "{{ id }}" %>"><%= tag && tag.title %></a>
<% end %>
<span class="title locked_title"><%= tag && tag.title %></span>
<span class="points_possible" style="display: none;"><%= tag.try_rescue(:assignment).try_rescue(:points_possible) || nbsp %></span>
<span class="requirement" style="display: none;">&nbsp;</span>
<span class="completion_requirement" style="display: none;">&nbsp;</span>
<span class="position" style="display: none;"><%= tag && tag.position %></span>
<span class="url" style="display: none;"><%= tag.try(:url) if editable %></span>
<span class="new_tab" style="display: none;"><%= tag.try(:new_tab) ? '1' : '0' if editable %></span>
<div class="completion_requirement">
<div class="requirement_type min_score_requirement">
<% score_display = content_tag(:span, criterion && criterion[:min_score] || nbsp, class: 'min_score') %>
<span class="unfulfilled"><%= t 'min_score.unfulfilled', 'must score at least a %{score}', :score => score_display %></span>
<span class="fulfilled"><%= t 'min_score.fulfilled', 'scored at least a %{score}', :score => score_display %></span>
</div>
<div class="requirement_type max_score_requirement">
<% score_display = content_tag(:span, criterion && criterion[:max_score] || nbsp, class: 'min_score') %>
<span class="unfulfilled"><%= t 'max_score.unfulfilled', 'must score no more than a %{score}', :score => score_display %></span>
<span class="fulfilled"><%= t 'max_score.fulfilled', 'scored no more than a%{score}', :score => score_display %></span>
</div>
<div class="requirement_type must_view_requirement">
<span class="unfulfilled"><%= t('must_view.unfulfilled', %{must view the page}) %></span>
<span class="fulfilled"><%= t('must_view.fulfilled', %{viewed the page}) %></span>
</div>
<div class="requirement_type must_contribute_requirement">
<span class="unfulfilled"><%= t('must_contribute.unfulfilled', %{must contribute to the content of the page}) %></span>
<span class="fulfilled"><%= t('must_contribute.fulfilled', %{contributed to the content of the page}) %></span>
</div>
<div class="requirement_type must_submit_requirement">
<span class="unfulfilled"><%= t('must_submit.unfulfilled', %{must submit the assignment}) %></span>
<span class="fulfilled"><%= t('must_submit.fulfilled', %{submitted the assignment}) %></span>
</div>
</div>
</td><!-- .item_name -->
<td class="due_date_display">&nbsp;</td>
<td class="points_possible_display">&nbsp;</td>
<td class="links">
&nbsp;
<a href="<%= context_url(@context, :context_url) %>/modules/items/<%= tag ? tag.id : "{{ id }}" %>" aria-label="<%= t('links.outdent_label', %{Decrease indent}) %>" class="outdent_item_link" title="<%= t('links.outdent', %{Decrease indent}) %>"><%= @module_item_image_tags['outdent'] %></a>
<a href="<%= context_url(@context, :context_url) %>/modules/items/<%= tag ? tag.id : "{{ id }}" %>" aria-label="<%= t('links.indent_label', %{Increase indent}) %>" class="indent_item_link" title="<%= t('links.indent', %{Increase indent}) %>"><%= @module_item_image_tags['indent'] %></a>
<a href="<%= context_url(@context, :context_url) %>/modules/items/<%= tag ? tag.id : "{{ id }}" %>" aria-label="<%= t('links.edit_item_details_label', %{Edit item details}) %>" class="edit_item_link edit_link" title="<%= t('links.edit_item', %{Edit item details}) %>"><%= @module_item_image_tags['edit'] %></a>
<a href="<%= context_url(@context, :context_url) %>/modules/items/<%= tag ? tag.id : "{{ id }}" %>" aria-label="<%= t('links.remove_item_label', %{Remove this item from the module}) %>" class="delete_item_link delete_link" title="<%= t('links.remove_item', %{Remove this item from the module}) %>"><%= @module_item_image_tags['delete'] %></a>
</td>
</tr>
</table>

View File

@ -6,11 +6,8 @@
jammit_css :modules_next
js_bundle :modules
%>
<% elsif @context.feature_enabled?(:draft_state) %>
<% jammit_css :context_modules2 %>
<%= render :partial => "context_modules/content_next" %>
<% else %>
<% jammit_css :context_modules2 %>
<%= render :partial => "context_modules/content" %>
<%= render :partial => "context_modules/content_next" %>
<% end %>

View File

@ -1,7 +1,5 @@
<% content_for :page_title, @context.name %>
<% if @context.feature_enabled?(:draft_state) %>
<% jammit_css :course_show %>
<% end %>
<% jammit_css :course_show %>
<% @active_tab ||= "home" %>
<h1 class='screenreader-only'><%= @context.name %></h1>
<% content_for :auto_discovery do %>
@ -15,39 +13,37 @@
<% content_for :right_side do %>
<div id="course_show_secondary">
<% @can_manage_content = can_do(@context, @current_user, :manage_content) %>
<% if @context.feature_enabled?(:draft_state) %>
<% if @can_manage_content && can_do(@context, @current_user, :change_course_state) && @context.unpublishable? %>
<div id="course_status" class="text-center">
<h4>
<%= t('headers.course_status', %{Course Status}) %>
</h4>
<div id='course_status_actions' class="ui-buttonset">
<%= form_for @context do |f| %>
<% if @context.created? || @context.claimed? %>
<button type="button" class='ui-button btn-unpublish disabled'>
<i class="icon-unpublish"></i>
<%= t('#buttons.unpublished', %{Unpublished}) %>
</button>
<button type='submit' class="ui-button btn-publish">
<i class="icon-unpublished"></i>
<%= t('#buttons.publish', %{Publish}) %>
</button>
<input type='hidden' name='course[event]' value='offer' />
<% else %>
<button type='submit' class="ui-button">
<i class="icon-unpublish"></i>
<%= t('#buttons.unpublish', %{Unpublish}) %>
</button>
<button type="button" class="ui-button disabled btn-published">
<i class="icon-publish"></i>
<%= t('#buttons.published', %{Published}) %>
</button>
<input type='hidden' name='course[event]' value='claim' />
<% end %>
<% if @can_manage_content && can_do(@context, @current_user, :change_course_state) && @context.unpublishable? %>
<div id="course_status" class="text-center">
<h4>
<%= t('headers.course_status', %{Course Status}) %>
</h4>
<div id='course_status_actions' class="ui-buttonset">
<%= form_for @context do |f| %>
<% if @context.created? || @context.claimed? %>
<button type="button" class='ui-button btn-unpublish disabled'>
<i class="icon-unpublish"></i>
<%= t('#buttons.unpublished', %{Unpublished}) %>
</button>
<button type='submit' class="ui-button btn-publish">
<i class="icon-unpublished"></i>
<%= t('#buttons.publish', %{Publish}) %>
</button>
<input type='hidden' name='course[event]' value='offer' />
<% else %>
<button type='submit' class="ui-button">
<i class="icon-unpublish"></i>
<%= t('#buttons.unpublish', %{Unpublish}) %>
</button>
<button type="button" class="ui-button disabled btn-published">
<i class="icon-publish"></i>
<%= t('#buttons.published', %{Published}) %>
</button>
<input type='hidden' name='course[event]' value='claim' />
<% end %>
</div>
<% end %>
</div>
<% end %>
</div>
<% if @can_manage_content || @course_home_view != 'feed' || @course_home_sub_navigation_tools.present? %>
<div class="course-options">
@ -122,16 +118,11 @@
<%= render :partial => "group_list", :object => @user_groups %>
<%= nbsp unless @current_user %>
</div>
<% if @course_home_view == 'wiki' %>
<% unless @context.feature_enabled?(:draft_state) %>
<% js_bundle :wiki %>
<%= render :partial => "wiki_pages/wiki_right_side", :locals => {:course_home => true} %>
<% end %>
<% elsif @course_home_view == 'assignments' %>
<% if @course_home_view == 'assignments' %>
<%= render :partial => 'assignments/assignments_list_right_side', :locals => {:course_home => true} %>
<% elsif @course_home_view == 'syllabus' %>
<%= render :partial => 'assignments/syllabus_right_side', :locals => {:course_home => true} %>
<% else %>
<% elsif @course_home_view != 'wiki' %>
<% locals = {:title => "Coming Up", :display_count => 3, :period => "the next week", :contexts_to_link_to => @context, :upcoming => true} %>
<% if @current_user %>
<% cache(safe_cache_key([@current_user, @contexts, 'course_upcoming_events' ])) do %>
@ -183,120 +174,48 @@
<%= render :partial => 'shared/dashboard_invitation', :object => @pending_enrollment %>
<% end %>
<% if @context.feature_enabled?(:draft_state)
has_front_page = @context.wiki && @context.wiki.front_page %>
<% content_for :right_side do %>
<div id="edit_course_home_content" style="display: none;">
<h2><%= t('draft_state.headings.set_layout', %{Set Home Page Layout}) %></h2>
<%= form_for :course, :url => context_url(@context, :context_url), :html => {:tabindex=>"0", :'data-turn-into-dialog'=>'{"height": 300, "width":500,"modal":true}', :title=>t('headings.choose_home_page_title', %{Choose Home Page}), :style => "display:none", :id => "edit_course_home_content_form", :method => :put} do |f| %>
<label for="edit_course_home_content_select"><%= t('draft_state.labels.select_content', %{Select what you'd like to display on the home page.}) %></label>
<div class="form_group"><label class="radio"><input type="radio" name="course[default_view]" value="feed" <%= 'checked' if @context.default_view == 'feed' || (!has_front_page && @context.default_view == 'wiki') %>><%= t('draft_state.options.course_activity_stream', %{Course Activity Stream}) %></label></div>
<div class="form_group">
<label class="radio"><input type="radio" name="course[default_view]" value="wiki" <%= 'checked' if has_front_page && @context.default_view == 'wiki' %><%= 'disabled' unless has_front_page %>>
<span class="<%= 'ui-state-disabled' unless has_front_page %>"><%= t('draft_state.options.custom_page', %{Pages Front Page}) %></span></label>
<% if has_front_page %>
<small>&emsp;<%= @context.wiki.front_page.title %>&emsp;[ <%= link_to t('change_home_page', 'Change'), polymorphic_url([@context, :wiki_pages]) %> ]</small>
<% else %>
<small>&emsp;[ <%= link_to t('front_page_not_set', 'Front page must be set first'), polymorphic_url([@context, :wiki_pages]) %> ]</small>
<% end %>
</div>
<div class="form_group"><label class="radio"><input type="radio" name="course[default_view]" value="modules" <%= 'checked' if @context.default_view == 'modules' %>><%= t('draft_state.options.modules', %{Course Modules}) %></label></div>
<div class="form_group"><label class="radio"><input type="radio" name="course[default_view]" value="assignments" <%= 'checked' if @context.default_view == 'assignments' %>><%= t('draft_state.options.assignments', %{Assignments List}) %></label></div>
<div class="form_group"><label class="radio"><input type="radio" name="course[default_view]" value="syllabus" <%= 'checked' if @context.default_view == 'syllabus' %>><%= t('draft_state.options.syllabus', %{Syllabus}) %></label></div>
<div class="button-container">
<a type="button" class="btn button-secondary dialog_closer"><%= t('draft_state.buttons.cancel', %{Cancel}) %></a>
<button type="submit" class="btn btn-primary"><%= t('draft_state.buttons.update_layout', %{Save}) %></button>
</div>
<% end %>
</div>
<% end %>
<% else %>
<% has_front_page = @context.wiki && @context.wiki.front_page %>
<% content_for :right_side do %>
<div id="edit_course_home_content" style="display: none;">
<%= form_for :course, :url => context_url(@context, :context_url), :html => {:id => "edit_course_home_content_form", :method => :put} do |f| %>
<h2><%= t('headings.set_layout', %{Set Home Page Layout}) %></h2>
<p>
<label for="edit_course_home_content_select"><strong><%= t('labels.select_content', %{When people visit the course page, show them}) %></strong></label>
<select name="course[default_view]" id="edit_course_home_content_select">
<option value="feed" <%= 'selected' if @context.default_view == 'feed' %>><%= t('options.recent_activity_dashboard', %{the Recent Activity Dashboard}) %></option>
<option value="wiki" <%= 'selected' if @context.default_view == 'wiki' %>><%= t('options.custom_page', %{a Page I'll Design Myself}) %></option>
<option value="modules" <%= 'selected' if @context.default_view == 'modules' %>><%= t('options.modules', %{the Course Modules/Sections}) %></option>
<option value="assignments" <%= 'selected' if @context.default_view == 'assignments' %>><%= t('options.assignments', %{the Assignment List}) %></option>
<option value="syllabus" <%= 'selected' if @context.default_view == 'syllabus' %>><%= t('options.syllabus', %{the Assignments with Syllabus}) %></option>
</select>
</p>
<div class="select_details ui-state-highlight ui-corner-all" style="display: none; padding: 1em; font-size: 12px;">
<div class="feed_details options_details">
<%= mt 'details.recent_activity_dashboard', "The **recent activity dashboard** lets participants see the most recent conversations, announcements, discussions, and interactions for this course. It's very similar to the dashboard page users see when they first log in, but only shows content for this specific course." %>
</div>
<div class="wiki_details options_details">
<%= mt 'details.custom_page', "You can **design your own course home page** and include whatever links, images or rich media you like." %>
</div>
<div class="modules_details options_details">
<%= mt 'details.modules', "You can organize your course into **modules or sections**, where each section contains a related set of files, assignments, pages, etc. If you want, you can also sequence modules by defining criteria and prerequisites that need to be completed before each module is unlocked.
<h2><%= t('draft_state.headings.set_layout', %{Set Home Page Layout}) %></h2>
<%= form_for :course, :url => context_url(@context, :context_url), :html => {:tabindex=>"0", :'data-turn-into-dialog'=>'{"height": 300, "width":500,"modal":true}', :title=>t('headings.choose_home_page_title', %{Choose Home Page}), :style => "display:none", :id => "edit_course_home_content_form", :method => :put} do |f| %>
<label for="edit_course_home_content_select"><%= t('draft_state.labels.select_content', %{Select what you'd like to display on the home page.}) %></label>
-This layout is probably best for courses that aren't based on a specific schedule like a term or semester." %>
</div>
<div class="assignments_details options_details">
<%= mt 'details.assignments', "This view shows the **list of assignments** for this course, with upcoming and recent assignments at the top." %>
</div>
<div class="syllabus_details options_details">
<%= mt 'details.syllabus', "The **syllabus view** lets you write up a description of course expectations or introduce the course with links, images, etc. and then also shows a calendar view of all assignments and course events." %>
</div>
<div class="form_group"><label class="radio"><input type="radio" name="course[default_view]" value="feed" <%= 'checked' if @context.default_view == 'feed' || (!has_front_page && @context.default_view == 'wiki') %>><%= t('draft_state.options.course_activity_stream', %{Course Activity Stream}) %></label></div>
<div class="form_group">
<label class="radio"><input type="radio" name="course[default_view]" value="wiki" <%= 'checked' if has_front_page && @context.default_view == 'wiki' %><%= 'disabled' unless has_front_page %>>
<span class="<%= 'ui-state-disabled' unless has_front_page %>"><%= t('draft_state.options.custom_page', %{Pages Front Page}) %></span></label>
<% if has_front_page %>
<small>&emsp;<%= @context.wiki.front_page.title %>&emsp;[ <%= link_to t('change_home_page', 'Change'), polymorphic_url([@context, :wiki_pages]) %> ]</small>
<% else %>
<small>&emsp;[ <%= link_to t('front_page_not_set', 'Front page must be set first'), polymorphic_url([@context, :wiki_pages]) %> ]</small>
<% end %>
</div>
<div class="form_group"><label class="radio"><input type="radio" name="course[default_view]" value="modules" <%= 'checked' if @context.default_view == 'modules' %>><%= t('draft_state.options.modules', %{Course Modules}) %></label></div>
<div class="form_group"><label class="radio"><input type="radio" name="course[default_view]" value="assignments" <%= 'checked' if @context.default_view == 'assignments' %>><%= t('draft_state.options.assignments', %{Assignments List}) %></label></div>
<div class="form_group"><label class="radio"><input type="radio" name="course[default_view]" value="syllabus" <%= 'checked' if @context.default_view == 'syllabus' %>><%= t('draft_state.options.syllabus', %{Syllabus}) %></label></div>
<div class="button-container">
<button type="submit" class="btn"><%= t('buttons.update_layout', %{Update Layout}) %></button>
<button type="button" class="btn button-secondary cancel_button"><%= t('#buttons.cancel', %{Cancel}) %></button>
<a type="button" class="btn button-secondary dialog_closer"><%= t('draft_state.buttons.cancel', %{Cancel}) %></a>
<button type="submit" class="btn btn-primary"><%= t('draft_state.buttons.update_layout', %{Save}) %></button>
</div>
<% end %>
</div>
<div class="clear"></div>
<% end %>
<div id="course_home_content">
<% unless @context.feature_enabled?(:draft_state) %>
<div style="float: right; text-align: left;" class="floating_links clearfix">
<% if can_do(@context, @current_user, :manage_content) || @course_home_view != 'feed' %>
<div style="font-size: 0.9em;">
<% if can_do(@context, @current_user, :manage_content) %>
<a href="<%= context_url(@context, :context_details_url) %>" class="edit_course_home_content_link"><%= t('links.change_layout', %{Change Home Page Layout}) %></a>
<% end %>
<% if can_do(@context, @current_user, :manage_content) && @course_home_view != 'feed' %>
|
<% end %>
<% if @course_home_view != 'feed' %>
<a href="<%= context_url(@context, :context_url, :view => 'feed') %>"><%= t('links.course_stream', %{See Course Stream}) %></a>
<% end %>
</div>
<% end %>
</div>
<% end %>
<% if @course_home_view == 'wiki' %>
<% if @context.feature_enabled?(:draft_state)
js_bundle :wiki_page_show %>
<div id="wiki_page_show"></div>
<% else %>
<%= render :partial => "wiki_pages/content", :locals => {:course_home => true } %>
<% end %>
<% js_bundle :wiki_page_show %>
<div id="wiki_page_show"></div>
<% elsif @course_home_view == 'modules' %>
<% if @context.feature_enabled?(:draft_state) %>
<%= render :partial => 'context_modules/content_next', :locals => {:course_home => true} %>
<% else %>
<%= render :partial => 'context_modules/content', :locals => {:course_home => true} %>
<% end %>
<%= render :partial => 'context_modules/content_next', :locals => {:course_home => true} %>
<% elsif @course_home_view == 'assignments' %>
<% if @context.feature_enabled?(:draft_state) %>
<%
@body_classes << 'hide-content-while-scripts-not-loaded'
@body_classes << 'with_item_groups'
js_bundle :assignment_index
jammit_css :new_assignments
%>
<% else %>
<%= render :partial => 'assignments/assignments_list_content', :locals => {:course_home => true} %>
<% end %>
<%
@body_classes << 'hide-content-while-scripts-not-loaded'
@body_classes << 'with_item_groups'
js_bundle :assignment_index
jammit_css :new_assignments
%>
<% elsif @course_home_view == 'syllabus' %>
<%= render :partial => 'assignments/syllabus_content', :locals => {:course_home => true} %>
<% else %>

View File

@ -33,7 +33,7 @@
jammit_css :tinymce, :discussions, :learning_outcomes
%>
<% if @topic.draft_state_enabled? && @unlock_at && @unlock_at > Time.now && !can_do(@context, @current_user, :moderate_forum) %>
<% if @unlock_at && @unlock_at > Time.now && !can_do(@context, @current_user, :moderate_forum) %>
<div id="discussion-managebar" class="toolbarView">
<div class="headerBar">
<div class="topic">
@ -55,7 +55,7 @@
<div class="headerBar">
<div class="row-fluid form-inline" style="overflow: visible;">
<div class="pull-right">
<% if @topic.draft_state_enabled? && can_do(@context, @current_user, :moderate_forum) %>
<% if can_do(@context, @current_user, :moderate_forum) %>
<button
id="topic_publish_button"
data-id='<%= @topic.id %>'
@ -197,39 +197,14 @@
<div class="discussion-section message_wrapper">
<div data-bind="message" class="message user_content"><%= user_content(@topic.message) %></div>
<% if @topic.draft_state_enabled? %>
<% if @locked %>
<div class="discussion-fyi">
<% if @topic.is_a? Announcement %>
<%= t 'announcement_closed', 'This announcement is closed for comments' %>
<% else %>
<%= @locked.is_a?(Hash) ? lock_explanation(@locked, 'topic', @context) : t(:locked, "This topic is closed for comments") %>
<% end %>
</div>
<% end %>
<% else %>
<% if @topic.post_delayed? %>
<div class="discussion-fyi">
<% if @topic.is_a? Announcement %>
<% if @topic.delayed_post_at %>
<%= t 'announcement_locked', 'This announcement will not be visible to users until *%{date}*', :date => datetime_string(@topic.delayed_post_at) %>
<% else %>
<%= t 'announcement_not_visible', 'This announcement is not visible to users' %>
<% end %>
<% else %>
<% if @topic.delayed_post_at %>
<%= t 'topic_locked', 'This topic will not be visible to users until *%{date}*',:date => datetime_string(@topic.delayed_post_at) %>
<% else %>
<%= t 'topic_not_visible', 'This topic is not visible to users' %>
<% end %>
<% end %>
</div>
<% end %>
<% if @locked %>
<div class="discussion-fyi">
<%= t 'locked', 'This topic is closed for comments' %>
</div>
<% end %>
<% if @locked %>
<div class="discussion-fyi">
<% if @topic.is_a? Announcement %>
<%= t 'announcement_closed', 'This announcement is closed for comments' %>
<% else %>
<%= @locked.is_a?(Hash) ? lock_explanation(@locked, 'topic', @context) : t(:locked, "This topic is closed for comments") %>
<% end %>
</div>
<% end %>
<% if @topic.editor_id && @topic.user_id && @topic.editor_id != @topic.user_id %>
@ -323,7 +298,7 @@
</div>
<% if @context.feature_enabled?(:draft_state) && @headers != false %>
<% if @headers != false %>
<div id="module_sequence_footer"></div>
<% else %>
<%=

View File

@ -1,26 +1,23 @@
{{#if draftStateEnabled}}
{{#if title}}
<h1 class="screenreader-only" style="display: inline">{{title}}</h1>
{{else}}
<h1 class="screenreader-only" style="display: inline">{{#t "page_header_title"}}New Discussion{{/t}}</h1>
{{/if}}
<div class="discussion-edit-header row-fluid">
<div class="span4 offset8 text-right">
{{#if published}}
<span id="topic-draft-state" class="published-status published">
<i class="icon-publish"></i>
{{#t "buttons.published"}}Published{{/t}}
</span>
{{else}}
<span id="topic-draft-state" class="published-status unpublished">
<i class="icon-unpublished"></i>
{{#t "buttons.not_published"}}Not Published{{/t}}
</span>
{{/if}}
</div>
</div>
{{#if title}}
<h1 class="screenreader-only" style="display: inline">{{title}}</h1>
{{else}}
<h1 class="screenreader-only" style="display: inline">{{#t "page_header_title"}}New Discussion{{/t}}</h1>
{{/if}}
<div class="discussion-edit-header row-fluid">
<div class="span4 offset8 text-right">
{{#if published}}
<span id="topic-draft-state" class="published-status published">
<i class="icon-publish"></i>
{{#t "buttons.published"}}Published{{/t}}
</span>
{{else}}
<span id="topic-draft-state" class="published-status unpublished">
<i class="icon-unpublished"></i>
{{#t "buttons.not_published"}}Not Published{{/t}}
</span>
{{/if}}
</div>
</div>
<fieldset>
<div class="control-group">

View File

@ -49,7 +49,7 @@
</div>
<div class="discussion-status">
<span id="publish-icon" class="publish-icon" {{#if ENV.DRAFT_STATE}} data-view="publishIcon" {{/if}}></span>
<span id="publish-icon" class="publish-icon" data-view="publishIcon"></span>
<a href="#" data-view="toggleableSubscriptionIcon" class="subscription-toggler">
<span class="screenreader-only">
{{#if subscribed}}

View File

@ -270,9 +270,7 @@
<div class="new" style="margin-top: 5px;">
<%= before_label :topic_name, "Topic Name" %>
<input type="text" name="title" class="item_title" aria-label="<%= before_label :topic_name, "Topic Name" %>" />
<% if @context.feature_enabled? :draft_state %>
<input type="hidden" name="published" value="false"/>
<% end %>
<input type="hidden" name="published" value="false"/>
<a href="<%= context_url(@context, :api_v1_context_discussion_topics_url) %>" style="display: none;" class="add_item_url">&nbsp;</a>
</div>
</div>

View File

@ -1,24 +1,4 @@
<% context ||= @context; asset ||= nil %>
<% if context && context.is_a?(Course) && asset && @headers != false %>
<% if context.feature_enabled?(:draft_state) %>
<div id="sequence_footer" class="draft_state_enabled" data-course-id="<%= context.id %>" data-asset-id="<%= asset.id %>" data-asset-type="<%= Api::API_DATA_TYPE[asset.class.to_s] || asset.class.to_s %>"></div>
<% else %>
<div id="sequence_footer" style="display: none;">
<a class="prev btn" href="#">
<i class="icon-arrow-left"></i> <span class="text"><%= t(:previous, "Previous") %></span>
<span class="title ellipsis"></span>
</a>
<a class="next btn" href="#">
<span class="text"><%= t(:next, "Next") %></span> <i class="icon-arrow-right"></i>
<span class="title ellipsis"></span>
</a>
<a href="<%= context_url(context, :context_context_modules_item_details_url, asset.asset_string, :module_item_id => params[:module_item_id]) %>" style="display: none;" class="sequence_details_url">&nbsp;</a>
<a href="<%= context_url(context, :context_context_modules_item_redirect_url, "{{ id }}") %>" class="module_item_url" style="display: none;">&nbsp;</a>
<a href="<%= context_url(context, :context_context_module_url, "{{ id }}") %>" class="module_url" style="display: none;">&nbsp;</a>
<div class="all">
<a href="<%= context_url(context, :context_context_modules_url) %>"><%= t :full_course_sequence, "see full course sequence" %></a>
</div>
<div class="clear"></div>
</div>
<% end %>
<div id="sequence_footer" data-course-id="<%= context.id %>" data-asset-id="<%= asset.id %>" data-asset-type="<%= Api::API_DATA_TYPE[asset.class.to_s] || asset.class.to_s %>"></div>
<% end %>

View File

@ -1,10 +0,0 @@
<% skip_front_page ||= false; page_link ||= nil; wiki_page = page_link; hidden ||= false %>
<% if !wiki_page %>
<li class="ellipsis" style="<%= 'display: none;' if hidden %>"><%= link_to t('#wiki_pages.front_page', "Front Page"), polymorphic_url([@context, @context.wiki.front_page]) %></li>
<% elsif skip_front_page && wiki_page.is_front_page? %>
<% else %>
<% if can_do(@context, @current_user, :manage_content) || wiki_page.published? %>
<li class="ellipsis" style="<%= 'display: none;' if hidden %><%= 'font-weight: bold;' if @page && wiki_page == @page %><%= 'font-style: italic;' unless wiki_page.published? %>" title="<%= t(:link_hidden_from_students_warning, "Students won't see this link") unless wiki_page.published? %>"><%= link_to wiki_page.title, polymorphic_url([@context, wiki_page]) rescue "" %>
</li>
<% end %>
<% end %>

View File

@ -1,115 +0,0 @@
<% course_home ||= false %>
<% cache([@page, @context, @wiki, @current_user, 'wiki_sidebar_links_partial'].cache_key) do %>
<div id="wiki_show_view_secondary">
<% if !course_home && can_do(@wiki, @current_user, :manage) && @context.wiki.wiki_pages.length < 2 %>
<div class="rs-margin-lr rs-margin-top">
<p>
<b><%= t :wiki_description_header, "What's a wiki for?" %></b>
<% if @context.is_a?(Course) %>
<%= t :wiki_description_for_course, <<-EOT
Think of it as an open-ended place to hold content. You could use it to describe your course, to provide
helpful explanations of difficult topics, or even to let students work together on writing projects.
EOT
%>
<% elsif @context.is_a?(Group) %>
<%= t :wiki_description_for_group, <<-EOT
Think of it as an open-ended place to hold content. You could use it to describe your group, to provide
helpful explanations of difficult topics, or even to let members work together on writing projects.
EOT
%>
<% end %>
</p>
</div>
<% end %>
<div>
<% pages = Canvas::ICU.collate_by(@context.wiki.wiki_pages.not_deleted.select{|p| !p.new_record? }){|p| p.title || CanvasSort::First} %>
<% if pages.length > 10 %>
<h2><%= t 'headers.common_pages', 'Common Pages' %></h2>
<div class="rs-margin-lr rs-margin-bottom">
<ul class="item_list limit_height" style="max-height: 100px;">
<%= render :partial => 'wiki_pages/page_link' %>
<% common_pages = pages.sort_by{|p| p.view_count} %>
<%= render :partial => 'wiki_pages/page_link', :collection => common_pages[0..3], :locals => {:skip_front_page => true} %>
<li><a href="#" class="more_pages_link" style="padding-left: 20px; font-size: 0.9em; <%= hidden unless common_pages.length > 4 %>"><%= t 'links.more', 'more...' %></a></li>
<%= render :partial => 'wiki_pages/page_link', :collection => common_pages[4..9], :locals => {:skip_front_page => true, :hidden => true} %>
</ul>
</div>
<% end %>
<% if pages.length > 6 %>
<h2><%= t 'headers.recent_changes', 'Recent Changes' %></h2>
<div class="rs-margin-lr rs-margin-bottom">
<ul class="item_list limit_height" style="max-height: 100px;">
<% recent_pages = pages.sort_by{|p| p.last_revision_at}.reverse %>
<%= render :partial => 'wiki_pages/page_link', :collection => recent_pages[0..2] %>
<li><a href="#" class="more_pages_link" style="padding-left: 20px; font-size: 0.9em; <%= hidden unless recent_pages.length > 3 %>"><%= t 'links.more', 'more...' %></a></li>
<%= render :partial => 'wiki_pages/page_link', :collection => recent_pages[3..9], :locals => {:skip_front_page => true, :hidden => true} %>
</ul>
</div>
<% end %>
<h2><%= t 'headers.all_pages', 'All Pages' %></h2>
<div class="rs-margin-lr rs-margin-bottom">
<% if pages.length < 8 %>
<ul class="item_list limit_height">
<%= render :partial => 'wiki_pages/page_link' %>
<%= render :partial => 'wiki_pages/page_link', :collection => Canvas::ICU.collate_by(pages, &:title), :locals => {:skip_front_page => true} %>
</ul>
<% else %>
<ul class="item_list limit_height">
<li><a href="#" class="more_pages_link" style="padding-left: 20px; font-size: 0.9em;"><%= t 'links.show_all', 'show all...' %></a></li>
<%= render :partial => 'wiki_pages/page_link', :locals => {:hidden => true} %>
<%= render :partial => 'wiki_pages/page_link', :collection => Canvas::ICU.collate_by(pages, &:title), :locals => {:skip_front_page => true, :hidden => true} %>
</ul>
<% end %>
</div>
</div>
<% if can_do(@page, @current_user, :update_content) || (can_do(@page, @current_user, :delete) && !@page.is_front_page?) || can_do(@wiki, @current_user, :create_page) %>
<div class="rs-margin-lr <%= "rs-margin-bottom" if course_home %>">
<hr />
<% if can_do(@page, @current_user, :update_content)%>
<%= link_to ('<i class="icon-edit"></i>').html_safe + " " + t('links.edit_page', "Edit this Page"), "#edit", :class => "edit_link btn button-sidebar-wide" %>
<% end %>
<a href="<%= polymorphic_url([@context, @page]) %>" class="wiki_page_url" style="display: none;">&nbsp;</a>
<% if can_do(@wiki, @current_user, :create_page) %>
<div id="wiki_page_new">
<a class="new btn button-sidebar-wide element_toggler" aria-controls="add_wiki_page_form" href="#"><i class="icon-add"></i> <%= t 'links.create_page', 'Create a New Page' %></a>
<%= form_for(:wiki_page, :url => context_url(@context, :context_wiki_pages_url), :html => {:method => :post, :style => "display: none", :id => 'add_wiki_page_form'}) do |f| -%>
<div class="input-append">
<%= f.text_field :title, :style => "width: 182px;", :placeholder => t(:title, "New page title"), :maxlength => "255" %>
<button class="btn" type="submit"><%= t 'buttons.create', 'Create' %></button>
</div>
<input type="hidden" name="url_prefix" value="" id="url_prefix" />
<% end %>
</div>
<% end %>
</div>
<% end %>
</div>
<% end %>
<div id="wiki_edit_view_secondary" style="display:none;">
<div>
<h2><%= t 'headers.page_tools', 'Page Tools' %></h2>
<ul class="item_list">
<% unless @page.is_front_page? || @page.new_record? || !can_do(@page, @current_user, :update) %>
<li>
<a id="wiki_page_rename_link" class="icon-note-dark element_toggler" aria-controls="wiki_page_rename_section" href="#"><%= t 'links.rename_page', 'Rename this page' %></a>
<div id="wiki_page_rename_section" style="display:none;">
<%= form_for(@page, :url => polymorphic_url([@context, @page]), :html => {:id => 'rename_wiki_page_form'}) do |f| -%>
<div class="input-append">
<%= f.text_field :title, :style => "width: 157px;", :placeholder => t(:title, "New page title"), :maxlength => "255" %>
<button class="btn" type="submit"><%= t 'buttons.rename', 'Rename' %></button>
</div>
<% end -%>
</div>
</li>
<% unless @page.new_record? || !can_do(@page, @current_user, :delete) %>
<li>
<%= link_to t('links.delete_page', 'Delete this Page'), polymorphic_url([@context, @page]), :confirm => t('delete_page_confirmation', 'Are you sure you want to delete this page? This cannot be undone!'), :method => :delete, :id => "wiki_page_delete", :class => "icon-trash" %>
</li>
<% end %>
<% end %>
</ul>
</div>
<%= render :partial => "shared/wiki_sidebar" %>
</div>

View File

@ -12,7 +12,7 @@ the same course. The description returned by the Get Assignment API might look
like this:
!!!javascript
<a href="http://canvas.example.com/courses/123/wiki/a-wiki-page"
<a href="http://canvas.example.com/courses/123/pages/a-wiki-page"
data-api-endpoint="http://canvas.example.com/api/v1/courses/123/pages/a-wiki-page"
data-api-returntype="Page">More information here</a>

View File

@ -89,7 +89,7 @@ teachers, or students as well. There's no wiki words, instead there's a
WYSIWYG editor and a sidebar with all the links you could possibly want. In
fact, every editable page inside of Instructure gets the same sidebar, so it's
easy to link from an assignment page to a forum, a file, a wiki page, etc.
Wiki pages are accessed by name, and created on demand (/courses/5/wiki/new_page
Wiki pages are accessed by name, and created on demand (/courses/5/pages/new_page
would be created if it didn't exist and you went to it).
# Quizzes

View File

@ -51,10 +51,10 @@ describe HtmlTextHelper do
link = html.css('a').first
link['href'].should == "http://www.instructure.com/"
str = th.format_message("click here: http://www.instructure.com/courses/1/wiki/informação").first
str = th.format_message("click here: http://www.instructure.com/courses/1/pages/informação").first
html = Nokogiri::HTML::DocumentFragment.parse(str)
link = html.css('a').first
link['href'].should == "http://www.instructure.com/courses/1/wiki/informa%C3%A7%C3%A3o"
link['href'].should == "http://www.instructure.com/courses/1/pages/informa%C3%A7%C3%A3o"
str = th.format_message("click here: http://www.instructure.com/'onclick=alert(document.cookie)//\nnewline").first
html = Nokogiri::HTML::DocumentFragment.parse(str)

View File

@ -32,10 +32,14 @@ module Api
# List pages
%r{^/courses/(#{ID})/wiki$} => ['[Page]', :api_v1_course_wiki_pages_url, :course_id],
%r{^/groups/(#{ID})/wiki$} => ['[Page]', :api_v1_group_wiki_pages_url, :group_id],
%r{^/courses/(#{ID})/pages$} => ['[Page]', :api_v1_course_wiki_pages_url, :course_id],
%r{^/groups/(#{ID})/pages$} => ['[Page]', :api_v1_group_wiki_pages_url, :group_id],
# Show page
%r{^/courses/(#{ID})/wiki/([^/]+)$} => ['Page', :api_v1_course_wiki_page_url, :course_id, :url],
%r{^/groups/(#{ID})/wiki/([^/]+)$} => ['Page', :api_v1_group_wiki_page_url, :group_id, :url],
%r{^/courses/(#{ID})/pages/([^/]+)$} => ['Page', :api_v1_course_wiki_page_url, :course_id, :url],
%r{^/groups/(#{ID})/pages/([^/]+)$} => ['Page', :api_v1_group_wiki_page_url, :group_id, :url],
# List assignments
%r{^/courses/(#{ID})/assignments$} => ['[Assignment]', :api_v1_course_assignments_url, :course_id],

View File

@ -192,10 +192,8 @@ module Api::V1::Assignment
hash['module_ids'] = thing_in_module.context_module_tags.map(&:context_module_id) if thing_in_module
end
if assignment.context.feature_enabled?(:draft_state)
hash['published'] = ! assignment.unpublished?
hash['unpublishable'] = assignment.can_unpublish?
end
hash['published'] = ! assignment.unpublished?
hash['unpublishable'] = assignment.can_unpublish?
if opts[:differentiated_assignments_enabled] || (opts[:differentiated_assignments_enabled] != false && assignment.context.feature_enabled?(:differentiated_assignments))
hash['only_visible_to_overrides'] = value_to_boolean(assignment.only_visible_to_overrides)
@ -423,11 +421,9 @@ module Api::V1::Assignment
update_params["description"] = process_incoming_html_content(update_params["description"])
end
if assignment.context.feature_enabled?(:draft_state)
if assignment_params.has_key? "published"
published = value_to_boolean(assignment_params['published'])
assignment.workflow_state = published ? 'published' : 'unpublished'
end
if assignment_params.has_key? "published"
published = value_to_boolean(assignment_params['published'])
assignment.workflow_state = published ? 'published' : 'unpublished'
end
if assignment.context.feature_enabled?(:differentiated_assignments)

View File

@ -1,83 +0,0 @@
#
# Copyright (C) 2014 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/>.
#
module Features
module DraftState
class Publisher < Struct.new(:course_id)
def perform
course = Course.find(course_id)
course.quizzes.where(workflow_state: 'unpublished').update_all(workflow_state: 'edited')
course.assignments.where(workflow_state: 'unpublished').update_all(workflow_state: 'published')
course.context_modules.where(workflow_state: 'unpublished').update_all(workflow_state: 'active')
course.discussion_topics.where(workflow_state: 'unpublished').update_all(workflow_state: 'active')
# content tags referencing wiki pages or quizzes do not need to be updated
# wiki pages and quizzes handle unpublished values correctly in non-draft state
course.context_module_tags.where(workflow_state: 'unpublished')
.where("content_type NOT IN ('WikiPage', 'Quiz', 'Quizzes::Quiz')")
.update_all(workflow_state: 'active')
# invalidate cache for modules
course.context_modules.where("workflow_state<>'deleted'").update_all(updated_at: Time.now.utc)
end
end
end
end
Feature.register('draft_state' => {
display_name: lambda { I18n.t('features.draft_state', 'Draft State') },
description: lambda { I18n.t('draft_state_description', <<END) },
This beta feature redesigns many parts of Canvas and allows content to exist in
a new unpublished state that is invisible to students and excluded from grade
calculations. Caution--disabling this feature may delete newly created or edited
content from the teacher's view.
END
applies_to: 'Course',
state: 'on',
root_opt_in: true,
development: false,
custom_transition_proc: ->(user, context, from_state, transitions) do
if context.is_a?(Course) && from_state == 'on'
transitions['off']['message'] = I18n.t('features.draft_state_course_disable_warning', <<END)
Turning this feature off will publish ALL existing objects in the course. Please make sure all draft content
is ready to be published and available to all users in the course before continuing.
END
elsif context.is_a?(Account) && from_state != 'off'
site_admin = Account.site_admin.grants_right?(user, :read)
warning = I18n.t('features.draft_state_account_disable_warning', <<END)
Turning this feature off will impact existing courses. For assistance in disabling this feature, please contact
your Canvas Success Manager.
END
%w(allowed off).each do |target_state|
if transitions.has_key?(target_state)
transitions[target_state]['message'] = warning
transitions[target_state]['locked'] = true unless site_admin
end
end
end
end,
after_state_change_proc: ->(context, old_state, new_state) do
if context.is_a?(Course) && old_state == 'on' && new_state == 'off'
Delayed::Job.enqueue(Features::DraftState::Publisher.new(context.id), max_attempts: 1)
end
end
}
)

View File

@ -54,7 +54,7 @@ class ImportedHtmlConverter
#todo: FLAG UNFOUND REFERENCES TO re-attempt in second loop?
if wiki_migration_id = $1
if linked_wiki = context.wiki.wiki_pages.where(migration_id: wiki_migration_id).first
new_url = "#{course_path}/wiki/#{linked_wiki.url}"
new_url = "#{course_path}/pages/#{linked_wiki.url}"
end
end
elsif val =~ /discussion_topic_migration_id=(.*)/
@ -74,7 +74,7 @@ class ImportedHtmlConverter
type = 'context_modules' if type == 'modules'
type = 'pages' if type == 'wiki'
if type == 'pages'
new_url = "#{course_path}/#{context.feature_enabled?(:draft_state) ? 'pages' : 'wiki'}/#{migration_id}"
new_url = "#{course_path}/pages/#{migration_id}"
elsif type == 'attachments'
if att = context.attachments.where(migration_id: migration_id).first
new_url = "#{course_path}/files/#{att.id}/preview"

View File

@ -726,7 +726,7 @@ define([
$("#no_context_modules_message").slideUp();
var $publishIcon = $module.find('.publish-icon');
// new module, setup publish icon and other stuff
if (ENV.ENABLE_DRAFT && !$publishIcon.data('id')) {
if (!$publishIcon.data('id')) {
var fixLink = function(locator, attribute) {
el = $module.find(locator);
el.attr(attribute, el.attr(attribute).replace('{{ id }}', data.context_module.id));
@ -1056,7 +1056,7 @@ define([
data.content_tag.type = item_data['item[type]'];
$item = modules.addItemToModule($module, data.content_tag);
$module.find(".context_module_items.ui-sortable").sortable('enable').sortable('refresh');
if (ENV.ENABLE_DRAFT) { initNewItemPublishButton($item, data.content_tag); }
initNewItemPublishButton($item, data.content_tag);
modules.updateAssignmentData();
})
);
@ -1293,12 +1293,10 @@ define([
};
$(document).ready(function() {
if (ENV.ENABLE_DRAFT) {
$('.publish-icon:visible').each(function(index, el) {
var view = initPublishButton($(el));
overrideModel(view.model, view);
});
}
$('.publish-icon:visible').each(function(index, el) {
var view = initPublishButton($(el));
overrideModel(view.model, view);
});
$('.external_url_link').click(function() {
window.location = $(this).attr('data-item-href');

View File

@ -834,9 +834,9 @@ define([
}
});
} else {
var draft_state_msf = $('#sequence_footer.draft_state_enabled')
if (draft_state_msf.length) {
var el = $(draft_state_msf[0]);
var sf = $('#sequence_footer')
if (sf.length) {
var el = $(sf[0]);
el.moduleSequenceFooter({
courseID: el.attr("data-course-id"),
assetType: el.attr("data-asset-type"),

View File

@ -159,7 +159,7 @@ def should_translate_user_content(course, include_verifiers=true)
This will explain everything: <img id="1" src="/courses/#{course.id}/files/#{attachment.id}/preview" alt="important">
This won't explain anything: <img id="2" src="/courses/#{course.id}/files/#{attachment.id}/download" alt="important">
Also, watch this awesome video: <a href="/media_objects/qwerty" class="instructure_inline_media_comment video_comment" id="media_comment_qwerty"><img></a>
And refer to this <a href="/courses/#{course.id}/wiki/awesome-page">awesome wiki page</a>.
And refer to this <a href="/courses/#{course.id}/pages/awesome-page">awesome wiki page</a>.
</p>
}
html = yield content

View File

@ -254,6 +254,8 @@ describe UserContent, type: :request do
<a href='/courses/#{@course.id}/assignments/9~123'>assignment</a>
<a href='/courses/#{@course.id}/wiki'>wiki index</a>
<a href='/courses/#{@course.id}/wiki/test-wiki-page'>wiki page</a>
<a href='/courses/#{@course.id}/pages'>wiki index</a>
<a href='/courses/#{@course.id}/pages/test-wiki-page'>wiki page</a>
<a href='/courses/#{@course.id}/discussion_topics'>discussion index</a>
<a href='/courses/#{@course.id}/discussion_topics/456'>discussion topic</a>
<a href='/courses/#{@course.id}/files'>files index</a>
@ -276,6 +278,8 @@ describe UserContent, type: :request do
"http://www.example.com/api/v1/courses/#{@course.id}/assignments/9~123",
"http://www.example.com/api/v1/courses/#{@course.id}/pages",
"http://www.example.com/api/v1/courses/#{@course.id}/pages/test-wiki-page",
"http://www.example.com/api/v1/courses/#{@course.id}/pages",
"http://www.example.com/api/v1/courses/#{@course.id}/pages/test-wiki-page",
"http://www.example.com/api/v1/courses/#{@course.id}/discussion_topics",
"http://www.example.com/api/v1/courses/#{@course.id}/discussion_topics/456",
"http://www.example.com/api/v1/courses/#{@course.id}/folders/root",
@ -286,7 +290,7 @@ describe UserContent, type: :request do
"http://www.example.com/api/v1/courses/#{@course.id}/external_tools/sessionless_launch?url=http%3A%2F%2Flti-tool-provider.example.com%2Flti_tool"
]
expect(doc.css('a').collect { |att| att['data-api-returntype'] }).to eq(
%w([Assignment] Assignment [Page] Page [Discussion] Discussion Folder File File [Quiz] Quiz SessionlessLaunchUrl)
%w([Assignment] Assignment [Page] Page [Page] Page [Discussion] Discussion Folder File File [Quiz] Quiz SessionlessLaunchUrl)
)
end
end
@ -299,6 +303,8 @@ describe UserContent, type: :request do
<p>
<a href='/groups/#{@group.id}/wiki'>wiki index</a>
<a href='/groups/#{@group.id}/wiki/some-page'>wiki page</a>
<a href='/groups/#{@group.id}/pages'>wiki index</a>
<a href='/groups/#{@group.id}/pages/some-page'>wiki page</a>
<a href='/groups/#{@group.id}/discussion_topics'>discussion index</a>
<a href='/groups/#{@group.id}/discussion_topics/1~123'>discussion topic</a>
<a href='/groups/#{@group.id}/files'>files index</a>
@ -313,6 +319,8 @@ describe UserContent, type: :request do
:format => 'json', :group_id => @group.id.to_s, :url => @wiki_page.url })
doc = Nokogiri::HTML::DocumentFragment.parse(json['body'])
expect(doc.css('a').collect { |att| att['data-api-endpoint'] }).to eq [
"http://www.example.com/api/v1/groups/#{@group.id}/pages",
"http://www.example.com/api/v1/groups/#{@group.id}/pages/some-page",
"http://www.example.com/api/v1/groups/#{@group.id}/pages",
"http://www.example.com/api/v1/groups/#{@group.id}/pages/some-page",
"http://www.example.com/api/v1/groups/#{@group.id}/discussion_topics",
@ -321,7 +329,7 @@ describe UserContent, type: :request do
"http://www.example.com/api/v1/files/789"
]
expect(doc.css('a').collect{ |att| att['data-api-returntype'] }).to eq(
%w([Page] Page [Discussion] Discussion Folder File)
%w([Page] Page [Page] Page [Discussion] Discussion Folder File)
)
end
end

View File

@ -355,7 +355,6 @@ describe AssignmentGroupsController, type: :request do
it "should not return unpublished assignments to students" do
student_in_course(:active_all => true)
@course.root_account.enable_feature!(:draft_state)
@course.require_assignment_group
assignment = @course.assignments.create! do |a|
a.title = "test"

View File

@ -265,8 +265,6 @@ describe AssignmentsApiController, type: :request do
end
it "should include published flag for accounts that do have enabled_draft" do
@course.account.enable_feature!(:draft_state)
@json = api_get_assignment_in_course(@assignment, @course)
expect(@json.has_key?('published')).to be_truthy
@ -482,7 +480,6 @@ describe AssignmentsApiController, type: :request do
before :once do
course_with_student(:active_all => true)
@course.account.enable_feature!(:draft_state)
@published = @course.assignments.create!({:name => "published assignment"})
@published.workflow_state = 'published'
@published.save!
@ -925,7 +922,6 @@ describe AssignmentsApiController, type: :request do
end
it "should update published/unpublished" do
@course.account.enable_feature!(:draft_state)
@assignment = @course.assignments.create({
:name => "some assignment",
:points_possible => 15
@ -1987,7 +1983,6 @@ describe AssignmentsApiController, type: :request do
context "draft state" do
before :once do
@course.account.enable_feature!(:draft_state)
@assignment = @course.assignments.create!({
:name => "unpublished assignment",
:points_possible => 15

View File

@ -124,7 +124,6 @@ describe DiscussionTopicsController, type: :request do
end
it "should make a basic topic" do
set_course_draft_state
api_call(:post, "/api/v1/courses/#{@course.id}/discussion_topics",
{ :controller => "discussion_topics", :action => "create", :format => "json", :course_id => @course.to_param },
{ :title => "test title", :message => "test <b>message</b>" })
@ -160,7 +159,6 @@ describe DiscussionTopicsController, type: :request do
end
it "should create a topic with all the bells and whistles" do
set_course_draft_state
post_at = 1.month.from_now
lock_at = 2.months.from_now
api_call(:post, "/api/v1/courses/#{@course.id}/discussion_topics",
@ -1217,9 +1215,8 @@ describe DiscussionTopicsController, type: :request do
expect(@entry.parent_entry).to be_nil
expect(@entry.message).to eq @message
end
it "should not allow students to create an entry under a topic that is closed for comments" do
@course.enable_feature!(:draft_state)
@topic.lock!
student_in_course(:course => @course, :active_all => true)
api_call(

View File

@ -229,7 +229,6 @@ describe "Pages API", type: :request do
end
it "should retrieve page content and attributes" do
set_course_draft_state
@hidden_page.publish
json = api_call(:get, "/api/v1/courses/#{@course.id}/pages/#{@hidden_page.url}",
:controller=>"wiki_pages_api", :action=>"show", :format=>"json", :course_id=>"#{@course.id}", :url=>@hidden_page.url)
@ -482,9 +481,6 @@ describe "Pages API", type: :request do
end
it "should create a new page in unpublished state (draft state)" do
@course.account.allow_feature!(:draft_state)
@course.enable_feature!(:draft_state)
json = api_call(:post, "/api/v1/courses/#{@course.id}/pages",
{ :controller => 'wiki_pages_api', :action => 'create', :format => 'json', :course_id => @course.to_param },
{ :wiki_page => { :published => false, :title => 'New Wiki Page!', :body => 'hello new page' }})
@ -494,9 +490,6 @@ describe "Pages API", type: :request do
end
it "should create a published front page, even when published is blank (draft state)" do
@course.account.allow_feature!(:draft_state)
@course.enable_feature!(:draft_state)
front_page_url = 'my-front-page'
json = api_call(:put, "/api/v1/courses/#{@course.id}/front_page",
{ :controller => 'wiki_pages_api', :action => 'update_front_page', :format => 'json', :course_id => @course.to_param },
@ -530,7 +523,6 @@ describe "Pages API", type: :request do
describe "update" do
it "should update page content and attributes" do
set_course_draft_state
api_call(:put, "/api/v1/courses/#{@course.id}/pages/#{@hidden_page.url}",
{ :controller => 'wiki_pages_api', :action => 'update', :format => 'json', :course_id => @course.to_param,
:url => @hidden_page.url },
@ -543,7 +535,6 @@ describe "Pages API", type: :request do
end
it "should update front_page" do
set_course_draft_state true
page = @course.wiki.wiki_pages.create!(:title => "hrup", :body => "blooop")
page.publish
page.set_as_front_page!
@ -559,7 +550,6 @@ describe "Pages API", type: :request do
end
it "should set as front page" do
set_course_draft_state true
wiki = @course.wiki
expect(wiki.unset_front_page!).to eq true
@ -580,7 +570,6 @@ describe "Pages API", type: :request do
end
it "should un-set as front page" do
set_course_draft_state true
wiki = @course.wiki
wiki.reload
expect(wiki.has_front_page?).to be_truthy
@ -602,8 +591,6 @@ describe "Pages API", type: :request do
end
it "should not change the front page unless set differently" do
set_course_draft_state true
# make sure we don't catch the default 'front-page'
@front_page.title = 'Different Front Page'
@front_page.save!
@ -665,7 +652,6 @@ describe "Pages API", type: :request do
context 'with draft state' do
before :once do
set_course_draft_state true
end
it 'should accept published' do
@ -680,8 +666,6 @@ describe "Pages API", type: :request do
end
it 'should ignore hide_from_students' do
set_course_draft_state true
json = api_call(:put, "/api/v1/courses/#{@course.id}/pages/#{@test_page.url}",
{ :controller => 'wiki_pages_api', :action => 'update', :format => 'json', :course_id => @course.to_param, :url => @test_page.url },
{ :wiki_page => {'hide_from_students' => 'true'} })
@ -696,7 +680,6 @@ describe "Pages API", type: :request do
context 'with unpublished page' do
before :once do
set_course_draft_state
@unpublished_page = @course.wiki.wiki_pages.build(:title => 'Unpublished Page', :body => 'Body of unpublished page')
@unpublished_page.workflow_state = 'unpublished'
@unpublished_page.save!
@ -721,7 +704,6 @@ describe "Pages API", type: :request do
end
it "should unpublish a page" do
set_course_draft_state
json = api_call(:put, "/api/v1/courses/#{@course.id}/pages/#{@hidden_page.url}?wiki_page[published]=false",
:controller => 'wiki_pages_api', :action => 'update', :format => 'json', :course_id => @course.to_param,
:url => @hidden_page.url, :wiki_page => {'published' => 'false'})
@ -821,8 +803,6 @@ describe "Pages API", type: :request do
before :once do
@deleted_page = @wiki.wiki_pages.create! :title => "Deleted page"
@deleted_page.destroy
@course.account.allow_feature!(:draft_state)
@course.enable_feature!(:draft_state)
@unpublished_page = @wiki.wiki_pages.create(:title => "Draft Page", :body => "Don't text and drive.")
@unpublished_page.workflow_state = :unpublished
@unpublished_page.save!
@ -989,7 +969,6 @@ describe "Pages API", type: :request do
end
it 'should not allow editing attributes (with draft state)' do
set_course_draft_state
api_call(:put, "/api/v1/courses/#{@course.id}/pages/#{@editable_page.url}",
{ :controller => 'wiki_pages_api', :action => 'update', :format => 'json', :course_id => @course.to_param,
:url => @editable_page.url },
@ -1046,8 +1025,6 @@ describe "Pages API", type: :request do
context "unpublished pages" do
before :once do
@course.account.allow_feature!(:draft_state)
@course.enable_feature!(:draft_state)
@unpublished_page = @wiki.wiki_pages.create(:title => "Draft Page", :body => "Don't text and drive.")
@unpublished_page.workflow_state = :unpublished
@unpublished_page.save!

View File

@ -18,10 +18,6 @@
require File.expand_path(File.dirname(__FILE__) + '/../../api_spec_helper')
describe Quizzes::CourseQuizExtensionsController, type: :request do
before :once do
Account.default.enable_feature!(:draft_state)
end
before :once do
course
@quizzes = [1,2].map do |n|

View File

@ -19,10 +19,6 @@
require File.expand_path(File.dirname(__FILE__) + '/../../api_spec_helper')
describe Quizzes::OutstandingQuizSubmissionsController, type: :request do
before :once do
Account.default.enable_feature!(:draft_state)
end
describe "GET /courses/:course_id/quizzes/:quiz_id/outstanding_quiz_submissions [index]" do
def api_index(options={}, data={})
url = "/api/v1/courses/#{@course.id}/quizzes/#{@quiz.id}/outstanding_quiz_submissions"

View File

@ -1,9 +1,6 @@
require File.expand_path(File.dirname(__FILE__) + '/../../api_spec_helper')
describe Quizzes::QuizAssignmentOverridesController, type: :request do
before :once do
Account.default.enable_feature!(:draft_state)
end
describe '[GET] /courses/:course_id/quizzes/assignment_overrides' do
before do

View File

@ -18,9 +18,6 @@
require File.expand_path(File.dirname(__FILE__) + '/../../api_spec_helper')
describe Quizzes::QuizExtensionsController, type: :request do
before :once do
Account.default.enable_feature!(:draft_state)
end
before :once do
course

View File

@ -20,9 +20,6 @@ require File.expand_path(File.dirname(__FILE__) + '/../../api_spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/../../locked_spec')
describe Quizzes::QuizGroupsController, type: :request do
before :once do
Account.default.enable_feature!(:draft_state)
end
before :once do
teacher_in_course(:active_all => true)

View File

@ -19,9 +19,6 @@
require File.expand_path(File.dirname(__FILE__) + '/../../api_spec_helper')
describe Quizzes::QuizIpFiltersController, type: :request do
before :once do
Account.default.enable_feature!(:draft_state)
end
before :once do
course_with_teacher :active_all => true

View File

@ -19,9 +19,6 @@
require File.expand_path(File.dirname(__FILE__) + '/../../api_spec_helper')
describe Quizzes::QuizQuestionsController, type: :request do
before :once do
Account.default.enable_feature!(:draft_state)
end
context 'as a teacher' do
before :once do

View File

@ -20,9 +20,6 @@ require File.expand_path(File.dirname(__FILE__) + '/../../api_spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/../../../models/quizzes/quiz_statistics/item_analysis/common')
describe Quizzes::QuizReportsController, type: :request do
before :once do
Account.default.enable_feature!(:draft_state)
end
describe "GET /courses/:course_id/quizzes/:quiz_id/reports [index]" do
def api_index(params={}, options={})

View File

@ -2,9 +2,6 @@ require File.expand_path(File.dirname(__FILE__) + '/../../api_spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/../../../models/quizzes/quiz_statistics/item_analysis/common')
describe Quizzes::QuizStatisticsController, type: :request do
before :once do
Account.default.enable_feature!(:draft_state)
end
def api_index(options={}, data={})
url = "/api/v1/courses/#{@course.id}/quizzes/#{@quiz.id}/statistics"

View File

@ -4,10 +4,6 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../models/quizzes/quiz
describe Quizzes::QuizSubmissionEventsController, type: :request do
require File.expand_path(File.dirname(__FILE__) + '/../../../quiz_spec_helper.rb')
before :once do
Account.default.enable_feature!(:draft_state)
end
def api_create(options={}, data={})
url = "/api/v1/courses/#{@course.id}/quizzes/#{@quiz.id}/submissions/#{@quiz_submission.id}/events"
params = { controller: 'quizzes/quiz_submission_events',

View File

@ -20,9 +20,6 @@ require File.expand_path(File.dirname(__FILE__) + '/../../api_spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/../../file_uploads_spec_helper')
describe Quizzes::QuizSubmissionFilesController, type: :request do
before :once do
Account.default.enable_feature!(:draft_state)
end
context "quiz submissions file uploads" do
before :once do

View File

@ -19,9 +19,6 @@
require File.expand_path(File.dirname(__FILE__) + '/../../api_spec_helper')
describe Quizzes::QuizSubmissionQuestionsController, :type => :request do
before :once do
Account.default.enable_feature!(:draft_state)
end
module Helpers
def create_question(type, factory_options = {}, quiz=@quiz)

View File

@ -18,9 +18,6 @@ require File.expand_path(File.dirname(__FILE__) + '/../../api_spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/../../../models/quizzes/quiz_user_messager_spec_helper')
describe Quizzes::QuizSubmissionUsersController, type: :request do
before :once do
Account.default.enable_feature!(:draft_state)
end
before :once do
course_with_teacher(active_all: true)

View File

@ -42,9 +42,6 @@ shared_examples_for 'Quiz Submissions API Restricted Endpoints' do
end
describe Quizzes::QuizSubmissionsApiController, type: :request do
before :once do
Account.default.enable_feature!(:draft_state)
end
module Helpers
def enroll_student

View File

@ -20,9 +20,6 @@ require File.expand_path(File.dirname(__FILE__) + '/../../api_spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/../../locked_spec')
describe Quizzes::QuizzesApiController, type: :request do
before :once do
Account.default.enable_feature!(:draft_state)
end
context 'locked api item' do
let(:item_type) { 'quiz' }
@ -461,8 +458,6 @@ describe Quizzes::QuizzesApiController, type: :request do
end
it "should not lose quiz question count when publishing with draft state" do
Account.default.enable_feature!(:draft_state)
@quiz ||= @course.quizzes.create!(:title => 'title')
@qq1 = @quiz.quiz_questions.create!(
question_data: multiple_choice_question_data

View File

@ -55,10 +55,6 @@ describe AssignmentsController do
end
context "draft state" do
before :once do
@course.root_account.enable_feature!(:draft_state)
end
it "should create a default group if none exist" do
user_session(@student)
@ -204,7 +200,6 @@ describe AssignmentsController do
end
it "should default to unpublished for draft state" do
@course.root_account.enable_feature!(:draft_state)
@course.require_assignment_group
get 'new', :course_id => @course.id
@ -246,7 +241,6 @@ describe AssignmentsController do
end
it "should default to unpublished if draft state is enabled" do
Account.default.enable_feature!(:draft_state)
post 'create', :course_id => @course.id, :assignment => {:title => "some assignment"}
expect(assigns[:assignment]).to be_unpublished
end

View File

@ -353,7 +353,7 @@ describe ContextModulesController do
end
it "should reorder unpublished items" do
course_with_teacher_logged_in(active_all: true, draft_state: true)
course_with_teacher_logged_in(active_all: true)
pageA = @course.wiki.wiki_pages.create title: "pageA"
pageA.workflow_state = 'unpublished'
pageA.save

View File

@ -579,7 +579,6 @@ describe CoursesController do
it "should disable management and set env urls on assignment homepage" do
@course1.default_view = "assignments"
@course1.save!
@course1.account.enable_feature!(:draft_state)
get 'show', :id => @course1.id
expect(controller.js_env[:URLS][:new_assignment_url]).not_to be_nil
expect(controller.js_env[:PERMISSIONS][:manage]).to be_falsey
@ -593,7 +592,6 @@ describe CoursesController do
it "should not show unpublished assignments to students" do
@course1.default_view = "assignments"
@course1.save!
@course1.account.enable_feature!(:draft_state)
@a1.unpublish
get 'show', :id => @course1.id
expect(assigns(:assignments).map(&:id).include?(@a1.id)).to be_falsey
@ -608,8 +606,6 @@ describe CoursesController do
end
it "should work for wiki view with draft state enabled" do
@course1.account.allow_feature!(:draft_state)
@course1.enable_feature!(:draft_state)
@course1.default_view = "wiki"
@course1.save!
@course1.wiki.wiki_pages.create!(:title => 'blah').set_as_front_page!

View File

@ -103,7 +103,6 @@ describe FilePreviewsController do
end
it "should fulfill module completion requirements" do
@course.enable_feature!(:draft_state)
attachment_model content_type: 'application/msword'
mod = @course.context_modules.create!(:name => "some module")
tag = mod.add_item(:id => @attachment.id, :type => 'attachment')

View File

@ -466,8 +466,6 @@ describe GradebooksController do
it "redirects if draft state is enabled and the assignment is unpublished" do
# Unpublished assignment and draft state enabled
@course.account.enable_feature!(:draft_state)
get 'speed_grader', course_id: @course, assignment_id: @assign.id
expect(response).to be_redirect
expect(flash[:notice]).to eq I18n.t(
@ -530,7 +528,6 @@ describe GradebooksController do
context 'draft state' do
it 'should not return unpublished assignments' do
course_with_student
@course.account.enable_feature!(:draft_state)
ag = @course.assignment_groups.create! group_weight: 100
a1 = ag.assignments.create! :submission_types => 'online_upload',
:points_possible => 10,

Some files were not shown because too many files have changed in this diff Show More