Allow modal to hardwire partialName for inheritance default template behaviour
This commit is contained in:
@@ -124,27 +124,27 @@ export default Ember.Mixin.create ApplicationRouteMixin,
|
|||||||
# -edit-distribution-point
|
# -edit-distribution-point
|
||||||
# modals/-edit-distribution-point
|
# modals/-edit-distribution-point
|
||||||
#
|
#
|
||||||
partialPath = null
|
unless controller.get('partialName')
|
||||||
while not partialPath and modalNameParts.length
|
partialPath = null
|
||||||
if container.lookup "template:#{modalNameParts.join('/')}/-#{partialName}"
|
while not partialPath and modalNameParts.length
|
||||||
partialPath = "#{modalNameParts.join('/')}/#{partialName}" # without the dash
|
if container.lookup "template:#{modalNameParts.join('/')}/-#{partialName}"
|
||||||
else if container.lookup "template:#{modalNameParts.join('/')}/modals/-#{partialName}"
|
partialPath = "#{modalNameParts.join('/')}/#{partialName}" # without the dash
|
||||||
partialPath = "#{modalNameParts.join('/')}/modals/#{partialName}" # without the dash
|
else if container.lookup "template:#{modalNameParts.join('/')}/modals/-#{partialName}"
|
||||||
else if container.lookup "template:modals/#{modalNameParts.join('/')}/modals/-#{partialName}"
|
partialPath = "#{modalNameParts.join('/')}/modals/#{partialName}" # without the dash
|
||||||
partialPath = "modals/#{modalNameParts.join('/')}/modals/#{partialName}" # without the dash
|
else if container.lookup "template:modals/#{modalNameParts.join('/')}/modals/-#{partialName}"
|
||||||
else if container.lookup "template:components/#{modalNameParts.join('/')}/-#{partialName}"
|
partialPath = "modals/#{modalNameParts.join('/')}/modals/#{partialName}" # without the dash
|
||||||
partialPath = "components/#{modalNameParts.join('/')}/#{partialName}" # without the dash
|
else if container.lookup "template:components/#{modalNameParts.join('/')}/-#{partialName}"
|
||||||
modalNameParts.pop()
|
partialPath = "components/#{modalNameParts.join('/')}/#{partialName}" # without the dash
|
||||||
partialPath ||= partialName if container.lookup("template:-#{partialName}") # can be root template
|
modalNameParts.pop()
|
||||||
partialPath ||= "modals/#{partialName}" if container.lookup("template:modals/-#{partialName}") # can be root template
|
partialPath ||= partialName if container.lookup("template:-#{partialName}") # can be root template
|
||||||
unless partialPath
|
partialPath ||= "modals/#{partialName}" if container.lookup("template:modals/-#{partialName}") # can be root template
|
||||||
message = "Cannot find template for modal '#{modalName}'"
|
unless partialPath
|
||||||
console.log message
|
message = "Cannot find template for modal '#{modalName}'"
|
||||||
@set "router.globals.flash_message", message
|
console.log message
|
||||||
return
|
@set "router.globals.flash_message", message
|
||||||
|
return
|
||||||
|
controller.set 'partialName', partialPath
|
||||||
@incrementProperty 'router.globals.modals_counter'
|
@incrementProperty 'router.globals.modals_counter'
|
||||||
controller.set 'partialName', partialPath
|
|
||||||
controller.willOpenModal() # can be implemented to setup stuff before rendering and hooks
|
controller.willOpenModal() # can be implemented to setup stuff before rendering and hooks
|
||||||
@render 'modals/layout',
|
@render 'modals/layout',
|
||||||
into: 'application'
|
into: 'application'
|
||||||
|
|||||||
Reference in New Issue
Block a user