File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ class CurationsController < ApplicationController
2+ before_action :authenticate_curator!
3+ before_action :set_curation , only : %i[ update ]
4+
5+ # POST /curations
6+ def create
7+ @curation = Curation . new ( curation_params )
8+
9+ if @curation . save
10+ flash [ :notice ] = 'Curation tracking registered'
11+ else
12+ flash . now [ :danger ] = 'Curation tracking could not be registered'
13+ end
14+ redirect_back ( fallback_location : curation . name &.register )
15+ end
16+
17+ # POST /curations/1
18+ def update
19+ if @curation . update ( curation_params )
20+ flash [ :notice ] = 'Curation tracking registered'
21+ else
22+ flash . now [ :danger ] = 'Curation tracking could not be registered'
23+ end
24+ redirect_back ( fallback_location : curation . name &.register )
25+ end
26+
27+ private
28+ def set_curation
29+ @curation = Curation . find ( params [ :id ] )
30+ end
31+
32+ # Only allow a list of trusted parameters through.
33+ def curation_params
34+ params
35+ . require ( :curation )
36+ . permit ( :name_id , :status_int , :notes )
37+ . merge ( user : current_user )
38+ end
39+ end
Original file line number Diff line number Diff line change 4343 < dd >
4444 <% curation = name . curation_kind ( k ) %>
4545 <%= simple_form_for ( curation ) do |f | %>
46- <%= f . input ( :name , as : :hidden ) %>
46+ <%= f . input ( :name_id , as : :hidden ) %>
4747 < div class ="text-<%= curation . color %> mb-3 ">
4848 < b > Current status:</ b >
4949 <%= curation . status . to_s . capitalize %>
You can’t perform that action at this time.
0 commit comments