diff options
| author | 2013-06-15 19:42:02 +0200 | |
|---|---|---|
| committer | 2013-06-15 19:42:02 +0200 | |
| commit | d3078fb726639eed478a2a449b0a9043af04a756 (patch) | |
| tree | d0a848273d0f2ba7ec5908341539ffef055f8368 | |
| parent | 4bda1d75aec180ee3845f74991f99a99ef2ae062 (diff) | |
Mise en place de la structure pour les différentes vues
| -rw-r--r-- | app/i18n/en.php | 3 | ||||
| -rw-r--r-- | app/i18n/fr.php | 3 | ||||
| -rw-r--r-- | app/layout/nav_menu.phtml | 67 | ||||
| -rw-r--r-- | app/views/helpers/global_view.phtml | 5 | ||||
| -rw-r--r-- | app/views/helpers/normal_view.phtml | 114 | ||||
| -rw-r--r-- | app/views/helpers/reader_view.phtml | 5 | ||||
| -rwxr-xr-x | app/views/helpers/rss_view.phtml (renamed from app/views/helpers/rss.phtml) | 0 | ||||
| -rw-r--r-- | app/views/index/index.phtml | 128 | ||||
| -rw-r--r-- | lib/lib_text.php | 8 | ||||
| -rw-r--r-- | public/theme/freshrss.css | 7 |
10 files changed, 198 insertions, 142 deletions
diff --git a/app/i18n/en.php b/app/i18n/en.php index e40be045a..4dbfde715 100644 --- a/app/i18n/en.php +++ b/app/i18n/en.php @@ -37,6 +37,9 @@ return array ( 'before_one_day' => 'Before one day', 'before_one_week' => 'Before one week', 'display' => 'Display', + 'normal_view' => 'Normal view', + 'reader_view' => 'Reading view', + 'global_view' => 'Global view', 'show_all_articles' => 'Show all articles', 'show_not_reads' => 'Show only unread', 'older_first' => 'Oldest first', diff --git a/app/i18n/fr.php b/app/i18n/fr.php index 69c7a8ffe..7a58b984c 100644 --- a/app/i18n/fr.php +++ b/app/i18n/fr.php @@ -37,6 +37,9 @@ return array ( 'before_one_day' => 'Antérieurs à 1 jour', 'before_one_week' => 'Antérieurs à 1 semaine', 'display' => 'Affichage', + 'normal_view' => 'Vue normale', + 'reader_view' => 'Vue lecture', + 'global_view' => 'Vue globale', 'show_all_articles' => 'Afficher tous les articles', 'show_not_reads' => 'Afficher les non lus', 'older_first' => 'Plus anciens en premier', diff --git a/app/layout/nav_menu.phtml b/app/layout/nav_menu.phtml index 3411f344b..dbe597985 100644 --- a/app/layout/nav_menu.phtml +++ b/app/layout/nav_menu.phtml @@ -59,43 +59,72 @@ <ul class="dropdown-menu"> <li class="dropdown-close"><a href="#close"><i class="icon i_close"></i></a></li> + <?php + $url_output = $url; + $actual_view = Request::param('output', 'nomal'); + ?> + <?php if($actual_view != 'normal') { ?> + <li class="item"> + <?php $url_output['params']['output'] = 'normal'; ?> + <a class="view_normal" href="<?php echo Url::display ($url_output); ?>"> + <?php echo Translate::t ('normal_view'); ?> + </a> + </li> + <?php } if($actual_view != 'reader') { ?> + <li class="item"> + <?php $url_output['params']['output'] = 'reader'; ?> + <a class="view_normal" href="<?php echo Url::display ($url_output); ?>"> + <?php echo Translate::t ('reader_view'); ?> + </a> + </li> + <?php } if($actual_view != 'global') { ?> + <li class="item"> + <?php $url_output['params']['output'] = 'global'; ?> + <a class="view_normal" href="<?php echo Url::display ($url_output); ?>"> + <?php echo Translate::t ('global_view'); ?> + </a> + </li> + <?php } ?> + + <li class="separator"></li> + <li class="item"> <?php + $url_state = $url; if ($this->state == 'not_read') { - $url['params']['state'] = 'all'; + $url_state['params']['state'] = 'all'; ?> - <a class="print_all" href="<?php echo Url::display ($url); ?>"><?php echo Translate::t ('show_all_articles'); ?></a> + <a class="print_all" href="<?php echo Url::display ($url_state); ?>"> + <?php echo Translate::t ('show_all_articles'); ?> + </a> <?php } else { - $url['params']['state'] = 'not_read'; + $url_state['params']['state'] = 'not_read'; ?> - <a class="print_non_read" href="<?php echo Url::display ($url); ?>"><?php echo Translate::t ('show_not_reads'); ?></a> + <a class="print_non_read" href="<?php echo Url::display ($url_state); ?>"> + <?php echo Translate::t ('show_not_reads'); ?> + </a> <?php } ?> </li> + <li class="separator"></li> - <?php - $params = Request::params (); - if (isset ($params['search'])) { - $params['search'] = urlencode ($params['search']); - } - $url = array ( - 'c' => 'index', - 'a' => 'index', - 'params' => $params - ); - ?> <li class="item"> <?php + $url_order = $url; if ($this->order == 'low_to_high') { - $url['params']['order'] = 'high_to_low'; + $url_order['params']['order'] = 'high_to_low'; ?> - <a href="<?php echo Url::display ($url); ?>"><?php echo Translate::t ('older_first'); ?></a> + <a href="<?php echo Url::display ($url_order); ?>"> + <?php echo Translate::t ('older_first'); ?> + </a> <?php } else { - $url['params']['order'] = 'low_to_high'; + $url_order['params']['order'] = 'low_to_high'; ?> - <a href="<?php echo Url::display ($url); ?>"><?php echo Translate::t ('newer_first'); ?></a> + <a href="<?php echo Url::display ($url_order); ?>"> + <?php echo Translate::t ('newer_first'); ?> + </a> <?php } ?> </li> </ul> diff --git a/app/views/helpers/global_view.phtml b/app/views/helpers/global_view.phtml new file mode 100644 index 000000000..b666fe620 --- /dev/null +++ b/app/views/helpers/global_view.phtml @@ -0,0 +1,5 @@ +<?php +$this->partial ('nav_menu'); +?> + +Non implémenté
\ No newline at end of file diff --git a/app/views/helpers/normal_view.phtml b/app/views/helpers/normal_view.phtml new file mode 100644 index 000000000..515084047 --- /dev/null +++ b/app/views/helpers/normal_view.phtml @@ -0,0 +1,114 @@ +<?php + +$this->partial ('aside_flux'); +$this->partial ('nav_menu'); + +if (isset ($this->entryPaginator) && !$this->entryPaginator->isEmpty ()) { + $items = $this->entryPaginator->items (); +?> + +<div id="stream"> + <?php + $display_today = true; + $display_yesterday = true; + $display_others = true; + ?> + <?php foreach ($items as $item) { ?> + + <?php if ($display_today && $item->isDay (Days::TODAY)) { ?> + <div class="day"><?php echo Translate::t ('today'); ?> - <?php echo timestamptodate (time (), false); ?></div> + <?php $display_today = false; } ?> + <?php if ($display_yesterday && $item->isDay (Days::YESTERDAY)) { ?> + <div class="day"><?php echo Translate::t ('yesterday'); ?> - <?php echo timestamptodate (time () - 86400, false); ?></div> + <?php $display_yesterday = false; } ?> + <?php if ($display_others && $item->isDay (Days::BEFORE_YESTERDAY)) { ?> + <div class="day"><?php echo Translate::t ('before_yesterday'); ?></div> + <?php $display_others = false; } ?> + + <div class="flux<?php echo !$item->isRead () ? ' not_read' : ''; ?><?php echo $item->isFavorite () ? ' favorite' : ''; ?>" id="flux_<?php echo $item->id (); ?>"> + <ul class="horizontal-list flux_header"> + <?php if (!login_is_conf ($this->conf) || is_logged ()) { ?> + <li class="item manage"> + <?php if (!$item->isRead ()) { ?> + <a class="read" href="<?php echo _url ('entry', 'read', 'id', $item->id (), 'is_read', 1); ?>"> </a> + <?php } else { ?> + <a class="read" href="<?php echo _url ('entry', 'read', 'id', $item->id (), 'is_read', 0); ?>"> </a> + <?php } ?> + + <?php if (!$item->isFavorite ()) { ?> + <a class="bookmark" href="<?php echo _url ('entry', 'bookmark', 'id', $item->id (), 'is_favorite', 1); ?>"> </a> + <?php } else { ?> + <a class="bookmark" href="<?php echo _url ('entry', 'bookmark', 'id', $item->id (), 'is_favorite', 0); ?>"> </a> + <?php } ?> + </li> + <?php } ?> + <?php $feed = $item->feed (true); ?> + <li class="item website"><a href="<?php echo _url ('index', 'index', 'get', 'f_' . $feed->id ()); ?>"><img class="favicon" src="<?php echo $feed->favicon (); ?>" alt="" /> <span><?php echo $feed->name (); ?></span></a></li> + <li class="item title"><?php echo $item->title (); ?></li> + <li class="item date"><?php echo $item->date (); ?></li> + <li class="item link"><a target="_blank" href="<?php echo $item->link (); ?>"> </a></li> + </ul> + + <div class="flux_content"> + <div class="content"> + <h1 class="title"><?php echo $item->title (); ?></h1> + <?php $author = $item->author (); ?> + <?php echo $author != '' ? '<div class="author">' . Translate::t ('by_author', $author) . '</div>' : ''; ?> + <?php + if($this->conf->lazyload() == 'yes') { + echo lazyimg($item->content ()); + } else { + echo $item->content(); + } + ?> + </div> + + <ul class="horizontal-list bottom"> + <li class="item"> + <div class="dropdown"> + <div id="dropdown-share-<?php echo $item->id ();?>" class="dropdown-target"></div> + <i class="icon i_share"></i> <a class="dropdown-toggle" href="#dropdown-share-<?php echo $item->id ();?>"><?php echo Translate::t ('share'); ?></a> + + <ul class="dropdown-menu"> + <li class="dropdown-close"><a href="#close"><i class="icon i_close"></i></a></li> + + <li class="item"><a href="mailto:?subject=<?php echo $item->title (); ?>&body=J'ai trouvé cet article intéressant, tu peux le lire à cette adresse : <?php echo urlencode($item->link ()); ?>"><?php echo Translate::t ('by_email'); ?></a></li> + <?php + $shaarli = $this->conf->urlShaarli (); + if ($shaarli) { + ?> + <li class="item"><a target="_blank" href="<?php echo $shaarli . '?post=' . urlencode($item->link ()) . '&title=' . urlencode ($item->title ()) . '&source=bookmarklet'; ?>"><?php echo Translate::t ('on_shaarli'); ?></a></li> + <?php } ?> + </ul> + </div> + </li> + <?php $tags = $item->tags(); ?> + <?php if(!empty($tags)) { ?> + <li class="item"> + <div class="dropdown"> + <div id="dropdown-tags-<?php echo $item->id ();?>" class="dropdown-target"></div> + <i class="icon i_tag"></i> <a class="dropdown-toggle" href="#dropdown-tags-<?php echo $item->id ();?>"><?php echo Translate::t ('related_tags'); ?></a> + + <ul class="dropdown-menu"> + <li class="dropdown-close"><a href="#close"><i class="icon i_close"></i></a></li> + + <?php foreach($tags as $tag) { ?> + <li class="item"><a href="<?php echo _url ('index', 'index', 'search', urlencode ('#' . $tag)); ?>"><?php echo $tag; ?></a></li> + <?php } ?> + </ul> + </div> + </li> + <?php } ?> + </ul> + </div> + </div> + <?php } ?> + + <?php $this->entryPaginator->render ('pagination.phtml', 'next'); ?> +</div> + +<?php } else { ?> +<div class="alert alert-warn"> + <span class="alert-head"><?php echo Translate::t ('no_feed_to_display'); ?></span> +</div> +<?php } ?>
\ No newline at end of file diff --git a/app/views/helpers/reader_view.phtml b/app/views/helpers/reader_view.phtml new file mode 100644 index 000000000..b666fe620 --- /dev/null +++ b/app/views/helpers/reader_view.phtml @@ -0,0 +1,5 @@ +<?php +$this->partial ('nav_menu'); +?> + +Non implémenté
\ No newline at end of file diff --git a/app/views/helpers/rss.phtml b/app/views/helpers/rss_view.phtml index 83de6de2e..83de6de2e 100755 --- a/app/views/helpers/rss.phtml +++ b/app/views/helpers/rss_view.phtml diff --git a/app/views/index/index.phtml b/app/views/index/index.phtml index 30df591eb..46ff33b3a 100644 --- a/app/views/index/index.phtml +++ b/app/views/index/index.phtml @@ -1,127 +1,13 @@ <?php -function lazyimg($content) { - return preg_replace( - '/<img([^<]+)src=([\'"])([^"\']*)([\'"])([^<]*)>/i', - '<img$1src="' . Url::display('/data/grey.gif') . '" data-original="$3"$5>', - $content - ); -} $output = Request::param ('output', 'normal'); if ($output == 'rss') { - $this->renderHelper ('rss'); + $this->renderHelper ('rss_view'); +} elseif($output == 'reader') { + $this->renderHelper ('reader_view'); +} elseif($output == 'global') { + $this->renderHelper ('global_view'); } else { - $this->partial ('aside_flux'); - $this->partial ('nav_menu'); - - if (isset ($this->entryPaginator) && !$this->entryPaginator->isEmpty ()) { - $items = $this->entryPaginator->items (); -?> - -<div id="stream"> - <?php - $display_today = true; - $display_yesterday = true; - $display_others = true; - ?> - <?php foreach ($items as $item) { ?> - - <?php if ($display_today && $item->isDay (Days::TODAY)) { ?> - <div class="day"><?php echo Translate::t ('today'); ?> - <?php echo timestamptodate (time (), false); ?></div> - <?php $display_today = false; } ?> - <?php if ($display_yesterday && $item->isDay (Days::YESTERDAY)) { ?> - <div class="day"><?php echo Translate::t ('yesterday'); ?> - <?php echo timestamptodate (time () - 86400, false); ?></div> - <?php $display_yesterday = false; } ?> - <?php if ($display_others && $item->isDay (Days::BEFORE_YESTERDAY)) { ?> - <div class="day"><?php echo Translate::t ('before_yesterday'); ?></div> - <?php $display_others = false; } ?> - - <div class="flux<?php echo !$item->isRead () ? ' not_read' : ''; ?><?php echo $item->isFavorite () ? ' favorite' : ''; ?>" id="flux_<?php echo $item->id (); ?>"> - <ul class="horizontal-list flux_header"> - <?php if (!login_is_conf ($this->conf) || is_logged ()) { ?> - <li class="item manage"> - <?php if (!$item->isRead ()) { ?> - <a class="read" href="<?php echo _url ('entry', 'read', 'id', $item->id (), 'is_read', 1); ?>"> </a> - <?php } else { ?> - <a class="read" href="<?php echo _url ('entry', 'read', 'id', $item->id (), 'is_read', 0); ?>"> </a> - <?php } ?> - - <?php if (!$item->isFavorite ()) { ?> - <a class="bookmark" href="<?php echo _url ('entry', 'bookmark', 'id', $item->id (), 'is_favorite', 1); ?>"> </a> - <?php } else { ?> - <a class="bookmark" href="<?php echo _url ('entry', 'bookmark', 'id', $item->id (), 'is_favorite', 0); ?>"> </a> - <?php } ?> - </li> - <?php } ?> - <?php $feed = $item->feed (true); ?> - <li class="item website"><a href="<?php echo _url ('index', 'index', 'get', 'f_' . $feed->id ()); ?>"><img class="favicon" src="<?php echo $feed->favicon (); ?>" alt="" /> <span><?php echo $feed->name (); ?></span></a></li> - <li class="item title"><?php echo $item->title (); ?></li> - <li class="item date"><?php echo $item->date (); ?></li> - <li class="item link"><a target="_blank" href="<?php echo $item->link (); ?>"> </a></li> - </ul> - - <div class="flux_content"> - <div class="content"> - <h1 class="title"><?php echo $item->title (); ?></h1> - <?php $author = $item->author (); ?> - <?php echo $author != '' ? '<div class="author">' . Translate::t ('by_author', $author) . '</div>' : ''; ?> - <?php - if($this->conf->lazyload() == 'yes') { - echo lazyimg($item->content ()); - } else { - echo $item->content(); - } - ?> - </div> - - <ul class="horizontal-list bottom"> - <li class="item"> - <div class="dropdown"> - <div id="dropdown-share-<?php echo $item->id ();?>" class="dropdown-target"></div> - <i class="icon i_share"></i> <a class="dropdown-toggle" href="#dropdown-share-<?php echo $item->id ();?>"><?php echo Translate::t ('share'); ?></a> - - <ul class="dropdown-menu"> - <li class="dropdown-close"><a href="#close"><i class="icon i_close"></i></a></li> - - <li class="item"><a href="mailto:?subject=<?php echo $item->title (); ?>&body=J'ai trouvé cet article intéressant, tu peux le lire à cette adresse : <?php echo urlencode($item->link ()); ?>"><?php echo Translate::t ('by_email'); ?></a></li> - <?php - $shaarli = $this->conf->urlShaarli (); - if ($shaarli) { - ?> - <li class="item"><a target="_blank" href="<?php echo $shaarli . '?post=' . urlencode($item->link ()) . '&title=' . urlencode ($item->title ()) . '&source=bookmarklet'; ?>"><?php echo Translate::t ('on_shaarli'); ?></a></li> - <?php } ?> - </ul> - </div> - </li> - <?php $tags = $item->tags(); ?> - <?php if(!empty($tags)) { ?> - <li class="item"> - <div class="dropdown"> - <div id="dropdown-tags-<?php echo $item->id ();?>" class="dropdown-target"></div> - <i class="icon i_tag"></i> <a class="dropdown-toggle" href="#dropdown-tags-<?php echo $item->id ();?>"><?php echo Translate::t ('related_tags'); ?></a> - - <ul class="dropdown-menu"> - <li class="dropdown-close"><a href="#close"><i class="icon i_close"></i></a></li> - - <?php foreach($tags as $tag) { ?> - <li class="item"><a href="<?php echo _url ('index', 'index', 'search', urlencode ('#' . $tag)); ?>"><?php echo $tag; ?></a></li> - <?php } ?> - </ul> - </div> - </li> - <?php } ?> - </ul> - </div> - </div> - <?php } ?> - - <?php $this->entryPaginator->render ('pagination.phtml', 'next'); ?> -</div> - - <?php } else { ?> -<div class="alert alert-warn"> - <span class="alert-head"><?php echo Translate::t ('no_feed_to_display'); ?></span> -</div> - <?php } ?> -<?php } ?> + $this->renderHelper ('normal_view'); +}
\ No newline at end of file diff --git a/lib/lib_text.php b/lib/lib_text.php index 6e8f7b2bf..9792e191e 100644 --- a/lib/lib_text.php +++ b/lib/lib_text.php @@ -86,3 +86,11 @@ function parse_tags ($desc) { return $desc_parse; } + +function lazyimg($content) { + return preg_replace( + '/<img([^<]+)src=([\'"])([^"\']*)([\'"])([^<]*)>/i', + '<img$1src="' . Url::display('/data/grey.gif') . '" data-original="$3"$5>', + $content + ); +}
\ No newline at end of file diff --git a/public/theme/freshrss.css b/public/theme/freshrss.css index 636f9e09d..26bb21d8f 100644 --- a/public/theme/freshrss.css +++ b/public/theme/freshrss.css @@ -245,11 +245,10 @@ line-height: 40px; } .flux_header .item.website .favicon { - padding: 12px; + padding: 5px; } .flux_header .item.website a { display: block; - padding: 0; height: 40px; } .flux_header .item.title { @@ -293,6 +292,7 @@ padding: 20px 10px; line-height: 170%; font-family: 'OpenSans'; + word-wrap: break-word; } .content .title { margin: 0 0 5px; @@ -480,6 +480,9 @@ width: 40px; text-align: center; } + .flux_header .item.website .favicon { + padding: 12px; + } .content { font-size: 120%; |
