Skip to content

Instantly share code, notes, and snippets.

@jfrolich
Created July 1, 2011 15:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jfrolich/1058803 to your computer and use it in GitHub Desktop.
Save jfrolich/1058803 to your computer and use it in GitHub Desktop.
Soapbox = SC.Application.create();
Soapbox.Page = SC.Object.extend({
title: null,
subMenu: false,
edit: false
});
Soapbox.pagesController = SC.ArrayProxy.create({
content: [],
createPage: function(title) {
var page = Soapbox.Page.create({ title: title });
this.pushObject(page);
}
});
Soapbox.createPageView = SC.TextField.extend({
insertNewline: function(){
var value = this.get('value');
if(value) {
Soapbox.pagesController.createPage(value);
this.set('value', '');
}
}
})
Soapbox.MenuItemsView = SC.CollectionView.extend({
contentBinding: "Soapbox.pagesController",
tagName: "ul",
itemViewClass: SC.View.extend({
tagName: "li",
templateName: 'say-hello',
className: "page menu_item",
  doubleClick: function(evt) {
console.log(this.content);
this.content.set("edit", true);
}
})
})
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>
Zenpage
</title>
<%= stylesheet_link_tag "backend" %>
<%= javascript_include_tag "backend" %>
<%= javascript_include_tag "http://use.typekit.com/dfr0iew.js" %>
<%= stylesheet_link_tag "iconic" %>
<link href='/stylesheets/textile-editor.css?1295053649' media='screen' rel='stylesheet' type='text/css' />
<%= javascript_include_tag "textile-editor" %>
<%= csrf_meta_tag %>
<%= yield(:head) %>
  <script type="text/x-handlebars" data-template-name="menu-item">
<div class="menu_item_content">
{{content.title}}
</div>
<div class="buttons">
<a class="edit iconic pencil iconbutton"></a>
<a class="delete x-alt iconic iconbutton"></a>
</div>
</script>
</head>
<body>
<div id='wrapper'>
<div id='sidebar'>
<h2>Paginas:</h2>
<%= render :partial => "admin/menu_items/menu_items", :locals => {:menu_items => @menu} %>
<%= render :partial => 'admin/menu_items/new' %>
<div style='clear:both; float:left'>
<script type="text/html">
{{view Soapbox.createPageView id="page_name" placeholder="Page title"}}
</script>
<script type="text/html">
{{collection Soapbox.MenuItemsView id="menuItems"}}
</script>
<br />
<br />
<%= link_to "Exposities", admin_expositions_path, :class => "small_normal_button" %>
<br />
<br />
<%= link_to "Site settings", "/admin/site_settings", :class => "small_normal_button" %>
<br />
<br />
<br />
<br />
<%= link_to "Log uit", admin_logout_path, :class => "small_red_button" %>
<br />
<br />
<br />
zenpage
<%= Zenpage::Application.config.app_version %>
</div>
</div>
<div id='content'>
<div id='flash-notice'>
<div id='notice'>
<%= flash[:notice] %>
</div>
<div id='close-notice'>
<a href='#'>x</a>
</div>
</div>
<%= yield %>
</div>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment