diff --git a/app/assets/stylesheets/blog_posts.css b/app/assets/stylesheets/blog_posts.css
index 2ae143a..ecb1bef 100644
--- a/app/assets/stylesheets/blog_posts.css
+++ b/app/assets/stylesheets/blog_posts.css
@@ -1,4 +1,4 @@
-form#blog_post_form, form#learning_goal_form {
+form#blog_post_form {
display: flex;
flex-direction: column;
max-width: 55em;
diff --git a/app/assets/stylesheets/learning_goals.css b/app/assets/stylesheets/learning_goals.css
deleted file mode 100644
index 1fdf47c..0000000
--- a/app/assets/stylesheets/learning_goals.css
+++ /dev/null
@@ -1,26 +0,0 @@
-.learning_goal {
- margin: 1em auto;
- padding: .5em;
- background-color: var(--inset-background-color);
- border: 1px solid var(--border-color);
-
- > .created_at {
- text-align: right;
- font-size: .8em;
- }
-}
-
-ul#learning_goals {
- list-style-type: none;
-}
-
-ul.todos {
- list-style-type: none;
-}
-
-ul.tags {
- list-style-type: none;
- > li {
- display: inline;
- }
-}
diff --git a/app/assets/stylesheets/todos.css b/app/assets/stylesheets/todos.css
deleted file mode 100644
index f3cf469..0000000
--- a/app/assets/stylesheets/todos.css
+++ /dev/null
@@ -1,44 +0,0 @@
-form#blog_post_form, form#learning_goal_form, form#todo_form {
- display: flex;
- flex-direction: column;
- max-width: 55em;
-
- > h2 {
- width: 100%;
- }
-
- > trix-toolbar {
- max-width: 95%;
- }
-
- > trix-editor {
- width: 95%;
- > ul {
- list-style-type: disc;
- }
- }
-
- input[type=text] {
- width: 95%;
- }
-
- > input[type=submit] {
- width: 95%;
- }
-}
-
-.blog_post {
- margin: 1em auto;
- padding: .5em;
- background-color: var(--inset-background-color);
- border: 1px solid var(--border-color);
-
- > .created_at {
- text-align: right;
- font-size: .8em;
- }
-}
-
-ul#blog_posts {
- list-style-type: none;
-}
diff --git a/app/controllers/learning_goals_controller.rb b/app/controllers/learning_goals_controller.rb
deleted file mode 100644
index 5e3c055..0000000
--- a/app/controllers/learning_goals_controller.rb
+++ /dev/null
@@ -1,62 +0,0 @@
-# frozen_string_literal: true
-
-class LearningGoalsController < ApplicationController
- skip_before_action :require_login, only: [:index, :show]
- before_action :set_learning_goal, only: [:show, :edit, :update, :destroy]
-
- def index ; end
-
- def new
- @learning_goal = LearningGoal.new
- end
-
- def create
- @learning_goal = LearningGoal.new(learning_goal_params)
- @learning_goal.user = helpers.current_user
-
- if @learning_goal.save
- redirect_to @learning_goal, notice: t(".created")
- else
- render :new, status: :unprocessable_entity
- end
- end
-
- def show ; end
-
- def edit; end
-
- def update
- if @learning_goal.update(learning_goal_params)
- redirect_to @learning_goal, notice: t(".updated")
- else
- render :edit, status: :unprocessable_entity
- end
- end
-
- def destroy
- if @learning_goal.destroy
- redirect_to learning_goals_path, notice: t(".deleted")
- else
- render :edit, status: :unprocessable_entity
- end
- end
-
- private
-
- def learning_goal_params
- params.require(:learning_goal).permit(
- :title,
- :starts_on,
- :ends_on,
- :description,
- :retrospective,
- :completed,
- :user,
- tag_ids: [],
- )
- end
-
- def set_learning_goal
- @learning_goal = LearningGoal.find(params[:id])
- end
-end
diff --git a/app/controllers/todos_controller.rb b/app/controllers/todos_controller.rb
deleted file mode 100644
index 2d70cab..0000000
--- a/app/controllers/todos_controller.rb
+++ /dev/null
@@ -1,51 +0,0 @@
-class TodosController < ApplicationController
- before_action :set_todo, only: [:edit, :update, :destroy]
-
- def new
- @todo = Todo.new
- end
-
- def create
- @todo = Todo.new(todo_params)
- if @todo.save
- redirect_to @todo.learning_goal, notice: t(".created")
- else
- render :new, status: :unprocessable_entity
- end
- end
-
- def edit ; end
-
- def update
- if @todo.update(todo_params)
- redirect_to @todo.learning_goal, notice: t(".updated")
- else
- render :edit, status: :unprocessable_entity
- end
- end
-
- def destroy
- learning_goal = @todo.learning_goal
- if @todo.destroy
- redirect_to learning_goal, notice: t(".deleted")
- else
- render :edit, status: :unprocessable_entity
- end
- end
-
- private
-
- def set_todo
- @todo = Todo.find(params[:id])
- end
-
- def todo_params
- params.require(:todo).permit(
- :learning_goal_id,
- :description,
- :done,
- :title,
- :due,
- )
- end
-end
diff --git a/app/helpers/learning_goals_helper.rb b/app/helpers/learning_goals_helper.rb
deleted file mode 100644
index d36c8ac..0000000
--- a/app/helpers/learning_goals_helper.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-module LearningGoalsHelper
- def learning_goal_completed_text(learning_goal)
- learning_goal.completed ? t(".completed") : t(".not_completed")
- end
-end
diff --git a/app/helpers/todos_helper.rb b/app/helpers/todos_helper.rb
deleted file mode 100644
index 65ab195..0000000
--- a/app/helpers/todos_helper.rb
+++ /dev/null
@@ -1,2 +0,0 @@
-module TodosHelper
-end
diff --git a/app/models/learning_goal.rb b/app/models/learning_goal.rb
deleted file mode 100644
index 7c739c5..0000000
--- a/app/models/learning_goal.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-class LearningGoal < ApplicationRecord
- belongs_to :user
- has_many :todos
- has_and_belongs_to_many :tags
- accepts_nested_attributes_for :tags
-
- has_rich_text :description
- has_rich_text :retrospective
- validates :completed, inclusion: { in: [true, false] }
- validates :title, presence: true
-
- scope :current, -> { where(starts_on: ..Date.today, ends_on: Date.today..) }
- scope :past, -> { where(ends_on: ..Date.today) }
- scope :future, -> { where(starts_on: Date.today..) }
-
- def microposts
- microposts = Micropost.none
- tags.each { |tag| microposts = microposts.or(tag.microposts) }
- microposts.uniq
- end
-end
diff --git a/app/models/tag.rb b/app/models/tag.rb
index dbee19b..320e815 100644
--- a/app/models/tag.rb
+++ b/app/models/tag.rb
@@ -4,7 +4,6 @@ class Tag < ApplicationRecord
validates :name, presence: true
has_many :microposts_tags
has_many :microposts, through: :microposts_tags
- has_and_belongs_to_many :learning_goals
def to_param
name
diff --git a/app/models/todo.rb b/app/models/todo.rb
deleted file mode 100644
index 3b66da3..0000000
--- a/app/models/todo.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-class Todo < ApplicationRecord
- belongs_to :learning_goal
- validates :done, inclusion: { in: [true, false] }
- has_rich_text :description
- has_one :user, through: :learning_goal
-end
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb
index c1ba737..8d4e11f 100644
--- a/app/views/layouts/application.html.erb
+++ b/app/views/layouts/application.html.erb
@@ -22,7 +22,6 @@
<%= link_to t(".microposts"), microposts_path %>
<% if logged_in? %>
<%= link_to t(".diary_entries"), diary_entries_path %>
- <%= link_to t(".learning_goals"), learning_goals_path %>
<%= link_to t(".profile"), user_path(current_user) %>
<%= link_to t(".log_out"), log_out_path, data: { turbo_method: :delete } %>
<% end %>
diff --git a/app/views/learning_goals/_form.html.erb b/app/views/learning_goals/_form.html.erb
deleted file mode 100644
index 110de80..0000000
--- a/app/views/learning_goals/_form.html.erb
+++ /dev/null
@@ -1,25 +0,0 @@
-<%= form_with model: @learning_goal, id: "learning_goal_form" do |f| %>
- <%= title %>
-
- <%= f.text_field :title, placeholder: t(".title") %>
-
- <%= f.rich_text_area :description %>
-
- <%= f.label :starts_on %>
- <%= f.date_field :starts_on %>
-
- <%= f.label :ends_on %>
- <%= f.date_field :ends_on %>
-
- <%= f.rich_text_area :retrospective %>
-
- <%= f.label :completed %>
- <%= f.check_box :completed %>
-
- <%= f.label :microposts_tag %>
- <%= f.collection_check_boxes :tag_ids, Tag.all, :id, :name %>
-
- <%= f.submit button_text %>
-<% end %>
-
-
diff --git a/app/views/learning_goals/_learning_goal.html.erb b/app/views/learning_goals/_learning_goal.html.erb
deleted file mode 100644
index b33ac8c..0000000
--- a/app/views/learning_goals/_learning_goal.html.erb
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
<%= link_to learning_goal.title, learning_goal %>
- <%= learning_goal.description %>
-
diff --git a/app/views/learning_goals/edit.html.erb b/app/views/learning_goals/edit.html.erb
deleted file mode 100644
index 36f1ace..0000000
--- a/app/views/learning_goals/edit.html.erb
+++ /dev/null
@@ -1,10 +0,0 @@
-<% @title = t(".edit") %>
-
-<%= render partial: "form",
- locals: {
- user: @user,
- button_text: t(".edit"),
- title: t(".edit"),
- } %>
-
-<%= link_to t(".delete"), @learning_goal, data: { turbo_method: :delete, turbo_confirm: t(".confirm") } %>
diff --git a/app/views/learning_goals/index.html.erb b/app/views/learning_goals/index.html.erb
deleted file mode 100644
index c51bc66..0000000
--- a/app/views/learning_goals/index.html.erb
+++ /dev/null
@@ -1,25 +0,0 @@
-<%= t(".learning_goals") %>
-
-<%= link_to t(".new"), new_learning_goal_path if logged_in? %>
-<%= link_to t(".new_todo"), new_todo_path if logged_in? %>
-
-<%= t(".current") %>
-<% if LearningGoal.current.any? %>
- <%= render LearningGoal.current %>
-<% else %>
- <%= t(".no_current_goals") %>
-<% end %>
-
-<%= t(".future") %>
-<% if LearningGoal.future.any? %>
- <%= render LearningGoal.future %>
-<% else %>
- <%= t(".no_future_goals") %>
-<% end %>
-
-<%= t(".past") %>
-<% if LearningGoal.past.any? %>
- <%= render LearningGoal.past %>
-<% else %>
- <%= t(".no_past_goals") %>
-<% end %>
diff --git a/app/views/learning_goals/new.html.erb b/app/views/learning_goals/new.html.erb
deleted file mode 100644
index e4e2ca0..0000000
--- a/app/views/learning_goals/new.html.erb
+++ /dev/null
@@ -1,8 +0,0 @@
-<% @title = t(".create") %>
-
-<%= render partial: "form",
- locals: {
- user: @user,
- button_text: t(".create"),
- title: t(".create"),
- } %>
diff --git a/app/views/learning_goals/show.html.erb b/app/views/learning_goals/show.html.erb
deleted file mode 100644
index 36d14a9..0000000
--- a/app/views/learning_goals/show.html.erb
+++ /dev/null
@@ -1,28 +0,0 @@
-
- <%= link_to t(".edit"), edit_learning_goal_path(@learning_goal) if @learning_goal.user == current_user %>
-
<%= @learning_goal.title %>
-
<%= @learning_goal.starts_on %>-<%= @learning_goal.ends_on %>
-
<%= t(".description") %>
-
<%= @learning_goal.description %>
- <% if @learning_goal.completed? %>
-
<%= t(".retrospective") %>
-
<%= @learning_goal.retrospective %>
- <% end %>
-
-
<%= t(".todos") %>
-
- <% @learning_goal.todos.each do |todo| %>
- - <%= render todo %>
- <% end %>
-
-
-
<%= t(".tags") %>
-
-
-
<%= t(".related_microposts") %>
-
<%= render @learning_goal.microposts %>
-
diff --git a/app/views/todos/_form.html.erb b/app/views/todos/_form.html.erb
deleted file mode 100644
index 90cbfbb..0000000
--- a/app/views/todos/_form.html.erb
+++ /dev/null
@@ -1,18 +0,0 @@
-<%= form_with model: @todo, id: "todo_form" do |f| %>
- <%= title %>
-
- <%= f.text_field :title, placeholder: t(".title") %>
-
- <%= f.label :learning_goal %>
- <%= f.collection_select :learning_goal_id, LearningGoal.all, :id, :title %>
-
- <%= f.rich_text_area :description %>
-
- <%= f.label :due %>
- <%= f.date_field :due %>
-
- <%= f.label :done %>
- <%= f.check_box :done %>
-
- <%= f.submit button_text %>
-<% end %>
diff --git a/app/views/todos/_todo.html.erb b/app/views/todos/_todo.html.erb
deleted file mode 100644
index 39e0ccc..0000000
--- a/app/views/todos/_todo.html.erb
+++ /dev/null
@@ -1,10 +0,0 @@
-
- checked
- <% end %>>
-<%= todo.title %>
-<% if todo.user == current_user %>
- <%= link_to t(".edit"), edit_todo_path(todo) %>
- <%= link_to t(".delete"), todo, data: { turbo_method: :delete, turbo_confirm: t(".confirm") } %>
-<% end %>
-<%= todo.description %>
diff --git a/app/views/todos/edit.html.erb b/app/views/todos/edit.html.erb
deleted file mode 100644
index 7bde9d6..0000000
--- a/app/views/todos/edit.html.erb
+++ /dev/null
@@ -1,10 +0,0 @@
-<% @title = t(".edit") %>
-
-<%= render partial: "form",
- locals: {
- user: @user,
- button_text: t(".edit"),
- title: t(".edit"),
- } %>
-
-<%= link_to t(".delete"), @todo, data: { turbo_method: :delete, turbo_confirm: t(".confirm") } %>
diff --git a/app/views/todos/new.html.erb b/app/views/todos/new.html.erb
deleted file mode 100644
index e4e2ca0..0000000
--- a/app/views/todos/new.html.erb
+++ /dev/null
@@ -1,8 +0,0 @@
-<% @title = t(".create") %>
-
-<%= render partial: "form",
- locals: {
- user: @user,
- button_text: t(".create"),
- title: t(".create"),
- } %>
diff --git a/config/locales/controllers/learning_goals/en.yml b/config/locales/controllers/learning_goals/en.yml
deleted file mode 100644
index 3e0d553..0000000
--- a/config/locales/controllers/learning_goals/en.yml
+++ /dev/null
@@ -1,5 +0,0 @@
-en:
- learning_goals:
- created: Successfully created learning goal
- updated: Successfully updated learning goal
- deleted: Successfully deleted learning goal
diff --git a/config/locales/controllers/todos/en.yml b/config/locales/controllers/todos/en.yml
deleted file mode 100644
index d6aad56..0000000
--- a/config/locales/controllers/todos/en.yml
+++ /dev/null
@@ -1,5 +0,0 @@
-en:
- todos:
- created: Successfully created todo
- updated: Successfully updated todo
- deleted: Successfully deleted todo
diff --git a/config/locales/views/layouts/application.yml b/config/locales/views/layouts/application.yml
index 48c7e1f..4bbd3c9 100644
--- a/config/locales/views/layouts/application.yml
+++ b/config/locales/views/layouts/application.yml
@@ -10,4 +10,3 @@ en:
blog_posts: Blog
microposts: μposts
diary_entries: Diary
- learning_goals: Learning Goals
diff --git a/config/locales/views/learning_goals/en.yml b/config/locales/views/learning_goals/en.yml
deleted file mode 100644
index 120c3cc..0000000
--- a/config/locales/views/learning_goals/en.yml
+++ /dev/null
@@ -1,29 +0,0 @@
-en:
- learning_goals:
- index:
- learning_goals: Learning Goals
- new: New learning goal
- new_todo: New todo
- current: Current
- future: Future
- past: Past
- no_current_goals: You have no current goals
- no_future_goals: You have no future goals
- no_past_goals: You have no past goals
- new:
- create: Create learning goal
- edit:
- edit: Edit learning goal
- delete: Delete learning goal
- confirm: Are you sure you want to delete this learning goal?
- form:
- title: Title
- show:
- completed: Learning goal is complete
- not_completed: Learning goal is incomplete
- edit: Edit
- description: Description
- retrospective: Retrospective
- tags: Tags
- todos: Todos
- related_microposts: Related μposts
diff --git a/config/locales/views/todos/en.yml b/config/locales/views/todos/en.yml
deleted file mode 100644
index ae8ff9f..0000000
--- a/config/locales/views/todos/en.yml
+++ /dev/null
@@ -1,14 +0,0 @@
-en:
- todos:
- new:
- create: Create todo
- edit:
- edit: Edit todo
- delete: Delete todo
- confirm: Are you sure you want to delete this todo?
- form:
- title: Title
- todo:
- edit: Edit
- delete: Delete
- confirm: Are you sure you want to delete this todo?
diff --git a/config/routes.rb b/config/routes.rb
index 2868fbf..891be87 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -13,10 +13,8 @@ Rails.application.routes.draw do
get "confirm_email", to: "email_confirmations#confirm"
resources :blog_posts
- resources :learning_goals
resources :microposts
resources :tags, only: [:index, :show]
- resources :todos, only: [:new, :create, :edit, :update, :destroy]
resources :diary_entries, except: [:destroy]
get "up" => "rails/health#show", as: :rails_health_check
diff --git a/db/migrate/20240305160037_remove_learning_goals.rb b/db/migrate/20240305160037_remove_learning_goals.rb
new file mode 100644
index 0000000..6aa65f6
--- /dev/null
+++ b/db/migrate/20240305160037_remove_learning_goals.rb
@@ -0,0 +1,6 @@
+class RemoveLearningGoals < ActiveRecord::Migration[7.1]
+ def change
+ drop_table :todos
+ drop_table :learning_goals
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 8afa141..aae9c3f 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -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_01_26_101316) do
+ActiveRecord::Schema[7.1].define(version: 2024_03_05_160037) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -105,17 +105,6 @@ ActiveRecord::Schema[7.1].define(version: 2024_01_26_101316) do
t.index ["name"], name: "index_feature_flags_on_name", unique: true
end
- create_table "learning_goals", force: :cascade do |t|
- t.string "title", null: false
- t.date "starts_on"
- t.date "ends_on"
- t.boolean "completed", default: false, null: false
- t.bigint "user_id", null: false
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.index ["user_id"], name: "index_learning_goals_on_user_id"
- end
-
create_table "learning_goals_tags", id: false, force: :cascade do |t|
t.bigint "learning_goal_id", null: false
t.bigint "tag_id", null: false
@@ -148,16 +137,6 @@ ActiveRecord::Schema[7.1].define(version: 2024_01_26_101316) do
t.datetime "updated_at", null: false
end
- create_table "todos", force: :cascade do |t|
- t.bigint "learning_goal_id", null: false
- t.boolean "done", default: false, null: false
- t.string "title", default: "", null: false
- t.date "due"
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.index ["learning_goal_id"], name: "index_todos_on_learning_goal_id"
- end
-
create_table "users", force: :cascade do |t|
t.string "username", null: false
t.string "password_digest", null: false
@@ -177,7 +156,5 @@ ActiveRecord::Schema[7.1].define(version: 2024_01_26_101316) do
add_foreign_key "diary_entries", "users"
add_foreign_key "exercises", "diary_entries"
add_foreign_key "exercises", "exercise_types"
- add_foreign_key "learning_goals", "users"
add_foreign_key "microposts", "users"
- add_foreign_key "todos", "learning_goals"
end
diff --git a/test/controllers/learning_goals_controller_test.rb b/test/controllers/learning_goals_controller_test.rb
deleted file mode 100644
index cf1ae1c..0000000
--- a/test/controllers/learning_goals_controller_test.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-require "test_helper"
-
-class LearningGoalsControllerTest < ActionDispatch::IntegrationTest
- # test "the truth" do
- # assert true
- # end
-end
diff --git a/test/controllers/todos_controller_test.rb b/test/controllers/todos_controller_test.rb
deleted file mode 100644
index f53fe65..0000000
--- a/test/controllers/todos_controller_test.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-require "test_helper"
-
-class TodosControllerTest < ActionDispatch::IntegrationTest
- # test "the truth" do
- # assert true
- # end
-end
diff --git a/test/fixtures/action_text/rich_texts.yml b/test/fixtures/action_text/rich_texts.yml
index defca85..10d53f0 100644
--- a/test/fixtures/action_text/rich_texts.yml
+++ b/test/fixtures/action_text/rich_texts.yml
@@ -10,7 +10,3 @@ draft_blog_post:
record: draft (BlogPost)
name: content
body: Just some text
-learning_goal_one:
- record: linux (LearningGoal)
- name: content
- body: Learning about Linux
diff --git a/test/fixtures/learning_goals.yml b/test/fixtures/learning_goals.yml
deleted file mode 100644
index d323fc0..0000000
--- a/test/fixtures/learning_goals.yml
+++ /dev/null
@@ -1,13 +0,0 @@
-sql:
- title: SQL
- starts_on: 2024-01-06
- ends_on: 2024-06-06
- completed: false
- user: trevor
-
-linux:
- title: Linux
- starts_on: 2023-03-06
- ends_on: 2023-06-06
- completed: true
- user: trevor
diff --git a/test/fixtures/todos.yml b/test/fixtures/todos.yml
deleted file mode 100644
index 1c5322d..0000000
--- a/test/fixtures/todos.yml
+++ /dev/null
@@ -1,10 +0,0 @@
-one:
- learning_goal: sql
- done: false
- title: Read ‘SQL for Mere Mortals’
- due: <%= 3.years.from_now %>
-
-two:
- learning_goal: linux
- done: true
- title: Install Debian
diff --git a/test/models/learning_goal_test.rb b/test/models/learning_goal_test.rb
deleted file mode 100644
index 90cd7e9..0000000
--- a/test/models/learning_goal_test.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-require "test_helper"
-
-class LearningGoalTest < ActiveSupport::TestCase
-end
diff --git a/test/models/todo_test.rb b/test/models/todo_test.rb
deleted file mode 100644
index 614a849..0000000
--- a/test/models/todo_test.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-require "test_helper"
-
-class TodoTest < ActiveSupport::TestCase
- # test "the truth" do
- # assert true
- # end
-end