Skip to content
This repository was archived by the owner on Apr 19, 2019. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions administrator/components/com_cpanel/views/cpanel/tmpl/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,26 @@
use Joomla\Registry\Registry;

$user = JFactory::getUser();

JFactory::getDocument()->addScriptDeclaration(
'jQuery(function($) {
$(".cpanel-module .unpublish").on("click", function(e) {
e.preventDefault();
var parent = $(this).parents(".cpanel-module");

$.post("index.php?option=com_modules&task=modules.unpublish&cid=" + parent.attr("data-moduleid"), {
"' . JSession::getFormToken() . '": 1
})
.done(function() {
parent.remove();
})
.fail(function() {
// TODO: Make this a notification?
alert( "' . JText::_('COM_CPANEL_UNPUBLISH_MODULE_ERROR') . '" );
});
});
});'
);
?>

<div class="row">
Expand Down
1 change: 1 addition & 0 deletions administrator/language/en-GB/en-GB.com_cpanel.ini
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,4 @@ COM_CPANEL_MSG_STATS_COLLECTION_TITLE="Stats Collection in Joomla"
COM_CPANEL_WELCOME_BEGINNERS_MESSAGE="<p>Community resources are available for new users</p><ul><li><a href="_QQ_"https://docs.joomla.org/Portal:Beginners"_QQ_">Joomla! Beginners Guide</a></li><li><a href="_QQ_"https://forum.joomla.org/viewforum.php?f=706"_QQ_">New to Joomla! Forum</a></li></ul>"
COM_CPANEL_WELCOME_BEGINNERS_TITLE="Welcome to Joomla!"
COM_CPANEL_XML_DESCRIPTION="Control Panel component"
COM_CPANEL_UNPUBLISH_MODULE_ERROR="Error unpublishing the module"
1 change: 1 addition & 0 deletions administrator/language/en-GB/en-GB.ini
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ JACTION_MANAGE="Access Administration Interface"
JACTION_MANAGE_COMPONENT_DESC="Allows users in the group to access the administration interface for this extension."
JACTION_OPTIONS="Configure Options Only"
JACTION_OPTIONS_COMPONENT_DESC="Allows users in the group to edit the options except the permissions of this extension."
JACTION_UNPUBLISH="Unpublish"

JBROWSERTARGET_MODAL="Modal"
JBROWSERTARGET_NEW="Open in new window"
Expand Down
3 changes: 2 additions & 1 deletion administrator/templates/atum/html/modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,15 @@ function modChrome_well($module, &$params, &$attribs)
$headerClass = ($headerClass) ? ' ' . htmlspecialchars($headerClass) : '';

echo '<div class="' . $moduleClass . '">';
echo '<' . $moduleTag . ' class="card card-block mb-3' . $moduleClassSfx . '">';
echo '<' . $moduleTag . ' class="cpanel-module mb-3 card card-block' . $moduleClassSfx . '" data-moduleid="' . $module->id . '">';

if ($canEdit)
{
echo '<div class="btn-group module-dropdown">';
echo '<a href="#" data-toggle="dropdown"><span class="fa fa-cog"></span></a>';
echo '<div class="dropdown-menu dropdown-menu-right">';
echo '<a class="dropdown-item" href="' . JRoute::_('index.php?option=com_modules&task=module.edit&id=' . (int) $module->id) . '">' . JText::_('JACTION_EDIT') . '</a>';
echo '<a class="dropdown-item unpublish" href="#">' . JText::_('JACTION_UNPUBLISH') . '</a>';
echo '</div>';
echo '</div>';
}
Expand Down