This repository has been archived by the owner on Aug 15, 2018. It is now read-only.
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
Josh Adams
committed
Nov 14, 2008
1 parent
7ce5dfe
commit cb4cdb6
Showing
14 changed files
with
121 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
0.0.3 |
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
class Admin::PageMetadatasController < Admin::BaseController | ||
before_filter :load_page | ||
before_filter :load_page_metadata, :only => [:edit, :update] | ||
|
||
protected | ||
def load_page | ||
@page = Page.find(params[:page_id]) | ||
end | ||
|
||
def load_page_metadata | ||
@page_metadata = @page.page_metadata | ||
end | ||
|
||
public | ||
def edit | ||
end | ||
|
||
def update | ||
if @page_metadata.update_attributes(params[:page_metadata]) | ||
flash[:notice] = "Metadata was updated successfully." | ||
redirect_to edit_admin_page_path(@page) | ||
else | ||
flash.now[:error] = "There was a problem updating the metadata." | ||
render :action => 'edit' | ||
end | ||
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
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
class PageMetadata < ActiveRecord::Base | ||
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
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<%= title "Edit Metadata for page: #{@page}" %> | ||
<% content_for :sidebar do %> | ||
<%= link_to "Back to Page", admin_page_path(@page), :class => 'button icon back' %> | ||
<% end %> | ||
<% form_for [:admin, :page, @page_metadata] do |f| %> | ||
<table class='form-table'> | ||
<%= form_row "Title", f.text_field(:title) -%> | ||
<%= form_row "Subject", f.text_field(:subject) -%> | ||
<%= form_row "Description", f.text_area(:description) -%> | ||
<%= form_row "Publisher", f.text_field(:publisher) -%> | ||
<%= form_row "Rights", f.text_field(:rights) -%> | ||
</table> | ||
<br /> | ||
<%= submit_tag "Update Metadata" %> | ||
<% 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
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
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
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
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
class CreatePageMetadatas < ActiveRecord::Migration | ||
def self.up | ||
create_table :page_metadatas do |t| | ||
t.integer :page_id | ||
t.string :title | ||
t.string :subject | ||
t.text :description | ||
t.string :publisher | ||
t.string :rights | ||
|
||
t.timestamps | ||
end | ||
end | ||
|
||
def self.down | ||
drop_table :page_metadatas | ||
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,15 @@ | ||
// Place your application-specific JavaScript functions and classes here | ||
// This file is automatically included by javascript_include_tag :defaults | ||
|
||
// This will provide a plugin to allow you to focus the first input field | ||
// of a given form on page load | ||
// So you can do $('#form1').focusFirstField(); | ||
(function(jQuery){ | ||
jQuery.fn.focusFirstField = function(){ | ||
$this = this; | ||
$this.find(":text:visible:enabled").filter(function(){ | ||
return jQuery(this).parents(":hidden").size() == 0; | ||
}).slice(0,1).focus(); | ||
return this; | ||
} | ||
})(jQuery); |
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html | ||
|
||
one: | ||
page_id: 1 | ||
title: MyString | ||
subject: MyString | ||
description: MyText | ||
publisher: MyString | ||
rights: MyString | ||
|
||
two: | ||
page_id: 1 | ||
title: MyString | ||
subject: MyString | ||
description: MyText | ||
publisher: MyString | ||
rights: MyString |
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
require 'test_helper' | ||
|
||
class PageMetadataTest < ActiveSupport::TestCase | ||
# Replace this with your real tests. | ||
def test_truth | ||
assert true | ||
end | ||
end |