We will create an index page of a company using metadata. Right now the view is displayed through the index.erb
file. Now, we will use metadata to load this from RhoSync.
These are the steps:
Add the following code to the company source adapter in your RhoSync application. Edit
company.rb
and add following code:def metadata objectlink = { :type => "linkli", :uri => "{{showuri}}", :text => "{{name}}" } list = { :type => "list", :children => [objectlink], :repeatable => "{{@companies}}" } content = { :type => "content", :children => [ list ] } toolbar = { :type => "toolbar", :lefturi => "/app", :righturi => "/app/Company/new", :lefttext => "Home", :righttext => "New"} title = { :title => "Meta Company", :type => "title"} index = { :title => "index", :type => "view", :children => [title, toolbar, content]} {'index' => index }.to_json end
Now, we will try to understand the...