issue with template

14 views
Skip to first unread message

Nuku Ameyibor

unread,
Aug 29, 2016, 1:35:08 PM8/29/16
to ErlyDTL Users
hello people ,

I was having some issues with some template and was wondering what i was doing wrong .
i have a dictionary item
Roles and a list item Userrole .
the Userrole item is being rendered correctly but the dict item Roles is doing a no show in the template .
basically accessing individual dict items(Roes.1,Roles.2 etc..) works but iterating through doesnt seem to work .
any ideas about what i might be doing wrong ?

%%%code
outa(_Arg,'GET',["yapp_test","user","get_roles_user",UserId])->
        Userrole =  yapp_test_lib_usermod:get_user_roles(list_to_integer(UserId)),
        Roles = yapp_test_lib_usermod:get_roles(),
        io:format("list is ~p",[dict:to_list(Roles)]),
        %%%this gives list is [{3,"Administrator"},{1,"Staff"},{4,"Super Administrator"}]
        {ok,UiData} = yapp_test_edit_roles:render([{useroles,Userrole},{roles,Roles}]),
        {html,UiData};
 
%%%templates
<h1>roles</h1>
{% for key, value in roles.items %}
 {{ key }} {{ value }}
{% endfor %}
 
<h1>roleids for user</h1>
{% for role in useroles %}
   {{ role }}
{% endfor %}


role 1 {{roles.1}}


 
%%%%%confused by below  output ???
%%%%roleids appear but roles dont appear  and also roles.1 appears ????
 
roles
roleids for user
1 3 4

role 1 is Staff
Reply all
Reply to author
Forward
0 new messages