diff --git a/app/controllers/task_items_controller.rb b/app/controllers/task_items_controller.rb
index 9147ead..10b71b2 100644
--- a/app/controllers/task_items_controller.rb
+++ b/app/controllers/task_items_controller.rb
@@ -9,7 +9,7 @@ class TaskItemsController < ApplicationController
@task_item.task_list = @task_list
if @task_item.save
- render :show, status: :created, location: @task_item
+ render :show, status: :created, location: [@task_list, @task_item]
else
render json: @task_item.errors, status: :unprocessable_entity
end
@@ -17,7 +17,7 @@ class TaskItemsController < ApplicationController
def update
if @task_item.update(task_item_params)
- render :show, status: :ok, location: @task_item
+ render :show, status: :ok, location: [@task_list, @task_item]
else
render json: @task_item.errors, status: :unprocessable_entity
end
@@ -31,7 +31,7 @@ class TaskItemsController < ApplicationController
private
def task_item_params
- params.require(:task_item).permit(:name, :quantity)
+ params.require(:task_item).permit(:name, :quantity, :completed)
end
def set_task_list
diff --git a/app/controllers/task_lists_controller.rb b/app/controllers/task_lists_controller.rb
index 54086dd..99254fe 100644
--- a/app/controllers/task_lists_controller.rb
+++ b/app/controllers/task_lists_controller.rb
@@ -4,7 +4,7 @@ class TaskListsController < ApplicationController
before_action :set_task_list, only: [:show, :update, :destroy]
def index
- @task_lists = TaskList.for_user(current_user).order(created_at: :desc)
+ @task_lists = TaskList.for_user(current_user).includes(:task_items).order(created_at: :desc)
end
def show
diff --git a/app/javascript/components/App.vue b/app/javascript/components/App.vue
index 3df7376..f77e325 100644
--- a/app/javascript/components/App.vue
+++ b/app/javascript/components/App.vue
@@ -46,27 +46,7 @@
created() {
if (this.user === null && this.authChecked === false) {
this.checkAuthentication();
- }
-
- // Hard coded values taken directly from Bulma css
- const mediaQueries = {
- mobile: "screen and (max-width: 768px)",
- tablet: "screen and (min-width: 769px)",
- tabletOnly: "screen and (min-width: 769px) and (max-width: 1023px)",
- touch: "screen and (max-width: 1023px)",
- desktop: "screen and (min-width: 1024px)",
- desktopOnly: "screen and (min-width: 1024px) and (max-width: 1215px)",
- widescreen: "screen and (min-width: 1216px)",
- widescreenOnly: "screen and (min-width: 1216px) and (max-width: 1407px)",
- fullhd: "screen and (min-width: 1408px)"
- };
-
- for (let device in mediaQueries) {
- const query = window.matchMedia(mediaQueries[device]);
- query.onchange = (q) => {
- this.$store.commit("setMediaQuery", {mediaName: device, value: q.matches});
- };
- query.onchange(query);
+
}
},
diff --git a/app/javascript/components/AppModal.vue b/app/javascript/components/AppModal.vue
index f015190..c9cf5bf 100644
--- a/app/javascript/components/AppModal.vue
+++ b/app/javascript/components/AppModal.vue
@@ -6,7 +6,7 @@
{{ title }}
@@ -17,8 +17,12 @@ | |||
---|---|---|---|
+ | |||
+
+
+ |
{{ i.name }} | {{ i.quantity }} | @@ -36,40 +40,83 @@ |