Skip to content

Commit

Permalink
JSON deprecated, welcome YAML
Browse files Browse the repository at this point in the history
  • Loading branch information
@soyjavi committed May 8, 2014
1 parent 38d4c77 commit 7cee239
Show file tree
Hide file tree
Showing 11 changed files with 228 additions and 253 deletions.
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
class Atoms.Organism.Menu extends Atoms.Organism.Aside

@scaffold "assets/scaffold/menu.json"
@scaffold "assets/scaffold/aside.json"

ALL_LABEL = "Todas"

render: ->
super
KulturKlik.proxy("GET", "categories").then (error, response) =>
Atoms.Entity.Category.create name: ALL_LABEL
Atoms.Entity.Category.create name: category for category in response.categories
Atoms.Entity.Category.create category for category in response.categories

# Children bubble events
onCategory: (atom, dispatcher, hierarchy...) ->
category = if atom.entity.name isnt ALL_LABEL then atom.entity.name or ""
category = if atom.entity.id? then atom.entity.id or ""
__.Article.Explorer.fetch 0, category
__.Article.Explorer.aside "menu"

Expand Down
27 changes: 27 additions & 0 deletions source/organisms/aside.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
id: aside
method: prepend

children:
- Organism.Header:
children:
- Atom.Heading:
size: h1
text: Categorías
- Organism.Section:
id: categories
style: padding
children:
- Molecule.List:
children: []
id: list
events:
- select
callbacks:
- onCategory
bind:
entity: Category
atom: Atom.Li
events: ["tap"]
create: true
update: false
destroy: false
7 changes: 5 additions & 2 deletions source/organisms/explorer.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,19 @@ class Atoms.Organism.Explorer extends Atoms.Organism.Article
onSectionPull: (event, dispatcher, hierarchy...) ->
do @fetch 0

fetch: (@page=0, @category) ->
fetch: (@page=0, @category=undefined) ->
Atoms.Entity.Event.destroyAll() if @page is 0
@fetching = true

@page++
attributes =
page : @page
started_at: "2014/05/07"
# latitude : 42.85
# longitude : -2.67
# radio : 100

attributes.category = @category if @category
console.log attributes
KulturKlik.proxy("GET", "search", attributes).then (error, response) =>
@today.refresh()
for result in response.results
Expand Down
129 changes: 0 additions & 129 deletions source/organisms/explorer.json

This file was deleted.

92 changes: 92 additions & 0 deletions source/organisms/explorer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
id: explorer
children:
- Organism.Header:
children:
- Atom.Heading:
size: h1
text: KulturKlik
- Molecule.Navigation:
style: left
children:
- Atom.Button:
icon: navicon
path: menu

- Molecule.Navigation:
children:
- Atom.Button:
text: Hoy
path: explorer/today
- Atom.Button:
text: Mañana
path: explorer/tomorrow
- Atom.Button:
text: Favorítos
path: explorer/likes

- Organism.Section:
id: today
events:
- scroll
- pull
children:
- Molecule.List:
children: []
id: list
bind:
entity: Event
atom: Atom.Li
events:
- tap
create: true
update: false
destroy: true
events:
- select
callbacks:
- onEvent

- Organism.Section:
id: tomorrow
events:
- scroll
- pull
children:
- Molecule.List:
id: list
children: []
events:
- select
callbacks:
- onEvent
bind:
entity: Event
atom: Atom.Li
events:
- tap
create: false
update: false
destroy: true


- Organism.Section:
id: likes
events:
- scroll
- pull
children:
- Molecule.List:
id: list
children: []
events:
- select
callbacks:
- onEvent
bind:
entity: Like
atom: Atom.Li
events:
- tap
create: true
update: false
destroy: true
67 changes: 0 additions & 67 deletions source/organisms/item.json

This file was deleted.

Loading

0 comments on commit 7cee239

Please sign in to comment.