Class: Wafflemix::PagesController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Wafflemix::PagesController
- Defined in:
- app/controllers/wafflemix/pages_controller.rb
Instance Method Summary collapse
Methods inherited from ApplicationController
Instance Method Details
#home ⇒ Object
24 25 26 27 28 29 30 |
# File 'app/controllers/wafflemix/pages_controller.rb', line 24 def home @page = Page.find_by_link_url('home') respond_to do |format| format.html end end |
#index ⇒ Object
4 5 6 7 8 9 10 |
# File 'app/controllers/wafflemix/pages_controller.rb', line 4 def index @pages = Page.active.arrange(:order => :position) respond_to do |format| format.html end end |
#mercury_update ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'app/controllers/wafflemix/pages_controller.rb', line 32 def mercury_update if params[:id] page = Page.find(params[:id]) else page = Page.find_by_link_url(params[:path].to_s.split('/').last)#(params[:path] ? params[:path].to_s.split('/').last : params[:id]) end page.title = params[:content][:page_title][:value] if params[:content][:page_title] params[:content].each do |key, value| if key =~ /content_section/ section = key.gsub /(content_section_|_)/, 'content_section_' => '', '_' => '' content_to_update = page.content_parts.find_by_name(section) content_to_update.content = value[:value] content_to_update.save end end page.save! render text: "" end |
#show ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'app/controllers/wafflemix/pages_controller.rb', line 12 def show if params[:id] @page = Page.find(params[:id]) else @page = Page.find_by_link_url(params[:path].to_s.split('/').last)#(params[:path] ? params[:path].to_s.split('/').last : params[:id]) end respond_to do |format| format.html end end |