Introduction
The Shot MVC implements a Model, View, Controller architecture on top of the base Shot Framework through a series of
Loaders and Routers. Additionally, the MVC gem allows you to use the MVCApplication
class, which will automatically
set up all required MVC loaders and routers.
Installation
gem install shot_mvc
Usage Example
require 'shot_mvc'
app = MVCApplication.new
app.run do
app.on 'load' do |instance|
instance.get 'controller', 'Home'
end
end
app.start
Components
The Shot MVC is made up of a few different parts, which collectively make up a Model, View, Controller structure.
Model
At the time of writing, Models are not yet finished, but coming soon!
View
The View portion of the MVC is made up of Elements and Templates.
Elements correspond to an actual HTML element on the user's screen. Elements have an assigned jQuery selector, and can
trigger any jQuery function on the corresponding element on the page.
Elements are capable of rendering Templates, which are nothing more than an ERB file, with some special sauce.
body = get 'element', 'body'
body.html = 'Hello World'
body.jq 'css', ['background-color', 'red']
body.render 'some_template'
Controllers
Controllers are just as you'd expect. All controllers inherit from the base Controller
class, and they can be loaded
using the built in Loader.
home_controller = get 'controller', 'Home'
home_controller.index
License
Licensed under the MIT License. For full licensing information, please see LICENSE.md.