Browse Source

- Add the universal share button

pull/16/head
Jaussoin Timothée 11 years ago
parent
commit
d2a6b3b6bd
  1. 2
      app/controllers/BlogController.php
  2. 11
      app/controllers/ShareController.php
  3. 7
      app/views/share.tpl
  4. 43
      app/widgets/Hello/hello.tpl
  5. 3
      app/widgets/Hello/locales.ini
  6. 3
      app/widgets/Post/Post.php
  7. 18
      app/widgets/Share/Share.php
  8. 2
      app/widgets/Share/locales.ini
  9. 29
      app/widgets/Share/share.tpl
  10. 1
      locales/locales.ini
  11. 1
      system/Route.php

2
app/controllers/BlogController.php

@ -6,6 +6,6 @@ class BlogController extends BaseController {
}
function dispatch() {
$this->page->setTitle(__('title.blog', APP_TITLE));
$this->page->setTitle(__('page.blog'));
}
}

11
app/controllers/ShareController.php

@ -0,0 +1,11 @@
<?php
class ShareController extends BaseController {
function load() {
$this->session_only = true;
}
function dispatch() {
$this->page->setTitle(__('page.share'));
}
}

7
app/views/share.tpl

@ -0,0 +1,7 @@
<main>
<section>
<div>
<?php $this->widget('Share');?>
</div>
</section>
</main>

43
app/widgets/Hello/hello.tpl

@ -96,20 +96,35 @@
</li>
</a>
</ul>
{/if}
<br />
<ul class="active">
<a href="{$c->route('blog', array($jid))}" target="_blank">
<li class="condensed action">
<div class="action">
<i class="md md-chevron-right"></i>
</div>
<span class="icon">
<i class="md md-wifi-tethering"></i>
<br />
<ul class="active thick">
<a href="{$c->route('blog', array($jid))}" target="_blank">
<li class="condensed action">
<div class="action">
<i class="md md-chevron-right"></i>
</div>
<span class="icon">
<i class="md md-wifi-tethering"></i>
</span>
<span>{$c->__('hello.blog_title')}</span>
<p>{$c->__('hello.blog_text')}</p>
</li>
<br/>
</a>
</ul>
<ul class="thick flex">
<li class="condensed block">
<span class="icon bubble color blue">
<i class="md md-share"></i>
</span>
<span>{$c->__('hello.blog_title')}</span>
<p>{$c->__('hello.blog_text')}</p>
<span>{$c->__('hello.share_title')}</span>
<p>{$c->__('hello.share_text')}</p>
</li>
</a>
</ul>
<li class="block">
<a class="button" href="javascript:(function(){location.href='{$c->route('share')}&url='+encodeURIComponent(location.href);})();">
<i class="md md-share"></i> {$c->__('hello.share_button')}
</a>
</li>
</ul>
{/if}
</div>

3
app/widgets/Hello/locales.ini

@ -3,3 +3,6 @@ hello.news = 'Read all theses articles on the News page'
hello.blog_title= 'Visit your public blog'
hello.blog_text = 'See your public posts and share them with all your contacts'
hello.contact_post = 'Contact post'
hello.share_title = 'Universal share button'
hello.share_text = 'Right click on or drag and drop the following button in your toolbar and use it on all the pages you want to share on Movim'
hello.share_button = 'Share on Movim'

3
app/widgets/Post/Post.php

@ -31,6 +31,7 @@ class Post extends WidgetCommon
function load()
{
$this->addcss('post.css');
$this->addjs('post.js');
$this->registerEvent('microblog_commentsget_handle', 'onComments');
$this->registerEvent('microblog_commentpublish_handle', 'onCommentPublished');
$this->registerEvent('microblog_commentsget_error', 'onCommentsError');
@ -114,6 +115,8 @@ class Post extends WidgetCommon
$view = $this->tpl();
Header::fill($view->draw('_post_header_create', true));
RPC::call('Post.setEmbed');
}
function ajaxPreview($form)

18
app/widgets/Share/Share.php

@ -0,0 +1,18 @@
<?php
use Respect\Validation\Validator;
class Share extends WidgetCommon {
function load()
{
}
function display()
{
$validate_url = Validator::url();
$url = $this->get('url');
if($validate_url->validate($url)) {
$this->view->assign('url', $url);
}
}
}

2
app/widgets/Share/locales.ini

@ -0,0 +1,2 @@
share.error = 'This is not a valid url'
share.success = 'Sharing the URL'

29
app/widgets/Share/share.tpl

@ -0,0 +1,29 @@
<div id="share_widget">
<ul class="thick">
{if="isset($url)"}
<li class="condensed action">
<div class="action">
<i class="md md-link"></i>
</div>
<span class="icon bubble blue color">
<i class="md md-share"></i>
</span>
<span>{$c->__('page.share')}</span>
<p>{$c->__('share.success')}</p>
<p><a href="{$url}">{$url}</a></p>
</li>
<script type="text/javascript">
localStorage.setItem('share_url', '{$url}');
movim_redirect('{$c->route('news')}');
</script>
{else}
<li class="condensed">
<span class="icon bubble orange color">
<i class="md md-error"></i>
</span>
<span>{$c->__('page.share')}</span>
<p>{$c->__('share.error')}</p>
</li>
{/if}
</ul>
</div>

1
locales/locales.ini

@ -29,6 +29,7 @@ page.gallery = 'Gallery'
page.preview = 'Preview'
page.visio = 'Visio-conference'
page.pods = 'Pods'
page.share = 'Share'
[errors]
error.error = 'Error: %s'

1
system/Route.php

@ -24,6 +24,7 @@ class Route extends \BaseController {
'news' => array('n'),
'pods' => false,
'profile' => false,
'share' => array('url'),
'visio' => false
);
}

Loading…
Cancel
Save