Skip to content

Instantly share code, notes, and snippets.

View zarkomilosevic's full-sized avatar

Zarko Milosevic zarkomilosevic

View GitHub Profile
'user strict'
import {ReduceStore} from 'flux/utils';
import TodoDispatcher from './TodoDispatcher';
import TodoActionTypes from './TodoActionTypes';
class TodoErrorsStore extends ReduceStore {
constructor(){
super(TodoDispatcher);
@zarkomilosevic
zarkomilosevic / routes.rb
Last active August 31, 2017 20:16
todomvc rails CRUD routes
Rails.application.routes.draw do
root 'todos#index'
resources :todos, only: [:index, :create, :update, :destroy] do
member do
put :toggle
end
collection do
/**
* Created by zarko on 7/2/17.
*/
'use strict';
import * as jQuery from 'jquery';
import * as Immutable from 'immutable';
import TodoActionTypes from './TodoActionTypes';
import TodoDispatcher from './TodoDispatcher';
def get_all
@todos = Todo.all
render json: @todos
end
def create
@todo = Todo.create(todo_params)
respond_to do |format|
format.json do
import * as Immutable from 'immutable';
const Todo = Immutable.Record({
id:'',
complete:false,
text:'',
});
export default Todo;
<section id="todoapp"></section>
<footer id="info">
<p>Double-click to edit a todo</p>
<p>Part of <a href="http://todomvc.com">TodoMVC</a></p>
</footer>
<%= javascript_pack_tag 'todoApp' %>
<%= stylesheet_pack_tag 'todoApp' %>
'use strict';
import AppContainer from '../todoApp/containers/AppContainer';
import React from 'react';
import ReactDOM from 'react-dom';
import '../todoApp/assets/base.css';
ReactDOM.render(<AppContainer />, document.getElementById('todoapp'));