-
Notifications
You must be signed in to change notification settings - Fork 1
Homepage card cleanup: density, grouped My Plans, content preview (COPLAN-22) #117
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
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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,18 @@ | ||
| module CoPlan | ||
| module PlansHelper | ||
| include MarkdownHelper | ||
|
|
||
| # Short preview of the plan's content for cards on the index page. | ||
| # Once an AI summary column lands (COPLAN-24), the card view prefers | ||
| # `plan.summary` and falls back to this helper. | ||
| def plan_content_preview(plan, limit: 200) | ||
| content = plan.current_content | ||
| return nil if content.blank? | ||
|
|
||
| plain = markdown_to_plain_text(content) | ||
| return nil if plain.blank? | ||
|
|
||
| truncate(plain, length: limit, omission: "…", separator: " ") | ||
| end | ||
| end | ||
| end |
This file contains hidden or 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 hidden or 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 hidden or 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,41 +1,53 @@ | ||
| <div class="page-header"> | ||
| <h1>Plans</h1> | ||
| </div> | ||
| <div class="plans-toolbar"> | ||
| <div class="plans-toolbar__row"> | ||
| <%= link_to "Mine", plans_path(params.permit(:status, :plan_type, :tag)), | ||
| class: "status-filter #{'status-filter--active' if @scope == 'mine'}" %> | ||
| <%= link_to "All", plans_path(params.permit(:status, :plan_type, :tag).merge(scope: "all")), | ||
| class: "status-filter #{'status-filter--active' if @scope == 'all'}" %> | ||
| <span class="plans-toolbar__divider" aria-hidden="true"></span> | ||
| <%= link_to "Any status", plans_path(params.permit(:scope, :plan_type, :tag)), | ||
| class: "status-filter #{'status-filter--active' if params[:status].blank?}" %> | ||
| <% CoPlan::Plan::STATUSES.each do |status| %> | ||
| <%= link_to status.titleize, plans_path(params.permit(:scope, :plan_type, :tag).merge(status: status)), | ||
| class: "status-filter status-filter--#{status} #{'status-filter--active' if params[:status] == status}" %> | ||
| <% end %> | ||
| </div> | ||
|
|
||
| <div class="status-filters"> | ||
| <%= link_to "All Plans", plans_path(params.permit(:status, :tag)), class: "status-filter #{'status-filter--active' if params[:scope].blank?}" %> | ||
| <%= link_to "My Plans", plans_path(params.permit(:status, :tag).merge(scope: "mine")), class: "status-filter #{'status-filter--active' if params[:scope] == 'mine'}" %> | ||
| </div> | ||
| <% if @plan_types.any? %> | ||
| <div class="plans-toolbar__row plans-toolbar__row--secondary"> | ||
| <%= link_to "Any type", plans_path(params.permit(:scope, :status, :tag)), | ||
| class: "status-filter #{'status-filter--active' if params[:plan_type].blank?}" %> | ||
| <% @plan_types.each do |pt| %> | ||
| <%= link_to pt.name, plans_path(params.permit(:scope, :status, :tag).merge(plan_type: pt.id)), | ||
| class: "status-filter #{'status-filter--active' if params[:plan_type] == pt.id}" %> | ||
| <% end %> | ||
| </div> | ||
| <% end %> | ||
|
|
||
| <div class="status-filters"> | ||
| <%= link_to "All", plans_path(params.permit(:scope, :plan_type, :tag)), class: "status-filter #{'status-filter--active' if params[:status].blank?}" %> | ||
| <% CoPlan::Plan::STATUSES.each do |status| %> | ||
| <%= link_to status.titleize, plans_path(params.permit(:scope, :plan_type, :tag).merge(status: status)), class: "status-filter status-filter--#{status} #{'status-filter--active' if params[:status] == status}" %> | ||
| <% if params[:tag].present? %> | ||
| <div class="active-filter"> | ||
| Filtered by tag: <span class="badge badge--tag badge--tag-active"><%= params[:tag] %></span> | ||
| <%= link_to "✕ Clear", plans_path(params.permit(:scope, :status, :plan_type)), class: "active-filter__clear" %> | ||
| </div> | ||
| <% end %> | ||
| </div> | ||
|
|
||
| <% if @plan_types.any? %> | ||
| <div class="status-filters"> | ||
| <%= link_to "All Types", plans_path(params.permit(:scope, :status, :tag)), class: "status-filter #{'status-filter--active' if params[:plan_type].blank?}" %> | ||
| <% @plan_types.each do |pt| %> | ||
| <%= link_to pt.name, plans_path(params.permit(:scope, :status, :tag).merge(plan_type: pt.id)), class: "status-filter #{'status-filter--active' if params[:plan_type] == pt.id}" %> | ||
| <% end %> | ||
| </div> | ||
| <% end %> | ||
|
|
||
| <% if params[:tag].present? %> | ||
| <div class="active-filter"> | ||
| Filtered by tag: <span class="badge badge--tag badge--tag-active"><%= params[:tag] %></span> | ||
| <%= link_to "✕ Clear", plans_path(params.permit(:scope, :status, :plan_type)), class: "active-filter__clear" %> | ||
| </div> | ||
| <% end %> | ||
|
|
||
| <% if @plans.any? %> | ||
| <div class="plans-list"> | ||
| <%= render partial: "coplan/plans/plan_page", locals: { plans: @plans, plan_unread_counts: @plan_unread_counts, page: @page, has_next_page: @has_next_page } %> | ||
| <%= render partial: "coplan/plans/plan_page", locals: { | ||
| plans: @plans, | ||
| plan_unread_counts: @plan_unread_counts, | ||
| page: @page, | ||
| has_next_page: @has_next_page, | ||
| grouped_by_status: @grouped_by_status, | ||
| } %> | ||
| </div> | ||
| <% else %> | ||
| <div class="empty-state card"> | ||
| <p>No plans yet. Plans are created via the API.</p> | ||
| <% if @scope == "mine" %> | ||
| <p>You haven't created any plans yet. Plans are created via the API.</p> | ||
| <% else %> | ||
| <p>No plans yet. Plans are created via the API.</p> | ||
| <% end %> | ||
| </div> | ||
| <% end %> |
This file contains hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When a signed-in user clicks the existing landing-page link labeled
Browse all plans →, it still callsplans_pathwithout ascope(checkedengine/app/views/coplan/welcome/_default_landing.html.erb:66), but this new default now routes that unscoped request to only the user's own plans. That makes a link explicitly promising all plans silently hide everyone else's published plans; update that caller (and any similar all-browse entry points) to passscope: "all"or avoid changing the unscoped default for those paths.Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch — fixed in a124a65. The 'Browse all plans →' link now passes
scope: "all"explicitly so it keeps its promise. The primary 'Browse plans' CTA at the top stays unscoped (defaults to mine), which feels right for a signed-in user landing.