Skip to content

Commit

Permalink
Merge pull request #312 from apghalsasi25/bug#152999_new
Browse files Browse the repository at this point in the history
Bug #311 fix: Frontend>>Editor field not working correctly.
  • Loading branch information
ankush-maherwal authored Jan 21, 2020
2 parents feab747 + 4447745 commit b50ebe3
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 51 deletions.
26 changes: 21 additions & 5 deletions src/components/com_tjucm/site/layouts/detail/fields.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php
/**
* @package TJ-UCM
*
* @author TechJoomla <[email protected]>
* @package TJ-UCM
*
* @author TechJoomla <[email protected]>
* @copyright Copyright (c) 2009-2019 TechJoomla. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

// No direct access
Expand Down Expand Up @@ -63,6 +63,7 @@
$count++;
$fieldCount = 0;
?>
<div class="tjucm-wrapper">
<div class="row">
<?php
foreach ($formObject->getFieldset($fieldset->name) as $field)
Expand Down Expand Up @@ -178,7 +179,21 @@

$layout = new JLayoutFile($layoutToUse, JPATH_ROOT . '/components/com_tjfields/layouts/fields');
$output = $layout->render(array('fieldXml' => $xmlField, 'field' => $field));
echo $output;

// To align text, textarea, textareacounter and editor fields properly

if ($field->type == 'Textarea'|| $field->type == 'Textareacounter'|| $field->type == 'Text' || $field->type == 'Editor')
{
?>
<div class="tj-wordwrap">
<?php echo $output; ?>
</div>
<?php
}
else
{
echo $output;
}
?>
</div>
</div>
Expand All @@ -188,5 +203,6 @@
}
?>
</div>
</div>
<?php
}
2 changes: 2 additions & 0 deletions src/components/com_tjucm/site/layouts/list/list.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
}

?>
<div class="tjucm-wrapper">
<tr class="row<?php echo $item->id?>">
<?php
if (isset($item->state))
Expand Down Expand Up @@ -197,3 +198,4 @@ class="delete-button" type="button"
}
?>
</tr>
</div>
105 changes: 59 additions & 46 deletions src/components/com_tjucm/site/views/items/tmpl/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,22 @@
$fieldsData = array();
$statusColumnWidth = 0;
?>
<div class="tjucm-wrapper">
<form action="<?php echo JRoute::_($link . '&Itemid=' . $itemId); ?>" method="post" name="adminForm" id="adminForm">
<?php
if (isset($this->items))
{
?>
<div class="page-header">
<h1 class="page-title">
<?php echo strtoupper($this->title) . " " . JText::_("COM_TJUCM_FORM_LIST"); ?>
<h1>
</div> <?php
}?>
<?php echo $this->loadTemplate('filters'); ?>
<div class="pull-right">
if (isset($this->items))
{
?>
<div class="page-header">
<h1 class="page-title">
<?php echo strtoupper($this->title) . " " . JText::_("COM_TJUCM_FORM_LIST"); ?>
</h1>
</div> <?php
}

echo $this->loadTemplate('filters');
?>
<div class="pull-right">
<?php
if ($this->allowedToAdd)
{
Expand Down Expand Up @@ -90,38 +93,34 @@
if (!empty($this->showList))
{
if (!empty($this->items))
{?>
<thead>
<tr>
<?php
if (isset($this->items[0]->state))
{
{
?>
<thead>
<tr>
<?php
if (isset($this->items[0]->state))
{
?>
<th class="center" width="3%">
<th class="center" width="3%">
<?php echo JHtml::_('grid.sort', 'JPUBLISHED', 'a.state', $listDirn, $listOrder); ?>
</th>
</th>
<?php
}
?>
<th width="2%">
<?php echo JHtml::_('grid.sort', 'COM_TJUCM_ITEMS_ID', 'a.id', $listDirn, $listOrder); ?>
</th>

<?php
if (!empty($this->ucmTypeParams->allow_draft_save) && $this->ucmTypeParams->allow_draft_save == 1)
{
$statusColumnWidth = 2;
?>
}
?>
<th width="2%">
<?php echo JHtml::_('grid.sort', 'COM_TJUCM_DATA_STATUS', 'a.draft', $listDirn, $listOrder); ?>
</th>
<?php
}

if (!empty($this->listcolumn))
{
JTable::addIncludePath(JPATH_ROOT . '/administrator/components/com_tjfields/tables');
$tjFieldsFieldTable = JTable::getInstance('field', 'TjfieldsTable');
if (!empty($this->ucmTypeParams->allow_draft_save) && $this->ucmTypeParams->allow_draft_save == 1)
{
$statusColumnWidth = 2;
?>
<th width="2%">
<?php echo JHtml::_('grid.sort', 'COM_TJUCM_DATA_STATUS', 'a.draft', $listDirn, $listOrder); ?>
</th>
<?php
}

foreach ($this->listcolumn as $fieldId => $col_name)
{
Expand All @@ -137,12 +136,11 @@
}
?>

<th style="word-break: break-word;" width="<?php echo (85 - $statusColumnWidth)/count($this->listcolumn).'%';?>">
<th style="word-break: break-word;" width="<?php echo (85 - $statusColumnWidth) / count($this->listcolumn) . '%';?>">
<?php echo htmlspecialchars($col_name, ENT_COMPAT, 'UTF-8'); ?>
</th>
<?php
}
}

if ($this->canEdit || $this->canDelete)
{
Expand All @@ -153,18 +151,18 @@
<?php
}
?>
</tr>
</thead>
<?php
}
}?>
</tr>
</thead>
<?php
}
}?>
<?php
if (!empty($this->items))
{
?>
<tfoot>
<tr>
<td colspan="<?php echo isset($this->items[0]) ? count($this->items[0]->field_values)+3 : 10; ?>">
<td colspan="<?php echo isset($this->items[0]) ? count($this->items[0]->field_values) + 3 : 10; ?>">
<?php echo $this->pagination->getListFooter(); ?>
</td>
</tr>
Expand Down Expand Up @@ -197,7 +195,18 @@
{
// Call the JLayout to render the fields in the details view
$layout = new JLayoutFile('list.list', JPATH_ROOT . '/components/com_tjucm/');
echo $layout->render(array('itemsData' => $item, 'created_by' => $this->created_by, 'client' => $this->client, 'xmlFormObject' => $formXml, 'ucmTypeId' => $this->ucmTypeId, 'ucmTypeParams' => $this->ucmTypeParams, 'fieldsData' => $fieldsData, 'formObject' => $formObject));
echo $layout->render(
array(
'itemsData' => $item,
'created_by' => $this->created_by,
'client' => $this->client,
'xmlFormObject' => $formXml,
'ucmTypeId' => $this->ucmTypeId,
'ucmTypeParams' => $this->ucmTypeParams,
'fieldsData' => $fieldsData,
'formObject' => $formObject
)
);
}
}
else
Expand All @@ -223,8 +232,11 @@
if ($this->allowedToAdd)
{
?>
<a target="_blank" href="<?php echo JRoute::_('index.php?option=com_tjucm&task=itemform.edit' . $appendUrl, false); ?>" class="btn btn-success btn-small">
<i class="icon-plus"></i><?php echo JText::_('COM_TJUCM_ADD_ITEM'); ?>
<a target="_blank"
href="<?php echo JRoute::_('index.php?option=com_tjucm&task=itemform.edit' . $appendUrl, false); ?>"
class="btn btn-success btn-small">
<i class="icon-plus"></i>
<?php echo JText::_('COM_TJUCM_ADD_ITEM'); ?>
</a>
<?php
}
Expand All @@ -235,6 +247,7 @@
<input type="hidden" name="filter_order_Dir" value="<?php echo $listDirn; ?>"/>
<?php echo JHtml::_('form.token'); ?>
</form>
</div>
<?php
if ($this->canDelete)
{
Expand Down

0 comments on commit b50ebe3

Please sign in to comment.