Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class PermalinkController < ApplicationController
- include Apotomo::ControllerMethods
- include Apotomo::WidgetShortcuts
- def drive
- @permalink = Permalink.find_by_url(params[:permalink])
- @contents = []
- use_widgets do |root|
- for psection in @permalink.page_type.sections do
- widget_section = section(psection.name)
- for pcell in psection.cells do
- widget_section << cell(pcell.name, @permalink.cell_state, pcell.label, @permalink.cell_data)
- end
- root << widget_section
- end
- end
- @contents.push render_widget(psection.name)
- end
- end
- ## VIEW
- <% for content in @contents do %>
- <%= content %>
- <% end %>
- ## MODELS
- Permalink belongs_to :page_type
- #url
- #cell_state
- #cell_data
- PageType has_many :permalink_sections
- PermalinkSection has_many :permalink_cells
- #name
- PermalinkCell
- #name
- #label
Add Comment
Please, Sign In to add comment