To rename members.title_format to members.dmsf_title_format #628
This commit is contained in:
parent
395e53d712
commit
0e83f00a67
@ -58,8 +58,8 @@ class DmsfFilesController < ApplicationController
|
||||
access.action = DmsfFileRevisionAccess::DownloadAction
|
||||
access.save!
|
||||
member = Member.where(:user_id => User.current.id, :project_id => @file.project.id).first
|
||||
if member && !member.title_format.nil? && !member.title_format.empty?
|
||||
title_format = member.title_format
|
||||
if member && !member.dmsf_title_format.nil? && !member.dmsf_title_format.empty?
|
||||
title_format = member.dmsf_title_format
|
||||
else
|
||||
title_format = Setting.plugin_redmine_dmsf['dmsf_global_title_format']
|
||||
end
|
||||
|
||||
@ -30,8 +30,8 @@ class DmsfStateController < ApplicationController
|
||||
member = @project.members.where(:user_id => User.current.id).first
|
||||
if member
|
||||
member.dmsf_mail_notification = params[:email_notify]
|
||||
member.title_format = params[:title_format]
|
||||
if format_valid?(member.title_format) && member.save
|
||||
member.dmsf_title_format = params[:title_format]
|
||||
if format_valid?(member.dmsf_title_format) && member.save
|
||||
flash[:notice] = l(:notice_your_preferences_were_saved)
|
||||
else
|
||||
flash[:error] = l(:notice_your_preferences_were_not_saved)
|
||||
|
||||
@ -393,8 +393,8 @@ class DmsfFile < ActiveRecord::Base
|
||||
|
||||
def display_name
|
||||
member = Member.where(:user_id => User.current.id, :project_id => self.project_id).first
|
||||
if member && !member.title_format.nil? && !member.title_format.empty?
|
||||
title_format = member.title_format
|
||||
if member && !member.dmsf_title_format.nil? && !member.dmsf_title_format.empty?
|
||||
title_format = member.dmsf_title_format
|
||||
else
|
||||
title_format = Setting.plugin_redmine_dmsf['dmsf_global_title_format']
|
||||
end
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
<% member = @project.members.where(:user_id => User.current.id).first %>
|
||||
<% if member %>
|
||||
<% mail_notification = member.dmsf_mail_notification %>
|
||||
<% title_format = member.title_format %>
|
||||
<% title_format = member.dmsf_title_format %>
|
||||
<% end %>
|
||||
|
||||
<%= form_tag(dmsf_user_pref_save_path(@project)) do %>
|
||||
|
||||
31
db/migrate/20180216152501_rename_title_format.rb
Normal file
31
db/migrate/20180216152501_rename_title_format.rb
Normal file
@ -0,0 +1,31 @@
|
||||
# encoding: utf-8
|
||||
#
|
||||
# Redmine plugin for Document Management System "Features"
|
||||
#
|
||||
# Copyright © 2011-18 Karel Pičman <karel.picman@kontron.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.
|
||||
|
||||
class RenameTitleFormat < ActiveRecord::Migration
|
||||
|
||||
def self.up
|
||||
rename_column :members, :title_format, :dmsf_title_format
|
||||
end
|
||||
|
||||
def self.down
|
||||
rename_column :members, :dmsf_title_format, :title_format
|
||||
end
|
||||
|
||||
end
|
||||
@ -45,8 +45,8 @@ class DmsfZip
|
||||
unless @files.include?(file)
|
||||
string_path = file.dmsf_folder.nil? ? '' : "#{file.dmsf_folder.dmsf_path_str}/"
|
||||
string_path = string_path[(root_path.length + 1) .. string_path.length] if root_path
|
||||
if member && !member.title_format.nil? && !member.title_format.empty?
|
||||
string_path += file.formatted_name(member.title_format)
|
||||
if member && !member.dmsf_title_format.nil? && !member.dmsf_title_format.empty?
|
||||
string_path += file.formatted_name(member.dmsf_title_format)
|
||||
else
|
||||
string_path += file.formatted_name(Setting.plugin_redmine_dmsf['dmsf_global_title_format'])
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user