Ray's back-end modifications for sub-roles

This commit is contained in:
Christophe Vilayphiou 2011-12-28 20:57:18 +08:00
parent 62aaf79491
commit 75c9851dbc
10 changed files with 83 additions and 35 deletions

View File

@ -344,6 +344,7 @@ body{
#person label {
display: block;
margin: 15px 0 0;
width: auto;
}
#person label input {
}
@ -362,10 +363,10 @@ body{
padding: 0;
width: 140px;
}
#porfile .users{
#profile .users{
margin-left: 180px;
}
.roles_block {
.roles_block, .attributes_block {
background: url(<%= asset_path "75.png" %>) repeat left top;
min-width:710px;
margin-bottom:50px;
@ -378,7 +379,7 @@ body{
-webkit-box-shadow: 0px 0px 4px #180902;/* Safari 和 Chrome */
box-shadow: 0px 0px 4px #180902; /* Opera 10.5 + */
}
.roles_block h2 {
.roles_block>h2, .attributes_block>h2 {
color: #FFFFFF;
font-weight: normal;
margin: 0;
@ -387,7 +388,18 @@ body{
text-shadow: 0 3px 2px #000000;
top: -30px;
}
.group>h2 {
color: #FFFFFF;
margin: 0 20px;
padding: 10px 0;
}
.group>.info_input {
border: 1px solid #686868;
margin: 0 20px;
padding: 10px;
}
.main hr {
background-color: #222222;
height:8px;
border:none;
margin:0;
@ -399,11 +411,11 @@ body{
#basic_block hr {
background-color: #666666;
}
#teacher_block hr {
background-color: #0071A9;
hr.teacher_block {
background-color: #0071A9 !important;
}
#student_block hr {
background-color: #AF0045;
hr.student_block {
background-color: #AF0045 !important;
}
.info_input {
padding:10px 20px;
@ -425,15 +437,41 @@ body{
.info_input .list_item {
color:#AEAEAE;
}
.info_input .add {
#add_attribute {
}
.add {
-moz-box-shadow:inset 0px 1px 0px 0px #8c8c8c;
-webkit-box-shadow:inset 0px 1px 0px 0px #8c8c8c;
box-shadow:inset 0px 1px 0px 0px #8c8c8c;
background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #303030), color-stop(1, #1a1a1a) );
background:-moz-linear-gradient( center top, #303030 5%, #1a1a1a 100% );
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#303030', endColorstr='#1a1a1a');
background-color:#303030;
-moz-border-radius:3px;
-webkit-border-radius:3px;
border-radius:3px;
border:1px solid #000;
display:block;
padding-left:22px;
color:#999;
font-family:arial;
font-size:12px;
line-height:21px;
height:19px;
background:url(<%= asset_path "icon.png" %>) no-repeat -59px 0;
margin-top: 10px;
color: #DDDDDD;
font-weight:bold;
padding:0px;
text-decoration:none;
text-shadow:0px -1px 0px #000000;
text-align: center;
line-height: 26px;
}
.add:hover {
background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #1a1a1a), color-stop(1, #303030) );
background:-moz-linear-gradient( center top, #1a1a1a 5%, #303030 100% );
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#1a1a1a', endColorstr='#303030');
background-color:#1a1a1a;
}
.add:active {
position:relative;
top:1px;
}
.main table {
@ -466,7 +504,6 @@ body{
-webkit-border-radius: 0 5px 5px 0;
}
.main thead td {
line-height:40px;
font-size:16px;
text-shadow: 0px 1px 1px #3e2914;
}

View File

@ -15,9 +15,8 @@
<%= f.select "select_list_options", attribute_field.select_list_options, :style => "width:130px" %>
</div>
</td>
<td>
<span class="action">
<% if attribute_field.new_record? %>
<td class="action">
<% if attribute_field.new_record? %>
<a href="#" class="delete"><%= t(:delete) %></a>
<% else %>
<%= f.hidden_field :id %>
@ -25,10 +24,9 @@
<a href="#" class="switch" id="<%= attribute_field.id %>"></a>
<%= f.hidden_field :disabled, :value => attribute_field.is_disabled? , :class => 'built_in_state' %>
<% else %>
<a href="#" class="remove_existing_record"><%= t(:delete) %></a>
<a href="#" class="remove_existing_record delete"><%= t(:delete) %></a>
<%= f.hidden_field :_destroy, :value => nil, :class => 'should_destroy' %>
<% end %>
<% end %>
</span>
</td>
</tr>

View File

@ -42,7 +42,7 @@
</thead>
<tfoot>
<tr>
<td colspan="5">
<td colspan="6">
<%= hidden_field_tag 'attribute_field_count', @attribute.attribute_fields.count %>
<a href="#" class="add"><%= t(:add) %></a>
</td>

View File

@ -1,5 +1,6 @@
<div class="attributes_block <%= @class %>">
<h2><%= t("admin.#{@attribute_type}") %></h2>
<hr>
<div class="info_input">
<table border="0" cellspacing="0" cellpadding="0">
<thead class="list_head">
@ -26,13 +27,14 @@
<div id='sub_roles' class="attributes_block <%= @class %>">
<h2>Sub roles</h2>
<hr>
<% @attribute.sub_roles.each_with_index do |sub_role, i| %>
<%= render :partial => 'form_sub', :object => sub_role, :locals => {:f => f, :i => i} %>
<% end %>
</div>
</div>
<div id='add_sub_role' class="info_input attributes_block">
<div id='add_sub_role'>
<%= hidden_field_tag 'attribute_field_count', @attribute.sub_roles.count %>
<a href="#" class="add"><%= t(:add) %></a>
</div>

View File

@ -1,4 +1,3 @@
<div class="info_input">
<table border="0" cellspacing="0" cellpadding="0">
<thead class="list_head">
@ -20,7 +19,7 @@
</tr>
</tbody>
</table>
<div class="attributes_block <%= @class %>">
<div class="group">
<h2>Attributes</h2>
<div class="info_input">
<table class="sub_role_attributes" border="0" cellspacing="0" cellpadding="0">
@ -37,10 +36,12 @@
</thead>
<tfoot>
<tr>
<td id='add_attribute' colspan="5">
<%= hidden_field_tag 'attribute_field_count', sub_role.attribute_fields.count %>
<a href="#" class="add"><%= t(:add) %></a>
<%= hidden_field_tag 'sub_role_temp_id', (i rescue 'new_sub_roles') %>
<td colspan="6">
<div id='add_attribute'>
<%= hidden_field_tag 'attribute_field_count', sub_role.attribute_fields.count %>
<a href="#" class="add"><%= t(:add) %></a>
<%= hidden_field_tag 'sub_role_temp_id', (i rescue 'new_sub_roles') %>
</div>
</td>
</tr>
</tfoot>

View File

@ -28,7 +28,7 @@
<% @roles.each do |role| %>
<div id="<%= role.id %>_block" class="attributes_block <%= @class %>" <%= raw(' style="display: none;"') unless ((@user.role.id.eql?(role.id) rescue nil) || (role.key.eql?('student') && @user.new_record?)) %>>
<h2><%= role.i18n_variable[I18n.locale] %></h2>
<hr>
<hr class="<#%= @user.role.key %>_block">
<%= render :partial => 'sub_role_selector', :locals => {:f => f, :role => role} %>
<%= render :partial => 'sub_role', :collection => role.sub_roles, :locals => {:f => f, :role => role} %>
</div>

View File

@ -1,4 +1,4 @@
<div id="sub_role_<%= show_sub_role.id %>" class="info_input">
<div id="sub_role_<%= show_sub_role.id %>" class="group">
<h2><%= show_sub_role.i18n_variable[I18n.locale] %></h2>
<%= render :partial => 'show_attribute', :object => show_sub_role %>
</div>

View File

@ -1,5 +1,6 @@
<div id="sub_role_<%= sub_role.id %>" class="info_input" <%= raw(' style="display: none;"') unless @user.sub_role_ids.include?(sub_role.id) %>>
<h2><%= sub_role.i18n_variable[I18n.locale] %></h2>
<div id="sub_role_<%= sub_role.id %>" class="group" <%= raw(' style="display: none;"') unless @user.sub_role_ids.include?(sub_role.id) %>>
<h2><%= sub_role.i18n_variable[I18n.locale] %></h2>
<div class="info_input">
<table border="0" cellspacing="0" cellpadding="0">
<thead class="list_head">
<tr>
@ -35,3 +36,4 @@
</tbody>
</table>
</div>
</div>

View File

@ -20,9 +20,9 @@
</div>
<% end -%>
<div id="<%= @user.role.key %>_block" class="roles_block <%= @class %>">
<div id="basic_block" class="roles_block <%= @class %>">
<h2><%= @user.role.i18n_variable[I18n.locale] %></h2>
<hr>
<hr class="<%= @user.role.key %>_block">
<%= render :partial => 'show_sub_role', :collection => @user.sub_roles %>
</div>
<div class="button_bar">

View File

@ -33,4 +33,12 @@ module ParserLayout
end
end
def parse_html_image(html)
html.scan(/(?<=\<img)(.*?)(?=\/\>)/){
$1.gsub(' ','').scan(/(?<=src=\")(.*?)(?=\")/){
return File.basename($1).gsub(/[\\\"]/, '')
}
}
end
end