Dan Brown

Made header more responsive and added nicer settings switches

1 +
2 +<template>
3 + <div class="toggle-switch" v-on="click: switch" v-class="active: isActive">
4 + <input type="hidden" v-attr="name: name, value: value"/>
5 + <div class="switch-handle"></div>
6 + </div>
7 +</template>
8 +
9 +
10 +<script>
11 + module.exports = {
12 + props: ['name', 'value'],
13 + data: function() {
14 + return {
15 + isActive: this.value == true && this.value != 'false'
16 + }
17 + },
18 + ready: function() {
19 + this.value = (this.value == true && this.value != 'false') ? 'true' : 'false';
20 + },
21 + methods: {
22 + switch: function() {
23 + this.isActive = !this.isActive;
24 + this.value = this.isActive ? 'true' : 'false';
25 + }
26 + }
27 + }
28 +</script>
...\ No newline at end of file ...\ No newline at end of file
...@@ -40,6 +40,7 @@ Vue.use(require('vue-resource')); ...@@ -40,6 +40,7 @@ Vue.use(require('vue-resource'));
40 // Vue Components 40 // Vue Components
41 Vue.component('image-manager', require('./components/image-manager.vue')); 41 Vue.component('image-manager', require('./components/image-manager.vue'));
42 Vue.component('image-picker', require('./components/image-picker.vue')); 42 Vue.component('image-picker', require('./components/image-picker.vue'));
43 +Vue.component('toggle-switch', require('./components/toggle-switch.vue'));
43 44
44 // Vue Controllers 45 // Vue Controllers
45 if(elemExists('#book-dashboard')) { 46 if(elemExists('#book-dashboard')) {
......
...@@ -47,6 +47,39 @@ input[type="text"], input[type="number"], input[type="email"], input[type="searc ...@@ -47,6 +47,39 @@ input[type="text"], input[type="number"], input[type="email"], input[type="searc
47 @extend .input-base; 47 @extend .input-base;
48 } 48 }
49 49
50 +.toggle-switch {
51 + display: inline-block;
52 + background-color: #BBB;
53 + width: 36px;
54 + height: 14px;
55 + border-radius: 7px;
56 + position: relative;
57 + transition: all ease-in-out 120ms;
58 + cursor: pointer;
59 + user-select: none;
60 + .switch-handle {
61 + display: block;
62 + position: relative;
63 + left: 0;
64 + margin-top: -3px;
65 + width: 20px;
66 + height: 20px;
67 + border-radius: 50%;
68 + background-color: #fafafa;
69 + border: 1px solid #CCC;
70 + box-shadow: 0 2px 2px 0 rgba(0,0,0,.14),0 3px 1px -2px rgba(0,0,0,.2),0 1px 5px 0 rgba(0,0,0,.12);
71 + transition: all ease-in-out 120ms;
72 + }
73 + &.active {
74 + background-color: rgba($positive, 0.4);
75 + .switch-handle {
76 + left: 16px;
77 + background-color: $positive;
78 + border: darken($positive, 20%);
79 + }
80 + }
81 +}
82 +
50 .form-group { 83 .form-group {
51 margin-bottom: $-s; 84 margin-bottom: $-s;
52 } 85 }
......
...@@ -242,7 +242,7 @@ div[class^="col-"] img { ...@@ -242,7 +242,7 @@ div[class^="col-"] img {
242 .col-xs-offset-0 { 242 .col-xs-offset-0 {
243 margin-left: 0%; 243 margin-left: 0%;
244 } 244 }
245 -@media (min-width: 768px) { 245 +@media (min-width: $screen-sm) {
246 .col-sm-1, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-sm-10, .col-sm-11, .col-sm-12 { 246 .col-sm-1, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-sm-10, .col-sm-11, .col-sm-12 {
247 float: left; 247 float: left;
248 } 248 }
...@@ -400,7 +400,7 @@ div[class^="col-"] img { ...@@ -400,7 +400,7 @@ div[class^="col-"] img {
400 margin-left: 0%; 400 margin-left: 0%;
401 } 401 }
402 } 402 }
403 -@media (min-width: 992px) { 403 +@media (min-width: $screen-md) {
404 .col-md-1, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-7, .col-md-8, .col-md-9, .col-md-10, .col-md-11, .col-md-12 { 404 .col-md-1, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-7, .col-md-8, .col-md-9, .col-md-10, .col-md-11, .col-md-12 {
405 float: left; 405 float: left;
406 } 406 }
...@@ -558,7 +558,7 @@ div[class^="col-"] img { ...@@ -558,7 +558,7 @@ div[class^="col-"] img {
558 margin-left: 0%; 558 margin-left: 0%;
559 } 559 }
560 } 560 }
561 -@media (min-width: 1200px) { 561 +@media (min-width: $screen-lg) {
562 .col-lg-1, .col-lg-2, .col-lg-3, .col-lg-4, .col-lg-5, .col-lg-6, .col-lg-7, .col-lg-8, .col-lg-9, .col-lg-10, .col-lg-11, .col-lg-12 { 562 .col-lg-1, .col-lg-2, .col-lg-3, .col-lg-4, .col-lg-5, .col-lg-6, .col-lg-7, .col-lg-8, .col-lg-9, .col-lg-10, .col-lg-11, .col-lg-12 {
563 float: left; 563 float: left;
564 } 564 }
......
...@@ -17,6 +17,9 @@ header { ...@@ -17,6 +17,9 @@ header {
17 display: inline-block; 17 display: inline-block;
18 vertical-align: top; 18 vertical-align: top;
19 margin-right: $-xl; 19 margin-right: $-xl;
20 + @include smaller-than($screen-md) {
21 + margin-right: $-m;
22 + }
20 } 23 }
21 .links a { 24 .links a {
22 display: inline-block; 25 display: inline-block;
...@@ -25,23 +28,63 @@ header { ...@@ -25,23 +28,63 @@ header {
25 &:last-child { 28 &:last-child {
26 padding-right: 0; 29 padding-right: 0;
27 } 30 }
31 + @include smaller-than($screen-md) {
32 + padding: $-l $-s;
33 + }
28 } 34 }
29 .avatar, .user-name { 35 .avatar, .user-name {
30 display: inline-block; 36 display: inline-block;
31 } 37 }
32 .avatar { 38 .avatar {
33 - margin-top: (45px/2); 39 + //margin-top: (45px/2);
34 width: 30px; 40 width: 30px;
35 height: 30px; 41 height: 30px;
36 } 42 }
37 .user-name { 43 .user-name {
38 vertical-align: top; 44 vertical-align: top;
39 - padding-top: 25.5px; 45 + padding-top: $-l;
40 - padding-left: $-m;
41 display: inline-block; 46 display: inline-block;
42 cursor: pointer; 47 cursor: pointer;
43 - i { 48 + > * {
49 + vertical-align: top;
50 + }
51 + > span, > i {
52 + padding-left: $-xs;
53 + display: inline-block;
54 + }
55 + > span {
56 + padding-top: $-xxs;
57 + }
58 + > i {
59 + padding-top: $-xs*1.2;
60 + }
61 + @include smaller-than($screen-md) {
44 padding-left: $-xs; 62 padding-left: $-xs;
63 + .name {
64 + display: none;
65 + }
66 + i {
67 + font-size: 2em;
68 + padding-left: 0;
69 + padding-top: 0;
70 + }
71 + }
72 + }
73 + @include smaller-than($screen-md) {
74 + text-align: center;
75 + .float.right {
76 + float: none;
77 + }
78 + }
79 + @include smaller-than($screen-sm) {
80 + .links a {
81 + padding: $-s;
82 + }
83 + form.search-box {
84 + margin-top: 0;
85 + }
86 + .user-name {
87 + padding-top: $-s;
45 } 88 }
46 } 89 }
47 } 90 }
...@@ -117,6 +160,7 @@ form.search-box { ...@@ -117,6 +160,7 @@ form.search-box {
117 min-width: 180px; 160 min-width: 180px;
118 padding: $-xs 0; 161 padding: $-xs 0;
119 color: #555; 162 color: #555;
163 + text-align: left !important;
120 a { 164 a {
121 display: block; 165 display: block;
122 padding: $-xs $-m; 166 padding: $-xs $-m;
......
...@@ -12,8 +12,8 @@ $m: 800px; ...@@ -12,8 +12,8 @@ $m: 800px;
12 $s: 600px; 12 $s: 600px;
13 $xs: 400px; 13 $xs: 400px;
14 $xxs: 360px; 14 $xxs: 360px;
15 -$screen-md: 992px;
16 $screen-lg: 1200px; 15 $screen-lg: 1200px;
16 +$screen-md: 992px;
17 $screen-sm: 768px; 17 $screen-sm: 768px;
18 18
19 // Spacing (Margins+Padding) 19 // Spacing (Margins+Padding)
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
35 <header id="header"> 35 <header id="header">
36 <div class="container"> 36 <div class="container">
37 <div class="row"> 37 <div class="row">
38 - <div class="col-md-4 col-sm-3"> 38 + <div class="col-lg-4 col-sm-4">
39 <a href="/" class="logo"> 39 <a href="/" class="logo">
40 @if(Setting::get('app-logo', '') !== 'none') 40 @if(Setting::get('app-logo', '') !== 'none')
41 <img class="logo-image" src="{{ Setting::get('app-logo', '') === '' ? '/logo.png' : Setting::get('app-logo', '') }}" alt="Logo"> 41 <img class="logo-image" src="{{ Setting::get('app-logo', '') === '' ? '/logo.png' : Setting::get('app-logo', '') }}" alt="Logo">
...@@ -43,13 +43,13 @@ ...@@ -43,13 +43,13 @@
43 <span class="logo-text">{{ Setting::get('app-name', 'BookStack') }}</span> 43 <span class="logo-text">{{ Setting::get('app-name', 'BookStack') }}</span>
44 </a> 44 </a>
45 </div> 45 </div>
46 - <div class="col-md-4 col-sm-3 text-center"> 46 + <div class="col-lg-4 col-sm-3 text-center">
47 <form action="/search/all" method="GET" class="search-box"> 47 <form action="/search/all" method="GET" class="search-box">
48 <input type="text" name="term" tabindex="2" value="{{ isset($searchTerm) ? $searchTerm : '' }}"> 48 <input type="text" name="term" tabindex="2" value="{{ isset($searchTerm) ? $searchTerm : '' }}">
49 <button class="text-button"><i class="zmdi zmdi-search"></i></button> 49 <button class="text-button"><i class="zmdi zmdi-search"></i></button>
50 </form> 50 </form>
51 </div> 51 </div>
52 - <div class="col-md-4 col-sm-6"> 52 + <div class="col-lg-4 col-sm-5">
53 <div class="float right"> 53 <div class="float right">
54 <div class="links text-center"> 54 <div class="links text-center">
55 <a href="/books"><i class="zmdi zmdi-book"></i>Books</a> 55 <a href="/books"><i class="zmdi zmdi-book"></i>Books</a>
...@@ -61,10 +61,10 @@ ...@@ -61,10 +61,10 @@
61 @endif 61 @endif
62 </div> 62 </div>
63 @if($signedIn) 63 @if($signedIn)
64 - <img class="avatar" src="{{$currentUser->getAvatar(30)}}" alt="{{ $currentUser->name }}">
65 <div class="dropdown-container" data-dropdown> 64 <div class="dropdown-container" data-dropdown>
66 <span class="user-name" data-dropdown-toggle> 65 <span class="user-name" data-dropdown-toggle>
67 - {{ $currentUser->name }} <i class="zmdi zmdi-caret-down"></i> 66 + <img class="avatar" src="{{$currentUser->getAvatar(30)}}" alt="{{ $currentUser->name }}">
67 + <span class="name">{{ $currentUser->name }}</span> <i class="zmdi zmdi-caret-down"></i>
68 </span> 68 </span>
69 <ul> 69 <ul>
70 <li> 70 <li>
......
...@@ -20,9 +20,8 @@ ...@@ -20,9 +20,8 @@
20 <input type="text" value="{{ Setting::get('app-name', 'BookStack') }}" name="setting-app-name" id="setting-app-name"> 20 <input type="text" value="{{ Setting::get('app-name', 'BookStack') }}" name="setting-app-name" id="setting-app-name">
21 </div> 21 </div>
22 <div class="form-group"> 22 <div class="form-group">
23 - <label for="setting-app-public">Allow public viewing?</label> 23 + <label>Allow public viewing?</label>
24 - <label><input type="radio" name="setting-app-public" @if(Setting::get('app-public')) checked @endif value="true"> Yes</label> 24 + <toggle-switch name="setting-app-public" value="{{ Setting::get('app-public') }}"></toggle-switch>
25 - <label><input type="radio" name="setting-app-public" @if(!Setting::get('app-public')) checked @endif value="false"> No</label>
26 </div> 25 </div>
27 </div> 26 </div>
28 <div class="col-md-6"> 27 <div class="col-md-6">
...@@ -43,8 +42,7 @@ ...@@ -43,8 +42,7 @@
43 <div class="col-md-6"> 42 <div class="col-md-6">
44 <div class="form-group"> 43 <div class="form-group">
45 <label for="setting-registration-enabled">Allow registration?</label> 44 <label for="setting-registration-enabled">Allow registration?</label>
46 - <label><input type="radio" name="setting-registration-enabled" @if(Setting::get('registration-enabled')) checked @endif value="true"> Yes</label> 45 + <toggle-switch name="setting-registration-enabled" value="{{ Setting::get('registration-enabled') }}"></toggle-switch>
47 - <label><input type="radio" name="setting-registration-enabled" @if(!Setting::get('registration-enabled')) checked @endif value="false"> No</label>
48 </div> 46 </div>
49 <div class="form-group"> 47 <div class="form-group">
50 <label for="setting-registration-role">Default user role after registration</label> 48 <label for="setting-registration-role">Default user role after registration</label>
...@@ -61,8 +59,7 @@ ...@@ -61,8 +59,7 @@
61 <div class="form-group"> 59 <div class="form-group">
62 <label for="setting-registration-confirmation">Require Email Confirmation?</label> 60 <label for="setting-registration-confirmation">Require Email Confirmation?</label>
63 <p class="small">If domain restriction is used then email confirmation will be required and the below value will be ignored.</p> 61 <p class="small">If domain restriction is used then email confirmation will be required and the below value will be ignored.</p>
64 - <label><input type="radio" name="setting-registration-confirmation" @if(Setting::get('registration-confirmation')) checked @endif value="true"> Yes</label> 62 + <toggle-switch name="setting-registration-confirmation" value="{{ Setting::get('registration-confirmation') }}"></toggle-switch>
65 - <label><input type="radio" name="setting-registration-confirmation" @if(!Setting::get('registration-confirmation')) checked @endif value="false"> No</label>
66 </div> 63 </div>
67 </div> 64 </div>
68 <div class="col-md-6"> 65 <div class="col-md-6">
......