[Modules] Publish / Unpublish ALL Option

This idea has been developed and deployed to Canvas

Instead of having to click every single item in a long list to Publish or Unpublish them all, it would save a lot of time if we had the option to "Publish All" or "Unpublish All". It would be even slicker if we could select or highlight a large group of multiple items (though not necessarily all of them) to publish or unpublish all at once.
121 Comments
david_eargle
Community Explorer

Unpublishes all files. Waits 1 second after opening the model before selecting the "unpublish" radio button, and then submits the modal. Then, proceeds to the next attachment. Had to make it recursive because otherwise loop functions would try to pop open all modals at once, which wouldn't be pretty.

We should make a power-to-the-people browser extension or something

var attachments = $('[data-module-type=attachment] button').toArray()

var unpublishAttachment = function(e){
   
    new Promise(function(resolve, reject){
        $(e).click()
        setTimeout(function(){
            resolve();
        }, 1000)
    })
    .then( function(){
        return new Promise(function(resolve, reject){
            $('.permissions-dialog-form .icon-unpublish').siblings('input').click()
            $('.permissions-dialog-form button[type=submit]').click();
            setTimeout(function(){
                resolve();
            }, 1000)
        })
    }).then(function(){
        if (attachments.length > 0){
            unpublishAttachment(attachments.pop())
        }
    })
}

if (attachments.length > 0){
    unpublishAttachment(attachments.pop())
}
lukamtow
Community Novice

Dave, you are amazing! I'm testing if it's possible to add a separate line to check if it is already published (perhaps checking if icon is published or unpublished) so it doesn't have to click on every single file whether they're already unpublished or not.

And yeah, we totally should release that extension. Canvas is just missing too many features.

david_eargle
Community Explorer

You could just change the first line to be more picky, by filtering to only include buttons with 'published' css class:

var attachments = $('[data-module-type=attachment] button.published').toArray()
augustone1998
Community Member

As a 6th grade math teacher, I do not know any computer code and I am unwilling to even try it. Canvas needs to figure this out. If lay-people can do it, so can they.

Again, big thanks to Canvas for all the clicking I had to do at the beginning of the term . SO DUMB.

John Myers

6th Math Teacher, M.Ed.

Marvin Ridge Middle School

2831 Crane Road

Waxhaw, NC 28173

(704) 290-1510 (phone)

(704) 243-0153 (fax)

Note: All email correspondence to and from this address is subject to public review under the NC Public Records Law.

As a result all messages may be monitored by and disclosed to third parties.

david_eargle
Community Explorer

 @sbitner ‌ describes how to run these scripts in this comment: https://community.canvaslms.com/ideas/6173-publish-unpublish-all-option?commentID=150746#comment-147... 

It's javascript that you run in your browser. In theory, yes, javascript can compromise accounts etc, and not everyone is a security expert to be able to discern what bad things my / the code might do, but perhaps you can trust others to review and vouch for the code. The javascript is merely selecting elements on the website (that's the `$('some selector')` part), and then simulating "clicks" on elements (`.click()`), just as if you had done it with your mouse.

Yes, Canvas should implement this functionality, but I've had them take three months to fix a show-stopping bug in quiz.next, so don't hold your breath for new features anytime soon

ronmarx
Community Contributor

Your comment,  @david_eargle ‌'s replies, and the sentiments expressed by  @olsonhum ,  @hasti , and  @lukamtow  are perfect examples of the additional needed work Instructure needs to do on its Canvas LMS product. There are just too many code solutions to the myriad of perfectly legitimate requests for features and functions, but the Canvas product directors don't/can't/won't prioritize implementing them in the product.

My comments aren't intended as a shallow critique, or digs against the many diligent, committed Instructure personnel. Instead, maybe idea threads like this should be used to resurrect the Khaki conference program with NEW participants, hosted by Instructure, with travel subsidized by Instructure. (Now that my contract with my previous employer has ended, I'm at liberty to submit my resume at Instructure's request.)

jennifer_lawson
Community Novice

This would be a huge help...thank you very much!!!

augustone1998
Community Member

So glad this popped up on my email again...I want to officially thank Canvas for not fixing this. The start of another term bring about 1000 more clicks of a mouse and 10 minutes of my time. GET THIS DONE ALREADY. 

jennifer_lawson
Community Novice

I hear you!!!

barbara_popp
Community Member

It would be beneficial if this could be an option for when we sandbox our courses to work on in the summer.  Without an, "all unpublish" button would prevent them all for showing up in our gradebook upon the start of the new year.