-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13725 from opf/meeting-agendas-merge
Meeting agendas merge
- Loading branch information
Showing
127 changed files
with
5,702 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
#-- 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 OpTurbo | ||
module Streamable | ||
extend ActiveSupport::Concern | ||
|
||
class_methods do | ||
def wrapper_key | ||
name.underscore.gsub("/", "-").gsub("_", "-") | ||
end | ||
end | ||
|
||
included do | ||
def render_as_turbo_stream(view_context:, action: :update) | ||
case action | ||
when :update | ||
@inner_html_only = true | ||
template = render_in(view_context) | ||
when :replace | ||
template = render_in(view_context) | ||
when :remove | ||
template = nil | ||
else | ||
raise "Unsupported action #{action}" | ||
end | ||
|
||
unless @component_wrapper_used | ||
raise "You need to wrap your component in a `component_wrapper` block in order to use the turbo-stream methods" | ||
end | ||
|
||
OpTurbo::StreamWrapperComponent.new( | ||
action:, | ||
target: wrapper_key, | ||
template: | ||
).render_in(view_context) | ||
end | ||
|
||
def insert_as_turbo_stream(component:, view_context:, action: :append) | ||
template = component.render_in(view_context) | ||
|
||
unless @component_wrapper_used | ||
raise "You need to wrap your component in a `component_wrapper` block in order to use the turbo-stream methods" | ||
end | ||
|
||
OpTurbo::StreamWrapperComponent.new( | ||
action:, | ||
target: insert_target_modified? ? insert_target_modifier_id : wrapper_key, | ||
template: | ||
).render_in(view_context) | ||
end | ||
|
||
def component_wrapper(tag: "div", class: nil, data: nil, style: nil, &block) | ||
@component_wrapper_used = true | ||
if inner_html_only? | ||
capture(&block) | ||
else | ||
content_tag(tag, id: wrapper_key, class:, data:, style:, &block) | ||
end | ||
end | ||
|
||
def inner_html_only? | ||
@inner_html_only == true | ||
end | ||
|
||
def wrapper_key | ||
if wrapper_uniq_by.nil? | ||
self.class.wrapper_key | ||
else | ||
"#{self.class.wrapper_key}-#{wrapper_uniq_by}" | ||
end | ||
end | ||
|
||
def wrapper_uniq_by | ||
# optionally implemented in subclass in order to make the wrapper key unique | ||
end | ||
|
||
def insert_target_modified? | ||
# optionally overriden (returning true) in subclass in order to indicate thate the insert target | ||
# is modified and should not be the root inner html element | ||
# insert_target_container needs to be present on component's erb template then | ||
false | ||
end | ||
|
||
def insert_target_container(tag: "div", class: nil, data: nil, style: nil, &block) | ||
unless insert_target_modified? | ||
raise "`insert_target_modified?` needs to be implemented and return true if `insert_target_container` is " \ | ||
"used in this component" | ||
end | ||
|
||
content_tag(tag, id: insert_target_modifier_id, class:, data:, style:, &block) | ||
end | ||
|
||
def insert_target_modifier_id | ||
"#{wrapper_key}-insert-target-modifier" | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
app/components/op_primer/box_collection_component.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<%#-- 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. | ||
++#%> | ||
<% if boxes.any? %> | ||
<% boxes.each do |box| %> | ||
<%= box %> | ||
<% end %> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#-- 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 OpPrimer | ||
class BoxCollectionComponent < Primer::Component | ||
def initialize(**) | ||
super | ||
|
||
@system_arguments = deny_tag_argument(**) || {} | ||
end | ||
|
||
renders_many :boxes, lambda { |**system_arguments| | ||
Primer::Box.new(**system_arguments || {}) | ||
} | ||
end | ||
end |
33 changes: 33 additions & 0 deletions
33
app/components/op_primer/component_collection_component.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<%#-- 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. | ||
++#%> | ||
<% if components.any? %> | ||
<% components.each do |component| %> | ||
<%= component %> | ||
<% end %> | ||
<% end %> |
41 changes: 41 additions & 0 deletions
41
app/components/op_primer/component_collection_component.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#-- 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 OpPrimer | ||
class ComponentCollectionComponent < Primer::Component | ||
def initialize(**) | ||
super | ||
|
||
@system_arguments = deny_tag_argument(**) || {} | ||
end | ||
|
||
renders_many :components, lambda { |component_instance| | ||
component_instance | ||
} | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#-- 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 OpPrimer | ||
module ComponentHelpers | ||
def flex_layout(**, &) | ||
render(OpPrimer::FlexLayoutComponent.new(**), &) | ||
end | ||
|
||
def box_collection(**, &) | ||
render(OpPrimer::BoxCollectionComponent.new(**), &) | ||
end | ||
|
||
def component_collection(**, &) | ||
render(OpPrimer::ComponentCollectionComponent.new(**), &) | ||
end | ||
end | ||
end |
Oops, something went wrong.