Changeset 58


Ignore:
Timestamp:
03/17/09 03:36:29 (15 years ago)
Author:
nanardon
Message:
  • more improvement on admin page
Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/Vote/Controller/Admin.pm

    r53 r58  
    3838    my $vote = $c->model('Vote'); 
    3939 
     40    $vote->vote_info($id) or do { 
     41        $c->res->redirect($c->uri_for('/')); 
     42        return; 
     43    }; 
     44 
    4045    my $password = $c->session->{vpassword} || $c->req->param('vpassword'); 
    4146 
    4247    if (!$c->model('Vote')->auth_poll($id, $password)) { 
    43         $c->stash->{page}{title} = $c->model('Vote')->vote_info($id)->{label} . ': Login d\'administration'; 
     48        $c->stash->{page}{title} = $vote->vote_info($id)->{label} . ': Login d\'administration'; 
    4449        $c->session->{vpassword} = undef; 
    4550        $c->stash->{template} = 'admin/login.tt'; 
  • trunk/lib/Vote/Model/Vote.pm

    r43 r58  
    181181        } 
    182182    } 
     183    $res->{free_choice} = 0; # avoiding undef 
    183184    $res 
    184185} 
  • trunk/root/templates/admin/default.tt

    r47 r58  
    1212Label: <input type="text" name="label" value="[% c.req.param('label') || thisvote.label | html %]"> 
    1313<br> 
    14 Description: <textarea name="description">[% c.req.param('description') || thisvote.description | html %]</textarea> 
     14Description:<br> 
     15<textarea name="description" cols="60" rows="4">[% c.req.param('description') || thisvote.description | html %]</textarea> 
    1516<br> 
     17<br> 
     18<i>Les dates sont au format AAAA-MM-JJ HH:MM:SS</i><br> 
    1619Debut du vote: 
    1720<input type="text" name="start" value="[% c.req.param('start') || thisvote.start | html %]"> 
     
    2023<input type="text" name="end" value="[% c.req.param('end') || thisvote.end | html %]"> 
    2124<br> 
     25<br> 
    2226Nombre de choix possible: 
    2327<input type="text" name="choice_count" value="[% c.req.param('choice_count') || thisvote.choice_count | html %]"> 
    2428<br> 
    2529Nombre de choix libres: 
    26 <input type="text" name="free_choice" value="[% c.req.param('free_choice') || thisvote.free_choice | html %]"> 
     30<input type="text" name="free_choice" value="[% c.req.param('free_choice') || thisvote.free_choice || 0 | html %]"> 
    2731<br> 
    2832<input type="submit"> 
     
    3034</td> 
    3135<td valign="TOP"> 
     36[% IF ! vote.vote_choices(voteid).size %] 
     37<p class="alert">Aucun choix configuré</p> 
     38[% ELSE %] 
    3239[% FOREACH choice = vote.vote_choices(voteid) %] 
    3340<form action="[% c.uri_for(voteid) %]"> 
     
    3946[% END %] 
    4047<form action="[% c.uri_for(voteid) %]"> 
     48[% END %] 
    4149Ajouter un choix:<br> 
    4250<input type="text" name="addch"> 
     
    5260<tr> 
    5361<td valign="TOP"> 
     62[% IF NOT vote.vote_voting_count(voteid) %] 
     63<p class="alert">Aucun votant inscrit</p> 
     64[% ELSE %] 
    5465[% signing = vote.vote_voting(voteid) %] 
    5566[% FOREACH thisvoting = signing %] 
     
    6172<input type="submit" name="delete" value="delete"><br> 
    6273</form> 
     74[% END %] 
    6375[% END %] 
    6476</td> 
Note: See TracChangeset for help on using the changeset viewer.