Skip to content

Commit

Permalink
Ensure all bootstrap modals can be overridden.
Browse files Browse the repository at this point in the history
Fixes #6995
  • Loading branch information
dgrammatiko authored and johanjanssens committed Jun 19, 2015
1 parent f6d549f commit ea3901c
Show file tree
Hide file tree
Showing 9 changed files with 117 additions and 80 deletions.
Expand Up @@ -146,16 +146,18 @@ protected function getInput()
. '<span class="icon-file"></span> ' . JText::_('JSELECT')
. '</a>';

$html[] = JHtmlBootstrap::renderModal(
'modalContact' . $this->id, array(
'url' => $link . '&amp;' . JSession::getFormToken() . '=1"',
'title' => JText::_('COM_CONTACT_CHANGE_CONTACT'),
'width' => '800px',
'height' => '300px',
'footer' => '<button class="btn" data-dismiss="modal" aria-hidden="true">'
. JText::_("JLIB_HTML_BEHAVIOR_CLOSE") . '</button>'
)
);
$html[] = JHtml::_(
'bootstrap.renderModal',
'modalContact' . $this->id,
array(
'url' => $link . '&amp;' . JSession::getFormToken() . '=1"',
'title' => JText::_('COM_CONTACT_CHANGE_CONTACT'),
'width' => '800px',
'height' => '300px',
'footer' => '<button class="btn" data-dismiss="modal" aria-hidden="true">'
. JText::_("JLIB_HTML_BEHAVIOR_CLOSE") . '</button>'
)
);

// Edit contact button.
if ($allowEdit)
Expand Down
Expand Up @@ -167,8 +167,10 @@ protected function getInput()

$html[] = '<input type="hidden" id="' . $this->id . '_id"' . $class . ' name="' . $this->name . '" value="' . $value . '" />';

$html[] = JHtmlBootstrap::renderModal(
'modalArticle' . $this->id, array(
$html[] = JHtml::_(
'bootstrap.renderModal',
'modalArticle' . $this->id,
array(
'url' => $url,
'title' => JText::_('COM_CONTENT_CHANGE_ARTICLE'),
'width' => '800px',
Expand Down
22 changes: 12 additions & 10 deletions administrator/components/com_menus/models/fields/menutype.php
Expand Up @@ -85,16 +85,18 @@ function jSelectPosition_' . $this->id . '(name) {
$html[] = '<a href="#menuTypeModal" role="button" class="btn btn-primary" data-toggle="modal" title="' . JText::_('JSELECT') . '">'
. '<span class="icon-list icon-white"></span> '
. JText::_('JSELECT') . '</a></span>';
$html[] = JHtmlBootstrap::renderModal(
'menuTypeModal', array(
'url' => $link,
'title' => JText::_('COM_MENUS_ITEM_FIELD_TYPE_LABEL'),
'width' => '800px',
'height' => '300px',
'footer' => '<button class="btn" data-dismiss="modal" aria-hidden="true">'
. JText::_("JLIB_HTML_BEHAVIOR_CLOSE") . '</button>'
)
);
$html[] = JHtml::_(
'bootstrap.renderModal',
'menuTypeModal',
array(
'url' => $link,
'title' => JText::_('COM_MENUS_ITEM_FIELD_TYPE_LABEL'),
'width' => '800px',
'height' => '300px',
'footer' => '<button class="btn" data-dismiss="modal" aria-hidden="true">'
. JText::_("JLIB_HTML_BEHAVIOR_CLOSE") . '</button>'
)
);
$html[] = '<input class="input-small" type="hidden" name="' . $this->name . '" value="' . htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8') . '" />';

return implode("\n", $html);
Expand Down
27 changes: 14 additions & 13 deletions administrator/components/com_menus/views/item/tmpl/edit_modules.php
Expand Up @@ -99,19 +99,20 @@
</span>
<?php endif; ?>
</td>
<?php echo JHtmlBootstrap::renderModal(
'module' . $module->id . 'Modal',
array(
'url' => $link,
'title' => JText::_('COM_MENUS_EDIT_MODULE_SETTINGS'),
'height' => '300px',
'width' => '800px',
'footer' => '<button class="btn" data-dismiss="modal" aria-hidden="true">'
. JText::_("JLIB_HTML_BEHAVIOR_CLOSE") . '</button>'
. '<button class="btn btn-success" data-dismiss="modal" aria-hidden="true" onclick="jQuery(\'#module' . $module->id . 'Modal iframe\').contents().find(\'#saveBtn\').click();">'
. JText::_("JSAVE") . '</button>'
)
); ?>
<?php echo JHtml::_(
'bootstrap.renderModal',
'module' . $module->id . 'Modal',
array(
'url' => $link,
'title' => JText::_('COM_MENUS_EDIT_MODULE_SETTINGS'),
'height' => '300px',
'width' => '800px',
'footer' => '<button class="btn" data-dismiss="modal" aria-hidden="true">'
. JText::_("JLIB_HTML_BEHAVIOR_CLOSE") . '</button>'
. '<button class="btn btn-success" data-dismiss="modal" aria-hidden="true" onclick="jQuery(\'#module' . $module->id . 'Modal iframe\').contents().find(\'#saveBtn\').click();">'
. JText::_("JSAVE") . '</button>'
)
); ?>
</tr>
<?php endforeach; ?>
</tbody>
Expand Down
43 changes: 27 additions & 16 deletions administrator/components/com_menus/views/menus/tmpl/default.php
Expand Up @@ -180,27 +180,38 @@
<?php foreach ($this->modules[$item->menutype] as &$module) : ?>
<?php if ($canEdit) : ?>
<?php $link = JRoute::_('index.php?option=com_modules&task=module.edit&id=' . $module->id . '&return=' . $return . '&tmpl=component&layout=modal'); ?>
<?php echo
JHtmlBootstrap::renderModal(
'module' . $module->id . 'Modal',
array(
'url' => $link,
'title' => JText::_('COM_MENUS_EDIT_MODULE_SETTINGS'),
'height' => '300px',
'width' => '800px',
'footer' => '<button class="btn" data-dismiss="modal" aria-hidden="true">'
. JText::_("JLIB_HTML_BEHAVIOR_CLOSE") . '</button>'
. '<button class="btn btn-success" data-dismiss="modal" aria-hidden="true" onclick="jQuery(\'#module' . $module->id . 'Modal iframe\').contents().find(\'#saveBtn\').click();">'
. JText::_("JSAVE") . '</button>'
)
);
?>
<?php echo JHtml::_(
'bootstrap.renderModal',
'module' . $module->id . 'Modal',
array(
'url' => $link,
'title' => JText::_('COM_MENUS_EDIT_MODULE_SETTINGS'),
'height' => '300px',
'width' => '800px',
'footer' => '<button class="btn" data-dismiss="modal" aria-hidden="true">'
. JText::_("JLIB_HTML_BEHAVIOR_CLOSE") . '</button>'
. '<button class="btn btn-success" data-dismiss="modal" aria-hidden="true" onclick="jQuery(\'#module'
. $module->id . 'Modal iframe\').contents().find(\'#saveBtn\').click();">'
. JText::_("JSAVE") . '</button>'
)
); ?>
<?php endif; ?>
<?php endforeach; ?>
<?php elseif ($modMenuId) : ?>
<a href="<?php echo JRoute::_('index.php?option=com_modules&task=module.add&eid=' . $modMenuId . '&params[menutype]=' . $item->menutype); ?>">
<?php echo JText::_('COM_MENUS_ADD_MENU_MODULE'); ?></a>
<?php echo JHtmlBootstrap::renderModal('moduleModal', array( 'url' => $link, 'title' => JText::_('COM_MENUS_EDIT_MODULE_SETTINGS'),'height' => '500px', 'width' => '800px'), ''); ?>
<?php echo JHtml::_(
'bootstrap.renderModal',
'moduleModal',
array(
'url' => $link,
'title' => JText::_('COM_MENUS_EDIT_MODULE_SETTINGS'),
'height' => '500px',
'width' => '800px',
'footer' => '<button class="btn" data-dismiss="modal" aria-hidden="true">'
. JText::_("JLIB_HTML_BEHAVIOR_CLOSE") . '</button>'
)
); ?>
<?php endif; ?>
</td>
<td class="center">
Expand Down
Expand Up @@ -147,16 +147,18 @@ protected function getInput()
. '<span class="icon-file"></span> ' . JText::_('JSELECT')
. '</a>';

$html[] = JHtmlBootstrap::renderModal(
'modalNewsfeed' . $this->id, array(
'url' => $link . '&amp;' . JSession::getFormToken() . '=1"',
'title' => JText::_('COM_NEWSFEEDS_CHANGE_FEED_BUTTON'),
'width' => '800px',
'height' => '300px',
'footer' => '<button class="btn" data-dismiss="modal" aria-hidden="true">'
. JText::_("JLIB_HTML_BEHAVIOR_CLOSE") . '</button>'
)
);
$html[] = JHtml::_(
'bootstrap.renderModal',
'modalNewsfeed' . $this->id,
array(
'url' => $link . '&amp;' . JSession::getFormToken() . '=1"',
'title' => JText::_('COM_NEWSFEEDS_CHANGE_FEED_BUTTON'),
'width' => '800px',
'height' => '300px',
'footer' => '<button class="btn" data-dismiss="modal" aria-hidden="true">'
. JText::_("JLIB_HTML_BEHAVIOR_CLOSE") . '</button>'
)
);

// Edit newsfeed button
if ($allowEdit)
Expand Down
Expand Up @@ -79,8 +79,10 @@ public static function thumbModal($template, $clientId = 0)
$footer = '<button class="btn" data-dismiss="modal" aria-hidden="true">'
. JText::_('JTOOLBAR_CLOSE') . '</a>';

$html .= JHtmlBootstrap::renderModal(
$template . '-Modal', array(
$html .= JHtml::_(
'bootstrap.renderModal',
$template . '-Modal',
array(
'title' => JText::_('COM_TEMPLATES_BUTTON_PREVIEW'),
'height' => '500px',
'width' => '800px',
Expand Down
8 changes: 5 additions & 3 deletions administrator/components/com_users/helpers/html/users.php
Expand Up @@ -125,8 +125,10 @@ public static function notesModal($count, $userId)
$footer = '<button class="btn" data-dismiss="modal" aria-hidden="true">'
. JText::_('JTOOLBAR_CLOSE') . '</a>';

return JHtmlBootstrap::renderModal(
'userModal_' . (int) $userId, array(
return JHtml::_(
'bootstrap.renderModal',
'userModal_' . (int) $userId,
array(
'title' => $title,
'backdrop' => 'static',
'keyboard' => true,
Expand All @@ -135,7 +137,7 @@ public static function notesModal($count, $userId)
'url' => JRoute::_('index.php?option=com_users&view=notes&tmpl=component&layout=modal&u_id=' . (int) $userId),
'height' => '300px',
'width' => '800px'
)
)
);

}
Expand Down
41 changes: 27 additions & 14 deletions administrator/templates/hathor/html/com_menus/menus/default.php
Expand Up @@ -157,25 +157,38 @@
<?php foreach ($this->modules[$item->menutype] as &$module) : ?>
<?php if ($canEdit) : ?>
<?php $link = JRoute::_('index.php?option=com_modules&task=module.edit&id='.$module->id.'&return='.$return.'&tmpl=component&layout=modal'); ?>
<?php echo JHtmlBootstrap::renderModal(
'module' . $module->id . 'Modal',
array(
'url' => $link,
'title' => JText::_('COM_MENUS_EDIT_MODULE_SETTINGS'),
'height' => '300px',
'width' => '800px',
'footer' => '<button class="btn" data-dismiss="modal" aria-hidden="true">'
. JText::_("JLIB_HTML_BEHAVIOR_CLOSE") . '</button>'
. '<button class="btn btn-success" data-dismiss="modal" aria-hidden="true" onclick="jQuery(\'#module' . $module->id . 'Modal iframe\').contents().find(\'#saveBtn\').click();">'
. JText::_("JSAVE") . '</button>'
)
); ?>
<?php echo JHtml::_(
'bootstrap.renderModal',
'module' . $module->id . 'Modal',
array(
'url' => $link,
'title' => JText::_('COM_MENUS_EDIT_MODULE_SETTINGS'),
'height' => '300px',
'width' => '800px',
'footer' => '<button class="btn" data-dismiss="modal" aria-hidden="true">'
. JText::_("JLIB_HTML_BEHAVIOR_CLOSE") . '</button>'
. '<button class="btn btn-success" data-dismiss="modal" aria-hidden="true" onclick="jQuery(\'#module'
. $module->id . 'Modal iframe\').contents().find(\'#saveBtn\').click();">'
. JText::_("JSAVE") . '</button>'
)
); ?>
<?php endif; ?>
<?php endforeach; ?>
<?php elseif ($modMenuId) : ?>
<a href="<?php echo JRoute::_('index.php?option=com_modules&task=module.add&eid=' . $modMenuId . '&params[menutype]='.$item->menutype); ?>">
<?php echo JText::_('COM_MENUS_ADD_MENU_MODULE'); ?></a>
<?php echo JHtmlBootstrap::renderModal('moduleModal', array( 'url' => $link, 'title' => JText::_('COM_MENUS_EDIT_MODULE_SETTINGS'),'height' => '500px', 'width' => '800px'), ''); ?>
<?php echo JHtml::_(
'bootstrap.renderModal',
'moduleModal',
array(
'url' => $link,
'title' => JText::_('COM_MENUS_EDIT_MODULE_SETTINGS'),
'height' => '500px',
'width' => '800px',
'footer' => '<button class="btn" data-dismiss="modal" aria-hidden="true">'
. JText::_("JLIB_HTML_BEHAVIOR_CLOSE") . '</button>'
)
); ?>
<?php endif; ?>
</td>
<td class="center">
Expand Down

0 comments on commit ea3901c

Please sign in to comment.