function announceUpdatedCurrentGrade (currentGrade) {
   var noGrade = '--';
   var flashMessage;
   if (currentGrade === noGrade) {
     flashMessage = I18n.t('Updated current grade to be empty');
   } else {
     flashMessage = I18n.t(
       'Updated current grade to %{currentGrade}',
       { currentGrade: currentGrade }
     );
   }
   $.screenReaderFlashMessage(flashMessage);
 }
Beispiel #2
0
    componentWillReceiveProps (nextProps) {
      if (!this.props.isSavingAssociations && nextProps.isSavingAssociations) {
        $.screenReaderFlashMessage(I18n.t('Saving associations started'))
      }

      if (this.props.isSavingAssociations && !nextProps.isSavingAssociations) {
        $.screenReaderFlashMessageExclusive(I18n.t('Saving associations complete'))

        // when saving is done, reload courses in course picker
        // this will remove courses we just associated from the picker
        this.coursePicker.reloadCourses()
      }
    }
  onSelectToggle = (e) => {
    const index = this.props.courses.findIndex(c => c.id === e.target.value)
    const course = this.props.courses[index]
    const srMsg = e.target.checked
                ? I18n.t('Selected course %{course}', { course: course.name })
                : I18n.t('Unselected course %{course}', { course: course.name })
    $.screenReaderFlashMessage(srMsg)

    this.updateSelected({ [e.target.value]: e.target.checked }, false)

    setTimeout(() => {
      this.handleFocusLoss(index)
    }, 0)
  }
Beispiel #4
0
 onSelectAllToggle = (e) => {
   const srMsg = e.target.checked
               ? I18n.t('Selected all courses')
               : I18n.t('Unselected all courses')
   $.screenReaderFlashMessage(srMsg)
   this.setState({
     selectedAll: e.target.checked,
     selected: e.target.checked ? this.props.courses
                 .reduce((selected, course) =>
                   Object.assign(selected, { [course.id]: true })
                 , {}) : {}
   }, () => {
     this.props.onSelectedChanged(this.state.selected)
   })
 }
 handleDelete = _.memoize((index) => () => {
   const masteryIndex = this.state.masteryIndex
   const rows = this.state.rows.delete(index)
   if (masteryIndex >= index && masteryIndex > 0) {
     this.setState({ masteryIndex: masteryIndex - 1 })
   }
   if (index === 0) {
     this.setState({rows})
     if (this.props.focusTab) {
       setTimeout(this.props.focusTab, 700)
     }
   } else {
     this.setState({ rows: rows.setIn([index-1, 'focusField'], 'trash') })
   }
   $.screenReaderFlashMessage(I18n.t('Proficiency Rating deleted'))
 })
Beispiel #6
0
    onSelectToggle = (e) => {
      const selected = this.state.selected
      selected[e.target.value] = e.target.checked
      const index = this.props.courses.findIndex(c => c.id === e.target.value)
      const course = this.props.courses[index]
      const srMsg = e.target.checked
                  ? I18n.t('Selected course %{course}', { course: course.name })
                  : I18n.t('Unselected course %{course}', { course: course.name })
      $.screenReaderFlashMessage(srMsg)
      this.setState({ selected, selectedAll: false }, () => {
        this.props.onSelectedChanged(this.state.selected)
      })

      setTimeout(() => {
        this.handleFocusLoss(index)
      }, 0)
    }
Beispiel #7
0
    $("#crosslist_course_form").bind('id_entered', function(event, course) {
      if(course.id == latest_course_id) { return; }
      $("#crosslist_course_form .submit_button").attr('disabled', true);
      $("#course_autocomplete_id").val("");
      if(!course.id) {
        $("#sis_id_holder,#account_name_holder").hide();
        $("#course_autocomplete_name").text("");
        return;
      }
      course.name = course.name || I18n.t('default_course_name', "Course ID \"%{course_id}\"", {course_id: course.id});
      $("#course_autocomplete_name_holder").show();
      var confirmingText = I18n.t('status.confirming_course', "Confirming %{course_name}...", {course_name: course.name});
      $("#course_autocomplete_name").text(confirmingText);
      $.screenReaderFlashMessage(confirmingText);
      $("#sis_id_holder,#account_name_holder").hide();
      $("#course_autocomplete_account_name").hide();
      var url = $.replaceTags($("#course_confirm_crosslist_url").attr('href'), 'id', course.id);
      latest_course_id = course.id;
      var course_id_before_get = latest_course_id;
      $.ajaxJSON(url, 'GET', {}, function(data) {
        if(course_id_before_get != latest_course_id) { return; }
        if(data && data.allowed) {
          var template_data = {
            sis_id: data.course && data.course.sis_source_id,
            account_name: data.account && data.account.name
          };
          $("#course_autocomplete_name_holder").fillTemplateData({data: template_data});
          $("#course_autocomplete_name").text(data.course.name);
          $.screenReaderFlashMessage(data.course.name);
          $("#sis_id_holder").showIf(template_data.sis_id);
          $("#account_name_holder").showIf(template_data.account_name);

          $("#course_autocomplete_id").val(data.course.id);
          $("#crosslist_course_form .submit_button").attr('disabled', false);
        } else {
          var errorText = I18n.t('errors.course_not_authorized_for_crosslist', "%{course_name} not authorized for cross-listing", {course_name: course.name});
          $("#course_autocomplete_name").text(errorText);
          $.screenReaderFlashError(errorText);
          $("#sis_id_holder,#account_name_holder").hide();
        }
      }, function(data) {
        $("#course_autocomplete_name").text(I18n.t('errors.confirmation_failed', "Confirmation Failed"));
      });
    });
Beispiel #8
0
  showStatus = () => {
    if (this.props.requestingResults) {
      $.screenReaderFlashMessage(I18n.t('Loading more grade history results.'));

      return (
        <Spinner size="small" title={I18n.t('Loading Results')} />
      );
    }

    if (this.noResultsFound()) {
      return (<Typography fontStyle="italic">{I18n.t('No results found.')}</Typography>);
    }

    if (!this.props.requestingResults && !this.props.nextPage && this.hasHistory()) {
      return (<Typography fontStyle="italic">{I18n.t('No more results to load.')}</Typography>);
    }

    return null;
  }
      .then(res => {
        const newDiscussion = res.data

        // Students lose the manage menu if they close a discussion that they
        // created. This can ruin the focus, and we need to correct it here
        // if so. The check is here, not in the caller of the updateDiscussion,
        // because we don't know if the menu disappears until we get the result
        // back from this call. This is terrible.
        if (focusOn) {
          if (focusOn === 'manageMenu') {
            const realFocus = newDiscussion.permissions.delete ? 'manageMenu' : 'title'
            newDiscussion.focusOn = realFocus
          } else {
            newDiscussion.focusOn = focusOn
          }
        }

        dispatch(actions.updateDiscussionSuccess({discussion: newDiscussion}))
        if (successMessage) {
          $.screenReaderFlashMessage(successMessage)
        }
      })
Beispiel #10
0
      $.ajaxJSON(url, 'GET', {}, function(data) {
        if(course_id_before_get != latest_course_id) { return; }
        if(data && data.allowed) {
          var template_data = {
            sis_id: data.course && data.course.sis_source_id,
            account_name: data.account && data.account.name
          };
          $("#course_autocomplete_name_holder").fillTemplateData({data: template_data});
          $("#course_autocomplete_name").text(data.course.name);
          $.screenReaderFlashMessage(data.course.name);
          $("#sis_id_holder").showIf(template_data.sis_id);
          $("#account_name_holder").showIf(template_data.account_name);

          $("#course_autocomplete_id").val(data.course.id);
          $("#crosslist_course_form .submit_button").attr('disabled', false);
        } else {
          var errorText = I18n.t('errors.course_not_authorized_for_crosslist', "%{course_name} not authorized for cross-listing", {course_name: course.name});
          $("#course_autocomplete_name").text(errorText);
          $.screenReaderFlashError(errorText);
          $("#sis_id_holder,#account_name_holder").hide();
        }
      }, function(data) {
        </div>;

        var results = this.props.results;
        if (!this.state.showUnpublished) {
          // filter out unpublished results
          results = _.map(results, function(result) {
            var new_result = _.clone(result);
            new_result.invalid_links = _.filter(result.invalid_links, function(link) { return link.reason != "unpublished_item" });
            return new_result;
          });
          results = _.filter(results, function(result) { return result.invalid_links.length > 0});
        }

        if (results.length === 0) {
          alertMessage = <div className='alert alert-success'>{noBrokenLinksMessage}</div>;
          $.screenReaderFlashMessage(noBrokenLinksMessage)
        } else {
          results.forEach((result) => {
            allResults.push(<ValidatorResultsRow result={result} />);
            numberofBrokenLinks += result.invalid_links.length;
          });

          alertMessage = <div className='alert alert-info'>{this.getDisplayMessage(numberofBrokenLinks)}</div>;
          $.screenReaderFlashMessage(this.getDisplayMessage(numberofBrokenLinks));
        }
      }

      return (
        <div id="all-results">
          {!!showUnpublishedBox && showUnpublishedBox}
          {alertMessage}
 () => $.screenReaderFlashMessage(I18n.t('loading_undated_events', 'Loading undated events')),
 success: () => {
   $.screenReaderFlashMessage(I18n.t('Removed %{user} as group leader', {user: user_name}))
   $(`.group-user-actions[data-user-id='user_${user_id}']`, this.el).focus()
 }
 success: () => {
   $.screenReaderFlashMessage(
     I18n.t('%{user} is now group leader', {user: this.model.get('leader').display_name})
   )
   $(`.group-user-actions[data-user-id='user_${user_id}']`, this.el).focus()
 }
Beispiel #15
0
    view.render()

    this.concludedConferences = new ConferenceCollection(ENV.concluded_conferences)
    view = this.concludedView = new CollectionView({
      el: $('#concluded-conference-list'),
      itemView: ConcludedConferenceView,
      collection: this.concludedConferences,
      emptyMessage: I18n.t('no_concluded_conferences', 'There are no concluded conferences'),
      listClassName: 'ig-list'
    })
    view.render()

    $.screenReaderFlashMessage(
      I18n.t(
        'notifications.inaccessible',
        'Warning: This page contains third-party content which is not accessible to screen readers.'
      ),
      20000
    )

    $('.new-conference-btn').on('click', () => this.create())
  },

  index () {
    this.editView.close()
  },

  create () {
    const conference = new Conference(_.clone(ENV.default_conference))
    conference.once('startSync', () => this.currentConferences.unshift(conference))
    if (conference.get('permissions').create) {
 componentDidUpdate (prevProps) {
   if (this.props.isLocked && !prevProps.isLocked) {
     $.screenReaderFlashMessage(I18n.t('%{attributes} locked', { attributes: formatLockObject(this.props.itemLocks) }))
   }
 }
Beispiel #17
0
 .catch(err => {
   $.screenReaderFlashMessage(I18n.t('Error saving discussion settings'))
   dispatch(actions.savingSettingsFail({err}))
 })
Beispiel #18
0
 .then(resp => {
   $.screenReaderFlashMessage(I18n.t('Saved discussion settings successfully'))
   dispatch(actions.savingSettingsSuccess({userSettings, courseSettings: resp.data}))
 })
Beispiel #19
0
  componentWillReceiveProps(newProps) {
    this.expandTillCurrentFolder(newProps)
  },

  onClick(event, folder) {
    event.preventDefault()
    $(ReactDOM.findDOMNode(this.refs.FolderTreeHolder))
      .find(`.${this.focusStyleClass}`)
      .each((key, value) => $(value).removeClass(this.focusStyleClass))
    $(ReactDOM.findDOMNode(this.refs.FolderTreeHolder))
      .find(`.${this.selectedStyleClass}`)
      .each((key, value) => $(value).removeClass(this.selectedStyleClass))
    if (folder.get('locked_for_user')) {
      const message = I18n.t('This folder is currently locked and unavailable to view.')
      $.flashError(message)
      $.screenReaderFlashMessage(message)
    } else {
      $.screenReaderFlashMessageExclusive(I18n.t('File list updated'))
      page(`${filesEnv.baseUrl}/folder/${folder.urlPath()}`)
    }
  },

  hrefFor(folder) {},
  // @makeHref (if folder.urlPath() then 'folder' else 'rootFolder'), splat: folder.urlPath()

  focusStyleClass: 'FolderTree__folderItem--focused',
  selectedStyleClass: 'FolderTree__folderItem--selected',

  expandTillCurrentFolder(props) {
    function expandFolder(folderIndex) {
      const folder = props.rootTillCurrentFolder && props.rootTillCurrentFolder[folderIndex]
Beispiel #20
0
 errorMessage: function() {
   if (this.state.errorMessage) {
    $.screenReaderFlashMessage(this.state.errorMessage);
     return <div className="alert alert-error">{this.state.errorMessage}</div>;
   }
 },
Beispiel #21
0
 .then(_ => {
   dispatch(actions.updateDiscussionSuccess())
   if (successMessage) {
     $.screenReaderFlashMessage(successMessage)
   }
 })
 () => $.screenReaderFlashMessage($(event.target).find('.screenreader_points_possible').text())
Beispiel #23
0
 $.ajaxJSON(url, 'DELETE', data, function(data) {
   CollaborationsPage.Util.removeCollaboration($collaboration);
   $.screenReaderFlashMessage(I18n.t('Collaboration was deleted'));
 }, $.noop);
Beispiel #24
0
 $.ajaxJSON( url, 'POST', contentItem, this.collaborationSuccess, function( msg ) {
   $.screenReaderFlashMessage(I18n.t('Collaboration creation failed'));
 });