Facebook
From Soft Terrapin, 1 Year ago, written in Perl.
This paste is a reply to Untitled from Cobalt Bat - view diff
Embed
Download Paste or View Raw
Hits: 122
  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. %  my @attr;
  8. %  push @attr, selected => 'selected' if $cat->id eq $category->id;
  9. %  push @{$categories}, [$cat->name, $cat->id, @attr];
  10. % }
  11.  
  12. #Under code must automatically select 'saved item at created or last change'
  13. <td>
  14.   %= select_field parent_id => $categories => (class=>'input')
  15. </td>
  16.  
  17.  
  18.  
  19. ####edit.html.ep
  20.  
  21. % layout 'admin', title => 'Jizzy.eu: Edycja Kategorii';
  22. % my $category = $self->db->resultset('Category')->find($self->stash('id'));
  23.  
  24. <h2>Category Edit [<%= $category->id %>]</h2>
  25.  
  26. %= form_for 'update_category' => (method => 'POST') => begin
  27.   %= include '/categories/_form', category => $category
  28.  
  29.         <nav class="is-flex">
  30.         %= link_to "Back" => "/categories", class => 'button', style=>"flex:1"
  31.         %= submit_button 'Update', class => 'button is-primary', style=>"flex:1"
  32.         </nav>
  33. % end

Replies to Re: Untitled rss

Title Name Language When
Re: Re: Untitled Gruff Parakeet perl 1 Year ago.
captcha