-
-
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.
- https://github.com/zinc-collective/convene/issues/1713 - https://github.com/zinc-collective/convene/issues/1566 I thought I would tilt at this while I waited for the build to go out; since I noticed I go from an `Entry` to a `Keyword` when trying to decide what to fill in next when world building. It also auto-fills the new `Entry` body with the `Keywords` canonical version and it's aliases! Which... I need to make a UI for soonish.
- Loading branch information
Showing
5 changed files
with
39 additions
and
11 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
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,5 @@ | ||
en: | ||
journal: | ||
entries: | ||
new: | ||
link_to: "New Journal Entry" |
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 @@ | ||
<div class="text-center p-2"> | ||
<%= link_to t("journal.entries.new.link_to"), location %> | ||
</div> |
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,27 @@ | ||
class Journal | ||
class NewEntryButtonComponent < ApplicationComponent | ||
attr_accessor :keyword, :journal | ||
def initialize(keyword: nil, journal: keyword&.journal) | ||
self.keyword = keyword | ||
self.journal = journal | ||
end | ||
|
||
def render? | ||
policy(new_entry).new? | ||
end | ||
|
||
def location | ||
journal.location(:new, child: :entry, query_params: location_query_params) | ||
end | ||
|
||
private def location_query_params | ||
return nil if keyword.blank? | ||
|
||
{entry: {body: "##{keyword.canonical_with_aliases.join(" #")}"}} | ||
end | ||
|
||
private def new_entry | ||
@new_entry ||= journal.entries.new | ||
end | ||
end | ||
end |