Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Design update 2017 #480

Merged
merged 9 commits into from
Aug 26, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion app/Http/Controllers/Auth/RegisterController.php
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,6 @@ public function resendConfirmation(Request $request)
return redirect('/register/confirm');
}

$this->emailConfirmationService->sendConfirmation($user);
session()->flash('success', trans('auth.email_confirm_resent'));
return redirect('/register/confirm');
}
Expand Down
17 changes: 14 additions & 3 deletions app/Http/Controllers/BookController.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,17 @@ public function __construct(EntityRepo $entityRepo, UserRepo $userRepo, ExportSe
*/
public function index()
{
$books = $this->entityRepo->getAllPaginated('book', 10);
$books = $this->entityRepo->getAllPaginated('book', 20);
$recents = $this->signedIn ? $this->entityRepo->getRecentlyViewed('book', 4, 0) : false;
$popular = $this->entityRepo->getPopular('book', 4, 0);
$new = $this->entityRepo->getRecentlyCreated('book', 4, 0);
$this->setPageTitle('Books');
return view('books/index', ['books' => $books, 'recents' => $recents, 'popular' => $popular]);
return view('books/index', [
'books' => $books,
'recents' => $recents,
'popular' => $popular,
'new' => $new
]);
}

/**
Expand Down Expand Up @@ -84,7 +90,12 @@ public function show($slug)
$bookChildren = $this->entityRepo->getBookChildren($book);
Views::add($book);
$this->setPageTitle($book->getShortName());
return view('books/show', ['book' => $book, 'current' => $book, 'bookChildren' => $bookChildren]);
return view('books/show', [
'book' => $book,
'current' => $book,
'bookChildren' => $bookChildren,
'activity' => Activity::entityActivity($book, 20, 0)
]);
}

/**
Expand Down
6 changes: 2 additions & 4 deletions app/Http/Controllers/HomeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,11 @@ public function index()
$activity = Activity::latest(10);
$draftPages = $this->signedIn ? $this->entityRepo->getUserDraftPages(6) : [];
$recentFactor = count($draftPages) > 0 ? 0.5 : 1;
$recents = $this->signedIn ? Views::getUserRecentlyViewed(12*$recentFactor, 0) : $this->entityRepo->getRecentlyCreated('book', 10*$recentFactor);
$recentlyCreatedPages = $this->entityRepo->getRecentlyCreated('page', 5);
$recentlyUpdatedPages = $this->entityRepo->getRecentlyUpdated('page', 5);
$recents = $this->signedIn ? Views::getUserRecentlyViewed(12*$recentFactor, 0) : $this->entityRepo->getRecentlyCreated('book', 12*$recentFactor);
$recentlyUpdatedPages = $this->entityRepo->getRecentlyUpdated('page', 12);
return view('home', [
'activity' => $activity,
'recents' => $recents,
'recentlyCreatedPages' => $recentlyCreatedPages,
'recentlyUpdatedPages' => $recentlyUpdatedPages,
'draftPages' => $draftPages
]);
Expand Down
2 changes: 2 additions & 0 deletions app/Http/Controllers/PageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@ public function showRevision($bookSlug, $pageSlug, $revisionId)
return view('pages/revision', [
'page' => $page,
'book' => $page->book,
'revision' => $revision
]);
}

Expand Down Expand Up @@ -409,6 +410,7 @@ public function showRevisionChanges($bookSlug, $pageSlug, $revisionId)
'page' => $page,
'book' => $page->book,
'diff' => $diff,
'revision' => $revision
]);
}

Expand Down
12 changes: 12 additions & 0 deletions app/PageRevision.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,16 @@ public function getPrevious()
return null;
}

/**
* Allows checking of the exact class, Used to check entity type.
* Included here to align with entities in similar use cases.
* (Yup, Bit of an awkward hack)
* @param $type
* @return bool
*/
public static function isA($type)
{
return $type === 'revision';
}

}
2 changes: 1 addition & 1 deletion app/Services/SearchService.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public function searchEntities($searchString, $entityType = 'all', $page = 1, $c
return [
'total' => $total,
'count' => count($results),
'results' => $results->sortByDesc('score')
'results' => $results->sortByDesc('score')->values()
];
}

Expand Down
8 changes: 7 additions & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,20 @@
const argv = require('yargs').argv;
const gulp = require('gulp'),
plumber = require('gulp-plumber');

const autoprefixer = require('gulp-autoprefixer');
const uglify = require('gulp-uglify');
const minifycss = require('gulp-clean-css');
const sass = require('gulp-sass');
const sourcemaps = require('gulp-sourcemaps');

const browserify = require("browserify");
const source = require('vinyl-source-stream');
const buffer = require('vinyl-buffer');
const babelify = require("babelify");
const watchify = require("watchify");
const envify = require("envify");
const uglify = require('gulp-uglify');

const gutil = require("gulp-util");
const liveReload = require('gulp-livereload');

Expand All @@ -21,6 +25,7 @@ let isProduction = argv.production || process.env.NODE_ENV === 'production';

gulp.task('styles', () => {
let chain = gulp.src(['resources/assets/sass/**/*.scss'])
.pipe(sourcemaps.init())
.pipe(plumber({
errorHandler: function (error) {
console.log(error.message);
Expand All @@ -29,6 +34,7 @@ gulp.task('styles', () => {
.pipe(sass())
.pipe(autoprefixer('last 2 versions'));
if (isProduction) chain = chain.pipe(minifycss());
chain = chain.pipe(sourcemaps.write());
return chain.pipe(gulp.dest('public/css/')).pipe(liveReload());
});

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"clipboard": "^1.7.1",
"codemirror": "^5.26.0",
"dropzone": "^4.0.1",
"gulp-sourcemaps": "^2.6.1",
"gulp-util": "^3.0.8",
"markdown-it": "^8.3.1",
"markdown-it-task-lists": "^2.0.0",
Expand Down
16 changes: 8 additions & 8 deletions resources/assets/js/pages/page-show.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,25 +106,25 @@ let setupPageShow = window.setupPageShow = function (pageId) {
goToText(event.target.getAttribute('href').substr(1));
});

// Make the book-tree sidebar stick in view on scroll
// Make the sidebar stick in view on scroll
let $window = $(window);
let $bookTree = $(".book-tree");
let $bookTreeParent = $bookTree.parent();
let $sidebar = $("#sidebar .scroll-body");
let $bookTreeParent = $sidebar.parent();
// Check the page is scrollable and the content is taller than the tree
let pageScrollable = ($(document).height() > $window.height()) && ($bookTree.height() < $('.page-content').height());
let pageScrollable = ($(document).height() > $window.height()) && ($sidebar.height() < $('.page-content').height());
// Get current tree's width and header height
let headerHeight = $("#header").height() + $(".toolbar").height();
let isFixed = $window.scrollTop() > headerHeight;
// Function to fix the tree as a sidebar
function stickTree() {
$bookTree.width($bookTreeParent.width() + 15);
$bookTree.addClass("fixed");
$sidebar.width($bookTreeParent.width() + 15);
$sidebar.addClass("fixed");
isFixed = true;
}
// Function to un-fix the tree back into position
function unstickTree() {
$bookTree.css('width', 'auto');
$bookTree.removeClass("fixed");
$sidebar.css('width', 'auto');
$sidebar.removeClass("fixed");
isFixed = false;
}
// Checks if the tree stickiness state should change
Expand Down
41 changes: 41 additions & 0 deletions resources/assets/sass/_blocks.scss
Original file line number Diff line number Diff line change
Expand Up @@ -180,4 +180,45 @@
&.warning:before {
content: '\f1f1';
}
}

.card {
margin: $-m;
background-color: #FFF;
box-shadow: 0 0 1px 0 rgba(0, 0, 0, 0.2);
h3 {
padding: $-m;
border-bottom: 1px solid #E8E8E8;
margin: 0;
font-size: $fs-s;
color: #888;
font-weight: 400;
text-transform: uppercase;
}
.body, p.empty-text {
padding: $-m;
}
}

.well {
background-color: #F8F8F8;
padding: $-m;
border: 1px solid #DDD;
}

#sidebar .scroll-body {
&.fixed {
z-index: 5;
position: fixed;
top: 0;
padding-right: $-m;
width: 30%;
left: 0;
height: 100%;
overflow-y: scroll;
-ms-overflow-style: none;
//background-color: $primary-faded;
border-left: 1px solid #DDD;
&::-webkit-scrollbar { width: 0 !important }
}
}
47 changes: 42 additions & 5 deletions resources/assets/sass/_buttons.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@
@mixin generate-button-colors($textColor, $backgroundColor) {
background-color: $backgroundColor;
color: $textColor;
text-transform: uppercase;
border: 1px solid $backgroundColor;
vertical-align: top;
&:hover {
background-color: lighten($backgroundColor, 8%);
box-shadow: $bs-med;
//box-shadow: $bs-med;
text-decoration: none;
color: $textColor;
}
Expand All @@ -26,16 +29,16 @@ $button-border-radius: 2px;
text-decoration: none;
font-size: $fs-m;
line-height: 1.4em;
padding: $-xs $-m;
padding: $-xs*1.3 $-m;
margin: $-xs $-xs $-xs 0;
display: inline-block;
border: none;
font-weight: 500;
font-weight: 400;
outline: 0;
border-radius: $button-border-radius;
cursor: pointer;
transition: all ease-in-out 120ms;
box-shadow: 0 0.5px 1.5px 0 rgba(0, 0, 0, 0.21);
box-shadow: 0;
@include generate-button-colors(#EEE, $primary);
}

Expand All @@ -51,13 +54,47 @@ $button-border-radius: 2px;
@include generate-button-colors(#EEE, $secondary);
}
&.muted {
@include generate-button-colors(#EEE, #888);
@include generate-button-colors(#EEE, #AAA);
}
&.muted-light {
@include generate-button-colors(#666, #e4e4e4);
}
}

.button.outline {
background-color: transparent;
color: #888;
border: 1px solid #DDD;
&:hover, &:focus, &:active {
box-shadow: none;
background-color: #EEE;
}
&.page {
border-color: $color-page;
color: $color-page;
&:hover, &:focus, &:active {
background-color: $color-page;
color: #FFF;
}
}
&.chapter {
border-color: $color-chapter;
color: $color-chapter;
&:hover, &:focus, &:active {
background-color: $color-chapter;
color: #FFF;
}
}
&.book {
border-color: $color-book;
color: $color-book;
&:hover, &:focus, &:active {
background-color: $color-book;
color: #FFF;
}
}
}

.text-button {
@extend .link;
background-color: transparent;
Expand Down
6 changes: 3 additions & 3 deletions resources/assets/sass/_codemirror.scss
Original file line number Diff line number Diff line change
Expand Up @@ -366,9 +366,9 @@ span.CodeMirror-selectedtext { background: none; }
.cm-s-base16-light span.cm-atom { color: #aa759f; }
.cm-s-base16-light span.cm-number { color: #aa759f; }

.cm-s-base16-light span.cm-property, .cm-s-base16-light span.cm-attribute { color: #90a959; }
.cm-s-base16-light span.cm-property, .cm-s-base16-light span.cm-attribute { color: #678c30; }
.cm-s-base16-light span.cm-keyword { color: #ac4142; }
.cm-s-base16-light span.cm-string { color: #f4bf75; }
.cm-s-base16-light span.cm-string { color: #e09c3c; }

.cm-s-base16-light span.cm-variable { color: #90a959; }
.cm-s-base16-light span.cm-variable-2 { color: #6a9fb5; }
Expand All @@ -392,7 +392,7 @@ span.CodeMirror-selectedtext { background: none; }
}
.cm-s-base16-light .CodeMirror-gutters { background: #f5f5f5; border-right: 1px solid #DDD; }

.flex-fill .CodeMirror {
.code-fill .CodeMirror {
position: absolute;
top: 0;
bottom: 0;
Expand Down
Loading