Compare commits
	
		
			2 Commits
		
	
	
		
			4d32f9e7f0
			...
			658c50fd04
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 658c50fd04 | |||
| 5339a864c0 | 
@@ -53,6 +53,6 @@ class PuzzlesController < ApplicationController
 | 
				
			|||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def puzzle_params
 | 
					  def puzzle_params
 | 
				
			||||||
    params.expect(puzzle: [ :name, :image ])
 | 
					    params.expect(puzzle: [ :brand, :name, :image ])
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2,4 +2,5 @@ class Puzzle < ApplicationRecord
 | 
				
			|||||||
  belongs_to :contest
 | 
					  belongs_to :contest
 | 
				
			||||||
  has_one_attached :image
 | 
					  has_one_attached :image
 | 
				
			||||||
  validates :name, presence: true
 | 
					  validates :name, presence: true
 | 
				
			||||||
 | 
					  validates :brand, presence: true
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -11,7 +11,7 @@
 | 
				
			|||||||
        | Edit contest
 | 
					        | Edit contest
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.row.mb-4
 | 
					.row.mb-4
 | 
				
			||||||
  .col
 | 
					  .col-sm-6
 | 
				
			||||||
    .row
 | 
					    .row
 | 
				
			||||||
      .col
 | 
					      .col
 | 
				
			||||||
        h4
 | 
					        h4
 | 
				
			||||||
@@ -27,11 +27,11 @@
 | 
				
			|||||||
            = image_tag puzzle.image if puzzle.image.attached?
 | 
					            = image_tag puzzle.image if puzzle.image.attached?
 | 
				
			||||||
            .card-body
 | 
					            .card-body
 | 
				
			||||||
              p.card-text
 | 
					              p.card-text
 | 
				
			||||||
                | TODO puzzle.brand
 | 
					                = puzzle.brand
 | 
				
			||||||
              a.stretched-link href=edit_contest_puzzle_path(@contest, puzzle)
 | 
					              a.stretched-link href=edit_contest_puzzle_path(@contest, puzzle)
 | 
				
			||||||
    .row
 | 
					    .row
 | 
				
			||||||
      .col
 | 
					      .col
 | 
				
			||||||
        a.btn.btn-primary href=new_contest_puzzle_path(@contest)
 | 
					        a.btn.btn-primary href=new_contest_puzzle_path(@contest)
 | 
				
			||||||
          | Add puzzle
 | 
					          | Add puzzle
 | 
				
			||||||
  .col
 | 
					  .col-sm-6
 | 
				
			||||||
    h4 Teams
 | 
					    h4 Teams
 | 
				
			||||||
@@ -4,6 +4,11 @@
 | 
				
			|||||||
      .form-floating
 | 
					      .form-floating
 | 
				
			||||||
        = form.text_field :name, autocomplete: "off", class: "form-control"
 | 
					        = form.text_field :name, autocomplete: "off", class: "form-control"
 | 
				
			||||||
        = form.label :name, class: "required"
 | 
					        = form.label :name, class: "required"
 | 
				
			||||||
 | 
					  .row.mb-3
 | 
				
			||||||
 | 
					    .col
 | 
				
			||||||
 | 
					      .form-floating
 | 
				
			||||||
 | 
					        = form.text_field :brand, autocomplete: "off", class: "form-control"
 | 
				
			||||||
 | 
					        = form.label :brand, class: "required"
 | 
				
			||||||
  .row.mb-3
 | 
					  .row.mb-3
 | 
				
			||||||
    .col
 | 
					    .col
 | 
				
			||||||
      .form-text Select an image
 | 
					      .form-text Select an image
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										5
									
								
								db/migrate/20250320075601_add_brand_to_puzzle.rb
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								db/migrate/20250320075601_add_brand_to_puzzle.rb
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,5 @@
 | 
				
			|||||||
 | 
					class AddBrandToPuzzle < ActiveRecord::Migration[8.0]
 | 
				
			||||||
 | 
					  def change
 | 
				
			||||||
 | 
					    add_column :puzzles, :brand, :string
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
							
								
								
									
										3
									
								
								db/schema.rb
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										3
									
								
								db/schema.rb
									
									
									
										generated
									
									
									
								
							@@ -10,7 +10,7 @@
 | 
				
			|||||||
#
 | 
					#
 | 
				
			||||||
# It's strongly recommended that you check this file into your version control system.
 | 
					# It's strongly recommended that you check this file into your version control system.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ActiveRecord::Schema[8.0].define(version: 2025_03_15_124339) do
 | 
					ActiveRecord::Schema[8.0].define(version: 2025_03_20_075601) do
 | 
				
			||||||
  create_table "active_storage_attachments", force: :cascade do |t|
 | 
					  create_table "active_storage_attachments", force: :cascade do |t|
 | 
				
			||||||
    t.string "name", null: false
 | 
					    t.string "name", null: false
 | 
				
			||||||
    t.string "record_type", null: false
 | 
					    t.string "record_type", null: false
 | 
				
			||||||
@@ -54,6 +54,7 @@ ActiveRecord::Schema[8.0].define(version: 2025_03_15_124339) do
 | 
				
			|||||||
    t.datetime "created_at", null: false
 | 
					    t.datetime "created_at", null: false
 | 
				
			||||||
    t.datetime "updated_at", null: false
 | 
					    t.datetime "updated_at", null: false
 | 
				
			||||||
    t.integer "contest_id", null: false
 | 
					    t.integer "contest_id", null: false
 | 
				
			||||||
 | 
					    t.string "brand"
 | 
				
			||||||
    t.index ["contest_id"], name: "index_puzzles_on_contest_id"
 | 
					    t.index ["contest_id"], name: "index_puzzles_on_contest_id"
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user