Browse Source

- Continue Post submit form integration

- Add a help popin
- Add a preview function
pull/16/head
Jaussoin Timothée 11 years ago
parent
commit
778712e75a
  1. 18
      app/widgets/Header/_header_main.tpl
  2. 19
      app/widgets/Post/Post.php
  3. 49
      app/widgets/Post/_post_empty.tpl
  4. 87
      app/widgets/Post/_post_help.tpl
  5. 16
      app/widgets/Post/_post_preview.tpl
  6. 4
      app/widgets/Post/locales.ini
  7. 17
      themes/material/css/article.css
  8. 2
      themes/material/css/color.css
  9. 16
      themes/material/css/form.css

18
app/widgets/Header/_header_main.tpl

@ -13,3 +13,21 @@
</div>
</form>
</div>
<div>
<span class="icon">
<i class="md md-edit"></i>
</span>
<h2 class="r2">New Post</h2>
<ul class="active">
<li onclick="Post_ajaxHelp()">
<span class="icon">
<i class="md md-help"></i>
</span>
</li>
<li onclick="Post_ajaxPreview(movim_form_to_json('post'))">
<span class="icon">
<i class="md md-remove-red-eye"></i>
</span>
</li>
</ul>
</div>

19
app/widgets/Post/Post.php

@ -19,6 +19,7 @@
*/
use Moxl\Xec\Action\Microblog\CommentsGet;
use \Michelf\Markdown;
class Post extends WidgetCommon
{
@ -42,6 +43,24 @@ class Post extends WidgetCommon
RPC::call('movim_fill', 'post_widget', $html);
}
function ajaxPreview($form)
{
if($form->content->value != '') {
$view = $this->tpl();
$view->assign('content', Markdown::defaultTransform($form->content->value));
Dialog::fill($view->draw('_post_preview', true));
} else {
Notification::append(false, 'No content to preview');
}
}
function ajaxHelp()
{
$view = $this->tpl();
Dialog::fill($view->draw('_post_help', true));
}
function ajaxGetComments($jid, $id)
{
$c = new CommentsGet;

49
app/widgets/Post/_post_empty.tpl

@ -3,7 +3,8 @@
<h4>{$c->__('post.placeholder')}</h4>
</div>-->
<ul class="simple">
<li class="action">
<li>
<!--
<form>
<div class="control action">
<span style="display: inline; float: left; margin-right: 2rem;"><i class="md md-insert-comment"></i></span>
@ -20,30 +21,28 @@
</div>
<span style="display: inline; float: right; margin-left: 2rem;"><i class="md md-mode-edit"></i></span>
</div>
</form>-->
<form name="post">
<div>
<input type="text" name="title" placeholder="Optionnel">
<label for="title">Title</label>
</div>
<div>
<textarea name="content" placeholder="Content" onkeyup="movim_textarea_autoheight(this);"></textarea>
<label for="content">Content</label>
</div>
<div>
<input type="url" name="embed" placeholder="http://myawesomewebsite.com/" onblur="Post_ajaxEmbedTest(this.value)">
<label for="embed">Link</label>
<div id="preview">
</div>
</div>
<div>
<input type="text" name="tags" placeholder="food, blog, news">
<label for="tags">Tags</label>
</div>
</form>
<h2>New post</h2>
</li>
</ul>
<form>
<div>
<input type="text" placeholder="Optionnel">
<label>Title</label>
</div>
<div>
<textarea placeholder="Content"></textarea>
<label>Content</label>
</div>
<div>
<input type="url" placeholder="http://myawesomewebsite.com/" onblur="Post_ajaxEmbedTest(this.value)">
<label>Link</label>
<div id="preview">
</div>
</div>
<div>
<input type="text" placeholder="food, blog, news">
<label>Tags</label>
</div>
</form>

87
app/widgets/Post/_post_help.tpl

@ -0,0 +1,87 @@
<section>
<h3>{$c->__('post.help')}</h3>
<ul class="thick flex">
<li class="block">
<span class="icon">
<i class="md md-format-size"></i>
</span>
<p># Title H1</p>
<p>## Title H2…</p>
</li>
<li class="block">
<span class="icon">
<i class="md md-format-bold"></i>
</span>
<p>**bolded**</p>
<p>__bolded__</p>
</li>
<li class="block">
<span class="icon">
<i class="md md-format-italic"></i>
</span>
<p>*emphasis*</p>
<p>_emphasis_</p>
</li>
<li class="block">
<span class="icon">
<i class="md md-format-quote"></i>
</span>
<p>> Quoted line</p>
<p>> Quoted line</p>
</li>
<li class="block">
<span class="icon">
<i class="md md-format-list-bulleted"></i>
</span>
<p>* Item 1</p>
<p>* Item 2</p>
</li>
<li class="block">
<span class="icon">
<i class="md md-format-list-numbered"></i>
</span>
<p>1. Item 1</p>
<p>2. Item 2</p>
</li>
<li class="block">
<span class="icon">
<i class="md md-functions"></i>
</span>
<p>`Sourcecode`</p>
</li>
<li class="block large">
<span class="icon">
<i class="md md-insert-link"></i>
</span>
<p>[my text](http://my_url/)</p>
</li>
<li class="block large">
<span class="icon">
<i class="md md-insert-photo"></i>
</span>
<p>![Alt text](http://my_image_url/)</p>
</li>
</ul>
<ul class="active">
<li class="subheader">{$c->__('post.help_more')}</li>
<a href="http://daringfireball.net/projects/markdown/syntax" target="_blank">
<li class="condensed action">
<div class="action">
<i class="md md-chevron-right"></i>
</div>
<span class="icon color bubble blue">
<i class="md md-star"></i>
</span>
<span>
{$c->__('post.help_manual')}
</span>
<p>http://daringfireball.net/projects/markdown/syntax</p>
</li>
</a>
</ul>
</section>
<div class="no_bar">
<a onclick="Dialog.clear()" class="button flat">
{$c->__('button.cancel')}
</a>
</div>

16
app/widgets/Post/_post_preview.tpl

@ -0,0 +1,16 @@
<section>
<h3>{$c->__('post.preview')}</h3>
<br />
<article>
<section>
<content>
{$content}
</content>
</section>
</article>
</section>
<div class="no_bar">
<a onclick="Dialog.clear()" class="button flat">
{$c->__('button.cancel')}
</a>
</div>

4
app/widgets/Post/locales.ini

@ -1,3 +1,7 @@
post.news_feed = 'News Feed'
post.comments = 'Comments'
post.placeholder = 'Discover and register to the groups you are interested in'
post.preview = 'Preview'
post.help = 'Help'
post.help_more = 'More help'
post.help_manual = 'Markdown syntax manual'

17
themes/material/css/article.css

@ -31,14 +31,23 @@ article section p {
margin-bottom: 1rem;
}
article section content ul li {
article section content ul li,
article section content ol li {
font-size: 2rem;
line-height: 3rem;
padding-left: 2rem;
list-style-type: circle;
list-style-position: inside;
min-height: 4rem;
}
article section content ul li {
list-style-type: disc;
}
article section content ol li {
list-style-type: decimal;
}
article section content strong,
article section content b {
font-weight: 700;
@ -54,3 +63,7 @@ article section content blockquote {
padding-left: 4rem;
font-style: italic;
}
article section content em {
font-style: italic;
}

2
themes/material/css/color.css

@ -186,7 +186,7 @@ body.green a:not(.classic) { color: #388E3C; border-color: #388E3C; }
/* green accent : purple */
body.green form > div .checkbox:before { background-color: #BBDEFB; }
/*body.green form > div .checkbox:before { background-color: #BBDEFB; }*/
body.green form > div .checkbox > input[type="checkbox"]:checked + label { background-color: #2196F3; }
body.green form > div .radio > input[type="radio"]:checked + label {

16
themes/material/css/form.css

@ -124,7 +124,7 @@ form > div .checkbox {
border-radius: 2rem;
margin-left: 1rem;
width: 5rem;
background-color: #939393;
background-color: rgba(0, 0, 0, 0.5);
margin: 1.5rem 0;
}
@ -135,19 +135,21 @@ form > div .checkbox:before {
height: 2.25rem;
border-radius: 2rem 0 0 2rem;
width: 2.7rem;
background-color: #77C1BA;
background-color: rgba(255, 255, 255, 0.5);
}
form > div .checkbox > input[type="checkbox"] + label {
display: block;
background-color: #FAFAFA;
box-shadow: 0 0.2rem 0.5rem rgba(0, 0, 0, 0.5);
width: 3rem;
height: 3rem;
width: 3.5rem;
height: 3.5rem;
border-radius: 2rem;
top: -0.35rem;
left: 0;
top: -0.65rem;
left: -0.2rem;
position: relative;
font-size: 2rem;
text-align: center;
transition: left 0.3s ease, box-shadow 0.1s ease;
}
@ -159,7 +161,7 @@ form > div .checkbox > input[type="checkbox"] + label:hover {
form > div .checkbox > input[type="checkbox"]:checked + label {
background-color: #009587;
left: 1.3em;
left: 1.1em;
}
form > div .checkbox > input[type="checkbox"]:checked + label:hover {

Loading…
Cancel
Save