├── .bowerrc ├── .editorconfig ├── .ember-cli ├── .gitignore ├── .jshintrc ├── .npmignore ├── .travis.yml ├── .watchmanconfig ├── LICENSE.md ├── README.md ├── addon ├── .gitkeep ├── adapter.js ├── mixins │ └── postgrest-route.js ├── serializer.js └── services │ └── postgrest.js ├── app ├── .gitkeep └── services │ └── postgrest.js ├── bower.json ├── config ├── ember-try.js └── environment.js ├── demo.sql ├── ember-cli-build.js ├── index.js ├── package.json ├── testem.js ├── tests ├── .jshintrc ├── dummy │ ├── app │ │ ├── adapters │ │ │ └── application.js │ │ ├── app.js │ │ ├── components │ │ │ ├── .gitkeep │ │ │ ├── data-table-field.js │ │ │ ├── data-table.js │ │ │ └── tables-menu.js │ │ ├── controllers │ │ │ └── .gitkeep │ │ ├── helpers │ │ │ └── .gitkeep │ │ ├── index.html │ │ ├── models │ │ │ └── .gitkeep │ │ ├── resolver.js │ │ ├── router.js │ │ ├── routes │ │ │ ├── .gitkeep │ │ │ ├── application.js │ │ │ ├── form.js │ │ │ ├── table.js │ │ │ └── templates.js │ │ ├── serializers │ │ │ └── application.js │ │ ├── styles │ │ │ ├── app.css │ │ │ └── dashboard.css │ │ └── templates │ │ │ ├── application.hbs │ │ │ ├── components │ │ │ ├── .gitkeep │ │ │ ├── data-table-field.hbs │ │ │ ├── data-table.hbs │ │ │ └── tables-menu.hbs │ │ │ ├── form.hbs │ │ │ ├── table.hbs │ │ │ └── templates.hbs │ ├── config │ │ └── environment.js │ └── public │ │ ├── crossdomain.xml │ │ └── robots.txt ├── helpers │ ├── destroy-app.js │ ├── module-for-acceptance.js │ ├── resolver.js │ └── start-app.js ├── index.html ├── integration │ └── .gitkeep ├── test-helper.js └── unit │ └── .gitkeep └── vendor └── .gitkeep /.bowerrc: -------------------------------------------------------------------------------- 1 | { 2 | "directory": "bower_components", 3 | "analytics": false 4 | } 5 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig helps developers define and maintain consistent 2 | # coding styles between different editors and IDEs 3 | # editorconfig.org 4 | 5 | root = true 6 | 7 | 8 | [*] 9 | end_of_line = lf 10 | charset = utf-8 11 | trim_trailing_whitespace = true 12 | insert_final_newline = true 13 | indent_style = space 14 | indent_size = 2 15 | 16 | [*.js] 17 | indent_style = space 18 | indent_size = 2 19 | 20 | [*.hbs] 21 | insert_final_newline = false 22 | indent_style = space 23 | indent_size = 2 24 | 25 | [*.css] 26 | indent_style = space 27 | indent_size = 2 28 | 29 | [*.html] 30 | indent_style = space 31 | indent_size = 2 32 | 33 | [*.{diff,md}] 34 | trim_trailing_whitespace = false 35 | -------------------------------------------------------------------------------- /.ember-cli: -------------------------------------------------------------------------------- 1 | { 2 | /** 3 | Ember CLI sends analytics information by default. The data is completely 4 | anonymous, but there are times when you might want to disable this behavior. 5 | 6 | Setting `disableAnalytics` to true will prevent any data from being sent. 7 | */ 8 | "disableAnalytics": false 9 | } 10 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # compiled output 4 | /dist 5 | /tmp 6 | 7 | # dependencies 8 | /node_modules 9 | /bower_components 10 | 11 | # misc 12 | /.sass-cache 13 | /connect.lock 14 | /coverage/* 15 | /libpeerconnection.log 16 | npm-debug.log 17 | testem.log 18 | -------------------------------------------------------------------------------- /.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "predef": [ 3 | "document", 4 | "window", 5 | "-Promise" 6 | ], 7 | "browser": true, 8 | "boss": true, 9 | "curly": true, 10 | "debug": false, 11 | "devel": true, 12 | "eqeqeq": true, 13 | "evil": true, 14 | "forin": false, 15 | "immed": false, 16 | "laxbreak": false, 17 | "newcap": true, 18 | "noarg": true, 19 | "noempty": false, 20 | "nonew": false, 21 | "nomen": false, 22 | "onevar": false, 23 | "plusplus": false, 24 | "regexp": false, 25 | "undef": true, 26 | "sub": true, 27 | "strict": false, 28 | "white": false, 29 | "eqnull": true, 30 | "esnext": true, 31 | "unused": true 32 | } 33 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | /bower_components 2 | /config/ember-try.js 3 | /dist 4 | /tests 5 | /tmp 6 | **/.gitkeep 7 | .bowerrc 8 | .editorconfig 9 | .ember-cli 10 | .gitignore 11 | .jshintrc 12 | .watchmanconfig 13 | .travis.yml 14 | bower.json 15 | ember-cli-build.js 16 | testem.js 17 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | --- 2 | language: node_js 3 | node_js: 4 | - "0.12" 5 | 6 | sudo: false 7 | 8 | cache: 9 | directories: 10 | - node_modules 11 | 12 | env: 13 | - EMBER_TRY_SCENARIO=default 14 | - EMBER_TRY_SCENARIO=ember-1.13 15 | - EMBER_TRY_SCENARIO=ember-release 16 | - EMBER_TRY_SCENARIO=ember-beta 17 | - EMBER_TRY_SCENARIO=ember-canary 18 | 19 | matrix: 20 | fast_finish: true 21 | allow_failures: 22 | - env: EMBER_TRY_SCENARIO=ember-canary 23 | 24 | before_install: 25 | - export PATH=/usr/local/phantomjs-2.0.0/bin:$PATH 26 | - "npm config set spin false" 27 | - "npm install -g npm@^2" 28 | 29 | install: 30 | - npm install -g bower 31 | - npm install 32 | - bower install 33 | 34 | script: 35 | - ember try $EMBER_TRY_SCENARIO test 36 | -------------------------------------------------------------------------------- /.watchmanconfig: -------------------------------------------------------------------------------- 1 | { 2 | "ignore_dirs": ["tmp", "dist"] 3 | } 4 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Ember PostgREST Dynamic UI 2 | 3 | Dynamic UI in Ember powered by [PostgREST](http://postgrest.com/) and [Ember Formly](https://github.com/formly-js/ember-formly) 4 | 5 | ## Video Demo 6 | 7 | 8 | 9 | [](https://www.youtube.com/watch?v=BJz3ROHPwKU) 10 | 11 | ## Installation 12 | 13 | * `git clone` this repository 14 | * `npm install` 15 | * `bower install` 16 | 17 | ### Install PostgREST 18 | 19 | Instructions at: [http://postgrest.com/](http://postgrest.com/) 20 | 21 | ## Running 22 | 23 | * `ember server` 24 | * [Run PostgREST](http://postgrest.com/install/server/#running-the-server) 25 | * Visit your app at http://localhost:4200. 26 | 27 | ## Running Tests 28 | 29 | * `npm test` (Runs `ember try:testall` to test your addon against multiple Ember versions) 30 | * `ember test` 31 | * `ember test --server` 32 | 33 | ## Building 34 | 35 | * `ember build` 36 | 37 | For more information on using ember-cli, visit [http://ember-cli.com/](http://ember-cli.com/). 38 | -------------------------------------------------------------------------------- /addon/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/benoror/ember-postgrest-dynamic-ui/244236859b997d5fc429c480431e193c65a1f704/addon/.gitkeep -------------------------------------------------------------------------------- /addon/adapter.js: -------------------------------------------------------------------------------- 1 | import DS from "ember-data"; 2 | 3 | export default DS.RESTAdapter.extend({ 4 | buildURL(modelName, id, snapshot, requestType, query) { 5 | const newModelNAme = id; 6 | return this._super(newModelNAme, undefined, snapshot, requestType, query); 7 | } 8 | 9 | // pathForType: function(modelName) { 10 | // return modelName; 11 | // } 12 | }); 13 | -------------------------------------------------------------------------------- /addon/mixins/postgrest-route.js: -------------------------------------------------------------------------------- 1 | import Ember from 'ember'; 2 | 3 | const { 4 | get, 5 | inject 6 | } = Ember; 7 | 8 | export default Ember.Mixin.create({ 9 | postgrest: inject.service(), 10 | 11 | getTables() { 12 | return get(this, 'postgrest').request('/').then((tables) => { 13 | return tables.filter((table) => table.name.indexOf('meta_') !== 0); 14 | }); 15 | }, 16 | 17 | getOptions(table_name) { 18 | return get(this, 'postgrest').request(`/${table_name}`, { 19 | method: 'OPTIONS' 20 | }); 21 | }, 22 | 23 | getRecords(table_name) { 24 | return get(this, 'postgrest').request(`/${table_name}`); 25 | }, 26 | 27 | getRecord(table_name, id) { 28 | return get(this, 'postgrest').request(`/${table_name}?id=eq.${id}`, { 29 | headers: { 30 | 'Prefer': 'plurality=singular' 31 | } 32 | }); 33 | }, 34 | 35 | getTemplates(table_name) { 36 | return get(this, 'postgrest') 37 | .request(`/meta_fields_templates?table_name=eq.${table_name}`); 38 | }, 39 | 40 | getTemplate(table_name, template) { 41 | if(template === 'default') { 42 | return undefined; 43 | } 44 | 45 | return get(this, 'postgrest') 46 | .request(`/meta_fields_templates?table_name=eq.${table_name}&id=eq.${template}`, { 47 | headers: { 48 | 'Prefer': 'plurality=singular' 49 | } 50 | }).then((row) => row.template); 51 | // return get(this, 'postgrest') 52 | // .request(`/templates/${table_name}/${id}.json`); 53 | }, 54 | 55 | setupFields(model) { 56 | return model.template || model.options.columns.map((field) => { 57 | let type; 58 | switch(field.type) { 59 | case 'integer': 60 | case 'decimal': 61 | case 'numeric': 62 | case 'real': 63 | case 'money': 64 | type = 'number'; 65 | break; 66 | case 'date': 67 | type = 'date'; 68 | break; 69 | case 'time': 70 | case 'time without time zone': 71 | type = 'time'; 72 | break; 73 | case 'timestamp': 74 | type = 'datetime'; 75 | break; 76 | case 'boolean': 77 | type = 'checkbox'; 78 | break; 79 | default: 80 | type = 'text'; 81 | break; 82 | } 83 | return { 84 | key: field.name, 85 | type: 'input', //field.type 86 | templateOptions: { 87 | type, 88 | label: Ember.String.capitalize(field.name), 89 | placeholder: Ember.String.capitalize(field.name) 90 | } 91 | }; 92 | }); 93 | } 94 | }); 95 | -------------------------------------------------------------------------------- /addon/serializer.js: -------------------------------------------------------------------------------- 1 | import Ember from 'ember'; 2 | import DS from 'ember-data'; 3 | 4 | // const inflector = new Ember.Inflector(); 5 | 6 | export default DS.JSONSerializer.extend({ 7 | // normalizeResponse(store, type, payload) { 8 | // const modelNamePlural = inflector.pluralize(type.modelName); 9 | // const newPayload = { payload: payload }; 10 | // console.log(newPayload); 11 | 12 | // 13 | // if(payload.records) { 14 | // payload[modelNamePlural] = payload.records; 15 | // delete payload.records; 16 | // 17 | // payload.meta = { 18 | // offset: payload.offset 19 | // }; 20 | // delete payload.offset; 21 | // 22 | // payload[modelNamePlural].forEach((record) => { 23 | // Ember.merge(record, record.fields); 24 | // delete record.fields; 25 | // record.created = record.createdTime; 26 | // delete record.createdTime; 27 | // }); 28 | // } else { 29 | // payload[type.modelName] = payload.fields; 30 | // payload[type.modelName].id = payload.id; 31 | // payload[type.modelName].created = payload.createdTime; 32 | // delete payload.id; 33 | // delete payload.fields; 34 | // delete payload.createdTime; 35 | // } 36 | // 37 | // return this._super(store, type, payload); 38 | // } 39 | }); 40 | -------------------------------------------------------------------------------- /addon/services/postgrest.js: -------------------------------------------------------------------------------- 1 | import AjaxService from 'ember-ajax/services/ajax'; 2 | 3 | export default AjaxService.extend({ 4 | host: 'http://localhost:3000' 5 | }); 6 | -------------------------------------------------------------------------------- /app/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/benoror/ember-postgrest-dynamic-ui/244236859b997d5fc429c480431e193c65a1f704/app/.gitkeep -------------------------------------------------------------------------------- /app/services/postgrest.js: -------------------------------------------------------------------------------- 1 | export { default } from 'ember-postgrest-dynamic-ui/services/postgrest'; 2 | -------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ember-postgrest-dynamic-ui", 3 | "dependencies": { 4 | "ember": "~2.5.0", 5 | "ember-cli-shims": "0.1.1", 6 | "ember-cli-test-loader": "0.2.2", 7 | "ember-qunit-notifications": "0.1.0", 8 | "bootstrap": "~3.3.5", 9 | "jsoneditor": "^5.5.6" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /config/ember-try.js: -------------------------------------------------------------------------------- 1 | /*jshint node:true*/ 2 | module.exports = { 3 | scenarios: [ 4 | { 5 | name: 'default', 6 | bower: { 7 | dependencies: { } 8 | } 9 | }, 10 | { 11 | name: 'ember-1.13', 12 | bower: { 13 | dependencies: { 14 | 'ember': '~1.13.0' 15 | }, 16 | resolutions: { 17 | 'ember': '~1.13.0' 18 | } 19 | } 20 | }, 21 | { 22 | name: 'ember-release', 23 | bower: { 24 | dependencies: { 25 | 'ember': 'components/ember#release' 26 | }, 27 | resolutions: { 28 | 'ember': 'release' 29 | } 30 | } 31 | }, 32 | { 33 | name: 'ember-beta', 34 | bower: { 35 | dependencies: { 36 | 'ember': 'components/ember#beta' 37 | }, 38 | resolutions: { 39 | 'ember': 'beta' 40 | } 41 | } 42 | }, 43 | { 44 | name: 'ember-canary', 45 | bower: { 46 | dependencies: { 47 | 'ember': 'components/ember#canary' 48 | }, 49 | resolutions: { 50 | 'ember': 'canary' 51 | } 52 | } 53 | } 54 | ] 55 | }; 56 | -------------------------------------------------------------------------------- /config/environment.js: -------------------------------------------------------------------------------- 1 | /*jshint node:true*/ 2 | 'use strict'; 3 | 4 | module.exports = function(/* environment, appConfig */) { 5 | return { }; 6 | }; 7 | -------------------------------------------------------------------------------- /demo.sql: -------------------------------------------------------------------------------- 1 | -- 2 | -- PostgreSQL database dump 3 | -- 4 | 5 | -- Dumped from database version 9.5.3 6 | -- Dumped by pg_dump version 9.5.3 7 | 8 | SET statement_timeout = 0; 9 | SET lock_timeout = 0; 10 | SET client_encoding = 'UTF8'; 11 | SET standard_conforming_strings = on; 12 | SET check_function_bodies = false; 13 | SET client_min_messages = warning; 14 | SET row_security = off; 15 | 16 | -- 17 | -- Name: plpgsql; Type: EXTENSION; Schema: -; Owner: 18 | -- 19 | 20 | CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog; 21 | 22 | 23 | -- 24 | -- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner: 25 | -- 26 | 27 | COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language'; 28 | 29 | 30 | SET search_path = public, pg_catalog; 31 | 32 | SET default_tablespace = ''; 33 | 34 | SET default_with_oids = false; 35 | 36 | -- 37 | -- Name: meta_fields_templates; Type: TABLE; Schema: public; Owner: benoror 38 | -- 39 | 40 | CREATE TABLE meta_fields_templates ( 41 | id integer NOT NULL, 42 | table_name character varying(255), 43 | description text, 44 | template jsonb 45 | ); 46 | 47 | 48 | ALTER TABLE meta_fields_templates OWNER TO benoror; 49 | 50 | -- 51 | -- Name: _fields_templates_id_seq; Type: SEQUENCE; Schema: public; Owner: benoror 52 | -- 53 | 54 | CREATE SEQUENCE _fields_templates_id_seq 55 | START WITH 1 56 | INCREMENT BY 1 57 | NO MINVALUE 58 | NO MAXVALUE 59 | CACHE 1; 60 | 61 | 62 | ALTER TABLE _fields_templates_id_seq OWNER TO benoror; 63 | 64 | -- 65 | -- Name: _fields_templates_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: benoror 66 | -- 67 | 68 | ALTER SEQUENCE _fields_templates_id_seq OWNED BY meta_fields_templates.id; 69 | 70 | 71 | -- 72 | -- Name: director_id_seq; Type: SEQUENCE; Schema: public; Owner: benoror 73 | -- 74 | 75 | CREATE SEQUENCE director_id_seq 76 | START WITH 1 77 | INCREMENT BY 1 78 | NO MINVALUE 79 | NO MAXVALUE 80 | CACHE 1; 81 | 82 | 83 | ALTER TABLE director_id_seq OWNER TO benoror; 84 | 85 | -- 86 | -- Name: director; Type: TABLE; Schema: public; Owner: benoror 87 | -- 88 | 89 | CREATE TABLE director ( 90 | id integer DEFAULT nextval('director_id_seq'::regclass) NOT NULL, 91 | name text, 92 | height numeric, 93 | birthday date, 94 | hour time without time zone, 95 | veggie boolean, 96 | favcolor character varying(255), 97 | password character varying(255) 98 | ); 99 | 100 | 101 | ALTER TABLE director OWNER TO benoror; 102 | 103 | -- 104 | -- Name: films; Type: TABLE; Schema: public; Owner: benoror 105 | -- 106 | 107 | CREATE TABLE films ( 108 | id integer NOT NULL, 109 | title text NOT NULL, 110 | year date NOT NULL, 111 | rating real DEFAULT 0 NOT NULL, 112 | language text NOT NULL 113 | ); 114 | 115 | 116 | ALTER TABLE films OWNER TO benoror; 117 | 118 | -- 119 | -- Name: film_id_seq; Type: SEQUENCE; Schema: public; Owner: benoror 120 | -- 121 | 122 | CREATE SEQUENCE film_id_seq 123 | START WITH 1 124 | INCREMENT BY 1 125 | NO MINVALUE 126 | NO MAXVALUE 127 | CACHE 1; 128 | 129 | 130 | ALTER TABLE film_id_seq OWNER TO benoror; 131 | 132 | -- 133 | -- Name: film_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: benoror 134 | -- 135 | 136 | ALTER SEQUENCE film_id_seq OWNED BY films.id; 137 | 138 | 139 | -- 140 | -- Name: id; Type: DEFAULT; Schema: public; Owner: benoror 141 | -- 142 | 143 | ALTER TABLE ONLY films ALTER COLUMN id SET DEFAULT nextval('film_id_seq'::regclass); 144 | 145 | 146 | -- 147 | -- Name: id; Type: DEFAULT; Schema: public; Owner: benoror 148 | -- 149 | 150 | ALTER TABLE ONLY meta_fields_templates ALTER COLUMN id SET DEFAULT nextval('_fields_templates_id_seq'::regclass); 151 | 152 | 153 | -- 154 | -- Name: _fields_templates_id_seq; Type: SEQUENCE SET; Schema: public; Owner: benoror 155 | -- 156 | 157 | SELECT pg_catalog.setval('_fields_templates_id_seq', 1, true); 158 | 159 | 160 | -- 161 | -- Data for Name: director; Type: TABLE DATA; Schema: public; Owner: benoror 162 | -- 163 | 164 | COPY director (id, name, height, birthday, hour, veggie, favcolor, password) FROM stdin; 165 | 6 Francis Ford Coppola \N \N \N \N \N \N 166 | 4 Stanley Kubrick \N \N \N \N \N \N 167 | 10 James Cameron \N \N \N \N \N \N 168 | 11 Christopher Nolan \N \N \N \N \N \N 169 | 2 Steven Spielberg \N \N \N \N \N \N 170 | 5 Quentin Tarantino \N \N \N \N \N \N 171 | 12 Peter Jackson \N \N \N \N \N \N 172 | 3 Alfred Hitchcock \N \N \N \N \N \N 173 | 8 Woody Allen \N \N \N \N \N \N 174 | 1 Martin Scorsese \N \N \N \N \N \N 175 | 7 Orson Welles \N \N \N \N \N \N 176 | 9 Ridley Scott \N \N \N \N \N \N 177 | \. 178 | 179 | 180 | -- 181 | -- Name: director_id_seq; Type: SEQUENCE SET; Schema: public; Owner: benoror 182 | -- 183 | 184 | SELECT pg_catalog.setval('director_id_seq', 35, true); 185 | 186 | 187 | -- 188 | -- Name: film_id_seq; Type: SEQUENCE SET; Schema: public; Owner: benoror 189 | -- 190 | 191 | SELECT pg_catalog.setval('film_id_seq', 35, true); 192 | 193 | 194 | -- 195 | -- Data for Name: films; Type: TABLE DATA; Schema: public; Owner: benoror 196 | -- 197 | 198 | COPY films (id, title, year, rating, language) FROM stdin; 199 | 2 The Look of Silence 2014-01-01 8.30000019 Indonesian 200 | 3 Fires on the Plain 2014-01-01 5.80000019 Japanese 201 | 5 Good Kill 2014-01-01 6.0999999 english 202 | 6 Leopardi 2014-01-01 6.9000001 english 203 | 7 Sivas 2014-01-01 7.69999981 english 204 | 8 Black Souls 2014-01-01 7.0999999 english 205 | 9 Three Hearts 2014-01-01 5.80000019 French 206 | 10 Pasolini 2014-01-01 5.80000019 english 207 | 11 Le dernier coup de marteau 2014-01-01 6.5 english 208 | 12 Manglehorn 2014-01-01 7.0999999 english 209 | 13 Hungry Hearts 2014-01-01 6.4000001 English 210 | 14 Belye nochi pochtalona Alekseya Tryapitsyna 2014-01-01 6.9000001 Russian 211 | 15 99 Homes 2014-01-01 7.30000019 english 212 | 16 The Cut 2014-01-01 6 Armenian 213 | 17 Birdman: Or (The Unexpected Virtue of Ignorance) 2014-01-01 8 English 214 | 18 La rançon de la gloire 2014-01-01 5.69999981 French 215 | 19 A Pigeon Sat on a Branch Reflecting on Existence 2014-01-01 7.19999981 english 216 | 20 Tales 2014-01-01 6.80000019 english 217 | 21 The Wonders 2014-01-01 6.80000019 Italian 218 | 22 Foxcatcher 2014-01-01 7.19999981 English 219 | 23 Mr. Turner 2014-01-01 7 English 220 | 24 Jimmy's Hall 2014-01-01 6.69999981 English 221 | 25 The Homesman 2014-01-01 6.5999999 English 222 | 26 The Captive 2014-01-01 5.9000001 english 223 | 27 Goodbye to Language 2014-01-01 6.19999981 French 224 | 28 The Search 2014-01-01 6.9000001 French 225 | 29 Still the Water 2014-01-01 6.9000001 Japanese 226 | 30 Mommy 2014-01-01 8.30000019 French 227 | 31 Two Days, One Night 2014-01-01 7.4000001 French 228 | 32 Maps to the Stars 2014-01-01 6.4000001 English 229 | 33 Saint Laurent 2014-01-01 6.5 French 230 | 34 Clouds of Sils Maria 2014-01-01 6.9000001 english 231 | 35 Winter Sleep 2014-01-01 8.5 Turkish 232 | 1 Chuang ru zhe 2014-01-01 6.19999981 english 233 | 4 Far from Men 2014-01-01 7.5 english 234 | \. 235 | 236 | 237 | -- 238 | -- Data for Name: meta_fields_templates; Type: TABLE DATA; Schema: public; Owner: benoror 239 | -- 240 | 241 | COPY meta_fields_templates (id, table_name, description, template) FROM stdin; 242 | 1 films film_basic_template [{"key": "title", "type": "input", "templateOptions": {"type": "text", "label": "El Titulo"}}, {"key": "director", "type": "input", "templateOptions": {"type": "text", "label": "El Mero Mero Director"}}] 243 | \. 244 | 245 | 246 | -- 247 | -- Name: _fields_templates_pkey; Type: CONSTRAINT; Schema: public; Owner: benoror 248 | -- 249 | 250 | ALTER TABLE ONLY meta_fields_templates 251 | ADD CONSTRAINT _fields_templates_pkey PRIMARY KEY (id); 252 | 253 | 254 | -- 255 | -- Name: director_pkey; Type: CONSTRAINT; Schema: public; Owner: benoror 256 | -- 257 | 258 | ALTER TABLE ONLY director 259 | ADD CONSTRAINT director_pkey PRIMARY KEY (id); 260 | 261 | 262 | -- 263 | -- Name: film_pkey; Type: CONSTRAINT; Schema: public; Owner: benoror 264 | -- 265 | 266 | ALTER TABLE ONLY films 267 | ADD CONSTRAINT film_pkey PRIMARY KEY (id); 268 | 269 | 270 | -- 271 | -- Name: public; Type: ACL; Schema: -; Owner: benoror 272 | -- 273 | 274 | REVOKE ALL ON SCHEMA public FROM PUBLIC; 275 | REVOKE ALL ON SCHEMA public FROM benoror; 276 | GRANT ALL ON SCHEMA public TO benoror; 277 | GRANT ALL ON SCHEMA public TO PUBLIC; 278 | 279 | 280 | -- 281 | -- PostgreSQL database dump complete 282 | -- 283 | 284 | -------------------------------------------------------------------------------- /ember-cli-build.js: -------------------------------------------------------------------------------- 1 | /*jshint node:true*/ 2 | /* global require, module */ 3 | var EmberAddon = require('ember-cli/lib/broccoli/ember-addon'); 4 | 5 | module.exports = function(defaults) { 6 | var app = new EmberAddon(defaults, { 7 | // Add options here 8 | }); 9 | 10 | /* 11 | This build file specifies the options for the dummy test app of this 12 | addon, located in `/tests/dummy` 13 | This build file does *not* influence how the addon or the app using it 14 | behave. You most likely want to be modifying `./index.js` or app's build file 15 | */ 16 | 17 | return app.toTree(); 18 | }; 19 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | /* jshint node: true */ 2 | 'use strict'; 3 | 4 | module.exports = { 5 | name: 'ember-postgrest-dynamic-ui' 6 | }; 7 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ember-postgrest-dynamic-ui", 3 | "version": "0.0.0", 4 | "description": "The default blueprint for ember-cli addons.", 5 | "directories": { 6 | "doc": "doc", 7 | "test": "tests" 8 | }, 9 | "scripts": { 10 | "build": "ember build", 11 | "start": "ember server", 12 | "test": "ember try:testall" 13 | }, 14 | "repository": "", 15 | "engines": { 16 | "node": ">= 0.10.0" 17 | }, 18 | "author": "", 19 | "license": "MIT", 20 | "devDependencies": { 21 | "broccoli-asset-rev": "^2.4.2", 22 | "ember-ajax": "0.7.1", 23 | "ember-bootstrap": "0.8.0", 24 | "ember-cli": "2.5.0", 25 | "ember-cli-app-version": "^1.0.0", 26 | "ember-cli-dependency-checker": "^1.2.0", 27 | "ember-cli-htmlbars": "^1.0.3", 28 | "ember-cli-htmlbars-inline-precompile": "^0.3.1", 29 | "ember-cli-inject-live-reload": "^1.4.0", 30 | "ember-cli-jshint": "^1.0.0", 31 | "ember-cli-qunit": "^1.4.0", 32 | "ember-cli-release": "0.2.8", 33 | "ember-cli-sri": "^2.1.0", 34 | "ember-cli-uglify": "^1.2.0", 35 | "ember-data": "^2.5.0", 36 | "ember-disable-prototype-extensions": "^1.1.0", 37 | "ember-export-application-global": "^1.0.5", 38 | "ember-jsoneditor": "0.1.2", 39 | "ember-load-initializers": "^0.5.1", 40 | "ember-resolver": "^2.0.3", 41 | "loader.js": "^4.0.1" 42 | }, 43 | "keywords": [ 44 | "ember-addon" 45 | ], 46 | "dependencies": { 47 | "ember-cli-babel": "^5.1.6", 48 | "ember-cli-htmlbars": "^1.0.8", 49 | "ember-formly": "0.0.0" 50 | }, 51 | "ember-addon": { 52 | "configPath": "tests/dummy/config" 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /testem.js: -------------------------------------------------------------------------------- 1 | /*jshint node:true*/ 2 | module.exports = { 3 | "framework": "qunit", 4 | "test_page": "tests/index.html?hidepassed", 5 | "disable_watching": true, 6 | "launch_in_ci": [ 7 | "PhantomJS" 8 | ], 9 | "launch_in_dev": [ 10 | "PhantomJS", 11 | "Chrome" 12 | ] 13 | }; 14 | -------------------------------------------------------------------------------- /tests/.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "predef": [ 3 | "document", 4 | "window", 5 | "location", 6 | "setTimeout", 7 | "$", 8 | "-Promise", 9 | "define", 10 | "console", 11 | "visit", 12 | "exists", 13 | "fillIn", 14 | "click", 15 | "keyEvent", 16 | "triggerEvent", 17 | "find", 18 | "findWithAssert", 19 | "wait", 20 | "DS", 21 | "andThen", 22 | "currentURL", 23 | "currentPath", 24 | "currentRouteName" 25 | ], 26 | "node": false, 27 | "browser": false, 28 | "boss": true, 29 | "curly": true, 30 | "debug": false, 31 | "devel": false, 32 | "eqeqeq": true, 33 | "evil": true, 34 | "forin": false, 35 | "immed": false, 36 | "laxbreak": false, 37 | "newcap": true, 38 | "noarg": true, 39 | "noempty": false, 40 | "nonew": false, 41 | "nomen": false, 42 | "onevar": false, 43 | "plusplus": false, 44 | "regexp": false, 45 | "undef": true, 46 | "sub": true, 47 | "strict": false, 48 | "white": false, 49 | "eqnull": true, 50 | "esnext": true, 51 | "unused": true 52 | } 53 | -------------------------------------------------------------------------------- /tests/dummy/app/adapters/application.js: -------------------------------------------------------------------------------- 1 | import PostgRESTAdapter from "ember-postgrest-dynamic-ui/adapter"; 2 | 3 | export default PostgRESTAdapter.extend({ 4 | host: 'http://localhost:3000' 5 | }); 6 | -------------------------------------------------------------------------------- /tests/dummy/app/app.js: -------------------------------------------------------------------------------- 1 | import Ember from 'ember'; 2 | import Resolver from './resolver'; 3 | import loadInitializers from 'ember-load-initializers'; 4 | import config from './config/environment'; 5 | 6 | let App; 7 | 8 | Ember.MODEL_FACTORY_INJECTIONS = true; 9 | 10 | App = Ember.Application.extend({ 11 | modulePrefix: config.modulePrefix, 12 | podModulePrefix: config.podModulePrefix, 13 | Resolver 14 | }); 15 | 16 | loadInitializers(App, config.modulePrefix); 17 | 18 | export default App; 19 | -------------------------------------------------------------------------------- /tests/dummy/app/components/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/benoror/ember-postgrest-dynamic-ui/244236859b997d5fc429c480431e193c65a1f704/tests/dummy/app/components/.gitkeep -------------------------------------------------------------------------------- /tests/dummy/app/components/data-table-field.js: -------------------------------------------------------------------------------- 1 | import Ember from 'ember'; 2 | 3 | const { 4 | get, 5 | computed 6 | } = Ember; 7 | 8 | export default Ember.Component.extend({ 9 | field: computed('record', 'column', function() { 10 | return get(this, 'record')[get(this, 'column').name]; 11 | }), 12 | 13 | isInPKey: computed('options', 'column', function() { 14 | const pkey = get(this, 'options').pkey; 15 | return pkey.indexOf(get(this, 'column').name) > -1; 16 | }) 17 | }); 18 | -------------------------------------------------------------------------------- /tests/dummy/app/components/data-table.js: -------------------------------------------------------------------------------- 1 | import Ember from 'ember'; 2 | 3 | export default Ember.Component.extend({ 4 | }); 5 | -------------------------------------------------------------------------------- /tests/dummy/app/components/tables-menu.js: -------------------------------------------------------------------------------- 1 | import Ember from 'ember'; 2 | 3 | export default Ember.Component.extend({ 4 | }); 5 | -------------------------------------------------------------------------------- /tests/dummy/app/controllers/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/benoror/ember-postgrest-dynamic-ui/244236859b997d5fc429c480431e193c65a1f704/tests/dummy/app/controllers/.gitkeep -------------------------------------------------------------------------------- /tests/dummy/app/helpers/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/benoror/ember-postgrest-dynamic-ui/244236859b997d5fc429c480431e193c65a1f704/tests/dummy/app/helpers/.gitkeep -------------------------------------------------------------------------------- /tests/dummy/app/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 |8 | {{column.name}} 9 | | 10 | {{/each}} 11 |
---|
18 | {{data-table-field 19 | record=record 20 | column=column 21 | options=options 22 | table_name=table_name 23 | template=template}} 24 | | 25 | {{/each}} 26 |