Add mobile_embed to Discussion Edit/Create view

flag=none
closes VICE-2967

test plan:
  - Tests pass
  - Go to /courses/[Course ID]/discussion_topics/[Discussion ID]/edit?embed=true
  - Shouldn't have the navigation bar and other surrounding things
      around the Discussion Edit/Create view.
  - The published/not published thing should appear on top right and adjust
      accordingly.

qa risk: low

Change-Id: I02ce835824c4035230946b88598956569c7c1977
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/298467
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jason Gillett <jason.gillett@instructure.com>
Product-Review: Jason Gillett <jason.gillett@instructure.com>
QA-Review: Chawn Neal <chawn.neal@instructure.com>
This commit is contained in:
Omar Gerardo Soto-Fortuño 2022-08-12 14:35:57 -04:00 committed by Omar Soto-Fortuño
parent 145d4d984a
commit 6b87175e97
4 changed files with 17 additions and 5 deletions

View File

@ -662,7 +662,7 @@ class DiscussionTopicsController < ApplicationController
set_master_course_js_env_data(@topic, @context)
conditional_release_js_env(@topic.assignment)
render :edit
render :edit, layout: params[:embed] == "true" ? "mobile_embed" : true
end
def show
@ -774,9 +774,12 @@ class DiscussionTopicsController < ApplicationController
end
end
edit_url = context_url(@topic.context, :edit_context_discussion_topic_url, @topic)
edit_url += "?embed=true" if params[:embed] == "true"
js_env({
course_id: params[:course_id] || @context.course&.id,
EDIT_URL: context_url(@topic.context, :edit_context_discussion_topic_url, @topic),
EDIT_URL: edit_url,
PEER_REVIEWS_URL: @topic.assignment ? context_url(@topic.assignment.context, :context_assignment_peer_reviews_url, @topic.assignment.id) : nil,
discussion_topic_id: params[:id],
manual_mark_as_read: @current_user&.manual_mark_as_read?,

View File

@ -39,3 +39,7 @@
label.short-label {
display: inline-block;
}
.full-width {
width: 100%;
}

View File

@ -139,7 +139,12 @@ export default class EditView extends ValidatedFormView
if returnToHelper.isValid(params['return_to'])
params['return_to']
else
@model.get 'html_url'
url = new URL(window.location.href)
searchParams = new URLSearchParams(url.search)
if searchParams.get('embed') == 'true'
(@model.get 'html_url') + "?embed=true"
else
@model.get 'html_url'
redirectAfterCancel: ->
location = @locationAfterCancel(deparam())

View File

@ -21,7 +21,7 @@
{{> ui/features/discussion_topic_edit/jst/_publishedButton.handlebars }}
</ul>
{{else}}
<div class="span4 offset8 text-right">
<div class="full-width text-right">
{{> ui/features/discussion_topic_edit/jst/_publishedButton.handlebars }}
</div>
</div>
@ -378,4 +378,4 @@
{{/if}}
<button type="submit" data-text-while-loading="{{#t " saving"}}Saving...{{/t}}" class="btn btn-primary">{{#t
"save"}}Save{{/t}}</button>
</div>
</div>