diff --git a/app/assets/javascripts/sibling_popup.js b/app/assets/javascripts/sibling_popup.js
new file mode 100644
index 0000000..1736dad
--- /dev/null
+++ b/app/assets/javascripts/sibling_popup.js
@@ -0,0 +1,26 @@
+// Copyright (c) 2015 Indiana University
+// All rights reserved.
+
+// Run this in the parent window to create the dialog popup.
+function show_sibling_popup(parent, prev_sib, next_sib, old_sib) {
+ window.open("/sibling_popup/show?parent=" + parent + "&prev_sib=" + prev_sib + "&next_sib=" + next_sib + "&old_sib=" + old_sib,
+ "_blank",
+ "location=no,menubar=no,status=no,toolbar=no,height=300,width=400");
+}
+
+// Run this in the dialog popup to redirect the parent window to a new-object page.
+function redirect_parent(type, parent, prev_sib, next_sib) {
+ opener.location.pathname = type + "s/new"
+ + "?parent=" + parent
+ + "&prev_sib=" + prev_sib
+ + "&next_sib=" + next_sib;
+}
+
+// Extract value of a Select element.
+function get_select_value(id) {
+ selector = document.getElementById(id);
+ // TODO check null selector
+ index = selector.selectedIndex;
+ // TODO check no selection
+ return selector.options[index].value;
+}
diff --git a/app/assets/stylesheets/sibling_popup.css.scss b/app/assets/stylesheets/sibling_popup.css.scss
new file mode 100644
index 0000000..5c10678
--- /dev/null
+++ b/app/assets/stylesheets/sibling_popup.css.scss
@@ -0,0 +1,5 @@
+// Place all the styles related to the sibling_popup controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
+
+body.popup { padding-top: 0; }
diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb
index 2a9c76e..45b345e 100644
--- a/app/controllers/pages_controller.rb
+++ b/app/controllers/pages_controller.rb
@@ -25,6 +25,9 @@ def new
@page = Page.new
session[:came_from] = :page
@page = Page.new(params[:page])
+ @page.parent = params[:parent] if params[:parent]
+ @page.prev_sib = params[:prev_sib] if params[:prev_sib]
+ @page.next_sib = params[:next_sib] if params[:next_sib]
add_breadcrumb "Create Page"
end
diff --git a/app/controllers/sibling_popup_controller.rb b/app/controllers/sibling_popup_controller.rb
new file mode 100644
index 0000000..9c9f4cf
--- /dev/null
+++ b/app/controllers/sibling_popup_controller.rb
@@ -0,0 +1,8 @@
+class SiblingPopupController < ApplicationController
+ layout 'popup'
+
+ def show
+ # we have params['query_param_name'] available here
+ end
+
+end
diff --git a/app/helpers/sibling_popup_helper.rb b/app/helpers/sibling_popup_helper.rb
new file mode 100644
index 0000000..3b12540
--- /dev/null
+++ b/app/helpers/sibling_popup_helper.rb
@@ -0,0 +1,2 @@
+module SiblingPopupHelper
+end
diff --git a/app/views/layouts/popup.html.erb b/app/views/layouts/popup.html.erb
new file mode 100644
index 0000000..f5a26c4
--- /dev/null
+++ b/app/views/layouts/popup.html.erb
@@ -0,0 +1,12 @@
+
+
+
+
<%= render_breadcrumbs %>
+
<%= notice %>
Page <%= @page.id %>
diff --git a/app/views/sibling_popup/show.html.erb b/app/views/sibling_popup/show.html.erb
new file mode 100644
index 0000000..9247ab8
--- /dev/null
+++ b/app/views/sibling_popup/show.html.erb
@@ -0,0 +1,38 @@
+
+
+<% @title = 'Create a new sibling'%>
+
<%= @title%>
+
+
diff --git a/config/application.rb b/config/application.rb
index 8a290fd..48ef12f 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -13,6 +13,7 @@ class Application < Rails::Application
g.test_framework :rspec, :spec => true
end
+ config.autoload_paths << Rails.root.join("lib")
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
diff --git a/config/object_profiles.yml b/config/object_profiles.yml
new file mode 100644
index 0000000..ca49eb3
--- /dev/null
+++ b/config/object_profiles.yml
@@ -0,0 +1,4 @@
+collection:
+page:
+paged:
+section:
\ No newline at end of file
diff --git a/config/routes.rb b/config/routes.rb
index fa34089..85eb938 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,4 +1,6 @@
PagedMedia::Application.routes.draw do
+ get 'sibling_popup/show'
+
resources :pages
resources :collections
resources :sections
diff --git a/lib/object_profile.rb b/lib/object_profile.rb
new file mode 100644
index 0000000..fa1014b
--- /dev/null
+++ b/lib/object_profile.rb
@@ -0,0 +1,30 @@
+# Represent a profile for a type of Node.
+# At the moment all it does (correctly) is to list the profiles, which are
+# named (and eventually described) in config/object_profiles.yaml
+#--
+# Copyright (c) 2015 Indiana University
+# All rights reserved.
+
+require 'yaml'
+
+class ObjectProfile
+ @@PROFILES = YAML.load_file('config/object_profiles.yml')
+
+ private_class_method :new
+
+ def name
+ NAME
+ end
+
+ # Enumerate profile names and bodies for a block, as if this were a Hash.
+ def self.each
+ @@PROFILES.each do |name, profile|
+ yield name, profile
+ end
+ end
+
+ # Return the body of the named profile.
+ def self.find(name)
+ @@PROFILES[name]
+ end
+end
\ No newline at end of file
diff --git a/spec/controllers/sibling_popup_controller_spec.rb b/spec/controllers/sibling_popup_controller_spec.rb
new file mode 100644
index 0000000..5ccee09
--- /dev/null
+++ b/spec/controllers/sibling_popup_controller_spec.rb
@@ -0,0 +1,12 @@
+require 'spec_helper'
+
+describe SiblingPopupController do
+
+ describe "GET 'show'" do
+ it "returns http success" do
+ get 'show'
+ response.should be_success
+ end
+ end
+
+end
diff --git a/spec/helpers/sibling_popup_helper_spec.rb b/spec/helpers/sibling_popup_helper_spec.rb
new file mode 100644
index 0000000..f1afbe6
--- /dev/null
+++ b/spec/helpers/sibling_popup_helper_spec.rb
@@ -0,0 +1,15 @@
+require 'spec_helper'
+
+# Specs in this file have access to a helper object that includes
+# the SiblingPopupHelper. For example:
+#
+# describe SiblingPopupHelper do
+# describe "string concat" do
+# it "concats two strings with spaces" do
+# expect(helper.concat_strings("this","that")).to eq("this that")
+# end
+# end
+# end
+describe SiblingPopupHelper do
+ pending "add some examples to (or delete) #{__FILE__}"
+end
diff --git a/spec/views/sibling_popup/show.html.erb_spec.rb b/spec/views/sibling_popup/show.html.erb_spec.rb
new file mode 100644
index 0000000..f5d2833
--- /dev/null
+++ b/spec/views/sibling_popup/show.html.erb_spec.rb
@@ -0,0 +1,5 @@
+require 'spec_helper'
+
+describe "sibling_popup/show.html.erb" do
+ pending "add some examples to (or delete) #{__FILE__}"
+end