diff --git a/.idea/watcherTasks.xml b/.idea/watcherTasks.xml
new file mode 100644
index 0000000..9338ba6
--- /dev/null
+++ b/.idea/watcherTasks.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/app/adapters/application.js b/app/adapters/application.js
new file mode 100644
index 0000000..632353f
--- /dev/null
+++ b/app/adapters/application.js
@@ -0,0 +1,5 @@
+import DS from 'ember-data';
+
+export default DS.RESTAdapter.extend({
+ host: 'http://api.fias.hellotan.ru'
+});
diff --git a/app/adapters/find-result.js b/app/adapters/find-result.js
new file mode 100644
index 0000000..1176dd8
--- /dev/null
+++ b/app/adapters/find-result.js
@@ -0,0 +1,18 @@
+import ApplicationAdapter from './application';
+import Ember from 'ember';
+
+export default ApplicationAdapter.extend({
+ query: function(store, type, query) {
+ var url = this.get('host')+'/find/'+query.text;
+ Ember.Logger.log('url:', url);
+
+ return new Ember.RSVP.Promise(function(resolve, reject) {
+ Ember.$.getJSON(url, query).then(function(data) {
+ Ember.run(null, resolve, data);
+ }, function(jqXHR) {
+ jqXHR.then = null; // tame jQuery's ill mannered promises
+ Ember.run(null, reject, jqXHR);
+ });
+ });
+ }
+});
\ No newline at end of file
diff --git a/app/components/nav-link-to.js b/app/components/nav-link-to.js
new file mode 100644
index 0000000..376a5b6
--- /dev/null
+++ b/app/components/nav-link-to.js
@@ -0,0 +1,6 @@
+import Ember from 'ember';
+
+export default Ember.LinkComponent.extend({
+ tagName: 'a',
+ classNames: ['item']
+});
diff --git a/app/components/search-form.js b/app/components/search-form.js
new file mode 100644
index 0000000..01c4240
--- /dev/null
+++ b/app/components/search-form.js
@@ -0,0 +1,19 @@
+import Ember from 'ember';
+
+export default Ember.Component.extend({
+ placeholder: "Ввведите название населенного пункта",
+ searchText: "",
+ store: Ember.inject.service('store'),
+
+ actions: {
+ search(param) {
+ if (param !== '') {
+ this.get('store').query('find-result', {text: param}).then((result) => {
+ this.set('model', result);
+ });
+ } else {
+ this.set('model', null);
+ }
+ }
+ }
+});
diff --git a/app/index.html b/app/index.html
index e3711f7..69ca6af 100644
--- a/app/index.html
+++ b/app/index.html
@@ -3,7 +3,7 @@
- FiasFace
+ Hellotan's FIAS API
diff --git a/app/models/find-result.js b/app/models/find-result.js
new file mode 100644
index 0000000..89eaea4
--- /dev/null
+++ b/app/models/find-result.js
@@ -0,0 +1,9 @@
+import Model from 'ember-data/model';
+import attr from 'ember-data/attr';
+
+export default Model.extend({
+ text: attr('string'),
+ cort: attr('number'),
+ ratio: attr('number'),
+ aoid: attr('string')
+});
diff --git a/app/router.js b/app/router.js
index 3bba78e..1444431 100644
--- a/app/router.js
+++ b/app/router.js
@@ -2,10 +2,11 @@ import Ember from 'ember';
import config from './config/environment';
const Router = Ember.Router.extend({
- location: config.locationType
+ location: config.locationType
});
-Router.map(function() {
+Router.map(function () {
+ this.route('search');
});
export default Router;
diff --git a/app/routes/index.js b/app/routes/index.js
new file mode 100644
index 0000000..8560625
--- /dev/null
+++ b/app/routes/index.js
@@ -0,0 +1,7 @@
+import Ember from 'ember';
+
+export default Ember.Route.extend({
+ beforeModel() {
+ this.transitionTo('search');
+ }
+});
diff --git a/app/routes/search.js b/app/routes/search.js
new file mode 100644
index 0000000..26d9f31
--- /dev/null
+++ b/app/routes/search.js
@@ -0,0 +1,4 @@
+import Ember from 'ember';
+
+export default Ember.Route.extend({
+});
diff --git a/app/serializers/find-result.js b/app/serializers/find-result.js
new file mode 100644
index 0000000..c06b191
--- /dev/null
+++ b/app/serializers/find-result.js
@@ -0,0 +1,5 @@
+import DS from 'ember-data';
+
+export default DS.JSONSerializer.extend({
+ primaryKey: 'aoid'
+});
\ No newline at end of file
diff --git a/app/styles/app.css b/app/styles/app.css
index e69de29..21596ed 100644
--- a/app/styles/app.css
+++ b/app/styles/app.css
@@ -0,0 +1,12 @@
+body {
+ background-color: #FFFFFF;
+}
+.ui.menu .item img.logo {
+ margin-right: 1.5em;
+}
+.main.container {
+ margin-top: 7em;
+}
+.wireframe {
+ margin-top: 2em;
+}
\ No newline at end of file
diff --git a/app/templates/application.hbs b/app/templates/application.hbs
index f8bc38e..7a411fb 100644
--- a/app/templates/application.hbs
+++ b/app/templates/application.hbs
@@ -1,3 +1,21 @@
-Welcome to Ember
-
-{{outlet}}
+
+
+ {{ outlet }}
+
diff --git a/app/templates/components/nav-link-to.hbs b/app/templates/components/nav-link-to.hbs
new file mode 100644
index 0000000..398911a
--- /dev/null
+++ b/app/templates/components/nav-link-to.hbs
@@ -0,0 +1 @@
+{{ yield }}
diff --git a/app/templates/components/search-form.hbs b/app/templates/components/search-form.hbs
new file mode 100644
index 0000000..b4dd610
--- /dev/null
+++ b/app/templates/components/search-form.hbs
@@ -0,0 +1,21 @@
+
+
+
+ {{input type="text" placeholder=placeholder value=searchText action="search" on="key-up"}}
+
+
+ {{#if model}}
+
+
+ {{#ui-accordion class='styled fluid'}}
+ {{#each model as |aoitem|}}
+ {{#ui-popup content=(concat "Ratio: " aoitem.ratio) position='right center'}}
+ {{#ui-accordion-section title=aoitem.text}}
AOID: {{ aoitem.aoid }}
{{/ui-accordion-section}}
+ {{/ui-popup}}
+ {{/each}}
+ {{/ui-accordion}}
+ {{/if}}
+
+
diff --git a/app/templates/index.hbs b/app/templates/index.hbs
new file mode 100644
index 0000000..c24cd68
--- /dev/null
+++ b/app/templates/index.hbs
@@ -0,0 +1 @@
+{{outlet}}
diff --git a/app/templates/search.hbs b/app/templates/search.hbs
new file mode 100644
index 0000000..96b57e9
--- /dev/null
+++ b/app/templates/search.hbs
@@ -0,0 +1 @@
+{{#search-form}}PIDARAS{{/search-form}}
\ No newline at end of file
diff --git a/bower.json b/bower.json
index 8140a53..a2a586a 100644
--- a/bower.json
+++ b/bower.json
@@ -4,6 +4,7 @@
"ember": "~2.5.0",
"ember-cli-shims": "0.1.1",
"ember-cli-test-loader": "0.2.2",
- "ember-qunit-notifications": "0.1.0"
+ "ember-qunit-notifications": "0.1.0",
+ "semantic-ui": "^2.1.8"
}
}
diff --git a/package.json b/package.json
index eaeffcc..78c7907 100644
--- a/package.json
+++ b/package.json
@@ -31,6 +31,7 @@
"ember-cli-jshint": "^1.0.0",
"ember-cli-qunit": "^1.4.0",
"ember-cli-release": "0.2.8",
+ "ember-cli-semantic-ui": "0.8.1",
"ember-cli-sri": "^2.1.0",
"ember-cli-uglify": "^1.2.0",
"ember-data": "^2.5.0",
diff --git a/public/assets/images/logo.png b/public/assets/images/logo.png
new file mode 100644
index 0000000..fe331ae
Binary files /dev/null and b/public/assets/images/logo.png differ
diff --git a/tests/integration/components/nav-link-to-test.js b/tests/integration/components/nav-link-to-test.js
new file mode 100644
index 0000000..47bcf84
--- /dev/null
+++ b/tests/integration/components/nav-link-to-test.js
@@ -0,0 +1,24 @@
+import { moduleForComponent, test } from 'ember-qunit';
+import hbs from 'htmlbars-inline-precompile';
+
+moduleForComponent('nav-link-to', 'Integration | Component | nav link to', {
+ integration: true
+});
+
+test('it renders', function(assert) {
+ // Set any properties with this.set('myProperty', 'value');
+ // Handle any actions with this.on('myAction', function(val) { ... });
+
+ this.render(hbs`{{nav-link-to}}`);
+
+ assert.equal(this.$().text().trim(), '');
+
+ // Template block usage:
+ this.render(hbs`
+ {{#nav-link-to}}
+ template block text
+ {{/nav-link-to}}
+ `);
+
+ assert.equal(this.$().text().trim(), 'template block text');
+});
diff --git a/tests/integration/components/search-form-test.js b/tests/integration/components/search-form-test.js
new file mode 100644
index 0000000..93e0f3a
--- /dev/null
+++ b/tests/integration/components/search-form-test.js
@@ -0,0 +1,24 @@
+import { moduleForComponent, test } from 'ember-qunit';
+import hbs from 'htmlbars-inline-precompile';
+
+moduleForComponent('search-form', 'Integration | Component | search form', {
+ integration: true
+});
+
+test('it renders', function(assert) {
+ // Set any properties with this.set('myProperty', 'value');
+ // Handle any actions with this.on('myAction', function(val) { ... });
+
+ this.render(hbs`{{search-form}}`);
+
+ assert.equal(this.$().text().trim(), '');
+
+ // Template block usage:
+ this.render(hbs`
+ {{#search-form}}
+ template block text
+ {{/search-form}}
+ `);
+
+ assert.equal(this.$().text().trim(), 'template block text');
+});
diff --git a/tests/unit/adapters/application-test.js b/tests/unit/adapters/application-test.js
new file mode 100644
index 0000000..f0a2101
--- /dev/null
+++ b/tests/unit/adapters/application-test.js
@@ -0,0 +1,12 @@
+import { moduleFor, test } from 'ember-qunit';
+
+moduleFor('adapter:application', 'Unit | Adapter | application', {
+ // Specify the other units that are required for this test.
+ // needs: ['serializer:foo']
+});
+
+// Replace this with your real tests.
+test('it exists', function(assert) {
+ let adapter = this.subject();
+ assert.ok(adapter);
+});
diff --git a/tests/unit/adapters/find-result-test.js b/tests/unit/adapters/find-result-test.js
new file mode 100644
index 0000000..90f351e
--- /dev/null
+++ b/tests/unit/adapters/find-result-test.js
@@ -0,0 +1,12 @@
+import { moduleFor, test } from 'ember-qunit';
+
+moduleFor('adapter:find-result', 'Unit | Adapter | find result', {
+ // Specify the other units that are required for this test.
+ // needs: ['serializer:foo']
+});
+
+// Replace this with your real tests.
+test('it exists', function(assert) {
+ let adapter = this.subject();
+ assert.ok(adapter);
+});
diff --git a/tests/unit/models/find-result-test.js b/tests/unit/models/find-result-test.js
new file mode 100644
index 0000000..8c42d98
--- /dev/null
+++ b/tests/unit/models/find-result-test.js
@@ -0,0 +1,12 @@
+import { moduleForModel, test } from 'ember-qunit';
+
+moduleForModel('find-result', 'Unit | Model | find result', {
+ // Specify the other units that are required for this test.
+ needs: []
+});
+
+test('it exists', function(assert) {
+ let model = this.subject();
+ // let store = this.store();
+ assert.ok(!!model);
+});
diff --git a/tests/unit/routes/index-test.js b/tests/unit/routes/index-test.js
new file mode 100644
index 0000000..5d0f50d
--- /dev/null
+++ b/tests/unit/routes/index-test.js
@@ -0,0 +1,11 @@
+import { moduleFor, test } from 'ember-qunit';
+
+moduleFor('route:index', 'Unit | Route | index', {
+ // Specify the other units that are required for this test.
+ // needs: ['controller:foo']
+});
+
+test('it exists', function(assert) {
+ let route = this.subject();
+ assert.ok(route);
+});
diff --git a/tests/unit/routes/search-test.js b/tests/unit/routes/search-test.js
new file mode 100644
index 0000000..cdc88b9
--- /dev/null
+++ b/tests/unit/routes/search-test.js
@@ -0,0 +1,11 @@
+import { moduleFor, test } from 'ember-qunit';
+
+moduleFor('route:search', 'Unit | Route | search', {
+ // Specify the other units that are required for this test.
+ // needs: ['controller:foo']
+});
+
+test('it exists', function(assert) {
+ let route = this.subject();
+ assert.ok(route);
+});
diff --git a/tests/unit/serializers/find-result-test.js b/tests/unit/serializers/find-result-test.js
new file mode 100644
index 0000000..431a9ec
--- /dev/null
+++ b/tests/unit/serializers/find-result-test.js
@@ -0,0 +1,15 @@
+import { moduleForModel, test } from 'ember-qunit';
+
+moduleForModel('find-result', 'Unit | Serializer | find result', {
+ // Specify the other units that are required for this test.
+ needs: ['serializer:find-result']
+});
+
+// Replace this with your real tests.
+test('it serializes records', function(assert) {
+ let record = this.subject();
+
+ let serializedRecord = record.serialize();
+
+ assert.ok(serializedRecord);
+});