Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Question about Sessions and Flash Messages in Chicago Boss
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Kai Janson  
View profile  
 More options Nov 7 2012, 9:26 am
From: Kai Janson <kot...@gmail.com>
Date: Wed, 7 Nov 2012 08:26:04 -0600
Local: Wed, Nov 7 2012 9:26 am
Subject: Re: [chicagoboss] Question about Sessions and Flash Messages in Chicago Boss

You can do that by using {{_session}} in the view for the session
variables, but for variables stemming off the controller, that'd be great
...

--Kai

On Wed, Nov 7, 2012 at 1:52 AM, Graeme Defty <graeme.de...@gmail.com> wrote:
> Evan,

> This reminds me of an earlier conversation regarding an option to display
> all variables passed to the view for debugging purposes.

> It occurs to me this could be done as a "for free" variable (e.g. _data)

> Sounds easy to do. Is it practical?

> g

> _____________________________________________________________

> On 6 November 2012 22:39, Evan Miller <emmil...@gmail.com> wrote:

>> You need to pass the flash messages into the view from the controller:

>> Messages = boss_flash:get_and_clear(SessionID)
>> {ok, [{flash_messages, Messages}]}

>> View:

>> {% for message in flash_messages %} ... {% endfor %}

>> See here for a list of variables that the views can access "for free":

>> http://www.chicagoboss.org/api-view.html

>> Everything else must be passed in explicitly.

>> On Sun, Nov 4, 2012 at 7:36 AM, @chrisco <chris.come...@gmail.com> wrote:

>>> Hi,

>>> I am a beginner programmer (beginner at programming in general and
>>> Erlang and ChicagoBoss in particular) and am trying to understand Sessions
>>> and their related Flash Messages in Chicago Boss.  I have reviewed the
>>> tutorial and the API documentation and can't figure it out.  This is what
>>> I've done:

>>> Created headliners_app_controller.erl
>>> and put this as the one line in it:

>>> -module(headliners_app, [Req, SessionID]).

>>> When I run the app and use a Chrome extension ("Edit This Cookie") I see
>>> that a session has been created.  So far so good.

>>> When I try to test/experiment with boss_flash, as described here
>>> http://www.chicagoboss.org/api-session.html, I everything goes to shit.
>>>  I think (know?) I'm doing something dumb, but after trying for too long
>>> (embarrassed to say how long!), I can't figure it out and decided to ask
>>> for help, so here I am.

>>> How do I use boss_flash?  I just basically want to get to a Chicago Boss
>>> Sessions and Flash "hello world"!  Thanks.

>>> Here are further details on my beginner's folly:

>>> I added this line:
>>> boss_flash:add(SessionID, notice, "Welcome!", "Your Session has now
>>> begun!").

>>> to this file:
>>> headliners_app_controller.erl

>>> so it now looks like this:
>>> -module(appname_my_controller, [Req, SessionID]).
>>> boss_flash:add(SessionID, notice, "Welcome!", "Your Session has now
>>> begun!").

>>> I added this line to a view file:
>>> {% for flash in boss_flash %} {{ flash.method }} - {{ flash.title }} -
>>> {{ flash.message }} {% endfor %}

>>> I restarted the server with:
>>> ./init-dev.sh

>>> And get this error:
>>> Error:
>>> {function_clause,
>>>     [{erlydtl_runtime,init_counter_stats,
>>>          [undefined,undefined],
>>>          [{file,"src/erlydtl_runtime.erl"},{line,208}]},
>>>      {headliners_app_view_search_index_html,render_internal,4,[]},
>>>      {headliners_app_view_search_index_html,render,2,[]},
>>>      {boss_web_controller,render_view,6,
>>>          [{file,"src/boss/boss_web_controller.erl"},{line,836}]},
>>>      {boss_web_controller,execute_action,5,
>>>          [{file,"src/boss/boss_web_controller.erl"},{line,725}]},
>>>      {boss_web_controller,execute_action,5,
>>>          [{file,"src/boss/boss_web_controller.erl"},{line,727}]},
>>>      {boss_web_controller,process_request,5,
>>>          [{file,"src/boss/boss_web_controller.erl"},{line,459}]},
>>>      {timer,tc,3,[{file,"timer.erl"},{line,194}]}]}

>>> I tried all the combinations of moving the code to different files
>>> (mainly just the controller for the particular view I wanted to show the
>>> flash message in) and either got the same error or the server (in the
>>> server shell window) seems to keep looping through "starting development
>>> server" (or whatever the exact wording is that it uses when it launches).

>>> Thanks,
>>> Chris

>>> --

>> --
>> Evan Miller
>> http://www.evanmiller.org/

>> --

>  --


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.