Guest User

Untitled

a guest
Jun 22nd, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. class PermalinkController < ApplicationController
  2. include Apotomo::ControllerMethods
  3. include Apotomo::WidgetShortcuts
  4.  
  5. def drive
  6. @permalink = Permalink.find_by_url(params[:permalink])
  7. @contents = []
  8. use_widgets do |root|
  9. for psection in @permalink.page_type.sections do
  10. widget_section = section(psection.name)
  11. for pcell in psection.cells do
  12. widget_section << cell(pcell.name, @permalink.cell_state, pcell.label, @permalink.cell_data)
  13. end
  14. root << widget_section
  15. end
  16. end
  17. @contents.push render_widget(psection.name)
  18. end
  19. end
  20.  
  21. ## VIEW
  22. <% for content in @contents do %>
  23. <%= content %>
  24. <% end %>
  25.  
  26. ## MODELS
  27.  
  28. Permalink belongs_to :page_type
  29. #url
  30. #cell_state
  31. #cell_data
  32.  
  33. PageType has_many :permalink_sections
  34.  
  35. PermalinkSection has_many :permalink_cells
  36. #name
  37.  
  38. PermalinkCell
  39. #name
  40. #label
Add Comment
Please, Sign In to add comment