- No more Home object

- Sitemap on the left side and view of the current page in the main block
This commit is contained in:
chris2tof committed 2011-05-09 18:49:57 +08:00
1 parent 9fdfb140d3
commit d9ba76ebd5
21 files changed
+122 -149

No files matched your search

-30
View File
@@ -1,30 +0,0 @@
<%= f.hidden_field :parent_id %>
<p>
<%= f.label :name, t('admin.name') %>
<%= f.text_field :name, :class => 'text', :value => 'home', :disabled => true %>
<%= f.hidden_field :name, :value => 'home' %>
</p>
<% @site_valid_locales.each do |locale| %>
<p>
<%= label_tag "home[title]", "#{t('admin.title')} #{locale}" %>
<%= text_field_tag "home[i18n_variable][#{locale}]", (@i18n_variable[locale] if @i18n_variable), :class => 'text' %>
</p>
<% end %>
<p>
<%= f.label :layout_id, t('admin.layout_name') %>
<%= f.select :layout_id, Layout.all.map{ |l| [l.description, l.id] } %>
</p>
<p>
<%= f.label "content", t('admin.content') %>
<%= f.text_area "content", :size => '100x30' %>
</p>
<p>
<%= f.label :is_published, "#{t('admin.is_published')} ?" %>
<%= f.radio_button :is_published, true %>Yes <%= f.radio_button :is_published, false %> No
</p>
-10
View File
@@ -1,10 +0,0 @@
<h1><%= t('admin.editing_home') %></h1>
<%= form_for @home, :url => admin_home_path(@home) do |f| %>
<%= f.error_messages %>
<%= render :partial => "form", :locals => { :f => f } %>
<p>
<%= f.submit t('update') %> <%= link_back %>
</p>
<% end %>
-11
View File
@@ -1,11 +0,0 @@
<h1><%= t('admin.new_home') %></h1>
<%= form_for :home, :url => admin_homes_path do |f| %>
<%= f.error_messages %>
<%= render :partial => "form", :locals => { :f => f } %>
<p>
<%= f.submit t('create') %> <%= link_back %>
</p>
<% end %>
+26 -17
View File
@@ -1,27 +1,36 @@
<% content_for :secondary do %>
<ul class="list">
<% if (@items.empty? && !@parent_item ) || (!@items.empty? && @items[0].is_home?) %>
<li><%= t('admin.new_page') %></li>
<li><%= t('admin.new_link') %></li>
<li><%= t('admin.new_snippet') %></li>
<% else %>
<li><%= link_to t('admin.new_page'), new_admin_page_path( :parent_id => @parent_item.id ), :class => 'button positive' %></li>
<li><%= link_to t('admin.new_link'), new_admin_link_path( :parent_id => @parent_item.id ) %>
<li><%= link_to t('admin.new_snippet'), new_admin_snippet_path( :parent_id => @parent_item.id ), :class => 'button positive' %></li>
<% end %>
</ul>
<% content_for :sidebar do %>
<div id='sidebar'><%= render 'layouts/site_map_left_bar' %></div>
<% end -%>
<%= flash_messages %>
<% content_for :page_specific_javascript do %>
<script type="text/javascript" charset="utf-8">
$('a.sidebar_link').live( "click", function(){
$(this).removeClass('sidebar_link');
$('.sidebar_no_link').addClass('sidebar_link');
$('.sidebar_no_link').removeClass('sidebar_no_link');
$(this).addClass('sidebar_no_link');
});
</script>
<% end -%>
<% content_for :page_specific_css do %>
<style type="text/css">
.sidebar_no_link {
pointer-events: none;
cursor: default;
}
</style>
<% end %>
<%= render 'layouts/page' %>
<!-- <%= flash_messages %>
<h1><%= t('admin.list_items') %>: <%= show_parent_items_link unless @parent_item.nil? %></h1>
<% if !Layout.exist_one? %>
<div style='color:red'><%= t('admin.no_layout') %>: <%= link_to t('create').downcase, new_admin_layout_path %></div>
<br/>
<% elsif (@items.empty? && !@parent_item ) %>
<div style='color:red'><%= t('admin.no_home_page') %>: <%= link_to t('create').downcase, new_admin_home_path(:parent_id => nil) %></div>
<br/>
<% else %>
<table>
<tr>
@@ -43,4 +52,4 @@
</table>
<% end %>
<%= render :partial => "snippets", :locals => { :snippets => @snippets } %>
<%= render :partial => "snippets", :locals => { :snippets => @snippets } %> -->
+9
View File
@@ -0,0 +1,9 @@
$('#main').empty();
switch ("<%= escape_javascript(@page._type)%>") {
case 'Link':
$('#main').append("TODO: page to edit the link");
break;
case 'Page':
$('#main').append("<%= escape_javascript(render(:partial => 'layouts/page')) %>");
break;
};
+1 -6
View File
@@ -2,12 +2,7 @@
<p>
<%= f.label :name, t('admin.name') %>
<% if @page.parent_id.nil? %>
<%= f.text_field :name, :class => 'text', :value => 'home', :disabled => true %>
<%= f.hidden_field :name, :value => 'home' %>
<% else %>
<%= f.text_field :name, :class => 'text' %>
<% end %>
<%= f.text_field :name, :class => 'text' %>
</p>
+1
View File
@@ -0,0 +1 @@
<%= parse_page(@page).html_safe if @page._type.eql?('Page') %>
@@ -0,0 +1 @@
<%= render_node_and_children(@page) %>
+30
View File
@@ -0,0 +1,30 @@
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title><%= @title %></title>
<link rel="shortcut icon" href="/favicon.ico">
<%= yield :page_specific_link %>
<%= stylesheet_link_tag "easy", "main", "devise", "content", :media => "screen, projection" %>
<%= stylesheet_link_tag "easyprint", :media => "print" %>
<%= javascript_include_tag "jquery", "jquery-ui", "rails", "easy", "application", :cache => 'all' %>
<%= yield :page_specific_javascript %>
<!--[if IE]>
<%= stylesheet_link_tag "ie", :media => "screen, projection" %>
<![endif]-->
<%= yield :page_specific_css %>
<%= csrf_meta_tag %>
</head>
<body>
<div id="header">
</div>
<div id="content" class="content">
<div id="sidebar" style='float: left;'><%= yield :sidebar %></div>
<div id="main" style='float: left;'><%= yield %></div>
</div>
<div id="footer">
</div>
</body>
</html>