From 13273cecf1a02d8bac6949929b66d8dadf886284 Mon Sep 17 00:00:00 2001
From: lizanle <491823689@qq.com>
Date: Thu, 9 Apr 2015 10:08:47 +0800
Subject: [PATCH 01/14] =?UTF-8?q?app=E7=9A=84=E5=88=9B=E5=BB=BA=E5=8A=A8?=
=?UTF-8?q?=E6=80=81=E6=8F=8F=E8=BF=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
config/locales/zh.yml | 2 ++
1 file changed, 2 insertions(+)
diff --git a/config/locales/zh.yml b/config/locales/zh.yml
index 17c445ae8..5a95d1bd3 100644
--- a/config/locales/zh.yml
+++ b/config/locales/zh.yml
@@ -2014,6 +2014,8 @@ zh:
label_recently_updated_courseware: 最近更新了课件
label_no_courses: 您没有参与任何课程,请搜索课程、加入课程,或者创建课程吧!
label_commit_failed: 提交失败
+ label_recently: 最近被
+ label_creat: 创建
#api end
label_end_time: 截止时间
From 590dd0cac5823164d9b580d4cf140597cbddf93e Mon Sep 17 00:00:00 2001
From: lizanle <491823689@qq.com>
Date: Thu, 9 Apr 2015 10:09:47 +0800
Subject: [PATCH 02/14] =?UTF-8?q?=E5=88=A0=E9=99=A4=E8=BF=99=E4=B8=AAdemo?=
=?UTF-8?q?=E7=9A=84=E6=95=B0=E6=8D=AE=E8=A1=A8=E5=88=9B=E5=BB=BA=E8=84=9A?=
=?UTF-8?q?=E6=9C=AC?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
db/migrate/20150316032155_create_discuss_demos.rb | 9 ---------
1 file changed, 9 deletions(-)
delete mode 100644 db/migrate/20150316032155_create_discuss_demos.rb
diff --git a/db/migrate/20150316032155_create_discuss_demos.rb b/db/migrate/20150316032155_create_discuss_demos.rb
deleted file mode 100644
index af7a2a6ed..000000000
--- a/db/migrate/20150316032155_create_discuss_demos.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-class CreateDiscussDemos < ActiveRecord::Migration
- def change
- create_table :discuss_demos do |t|
- t.string :title
- t.text :body
- t.timestamps
- end
- end
-end
From 988f8b79189b33ca76351c2fba41ceaa34e521f7 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Thu, 9 Apr 2015 10:33:15 +0800
Subject: [PATCH 03/14] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=9A=90=E8=97=8F?=
=?UTF-8?q?=E9=9D=9E=E9=A1=B9=E7=9B=AE=E4=BF=A1=E6=81=AF=E6=8C=89=E9=92=AE?=
=?UTF-8?q?=E4=BB=A5=E5=8F=8A=E8=B7=AF=E7=94=B1=20=E5=AE=9E=E7=8E=B0?=
=?UTF-8?q?=E7=82=B9=E5=87=BB=E6=8C=89=E9=92=AE=E4=BA=8B=E6=95=B0=E6=8D=AE?=
=?UTF-8?q?=E7=9A=84=E5=AD=98=E5=82=A8=E4=B8=8E=E4=BF=AE=E6=94=B9=20?=
=?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/settings_controller.rb | 19 +++++++++++++++++++
app/views/settings/edit.html.erb | 4 +++-
app/views/settings/hidden_non_project.js.erb | 5 +++++
config/locales/zh.yml | 2 ++
config/routes.rb | 1 +
config/settings.yml | 2 ++
6 files changed, 32 insertions(+), 1 deletion(-)
create mode 100644 app/views/settings/hidden_non_project.js.erb
diff --git a/app/controllers/settings_controller.rb b/app/controllers/settings_controller.rb
index c60d1bd8f..93e0e9c4b 100644
--- a/app/controllers/settings_controller.rb
+++ b/app/controllers/settings_controller.rb
@@ -29,6 +29,9 @@ class SettingsController < ApplicationController
end
def edit
+ hidden_non_project = Setting.find_by_name("hidden_non_project")
+ @text = (hidden_non_project && hidden_non_project.value == "0") ? l(:label_show_non_project) : l(:label_hidden_non_project)
+
@notifiables = Redmine::Notifiable.all
if request.post? && params[:settings] && params[:settings].is_a?(Hash)
settings = (params[:settings] || {}).dup.symbolize_keys
@@ -70,4 +73,20 @@ class SettingsController < ApplicationController
rescue Redmine::PluginNotFound
render_404
end
+
+ #隐藏/显示非项目信息
+ def hidden_non_project
+ @notifiable = Setting.find_by_name("hidden_non_project")
+ if @notifiable
+ @notifiable.value == "1" ? @notifiable.value = 0 : @notifiable.value = 1
+ @notifiable.save
+ else
+ @notifiable = Setting.new()
+ @notifiable.name = "hidden_non_project"
+ @notifiable.value = 0
+ @notifiable.save
+ end
+
+ redirect_to settings_url
+ end
end
diff --git a/app/views/settings/edit.html.erb b/app/views/settings/edit.html.erb
index 8de53f55c..798db291b 100644
--- a/app/views/settings/edit.html.erb
+++ b/app/views/settings/edit.html.erb
@@ -1,4 +1,6 @@
-
<%= l(:label_settings) %>
+<%=l(:label_settings)%>
+<%= link_to @text,settings_hidden_non_project_path,:id => "hidden_non_project",:style => "float: right;margin-right: 60px;margin-top: 9px;"%>
+
<%= render_tabs administration_settings_tabs %>
diff --git a/app/views/settings/hidden_non_project.js.erb b/app/views/settings/hidden_non_project.js.erb
new file mode 100644
index 000000000..370fea33a
--- /dev/null
+++ b/app/views/settings/hidden_non_project.js.erb
@@ -0,0 +1,5 @@
+<% if @notifiable.value == "0"%>
+ $("#hidden_non_project").replaceWith("<%= escape_javascript(link_to '显示非项目信息',settings_hidden_non_project_path,:id => 'hidden_non_project',:style => 'float: right;margin-right: 60px;margin-top: 9px;', :remote => true)%>");
+<% else%>
+ $("#hidden_non_project").replaceWith("<%= escape_javascript(link_to '隐藏非项目信息',settings_hidden_non_project_path,:id => 'hidden_non_project',:style => 'float: right;margin-right: 60px;margin-top: 9px;', :remote => true)%>");
+<% end%>
\ No newline at end of file
diff --git a/config/locales/zh.yml b/config/locales/zh.yml
index 17c445ae8..9cae8b25a 100644
--- a/config/locales/zh.yml
+++ b/config/locales/zh.yml
@@ -2031,4 +2031,6 @@ zh:
modal_valid_unpassing: 该分班已经存在
mail_footer: 点击修改邮件发送设置
+ label_show_non_project: 显示非项目信息
+ label_hidden_non_project: 隐藏非项目信息
diff --git a/config/routes.rb b/config/routes.rb
index c9220769c..03ed4d2ab 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -736,6 +736,7 @@ RedmineApp::Application.routes.draw do
match 'settings', :controller => 'settings', :action => 'index', :via => :get
match 'settings/edit', :via => [:get, :post]
match 'settings/plugin/:id', :to => 'settings#plugin', :via => [:get, :post], :as => 'plugin_settings'
+ match 'settings/hidden_non_project', :via => [:get, :post]
match 'sys/projects', :via => :get
match 'sys/projects/:id/repository', :to => 'sys#create_project_repository', :via => :post
diff --git a/config/settings.yml b/config/settings.yml
index cd3f2974e..28d6c5dbc 100644
--- a/config/settings.yml
+++ b/config/settings.yml
@@ -266,6 +266,8 @@ repository_domain:
default: repository.trustie.net
please_chose:
default: 请选择
+hidden_non_project:
+ default: 1
plugin_redmine_ckeditor:
serialized: true
default: --- !ruby/hash:ActiveSupport::HashWithIndifferentAccess
From 78b60efbbeb7571f3bd3808028a7106669a7bbb0 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Thu, 9 Apr 2015 10:53:56 +0800
Subject: [PATCH 04/14] =?UTF-8?q?=E5=AF=BC=E8=88=AA=E6=A0=8F=E6=A0=B9?=
=?UTF-8?q?=E6=8D=AE=E9=85=8D=E7=BD=AE=E4=BF=A1=E6=81=AF=E7=A1=AE=E5=AE=9A?=
=?UTF-8?q?=E6=98=AF=E5=90=A6=E6=98=BE=E7=A4=BA=E9=9D=9E=E9=A1=B9=E7=9B=AE?=
=?UTF-8?q?=E8=BF=9E=E6=8E=A5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/helpers/application_helper.rb | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index f36e4b397..cfc4545a9 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -1947,6 +1947,8 @@ module ApplicationHelper
end
def bootstrap_render_dynamic_nav
+ hidden_non_project = Setting.find_by_name("hidden_non_project")
+ visiable = !(hidden_non_project && hidden_non_project.value == "0")
main_course_link = link_to l(:label_course_practice), {:controller => 'welcome', :action => 'index', :host => Setting.course_domain}
main_project_link = link_to l(:label_project_deposit), {:controller => 'welcome', :action => 'index', :host => Setting.project_domain}
@@ -1964,21 +1966,21 @@ module ApplicationHelper
#@nav_dispaly_project_label
nav_list = Array.new
- nav_list.push(school_all_school_link) if @nav_dispaly_course_all_label && @show_course == 1
+ nav_list.push(school_all_school_link) if @nav_dispaly_course_all_label && @show_course == 1 && visiable
# nav_list.push(course_all_course_link) if @nav_dispaly_course_all_label && @show_course == 1
- nav_list.push(course_teacher_all_link) if @nav_dispaly_teacher_all_label && @show_course == 1
+ nav_list.push(course_teacher_all_link) if @nav_dispaly_teacher_all_label && @show_course == 1 && visiable
nav_list.push(main_project_link) if @nav_dispaly_main_project_label
- nav_list.push(main_course_link) if @nav_dispaly_main_course_label && @show_course == 1
- nav_list.push(main_contest_link) if @nav_dispaly_main_contest_label && @show_contest == 1
+ nav_list.push(main_course_link) if @nav_dispaly_main_course_label && @show_course == 1 && visiable
+ nav_list.push(main_contest_link) if @nav_dispaly_main_contest_label && @show_contest == 1 && visiable
- nav_list.push(courses_link) if @nav_dispaly_course_label && @show_course == 1
+ nav_list.push(courses_link) if @nav_dispaly_course_label && @show_course == 1 && visiable
# nav_list.push(projects_link) if @nav_dispaly_project_label
#nav_list.push(users_link) if @nav_dispaly_user_label
# nav_list.push(contest_link) if @nav_dispaly_contest_label && @show_contest == 1
- nav_list.push(bids_link) if @nav_dispaly_bid_label
- nav_list.push(forum_link) if @nav_dispaly_forum_label
- nav_list.push(stores_link) if @nav_dispaly_store_all_label
+ nav_list.push(bids_link) if @nav_dispaly_bid_label && visiable
+ nav_list.push(forum_link) if @nav_dispaly_forum_label && visiable
+ nav_list.push(stores_link) if @nav_dispaly_store_all_label && visiable
content_li = ''
nav_list.collect do |nav_item|
From a737342a66da61144c2c26bc196c7a1de443a0cb Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Thu, 9 Apr 2015 11:00:39 +0800
Subject: [PATCH 05/14] =?UTF-8?q?=E5=AE=8C=E6=88=90=E4=B8=AA=E4=BA=BA?=
=?UTF-8?q?=E4=BF=A1=E6=81=AF=E4=B8=8B=E6=8B=89=E3=80=81=E9=A6=96=E9=A1=B5?=
=?UTF-8?q?=E4=B8=8B=E6=A0=87=E7=9A=84=E9=9A=90=E8=97=8F=E9=9D=9E=E9=A1=B9?=
=?UTF-8?q?=E7=9B=AE=E4=BF=A1=E6=81=AF=E7=9A=84=E5=AE=9A=E5=88=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/layouts/_base_header.html.erb | 4 +++-
app/views/welcome/_link_to_another.html.erb | 7 +++++--
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/app/views/layouts/_base_header.html.erb b/app/views/layouts/_base_header.html.erb
index 75c39a407..9eaf7f6ed 100644
--- a/app/views/layouts/_base_header.html.erb
+++ b/app/views/layouts/_base_header.html.erb
@@ -11,8 +11,10 @@
-
<%=link_to_user(User.current)%>
+ <% hidden_non_project = Setting.find_by_name("hidden_non_project")
+ visiable = hidden_non_project && hidden_non_project.value == "0"%>