From ea322d617744352b3422700d0374851a213c8850 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 25 Jul 2014 14:51:10 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=E6=97=B6=E9=97=B4=E5=AD=97=E7=9A=84=E9=95=BF?= =?UTF-8?q?=E5=BA=A6=E8=BF=87=E9=95=BF=E6=97=B6=E4=BC=9A=E6=8D=A2=E8=A1=8C?= =?UTF-8?q?=E7=9A=84BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/projects/_project.html.erb | 18 +++++++++--------- db/schema.rb | 20 ++++++++++---------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/app/views/projects/_project.html.erb b/app/views/projects/_project.html.erb index 1bdef9df9..c057202f8 100644 --- a/app/views/projects/_project.html.erb +++ b/app/views/projects/_project.html.erb @@ -18,37 +18,37 @@

- +
- - - - - - - - diff --git a/db/schema.rb b/db/schema.rb index fe80b7d6f..c01c1baa6 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -843,18 +843,18 @@ ActiveRecord::Schema.define(:version => 20140725013735) do create_table "relative_memos", :force => true do |t| t.integer "osp_id" t.integer "parent_id" - t.string "subject", :null => false - t.text "content", :null => false + t.string "subject", :null => false + t.text "content", :limit => 16777215, :null => false t.integer "author_id" - t.integer "replies_count", :default => 0 + t.integer "replies_count", :default => 0 t.integer "last_reply_id" - t.boolean "lock", :default => false - t.boolean "sticky", :default => false - t.boolean "is_quote", :default => false - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "viewed_count_crawl", :default => 0 - t.integer "viewed_count_local", :default => 0 + t.boolean "lock", :default => false + t.boolean "sticky", :default => false + t.boolean "is_quote", :default => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "viewed_count_crawl", :default => 0 + t.integer "viewed_count_local", :default => 0 t.string "url" t.string "username" t.string "userhomeurl" From b5b246f09806a9ea6a3b5809ed72b744ee9b4d68 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 25 Jul 2014 15:12:24 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=AA=E6=80=A7?= =?UTF-8?q?=E7=AD=BE=E5=90=8D=E6=9C=AA=E8=87=AA=E5=8A=A8=E6=8D=A2=E8=A1=8C?= =?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/views/layouts/base_users.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/layouts/base_users.html.erb b/app/views/layouts/base_users.html.erb index aa0e66ed8..e116a800f 100644 --- a/app/views/layouts/base_users.html.erb +++ b/app/views/layouts/base_users.html.erb @@ -143,7 +143,7 @@

<% end %> <% unless @user.user_extensions.nil? %> -

+

<%= @user.user_extensions.brief_introduction %>

<% end %> From 758541250f73ee6e8f2d3fb671f3a16eb7941c15 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 25 Jul 2014 15:41:21 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E6=8F=92=E4=BB=B6=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=BF=81=E7=A7=BB=E6=96=87=E4=BB=B6=EF=BC=8C?= =?UTF-8?q?=E7=A1=AE=E4=BF=9D=E6=95=B0=E6=8D=AE=E5=BA=93=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=AD=A3=E7=A1=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20140725073357_insert_to_setting.rb | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 db/migrate/20140725073357_insert_to_setting.rb 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 From 97531960dabee26054465611ebd77b42662efdee Mon Sep 17 00:00:00 2001 From: z9hang Date: Fri, 25 Jul 2014 16:05:33 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E9=A6=96=E9=A1=B5=E5=AE=9A=E5=88=B6?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=89=82=E4=BF=AE=E6=94=B9=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E5=A4=A7=E5=B0=8F=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 | 6 +++++ app/models/first_page.rb | 2 ++ app/views/admin/contest_page_made.html.erb | 8 +++++++ app/views/admin/course_page_made.html.erb | 8 +++++++ app/views/admin/first_page_made.html.erb | 9 +++++++- app/views/welcome/contest.html.erb | 6 ++--- app/views/welcome/course.html.erb | 4 ++-- app/views/welcome/index.html.erb | 4 ++-- config/locales/zh.yml | 4 ++++ db/migrate/20140725062302_add_column.rb | 6 +++++ db/schema.rb | 8 ++++--- lib/tasks/first_page.rake | 26 ++++++++++++++++++++++ lib/tasks/first_page_ros.rake | 0 13 files changed, 80 insertions(+), 11 deletions(-) create mode 100644 db/migrate/20140725062302_add_column.rb create mode 100644 lib/tasks/first_page.rake delete mode 100644 lib/tasks/first_page_ros.rake 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/schema.rb b/db/schema.rb index fe80b7d6f..9191e78ce 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 => 20140725013735) do +ActiveRecord::Schema.define(:version => 20140725062302) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -419,10 +419,12 @@ ActiveRecord::Schema.define(:version => 20140725013735) do t.string "web_title" t.string "title" t.text "description" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false t.string "page_type" t.integer "sort_type" + t.integer "image_width", :default => 107 + t.integer "image_height", :default => 63 end create_table "forums", :force => true do |t| 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
+ <%= link_to @project.watcher_users.count, project_watcherlist_path(project)%> + <%= content_tag('span', l(:label_x_follow_people,:count =>@project.watcher_users.count)) %>
+ <%= link_to "#{@project.members.count}", project_member_path(@project)%> + <%= content_tag('span', l(:label_x_current_contributors, :count => @project.users.count)) %>
+ <%= content_tag('span', "#{(@project.repository.nil? || @project.repository.changesets[0].nil?) ? '0' : distance_of_time_in_words(Time.now, @project.repository.changesets[0].committed_on)}", :class => "info") %> + <%= content_tag('span', l(:label_since_last_commits)) %>
+ <% find_project_repository @project %> <%= content_tag('span', "#{@project.repository.nil? || @project.project_status.nil? ? '0' : @project.project_status.changesets_count }", :class => "info") %> + <%= content_tag('span', l(:label_commit_on)) %>