Skip to content
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

WIP: [FEAT] Custom Links in Dropdown Menu #5718

Closed
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
5c15b07
feat: add migration and model for custom links
nepaakash May 13, 2024
10e78b9
feat: update the schema information
nepaakash May 13, 2024
5910151
feat: add factory and spec file
nepaakash May 13, 2024
88e5893
Merge remote-tracking branch 'origin/main' into feat/custom-links-in-…
nepaakash Jun 23, 2024
22fbe5b
feat: add setter for custom url
nepaakash Jun 23, 2024
e046020
feat: add custom link section in edit organization page
nepaakash Jun 23, 2024
a697e10
fet: add before action and update setter name
nepaakash Jun 23, 2024
c25ba65
feat: add soft delete column to custom links table
nepaakash Jun 23, 2024
53b95c2
feat: add active scope to custom link class
nepaakash Jun 23, 2024
33a0d41
feat: add active column to custom links table
nepaakash Jun 23, 2024
ebbb863
feat: update destroy popup text
nepaakash Jun 23, 2024
ab5454a
feat: add custom link policy
nepaakash Jun 23, 2024
a7b39b3
feat: add route and controller for custom link policy
nepaakash Jun 23, 2024
be36735
feat: add views for crud
nepaakash Jun 23, 2024
9a5df29
feat: add association with custom links
nepaakash Jun 23, 2024
e801d16
feat: add active column and soft delete validations
nepaakash Jun 23, 2024
3fd889b
feat: remove unused methods
nepaakash Jun 23, 2024
c3dcacb
feat: add validation for text and url
nepaakash Jun 23, 2024
136111b
feat: add custom link to the profile dropdown
nepaakash Jun 23, 2024
8fb37fa
fix: linter issue fix
nepaakash Jun 23, 2024
cce5956
feat: update factory for custom link
nepaakash Jun 23, 2024
1d0d5d7
fix: linters issue fixed
nepaakash Jun 23, 2024
4942caf
fix: fix model spec linter
nepaakash Jun 23, 2024
f020367
feat: add casa org association in custom link factory
nepaakash Jun 23, 2024
4d2d99b
fix: linter issue fix
nepaakash Jun 23, 2024
e905bb1
fix: return if current organization is not present
nepaakash Jun 29, 2024
dded9f9
feat: remove soft delete feature from custom link
nepaakash Jun 29, 2024
990f96b
feat: add icon for the custom link
nepaakash Jun 29, 2024
3f6847f
feat: include destroy method in custom link policy
nepaakash Jun 29, 2024
b8f25bf
feat: remove sof delete validation and condition
nepaakash Jun 29, 2024
a514b3f
fix: linter issue fix
nepaakash Jun 29, 2024
6d8a7aa
feat: add test case fir custom link
nepaakash Aug 26, 2024
8b923fd
Merge remote-tracking branch 'origin/main' into feat/custom-links-in-…
nepaakash Aug 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions app/models/custom_link.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
class CustomLink < ApplicationRecord
belongs_to :casa_org
end
Copy link
Collaborator

@schoork schoork May 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should add some validation on the url and the text

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This task is still in progress... Will definitely add those


# == Schema Information
#
# Table name: custom_links
#
# id :bigint not null, primary key
# text :string
# url :text
# created_at :datetime not null
# updated_at :datetime not null
# casa_org_id :bigint not null
#
# Indexes
#
# index_custom_links_on_casa_org_id (casa_org_id)
#
# Foreign Keys
#
# fk_rails_... (casa_org_id => casa_orgs.id)
#
1 change: 0 additions & 1 deletion app/models/learning_hour.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ def user_org_learning_topic_enable?
# id :bigint not null, primary key
# duration_hours :integer not null
# duration_minutes :integer not null
# learning_type :integer default(5)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

interesting diff - at some point we need to figure out why this keeps appearing and disappearing

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. This thing drives me nuts in my code. Also I feel like I messed it up. @elasticspoon any ideas?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be removed. It looks like :learning_type was adding in

t.integer :learning_type, default: 5, not_null: true
but then removed in
class RemoveLearningType < ActiveRecord::Migration[7.0]

It probably should have been removed but somehow got left in?

I suspect what is going on is it exists in the schema because someone forgot to commit the removal. Most people do a schema:load to they have it. But when people run migrations it attempts to remove the column. And every time the removal is attempted we think "thats weird, we should leave the column".

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would leave it in for now simply because I think the removal might mess up the seeding.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nepaakash revert this change for now

# name :string not null
# occurred_at :datetime not null
# created_at :datetime not null
Expand Down
10 changes: 10 additions & 0 deletions db/migrate/20240513155246_create_custom_links.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class CreateCustomLinks < ActiveRecord::Migration[7.1]
def change
create_table :custom_links do |t|
t.string :text
t.text :url
t.references :casa_org, null: false, foreign_key: true
t.timestamps
end
end
end
13 changes: 11 additions & 2 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema[7.1].define(version: 2024_05_07_022441) do
ActiveRecord::Schema[7.1].define(version: 2024_05_13_155246) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"

Expand Down Expand Up @@ -298,6 +298,15 @@
t.index ["judge_id"], name: "index_court_dates_on_judge_id"
end

create_table "custom_links", force: :cascade do |t|
t.string "text"
t.text "url"
t.bigint "casa_org_id", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["casa_org_id"], name: "index_custom_links_on_casa_org_id"
end

create_table "delayed_jobs", force: :cascade do |t|
t.integer "priority", default: 0, null: false
t.integer "attempts", default: 0, null: false
Expand Down Expand Up @@ -420,7 +429,6 @@

create_table "learning_hours", force: :cascade do |t|
t.bigint "user_id", null: false
t.integer "learning_type", default: 5
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

revert this change for now

t.string "name", null: false
t.integer "duration_minutes", null: false
t.integer "duration_hours", null: false
Expand Down Expand Up @@ -684,6 +692,7 @@
add_foreign_key "contact_topic_answers", "contact_topics"
add_foreign_key "contact_topics", "casa_orgs"
add_foreign_key "court_dates", "casa_cases"
add_foreign_key "custom_links", "casa_orgs"
add_foreign_key "emancipation_options", "emancipation_categories"
add_foreign_key "followups", "users", column: "creator_id"
add_foreign_key "judges", "casa_orgs"
Expand Down
5 changes: 5 additions & 0 deletions spec/factories/custom_links.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FactoryBot.define do
factory :custom_link do

end
end
5 changes: 5 additions & 0 deletions spec/models/custom_link_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
require 'rails_helper'

RSpec.describe CustomLink, type: :model do
pending "add some examples to (or delete) #{__FILE__}"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add tests before merging

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes sure... It is still a work in progress

end
Loading