-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added view for rendering categories, quizzes and questions
- Loading branch information
1 parent
341c5f4
commit 71798f1
Showing
31 changed files
with
246 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// Place all the styles related to the Categories controller here. | ||
// They will automatically be included in application.css. | ||
// You can use Sass (SCSS) here: https://sass-lang.com/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// Place all the styles related to the Quiz controller here. | ||
// They will automatically be included in application.css. | ||
// You can use Sass (SCSS) here: https://sass-lang.com/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
class CategoriesController < ApplicationController | ||
def show | ||
@questions = Question.where(category_id: params[:id]) | ||
|
||
category = Category.find(params[:id]) | ||
@multiply = category.multiply | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
class QuizController < ApplicationController | ||
|
||
def show | ||
@quiz = Quiz.find(params[:id]) | ||
@categories = Category.where(quiz_id: @quiz.id) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
module CategoriesHelper | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
module QuizHelper | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<h1>Questions</h1> | ||
|
||
<% if @questions.any? %> | ||
|
||
<%= form_with do |f| %> | ||
|
||
<ul> | ||
<% @questions.each do |question| %> | ||
<li><%= question.title %></li> | ||
<hr> | ||
<ul> | ||
<% if @multiply %> | ||
<%= f.collection_check_boxes :answer_id, Answer.where(question_id: question.id), :id, :title_en %> | ||
<% else %> | ||
<%= f.collection_radio_buttons :answer_id, Answer.where(question_id: question.id), :id, :title_en %> | ||
<% end %> | ||
</ul> | ||
<% end %> | ||
</ul> | ||
|
||
<% end %> | ||
<% else %> | ||
<p>No any questions</p> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,16 @@ | ||
<h1>Home#index</h1> | ||
<p>Find me in app/views/home/index.html.erb</p> | ||
<h1>Home</h1> | ||
|
||
<h2>Quizzes:</h2> | ||
<% if @quizzes.any? %> | ||
<ul> | ||
<% @quizzes.each do |quiz| %> | ||
<li> | ||
<%= link_to quiz_path(quiz) do %> | ||
<%= quiz.title %> | ||
<% end %> | ||
</li> | ||
<% end %> | ||
</ul> | ||
<% else %> | ||
<p>No any quizzes</p> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<h1> | ||
Choose your category | ||
</h1> | ||
|
||
<% if @categories.any? %> | ||
<ul> | ||
<% @categories.each do |category| %> | ||
<li> | ||
<%= link_to category_path(category) do %> | ||
<%= category.title %> | ||
<% end %> | ||
</li> | ||
<% end %> | ||
</ul> | ||
<% else %> | ||
<p>No Any Categories</p> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
nmmjPIYi31KQUAt4zkUVSZ+QrImBJF6b4nRsg7/J8DHuMWT0otIk4eOrZs6E2HvFSbxqx3kyjkDIjzPLPYI9/YX9z9Z5ZDGxMlPBmAbsXXtyAFp2g8e5Bjw64VzQhQmqQWkn20LWw13rcKFabn1hRgB0bx3/U12dqzD0SAslQSYpsxZWgH195Ivtt2f49VIAd0f9C86Fk/FmyUE/N3aXMtAcC9GZDZdfw3SOX/pSE+B0Zo97Cg+uKuwTne72FRQlMGRK/PiGkrtXeuedTiao7e1lwPIrqOrkvVXBuJ+4oiTzgNwWwILj/YAEWIi1BbtLYClkXiCIJy5q4xX1FfBqMl835Qi4V6AaYun7okObrVF9mji4BM1AkTQNmtjzSMP2fqu1n7gAgFPV0la6eVEVxFWNUBhXN0X8bA+P--b7GlQ5hc2O48fwW/--fyvygLf/+b1saj1gUuWRqw== | ||
jI2cuUFqWtfsPyA8z2Xh88MEaEOcLYeK6G9G8BAvWjdFB6vTBLo8OmVsH7fbGl+ZInR4EeUDrXUO2Xq4uZw0vcxw95TDnIvaxdWHdMIXbvXSPOSlFY8o9/tQujlU6kefhb0mJa0jXPlepgzqJ6xc8AzeVURr1geBMGvG7lazNEkDRwLgfxHAtNw3jUpe4SatYghlXsw6CQ772HvxlJtICpGT5saisELmttWXPZee2zahy2eWUQBSqYtYiqduVwY5vy8ngDRqS6dLYcYdaMikWH4rGI63ADYRkfs94guext6SjY1mriVrzCnqCI0AyMesPpHe6e6GBah1tmaz/iRSXXJ8B+aSi5iuR88WtcHiJSyPaAQryrQrKb4yZoKpTSBqNaVlUOGMrBnyCRRJ60QNapG4FDGkL9QX5CNT--hJE7dOrJqQIG4+Fm--qJLYUILiJwMR5xzEO1ofBQ== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,15 @@ | ||
require_relative 'production' | ||
require_relative 'production' | ||
|
||
Rails.application.configure do | ||
# Settings specified here will take precedence over those in config/application.rb. | ||
|
||
require 'syslog/logger' | ||
config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new(ENV['app_name'] || 'accreditation')) | ||
|
||
# Enable stdout logger | ||
config.logger = Logger.new(STDOUT) | ||
|
||
# Set log level | ||
config.log_level = :ERROR | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
process.env.NODE_ENV = process.env.NODE_ENV || 'staging' | ||
|
||
const environment = require('./environment') | ||
|
||
module.exports = environment.toWebpackConfig() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class AddNewFieldToCategories < ActiveRecord::Migration[6.1] | ||
def change | ||
add_column :categories, :multiply, :boolean | ||
end | ||
end |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.