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] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=9A=90=E8=97=8F=E9=9D=9E?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E4=BF=A1=E6=81=AF=E6=8C=89=E9=92=AE=E4=BB=A5?= =?UTF-8?q?=E5=8F=8A=E8=B7=AF=E7=94=B1=20=E5=AE=9E=E7=8E=B0=E7=82=B9?= =?UTF-8?q?=E5=87=BB=E6=8C=89=E9=92=AE=E4=BA=8B=E6=95=B0=E6=8D=AE=E7=9A=84?= =?UTF-8?q?=E5=AD=98=E5=82=A8=E4=B8=8E=E4=BF=AE=E6=94=B9=20=E4=BF=AE?= =?UTF-8?q?=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 @@ -