Guest
23 Oct 2013 04:49

Hey guys,

We are using Cobalt 8 and Emerald 9 on our site as the foundation for our backend.

Although we are using a lot of your front-end solutions our foundation is build with Backbone.

Right now we have two Backbone views, one of all the categories and one with the record list, so it's very easy to navigate all the categories and view the records thanks to Backbone and AJAX.

Of course we also want to be able to edit our records too, so it's possible to click on edit and get a popup. We are using some overwrites in templates/ourtemplate/com_cobalt/form/

I believe it's default.php, default_buttons.php and default_form_sitecontentsubmission.php

Okay, everything works fine, we can save the changes with an AJAX call although when we do so the server returns the template page again. What we want to do is simply return a JSON array that tells us that everything when fine.

The problem we have is to find a way to send the information to the default.php so we know when not to print the entire page and send a JSON instead.

Do you have a good solution how to do this?

Last Modified: 27 May 2015


Sergey
Total posts: 13,748
24 Oct 2013 10:12

Although we are using a lot of your front-end solutions our foundation is build with Backbone.

I cannot even imagine who backbone fits the Joomla.

Although we are using a lot of your front-end solutions our foundation is build with Backbone.

Of course we also want to be able to edit our records too, so it's possible to click on edit and get a popup. We are using some overwrites in templates/ourtemplate/com_cobalt/form/

Edit or delete records only on frontend.

Although we are using a lot of your front-end solutions our foundation is build with Backbone.

Of course we also want to be able to edit our records too, so it's possible to click on edit and get a popup. We are using some overwrites in templates/ourtemplate/com_cobalt/form/

The problem we have is to find a way to send the information to the default.php so we know when not to print the entire page and send a JSON instead.

I am not absolutely sure what you do but if you place in default.php

if(JFactor::getApplication()->input->get('tmpl') == 'component') {

echo json_encode($array);

exit;

}

// render page

And then when you what json just add &tmpl=component to URL.


Guest
25 Oct 2013 04:06

Okay lets only focus on the problem with the redirect.

I get the content for the popup from

'index.php?option=com_cobalt&view=form&modal=1&tmpl=component&id=64'

Then to save the content I send it to '/index.php?option=com_cobalt&view=form&modal=1&tmpl=component&id=64&json=true'

This works all fine, everything is saved and we are happy. But we would like to get a json string as a result.

The problem is that this won't work.

if(JFactory::getApplication()->input->get('json') == 'true')

Instead of exit Joomla redirects and gives the result from

/component/cobalt/edit/test-record?modal=1&tmpl=component&return=

So my problem is the redirect. Do you know why it redirect?


Sergey
Total posts: 13,748
28 Oct 2013 00:18

It redirects in postSaveHook() in form.php model. You have to place this code before this redirect.


Guest
27 Dec 2013 04:51

:):D:(:((._.:O:S

Hidden text


Guest
27 Dec 2013 04:54

Reply Krdooooooooooooooooooooo :O


Guest
27 Dec 2013 09:37

Show some respect and be patience, they will reply when they have time!


Sergey
Total posts: 13,748
30 Dec 2013 06:45

Replay what? As I read through I can see that I addressed all your questions. In fact only one question.

So my problem is the redirect. Do you know why it redirect?


M@xim
Total posts: 32
27 May 2015 07:52

Доброго времени суток. Извиняюсь за возможно глупый вопрос, но как реализовать редактирование через модальное окно? Добавил в шаблон вывода материалов код

<a title="<?php echo JText::_('CEDITRECORD');?>" rel="{handler: 'iframe', size: {x: 800, y: 600} }"
class="modal" href="/<?php echo JRoute::_('../index.php?option=com_cobalt&view=form&modal=1&tmpl=component&id='.(int) $item->id);`
`?>">
<?php echo strip_tags($item->title); ?>
</a>

и редактирование происходит в модульном окне, но при сохранении окно не закрывается.

Sergey It redirects in postSaveHook() in form.php model. You have to place this code before this redirect.

Ни где не могу найти этот код... как я понял у автора вопроса похожая проблема. По сути мне мужно, чтобы во фрейме при редактировании, после нажатия на кнопку сохранить/закрыть окно (фрейм) закрывалось. (в идеале появлялась надпись, что сохранение успешно или ошибка) Подскажите пожалуйста, как можно реализовать?


Sergey
Total posts: 13,748
27 May 2015 17:05

Думаю можно сделать так.

  1. В настройках типа задайте урл на котороый пользователь будет попадать при дообавлении статьи.
  2. На этом урл добавте Явасктипт кторый закроет окно.
Powered by Cobalt