Skip to content

Commit

Permalink
added basic site pages
Browse files Browse the repository at this point in the history
  • Loading branch information
hiqsol committed Apr 10, 2016
1 parent 52d05bd commit 065c211
Show file tree
Hide file tree
Showing 12 changed files with 180 additions and 150 deletions.
18 changes: 18 additions & 0 deletions src/_bootstrap.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

if (!defined('HISITE_VENDOR_DIR')) {
foreach ([dirname(__DIR__) . '/vendor', dirname(dirname(dirname(__DIR__)))] as $dir) {
if (file_exists($dir . '/autoload.php')) {
define('HISITE_VENDOR_DIR', $dir);
break;
}
}

if (!defined('HISITE_VENDOR_DIR')) {
fwrite(STDERR, "Run composer to set up dependencies!\n");
exit(1);
}

require HISITE_VENDOR_DIR . '/autoload.php';
require HISITE_VENDOR_DIR . '/yiisoft/yii2/Yii.php';
}
3 changes: 1 addition & 2 deletions src/assets/AppAsset.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@

class AppAsset extends AssetBundle
{
public $basePath = '@webroot';
public $baseUrl = '@web';
public $sourcePath = '@hiqdev/assetpackagist/assets';
public $css = [
'css/site.css',
];
Expand Down
91 changes: 91 additions & 0 deletions src/assets/css/site.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
html,
body {
height: 100%;
}

.wrap {
min-height: 100%;
height: auto;
margin: 0 auto -60px;
padding: 0 0 60px;
}

.wrap > .container {
padding: 70px 15px 20px;
}

.footer {
height: 60px;
background-color: #f5f5f5;
border-top: 1px solid #ddd;
padding-top: 20px;
}

.jumbotron {
text-align: center;
background-color: transparent;
}

.jumbotron .btn {
font-size: 21px;
padding: 14px 24px;
}

.not-set {
color: #c55;
font-style: italic;
}

/* add sorting icons to gridview sort links */
a.asc:after, a.desc:after {
position: relative;
top: 1px;
display: inline-block;
font-family: 'Glyphicons Halflings';
font-style: normal;
font-weight: normal;
line-height: 1;
padding-left: 5px;
}

a.asc:after {
content: /*"\e113"*/ "\e151";
}

a.desc:after {
content: /*"\e114"*/ "\e152";
}

.sort-numerical a.asc:after {
content: "\e153";
}

.sort-numerical a.desc:after {
content: "\e154";
}

.sort-ordinal a.asc:after {
content: "\e155";
}

.sort-ordinal a.desc:after {
content: "\e156";
}

.grid-view th {
white-space: nowrap;
}

.hint-block {
display: block;
margin-top: 5px;
color: #999;
}

.error-summary {
color: #a94442;
background: #fdf7f7;
border-left: 3px solid #eed3d7;
padding: 10px 20px;
margin: 0 0 15px 0;
}
11 changes: 4 additions & 7 deletions src/config/common.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
'runtimePath' => dirname(dirname(__DIR__)) . '/runtime',
'controllerNamespace' => 'hiqdev\assetpackagist\controllers',
'bootstrap' => ['log'],
'aliases' => [
'@bower' => '@vendor/bower-asset',
'@npm' => '@vendor/npm-asset',
],
'components' => [
'log' => [
'traceLevel' => YII_DEBUG ? 3 : 0,
Expand All @@ -26,13 +30,6 @@
],
],
],
'urlManager' => [
'enablePrettyUrl' => true,
'rules' => [
'packages.json' => 'packages/packages',
'p/provider-latest.json' => 'packages/provider',
],
],
'request' => [
'cookieValidationKey' => '345sdfsadf',
],
Expand Down
1 change: 1 addition & 0 deletions src/config/params.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@
*/

return [
'logo-text' => 'Asset Packagist',
];
9 changes: 7 additions & 2 deletions src/config/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,18 @@
* @copyright Copyright (c) 2016, HiQDev (http://hiqdev.com/)
*/

$config = __DIR__ . '/common.php';
$config = require(__DIR__ . '/common.php');

$config['components']['urlManager'] = [
'enablePrettyUrl' => true,
'showScriptName' => false,
];

if (YII_DEBUG) {
$config['bootstrap']['debug'] = 'debug';
$config['modules']['debug'] = [
'class' => 'yii\debug\Module',
'allowedIPs' => ['*'],
'allowedIPs' => ['94.244.188.156'],
];
}

Expand Down
10 changes: 10 additions & 0 deletions src/controllers/SiteController.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,14 @@ public function actionIndex()
{
return $this->render('index');
}

public function actionAbout()
{
return $this->render('about');
}

public function actionContact()
{
return $this->render('contact');
}
}
13 changes: 6 additions & 7 deletions src/views/layouts/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<div class="wrap">
<?php
NavBar::begin([
'brandLabel' => 'My Company',
'brandLabel' => Yii::$app->params['logo-text'],
'brandUrl' => Yii::$app->homeUrl,
'options' => [
'class' => 'navbar-inverse navbar-fixed-top',
Expand All @@ -36,10 +36,9 @@
echo Nav::widget([
'options' => ['class' => 'navbar-nav navbar-right'],
'items' => [
['label' => 'Home', 'url' => ['/site/index']],
['label' => 'About', 'url' => ['/site/about']],
['label' => 'Contact', 'url' => ['/site/contact']],
['label' => 'Login', 'url' => ['/site/login']],
['label' => 'About', 'url' => ['/site/about']],
['label' => 'Contact', 'url' => ['/site/contact']],
['label' => 'GitHub', 'url' => 'https://github.com/hiqdev/asset-packagist.hiqdev.com'],
],
]);
NavBar::end();
Expand All @@ -55,9 +54,9 @@

<footer class="footer">
<div class="container">
<p class="pull-left">&copy; My Company <?= date('Y') ?></p>
<p class="pull-left">&copy; <a href="http://hiqdev.com/">HiQDev</a>, <?= date('Y') ?></p>

<p class="pull-right"><?= Yii::powered() ?></p>
<p class="pull-right">Not even doubt, <?= lcfirst(Yii::powered()) ?></p>
</div>
</footer>

Expand Down
4 changes: 1 addition & 3 deletions src/views/site/about.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
<h1><?= Html::encode($this->title) ?></h1>

<p>
This is the About page. You may modify the following file to customize its content:
Here is going to be more information on how it works.
</p>

<code><?= __FILE__ ?></code>
</div>
60 changes: 7 additions & 53 deletions src/views/site/contact.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
/* @var $form yii\bootstrap\ActiveForm */
/* @var $model app\models\ContactForm */

use yii\bootstrap\ActiveForm;
use yii\captcha\Captcha;
use yii\helpers\Html;

$this->title = 'Contact';
Expand All @@ -14,55 +12,11 @@
<div class="site-contact">
<h1><?= Html::encode($this->title) ?></h1>

<?php if (Yii::$app->session->hasFlash('contactFormSubmitted')): ?>

<div class="alert alert-success">
Thank you for contacting us. We will respond to you as soon as possible.
</div>

<p>
Note that if you turn on the Yii debugger, you should be able
to view the mail message on the mail panel of the debugger.
<?php if (Yii::$app->mailer->useFileTransport): ?>
Because the application is in development mode, the email is not sent but saved as
a file under <code><?= Yii::getAlias(Yii::$app->mailer->fileTransportPath) ?></code>.
Please configure the <code>useFileTransport</code> property of the <code>mail</code>
application component to be false to enable email sending.
<?php endif; ?>
</p>

<?php else: ?>

<p>
If you have business inquiries or other questions, please fill out the following form to contact us.
Thank you.
</p>

<div class="row">
<div class="col-lg-5">

<?php $form = ActiveForm::begin(['id' => 'contact-form']); ?>

<?= $form->field($model, 'name')->textInput(['autofocus' => true]) ?>

<?= $form->field($model, 'email') ?>

<?= $form->field($model, 'subject') ?>

<?= $form->field($model, 'body')->textArea(['rows' => 6]) ?>

<?= $form->field($model, 'verifyCode')->widget(Captcha::className(), [
'template' => '<div class="row"><div class="col-lg-3">{image}</div><div class="col-lg-6">{input}</div></div>',
]) ?>

<div class="form-group">
<?= Html::submitButton('Submit', ['class' => 'btn btn-primary', 'name' => 'contact-button']) ?>
</div>

<?php ActiveForm::end(); ?>

</div>
</div>

<?php endif; ?>
<p>
You can contact us in several ways:
<ul>
<li><a href="https://github.com/hiqdev/asset-packagist.hiqdev.com/issues">GitHub issues</a> - this is the preferred way, you can contribute too</li>
<li>my email: <a href="mailto:sol@hiqdev.com">sol@hiqdev.com</a></li>
</ul>
</p>
</div>
63 changes: 34 additions & 29 deletions src/views/site/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,50 +2,55 @@

/* @var $this yii\web\View */

$this->title = 'My Yii Application';
$this->title = Yii::$app->params['logo-text'];
?>
<div class="site-index">

<div class="jumbotron">
<h1>Congratulations!</h1>

<p class="lead">You have successfully created your Yii-powered application.</p>

<p><a class="btn btn-lg btn-success" href="http://www.yiiframework.com">Get started with Yii</a></p>
<img src="https://getcomposer.org/img/logo-composer-transparent2.png" height="140px">
<img src="http://bower.io/img/bower-logo.svg" height="100px" style="margin:10px">
<img src="https://www.npmjs.com/static/images/npm-logo.svg" height="80px" style="margin:10px">
<h3>Composer, Bower and NPM friends forever!</h3>
</div>

<div class="body-content">

<div class="row">
<div class="col-lg-4">
<h2>Heading</h2>
<h2>What?</h2>

<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et
dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip
ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
fugiat nulla pariatur.</p>
<p>This repository allows installation of Bower and NPM packages with Composer.</p>
<p>It's like a server-side <code><a href="https://github.com/francoispluchino/composer-asset-plugin">fxp/composer-asset-plugin</a></code>.</p>
<p>But <b>NO</b> plugin and <b>NO</b> Node.js required.</p>
</p>

<p><a class="btn btn-default" href="http://www.yiiframework.com/doc/">Yii Documentation &raquo;</a></p>
<p><a class="btn btn-default" href="/site/about">More info &raquo;</a></p>
</div>
<div class="col-lg-4">
<h2>Heading</h2>

<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et
dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip
ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
fugiat nulla pariatur.</p>

<p><a class="btn btn-default" href="http://www.yiiframework.com/forum/">Yii Forum &raquo;</a></p>
<h2>How?</h2>

<p>List required packages like this:</p>
<pre><code>"require": {
"bower-asset/bootstrap": "^3.3",
"npm-asset/jquery": "^2.2"
}</code></pre>

<p>And add these lines:</p>
<pre><code>"repositories": [
{
"type": "composer",
"url": "https://asset-packagist.hiqdev.com"
}
]</code></pre>
</div>
<div class="col-lg-4">
<h2>Heading</h2>

<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et
dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip
ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
fugiat nulla pariatur.</p>

<p><a class="btn btn-default" href="http://www.yiiframework.com/extensions/">Yii Extensions &raquo;</a></p>
<h2>Why?</h2>

<p>Got tired of <code><a href="https://github.com/francoispluchino/composer-asset-plugin">fxp/composer-asset-plugin</a></code>.
It's a cool thing anyway - good idea and decent realization.
But it slows down composer and requires global installation which makes a lot of different probllems (Travis and Scrutinizer integration were most annoying for me).
</p>
<p>This repository solves all these problems.</p>
<p><a class="btn btn-default" href="/site/contact">More questions? &raquo;</a></p>
</div>
</div>

Expand Down

0 comments on commit 065c211

Please sign in to comment.