Skip to content

Commit

Permalink
Dev: Adapt attribute settings to Bootstrap
Browse files Browse the repository at this point in the history
  • Loading branch information
olleharstedt committed Dec 21, 2015
1 parent 4d2653f commit 03f4f0f
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 73 deletions.
6 changes: 4 additions & 2 deletions application/controllers/admin/participantsaction.php
Expand Up @@ -946,8 +946,8 @@ function viewAttribute()
'attributevalues' => ParticipantAttributeName::model()->getAttributesValues($iAttributeId),
'aAttributes' => ParticipantAttributeName::model()->getAllAttributes()
);
App()->getClientScript()->registerCssFile(Yii::app()->getConfig('adminstyleurl').'participants.css');
App()->getClientScript()->registerCssFile(Yii::app()->getConfig('adminstyleurl').'viewAttribute.css');
//App()->getClientScript()->registerCssFile(Yii::app()->getConfig('adminstyleurl').'participants.css');
//App()->getClientScript()->registerCssFile(Yii::app()->getConfig('adminstyleurl').'viewAttribute.css');
App()->getClientScript()->registerScriptFile( App()->getAssetManager()->publish( ADMIN_SCRIPT_PATH . "viewAttribute.js"));
$this->_renderWrappedTemplate('participants', array('participantsPanel', 'viewAttribute'), $aData);
}
Expand All @@ -967,6 +967,8 @@ function saveAttribute()
);
ParticipantAttributeName::model()->saveAttribute($aData);

//echo "<pre>"; var_dump($_POST); echo "</pre>"; die;

// Save translations
if (isset($_POST['lang']))
{
Expand Down
131 changes: 61 additions & 70 deletions application/views/admin/participants/viewAttribute_view.php
Expand Up @@ -19,29 +19,38 @@
<div class="row">
<div class="col-lg-12 content-right">

<?php echo CHtml::beginForm(Yii::app()->getController()->createUrl('admin/participants/sa/saveAttribute/aid/' . Yii::app()->request->getQuery('aid')) . '/', "post",array('class'=>'form-inline col-md-6 col-md-offset-3')); ?>
<?php echo CHtml::beginForm(Yii::app()->getController()->createUrl('admin/participants/sa/saveAttribute/aid/' . Yii::app()->request->getQuery('aid')) . '/', "post",array('class'=>'form-horizontal col-md-6 col-md-offset-3', 'role' => 'form')); ?>

<div class="form-group"><label for="atttype"><?php eT('Default attribute name:'); ?></label>
<?php echo CHtml::textField('defaultname', $attributes['defaultname'],array('required'=>'required')); ?>
</div>
<div class="form-group "><label for="atttype"><?php eT('Attribute type:'); ?></label>
<?php
echo CHtml::dropDownList('attribute_type', $attributes['attribute_type'], array(
'TB' => 'Text box',
'DD' => 'Drop-down list',
'DP' => 'Date'),
array('class'=>'form-control')
<div class="form-group">
<label for="defaultname" class='control-label col-sm-3'><?php eT('Default attribute name:'); ?></label>
<div class='col-sm-3'>
<?php echo CHtml::textField('defaultname', $attributes['defaultname'],array('required'=>'required', 'class' => 'form-control')); ?>
</div>
</div>

);
?>
</div>
<div class="form-group"><label for='attvisible' id='attvisible'><?php eT('Attribute visible:') ?></label>
<?php echo CHtml::checkbox('visible', ($attributes['visible'] == "TRUE"),array('value'=>'TRUE','uncheckValue'=>'FALSE')); ?>
</div>
<div class="form-group ">
<label for="atttype" class='col-sm-3 control-label'><?php eT('Attribute type:'); ?></label>
<div class='col-sm-3'>
<?php
echo CHtml::dropDownList('attribute_type', $attributes['attribute_type'], array(
'TB' => 'Text box',
'DD' => 'Drop-down list',
'DP' => 'Date'),
array('class'=>'form-control')
);
?>
</div>
</div>

<div class="form-group">
<label for='attvisible' id='attvisible' class='col-sm-3 control-label'><?php eT('Attribute visible:') ?></label>
<div class='col-sm-3'>
<?php echo CHtml::checkbox('visible', ($attributes['visible'] == "TRUE"),array('value'=>'TRUE','uncheckValue'=>'FALSE')); ?>
</div>
</div>


<div id='ddtable' style='display: none'>
<br/><br/>
<table class='hovertable table table-striped'>
<thead>
<tr>
Expand Down Expand Up @@ -84,59 +93,41 @@
</table>
</div>

<div id="addlang">
<table width='400' >
<tr>
<th colspan='2'>
<?php eT('Add a language:'); ?>
</th>
</tr>
<tr>
<td class='data'>
<?php
echo CHtml::dropDownList('langdata', '', $aOptions, array('class'=>'form-control'));
?>
</td>
<td class='actions'>
<span class="icon-add text-success" id="add" title="<?php eT('Add language'); ?>" ></span>
</td>
</tr>
</table>
<div id="addlang" class='form-group'>
<label class='control-label col-sm-3'><?php eT('Add a language:'); ?></label>
<div class='col-sm-3'>
<?php echo CHtml::dropDownList('langdata', '', $aOptions, array('class'=>'form-control')); ?>
</div>
<span data-toggle='tooltip' data-placement='bottom' class="ui-pg-button icon-add text-success" id="add" title="<?php eT('Add language'); ?>" ></span>
</div>
<br />


<div id='tabs'>
<ul class="nav nav-tabs" id="">
<?php foreach ($attributenames as $key => $value): ?>
<li role="presentation" <?php if($key==0){ echo 'class="active"'; }?>>
<a data-toggle="tab" href='#<?php echo $value['lang']; ?>'>
<?php echo $aOptions[$value['lang']] ?>
</a>
<script type='text/javascript'>
removeitem.push('<?php echo $value['lang'] ?>');
</script>
</li>
<?php endforeach;?>
<?php foreach ($attributenames as $key => $value): ?>
<li role="presentation" <?php if($key==0){ echo 'class="active"'; }?>>
<a data-toggle="tab" href='#<?php echo $value['lang']; ?>'>
<?php echo $aOptions[$value['lang']] ?>
</a>
<script type='text/javascript'>
removeitem.push('<?php echo $value['lang'] ?>');
</script>
</li>
<?php endforeach;?>
</ul>
<?php //var_dump($attributenames); ?>
<?php
foreach ($attributenames as $key => $value)
{
?>
<div class='commonsettings'>
<div id="<?php echo $value['lang'] ?>">
<table width='400' class='nudgeleft'>
<tr>
<th>
<label for='attname' id='attname'>
<?php eT('Attribute name:'); ?>
</label>
</th>
</tr>
<tr>
<td class='data'>
<?php echo CHtml::textField('lang[' . $value['lang'] . ']', $value['attribute_name'], array('class'=>'languagesetting', 'style'=>'border: 1px solid #ccc')); ?>
</td>
</tr>
</table>
<div id="<?php echo $value['lang'] ?>" class='form-group' style='padding-top: 1em;'>
<label class='control-label col-sm-3' for='attname' id='attname'>
<?php eT('Attribute name:'); ?>
</label>
<div class='col-sm-3'>
<?php echo CHtml::textField('lang[' . $value['lang'] . ']', $value['attribute_name'], array('class'=>'languagesetting form-control')); ?>
</div>
</div>
</div>
<?php
Expand All @@ -145,14 +136,14 @@
?>
</div>



<p>
<?php
echo CHtml::submitButton('submit', array('value' => gT('Save')));
echo CHtml::endForm();
?>
</p>
<div class='form-group'>
<div class='col-sm-3 col-sm-offset-0'>
<?php
echo CHtml::submitButton('submit', array('value' => gT('Save'), 'class' => 'btn btn-default'));
?>
</div>
</div>
<?php echo CHtml::endForm(); ?>



Expand Down
2 changes: 1 addition & 1 deletion scripts/admin/viewAttribute.js
Expand Up @@ -31,7 +31,7 @@ $(document).ready(function() {

// Add li anchor and content
$('#tabs ul').append(
'<li class="ui-state-default ui-corner-top" role="tab" tabindex="-1" aria-controls="' + lang + '" aria-labelledby="ui-id-' + num_tabs + '"aria-selected="fase"><a class="ui-tabs-anchor" role="presentation" tabindex="-1" id="ui-id-' + num_tabs + '"href="#' + lang + '">' + $('#langdata option:selected').text() + '</a></li>'
'<li data-toggle="tab" class="ui-state-default ui-corner-top" role="tab" tabindex="-1" aria-controls="' + lang + '" aria-labelledby="ui-id-' + num_tabs + '"aria-selected="fase"><a class="ui-tabs-anchor" role="presentation" tabindex="-1" id="ui-id-' + num_tabs + '"href="#' + lang + '">' + $('#langdata option:selected').text() + '</a></li>'
);
$('#tabs').append('<div class="commonsettings"><div id="' + lang + '" aria-labelledby="ui-id-' + num_tabs + '" class="ui-tabs-panel ui-widget-content ui-corner-bottom" role="tabpanel" aria-expanded="true" aria-hidden="true" style="display: none;"> <table width="400" class="nudgeleft"> <tbody><tr> <th> <label for="attname" id="attname"> Attribute name: </label> </th> </tr> <tr> <td class="data"> <input class="languagesetting" style="border: 1px solid black; background-color: rgb(255, 255, 255);" type="text" value="" name="lang[' + lang + ']" id="lang_' + lang + '"> </td> </tr> </tbody></table> </div> </div>');

Expand Down

0 comments on commit 03f4f0f

Please sign in to comment.