Skip to content

Commit

Permalink
Merge branch 'dev' into feature/40749-consistent-calculation-of-perce…
Browse files Browse the repository at this point in the history
…nt-complete
  • Loading branch information
cbliard authored Mar 25, 2024
2 parents 5abd3ab + 6f0575f commit 6b7255a
Show file tree
Hide file tree
Showing 397 changed files with 13,942 additions and 2,744 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/crowdin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ jobs:
env:
OPENPROJECT_CROWDIN_PROJECT: ${{ secrets.OPENPROJECT_CROWDINV2_PROJECT }}
OPENPROJECT_CROWDIN_API_KEY: ${{ secrets.OPENPROJECT_CROWDINV2_API_KEY }}
- name: "Fix root key in Portuguese crowdin translation files"
run: |
script/i18n/fix_crowdin_pt_language_root_key
- name: "Commit translations"
run: |
git config user.name "OpenProject Actions CI"
Expand Down
56 changes: 48 additions & 8 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,41 @@ env:
REGISTRY_IMAGE: openproject/community

jobs:
extract_version:
runs-on: ubuntu-latest
steps:
- name: Extract version
id: extract_version
run: |
if [[ ${{ github.event_name }} == 'push' ]]; then
TAG_REF=${GITHUB_REF#refs/tags/}
CHECKOUT_REF=$GITHUB_REF
elif [[ ${{ github.event_name }} == 'schedule' ]]; then
TAG_REF=dev
CHECKOUT_REF=refs/heads/dev
elif [[ ${{ github.event_name }} == 'workflow_dispatch' ]]; then
TAG_REF=${{ inputs.tag }}
CHECKOUT_REF=${{ inputs.tag }}
else
echo "Unsupported event"
exit 1
fi
if [ -z "$TAG_REF" ] || [ -z "$CHECKOUT_REF" ]; then
echo "No TAG_REF or CHECKOUT_REF set. Aborting"
exit 1
fi
VERSION=${TAG_REF#v}
echo "Version: $VERSION"
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "checkout_ref=$CHECKOUT_REF" >> "$GITHUB_OUTPUT"
outputs:
version: ${{ steps.extract_version.outputs.version }}
checkout_ref: ${{ steps.extract_version.outputs.checkout_ref }}
build:
needs:
- extract_version
if: github.repository == 'opf/openproject'
runs-on: runs-on,runner=8cpu-linux,family=m7i+m7a,run-id=${{ github.run_id }}
strategy:
Expand Down Expand Up @@ -61,7 +95,7 @@ jobs:
echo "No TAG_REF or CHECKOUT_REF set. Aborting"
exit 1
fi
VERSION=${TAG_REF#v}
echo "Version: $VERSION"
echo "::set-output name=version::$VERSION"
Expand All @@ -87,8 +121,13 @@ jobs:
id: meta
uses: docker/metadata-action@v4
with:
context: git
labels: |
io.artifacthub.package.readme-url=https://www.openproject.org/docs/installation-and-operations/installation/docker/
org.opencontainers.image.documentation=https://www.openproject.org/docs/
org.opencontainers.image.vendor=OpenProject GmbH
tags: |
type=semver,pattern={{version}},value=${{ steps.extract_version.outputs.version }}
type=semver,pattern={{version}},value=${{ needs.extract_version.outputs.version }}
images: |
${{ env.REGISTRY_IMAGE }}
- name: Build image
Expand Down Expand Up @@ -150,6 +189,7 @@ jobs:
matrix:
target: [slim, all-in-one]
needs:
- extract_version
- build
steps:
- name: Download digests
Expand All @@ -171,16 +211,16 @@ jobs:
with:
images: ${{ env.REGISTRY_IMAGE }}
labels: |
io.artifacthub.package.readme-url="https://www.openproject.org/docs/installation-and-operations/installation/docker/"
org.opencontainers.image.documentation="https://www.openproject.org/docs/"
org.opencontainers.image.vendor="OpenProject GmbH"
io.artifacthub.package.readme-url=https://www.openproject.org/docs/installation-and-operations/installation/docker/
org.opencontainers.image.documentation=https://www.openproject.org/docs/
org.opencontainers.image.vendor=OpenProject GmbH
flavor: |
latest=false
suffix=${{ steps.set_suffix.outputs.suffix }}
tags: |
type=semver,pattern={{version}},value=${{ steps.extract_version.outputs.version }}
type=semver,pattern={{major}}.{{minor}},value=${{ steps.extract_version.outputs.version }}
type=semver,pattern={{major}},value=${{ steps.extract_version.outputs.version }}
type=semver,pattern={{version}},value=${{ needs.extract_version.outputs.version }}
type=semver,pattern={{major}}.{{minor}},value=${{ needs.extract_version.outputs.version }}
type=semver,pattern={{major}},value=${{ needs.extract_version.outputs.version }}
type=raw,value=dev,priority=200,enable={{is_default_branch}}
- name: Login to Docker Hub
uses: docker/login-action@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pullpreview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
with:
admins: crohr,HDinger,machisuji,oliverguenther,ulferts,wielinde,cbliard
compose_files: docker-compose.pullpreview.yml
instance_type: large
instance_type: xlarge
ports: 80,443,8080
default_port: 443
ttl: 10d
Expand Down
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,7 @@ GEM
openssl-signature_algorithm (1.3.0)
openssl (> 2.0)
os (1.1.4)
ox (2.14.17)
ox (2.14.18)
paper_trail (15.1.0)
activerecord (>= 6.1)
request_store (~> 1.4)
Expand Down Expand Up @@ -993,7 +993,7 @@ GEM
rubocop-performance (1.20.2)
rubocop (>= 1.48.1, < 2.0)
rubocop-ast (>= 1.30.0, < 2.0)
rubocop-rails (2.24.0)
rubocop-rails (2.24.1)
activesupport (>= 4.2.0)
rack (>= 1.1)
rubocop (>= 1.33.0, < 2.0)
Expand Down
1 change: 1 addition & 0 deletions app/components/_index.sass
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
@import "work_packages/share/invite_user_form_component"
@import "open_project/common/attribute_component"
@import "filters_component"
@import "projects/settings/project_custom_field_sections/index_component"
10 changes: 5 additions & 5 deletions app/components/open_project/common/attribute_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#
# See COPYRIGHT and LICENSE files for more details.
#++
require 'nokogiri'
require "nokogiri"

module OpenProject
module Common
Expand All @@ -34,7 +34,7 @@ class AttributeComponent < Primer::Component
:name,
:description

PARAGRAPH_CSS_CLASS = 'op-uc-p'.freeze
PARAGRAPH_CSS_CLASS = "op-uc-p".freeze

def initialize(id, name, description, **args)
super
Expand Down Expand Up @@ -73,7 +73,7 @@ def first_paragraph
.inner_html
.html_safe # rubocop:disable Rails/OutputSafety
else
''
""
end
end

Expand All @@ -83,12 +83,12 @@ def text_ast

def body_children
text_ast
.xpath('html/body')
.xpath("html/body")
.children
end

def multi_type?
first_paragraph.include?('figure') || first_paragraph.include?('macro')
first_paragraph.include?("figure") || first_paragraph.include?("macro")
end
end
end
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<%=
component_wrapper do
flex_layout(align_items: :center, justify_content: :space_between, classes: 'op-project-custom-field', data: {
qa_selector: "project-custom-field-#{@project_custom_field.id}"
}) do |custom_field_container|
custom_field_container.with_column(flex_layout: true) do |title_container|
title_container.with_column(pt: 1, mr: 2) do
render(Primer::Beta::Text.new) do
@project_custom_field.name
end
end
title_container.with_column(pt: 1, mr: 2, data: { qa_selector: "custom-field-type" } ) do
render(Primer::Beta::Text.new(font_size: :small, color: :subtle)) do
@project_custom_field.field_format.capitalize
end
end
if @project_custom_field.required?
title_container.with_column(pt: 1) do
render(Primer::Beta::Label.new(scheme: :attention, size: :medium)) do
t("label_required")
end
end
end
end
# py: 1 quick fix: prevents the row from bouncing as the toggle switch currently changes height while toggling
custom_field_container.with_column(py: 1, mr: 2) do
# buggy currently:
# small variant + status_label_position: :start leads to a small bounce while toggling
# behavior can be seen on primer's viewbook as well -> https://view-components-storybook.eastus.cloudapp.azure.com/view-components/lookbook/inspect/primer/alpha/toggle_switch/small
# quick fix: don't display loading indicator which is causing the bounce
render(Primer::Alpha::ToggleSwitch.new(
src: toggle_project_settings_project_custom_fields_path(
project_custom_field_project_mapping: {
project_id: @project.id,
custom_field_id: @project_custom_field.id
}
),
csrf_token: form_authenticity_token,
data: { 'turbo-method': :put, 'turbo-stream': true,
qa_selector: "toggle-project-custom-field-mapping-#{@project_custom_field.id}" },
checked: active_in_project?,
enabled: !@project_custom_field.required?, # required fields cannot be disabled
size: :small,
status_label_position: :start,
classes: "op-primer-adjustments__toggle-switch--hidden-loading-indicator",
))
end
end
end
%>
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2023 the OpenProject GmbH
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
#
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
# Copyright (C) 2006-2013 Jean-Philippe Lang
# Copyright (C) 2010-2013 the ChiliProject Team
#
# 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.
#
# See COPYRIGHT and LICENSE files for more details.
#++

module Projects
module Settings
module ProjectCustomFieldSections
class CustomFieldRowComponent < ApplicationComponent
include ApplicationHelper
include OpPrimer::ComponentHelpers
include OpTurbo::Streamable

def initialize(project:, project_custom_field:)
super

@project = project
@project_custom_field = project_custom_field
@project_custom_field_project_mappings = project.project_custom_field_project_mappings
end

private

def wrapper_uniq_by
@project_custom_field.id
end

def active_in_project?
@project_custom_field_project_mappings.any? do |mapping|
mapping.custom_field_id == @project_custom_field.id
end
end
end
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<%=
component_wrapper(data: wrapper_data_attributes) do
flex_layout do |flex|
flex.with_row(mt: 3) do
render(Primer::Alpha::TextField.new(
name: "project-custom-fields-mapping-filter",
label: t('projects.settings.project_custom_fields.filter.label'),
visually_hide_label: true,
placeholder: t('projects.settings.project_custom_fields.filter.label'),
leading_visual: {
icon: :search,
size: :small
},
show_clear_button: true,
clear_button_id: "project-custom-fields-mapping-filter-clear-button",
data: {
action: "input->projects--settings--project-custom-fields-mapping-filter#filterLists",
"projects--settings--project-custom-fields-mapping-filter-target": "filter"
}
))
end

@project_custom_field_sections.each do |project_custom_field_section|
flex.with_row do
render(Projects::Settings::ProjectCustomFieldSections::ShowComponent.new(
project: @project,
project_custom_field_section:
))
end
end
end
end
%>
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2023 the OpenProject GmbH
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
#
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
# Copyright (C) 2006-2013 Jean-Philippe Lang
# Copyright (C) 2010-2013 the ChiliProject Team
#
# 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.
#
# See COPYRIGHT and LICENSE files for more details.
#++

module Projects
module Settings
module ProjectCustomFieldSections
class IndexComponent < ApplicationComponent
include ApplicationHelper
include OpPrimer::ComponentHelpers
include OpTurbo::Streamable

def initialize(project:, project_custom_field_sections:)
super

@project = project
@project_custom_field_sections = project_custom_field_sections
end

private

def wrapper_data_attributes
{
controller: 'projects--settings--project-custom-fields-mapping-filter',
'application-target': 'dynamic'
}
end
end
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.Box
.hidden-by-filter
display: none
Loading

0 comments on commit 6b7255a

Please sign in to comment.