Items UI changes

This commit is contained in:
chris2tof 2011-06-10 13:57:42 +08:00
parent 247b8ec4dc
commit a695b9ad29
31 changed files with 141 additions and 41 deletions

View File

@ -9,14 +9,16 @@ module Admin::ItemHelper
when 'Link'
dest = admin_link_path(node)
end
ret << "<ul>"
ret << "<li>"
ret << (link_to node.name, dest)
ret << ' | ' << (link_to t('admin.code'), eval("edit_admin_#{node._type.downcase}_path(node, :code => true)")) if node._type.eql?('Page')
ret << ' | ' << (link_to t('admin.new_page'), new_admin_page_path(:parent_id => node.id)) if node._type.eql?('Page')
ret << ' | ' << (link_to t('admin.new_link'), new_admin_link_path(:parent_id => node.id)) if node._type.eql?('Page')
ret << ' | ' << (link_to t('admin.new_page'), new_admin_page_path(:parent_id => node.id), :class => 'new_page') if node._type.eql?('Page')
ret << ' | ' << (link_to t('admin.new_link'), new_admin_link_path(:parent_id => node.id), :class => 'new_link') if node._type.eql?('Page')
ret << ' | ' << (link_to t(:delete), eval("delete_admin_#{node._type.downcase}_path(node, :authenticity_token => form_authenticity_token)"), :confirm => t('sure?'), :class => 'delete')
ret << render_children(node)
ret << "</li>"
ret << "</ul>"
end
ret.html_safe
end

View File

@ -1,5 +1,5 @@
<% content_for :sidebar do %>
<div id='sidebar'><%= render 'admin/items/site_map_left_bar' %></div>
<%= render 'admin/items/site_map_left_bar' %>
<% end -%>
<% content_for :page_specific_javascript do %>

View File

@ -1,9 +1,9 @@
$('#main').empty();
$('#panel_main').empty();
switch ("<%= escape_javascript(@item._type)%>") {
case 'Link':
$('#main').append("<%= escape_javascript(render(:partial => 'admin/links/show')) %>");
$('#panel_main').append("<%= escape_javascript(render(:partial => 'admin/links/show')) %>");
break;
case 'Page':
$('#main').append("<%= escape_javascript(render(:partial => 'admin/pages/show')) %>");
$('#panel_main').append("<%= escape_javascript(render(:partial => 'admin/pages/show')) %>");
break;
};

View File

@ -1,3 +1,3 @@
$('#sidebar').html("<%= escape_javascript(render(:partial => 'admin/items/site_map_left_bar')) %>");
$('#main').html("<%= escape_javascript(render(:partial => 'admin/links/show')) %>");
$('#panel_sidebar').html("<%= escape_javascript(render(:partial => 'admin/items/site_map_left_bar')) %>");
$('#panel_main').html("<%= escape_javascript(render(:partial => 'admin/links/show')) %>");
history.pushState(null, document.title, "<%= escape_javascript(admin_link_url(@item)) %>");

View File

@ -1 +1 @@
$('#sidebar').html("<%= escape_javascript(render(:partial => 'admin/items/site_map_left_bar')) %>");
$('#panel_sidebar').html("<%= escape_javascript(render(:partial => 'admin/items/site_map_left_bar')) %>");

View File

@ -1,5 +1,5 @@
<% content_for :sidebar do %>
<div id='sidebar'><%= render 'admin/items/site_map_left_bar' %></div>
<%= render 'admin/items/site_map_left_bar' %>
<% end -%>
<%= render 'edit' %>

View File

@ -1 +1 @@
$('#main').html("<%= escape_javascript(render(:partial => 'admin/links/edit')) %>");
$('#panel_main').html("<%= escape_javascript(render(:partial => 'admin/links/edit')) %>");

View File

@ -1,5 +1,5 @@
<% content_for :sidebar do %>
<div id='sidebar'><%= render 'admin/items/site_map_left_bar' %></div>
<%= render 'admin/items/site_map_left_bar' %>
<% end -%>
<%= render 'new' %>

View File

@ -1 +1 @@
$('#main').html("<%= escape_javascript(render(:partial => 'admin/links/new')) %>");
$('#panel_main').html("<%= escape_javascript(render(:partial => 'admin/links/new')) %>");

View File

@ -1,5 +1,5 @@
<% content_for :sidebar do %>
<div id='sidebar'><%= render 'admin/items/site_map_left_bar' %></div>
<%= render 'admin/items/site_map_left_bar' %>
<% end -%>
<%= render 'show' %>

View File

@ -1 +1 @@
$('#main').html("<%= escape_javascript(render(:partial => 'show')) %>");
$('#panel_main').html("<%= escape_javascript(render(:partial => 'show')) %>");

View File

@ -1,2 +1,2 @@
$('#main').html("<%= escape_javascript(render(:partial => 'admin/links/show')) %>");
$('#panel_main').html("<%= escape_javascript(render(:partial => 'admin/links/show')) %>");
history.pushState(null, document.title, "<%= escape_javascript(admin_link_url(@item)) %>");

View File

@ -1,5 +1,5 @@
<% content_for :sidebar do %>
<div id='sidebar'><%= render 'admin/items/site_map_left_bar' %></div>
<%= render 'admin/items/site_map_left_bar' %>
<% end -%>
<%= render @partial %>

View File

@ -1 +1 @@
$('#main').html("<%= escape_javascript(render(:partial => @partial)) %>");
$('#panel_main').html("<%= escape_javascript(render(:partial => @partial)) %>");

View File

@ -1,2 +1,2 @@
$('#main').html("<%= escape_javascript(render(:partial => 'admin/pages/show' )) %>");
$('#panel_main').html("<%= escape_javascript(render(:partial => 'admin/pages/show' )) %>");
history.pushState(null, document.title, "<%= escape_javascript(admin_page_url(@item)) %>");

View File

@ -1,3 +1,3 @@
$('#sidebar').html("<%= escape_javascript(render(:partial => 'admin/items/site_map_left_bar')) %>");
$('#main').html("<%= escape_javascript(render(:partial => 'admin/pages/show')) %>");
$('#panel_sidebar').html("<%= escape_javascript(render(:partial => 'admin/items/site_map_left_bar')) %>");
$('#panel_main').html("<%= escape_javascript(render(:partial => 'admin/pages/show')) %>");
history.pushState(null, document.title, "<%= escape_javascript(admin_page_url(@item)) %>");

View File

@ -1 +1 @@
$('#sidebar').html("<%= escape_javascript(render(:partial => 'admin/items/site_map_left_bar')) %>");
$('#panel_sidebar').html("<%= escape_javascript(render(:partial => 'admin/items/site_map_left_bar')) %>");

View File

@ -1,3 +1,7 @@
<% content_for :sidebar do %>
<%= render 'admin/items/site_map_left_bar' %>
<% end -%>
<h1><%= t('admin.editing_page') %></h1>
<%= form_for @item, :url => admin_page_path(@item) do |f| %>

View File

@ -1 +1 @@
$('#main').html("<%= escape_javascript(render(:partial => @code ? 'edit_code' : 'edit')) %>");
$('#panel_main').html("<%= escape_javascript(render(:partial => @code ? 'edit_code' : 'edit')) %>");

View File

@ -1,5 +1,5 @@
<% content_for :sidebar do %>
<div id='sidebar'><%= render 'admin/items/site_map_left_bar' %></div>
<%= render 'admin/items/site_map_left_bar' %>
<% end -%>
<%= render 'new' %>

View File

@ -1 +1 @@
$('#main').html("<%= escape_javascript(render(:partial => 'admin/pages/new')) %>");
$('#panel_main').html("<%= escape_javascript(render(:partial => 'admin/pages/new')) %>");

View File

@ -1 +1,5 @@
<% content_for :sidebar do %>
<%= render 'admin/items/site_map_left_bar' %>
<% end -%>
<%= render @code ? 'show_code' : 'show' %>

View File

@ -1 +1 @@
$('#main').html("<%= escape_javascript(render(:partial => 'show')) %>");
$('#panel_main').html("<%= escape_javascript(render(:partial => 'show')) %>");

View File

@ -1,2 +1,2 @@
$('#main').html("<%= escape_javascript(render(:partial => 'admin/pages/show')) %>");
$('#panel_main').html("<%= escape_javascript(render(:partial => 'admin/pages/show')) %>");
history.pushState(null, document.title, "<%= escape_javascript(admin_page_url(@item)) %>");

View File

@ -5,8 +5,7 @@
<title><%= @title || 'R4 rescue 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" %>
<%= stylesheet_link_tag "content", :media => "screen, projection" %>
<%= javascript_include_tag :ckeditor %>
<%= javascript_include_tag "jquery", "jquery-ui", "rails", "easy", "application", :cache => 'all' %>
@ -18,8 +17,8 @@
<%= csrf_meta_tag %>
</head>
<body>
<div id="header">
<ul id="nav">
<div id="panel_header">
<ul id="panel_nav">
<li><%= link_to t('homepage'), root_path %></li>
<li><%= link_to t('admin.item'), admin_items_path %></li>
<li><%= link_to t('admin.layout'), admin_layouts_path %></li>
@ -28,7 +27,7 @@
<li><%= link_to t('admin.user_role'), admin_user_role_models_path %></li>
<li><%= link_to t('admin.translation'), admin_translations_path %></li>
</ul>
<ul class="hmenu">
<ul class="panel_hmenu">
<li>
<%= render 'layouts/lang_menu' %>
</li>
@ -36,12 +35,11 @@
</ul>
</div>
<div id="content" class="content">
<div id="sidebar" style='float: left;'><%= yield :sidebar %></div>
<div id="main" style='float: left;'><%= yield %></div>
<div id="panel_content" class="content">
<div id="panel_sidebar" style='float: left;'><%= yield :sidebar %></div>
<div id="panel_main" style='float: left;'><%= yield %></div>
</div>
<div id="footer">
</div>
<div id="panel_footer"><%= yield :footer %></div>
</body>
</html>

BIN
public/images/bar_bg.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 157 B

BIN
public/images/home.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 857 B

BIN
public/images/tree_list.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 181 B

BIN
public/images/tree_list_h.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 184 B

View File

@ -2,7 +2,7 @@
// This file is automatically included by javascript_include_tag :defaults
$(function () {
$('#sidebar a, #main a.nav').live('click',
$('#panel_sidebar a, #panel_main a.nav').live('click',
function () {
$.getScript(this.href);
history.pushState(null, document.title, this.href);
@ -10,7 +10,7 @@ $(function () {
}
);
$('#main a.reload').live('click',
$('#panel_main a.reload').live('click',
function () {
$.getScript(this.href);
history.replaceState(null, document.title, this.href);

View File

@ -1,4 +1,96 @@
#panel_header ul, #panel_sidebar ul{
margin:0;
padding:0;
}
#panel_header ul li, #panel_sidebar ul li{
list-style:none;
}
#panel_header a, #panel_sidebar a {
text-decoration:none;
}
html{
height:100%;
width:100%;
}
body{
height:100%;
margin:0;
width:100%;
}
#panel_content{
height:100%;
width:100%;
}
#panel_header{
background:url(../images/bar_bg.png) repeat-x 0 0;
font-size:12px;
height:41px;
}
#panel_header ul{
margin:0 0 0 10px;
}
#panel_header a:link,#panel_header a:visited{
color:#fff;
}
#panel_header a:hover,#panel_header a:active{
color:#ececec;
}
#panel_nav{
float:left;
margin:0 0 0 10px;
}
#panel_nav li{
float: left;
line-height: 38px;
list-style: none outside none;
margin: 0 10px 0 0;
}
.panel_hmenu{
color: #FFFFFF;
float: right;
}
.panel_hmenu li{
float: left;
line-height: 41px;
list-style: none outside none;
margin: 0 10px 0 0;
}
#panel_sidebar{
background: none repeat scroll 0 0 #323232;
color: #FFFFFF;
float: left;
height: 100%;
min-width: 250px;
padding:5px 5px 0 0;
}
#panel_sidebar a:link,#panel_sidebar a:visited{
color:#fff;
}
#panel_sidebar a:hover,#panel_sidebar a:active{
color:#ececec;
}
#panel_sidebar ul{
background: url("../images/tree_list.png") repeat scroll 0 0 transparent;
}
#panel_sidebar li{
font-size: 12px;
line-height: 29px;
list-style:none;
padding: 0 0 0 10px;
}
#panel_sidebar ul {
}
#panel_sidebar ul li{
padding:0 0 0 20px;
}
.new_page{}
.new_link{}
.del_page{}
#panel_main{
margin:10px;
}