* finished Issue 23: Move user preferences to tab in Project settings
git-svn-id: http://redmine-dmsf.googlecode.com/svn/trunk/redmine_dmsf@93 5e329b0b-a2ee-ea63-e329-299493fc886d
This commit is contained in:
parent
69fc0ba460
commit
f04f75e2c4
@ -52,15 +52,12 @@ class DmsfStateController < ApplicationController
|
||||
{:controller => "dmsf", :action => "index", :id => @project, :folder_id => @file.folder}
|
||||
end
|
||||
|
||||
def user_pref
|
||||
end
|
||||
|
||||
def user_pref_save
|
||||
@user_pref = DmsfUserPref.for(@project, User.current)
|
||||
@user_pref.email_notify = params[:email_notify];
|
||||
@user_pref.save
|
||||
flash[:notice] = l(:notice_your_preferences_were_saved)
|
||||
redirect_to :action => "user_pref", :id => @project
|
||||
redirect_to :controller => "projects", :action => 'settings', :tab => 'dmsf', :id => @project
|
||||
end
|
||||
|
||||
def folder_notify_activate
|
||||
|
||||
@ -178,8 +178,6 @@ form_tag({:action => "entries_operation", :id => @project, :folder_id => @folder
|
||||
<%= render(:partial => "multi_upload") %>
|
||||
<br />
|
||||
|
||||
<%= link_to(l(:link_user_preferences), {:controller => "dmsf_state", :action => "user_pref", :id => @project}) %>
|
||||
|
||||
<% content_for :header_tags do %>
|
||||
<script type="text/javascript">
|
||||
jQuery.noConflict();
|
||||
|
||||
@ -1,10 +1,4 @@
|
||||
<% html_title(l(:dmsf)) %>
|
||||
|
||||
<div class="contextual">
|
||||
</div>
|
||||
|
||||
<h2><%= l(:link_user_preferences) %></h2>
|
||||
|
||||
<p><strong><%=l(:link_user_preferences)%></strong></p>
|
||||
<div class="box">
|
||||
<% form_tag({:controller => "dmsf_state", :action => "user_pref_save", :id => @project},
|
||||
:method=>:post) do %>
|
||||
9
init.rb
9
init.rb
@ -17,6 +17,13 @@
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
require 'redmine'
|
||||
require 'dispatcher'
|
||||
|
||||
Dispatcher.to_prepare :redmine_dmsf do
|
||||
unless ProjectsHelper.included_modules.include?(ProjectTabsExtended)
|
||||
ProjectsHelper.send(:include, ProjectTabsExtended)
|
||||
end
|
||||
end
|
||||
|
||||
Redmine::Plugin.register :redmine_dmsf do
|
||||
name "DMSF"
|
||||
@ -45,7 +52,7 @@ Redmine::Plugin.register :redmine_dmsf do
|
||||
|
||||
project_module :dmsf do
|
||||
permission :browse_documents, {:dmsf => [:index]}
|
||||
permission :user_preferences, {:dmsf_state => [:user_pref, :user_pref_save]}
|
||||
permission :user_preferences, {:dmsf_state => [:user_pref_save]}
|
||||
permission :view_dmsf_files, {:dmsf => [:download_file, :download_revision, :entries_operation, :email_entries_send],
|
||||
:dmsf_detail => [:file_detail]}
|
||||
permission :folder_manipulation, {:dmsf_detail => [:folder_new, :create_folder, :delete_folder, :folder_detail, :save_folder]}
|
||||
|
||||
45
lib/project_tabs_extended.rb
Normal file
45
lib/project_tabs_extended.rb
Normal file
@ -0,0 +1,45 @@
|
||||
# Redmine plugin for Document Management System "Features"
|
||||
#
|
||||
# Copyright (C) 2011 Vít Jonáš <vit.jonas@gmail.com>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
require_dependency 'projects_helper'
|
||||
|
||||
module ProjectTabsExtended
|
||||
|
||||
def self.included(base)
|
||||
base.extend(ClassMethods)
|
||||
base.send(:include, InstanceMethods)
|
||||
base.class_eval do
|
||||
unloadable
|
||||
alias_method_chain :project_settings_tabs, :dmsf
|
||||
end
|
||||
end
|
||||
|
||||
module ClassMethods
|
||||
end
|
||||
|
||||
module InstanceMethods
|
||||
|
||||
def project_settings_tabs_with_dmsf
|
||||
tabs = project_settings_tabs_without_dmsf
|
||||
tabs.push({:name => 'dmsf', :controller => :dmsf_state, :action => :user_pref_save, :partial => 'dmsf_state/user_pref', :label => :dmsf})
|
||||
return tabs
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
Loading…
x
Reference in New Issue
Block a user