Zotonic
Zotonic
zotonic@conference.zotonic.com
Friday, 17 May 2013< ^ >
Arjan has set the subject to: Zotonic - The Erlang Web Framework & CMS
Room Configuration

GMT+2
[00:08:54] mawuli.ypa leaves the room
[00:26:29] mawuli.ypa joins the room
[00:34:48] michael joins the room
[00:44:10] michael leaves the room
[01:30:47] mawuli.ypa leaves the room
[01:49:17] mawuli.ypa joins the room
[02:03:04] mawuli.ypa leaves the room
[03:08:34] mawuli.ypa joins the room
[03:34:46] mawuli.ypa leaves the room
[03:50:57] mawuli.ypa joins the room
[04:39:13] mawuli.ypa leaves the room
[04:42:03] mawuli.ypa joins the room
[06:11:50] mawuli.ypa leaves the room
[06:11:59] mawuli.ypa joins the room
[07:08:46] arcusfelis joins the room
[08:19:12] mawuli.ypa leaves the room
[08:22:53] <z-bot> [vbit] hello
[08:30:53] Arjan leaves the room
[09:08:56] Arjan joins the room
[10:01:19] A. G. joins the room
[10:09:48] <A. G.> Hi, how can I re-render some block after uploading file? I've tried
Html = z_template:render("_personal_page_list.tpl", [], Context),
z_render:replace("personal_page_list", Html, Context).
in the upload file handler (where "personal_page_list" is id of <div> in which "_personal_page_list.tpl" should be rendered), but this doesn't lead to updating html (though no errors in zotonic console and in javascript console; file uploads successfully).
I have also tried to add action={replace id="..."} to wire, then it re-renderes, but before file uploading.
[10:33:14] <Andreas Stenius> hmm... when looking at it, it feels like the z_render:replace should work..
[10:35:26] <Andreas Stenius> you have to make sure that the rendered update actually gets into the context returned, though... so it matters where you call this..
[10:36:21] <Andreas Stenius> or make sure it is sent to the page session in some other way..
[10:50:17] Arjan leaves the room
[10:59:30] <A. G.> Andreas Stenius: That is, Html (second argument of replace/3) should be included in returned context? It seems to be true: there are some term like
[{[36,40,
[34,"#personal_page_list",34],
<<").">>,<<"replaceWith">>,<<"(\"">>,
[
and many numbers later.
[11:00:24] <A. G.> (this term is in the beginning of visible in the shell)
[11:02:04] <Andreas Stenius> that looks good, to me..
[11:02:31] <Andreas Stenius> if it doesn't work, I suspect that the context rendered data is never sent to the client..
[11:04:49] <Andreas Stenius> is that context returned as a result to a action event callback?
[11:05:18] <Andreas Stenius> you may want to look at https://github.com/zotonic/zotonic/blob/master/modules/mod_admin/actions/action_admin_dialog_media_upload.erl for ideas.. ;)
[11:08:33] <A. G.> Yes, this is the returned context.
[11:08:44] <A. G.> I've put full log at http://hpaste.org/88084
[11:11:13] mawuli.ypa joins the room
[11:11:39] <Andreas Stenius> if you look at the data received on your websocket/comet connection, you should see that string: $('#personal_page_list').replaceWith(".....").widgetManager() there...
[11:12:40] <Andreas Stenius> if you don't I'd need to see the end of your event handler where you have those debug prints, to see if I can spot anything there..
[11:18:40] <A. G.> I don't see this: there are two connections, to /close-connection and to /postback, first without data in response, the second returns (Chrome shows in tab "preview") <textarea> z_unmask('zzrylywn-form');</textarea>
[11:19:07] <A. G.> Code:
upload_file(#submit{message={media_upload, _EventProps}}, Context) ->
File = z_context:get_q("upload_file", Context),
Title= z_context:get_q("upload_description", Context),
io:format("DEBUG Title=~p~n", [Title]), % DEBUG
{ok, Id} = case File of
#upload{filename=OriginalFilename, tmpfile=TmpFile} ->
m_media:insert_file(TmpFile, [{category, media}, {summary, Title}], Context)
end,
io:format("Id from insert_file: ~p~n", [Id]), % DEBUG
User = z_acl:user(Context),
m_edge:insert(Id, author, User, Context),
Html = z_template:render("_personal_page_list.tpl", [], Context),
R = z_render:replace("personal_page_list", Html, Context),
% io:format("DEBUG render returns: ~p~n", [R]), % DEBUG
io:format("DEBUG render finished~n\tDEBUG html=~p~n\tDEBUG context=~p~n", [Html,R]),
R.
[11:23:35] <Andreas Stenius> Ah, it may be a bit early to render at that stage (I've not fiddled too much with it this way before..)
[11:24:13] <Andreas Stenius> try z_render:wire({replace, [{target, Id}, {template, "foo"}]}, Context) instead...
[11:25:04] <Andreas Stenius> the z_render:wire will queue the action in the context to be rendered at a later stage...
[11:25:37] <Andreas Stenius> so I'm guessing that if you put rendered data in the context, that it may not be carried forward in the lower levels...
[11:25:58] <Andreas Stenius> which may be seen as a missing feature, or maybe even a bug.. ?
[11:33:59] <A. G.> No, with z_render:wire/2 the problem still exists.
[11:50:46] <A. G.> Is it possible to add timeout? — let it sends file, waits 2s, replace form.
[11:52:01] <Andreas Stenius> not directly, but you can always trigger you own function to send something down the line after some time has passed..
[11:54:40] <A. G.> okay. On the other hand, if I just attach my own javascript handler to id, how can I execute wire action by hands?
[11:54:52] <Andreas Stenius> this is what I did to have feedback on the page while a long running process was working... http://pastebin.com/jpp72qRd
[11:56:03] <Andreas Stenius> I think that z_session_page:add_script is what you are looking for..
[12:03:33] Arjan joins the room
[12:08:05] Arjan leaves the room
[12:10:44] <A. G.> Thank you, I'l try it...
[12:43:59] Arjan joins the room
[12:44:08] <Arjan> hey
[12:44:12] <Arjan> all good to go?
[12:44:20] <Andreas Stenius> yep, same invite..
[12:44:33] <Arjan> doesnt work for me
[13:27:53] Arjan leaves the room
[13:30:42] Maas joins the room
[13:32:44] <Maas> Getting tired of all these wonky edge cases in mobile browsers. iOS doesn't report device orientation correctly inside an iframes. Also never triggers orientation change then. Huge time sink
[13:55:12] yashshah joins the room
[13:59:08] <Andreas Stenius> Hi Mawuli and Yash.
[13:59:38] <Andreas Stenius> I've just become aware of that we are not allowed to disclose who we've selected.
[14:00:22] <yashshah> Andreas Stenius, Ahh okay :)
[14:01:02] <Andreas Stenius> but I can say that it has not been an easy one ;)
[14:01:12] yashshah leaves the room: Disconnected: closed
[14:02:16] yashshah joins the room
[14:02:46] <yashshah> Haha expected that :)
[14:20:32] yashshah leaves the room: Disconnected: closed
[14:21:13] yashshah joins the room
[14:27:24] yashshah leaves the room
[14:38:46] arcusfelis leaves the room
[14:48:12] <A. G.> This was a silly bug: after call to upload_file/2, code below returns some old context.
[15:09:05] yashshah joins the room
[15:59:10] yashshah leaves the room
[16:00:13] yashshah joins the room
[16:35:02] A. G. leaves the room
[16:49:33] yashshah leaves the room
[16:59:25] mawuli.ypa leaves the room
[17:03:44] mawuli.ypa joins the room
[17:34:54] Maas leaves the room
[17:45:27] <mawuli.ypa> Andreas: ok. Either way, Zotonic will be hacked this summer! :)
[18:40:36] mawuli.ypa leaves the room
[18:51:04] mawuli.ypa joins the room
[19:04:40] mawuli.ypa leaves the room
[19:18:11] mawuli.ypa joins the room
[19:40:23] Arjan joins the room
[19:40:53] mawuli.ypa leaves the room
[19:41:24] mawuli.ypa joins the room
[19:41:36] Arjan leaves the room
[19:51:03] mawuli.ypa leaves the room
[19:53:24] mawuli.ypa joins the room
[19:58:36] Maas joins the room
[20:04:23] yashshah joins the room
[20:04:45] mawuli.ypa leaves the room
[20:05:10] mawuli.ypa joins the room
[20:18:17] mawuli.ypa leaves the room
[20:19:27] mawuli.ypa joins the room
[20:19:33] Maas leaves the room
[20:30:05] mawuli.ypa leaves the room
[20:50:34] Maas joins the room
[20:52:11] mawuli.ypa joins the room
[22:37:06] simon.smithies joins the room
[22:37:49] yashshah leaves the room
[22:40:01] simon.smithies leaves the room
[22:40:55] simon.smithies joins the room
[22:40:59] simon.smithies leaves the room
[22:41:01] simon.smithies joins the room
[22:52:26] Andreas Stenius leaves the room
[22:54:31] simon.smithies leaves the room
[23:13:29] Maas leaves the room
Powered by ejabberd Powered by Erlang Valid XHTML 1.0 Transitional Valid CSS!