Change Atum layouts for the newest incarnation of the template, adjust filtering logic a bit so it's closer to core search tools implementation

This commit is contained in:
Michael Babker 2019-08-27 19:44:51 -05:00
parent 3ad49d72ec
commit d29861df2f
11 changed files with 172 additions and 148 deletions

View File

@ -19,20 +19,12 @@ use Joomla\Registry\Registry;
class DisplayController extends AbstractController
{
/**
* Default ordering column
* Default ordering value
*
* @var string
* @since 2.0
* @since __DEPLOY_VERSION__
*/
protected $defaultOrderColumn = 'a.pull_id';
/**
* Default sort direction
*
* @var string
* @since 2.0
*/
protected $defaultDirection = 'DESC';
protected $defaultFullOrdering = 'a.pull_id DESC';
/**
* Execute the controller.
@ -117,27 +109,34 @@ class DisplayController extends AbstractController
$limit = $this->getApplication()->getUserStateFromRequest('global.list.limit', 'limit', $this->getApplication()->get('list_limit', 20), 'uint');
$state->set('list.limit', $limit);
// Check if the ordering field is in the white list, otherwise use the incoming value.
$value = $this->getApplication()->getUserStateFromRequest($this->context . '.ordercol', 'filter_order', $this->defaultOrderColumn);
$fullOrdering = $this->getApplication()->getUserStateFromRequest($this->context . '.fullorder', 'list_fullordering', $this->defaultFullOrdering);
if (!in_array($value, $model->getSortFields()))
$orderingParts = explode(' ', $fullOrdering);
if (count($orderingParts) !== 2)
{
$value = $this->defaultOrderColumn;
$this->getApplication()->setUserState($this->context . '.ordercol', $value);
$fullOrdering = $this->defaultFullOrdering;
$orderingParts = explode(' ', $fullOrdering);
}
$state->set('list.ordering', $value);
$state->set('list.fullordering', $fullOrdering);
// Check if the ordering direction is valid, otherwise use the incoming value.
$value = $this->getApplication()->getUserStateFromRequest($this->context . '.orderdirn', 'filter_order_Dir', $this->defaultDirection);
// The 2nd part will be considered the direction
$direction = $orderingParts[array_key_last($orderingParts)];
if (!in_array(strtoupper($value), array('ASC', 'DESC', '')))
if (in_array(strtoupper($direction), array('ASC', 'DESC', '')))
{
$value = $this->defaultDirection;
$this->getApplication()->setUserState($this->context . '.orderdirn', $value);
$state->set('list.direction', $direction);
}
$state->set('list.direction', $value);
// The 1st part will be the ordering
$ordering = $orderingParts[array_key_first($orderingParts)];
if (in_array($ordering, $model->getSortFields()))
{
$state->set('list.ordering', $ordering);
}
$value = $this->getApplication()->getUserStateFromRequest($this->context . '.limitstart', 'limitstart', 0);
$limitstart = ($limit != 0 ? (floor($value / $limit) * $limit) : 0);

View File

@ -34,7 +34,7 @@ class PullsModel extends \JModelDatabase
* @var array
* @since 2.0
*/
protected $sortFields = array('a.pull_id', 'a.title', 'applied');
protected $sortFields = array('a.pull_id', 'a.title');
/**
* Instantiate the model.
@ -169,20 +169,14 @@ class PullsModel extends \JModelDatabase
}
// Handle the list ordering.
$ordering = $this->getState()->get('list.ordering');
$direction = $this->getState()->get('list.direction');
$ordering = $this->getState()->get('list.ordering', 'a.pull_id');
$direction = $this->getState()->get('list.direction', 'DESC');
if (!empty($ordering))
{
$query->order($db->escape($ordering) . ' ' . $db->escape($direction));
}
// If $ordering is by applied patches, then append sort on pull_id also
if ($ordering === 'applied')
{
$query->order('a.pull_id ' . $db->escape($direction));
}
return $query;
}

View File

@ -156,19 +156,44 @@ class PullsHtmlView extends DefaultHtmlView
\JToolbarHelper::preferences('com_patchtester');
}
/**
* Returns an array of values to be used for pagination limits
*
* @return array
*
* @since __DEPLOY_VERSION__
*/
protected function getLimitOptions()
{
return array(
5 => \JText::_('J5'),
10 => \JText::_('J10'),
15 => \JText::_('J15'),
20 => \JText::_('J20'),
25 => \JText::_('J25'),
30 => \JText::_('J30'),
50 => \JText::_('J50'),
100 => \JText::_('J100'),
200 => \JText::_('J200'),
500 => \JText::_('J500'),
0 => \JText::_('JALL'),
);
}
/**
* Returns an array of fields the table can be sorted by
*
* @return array Array containing the field name to sort by as the key and display text as value
* @return array
*
* @since 2.0
*/
protected function getSortFields()
{
return array(
'a.title' => \JText::_('JGLOBAL_TITLE'),
'a.pull_id' => \JText::_('COM_PATCHTESTER_PULL_ID'),
'applied' => \JText::_('JSTATUS')
'a.title ASC' => \JText::_('JGLOBAL_TITLE_ASC'),
'a.title DESC' => \JText::_('JGLOBAL_TITLE_DESC'),
'a.pull_id ASC' => \JText::_('COM_PATCHTESTER_PULL_ID_ASC'),
'a.pull_id DESC' => \JText::_('COM_PATCHTESTER_PULL_ID_DESC'),
);
}
}

View File

@ -11,15 +11,13 @@
\JHtml::_('behavior.core');
\JHtml::_('bootstrap.tooltip');
\JHtml::_('formbehavior.chosen', 'select');
\JHtml::_('stylesheet', 'com_patchtester/octicons.css', array('version' => 'auto', 'relative' => true));
\JHtml::_('stylesheet', 'com_patchtester/octicons.css', array('version' => '3.5.0', 'relative' => true));
\JHtml::_('script', 'com_patchtester/patchtester.js', array('version' => 'auto', 'relative' => true));
$listOrder = $this->escape($this->state->get('list.ordering'));
$listDirn = $this->escape($this->state->get('list.direction'));
$listOrder = $this->escape($this->state->get('list.fullordering', 'a.pull_id DESC'));
$filterApplied = $this->escape($this->state->get('filter.applied'));
$filterBranch = $this->escape($this->state->get('filter.branch'));
$filterRtc = $this->escape($this->state->get('filter.rtc'));
$colSpan = $this->trackerAlias !== false ? 8 : 7;
?>
<form action="<?php echo \JRoute::_('index.php?option=com_patchtester&view=pulls'); ?>" method="post" name="adminForm" id="adminForm" data-order="<?php echo $listOrder; ?>">
<div id="j-main-container">
@ -36,17 +34,9 @@ $colSpan = $this->trackerAlias !== false ? 8 : 7;
<label for="limit" class="element-invisible"><?php echo \JText::_('JFIELD_PLG_SEARCH_SEARCHLIMIT_DESC'); ?></label>
<?php echo $this->pagination->getLimitBox(); ?>
</div>
<div class="btn-group pull-right hidden-phone">
<label for="directionTable" class="element-invisible"><?php echo \JText::_('JFIELD_ORDERING_DESC'); ?></label>
<select name="directionTable" id="directionTable" class="input-medium" onchange="PatchTester.orderTable()">
<option value=""><?php echo \JText::_('JFIELD_ORDERING_DESC');?></option>
<option value="asc"<?php if ($listDirn == 'asc') echo ' selected="selected"'; ?>><?php echo \JText::_('JGLOBAL_ORDER_ASCENDING'); ?></option>
<option value="desc"<?php if ($listDirn == 'desc') echo ' selected="selected"'; ?>><?php echo \JText::_('JGLOBAL_ORDER_DESCENDING'); ?></option>
</select>
</div>
<div class="btn-group pull-right">
<label for="sortTable" class="element-invisible"><?php echo \JText::_('JGLOBAL_SORT_BY'); ?></label>
<select name="sortTable" id="sortTable" class="input-medium" onchange="PatchTester.orderTable()">
<label for="list_fullordering" class="element-invisible"><?php echo \JText::_('JGLOBAL_SORT_BY'); ?></label>
<select name="list_fullordering" id="list_fullordering" class="input-medium" onchange="this.form.submit();">
<option value=""><?php echo \JText::_('JGLOBAL_SORT_BY'); ?></option>
<?php echo \JHtml::_('select.options', $this->getSortFields(), 'value', 'text', $listOrder);?>
</select>
@ -90,10 +80,10 @@ $colSpan = $this->trackerAlias !== false ? 8 : 7;
<th class="nowrap">
<?php echo \JText::_('JGLOBAL_TITLE'); ?>
</th>
<th width="8%" class="nowrap center">
<th width="8%" class="nowrap center hidden-phone">
<?php echo \JText::_('COM_PATCHTESTER_BRANCH'); ?>
</th>
<th width="8%" class="nowrap center">
<th width="8%" class="nowrap center hidden-phone">
<?php echo \JText::_('COM_PATCHTESTER_READY_TO_COMMIT'); ?>
</th>
<th width="8%" class="nowrap center">
@ -123,8 +113,6 @@ $colSpan = $this->trackerAlias !== false ? 8 : 7;
<input type="hidden" name="task" value="" />
<input type="hidden" name="boxchecked" value="0" />
<input type="hidden" name="pull_id" id="pull_id" value="" />
<input type="hidden" name="filter_order" value="<?php echo $listOrder; ?>" />
<input type="hidden" name="filter_order_Dir" value="<?php echo $listDirn; ?>" />
<?php echo \JHtml::_('form.token'); ?>
</div>
</form>

View File

@ -27,10 +27,10 @@ foreach ($this->items as $i => $item) :
</div>
<?php endif; ?>
</td>
<td class="center">
<td class="center hidden-phone">
<?php echo $this->escape($item->branch); ?>
</td>
<td class="center">
<td class="center hidden-phone">
<?php if ($item->is_rtc) : ?>
<span class="label label-success"><?php echo \JText::_('JYES'); ?></span>
<?php else : ?>

View File

@ -71,12 +71,15 @@ COM_PATCHTESTER_GITHUB="GitHub"
COM_PATCHTESTER_HEADING_FETCH_DATA="Fetching GitHub Data"
COM_PATCHTESTER_JISSUE="J! Issue"
COM_PATCHTESTER_JISSUES="Issue Tracker"
COM_PATCHTESTER_PULL_ID="Pull ID"
COM_PATCHTESTER_NO_CREDENTIALS="You have not entered your user credentials in the Options. This will limit you to only 60 requests to the GitHub API per hour. Adding your credentials will allow 5,000 requests per hour."
COM_PATCHTESTER_NO_FILES_TO_PATCH="There are no files to patch from this pull request. This may mean that the files in the pull request are not present in your installation."
COM_PATCHTESTER_NO_ITEMS="No data has been retrieved from GitHub, please click the 'Fetch Data' button in the toolbar to retrieve the open pull requests."
COM_PATCHTESTER_NOT_APPLIED="Not Applied"
COM_PATCHTESTER_NOT_RTC="Not RTC"
COM_PATCHTESTER_PULL_ID="Pull ID"
COM_PATCHTESTER_PULL_ID_ASC="Pull ID ascending"
COM_PATCHTESTER_PULL_ID_DESC="Pull ID descending"
COM_PATCHTESTER_PULLS_TABLE_CAPTION="Table of Pull Requests"
COM_PATCHTESTER_READY_TO_COMMIT="Ready to Commit"
COM_PATCHTESTER_REPO_IS_GONE="The patch could not be applied because the repository is missing"
COM_PATCHTESTER_REQUIREMENT_HTTPS="HTTPS wrappers must be enabled"
@ -91,3 +94,5 @@ COM_PATCHTESTER_RTC="RTC"
COM_PATCHTESTER_TEST_THIS_PATCH="Test This Patch"
COM_PATCHTESTER_TOOLBAR_FETCH_DATA="Fetch Data"
COM_PATCHTESTER_TOOLBAR_RESET="Reset"
COM_PATCHTESTER_VIEW_ON_GITHUB="View on GitHub"
COM_PATCHTESTER_VIEW_ON_JOOMLA_ISSUE_TRACKER="View on Joomla! Issue Tracker"

View File

@ -0,0 +1,26 @@
<?php
/**
* Patch testing component for the Joomla! CMS
*
* @copyright Copyright (C) 2011 - 2012 Ian MacLennan, Copyright (C) 2013 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later
*/
use Joomla\CMS\Factory;
/** @var \PatchTester\View\DefaultHtmlView $this */
\JHtml::_('jquery.framework');
\JHtml::_('behavior.core');
\JHtml::_('script', 'com_patchtester/fetcher.js', array('version' => 'auto', 'relative' => true));
?>
<div id="patchtester-container">
<h1 id="patchtester-progress-header"><?php echo \JText::_('COM_PATCHTESTER_FETCH_INITIALIZING'); ?></h1>
<p id="patchtester-progress-message"><?php echo \JText::_('COM_PATCHTESTER_FETCH_INITIALIZING_DESCRIPTION'); ?></p>
<div id="progress" class="progress">
<div id="progress-bar" class="progress-bar progress-bar-striped progress-bar-animated bg-success" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" role="progressbar"></div>
</div>
<input id="patchtester-token" type="hidden" name="<?php echo Factory::getSession()->getFormToken(); ?>" value="1" />
</div>

View File

@ -15,73 +15,75 @@ $searchToolsOptions = array(
'searchFieldSelector' => '#filter_search',
'selectorFieldName' => 'client_id',
'showSelector' => false,
'orderFieldSelector' => '#sortTable',
'orderFieldSelector' => '#list_fullordering',
'showNoResults' => false,
'noResultsText' => '',
'formSelector' => '#adminForm',
);
\JHtml::_('behavior.core');
\JHtml::_('bootstrap.tooltip');
\JHtml::_('searchtools.form', '#adminForm', $searchToolsOptions);
\JHtml::_('stylesheet', 'com_patchtester/octicons.css', array('version' => 'auto', 'relative' => true));
\JHtml::_('stylesheet', 'com_patchtester/octicons.css', array('version' => '3.5.0', 'relative' => true));
\JHtml::_('script', 'com_patchtester/patchtester.js', array('version' => 'auto', 'relative' => true));
$listOrder = $this->escape($this->state->get('list.ordering'));
$listDirn = $this->escape($this->state->get('list.direction', 'desc'));
$listOrder = $this->escape($this->state->get('list.fullordering', 'a.pull_id DESC'));
$listLimit = (int) ($this->state->get('list.limit'));
$filterApplied = $this->escape($this->state->get('filter.applied'));
$filterBranch = $this->escape($this->state->get('filter.branch'));
$filterRtc = $this->escape($this->state->get('filter.rtc'));
$colSpan = $this->trackerAlias !== false ? 8 : 7;
?>
<form action="<?php echo \JRoute::_('index.php?option=com_patchtester&view=pulls'); ?>" method="post" name="adminForm" id="adminForm" data-order="<?php echo $listOrder; ?>">
<form action="<?php echo \JRoute::_('index.php?option=com_patchtester&view=pulls'); ?>" method="post" name="adminForm" id="adminForm">
<div class="row">
<div class="col-md-12">
<div id="j-main-container" class="j-main-container">
<div class="js-stools" role="search">
<div class="js-stools-container-bar">
<label for="filter_search" class="sr-only">
<?php echo \JText::_('COM_PATCHTESTER_FILTER_SEARCH_DESCRIPTION'); ?>
</label>
<div class="btn-toolbar">
<div class="btn-group mr-2">
<div class="input-group">
<input type="text" name="filter_search" id="filter_search" value="<?php echo $this->escape($this->state->get('filter.search')); ?>" class="form-control" title="<?php echo \JText::_('COM_PATCHTESTER_FILTER_SEARCH_DESCRIPTION'); ?>" placeholder="<?php echo \JText::_('JSEARCH_FILTER'); ?>">
<label for="filter_search" class="sr-only">
<?php echo \JText::_('COM_PATCHTESTER_FILTER_SEARCH_DESCRIPTION'); ?>
</label>
<input type="text" name="filter_search" id="filter_search" value="<?php echo $this->escape($this->state->get('filter.search')); ?>" class="form-control" placeholder="<?php echo \JText::_('JSEARCH_FILTER'); ?>">
<div role="tooltip" id="filter_search-desc">
<?php echo $this->escape(\JText::_('COM_PATCHTESTER_FILTER_SEARCH_DESCRIPTION')); ?>
</div>
<span class="input-group-append">
<button type="submit" class="btn btn-primary hasTooltip" title="<?php echo \JHtml::_('tooltipText', 'JSEARCH_FILTER_SUBMIT'); ?>" aria-label="<?php echo \JText::_('JSEARCH_FILTER_SUBMIT'); ?>">
<button type="submit" class="btn btn-primary" aria-label="<?php echo \JText::_('JSEARCH_FILTER_SUBMIT'); ?>">
<span class="fa fa-search" aria-hidden="true"></span>
</button>
</span>
</div>
</div>
<button type="button" class="btn btn-primary hasTooltip js-stools-btn-clear mr-2" title="<?php echo \JHtml::_('tooltipText', 'JSEARCH_FILTER_CLEAR'); ?>">
<?php echo \JText::_('JSEARCH_FILTER_CLEAR'); ?>
</button>
<div class="btn-group">
<button type="button" class="btn btn-primary hasTooltip js-stools-btn-filter">
<?php echo \JText::_('JFILTER_OPTIONS'); ?>
<span class="fa fa-caret-down" aria-hidden="true"></span>
<span class="fa fa-angle-down" aria-hidden="true"></span>
</button>
<button type="button" class="btn btn-primary js-stools-btn-clear mr-2">
<?php echo \JText::_('JSEARCH_FILTER_CLEAR'); ?>
</button>
</div>
<div class="ordering-select">
<div class="js-stools-field-list">
<select name="list_fullordering" id="list_fullordering" class="custom-select" onchange="this.form.submit()">
<option value=""><?php echo \JText::_('JGLOBAL_SORT_BY'); ?></option>
<?php echo \JHtml::_('select.options', $this->getSortFields(), 'value', 'text', $listOrder); ?>
</select>
</div>
<div class="js-stools-field-list">
<span class="sr-only">
<label id="list_limit-lbl" for="list_limit">Select number of items per page.</label>
</span>
<select name="list_limit" id="list_limit" class="custom-select" onchange="this.form.submit()">
<?php echo \JHtml::_('select.options', $this->getLimitOptions(), 'value', 'text', $listLimit); ?>
</select>
</div>
</div>
</div>
</div>
<!-- Filters div -->
<div class="js-stools-container-filters clearfix">
<div class="ordering-select">
<div class="js-stools-field-list">
<select name="sortTable" id="sortTable" class="custom-select" onchange="PatchTester.orderTable()">
<option value=""><?php echo \JText::_('JGLOBAL_SORT_BY'); ?></option>
<?php echo \JHtml::_('select.options', $this->getSortFields(), 'value', 'text', $listOrder); ?>
</select>
</div>
<div class="js-stools-field-list">
<select name="directionTable" id="directionTable" class="custom-select" onchange="PatchTester.orderTable()">
<option value=""><?php echo \JText::_('JFIELD_ORDERING_DESC');?></option>
<option value="asc"<?php if (strtolower($listDirn) === 'asc') echo ' selected="selected"'; ?>><?php echo \JText::_('JGLOBAL_ORDER_ASCENDING'); ?></option>
<option value="desc"<?php if (strtolower($listDirn) === 'desc') echo ' selected="selected"'; ?>><?php echo \JText::_('JGLOBAL_ORDER_DESCENDING'); ?></option>
</select>
</div>
</div>
<div class="js-stools-field-filter">
<select name="filter_applied" class="custom-select" onchange="this.form.submit();">
<option value=""><?php echo \JText::_('COM_PATCHTESTER_FILTER_APPLIED_PATCHES'); ?></option>
@ -106,37 +108,33 @@ $colSpan = $this->trackerAlias !== false ? 8 : 7;
</div>
<div id="j-main-container" class="j-main-container">
<?php if (empty($this->items)) : ?>
<div class="alert alert-warning alert-no-items">
<div class="alert alert-info">
<span class="fa fa-info-circle" aria-hidden="true"></span><span class="sr-only"><?php echo \JText::_('INFO'); ?></span>
<?php echo \JText::_('JGLOBAL_NO_MATCHING_RESULTS'); ?>
</div>
<?php else : ?>
<table class="table">
<caption id="captionTable" class="sr-only">
<?php echo \JText::_('COM_PATCHTESTER_PULLS_TABLE_CAPTION'); ?>, <?php echo \JText::_('JGLOBAL_SORTED_BY'); ?>
</caption>
<thead>
<tr>
<th width="5%" class="nowrap text-center">
<th scope="col" style="width:5%" class="text-center">
<?php echo \JText::_('COM_PATCHTESTER_PULL_ID'); ?>
</th>
<th class="nowrap">
<th scope="col" style="min-width:100px">
<?php echo \JText::_('JGLOBAL_TITLE'); ?>
</th>
<th width="8%" class="nowrap text-center">
<th scope="col" style="width:8%" class="d-none d-md-table-cell text-center">
<?php echo \JText::_('COM_PATCHTESTER_BRANCH'); ?>
</th>
<th width="8%" class="nowrap text-center">
<th scope="col" style="width:8%" class="d-none d-md-table-cell text-center">
<?php echo \JText::_('COM_PATCHTESTER_READY_TO_COMMIT'); ?>
</th>
<th width="8%" class="nowrap text-center">
<?php echo \JText::_('COM_PATCHTESTER_GITHUB'); ?>
</th>
<?php if ($this->trackerAlias !== false) : ?>
<th width="8%" class="nowrap text-center">
<?php echo \JText::_('COM_PATCHTESTER_JISSUES'); ?>
</th>
<?php endif; ?>
<th width="10%" class="nowrap text-center">
<th scope="col" style="width:10%" class="text-center">
<?php echo \JText::_('JSTATUS'); ?>
</th>
<th width="15%" class="nowrap text-center">
<th scope="col" style="width:15%" class="text-center">
<?php echo \JText::_('COM_PATCHTESTER_TEST_THIS_PATCH'); ?>
</th>
</tr>
@ -152,8 +150,6 @@ $colSpan = $this->trackerAlias !== false ? 8 : 7;
<input type="hidden" name="task" value="" />
<input type="hidden" name="boxchecked" value="0" />
<input type="hidden" name="pull_id" id="pull_id" value="" />
<input type="hidden" name="filter_order" value="<?php echo $listOrder; ?>" />
<input type="hidden" name="filter_order_Dir" value="<?php echo $listDirn; ?>" />
<?php echo \JHtml::_('form.token'); ?>
</div>
</div>

View File

@ -16,39 +16,42 @@ foreach ($this->items as $i => $item) :
endif;
?>
<tr<?php echo $status; ?>>
<td class="text-center">
<th scope="row" class="text-center">
<?php echo $item->pull_id; ?>
</td>
</th>
<td>
<span class="hasTooltip" title="<strong>Info</strong><br/><?php echo $this->escape($item->description); ?>"><?php echo $this->escape($item->title); ?></span>
<?php if ($item->applied) : ?>
<div>
<span class="badge badge-info"><?php echo \JText::sprintf('COM_PATCHTESTER_APPLIED_COMMIT_SHA', substr($item->sha, 0, 10)); ?></span>
<span><?php echo $this->escape($item->title); ?></span>
<div role="tooltip" id="tip<?php echo $i; ?>">
<?php echo $this->escape($item->description); ?>
</div>
<div class="row">
<div class="col-md-auto">
<a class="badge badge-info" href="<?php echo $item->pull_url; ?>" target="_blank">
<?php echo \JText::_('COM_PATCHTESTER_VIEW_ON_GITHUB'); ?>
</a>
</div>
<?php endif; ?>
<div class="col-md-auto">
<a class="badge badge-info" href="https://issues.joomla.org/tracker/<?php echo $this->trackerAlias; ?>/<?php echo $item->pull_id; ?>" target="_blank">
<?php echo \JText::_('COM_PATCHTESTER_VIEW_ON_JOOMLA_ISSUE_TRACKER'); ?>
</a>
</div>
<?php if ($item->applied) : ?>
<div class="col-md-auto">
<span class="badge badge-info"><?php echo \JText::sprintf('COM_PATCHTESTER_APPLIED_COMMIT_SHA', substr($item->sha, 0, 10)); ?></span>
</div>
<?php endif; ?>
</div>
</td>
<td class="text-center">
<td class="d-none d-md-table-cell text-center">
<?php echo $this->escape($item->branch); ?>
</td>
<td class="text-center">
<td class="d-none d-md-table-cell text-center">
<?php if ($item->is_rtc) : ?>
<span class="badge badge-success"><?php echo \JText::_('JYES'); ?></span>
<?php else : ?>
<span class="badge badge-secondary"><?php echo \JText::_('JNO'); ?></span>
<?php endif; ?>
</td>
<td class="text-center">
<a class="btn btn-sm btn-info" href="<?php echo $item->pull_url; ?>" target="_blank">
<span class="octicon octicon-mark-github"></span> <?php echo \JText::_('COM_PATCHTESTER_GITHUB'); ?>
</a>
</td>
<?php if ($this->trackerAlias !== false) : ?>
<td class="text-center">
<a class="btn btn-sm btn-warning" href="https://issues.joomla.org/tracker/<?php echo $this->trackerAlias; ?>/<?php echo $item->pull_id; ?>" target="_blank">
<i class="icon-joomla"></i> <?php echo \JText::_('COM_PATCHTESTER_JISSUE'); ?>
</a>
</td>
<?php endif; ?>
<td class="text-center">
<?php if ($item->applied) : ?>
<span class="badge badge-success"><?php echo \JText::_('COM_PATCHTESTER_APPLIED'); ?></span>
@ -58,9 +61,9 @@ foreach ($this->items as $i => $item) :
</td>
<td class="text-center">
<?php if ($item->applied) : ?>
<a class="btn btn-sm btn-success" href="javascript:PatchTester.submitpatch('revert', '<?php echo (int) $item->applied; ?>');"><?php echo \JText::_('COM_PATCHTESTER_REVERT_PATCH'); ?></a><br />
<button class="btn btn-sm btn-success" onclick="PatchTester.submitpatch('revert', '<?php echo (int) $item->applied; ?>');"><?php echo \JText::_('COM_PATCHTESTER_REVERT_PATCH'); ?></button>
<?php else : ?>
<a class="btn btn-sm btn-primary" href="javascript:PatchTester.submitpatch('apply', '<?php echo (int) $item->pull_id; ?>');"><?php echo \JText::_('COM_PATCHTESTER_APPLY_PATCH'); ?></a>
<button class="btn btn-sm btn-primary" onclick="PatchTester.submitpatch('apply', '<?php echo (int) $item->pull_id; ?>');"><?php echo \JText::_('COM_PATCHTESTER_APPLY_PATCH'); ?></button>
<?php endif; ?>
</td>
</tr>

View File

@ -64,8 +64,14 @@ if (typeof Joomla === 'undefined') {
if (progress < 100) {
progressBar.css('width', progress + '%').attr('aria-valuenow', progress);
} else {
progressBar.removeClass('bar-success').addClass('bar-warning').attr('aria-valuemin', 100).attr('aria-valuemax', 200);
progressBar.css('width', progress + '%').attr('aria-valuenow', progress);
// Both BS2 and BS4 classes are targeted to keep this script simple
progressBar
.removeClass('bar-success bg-success')
.addClass('bar-warning bg-warning')
.css('width', progress + '%')
.attr('aria-valuemin', 100)
.attr('aria-valuemax', 200)
.attr('aria-valuenow', progress);
}
}

View File

@ -13,24 +13,6 @@ if (typeof Joomla === 'undefined') {
'use strict';
window.PatchTester = {
/**
* Re-order the pull request list table
*/
orderTable: function () {
var table = document.getElementById('sortTable'),
direction = document.getElementById('directionTable'),
order = table.options[table.selectedIndex].value,
currentOrder = document.getElementById('adminForm').getAttribute('data-order').valueOf();
if (order != currentOrder) {
var dirn = 'asc';
} else {
var dirn = direction.options[direction.selectedIndex].value;
}
Joomla.tableOrdering(order, dirn, '');
},
/**
* Process the patch action
*