LTI placed in assignment submission box

Jump to solution
help
Community Novice

Hi

Is there any guide/documentation to build an LTI tool that will show in a specific place in Canvas - I am thinking about another "tab" in the assignment submission like the dropbox LTI (see attached image) so that the file attached this way will be connected with the assignment submissiondropbox LTI

Labels (1)
1 Solution
tnijssen
Community Member

To find out, I started by looking at the HTML in my browser. I found the following:

<form id="submit_online_upload_form" class="submit_assignment_form ui-tabs-panel ui-widget-content ui-corner-bottom" enctype="multipart/form-data" action="/courses/12719/assignments/42589/submissions" accept-charset="UTF-8" method="post" aria-labelledby="ui-id-3" role="tabpanel" aria-expanded="true" aria-hidden="false">

That "id" attribute looks interesting. Let's look it up in the Canvas source code, and we find this file. Clearly, the Google ones are special, but here we see what we're looking for:

<% (@external_tools[0,3] || []).each do |external_tool| %>
        <li><a href="#submit_from_external_tool_form_<%= external_tool.id %>"
          class="external-tool"
          data-id="<%= external_tool.id %>"
          data-name="<%= external_tool.name %>">
<%= external_tool.label_for(:homework_submission, I18n.locale) %></a></li>
      <% end %>

So we're looking for the controller of this template, which should define "external_tools".

I went up to the controllers directory, and guessed that we're dealing with the assignments_controller.

Indeed, we find the following useful snippet:

 if @assignment.submission_types.include?("online_upload") || @assignment.submission_types.include?("online_url")
        @external_tools = ContextExternalTool.all_tools_for(@context, :user => @current_user, :placements => :homework_submission)

Aha! We're looking for those tools that have "homework_submission" as one of the placements.

One quick Google search and we find this page, which links to the Canvas documentation for making an LTI homework submission.

Hope that helps!

View solution in original post