+ zin: add comment form and comment dialog wgs.
This commit is contained in:
@@ -1063,3 +1063,71 @@ function formItemDropdown()
|
||||
{
|
||||
return createWg('formItemDropdown', func_get_args());
|
||||
}
|
||||
|
||||
/**
|
||||
* Zentao editor wg.
|
||||
*
|
||||
* string name
|
||||
* ?string id
|
||||
* ?string class
|
||||
* ?string value
|
||||
* ?bool required
|
||||
* ?string placeholder
|
||||
* ?int rows
|
||||
* ?int cols
|
||||
*/
|
||||
function editor()
|
||||
{
|
||||
return createWg('editor', func_get_args());
|
||||
}
|
||||
|
||||
/**
|
||||
* Zentao comment button wg.
|
||||
*
|
||||
* ?string dataTarget
|
||||
* ?string dataUrl
|
||||
* ?string dataType
|
||||
* ?string icon
|
||||
* ?string text
|
||||
* ?bool square
|
||||
* ?bool disabled
|
||||
* ?bool active
|
||||
* ?string url
|
||||
* ?string target
|
||||
* ?string trailingIcon
|
||||
* ?string hint
|
||||
* ?string type
|
||||
* ?string btnType
|
||||
* string|int|null size
|
||||
* string|bool|null caret
|
||||
*/
|
||||
function commentBtn()
|
||||
{
|
||||
return createWg('commentBtn', func_get_args());
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Zentao comment dialog wg.
|
||||
*
|
||||
* ?string title,
|
||||
* ?string url
|
||||
* ?string name='comment'
|
||||
* ?string method='POST'
|
||||
*/
|
||||
function commentDialog()
|
||||
{
|
||||
return createWg('commentDialog', func_get_args());
|
||||
}
|
||||
|
||||
/**
|
||||
* Zentao comment form wg.
|
||||
*
|
||||
* ?string url
|
||||
* ?string name='comment'
|
||||
* ?string method='POST'
|
||||
*/
|
||||
function commentForm()
|
||||
{
|
||||
return createWg('commentForm', func_get_args());
|
||||
}
|
||||
|
||||
@@ -5,8 +5,9 @@ namespace zin;
|
||||
class commentBtn extends btn
|
||||
{
|
||||
static $defineProps = array(
|
||||
'dataTarget?:string',
|
||||
'dataUrl?:string',
|
||||
'dataType?:string="html"',
|
||||
'dataType?:string',
|
||||
'icon?:string',
|
||||
'iconClass?:string',
|
||||
'text?:string',
|
||||
@@ -26,14 +27,15 @@ class commentBtn extends btn
|
||||
|
||||
protected function getProps(): array
|
||||
{
|
||||
$dataUrl = $this->prop('dataUrl');
|
||||
$dataType = $this->prop('dataType');
|
||||
$props = parent::getProps();
|
||||
$dataTarget = $this->prop('dataTarget');
|
||||
$dataUrl = $this->prop('dataUrl');
|
||||
$dataType = $this->prop('dataType');
|
||||
$props = parent::getProps();
|
||||
|
||||
$props['data-toggle'] = 'modal';
|
||||
$props['data-type'] = 'ajax';
|
||||
$props['data-data-type'] = $dataType;
|
||||
$props['data-type'] = $dataType;
|
||||
$props['data-url'] = $dataUrl;
|
||||
$props['data-target'] = $dataTarget;
|
||||
|
||||
return $props;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
namespace zin;
|
||||
|
||||
class commentDialog extends wg
|
||||
{
|
||||
static $defineProps = array(
|
||||
'title?:string',
|
||||
'url?:string',
|
||||
'name?:string="comment"',
|
||||
'method?:string="post"'
|
||||
);
|
||||
|
||||
protected function build(): wg
|
||||
{
|
||||
global $lang;
|
||||
$title = $this->prop('title');
|
||||
$name = $this->prop('name');
|
||||
$url = $this->prop('url');
|
||||
$method = $this->prop('method');
|
||||
if(empty($title)) $title = $lang->action->create;
|
||||
|
||||
return modal
|
||||
(
|
||||
set::id('comment-dialog'),
|
||||
set::title($title),
|
||||
commentForm
|
||||
(
|
||||
set::url($url),
|
||||
set::method($method),
|
||||
set::name($name),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
namespace zin;
|
||||
|
||||
class commentForm extends wg
|
||||
{
|
||||
static $defineProps = array(
|
||||
'url?:string',
|
||||
'name?:string="comment"',
|
||||
'method?:string="POST"'
|
||||
);
|
||||
|
||||
protected function build(): wg
|
||||
{
|
||||
global $lang;
|
||||
$url = $this->prop('url');
|
||||
$name = $this->prop('name');
|
||||
$method = $this->prop('method');
|
||||
if(empty($name)) $name = 'comment';
|
||||
|
||||
return form
|
||||
(
|
||||
set::url($url),
|
||||
set::method($method),
|
||||
setClass('comment-form'),
|
||||
editor
|
||||
(
|
||||
setID($name),
|
||||
set::name($name)
|
||||
),
|
||||
set::actions
|
||||
(
|
||||
array(
|
||||
'submit',
|
||||
array('data-dismiss' => 'modal', 'text' => $lang->close)
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user