Skip to content

Commit

Permalink
Tweaking detail links (view/edit) and the openSingleView() method so …
Browse files Browse the repository at this point in the history
…they work in visualizations (so using a an element set to detail link in a google map bubble will open popup)
  • Loading branch information
cheesegrits committed May 24, 2016
1 parent 2148937 commit 0cdc8a0
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 23 deletions.
12 changes: 10 additions & 2 deletions components/com_fabrik/models/list.php
Original file line number Diff line number Diff line change
Expand Up @@ -2236,9 +2236,17 @@ public function _addLink($data, &$elementModel, $row, $repeatCounter = 0)
$loadMethod = $this->getLoadMethod('custom_link');
$class = 'fabrik___rowlink ' . $class;
$dataList = 'list_' . $this->getRenderContext();
$rowId = $this->getSlug($row);
$isAjax = $this->isAjaxLinks() ? '1' : '0';
if ($target !== '') $target = 'target="' . $target . '"';
$data = '<a data-loadmethod="' . $loadMethod . '" data-list="' . $dataList . '" class="' . $class . '" href="' . $link . '"' . $target . '>' . $data
. '</a>';
$data = '<a data-loadmethod="' . $loadMethod
. '" data-list="' . $dataList
. '" data-rowid="' . $rowId
. '" data-isajax="' . $isAjax
. '" class="' . $class
. '" href="' . $link
. '"' . $target . '>' . $data
. '</a>';

return $data;
}
Expand Down
2 changes: 1 addition & 1 deletion media/com_fabrik/js/dist/fabrik.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

53 changes: 33 additions & 20 deletions media/com_fabrik/js/fabrik.js
Original file line number Diff line number Diff line change
Expand Up @@ -377,16 +377,27 @@ define(['jquery', 'fab/loader', 'fab/requestqueue'], function (jQuery, Loader, R
listRef = jQuery(target).data('list'),
list = Fabrik.blocks[listRef];

if (!list.options.ajax_links) {
if (jQuery(target).data('isajax') !== 1) {
return;
}
e.preventDefault();
row = list.getActiveRow(e);
if (!row || row.length === 0) {
return;

if (list) {
if (!list.options.ajax_links) {
return;
}

row = list.getActiveRow(e);
if (!row || row.length === 0) {
return;
}
list.setActive(row);
rowId = row.prop('id').split('_').pop();
}
list.setActive(row);
rowId = row.prop('id').split('_').pop();
else {
rowId = jQuery(target).data('rowid');
}

e.preventDefault();

if (jQuery(e.target).prop('tagName') === 'A') {
a = jQuery(e.target);
Expand Down Expand Up @@ -428,19 +439,21 @@ define(['jquery', 'fab/loader', 'fab/requestqueue'], function (jQuery, Loader, R
}
};

// Only set width/height if specified, otherwise default to window defaults
if (list.options.popup_width !== '') {
winOpts.width = list.options.popup_width;
}
if (list.options.popup_height !== '') {
winOpts.height = list.options.popup_height;
}
winOpts.id = view === 'details' ? 'view.' + winOpts.id : 'add.' + winOpts.id;
if (list.options.popup_offset_x !== null) {
winOpts.offset_x = list.options.popup_offset_x;
}
if (list.options.popup_offset_y !== null) {
winOpts.offset_y = list.options.popup_offset_y;
if (list) {
// Only set width/height if specified, otherwise default to window defaults
if (list.options.popup_width !== '') {
winOpts.width = list.options.popup_width;
}
if (list.options.popup_height !== '') {
winOpts.height = list.options.popup_height;
}
winOpts.id = view === 'details' ? 'view.' + winOpts.id : 'add.' + winOpts.id;
if (list.options.popup_offset_x !== null) {
winOpts.offset_x = list.options.popup_offset_x;
}
if (list.options.popup_offset_y !== null) {
winOpts.offset_y = list.options.popup_offset_y;
}
}
Fabrik.getWindow(winOpts);
};
Expand Down

0 comments on commit 0cdc8a0

Please sign in to comment.