Facebook
From Cobalt Bat, 11 Months ago, written in Perl.
Embed
Download Paste or View Raw
Hits: 109
  1. ####_form.html.ep
  2.  
  3. #Under code I don't know to move to Controller
  4. % my $categories = Mojo::Collection->new(['*' => 0]);
  5. % my $cats = $self->db->resultset('Category');
  6. % while (my $cat = $cats->next) {
  7. %   (!$category) ? push @{$categories}, [$cat->name + ", selected => 'selected'", $cat->id] : push @{$categories}, [$cat->name, $cat->id];
  8. % }
  9.  
  10. #Under code must automatically select 'saved item at created or last change'
  11. <td><%= ($category) ? select_field parent_id=>[$categories->each], class=>'input' : select_field parent_id=>[$categories->each], class=>'input' %></td>
  12.  
  13.  
  14.  
  15. ####edit.html.ep
  16.  
  17. % layout 'admin', title => 'Jizzy.eu: Edycja Kategorii';
  18. % my $category = $self->db->resultset('Category')->find($self->stash('id'));
  19.  
  20. <h2>Category Edit [<%= $category->id %>]</h2>
  21.  
  22. %= form_for 'update_category' => (method => 'POST') => begin
  23.   %= include '/categories/_form', category => $category
  24.  
  25.         <nav class="is-flex">
  26.         %= link_to "Back" => "/categories", class => 'button', style=>"flex:1"
  27.         %= submit_button 'Update', class => 'button is-primary', style=>"flex:1"
  28.         </nav>
  29. % end

Replies to Untitled rss

Title Name Language When
Re: Untitled Silly Treeshrew perl 11 Months ago.
Re: Untitled Soft Terrapin perl 11 Months ago.