-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a text-display widget which, when given a height, will truncate…
… the text. Also autopopulates and updates a bootstrap tooltip
- Loading branch information
Michael Malone
committed
Nov 30, 2015
1 parent
773b312
commit a21d35c
Showing
15 changed files
with
238 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<template> | ||
<div class="text-display" data-toggle="tooltip" >${text}</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
define(['exports', 'aurelia-templating', 'aurelia-binding', 'aurelia-dependency-injection', 'jquery'], function (exports, _aureliaTemplating, _aureliaBinding, _aureliaDependencyInjection, _jquery) { | ||
'use strict'; | ||
|
||
Object.defineProperty(exports, '__esModule', { | ||
value: true | ||
}); | ||
|
||
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); | ||
|
||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
|
||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } | ||
|
||
var _$ = _interopRequireDefault(_jquery); | ||
|
||
var TextDisplayWidget = (function () { | ||
function TextDisplayWidget(element) { | ||
_classCallCheck(this, _TextDisplayWidget); | ||
|
||
this.element = element; | ||
} | ||
|
||
_createClass(TextDisplayWidget, [{ | ||
key: 'bind', | ||
value: function bind() { | ||
(0, _$['default'])(this.element.querySelector('[data-toggle="tooltip"]')).attr('title', this.text).tooltip(); | ||
} | ||
}, { | ||
key: 'textChanged', | ||
value: function textChanged(newValue) { | ||
(0, _$['default'])(this.element.querySelector('[data-toggle="tooltip"]')).attr('title', newValue).tooltip('fixTitle'); | ||
} | ||
}]); | ||
|
||
var _TextDisplayWidget = TextDisplayWidget; | ||
TextDisplayWidget = (0, _aureliaDependencyInjection.inject)(Element)(TextDisplayWidget) || TextDisplayWidget; | ||
TextDisplayWidget = (0, _aureliaTemplating.bindable)({ | ||
name: 'placement', | ||
defaultValue: 'auto' | ||
})(TextDisplayWidget) || TextDisplayWidget; | ||
TextDisplayWidget = (0, _aureliaTemplating.bindable)('text')(TextDisplayWidget) || TextDisplayWidget; | ||
TextDisplayWidget = (0, _aureliaTemplating.customElement)('text-display-widget')(TextDisplayWidget) || TextDisplayWidget; | ||
return TextDisplayWidget; | ||
})(); | ||
|
||
exports.TextDisplayWidget = TextDisplayWidget; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<template> | ||
<div class="text-display" data-toggle="tooltip" >${text}</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
'use strict'; | ||
|
||
Object.defineProperty(exports, '__esModule', { | ||
value: true | ||
}); | ||
|
||
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); | ||
|
||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
|
||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } | ||
|
||
var _aureliaTemplating = require('aurelia-templating'); | ||
|
||
var _aureliaBinding = require('aurelia-binding'); | ||
|
||
var _aureliaDependencyInjection = require('aurelia-dependency-injection'); | ||
|
||
var _jquery = require('jquery'); | ||
|
||
var _jquery2 = _interopRequireDefault(_jquery); | ||
|
||
var TextDisplayWidget = (function () { | ||
function TextDisplayWidget(element) { | ||
_classCallCheck(this, _TextDisplayWidget); | ||
|
||
this.element = element; | ||
} | ||
|
||
_createClass(TextDisplayWidget, [{ | ||
key: 'bind', | ||
value: function bind() { | ||
(0, _jquery2['default'])(this.element.querySelector('[data-toggle="tooltip"]')).attr('title', this.text).tooltip(); | ||
} | ||
}, { | ||
key: 'textChanged', | ||
value: function textChanged(newValue) { | ||
(0, _jquery2['default'])(this.element.querySelector('[data-toggle="tooltip"]')).attr('title', newValue).tooltip('fixTitle'); | ||
} | ||
}]); | ||
|
||
var _TextDisplayWidget = TextDisplayWidget; | ||
TextDisplayWidget = (0, _aureliaDependencyInjection.inject)(Element)(TextDisplayWidget) || TextDisplayWidget; | ||
TextDisplayWidget = (0, _aureliaTemplating.bindable)({ | ||
name: 'placement', | ||
defaultValue: 'auto' | ||
})(TextDisplayWidget) || TextDisplayWidget; | ||
TextDisplayWidget = (0, _aureliaTemplating.bindable)('text')(TextDisplayWidget) || TextDisplayWidget; | ||
TextDisplayWidget = (0, _aureliaTemplating.customElement)('text-display-widget')(TextDisplayWidget) || TextDisplayWidget; | ||
return TextDisplayWidget; | ||
})(); | ||
|
||
exports.TextDisplayWidget = TextDisplayWidget; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<template> | ||
<div class="text-display" data-toggle="tooltip" >${text}</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import {customElement, bindable} from 'aurelia-templating'; | ||
import {bindingMode} from 'aurelia-binding'; | ||
import {inject} from 'aurelia-dependency-injection'; | ||
import $ from 'jquery'; | ||
|
||
@customElement('text-display-widget') | ||
@bindable('text') | ||
@bindable({ | ||
name: 'placement', | ||
defaultValue: 'auto' | ||
}) | ||
@inject(Element) | ||
export class TextDisplayWidget { | ||
|
||
constructor(element) { | ||
this.element = element; | ||
} | ||
|
||
bind() { | ||
$(this.element.querySelector('[data-toggle="tooltip"]')).attr('title', this.text).tooltip(); | ||
} | ||
|
||
textChanged(newValue) { | ||
$(this.element.querySelector('[data-toggle="tooltip"]')).attr('title', newValue).tooltip('fixTitle'); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<template> | ||
<div class="text-display" data-toggle="tooltip" >${text}</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
System.register(['aurelia-templating', 'aurelia-binding', 'aurelia-dependency-injection', 'jquery'], function (_export) { | ||
'use strict'; | ||
|
||
var customElement, bindable, bindingMode, inject, $, TextDisplayWidget; | ||
|
||
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); | ||
|
||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } | ||
|
||
return { | ||
setters: [function (_aureliaTemplating) { | ||
customElement = _aureliaTemplating.customElement; | ||
bindable = _aureliaTemplating.bindable; | ||
}, function (_aureliaBinding) { | ||
bindingMode = _aureliaBinding.bindingMode; | ||
}, function (_aureliaDependencyInjection) { | ||
inject = _aureliaDependencyInjection.inject; | ||
}, function (_jquery) { | ||
$ = _jquery['default']; | ||
}], | ||
execute: function () { | ||
TextDisplayWidget = (function () { | ||
function TextDisplayWidget(element) { | ||
_classCallCheck(this, _TextDisplayWidget); | ||
|
||
this.element = element; | ||
} | ||
|
||
_createClass(TextDisplayWidget, [{ | ||
key: 'bind', | ||
value: function bind() { | ||
$(this.element.querySelector('[data-toggle="tooltip"]')).attr('title', this.text).tooltip(); | ||
} | ||
}, { | ||
key: 'textChanged', | ||
value: function textChanged(newValue) { | ||
$(this.element.querySelector('[data-toggle="tooltip"]')).attr('title', newValue).tooltip('fixTitle'); | ||
} | ||
}]); | ||
|
||
var _TextDisplayWidget = TextDisplayWidget; | ||
TextDisplayWidget = inject(Element)(TextDisplayWidget) || TextDisplayWidget; | ||
TextDisplayWidget = bindable({ | ||
name: 'placement', | ||
defaultValue: 'auto' | ||
})(TextDisplayWidget) || TextDisplayWidget; | ||
TextDisplayWidget = bindable('text')(TextDisplayWidget) || TextDisplayWidget; | ||
TextDisplayWidget = customElement('text-display-widget')(TextDisplayWidget) || TextDisplayWidget; | ||
return TextDisplayWidget; | ||
})(); | ||
|
||
_export('TextDisplayWidget', TextDisplayWidget); | ||
} | ||
}; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<template> | ||
<div class="text-display" data-toggle="tooltip" >${text}</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import {customElement, bindable} from 'aurelia-templating'; | ||
import {bindingMode} from 'aurelia-binding'; | ||
import {inject} from 'aurelia-dependency-injection'; | ||
import $ from 'jquery'; | ||
|
||
@customElement('text-display-widget') | ||
@bindable('text') | ||
@bindable({ | ||
name: 'placement', | ||
defaultValue: 'auto' | ||
}) | ||
@inject(Element) | ||
export class TextDisplayWidget { | ||
|
||
constructor(element) { | ||
this.element = element; | ||
} | ||
|
||
bind() { | ||
$(this.element.querySelector('[data-toggle="tooltip"]')).attr('title', this.text).tooltip(); | ||
} | ||
|
||
textChanged(newValue) { | ||
$(this.element.querySelector('[data-toggle="tooltip"]')).attr('title', newValue).tooltip('fixTitle'); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.text-display { | ||
overflow: hidden; | ||
text-overflow: ellipsis; | ||
max-height: 100%; | ||
} |