Example #1
0
      var onSuccess = _.bind(function(resp) {
        toastr.info(
          _s.sprintf('%s was removed!', this.courseModel.get('name'))
        );

        mixpanel.track('Removed transcript course', {
          course_id: this.courseModel.id.$oid
        });
        mixpanel.people.increment({'Removed transcript course': 1});

        // TODO(mack): remove require()
        var _user_course = require('user_course');
        // Remove the user course from the collection cache
        _user_course.UserCourses.removeFromCache(this.userCourse);
        this.courseModel.set('user_course_id', undefined);
        this.userCourse = undefined;

        this.$('.remove-course-btn').tooltip('destroy');
        if (pageData.ownProfile) {
          // We should only be removing the course card if the user is on their
          // own profile
          var onHide = _.bind(function() {
            // TODO(mack): properly destory subviews
            this.close();
          }, this);

          this.$el.slideUp(200, onHide);
        } else {
          this.render();
        }

      }, this);
Example #2
0
      var onSuccess = function(resp) {
        //TODO(mack): consider alternative placement of toast so that it
        // doesn't potentially cover up the main nav
        toastr.success(
          _s.sprintf('%s was added to your shortlist!',
              self.courseModel.get('name'))
        );

        // TODO(mack): remove require()
        var _user_course = require('user_course');
        // Add the new user course to the collection cache
        _user_course.UserCourses.addToCache(resp.user_course);
        self.userCourse = _user_course.UserCourses.getFromCache(
          resp.user_course.id.$oid);
        self.courseModel.set('user_course_id', self.userCourse.id);

        self.$('.add-course-btn').tooltip('destroy');

        if (self.courseAdded) {
          self.courseAdded();
        }
      };