Skip to content

Instantly share code, notes, and snippets.

Model relationship mixins

Some mixins for managing model relationships.

  • belongsTo('this-model-name', 'to-model-name')
  • hasMany('this-model-name', 'has-model-name')
  • hasManyThrough('this-model-name', 'has-model-name', 'through-model-name')

The mixins are returned by factory functions that take standard arguments to create methods and properties based on the model names provided.

Example: Create Models

Model Buffered Proxy Mixin

Makes it easy to work with models through a buffered proxy. Designed to work with the model relationship mixins and supports an identical API for buffered relationship management. This builds on the functionality of the Ember Buffered Proxy library.

New States

Normally a model has two states:

  • Clean: no unsaved changes
  • Dirty: some unsaved changes

A buffered model has four states:

  • Clean: no unsaved changes
#column-a {
@include grid-column; // make it a column
@include grid(6); // make it 6 columns wide
}
#column-b {
@include grid-column(6); // make it a column, 6 columns wide
}
#column-c {
@include grid-column; // make it a column
@include grid-plus(6, -10px); // make it 6 columns wide, minus padding
@heygrady
heygrady / background-box.css
Created February 19, 2011 00:58
CSS Rounded Corners
/* multiple backgrounds */
/* Firefox 3.6+, Safari, Chrome, IE 9 */
.box {
background:
url(corner2-tl.png) left top no-repeat,
url(corner2-tr.png) right top no-repeat,
url(corner2-br.png) right bottom no-repeat,
url(corner2-bl.png) left bottom no-repeat,
url(corner-t.png) left top repeat-x,
url(corner-b.png) left bottom repeat-x,
@heygrady
heygrady / blur.css
Created March 10, 2011 01:41
simple red text-shadow
h1 {
color: #00ff00;
filter: progid:DXImageTransform.Microsoft.Blur(pixelradius=2);
}
@heygrady
heygrady / _ui-corners.scss
Last active September 26, 2015 21:27
jQuery Corners Plugin
//-----------------------------------------------
// Variables
//-----------------------------------------------
$ui-corners-cache-buster: true !default;
// default widths
$ui-corners-corner-height: 10px !default;
$ui-corners-corner-width: 10px !default;
$ui-corners-side-width: 10px !default;
@heygrady
heygrady / fixed.css
Created April 22, 2012 06:14
Fluid Grid
#container {
width: 960px;
margin: 0 auto;
}
[role="main"] {
width: auto;
margin: 0 0;
}
@heygrady
heygrady / final.css
Created May 27, 2012 19:56
Adaptive Images with CSS
/* place these styles in your global stylesheet */
.image {
display: -moz-inline-box;
-moz-box-orient: vertical;
display: inline-block;
vertical-align: middle;
*vertical-align: auto;
font: 0/0 serif;
text-shadow: none;
color: transparent;
import Ember from 'ember';
import SearchableSelect from 'ember-searchable-select/components/searchable-select';
import layout from './template';
const menuSelector = '.Searchable-select__options-list-scroll-wrapper';
export default SearchableSelect.extend({
layout,
classNames: ['Searchable-select-infinite'],
[
{
"id": 1,
"date": "2016-05-10T07:25:45",
"date_gmt": "2016-05-10T07:25:45",
"guid": {
"rendered": "https://demo.wp-api.org/?p=1"
},
"modified": "2016-05-10T07:25:45",
"modified_gmt": "2016-05-10T07:25:45",