Skip to content

Commit

Permalink
gulp scss added
Browse files Browse the repository at this point in the history
  • Loading branch information
jpirih committed Dec 11, 2016
1 parent 18dada5 commit c4f757e
Show file tree
Hide file tree
Showing 20 changed files with 570 additions and 322 deletions.
491 changes: 281 additions & 210 deletions .idea/workspace.xml

Large diffs are not rendered by default.

6 changes: 1 addition & 5 deletions app/Http/Controllers/AuthController.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,11 @@ public function getRegisterPage()
{
return view('auth.register');
}

// login page
public function getLoginPage()
{
return view('auth.login');
}

// save new user data to database -> default user role is User
public function postRegistration(RegisterUserRequest $request)
{
Expand All @@ -45,7 +43,7 @@ public function postLogin(Request $request)
{
if(Auth::attempt(['email' => $request::get('email'), 'password' => $request::get('password')]))
{
return redirect()->route('blog')->with('status', 'Prijavljeni ste kost '. Auth::user()->nickname);
return redirect()->route('blog')->with('status', 'Prijavljeni ste kot '. Auth::user()->nickname);
}
return redirect()->back()->with('status', 'Prišlo je do napke poskusite ponovno');
}
Expand All @@ -56,6 +54,4 @@ public function getLogout()
Auth::logout();
return redirect()->route('blog')->with('status', 'Uspešno ste se odjavili');
}


}
35 changes: 30 additions & 5 deletions app/Http/Controllers/DashboardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,45 @@

namespace App\Http\Controllers;

use App\Role;
use App\User;
use App\Category;
use App\Comment;
use App\Post;

use Carbon\Carbon;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Request;

class DashboardController extends Controller
{
// dasboard index - user managemnt
// admin dashboard index
public function dashboard()
{
return view('admin.dashboard');
$recentPosts = Post::all()->sortByDesc('date_published')->take(3);

$recentComments = Comment::all()->sortByDesc('created_at')->take(3);


$data = [
'recentPosts' => $recentPosts,
'recentComments' => $recentComments
];

return view('admin.dashboard', $data);
}


// admin blog management page
public function blogAdmin()
{
$categories = Category::all();
$posts = Post::all();

foreach ($posts as $post)
{
$post->date_published = Carbon::createFromTimestamp(strtotime($post->date_published));
}

$data = ['categories' => $categories, 'posts' => $posts];

return view('admin.blog', $data);
}
}
19 changes: 0 additions & 19 deletions app/Http/Controllers/PostController.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,7 @@ public function index()
}

$newPosts = Post::orderBy('created_at', 'desc')->take(3)->get();


return view('pages.posts', ['posts' => $posts, 'newPosts' => $newPosts]);

}
// write new post
public function create(){
Expand Down Expand Up @@ -106,7 +103,6 @@ public function update(StorePostRequest $request, $id){
$title = $request->get('title');
$content = $request->get('content');
$categories = $request->get('categories');

// deletes all categories and adds new ones
$post->categories()->detach();
if($categories != null){
Expand All @@ -119,24 +115,9 @@ public function update(StorePostRequest $request, $id){
$post->title = $title;
$post->body = $content;
$post->save();

return redirect(route('posts.show', ['id' => $id]))->with('status', 'Objava: '. $post->title. ' je bila spremenjena');
}

// pregled vseh objav - tabela
public function allPosts(){
Carbon::setLocale('sl');
$posts = Post::all();

foreach ($posts as $post)
{
$date = strtotime($post->date_published);
$post->date_published = date('d.M.Y', $date);
}

$categories = Category::all();
return view('pages.posts_dashboard', ['posts' => $posts, 'categories' => $categories]);
}

// funkcija za dodajanje novih kategorij - na dashbordu
public function saveCategory(StoreCategoryRequest $request){
Expand Down
9 changes: 0 additions & 9 deletions app/Http/Controllers/UsersController.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
<?php

namespace App\Http\Controllers;



use App\Post;
use App\Role;
use App\User;
Expand Down Expand Up @@ -54,19 +51,13 @@ public function userProfile($userId)
{
$currentUser = Auth::user();
$currentUserRole = $currentUser->roles()->first()->name;
$normalUser = 'User';
$admin = 'Admin';


if(($currentUser->id == $userId) || ($currentUserRole == $admin))
{
$posts = Post::where('user_id', $userId)->get();
$user = User::find($userId);

return view('pages.user_profile', ['posts' => $posts, 'user' => $user]);
}


return redirect()->route('login')->with('status', 'Za ogled te strani je potrebna prijava.');
}
}
9 changes: 2 additions & 7 deletions app/Http/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

// public routes
Route::group(['middleware' => 'web'], function () {

Route::get('/','SiteController@index')->name('index');
Route::get('posts', 'PostController@index')->name('blog');
Route::get('about', 'SiteController@about')->name('about');
Expand All @@ -23,16 +22,12 @@
Route::post('register', 'AuthController@postRegistration')->name('user.register');
Route::post('login', 'AuthController@postLogin')->name('user.login');
Route::get('logout', 'AuthController@getLogout')->name('user.logout');



});
});
// blog functions for registered users
Route::group(['middleware' =>['web', "roles"], "roles" => ['Admin', 'Moderator', 'User']], function (){
Route::get('posts/create', ['uses' => 'PostController@create', 'as' => 'posts.create']);
Route::post('posts', ['uses' => 'PostController@store', 'as' => 'posts.store']);
Route::get('posts/{id}', ['uses' => 'PostController@show', 'as' => 'posts.show']);
Route::get('zbirnik-objav', ['uses' => 'PostController@allPosts', 'as' => 'dashboard']);
Route::post('create-category', ['uses' => 'PostController@saveCategory', 'as' => 'crete_category']);
Route::post('posts/{id}/comment', ['uses' => 'CommentController@store', 'as' => 'comments.store']);
Route::get('posts/{id}/edit', ['uses' => 'PostController@edit', 'as' => 'posts.edit']);
Expand All @@ -44,7 +39,7 @@
Route::get('dashboard', 'DashboardController@dashboard')->name('admin-dashboard');
Route::get('users', 'UsersController@index')->name('admin-users');
Route::post('assign-roles', 'UsersController@assignUserRoles')->name('assign.roles');

Route::get('blog', 'DashboardController@blogAdmin')->name('admin-blog');
});


Expand Down
6 changes: 5 additions & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,9 @@ var elixir = require('laravel-elixir');
*/

elixir(function(mix) {
mix.sass('app.scss');
mix.sass('app.scss', 'public/assets/css');
});

elixir(function (mix) {
mix.script();
});
1 change: 1 addition & 0 deletions npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 37 additions & 0 deletions public/assets/css/app.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions public/assets/css/app.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 44 additions & 0 deletions public/css/app.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions public/css/app.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 0 additions & 33 deletions public/css/theme.css

This file was deleted.

67 changes: 67 additions & 0 deletions resources/assets/sass/app.scss
Original file line number Diff line number Diff line change
@@ -1,2 +1,69 @@
// @import "node_modules/bootstrap-sass/assets/stylesheets/bootstrap";

$infoColor: #e6ffff;
$profileColor: #337ab7;
$adminColor: #33CC33;
$headerTextColor: #ffffff;
$commentColor: #ccff99;

// border radius
@mixin border-radius($radius) {
-moz-border-radius: $radius;
-webkit-border-radius: $radius;
border-radius: $radius;
}

// box defalut class
.box {
border: 1px solid lightgray;
margin: 10px;
padding: 15px;
@include border-radius(5px)
}

.header{
@extend .krepko;
color: $headerTextColor;
}
// bold text class
.krepko{
font-weight: bold;
}

.index-img{
width: 100%;
height: 240px;
}

.post{
background-color: lightyellow;
}
.posts{
background-color: lightgoldenrodyellow;
border: 2px solid black;
}
.glava {
background: $profileColor;
@extend .header;

}
.info-box{
@extend .box;
color: $headerTextColor;
background: $infoColor;
@extend .krepko
}

.table-header{
@extend .header;
background: $adminColor;

}
.comment-box{
@extend .box;
background: $commentColor;
}

.default-box{
@extend .box
}
Loading

0 comments on commit c4f757e

Please sign in to comment.