Skip to content

Commit

Permalink
Create teams controller and adjust navbar
Browse files Browse the repository at this point in the history
  • Loading branch information
canan8 committed May 16, 2020
1 parent d916dca commit a951380
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 19 deletions.
3 changes: 3 additions & 0 deletions app/assets/stylesheets/teams.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Place all the styles related to the teams controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: https://sass-lang.com/
5 changes: 5 additions & 0 deletions app/controllers/teams_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class TeamsController < ApplicationController
def index
@teams = Team.all
end
end
2 changes: 2 additions & 0 deletions app/helpers/teams_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module TeamsHelper
end
10 changes: 5 additions & 5 deletions app/javascript/packs/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ require('jquery')
//
// const images = require.context('../images', true)
// const imagePath = (name) => images(name, true)
// $( document ).ready(function() {
// $('.ui.dropdown').dropdown();
// });

$(document).on('turbolinks:load', function() {
$('.item').click(function(e) {
$('.active').removeClass('active');
$(this).addClass('active');
});
$(document).on('turbolinks:load', function () {
// $('.ui.dropdown').dropdown(); use this later on @canan
})
23 changes: 12 additions & 11 deletions app/views/layouts/_navigation.html.erb
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
<div class="ui inverted segment">
<div class="ui inverted secondary pointing menu">
<a class="active item">
Home
</a>
<a class="item">
Teams
</a>
<a class="item">
Account
</a>
<%= link_to 'Pretro', root_path, class: 'item' %>
<%= link_to 'Home', root_path, class: 'item' %>
<%= link_to 'Teams', teams_path, class: 'item' %>
<div class="right menu">
<div class="ui simple dropdown item" id="dropdown">
Account <i class="dropdown icon"></i>
<div class="menu">
<%= link_to 'Profile', root_path, class: 'item' %>
<%= link_to 'Settings', root_path, class: 'item' %>
<div class="divider"></div>
<%= link_to 'Log out', root_path, class: 'item' %>
</div>
</div>
</div>
8 changes: 5 additions & 3 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@
</head>

<body>
<div class="ui container">
<%= render 'layouts/navigation' %>
<%= yield %>
<div class="ui inverted menu">
<div class="ui container">
<%= render 'layouts/navigation'%>
</div>
</div>
<%= yield %>
</body>
</html>
5 changes: 5 additions & 0 deletions app/views/teams/index.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<% @teams.each do |team| %>
<ul>
<li> <%= team.name %> </li>
</ul>
<% end %>
1 change: 1 addition & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
devise_for :users
resources :users, only: [:show, :index]
root 'welcome#index'
get 'teams', to: 'teams#index'
end
7 changes: 7 additions & 0 deletions test/controllers/teams_controller_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
require 'test_helper'

class TeamsControllerTest < ActionDispatch::IntegrationTest
# test "the truth" do
# assert true
# end
end

0 comments on commit a951380

Please sign in to comment.