diff --git a/app/assets/stylesheets/learning_goals.css b/app/assets/stylesheets/learning_goals.css index b6d428d..1fdf47c 100644 --- a/app/assets/stylesheets/learning_goals.css +++ b/app/assets/stylesheets/learning_goals.css @@ -13,3 +13,14 @@ 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 new file mode 100644 index 0000000..f3cf469 --- /dev/null +++ b/app/assets/stylesheets/todos.css @@ -0,0 +1,44 @@ +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 index 2407579..5e3c055 100644 --- a/app/controllers/learning_goals_controller.rb +++ b/app/controllers/learning_goals_controller.rb @@ -4,11 +4,7 @@ class LearningGoalsController < ApplicationController skip_before_action :require_login, only: [:index, :show] before_action :set_learning_goal, only: [:show, :edit, :update, :destroy] - def index - @learning_goals = LearningGoal.all - .order(created_at: :desc) - .page(params[:page]) - end + def index ; end def new @learning_goal = LearningGoal.new diff --git a/app/models/learning_goal.rb b/app/models/learning_goal.rb index 554aaac..7c739c5 100644 --- a/app/models/learning_goal.rb +++ b/app/models/learning_goal.rb @@ -7,9 +7,12 @@ class LearningGoal < ApplicationRecord 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) } diff --git a/app/views/learning_goals/_learning_goal.html.erb b/app/views/learning_goals/_learning_goal.html.erb new file mode 100644 index 0000000..b33ac8c --- /dev/null +++ b/app/views/learning_goals/_learning_goal.html.erb @@ -0,0 +1,4 @@ +
<%= t(".empty") %>
+<%= t(".no_current_goals") %>
+<% end %> + +<%= t(".no_future_goals") %>
+<% end %> + +<%= t(".no_past_goals") %>
<% end %> diff --git a/app/views/learning_goals/show.html.erb b/app/views/learning_goals/show.html.erb index d5b3241..36d14a9 100644 --- a/app/views/learning_goals/show.html.erb +++ b/app/views/learning_goals/show.html.erb @@ -10,14 +10,14 @@ <% end %>