Changeset 1692


Ignore:
Timestamp:
01/30/16 13:06:47 (8 years ago)
Author:
nanardon
Message:

Redirect / to user's page

Location:
trunk/LATMOS-Accounts-Web
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LATMOS-Accounts-Web/lib/LATMOS/Accounts/Web/Controller/About.pm

    r870 r1692  
    33use warnings; 
    44use base 'Catalyst::Controller'; 
     5 
     6use POSIX; 
     7use DateTime; 
     8use Date::Calc; 
     9use Date::Parse; 
    510 
    611=head1 NAME 
     
    2530 
    2631    $c->stash->{page}{title} = "A propos..."; 
     32 
     33    if ($c->user) { 
     34        my $ouser = $c->model('Accounts')->db->get_object( 
     35            'user', 
     36            $c->user->{username}, 
     37        ); 
     38 
     39        my @cd = split('-', DateTime->from_epoch( 
     40            epoch => str2time( 
     41                $ouser->get_attributes('create'), 
     42            ) 
     43        )->ymd('-')); 
     44        my @now = split('-', DateTime->now()->ymd('-')); 
     45 
     46        my ($Dy,$Dm,$Dd) = Date::Calc::N_Delta_YMD(@cd, @now); 
     47        $c->stash->{accountExists} = join(', ', 
     48            ($Dy ? $c->loc('[_1] years', $Dy)  : ()), 
     49            ($Dm ? $c->loc('[_1] months', $Dm) : ()), 
     50            ($Dd ? $c->loc('[_1] days', $Dd)   : ()), 
     51        ); 
     52 
     53        if (my $expire = $ouser->get_attributes('expire')) { 
     54            my @ed = split('-', DateTime->from_epoch( 
     55                epoch => str2time( 
     56                    $expire 
     57                ) 
     58            )->ymd('-')); 
     59 
     60            my ($Dy,$Dm,$Dd) = Date::Calc::N_Delta_YMD(@now, @ed); 
     61            $c->stash->{accountExpire} = join(', ', 
     62                ($Dy ? $c->loc('[_1] years', $Dy)  : ()), 
     63                ($Dm ? $c->loc('[_1] months', $Dm) : ()), 
     64                ($Dd ? $c->loc('[_1] days', $Dd)   : ()), 
     65            ); 
     66        } 
     67    } 
    2768} 
    2869 
  • trunk/LATMOS-Accounts-Web/lib/LATMOS/Accounts/Web/Controller/Root.pm

    r1690 r1692  
    7474 
    7575    if ($c->user) { 
    76         my $ouser = $c->model('Accounts')->db->get_object( 
    77             'user', 
    78             $c->user->{username}, 
    79         ); 
    80  
    81         my @cd = split('-', DateTime->from_epoch( 
    82             epoch => str2time( 
    83                 $ouser->get_attributes('create'), 
    84             ) 
    85         )->ymd('-')); 
    86         my @now = split('-', DateTime->now()->ymd('-')); 
    87  
    88         my ($Dy,$Dm,$Dd) = Date::Calc::N_Delta_YMD(@cd, @now); 
    89         $c->stash->{accountExists} = join(', ', 
    90             ($Dy ? $c->loc('[_1] years', $Dy)  : ()), 
    91             ($Dm ? $c->loc('[_1] months', $Dm) : ()), 
    92             ($Dd ? $c->loc('[_1] days', $Dd)   : ()), 
    93         ); 
    94  
    95         if (my $expire = $ouser->get_attributes('expire')) { 
    96             my @ed = split('-', DateTime->from_epoch( 
    97                 epoch => str2time( 
    98                     $expire 
    99                 ) 
    100             )->ymd('-')); 
    101  
    102             my ($Dy,$Dm,$Dd) = Date::Calc::N_Delta_YMD(@now, @ed); 
    103             $c->stash->{accountExpire} = join(', ', 
    104                 ($Dy ? $c->loc('[_1] years', $Dy)  : ()), 
    105                 ($Dm ? $c->loc('[_1] months', $Dm) : ()), 
    106                 ($Dd ? $c->loc('[_1] days', $Dd)   : ()), 
    107             ); 
    108         } 
     76        $c->res->redirect( 
     77            $c->uri_for('/users', $c->user->{username}) 
     78        ) 
    10979    } 
    11080} 
  • trunk/LATMOS-Accounts-Web/lib/LATMOS/Accounts/Web/I18N/fr.po

    r1691 r1692  
    77msgstr "" 
    88"Project-Id-Version: 1\n" 
    9 "POT-Creation-Date: 2016-01-01 12:00:00\n" 
     9"POT-Creation-Date: YEAR-MO-DA HO:MI+ZONE\n" 
    1010"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 
    1111"Last-Translator: Olivier Thauvin <olivier.thauvin@latmos.ipsl.fr\n" 
     
    1717 
    1818#. ($Dd) 
    19 #: lib/LATMOS/Accounts/Web/Controller/Root.pm:106 
    20 #: lib/LATMOS/Accounts/Web/Controller/Root.pm:92 
     19#: lib/LATMOS/Accounts/Web/Controller/About.pm:50 
     20#: lib/LATMOS/Accounts/Web/Controller/About.pm:64 
    2121msgid "%1 days" 
    2222msgstr "%1 jours" 
    2323 
    2424#. ($Dm) 
    25 #: lib/LATMOS/Accounts/Web/Controller/Root.pm:105 
    26 #: lib/LATMOS/Accounts/Web/Controller/Root.pm:91 
     25#: lib/LATMOS/Accounts/Web/Controller/About.pm:49 
     26#: lib/LATMOS/Accounts/Web/Controller/About.pm:63 
    2727msgid "%1 months" 
    2828msgstr "%1 mois" 
    2929 
    3030#. ($Dy) 
    31 #: lib/LATMOS/Accounts/Web/Controller/Root.pm:104 
    32 #: lib/LATMOS/Accounts/Web/Controller/Root.pm:90 
     31#: lib/LATMOS/Accounts/Web/Controller/About.pm:48 
     32#: lib/LATMOS/Accounts/Web/Controller/About.pm:62 
    3333msgid "%1 years" 
    3434msgstr "%1 ans" 
     
    4141msgid "(none)" 
    4242msgstr "(sans)" 
     43 
     44#: root/html/includes/sidebar.tt:77 
     45msgid "About" 
     46msgstr "À propos" 
    4347 
    4448#: lib/LATMOS/Accounts/Web/Controller/Json/Timeline.pm:128 
     
    154158 
    155159#. (c.model("Accounts").db.get_object("user", c.user.username)) 
    156 #: root/html/index.tt:1 
     160#: root/html/about/index.tt:3 
    157161msgid "Welcome %1." 
    158162msgstr "Bienvenue %1." 
    159163 
    160164#. (c.stash.accountExists) 
    161 #: root/html/index.tt:3 
     165#: root/html/about/index.tt:5 
    162166msgid "Your account exists for %1, we hope it does not end too soon." 
    163167msgstr "Votre compte existe depuis %1, nous espérons qu'il durera longtemps" 
    164168 
    165169#. (accountExpire) 
    166 #: root/html/index.tt:7 
     170#: root/html/about/index.tt:9 
    167171msgid "Your account will expire in %1, we are really sorry about this" 
    168172msgstr "Votre compte exprirera dans %1, Nous vraiment désolé." 
  • trunk/LATMOS-Accounts-Web/root/html/about/index.tt

    r971 r1692  
    11<div class="objectform"> 
     2 
     3<p>[% l('Welcome [_1].',  c.model('Accounts').db.get_object('user', c.user.username )) | html %]</p> 
     4 
     5<p>[% l('Your account exists for [_1], we hope it does not end too soon.', 
     6    c.stash.accountExists) %]</p> 
     7 
     8[% IF accountExpire %] 
     9<p>[% l('Your account will expire in [_1], we are really sorry about this', accountExpire) %] 
     10[% END %] 
     11 
    212<h2>LATMOS::Accounts::Web</h2> 
    313 
     
    1222<p>Philippe Weill, Yann Delcambre</p> 
    1323</div> 
     24 
     25 
  • trunk/LATMOS-Accounts-Web/root/html/includes/sidebar.tt

    r1674 r1692  
    7373</li> 
    7474 
    75 <li><a href="[% c.uri_for('/admin') 
    76 %]">Gestion...</a></li> 
     75<li><a href="[% c.uri_for('/admin') %]">Gestion...</a></li> 
     76<li><a href="[% c.uri_for('/about') %]"> 
     77    [% l('About') %]</a></li> 
    7778</ul> 
    7879 
  • trunk/LATMOS-Accounts-Web/root/html/index.tt

    r1687 r1692  
    1 <p>[% l('Welcome [_1].',  c.model('Accounts').db.get_object('user', c.user.username )) | html %]</p> 
    21 
    3 <p>[% l('Your account exists for [_1], we hope it does not end too soon.', 
    4     c.stash.accountExists) %]</p> 
    5  
    6 [% IF accountExpire %] 
    7 <p>[% l('Your account will expire in [_1], we are really sorry about this', accountExpire) %] 
    8 [% END %] 
    9  
    10  
Note: See TracChangeset for help on using the changeset viewer.