-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.txt
122 lines (73 loc) · 3.07 KB
/
README.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
Creating a new Valet service
============================
Valet has gone through a few different code arrangements.
Barnard-Remote uses the most current arrangement.
Update app_config.yml
---------------------
Your new service should have a section in app_config with
some basic settings filled in. Type can be 'form' or 'bounce'.
paging:
label: 'Paging'
authenticate: true
type: bounce
Update routes.rb
---------------------
Your new service should be one of the many service-names
listed which map to controller: 'forms'
resources :paging,
:ill,
:docdel,
:in_process,
:precat,
:itemfeedback,
:notonshelf,
:barnard_remote,
controller: 'forms',
only: [:show, :create]
Create service-specific library
-------------------------------
Within /app/lib/service/ create a new .rb file for the service.
Minimally, you need this:
module Service
class Paging < Service::Base
end
end
But add in any other logic you need, refer to base.rb for
what methods to override, and look at other services for
examples of override logic.
Bounce - redirect browser to another URL
----------------------------------------
Services configured as type:bounce, need to implement:
build_service_url(params, bib_record, current_user)
If the service is linked directly from CLIO, then 'params' will
likely be just the bib id. That's already been used to fetch a
full ClioRecord object, which is the 2nd arg - the bib_record.
Form - build a Valet form
----------------------------------------
Services configured as type:form need a form.
The form should be in app/views/forms, and named after the services,
e.g., /app/views/forms/avery_onsite.html.erb
The form should try to re-use partials if possible.
Optional - create confirmation page
-----------------------------------
If after collecting information you'd like this service to redirect
to a confirmation page, you'll need to do two things:
1) write a get_confirmation_locals() method, to gather local variables,
2) write an /app/views/forms/SERVICE_confirm.html.erb form, to display the variables
Optional - send email
---------------------
If after collection information you'd like this service to send
email, you'll need to do three things:
1) write a send_emails() method, which will gather params
2) add a method to /app/mailers/form_mailer.rb to process params and send mail
3) write mail template, named the same as the method, under /app/views/form_mailer/SERVICE.text.erb
Supporting services without a bib argument
---------------------
The basic Valet structure assumes that each service takes a single param, the bib id.
Some services support a simple redirect without a bib id, and need special setup.
These services still use Valet-based authentication and logging.
1) Add a route to the "SIMPLE REDIRECT SERVICES" section of routes.rb
get 'illiad', action: :show, controller: 'forms'
2) Add a new key to the app_config.yml section for this service:
bib_optional: true
3) Setup the rest as usual