present? instead of == '1' for settings

This commit is contained in:
karel.picman@lbcfree.net 2021-05-07 11:13:12 +02:00
parent 90015ef514
commit 0c07e1f749
5 changed files with 5 additions and 5 deletions

View File

@ -81,7 +81,7 @@ class DmsfFile < ActiveRecord::Base
before_create :default_values before_create :default_values
def default_values def default_values
if (Setting.plugin_redmine_dmsf['dmsf_default_notifications'] == '1') && (!dmsf_folder || !dmsf_folder.system) if Setting.plugin_redmine_dmsf['dmsf_default_notifications'].present? && (!dmsf_folder || !dmsf_folder.system)
self.notification = true self.notification = true
end end
end end

View File

@ -123,7 +123,7 @@ class DmsfFolder < ActiveRecord::Base
end end
def default_values def default_values
if Setting.plugin_redmine_dmsf['dmsf_default_notifications'] == '1' && !system if Setting.plugin_redmine_dmsf['dmsf_default_notifications'].present? && !system
self.notification = true self.notification = true
end end
end end

View File

@ -93,7 +93,7 @@
<% unless @folder && @folder.system %> <% unless @folder && @folder.system %>
<% other_formats_links do |f| %> <% other_formats_links do |f| %>
<%= f.link_to 'CSV', url: { action: :show, id: @project, folder_id: @folder, encoding: Encoding::UTF_8 } if @project %> <%= f.link_to 'CSV', url: { action: :show, id: @project, folder_id: @folder, encoding: Encoding::UTF_8 } if @project %>
<% if Setting.plugin_redmine_dmsf['dmsf_webdav'] == '1' %> <% if Setting.plugin_redmine_dmsf['dmsf_webdav'].present? %>
<span> <span>
<%= link_to 'WebDAV', webdav_url(@project, @folder) %> <%= link_to 'WebDAV', webdav_url(@project, @folder) %>
</span> </span>

View File

@ -67,7 +67,7 @@
ids: params[:ids], email_entries: true), method: :post, class: 'icon icon-email', ids: params[:ids], email_entries: true), method: :post, class: 'icon icon-email',
disabled: !email_allowed %> disabled: !email_allowed %>
</li> </li>
<% if Setting.plugin_redmine_dmsf['dmsf_webdav'] == '1' %> <% if Setting.plugin_redmine_dmsf['dmsf_webdav'].present? %>
<li> <li>
<% if dmsf_file.last_revision && dmsf_file.last_revision.protocol %> <% if dmsf_file.last_revision && dmsf_file.last_revision.protocol %>
<% url = "#{dmsf_file.last_revision.protocol}:ofe|u|#{Setting.protocol.strip}://#{Setting.host_name.strip}/dmsf/webdav/#{Addressable::URI.escape(RedmineDmsf::Webdav::ProjectResource.create_project_name(dmsf_file.project))}/" %> <% url = "#{dmsf_file.last_revision.protocol}:ofe|u|#{Setting.protocol.strip}://#{Setting.host_name.strip}/dmsf/webdav/#{Addressable::URI.escape(RedmineDmsf::Webdav::ProjectResource.create_project_name(dmsf_file.project))}/" %>

View File

@ -73,7 +73,7 @@ module RedmineDmsf
def set_default_dmsf_notification def set_default_dmsf_notification
if self.new_record? if self.new_record?
if !self.dmsf_notification && (Setting.plugin_redmine_dmsf['dmsf_default_notifications'] == '1') if !self.dmsf_notification && Setting.plugin_redmine_dmsf['dmsf_default_notifications'].present?
self.dmsf_notification = true self.dmsf_notification = true
end end
end end