Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save bendemboski/b510208ca5d0ee18dc094d005fd001ac to your computer and use it in GitHub Desktop.
Save bendemboski/b510208ca5d0ee18dc094d005fd001ac to your computer and use it in GitHub Desktop.
glossary app demo
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
import Ember from 'ember';
export function myHelper([str]) {
let div = document.createElement('div');
str.split('\n').forEach((str) => {
div.appendChild(document.createTextNode(str));
div.appendChild(document.createElement('br'));
});
return Ember.String.htmlSafe(div.innerHTML);
}
export default Ember.Helper.helper(myHelper);
import Model from 'ember-data/model';
import attr from 'ember-data/attr';
import { belongsTo, hasMany } from 'ember-data/relationships';
export default Model.extend({
term: attr('string'),
url: attr('string'),
definitions: attr()
});
import EmberRouter from '@ember/routing/router';
import config from './config/environment';
const Router = EmberRouter.extend({
location: 'none',
rootURL: config.rootURL
});
Router.map(function() {
this.route('ember-data')
});
export default Router;
import Ember from 'ember';
export default Ember.Route.extend({
model() {
return [
{
url: "https://www.glossary.oilfield.slb.com/en/Terms/c/coal-seam_gas.aspx",
term: "coal-seam gas",
definitions: [
{
speech_type: "n.",
category: "Geology",
definition: "Abbreviation for coal seam gas. Natural gas, predominantly methane [CH4], generated during coal formation and adsorbed in coal. Natural gas adsorbs to the surfaces of matrix pores within the coal and natural fractures, or cleats, as reservoir pressure increases. \n Production of natural gas from coal requires decreasing the pore pressure below the coal\u2019s desorption pressure so that methane will desorb from surfaces, diffuse through the coal matrix and become free gas. Because the diffusivity and permeability of the coal matrix are ultralow, coal must have an extensive cleat system to ensure adequate permeability and flow of methane to wellbores at economic production rates.\n Coal seams are typically saturated with water. Consequently, the coal must be dewatered for efficient gas production. Dewatering reduces the hydrostatic pressure and promotes gas desorption from coal. As dewatering progresses, gas production often increases at a rate governed by how quickly gas desorbs from coal, the permeability of the cleat and the relative permeability of the gas-water system in the cleat. Eventually, the rate and amount of gas desorption decreases as the coal seam is depleted of its gas, and production declines.\n Coal seams with no water (dry coal) have been discovered and commercially exploited. In these reservoirs, the adsorbed gas is held in place by free gas in the cleats. Consequently, gas production consists of both free gas from the cleat system and desorbed gas from the matrix.",
see: [
{
title: "unconventional resource",
link: "https://www.glossary.oilfield.slb.com/en/Terms/u/unconventional_resource.aspx"
}
],
more_details: [
{
title: "Learning to Produce Coalbed Methane",
link: "http://www.slb.com/resources/publications/industry_articles/oilfield_review/1991/or1991jan04_methane.aspx"
},
{
title: "Producing Natural Gas from Coal",
link: "http://www.slb.com/resources/publications/industry_articles/oilfield_review/2003/or2003aut02_gas_from_coal.aspx"
},
{
title: "Coalbed Methane: Clean Energy for the World",
link: "http://www.slb.com/resources/publications/industry_articles/oilfield_review/2009/or2009sum01_coalbed_methane.aspx"
}
],
synonyms: [
{
title: "coalbed methane",
link: "https://www.glossary.oilfield.slb.com/en/Terms/c/coalbed_methane.aspx"
},
{
title: "coal bed methane",
link: "https://www.glossary.oilfield.slb.com/en/Terms/c/coal_bed_methane.aspx"
},
{
title: "coal-bed methane",
link: "https://www.glossary.oilfield.slb.com/en/Terms/c/coal-bed_methane.aspx"
},
{
title: "CBM",
link: "https://www.glossary.oilfield.slb.com/en/Terms/c/cbm.aspx"
}
],
antonyms: [],
alternate_forms: "coal seam gas, CSG",
image: {
src: "https://www.glossary.oilfield.slb.com/en/Terms/c/en/~/media/PublicMedia/geology/coalbedMethane01.ashx",
caption: "Gas adsorption and desorption in coal. During coalification, the matrix shrinks, creating orthogonal fractures called cleats."
}
}
]
},
]
}
});
import Ember from 'ember';
export default Ember.Route.extend({
model() {
this.store.createRecord('term',
{
url: "https://www.glossary.oilfield.slb.com/en/Terms/c/coal-seam_gas.aspx",
term: "coal-seam gas",
definitions: [
{
speech_type: "n.",
category: "Geology",
definition: "Natural gas, predominantly methane [CH4], generated during coal formation and adsorbed in coal.",
see: [
{
title: "unconventional resource",
link: "https://www.glossary.oilfield.slb.com/en/Terms/u/unconventional_resource.aspx"
}
],
more_details: [
{
title: "Learning to Produce Coalbed Methane",
link: "http://www.slb.com/resources/publications/industry_articles/oilfield_review/1991/or1991jan04_methane.aspx"
},
{
title: "Producing Natural Gas from Coal",
link: "http://www.slb.com/resources/publications/industry_articles/oilfield_review/2003/or2003aut02_gas_from_coal.aspx"
},
{
title: "Coalbed Methane: Clean Energy for the World",
link: "http://www.slb.com/resources/publications/industry_articles/oilfield_review/2009/or2009sum01_coalbed_methane.aspx"
}
],
synonyms: [
{
title: "coalbed methane",
link: "https://www.glossary.oilfield.slb.com/en/Terms/c/coalbed_methane.aspx"
},
{
title: "coal bed methane",
link: "https://www.glossary.oilfield.slb.com/en/Terms/c/coal_bed_methane.aspx"
},
{
title: "coal-bed methane",
link: "https://www.glossary.oilfield.slb.com/en/Terms/c/coal-bed_methane.aspx"
},
{
title: "CBM",
link: "https://www.glossary.oilfield.slb.com/en/Terms/c/cbm.aspx"
}
],
antonyms: [],
alternate_forms: "coal seam gas, CSG",
image: {
src: "https://www.glossary.oilfield.slb.com/en/Terms/c/en/~/media/PublicMedia/geology/coalbedMethane01.ashx",
caption: "Gas adsorption and desorption in coal. During coalification, the matrix shrinks, creating orthogonal fractures called cleats."
}
}
]
}
)
return this.store.peekAll('term')
}
});
{{#each model as |term|}}
<p>{{term.term}}</p>
{{#each term.definitions as |def|}}
<div>{{def.speech_type}} [{{def.category}}]</div>
{{my-helper def.definition}}
{{/each}}
{{/each}}
{{#each model as |term|}}
<div>{{term.term}}</div>
{{#each term.definitions as |def|}}
<div>{{def.category}}</div>
{{#each def.see as |see|}}
{{see.title}}
{{/each}}
{{/each}}
{{/each}}
{
"version": "0.15.1",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js",
"ember": "3.4.3",
"ember-template-compiler": "3.4.3",
"ember-testing": "3.4.3"
},
"addons": {
"ember-data": "3.4.2"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment