From 720c75478a1912f3779ab62103a4f534efe617df Mon Sep 17 00:00:00 2001
From: z9hang
Date: Thu, 10 Jul 2014 10:15:20 +0800
Subject: [PATCH 01/14] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E4=B8=8A=E4=BC=A0?=
=?UTF-8?q?=E5=9B=BE=E7=89=87=E5=8F=AF=E4=BC=A0=E9=9D=9E=E5=9B=BE=E7=89=87?=
=?UTF-8?q?=E6=96=87=E4=BB=B6bug?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/avatar/_avatar_form.html.erb | 3 +++
config/configuration.yml | 1 +
config/locales/zh.yml | 1 +
lib/redmine/configuration.rb | 3 ++-
public/javascripts/avatars.js | 26 +++++++++++++++++++++++++-
5 files changed, 32 insertions(+), 2 deletions(-)
diff --git a/app/views/avatar/_avatar_form.html.erb b/app/views/avatar/_avatar_form.html.erb
index 272397c62..a880f32aa 100644
--- a/app/views/avatar/_avatar_form.html.erb
+++ b/app/views/avatar/_avatar_form.html.erb
@@ -45,6 +45,7 @@
<%= l(:button_upload_photo) %>
+
<%= file_field_tag 'avatar[image]',
:id => nil,
@@ -57,6 +58,8 @@
:max_file_size => Setting.attachment_max_size.to_i.kilobytes,
:max_file_size_message => l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)),
:max_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i,
+ :file_type => Redmine::Configuration['pic_types'].to_s,
+ :type_support_message => l(:error_pic_type),
:upload_path => upload_avatar_path(:format => 'js'),
:description_placeholder => nil ,# l(:label_optional_description)
:source_type => source.class.to_s,
diff --git a/config/configuration.yml b/config/configuration.yml
index a98ea3391..4bdd279aa 100644
--- a/config/configuration.yml
+++ b/config/configuration.yml
@@ -199,6 +199,7 @@ default:
# Maximum number of simultaneous AJAX uploads
#max_concurrent_ajax_uploads: 2
+ #pic_types: "bmp,jpeg,jpg,png,gif"
# specific configuration options for production environment
# that overrides the default ones
diff --git a/config/locales/zh.yml b/config/locales/zh.yml
index 1b3774d65..716889bbc 100644
--- a/config/locales/zh.yml
+++ b/config/locales/zh.yml
@@ -1217,6 +1217,7 @@ zh:
button_export: 导出
label_export_options: "%{export_format} 导出选项"
error_attachment_too_big: 该文件无法上传。超过文件大小限制 (%{max_size})
+ error_pic_type: "仅支持如下图片格式:"
notice_failed_to_save_time_entries: "无法保存下列所选取的 %{total} 个项目中的 %{count} 工时: %{ids}。"
label_x_issues:
zero: 0 问题
diff --git a/lib/redmine/configuration.rb b/lib/redmine/configuration.rb
index 6723b777e..ba8e91294 100644
--- a/lib/redmine/configuration.rb
+++ b/lib/redmine/configuration.rb
@@ -21,7 +21,8 @@ module Redmine
# Configuration default values
@defaults = {
'email_delivery' => nil,
- 'max_concurrent_ajax_uploads' => 2
+ 'max_concurrent_ajax_uploads' => 2,
+ 'pic_types' => "bmp,jpeg,jpg,png,gif"
}
@config = nil
diff --git a/public/javascripts/avatars.js b/public/javascripts/avatars.js
index 24bc1ee1c..db9a2255e 100644
--- a/public/javascripts/avatars.js
+++ b/public/javascripts/avatars.js
@@ -140,10 +140,34 @@ function uploadAndAttachFiles(files, inputEl) {
if (sizeExceeded) {
window.alert(maxFileSizeExceeded);
} else {
- $.each(files, function() {addFile(inputEl, this, true);});
+ uploadAndTypeFiles(files,inputEl);
+ //$.each(files, function() {addFile(inputEl, this, true);});
}
}
+function uploadAndTypeFiles(files, inputEl) {
+
+ var enableType = $(inputEl).data('file-type');
+ var typeSupportrdMessage = $(inputEl).data('type-support-message');
+ if (enableType == null || enableType.trim() == "")
+ {
+ $.each(files, function() {addFile(inputEl, this, true);});
+ return;
+ }
+ var typeSupported = false;
+ $.each(files, function() {
+ var a = this.name.split('.');
+ var type = a[a.length-1];
+ var rs = enableType.indexOf(type);
+ if(rs >= 0) {typeSupported = true }
+ });
+ if (typeSupported) {
+ $.each(files, function() {addFile(inputEl, this, true);});
+ } else {
+ window.alert(typeSupportrdMessage + enableType);
+ }
+}
+
function handleFileDropEvent(e) {
$(this).removeClass('fileover');
From 39434766e3cd18ae9cf964af15d8307ab96ae2b8 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Thu, 10 Jul 2014 16:35:53 +0800
Subject: [PATCH 02/14] =?UTF-8?q?1.=E4=BF=AE=E5=A4=8D=E8=B6=85=E7=BA=A7?=
=?UTF-8?q?=E7=AE=A1=E7=90=86=E5=91=98=E6=97=A0=E6=B3=95=E8=AE=BF=E9=97=AE?=
=?UTF-8?q?=E8=AF=BE=E7=A8=8B=E4=BD=9C=E4=B8=9A=E5=88=97=E8=A1=A8=E7=9A=84?=
=?UTF-8?q?BUG=202.=E4=BF=AE=E6=94=B9=E4=BD=9C=E4=B8=9A=E6=8F=8F=E8=BF=B0?=
=?UTF-8?q?=E6=A0=B7=E5=BC=8F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/bids_controller.rb | 2 +-
app/models/course.rb | 3 ++-
app/views/courses/_course.html.erb | 8 ++++++--
app/views/courses/index.html.erb | 2 ++
4 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/app/controllers/bids_controller.rb b/app/controllers/bids_controller.rb
index a728ee6e2..b9f9245c8 100644
--- a/app/controllers/bids_controller.rb
+++ b/app/controllers/bids_controller.rb
@@ -449,7 +449,7 @@ class BidsController < ApplicationController
# 显示作业课程
# add by nwb
def show_courseEx
- if (User.current.logged? && User.current.member_of_course?(@bid.courses.first))
+ if (User.current.logged? && (User.current.member_of_course?(@bid.courses.first) || User.current.admin?))
# flash[:notice] = ""
@membership = User.current.coursememberships.all(:conditions => Course.visible_condition(User.current))
diff --git a/app/models/course.rb b/app/models/course.rb
index 5034ab0d8..bac28e4c2 100644
--- a/app/models/course.rb
+++ b/app/models/course.rb
@@ -92,7 +92,8 @@ class Course < ActiveRecord::Base
# 课程的短描述信息
def short_description(length = 255)
- description.gsub(/^(.{#{length}}[^\n\r]*).*$/m, '\1...').strip if description
+ description.gsub(/<\/?.*?>/,"").strip if description
+ #description.gsub(/^(.{#{length}}[^\n\r]*).*$/m, '\1...').strip if description
end
def extra_frozen?
diff --git a/app/views/courses/_course.html.erb b/app/views/courses/_course.html.erb
index ef8f37566..6b720229a 100644
--- a/app/views/courses/_course.html.erb
+++ b/app/views/courses/_course.html.erb
@@ -16,7 +16,7 @@
<%= content_tag('span', "#{l(:label_institution_name)}:", :class => "course-font")%>
<% @admin = @course.course_infos%>
<%if @admin&&@admin.first&&@admin.first.user&&@admin.first.user.user_extensions%>
-
+
<% unless @course.teacher.user_extensions.school.nil? %>
<%= link_to @course.teacher.user_extensions.school.try(:name), school_course_list_path(@course.teacher.user_extensions.school) %>
<% end %>
@@ -28,7 +28,7 @@
<%= content_tag('a', @admin.collect{|u| link_to(u.user.lastname+u.user.firstname, user_path(u.user_id))}.join(", ").html_safe) %>
<% end %>
-
+
@@ -76,6 +76,10 @@
<%= content_tag "span", "#{l(:label_course_brief_introduction)}:", :class => "course-font" %>
+ <%# desc = course.short_description.nil? ? "" : course.short_description%>
+
<%= content_tag "div", course.short_description, :class => "brief_introduction", :title => course.short_description %>
diff --git a/app/views/courses/index.html.erb b/app/views/courses/index.html.erb
index db94cf6c5..0586262e9 100644
--- a/app/views/courses/index.html.erb
+++ b/app/views/courses/index.html.erb
@@ -35,6 +35,8 @@
<%if @courses%>
<%= render_course_hierarchy(@courses)%>
+ <%#= render :partial => 'course', :locals => {:course => @courses.first}%>
+ <%#= "
hello ".html_safe %>
<%end%>
From 47ad20421e3fbe9c481e1fc9290863e230550c0d Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Thu, 10 Jul 2014 16:48:13 +0800
Subject: [PATCH 03/14] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=BD=93=E8=AF=BE?=
=?UTF-8?q?=E7=A8=8B=E6=8F=8F=E8=BF=B0=E4=B8=AD=E6=9C=89=E7=89=B9=E6=AE=8A?=
=?UTF-8?q?=E6=A0=87=E7=AD=BE=E6=98=AF=EF=BC=8C=E8=AF=BE=E7=A8=8B=E5=88=97?=
=?UTF-8?q?=E8=A1=A8=E6=8F=8F=E8=BF=B0=E6=98=BE=E7=A4=BA=E6=9C=89=E8=AF=AF?=
=?UTF-8?q?=E7=9A=84BUG?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/models/course.rb | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/app/models/course.rb b/app/models/course.rb
index bac28e4c2..7db789a7a 100644
--- a/app/models/course.rb
+++ b/app/models/course.rb
@@ -92,10 +92,21 @@ class Course < ActiveRecord::Base
# 课程的短描述信息
def short_description(length = 255)
- description.gsub(/<\/?.*?>/,"").strip if description
+ description.gsub(/<\/?.*?>/,"").html_safe if description
#description.gsub(/^(.{#{length}}[^\n\r]*).*$/m, '\1...').strip if description
end
+ def strip_html(html)
+ return html if html.empty? || !html.include?('<')
+ output = ""
+ tokenizer = HTML::Tokenizer.new(html)
+ while token = tokenizer.next
+ node = HTML::Node.parse(nil, 0, 0, token, false)
+ output += token unless (node.kind_of? HTML::Tag) or (token =~ /^
Date: Thu, 10 Jul 2014 16:57:04 +0800
Subject: [PATCH 04/14] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=AA=E4=BA=BA?=
=?UTF-8?q?=E4=B8=BB=E9=A1=B5=E4=B8=AD=E4=BD=9C=E4=B8=9A=E3=80=81=E9=A1=B9?=
=?UTF-8?q?=E7=9B=AE=E4=BB=8B=E7=BB=8D=E4=B8=8D=E6=AD=A3=E7=A1=AE=E7=9A=84?=
=?UTF-8?q?BUG?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/models/open_source_project.rb | 3 ++-
app/models/project.rb | 3 ++-
app/views/users/_course_form.html.erb | 2 +-
app/views/users/user_projects.html.erb | 2 +-
4 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/app/models/open_source_project.rb b/app/models/open_source_project.rb
index e3556ce55..2de5966bb 100644
--- a/app/models/open_source_project.rb
+++ b/app/models/open_source_project.rb
@@ -84,7 +84,8 @@ class OpenSourceProject < ActiveRecord::Base
# end
def short_description(length = 255)
- description.gsub(/^(.{#{length}}[^\n\r]*).*$/m, '\1...').strip if description
+ #description.gsub(/^(.{#{length}}[^\n\r]*).*$/m, '\1...').strip if description
+ description.gsub(/<\/?.*?>/,"").html_safe if description
end
def applied_by?(user)
diff --git a/app/models/project.rb b/app/models/project.rb
index 5efaf10ab..4bd1f2774 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -623,7 +623,8 @@ class Project < ActiveRecord::Base
# Returns a short description of the projects (first lines)
def short_description(length = 255)
- description.gsub(/^(.{#{length}}[^\n\r]*).*$/m, '\1...').strip if description
+ #description.gsub(/^(.{#{length}}[^\n\r]*).*$/m, '\1...').strip if description
+ description.gsub(/<\/?.*?>/,"").html_safe if description
end
def css_classes
diff --git a/app/views/users/_course_form.html.erb b/app/views/users/_course_form.html.erb
index f5cada9a8..4d9c58392 100644
--- a/app/views/users/_course_form.html.erb
+++ b/app/views/users/_course_form.html.erb
@@ -32,7 +32,7 @@
- <%= membership.course.description %>
+ <%= membership.course.short_description %>
diff --git a/app/views/users/user_projects.html.erb b/app/views/users/user_projects.html.erb
index e16700cd1..66ddcaae2 100644
--- a/app/views/users/user_projects.html.erb
+++ b/app/views/users/user_projects.html.erb
@@ -30,7 +30,7 @@
- <%= membership.project.description%>
+ <%= membership.project.short_description%>
From 51ef3fa5a18799f34f0d3e398ac936014bafb520 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Thu, 10 Jul 2014 16:58:57 +0800
Subject: [PATCH 05/14] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=BB=E9=A1=B5?=
=?UTF-8?q?=E8=AF=BE=E7=A8=8B=E4=BB=8B=E7=BB=8D=E6=98=BE=E7=A4=BA=E6=9C=89?=
=?UTF-8?q?=E8=AF=AF=E7=9A=84BUG?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/welcome/index.html.erb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/views/welcome/index.html.erb b/app/views/welcome/index.html.erb
index 345f47739..890155915 100644
--- a/app/views/welcome/index.html.erb
+++ b/app/views/welcome/index.html.erb
@@ -65,7 +65,7 @@
(<%= link_to "#{projectCount(project)}人", project_member_path(project) ,:course =>'0' %>)
- ><%=project.description.truncate(50, omission: '...')%>
+ ><%=project.short_description.truncate(50, omission: '...')%>
<% issue_count = project.issues.count %>
From b4dd8409eb57b17bce852226dcabaeceb8361a38 Mon Sep 17 00:00:00 2001
From: z9hang
Date: Thu, 10 Jul 2014 17:38:04 +0800
Subject: [PATCH 06/14] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=A1=B9=E7=9B=AE?=
=?UTF-8?q?=E6=89=98=E7=AE=A1=E5=B9=B3=E5=8F=B0=E9=A6=96=E9=A1=B5=E5=AE=9A?=
=?UTF-8?q?=E5=88=B6=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/admin_controller.rb | 30 +++++++++++++++++++
app/controllers/welcome_controller.rb | 2 +-
app/helpers/application_helper.rb | 7 ++++-
app/models/first_page.rb | 3 ++
app/views/admin/first_page_made.html.erb | 28 +++++++++++++++++
app/views/users/_score_new_index.html.erb | 6 ++--
app/views/users/_show_new_score.html.erb | 12 ++++----
app/views/users/_user_score.html.erb | 2 +-
app/views/users/show_new_score.html.erb | 12 ++++----
app/views/welcome/index.html.erb | 12 ++++++--
config/locales/zh.yml | 5 ++++
config/routes.rb | 1 +
.../20140710071720_create_first_pages.rb | 17 +++++++++++
db/schema.rb | 10 ++++++-
lib/redmine.rb | 1 +
test/fixtures/first_pages.yml | 11 +++++++
test/unit/first_page_test.rb | 7 +++++
17 files changed, 144 insertions(+), 22 deletions(-)
create mode 100644 app/models/first_page.rb
create mode 100644 app/views/admin/first_page_made.html.erb
create mode 100644 db/migrate/20140710071720_create_first_pages.rb
create mode 100644 test/fixtures/first_pages.yml
create mode 100644 test/unit/first_page_test.rb
diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb
index 2a3ce15d8..152fb059e 100644
--- a/app/controllers/admin_controller.rb
+++ b/app/controllers/admin_controller.rb
@@ -234,4 +234,34 @@ class AdminController < ApplicationController
format.api
end
end
+
+ #首页定制
+ def first_page_made
+ if request.get?
+ @first_page = FirstPage.all.first
+ elsif request.post?
+ @first_page = FirstPage.all.first
+ @first_page.web_title = params[:web_title]
+ @first_page.description = params[:description]
+ @first_page.title = params[:title]
+ if @first_page.save
+ respond_to do |format|
+ format.html {
+ flash[:notice] = l(:notice_successful_update)
+ redirect_to admin_first_page_made_path
+ }
+ format.api { render_api_ok }
+ end
+ else
+ respond_to do |format|
+ format.html {
+ first_page_made
+ render :action => 'first_page_made'
+ }
+ format.api { render_validation_errors(@first_page) }
+ end
+ end
+ end
+
+ end
end
diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb
index bf18332df..0920d2e42 100644
--- a/app/controllers/welcome_controller.rb
+++ b/app/controllers/welcome_controller.rb
@@ -21,7 +21,7 @@ class WelcomeController < ApplicationController
before_filter :entry_select, :only => [:index]
def index
-
+ @first_page = FirstPage.all.first
end
def robots
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index c9dc4fa26..3f873a64d 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -625,10 +625,15 @@ module ApplicationHelper
end
def html_title(*args)
+ first_page = FirstPage.all.first
if args.empty?
title = @html_title || []
title << @project.name if @project
- title << Setting.app_title unless Setting.app_title == title.last
+ if first_page.nil? || first_page.web_title.nil?
+ title << Setting.app_title unless Setting.app_title == title.last
+ else
+ title << first_page.web_title unless first_page.web_title == title.last
+ end
title.select {|t| !t.blank? }.join(' - ')
else
@html_title ||= []
diff --git a/app/models/first_page.rb b/app/models/first_page.rb
new file mode 100644
index 000000000..8d8bbcff6
--- /dev/null
+++ b/app/models/first_page.rb
@@ -0,0 +1,3 @@
+class FirstPage < ActiveRecord::Base
+ attr_accessible :description, :title, :web_title
+end
diff --git a/app/views/admin/first_page_made.html.erb b/app/views/admin/first_page_made.html.erb
new file mode 100644
index 000000000..9e863d813
--- /dev/null
+++ b/app/views/admin/first_page_made.html.erb
@@ -0,0 +1,28 @@
+<%=l(:label_first_page_made)%>
+
+<%= form_tag(:controller => 'admin', :action => 'first_page_made') do %>
+
+ <%= l(:label_site_image) %>:
+
+
+ <%= render :partial=>"avatar/avatar_form",:style => "display:inline",:locals=> {source:@first_page} %>
+
+
+ <%= l(:label_web_title) %>:
+ <%= text_field_tag 'web_title', params[:wbe_title],:value => @first_page.web_title, :size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %>
+
+
+ <%= l(:label_site_title) %>:
+ <%= text_field_tag 'title', params[:label_site_title], :value => @first_page.title,:size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %>
+
+
+ <%= l(:label_site_description)%>:
+ <%= text_area_tag 'description',@first_page.description,:rows => 8, :size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %>
+
+ <%= submit_tag l(:button_save), :class => "small", :name => nil %>
+<% end %>
+
+
+
+
+
\ No newline at end of file
diff --git a/app/views/users/_score_new_index.html.erb b/app/views/users/_score_new_index.html.erb
index 43687aa78..0f5d96a45 100644
--- a/app/views/users/_score_new_index.html.erb
+++ b/app/views/users/_score_new_index.html.erb
@@ -28,7 +28,7 @@
= <%= l(:label_user_score_of_collaboration) %> + <%= l(:label_user_score_of_influence) %> +
<%= l(:label_user_score_of_skill)%> + <%= l(:label_user_score_of_active) %>
- = <%= format("%.2f" ,@user.user_score_attr.collaboration.nil? ? 0:@user.user_score_attr.collaboration).to_f %> + <%= format("%.2f" , @user.user_score_attr.influence.nil? ? 0:@user.user_score_attr.influence ).to_f %>
- + <%= format("%.2f" , @user.user_score_attr.skill.nil? ? 0:@user.user_score_attr.skill).to_f %> + <%= format("%.2f" , @user.user_score_attr.active.nil? ? 0:@user.user_score_attr.active).to_f %>
- = <%= format("%.2f" ,@user.user_score_attr.total_score.nil? ? 0:@user.user_score_attr.total_score).to_f %>
+ = <%= format("%.2f" ,@user.user_score_attr.collaboration.nil? ? 0:@user.user_score_attr.collaboration).to_i %> + <%= format("%.2f" , @user.user_score_attr.influence.nil? ? 0:@user.user_score_attr.influence ).to_i %>
+ + <%= format("%.2f" , @user.user_score_attr.skill.nil? ? 0:@user.user_score_attr.skill).to_i %> + <%= format("%.2f" , @user.user_score_attr.active.nil? ? 0:@user.user_score_attr.active).to_i %>
+ = <%= format("%.2f" ,@user.user_score_attr.total_score.nil? ? 0:@user.user_score_attr.total_score).to_i %>
diff --git a/app/views/users/_show_new_score.html.erb b/app/views/users/_show_new_score.html.erb
index c5f15694e..fddca46ac 100644
--- a/app/views/users/_show_new_score.html.erb
+++ b/app/views/users/_show_new_score.html.erb
@@ -38,7 +38,7 @@
<%= l(:label_user_score) %>
- <%= format("%.2f" , @user.user_score_attr.total_score).to_f %>
+ <%= format("%.2f" , @user.user_score_attr.total_score).to_i %>
@@ -49,23 +49,23 @@
<%= link_to l(:label_user_score) , {:controller => 'users', :action => 'score_new_index', :remote => true} %> :
- <%= format("%.2f" , @user.user_score_attr.total_score).to_f %>
+ <%= format("%.2f" , @user.user_score_attr.total_score).to_i %>
<%= link_to l(:label_user_score_of_collaboration), {:controller => 'users',:action => 'topic_new_score_index', :remote => true} %> :
- <%= format("%.2f" , @user.user_score_attr.collaboration.nil? ? 0:@user.user_score_attr.collaboration).to_f %>
+ <%= format("%.2f" , @user.user_score_attr.collaboration.nil? ? 0:@user.user_score_attr.collaboration).to_i %>
<%= link_to l(:label_user_score_of_influence), {:controller => 'users',:action => 'project_new_score_index', :remote => true} %> :
- <%= format("%.2f" , @user.user_score_attr.influence.nil? ? 0:@user.user_score_attr.influence).to_f %>
+ <%= format("%.2f" , @user.user_score_attr.influence.nil? ? 0:@user.user_score_attr.influence).to_i %>
<%= link_to l(:label_user_score_of_skill), {:controller => 'users',:action => 'activity_new_score_index', :remote => true} %> :
- <%= format("%.2f" , @user.user_score_attr.skill.nil? ? 0:@user.user_score_attr.skill).to_f %>
+ <%= format("%.2f" , @user.user_score_attr.skill.nil? ? 0:@user.user_score_attr.skill).to_i %>
<%= link_to l(:label_user_score_of_active), {:controller => 'users',:action => 'influence_new_score_index', :remote => true} %> :
- <%= format("%.2f" , @user.user_score_attr.active.nil? ? 0:@user.user_score_attr.active).to_f %>
+ <%= format("%.2f" , @user.user_score_attr.active.nil? ? 0:@user.user_score_attr.active).to_i %>
diff --git a/app/views/users/_user_score.html.erb b/app/views/users/_user_score.html.erb
index d047c11d0..53f05a2dd 100644
--- a/app/views/users/_user_score.html.erb
+++ b/app/views/users/_user_score.html.erb
@@ -1,5 +1,5 @@
<%= l(:label_user_grade)%>:
-<%= link_to(format("%.2f" , user.user_score_attr.total_score).to_f, {:controller => 'users',
+<%= link_to(format("%.2f" , user.user_score_attr.total_score).to_i, {:controller => 'users',
:action => 'show_new_score',
:remote => true,
:id => user.id
diff --git a/app/views/users/show_new_score.html.erb b/app/views/users/show_new_score.html.erb
index 07e82fd5f..0efae940c 100644
--- a/app/views/users/show_new_score.html.erb
+++ b/app/views/users/show_new_score.html.erb
@@ -53,7 +53,7 @@
<%= l(:label_user_score) %>
- <%= format("%.2f" , @user.user_score_attr.total_score).to_f %>
+ <%= format("%.2f" , @user.user_score_attr.total_score).to_i %>
@@ -64,23 +64,23 @@
<%= l(:label_user_score) %> :
- <%= format("%.2f" , @user.user_score_attr.total_score).to_f %>
+ <%= format("%.2f" , @user.user_score_attr.total_score).to_i %>
<%= l(:label_user_score_of_collaboration) %> :
- <%= format("%.2f" , @user.user_score_attr.collaboration.nil? ? 0:@user.user_score_attr.collaboration).to_f %>
+ <%= format("%.2f" , @user.user_score_attr.collaboration.nil? ? 0:@user.user_score_attr.collaboration).to_i %>
<%= l(:label_user_score_of_influence) %> :
- <%= format("%.2f" , @user.user_score_attr.influence.nil? ? 0:@user.user_score_attr.influence).to_f %>
+ <%= format("%.2f" , @user.user_score_attr.influence.nil? ? 0:@user.user_score_attr.influence).to_i %>
<%= l(:label_user_score_of_skill) %> :
- <%= format("%.2f" , @user.user_score_attr.skill.nil? ? 0:@user.user_score_attr.skill).to_f %>
+ <%= format("%.2f" , @user.user_score_attr.skill.nil? ? 0:@user.user_score_attr.skill).to_i %>
<%= l(:label_user_score_of_active) %> :
- <%= format("%.2f" , @user.user_score_attr.active.nil? ? 0:@user.user_score_attr.active).to_f %>
+ <%= format("%.2f" , @user.user_score_attr.active.nil? ? 0:@user.user_score_attr.active).to_i %>
diff --git a/app/views/welcome/index.html.erb b/app/views/welcome/index.html.erb
index 345f47739..ffc9706e9 100644
--- a/app/views/welcome/index.html.erb
+++ b/app/views/welcome/index.html.erb
@@ -30,13 +30,19 @@
<%= link_to image_tag('/images/qrweixin.jpg', size: '150x150', alt: 'trustie', class: "weixin" ), home_path %>
微信扫码
-
+
- <%= image_tag '/images/transparent.png', size: "75x75" %>
+
+ <% if get_avatar?(@first_page) %>
+ <%= image_tag(url_to_avatar(@first_page), size: "75x75") %>
+ <% else %>
+ <%= image_tag '/images/transparent.png', size: "75x75" %>
+ <% end %>
+
- <%= l(:label_welcome_trustie) %><%= l(:label_welcome_trustie_project) %> , <%= l(:label_welcome_trustie_project_description) %>
+ <%= @first_page.title %> , <%= @first_page.description %>
<%= render :partial => "search_project", :locals => {:project_type => 0}%>
diff --git a/config/locales/zh.yml b/config/locales/zh.yml
index 716889bbc..11c9e054a 100644
--- a/config/locales/zh.yml
+++ b/config/locales/zh.yml
@@ -515,6 +515,7 @@ zh:
label_project_new_description: '项目可以是软件开发项目,也可以是协作研究项目。'
label_project_plural: 项目列表
label_project_score: 项目评分
+ label_first_page_made: 首页定制
label_x_projects:
zero: 无项目
one: 1 个项目
@@ -561,6 +562,10 @@ zh:
label_login_with_open_id_option: 或使用OpenID登录
label_password_lost: 忘记密码
label_home: 主页
+ label_web_title: 浏览器标题
+ label_site_title: 网站标题
+ label_site_description: 网站简介
+ label_site_image: 简介图片
#by young
label_requirement: 需求
label_new_course: 课程列表
diff --git a/config/routes.rb b/config/routes.rb
index f9dd53cf3..7c5f878eb 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -558,6 +558,7 @@ RedmineApp::Application.routes.draw do
match 'admin', :controller => 'admin', :action => 'index', :via => :get
match 'admin/projects', :controller => 'admin', :action => 'projects', :via => :get
match 'admin/users', :controller => 'admin', :action => 'users', :via => :get
+ match 'admin/first_page_made',:controller => 'admin',:action => 'first_page_made',:via => [:get,:post]
match 'admin/search', :controller => 'admin', :action => 'search', :via => [:get, :post]
match 'admin/plugins', :controller => 'admin', :action => 'plugins', :via => :get
match 'admin/info', :controller => 'admin', :action => 'info', :via => :get
diff --git a/db/migrate/20140710071720_create_first_pages.rb b/db/migrate/20140710071720_create_first_pages.rb
new file mode 100644
index 000000000..fa7d01601
--- /dev/null
+++ b/db/migrate/20140710071720_create_first_pages.rb
@@ -0,0 +1,17 @@
+# -*coding:utf-8 -*-
+class CreateFirstPages < ActiveRecord::Migration
+ def change
+ create_table :first_pages do |t|
+ t.string :web_title
+ t.string :title
+ t.string :description
+
+ t.timestamps
+ end
+ fp = FirstPage.new
+ fp.web_title = "Trustie - 为大学生技术创新筑巢"
+ fp.title = "Trustie在线项目托管平台"
+ fp.description = "面向中国大学生与软件从业者,提供社交化的项目管理、代码托管、资源共享、合作交流。"
+ fp.save
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 6e750aa9f..d84c30f9a 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20140708023356) do
+ActiveRecord::Schema.define(:version => 20140710071720) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@@ -406,6 +406,14 @@ ActiveRecord::Schema.define(:version => 20140708023356) do
add_index "enumerations", ["id", "type"], :name => "index_enumerations_on_id_and_type"
add_index "enumerations", ["project_id"], :name => "index_enumerations_on_project_id"
+ create_table "first_pages", :force => true do |t|
+ t.string "web_title"
+ t.string "title"
+ t.string "description"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
create_table "forums", :force => true do |t|
t.string "name", :null => false
t.string "description", :default => ""
diff --git a/lib/redmine.rb b/lib/redmine.rb
index e17d657c8..6215a04ba 100644
--- a/lib/redmine.rb
+++ b/lib/redmine.rb
@@ -351,6 +351,7 @@ end
Redmine::MenuManager.map :admin_menu do |menu|
menu.push :projects, {:controller => 'admin', :action => 'projects'}, :caption => :label_project_plural
menu.push :users, {:controller => 'admin', :action => 'users'}, :caption => :label_user_plural
+ menu.push :first_page_made, {:controller => 'admin',:action => 'first_page_made'},:caption => :label_first_page_made
menu.push :groups, {:controller => 'groups'}, :caption => :label_group_plural
menu.push :roles, {:controller => 'roles'}, :caption => :label_role_and_permissions
menu.push :trackers, {:controller => 'trackers'}, :caption => :label_tracker_plural
diff --git a/test/fixtures/first_pages.yml b/test/fixtures/first_pages.yml
new file mode 100644
index 000000000..5af4dd417
--- /dev/null
+++ b/test/fixtures/first_pages.yml
@@ -0,0 +1,11 @@
+# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
+
+one:
+ web_title: MyString
+ title: MyString
+ description: MyString
+
+two:
+ web_title: MyString
+ title: MyString
+ description: MyString
diff --git a/test/unit/first_page_test.rb b/test/unit/first_page_test.rb
new file mode 100644
index 000000000..77e2cc97a
--- /dev/null
+++ b/test/unit/first_page_test.rb
@@ -0,0 +1,7 @@
+require 'test_helper'
+
+class FirstPageTest < ActiveSupport::TestCase
+ # test "the truth" do
+ # assert true
+ # end
+end
From bed662c2e5f77c3df15a243b7a446921d47799dc Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Thu, 10 Jul 2014 17:42:40 +0800
Subject: [PATCH 07/14] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=A1=B9=E7=9B=AE?=
=?UTF-8?q?=E7=BC=BA=E9=99=B7=E5=88=97=E8=A1=A8=E6=8F=8F=E8=BF=B0=E6=98=BE?=
=?UTF-8?q?=E7=A4=BA=E4=B8=8D=E6=AD=A3=E5=B8=B8=E7=9A=84BUG?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/models/issue.rb | 8 ++++++++
app/views/issues/_list.html.erb | 2 +-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/app/models/issue.rb b/app/models/issue.rb
index 550e0dc5d..f47e1c6f9 100644
--- a/app/models/issue.rb
+++ b/app/models/issue.rb
@@ -562,6 +562,12 @@ class Issue < ActiveRecord::Base
@workflow_rule_by_attribute = result if user.nil?
result
end
+ # 缺陷的短描述信息
+ def short_description(length = 255)
+ description.gsub(/<\/?.*?>/,"").html_safe if description
+ #description.gsub(/^(.{#{length}}[^\n\r]*).*$/m, '\1...').strip if description
+ end
+
private :workflow_rule_by_attribute
def done_ratio
@@ -1513,4 +1519,6 @@ class Issue < ActiveRecord::Base
def be_user_score_new_issue
UserScore.project(:post_issue, User.current,self, { issue_id: self.id })
end
+
+
end
diff --git a/app/views/issues/_list.html.erb b/app/views/issues/_list.html.erb
index b36c4b57d..57d8a60cb 100644
--- a/app/views/issues/_list.html.erb
+++ b/app/views/issues/_list.html.erb
@@ -38,7 +38,7 @@
<% end -%>
From 4f2298fd2230f964778f01f5434d8c5402bb03a6 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Fri, 11 Jul 2014 10:31:52 +0800
Subject: [PATCH 08/14] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=AA=E4=BA=BA?=
=?UTF-8?q?=E5=8A=A8=E6=80=81=E9=A6=96=E9=A1=B5=E4=B8=AD=E7=95=99=E8=A8=80?=
=?UTF-8?q?=E7=AD=89=E5=8A=A8=E6=80=81=E6=98=BE=E7=A4=BA=E6=9C=89=E8=AF=AF?=
=?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/helpers/application_helper.rb | 4 +-
app/models/news.rb | 6 +++
app/views/users/show.html.erb | 60 ++++++++++++------------
app/views/users/user_activities.html.erb | 5 +-
4 files changed, 41 insertions(+), 34 deletions(-)
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index e6bbf6ed6..0a84b7a55 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -256,8 +256,8 @@ module ApplicationHelper
end
def format_activity_description(text)
- h(truncate(text.to_s, :length => 120).gsub(%r{[\r\n]*<(pre|code)>.*$}m, '...')
- ).gsub(/[\r\n]+/, " ").html_safe
+ h(truncate(text.to_s, :length => 120).gsub(%r{[\r\n]*<(pre|code)>.*$}m, '...')).gsub(/[\r\n]+/, " ").html_safe
+ #h(truncate(text.to_s, :length => 120).gsub(/<\/?.*?>/,"")).html_safe
end
def format_version_name(version)
diff --git a/app/models/news.rb b/app/models/news.rb
index 9a0f8b75c..66e339291 100644
--- a/app/models/news.rb
+++ b/app/models/news.rb
@@ -74,6 +74,12 @@ class News < ActiveRecord::Base
visible(user).includes([:author, :project]).order("#{News.table_name}.created_on DESC").limit(count).all
end
+ # 新闻的短描述信息
+ def short_description(length = 255)
+ description.gsub(/<\/?.*?>/,"").html_safe if description
+ #description.gsub(/^(.{#{length}}[^\n\r]*).*$/m, '\1...').strip if description
+ end
+
private
def add_author_as_watcher
diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb
index ec469a5b9..f2fa522cd 100644
--- a/app/views/users/show.html.erb
+++ b/app/views/users/show.html.erb
@@ -26,7 +26,7 @@
<%= text_field_tag 'user', params[:user], :size => 30 %>
- <%= submit_tag l(:label_search_by_user), :class => "small", :name => nil %>
+ <%= submit_tag l(:label_search_by_user), :class => "small", :name => nil %>
@@ -51,31 +51,31 @@
<% case e.act_type %>
<% when 'JournalsForMessage' %>
<% if User.current.login == e.user.try(:login) %>
- <%# if e.user_id == act.jour.id %>
- <%= link_to("#{l(:label_i)}", user_path(e.user_id)) %> <%= l(:label_have_feedback) %><%=
- link_to("#{e.act.user.name}", user_path(e.act.user.id)) %><%= l(:label_of_feedback) + l(:label_layouts_feedback) %>
+ <%# if e.user_id == act.jour.id %>
+ <%= link_to("#{l(:label_i)}", user_path(e.user_id)) %> <%= l(:label_have_feedback) %>
+ <%= link_to("#{e.act.user.name}", user_path(e.act.user.id)) %><%= l(:label_of_feedback) + l(:label_layouts_feedback) %>
<%# else %>
<%# end %>
<% else %>
- <%= link_to("#{e.user.name}", user_path(e.user_id)) %> <%= l(:label_have_feedback) %><%=
- link_to("#{e.act.user.name}", user_path(e.act.user.id)) %><%= l(:label_of_feedback) + l(:label_layouts_feedback) %>
+ <%= link_to("#{e.user.name}", user_path(e.user_id)) %> <%= l(:label_have_feedback) %><%=
+ link_to("#{e.act.user.name}", user_path(e.act.user.id)) %><%= l(:label_of_feedback) + l(:label_layouts_feedback) %>
<% end %>
-
- <%= textilizable act.notes %>
- <%= link_to(l(:label_goto), user_newfeedback_user_path(e.user_id)) %>
-
-
-
+
+ <%= textilizable act.notes %>
+ <%= link_to(l(:label_goto), user_newfeedback_user_path(e.user_id)) %>
+
+
+
-
-
-
- <%=(l(:label_update_time).to_s << ':' << format_time(e.act.created_on)).to_s %>
-
-
-
-
+
+
+
+ <%=(l(:label_update_time).to_s << ':' << format_time(e.act.created_on)).to_s %>
+
+
+
+
<% when 'Bid' %>
<% if act.reward_type ==3 %>
@@ -92,7 +92,7 @@
<% end %>
<% end %>
- <%= h act.description %>
+ <%= act.description.html_safe %>
@@ -109,7 +109,7 @@
<%= link_to(h(e.user), user_path(e.user_id)) %> <%= l(:label_new_activity) %> <%= link_to( l(:label_activity_project)+act.issue.project.name, project_path(act.issue.project.identifier))%> <%= link_to format_activity_title("#{act.issue.tracker} ##{act.issue.id}: #{act.issue.subject}"), {:controller => 'issues', :action => 'show', :id => act.issue.id, :anchor => "change-#{act.id}"} %>
<% end %>
- <%= h act.notes %>
+ <%= act.notes.html_safe %>
@@ -126,7 +126,7 @@
<%= link_to(h(e.user), user_path(e.user_id)) %> <%= l(:label_new_activity) %> <%= link_to format_activity_title(act.title), {:controller => 'repositories', :action => 'revision', :id => act.repository.project, :repository_id => act.repository.identifier_param, :rev => act.identifier} %>
<% end %>
- <%= h act.long_comments %>
+ <%= act.long_comments.html_safe %>
@@ -145,11 +145,11 @@
<%= h act.content.truncate(240, omission: '...') %>
-
+
<%= (l(:label_update_time).to_s << ':' << format_time(e.act.created_on)).to_s %>
-
+
<% when 'Principal' %>
@@ -161,8 +161,8 @@
<% end %>
-
-
+
+
<%= (l(:label_update_time).to_s << ':' << format_time(e.act.created_on)).to_s %>
@@ -177,7 +177,7 @@
<%= link_to(h(e.user), user_path(e.user_id)) %> <%= l(:label_new_activity) %> <%= link_to format_activity_title("#{l(:label_news)}: #{act.title}"), {:controller => 'news', :action => 'show', :id => act.id} %>
<% end %>
- <%= h act.description %>
+ <%= act.description.html_safe %>
@@ -193,7 +193,7 @@
<%= link_to(h(e.user), user_path(e.user_id)) %> <%= l(:label_new_activity) %> <%= link_to format_activity_title("#{act.source_from} (#{act.status}): #{act.tracker.name} #{act.subject}"), {:controller => 'issues', :action => 'show', :id => act.id} %>
<% end %>
- <%= textilizable act.description %>
+ <%= textilizable(act.description) %>
@@ -251,7 +251,7 @@
- <%= link_to(h(e.user), user_path(e.user)) %>
+ <%= link_to(h(e.user), user_path(e.user)) %>
<% if e.instance_of?(JournalsForMessage)%>
<% if e.reply_id == User.current.id%>
<%if e.jour_type == 'Bid'%>
diff --git a/app/views/users/user_activities.html.erb b/app/views/users/user_activities.html.erb
index faea90fd3..2b4cf8819 100644
--- a/app/views/users/user_activities.html.erb
+++ b/app/views/users/user_activities.html.erb
@@ -39,8 +39,9 @@
-
+
+
<% end %>
-<% end %>
+<% end %>
<% end %>
From 3dfcc90574071ab2b0b56435d9bd8988234f5c47 Mon Sep 17 00:00:00 2001
From: z9hang
Date: Fri, 11 Jul 2014 11:41:54 +0800
Subject: [PATCH 09/14] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E3=80=81=E7=AB=9E?=
=?UTF-8?q?=E8=B5=9B=E9=A6=96=E9=A1=B5=E5=AE=9A=E5=88=B6=20=E8=B6=85?=
=?UTF-8?q?=E7=BA=A7=E7=AE=A1=E7=90=86=E5=91=98=E8=B4=A6=E6=88=B7=E4=B8=AD?=
=?UTF-8?q?=E9=A6=96=E9=A1=B5=E5=AE=9A=E5=88=B6=E7=95=8C=E9=9D=A2=E4=BC=98?=
=?UTF-8?q?=E5=8C=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/admin_controller.rb | 66 ++++++++++++++++++-
app/controllers/welcome_controller.rb | 23 +++++--
app/helpers/application_helper.rb | 2 +-
app/views/admin/contest_page_made.html.erb | 39 +++++++++++
app/views/admin/course_page_made.html.erb | 37 +++++++++++
app/views/admin/first_page_made.html.erb | 18 +++--
app/views/admin/project_page_made.html.erb | 31 +++++++++
app/views/welcome/contest.html.erb | 13 ++--
app/views/welcome/course.html.erb | 9 ++-
app/views/welcome/index.html.erb | 2 +
config/locales/zh.yml | 3 +
config/routes.rb | 2 +
...20140710095123_add_cloumn_to_first_page.rb | 9 +++
db/migrate/20140711010124_alt_column_name.rb | 5 ++
...12924_add_contest_and_course_first_page.rb | 17 +++++
db/schema.rb | 3 +-
16 files changed, 259 insertions(+), 20 deletions(-)
create mode 100644 app/views/admin/contest_page_made.html.erb
create mode 100644 app/views/admin/course_page_made.html.erb
create mode 100644 app/views/admin/project_page_made.html.erb
create mode 100644 db/migrate/20140710095123_add_cloumn_to_first_page.rb
create mode 100644 db/migrate/20140711010124_alt_column_name.rb
create mode 100644 db/migrate/20140711012924_add_contest_and_course_first_page.rb
diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb
index 152fb059e..d87644e43 100644
--- a/app/controllers/admin_controller.rb
+++ b/app/controllers/admin_controller.rb
@@ -238,9 +238,9 @@ class AdminController < ApplicationController
#首页定制
def first_page_made
if request.get?
- @first_page = FirstPage.all.first
+ @first_page = FirstPage.where("page_type = 'project'").first
elsif request.post?
- @first_page = FirstPage.all.first
+ @first_page = FirstPage.where("page_type = 'project'").first
@first_page.web_title = params[:web_title]
@first_page.description = params[:description]
@first_page.title = params[:title]
@@ -262,6 +262,68 @@ class AdminController < ApplicationController
end
end
end
+ end
+
+ def course_page_made
+ if request.get?
+ @course_page = FirstPage.where("page_type = 'course'").first
+ @first_page = FirstPage.where("page_type = 'project'").first
+ elsif request.post?
+ @first_page = FirstPage.where("page_type = 'project'").first
+ @course_page = FirstPage.where("page_type = 'course'").first
+ @first_page.web_title = params[:web_title]
+ @course_page.title = params[:course_title]
+ @course_page.description = params[:course_description]
+ if @first_page.save && @course_page.save
+ respond_to do |format|
+ format.html {
+ flash[:notice] = l(:notice_successful_update)
+ redirect_to admin_course_page_made_path
+ }
+ format.api { render_api_ok }
+ end
+ else
+ respond_to do |format|
+ format.html {
+ course_page_made
+ render :action => 'course_page_made'
+ }
+ format.api { render_validation_errors(@first_page) }
+ format.api { render_validation_errors(@course_page) }
+ end
+ end
+ end
+ end
+ def contest_page_made
+ if request.get?
+ @contest_page = FirstPage.where("page_type = 'contest'").first
+ @first_page = FirstPage.where("page_type = 'project'").first
+ elsif request.post?
+ @first_page = FirstPage.where("page_type = 'project'").first
+ @contest_page = FirstPage.where("page_type = 'contest'").first
+ @first_page.web_title = params[:web_title]
+ @contest_page.title = params[:contest_title]
+ @contest_page.description = params[:contest_description]
+ if @first_page.save && @contest_page.save
+ respond_to do |format|
+ format.html {
+ flash[:notice] = l(:notice_successful_update)
+ redirect_to admin_contest_page_made_path
+ }
+ format.api { render_api_ok }
+ end
+ else
+ respond_to do |format|
+ format.html {
+ contest_page_made
+ render :action => 'contest_page_made'
+ }
+ format.api { render_validation_errors(@first_page) }
+ format.api { render_validation_errors(@contest_page) }
+ end
+ end
+ end
end
+
end
diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb
index 0920d2e42..03bca6162 100644
--- a/app/controllers/welcome_controller.rb
+++ b/app/controllers/welcome_controller.rb
@@ -16,12 +16,13 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class WelcomeController < ApplicationController
+ include ApplicationHelper
caches_action :robots
# before_filter :fake, :only => [:index, :course]
before_filter :entry_select, :only => [:index]
def index
- @first_page = FirstPage.all.first
+ @first_page = FirstPage.where("page_type = 'project'").first
end
def robots
@@ -30,6 +31,7 @@ class WelcomeController < ApplicationController
end
def course
+ @course_page = FirstPage.where("page_type = 'course'").first
if params[:school_id]
@school_id = params[:school_id]
elsif User.current.logged? && User.current.user_extensions.school
@@ -41,13 +43,24 @@ class WelcomeController < ApplicationController
def logolink()
+ @course_page = FirstPage.where("page_type = 'course'").first
+ logo = get_avatar?(@course_page)
id = params[:school_id]
logo_link = ""
- if id.nil? and User.current.user_extensions.school.nil?
- logo_link = '/images/transparent.png'
+ if id.nil? && User.current.user_extensions.school.nil?
+ if logo
+ logo_link = url_to_avatar(@course_page)
+ else
+ logo_link = '/images/transparent.png'
+ end
+
else
if id == "0"
- logo_link = '/images/transparent.png'
+ if logo
+ logo_link = url_to_avatar(@course_page)
+ else
+ logo_link = '/images/transparent.png'
+ end
else
if id.nil?
if School.find(User.current.user_extensions.school.id).logo_link.nil?
@@ -66,7 +79,7 @@ class WelcomeController < ApplicationController
def contest
-
+ @contest_page = FirstPage.where("page_type = 'contest'").first
end
def search
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 3f873a64d..b63381903 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -625,7 +625,7 @@ module ApplicationHelper
end
def html_title(*args)
- first_page = FirstPage.all.first
+ first_page = FirstPage.where("page_type = 'project'").first
if args.empty?
title = @html_title || []
title << @project.name if @project
diff --git a/app/views/admin/contest_page_made.html.erb b/app/views/admin/contest_page_made.html.erb
new file mode 100644
index 000000000..b8a86fa4d
--- /dev/null
+++ b/app/views/admin/contest_page_made.html.erb
@@ -0,0 +1,39 @@
+<%=l(:label_first_page_made)%>
+
+<%= form_tag(:controller => 'admin', :action => 'contest_page_made') do %>
+
+ <%= l(:label_web_title) %>:
+ <%= text_field_tag 'web_title', params[:wbe_title],:value => @first_page.web_title, :size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %>
+
+
+
+ <%= link_to l(:label_project_first_page), {:action => 'first_page_made'} %>
+ <%= link_to l(:label_course_first_page), {:action => 'course_page_made'} %>
+ <%= link_to l(:label_contest_first_page), {:action => 'contest_page_made'} , :class => 'selected'%>
+
+
+
+ <%=l(:label_contest_first_page)%>
+
+ <%= l(:label_site_image) %>:
+
+
+ <%= render :partial=>"avatar/avatar_form",:style => "display:inline",:locals=> {source:@contest_page} %>
+
+
+ <%= l(:label_site_title) %>:
+ <%= text_field_tag 'contest_title', params[:label_site_title], :value => @contest_page.title,:size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %>
+
+
+
+ <%= l(:label_site_description)%>:
+ <%= text_area_tag 'contest_description',@contest_page.description,:rows => 8, :size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %>
+
+
+ <%= submit_tag l(:button_save), :class => "small", :name => nil %>
+<% end %>
+
+
+
+
+
\ No newline at end of file
diff --git a/app/views/admin/course_page_made.html.erb b/app/views/admin/course_page_made.html.erb
new file mode 100644
index 000000000..4554fb8e0
--- /dev/null
+++ b/app/views/admin/course_page_made.html.erb
@@ -0,0 +1,37 @@
+<%=l(:label_first_page_made)%>
+
+<%= form_tag(:controller => 'admin', :action => 'course_page_made') do %>
+
+ <%= l(:label_web_title) %>:
+ <%= text_field_tag 'web_title', params[:wbe_title],:value => @first_page.web_title, :size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %>
+
+
+
+ <%= link_to l(:label_project_first_page), {:action => 'first_page_made'} %>
+ <%= link_to l(:label_course_first_page), {:action => 'course_page_made'}, :class => 'selected' %>
+ <%= link_to l(:label_contest_first_page), {:action => 'contest_page_made'} %>
+
+
+ <%=l(:label_course_first_page)%>
+
+ <%= l(:label_site_image) %>:
+
+
+ <%= render :partial=>"avatar/avatar_form",:style => "display:inline",:locals=> {source:@course_page} %>
+
+
+ <%= l(:label_site_title) %>:
+ <%= text_field_tag 'course_title', params[:label_site_title], :value => @course_page.title,:size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %>
+
+
+ <%= l(:label_site_description)%>:
+ <%= text_area_tag 'course_description',@course_page.description,:rows => 8, :size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %>
+
+
+ <%= submit_tag l(:button_save), :class => "small", :name => nil %>
+<% end %>
+
+
+
+
+
\ No newline at end of file
diff --git a/app/views/admin/first_page_made.html.erb b/app/views/admin/first_page_made.html.erb
index 9e863d813..a64bbb443 100644
--- a/app/views/admin/first_page_made.html.erb
+++ b/app/views/admin/first_page_made.html.erb
@@ -1,16 +1,25 @@
<%=l(:label_first_page_made)%>
<%= form_tag(:controller => 'admin', :action => 'first_page_made') do %>
+
+ <%= l(:label_web_title) %>:
+ <%= text_field_tag 'web_title', params[:wbe_title],:value => @first_page.web_title, :size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %>
+
+
+
+ <%= link_to l(:label_project_first_page), {:action => 'first_page_made'}, :class => 'selected' %>
+ <%= link_to l(:label_course_first_page), {:action => 'course_page_made'} %>
+ <%= link_to l(:label_contest_first_page), {:action => 'contest_page_made'} %>
+
+
+ <%=l(:label_project_first_page)%>
<%= l(:label_site_image) %>:
<%= render :partial=>"avatar/avatar_form",:style => "display:inline",:locals=> {source:@first_page} %>
-
- <%= l(:label_web_title) %>:
- <%= text_field_tag 'web_title', params[:wbe_title],:value => @first_page.web_title, :size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %>
-
+
<%= l(:label_site_title) %>:
<%= text_field_tag 'title', params[:label_site_title], :value => @first_page.title,:size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %>
@@ -19,6 +28,7 @@
<%= l(:label_site_description)%>:
<%= text_area_tag 'description',@first_page.description,:rows => 8, :size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %>
+
<%= submit_tag l(:button_save), :class => "small", :name => nil %>
<% end %>
diff --git a/app/views/admin/project_page_made.html.erb b/app/views/admin/project_page_made.html.erb
new file mode 100644
index 000000000..e338c21a9
--- /dev/null
+++ b/app/views/admin/project_page_made.html.erb
@@ -0,0 +1,31 @@
+
<%=l(:label_first_page_made)%>
+
+<%= form_tag(:controller => 'admin', :action => 'first_page_made') do %>
+
+ <%= l(:label_web_title) %>:
+ <%= text_field_tag 'web_title', params[:wbe_title],:value => @first_page.web_title, :size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %>
+
+
<%=l(:label_project_first_page)%>
+
+ <%= l(:label_site_image) %>:
+
+
+ <%= render :partial=>"avatar/avatar_form",:style => "display:inline",:locals=> {source:@first_page} %>
+
+
+
+ <%= l(:label_site_title) %>:
+ <%= text_field_tag 'title', params[:label_site_title], :value => @first_page.title,:size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %>
+
+
+ <%= l(:label_site_description)%>:
+ <%= text_area_tag 'description',@first_page.description,:rows => 8, :size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %>
+
+
+ <%= submit_tag l(:button_save), :class => "small", :name => nil %>
+<% end %>
+
+
+
+
+
\ No newline at end of file
diff --git a/app/views/welcome/contest.html.erb b/app/views/welcome/contest.html.erb
index c87cc13e1..c3bd120da 100644
--- a/app/views/welcome/contest.html.erb
+++ b/app/views/welcome/contest.html.erb
@@ -114,12 +114,17 @@
- <%= image_tag '/images/transparent.png', size: "75x75" %>
+ <% if get_avatar?(@contest_page) %>
+ <%= image_tag(url_to_avatar(@contest_page), size: "75x75") %>
+ <% else %>
+ <%= image_tag '/images/transparent.png', size: "75x75" %>
+ <% end %>
-
- <%= l(:label_welcome_trustie) %> <%= l(:label_welcome_trustie_contest) %> , <%= l(:label_welcome_trustie_contest_description) %>
-
+ <% unless @contest_page.nil? %>
+
<%= @contest_page.title %> , <%= @contest_page.description %>
+ <% end %>
+
diff --git a/app/views/welcome/course.html.erb b/app/views/welcome/course.html.erb
index cfde8fca4..f6bffe51c 100644
--- a/app/views/welcome/course.html.erb
+++ b/app/views/welcome/course.html.erb
@@ -51,14 +51,17 @@
<% end %>
<% end %>
<% end %>
- <%= l(:label_welcome_trustie) %><%= l(:label_welcome_trustie_course) %>
+ <% unless @course_page.nil? %>
+ <%= @course_page.title %>
+
<% if @school_id.nil? and User.current.user_extensions.school.nil? %>
- , <%= l(:label_welcome_trustie_course_description) %>
+ , <%= @course_page.description %>
<% else %>
<% if @school_id == "0" %>
- , <%= l(:label_welcome_trustie_course_description) %>
+ , <%= @course_page.description %>
<% end %>
<% end %>
+ <% end %>
<%= render :partial => "search_course", :locals => {:project_type => Project::ProjectType_course} %>
diff --git a/app/views/welcome/index.html.erb b/app/views/welcome/index.html.erb
index ffc9706e9..d1d807207 100644
--- a/app/views/welcome/index.html.erb
+++ b/app/views/welcome/index.html.erb
@@ -42,7 +42,9 @@
+ <% unless @first_page.nil? %>
<%= @first_page.title %> , <%= @first_page.description %>
+ <% end %>
<%= render :partial => "search_project", :locals => {:project_type => 0}%>
diff --git a/config/locales/zh.yml b/config/locales/zh.yml
index 11c9e054a..69af5cd2a 100644
--- a/config/locales/zh.yml
+++ b/config/locales/zh.yml
@@ -516,6 +516,9 @@ zh:
label_project_plural: 项目列表
label_project_score: 项目评分
label_first_page_made: 首页定制
+ label_project_first_page: 项目托管平台首页
+ label_course_first_page: 课程实践平台首页
+ label_contest_first_page: 竞赛实战平台首页
label_x_projects:
zero: 无项目
one: 1 个项目
diff --git a/config/routes.rb b/config/routes.rb
index 7c5f878eb..f6b391108 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -559,6 +559,8 @@ RedmineApp::Application.routes.draw do
match 'admin/projects', :controller => 'admin', :action => 'projects', :via => :get
match 'admin/users', :controller => 'admin', :action => 'users', :via => :get
match 'admin/first_page_made',:controller => 'admin',:action => 'first_page_made',:via => [:get,:post]
+ match 'admin/course_page_made',:controller => 'admin',:action => 'course_page_made',:via => [:get,:post]
+ match 'admin/contest_page_made',:controller => 'admin',:action => 'contest_page_made',:via => [:get,:post]
match 'admin/search', :controller => 'admin', :action => 'search', :via => [:get, :post]
match 'admin/plugins', :controller => 'admin', :action => 'plugins', :via => :get
match 'admin/info', :controller => 'admin', :action => 'info', :via => :get
diff --git a/db/migrate/20140710095123_add_cloumn_to_first_page.rb b/db/migrate/20140710095123_add_cloumn_to_first_page.rb
new file mode 100644
index 000000000..6720a8aa4
--- /dev/null
+++ b/db/migrate/20140710095123_add_cloumn_to_first_page.rb
@@ -0,0 +1,9 @@
+class AddCloumnToFirstPage < ActiveRecord::Migration
+ def change
+ add_column :first_pages,:type,:string
+
+ fr = FirstPage.all.first
+ fr.type = "project"
+ fr.save
+ end
+end
diff --git a/db/migrate/20140711010124_alt_column_name.rb b/db/migrate/20140711010124_alt_column_name.rb
new file mode 100644
index 000000000..24b784765
--- /dev/null
+++ b/db/migrate/20140711010124_alt_column_name.rb
@@ -0,0 +1,5 @@
+class AltColumnName < ActiveRecord::Migration
+ def change
+ rename_column :first_pages,:type,:page_type
+ end
+end
diff --git a/db/migrate/20140711012924_add_contest_and_course_first_page.rb b/db/migrate/20140711012924_add_contest_and_course_first_page.rb
new file mode 100644
index 000000000..801219bd5
--- /dev/null
+++ b/db/migrate/20140711012924_add_contest_and_course_first_page.rb
@@ -0,0 +1,17 @@
+# -*coding:utf-8 -*-
+class AddContestAndCourseFirstPage < ActiveRecord::Migration
+ def change
+ fp = FirstPage.new
+ fp.web_title = ""
+ fp.title = "Trustie在线课程实践平台"
+ fp.description = "面向中国高校教师与大学生,提供社交化的课程管理、资源共享、合作实验、协同研究。"
+ fp.page_type = "course"
+ fp.save
+ fp1 = FirstPage.new
+ fp1.web_title = ""
+ fp1.title = "Trustie在线竞赛实战平台"
+ fp1.description = "面向中国大学生与编程爱好者,提供社交化的竞赛管理、应用管理、代码托管、合作交流。"
+ fp1.page_type = "contest"
+ fp1.save
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index d84c30f9a..8123e15de 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20140710071720) do
+ActiveRecord::Schema.define(:version => 20140711012924) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@@ -412,6 +412,7 @@ ActiveRecord::Schema.define(:version => 20140710071720) do
t.string "description"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
+ t.string "page_type"
end
create_table "forums", :force => true do |t|
From e1c7aaa2208025ceba5c8ccfc131ca0fa34a10e0 Mon Sep 17 00:00:00 2001
From: z9hang
Date: Fri, 11 Jul 2014 11:53:31 +0800
Subject: [PATCH 10/14] =?UTF-8?q?=E5=86=B2=E7=AA=81=E7=BC=96=E8=BE=91?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
db/schema.rb | 16 +---------------
1 file changed, 1 insertion(+), 15 deletions(-)
diff --git a/db/schema.rb b/db/schema.rb
index 9e21541c2..fa41ed1d5 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -12,7 +12,6 @@
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20140711012924) do
->>>>>>> 056f86caad29ca95632d9da9e1e616cd00e2349a
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@@ -805,7 +804,7 @@ ActiveRecord::Schema.define(:version => 20140711012924) do
end
create_table "relative_memos", :force => true do |t|
- t.integer "osp_id", :null => false
+ t.integer "osp_id"
t.integer "parent_id"
t.string "subject", :null => false
t.text "content", :null => false
@@ -842,19 +841,6 @@ ActiveRecord::Schema.define(:version => 20140711012924) do
add_index "repositories", ["project_id"], :name => "index_repositories_on_project_id"
- create_table "rich_rich_files", :force => true do |t|
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- t.string "rich_file_file_name"
- t.string "rich_file_content_type"
- t.integer "rich_file_file_size"
- t.datetime "rich_file_updated_at"
- t.string "owner_type"
- t.integer "owner_id"
- t.text "uri_cache"
- t.string "simplified_type", :default => "file"
- end
-
create_table "roles", :force => true do |t|
t.string "name", :limit => 30, :default => "", :null => false
t.integer "position", :default => 1
From 9472a7eb5cd1b0e9904118bd1dbdc5a0c0829266 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Fri, 11 Jul 2014 13:41:05 +0800
Subject: [PATCH 11/14] =?UTF-8?q?=E6=9C=AA=E7=99=BB=E5=BD=95=E6=97=B6?=
=?UTF-8?q?=E5=8F=96=E6=B6=88=E6=98=BE=E7=A4=BA=E6=88=91=E7=9A=84=E5=AD=A6?=
=?UTF-8?q?=E6=A0=A1=E6=8C=89=E9=92=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/school/index.html.erb | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/app/views/school/index.html.erb b/app/views/school/index.html.erb
index a42844ffb..8a5aa5f49 100644
--- a/app/views/school/index.html.erb
+++ b/app/views/school/index.html.erb
@@ -71,7 +71,9 @@
<%= link_to "全部学校",school_index_path %>
- 我的学校
+ <% if User.current.logged? %>
+ 我的学校
+ <% end %>
请选择省份:
From 9da70f9a20f718e6b0b6d328d606a956653f5915 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Fri, 11 Jul 2014 14:51:33 +0800
Subject: [PATCH 12/14] =?UTF-8?q?=E8=B0=83=E6=95=B4=E9=A1=B9=E7=9B=AE?=
=?UTF-8?q?=E5=88=97=E8=A1=A8=E6=A0=B7=E5=BC=8F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/projects/_project.html.erb | 52 ++++++++++++++++++++--------
app/views/welcome/index.html.erb | 52 ++++++++++++++--------------
2 files changed, 63 insertions(+), 41 deletions(-)
diff --git a/app/views/projects/_project.html.erb b/app/views/projects/_project.html.erb
index 4feddc675..5f507db3c 100644
--- a/app/views/projects/_project.html.erb
+++ b/app/views/projects/_project.html.erb
@@ -18,18 +18,40 @@
<% end %>
@@ -120,9 +142,9 @@
<%= l(:label_project_grade)%>:
<%= link_to(format("%.2f" , finall_project_score ).to_f,
- {:controller => 'projects',
- :action => 'show_projects_score',
- :remote => true, :id => @project.id}, :style=>"color: #EC6300;") %>
+ {:controller => 'projects',
+ :action => 'show_projects_score',
+ :remote => true, :id => @project.id}, :style=>"color: #EC6300;") %>
<% end %>
diff --git a/app/views/welcome/index.html.erb b/app/views/welcome/index.html.erb
index 890155915..67cbb3bd0 100644
--- a/app/views/welcome/index.html.erb
+++ b/app/views/welcome/index.html.erb
@@ -54,7 +54,7 @@
<% projects = find_miracle_project(10, 3) %>
<% projects.map do |project| %>
-
+
<%= image_tag(get_project_avatar(project), :class => "avatar-4") %>
@@ -68,40 +68,40 @@
><%=project.short_description.truncate(50, omission: '...')%>
- <% issue_count = project.issues.count %>
- <% issue_journal_count = project.issue_changes.count %>
- <% issue_score = issue_count * 0.2 %>
- <% issue_journal_score = issue_journal_count * 0.1 %>
- <% finall_issue_score = issue_score + issue_journal_score %>
+ <%# issue_count = project.issues.count %>
+ <%# issue_journal_count = project.issue_changes.count %>
+ <%# issue_score = issue_count * 0.2 %>
+ <%# issue_journal_score = issue_journal_count * 0.1 %>
+ <%# finall_issue_score = issue_score + issue_journal_score %>
- <% new_count = project.news.count %>
- <% new_score = new_count * 0.1 %>
- <% finall_new_score = new_score %>
+ <%# new_count = project.news.count %>
+ <%# new_score = new_count * 0.1 %>
+ <%# finall_new_score = new_score %>
- <% document_count = project.documents.count %>
- <% file_score = document_count * 0.1 %>
- <% finall_file_score = file_score %>
+ <%# document_count = project.documents.count %>
+ <%# file_score = document_count * 0.1 %>
+ <%# finall_file_score = file_score %>
- <% changeset_count = project.changesets.count %>
- <% code_submit_score = changeset_count * 0.3 %>
- <% finall_code_submit_score = code_submit_score %>
+ <%# changeset_count = project.changesets.count %>
+ <%# code_submit_score = changeset_count * 0.3 %>
+ <%# finall_code_submit_score = code_submit_score %>
- <% board_message_count = 0 %>
- <% project.boards.each do |board| %>
- <% board_message_count += board.messages_count %>
- <% end %>
- <% topic_score = board_message_count * 0.1 %>
- <% finall_topic_score = topic_score %>
+ <%# board_message_count = 0 %>
+ <%# project.boards.each do |board| %>
+ <%# board_message_count += board.messages_count %>
+ <%# end %>
+ <%# topic_score = board_message_count * 0.1 %>
+ <%# finall_topic_score = topic_score %>
- <% finall_project_score = finall_issue_score + finall_new_score + finall_file_score + finall_code_submit_score + topic_score %>
- <%= content_tag "span", l(:label_project_score)+ ":" + format("%.2f" , finall_project_score ),
+ <%# finall_project_score = finall_issue_score + finall_new_score + finall_file_score + finall_code_submit_score + topic_score %>
+ <%= content_tag "span", l(:label_project_score)+ ":" + project_score(project),
:style => "cursor: pointer; display: inline-block; float: right; color: #ec6300; ",
:title => "项目得分,综合考虑了项目的各项活动,反映了该项目的活跃程度",
:class => "tooltip",
:id => "tooltip-#{project.id}" %>
-
+
<% end; reset_cycle %>
@@ -114,7 +114,7 @@
<%activities = find_all_activities%>
<% activities.each do |event| %>
-
+
<%= image_tag url_to_avatar(event.event_author), :class => "avatar-3" %>
@@ -125,7 +125,7 @@
<%= l(:field_updated_on) %><%= time_tag_welcome event.event_datetime %>前 <%= show_event_reply event %>
-
+
<% end %>
From 6b6fd2906fa479ee3bb4fbdbb4c25cb882b933f4 Mon Sep 17 00:00:00 2001
From: z9hang
Date: Mon, 14 Jul 2014 09:18:31 +0800
Subject: [PATCH 13/14] =?UTF-8?q?=E7=AB=9E=E8=B5=9B=E5=88=97=E8=A1=A8?=
=?UTF-8?q?=E3=80=82=E8=B4=B4=E5=90=A7=E5=88=97=E8=A1=A8=E7=9A=84=E9=9D=9E?=
=?UTF-8?q?=E7=A9=BA=E5=88=A4=E6=96=AD=20=E6=95=B0=E6=8D=AE=E8=BF=81?=
=?UTF-8?q?=E7=A7=BB=E6=8A=A5=E9=94=99=E9=97=AE=E9=A2=98=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/models/first_page.rb | 3 ++-
app/views/contests/_contest_list.html.erb | 12 ++++++++++--
app/views/forums/_forum_list.html.erb | 6 +++++-
3 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/app/models/first_page.rb b/app/models/first_page.rb
index 8d8bbcff6..fcb76972c 100644
--- a/app/models/first_page.rb
+++ b/app/models/first_page.rb
@@ -1,3 +1,4 @@
class FirstPage < ActiveRecord::Base
- attr_accessible :description, :title, :web_title
+ attr_accessible :description, :title, :web_title,:page_type
end
+ l
\ No newline at end of file
diff --git a/app/views/contests/_contest_list.html.erb b/app/views/contests/_contest_list.html.erb
index 8b5e34975..61dd6192c 100644
--- a/app/views/contests/_contest_list.html.erb
+++ b/app/views/contests/_contest_list.html.erb
@@ -2,11 +2,19 @@
<% contests.each do |contest|%>
- <%= link_to(image_tag(url_to_avatar(contest.author), :class => 'avatar'), user_path(contest.author), :class => "avatar") %>
+
+ <% unless contest.author.nil? %>
+ <%= link_to(image_tag(url_to_avatar(contest.author), :class => 'avatar'), user_path(contest.author), :class => "avatar") %>
+ <% end %>
+
- <%= link_to(contest.author, user_path(contest.author), :class => 'bid_user') %>: <%= link_to(contest.name, show_contest_contest_path(contest), :class => 'bid_path', :target => "_blank") %>
+
+ <% unless contest.author.nil? %>
+ <%= link_to(contest.author, user_path(contest.author), :class => 'bid_user') %>:
+ <% end %>
+ <%= link_to(contest.name, show_contest_contest_path(contest), :class => 'bid_path', :target => "_blank") %>
diff --git a/app/views/forums/_forum_list.html.erb b/app/views/forums/_forum_list.html.erb
index 0bbb0ddd4..2b8f98494 100644
--- a/app/views/forums/_forum_list.html.erb
+++ b/app/views/forums/_forum_list.html.erb
@@ -3,7 +3,11 @@
<% if forums.any? %>
<% forums.each do |forum| %>
-
<%= link_to image_tag(url_to_avatar(forum.creator), :class => "avatar"), user_path(forum.creator) %>
+
+ <% unless forum.creator.nil? %>
+ <%= link_to image_tag(url_to_avatar(forum.creator), :class => "avatar"), user_path(forum.creator) %>
+ <% end %>
+
<%= link_to h(forum.name), forum_path(forum) %>
<%= forum.description%>
From 98ddd6940db34d784060734b70122beddbee3f1a Mon Sep 17 00:00:00 2001
From: z9hang
Date: Mon, 14 Jul 2014 09:31:55 +0800
Subject: [PATCH 14/14] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E9=94=99=E8=AF=AF?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/models/first_page.rb | 1 -
1 file changed, 1 deletion(-)
diff --git a/app/models/first_page.rb b/app/models/first_page.rb
index fcb76972c..b284c8fdc 100644
--- a/app/models/first_page.rb
+++ b/app/models/first_page.rb
@@ -1,4 +1,3 @@
class FirstPage < ActiveRecord::Base
attr_accessible :description, :title, :web_title,:page_type
end
- l
\ No newline at end of file