Prepared checkboxes and radio buttons for the new jquery flatelements plugin

This commit is contained in:
Andy Strobel 2014-04-27 13:47:59 +02:00
parent dc7205ad20
commit 094bfaf38d
4 changed files with 45 additions and 10 deletions

View File

@ -26,11 +26,20 @@
<div class="row">
<?php if (!$poll->hasUserVoted()) : ?>
<div class="col-md-1">
<div class="col-md-1" style="padding-right: 0;">
<?php if ($poll->allow_multiple) : ?>
<?php echo CHtml::checkBox('answers[' . $answer->id . ']'); ?>
<div class="checkbox">
<label>
<?php echo CHtml::checkBox('answers[' . $answer->id . ']'); ?>
</label>
</div>
<?php else: ?>
<?php echo CHtml::radioButton('answers', false, array('value' => $answer->id)); ?>
<div class="radio">
<label>
<?php echo CHtml::radioButton('answers', false, array('value' => $answer->id, 'id' => 'answer_'. $answer->id)); ?>
</label>
</div>
<?php endif; ?>
</div>
<?php endif; ?>
@ -117,7 +126,7 @@
$voteUrl = CHtml::normalizeUrl(array('/polls/poll/answerReset', 'sguid' => $space->guid, 'pollId' => $poll->id));
echo HHtml::ajaxLink(Yii::t('PollsModule.base', 'Reset my vote'), $voteUrl, array(
'dataType' => 'json',
'success' => "function(json) { $('#wallEntry_'+json.wallEntryId).html(parseHtml(json.output)); }",
'success' => "function(json) { $('#wallEntry_'+json.wallEntryId).html(parseHtml(json.output)); $('#wallEntry_'+json.wallEntryId).find(':checkbox, :radio').flatelements(); }",
), array('id' => "PollAnswerResetButton_" . $poll->id, 'class' => 'btn btn-danger')
);
?>

View File

@ -5,7 +5,7 @@
<?php echo CHtml::textArea("answersText", "", array('id' => "contentForm_answersText", 'rows' => '5', "class" => "form-control contentForm", "tabindex" => "2", "placeholder" => Yii::t('PollsModule.base', "Possible answers (one per line)"))); ?>
<div class="checkbox">
<label>
<?php echo CHtml::checkbox("allowMultiple", "", array('id' => "contentForm_answersText", 'class' => 'checkbox tick contentForm', "tabindex" => "4")); ?> <?php echo Yii::t('PollsModule.base', 'Allow multiple answers per user?'); ?>
<?php echo CHtml::checkbox("allowMultiple", "", array('id' => "contentForm_allowMultiple", 'class' => 'checkbox contentForm', "tabindex" => "4")); ?> <?php echo Yii::t('PollsModule.base', 'Allow multiple answers per user?'); ?>
</label>
</div>

View File

@ -134,10 +134,35 @@
</td>
<?php if (!$workspace->isOwner($user->id)) : ?>
<td><?php echo CHtml::checkBox('user_' . $user->guid . "[inviteRole]", $membership->invite_role, array('class' => 'check_invite', 'id' => "chk_invite_" . $user->id)); ?></td>
<td><?php echo CHtml::checkBox('user_' . $user->guid . "[shareRole]", $membership->share_role, array('class' => 'check_share', 'id' => "chk_share_" . $user->id)); ?></td>
<td><?php echo CHtml::checkBox('user_' . $user->guid . "[adminRole]", $membership->admin_role, array('class' => 'check_admin', 'id' => "chk_admin_" . $user->id)); ?></td>
<td>
<!-- <td><?php /*echo CHtml::checkBox('user_' . $user->guid . "[inviteRole]", $membership->invite_role, array('class' => 'check_invite', 'id' => "chk_invite_" . $user->id)); */?></td>
<td><?php /*echo CHtml::checkBox('user_' . $user->guid . "[shareRole]", $membership->share_role, array('class' => 'check_share', 'id' => "chk_share_" . $user->id)); */?></td>
<td><?php /*echo CHtml::checkBox('user_' . $user->guid . "[adminRole]", $membership->admin_role, array('class' => 'check_admin', 'id' => "chk_admin_" . $user->id)); */?></td>-->
<td style="vertical-align:middle">
<div class="checkbox">
<label>
<?php echo CHtml::checkBox('user_' . $user->guid . "[inviteRole]", $membership->invite_role, array('class' => 'check_invite', 'id' => "chk_invite_" . $user->id, 'data-view' => 'slider')); ?>
</label>
</div>
</td>
<td style="vertical-align:middle">
<div class="checkbox">
<label>
<?php echo CHtml::checkBox('user_' . $user->guid . "[shareRole]", $membership->share_role, array('class' => 'check_share', 'id' => "chk_share_" . $user->id, 'data-view' => 'slider')); ?>
</label>
</div>
</td>
<td style="vertical-align:middle">
<div class="checkbox">
<label>
<?php echo CHtml::checkBox('user_' . $user->guid . "[adminRole]", $membership->admin_role, array('class' => 'check_admin', 'id' => "chk_admin_" . $user->id, 'data-view' => 'slider')); ?>
</label>
</div>
</td>
<td style="vertical-align:middle">
<!-- load modal confirm widget -->
<?php
$this->widget('application.widgets.ModalConfirmWidget', array(

View File

@ -2,7 +2,6 @@
<div class="panel-body">
<div class="media-body">
<h5 class="media-heading"><?php echo $space->name; ?></h5>
<div class="media">
<img class="img-rounded pull-left"
src="<?php echo $space->getProfileImage()->getUrl(); ?>" height="100" width="100"
@ -20,6 +19,8 @@
<script type="text/javascript">
$(document).ready(function() {
// save the count of characters