So far, we have setup everything in a the config.js file in the root folder. As we start to build a setting page, we will store our settings in MongoDB database, just like other data. However, we need to build a setting page in the dashboard first before doing anything else with the database.

 

<!--views/admin/setting.ejs-->
<link href="/styles/admin/setting.css" rel="stylesheet"></link>

    <div class='Setting'>
        <form action='/admin/setting' method='post' >
            <a>ឈ្មោះគេហទំព័រ</a><input type='text' value="" name='siteTitle' required />
            <a>អំពី​គេហទំព័រ</a><input type='text' value="" name='description' required />
            <a>ទិន្នន័យ​ផ្នែក​​ក្នុង</a><input type='text' value="" name='maxPosts' required /> 
            <a>ទិន្នន័យខាង​​មុខ​</a><input type='text' value="" name='indexPostLimit' required /> 
            <a>ទិន្នន័យ​ជំពូក​</a><input type='text' value="" name='categoryPostLimit' required /> 
            <a></a><input type='submit' value='បញ្ជូនទិន្នន័យ' />
        </form>
    </div>

 

/* static/styles/admin/setting.css */
.Setting form{
    width: 60%;
    display: grid;
    grid-template-columns: 20% 80%;
    grid-gap: 5px;
    align-items: center;
}
 
.Setting form input[type=submit],
.Setting form input{
    font: var(--body-font);
    padding: 5px 10px;
}
 
.Setting form a{
    text-align: right;
    color: white;
}

 

 

GitHub: https://github.com/Sokhavuth/khmerweb-job

Heroku: https://khmerweb-job.herokuapp.com