Marek Piasecki
6 years ago
commit
ce202ca54b
6 changed files with 72 additions and 0 deletions
@ -0,0 +1,5 @@ |
|||
tag not_found |
|||
|
|||
def render |
|||
<self> |
|||
<h1> 'Page not found' |
@ -0,0 +1,33 @@ |
|||
tag ref < a |
|||
|
|||
prop view |
|||
prop target |
|||
prop go |
|||
|
|||
attr onclick |
|||
|
|||
def setup |
|||
@r = R |
|||
|
|||
def render |
|||
<self.active=is_active href=link onclick='return false'> |
|||
|
|||
def is_active |
|||
var view, params |
|||
[ view, params ] = @r.split_path(link) |
|||
view == @r:view && L.isEqual params, @r:params |
|||
|
|||
def ontap e |
|||
return if is_active |
|||
@r.go dom:href |
|||
window.scrollTo 0, 0 |
|||
|
|||
def link |
|||
@go || url |
|||
|
|||
def url |
|||
if @target |
|||
var 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 |
@ -0,0 +1,14 @@ |
|||
global:Router = require('pro-router') |
|||
require './ref/ref' |
|||
require './switch/switch' |
|||
require './not_found/not_found' |
|||
|
|||
tag router |
|||
|
|||
def setup |
|||
@r = R |
|||
@t = Imba:TAGS |
|||
|
|||
def render |
|||
self:__:A = self:__:A || {} |
|||
<self> ( self:__:A[@r:view] || self:__:A[@r:view] = @t[@r:view.toUpperCase]() ).end |
@ -0,0 +1,18 @@ |
|||
require './switch.scss' |
|||
|
|||
tag switch |
|||
|
|||
prop key |
|||
prop disable |
|||
|
|||
def setup |
|||
@r = R |
|||
|
|||
def render |
|||
<self.is_on=is_on .disabled=@disable> |
|||
|
|||
def is_on |
|||
@r:params[@key] |
|||
|
|||
def ontap |
|||
@r.toggle key unless @disable |
@ -0,0 +1 @@ |
|||
._switch{ cursor: pointer } |
Loading…
Reference in new issue