#NEWLINE# def email_link( request ) : #NEWLINE# #INDENT# prompt_for_link_text = bool ( request . GET . get ( 'prompt_for_link_text' ) ) #NEWLINE# if prompt_for_link_text : #NEWLINE# #INDENT# form_class = EmailLinkChooserWithLinkTextForm #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# form_class = EmailLinkChooserForm #NEWLINE# #UNINDENT# if ( request . method == 'POST' ) : #NEWLINE# #INDENT# form = form_class ( request . POST ) #NEWLINE# if form . is_valid ( ) : #NEWLINE# #INDENT# return render_modal_workflow ( request , None , 'wagtailadmin/chooser/external_link_chosen.js' , { #NEWLINE# #INDENT# 'url' : ( 'mailto:' + form . cleaned_data [ 'email_address' ] ) , #NEWLINE# 'link_text' : ( form . cleaned_data [ 'link_text' ] if ( prompt_for_link_text and form . cleaned_data [ 'link_text' ] ) else form . cleaned_data [ 'email_address' ] ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# form = form_class ( ) #NEWLINE# #UNINDENT# return render_modal_workflow ( request , 'wagtailadmin/chooser/email_link.html' , 'wagtailadmin/chooser/email_link.js' , shared_context ( prompt_for_link_text , { #NEWLINE# #INDENT# 'form' : form , #NEWLINE# #UNINDENT# } ) )