Browse Source
Introducting Briefs and implement a simple PublishBrief widget
Introducting Briefs and implement a simple PublishBrief widget
Improve Posts/Briefs cards Move the Posts/Briefs deletions actions to PostActionspull/392/head
22 changed files with 256 additions and 113 deletions
-
5app/models/postn/Postn.php
-
5app/views/news.tpl
-
2app/views/post.tpl
-
12app/widgets/Menu/_menu_list.tpl
-
46app/widgets/Post/Post.php
-
4app/widgets/Post/_post.tpl
-
61app/widgets/Post/_post_card.tpl
-
61app/widgets/PostActions/PostActions.php
-
2app/widgets/PostActions/_postactions_delete.tpl
-
0app/widgets/PostActions/postactions.tpl
-
30app/widgets/Presence/_presence.tpl
-
18app/widgets/Presence/presence.tpl
-
7app/widgets/Publish/Publish.php
-
0app/widgets/PublishBrief/Document sans nom
-
41app/widgets/PublishBrief/PublishBrief.php
-
3app/widgets/PublishBrief/locales.ini
-
3app/widgets/PublishBrief/publishbrief.css
-
10app/widgets/PublishBrief/publishbrief.js
-
41app/widgets/PublishBrief/publishbrief.tpl
-
6src/Movim/Bootstrap.php
-
4themes/material/css/color.css
-
8themes/material/css/listn.css
@ -0,0 +1,61 @@ |
|||
<?php |
|||
|
|||
use Moxl\Xec\Action\Pubsub\PostDelete; |
|||
use Moxl\Xec\Action\Pubsub\Delete; |
|||
|
|||
class PostActions extends \Movim\Widget\Base |
|||
{ |
|||
function load() |
|||
{ |
|||
$this->registerEvent('pubsub_postdelete_handle', 'onDelete'); |
|||
$this->registerEvent('pubsub_postdelete', 'onDelete'); |
|||
} |
|||
|
|||
function onDelete($packet) |
|||
{ |
|||
list($server, $node, $id) = array_values($packet->content); |
|||
|
|||
if(substr($node, 0, 29) == 'urn:xmpp:microblog:0:comments') { |
|||
Notification::append(false, $this->__('post.comment_deleted')); |
|||
$this->ajaxGetComments($server, substr($node, 30)); |
|||
} else { |
|||
Notification::append(false, $this->__('post.deleted')); |
|||
|
|||
if($node == 'urn:xmpp:microblog:0') { |
|||
$this->rpc('MovimUtils.redirect', $this->route('news')); |
|||
} else { |
|||
$this->rpc('MovimUtils.redirect', $this->route('community', [$server, $node])); |
|||
} |
|||
} |
|||
} |
|||
|
|||
function ajaxDelete($to, $node, $id) |
|||
{ |
|||
$view = $this->tpl(); |
|||
|
|||
$view->assign('to', $to); |
|||
$view->assign('node', $node); |
|||
$view->assign('id', $id); |
|||
|
|||
Dialog::fill($view->draw('_postactions_delete', true)); |
|||
} |
|||
|
|||
function ajaxDeleteConfirm($to, $node, $id) |
|||
{ |
|||
$p = new PostDelete; |
|||
$p->setTo($to) |
|||
->setNode($node) |
|||
->setId($id) |
|||
->request(); |
|||
|
|||
$p = new Delete; |
|||
$p->setTo($to) |
|||
->setNode('urn:xmpp:microblog:0:comments/'.$id) |
|||
->request(); |
|||
} |
|||
|
|||
|
|||
function display() |
|||
{ |
|||
} |
|||
} |
|||
@ -1,15 +1,17 @@ |
|||
<li> |
|||
{$url = $me->getPhoto('s')} |
|||
{if="$url"} |
|||
<span |
|||
class="primary icon bubble status {if="$presence->value != null"}{$presencetxt[$presence->value]}{/if}" |
|||
style="background-image: url({$me->getPhoto('s')})"> |
|||
</span> |
|||
{else} |
|||
<span class="primary icon bubble color {$me->jid|stringToColor} status {if="$presence->value != null"}{$presencetxt[$presence->value]}{/if}"> |
|||
<i class="zmdi zmdi-account"></i> |
|||
</span> |
|||
{/if} |
|||
<a href="{$c->route('contact', $me->jid)}"> |
|||
<li> |
|||
{$url = $me->getPhoto('s')} |
|||
{if="$url"} |
|||
<span |
|||
class="primary icon bubble status {if="$presence->value != null"}{$presencetxt[$presence->value]}{/if}" |
|||
style="background-image: url({$me->getPhoto('s')})"> |
|||
</span> |
|||
{else} |
|||
<span class="primary icon bubble color {$me->jid|stringToColor} status {if="$presence->value != null"}{$presencetxt[$presence->value]}{/if}"> |
|||
<i class="zmdi zmdi-account"></i> |
|||
</span> |
|||
{/if} |
|||
|
|||
<p class="line bold normal">{$me->getTrueName()}</p> |
|||
</li> |
|||
<p class="line bold normal">{$me->getTrueName()}</p> |
|||
</li> |
|||
</a> |
|||
@ -1,11 +1,9 @@ |
|||
<ul class="list active thick" dir="ltr"> |
|||
<a href="{$c->route('conf')}" id="presence_widget"> |
|||
<li> |
|||
<span class="primary icon bubble color status"> |
|||
<i class="zmdi zmdi-account"></i> |
|||
</span> |
|||
<p class="line bold"><br /></p> |
|||
<p class="line"><br /></p> |
|||
</li> |
|||
</a> |
|||
<ul class="list active thick" id="presence_widget" dir="ltr"> |
|||
<li> |
|||
<span class="primary icon bubble color status"> |
|||
<i class="zmdi zmdi-account"></i> |
|||
</span> |
|||
<p class="line bold"><br /></p> |
|||
<p class="line"><br /></p> |
|||
</li> |
|||
</ul> |
|||
@ -0,0 +1,41 @@ |
|||
<?php |
|||
|
|||
use Moxl\Xec\Action\Pubsub\PostPublish; |
|||
|
|||
use Movim\Session; |
|||
|
|||
use Respect\Validation\Validator; |
|||
|
|||
class PublishBrief extends \Movim\Widget\Base |
|||
{ |
|||
function load() |
|||
{ |
|||
$this->addjs('publishbrief.js'); |
|||
$this->addcss('publishbrief.css'); |
|||
} |
|||
|
|||
function ajaxPublish($form) |
|||
{ |
|||
$this->rpc('PublishBrief.disableSend'); |
|||
|
|||
if(Validator::stringType()->notEmpty()->validate(trim($form->title->value))) { |
|||
$p = new PostPublish; |
|||
$p->setFrom($this->user->getLogin()) |
|||
->setTo($this->user->getLogin()) |
|||
->setTitle(htmlspecialchars($form->title->value)) |
|||
->setNode('urn:xmpp:microblog:0'); |
|||
|
|||
if($form->open->value === true) { |
|||
$p->isOpen(); |
|||
} |
|||
|
|||
$p->request(); |
|||
} else { |
|||
$this->rpc('PublishBrief.enableSend'); |
|||
} |
|||
} |
|||
|
|||
function display() |
|||
{ |
|||
} |
|||
} |
|||
@ -0,0 +1,3 @@ |
|||
[publishbrief] |
|||
placeholder = "What's new?" |
|||
post = Write a post |
|||
@ -0,0 +1,3 @@ |
|||
header#publishbrief form > div textarea { |
|||
padding-top: 1rem; |
|||
} |
|||
@ -0,0 +1,10 @@ |
|||
var Publish = { |
|||
enableSend: function() { |
|||
MovimUtils.removeClass('#button_send', 'disabled'); |
|||
}, |
|||
|
|||
disableSend: function() { |
|||
MovimUtils.addClass('#button_send', 'disabled'); |
|||
} |
|||
} |
|||
|
|||
@ -0,0 +1,41 @@ |
|||
<header id="publishbrief" class="card shadow"> |
|||
<ul class="block list"> |
|||
<li> |
|||
<span id="menu" class="primary on_mobile icon bubble active gray" onclick="MovimTpl.toggleMenu()"> |
|||
<i class="zmdi zmdi-menu"></i> |
|||
</span> |
|||
<span class="primary on_desktop icon bubble gray"> |
|||
<i class="zmdi zmdi-edit"></i> |
|||
</span> |
|||
<span class="control icon gray active" onclick="PublishBrief_ajaxPublish(MovimUtils.formToJson('brief'));"> |
|||
<i class="zmdi zmdi-mail-send"></i> |
|||
</span> |
|||
<form onsubmit="return false;" name="brief"> |
|||
<div> |
|||
<textarea |
|||
name="title" |
|||
id="title" |
|||
rows="1" |
|||
onkeyup="MovimUtils.textareaAutoheight(this);" |
|||
placeholder="{$c->__('publishbrief.placeholder')}" |
|||
type="text"></textarea> |
|||
</div> |
|||
</form> |
|||
</li> |
|||
<li> |
|||
<span class="primary"></span> |
|||
<p class="normal"> |
|||
<a class="button flat gray disabled" href="#"> |
|||
<i class="zmdi zmdi-image"></i> |
|||
</a> |
|||
<a class="button flat gray disabled" href="#"> |
|||
<i class="zmdi zmdi-link"></i> |
|||
</a> |
|||
|
|||
<a class="button flat gray oppose" href="{$c->route('publish')}"> |
|||
{$c->__('publishbrief.post')} <i class="zmdi zmdi-format-align-left"></i> |
|||
</a> |
|||
</p> |
|||
</li> |
|||
</ul> |
|||
</header> |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue