From 75c9851dbcbc3b7387deeb8363b9fd62dcee91b5 Mon Sep 17 00:00:00 2001 From: Christophe Vilayphiou Date: Wed, 28 Dec 2011 20:57:18 +0800 Subject: [PATCH] Ray's back-end modifications for sub-roles --- app/assets/stylesheets/admin_back_end.css.erb | 67 ++++++++++++++----- .../attributes/_attribute_field.html.erb | 8 +-- app/views/admin/infos/_form.html.erb | 2 +- app/views/admin/roles/_form.html.erb | 4 +- app/views/admin/roles/_sub_role.html.erb | 13 ++-- app/views/admin/users/_form.html.erb | 2 +- app/views/admin/users/_show_sub_role.html.erb | 2 +- app/views/admin/users/_sub_role.html.erb | 8 ++- app/views/admin/users/show.html.erb | 4 +- lib/parsers/parser_layout.rb | 8 +++ 10 files changed, 83 insertions(+), 35 deletions(-) diff --git a/app/assets/stylesheets/admin_back_end.css.erb b/app/assets/stylesheets/admin_back_end.css.erb index f5ba3ccc..42b6453e 100644 --- a/app/assets/stylesheets/admin_back_end.css.erb +++ b/app/assets/stylesheets/admin_back_end.css.erb @@ -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; } diff --git a/app/views/admin/attributes/_attribute_field.html.erb b/app/views/admin/attributes/_attribute_field.html.erb index 56d0b3ad..63ee5953 100644 --- a/app/views/admin/attributes/_attribute_field.html.erb +++ b/app/views/admin/attributes/_attribute_field.html.erb @@ -15,9 +15,8 @@ <%= f.select "select_list_options", attribute_field.select_list_options, :style => "width:130px" %> - - - <% if attribute_field.new_record? %> + + <% if attribute_field.new_record? %> <%= t(:delete) %> <% else %> <%= f.hidden_field :id %> @@ -25,10 +24,9 @@ <%= f.hidden_field :disabled, :value => attribute_field.is_disabled? , :class => 'built_in_state' %> <% else %> - <%= t(:delete) %> + <%= t(:delete) %> <%= f.hidden_field :_destroy, :value => nil, :class => 'should_destroy' %> <% end %> <% end %> - \ No newline at end of file diff --git a/app/views/admin/infos/_form.html.erb b/app/views/admin/infos/_form.html.erb index bf31b652..103c7af1 100644 --- a/app/views/admin/infos/_form.html.erb +++ b/app/views/admin/infos/_form.html.erb @@ -42,7 +42,7 @@ - + <%= hidden_field_tag 'attribute_field_count', @attribute.attribute_fields.count %> <%= t(:add) %> diff --git a/app/views/admin/roles/_form.html.erb b/app/views/admin/roles/_form.html.erb index 11608072..b744f20c 100644 --- a/app/views/admin/roles/_form.html.erb +++ b/app/views/admin/roles/_form.html.erb @@ -1,5 +1,6 @@

<%= t("admin.#{@attribute_type}") %>

+
@@ -26,13 +27,14 @@

Sub roles

+
<% @attribute.sub_roles.each_with_index do |sub_role, i| %> <%= render :partial => 'form_sub', :object => sub_role, :locals => {:f => f, :i => i} %> <% end %>
-
+
<%= hidden_field_tag 'attribute_field_count', @attribute.sub_roles.count %> <%= t(:add) %>
diff --git a/app/views/admin/roles/_sub_role.html.erb b/app/views/admin/roles/_sub_role.html.erb index e5a5f076..4c39229c 100644 --- a/app/views/admin/roles/_sub_role.html.erb +++ b/app/views/admin/roles/_sub_role.html.erb @@ -1,4 +1,3 @@ -
@@ -20,7 +19,7 @@
-
+

Attributes

@@ -37,10 +36,12 @@ - diff --git a/app/views/admin/users/_form.html.erb b/app/views/admin/users/_form.html.erb index 07e7dc7f..37ee9d28 100644 --- a/app/views/admin/users/_form.html.erb +++ b/app/views/admin/users/_form.html.erb @@ -28,7 +28,7 @@ <% @roles.each do |role| %> diff --git a/app/views/admin/users/_show_sub_role.html.erb b/app/views/admin/users/_show_sub_role.html.erb index 22d8b758..4968b2db 100644 --- a/app/views/admin/users/_show_sub_role.html.erb +++ b/app/views/admin/users/_show_sub_role.html.erb @@ -1,4 +1,4 @@ -
+

<%= show_sub_role.i18n_variable[I18n.locale] %>

<%= render :partial => 'show_attribute', :object => show_sub_role %>
\ No newline at end of file diff --git a/app/views/admin/users/_sub_role.html.erb b/app/views/admin/users/_sub_role.html.erb index f55b8b48..ff8579c7 100644 --- a/app/views/admin/users/_sub_role.html.erb +++ b/app/views/admin/users/_sub_role.html.erb @@ -1,5 +1,6 @@ -
- <%= hidden_field_tag 'attribute_field_count', sub_role.attribute_fields.count %> - <%= t(:add) %> - <%= hidden_field_tag 'sub_role_temp_id', (i rescue 'new_sub_roles') %> + +
+ <%= hidden_field_tag 'attribute_field_count', sub_role.attribute_fields.count %> + <%= t(:add) %> + <%= hidden_field_tag 'sub_role_temp_id', (i rescue 'new_sub_roles') %> +
@@ -34,4 +35,5 @@ <% end %>
-
\ No newline at end of file +
+
\ No newline at end of file diff --git a/app/views/admin/users/show.html.erb b/app/views/admin/users/show.html.erb index 4ca95d09..c9b3d696 100644 --- a/app/views/admin/users/show.html.erb +++ b/app/views/admin/users/show.html.erb @@ -20,9 +20,9 @@
<% end -%> -
+

<%= @user.role.i18n_variable[I18n.locale] %>

-
+
<%= render :partial => 'show_sub_role', :collection => @user.sub_roles %>
diff --git a/lib/parsers/parser_layout.rb b/lib/parsers/parser_layout.rb index c97b8df2..c017854d 100644 --- a/lib/parsers/parser_layout.rb +++ b/lib/parsers/parser_layout.rb @@ -33,4 +33,12 @@ module ParserLayout end end + def parse_html_image(html) + html.scan(/(?<=\)/){ + $1.gsub(' ','').scan(/(?<=src=\")(.*?)(?=\")/){ + return File.basename($1).gsub(/[\\\"]/, '') + } + } + end + end