Skip to content

Commit

Permalink
Bug techjoomla#311 fix: Frontend>>Editor field not working correctly.
Browse files Browse the repository at this point in the history
  • Loading branch information
Aishwarya committed Dec 19, 2019
1 parent ddac4a5 commit 3289571
Show file tree
Hide file tree
Showing 4 changed files with 151 additions and 105 deletions.
2 changes: 1 addition & 1 deletion src/components/com_tjucm/media/css/tjucm.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ margin-left:5px !important;
width:200px !important;
}

p.tj-wordwrap{
.tjucm-wrapper .tj-wordwrap{
word-break: break-word;
}
20 changes: 12 additions & 8 deletions src/components/com_tjucm/site/layouts/detail/fields.php
Original file line number Diff line number Diff line change
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 @@ -162,7 +163,7 @@
$layoutToUse = (array_key_exists($field->type, $fieldLayout)) ? $fieldLayout[$field->type] : 'field';
?>
<div class="<?php echo $controlGroupDivClass;?>">
<div class="<?php echo $labelDivClass;?>">
<div class="<?php echo $labelDivClass;?>">
<?php echo $field->label; ?>:
</div>
<div class="<?php echo $controlDivClass;?>">
Expand All @@ -186,18 +187,20 @@
$layout = new JLayoutFile($layoutToUse, JPATH_ROOT . '/components/com_tjfields/layouts/fields');
$output = $layout->render(array('fieldXml' => $xmlField, 'field' => $field));

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

if ($field->type == 'Textarea'|| $field->type == 'Textareacounter'|| $field->type == 'Text')
if ($field->type == 'Textarea'|| $field->type == 'Textareacounter'|| $field->type == 'Text' || $field->type == 'Editor')
{
?>
<p class="tj-wordwrap">
<div class="tj-wordwrap">
<?php echo $output; ?>
</p>
<?php
</div>
<?php
}
else
{
echo $output;
}

echo $output;
?>
</div>
</div>
Expand All @@ -207,5 +210,6 @@
}
?>
</div>
</div>
<?php
}
49 changes: 38 additions & 11 deletions src/components/com_tjucm/site/layouts/list/list.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php
/**
* @package TJ-UCM
* @package TJ-UCM
*
* @author TechJoomla <[email protected]>
* @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 @@ -51,7 +51,7 @@
$xmlFormObject = $displayData['xmlFormObject'];
$formObject = $displayData['formObject'];
$ucmTypeId = $displayData['ucmTypeId'];
$allowDraftSave= $displayData['ucmTypeParams']->allow_draft_save;
$allowDraftSave = $displayData['ucmTypeParams']->allow_draft_save;

$appendUrl = '';
$csrf = "&" . Session::getFormToken() . '=1';
Expand Down Expand Up @@ -93,13 +93,16 @@
}

?>
<div class="tjucm-wrapper">
<tr class="row<?php echo $item->id?>">
<?php
if (isset($item->state))
{
$class = ($canChange) ? 'active' : 'disabled'; ?>
<td class="center">
<a class="<?php echo $class; ?>" href="<?php echo ($canChange) ? 'index.php?option=com_tjucm&task=item.publish&id=' . $item->id . '&state=' . (($item->state + 1) % 2) . $appendUrl . $csrf : '#'; ?>">
<a class="<?php echo $class; ?>"
href="<?php echo ($canChange) ? 'index.php?option=com_tjucm&task=item.publish&id=' .
$item->id . '&state=' . (($item->state + 1) % 2) . $appendUrl . $csrf : '#'; ?>">
<?php
if ($item->state == 1)
{
Expand All @@ -116,16 +119,21 @@
}
?>
<td>
<a href="<?php echo Route::_('index.php?option=com_tjucm&view=item&id=' . (int) $item->id . "&client=" . $client . '&Itemid=' . $itemId, false); ?>">
<a href="<?php echo Route::_(
'index.php?option=com_tjucm&view=item&id=' .
(int) $item->id . "&client=" . $client . '&Itemid=' . $itemId, false
); ?>">
<?php echo $this->escape($item->id); ?>
</a>
</td>
<?php
if ($allowDraftSave)
{ ?>
{
?>
<td><?php echo ($item->draft) ? Text::_('COM_TJUCM_DATA_STATUS_DRAFT') : Text::_('COM_TJUCM_DATA_STATUS_SAVE'); ?></td>
<?php
}

if (!empty($item->field_values))
{
foreach ($item->field_values as $key => $fieldValue)
Expand All @@ -147,7 +155,11 @@
{
$field = $formObject->getField($tjFieldsFieldTable->name);
$field->setValue($fieldValue);
$layoutToUse = (array_key_exists(ucfirst($tjFieldsFieldTable->type), $fieldLayout)) ? $fieldLayout[ucfirst($tjFieldsFieldTable->type)] : 'field';
$layoutToUse = (
array_key_exists(
ucfirst($tjFieldsFieldTable->type), $fieldLayout
)
) ? $fieldLayout[ucfirst($tjFieldsFieldTable->type)] : 'field';
$layout = new JLayoutFile($layoutToUse, JPATH_ROOT . '/components/com_tjfields/layouts/fields');
$output = $layout->render(array('fieldXml' => $fieldXml, 'field' => $field));
echo $output;
Expand All @@ -156,22 +168,36 @@
</td><?php
}
}

if ($canEdit || $canDelete || $editown || $deleteOwn)
{
?>
<td class="center">
<a target="_blank" href="<?php echo $link; ?>" type="button" title="<?php echo Text::_('COM_TJUCM_VIEW_RECORD');?>"><i class="icon-eye-open"></i></a>
<a target="_blank" href="<?php echo $link; ?>"
type="button" title="<?php echo Text::_('COM_TJUCM_VIEW_RECORD');?>">
<i class="icon-eye-open"></i>
</a>
<?php
if ($canEdit || $editown)
{
?>
<a target="_blank" href="<?php echo 'index.php?option=com_tjucm&task=itemform.edit&id=' . $item->id . $appendUrl; ?>" type="button" title="<?php echo Text::_('COM_TJUCM_EDIT_ITEM');?>"> | <i class="icon-apply" aria-hidden="true"></i></a>
<a target="_blank"
href="<?php echo 'index.php?option=com_tjucm&task=itemform.edit&id=' . $item->id . $appendUrl; ?>"
type="button"
title="<?php echo Text::_('COM_TJUCM_EDIT_ITEM');?>"> |
<i class="icon-apply" aria-hidden="true"></i>
</a>
<?php
}

if ($canDelete || $deleteOwn)
{
?>
<a href="<?php echo 'index.php?option=com_tjucm&task=itemform.remove' . '&id=' . $item->id . $appendUrl . $csrf; ?>" class="delete-button" type="button" title="<?php echo Text::_('COM_TJUCM_DELETE_ITEM');?>"> | <i class="icon-delete" aria-hidden="true"></i></a>
<a href="<?php echo 'index.php?option=com_tjucm&task=itemform.remove' . '&id=' . $item->id . $appendUrl . $csrf; ?>"
class="delete-button" type="button"
title="<?php echo Text::_('COM_TJUCM_DELETE_ITEM');?>"> |
<i class="icon-delete" aria-hidden="true"></i>
</a>
<?php
}
?>
Expand All @@ -180,3 +206,4 @@
}
?>
</tr>
</div>
Loading

0 comments on commit 3289571

Please sign in to comment.