Created
November 24, 2011 12:37
-
-
Save Znow/1391263 to your computer and use it in GitHub Desktop.
shows the specific page...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Admin::AdvicePagesController < AdminController | |
def index | |
@pages = AdvicePage.all | |
end | |
def show | |
@page = AdvicePage.find(params[:id]) | |
end | |
def mercury_update | |
page = AdvicePage.find(params[:id]) | |
page.name = params[:content][:page_title][:value] | |
page.content = params[:content][:page_content][:value] | |
page.save! | |
render text: "" | |
end | |
def edit | |
@page = AdvicePage.find(params[:id]) | |
end | |
def update | |
@page = AdvicePage.find(params[:id]) | |
if @page.update_attributes(params[:advice_page]) | |
redirect_to admin_advice_pages_path, :notice => 'Page was successfully updated.' | |
else | |
redirect_to edit_admin_advice_page(@page.id) | |
end | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Advicecapital::Application.routes.draw do | |
Mercury::Engine.routes | |
match '/contact' => 'contact#new', :as => 'contact', :via => :get | |
match '/contact' => 'contact#create', :as => 'contact', :via => :post | |
devise_for :users | |
resources :news | |
resources :boards | |
#resources :contacts, :only => [:new, :create] | |
resources :videos | |
namespace :admin do | |
root :to => 'dashboard#index' | |
resources :advice_pages do | |
member { post :mercury_update } | |
end | |
resources :boxes, :only => [:index, :show, :edit, :update] | |
resources :investors | |
resources :users | |
resources :employees | |
end | |
root :to => "pages#index" | |
match '/receive_news', :to => 'pages#receive_news' | |
match '/disclaimer', :to => 'pages#disclaimer' | |
match '/organisation', :to => 'admin/employees#index' | |
mount Resque::Server, :at => "/resque" | |
match '/*slugs', :to => 'pages#show' | |
# AdvicePage.all.each do |r| | |
# match r.slug, :to => "pages#show" | |
# end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.span-20 | |
%h3 | |
%span#page_title.mercury-region{"data-type" => "editable"} | |
= raw @page.title | |
%p | |
#page_content.mercury-region{"data-type" => "editable"} | |
= raw @page.content | |
- if can? :manage, @page | |
= link_to "Rediger side", "/editor" + request.path, id: "edit_link", data: {save_url: mercury_update_admin_advice_page_path(@page)} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment