Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelSipayung committed Feb 1, 2024
2 parents 3456d40 + 6c948a9 commit 612c557
Show file tree
Hide file tree
Showing 366 changed files with 2,671 additions and 1,909 deletions.
19 changes: 0 additions & 19 deletions .idea/dataSources.xml

This file was deleted.

496 changes: 251 additions & 245 deletions .idea/sample_app.iml

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# frozen_string_literal: true

# current gem file
source 'https://rubygems.org'
ruby '3.1.4'
ruby '3.2.2'
# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
gem 'rails', '~> 7.1.2'

Expand Down Expand Up @@ -84,5 +86,5 @@ group :production do
gem 'mysql2'
# gem 'activerecord-mysql2-adapter'
end
#upload: validation, file format, and etc...
# upload: validation, file format, and etc...
gem 'active_storage_validations', '~> 0.9.2'
4 changes: 3 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# frozen_string_literal: true

# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.

require_relative "config/application"
require_relative 'config/application'

Rails.application.load_tasks
2 changes: 2 additions & 0 deletions app/channels/application_cable/channel.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module ApplicationCable
class Channel < ActionCable::Channel::Base
end
Expand Down
2 changes: 2 additions & 0 deletions app/channels/application_cable/connection.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module ApplicationCable
class Connection < ActionCable::Connection::Base
end
Expand Down
1 change: 1 addition & 0 deletions app/controllers/account_activations_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

# account activations controller : handle account activations
class AccountActivationsController < ApplicationController
before_action :logged_in_user, except: [:edit]
Expand Down
1 change: 1 addition & 0 deletions app/controllers/accreditation_school_lists_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

# accreditation controller : handle accreditation
class AccreditationSchoolListsController < ApplicationController
before_action :set_accreditation_school_list, only: %i[show edit update destroy]
Expand Down
1 change: 1 addition & 0 deletions app/controllers/achievement_kategori_lists_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

# achievement kategori list controller : handle achievement kategori list
class AchievementKategoriListsController < ApplicationController
before_action :set_achievement_kategori_list, only: %i[show edit update destroy]
Expand Down
1 change: 1 addition & 0 deletions app/controllers/achievement_tingkat_lists_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

# achievement tingkat list controller : handle achievement tingkat list
class AchievementTingkatListsController < ApplicationController
before_action :set_achievement_tingkat_list, only: %i[show edit update destroy]
Expand Down
1 change: 1 addition & 0 deletions app/controllers/achievements_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

# achievements controller : handle achievements
class AchievementsController < ApplicationController
before_action :set_achievement_dropdown_menu, only: %i[new create edit update]
Expand Down
1 change: 1 addition & 0 deletions app/controllers/address_kabupaten_lists_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

# address kabupaten list controller : handle address kabupaten list
class AddressKabupatenListsController < ApplicationController
before_action :set_address_kabupaten_list, only: %i[show edit update destroy]
Expand Down
1 change: 1 addition & 0 deletions app/controllers/address_kecamatan_lists_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

# adress kecamatan list controller : handle address kecamatan list
class AddressKecamatanListsController < ApplicationController
before_action :set_address_kecamatan_list, only: %i[show edit update destroy]
Expand Down
1 change: 1 addition & 0 deletions app/controllers/address_province_lists_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

# address province list controller : handle address province list
class AddressProvinceListsController < ApplicationController
before_action :set_address_province_list, only: %i[show edit update destroy]
Expand Down
1 change: 1 addition & 0 deletions app/controllers/addresses_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

# address controller : handle address
class AddressesController < ApplicationController
before_action :set_address_dropdown_menu, only: %i[new create edit update]
Expand Down
1 change: 1 addition & 0 deletions app/controllers/all_school_lists_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

# all school list controller : handle all school list
class AllSchoolListsController < ApplicationController
before_action :set_all_school_list, only: %i[show edit update destroy]
Expand Down
1 change: 1 addition & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

# application controller : handle application
class ApplicationController < ActionController::Base
before_action :logged_in_user # prevent to write before_action :logged_in_user in every controller
Expand Down
1 change: 1 addition & 0 deletions app/controllers/batch_lists_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

# batch list controller : handle batch list
class BatchListsController < ApplicationController
before_action :set_batch_list, only: %i[show edit update destroy]
Expand Down
1 change: 1 addition & 0 deletions app/controllers/extra_lists_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

# extra list controller : handle extra list
class ExtraListsController < ApplicationController
before_action :set_extra_list, only: %i[show edit update destroy]
Expand Down
1 change: 1 addition & 0 deletions app/controllers/extras_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

# extra controller : handle extra
class ExtrasController < ApplicationController
before_action :set_extra_dropdown_menu, only: %i[new create edit update]
Expand Down
1 change: 1 addition & 0 deletions app/controllers/high_school_majors_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

# high school major controller : handle high school major
class HighSchoolMajorsController < ApplicationController
before_action :set_high_school_major, only: %i[show edit update destroy]
Expand Down
1 change: 1 addition & 0 deletions app/controllers/language_degree_lists_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

# language degree list controller : handle language degree list
class LanguageDegreeListsController < ApplicationController
before_action :set_language_degree_list, only: %i[show edit update destroy]
Expand Down
1 change: 1 addition & 0 deletions app/controllers/language_name_lists_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

# language name list controller : handle language name list
class LanguageNameListsController < ApplicationController
before_action :set_language_name_list, only: %i[show edit update destroy]
Expand Down
1 change: 1 addition & 0 deletions app/controllers/languages_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

# language controller : handle language
class LanguagesController < ApplicationController
before_action :set_language_dropdown_menu, only: %i[new create edit update]
Expand Down
1 change: 1 addition & 0 deletions app/controllers/major_lists_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

# major list controller : handle major list
class MajorListsController < ApplicationController
before_action :set_major_list, only: %i[show edit update destroy]
Expand Down
3 changes: 2 additions & 1 deletion app/controllers/majors_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

# major controller : handle major
class MajorsController < ApplicationController
before_action :set_major_dropdown_menu, only: %i[new create edit update]
Expand Down Expand Up @@ -34,7 +35,7 @@ def show; end
private

def major_params
params.require(:major).permit(:jurusan_1, :jurusan_2, :jurusan_3, :gelombang)
params.require(:major).permit(:jurusan1, :jurusan2, :jurusan3, :gelombang)
end

def set_major_dropdown_menu
Expand Down
10 changes: 6 additions & 4 deletions app/controllers/microposts_controller.rb
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
# frozen_string_literal: true

# microposts controller : handle microposts
class MicropostsController < ApplicationController
# only login user could create and destroy it's post
before_action :logged_in_user, only: %i[create destroy]
before_action :correct_user, only: :destroy
# the present of current_user is to tell that create it by
# who already logged in and to make the current user post
# using build, since we work with collection, return new object of collection
# add image to newly created micropost object

def create
# the present of current_user is to tell that create it by
# who already logged in and to make the current user post
# using build, since we work with collection, return new object of collection
@micropost = current_user.microposts.build(micropost_params)
# add image to newly created micropost object
@micropost.image.attach(params[:micropost][:image])
if @micropost.save # save the post's current user
flash[:success] = 'Micropost created!'
Expand Down
1 change: 1 addition & 0 deletions app/controllers/organization_degree_lists_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

# organization degree list controller : handle organization degree list
class OrganizationDegreeListsController < ApplicationController
before_action :set_organization_degree_list, only: %i[show edit update destroy]
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/organizations_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

# organization controller : handle organization
class OrganizationsController < ApplicationController
before_action :set_organization_dropdown_menu, only: %i[new create edit update]
Expand Down Expand Up @@ -49,5 +50,4 @@ def current_organization
@organization = current_user.organizations.find_by(id: params[:id])
redirect_to root_url if @organization.nil?
end

end
1 change: 1 addition & 0 deletions app/controllers/parent_education_lists_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

# parent education list controller : handle parent education list
class ParentEducationListsController < ApplicationController
before_action :set_parent_education_list, only: %i[show edit update destroy]
Expand Down
1 change: 1 addition & 0 deletions app/controllers/parent_job_lists_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

# parent job list controller : handle parent job list
class ParentJobListsController < ApplicationController
before_action :set_parent_job_list, only: %i[show edit update destroy]
Expand Down
1 change: 1 addition & 0 deletions app/controllers/parents_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

# parents controller : handle parents data
class ParentsController < ApplicationController
before_action :set_parent_dropdown_menu, only: %i[new create edit update]
Expand Down
5 changes: 3 additions & 2 deletions app/controllers/password_resets_controller.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# frozen_string_literal: true

# password reset controller : handle password reset
class PasswordResetsController < ApplicationController
# Because confirmation of the existence of a valid @user
# is needed in both the update and edit actions
before_action :logged_in_user, except: %i[update new create edit]
before_action :get_user, only: %i[edit update]
before_action :find_user, only: %i[edit update]
before_action :valid_user, only: %i[edit update]
# make sure the reset password is not expired
before_action :check_expiration, only: %i[edit update]
Expand Down Expand Up @@ -41,7 +42,7 @@ def edit; end
private

# only valid user can get request edit password
def get_user
def find_user
@user = User.find_by(email: params[:email])
end

Expand Down
1 change: 1 addition & 0 deletions app/controllers/personal_gender_lists_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

# personal religion list controller : handle personal religion list
class PersonalGenderListsController < ApplicationController
before_action :set_personal_gender_list, only: %i[show edit update destroy]
Expand Down
1 change: 1 addition & 0 deletions app/controllers/personal_religion_lists_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

# personal religion list controller : handle personal religion list
class PersonalReligionListsController < ApplicationController
before_action :set_personal_religion_list, only: %i[show edit update destroy]
Expand Down
1 change: 1 addition & 0 deletions app/controllers/personals_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

# personal controller : handle personal data
class PersonalsController < ApplicationController
before_action :set_personal_dropdown_menu, only: %i[new create edit update]
Expand Down
11 changes: 6 additions & 5 deletions app/controllers/pmdk_each_score_informations_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

# pmdk each score controller : handle pmdk each score
class PmdkEachScoreInformationsController < ApplicationController
before_action :current_pmdk_each_score, only: %i[show edit update]
Expand Down Expand Up @@ -35,11 +36,11 @@ def show; end

def pmdk_each_score_information_params
params.require(:pmdk_each_score_information).permit(
:matematika_semester_1, :matematika_semester_2, :matematika_semester_3, :matematika_semester_4,
:matematika_semester_5, :kimia_semester_1, :kimia_semester_2, :kimia_semester_3, :kimia_semester_4,
:kimia_semester_5, :fisika_semester_1, :fisika_semester_2, :fisika_semester_3, :fisika_semester_4,
:fisika_semester_5, :bahasa_inggris_semester_1, :bahasa_inggris_semester_2, :bahasa_inggris_semester_3,
:bahasa_inggris_semester_4, :bahasa_inggris_semester_5, :sertifikat
:matematika_semester1, :matematika_semester2, :matematika_semester3, :matematika_semester4,
:matematika5, :kimia1, :kimia2, :kimia3, :kimia4,
:kimia5, :fisika1, :fisika2, :fisika3, :fisika4,
:fisika5, :inggris1, :inggris2, :inggris3,
:inggris4, :inggris5, :sertifikat
)
end

Expand Down
1 change: 1 addition & 0 deletions app/controllers/pmdk_school_lists_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

# pmdk school list controller : handle pmdk school list
class PmdkSchoolListsController < ApplicationController
before_action :set_pmdk_school_list, only: %i[show edit update destroy]
Expand Down
9 changes: 5 additions & 4 deletions app/controllers/pmdk_total_score_informations_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

# pmdk total score controller : handle pmdk total score
class PmdkTotalScoreInformationsController < ApplicationController
before_action :current_pmdk_total_score, only: %i[edit update show]
Expand Down Expand Up @@ -34,10 +35,10 @@ def show; end

def pmdk_total_score_params
params.require(:pmdk_total_score_information).permit(
:jumlah_nilai_semester_1, :jumlah_nilai_semester_2, :jumlah_nilai_semester_3,
:jumlah_nilai_semester_4, :jumlah_nilai_semester_5,
:jumlah_pelajaran_semester_1, :jumlah_pelajaran_semester_2,
:jumlah_pelajaran_semester_3, :jumlah_pelajaran_semester_4, :jumlah_pelajaran_semester_5,
:jumlah_nilai_semester1, :jumlah_nilai_semester2, :jumlah_nilai_semester3,
:jumlah_nilai_semester4, :jumlah_nilai_semester5,
:jumlah_pelajaran_semester1, :jumlah_pelajaran_semester2,
:jumlah_pelajaran_semester3, :jumlah_pelajaran_semester4, :jumlah_pelajaran_semester5,
:surat_rekomendasi
)
end
Expand Down
5 changes: 1 addition & 4 deletions app/controllers/sessions_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

# handle sessions (login, logout, etc.) for the application
class SessionsController < ApplicationController
skip_before_action :logged_in_user, only: %i[new create] # skip the logged_in_user method for new and create action
Expand All @@ -9,18 +10,14 @@ def create
if user&.authenticate(params[:session][:password])
if user.activated
log_in user # log the user in (session)
# remember user only if the user clicked remember
params[:session][:remember_me] == '1' ? remember(user) : forget(user)
# remember(user)
redirect_back_or user # automatically convert to the route user_url(user)
else
message = 'Account not activated'
message += 'Check your email for activation link'
flash[:warning] = message
redirect_to root_url
end
else
# create an error message
flash.now[:danger] = 'Invalid email/password combination'
render 'new'
end
Expand Down
1 change: 1 addition & 0 deletions app/controllers/source_information_lists_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

# source information list controller : handle source information list
class SourceInformationListsController < ApplicationController
before_action :set_source_information_list, only: %i[show edit update destroy]
Expand Down
1 change: 1 addition & 0 deletions app/controllers/source_motivation_lists_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

# source motivation list controller : handle source motivation list
class SourceMotivationListsController < ApplicationController
before_action :set_source_motivation_list, only: %i[show edit update destroy]
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/static_pages_controller.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

# static pages, serve static content
class StaticPagesController < ApplicationController
skip_before_action :logged_in_user, only: %i[home help about contact]
def home
Expand Down
1 change: 1 addition & 0 deletions app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

# users controller : handle users
class UsersController < ApplicationController
# prevent use update data or delete without login first
Expand Down
Loading

0 comments on commit 612c557

Please sign in to comment.