From 8222543d359017880aa6055d8bab8c2b62eb7c86 Mon Sep 17 00:00:00 2001 From: Marek Piasecki Date: Tue, 10 Jan 2023 13:18:10 +0100 Subject: [PATCH] move router tag & shape it to working and useful form --- router_tag.imba | 39 --------------------------------------- src/router_tag.imba | 29 +++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 39 deletions(-) delete mode 100644 router_tag.imba create mode 100644 src/router_tag.imba diff --git a/router_tag.imba b/router_tag.imba deleted file mode 100644 index 550bac6..0000000 --- a/router_tag.imba +++ /dev/null @@ -1,39 +0,0 @@ -require('pro-router') - -tag router - def render - <{ view }> - -tag switch - prop key - prop disabled - - css cursor:pointer - - def render - - -tag ref < a - prop view - prop target - prop go - - def render - - - 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 "Page not found :/" diff --git a/src/router_tag.imba b/src/router_tag.imba new file mode 100644 index 0000000..058901c --- /dev/null +++ b/src/router_tag.imba @@ -0,0 +1,29 @@ +tag toggle + prop param + prop disabled + + css cursor:pointer cursor.disabled:default + + def render + + +tag ref-f # f - forget current params in new destination + prop view + prop target = {} + prop go + + def render + let link = go || url + + + get url + R.to_path view, target + +tag ref < ref-f + get url + #target = JSON.parse JSON.stringify(target) # duplicate object + #target[k] ||= v for own k, v of R.safe_params + R.to_path view, #target + +tag not_found +

"Page not found :(" \ No newline at end of file