From d916dca719793417f50c46d6afcee30ede481ca0 Mon Sep 17 00:00:00 2001 From: Canan Date: Thu, 14 May 2020 01:36:07 +0300 Subject: [PATCH] Add navigation bar --- app/javascript/packs/application.js | 7 +++++++ app/views/layouts/_navigation.html.erb | 13 +++++++++++++ app/views/layouts/application.html.erb | 5 ++++- 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 app/views/layouts/_navigation.html.erb diff --git a/app/javascript/packs/application.js b/app/javascript/packs/application.js index 7307657..ab518e4 100644 --- a/app/javascript/packs/application.js +++ b/app/javascript/packs/application.js @@ -16,3 +16,10 @@ require('jquery') // // const images = require.context('../images', true) // const imagePath = (name) => images(name, true) + +$(document).on('turbolinks:load', function() { + $('.item').click(function(e) { + $('.active').removeClass('active'); + $(this).addClass('active'); +}); +}) \ No newline at end of file diff --git a/app/views/layouts/_navigation.html.erb b/app/views/layouts/_navigation.html.erb new file mode 100644 index 0000000..a6de208 --- /dev/null +++ b/app/views/layouts/_navigation.html.erb @@ -0,0 +1,13 @@ +
+ +
\ No newline at end of file diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 2958b53..a105372 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -10,6 +10,9 @@ - <%= yield %> +
+ <%= render 'layouts/navigation' %> + <%= yield %> +