diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index bc4fc85ac..b5a9dc169 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -227,6 +227,16 @@ module ApplicationHelper xls_report.string end + # 用户资料是否完善 + def user_data_complete user + user_extension = UserExtensions.where(:user_id => user.id).first + data = true + if user_extension.gender.nil? || user_extension.school_id.nil? || user.lastname.blank? || (user_extension.identity == 3 && user_extension.school_id.nil?) + data = false + end + return data + end + # 获取用户单位 # 优先获取高校信息,如果改信息不存在则获取occupation def get_occupation_from_user user diff --git a/app/models/user.rb b/app/models/user.rb index 8fb7f36f6..e9aa1dde8 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -80,12 +80,12 @@ class User < Principal #每日一报、一事一报、不报 - MAIL_NOTIFICATION_OPTIONS = [ + # MAIL_NOTIFICATION_OPTIONS = [ #['week', :label_user_mail_option_week], # ['day', :label_user_mail_option_day], - ['all', :label_user_mail_option_all], - ['none', :label_user_mail_option_none] - ] + # ['all', :label_user_mail_option_all], + # ['none', :label_user_mail_option_none] + # ] has_many :homework_users has_many :homework_attaches, :through => :homework_users @@ -244,7 +244,7 @@ class User < Principal validates_format_of :mail, :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i, :allow_blank => true validates_length_of :mail, :maximum => MAIL_LENGTH_LIMIT, :allow_nil => true validates_confirmation_of :password, :allow_nil => true - validates_inclusion_of :mail_notification, :in => MAIL_NOTIFICATION_OPTIONS.collect(&:first), :allow_blank => true + # validates_inclusion_of :mail_notification, :in => MAIL_NOTIFICATION_OPTIONS.collect(&:first), :allow_blank => true validate :validate_password_length # validates_email_realness_of :mail before_create :set_mail_notification diff --git a/app/views/layouts/new_base_user.html.erb b/app/views/layouts/new_base_user.html.erb index b53f35edb..5778949aa 100644 --- a/app/views/layouts/new_base_user.html.erb +++ b/app/views/layouts/new_base_user.html.erb @@ -101,10 +101,10 @@
-
+
<% if User.current.logged? && User.current == @user%>
- <%=link_to image_tag(url_to_avatar(@user),width:"74", height: "74", :id => 'nh_source_tx'), + <%= link_to image_tag(url_to_avatar(@user),width:"74", height: "74", :id => 'nh_source_tx'), my_clear_user_avatar_temp_path, :class => "user_leftinfo_img", :remote => true %>
<%=link_to '', my_clear_user_avatar_temp_path, :class => 'homepageEditProfileIcon', :remote => true, :title => '点击编辑Logo' %> diff --git a/app/views/my/account.html.erb b/app/views/my/account.html.erb index 166a95ccb..560c10d8f 100644 --- a/app/views/my/account.html.erb +++ b/app/views/my/account.html.erb @@ -1,73 +1,73 @@ - <% if @force %> - <% message = AppliedMessage.where(:status => 3, :user_id => User.current.id, :viewed => 0).first %> - <% unless message.nil? %> -
+<% if @force %> + <% message = AppliedMessage.where(:status => 3, :user_id => User.current.id, :viewed => 0).first %> + <% unless message.nil? %> +
  消息:  您添加新的单位“<%= message.name %>”的申请,经确认为无效的单位信息,已被删除,请重新编辑您的单位资料。谢谢!
<% message.update_attribute(:viewed, true)%> -
- <% end %> -
-
  提示:  您尚未完善您的基本资料,完善后可使用更多功能
-
- <% end %> -
-
-
    -
  • 基本资料
  • -
  • 密码管理
  • -
-
-
-
- <%= labelled_form_for :user, @user, :url => {:action => "account"}, :html => {:id => 'my_account_form', :method => :post} do |f| %> -
- <% if( @act.nil? || @act != 'password') %> +
+ <% end %> +
+
  提示:  您尚未完善您的基本资料,完善后可使用更多功能
+
+<% end %> +
+
+
    +
  • 基本资料
  • +
  • 密码管理
  • +
+
+
+
+<%= labelled_form_for :user, @user, :url => {:action => "account"}, :html => {:id => 'my_account_form', :method => :post} do |f| %> +
+ <% if( @act.nil? || @act != 'password') %> <%= render_flash_messages %> <%= error_messages_for 'user',@user.user_extensions %> + <% end %> +
    +
  • *  登录名 : 
  • +
  • *  邮箱 : 
  • +
  • *  职业 : 
  • +
  • *  姓名 : 
  • +
  • 组织名 : *
  • +
  • *  性别 : 
  • +
  • *  单位名称 : 
  • +
  • 地区 : 
  • + + +
  • 个人主页 : 
  • +
  •   
  • +
+
    +
  • <%= f.text_field :login,:no_label=>true, :required => true, :style => "color:grey", :nh_required => "1", :name => "login", :class => "w210" %>
  • + <% if @force %> +
  • <%= f.text_field :mail,:no_label=>true, :required => true,:nh_required => "1",:class=>"w210",:disabled=>'disabled'%>
  • + <% else %> +
  • <%= f.text_field :mail,:no_label=>true, :required => true,:nh_required=>"1",:class=>"w210"%>
  • <% end %> -
      -
    • *  登录名 : 
    • -
    • *  邮箱 : 
    • -
    • *  职业 : 
    • -
    • *  姓名 : 
    • -
    • 组织名 : *
    • -
    • *  性别 : 
    • -
    • *  单位名称 : 
    • -
    • 地区 : 
    • -
    • 邮件通知 : 
    • - -
    • 个人主页 : 
    • -
    •   
    • -
    -
      -
    • <%= f.text_field :login,:no_label=>true, :required => true, :style => "color:grey", :nh_required => "1", :name => "login", :class => "w210" %>
    • - <% if @force %> -
    • <%= f.text_field :mail,:no_label=>true, :required => true,:nh_required => "1",:class=>"w210",:disabled=>'disabled'%>
    • - <% else %> -
    • <%= f.text_field :mail,:no_label=>true, :required => true,:nh_required=>"1",:class=>"w210"%>
    • - <% end %> -
    • - + + + - - - + + + <% if !User.current.user_extensions.nil? && !User.current.user_extensions.student_id.nil? %> <%= text_field_tag :no, User.current.user_extensions.student_id, :placeholder => l(:label_account_identity_studentID),:style => "width:127px;" %> @@ -76,159 +76,168 @@ <% end %> -
    • + -
    • <%= text_field_tag :lastname, @user.lastname+@user.firstname, :no_label => true, :required => true, :nh_required => "1",:class => "w210" %>姓名不能为空 +
    • <%= text_field_tag :lastname, @user.lastname+@user.firstname, :no_label => true, :required => true, :nh_required => "1",:class => "w210" %>姓名不能为空 -
    • - <% if User.current.user_extensions && User.current.user_extensions.gender && User.current.user_extensions.gender == 1 %> - - <% else %> - - <% end %> - -
    • +
    • + <% if User.current.user_extensions && User.current.user_extensions.gender && User.current.user_extensions.gender == 1 %> + + <% else %> + + <% end %> + +
    • -
    • - - <% if User.current.user_extensions.nil? %> - - -

      - - -

      - - - <% elsif User.current.user_extensions.identity == 3 || User.current.user_extensions.identity == 2 %> - <% if User.current.user_extensions.school_id.nil? %> - - - <% else %> - - +
    • + + <% if User.current.user_extensions.nil? %> + + +

      + + +

      + + + <% elsif User.current.user_extensions.identity == 3 || User.current.user_extensions.identity == 2 %> + <% if User.current.user_extensions.school_id.nil? %> + + + <% else %> + + + <% end %> +

      + + +

      + + <% elsif User.current.user_extensions.school.nil? %> + + +

      + + +

      + + <% else %> + + +

      + + +

      + + <% end %> +
    • + +
    • + + +
    • + + + +
    • + <% if @user.homepage && !@user.homepage.article_homepages.empty? %> + <% if @user.base_homepage %> + <%=link_to '查看', homepage_user_path(@user.login), :class => 'linkBlue',:target => '_blank' %> + <% else %> + <%=link_to '查看', user_homepages_path(:user_id => @user.id),:target => '_blank', :class => 'linkBlue' %> + <% end %> + <% else %> +

      您还没有创建属于自己的个人主页。 + <% if user_data_complete @user %> + <%= link_to '新建', new_user_homepage_article_homepage_path(:user_id => @user.id, + :homepage_id => @user.homepage.id), + :onclick=>"my_account_form_submit();", + :target => "_blank", + :class => 'linkBlue' %> <% end %> -

      - - -

      - - <% elsif User.current.user_extensions.school.nil? %> - - -

      - - -

      - - <% else %> - - -

      - - -

      - - <% end %> -
    • +

      -
    • - - -
    • + <% end %> + + +
    • <%= f.select :language, :Chinese => :zh, :English => :en %>
    • +
    • + 确定 + + +
    • +
    +
    +
+<% end %> -
  • - <%= select_tag( 'user[mail_notification]', options_for_select( user_mail_notification_options(@user), @user.mail_notification) ) %> - -
  • - -
  • - <% if @user.homepage && !@user.homepage.article_homepages.empty? %> - <% if @user.base_homepage %> - <%=link_to '查看', homepage_user_path(@user.login), :class => 'linkBlue',:target => '_blank' %> - <% else %> - <%=link_to '查看', user_homepages_path(:user_id => @user.id),:target => '_blank', :class => 'linkBlue' %> - <% end %> - <% else %> -

    您还没有创建属于自己的个人主页。<%=link_to '新建', new_user_homepage_article_homepage_path(:user_id=> @user.id, :homepage_id => @user.homepage.id),:onclick=>"my_account_form_submit();", :target => "_blank", :class => 'linkBlue' %>

    - <% end %> - -
  • -
  • <%= f.select :language, :Chinese => :zh, :English => :en %>
  • -
  • - 确定 - - -
  • - -
    -
    - <% end %> - - <%= form_tag({:action => "password"},:id => 'my_password_form') do %> -
    - <% if( !@act.nil? && @act == 'password') %> +<%= form_tag({:action => "password"},:id => 'my_password_form') do %> +
    + <% if( !@act.nil? && @act == 'password') %> <%= render_flash_messages %> <%= error_messages_for 'user' %> - <% end %> -
      -
    • 原始密码 : 
    • -
    • 新密码 : 
    • -
    • 确认密码 : 
    • -
    -
      - -
    • -
    • 请输入8-12个字符
    • -
    • -
    • - 确认 - - -
    • -
    -
    -
    -
    <% end %> -
    +
      +
    • 原始密码 : 
    • +
    • 新密码 : 
    • +
    • 确认密码 : 
    • +
    +
      + +
    • +
    • 请输入8-12个字符
    • +
    • +
    • + 确认 + + +
    • +
    +
    +
    +
    +<% end %> +
    @@ -243,10 +252,10 @@
    @@ -262,322 +271,322 @@ <%= stylesheet_link_tag 'nyan' %> <%= javascript_include_tag '/javascripts/jquery.leanModal.min.js' %> <% if !User.current.user_extensions.nil? %> - <% province = User.current.user_extensions.location %> - <% city = User.current.user_extensions.location_city %> - <% identity = User.current.user_extensions.identity %> - <% occupation1 = User.current.user_extensions.occupation %> - <% occupation = User.current.user_extensions.occupation %> - <% title = User.current.user_extensions.technical_title %> - <% gender = User.current.user_extensions.gender %> - <% language = User.current.language %> + <% province = User.current.user_extensions.location %> + <% city = User.current.user_extensions.location_city %> + <% identity = User.current.user_extensions.identity %> + <% occupation1 = User.current.user_extensions.occupation %> + <% occupation = User.current.user_extensions.occupation %> + <% title = User.current.user_extensions.technical_title %> + <% gender = User.current.user_extensions.gender %> + <% language = User.current.language %> <% else %> - <% province = "湖南省" %> - <% city = "长沙"%> - <% identity = ""%> - <% occupation1 = ""%> - <% title = "" %> - <% language = ""%> + <% province = "湖南省" %> + <% city = "长沙"%> + <% identity = ""%> + <% occupation1 = ""%> + <% title = "" %> + <% language = ""%> <% end %> \ No newline at end of file diff --git a/app/views/users/_form.html.erb b/app/views/users/_form.html.erb index 287c5f202..afbd6f360 100644 --- a/app/views/users/_form.html.erb +++ b/app/views/users/_form.html.erb @@ -42,13 +42,13 @@
    -
    - <%=l(:field_mail_notification)%> - <%= render :partial => 'users/mail_notifications' %> -
    +
    - <%=l(:label_preferences)%> + <%= l(:label_preferences) %> <%= render :partial => 'users/preferences' %>
    diff --git a/public/images/user/user_bg_info2.jpg b/public/images/user/user_bg_info2.jpg new file mode 100644 index 000000000..f2f676ee7 Binary files /dev/null and b/public/images/user/user_bg_info2.jpg differ diff --git a/public/stylesheets/css/user.css b/public/stylesheets/css/user.css index ac38bce15..ed3ab7aee 100644 --- a/public/stylesheets/css/user.css +++ b/public/stylesheets/css/user.css @@ -88,6 +88,7 @@ a:hover.pro_new_topbtn_left{background-image: linear-gradient(#ededed, #dddddd); /* 个人主页左侧信息 */ .user_leftinfo{ width:238px;border:1px solid #e5e5e5; background:#fff url(/images/user/user_bg_info.jpg) 0 0 no-repeat; position:relative; } +.user_leftdata_background{ width:238px;border:1px solid #e5e5e5; background:#fff url(/images/user/user_bg_info2.jpg) 0 0 no-repeat; position:relative; } a.user_leftinfo_img { display:block; width:80px; height:80px; margin:15px auto;} .user_leftinfo_img img{ width:74px; height:74px;-webkit-border-radius:50px;-moz-border-radius:50px;-o-border-radius:50px;border-radius:50px; border:3px solid #dcdcdc; } .user_leftinfo_female{ display:block; width:20px; height:20px;background:url(/images/user/icons_user_leftnav.png) 5px -378px no-repeat; position:absolute; top:80px; left:160px;}