diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb
index a76a78dcb..36b7e8598 100644
--- a/app/controllers/admin_controller.rb
+++ b/app/controllers/admin_controller.rb
@@ -150,6 +150,8 @@ class AdminController < ApplicationController
@first_page.web_title = params[:web_title]
@first_page.description = params[:first_page][:description]
#@first_page.title = params[:title]
+ @first_page.image_width = params[:image_width]
+ @first_page.image_height = params[:image_height]
@first_page.sort_type = params[:sort_type]
if @first_page.save
respond_to do |format|
@@ -183,6 +185,8 @@ class AdminController < ApplicationController
@first_page.web_title = params[:web_title]
@course_page.web_title = params[:web_title]
@course_page.title = params[:course_title]
+ @course_page.image_width = params[:image_width]
+ @course_page.image_height = params[:image_height]
@course_page.description = params[:course_description]
if @first_page.save && @course_page.save
respond_to do |format|
@@ -219,6 +223,8 @@ class AdminController < ApplicationController
@first_page.web_title = params[:web_title]
@contest_page.web_title = params[:web_title]
@contest_page.title = params[:contest_title]
+ @contest_page.image_width = params[:image_width]
+ @contest_page.image_height = params[:image_height]
@contest_page.description = params[:contest_description]
@notification.title = params[:contest_notification_title]
@notification.content = params[:contest_notification][:content]
diff --git a/app/models/first_page.rb b/app/models/first_page.rb
index 58d20901e..e7ecfd518 100644
--- a/app/models/first_page.rb
+++ b/app/models/first_page.rb
@@ -2,5 +2,7 @@ class FirstPage < ActiveRecord::Base
attr_accessible :description, :title, :web_title,:page_type,:sort_type
validates_presence_of :web_title, :title, :description,:page_type
validates_length_of :web_title,:title, maximum: 30
+ validates_inclusion_of :image_width,:in => 50..120, :message => l(:image_width_error_message)
+ validates_inclusion_of :image_height,:in => 50..80, :message => l(:image_height_error_message)
#validates_length_of :description, maximum: 100
end
diff --git a/app/views/admin/contest_page_made.html.erb b/app/views/admin/contest_page_made.html.erb
index 7f054324d..c1bccb122 100644
--- a/app/views/admin/contest_page_made.html.erb
+++ b/app/views/admin/contest_page_made.html.erb
@@ -20,6 +20,14 @@
<%= render :partial=>"avatar/avatar_form",:style => "display:inline",:locals=> {source:@contest_page} %>
+
+
+ <%= text_field_tag 'image_width', params[:label_image_width],:value => @contest_page.image_width,:size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %>
+
+
+
+ <%= text_field_tag 'image_height', params[:label_imgae_height], :value => @contest_page.image_height,:size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %>
+
<%= text_field_tag 'contest_title', params[:label_site_title], :value => @contest_page.title,:size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %>
diff --git a/app/views/admin/course_page_made.html.erb b/app/views/admin/course_page_made.html.erb
index 7d73c7c6e..15a99bc6a 100644
--- a/app/views/admin/course_page_made.html.erb
+++ b/app/views/admin/course_page_made.html.erb
@@ -19,6 +19,14 @@
<%= render :partial=>"avatar/avatar_form",:style => "display:inline",:locals=> {source:@course_page} %>
+
+
+ <%= text_field_tag 'image_width', params[:label_image_width],:value => @course_page.image_width,:size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %>
+
+
+
+ <%= text_field_tag 'image_height', params[:label_imgae_height], :value => @course_page.image_height,:size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %>
+
<%= text_field_tag 'course_title', params[:label_site_title], :value => @course_page.title,:size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %>
diff --git a/app/views/admin/first_page_made.html.erb b/app/views/admin/first_page_made.html.erb
index e4a5119d3..b83e54db1 100644
--- a/app/views/admin/first_page_made.html.erb
+++ b/app/views/admin/first_page_made.html.erb
@@ -19,7 +19,14 @@
<%= render :partial=>"avatar/avatar_form",:style => "display:inline",:locals=> {source:@first_page} %>
-
+
+
+ <%= text_field_tag 'image_width', params[:label_image_width],:value => @first_page.image_width,:size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %>
+
+
+
+ <%= text_field_tag 'image_height', params[:label_imgae_height], :value => @first_page.image_height,:size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %>
+
-
+
<% if get_avatar?(@contest_page) %>
- <%= image_tag(url_to_avatar(@contest_page), size: "75x75") %>
+ <%= image_tag(url_to_avatar(@contest_page), width:@contest_page.image_width,height: @contest_page.image_height) %>
<% else %>
- <%= image_tag '/images/transparent.png', size: "75x75" %>
+ <%= image_tag '/images/transparent.png', width:@contest_page.image_width,height: @contest_page.image_height %>
<% end %>
diff --git a/app/views/welcome/course.html.erb b/app/views/welcome/course.html.erb
index 6ddc64899..dae00f50e 100644
--- a/app/views/welcome/course.html.erb
+++ b/app/views/welcome/course.html.erb
@@ -37,8 +37,8 @@
微信扫码
-
- <%= image_tag(@logoLink, size: '75x75') %>
+
+ <%= image_tag(@logoLink, width:@course_page.image_width,height: @course_page.image_height) %>
diff --git a/app/views/welcome/index.html.erb b/app/views/welcome/index.html.erb
index b2bc1657e..7dd1e751d 100644
--- a/app/views/welcome/index.html.erb
+++ b/app/views/welcome/index.html.erb
@@ -37,9 +37,9 @@
<% if get_avatar?(@first_page) %>
- <%= image_tag(url_to_avatar(@first_page), size: "107x63") %>
+ <%= image_tag(url_to_avatar(@first_page), width:@first_page.image_width,height: @first_page.image_height) %>
<% else %>
- <%= image_tag '/images/transparent.png', size: "107x63" %>
+ <%= image_tag '/images/transparent.png', width:@first_page.image_width,height: @first_page.image_height %>
<% end %>
diff --git a/config/locales/zh.yml b/config/locales/zh.yml
index 439661a27..bb4c445e8 100644
--- a/config/locales/zh.yml
+++ b/config/locales/zh.yml
@@ -572,6 +572,10 @@ zh:
label_site_title: 网站标题
label_site_description: 网站简介
label_site_image: 简介图片
+ label_image_width: 图片宽度
+ label_imgae_height: 图片高度
+ image_width_error_message: 图片宽度只能是50至120之间的整数
+ image_height_error_message: 图片高度只能是50至80之间的整数
label_sort_type: 热门项目排序方式
label_contest_notification_title: 竞赛通知标题
label_contest_notification_content: 竞赛通知内容
diff --git a/db/migrate/20140725062302_add_column.rb b/db/migrate/20140725062302_add_column.rb
new file mode 100644
index 000000000..995ccde3a
--- /dev/null
+++ b/db/migrate/20140725062302_add_column.rb
@@ -0,0 +1,6 @@
+class AddColumn < ActiveRecord::Migration
+ def change
+ add_column("first_pages","image_width",:integer,default: 107)
+ add_column("first_pages","image_height",:integer,default: 63)
+ end
+end
diff --git a/db/migrate/20140725073357_insert_to_setting.rb b/db/migrate/20140725073357_insert_to_setting.rb
new file mode 100644
index 000000000..89c367a7d
--- /dev/null
+++ b/db/migrate/20140725073357_insert_to_setting.rb
@@ -0,0 +1,28 @@
+class InsertToSetting < ActiveRecord::Migration
+ def up
+ ss = Setting.find_all_by_name("plugin_redmine_ckeditor")
+ if ss.nil?
+ sett = Setting.new
+ sett.name = "plugin_redmine_ckeditor"
+ sett.value = "--- !ruby/hash:ActiveSupport::HashWithIndifferentAccess
+ skin: kama
+ ui_color: ! '#f4f4f4'
+ width: ''
+ height: '400'
+ enter_mode: '1'
+ show_blocks: '1'
+ toolbar_can_collapse: '0'
+ toolbar_location: top
+ toolbar: Source,ShowBlocks,--,Undo,Redo,-,Find,Replace,--,Bold,Italic,Underline,Strike,-,Subscript,Superscript,-,NumberedList,BulletedList,-,Outdent,Indent,Blockquote,-,JustifyLeft,JustifyCenter,JustifyRight,JustifyBlock,-,Link,Unlink,-,richImage,Table,HorizontalRule,/,Styles,Format,Font,FontSize,-,TextColor,BGColor,Cut,Copy,Paste,BidiLtr,BidiRtl,PasteText,PasteFromWord,RemoveFormat,SelectAll"
+ sett.save
+ end
+ end
+
+ def down
+ ss = Setting.find_all_by_name("plugin_redmine_ckeditor")
+ if ss.nil?
+ else
+ ss.destroy
+ end
+ end
+end
diff --git a/lib/tasks/first_page.rake b/lib/tasks/first_page.rake
new file mode 100644
index 000000000..762eea5d6
--- /dev/null
+++ b/lib/tasks/first_page.rake
@@ -0,0 +1,26 @@
+# -*coding:utf-8 -*-
+desc "First Page Initialize"
+task :first_page do
+ puts "first_page sync."
+end
+
+namespace :first_page do
+ desc "initialize first page"
+ task :initialize => :environment do
+ first_page = FirstPage.where("page_type = 'project'").first
+ first_page.description = "
micROS多态智能集群机器人操作系统
+中国开源社区
"
+ first_page.image_width = 107;
+ first_page.image_height = 63;
+ course_page = FirstPage.where("page_type = 'course'").first
+ course_page.image_width = 75
+ course_page.image_height = 75
+ contest_page = FirstPage.where("page_type = 'contest'").first
+ contest_page.image_width = 75
+ contest_page.image_height = 75
+ first_page.save
+ course_page.save
+ contest_page.save
+ puts "initialized Successfully"
+ end
+end
\ No newline at end of file
diff --git a/lib/tasks/first_page_ros.rake b/lib/tasks/first_page_ros.rake
deleted file mode 100644
index e69de29bb..000000000