Final Ray's modifications

This commit is contained in:
chris2tof 2011-11-19 21:47:18 +08:00
parent dac6348402
commit ad9f9bbf5c
19 changed files with 122 additions and 135 deletions

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 198 B

After

Width:  |  Height:  |  Size: 1010 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@ -21,7 +21,7 @@ ul {
margin:0; margin:0;
padding:0; padding:0;
} }
input{ .info_input input{
border:none; border:none;
padding:5px; padding:5px;
border-radius: 5px; border-radius: 5px;
@ -91,6 +91,11 @@ h1 {
border-top:1px solid #406cc3; border-top:1px solid #406cc3;
border-bottom:1px solid #242628; border-bottom:1px solid #242628;
} }
#infos_list .member_setup ul li.set_3 {
background-position:left bottom;
border-top:1px solid #406cc3;
border-bottom:1px solid #242628;
}
#user_list .member_setup ul li.set_1 a span { #user_list .member_setup ul li.set_1 a span {
background-position:left bottom; background-position:left bottom;
color:#eeeeee; color:#eeeeee;
@ -139,6 +144,9 @@ h1 {
.main_list { .main_list {
padding-top:70px; padding-top:70px;
} }
.main_list ul {
clear:both;
}
.main_list li { .main_list li {
background:url(<%= asset_path '75.png' %>) repeat left top; background:url(<%= asset_path '75.png' %>) repeat left top;
margin-bottom:20px; margin-bottom:20px;
@ -173,6 +181,9 @@ h1 {
.main_list li.list_item:hover { .main_list li.list_item:hover {
border:1px solid #3699dd; border:1px solid #3699dd;
} }
.main_list li.disable {
opacity:0.6;
}
.main_list li.list_item:hover span { .main_list li.list_item:hover span {
line-height:38px; line-height:38px;
} }
@ -206,6 +217,13 @@ h1 {
#main .action a.delete{ #main .action a.delete{
background-position:-38px top; background-position:-38px top;
} }
#main a.switch{
background:url(<%= asset_path 'switch.png' %>) no-repeat left 3px;
width:40px;
}
#main .disable a.switch{
background:url(<%= asset_path 'switch.png' %>) no-repeat left bottom;
}
#main .action a.show:hover{ #main .action a.show:hover{
background-position:left -19px; background-position:left -19px;
} }
@ -238,19 +256,37 @@ h1 {
#add_new a:hover { #add_new a:hover {
background-position: -54px 3px; background-position: -54px 3px;
} }
.buttom {
float:right;
}
#confirm a{ #confirm a{
background-position:4px -70px; background-position:4px -70px;
} }
#confirm a:hover{ #confirm a:hover{
background-position: 4px -51px; background-position: 4px -51px;
} }
#create a{
background-image: none;
padding: 0 10px;
}
#update a{
background-position:4px -112px;
}
#update a:hover{
background-position:4px -89px;
}
#back a{
background-position:4px -156px;
}
#back a:hover{
background-position:4px -133px;
}
.buttom a { .buttom a {
margin-bottom: 20px; margin:0 0 20px 10px;
background-image:url(<%= asset_path 'icon.png' %>); background-image:url(<%= asset_path 'icon.png' %>);
background-repeat:no-repeat; background-repeat:no-repeat;
font-size:12px; font-size:12px;
color:#FFF; color:#FFF;
float:right;
display:inline-block; display:inline-block;
padding:0 10px 0 25px; padding:0 10px 0 25px;
background-color: rgba(0, 0, 0, 0.75); background-color: rgba(0, 0, 0, 0.75);
@ -279,6 +315,21 @@ h1 {
position:absolute; position:absolute;
top:-30px; top:-30px;
} }
#porfile .user_mail {
text-align: center;
background:url(<%= asset_path 'upload_but.png' %>) repeat-x left top;
border:none;
border-radius: 5px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
padding:3px 10px 1px;
margin-top:10px;
width:110px;
height: 21px;
font-size: 12px;
color:#666666;
text-shadow: 0 1px 0 #FFFFFF;
}
#porfile label { #porfile label {
display:block; display:block;
text-shadow: 0 1px 0 #FFFFFF; text-shadow: 0 1px 0 #FFFFFF;
@ -326,6 +377,7 @@ h1 {
margin-left:180px; margin-left:180px;
} }
#person { #person {
text-align:center;
left: 265px; left: 265px;
position: fixed; position: fixed;
top: 75px; top: 75px;
@ -340,7 +392,16 @@ h1 {
-webkit-box-shadow: 0px 0px 4px #180902;/* Safari 和 Chrome */ -webkit-box-shadow: 0px 0px 4px #180902;/* Safari 和 Chrome */
box-shadow: 0px 0px 4px #180902; /* Opera 10.5 + */ box-shadow: 0px 0px 4px #180902; /* Opera 10.5 + */
} }
#person .mail {
color: #FFFFFF;
font-size: 12px;
text-shadow:0px 1px 0px #333;
font-weight:bold;
background:url(<%= asset_path 'line.png' %>) repeat-x left top;
padding-top:10px;
}
#upload, #edit{ #upload, #edit{
margin: 0 auto;
display:block; display:block;
text-shadow: 0 1px 0 #FFFFFF; text-shadow: 0 1px 0 #FFFFFF;
background:url(<%= asset_path 'upload_but.png' %>) repeat-x left top; background:url(<%= asset_path 'upload_but.png' %>) repeat-x left top;

View File

@ -52,7 +52,7 @@ class User
infos = self.user_infos.detect {|info| info.key.to_s.eql?('profile') } infos = self.user_infos.detect {|info| info.key.to_s.eql?('profile') }
if infos if infos
first_name = infos.attribute_values.detect {|value| value.key.to_s.eql?('first_name') }[I18n.locale.to_s] rescue nil first_name = infos.attribute_values.detect {|value| value.key.to_s.eql?('first_name') }[I18n.locale.to_s] rescue nil
last_name = infos.attribute_values.detect {|value| value.key.to_s.eql?('last_name') }[I18n.locale.to_s] rescue nil last_name = infos.attribute_values.detect {|value| value.key.to_s.eql?('family_name') }[I18n.locale.to_s] rescue nil
return "#{first_name} #{last_name}" return "#{first_name} #{last_name}"
else else
return nil return nil

View File

@ -53,7 +53,7 @@ class UserAttributeModel
end end
def is_disabled? def is_disabled?
self.disabled self.disabled.blank? ? false : self.disabled
end end
def get_enabled_attribute_models def get_enabled_attribute_models

View File

@ -20,12 +20,8 @@
<% if attribute_model.new_record? %> <% if attribute_model.new_record? %>
<a href="#" class="delete"><%= t(:delete) %></a> <a href="#" class="delete"><%= t(:delete) %></a>
<% else %> <% else %>
<% if attribute_model.is_built_in? %> <% if attribute_model.is_built_in? %>
<a href="#" class="change_built_in" id="<%= attribute_model.id %>"> <a href="#" class="change_built_in switch" id="<%= attribute_model.id %>"></a>
<span style="display:<%= attribute_model.is_disabled? ? 'none' : 'inline' %>"><%= t(:disable) %></span>
<span style="display:<%= attribute_model.is_disabled? ? 'inline' : 'none' %>"><%= t(:enable) %></span>
</a>
<%= hidden_field_tag "user_#{@attribute}_model[attribute_models][][disabled]", attribute_model.is_disabled? , :class => 'built_in_state' %> <%= hidden_field_tag "user_#{@attribute}_model[attribute_models][][disabled]", attribute_model.is_disabled? , :class => 'built_in_state' %>
<% else %> <% else %>
<a href="#" class="remove_existing_record delete"><%= t(:delete) %></a> <a href="#" class="remove_existing_record delete"><%= t(:delete) %></a>

View File

@ -1,5 +1,5 @@
<div id="UserRole_block" class="roles_block"> <div id="UserRole_block" class="roles_block">
<h2>User Role</h2> <h2><%= t("admin.user_#{@attribute}") %></h2>
<div class="info_input"> <div class="info_input">
<table border="0" cellspacing="0" cellpadding="0"> <table border="0" cellspacing="0" cellpadding="0">
<thead class="list_head"> <thead class="list_head">
@ -68,7 +68,7 @@
}); });
$('#attributes_block a.change_built_in').click(function(){ $('#attributes_block a.change_built_in').click(function(){
$(this).children().toggle(); $(this).parent().toggleClass('disable');
var $am = $(this).next('.built_in_state') var $am = $(this).next('.built_in_state')
$am.attr('value', ($am.attr('value') == "false") ? "true" : "false"); $am.attr('value', ($am.attr('value') == "false") ? "true" : "false");
}); });

View File

@ -1,21 +1,14 @@
<% content_for :body_id do %>roles_list<% end -%> <% content_for :body_id do %><%= "#{@attribute}s_list" %><% end -%>
<% content_for :secondary do %>
<div class="member_setup">
<h1>Member Setup</h1>
<ul class="list">
<li class="set_1"><%= link_to content_tag(:span, t('admin.list_users')), admin_users_path %></li>
<li class="set_2"><%= link_to content_tag(:span, t('admin.list_user_roles')), admin_user_role_models_path %></li>
</ul>
</div>
<% end -%>
<div id="porfile"> <div id="porfile">
<%= form_for @user_attribute_model, :url => eval("admin_user_#{@attribute}_model_path(@user_role_model)") do |f| %> <%= form_for @user_attribute_model, :url => eval("admin_user_#{@attribute}_model_path(@user_role_model)") do |f| %>
<%= f.error_messages %> <%= f.error_messages %>
<%= render :partial => "admin/user_attribute_models/form", :locals => { :f => f, :is_new => false } %> <%= render :partial => "admin/user_attribute_models/form", :locals => { :f => f, :is_new => false } %>
<div class='buttom clear'> <div id="update" class='buttom clear'>
<%= f.submit t('update') %> <%= link_back %> <%= link_to t('update'), "#", :onclick=>"$('#edit_user_role_model_#{@user_attribute_model.id}').submit()" %>
</div>
<div id="back" class='buttom clear'>
<%= link_back %>
</div> </div>
<% end -%> <% end -%>
</div> </div>

View File

@ -1,60 +1,32 @@
<% content_for :body_id do %>roles_list<% end -%> <% content_for :body_id do %><%= "#{@attribute}s_list" %><% end -%>
<% content_for :secondary do %>
<div class="member_setup">
<h1>Member Setup</h1>
<ul class="list">
<li class="set_1"><%= link_to content_tag(:span, t('admin.list_users')), admin_users_path %></li>
<li class="set_2"><%= link_to content_tag(:span, t('admin.list_user_roles')), admin_user_role_models_path %></li>
</ul>
</div>
<% end -%>
<!-- <table>
<tr>
<th><%= t("admin.#{@attribute}") %></th>
<th><%= t('admin.key') %></th>
<th><%= t('admin.action') %></th>
</tr>
<% @user_attribute_models.each do |user_attribute_model| %>
<tr>
<td><%= user_attribute_model.i18n_variable[I18n.locale] %></td>
<td><%= user_attribute_model.key %></td>
<td>
<%= link_to t(:edit), eval("edit_admin_user_#{@attribute}_model_path(user_attribute_model)") %> |
<% if user_attribute_model.is_built_in? %>
<%= link_to t(:disable), eval("admin_user_#{@attribute}_model_path(user_attribute_model, :authenticity_token => form_authenticity_token, :user_#{@attribute}_model => {:disabled => true})"), :remote => true, :method => :put, :id => "disable_#{user_attribute_model.id}", :style => "display:#{user_attribute_model.is_disabled? ? 'none' : 'inline'}" %>
<%= link_to t(:enable), eval("admin_user_#{@attribute}_model_path(user_attribute_model, :authenticity_token => form_authenticity_token, :user_#{@attribute}_model => {:disabled => false})"), :remote => true, :method => :put, :id => "enable_#{user_attribute_model.id}", :style => "display:#{user_attribute_model.is_disabled? ? 'inline' : 'none'}" %>
<% else %>
<%= link_to t(:delete), eval("admin_user_#{@attribute}_model_path(user_attribute_model)"), :confirm => t('sure?'), :method => :delete %>
<% end %>
</td>
</tr>
<% end %>
</table> -->
<div class="main_list"> <div class="main_list">
<div id="add_new" class="buttom clear"> <div id="add_new" class="buttom clear">
<%= link_to t('admin.new_user_role'), new_admin_user_role_model_path %> <%= link_to t("admin.new_user_#{@attribute}"), eval("new_admin_user_#{@attribute}_model_path") %>
</div> </div>
<ul> <ul>
<li class="list_head clear"> <li class="list_head clear">
<span class="roles">Roles</span> <span class="<%= @attribute %>s"><%= t("admin.#{@attribute}") %></span>
<span class="action">Action</span> <span class="action">Action</span>
</li> </li>
<% @user_attribute_models.each do |user_attribute_model| %> <% @user_attribute_models.each do |user_attribute_model| %>
<li class="list_item clear"> <li id="attribute_<%= user_attribute_model.id %>" class="list_item <%= "#{user_attribute_model.is_disabled? ? 'disable' : ''}" %> clear">
<span class="roles <%= user_attribute_model.i18n_variable[:key].downcase %>"><%= user_attribute_model.i18n_variable[I18n.locale] %></span> <span class="<%= @attribute %>s <%= user_attribute_model.i18n_variable[:key].downcase %>"><%= user_attribute_model.i18n_variable[I18n.locale] %></span>
<span class="action"> <span class="action">
<%= link_to t(:edit), eval("edit_admin_user_#{@attribute}_model_path(user_attribute_model)"), :class => 'edit' %> <%= link_to t(:edit), eval("edit_admin_user_#{@attribute}_model_path(user_attribute_model)"), :class => 'edit' %>
<%= link_to t(:delete), eval("admin_user_#{@attribute}_model_path(user_attribute_model)"), :class => 'delete', :confirm => t('sure?'), :method => :delete unless user_attribute_model.is_built_in? %> <% if user_attribute_model.is_built_in? %>
<%= link_to t(:enable), eval("admin_user_#{@attribute}_model_path(user_attribute_model, :authenticity_token => form_authenticity_token, :user_#{@attribute}_model => {:disabled => true})"), :remote => true, :method => :put, :id => "disable_#{user_attribute_model.id}", :style => "display:#{user_attribute_model.is_disabled? ? 'none' : ''}", :class => 'switch' %>
<%= link_to t(:disable), eval("admin_user_#{@attribute}_model_path(user_attribute_model, :authenticity_token => form_authenticity_token, :user_#{@attribute}_model => {:disabled => false})"), :remote => true, :method => :put, :id => "enable_#{user_attribute_model.id}", :style => "display:#{user_attribute_model.is_disabled? ? '' : 'none'}", :class => 'switch' %>
<% else %>
<%= link_to t(:delete), eval("admin_user_#{@attribute}_model_path(user_attribute_model)"), :class => 'delete', :confirm => t('sure?'), :method => :delete %>
<% end %>
</span> </span>
</li> </li>
<% end %> <% end %>
</ul> </ul>
<div id="add_new" class="buttom clear"> <div id="add_new" class="buttom clear">
<%= link_to t('admin.new_user_role'), new_admin_user_role_model_path %> <%= link_to t("admin.new_user_#{@attribute}"), eval("new_admin_user_#{@attribute}_model_path") %>
</div> </div>
</div> </div>

View File

@ -1,21 +1,14 @@
<% content_for :body_id do %>roles_list<% end -%> <% content_for :body_id do %><%= "#{@attribute}s_list" %><% end -%>
<% content_for :secondary do %>
<div class="member_setup">
<h1>Member Setup</h1>
<ul class="list">
<li class="set_1"><%= link_to content_tag(:span, t('admin.list_users')), admin_users_path %></li>
<li class="set_2"><%= link_to content_tag(:span, t('admin.list_user_roles')), admin_user_role_models_path %></li>
</ul>
</div>
<% end -%>
<div id="porfile"> <div id="porfile">
<%= form_for @user_attribute_model, :url => eval("admin_user_#{@attribute}_models_path") do |f| %> <%= form_for @user_attribute_model, :url => eval("admin_user_#{@attribute}_models_path") do |f| %>
<%= f.error_messages %> <%= f.error_messages %>
<%= render :partial => "admin/user_attribute_models/form", :locals => { :f => f, :is_new => true } %> <%= render :partial => "admin/user_attribute_models/form", :locals => { :f => f, :is_new => true } %>
<div class='buttom clear'> <div id="create" class='buttom clear'>
<%= f.submit t('create') %> <%= link_back %> <%= link_to t('create'), "#", :onclick=>"$('#new_user_attribute_model').submit()" %>
</div>
<div id="back" class='buttom clear'>
<%= link_back %>
</div> </div>
<% end -%> <% end -%>
</div> </div>

View File

@ -1,2 +1,3 @@
$("#enable_<%= @user_attribute_model.id %>").toggle(); $("#enable_<%= @user_attribute_model.id %>").toggle();
$("#disable_<%= @user_attribute_model.id %>").toggle(); $("#disable_<%= @user_attribute_model.id %>").toggle();
$("#attribute_<%= @user_attribute_model.id %>").toggleClass('disable');

View File

@ -7,7 +7,7 @@
<%#= file_field_tag 'file' %> <%#= file_field_tag 'file' %>
<%#= hidden_field_tag :avatar_cache %> <%#= hidden_field_tag :avatar_cache %>
<a id="upload" href="#"> Choose a file... </a> <a id="upload" href="#"> Choose a file... </a>
<%= f.text_field :email %> <%= f.text_field :email, :onfocus => "this.value='';", :onblur => "if(this.value==''){this.value='E-Mail';}", :value => "E-Mail", :class => 'user_mail' %>
<label> <label>
<%= f.check_box :admin %><span>Admin</span> <%= f.check_box :admin %><span>Admin</span>
</label> </label>

View File

@ -1,21 +1,14 @@
<% content_for :body_id do %>user_list<% end -%> <% content_for :body_id do %>user_list<% end -%>
<% content_for :secondary do %>
<div class="member_setup">
<h1>Member Setup</h1>
<ul class="list">
<li class="set_1"><%= link_to content_tag(:span, t('admin.list_users')), admin_users_path %></li>
<li class="set_2"><%= link_to content_tag(:span, t('admin.list_user_roles')), admin_user_role_models_path %></li>
</ul>
</div>
<% end -%>
<div id="porfile"> <div id="porfile">
<%= form_for @user, :url => admin_user_path(@user), :html => { :multipart => true } do |f| %> <%= form_for @user, :url => admin_user_path(@user), :html => { :multipart => true } do |f| %>
<%= f.error_messages %> <%= f.error_messages %>
<%= render :partial => 'form', :locals => { :f => f } %> <%= render :partial => 'form', :locals => { :f => f } %>
<div class='buttom clear'> <div id="update" class='buttom clear'>
<%= f.submit t('update') %> <%= link_back %> <%= link_to t('update'), "#", :onclick=>"$('#edit_user_#{@user.id}').submit()" %>
</div>
<div id="back" class='buttom clear'>
<%= link_back %>
</div> </div>
<% end -%> <% end -%>
</div> </div>

View File

@ -1,17 +1,5 @@
<% content_for :body_id do %>user_list<% end -%> <% content_for :body_id do %>user_list<% end -%>
<% content_for :secondary do %>
<div class="member_setup">
<h1>Member Setup</h1>
<ul class="list">
<li class="set_1"><%= link_to content_tag(:span, t('admin.list_users')), admin_users_path %></li>
<li class="set_2"><%= link_to content_tag(:span, t('admin.list_user_roles')), admin_user_role_models_path %></li>
</ul>
</div>
<% end -%>
<div class="main_list"> <div class="main_list">
<%= flash_messages %> <%= flash_messages %>
<div id="add_new" class="buttom clear"> <div id="add_new" class="buttom clear">

View File

@ -1,21 +1,14 @@
<% content_for :body_id do %>user_list<% end -%> <% content_for :body_id do %>user_list<% end -%>
<% content_for :secondary do %>
<div class="member_setup">
<h1>Member Setup</h1>
<ul class="list">
<li class="set_1"><%= link_to content_tag(:span, t('admin.list_users')), admin_users_path %></li>
<li class="set_2"><%= link_to content_tag(:span, t('admin.list_user_roles')), admin_user_role_models_path %></li>
</ul>
</div>
<% end -%>
<div id="porfile"> <div id="porfile">
<%= form_for @user, :url => admin_users_path, :html => { :multipart => true } do |f| %> <%= form_for @user, :url => admin_users_path, :html => { :multipart => true } do |f| %>
<%= f.error_messages %> <%= f.error_messages %>
<%= render :partial => 'form', :locals => { :f => f } %> <%= render :partial => 'form', :locals => { :f => f } %>
<div id="confirm" class='buttom clear'> <div id="create" class='buttom clear'>
<%= f.submit t('create') %> <%= link_back %> <%= link_to t('create'), "#", :onclick=>"$('#new_user').submit()" %>
</div>
<div id="back" class='buttom clear'>
<%= link_back %>
</div> </div>
<% end -%> <% end -%>
</div> </div>

View File

@ -1,15 +1,5 @@
<% content_for :body_id do %>user_list<% end -%> <% content_for :body_id do %>user_list<% end -%>
<% content_for :secondary do %>
<div class="member_setup">
<h1>Member Setup</h1>
<ul class="list">
<li class="set_1"><%= link_to content_tag(:span, t('admin.list_users')), admin_users_path %></li>
<li class="set_2"><%= link_to content_tag(:span, t('admin.list_user_roles')), admin_user_role_models_path %></li>
</ul>
</div>
<% end -%>
<div id="porfile"> <div id="porfile">
<div id="person"> <div id="person">

View File

@ -31,7 +31,14 @@
<div id="search"> <div id="search">
<input id="user_search" name="user[username]" size="30" type="text" /> <input id="user_search" name="user[username]" size="30" type="text" />
</div> </div>
<%= yield :secondary %> <div class="member_setup">
<h1>Member Setup</h1>
<ul class="list">
<li class="set_1"><%= link_to content_tag(:span, t('admin.list_users')), admin_users_path %></li>
<li class="set_2"><%= link_to content_tag(:span, t('admin.list_user_roles')), admin_user_role_models_path %></li>
<li class="set_3"><%= link_to content_tag(:span, t('admin.list_user_infos')), admin_user_info_models_path %></li>
</ul>
</div>
</div> </div>
<div id="main"> <div id="main">