Skip to content

Commit

Permalink
Fix ACP alerts to use same system as client (NodeBB#6396)
Browse files Browse the repository at this point in the history
* Fix PostCSS warning message

* Fix disconnect indicator styling

Would increase size of quick actions when active

* Use same alert system in ACP and client

- Remove snackbar
- Add styling and fix template for ACP (based on Persona)
  • Loading branch information
pitaj authored and julianlam committed Mar 26, 2018
1 parent dae6acd commit dcf1865
Show file tree
Hide file tree
Showing 9 changed files with 91 additions and 124 deletions.
1 change: 0 additions & 1 deletion public/less/admin/admin.less
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@

@import "./modules/alerts";
@import "./modules/selectable";
@import "./modules/snackbar";
@import "./modules/nprogress";
@import "./modules/search";

Expand Down
6 changes: 1 addition & 5 deletions public/less/admin/header.less
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
}

.fa {
margin-top: 12px;
line-height: 44px;
font-size: 25px;
}

Expand Down Expand Up @@ -112,8 +112,4 @@
}
}
}

.reconnect-spinner {
line-height: 44px;
}
}
112 changes: 86 additions & 26 deletions public/less/admin/modules/alerts.less
Original file line number Diff line number Diff line change
@@ -1,35 +1,95 @@
.alert-window {
position:fixed;
width:300px;
z-index:10;
.toaster-alert {
.pointer;
}
position: fixed;
width: 300px;
z-index: 10002;

right: 20px;
bottom: 0px;

.alert {
img {
float:left;
padding-right:10px;
.close {
color: inherit;
}
}
}

.alert-left-top {
left:20px;
top:70px;
}
&::before {
position: relative;
top: -15px;
left: -15px;
display: block;
height: 2px;
width: 0;
transition: inherit;
}

.alert-left-bottom {
left:20px;
bottom:20px;
}
&.alert-info::before {
background-color: @brand-info;
}

.alert-right-top {
right:20px;
top:70px;
}
&.alert-warning::before {
background-color: @brand-warning;
}

&.alert-success::before {
background-color: @brand-success;
}

.alert-right-bottom {
right:20px;
bottom:20px;
&.alert-danger::before {
background-color: @brand-danger;
}

&.animate {
&.alert-info::before {
background-color: lighten(@brand-info, 25%);
}

&.alert-warning::before {
background-color: lighten(@brand-warning, 25%);
}

&.alert-success::before {
background-color: lighten(@brand-success, 25%);
}

&.alert-danger::before {
background-color: lighten(@brand-danger, 25%);
}

&::before {
width: ~"calc(100% + 50px)";
}
}

background-color: white;
border: 0;
border-left: 5px solid !important;
box-shadow: 0px 2px 5px 0px rgba(0, 0, 0, 0.25), 0px 2px 10px 0px rgba(0, 0, 0, 0.25);

strong {
text-transform: uppercase;
}

p {
padding: 10px 0px 0px;
}

&.alert-info {
color: @brand-info;
border-color: @brand-info;
}

&.alert-warning {
color: @brand-warning;
border-color: @brand-warning;
}

&.alert-success {
color: @brand-success;
border-color: @brand-success;
}

&.alert-danger {
color: @brand-danger;
border-color: @brand-danger;
}
}
}
65 changes: 0 additions & 65 deletions public/less/admin/modules/snackbar.less

This file was deleted.

19 changes: 0 additions & 19 deletions public/src/admin/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
}

$('[component="logout"]').on('click', app.logout);
app.alert = launchSnackbar;

configureSlidemenu();
setupNProgress();
Expand Down Expand Up @@ -141,24 +140,6 @@
});
}

function launchSnackbar(params) {
var message = (params.title ? '<strong>' + params.title + '</strong>' : '') + (params.message ? params.message : '');

require(['translator'], function (translator) {
translator.translate(message, function (html) {
var bar = $.snackbar({
content: html,
timeout: params.timeout || 3000,
htmlAllowed: true,
});

if (params.clickfn) {
bar.on('click', params.clickfn);
}
});
});
}

function configureSlidemenu() {
var env = utils.findBootstrapEnvironment();

Expand Down
2 changes: 0 additions & 2 deletions public/vendor/snackbar/snackbar.min.js

This file was deleted.

1 change: 0 additions & 1 deletion src/meta/js.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ JS.scripts = {
'public/vendor/semver/semver.browser.js',
'public/vendor/jquery/serializeObject/jquery.ba-serializeobject.min.js',
'public/vendor/jquery/deserialize/jquery.deserialize.min.js',
'public/vendor/snackbar/snackbar.min.js',
'public/vendor/slideout/slideout.min.js',
'public/vendor/nprogress.min.js',
],
Expand Down
4 changes: 3 additions & 1 deletion src/meta/minifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,9 @@ function buildCSS(data, callback) {
clean({
processImportFrom: ['local'],
}),
] : [autoprefixer]).process(lessOutput.css).then(function (result) {
] : [autoprefixer]).process(lessOutput.css, {
from: undefined,
}).then(function (result) {
process.nextTick(callback, null, { code: result.css });
}, function (err) {
process.nextTick(callback, err);
Expand Down
5 changes: 1 addition & 4 deletions src/views/admin/footer.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
</div>


<div class="alert-window alert-left-top"></div>
<div class="alert-window alert-left-bottom"></div>
<div class="alert-window alert-right-top"></div>
<div class="alert-window alert-right-bottom"></div>
<div class="alert-window" component="toaster/tray"></div>

<div id="footer" class="container" style="padding-top: 50px; display:none;">
<footer class="footer">Copyright &copy; 2015 <a target="_blank" href="https://nodebb.org">NodeBB</a> by <a target="_blank" href="https://github.com/psychobunny">psychobunny</a>, <a href="https://github.com/julianlam" target="_blank">julianlam</a>, <a href="https://github.com/barisusakli" target="_blank">barisusakli</a> from <a target="_blank" href="http://www.designcreateplay.com">designcreateplay</a></footer>
Expand Down

0 comments on commit dcf1865

Please sign in to comment.