Skip to content

Instantly share code, notes, and snippets.

View pavloo's full-sized avatar
🎯
Focusing

Pavlo Osadchyi pavloo

🎯
Focusing
View GitHub Profile
createRegularPayment: (period) ->
payment = @get('store').createRecord('RegularPayment',
{
period: period.period
date: period.date
})
template = @get('store').createRecord('paymentTemplate',
{
title: @get('paymentTitle')
createRegularPayment: (period) ->
payment = @get('store').createRecord('RegularPayment',
{
period: period.period
date: period.date
})
payment.save().then (regular) ->
console.log 'here'
template = @get('store').createRecord('paymentTemplate',
{
Application = Ember.Route.extend
model: (_, transition)->
@_needsAuth(transition.targetName) and @store.find('user', 'current').catch( =>
@transitionTo('sign_in')
Ember.RSVP.resolve()
)
needs: 'application'.w()
...
currentUser = @get('controllers.application.model')
initialize: (container, application)->
shared = container.lookup('globals:shared')
shared.set('auth.token', window.localStorage.auth_token)
initialize: (container, application)->
sharedStore = Ember.Object.create()
auth = Ember.Object.extend
token: null
currentUser: (->
result = application.LoginLogic.retrieveCurrentUser(@get('token'))
if result
{{else}}
{{#view Teachertrainingv2.Carousel contentBinding="carouselCuepoints"}}
{{view view.itemsView}}
<a class="carousel-control left cur-ptr" data-slide="prev" {{action "previousSlide" target="view"}}>
<span class="glyphicon glyphicon-chevron-left"></span>
</a>
<a class="carousel-control right cur-ptr" data-slide="next" {{action "nextSlide" target="view"}}>
<span class="glyphicon glyphicon-chevron-right"></span>
</a>
<p class="text-center carousel-pos">
@pavloo
pavloo / gist:cfc4ff41741d43fdb04b
Created July 22, 2014 15:52
Metaprog in Ember
Ember.Application.initializer({
name: 'authenticated-routes',
after: 'simple-auth',
initialize: function(container, application) {
var routeNames = Object.keys(Teachertrainingv2.Router.router.recognizer.names),
routeObj = null;
var systemRoutes = ['loading', 'error', 'application'];
var routesWithoutAuth = systemRoutes.concat(Teachertrainingv2.ROUTES_NOT_REQUIRE_AUTHENTICATION);
@pavloo
pavloo / application.controller.js
Created February 9, 2016 20:42
Nested Routes Hooks
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle'
});
@pavloo
pavloo / application.controller.js
Last active March 16, 2016 23:21
registerWaiter illustartion
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
actions: {
insert(){
// set timeout is used intentionally
// (instead of Ember.run.later)
setTimeout(()=>{