Make library render functions act consistently and be named consistently.

Closes #60
master
Zachary Doll 2015-01-14 16:03:42 -06:00
parent 91ba64f7a2
commit 59df030e0a
4 changed files with 44 additions and 24 deletions

View File

@ -92,7 +92,7 @@ class ActionController extends DashboardController {
$NewID = $this->Form->Save();
if($NewID) {
$Action = $this->ActionModel->GetByID($NewID);
$ActionRow = ActionRow($Action);
$ActionRow = RenderActionRow($Action);
if($Edit) {
$this->JsonTarget('#ActionID_' . $this->Action->ActionID, $ActionRow, 'ReplaceWith');

View File

@ -75,7 +75,7 @@ if(!function_exists('RenderReactionRecord')) {
}
if(!function_exists('ActionRow')) {
if(!function_exists('RenderActionRow')) {
/**
* Renders an action row used to construct the action admin screen
@ -83,7 +83,7 @@ if(!function_exists('ActionRow')) {
* @param stdClass $Action
* @return string
*/
function ActionRow($Action) {
function RenderActionRow($Action) {
return Wrap(
Wrap(
Anchor(T('Edit'), 'action/edit/' . $Action->ActionID, array('class' => 'Popup SmallButton')) . Anchor(T('Delete'), 'action/delete/' . $Action->ActionID, array('class' => 'Popup SmallButton')), 'div', array('class' => 'Tools')) .
@ -110,14 +110,15 @@ if(!function_exists('RenderPerkPermissionForm')) {
function RenderPerkPermissionForm($Perm, $Label) {
$Form = Gdn::Controller()->Form;
$Fieldname = 'Perm' . $Perm;
echo '<li>';
echo $Form->Label($Label, $Fieldname);
echo $Form->Dropdown($Fieldname, array(
$String = $Form->Label($Label, $Fieldname);
$String .= $Form->Dropdown($Fieldname, array(
'' => T('Default'),
'grant' => T('Grant'),
'revoke' => T('Revoke')
));
echo '</li>';
return $String;
}
}
@ -143,10 +144,11 @@ if(!function_exists('RenderPerkConfigurationForm')) {
$Options = $Options + array('' => T('Default'));
$Form = Gdn::Controller()->Form;
$Fieldname = 'Conf' . $Config;
echo '<li>';
echo $Form->Label($Label, $Fieldname);
echo $Form->Dropdown($Fieldname, $Options);
echo '</li>';
$String = $Form->Label($Label, $Fieldname);
$String .= $Form->Dropdown($Fieldname, $Options);
return $String;
}
}

View File

@ -10,7 +10,7 @@ echo Wrap(Anchor(T('Yaga.Action.Add'), 'action/add', array('class' => 'Popup Sma
<ol id="Actions" class="Sortable">
<?php
foreach($this->Data('Actions') as $Action) {
echo ActionRow($Action);
echo RenderActionRow($Action);
}
?>
</ol>

View File

@ -59,8 +59,9 @@ echo $this->Form->Errors();
echo $this->Form->Dropdown('Role', $this->Data('Roles'), array('IncludeNULL' => TRUE));
?>
</li>
<li>
<?php
RenderPerkConfigurationForm('Garden.EditContentTimeout', 'Yaga.Perks.EditTimeout', array('0' => T('Authors may never edit'),
echo RenderPerkConfigurationForm('Garden.EditContentTimeout', 'Yaga.Perks.EditTimeout', array('0' => T('Authors may never edit'),
'350' => sprintf(T('Authors may edit for %s'), T('5 minutes')),
'900' => sprintf(T('Authors may edit for %s'), T('15 minutes')),
'3600' => sprintf(T('Authors may edit for %s'), T('1 hour')),
@ -69,17 +70,34 @@ echo $this->Form->Errors();
'604800' => sprintf(T('Authors may edit for %s'), T('1 week')),
'2592000' => sprintf(T('Authors may edit for %s'), T('1 month')),
'-1' => T('Authors may always edit')));
RenderPerkPermissionForm('Garden.Curation.Manage', 'Yaga.Perks.Curation');
RenderPerkPermissionForm('Plugins.Signatures.Edit', 'Yaga.Perks.Signatures');
RenderPerkPermissionForm('Plugins.Tagging.Add', 'Yaga.Perks.Tags');
RenderPerkConfigurationForm('Plugins.Emotify.FormatEmoticons', 'Yaga.Perks.Emoticons');
RenderPerkConfigurationForm('Garden.Format.MeActions', 'Yaga.Perks.MeActions');
?>
</li>
<li>
<?php
echo RenderPerkPermissionForm('Garden.Curation.Manage', 'Yaga.Perks.Curation');
?>
</li>
<li>
<?php
echo RenderPerkPermissionForm('Plugins.Signatures.Edit', 'Yaga.Perks.Signatures');
?>
</li>
<li>
<?php
echo RenderPerkPermissionForm('Plugins.Tagging.Add', 'Yaga.Perks.Tags');
?>
</li>
<li>
<?php
echo RenderPerkConfigurationForm('Plugins.Emotify.FormatEmoticons', 'Yaga.Perks.Emoticons');
?>
</li>
<li>
<?php
echo RenderPerkConfigurationForm('Garden.Format.MeActions', 'Yaga.Perks.MeActions');
?>
</li>
<?php
$this->FireEvent('PerkOptions');
// Restore the prefix