From 3bc8290ab838ea039b7a297d58d8d55ebc7bbe63 Mon Sep 17 00:00:00 2001 From: devfake <devfakeplus@googlemail.com> Date: Mon, 22 Jun 2015 11:57:22 +0200 Subject: [PATCH] rewrite structure --- site/client/app/app.js | 4 +-- site/client/app/components/inner.js | 19 +++++++++++ site/client/app/components/landing.js | 26 +++++++++++++++ site/client/app/components/lobby.js | 11 ------- site/client/app/components/modals/login.js | 5 --- site/client/app/components/navigation.js | 4 +-- site/client/app/views/inner.html | 15 +++++++++ site/client/app/views/landing.html | 29 +++++++++++++++++ site/client/app/views/lobby.html | 12 +------ site/client/app/views/modals/login.html | 17 ---------- site/client/assets/sass/_inner.scss | 6 +--- site/client/views/app.blade.php | 23 +++----------- site/client/views/inner.blade.php | 17 ---------- site/client/views/landing.blade.php | 37 ---------------------- site/server/app/Http/routes.php | 11 ++----- 15 files changed, 103 insertions(+), 133 deletions(-) create mode 100644 site/client/app/components/inner.js create mode 100644 site/client/app/components/landing.js delete mode 100644 site/client/app/components/modals/login.js create mode 100644 site/client/app/views/inner.html create mode 100644 site/client/app/views/landing.html delete mode 100644 site/client/app/views/modals/login.html delete mode 100644 site/client/views/inner.blade.php delete mode 100644 site/client/views/landing.blade.php diff --git a/site/client/app/app.js b/site/client/app/app.js index b8618c9..b049be2 100644 --- a/site/client/app/app.js +++ b/site/client/app/app.js @@ -15,8 +15,8 @@ var app = new Vue({ }, components: { - lobby: require('./components/lobby'), - chat: require('./components/chat') + inner: require('./components/inner'), + landing: require('./components/landing') } }); diff --git a/site/client/app/components/inner.js b/site/client/app/components/inner.js new file mode 100644 index 0000000..deea695 --- /dev/null +++ b/site/client/app/components/inner.js @@ -0,0 +1,19 @@ +module.exports = { + + template: require('../views/inner.html'), + + data: function() { + return { + modal: false + } + }, + + components: { + searchmatch: require('./modals/searchMatch'), + navigation: require('./navigation'), + chat: require('./chat'), + + lobby: require('./lobby') + } + +}; \ No newline at end of file diff --git a/site/client/app/components/landing.js b/site/client/app/components/landing.js new file mode 100644 index 0000000..339f7aa --- /dev/null +++ b/site/client/app/components/landing.js @@ -0,0 +1,26 @@ +var router = require('./../routes'); + +module.exports = { + + template: require('../views/landing.html'), + + inherit: true, + + ready: function() { + setTimeout(function() { + $('.container-form-landing').addClass('active') + }, 300); + }, + + methods: { + asGuest: function() { + // set localstorage for guest + $('.icon-guest-load').show(); + + setTimeout(function() { + window.location.href = './lobby'; + }, 500); + } + } + +}; \ No newline at end of file diff --git a/site/client/app/components/lobby.js b/site/client/app/components/lobby.js index 3a7edea..1e87a1d 100644 --- a/site/client/app/components/lobby.js +++ b/site/client/app/components/lobby.js @@ -2,15 +2,4 @@ module.exports = { template: require('../views/lobby.html'), - data: function() { - return { - modal: false - } - }, - - components: { - searchmatch: require('./modals/searchMatch'), - navigation: require('./navigation') - } - }; \ No newline at end of file diff --git a/site/client/app/components/modals/login.js b/site/client/app/components/modals/login.js deleted file mode 100644 index f8456c1..0000000 --- a/site/client/app/components/modals/login.js +++ /dev/null @@ -1,5 +0,0 @@ -module.exports = { - - template: require('../../views/modals/login.html') - -}; \ No newline at end of file diff --git a/site/client/app/components/navigation.js b/site/client/app/components/navigation.js index ffcece6..9a0a48d 100644 --- a/site/client/app/components/navigation.js +++ b/site/client/app/components/navigation.js @@ -12,8 +12,8 @@ module.exports = { }, searchMatch: function() { - this.modal = true; - // trigger match functions + this.modal = true; + // trigger match functions } } diff --git a/site/client/app/views/inner.html b/site/client/app/views/inner.html new file mode 100644 index 0000000..e319baa --- /dev/null +++ b/site/client/app/views/inner.html @@ -0,0 +1,15 @@ +<searchmatch></searchmatch> + +<a href="./lobby"><img src="assets/img/logo-medium.png" width="120" height="38" alt="Gwent" class="logo-medium"></a> + +<main> + + <navigation></navigation> + + <section class="container-content"> + <component is="lobby"></component> + </section> + +</main> + + <component is="chat"></component> \ No newline at end of file diff --git a/site/client/app/views/landing.html b/site/client/app/views/landing.html new file mode 100644 index 0000000..c495841 --- /dev/null +++ b/site/client/app/views/landing.html @@ -0,0 +1,29 @@ +<section class="container-landing"> + <div class="wrap-landing"> + <img src="assets/img/logo-big.png" width="243" height="85" alt="Gwent" class="logo-big"> + + <p class="teaser-landing"> + Play The Witcher Gwent Card-Game online!<br> + Play with randomly generated teams, or build your own! + </p> + + <div class="container-form-landing"> + + <form class="form-session"> + <input type="text" placeholder="Username" class="field-session" autofocus> + <input type="password" placeholder="Password" class="field-session"> + + <div class="wrap-btn-action btn-register-action"> + <input type="submit" value="Register" class="btn-action"> + <i class="icon-action-load"></i> + </div> + </form> + + <span class="choose">or</span> + + <a class="btn-second btn-guest" v-on="click: asGuest">Play as guest <i class="icon-guest-load"></i></a> + <a href="#" class="btn-none btn-login">Login</a> + + </div> + </div> +</section> \ No newline at end of file diff --git a/site/client/app/views/lobby.html b/site/client/app/views/lobby.html index d1047df..90c8d3c 100644 --- a/site/client/app/views/lobby.html +++ b/site/client/app/views/lobby.html @@ -1,11 +1 @@ -<a href="./lobby"><img src="assets/img/logo-medium.png" width="120" height="38" alt="Gwent" class="logo-medium"></a> - -<main> - - <navigation></navigation> - - <section class="container-content"> - <searchmatch></searchmatch> - </section> - -</main> \ No newline at end of file +lobby \ No newline at end of file diff --git a/site/client/app/views/modals/login.html b/site/client/app/views/modals/login.html deleted file mode 100644 index 4f6fa29..0000000 --- a/site/client/app/views/modals/login.html +++ /dev/null @@ -1,17 +0,0 @@ -<div class="modal" v-class="active: modal"> - <div class="modal-banner"> - <div class="wrap-modal"> - - <form class="form-session form-login"> - <input type="text" placeholder="Username" class="field-session"> - <input type="password" placeholder="Password" class="field-session"> - - <div class="wrap-btn-action btn-login-action"> - <input type="submit" value="Login" class="btn-action"> - <i class="icon-load"></i> - </div> - </form> - - </div> - </div> -</div> \ No newline at end of file diff --git a/site/client/assets/sass/_inner.scss b/site/client/assets/sass/_inner.scss index 566a2d4..cb35627 100644 --- a/site/client/assets/sass/_inner.scss +++ b/site/client/assets/sass/_inner.scss @@ -1,17 +1,13 @@ body.inner { background: url(../img/inner-bg.jpg) #162232 center top no-repeat; background-size: cover; + padding: 40px; } .logo-medium { float: left; } -.container-inner { - width: 100%; - padding: 40px; -} - main { float: left; clear: both; diff --git a/site/client/views/app.blade.php b/site/client/views/app.blade.php index b7c9479..3f3b84c 100644 --- a/site/client/views/app.blade.php +++ b/site/client/views/app.blade.php @@ -14,27 +14,14 @@ </head> <body class="{{ $section }}"> - @yield('content') + @if(Auth::check() || Request::path() != '/') + <component is="inner"></component> + @else + <component is="landing"></component> + @endif <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script> <script src="{{ url('assets/js/bundle.js') }}"></script> - <script> - // todo: extract to vue - setTimeout(function() { - $('.container-form-landing').addClass('active') - }, 300); - - // todo: extract to vue - $('.btn-guest').on('click', function() { - // set localstorage for guest - $('.icon-guest-load').show(); - - setTimeout(function() { - window.location.href = './lobby'; - }, 500); - }); - </script> - </body> </html> \ No newline at end of file diff --git a/site/client/views/inner.blade.php b/site/client/views/inner.blade.php deleted file mode 100644 index 5e37bf9..0000000 --- a/site/client/views/inner.blade.php +++ /dev/null @@ -1,17 +0,0 @@ -@extends('app') - -@section('content') - - <section class="container-inner"> - - @if($type == 'server') - <component is="lobby" v-transition transition-mode="out-in"></component> - @else - <component is="@{{ view }}" v-transition transition-mode="out-in"></component> - @endif - - <component is="chat"></component> - - </section> - -@stop \ No newline at end of file diff --git a/site/client/views/landing.blade.php b/site/client/views/landing.blade.php deleted file mode 100644 index 2988c4d..0000000 --- a/site/client/views/landing.blade.php +++ /dev/null @@ -1,37 +0,0 @@ -@extends('app') - -@section('content') - - <login></login> - - <section class="container-landing"> - <div class="wrap-landing"> - <img src="assets/img/logo-big.png" width="243" height="85" alt="Gwent" class="logo-big"> - - <p class="teaser-landing"> - Play The Witcher Gwent Card-Game online!<br> - Play with randomly generated teams, or build your own! - </p> - - <div class="container-form-landing"> - - <form class="form-session"> - <input type="text" placeholder="Username" class="field-session" autofocus> - <input type="password" placeholder="Password" class="field-session"> - - <div class="wrap-btn-action btn-register-action"> - <input type="submit" value="Register" class="btn-action"> - <i class="icon-action-load"></i> - </div> - </form> - - <span class="choose">or</span> - - <a class="btn-second btn-guest">Play as guest <i class="icon-guest-load"></i></a> - <a href="#" class="btn-none btn-login" v-on="click: modal = true">Login</a> - - </div> - </div> - </section> - -@stop \ No newline at end of file diff --git a/site/server/app/Http/routes.php b/site/server/app/Http/routes.php index 0e1ab5e..4d1e212 100755 --- a/site/server/app/Http/routes.php +++ b/site/server/app/Http/routes.php @@ -1,16 +1,11 @@ <?php get('/lobby', function() { - return view('inner') - ->withSection('inner') - ->withType('server'); + return view('app') + ->withSection('inner'); }); get('/', function() { - if(Auth::check()) { - return redirect('/lobby'); - } - - return view('landing') + return view('app') ->withSection('landing'); }); \ No newline at end of file