Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
51 additions
and
4 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,26 @@ | ||
class Admin::PagesController < Admin::ApplicationController | ||
def index | ||
@pages = pages.order('key ASC, locale ASC') | ||
end | ||
|
||
def edit | ||
@page = pages.find(params[:id]) | ||
end | ||
|
||
def update | ||
@page = pages.find(params[:id]) | ||
|
||
if @page.update_attributes(params[:manageable_content_page]) | ||
redirect_to admin_pages_path | ||
else | ||
render :edit | ||
end | ||
end | ||
|
||
protected | ||
|
||
def pages | ||
ManageableContent::Manager.pages | ||
end | ||
|
||
end |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,23 @@ | ||
<h1>Admin::Pages#edit</h1> | ||
<p>Find me in app/views/admin/pages/edit.html.erb</p> | ||
<%= form_for @page, :url => admin_page_path(@page), :method => :put do |form| %> | ||
<p> | ||
<%= form.label :key %> | ||
<%= form.text_field :key, :disabled => true %> | ||
</p> | ||
<p> | ||
<%= form.label :locale %> | ||
<%= form.text_field :locale, :disabled => true %> | ||
</p> | ||
|
||
<% unless form.object.page_contents.empty? %> | ||
<% eligible_contents = ManageableContent::Manager.eligible_contents(form.object.key) %> | ||
<%= form.fields_for :page_contents do |content_form| %> | ||
<% if eligible_contents.include?(content_form.object.key.to_sym) %> | ||
<%= content_form.label :content, content_form.object.key %> | ||
<%= content_form.text_area :content %> | ||
<% end %> | ||
<% end %> | ||
<% end %> | ||
<%= form.submit 'Save' %> | ||
<% end %> |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,15 @@ | ||
<h1>Admin::Pages#index</h1> | ||
<p>Find me in app/views/admin/pages/index.html.erb</p> | ||
<table> | ||
<thead> | ||
<th>Page</th> | ||
<th></th> | ||
<thead> | ||
<tbody> | ||
<% @pages.each do |page| %> | ||
<tr> | ||
<td><%= page.key.titleize %></td> | ||
<td><%= link_to 'edit', edit_admin_page_path(page) %></td> | ||
</tr> | ||
<% end %> | ||
</tbody> | ||
</table> |
This file was deleted.
Oops, something went wrong.