README in masterview_gem_pack-0.0.11 vs README in masterview_gem_pack-0.0.12
- old
+ new
@@ -51,19 +51,19 @@
After this MasterView is ready for use. Skip down to the Usage section for more details.
=== Installation without using gems, install as plugin
-script/plugin install masterview
+script/plugin install svn://rubyforge.org/var/svn/masterview
-This will copy entire MasterView system into your vendor/plugin/masterview directory. You may tweak its init.rb to override any MasterView constants at runtime. See MasterView module masterview.rb for a list of available constants. You may also retrieve the plugin package (.tgz and .zip) from Rubyforge.org searching for the project masterview_complete.
+This will copy entire MasterView system into your vendor/plugin/masterview directory. You may tweak its init.rb to override any MasterView constants at runtime. See MasterView module masterview.rb for a list of available constants. Note that if you don't have svn (subversion) installed, you may also retrieve the plugin package (masterview_plugin.tgz or masterview_plugin.zip) from http://rubyforge.org/projects/masterview and simply extract into vendor/plugins/masterview
== Usage
You may add MasterView attributes to existing (x)html or you may use the masterview generator to create a complete working application. The generator can create controllers, models, and the MasterView template file similar to how the built-in generator works. Simply change directory to your rails application and run the following
-script/generate masterview YourModelName
+script/generate masterview YourModelName [YourControllerName]
Once it is done generating, the generated MasterView template file will be created in app/views/masterview/YourModelName.html. This file is html and can be edited with any standard html editor. The rails specific logic is contained in simple attributes which are ignored by html editors. The syntax for these attributes is heavily derived from the rails helper tags themselves so it should feel natural to the rails developer.
Another interesting thing to know is that while all of the pages for this Model have been bundled up into one html file for ease of editing, at runtime this template gets rendered into the exact same layouts and partials that you would use if you were building from scratch. Its jsut that now you can see what your pages will render like in your wysiwyg html editor and change and layout accordingly. Additionally MasterView supplies some javascript to show only one action view at time (list, new, show, edit, delete) so you can view in your browser without running in Rails. Dummy html can be included to improve the accuracy of the page which can be easily removed at runtime.
@@ -169,10 +169,27 @@
app/views/product/new.rhtml
<div>
<form></form>
</div>
-
+
+mv:attr=":foo => 'bar', :cat => #{h product.name}"
+ At runtime this sets attribute values on the element this directive is defined on, for example...
+
+ <div mv:attr=":foo => 'bar', :hi => 'cat'">hello</div>
+
+ becomes
+
+ <div foo="bar" hi="cat">hello</div>
+
+ You can put erb evaluated code in #{ } like in this example
+
+ <div mv:attr=":foo => #{h product.name}, :hi => 'cat'">hello</div>
+
+ becomes
+
+ <div foo="<%= h product.name %>" hi="cat">hello</div>
+
mv:block="rubyBlockCodeHere"
At runtime this expands to the equivalent rhtml (erb) block code around this element, for example...
<div mv:block="products.each do |product|">foobar</div>