Partial sitemap

This commit is contained in:
Christophe Vilayphiou 2012-07-25 15:10:15 +08:00
parent 12f9f666eb
commit db9c4c0e10
7 changed files with 390 additions and 40 deletions

File diff suppressed because one or more lines are too long

View File

@ -570,53 +570,342 @@
padding: 5px; padding: 5px;
} }
.popover-content { .popover-content {
-webkit-border-radius: 0 0 3px 3px; border-radius: 3px;
-moz-border-radius: 0 0 3px 3px;
border-radius: 0 0 3px 3px;
padding: 5px; padding: 5px;
} }
.popover-title { .popover-title {
display: none; display: none;
} }
/*show link and file*/ .member td.teacher {
.linkAndFile { /*background-color: #AF0045;
border-left: 2px solid #AF0045;*/
}
.user-info .roles-nav {
margin: 0;
position: relative;
clear: both; clear: both;
} }
.linkAndFile>div { .user-info .roles-nav li {
margin-top: 20px;
}
.linkAndFile [class^="icons-"] {
float: left; float: left;
margin-top: 10px; list-style: none;
background-color: #FFFFFF;
} }
.linkAndFile .showLink, .linkAndFile .showFile { .user-info .roles-nav li a {
background-color: #ededed; text-indent: -9999px;
padding: 5px; display: block;
height: 15px;
width: 100px;
margin-top: 3px;
opacity: 0.3;
-moz-opacity: 0.3;
filter:alpha(opacity=3);
}
.user-info .roles-nav li:first-child a {
border-radius: 0 0 0 4px;
}
.user-info .roles-nav li:last-child a {
border-radius: 0 0 4px 0;
}
.user-info .roles-nav li hr {
position: absolute;
top: 0;
left: 0;
right: 0;
height: 3px;
margin: 0;
border: none;
display: none;
}
.user-info .roles-nav li.teacher a {
background-color: #F36F08;
}
.user-info .roles-nav li.student a {
background-color: #186AB6;
}
.user-info .roles-nav li.staff a {
background-color: #139E2F;
}
.user-info .roles-nav li.active a {
border-bottom: none;
height: 18px;
margin-top: 0;
opacity: 1;
-moz-opacity: 1;
filter:alpha(opacity=10);
}
.user-info .roles-nav li.active hr {
display: block;
}
.user-info-basic {
padding: 20px;
min-width: 220px;
display: inline-block;
float: left;
}
.user-info-roles {
padding: 20px;
}
.user-avatar {
overflow: hidden;
width: 80px;
height: 80px;
border-radius: 5px; border-radius: 5px;
margin-left: 25px; box-shadow: 0 1px 3px rgba(0,0,0,.8);
margin-right: 10px;
} }
.linkAndFile .showLink a, .linkAndFile .showFile a { .user-avatar .reflective {
display: inline-block; background-image: url(img/reflective.png);
margin: 5px 10px; background-repeat: no-repeat;
background-position: 0;
height: 80px;
width: 80px;
position: absolute;
} }
.linkAndFile>div>a:last-child { .user .user-avatar .reflective {
margin-right: 5px background-image: url(img/reflective.png);
background-repeat: no-repeat;
background-position: 0 -20px;
height: 80px;
width: 80px;
position: absolute;
top: 10px;
left: 10px;
opacity: 0;
-moz-opacity: 0;
filter:alpha(opacity=0);
} }
.news_paragraph p { .user:hover .user-avatar .reflective {
line-height: 20px; background-position: 0 0;
opacity: 1;
-moz-opacity: 1;
filter:alpha(opacity=10);
} }
.nav-tabs>li>.edit, .nav-tabs>li>.edit:hover { .user-name {
background-color: #333; font-size: 22px;
color: #FFF; line-height: 24px;
padding-right: 12px; color: #555;
margin: 0 0 3px;
font-family: Helvetica, "微軟正黑體";
} }
.nav-tabs li .icons-pencil { .user-data {
float: right; padding: 20px;
position: relative;
}
.data-block hr {
background-color: #666;
height: 8px;
border: none;
margin: 0;
border-radius: 5px 5px 0px 0px;
-moz-border-radius: 5px 5px 0px 0px;
-webkit-border-radius: 5px 5px 0px 0px;
}
.data-block .info_input {
margin-bottom:50px;
position:relative;
padding: 10px;
background-color: rgba(227,227,227,1);
border-radius: 0px 0px 5px 5px;
-moz-border-radius: 0px 0px 5px 5px;
-webkit-border-radius: 0px 0px 5px 5px;
-moz-box-shadow: 0px 1px 0px rgba(0,0,0,.3); /* Firefox */
-webkit-box-shadow: 0px 1px 0px rgba(0,0,0,.3);/* Safari 和 Chrome */
box-shadow: 0px 1px 0px rgba(0,0,0,.3); /* Opera 10.5 + */
}
.data-block .info_input table {
width: 100%;
}
.data-block .info_input table .list_head td {
border-bottom: 1px solid #AAA;
}
.teacher hr {
background-color: #F36F08;
}
.student hr {
background-color: #186AB6;
}
.staff hr {
background-color: #139E2F;
}
.view-mode {
margin: 4px 20px 0 0;
}
.view-mode i {
font-size: 14px;
line-height: 6px !important;
}
.member-abstract, .member-large {
padding: 15px;
}
.member-abstract ul, .member-large ul {
margin: 0;
padding: 0;
list-style: none;
}
.member-abstract>ul>li, .member-large>ul>li {
margin: 5px;
overflow: hidden;
border-radius: 5px;
box-shadow: 0 1px 3px rgba(0,0,0,.3);
}
.member-abstract .user *, .member-large .user * {
-webkit-transition: all .3s ease;
-moz-transition: all .3s ease;
-o-transition: all .3s ease;
transition: all .3s ease;
}
.member-abstract .user, .member-large .user {
background-color: #EDEDED;
padding: 10px;
position: relative;
border-radius: 0 0 5px 5px;
width: 360px;
-webkit-transition: all .3s ease;
-moz-transition: all .3s ease;
-o-transition: all .3s ease;
transition: all .3s ease;
}
.member-abstract .user:hover, .member-large .user:hover {
background-color: #333333;
}
.member-abstract .user:hover .user-name, .member-large .user:hover .user-name {
color: #DDD;
}
.member-abstract .user .user-meta {
margin-left: 90px;
}
.member-abstract .user .user-title span {
color: #5e5e5e;
font-size: 13px;
padding-right: 10px;
}
.member-abstract .user:hover .user-title span {
color: #AAA;
}
.member-abstract .user ul.user-itemborder {
margin-top: 8px; margin-top: 8px;
border-top: 1px solid #D5D5D5;
padding: 4px 0 0;
} }
.nav-tabs li a { .member-abstract .user ul.user-itemborder li, .member-abstract .user ul.user-itemborder li span {
padding-right: 32px; color: #333;
}
.member-abstract .user:hover ul.user-itemborder {
color: #EDEDED;
border-top: 1px solid #666;
}
.member-abstract .user:hover ul.user-itemborder li, .member-abstract .user:hover ul.user-itemborder li span {
color: #EDEDED;
}
.member-abstract .user ul.user-itemborder li {
width: 33%;
font-size: 11px;
text-align: center;
}
.member-abstract .user ul.user-itemborder li span {
font-size: 13px;
font-weight: bold;
padding-right: 5px;
}
.member-large .user {
width: 80px;
min-height: 125px;
}
.member-large .user-avatar {
margin-right: 0;
}
.member-large .user-name {
font-weight: bold;
font-size: 13px;
width: 80px;
line-height: 18px;
padding-top: 5px;
text-align: center;
}
.rolesTag {
width: 100%;
}
.rolesTag td {
height: 6px;
background-color: #333;
}
.rolesTag td.teacher {
background-color: #F38C08;
}
.rolesTag td.student {
background-color: #186AB6;
}
.rolesTag td.staff {
background-color: #139E2F;
}
.site-map {
padding: 15px;
}
.site-map .map-block {
width: 250px;
min-height: 20px;
border: 1px solid #dedede;
background-color: #E6E6E6;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
margin-bottom: 10px;
}
.site-map .map-block ul {
margin: 0px;
list-style: none;
}
.site-map .map-block li {
font-size: 12px;
background-color: #F7F7F7;
padding: 5px 15px;
border-top: 1px solid #FFF;
border-bottom: 1px solid #dedede;
}
.site-map .map-block li:last-child {
border-radius: 0 0 4px 4px;
border-bottom: none;
}
.site-map .map-block li:hover a {;
text-decoration: none;
}
.site-map .map-block li.disabled {
color: #C9C9C9;
}
.site-map .map-block li.disabled .onoff {
box-shadow: 0px 1px 0px rgba(255, 255, 255, 0.5), 0 0 5px rgba(0,0,0,.2) inset;
background-color: #9C9C9C;
color: #CACACA;
}
.site-map .map-block h4 {
line-height: 30px;
padding: 0 15px;
border-radius: 4px 4px 0 0;
box-shadow: 0px 1px 2px #A8A8A8;
position: relative;
background-image: -moz-linear-gradient(top, #FCFCFC, #DFDFDF);
background-image: -ms-linear-gradient(top, #FCFCFC, #DFDFDF);
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#FCFCFC), to(#DFDFDF));
background-image: -webkit-linear-gradient(top, #FCFCFC, #DFDFDF);
background-image: -o-linear-gradient(top, #FCFCFC, #DFDFDF);
background-image: linear-gradient(top, #FCFCFC, #DFDFDF);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FCFCFC', endColorstr='#DFDFDF', GradientType=0);
}
.onoff {
display: block;
background-color: #5EB92B;
font-size: 9px;
padding: 0px 10px;
border-radius: 8px;
line-height: 16px;
height: 15px;
color: #FFF;
width: 38px;
border: none;
box-shadow: 0px 1px 0px rgba(255, 255, 255, 0.5), 0 0 5px rgba(13, 75, 23, 0.5) inset;
margin-top: 2px;
} }

View File

@ -19,22 +19,28 @@ class Admin::SitesController < ApplicationController
redirect_to :back redirect_to :back
end end
def mail_setting
end
def site_info def site_info
end end
def sitemap
@items = get_homepage.children rescue []
end
def sitemap_toggle
@item = Item.find(params[:id])
@item.sitemap_enabled = !@item.sitemap_enabled
@item.save
end
def system_info def system_info
end end
def language
end
def mail_setting
end
def ui_theme def ui_theme
end end

View File

@ -11,6 +11,7 @@ class Item
field :enabled_for, :type => Array, :default => nil field :enabled_for, :type => Array, :default => nil
field :menu_enabled_for, :type => Array, :default => nil field :menu_enabled_for, :type => Array, :default => nil
field :title, localize: true field :title, localize: true
field :sitemap_enabled, :type => Boolean, :default => true
validates_format_of :name, :with => /^[0-9a-zA-Z\-_]+$/ validates_format_of :name, :with => /^[0-9a-zA-Z\-_]+$/

View File

@ -0,0 +1,13 @@
<div class="map-block">
<h4><%= sitemap_block.i18n_variable[I18n.locale] %></h4>
<ul>
<% sitemap_block.children.each do |child| %>
<li class="clear">
<%= child.i18n_variable[I18n.locale] %>
<button id="<%= child.id %>" class="onoff pull-right">
<%= child.sitemap_enabled ? t('on_cap') : t('off_cap') %>
</button>
</li>
<% end if sitemap_block.children %>
</ul>
</div>

View File

@ -0,0 +1,30 @@
<% content_for :side_bar do %>
<%= render 'side_bar' %>
<% end %>
<div class="site-map">
<%= render :partial => 'sitemap_block', :collection => @items %>
</div>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "lib/jquery.masonry.min.js" %>
<script>
$(document).ready(function(){
$('.site-map').masonry({
itemSelector: '.map-block',
columnWidth: 260,
isAnimated: true
});
});
$(document).on('click', '.onoff', function () {
$(this).parents("li").toggleClass("disabled");
if($(this).parents("li").attr("class").indexOf("disabled") > 0){
$(this).text('OFF')
} else {
$(this).text('ON')
}
$.getScript('admin_sites_path' + '/' + $(this).attr('id') + '/sitemap_toggle');
});
</script>
<% end %>

View File

@ -114,11 +114,12 @@ Orbit::Application.routes.draw do
get 'add_attribute_field' get 'add_attribute_field'
end end
resources :sites do resources :sites do
get 'site_info'
get 'system_info'
get 'language'
get 'mail_setting' get 'mail_setting'
get 'site_info'
get 'sitemap'
get 'system_info'
get 'ui_theme' get 'ui_theme'
put 'sitemap_toggle', :on => :member
end end
resources :snippets resources :snippets
resources :tags resources :tags