-
Notifications
You must be signed in to change notification settings - Fork 22
Change default sort option for workshops to title, etc #1034
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
Changes from all commits
14a2329
44e383a
8cb84e7
70cd131
c433fe4
824bde8
8a351bc
0b1a544
7322b6e
c1d6d07
9b9b143
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,8 +4,8 @@ class WorkshopsController < ApplicationController | |
|
|
||
| def index | ||
| authorize! | ||
| @category_types = CategoryType.published.order(:name).decorate | ||
| @sectors = Sector.published | ||
| @category_types = CategoryType.published.where(story_specific: false).order(:name).decorate | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. don't show story population on workshops tags dropdowns |
||
| @sectors = Sector.published.order(:name) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. alphabetize sector names in dropdowns |
||
| @windows_types = WindowsType.all | ||
|
|
||
| if turbo_frame_request? | ||
|
|
@@ -21,6 +21,7 @@ def index | |
|
|
||
| render :workshop_results | ||
| else | ||
| @sort = params[:sort].presence || "title" | ||
| render :index | ||
| end | ||
| end | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,7 +29,7 @@ def call | |
|
|
||
| # Compute the effective sort | ||
| def default_sort | ||
| params[:sort].presence || "created" | ||
| params[:sort].presence || "title" | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. change default sort |
||
| # return params[:sort] if params[:sort].present? | ||
| # return 'keywords' if params[:query].present? # only when returning weighted results from # search_by_query | ||
| # 'title' | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,6 +24,13 @@ | |
|
|
||
| <div class="grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-4 gap-4 overflow-visible p-4"> | ||
|
|
||
| <%= render "dropdown_filter", | ||
| dom_id_prefix: "windows-types", | ||
| label_text: "Windows Audience", | ||
| items: @windows_types, | ||
| label_method: :short_name, | ||
| param_name: :windows_types %> | ||
|
|
||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. move windows audience first bc people weren't noticing it |
||
| <%= render "categories_fields", category_types: @category_types %> | ||
|
|
||
| <%= render "dropdown_filter", | ||
|
|
@@ -32,12 +39,5 @@ | |
| items: @sectors.reject { |sector| sector.name == "Other" }, | ||
| param_name: :sectors %> | ||
|
|
||
| <%= render "dropdown_filter", | ||
| dom_id_prefix: "windows-types", | ||
| label_text: "Windows Type", | ||
| items: @windows_types, | ||
| label_method: :short_name, | ||
| param_name: :windows_types %> | ||
|
|
||
| <%= render "inactive_fields" if allowed_to?(:manage?, Workshop) %> | ||
| </div> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| class AddNotNullConstraintsToAffiliations < ActiveRecord::Migration[8.1] | ||
| def up | ||
| # Clean up any orphaned records before adding constraints | ||
| Affiliation.where(organization_id: nil).destroy_all | ||
| Affiliation.where(person_id: nil).destroy_all | ||
|
|
||
| change_column_null :affiliations, :organization_id, false | ||
| change_column_null :affiliations, :person_id, false | ||
|
|
||
| # Fix column type so foreign key can be added (people.id is int, not bigint) | ||
| change_column :affiliations, :person_id, :integer, null: false | ||
|
|
||
| unless foreign_key_exists?(:affiliations, :people, column: :person_id) | ||
| add_foreign_key :affiliations, :people, column: :person_id | ||
| end | ||
| end | ||
|
|
||
| def down | ||
| change_column_null :affiliations, :organization_id, true | ||
| change_column_null :affiliations, :person_id, true | ||
|
|
||
| if foreign_key_exists?(:affiliations, :people, column: :person_id) | ||
| remove_foreign_key :affiliations, :people, column: :person_id | ||
| end | ||
|
|
||
| change_column :affiliations, :person_id, :bigint | ||
| end | ||
| end |
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.
an ahoy test was breaking bc of this