Skip to content

Commit

Permalink
Fixed issue: Add general link to documentation in admin interface (T145)
Browse files Browse the repository at this point in the history
  • Loading branch information
lacrioque committed Jan 4, 2019
1 parent fcfab76 commit 2121dae
Show file tree
Hide file tree
Showing 15 changed files with 147 additions and 50 deletions.
2 changes: 1 addition & 1 deletion application/controllers/AdminController.php
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ public function getActionClasses()
'notification' => 'NotificationController',
'menus' => 'SurveymenuController',
'menuentries' => 'SurveymenuEntryController',
'tutorial' => 'TutorialsController',
'tutorials' => 'TutorialsController',
'tutorialentries' => 'TutorialEntryController',
'extensionupdater' => 'ExtensionUpdaterController'
);
Expand Down
33 changes: 15 additions & 18 deletions application/controllers/admin/TutorialEntryController.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
<?php

class TutorialEntryController extends Controller
class TutorialEntryController extends Survey_Common_Action
{
/**
* @var string the default layout for the views. Defaults to '//layouts/column2', meaning
* using two-column layout. See 'protected/views/layouts/column2.php'.
*/
public $layout = '//layouts/column2';

/**
* @return string[] action filters
*/
Expand Down Expand Up @@ -45,6 +39,20 @@ public function accessRules()
);
}

public function index()
{
$this->getController()->redirect(array('admin/tutorialentries/sa/view'));
}

public function view()
{
//$this->checkPermission();
$data = array();
$data['model'] = TutorialEntry::model();
//App()->getClientScript()->registerPackage('surveymenufunctions');
$this->_renderWrappedTemplate(null, array('tutorialentries/index'), $data);
}

/**
* Displays a particular model.
* @param integer $id the ID of the model to be displayed
Expand Down Expand Up @@ -118,17 +126,6 @@ public function actionDelete($id)
}
}

/**
* Lists all models.
*/
public function actionIndex()
{
$dataProvider = new CActiveDataProvider('TutorialEntry');
$this->render('index', array(
'dataProvider'=>$dataProvider,
));
}

/**
* Manages all models.
*/
Expand Down
28 changes: 22 additions & 6 deletions application/models/TutorialEntry.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ public function rules()
// will receive user inputs.
return array(
array('title, content, settings', 'required'),
array('numerical', 'integerOnly'=>true),
// The following rule is used by search().
// @todo Please remove those attributes that should not be searched.
array('teid, title, content, settings', 'safe', 'on'=>'search'),
Expand All @@ -47,7 +46,7 @@ public function relations()
// NOTE: you may need to adjust the relation name and the related
// class name for the relations automatically generated below.
return array(
'tutorialEntryGroup' => array(self::HAS_MANY, 'TutorialEntryGroups', 'teid'),
'tutorialEntryRelation' => array(self::HAS_MANY, 'TutorialEntryRelation', 'teid'),
);
}

Expand All @@ -57,13 +56,30 @@ public function relations()
public function attributeLabels()
{
return array(
'teid' => 'Tutorial Entry Id',
'title' => 'Title',
'content' => 'Content',
'settings' => 'Settings',
'teid' => gT('Tutorial Entry Id'),
'title' => gT('Title'),
'content' => gT('Content'),
'settings' => gT('Settings'),
);
}

public function getColumns(){
return [
[
'name' => 'teid',
],
[
'name' => 'title',
],
[
'name' => 'content',
],
[
'name' => 'settings',
],
];
}

/**
* Retrieves a list of models based on the current search/filter conditions.
*
Expand Down
32 changes: 32 additions & 0 deletions application/views/admin/super/_help_menu.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@

<li class="dropdown larger-dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<span class="fa fa-question-circle" ></span>
<?php eT('Help');?>
<span class="caret"></span>
</a>
<ul class="dropdown-menu larger-dropdown" id="help-dropdown">
<?php $this->renderPartial( "/admin/super/_tutorial_menu", []); ?>
<li>
<a href="http://manual.limesurvey.org/" target="_blank">
<span class="fa fa-question-circle" ></span>
<?php eT('LimeSurvey Manual');?>
<i class="fa fa-external-link pull-right"></i>
</a>
</li>
<li>
<a href="https://bugs.limesurvey.org/" target="_blank">
<span class="fa fa-bug" ></span>
<?php eT('Report bugs');?>
<i class="fa fa-external-link pull-right"></i>
</a>
</li>
<li>
<a href="https://limesurvey.org/" target="_blank">
<span class="fa fa-star" ></span>
<?php eT('LimeSurvey Homepage');?>
<i class="fa fa-external-link pull-right"></i>
</a>
</li>
</ul>
</li>
24 changes: 21 additions & 3 deletions application/views/admin/super/_tutorial_menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,38 @@
$aTutorials = Tutorial::model()->getActiveTutorials();
?>
<?php if(!empty($aTutorials) && Permission::model()->hasGlobalPermission('surveys', 'create')) { ?>
<li class="dropdown">
<li class="dropdown dropdown-submenu">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<span class="fa fa-rocket" ></span>
<?php eT('Tutorials');?>
<span class="caret"></span>
<i class="fa fa-chevron-right pull-right"></i>
</a>
<ul class="dropdown-menu " id="tutorials-dropdown">
<ul class="dropdown-menu larger-dropdown" id="tutorials-dropdown">
<?php foreach($aTutorials as $oTutorial) { ?>
<li>
<a href="#" onclick="window.tourLibrary.triggerTourStart('<?=$oTutorial->name?>')">
<i class="fa <?=$oTutorial->icon?>"></i>&nbsp;<?=$oTutorial->title?>
</a>
</li>
<?php } ?>
<?php if(!empty($aTutorials) && Permission::model()->hasGlobalPermission('superadmin', 'read')) { ?>
<li class="divider"></li>
<li>
<a href="<?=App()->createUrl('admin/tutorials/sa/view')?>">
<span class="fa fa-rocket" ></span>
<?php eT('See all Tutorial');?>
<i class="fa fa-search pull-right"></i>
</a>
</li>
<li>
<a href="<?=App()->createUrl('admin/tutorials/sa/create')?>">
<span class="fa fa-rocket" ></span>
<?php eT('Create Tutorial');?>
<i class="fa fa-plus pull-right"></i>
</a>
</li>
<?php } ?>
</ul>
</li>
<?php } ?>

4 changes: 2 additions & 2 deletions application/views/admin/super/adminmenu.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@
<div class="collapse navbar-collapse js-navbar-collapse pull-right">
<ul class="nav navbar-nav navbar-right">

<!-- Tutorial menu -->
<?php $this->renderPartial( "/admin/super/_tutorial_menu", []); ?>
<!-- Help menu -->
<?php $this->renderPartial( "/admin/super/_help_menu", []); ?>

<!-- Configuration menu -->
<?php $this->renderPartial( "/admin/super/_configuration_menu", $dataForConfigMenu ); ?>
Expand Down
20 changes: 0 additions & 20 deletions application/views/admin/tutorialEntry/index.php

This file was deleted.

54 changes: 54 additions & 0 deletions application/views/admin/tutorialentries/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?php
$pageSize=Yii::app()->user->getState('pageSize',Yii::app()->params['defaultPageSize']);

// DO NOT REMOVE This is for automated testing to validate we see that page
echo viewHelper::getViewTestTag('tutorialentries');

?>
<div class="container-fluid ls-space padding left-50 right-50">
<div class="ls-flex-column ls-space padding left-35 right-35">
<div class="col-12 h1 pagetitle">
<?php eT('Tutorialentries')?>
</div>
<div class="col-12">
<a class="btn btn-primary pull-right col-xs-6 col-sm-3 col-md-2" id="createnewtutorialentry" >
<i class="fa fa-plus"></i>&nbsp;<?php eT('New') ?>
</a>
<?php if(Permission::model()->hasGlobalPermission('superadmin','read')):?>
<a class="btn btn-danger pull-right ls-space margin right-10 col-xs-6 col-sm-3 col-md-2" href="#restoremodal" data-toggle="modal">
<i class="fa fa-refresh"></i>&nbsp;
<?php eT('Reset') ?>
</a>
<?php endif; ?>
</div>
<div class="col-12 ls-space margin top-15">
<div class="col-12 ls-flex-item">
<?php $this->widget('bootstrap.widgets.TbGridView', array(
'dataProvider' => $model->search(),
// Number of row per page selection
'id' => 'tutorial-grid',
'columns' => $model->getColumns(),
'filter' => $model,
'emptyText'=>gT('No customizable entries found.'),
'summaryText'=>gT('Displaying {start}-{end} of {count} result(s).').' '. sprintf(gT('%s rows per page'),
CHtml::dropDownList(
'pageSize',
$pageSize,
Yii::app()->params['pageSizeOptions'],
array('class'=>'changePageSize form-control', 'style'=>'display: inline; width: auto')
)
),
'rowHtmlOptionsExpression' => '["data-tutorialentry-id" => $data->teid]',
'htmlOptions' => array('class'=> 'table-responsive'),
'itemsCssClass' => 'table table-responsive table-striped',
'htmlOptions'=>array('style'=>'cursor: pointer;', 'class'=>'hoverAction grid-view'),
'ajaxType' => 'POST',
'ajaxUpdate' => true,
'template' => "{items}\n<div id='tokenListPager'><div class=\"col-sm-4\" id=\"massive-action-container\"></div><div class=\"col-sm-4 pager-container ls-ba \">{pager}</div><div class=\"col-sm-4 summary-container\">{summary}</div></div>",
'afterAjaxUpdate'=>'bindAction',
));
?>
</div>
</div>
</div>
</div>

0 comments on commit 2121dae

Please sign in to comment.