-
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Show Entries that match a Keyword or it's Aliases
- Loading branch information
Showing
6 changed files
with
50 additions
and
18 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,25 @@ | ||
# frozen_string_literal: true | ||
|
||
class Journal | ||
class KeywordPolicy < ApplicationPolicy | ||
alias_method :keyword, :object | ||
|
||
def create? | ||
person&.operator? || person&.member_of?(entry.space) | ||
end | ||
|
||
def show? | ||
true | ||
end | ||
|
||
def update? | ||
create? | ||
end | ||
|
||
class Scope < ApplicationScope | ||
def resolve | ||
scope | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,12 @@ | ||
<%= keyword.canonical_keyword %> | ||
<%= keyword.aliases %> | ||
<h1><%= keyword.canonical_keyword %></h1> | ||
<ul> | ||
<%= keyword&.aliases&.each do |aliass| %> | ||
<li><%= aliass %></li> | ||
<% end %> | ||
</ul> | ||
|
||
<ul> | ||
<%- policy_scope(keyword.entries).each do |entry|%> | ||
<li><%= link_to(entry.headline, entry.location) %></li> | ||
<%- end %> | ||
</ul> |
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
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