-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d88d2ed
commit 18c1f1a
Showing
2 changed files
with
29 additions
and
0 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
app/components/shares/project_queries/project_access_warning_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,3 @@ | ||
<%- if query_is_public? || query_is_shared? %> | ||
<%= container.with_row(mt: 3) { render(Primer::Alpha::Banner.new(icon: :info)) { I18n.t('sharing.project_queries.access_warning') } }%> | ||
<%- end %> |
26 changes: 26 additions & 0 deletions
26
app/components/shares/project_queries/project_access_warning_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,26 @@ | ||
module Shares | ||
module ProjectQueries | ||
class ProjectAccessWarningComponent < ViewComponent::Base # rubocop:disable OpenProject/AddPreviewForViewComponent | ||
include OpPrimer::ComponentHelpers | ||
|
||
def initialize(strategy:, modal_body_container:) | ||
super | ||
|
||
@strategy = strategy | ||
@container = modal_body_container | ||
end | ||
|
||
private | ||
|
||
attr_reader :strategy, :container | ||
|
||
def query_is_public? | ||
@strategy.entity.public? | ||
end | ||
|
||
def query_is_shared? | ||
@strategy.entity.members.any? | ||
end | ||
end | ||
end | ||
end |