Akelos Framework v1 forum archive. This forum is no longer maintained. To report bugs please visit https://github.com/akelos/akelos/issues
    • CommentAuthormstram
     

    In R.O.R., the code show below, in a 'list.rhtml' view will make the 'title' field from the 'recipes' table a 'clickable' link .... (directly instead of having the separate 'edit' link).

    Is there equivalent code in Akelos ? : (and what is it ? :) )

    (Bermi, since you are obviously quite proficient with programming, an interesting challenge for you might be to write a R.O.R. -> Akelos "translator" for the script/console, where a user could type in a ROR "idiom" as above and get the Akelos format !) ;)

    Mike

    <%= link_to %Q{#{recipe.title}}, :action => 'edit', :id => recipe

    •  
      CommentAuthorbermi
     

    Mike,

    <%= link_to recipe.title, :action => 'edit', :id => recipe %>
    

    or

    <%= link_to "#{recipe.title}", {:action => 'edit', :id => recipe} %>
    

    works on Akelos views :D, just try it out.

    The Ruby > PHP conversion challenge is already done at some extent. Adding it to the console is just a matter of parsing incoming commands through the AkSintags parser, and that is not on the top of my list of priorities, but it might be a suitable challenge for other community member. Anyone interested?

    • CommentAuthormstram
     
    I tried the code below in author/listing.tpl and am getting :

    " Catchable fatal error: Object of class Author could not be converted to string in D:\xampplite\htdocs\akelos\lib\AkRouter.php on line 253"

    {loop authors}
    <tr {?author_odd_position}class="odd"{end}>
    {loop content_columns}
    <td class="field"><?php echo $author->get($content_column) ?></td>
    ----------------------------------------------------------------------------------------------
    <td><%= link_to author.name, :action => 'edit', :id => author %></td>
    -----------------------------------------------------------------------------------------------
    {end}
    •  
      CommentAuthorbermi
     

    You need to change this

    <td><%= link_to author.name, :action => 'edit', :id => author %></td>
    

    with

    <td><%= link_to author.name, :action => 'edit', :id => author.id %></td>
    

    as url_for does not extracts automatically the AR :id like in RoR

    • CommentAuthormstram
     
    Bermi,

    Thanks ! It's working now !

    MIke
    • CommentAuthorGKSR
     
    My code:

    {loop topspots}
    <a href="/myproject/controller/action/{topspot.city}/" class="homelinks">{topspot.city}, Abbreviation</a>
    {end}

    Abbreviation:
    <?php
    $abbreviation = $State->find($topspot->state)->abbreviation;
    ?>

    <%= link_to "xxxx, yyyy", {:controller => 'vacationrental', :action => 'listing', :id => topspot.city} %>

    xxxx-> {topspot.city}
    yyyy-> $abbreviation (Ex: FL ,CA,...)

    How to write the sintag for this kind of link(anchor tag shown above in the loop)