Jump to content

Launching the Assignment Monitor with jQuery


sclough

Recommended Posts

We've got some code to open the quick assign window to create new homework tasks. This is just a click function like this:

var $target = jQuery('[data-action=launch_quick_assign]:first');
  $target.on('click', function(el, ev) { 
  ev.stopPropagation(); 
  el.frogui_modules_quickassign(); 
}.bind($target.get(0), $target));

I was wondering which frog UI module I'd need to call to open the assignment monitor screen?

Link to comment
Share on other sites

Hi @sclough,

You can open the Assignment Monitor app using the new endpoints in FrogOS.js

Normally we would do this;

FrogOS.openApp(
    'assignmentreports',
    { view: "monitor" }
);

But it doesn't seem to be behaving itself at the moment, so lets pull apart what this does under the hood.

$('.os_core:first').trigger('os.internal.launchapp', {
    data: {
        name: 'assignmentreports',
        view: 'monitor'
    }
});

The above code will give you the desired result. I will be logging a bug to fix the FrogOS.js and hopefully that will go out in one of the next few hotfixes :)

  • Like 1
Link to comment
Share on other sites

21 minutes ago, sfoster said:

Thanks Chris :)

Is there anywhere we can get a list of endpoints please?

Simon

Hi Simon,

We don't typically give out these endpoints, we are looking to augment them and present them in a cleaner way, hence FrogOS.js

Whilst the official documentation is a few months away; here is a quick summary of the endpoints available to you as of the Dickens Release.

/**
 * Get the current user
 * @method getUser
 * @version 2015-06-29
 * @author Chris Smith
 *
 * @codestart javascript
 *
 * var element = jQuery('.welcome-msg'),
 *     user = FrogOS.getUser();
 *
 * element.text(
 *      sprintf('Hello <strong>%s</strong>', user.attr('displayname'))
 * );
 *
 * @codeend
 *
 * @return {Lib.Model.User} An instance of the User Class
 */
getUser: function() {},

/**
 * Alias Sprintf into our namespace.
 * @method sprintf
 * @version 2015-06-29
 * @author Chris Smith
 * @type {Function}
 *
 * @codestart javascript
 *
 * var date = moment().format('dddd MMMM YYYY'),
 *     element = jQuery('.welcome-msg');
 *
 * element.text(
 *      sprintf('Here\'s the schedule for %s', date);
 * );
 *
 * @codeend
 */
sprintf: sprintf,

/**
 * Alias FDP api method
 * @method fdp
 * @version 2015-07-02
 * @author Chris Smith
 * @type {Function}
 *
 * @codestart javascript
 *
 * FrogOS.fdp({
 *     url: 'notification/send',
 *     path: '/api/fdp/2/',
 *     type: 'POST',
 *     data: {
 *         recipients: recipients_list,
 *         message: my_message
 *     }
 * }).done(function(response) {
 *     // Do things
 * }).fail(function(e) {
 *     // Report Error
 * });
 *
 * @codeend
 *
 * @returns {jQuery.Promise} Promise Object
 */
fdp: function(options) {},

/**
 * Open a Site or Assignment
 * @method openSite
 * @version 2016-06-20
 * @author  Chris Smith
 *
 * @codestart javascript
 *
 * FrogOS.openSite({
 *     site: '/a_user/example_site'
 * });
 *
 * @codeend
 * @return this
 */
openSite: function(options) {},

/**
 * Open an application
 * @param  {String} appName Name of App
 * @param  {Object} options Application Info
 *
 * @codestart javascript
 *
 * // Open Student App
 * FrogOS.openApp(
 *     'assignmentreports',
 *     {
 *         view: student
 *     }
 * );
 *
 * @codend
 *
 * @note options parameter currently broken @chris.smith - 06/10/2016
 *
 * @return this
 */
openApp: function(appName, options) {}

Hope this helps :)

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...