Commit 0ff0d801 authored by Florian Hübsch's avatar Florian Hübsch
Browse files

Basic collection setup. Includes:

- Add ancestry gem for tree structure of collections.
- Add some collection seeds.
- Collection API via Grape gem.
- Collection Store/Actions
- Collection Tree View
- Add Navigation component
- Basic Bootstrap Layout
- UIStore/UIActions for Collection Selection
parent 2477a94a
class CollectionSerializer < ActiveModel::Serializer
attributes :id, :label
has_many :children
def children
object.children
end
end
Erfolgreich eingeloggt.
= react_component('Test', {name: 'foo'}, {})
= react_component('App', {}, {})
= link_to 'Ausloggen', destroy_user_session_path, method: :delete
......@@ -16,6 +16,10 @@ Bundler.require(*Rails.groups)
module Chemotion
class Application < Rails::Application
# Grape API config
config.paths.add File.join('app', 'api'), glob: File.join('**', '*.rb')
config.autoload_paths += Dir[Rails.root.join('app', 'api', '*')]
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
......
......@@ -5,5 +5,7 @@ Rails.application.routes.draw do
root to: 'pages#welcome', as: :authenticated_root
end
mount API => '/'
root :to => redirect("/users/sign_in")
end
class CreateCollections < ActiveRecord::Migration
def change
create_table :collections do |t|
t.integer :user_id, null: false, index: true
t.string :ancestry, index: true
t.text :label, null: false
t.timestamps null: false
end
end
end
......@@ -11,11 +11,22 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20150618114948) do
ActiveRecord::Schema.define(version: 20150728120436) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
create_table "collections", force: :cascade do |t|
t.integer "user_id", null: false
t.string "ancestry"
t.text "label", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
add_index "collections", ["ancestry"], name: "index_collections_on_ancestry", using: :btree
add_index "collections", ["user_id"], name: "index_collections_on_user_id", using: :btree
create_table "users", force: :cascade do |t|
t.string "email", default: "", null: false
t.string "encrypted_password", default: "", null: false
......
# create initial test user
User.create!(email: 'test@ninjaconcept.com', password: 'ninjaconcept', password_confirmation: 'ninjaconcept')
u = User.create!(email: 'test@ninjaconcept.com', password: 'ninjaconcept', password_confirmation: 'ninjaconcept')
# create some collections
root_1 = Collection.create!(label: 'All', user_id: u.id)
root_2 = Collection.create!(label: 'Root #2', user_id: u.id)
child = Collection.create!(label: 'Child of Root #2', user_id: u.id, parent: root_2)
grand_child = Collection.create!(label: 'Grandchild', user_id: u.id, parent: child)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment