Quiz

source: https://github.com/sms516/quiz
online: http://dojang.nz/

Installation:

  1. Create a new laravel project:

     
  2. Download the app from https://github.com/sms516/quiz. It’s better to donwload in zip file then extract the content in /works/laravel/quiz/ directory. Overwrite the existing files and directories.
  3. Install the laravel component required:

     
  4. Import the database file (DB_SETUP.sql) along with the github.
    NOTE: ‘quiz_details’ table can’t be created because the field type ‘datetime CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP’ for ‘updated_at’ can’t be used. So replace ‘datetime’ with ‘timestamp’
  5. Set the file/folder permission for ‘storage’
  6. Test it live (http://localhost:8000/admin)

    WORKING!!!quiz-frontCAN’T SHOW http://localhost:8000/admin BUT CAN SHOW http://localhost:8000/admin/quiz/questionsquiz-admin-questionNOTE: Check the routes in /app/Http/routes.php. The routes are very limited! NO ROUTE FOR ADMIN???
  7. I found gulpfile.js in the root of the website, so I think I need to use npm and gulp to compile the saas:
    Use ‘npm install’ to install required modules

    Use ‘gulp’ to compile saas

    I DONT KNOW HOW TO DO NEXT OR HOW THE NPM AND GULP AFFECT THE WEBSITE! NEED TO LEARN ABOUT THESE!!!
  8. On the homepage ‘http://localhost:8000’, I clicked ‘Start Quiz’ button but I got NOT FOUND error (ajax error) at the chrome console. I found it is triggered by ‘onclick=”startQuiz()”‘ in /resources/views/quiz/view.blade.php and the javascript command in /public/js/functions.js. I NEED TO MODIFY A FEW SETTING IN functions.js file! First replace the ‘base_dir’ variable like below:

    FROM NOW ON, I HAVE TO USE ‘http://localhost/works/laravel/quiz/public/’ INSTEAD OF ‘http://localhost:8000’! FOR HOMEPAGE AND ‘http://localhost/works/laravel/quiz/public/admin/quiz/questions’ FOR ADMIN PAGE!
    NOW THE AJAX IS WORKING!! ‘Start Quiz’ button IS WORKING!
    Another errors detected:

    Sometimes I got unknow error when trying to edit the question (http://localhost/works/laravel/quiz/public/admin/quiz/question/376).
    Solution: I need to put ‘ini_set(‘display_errors’,1);’ in /app/Http/routes.php to enable to debug the errors. It seems the ‘storage’ directory HAS NOT BEEN SET THE PERMISSION. So make sure the step #5 is executed first!
  9. Improvements:
    Many links in the admin page can’t be opened or don’t have the correct routes. Here I want to fix or develop the links.
    Club Admin (http://localhost/works/laravel/quiz/public/admin/club)
    Add a new route in /app/Http/routes.php

    Create a new controller ‘ClubController.php’ in /app/Http/Controllers/

    The ‘Club’ model is already exist in /app/models/ directory! Here we want to show all the club in our database!
    The data would be showed up by /resources/views/club/view.blade.php like this:quiz-view-clubsAdd/Save New Club (http://localhost/works/laravel/quiz/public/admin/club/add)
    Add two new routes in /app/Http/routes.php

    Modify a controller ‘ClubController.php’ in /app/Http/Controllers/

    Add/modify a model ‘Club.php’ in /app/models/ directory:

    Add new model ‘MartialArt.php’ in /app/models/ directory:

    Add a new blade template ‘add.blade.php’ in /resources/views/club/ directory

    OK. then make a test at http://localhost/works/laravel/quiz/public/admin/club/add.quiz-add-clubI got this club sample from Kumgang Tae Kwon Do website. Then save the data by clicking ‘Add Club’. Here is the working result:quiz-club-savedEdit/Save Club (http://localhost/works/laravel/quiz/public/admin/club/edit/4)
    First I need to put ‘Edit’ link on the club admin page (http://localhost/works/laravel/quiz/public/admin/club). Modify ‘view.blade.php’ in /resources/views/club/ directory. Modify the header table to show/hide the needed field (add class ‘all’ to show and ‘none’ to hide)

    Then arrange the field width by defining the columns (‘columnDefs’) like this:

    So here is the new looksquiz-club-view-editTo make the ‘Edit’ links work, add two new routes in /app/Http/routes.php

    Then Modify ‘ClubController.php’ in /app/Http/Controllers/ dir:

    Add/Modify ‘edit.blade.php’ in /resources/views/club/ directory:

    OK. Now the Club admin can be used properly.
    NOTES: When I save the new club or the edited club, I don’t find the flash status to show the data is saved/updated successfully!
    HOW TO DELETE CLUB???

Leave a Reply

Your email address will not be published. Required fields are marked *