diff options
Diffstat (limited to 'src/guff/views/tab.cr')
-rw-r--r-- | src/guff/views/tab.cr | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/guff/views/tab.cr b/src/guff/views/tab.cr new file mode 100644 index 0000000..6a354b4 --- /dev/null +++ b/src/guff/views/tab.cr @@ -0,0 +1,21 @@ +require "./view" + +class Guff::Views::TabView < Guff::Views::View + def initialize( + context : Context, + @prefix : String, + @tab : Hash(Symbol, String) + ) + super(context) + @id = h("%s-tab-%s" % [@prefix, @tab[:id]]) as String + @target = h("%s-pane-%s" % [@prefix, @tab[:id]]) as String + end + + private def v(id : Symbol) : String + raise "unknown id: #{id}" unless @tab.has_key?(id) + h(@tab[id]) + end + + ECR.def_to_s("src/views/tab.ecr") +end + |