mirror of
https://github.com/opf/openproject.git
synced 2026-06-14 03:30:14 +00:00
safe automatic fixes by rubocop (#8994)
This commit is contained in:
+4
-4
@@ -16,9 +16,9 @@ git.modified_files
|
||||
# Check for missing onPush
|
||||
unless lines.grep(/changeDetection:\s+ChangeDetectionStrategy.OnPush/).length > 0
|
||||
warn(
|
||||
"Please use `ChangeDetectionStrategy.OnPush` for this component",
|
||||
file: path,
|
||||
line: lines.index(component_line) || 0
|
||||
)
|
||||
"Please use `ChangeDetectionStrategy.OnPush` for this component",
|
||||
file: path,
|
||||
line: lines.index(component_line) || 0
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -41,8 +41,8 @@ gem 'rdoc', '>= 2.4.2'
|
||||
|
||||
# Maintain our own omniauth due to relative URL root issues
|
||||
# see upstream PR: https://github.com/omniauth/omniauth/pull/903
|
||||
gem 'omniauth', git: 'https://github.com/opf/omniauth', ref: 'fe862f986b2e846e291784d2caa3d90a658c67f0'
|
||||
gem 'doorkeeper', '~> 5.4.0'
|
||||
gem 'omniauth', git: 'https://github.com/opf/omniauth', ref: 'fe862f986b2e846e291784d2caa3d90a658c67f0'
|
||||
gem 'request_store', '~> 1.5.0'
|
||||
|
||||
gem 'warden', '~> 1.2'
|
||||
@@ -110,8 +110,8 @@ gem 'multi_json', '~> 1.15.0'
|
||||
gem 'oj', '~> 3.11.0'
|
||||
|
||||
gem 'daemons'
|
||||
gem 'delayed_job_active_record', '~> 4.1.5'
|
||||
gem 'delayed_cron_job', '~> 0.7.4'
|
||||
gem 'delayed_job_active_record', '~> 4.1.5'
|
||||
|
||||
gem 'rack-protection', '~> 2.1.0'
|
||||
|
||||
@@ -252,8 +252,8 @@ group :development do
|
||||
gem 'rubocop'
|
||||
|
||||
# Gems for living styleguide
|
||||
gem 'sassc-rails'
|
||||
gem 'livingstyleguide', '~> 2.1.0'
|
||||
gem 'sassc-rails'
|
||||
end
|
||||
|
||||
group :development, :test do
|
||||
@@ -307,14 +307,14 @@ platforms :mri, :mingw, :x64_mingw do
|
||||
end
|
||||
|
||||
gem 'openproject-translations',
|
||||
git: 'https://github.com/opf/openproject-translations.git',
|
||||
branch: 'dev'
|
||||
git: 'https://github.com/opf/openproject-translations.git',
|
||||
branch: 'dev'
|
||||
|
||||
gem 'newrelic_rpm', require: ENV.has_key?('NEW_RELIC_LICENSE_KEY')
|
||||
|
||||
# Load Gemfile.local, Gemfile.plugins, plugins', and custom Gemfiles
|
||||
gemfiles = Dir.glob File.expand_path('../{Gemfile.plugins,Gemfile.modules,Gemfile.local,lib/plugins/*/Gemfile}',
|
||||
__FILE__)
|
||||
gemfiles = Dir.glob File.expand_path('{Gemfile.plugins,Gemfile.modules,Gemfile.local,lib/plugins/*/Gemfile}',
|
||||
__dir__)
|
||||
gemfiles << ENV['CUSTOM_PLUGIN_GEMFILE'] unless ENV['CUSTOM_PLUGIN_GEMFILE'].nil?
|
||||
gemfiles.each do |file|
|
||||
next unless File.readable?(file)
|
||||
|
||||
@@ -34,7 +34,9 @@ guard :rspec do # , :cli => "--drb" do
|
||||
# Rails example
|
||||
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
||||
watch(%r{^app/(.*)(\.erb|\.haml)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
|
||||
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
|
||||
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) do |m|
|
||||
["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"]
|
||||
end
|
||||
watch(%r{^spec/support/(.+)\.rb$}) { 'spec' }
|
||||
watch('config/routes.rb') { 'spec/routing' }
|
||||
watch('app/controllers/application_controller.rb') { 'spec/controllers' }
|
||||
@@ -44,5 +46,5 @@ guard :rspec do # , :cli => "--drb" do
|
||||
|
||||
# Turnip features and steps
|
||||
watch(%r{^spec/acceptance/(.+)\.feature$})
|
||||
watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' }
|
||||
watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' }
|
||||
end
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
||||
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
||||
|
||||
require File.expand_path('../config/application', __FILE__)
|
||||
require File.expand_path('config/application', __dir__)
|
||||
|
||||
OpenProject::Application.load_rake_tasks
|
||||
|
||||
|
||||
@@ -27,9 +27,9 @@ module CustomActions
|
||||
|
||||
def headers
|
||||
[
|
||||
['name', caption: CustomAction.human_attribute_name(:name)],
|
||||
['description', caption: CustomAction.human_attribute_name(:description)],
|
||||
['sort', caption: I18n.t(:label_sort)]
|
||||
['name', { caption: CustomAction.human_attribute_name(:name) }],
|
||||
['description', { caption: CustomAction.human_attribute_name(:description) }],
|
||||
['sort', { caption: I18n.t(:label_sort) }]
|
||||
]
|
||||
end
|
||||
end
|
||||
|
||||
@@ -2,7 +2,6 @@ require_dependency 'enumerations/row_cell'
|
||||
|
||||
module Enumerations
|
||||
class TableCell < ::TableCell
|
||||
|
||||
def initial_sort
|
||||
%i[id asc]
|
||||
end
|
||||
@@ -42,13 +41,13 @@ module Enumerations
|
||||
|
||||
def headers
|
||||
[
|
||||
['name', caption: Enumeration.human_attribute_name(:name)],
|
||||
['is_default', caption: Enumeration.human_attribute_name(:is_default)],
|
||||
['is_default', caption: Enumeration.human_attribute_name(:active)],
|
||||
['sort', caption: I18n.t(:label_sort)]
|
||||
['name', { caption: Enumeration.human_attribute_name(:name) }],
|
||||
['is_default', { caption: Enumeration.human_attribute_name(:is_default) }],
|
||||
['is_default', { caption: Enumeration.human_attribute_name(:active) }],
|
||||
['sort', { caption: I18n.t(:label_sort) }]
|
||||
].tap do |default|
|
||||
if with_colors
|
||||
default.insert 3, ['color', caption: Enumeration.human_attribute_name(:color)]
|
||||
default.insert 3, ['color', { caption: Enumeration.human_attribute_name(:color) }]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -3,8 +3,6 @@ require_dependency 'oauth/applications/row_cell'
|
||||
module OAuth
|
||||
module Applications
|
||||
class TableCell < ::TableCell
|
||||
|
||||
|
||||
class << self
|
||||
def row_class
|
||||
::OAuth::Applications::RowCell
|
||||
@@ -38,11 +36,11 @@ module OAuth
|
||||
|
||||
def headers
|
||||
[
|
||||
['name', caption: ::Doorkeeper::Application.human_attribute_name(:name)],
|
||||
['owner', caption: ::Doorkeeper::Application.human_attribute_name(:owner)],
|
||||
['client_credentials', caption: I18n.t('oauth.client_credentials')],
|
||||
['redirect_uri', caption: ::Doorkeeper::Application.human_attribute_name(:redirect_uri)],
|
||||
['confidential', caption: ::Doorkeeper::Application.human_attribute_name(:confidential)],
|
||||
['name', { caption: ::Doorkeeper::Application.human_attribute_name(:name) }],
|
||||
['owner', { caption: ::Doorkeeper::Application.human_attribute_name(:owner) }],
|
||||
['client_credentials', { caption: I18n.t('oauth.client_credentials') }],
|
||||
['redirect_uri', { caption: ::Doorkeeper::Application.human_attribute_name(:redirect_uri) }],
|
||||
['confidential', { caption: ::Doorkeeper::Application.human_attribute_name(:confidential) }]
|
||||
]
|
||||
end
|
||||
end
|
||||
|
||||
@@ -123,7 +123,7 @@ module Projects
|
||||
def custom_field(name)
|
||||
table.project_custom_fields.fetch(name)
|
||||
end
|
||||
|
||||
|
||||
def additional_css_class(column)
|
||||
case column
|
||||
when :name
|
||||
|
||||
@@ -6,7 +6,7 @@ module Projects
|
||||
options :current_user # adds this option to those of the base class
|
||||
|
||||
def initial_sort
|
||||
[:lft, :asc]
|
||||
%i[lft asc]
|
||||
end
|
||||
|
||||
def table_id
|
||||
@@ -52,11 +52,11 @@ module Projects
|
||||
def all_columns
|
||||
@all_columns ||= begin
|
||||
[
|
||||
[:hierarchy, builtin: true],
|
||||
[:name, builtin: true, caption: Project.human_attribute_name(:name)],
|
||||
[:project_status, caption: Project.human_attribute_name(:status)],
|
||||
[:status_explanation, caption: Projects::Status.human_attribute_name(:explanation)],
|
||||
[:public, caption: Project.human_attribute_name(:public)],
|
||||
[:hierarchy, { builtin: true }],
|
||||
[:name, { builtin: true, caption: Project.human_attribute_name(:name) }],
|
||||
[:project_status, { caption: Project.human_attribute_name(:status) }],
|
||||
[:status_explanation, { caption: Projects::Status.human_attribute_name(:explanation) }],
|
||||
[:public, { caption: Project.human_attribute_name(:public) }],
|
||||
*custom_field_columns,
|
||||
*admin_columns
|
||||
]
|
||||
@@ -82,15 +82,15 @@ module Projects
|
||||
return [] unless current_user.admin?
|
||||
|
||||
[
|
||||
[:created_at, caption: Project.human_attribute_name(:created_at)],
|
||||
[:latest_activity_at, caption: Project.human_attribute_name(:latest_activity_at)],
|
||||
[:required_disk_space, caption: I18n.t(:label_required_disk_storage)]
|
||||
[:created_at, { caption: Project.human_attribute_name(:created_at) }],
|
||||
[:latest_activity_at, { caption: Project.human_attribute_name(:latest_activity_at) }],
|
||||
[:required_disk_space, { caption: I18n.t(:label_required_disk_storage) }]
|
||||
]
|
||||
end
|
||||
|
||||
def custom_field_columns
|
||||
project_custom_fields.values.map do |custom_field|
|
||||
[:"cf_#{custom_field.id}", caption: custom_field.name, custom_field: true]
|
||||
[:"cf_#{custom_field.id}", { caption: custom_field.name, custom_field: true }]
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -7,7 +7,8 @@ module Settings
|
||||
options :unit, :title
|
||||
options size: 3
|
||||
|
||||
def name # name of setting and tag
|
||||
# name of setting and tag
|
||||
def name
|
||||
model
|
||||
end
|
||||
end
|
||||
|
||||
@@ -9,7 +9,8 @@ module Settings
|
||||
options container_class: "-wide"
|
||||
options include_blank: true
|
||||
|
||||
def name # name of setting and tag
|
||||
# name of setting and tag
|
||||
def name
|
||||
model
|
||||
end
|
||||
|
||||
@@ -48,7 +49,7 @@ module Settings
|
||||
##
|
||||
# Returns time zone (label, value) tuples to be used for a select field.
|
||||
def time_zone_entries
|
||||
time_zones.map { |tz| [tz.to_s, tz.name ] }
|
||||
time_zones.map { |tz| [tz.to_s, tz.name] }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -2,7 +2,6 @@ require_dependency 'statuses/row_cell'
|
||||
|
||||
module Statuses
|
||||
class TableCell < ::TableCell
|
||||
|
||||
def initial_sort
|
||||
%i[id asc]
|
||||
end
|
||||
@@ -34,15 +33,15 @@ module Statuses
|
||||
|
||||
def headers
|
||||
[
|
||||
[:name, caption: Status.human_attribute_name(:name)],
|
||||
[:color, caption: Status.human_attribute_name(:color)],
|
||||
[:is_default, caption: Status.human_attribute_name(:is_default)],
|
||||
[:is_closed, caption: Status.human_attribute_name(:is_closed)],
|
||||
[:is_readonly, caption: Status.human_attribute_name(:is_readonly)],
|
||||
[:sort, caption: I18n.t(:label_sort)]
|
||||
[:name, { caption: Status.human_attribute_name(:name) }],
|
||||
[:color, { caption: Status.human_attribute_name(:color) }],
|
||||
[:is_default, { caption: Status.human_attribute_name(:is_default) }],
|
||||
[:is_closed, { caption: Status.human_attribute_name(:is_closed) }],
|
||||
[:is_readonly, { caption: Status.human_attribute_name(:is_readonly) }],
|
||||
[:sort, { caption: I18n.t(:label_sort) }]
|
||||
].tap do |default|
|
||||
if WorkPackage.use_status_for_done_ratio?
|
||||
default.insert 2, [:done_ratio, caption: WorkPackage.human_attribute_name(:done_ratio)]
|
||||
default.insert 2, [:done_ratio, { caption: WorkPackage.human_attribute_name(:done_ratio) }]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -4,7 +4,7 @@ module Users
|
||||
columns :login, :firstname, :lastname, :mail, :admin, :created_at, :last_login_on
|
||||
|
||||
def initial_sort
|
||||
[:id, :asc]
|
||||
%i[id asc]
|
||||
end
|
||||
|
||||
def headers
|
||||
@@ -22,7 +22,7 @@ module Users
|
||||
end
|
||||
|
||||
def desc_by_default
|
||||
[:admin, :created_at, :last_login_on]
|
||||
%i[admin created_at last_login_on]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -146,7 +146,7 @@ class BaseContract < Disposable::Twin
|
||||
writable_attributes.include?(attribute.to_s)
|
||||
end
|
||||
|
||||
def valid?(*args)
|
||||
def valid?(*_args)
|
||||
super()
|
||||
|
||||
errors.empty?
|
||||
|
||||
@@ -62,7 +62,7 @@ module Members
|
||||
|
||||
def role_grantable?(role)
|
||||
role.builtin == Role::NON_BUILTIN &&
|
||||
((model.project && role.class == Role) || (!model.project && role.class == GlobalRole))
|
||||
((model.project && role.instance_of?(Role)) || (!model.project && role.instance_of?(GlobalRole)))
|
||||
end
|
||||
|
||||
def user_allowed_to_manage?
|
||||
|
||||
@@ -34,7 +34,7 @@ require_relative './base_contract'
|
||||
# Model contract for AR records that
|
||||
# support change tracking
|
||||
class ModelContract < BaseContract
|
||||
def valid?(*args)
|
||||
def valid?(*_args)
|
||||
super()
|
||||
readonly_attributes_unchanged
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#-- encoding: UTF-8
|
||||
|
||||
#-- copyright
|
||||
# OpenProject is an open source project management software.
|
||||
# Copyright (C) 2012-2021 the OpenProject GmbH
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#-- encoding: UTF-8
|
||||
|
||||
#-- copyright
|
||||
# OpenProject is an open source project management software.
|
||||
# Copyright (C) 2012-2021 the OpenProject GmbH
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#-- encoding: UTF-8
|
||||
|
||||
#-- copyright
|
||||
# OpenProject is an open source project management software.
|
||||
# Copyright (C) 2012-2021 the OpenProject GmbH
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#-- encoding: UTF-8
|
||||
|
||||
#-- copyright
|
||||
# OpenProject is an open source project management software.
|
||||
# Copyright (C) 2012-2021 the OpenProject GmbH
|
||||
|
||||
@@ -32,7 +32,6 @@ require 'model_contract'
|
||||
|
||||
module Types
|
||||
class BaseContract < ::ModelContract
|
||||
|
||||
def self.model
|
||||
Type
|
||||
end
|
||||
@@ -97,7 +96,7 @@ module Types
|
||||
errors.add(
|
||||
:attribute_groups,
|
||||
I18n.t('activerecord.errors.models.type.attributes.attribute_groups.attribute_unknown_name',
|
||||
attribute: key)
|
||||
attribute: key)
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -199,8 +199,8 @@ module WorkPackages
|
||||
|
||||
def validate_enabled_type
|
||||
# Checks that the issue can not be added/moved to a disabled type
|
||||
if type_context_changed?
|
||||
errors.add :type_id, :inclusion unless model.project.types.include?(model.type)
|
||||
if type_context_changed? && !model.project.types.include?(model.type)
|
||||
errors.add :type_id, :inclusion
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#-- encoding: UTF-8
|
||||
|
||||
#-- copyright
|
||||
# OpenProject is an open source project management software.
|
||||
# Copyright (C) 2012-2021 the OpenProject GmbH
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#-- encoding: UTF-8
|
||||
|
||||
#-- copyright
|
||||
# OpenProject is an open source project management software.
|
||||
# Copyright (C) 2012-2021 the OpenProject GmbH
|
||||
@@ -77,6 +78,7 @@ class AccountController < ApplicationController
|
||||
if params[:token]
|
||||
@token = ::Token::Recovery.find_by_plaintext_value(params[:token])
|
||||
redirect_to(home_url) && return unless @token and !@token.expired?
|
||||
|
||||
@user = @token.user
|
||||
if request.post?
|
||||
call = ::Users::ChangePasswordService.new(current_user: @user, session: session).call(params)
|
||||
@@ -116,7 +118,7 @@ class AccountController < ApplicationController
|
||||
UserMailer.password_lost(token).deliver_later
|
||||
flash[:notice] = I18n.t(:notice_account_lost_email_sent)
|
||||
redirect_to action: 'login', back_url: home_url
|
||||
return
|
||||
nil
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -277,7 +279,7 @@ class AccountController < ApplicationController
|
||||
show_sso_error_for user
|
||||
|
||||
flash.now[:error] = I18n.t(:error_auth_source_sso_failed, value: failure[:login]) +
|
||||
": " + String(flash.now[:error])
|
||||
": " + String(flash.now[:error])
|
||||
|
||||
render action: 'login', back_url: failure[:back_url]
|
||||
end
|
||||
@@ -413,10 +415,13 @@ class AccountController < ApplicationController
|
||||
account_inactive(user, flash_now: true)
|
||||
elsif user.force_password_change
|
||||
return if redirect_if_password_change_not_allowed(user)
|
||||
|
||||
render_password_change(user, I18n.t(:notice_account_new_password_forced), show_user_name: true)
|
||||
elsif user.password_expired?
|
||||
return if redirect_if_password_change_not_allowed(user)
|
||||
render_password_change(user, I18n.t(:notice_account_password_expired, days: Setting.password_days_valid.to_i), show_user_name: true)
|
||||
|
||||
render_password_change(user, I18n.t(:notice_account_password_expired, days: Setting.password_days_valid.to_i),
|
||||
show_user_name: true)
|
||||
else
|
||||
flash_and_log_invalid_credentials
|
||||
end
|
||||
@@ -546,7 +551,7 @@ class AccountController < ApplicationController
|
||||
end
|
||||
end
|
||||
|
||||
def invited_account_not_activated(user)
|
||||
def invited_account_not_activated(_user)
|
||||
flash_error_message(log_reason: 'invited, NOT ACTIVATED', flash_now: false) do
|
||||
'account.error_inactive_activation_by_mail'
|
||||
end
|
||||
|
||||
@@ -72,7 +72,7 @@ class ActivitiesController < ApplicationController
|
||||
@days = Setting.activity_days_default.to_i
|
||||
|
||||
if params[:from]
|
||||
begin; @date_to = params[:from].to_date + 1.day; rescue; end
|
||||
begin; @date_to = params[:from].to_date + 1.day; rescue StandardError; end
|
||||
end
|
||||
|
||||
@date_to ||= User.current.today + 1.day
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#-- encoding: UTF-8
|
||||
|
||||
#-- copyright
|
||||
# OpenProject is an open source project management software.
|
||||
# Copyright (C) 2012-2021 the OpenProject GmbH
|
||||
@@ -63,7 +64,7 @@ class AdminController < ApplicationController
|
||||
begin
|
||||
@test = UserMailer.test_mail(User.current).deliver_now
|
||||
flash[:notice] = I18n.t(:notice_email_sent, value: User.current.mail)
|
||||
rescue => e
|
||||
rescue StandardError => e
|
||||
flash[:error] = I18n.t(:notice_email_error, value: Redmine::CodesetUtil.replace_invalid_utf8(e.message.dup))
|
||||
end
|
||||
ActionMailer::Base.raise_delivery_errors = raise_delivery_errors
|
||||
@@ -131,7 +132,7 @@ class AdminController < ApplicationController
|
||||
|
||||
def image_conversion_libs_available?
|
||||
Open3.capture2e('convert', '-version').first.include?('ImageMagick')
|
||||
rescue
|
||||
rescue StandardError
|
||||
false
|
||||
end
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#-- encoding: UTF-8
|
||||
|
||||
#-- copyright
|
||||
# OpenProject is an open source project management software.
|
||||
# Copyright (C) 2012-2021 the OpenProject GmbH
|
||||
@@ -120,7 +121,7 @@ class ApplicationController < ActionController::Base
|
||||
end
|
||||
|
||||
rescue_from ActionController::ParameterMissing do |exception|
|
||||
render body: "Required parameter missing: #{exception.param}",
|
||||
render body: "Required parameter missing: #{exception.param}",
|
||||
status: :bad_request
|
||||
end
|
||||
|
||||
@@ -188,8 +189,11 @@ class ApplicationController < ActionController::Base
|
||||
|
||||
def log_requesting_user
|
||||
return unless Setting.log_requesting_user?
|
||||
login_and_mail = " (#{escape_for_logging(User.current.login)} ID: #{User.current.id} " \
|
||||
"<#{escape_for_logging(User.current.mail)}>)" unless User.current.anonymous?
|
||||
|
||||
unless User.current.anonymous?
|
||||
login_and_mail = " (#{escape_for_logging(User.current.login)} ID: #{User.current.id} " \
|
||||
"<#{escape_for_logging(User.current.mail)}>)"
|
||||
end
|
||||
logger.info "OpenProject User: #{escape_for_logging(User.current.name)}#{login_and_mail}"
|
||||
end
|
||||
|
||||
@@ -198,7 +202,7 @@ class ApplicationController < ActionController::Base
|
||||
# replaces all invalid characters with #
|
||||
def escape_for_logging(string)
|
||||
# only allow numbers, ASCII letters, space and the following characters: @.-"'!?=/
|
||||
string.gsub(/[^0-9a-zA-Z@._\-"\'!\?=\/ ]{1}/, '#')
|
||||
string.gsub(/[^0-9a-zA-Z@._\-"'!?=\/ ]{1}/, '#')
|
||||
end
|
||||
|
||||
def reset_i18n_fallbacks
|
||||
@@ -314,7 +318,6 @@ class ApplicationController < ActionController::Base
|
||||
associated.each do |a|
|
||||
instance_variable_set('@' + a.class.to_s.downcase, a)
|
||||
end
|
||||
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render_404
|
||||
end
|
||||
@@ -326,14 +329,18 @@ class ApplicationController < ActionController::Base
|
||||
# then message.forum and board.project
|
||||
def find_belongs_to_chained_objects(associations, start_object = nil)
|
||||
associations.inject([start_object].compact) do |instances, association|
|
||||
scope_name, scope_association = association.is_a?(Hash) ?
|
||||
[association.keys.first.to_s.downcase, association.values.first] :
|
||||
scope_name, scope_association = if association.is_a?(Hash)
|
||||
[association.keys.first.to_s.downcase, association.values.first]
|
||||
else
|
||||
[association.to_s.downcase, association.to_s.downcase]
|
||||
end
|
||||
|
||||
# TODO: Remove this hidden dependency on params
|
||||
instances << (instances.last.nil? ?
|
||||
scope_name.camelize.constantize.find(params[:"#{scope_name}_id"]) :
|
||||
instances.last.send(scope_association.to_sym))
|
||||
instances << (if instances.last.nil?
|
||||
scope_name.camelize.constantize.find(params[:"#{scope_name}_id"])
|
||||
else
|
||||
instances.last.send(scope_association.to_sym)
|
||||
end)
|
||||
instances
|
||||
end
|
||||
end
|
||||
@@ -349,6 +356,7 @@ class ApplicationController < ActionController::Base
|
||||
.where(id: params[:work_package_id] || params[:ids])
|
||||
.order('id ASC')
|
||||
fail ActiveRecord::RecordNotFound if @work_packages.empty?
|
||||
|
||||
@projects = @work_packages.map(&:project).compact.uniq
|
||||
@project = @projects.first if @projects.size == 1
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#-- encoding: UTF-8
|
||||
|
||||
#-- copyright
|
||||
# OpenProject is an open source project management software.
|
||||
# Copyright (C) 2012-2021 the OpenProject GmbH
|
||||
@@ -79,8 +80,8 @@ class AuthSourcesController < ApplicationController
|
||||
begin
|
||||
@auth_method.test_connection
|
||||
flash[:notice] = I18n.t(:notice_successful_connection)
|
||||
rescue => text
|
||||
flash[:error] = I18n.t(:error_unable_to_connect, value: text.message)
|
||||
rescue StandardError => e
|
||||
flash[:error] = I18n.t(:error_unable_to_connect, value: e.message)
|
||||
end
|
||||
redirect_to action: 'index'
|
||||
end
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#-- encoding: UTF-8
|
||||
|
||||
#-- copyright
|
||||
# OpenProject is an open source project management software.
|
||||
# Copyright (C) 2012-2021 the OpenProject GmbH
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#-- encoding: UTF-8
|
||||
|
||||
#-- copyright
|
||||
# OpenProject is an open source project management software.
|
||||
# Copyright (C) 2012-2021 the OpenProject GmbH
|
||||
@@ -30,9 +31,9 @@
|
||||
class CategoriesController < ApplicationController
|
||||
menu_item :settings_categories
|
||||
model_object Category
|
||||
before_action :find_model_object, except: [:new, :create]
|
||||
before_action :find_project_from_association, except: [:new, :create]
|
||||
before_action :find_project, only: [:new, :create]
|
||||
before_action :find_model_object, except: %i[new create]
|
||||
before_action :find_project_from_association, except: %i[new create]
|
||||
before_action :find_project, only: %i[new create]
|
||||
before_action :authorize
|
||||
|
||||
def new
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#-- encoding: UTF-8
|
||||
|
||||
#-- copyright
|
||||
# OpenProject is an open source project management software.
|
||||
# Copyright (C) 2012-2021 the OpenProject GmbH
|
||||
|
||||
@@ -14,10 +14,10 @@ module Accounts::AuthenticationStages
|
||||
end
|
||||
else
|
||||
flash[:error] = I18n.t(
|
||||
:notice_auth_stage_wrong_stage,
|
||||
expected: stage || '(none)',
|
||||
actual: params[:stage]
|
||||
)
|
||||
:notice_auth_stage_wrong_stage,
|
||||
expected: stage || '(none)',
|
||||
actual: params[:stage]
|
||||
)
|
||||
|
||||
redirect_to signin_path
|
||||
end
|
||||
@@ -33,7 +33,7 @@ module Accounts::AuthenticationStages
|
||||
|
||||
def authentication_stages(after_activation: false, reset: true)
|
||||
if OpenProject::Authentication::Stage.stages.select(&:active?).any?
|
||||
session.delete [:authentication_stages, :stage_secrets, :back_url] if reset
|
||||
session.delete %i[authentication_stages stage_secrets back_url] if reset
|
||||
|
||||
if session.include?(:authentication_stages)
|
||||
lookup_authentication_stages
|
||||
@@ -82,7 +82,7 @@ module Accounts::AuthenticationStages
|
||||
.to_h
|
||||
end
|
||||
|
||||
def stage_secret(ident)
|
||||
def stage_secret(_ident)
|
||||
SecureRandom.hex(16)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -91,7 +91,7 @@ module Accounts::UserPasswordChange
|
||||
def redirect_if_password_change_not_allowed(user)
|
||||
if user and not user.change_password_allowed?
|
||||
logger.warn "Password change for user '#{user}' forced, but user is not allowed " +
|
||||
'to change password'
|
||||
'to change password'
|
||||
flash[:error] = I18n.t(:notice_can_t_change_password)
|
||||
redirect_to action: 'login'
|
||||
return true
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#-- encoding: UTF-8
|
||||
|
||||
#-- copyright
|
||||
# OpenProject is an open source project management software.
|
||||
# Copyright (C) 2012-2021 the OpenProject GmbH
|
||||
|
||||
@@ -92,9 +92,9 @@ class CustomActionsController < ApplicationController
|
||||
if request.get?
|
||||
render template: 'common/upsale',
|
||||
locals: {
|
||||
feature_title: I18n.t('custom_actions.upsale.title'),
|
||||
feature_description: I18n.t('custom_actions.upsale.description'),
|
||||
feature_reference: 'custom_actions_admin'
|
||||
feature_title: I18n.t('custom_actions.upsale.title'),
|
||||
feature_description: I18n.t('custom_actions.upsale.description'),
|
||||
feature_reference: 'custom_actions_admin'
|
||||
}
|
||||
else
|
||||
render_403
|
||||
|
||||
@@ -89,7 +89,7 @@ class CustomFieldsController < ApplicationController
|
||||
def destroy
|
||||
begin
|
||||
@custom_field.destroy
|
||||
rescue
|
||||
rescue StandardError
|
||||
flash[:error] = I18n.t(:error_can_not_delete_custom_field)
|
||||
end
|
||||
redirect_to custom_fields_path(tab: @custom_field.class.name)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#-- encoding: UTF-8
|
||||
|
||||
#-- copyright
|
||||
# OpenProject is an open source project management software.
|
||||
# Copyright (C) 2012-2021 the OpenProject GmbH
|
||||
@@ -31,9 +32,9 @@ class CustomStylesController < ApplicationController
|
||||
layout 'admin'
|
||||
menu_item :custom_style
|
||||
|
||||
before_action :require_admin, except: [:logo_download, :favicon_download, :touch_icon_download]
|
||||
before_action :require_ee_token, except: [:upsale, :logo_download, :favicon_download, :touch_icon_download]
|
||||
skip_before_action :check_if_login_required, only: [:logo_download, :favicon_download, :touch_icon_download]
|
||||
before_action :require_admin, except: %i[logo_download favicon_download touch_icon_download]
|
||||
before_action :require_ee_token, except: %i[upsale logo_download favicon_download touch_icon_download]
|
||||
skip_before_action :check_if_login_required, only: %i[logo_download favicon_download touch_icon_download]
|
||||
|
||||
def show
|
||||
@custom_style = CustomStyle.current || CustomStyle.new
|
||||
@@ -123,7 +124,10 @@ class CustomStylesController < ApplicationController
|
||||
|
||||
def options_for_theme_select
|
||||
options = OpenProject::CustomStyles::ColorThemes.themes.map { |val| val[:theme] }
|
||||
options << [t('admin.custom_styles.color_theme_custom'), '', selected: true, disabled: true] unless @current_theme.present?
|
||||
unless @current_theme.present?
|
||||
options << [t('admin.custom_styles.color_theme_custom'), '',
|
||||
{ selected: true, disabled: true }]
|
||||
end
|
||||
|
||||
options
|
||||
end
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#-- encoding: UTF-8
|
||||
|
||||
#-- copyright
|
||||
# OpenProject is an open source project management software.
|
||||
# Copyright (C) 2012-2021 the OpenProject GmbH
|
||||
@@ -31,7 +32,7 @@ class EnumerationsController < ApplicationController
|
||||
layout 'admin'
|
||||
|
||||
before_action :require_admin
|
||||
before_action :find_enumeration, only: [:edit, :update, :destroy]
|
||||
before_action :find_enumeration, only: %i[edit update destroy]
|
||||
|
||||
include CustomFieldsHelper
|
||||
|
||||
@@ -117,6 +118,7 @@ class EnumerationsController < ApplicationController
|
||||
def enumeration_class(type)
|
||||
klass = type.to_s.constantize
|
||||
raise NameError unless klass.ancestors.include? Enumeration
|
||||
|
||||
klass
|
||||
rescue NameError
|
||||
nil
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#-- encoding: UTF-8
|
||||
|
||||
#-- copyright
|
||||
# OpenProject is an open source project management software.
|
||||
# Copyright (C) 2012-2021 the OpenProject GmbH
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#-- encoding: UTF-8
|
||||
|
||||
#-- copyright
|
||||
# OpenProject is an open source project management software.
|
||||
# Copyright (C) 2012-2021 the OpenProject GmbH
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#-- encoding: UTF-8
|
||||
|
||||
#-- copyright
|
||||
# OpenProject is an open source project management software.
|
||||
# Copyright (C) 2012-2021 the OpenProject GmbH
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#-- encoding: UTF-8
|
||||
|
||||
#-- copyright
|
||||
# OpenProject is an open source project management software.
|
||||
# Copyright (C) 2012-2021 the OpenProject GmbH
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#-- encoding: UTF-8
|
||||
|
||||
#-- copyright
|
||||
# OpenProject is an open source project management software.
|
||||
# Copyright (C) 2012-2021 the OpenProject GmbH
|
||||
|
||||
@@ -101,7 +101,7 @@ class JournalsController < ApplicationController
|
||||
|
||||
def valid_diff?
|
||||
valid_field?(params[:field]) &&
|
||||
@journal.journable.class == WorkPackage
|
||||
@journal.journable.instance_of?(WorkPackage)
|
||||
end
|
||||
|
||||
def journals_index_title
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#-- encoding: UTF-8
|
||||
|
||||
#-- copyright
|
||||
# OpenProject is an open source project management software.
|
||||
# Copyright (C) 2012-2021 the OpenProject GmbH
|
||||
|
||||
@@ -228,7 +228,7 @@ class MembersController < ApplicationController
|
||||
# The invitation can pretty much only fail due to the user already
|
||||
# having been invited. So look them up if it does.
|
||||
user = UserInvitation.invite_new_user(email: id) ||
|
||||
User.find_by_mail(id)
|
||||
User.find_by_mail(id)
|
||||
|
||||
user.id if user
|
||||
end
|
||||
@@ -243,17 +243,18 @@ class MembersController < ApplicationController
|
||||
end
|
||||
|
||||
def each_comma_seperated(array, &block)
|
||||
array.map { |e|
|
||||
array.map do |e|
|
||||
if e.to_s.match /\d(,\d)*/
|
||||
block.call(e)
|
||||
else
|
||||
e
|
||||
end
|
||||
}.flatten
|
||||
end.flatten
|
||||
end
|
||||
|
||||
def transform_array_of_comma_seperated_ids(array)
|
||||
return array unless array.present?
|
||||
|
||||
each_comma_seperated(array) do |elem|
|
||||
elem.to_s.split(',')
|
||||
end
|
||||
|
||||
@@ -33,7 +33,7 @@ class MessagesController < ApplicationController
|
||||
default_search_scope :messages
|
||||
model_object Message, scope: Forum
|
||||
before_action :find_object_and_scope
|
||||
before_action :authorize, except: [:edit, :update, :destroy]
|
||||
before_action :authorize, except: %i[edit update destroy]
|
||||
|
||||
include AttachmentsHelper
|
||||
include PaginationHelper
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#-- encoding: UTF-8
|
||||
|
||||
#-- copyright
|
||||
# OpenProject is an open source project management software.
|
||||
# Copyright (C) 2012-2021 the OpenProject GmbH
|
||||
|
||||
@@ -117,6 +117,7 @@ class NewsController < ApplicationController
|
||||
|
||||
def find_optional_project
|
||||
return true unless params[:project_id]
|
||||
|
||||
@project = Project.find(params[:project_id])
|
||||
authorize
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#-- encoding: UTF-8
|
||||
|
||||
#-- copyright
|
||||
# OpenProject is an open source project management software.
|
||||
# Copyright (C) 2012-2021 the OpenProject GmbH
|
||||
@@ -27,7 +28,6 @@
|
||||
# See docs/COPYRIGHT.rdoc for more details.
|
||||
#++
|
||||
|
||||
|
||||
module OAuth
|
||||
class ApplicationsController < ::ApplicationController
|
||||
before_action :require_admin
|
||||
@@ -42,6 +42,7 @@ module OAuth
|
||||
end
|
||||
|
||||
def new; end
|
||||
|
||||
def edit; end
|
||||
|
||||
def show
|
||||
@@ -88,7 +89,6 @@ module OAuth
|
||||
redirect_to action: :index
|
||||
end
|
||||
|
||||
|
||||
protected
|
||||
|
||||
def default_breadcrumb
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#-- encoding: UTF-8
|
||||
|
||||
#-- copyright
|
||||
# OpenProject is an open source project management software.
|
||||
# Copyright (C) 2012-2021 the OpenProject GmbH
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#-- encoding: UTF-8
|
||||
|
||||
#-- copyright
|
||||
# OpenProject is an open source project management software.
|
||||
# Copyright (C) 2012-2021 the OpenProject GmbH
|
||||
@@ -27,7 +28,6 @@
|
||||
# See docs/COPYRIGHT.rdoc for more details.
|
||||
#++
|
||||
|
||||
|
||||
module OAuth
|
||||
class GrantsController < ::ApplicationController
|
||||
before_action :require_login
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#-- encoding: UTF-8
|
||||
|
||||
#-- copyright
|
||||
# OpenProject is an open source project management software.
|
||||
# Copyright (C) 2012-2021 the OpenProject GmbH
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#-- encoding: UTF-8
|
||||
|
||||
#-- copyright
|
||||
# OpenProject is an open source project management software.
|
||||
# Copyright (C) 2012-2021 the OpenProject GmbH
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#-- encoding: UTF-8
|
||||
|
||||
#-- copyright
|
||||
# OpenProject is an open source project management software.
|
||||
# Copyright (C) 2012-2021 the OpenProject GmbH
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#-- encoding: UTF-8
|
||||
|
||||
#-- copyright
|
||||
# OpenProject is an open source project management software.
|
||||
# Copyright (C) 2012-2021 the OpenProject GmbH
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#-- encoding: UTF-8
|
||||
|
||||
#-- copyright
|
||||
# OpenProject is an open source project management software.
|
||||
# Copyright (C) 2012-2021 the OpenProject GmbH
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#-- encoding: UTF-8
|
||||
|
||||
#-- copyright
|
||||
# OpenProject is an open source project management software.
|
||||
# Copyright (C) 2012-2021 the OpenProject GmbH
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#-- encoding: UTF-8
|
||||
|
||||
#-- copyright
|
||||
# OpenProject is an open source project management software.
|
||||
# Copyright (C) 2012-2021 the OpenProject GmbH
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#-- encoding: UTF-8
|
||||
|
||||
#-- copyright
|
||||
# OpenProject is an open source project management software.
|
||||
# Copyright (C) 2012-2021 the OpenProject GmbH
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#-- encoding: UTF-8
|
||||
|
||||
#-- copyright
|
||||
# OpenProject is an open source project management software.
|
||||
# Copyright (C) 2012-2021 the OpenProject GmbH
|
||||
|
||||
@@ -103,7 +103,6 @@ class ProjectsController < ApplicationController
|
||||
model: @altered_project)
|
||||
.call(permitted_params.project)
|
||||
|
||||
|
||||
if service_call.success?
|
||||
flash[:notice] = t(:notice_successful_update)
|
||||
redirect_to settings_generic_project_path(@altered_project)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#-- encoding: UTF-8
|
||||
|
||||
#-- copyright
|
||||
# OpenProject is an open source project management software.
|
||||
# Copyright (C) 2012-2021 the OpenProject GmbH
|
||||
@@ -34,6 +35,7 @@ require_dependency 'open_project/scm/adapters'
|
||||
|
||||
class ChangesetNotFound < StandardError
|
||||
end
|
||||
|
||||
class InvalidRevisionParam < StandardError
|
||||
end
|
||||
|
||||
@@ -42,12 +44,12 @@ class RepositoriesController < ApplicationController
|
||||
include RepositoriesHelper
|
||||
|
||||
menu_item :repository
|
||||
menu_item :settings, only: [:edit, :destroy_info]
|
||||
menu_item :settings, only: %i[edit destroy_info]
|
||||
default_search_scope :changesets
|
||||
|
||||
before_action :find_project_by_project_id
|
||||
before_action :authorize
|
||||
before_action :find_repository, except: [:edit, :update, :create, :destroy, :destroy_info]
|
||||
before_action :find_repository, except: %i[edit update create destroy destroy_info]
|
||||
accept_key_auth :revisions
|
||||
|
||||
rescue_from OpenProject::SCM::Exceptions::SCMError, with: :show_error_command_failed
|
||||
@@ -82,10 +84,10 @@ class RepositoriesController < ApplicationController
|
||||
if request.post? && params.key?(:committers)
|
||||
# Build a hash with repository usernames as keys and corresponding user ids as values
|
||||
@repository.committer_ids = params[:committers].values
|
||||
.inject({}) { |h, c|
|
||||
.inject({}) do |h, c|
|
||||
h[c.first] = c.last
|
||||
h
|
||||
}
|
||||
end
|
||||
flash[:notice] = I18n.t(:notice_successful_update)
|
||||
redirect_to action: 'committers', project_id: @project
|
||||
end
|
||||
@@ -207,6 +209,7 @@ class RepositoriesController < ApplicationController
|
||||
# TODO: need to handle edge cases of non-binary content that isn't UTF-8
|
||||
return false
|
||||
end
|
||||
|
||||
true
|
||||
end
|
||||
|
||||
@@ -228,12 +231,13 @@ class RepositoriesController < ApplicationController
|
||||
|
||||
def revision
|
||||
raise ChangesetNotFound if @rev.blank?
|
||||
|
||||
@changeset = @repository.find_changeset_by_name(@rev)
|
||||
raise ChangesetNotFound unless @changeset
|
||||
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.js do render layout: false end
|
||||
format.js { render layout: false }
|
||||
end
|
||||
rescue ChangesetNotFound
|
||||
show_error_not_found
|
||||
@@ -297,6 +301,7 @@ class RepositoriesController < ApplicationController
|
||||
unless current_user.allowed_to_in_project?(:view_commit_author_statistics, @project)
|
||||
return deny_access
|
||||
end
|
||||
|
||||
data = graph_commits_per_author(@repository)
|
||||
end
|
||||
|
||||
@@ -341,10 +346,8 @@ class RepositoriesController < ApplicationController
|
||||
@rev = params[:rev].blank? ? @repository.default_branch : params[:rev].to_s.strip
|
||||
@rev_to = params[:rev_to]
|
||||
|
||||
unless @rev.to_s.match(REV_PARAM_RE) && @rev_to.to_s.match(REV_PARAM_RE)
|
||||
if @repository.branches.blank?
|
||||
raise InvalidRevisionParam
|
||||
end
|
||||
if !@rev.to_s.match(REV_PARAM_RE) && @rev_to.to_s.match(REV_PARAM_RE) && @repository.branches.blank?
|
||||
raise InvalidRevisionParam
|
||||
end
|
||||
rescue OpenProject::SCM::Exceptions::SCMEmpty
|
||||
render 'empty'
|
||||
@@ -427,10 +430,10 @@ class RepositoriesController < ApplicationController
|
||||
.references(:changesets)
|
||||
.group(:committer)
|
||||
.size
|
||||
h = changes_by_author.inject({}) { |o, i|
|
||||
h = changes_by_author.inject({}) do |o, i|
|
||||
o[i.first] = i.last
|
||||
o
|
||||
}
|
||||
end
|
||||
|
||||
fields = commits_by_author.map(&:first)
|
||||
commits_data = commits_by_author.map(&:last)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#-- encoding: UTF-8
|
||||
|
||||
#-- copyright
|
||||
# OpenProject is an open source project management software.
|
||||
# Copyright (C) 2012-2021 the OpenProject GmbH
|
||||
@@ -86,7 +87,7 @@ class RolesController < ApplicationController
|
||||
flash[:notice] = I18n.t(:notice_successful_delete)
|
||||
redirect_to action: 'index'
|
||||
notify_changed_roles(:removed, @role)
|
||||
rescue
|
||||
rescue StandardError
|
||||
flash[:error] = I18n.t(:error_can_not_remove_role)
|
||||
redirect_to action: 'index'
|
||||
end
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#-- encoding: UTF-8
|
||||
|
||||
#-- copyright
|
||||
# OpenProject is an open source project management software.
|
||||
# Copyright (C) 2012-2021 the OpenProject GmbH
|
||||
@@ -85,8 +86,8 @@ class SearchController < ApplicationController
|
||||
@pagination_next_date = @results[-1].event_datetime if offset && @results[-1]
|
||||
|
||||
if @results.size > LIMIT
|
||||
@pagination_previous_date = @results[-(LIMIT)].event_datetime
|
||||
@results = @results[-(LIMIT), LIMIT]
|
||||
@pagination_previous_date = @results[-LIMIT].event_datetime
|
||||
@results = @results[-LIMIT, LIMIT]
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#-- encoding: UTF-8
|
||||
|
||||
#-- copyright
|
||||
# OpenProject is an open source project management software.
|
||||
# Copyright (C) 2012-2021 the OpenProject GmbH
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#-- encoding: UTF-8
|
||||
|
||||
#-- copyright
|
||||
# OpenProject is an open source project management software.
|
||||
# Copyright (C) 2012-2021 the OpenProject GmbH
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#-- encoding: UTF-8
|
||||
|
||||
#-- copyright
|
||||
# OpenProject is an open source project management software.
|
||||
# Copyright (C) 2012-2021 the OpenProject GmbH
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#-- encoding: UTF-8
|
||||
|
||||
#-- copyright
|
||||
# OpenProject is an open source project management software.
|
||||
# Copyright (C) 2012-2021 the OpenProject GmbH
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#-- encoding: UTF-8
|
||||
|
||||
#-- copyright
|
||||
# OpenProject is an open source project management software.
|
||||
# Copyright (C) 2012-2021 the OpenProject GmbH
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#-- encoding: UTF-8
|
||||
|
||||
#-- copyright
|
||||
# OpenProject is an open source project management software.
|
||||
# Copyright (C) 2012-2021 the OpenProject GmbH
|
||||
@@ -78,7 +79,7 @@ class StatusesController < ApplicationController
|
||||
flash[:notice] = I18n.t(:notice_successful_delete)
|
||||
end
|
||||
redirect_to action: 'index'
|
||||
rescue
|
||||
rescue StandardError
|
||||
flash[:error] = I18n.t(:error_unable_delete_status)
|
||||
redirect_to action: 'index'
|
||||
end
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#-- encoding: UTF-8
|
||||
|
||||
#-- copyright
|
||||
# OpenProject is an open source project management software.
|
||||
# Copyright (C) 2012-2021 the OpenProject GmbH
|
||||
@@ -99,7 +100,7 @@ class SysController < ActionController::Base
|
||||
unless Setting.sys_api_enabled? && params[:key].to_s == Setting.sys_api_key
|
||||
render plain: 'Access denied. Repository management WS is disabled or key is invalid.',
|
||||
status: 403
|
||||
return false
|
||||
false
|
||||
end
|
||||
end
|
||||
|
||||
@@ -125,6 +126,7 @@ class SysController < ActionController::Base
|
||||
render plain: "Project ##{@project.id} does not have a repository.", status: 404
|
||||
else
|
||||
return true if @repository.scm.storage_available?
|
||||
|
||||
render plain: 'repositories.storage.not_available', status: 400
|
||||
end
|
||||
|
||||
@@ -150,12 +152,13 @@ class SysController < ActionController::Base
|
||||
unless Setting.repository_authentication_caching_enabled?
|
||||
return user_login(username, password)
|
||||
end
|
||||
|
||||
user = nil
|
||||
user_id = Rails.cache.fetch(OpenProject::RepositoryAuthentication::CACHE_PREFIX + Digest::SHA1.hexdigest("#{username}#{password}"),
|
||||
expires_in: OpenProject::RepositoryAuthentication::CACHE_EXPIRES_AFTER) {
|
||||
expires_in: OpenProject::RepositoryAuthentication::CACHE_EXPIRES_AFTER) do
|
||||
user = user_login(username, password)
|
||||
user ? user.id.to_s : '-1'
|
||||
}
|
||||
end
|
||||
|
||||
return nil if user_id.blank? or user_id == '-1'
|
||||
|
||||
|
||||
@@ -53,7 +53,6 @@ class TypesController < ApplicationController
|
||||
CreateTypeService
|
||||
.new(current_user)
|
||||
.call(permitted_type_params, copy_workflow_from: params[:copy_workflow_from]) do |call|
|
||||
|
||||
@type = call.result
|
||||
|
||||
call.on_success do
|
||||
@@ -87,7 +86,6 @@ class TypesController < ApplicationController
|
||||
UpdateTypeService
|
||||
.new(@type, current_user)
|
||||
.call(permitted_type_params) do |call|
|
||||
|
||||
call.on_success do
|
||||
redirect_to_type_tab_path(@type, t(:notice_successful_update))
|
||||
end
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#-- encoding: UTF-8
|
||||
|
||||
#-- copyright
|
||||
# OpenProject is an open source project management software.
|
||||
# Copyright (C) 2012-2021 the OpenProject GmbH
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#-- encoding: UTF-8
|
||||
|
||||
#-- copyright
|
||||
# OpenProject is an open source project management software.
|
||||
# Copyright (C) 2012-2021 the OpenProject GmbH
|
||||
@@ -35,18 +36,18 @@ class UsersController < ApplicationController
|
||||
before_action :authorize_global, except: %i[show deletion_info destroy]
|
||||
|
||||
before_action :find_user, only: %i[show
|
||||
edit
|
||||
update
|
||||
change_status_info
|
||||
change_status
|
||||
destroy
|
||||
deletion_info
|
||||
resend_invitation]
|
||||
edit
|
||||
update
|
||||
change_status_info
|
||||
change_status
|
||||
destroy
|
||||
deletion_info
|
||||
resend_invitation]
|
||||
# should also contain destroy but post data can not be redirected
|
||||
before_action :require_login, only: [:deletion_info]
|
||||
before_action :authorize_for_user, only: [:destroy]
|
||||
before_action :check_if_deletion_allowed, only: %i[deletion_info
|
||||
destroy]
|
||||
destroy]
|
||||
|
||||
# Password confirmation helpers and actions
|
||||
include PasswordConfirmation
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#-- encoding: UTF-8
|
||||
|
||||
#-- copyright
|
||||
# OpenProject is an open source project management software.
|
||||
# Copyright (C) 2012-2021 the OpenProject GmbH
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#-- encoding: UTF-8
|
||||
|
||||
#-- copyright
|
||||
# OpenProject is an open source project management software.
|
||||
# Copyright (C) 2012-2021 the OpenProject GmbH
|
||||
|
||||
@@ -192,6 +192,7 @@ class WikiController < ApplicationController
|
||||
# rename a page
|
||||
def rename
|
||||
return render_403 unless editable?
|
||||
|
||||
@page.redirect_existing_links = true
|
||||
# used to display the *original* title if some AR validation errors occur
|
||||
@original_title = @page.title
|
||||
@@ -205,7 +206,8 @@ class WikiController < ApplicationController
|
||||
old_name: @page.title,
|
||||
new_name: attributes["title"],
|
||||
existing_caption: item.caption,
|
||||
existing_identifier: item.name)
|
||||
existing_identifier: item.name
|
||||
)
|
||||
|
||||
redirect_to_show
|
||||
elsif @page.update(attributes)
|
||||
@@ -305,6 +307,7 @@ class WikiController < ApplicationController
|
||||
# Reassign children to another parent page
|
||||
reassign_to = @wiki.pages.find_by(id: params[:reassign_to_id].presence)
|
||||
return unless reassign_to
|
||||
|
||||
@page.children.each do |child|
|
||||
child.update_attribute(:parent, reassign_to)
|
||||
end
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#-- encoding: UTF-8
|
||||
|
||||
#-- copyright
|
||||
# OpenProject is an open source project management software.
|
||||
# Copyright (C) 2012-2021 the OpenProject GmbH
|
||||
@@ -137,7 +138,8 @@ class WikiMenuItemsController < ApplicationController
|
||||
private
|
||||
|
||||
def wiki_menu_item_params
|
||||
@wiki_menu_item_params ||= params.require(:menu_items_wiki_menu_item).permit(:name, :title, :navigatable_id, :parent_id, :setting, :new_wiki_page, :index_page)
|
||||
@wiki_menu_item_params ||= params.require(:menu_items_wiki_menu_item).permit(:name, :title, :navigatable_id, :parent_id,
|
||||
:setting, :new_wiki_page, :index_page)
|
||||
end
|
||||
|
||||
def get_data_from_params(params)
|
||||
@@ -157,7 +159,7 @@ class WikiMenuItemsController < ApplicationController
|
||||
@wiki_menu_item.parent.id
|
||||
else
|
||||
@page.nearest_main_item.try :id
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def assign_wiki_menu_item_params(menu_item)
|
||||
@@ -181,7 +183,7 @@ class WikiMenuItemsController < ApplicationController
|
||||
item.tap { |item| item.parent_id = nil }
|
||||
else
|
||||
wiki.wiki_menu_items.build(name: page.slug, title: page.title)
|
||||
end
|
||||
end
|
||||
|
||||
menu_item.options = options
|
||||
menu_item.save
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#-- encoding: UTF-8
|
||||
|
||||
#-- copyright
|
||||
# OpenProject is an open source project management software.
|
||||
# Copyright (C) 2012-2021 the OpenProject GmbH
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#-- encoding: UTF-8
|
||||
|
||||
#-- copyright
|
||||
# OpenProject is an open source project management software.
|
||||
# Copyright (C) 2012-2021 the OpenProject GmbH
|
||||
|
||||
@@ -104,7 +104,7 @@ class WorkPackages::MovesController < ApplicationController
|
||||
.compact
|
||||
|
||||
if ids.present?
|
||||
joined = ids.map {|id| "##{id}" }.join(" ")
|
||||
joined = ids.map { |id| "##{id}" }.join(" ")
|
||||
["#{parent_id} (+ children errors: #{joined})"]
|
||||
else
|
||||
[parent_id]
|
||||
@@ -122,7 +122,7 @@ class WorkPackages::MovesController < ApplicationController
|
||||
unless @project
|
||||
# TODO: let users bulk move/copy work packages from different projects
|
||||
render_error message: :'work_packages.move.unsupported_for_multiple_projects', status: 400
|
||||
return false
|
||||
false
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#-- encoding: UTF-8
|
||||
|
||||
#-- copyright
|
||||
# OpenProject is an open source project management software.
|
||||
# Copyright (C) 2012-2021 the OpenProject GmbH
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#-- encoding: UTF-8
|
||||
|
||||
#-- copyright
|
||||
# OpenProject is an open source project management software.
|
||||
# Copyright (C) 2012-2021 the OpenProject GmbH
|
||||
@@ -67,16 +68,16 @@ class WorkflowsController < ApplicationController
|
||||
end
|
||||
|
||||
def copy
|
||||
if params[:source_type_id].blank? || params[:source_type_id] == 'any'
|
||||
@source_type = nil
|
||||
else
|
||||
@source_type = ::Type.find_by(id: params[:source_type_id].to_i)
|
||||
end
|
||||
if params[:source_role_id].blank? || params[:source_role_id] == 'any'
|
||||
@source_role = nil
|
||||
else
|
||||
@source_role = Role.find_by(id: params[:source_role_id].to_i)
|
||||
end
|
||||
@source_type = if params[:source_type_id].blank? || params[:source_type_id] == 'any'
|
||||
nil
|
||||
else
|
||||
::Type.find_by(id: params[:source_type_id].to_i)
|
||||
end
|
||||
@source_role = if params[:source_role_id].blank? || params[:source_role_id] == 'any'
|
||||
nil
|
||||
else
|
||||
Role.find_by(id: params[:source_role_id].to_i)
|
||||
end
|
||||
|
||||
@target_types = params[:target_type_ids].blank? ? nil : ::Type.where(id: params[:target_type_ids])
|
||||
@target_roles = params[:target_role_ids].blank? ? nil : Role.where(id: params[:target_role_ids])
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#-- encoding: UTF-8
|
||||
|
||||
#-- copyright
|
||||
# OpenProject is an open source project management software.
|
||||
# Copyright (C) 2012-2021 the OpenProject GmbH
|
||||
@@ -52,15 +53,17 @@ module AccessibilityHelper
|
||||
return nil if english_locale_set?
|
||||
|
||||
caption_content = menu_item.instance_variable_get(:@caption)
|
||||
locale_label = caption_content.is_a?(Symbol) ? caption_content : :"label_#{menu_item.name.to_s}"
|
||||
locale_label = caption_content.is_a?(Symbol) ? caption_content : :"label_#{menu_item.name}"
|
||||
|
||||
(!locale_exists?(locale_label) || equals_english_locale(locale_label)) ? :en : nil
|
||||
!locale_exists?(locale_label) || equals_english_locale(locale_label) ? :en : nil
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def locale_exists?(key, locale = I18n.locale)
|
||||
I18n.t(key, locale: locale, raise: true) rescue false
|
||||
I18n.t(key, locale: locale, raise: true)
|
||||
rescue StandardError
|
||||
false
|
||||
end
|
||||
|
||||
def english_locale_set?
|
||||
|
||||
@@ -8,7 +8,7 @@ module AdditionalUrlHelpers
|
||||
end
|
||||
|
||||
def add_params_to_uri(uri, args = {})
|
||||
uri = URI.parse uri
|
||||
uri = URI.parse uri
|
||||
query = URI.decode_www_form String(uri.query)
|
||||
|
||||
args.each do |k, v|
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#-- encoding: UTF-8
|
||||
|
||||
#-- copyright
|
||||
# OpenProject is an open source project management software.
|
||||
# Copyright (C) 2012-2021 the OpenProject GmbH
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#-- encoding: UTF-8
|
||||
|
||||
#-- copyright
|
||||
# OpenProject is an open source project management software.
|
||||
# Copyright (C) 2012-2021 the OpenProject GmbH
|
||||
|
||||
@@ -127,7 +127,7 @@ module ApplicationHelper
|
||||
# Renders flash messages
|
||||
def render_flash_messages
|
||||
messages = flash
|
||||
.reject { |k,_| k.start_with? '_' }
|
||||
.reject { |k, _| k.start_with? '_' }
|
||||
.map { |k, v| render_flash_message(k, v) }
|
||||
|
||||
safe_join messages, "\n"
|
||||
@@ -166,7 +166,7 @@ module ApplicationHelper
|
||||
identifier = element[:project].id
|
||||
tag_options = {
|
||||
value: h(identifier),
|
||||
title: h(element[:project].name),
|
||||
title: h(element[:project].name)
|
||||
}
|
||||
|
||||
if !selected.nil? && selected.id == identifier
|
||||
@@ -223,13 +223,13 @@ module ApplicationHelper
|
||||
end
|
||||
|
||||
def labeled_check_box_tags(name, collection, options = {})
|
||||
collection.sort.map { |object|
|
||||
collection.sort.map do |object|
|
||||
id = name.gsub(/[\[\]]+/, '_') + object.id.to_s
|
||||
|
||||
object_options = options.inject({}) { |h, (k, v)|
|
||||
object_options = options.inject({}) do |h, (k, v)|
|
||||
h[k] = v.is_a?(Symbol) ? send(v, object) : v
|
||||
h
|
||||
}
|
||||
end
|
||||
|
||||
object_options[:class] = Array(object_options[:class]) + %w(form--label-with-check-box)
|
||||
|
||||
@@ -238,7 +238,7 @@ module ApplicationHelper
|
||||
styled_check_box_tag(name, object.id, false, id: id) + object
|
||||
end
|
||||
end
|
||||
}.join.html_safe
|
||||
end.join.html_safe
|
||||
end
|
||||
|
||||
def html_hours(text)
|
||||
@@ -323,7 +323,7 @@ module ApplicationHelper
|
||||
text.to_s
|
||||
.gsub(/\r\n?/, "\n") # \r\n and \r -> \n
|
||||
.gsub(/\n\n+/, '<br /><br />') # 2+ newline -> 2 br
|
||||
.gsub(/([^\n]\n)(?=[^\n])/, '\1<br />') # 1 newline -> br
|
||||
.gsub(/([^\n]\n)(?=[^\n])/, '\1<br />') # 1 newline -> br
|
||||
.html_safe
|
||||
end
|
||||
|
||||
@@ -415,7 +415,7 @@ module ApplicationHelper
|
||||
end
|
||||
end
|
||||
|
||||
def calendar_for(*args)
|
||||
def calendar_for(*_args)
|
||||
ActiveSupport::Deprecation.warn "calendar_for has been removed. Please add the class '-augmented-datepicker' instead.", caller
|
||||
end
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#-- encoding: UTF-8
|
||||
|
||||
#-- copyright
|
||||
# OpenProject is an open source project management software.
|
||||
# Copyright (C) 2012-2021 the OpenProject GmbH
|
||||
|
||||
@@ -36,6 +36,6 @@ module AttributeHelpTextsHelper
|
||||
available
|
||||
.reject { |key,| used.include? key }
|
||||
.map { |key, label| [label, key] }
|
||||
.sort_by { |label, key| label.downcase }
|
||||
.sort_by { |label, _key| label.downcase }
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#-- encoding: UTF-8
|
||||
|
||||
#-- copyright
|
||||
# OpenProject is an open source project management software.
|
||||
# Copyright (C) 2012-2021 the OpenProject GmbH
|
||||
@@ -28,7 +29,6 @@
|
||||
#++
|
||||
|
||||
module AugmentingHelper
|
||||
|
||||
##
|
||||
# Create a collapsible section and yield to render the block
|
||||
#
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#-- encoding: UTF-8
|
||||
|
||||
#-- copyright
|
||||
# OpenProject is an open source project management software.
|
||||
# Copyright (C) 2012-2021 the OpenProject GmbH
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#-- encoding: UTF-8
|
||||
|
||||
#-- copyright
|
||||
# OpenProject is an open source project management software.
|
||||
# Copyright (C) 2012-2021 the OpenProject GmbH
|
||||
|
||||
@@ -94,7 +94,7 @@ module ColorsHelper
|
||||
|
||||
styles = color.color_styles
|
||||
|
||||
background_style = styles.map { |k,v| "#{k}:#{v} !important"}.join(';')
|
||||
background_style = styles.map { |k, v| "#{k}:#{v} !important" }.join(';')
|
||||
border_color = color.bright? ? '#555555' : color.hexcode
|
||||
|
||||
if name === 'type'
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#-- encoding: UTF-8
|
||||
|
||||
#-- copyright
|
||||
# OpenProject is an open source project management software.
|
||||
# Copyright (C) 2012-2021 the OpenProject GmbH
|
||||
|
||||
@@ -79,7 +79,7 @@ module CustomFieldsHelper
|
||||
path: custom_fields_path(tab: :IssuePriorityCustomField),
|
||||
label: IssuePriority::OptionName
|
||||
}
|
||||
]
|
||||
]
|
||||
end
|
||||
|
||||
# Return custom field html tag corresponding to its format
|
||||
@@ -92,12 +92,15 @@ module CustomFieldsHelper
|
||||
|
||||
tag = case field_format.try(:edit_as)
|
||||
when 'date'
|
||||
styled_text_field_tag(field_name, custom_value.value, id: field_id, class: '-augmented-datepicker', size: 10, container_class: '-slim', required: custom_field.is_required)
|
||||
styled_text_field_tag(field_name, custom_value.value, id: field_id, class: '-augmented-datepicker', size: 10,
|
||||
container_class: '-slim', required: custom_field.is_required)
|
||||
when 'text'
|
||||
styled_text_area_tag(field_name, custom_value.value, id: field_id, rows: 3, container_class: '-middle', required: custom_field.is_required)
|
||||
styled_text_area_tag(field_name, custom_value.value, id: field_id, rows: 3, container_class: '-middle',
|
||||
required: custom_field.is_required)
|
||||
when 'bool'
|
||||
hidden_tag = hidden_field_tag(field_name, '0')
|
||||
checkbox_tag = styled_check_box_tag(field_name, '1', custom_value.typed_value, id: field_id, required: custom_field.is_required)
|
||||
checkbox_tag = styled_check_box_tag(field_name, '1', custom_value.typed_value, id: field_id,
|
||||
required: custom_field.is_required)
|
||||
hidden_tag + checkbox_tag
|
||||
when 'list'
|
||||
blank_option = if custom_field.is_required? && custom_field.default_value.blank?
|
||||
@@ -108,32 +111,36 @@ module CustomFieldsHelper
|
||||
'<option></option>'
|
||||
end
|
||||
|
||||
options = blank_option.html_safe + options_for_select(custom_field.possible_values_options(custom_value.customized), custom_value.value)
|
||||
options = blank_option.html_safe + options_for_select(custom_field.possible_values_options(custom_value.customized),
|
||||
custom_value.value)
|
||||
|
||||
styled_select_tag(field_name, options, id: field_id, container_class: '-middle', required: custom_field.is_required)
|
||||
else
|
||||
styled_text_field_tag(field_name, custom_value.value, id: field_id, container_class: '-middle', required: custom_field.is_required)
|
||||
end
|
||||
styled_text_field_tag(field_name, custom_value.value, id: field_id, container_class: '-middle',
|
||||
required: custom_field.is_required)
|
||||
end
|
||||
|
||||
tag = content_tag :span, tag, lang: custom_field.name_locale, class: 'form--field-container'
|
||||
|
||||
custom_value.errors.empty? ?
|
||||
tag :
|
||||
if custom_value.errors.empty?
|
||||
tag
|
||||
else
|
||||
ActionView::Base.wrap_with_error_span(tag, custom_value, 'value')
|
||||
end
|
||||
end
|
||||
|
||||
# Return custom field label tag
|
||||
def custom_field_label_tag(name, custom_value)
|
||||
content_tag 'label', h(custom_value.custom_field.name) +
|
||||
(custom_value.custom_field.is_required? ? content_tag('span', ' *', class: 'required') : ''),
|
||||
(custom_value.custom_field.is_required? ? content_tag('span', ' *', class: 'required') : ''),
|
||||
for: "#{name}_custom_field_values_#{custom_value.custom_field.id}",
|
||||
class: "form--label #{(custom_value.errors.empty? ? nil : 'error')}",
|
||||
class: "form--label #{custom_value.errors.empty? ? nil : 'error'}",
|
||||
lang: custom_value.custom_field.name_locale
|
||||
end
|
||||
|
||||
def hidden_custom_field_label_tag(name, custom_value)
|
||||
content_tag 'label', h(custom_value.custom_field.name) +
|
||||
(custom_value.custom_field.is_required? ? content_tag('span', ' *', class: 'required') : ''),
|
||||
(custom_value.custom_field.is_required? ? content_tag('span', ' *', class: 'required') : ''),
|
||||
for: "#{name}_custom_field_values_#{custom_value.custom_field.id}",
|
||||
class: "hidden-for-sighted",
|
||||
lang: custom_value.custom_field.name_locale
|
||||
@@ -141,7 +148,7 @@ module CustomFieldsHelper
|
||||
|
||||
def blank_custom_field_label_tag(name, custom_field)
|
||||
content_tag 'label', h(custom_field.name) +
|
||||
(custom_field.is_required? ? content_tag('span', ' *', class: 'required') : ''),
|
||||
(custom_field.is_required? ? content_tag('span', ' *', class: 'required') : ''),
|
||||
for: "#{name}_custom_field_values_#{custom_field.id}",
|
||||
class: 'form--label'
|
||||
end
|
||||
@@ -151,7 +158,7 @@ module CustomFieldsHelper
|
||||
custom_field_label_tag(name, custom_value) + custom_field_tag(name, custom_value)
|
||||
end
|
||||
|
||||
def custom_field_tag_for_bulk_edit(name, custom_field, project=nil)
|
||||
def custom_field_tag_for_bulk_edit(name, custom_field, project = nil)
|
||||
field_name = "#{name}[custom_field_values][#{custom_field.id}]"
|
||||
field_id = "#{name}_custom_field_values_#{custom_field.id}"
|
||||
field_format = OpenProject::CustomFieldFormat.find_by_name(custom_field.field_format)
|
||||
@@ -165,7 +172,8 @@ module CustomFieldsHelper
|
||||
[I18n.t(:general_text_yes), '1'],
|
||||
[I18n.t(:general_text_no), '0']]), id: field_id)
|
||||
when 'list'
|
||||
styled_select_tag(field_name, options_for_select([[I18n.t(:label_no_change_option), '']] + custom_field.possible_values_options(project)), id: field_id)
|
||||
styled_select_tag(field_name,
|
||||
options_for_select([[I18n.t(:label_no_change_option), '']] + custom_field.possible_values_options(project)), id: field_id)
|
||||
else
|
||||
styled_text_field_tag(field_name, '', id: field_id)
|
||||
end
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#-- encoding: UTF-8
|
||||
|
||||
#-- copyright
|
||||
# OpenProject is an open source project management software.
|
||||
# Copyright (C) 2012-2021 the OpenProject GmbH
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#-- encoding: UTF-8
|
||||
|
||||
#-- copyright
|
||||
# OpenProject is an open source project management software.
|
||||
# Copyright (C) 2012-2021 the OpenProject GmbH
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#-- encoding: UTF-8
|
||||
|
||||
#-- copyright
|
||||
# OpenProject is an open source project management software.
|
||||
# Copyright (C) 2012-2021 the OpenProject GmbH
|
||||
@@ -61,6 +62,6 @@ module HomescreenHelper
|
||||
##
|
||||
# Determine whether we should render the onboarding modal
|
||||
def show_onboarding_modal?
|
||||
return OpenProject::Configuration.onboarding_enabled? && params[:first_time_user]
|
||||
OpenProject::Configuration.onboarding_enabled? && params[:first_time_user]
|
||||
end
|
||||
end
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user