TODO in masterview-0.2.3 vs TODO in masterview-0.2.4
- old
+ new
@@ -34,16 +34,28 @@
--####################
DSL for creating directives
maybe something like
-event :etag => [:object, :method, :options, :html_options] do
- # creates @dcs, @args, @object, @method, @options, @html_options, and we already have attr_value and attrs
- # the array of symbols is used for string args found in attr_value
- # here we build up the response
- outargs = []
- outargs << quote_if_simple_word(@object)
- outargs << quote_if_simple_word(@method)
- outargs << @options unless @options.to_s.empty?
- outargs << @html_options unless @html_options.to_s.empty?
- erb_output( 'test '+outargs.join(', ') )
-end
+event :stag do |e|
+ # these read args consecutively out of parse(attr_value)
+ e.attr_arg :object, :quote_if => true
+ e.attr_arg :foo { |t| t.upcase } # modifying case of foo
+ e.attr_arg :link_name { self.content } #overriding with different value
+ e.attr_arg :options, :optional => {} # specify that is optional but provide default if it is needed
+ e.attr_arg :html_options, :merge_common => true, :merge => [:size, :rows] # merge in common and specified attributes
+
+ a = a+1 # do some other logic
+
+ old_content = e.content # retrieving content of tag
+ e.content = 'foo' # resetting content of tag
+ yield_contents = e.yield()
+
+ e.erb_code_render 'a = a + 1' # render <% a = a + 1 %>
+ e.erb_content_render 'text_area' args(:object, :foo, :link_name, :options, :html_options) # render <%= %>, args handles joining the args with comma, and also takes into account if last args are not empty that other args are either provided also or defaulted.
+
+ e.render 'direct render' # direct render as is
+end
+
+- default generate to *.rhtml if nothing is specified
+
+
\ No newline at end of file