From 7d3a18197b6b09feaaeba75c165b6e42ef6f2f7b Mon Sep 17 00:00:00 2001 From: alan <547533434@qq.com> Date: Wed, 29 Oct 2014 16:13:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9bug<=E6=B3=A8=E5=86=8C?= =?UTF-8?q?=E6=97=B6=E7=94=A8=E6=88=B7=E5=8F=AF=E4=BB=A5=E4=B8=8D=E5=A1=AB?= =?UTF-8?q?=E7=9C=9F=E5=AE=9E=E5=A7=93=E5=90=8D=EF=BC=8C=E5=B0=86=E5=85=B6?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E4=B8=BA=E5=8F=AF=E9=80=89>=E5=92=8C?= =?UTF-8?q?=E3=80=8A=E6=B5=8B=E8=AF=95=E7=89=88=EF=BC=9A=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?--=E7=82=B9=E5=87=BB=E4=BD=9C=E5=93=81=E4=B8=8B=E8=BD=BD?= =?UTF-8?q?=E6=8A=A5500=E9=94=99=E8=AF=AF=E3=80=8B=20Signed-off-by:=20alan?= =?UTF-8?q?=20<547533434@qq.com>?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/files_controller.rb | 49 ++++++++++++------- app/models/user.rb | 2 +- app/views/account/register.html.erb | 5 +- app/views/projects/settings/_modules.html.erb | 6 ++- config/locales/zh.yml | 3 +- 5 files changed, 40 insertions(+), 25 deletions(-) diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index 9171407eb..8dd8ba93f 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -16,11 +16,9 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class FilesController < ApplicationController - if @project + layout 'base_projects' #by young - else - layout 'base_courses' - end + menu_item :files before_filter :find_project_by_project_id#, :except => [:getattachtype] @@ -303,26 +301,39 @@ class FilesController < ApplicationController @isproject = true @containers = [ Project.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@project.id)] @containers += @project.versions.includes(:attachments).reorder(sort).all + show_attachments @containers + @attachtype = params[:type].to_i + @contenttype = params[:contentType].to_s + respond_to do |format| + format.js + format.html { + render :layout => 'base_projects' + } + end - - #render :layout => 'base_projects' elsif @course @isproject = false @containers = [ Course.includes(:attachments).reorder(sort).find(@course.id)] - # show_attachments @containers - # @attachtype = params[:type].to_i - # @contenttype = params[:contentType].to_s - - end - - show_attachments @containers - @attachtype = params[:type].to_i - @contenttype = params[:contentType].to_s + show_attachments @containers + @attachtype = params[:type].to_i + @contenttype = params[:contentType].to_s + # render layout: 'base_courses' + respond_to do |format| + format.js + format.html { + render :layout => 'base_courses' + } + end + end - respond_to do |format| - format.js - format.html - end + # show_attachments @containers + # @attachtype = params[:type].to_i + # @contenttype = params[:contentType].to_s + # + # respond_to do |format| + # format.js + # format.html + # end end end diff --git a/app/models/user.rb b/app/models/user.rb index 78bfc75f0..0bb359812 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -167,7 +167,7 @@ class User < Principal LOGIN_LENGTH_LIMIT = 25 MAIL_LENGTH_LIMIT = 60 - validates_presence_of :login, :firstname, :mail, :if => Proc.new { |user| !user.is_a?(AnonymousUser) } + validates_presence_of :login, :mail, :if => Proc.new { |user| !user.is_a?(AnonymousUser) } validates_uniqueness_of :login, :if => Proc.new { |user| user.login_changed? && user.login.present? }, :case_sensitive => false validates_uniqueness_of :mail, :if => Proc.new { |user| user.mail_changed? && user.mail.present? }, :case_sensitive => false # Login must contain letters, numbers, underscores only diff --git a/app/views/account/register.html.erb b/app/views/account/register.html.erb index f53f31f80..cbdbd108b 100644 --- a/app/views/account/register.html.erb +++ b/app/views/account/register.html.erb @@ -335,8 +335,9 @@
<%= f.password_field :password_confirmation, :size => 25, :required => true %>
<% end %>