Skip to content

Commit

Permalink
Fix news feed edit modal (issue #10520)
Browse files Browse the repository at this point in the history
  • Loading branch information
cyrezdev committed May 17, 2016
1 parent 4897400 commit 2e2af7c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
Expand Up @@ -166,7 +166,7 @@ protected function getInput()
. ' id="' . $this->id . '_edit"'
. ' data-toggle="modal"'
. ' role="button"'
. ' href="#newsfeedEdit' . $this->id . 'Modal"'
. ' href="#newsfeedEdit' . $this->value . 'Modal"'
. ' title="' . JHtml::tooltipText('COM_NEWSFEEDS_EDIT_NEWSFEED') . '">'
. '<span class="icon-edit"></span> ' . JText::_('JACTION_EDIT')
. '</a>';
Expand Down Expand Up @@ -204,7 +204,7 @@ protected function getInput()
// Edit newsfeed modal
$html[] = JHtml::_(
'bootstrap.renderModal',
'newsfeedEdit' . $this->id . 'Modal',
'newsfeedEdit' . $this->value . 'Modal',
array(
'url' => $urlEdit,
'title' => JText::_('COM_NEWSFEEDS_EDIT_NEWSFEED'),
Expand All @@ -215,13 +215,13 @@ protected function getInput()
'modalWidth' => '80',
'bodyHeight' => '70',
'footer' => '<button type="button" class="btn" data-dismiss="modal" aria-hidden="true"'
. ' onclick="jQuery(\'#newsfeedEdit' . $this->id . 'Modal iframe\').contents().find(\'#closeBtn\').click();">'
. ' onclick="jQuery(\'#newsfeedEdit' . $this->value . 'Modal iframe\').contents().find(\'#closeBtn\').click();">'
. JText::_("JLIB_HTML_BEHAVIOR_CLOSE") . '</button>'
. '<button type="button" class="btn btn-primary" data-dismiss="modal" aria-hidden="true"'
. ' onclick="jQuery(\'#newsfeedEdit' . $this->id . 'Modal iframe\').contents().find(\'#saveBtn\').click();">'
. '<button type="button" class="btn btn-primary" aria-hidden="true"'
. ' onclick="jQuery(\'#newsfeedEdit' . $this->value . 'Modal iframe\').contents().find(\'#saveBtn\').click();">'
. JText::_("JSAVE") . '</button>'
. '<button type="button" class="btn btn-success" aria-hidden="true"'
. ' onclick="jQuery(\'#newsfeedEdit' . $this->id . 'Modal iframe\').contents().find(\'#applyBtn\').click();">'
. ' onclick="jQuery(\'#newsfeedEdit' . $this->value . 'Modal iframe\').contents().find(\'#applyBtn\').click();">'
. JText::_("JAPPLY") . '</button>'
)
);
Expand Down
Expand Up @@ -21,14 +21,19 @@

$assoc = JLanguageAssociations::isEnabled();

JFactory::getDocument()->addScriptDeclaration("
JFactory::getDocument()->addScriptDeclaration('
Joomla.submitbutton = function(task)
{
if (task == 'newsfeed.cancel' || document.formvalidator.isValid(document.getElementById('newsfeed-form'))) {
Joomla.submitform(task, document.getElementById('newsfeed-form'));
if (task == "newsfeed.cancel" || document.formvalidator.isValid(document.getElementById("newsfeed-form"))) {
Joomla.submitform(task, document.getElementById("newsfeed-form"));
if (task !== "newsfeed.apply")
{
window.parent.jQuery("#newsfeedEdit' . $this->item->id . 'Modal").modal("hide");
}
}
};
");
');

// Fieldsets to not automatically render by /layouts/joomla/edit/params.php
$this->ignore_fieldsets = array('images', 'jbasic', 'jmetadata', 'item_associations');
Expand Down

0 comments on commit 2e2af7c

Please sign in to comment.