-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from lukaskavouras/master
New admin functionality for changing pages dynamically
- Loading branch information
Showing
16 changed files
with
483 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
ALTER TABLE system_configuration add column home_page integer, add column help_page integer; | ||
INSERT INTO system_configuration (admin_email,home_page,help_page) values (null,null,null); | ||
CREATE TABLE pages (id serial primary key, title text, content text); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<?php | ||
|
||
namespace app\models; | ||
|
||
use Yii; | ||
|
||
/** | ||
* This is the model class for table "pages". | ||
* | ||
* @property int $id | ||
* @property string $title | ||
* @property string $body | ||
*/ | ||
class Page extends \yii\db\ActiveRecord | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public static function tableName() | ||
{ | ||
return 'pages'; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function rules() | ||
{ | ||
return [ | ||
[['title', 'content'], 'string'], | ||
]; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function attributeLabels() | ||
{ | ||
return [ | ||
'id' => 'ID', | ||
'title' => 'Title', | ||
'content' => 'Content', | ||
]; | ||
} | ||
|
||
public static function getPagesDropdown() | ||
{ | ||
$pages=self::find()->all(); | ||
|
||
$result=[]; | ||
foreach ($pages as $page) | ||
{ | ||
$result[$page->id]=$page->title; | ||
} | ||
|
||
return $result; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
use yii\helpers\Html; | ||
use webvimark\modules\UserManagement\models\User; | ||
use yii\widgets\ActiveForm; | ||
|
||
$this->title='Add new page'; | ||
$this->registerJsFile('@web/js/administration/add-edit-page.js', ['depends' => [\yii\web\JqueryAsset::className()]] ); | ||
$back_icon='<i class="fas fa-arrow-left"></i>'; | ||
/* | ||
* Users are able to view the name, version, start date, end date, mountpoint | ||
* and running status of their previous software executions. | ||
*/ | ||
?> | ||
<div class='title row'> | ||
<div class="col-md-11"> | ||
<h1><?= Html::encode($this->title) ?></h1> | ||
</div> | ||
<div class="col-md-1 float-right"> | ||
<?= Html::a("$back_icon Back", ['/administration/manage-pages'], ['class'=>'btn btn-default']) ?> | ||
</div> | ||
</div> | ||
|
||
<?php $form = ActiveForm::begin($form_params); ?> | ||
|
||
<?= $form->field($model, 'title') ?> | ||
|
||
<?= $form->field($model, 'content')->textarea(['rows'=>30,'id'=>'content-area']) ?> | ||
|
||
|
||
<div class="row"> | ||
<div class="col-md-1"><?= Html::submitButton('<i class="fas fa-check"></i> Submit', ['class' => 'btn btn-primary']) ?></div> | ||
<div class="col-md-1"><?= Html::a('<i class="fas fa-times"></i> Cancel', ['/project/index'], ['class'=>'btn btn-default']) ?></div> | ||
<div class="col-md-1"><?= Html::a('<i class="fas fa-eye"></i> Preview', "javascript:void(0);", ['class'=>'btn btn-secondary preview-btn']) ?></div> | ||
|
||
</div> | ||
|
||
<?php ActiveForm::end(); ?> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
use yii\helpers\Html; | ||
use webvimark\modules\UserManagement\models\User; | ||
use yii\widgets\ActiveForm; | ||
|
||
$this->title="Edit page \"$page->title\""; | ||
$this->registerJsFile('@web/js/administration/add-edit-page.js', ['depends' => [\yii\web\JqueryAsset::className()]] ); | ||
$back_icon='<i class="fas fa-arrow-left"></i>'; | ||
/* | ||
* Users are able to view the name, version, start date, end date, mountpoint | ||
* and running status of their previous software executions. | ||
*/ | ||
?> | ||
<div class='title row'> | ||
<div class="col-md-11"> | ||
<h1><?= Html::encode($this->title) ?></h1> | ||
</div> | ||
<div class="col-md-1 float-right"> | ||
<?= Html::a("$back_icon Back", ['/administration/manage-pages'], ['class'=>'btn btn-default']) ?> | ||
</div> | ||
</div> | ||
|
||
<?php $form = ActiveForm::begin($form_params); ?> | ||
|
||
<?= $form->field($page, 'content')->textarea(['rows'=>30,'id'=>'content-area']) ?> | ||
|
||
|
||
<div class="row"> | ||
<div class="col-md-1"><?= Html::submitButton('<i class="fas fa-check"></i> Submit', ['class' => 'btn btn-primary']) ?></div> | ||
<div class="col-md-1"><?= Html::a('<i class="fas fa-times"></i> Cancel', ['/administration/index'], ['class'=>'btn btn-default']) ?></div> | ||
<div class="col-md-1"><?= Html::a('<i class="fas fa-eye"></i> Preview', "javascript:void(0);", ['class'=>'btn btn-secondary preview-btn']) ?></div> | ||
|
||
</div> | ||
|
||
<?php ActiveForm::end(); ?> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
use yii\helpers\Html; | ||
use app\components\Headers; | ||
|
||
echo Html::CssFile('@web/css/project/vm-details.css'); | ||
|
||
$this->title="Authorization error"; | ||
|
||
$back_icon='<i class="fas fa-arrow-left"></i>'; | ||
|
||
Headers::begin() ?> | ||
<?php echo Headers::widget( | ||
['title'=>"Page does not exist.", | ||
'buttons'=> | ||
[ | ||
['fontawesome_class'=>$back_icon,'name'=> 'Back', 'action'=> ['/administration/manage-pages'], 'type'=>'a', 'options'=>['class'=>'btn btn-default'] ], | ||
|
||
] | ||
]) | ||
?> | ||
<?Headers::end()?> | ||
|
||
|
||
|
||
<div class="row"> | ||
<div class="col-md-12"><h3>This page does not exist.</h3></div> | ||
</div> |
Oops, something went wrong.