Last active
April 27, 2016 06:33
-
-
Save tamebadger/984967a29d5c7cdc430e5e878cf5fc70 to your computer and use it in GitHub Desktop.
Modal Navigation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Component.extend({ | |
modalNavigation: Ember.inject.service(), | |
isOpen: Ember.computed.alias('modalNavigation.modalOpen'), | |
classNameBindings: ['isOpen:modalDialog:notOpen'], | |
actions: { | |
close(){ | |
this.get('modalNavigation').closeModal() | |
} | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
import config from './config/environment'; | |
const Router = Ember.Router.extend({ | |
location: 'none' | |
}); | |
Router.map(function() { | |
this.route('needsmodal') | |
this.route('nonemodal') | |
this.route('hasmodal') | |
}); | |
export default Router; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Route.extend({ | |
init(...args){ | |
this._super(args) | |
console.log('init') | |
}, | |
modalNavigation: Ember.inject.service(), | |
beforeModel(){ | |
console.log('openingModal') | |
this.get('modalNavigation').openModal() | |
}, | |
model(){ | |
return {} | |
}, | |
deactivate(){ | |
console.log('closingModal') | |
this.get('modalNavigation').openModal() | |
}, | |
actions: { | |
onClose(){ | |
console.log('we want to close route') | |
} | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Route.extend({ | |
actions: { | |
onClose(){ | |
console.log('we want to close route') | |
} | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Route.extend({ | |
init(...args){ | |
this._super(args) | |
console.log('init') | |
}, | |
modalNavigation: Ember.inject.service(), | |
beforeModel(){ | |
console.log('openingModal') | |
this.get('modalNavigation').openModal() | |
}, | |
model(){ | |
return {} | |
}, | |
deactivate(){ | |
console.log('closingModal') | |
this.get('modalNavigation').openModal() | |
}, | |
actions: { | |
onClose(){ | |
console.log('we want to close route') | |
} | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.notOpen { | |
display: none; | |
} | |
.modalDialog { | |
display: block; | |
position: fixed; | |
z-index: 1; | |
left: 0; | |
top: 0; | |
width: 100%; | |
height: 100%; | |
overflow: auto; | |
background-color: rgb(0,0,0); | |
background-color: rgba(0,0,0,0.4); | |
} | |
.modalDialog > div { | |
width: 200px; | |
position: relative; | |
margin: 10% auto; | |
padding: 5px 20px 13px 20px; | |
background: #fff; | |
} | |
.close:hover { | |
background: #00d9ff; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "0.7.2", | |
"EmberENV": { | |
"FEATURES": {} | |
}, | |
"options": { | |
"use_pods": false, | |
"enable-testing": false | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js", | |
"ember": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/2.4.4/ember.debug.js", | |
"ember-data": "https://cdnjs.cloudflare.com/ajax/libs/ember-data.js/2.4.3/ember-data.js", | |
"ember-template-compiler": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/2.4.4/ember-template-compiler.js" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment