mirror of
https://github.com/flarum/core.git
synced 2025-08-07 00:47:00 +02:00
Set up responsive admin layout
This commit is contained in:
43
framework/core/ember/common/app/components/application/back-button.js
Executable file
43
framework/core/ember/common/app/components/application/back-button.js
Executable file
@@ -0,0 +1,43 @@
|
||||
import Ember from 'ember';
|
||||
|
||||
/**
|
||||
The back/pin button group in the top-left corner of Flarum's interface.
|
||||
*/
|
||||
export default Ember.Component.extend({
|
||||
classNames: ['back-button'],
|
||||
classNameBindings: ['active', 'className'],
|
||||
|
||||
active: Ember.computed.or('target.paneIsShowing', 'target.paneIsPinned'),
|
||||
|
||||
mouseEnter: function() {
|
||||
var target = this.get('target');
|
||||
if (target) {
|
||||
target.send('showPane');
|
||||
}
|
||||
},
|
||||
|
||||
mouseLeave: function() {
|
||||
var target = this.get('target');
|
||||
if (target) {
|
||||
target.send('hidePane');
|
||||
}
|
||||
},
|
||||
|
||||
actions: {
|
||||
// WE HAVE TO GO BACK. WAAAAAALLLLLLTTTTT
|
||||
back: function() {
|
||||
this.sendAction('goBack');
|
||||
},
|
||||
|
||||
togglePinned: function() {
|
||||
var target = this.get('target');
|
||||
if (target) {
|
||||
target.send('togglePinned');
|
||||
}
|
||||
},
|
||||
|
||||
toggleDrawer: function() {
|
||||
this.sendAction('toggleDrawer');
|
||||
}
|
||||
}
|
||||
});
|
17
framework/core/ember/common/app/controllers/alerts.js
Normal file
17
framework/core/ember/common/app/controllers/alerts.js
Normal file
@@ -0,0 +1,17 @@
|
||||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Controller.extend({
|
||||
alerts: [],
|
||||
|
||||
actions: {
|
||||
alert: function(message) {
|
||||
this.get('alerts').pushObject(message);
|
||||
},
|
||||
dismissAlert: function(message) {
|
||||
this.get('alerts').removeObject(message.constructor);
|
||||
},
|
||||
clearAlerts: function() {
|
||||
this.get('alerts').clear();
|
||||
}
|
||||
}
|
||||
});
|
@@ -3,7 +3,6 @@ export default {
|
||||
initialize: function(container, application) {
|
||||
application.inject('adapter', 'alerts', 'controller:alerts')
|
||||
application.inject('component', 'alerts', 'controller:alerts')
|
||||
application.inject('component', 'composer', 'controller:composer')
|
||||
application.inject('model', 'session', 'simple-auth-session:main')
|
||||
application.inject('component', 'session', 'simple-auth-session:main')
|
||||
application.inject('component', 'store', 'store:main')
|
||||
|
7
framework/core/ember/common/app/templates/alerts.hbs
Normal file
7
framework/core/ember/common/app/templates/alerts.hbs
Normal file
@@ -0,0 +1,7 @@
|
||||
<div class="alerts">
|
||||
{{#each alert in alerts}}
|
||||
<div class="alert-wrapper">
|
||||
{{view alert dismiss="dismissAlert"}}
|
||||
</div>
|
||||
{{/each}}
|
||||
</div>
|
@@ -0,0 +1,10 @@
|
||||
{{#if canGoBack}}
|
||||
<div class="btn-group">
|
||||
<button class="btn btn-default btn-icon back" {{action "back"}}>{{fa-icon "chevron-left" class="icon-glyph"}}</button>
|
||||
{{#if target.paned}}
|
||||
<button {{bind-attr class=":btn :btn-default :btn-icon :pin target.panePinned:active"}} {{action "togglePinned"}}>{{fa-icon "thumb-tack" class="icon-glyph"}}</button>
|
||||
{{/if}}
|
||||
</div>
|
||||
{{else if toggleDrawer}}
|
||||
<button class="btn btn-default btn-icon drawer-toggle" {{action "toggleDrawer"}}>{{fa-icon "reorder" class="icon-glyph"}}</button>
|
||||
{{/if}}
|
@@ -0,0 +1,5 @@
|
||||
<a href="#" {{bind-attr class=":dropdown-toggle buttonClass"}} data-toggle="dropdown" {{action "buttonClick"}}>
|
||||
{{user-avatar user}}
|
||||
<span class="label">{{label}}</span>
|
||||
</a>
|
||||
{{ui/item-list items=items class=dropdownMenuClass}}
|
Reference in New Issue
Block a user