mirror of
https://github.com/flarum/core.git
synced 2025-08-12 11:24:30 +02:00
Hello world!
This commit is contained in:
0
ember/app/components/.gitkeep
Normal file
0
ember/app/components/.gitkeep
Normal file
18
ember/app/components/button-item.js
Normal file
18
ember/app/components/button-item.js
Normal file
@@ -0,0 +1,18 @@
|
||||
import Ember from 'ember';
|
||||
|
||||
export default Ember.View.extend({
|
||||
title: '',
|
||||
icon: '',
|
||||
class: '',
|
||||
action: null,
|
||||
|
||||
tagName: 'a',
|
||||
classNames: ['btn'],
|
||||
classNameBindings: ['class', 'disabled'],
|
||||
|
||||
layout: Ember.Handlebars.compile('{{#if view.icon}}{{fa-icon view.icon class="fa-fw"}} {{/if}}<span>{{view.title}}</span>'),
|
||||
|
||||
click: function() {
|
||||
this.action();
|
||||
}
|
||||
});
|
6
ember/app/components/item-collection.js
Normal file
6
ember/app/components/item-collection.js
Normal file
@@ -0,0 +1,6 @@
|
||||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Component.extend({
|
||||
tagName: 'ul',
|
||||
layoutName: 'components/item-collection',
|
||||
});
|
13
ember/app/components/loading-indicator.js
Normal file
13
ember/app/components/loading-indicator.js
Normal file
@@ -0,0 +1,13 @@
|
||||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Component.extend({
|
||||
|
||||
classNames: ['loading'],
|
||||
|
||||
layout: Ember.Handlebars.compile(' '),
|
||||
|
||||
didInsertElement: function() {
|
||||
this.$().spin(this.get('size'));
|
||||
}
|
||||
|
||||
});
|
5
ember/app/components/menu-item-separator.js
Normal file
5
ember/app/components/menu-item-separator.js
Normal file
@@ -0,0 +1,5 @@
|
||||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Component.extend({
|
||||
liClass: 'divider'
|
||||
});
|
31
ember/app/components/menu-item.js
Normal file
31
ember/app/components/menu-item.js
Normal file
@@ -0,0 +1,31 @@
|
||||
import Ember from 'ember';
|
||||
|
||||
var MenuItem = Ember.Component.extend({
|
||||
title: '',
|
||||
icon: '',
|
||||
className: '',
|
||||
action: null,
|
||||
divider: false,
|
||||
|
||||
tagName: 'a',
|
||||
attributeBindings: ['href'],
|
||||
classNameBindings: ['className'],
|
||||
href: '#',
|
||||
layout: Ember.Handlebars.compile('{{#if icon}}{{fa-icon icon class="fa-fw"}} {{/if}}<span>{{title}}</span>'),
|
||||
|
||||
click: function(e) {
|
||||
e.preventDefault();
|
||||
// this.sendAction('action');
|
||||
this.get('action')();
|
||||
}
|
||||
});
|
||||
|
||||
MenuItem.reopenClass({
|
||||
separator: function() {
|
||||
return this.create({
|
||||
divider: true
|
||||
});
|
||||
}
|
||||
})
|
||||
|
||||
export default MenuItem;
|
6
ember/app/components/menu-list.js
Normal file
6
ember/app/components/menu-list.js
Normal file
@@ -0,0 +1,6 @@
|
||||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Component.extend({
|
||||
tagName: 'ul',
|
||||
layoutName: 'components/menu-list',
|
||||
});
|
15
ember/app/components/menu-split.js
Normal file
15
ember/app/components/menu-split.js
Normal file
@@ -0,0 +1,15 @@
|
||||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Component.extend({
|
||||
items: null, // NamedContainerView/Menu
|
||||
layoutName: 'components/menu-split',
|
||||
show: 1,
|
||||
|
||||
visibleItems: function() {
|
||||
return this.get('items').slice(0, this.get('show'));
|
||||
}.property('items'),
|
||||
|
||||
hiddenItems: function() {
|
||||
return this.get('items').slice(this.get('show'));
|
||||
}.property('items'),
|
||||
});
|
34
ember/app/components/nav-item.js
Normal file
34
ember/app/components/nav-item.js
Normal file
@@ -0,0 +1,34 @@
|
||||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Component.extend({
|
||||
icon: '',
|
||||
title: '',
|
||||
action: null,
|
||||
badge: '',
|
||||
badgeAction: null,
|
||||
// active: false,
|
||||
|
||||
tagName: 'li',
|
||||
classNameBindings: ['active'],
|
||||
active: function() {
|
||||
return this.get('childViews').anyBy('active');
|
||||
}.property('childViews.@each.active'),
|
||||
|
||||
layout: function() {
|
||||
return Ember.Handlebars.compile('<a href="#" class="count" {{action "badge"}}>{{badge}}</a>\
|
||||
{{#link-to '+this.get('linkTo')+'}}'+this.get('iconTemplate')+'{{title}}{{/link-to}}');
|
||||
}.property('linkTo', 'iconTemplate'),
|
||||
|
||||
iconTemplate: function() {
|
||||
return '{{fa-icon icon}}';
|
||||
}.property(),
|
||||
|
||||
actions: {
|
||||
main: function() {
|
||||
this.get('action')();
|
||||
},
|
||||
badge: function() {
|
||||
this.get('badgeAction')();
|
||||
}
|
||||
}
|
||||
});
|
9
ember/app/components/notification-message.js
Executable file
9
ember/app/components/notification-message.js
Executable file
@@ -0,0 +1,9 @@
|
||||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Component.extend({
|
||||
|
||||
close: function() {
|
||||
this.sendAction('closeAction');
|
||||
}
|
||||
|
||||
});
|
38
ember/app/components/search-input.js
Normal file
38
ember/app/components/search-input.js
Normal file
@@ -0,0 +1,38 @@
|
||||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Component.extend({
|
||||
classNames: ['search-input'],
|
||||
classNameBindings: ['active', 'value:clearable'],
|
||||
|
||||
didInsertElement: function() {
|
||||
var self = this;
|
||||
this.$().find('input').on('keydown', function(e) {
|
||||
if (e.which == 27) {
|
||||
self.clear();
|
||||
}
|
||||
});
|
||||
this.$().find('.clear').on('mousedown', function(e) {
|
||||
e.preventDefault();
|
||||
}).on('click', function(e) {
|
||||
e.preventDefault();
|
||||
self.clear();
|
||||
})
|
||||
},
|
||||
|
||||
clear: function() {
|
||||
this.set('value', '');
|
||||
this.sendAction('action', '');
|
||||
this.$().find('input').focus();
|
||||
},
|
||||
|
||||
willDestroyElement: function() {
|
||||
this.$().find('input').off('keydown');
|
||||
this.$().find('.clear').off('mousedown click');
|
||||
},
|
||||
|
||||
actions: {
|
||||
search: function() {
|
||||
this.sendAction('action', this.get('value'));
|
||||
}
|
||||
}
|
||||
});
|
9
ember/app/components/select-input.js
Normal file
9
ember/app/components/select-input.js
Normal file
@@ -0,0 +1,9 @@
|
||||
import Ember from 'ember';
|
||||
|
||||
export default Ember.View.extend({
|
||||
|
||||
tagName: 'span',
|
||||
classNames: ['select'],
|
||||
layout: Ember.Handlebars.compile('{{view Ember.Select content=view.content optionValuePath=view.optionValuePath optionLabelPath=view.optionLabelPath value=view.value}} {{fa-icon "sort"}}')
|
||||
|
||||
});
|
Reference in New Issue
Block a user