You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
707 B
39 lines
707 B
require('pro-router')
|
|
|
|
tag router
|
|
def render
|
|
<self view=R.view> <{ view }>
|
|
|
|
tag switch
|
|
prop key
|
|
prop disabled
|
|
|
|
css cursor:pointer
|
|
|
|
def render
|
|
<self .activated=R.params[key] .disabled=disabled @click.if(!disabled)=R.toggle(key)> <slot>
|
|
|
|
tag ref < a
|
|
prop view
|
|
prop target
|
|
prop go
|
|
|
|
def render
|
|
<self .active=active? href=link @click.prevent.if(!active?)=R.go(href)> <slot>
|
|
|
|
def active?
|
|
R.to_path == link
|
|
|
|
get link do #link ||= go || url
|
|
|
|
#tu skonczylem:
|
|
|
|
def url
|
|
if target
|
|
let attributes = L.reduce L.concat({}, target), do |map, el|
|
|
map[el:type] = el:id
|
|
map
|
|
R.to_path view, L.defaults attributes || {}, R:safe_params
|
|
|
|
tag not_found
|
|
def render do <self> "Page not found :/"
|
|
|