Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/models/referral/link.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ module Referral
class Link < ApplicationRecord
include Hashid::Rails

validates :slug, uniqueness: true

belongs_to :program, class_name: "Referral::Program"
belongs_to :creator, class_name: "User"

Expand Down
6 changes: 3 additions & 3 deletions app/views/admin/referral_programs.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<section data-behavior="modal" id="referral_program_<%= program.id %>" class="modal" role="dialog">
<div class="modal__content">
<header class="modal__header">
<h2 class="modal__title">Create Referral Link for <%= program.name %></h2>
<h2 class="modal__title">Create referral link for <%= program.name %></h2>
<button class="modal__close" data-behavior="modal_close" aria-label="Close modal">&times;</button>
</header>
<div class="modal__body">
Expand All @@ -48,10 +48,10 @@
<%= form.label :name, "Link name" %>
<%= form.text_field :name, placeholder: "Reddit Post", required: true, class: "w-100" %>
<br>
<%= form.label :slug, "Custom slug" %>
<%= form.label :slug, "Custom slug (optional)" %>
<%= form.text_field :slug, placeholder: "my-custom-slug", class: "w-100" %>
<br>
<%= form.submit "Create Link", class: "bg-success" %>
<%= form.submit "Create link", class: "bg-success" %>
</fieldset>
<% end %>
</div>
Expand Down