Skip to content

Commit 664ac15

Browse files
committed
Add autocomplete
1 parent 94f7de1 commit 664ac15

File tree

6 files changed

+88
-17
lines changed

6 files changed

+88
-17
lines changed

app/controllers/autocomplete.js

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
import Ember from 'ember';
2+
3+
export default Ember.ObjectController.extend({
4+
text: "",
5+
languages: [
6+
"Ada",
7+
"Algol",
8+
"Alice",
9+
"Assembly",
10+
"Basic",
11+
"C",
12+
"C#",
13+
"C++",
14+
"Clojure",
15+
"COBOL",
16+
"CoffeeScript",
17+
"Dart",
18+
"Delphi",
19+
"ECMAScript",
20+
"Erlang",
21+
"F#",
22+
"Fortran",
23+
"FoxPro",
24+
"Go",
25+
"Groovy",
26+
"Haskell",
27+
"J#",
28+
"Java",
29+
"JavaScript",
30+
"JScript",
31+
"Lisp",
32+
"Logo",
33+
"Magic",
34+
"MATLAB",
35+
"Mercury",
36+
"Monkey",
37+
"Modula-2",
38+
"Objective-C",
39+
"OCaml",
40+
"Pascal",
41+
"Perl",
42+
"PHP",
43+
"PL/SQL",
44+
"Prolog",
45+
"Python",
46+
"Q",
47+
"R",
48+
"Ruby",
49+
"Rust",
50+
"Scala",
51+
"Scheme",
52+
"Smalltalk",
53+
"Tcl",
54+
"Turing",
55+
"TypeScript",
56+
"VBScript",
57+
"Visual Basic",
58+
"Whitespace",
59+
"xBase"
60+
]
61+
});

app/controllers/slider.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export default Ember.ObjectController.extend({
1010
this.set('num2', this.get('num'));
1111
}.observes('num'),
1212
actions: {
13-
didSlide: function(event, ui) {
13+
didSlide: function() {
1414
this.set('text', this.get('text') + "_");
1515
}
1616
}

app/router.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@ var Router = Ember.Router.extend({
66
});
77

88
Router.map(function() {
9+
this.route('autocomplete');
910
this.route('button');
1011
this.route('datepicker');
1112
this.route('progressBar');
12-
this.route('spinner');
1313
this.route('slider');
14+
this.route('spinner');
1415
});
1516

1617
export default Router;

app/templates/application.hbs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
<nav>
2+
<li>{{#link-to "autocomplete"}}Autocomplete{{/link-to}}</li>
23
<li>{{#link-to "button"}}Button{{/link-to}}</li>
34
<li>{{#link-to "datepicker"}}Datepicker{{/link-to}}</li>
45
<li>{{#link-to "progressBar"}}Progress Bar{{/link-to}}</li>
5-
<li>{{#link-to "spinner"}}Spinner{{/link-to}}</li>
66
<li>{{#link-to "slider"}}Slider{{/link-to}}</li>
7+
<li>{{#link-to "spinner"}}Spinner{{/link-to}}</li>
78
</nav>
89

910
{{outlet}}

app/templates/autocomplete.hbs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<h2>Autocomplete</h2>
2+
3+
{{jqui-autocomplete value=text source=languages}} {{text}}
4+
5+
<p>To use the autocomplete widget as above, just add the following template and controller to your application:</p>
6+
7+
<h4>Template:</h4>
8+
<p><code>\{{jqui-autocomplete value=text source=languages}} \{{text}}</code></p>
9+
10+
<h4>Controller</h4>
11+
<p><code><pre>
12+
import Ember from 'ember';
13+
14+
export default Ember.ObjectController.extend({
15+
text: "",
16+
languages: [
17+
"Ada",
18+
"Algol",
19+
// ...
20+
]
21+
});
22+
</pre></code></p>

tests/unit/routes/slider-test.js

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)