Skip to content
This repository has been archived by the owner on Mar 6, 2024. It is now read-only.

Commit

Permalink
feat: allow links in navbar
Browse files Browse the repository at this point in the history
  • Loading branch information
darccio committed May 1, 2023
1 parent 32b681d commit 02d03ef
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 1 deletion.
4 changes: 4 additions & 0 deletions app/models/link.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# frozen_string_literal: true

class Link < ApplicationRecord
end
5 changes: 5 additions & 0 deletions app/views/application/_navbar.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@
</li>
</ul>
<ul class="navbar-nav">
<% Link.all.each do |link| %>
<li class="nav-item">
<%= link_to link.name, link.url, class: 'nav-link' %>
</li>
<% end %>
<li class="nav-item">
<%= link_to t('application.log_out'), session_path('current'), method: :delete, class: 'nav-link' %>
</li>
Expand Down
12 changes: 12 additions & 0 deletions db/migrate/20230501111239_create_links.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# frozen_string_literal: true

class CreateLinks < ActiveRecord::Migration[7.0]
def change
create_table :links do |t|
t.string :url
t.string :name

t.timestamps
end
end
end
9 changes: 8 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema[7.0].define(version: 2023_04_21_151747) do
ActiveRecord::Schema[7.0].define(version: 2023_05_01_111239) do
create_table "active_storage_attachments", force: :cascade do |t|
t.string "name", null: false
t.string "record_type", null: false
Expand Down Expand Up @@ -80,6 +80,13 @@
t.datetime "updated_at", null: false
end

create_table "links", force: :cascade do |t|
t.string "url"
t.string "name"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end

create_table "options", force: :cascade do |t|
t.string "value"
t.string "description"
Expand Down

0 comments on commit 02d03ef

Please sign in to comment.