All basic question types
This commit is contained in:
parent
3e1e5618ca
commit
4fe218166f
51 changed files with 760 additions and 92 deletions
|
@ -3,23 +3,18 @@
|
|||
<head>
|
||||
<title><%= content_for(:title) || "Entrance Exam" %></title>
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="mobile-web-app-capable" content="yes">
|
||||
<%= csrf_meta_tags %>
|
||||
<%= csp_meta_tag %>
|
||||
|
||||
<%= yield :head %>
|
||||
|
||||
<%# Enable PWA manifest for installable apps (make sure to enable in config/routes.rb too!) %>
|
||||
<%#= tag.link rel: "manifest", href: pwa_manifest_path(format: :json) %>
|
||||
|
||||
<link rel="icon" href="/icon.png" type="image/png">
|
||||
<link rel="icon" href="/icon.svg" type="image/svg+xml">
|
||||
<link rel="apple-touch-icon" href="/icon.png">
|
||||
|
||||
<%# Includes all stylesheet files in app/assets/stylesheets %>
|
||||
<%= stylesheet_link_tag :app %>
|
||||
<%= javascript_include_tag "application", "data-turbo-track": "reload", type: "module" %>
|
||||
<%= javascript_include_tag "application" %>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
|
|
@ -1,22 +0,0 @@
|
|||
{
|
||||
"name": "EntranceExam",
|
||||
"icons": [
|
||||
{
|
||||
"src": "/icon.png",
|
||||
"type": "image/png",
|
||||
"sizes": "512x512"
|
||||
},
|
||||
{
|
||||
"src": "/icon.png",
|
||||
"type": "image/png",
|
||||
"sizes": "512x512",
|
||||
"purpose": "maskable"
|
||||
}
|
||||
],
|
||||
"start_url": "/",
|
||||
"display": "standalone",
|
||||
"scope": "/",
|
||||
"description": "EntranceExam.",
|
||||
"theme_color": "red",
|
||||
"background_color": "red"
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
// Add a service worker for processing Web Push notifications:
|
||||
//
|
||||
// self.addEventListener("push", async (event) => {
|
||||
// const { title, options } = await event.data.json()
|
||||
// event.waitUntil(self.registration.showNotification(title, options))
|
||||
// })
|
||||
//
|
||||
// self.addEventListener("notificationclick", function(event) {
|
||||
// event.notification.close()
|
||||
// event.waitUntil(
|
||||
// clients.matchAll({ type: "window" }).then((clientList) => {
|
||||
// for (let i = 0; i < clientList.length; i++) {
|
||||
// let client = clientList[i]
|
||||
// let clientPath = (new URL(client.url)).pathname
|
||||
//
|
||||
// if (clientPath == event.notification.data.path && "focus" in client) {
|
||||
// return client.focus()
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (clients.openWindow) {
|
||||
// return clients.openWindow(event.notification.data.path)
|
||||
// }
|
||||
// })
|
||||
// )
|
||||
// })
|
12
app/views/questions/_image_form.html.erb
Normal file
12
app/views/questions/_image_form.html.erb
Normal file
|
@ -0,0 +1,12 @@
|
|||
<div id="<%= "question_answer_#{question.id}_preview" %>">
|
||||
<% if question.answer.present? %>
|
||||
<%= image_tag question.answer.image %>
|
||||
<% end %>
|
||||
</div>
|
||||
<input id="<%= "question_answer_#{question.id}" %>"
|
||||
type="file"
|
||||
accept=".jpg,.jpeg,.png,.webp,image/jpg,image/jpeg,image/png,image/webp"
|
||||
autocomplete="off"
|
||||
data-behaviour="question_image_input"
|
||||
data-submit-url="<%= answer_question_url(question.id) %>"
|
||||
/>
|
3
app/views/questions/_politicians_form.html.erb
Normal file
3
app/views/questions/_politicians_form.html.erb
Normal file
|
@ -0,0 +1,3 @@
|
|||
<div>
|
||||
This one's going to be hard...
|
||||
</div>
|
7
app/views/questions/_simple_form.html.erb
Normal file
7
app/views/questions/_simple_form.html.erb
Normal file
|
@ -0,0 +1,7 @@
|
|||
<input id="<%= "question_answer_#{question.id}" %>"
|
||||
type="text"
|
||||
value="<%= question.answer&.data || '' %>"
|
||||
autocomplete="off"
|
||||
data-behaviour="question_simple_input"
|
||||
data-submit-url="<%= answer_question_url(question.id) %>"
|
||||
/>
|
1
app/views/questions/_simple_show.html.erb
Normal file
1
app/views/questions/_simple_show.html.erb
Normal file
|
@ -0,0 +1 @@
|
|||
<%= question.text %>
|
1
app/views/questions/_video_show.html.erb
Normal file
1
app/views/questions/_video_show.html.erb
Normal file
|
@ -0,0 +1 @@
|
|||
<video src="<%= question.public_asset_path %>" controls preload="metadata"></video>
|
5
app/views/sections/index.html.erb
Normal file
5
app/views/sections/index.html.erb
Normal file
|
@ -0,0 +1,5 @@
|
|||
<% @sections.each do |section| %>
|
||||
<p>
|
||||
<%= link_to section.title, section_url(section) %>
|
||||
</p>
|
||||
<% end %>
|
10
app/views/sections/show.html.erb
Normal file
10
app/views/sections/show.html.erb
Normal file
|
@ -0,0 +1,10 @@
|
|||
<h4><%= @section.title %></h4>
|
||||
|
||||
<p><%= @section.description %></p>
|
||||
|
||||
<% @questions.each do |question| %>
|
||||
<section>
|
||||
<%= render partial: "questions/#{question.question_kind}_show", locals: { question: } %>
|
||||
<%= render partial: "questions/#{question.answer_kind}_form", locals: { question: } %>
|
||||
</section>
|
||||
<% end %>
|
5
app/views/sessions/new.html.erb
Normal file
5
app/views/sessions/new.html.erb
Normal file
|
@ -0,0 +1,5 @@
|
|||
<%= form_with url: sessions_path, method: :post do |form| %>
|
||||
<%= form.label :token, "Token" %>
|
||||
<%= form.password_field :token %>
|
||||
<%= form.submit "Start exam" %>
|
||||
<% end %>
|
Loading…
Add table
Add a link
Reference in a new issue