Skip to content

Instantly share code, notes, and snippets.

@erichocean
Created October 3, 2008 19:39
Show Gist options
  • Save erichocean/14626 to your computer and use it in GitHub Desktop.
Save erichocean/14626 to your computer and use it in GitHub Desktop.
<% # SPROUTCORE DEFAULT INDEX TEMPLATE
# This template provide provides a basic wrapper for a SproutCore client.
# Most of the time, it will be sufficient for your own needs. However, if
# you need to create your own template, you can do so by copying this file
# into your client, naming it 'index.rhtml' and then adding the options
# :index => 'index' to your client declaration in routes.rb.
#
# See the comments in this file for more information on what you can
# change.
-%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<% # @title will be defined if you passed :title in routes.rb -%>
<title><%= (@title.to_s || bundle_name.to_s || '').capitalize %></title>
<% #
# This line should appear in your head area to include the stylesheets
# generated by your client. If you need to include your own
# stylesheets, you don't need to change it here. Instead, use the
# :requires option in routes.rb.
-%>
<script src="<%= static_url('detect-browser') %>" type="text/javascript"></script>
<%= stylesheets_for_client %>
<%= @content_for_page_styles %>
</head>
<body class="<%= @theme || 'sc-theme' %> focus">
<script type="text/javascript">
if (SC.setupBodyClassNames) SC.setupBodyClassNames() ;
</script>
<% #
# This is where you root body element will appear. To cause your
# content to appear here, just declare content_for('body') in one of
# your partials.
-%>
<!-- Main Page Body -->
<%= @content_for_body %>
<% #
# This is where the resources you delcare will appear. You must
# include the following three lines verbatim for the resources you
# declare to be properly used.
-%>
<!-- Resources to be removed from DOM on page load -->
<div id="resources" style="display:none; visibility: hidden;">
<%= @content_for_resources -%>
</div>
<% #
# This line should appear at the bottom of your page to include your
# generated JavaScript and any libraries you reference. If you need
# to include other javascripts, add them to the :requires option of
# your client in routes.rb instead of changing it here.
-%>
<!-- Include Site Javascript -->
<%= javascripts_for_client %>
<%= @content_for_page_javascript %>
<% #
# The following lines to the closing body tag must be included at the
# very end of your file. This will actually setup the JavaScript
# views on your page and register SproutCore to start on page load.
-%>
<!-- Render Page Views -->
<script type="text/javascript">
SC.page = SC.Page.create({
layoutSize: { width: 800, height: 600 }, // the size we used to position everything statically...
marginInset: SC.View.create({
outlets: ['projectNameLabel','appProjectDirLabel','projectAppsScroller','appNameLabel','appDirLabel','appFilesScroller'],
autoresize: SC.AUTORESIZE_WIDTH_HEIGHT,
layout: { x: 0, y: 0, width: 400, height: 300 },
projectNameLabel: SC.LabelView.create({
valueBinding: 'SC.IDE.projectController.name',
autoresize: SC.AUTORESIZE_LEFT,
layout: { x: 100, y: 0, width: 300, height: 30 },
localize: false,
escapeHTML: true,
isEditable: false
}),
appProjectDirLabel: SC.LabelView.create({
valueBinding: 'SC.IDE.projectController*directory.path',
autoresize: SC.AUTORESIZE_LEFT,
layout: { x: 100, y: 0, width: 300, height: 30 },
localize: false,
escapeHTML: true,
isEditable: false
}),
projectAppsScroller: SC.ScrollView.create({
outlets: ['projectAppsList'],
autoresize: SC.AUTORESIZE_LEFT,
layout: { x: 100, y: 0, width: 600, height: 100 },
projectAppsList: SC.ListView.create({
contentBinding: 'SC.IDE.appsController.arrangedObjects',
selectionBinding: 'SC.IDE.appsController.selection',
contentValueKey: 'name',
isSelectable: true,
hasContentBranch: false,
acceptsFirstResponder: true,
hasContentIcon: false
})
}),
appNameLabel: SC.LabelView.create({
valueBinding: 'SC.IDE.appController.name',
autoresize: SC.AUTORESIZE_LEFT,
layout: { x: 100, y: 0, width: 300, height: 30 },
localize: false,
escapeHTML: true,
isEditable: true
}),
appDirLabel: SC.LabelView.create({
valueBinding: 'SC.IDE.appController*directory.path',
autoresize: SC.AUTORESIZE_LEFT,
layout: { x: 100, y: 0, width: 300, height: 30 },
localize: false,
escapeHTML: true,
isEditable: false
}),
appFilesScroller: SC.ScrollView.create({
outlets: ['appFilesList'],
autoresize: SC.AUTORESIZE_LEFT,
layout: { x: 100, y: 0, width: 600, height: 100 },
appFilesList: SC.ListView.create({
contentBinding: 'SC.IDE.appsController.arrangedObjects',
selectionBinding: 'SC.IDE.appsController.selection',
contentValueKey: 'path',
isSelectable: true,
hasContentBranch: false,
acceptsFirstResponder: true,
hasContentIcon: false
})
})
})
});
</script>
<!-- Start SproutCore on Page Load -->
<script type="text/javascript">window.onload = SC.didLoad;</script>
<%= @content_for_final %>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment