Marek Piasecki
2 years ago
3 changed files with 35 additions and 0 deletions
@ -1 +1,3 @@ |
|||
import "pro-router/standalone" |
|||
import "./router.imba" |
|||
import "./main.imba" |
@ -0,0 +1,33 @@ |
|||
tag pro-router |
|||
prop view |
|||
<self><{ "view-{view || R.view }" }> |
|||
|
|||
tag pro-toggle |
|||
prop param |
|||
prop disabled |
|||
|
|||
css cursor:pointer cursor.disabled:default |
|||
|
|||
def render |
|||
<self.activated=R.params[param] .disabled=disabled @click.if(!disabled)=R.toggle(param)><slot> |
|||
|
|||
tag pro-ref-f < a # f - forget current params in new destination |
|||
prop view |
|||
prop params = {} |
|||
prop go |
|||
|
|||
def render |
|||
let link = go || url |
|||
<self[d:inline].active=(R.to_path! == link) href=link @click.prevent=(R.go(link); window.scrollTo(0,0))><slot> |
|||
|
|||
get url |
|||
R.to_path view, params |
|||
|
|||
tag pro-ref < pro-ref-f |
|||
get url |
|||
#params = JSON.parse JSON.stringify(params) # duplicate object |
|||
#params[k] ||= v for own k, v of R.safe_params |
|||
R.to_path view, #params |
|||
|
|||
tag view-not_found |
|||
<self><h1> "Page not found :(" |
Loading…
Reference in new issue