-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EPIC: tag
items
to categorise and organize
#245
Comments
Thanks @iteles for these acceptance criteria.
I think it shouldn't be too complicated to trim the spaces on tags. Another question, do we want tags to be case insensitive? Might be good to avoid creating duplicated tags. |
@SimonLab All good questions! On case sensitivity - definitely case-insensitive for now. I wouldn't worry about the plurals yet because we will very closely get to an auto-complete solution to this where a person will type in a couple of letters and get the various suggestions given to them (which should deal with the plurals). |
@iteles are you working on creating the UI for this story or am I'? |
The UX of this is pretty important. This is a mini-project in itself that is worth brainstorming several UIs for to ensure that we have an API that can cater to all UI/UXs. |
tag
items
to group and organize
Next: Sketch the most basic UI for adding
|
I'm trying Excalidraw to quickly create UI of the mvp: Excalidraw live session: https://excalidraw.com/#room=c7eca65eedec24628894,rm8LQPspjQO5OKF2gaxgsQ It's really quick to create something simple, it doesn't have a lot of Figma features (simulate user actions) but I think it's enough and easier/quicker to use for what we want to represent. I'll update the UI to represent the requirements define in #245 (comment) My first idea based on the requirements above is to have a simple text input to add tags to a new item. We can then click on the list of tags of an item to edit them, the same way we edit the item itself. The UI is simple but it would allow us to have the first version of this feature deploy rapidly and to iterate on it. @nelsonic do you want to change this first UI version or should I try to implement it? Also should we moved this issue to https://github.com/dwyl/mvp/issues? On the backend we can have a |
@SimonLab this proposed UI/UX is definitely the simplest for adding/removing I've tidied the Acceptance Criteria in the OP. 👍 |
Creating defmodule App.Tag do
use Ecto.Schema
import Ecto.Changeset
alias App.{Item, ItemTag}
schema "tags" do
field :text, :string
many_to_many(:items, Item, join_through: ItemTag)
timestamps()
end
@doc false
def changeset(tag, attrs) do
tag
|> cast(attrs, [:text])
|> validate_required([:text])
end
end The defmodule App.ItemTag do
use Ecto.Schema
alias App.{Item, Tag}
schema "items_tags" do
belongs_to(:item, Item)
belongs_to(:tag, Tag)
timestamps()
end
end Now that we have our schemas defined, we need to make sure our changesets handle the unique constraint on the tag name and on the item - tag. see |
@SimonLab not so sure about the Basically, when someone is adding
|
My initial implementation was to make tags global to the all application, however I can easily change it to make tags unique to a user. For the first version I'm not using an autocomplete feature or dictionary to keep things simple, but we can add this later one if required |
@SimonLab yeah having |
It basically means that in |
I've done more reading/testing with tags and items associations yesterday and I'm updating the documentation I'll continue adding the doc and describe any blockers I encounter in this issue |
Thanks @SimonLab makes sense. 👌🏻 |
@SimonLab sounds good. thanks for the update. 👌 |
I'm currently updating the following function to get the tags linked to the item: def items_with_timers(person_id \\ 0) do
sql = """
SELECT i.id, i.text, i.status, i.person_id, t.start, t.stop, t.id as timer_id FROM items i
FULL JOIN timers as t ON t.item_id = i.id
WHERE i.person_id = $1 AND i.status IS NOT NULL
ORDER BY timer_id ASC;
"""
Ecto.Adapters.SQL.query!(Repo, sql, [person_id])
|> map_columns_to_values()
|> accumulate_item_timers()
end I'm thinking of adding another |
@SimonLab yeah, for now adding a |
I've updated the sql query to returns the list of tags for the items: def items_with_timers(person_id \\ 0) do
sql = """
SELECT i.id, i.text, i.status, i.person_id, t.start, t.stop, t.id as timer_id, tags.text as tag_text, tags.id as tag_id FROM items i
FULL JOIN timers as t ON t.item_id = i.id
FULL JOIN items_tags as it ON it.item_id = i.id
FULL JOIN tags ON it.tag_id = tags.id
WHERE i.person_id = $1 AND i.status IS NOT NULL
ORDER BY timer_id ASC;
"""
Ecto.Adapters.SQL.query!(Repo, sql, [person_id])
|> map_columns_to_values()
|> accumulate_item_timers()
end However I had to change the So I want first to understand fully the timer logic so I don't break anything in the code: |
Displaying the tag names under each items: The filter are clickable and filter the list of items matching the tag name
This requires a bit more work on the UI/front end side. I think the tag system will be updated soon (see #287 ) and I don't wont to add to much more code to this PR. I'd like also to focus on updating the templates by using Phoenix components. |
@SimonLab thanks for the great PR. 👌 |
@iteles this is ready for testing on: https://mvp.fly.dev/ 🙏 |
tag
items
to group and organizetag
items
to categorise and organize
As a person who believes that structure is key to organisation and trust in an app
I'd like to be able to tag my inputs with tags I make up myself
So that I can later have a better understanding of what is required from that capture at a glance and filter by the topics I am most interested in.
Tagging and projects are some of the features that I expect to most evolve as part of the app's user experience as they are the most critical but here is a starting point.
To be clear, I don't think that this will be useable as-is, but will certainly be a place to evolve from. We will have a much better UX for this within the next sprint but this is the starting point.
Acceptance Criteria
item
in my list ofcapturesitems
,I see a text field where I can input tags
tag
is checked against the saved tags (case-insensitive) and:tag
already exists, save thecapturesitem
against that tagtag
does not exist, create a newtag
and save thecapturesitem
to ittags
are saved, take human back to the list ofcapturesitems
tags
should be displayed under theitem.text
tag
should be a clickablehyperlink
tag
(hyperlink
) should filter theitems
in the currentlist
to just those with thattag
.The text was updated successfully, but these errors were encountered: