-
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.
- Loading branch information
1 parent
96011fd
commit bc931e2
Showing
28 changed files
with
502 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
class PersonalGenderListsController < ApplicationController | ||
before_action :set_personal_gender_list, only: %i[ show edit update destroy ] | ||
|
||
# GET /personal_gender_lists or /personal_gender_lists.json | ||
def index | ||
@personal_gender_lists = PersonalGenderList.all | ||
end | ||
|
||
# GET /personal_gender_lists/1 or /personal_gender_lists/1.json | ||
def show | ||
end | ||
|
||
# GET /personal_gender_lists/new | ||
def new | ||
@personal_gender_list = PersonalGenderList.new | ||
end | ||
|
||
# GET /personal_gender_lists/1/edit | ||
def edit | ||
end | ||
|
||
# POST /personal_gender_lists or /personal_gender_lists.json | ||
def create | ||
@personal_gender_list = PersonalGenderList.new(personal_gender_list_params) | ||
|
||
respond_to do |format| | ||
if @personal_gender_list.save | ||
format.html { redirect_to personal_gender_list_url(@personal_gender_list), notice: "Personal gender list was successfully created." } | ||
format.json { render :show, status: :created, location: @personal_gender_list } | ||
else | ||
format.html { render :new, status: :unprocessable_entity } | ||
format.json { render json: @personal_gender_list.errors, status: :unprocessable_entity } | ||
end | ||
end | ||
end | ||
|
||
# PATCH/PUT /personal_gender_lists/1 or /personal_gender_lists/1.json | ||
def update | ||
respond_to do |format| | ||
if @personal_gender_list.update(personal_gender_list_params) | ||
format.html { redirect_to personal_gender_list_url(@personal_gender_list), notice: "Personal gender list was successfully updated." } | ||
format.json { render :show, status: :ok, location: @personal_gender_list } | ||
else | ||
format.html { render :edit, status: :unprocessable_entity } | ||
format.json { render json: @personal_gender_list.errors, status: :unprocessable_entity } | ||
end | ||
end | ||
end | ||
|
||
# DELETE /personal_gender_lists/1 or /personal_gender_lists/1.json | ||
def destroy | ||
@personal_gender_list.destroy! | ||
|
||
respond_to do |format| | ||
format.html { redirect_to personal_gender_lists_url, notice: "Personal gender list was successfully destroyed." } | ||
format.json { head :no_content } | ||
end | ||
end | ||
|
||
private | ||
# Use callbacks to share common setup or constraints between actions. | ||
def set_personal_gender_list | ||
@personal_gender_list = PersonalGenderList.find(params[:id]) | ||
end | ||
|
||
# Only allow a list of trusted parameters through. | ||
def personal_gender_list_params | ||
params.require(:personal_gender_list).permit(:jenis_kelamin) | ||
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,70 @@ | ||
class PersonalReligionListsController < ApplicationController | ||
before_action :set_personal_religion_list, only: %i[ show edit update destroy ] | ||
|
||
# GET /personal_religion_lists or /personal_religion_lists.json | ||
def index | ||
@personal_religion_lists = PersonalReligionList.all | ||
end | ||
|
||
# GET /personal_religion_lists/1 or /personal_religion_lists/1.json | ||
def show | ||
end | ||
|
||
# GET /personal_religion_lists/new | ||
def new | ||
@personal_religion_list = PersonalReligionList.new | ||
end | ||
|
||
# GET /personal_religion_lists/1/edit | ||
def edit | ||
end | ||
|
||
# POST /personal_religion_lists or /personal_religion_lists.json | ||
def create | ||
@personal_religion_list = PersonalReligionList.new(personal_religion_list_params) | ||
|
||
respond_to do |format| | ||
if @personal_religion_list.save | ||
format.html { redirect_to personal_religion_list_url(@personal_religion_list), notice: "Personal religion list was successfully created." } | ||
format.json { render :show, status: :created, location: @personal_religion_list } | ||
else | ||
format.html { render :new, status: :unprocessable_entity } | ||
format.json { render json: @personal_religion_list.errors, status: :unprocessable_entity } | ||
end | ||
end | ||
end | ||
|
||
# PATCH/PUT /personal_religion_lists/1 or /personal_religion_lists/1.json | ||
def update | ||
respond_to do |format| | ||
if @personal_religion_list.update(personal_religion_list_params) | ||
format.html { redirect_to personal_religion_list_url(@personal_religion_list), notice: "Personal religion list was successfully updated." } | ||
format.json { render :show, status: :ok, location: @personal_religion_list } | ||
else | ||
format.html { render :edit, status: :unprocessable_entity } | ||
format.json { render json: @personal_religion_list.errors, status: :unprocessable_entity } | ||
end | ||
end | ||
end | ||
|
||
# DELETE /personal_religion_lists/1 or /personal_religion_lists/1.json | ||
def destroy | ||
@personal_religion_list.destroy! | ||
|
||
respond_to do |format| | ||
format.html { redirect_to personal_religion_lists_url, notice: "Personal religion list was successfully destroyed." } | ||
format.json { head :no_content } | ||
end | ||
end | ||
|
||
private | ||
# Use callbacks to share common setup or constraints between actions. | ||
def set_personal_religion_list | ||
@personal_religion_list = PersonalReligionList.find(params[:id]) | ||
end | ||
|
||
# Only allow a list of trusted parameters through. | ||
def personal_religion_list_params | ||
params.require(:personal_religion_list).permit(:agama) | ||
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 PersonalGenderListsHelper | ||
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 PersonalReligionListsHelper | ||
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,22 @@ | ||
<%= form_with(model: personal_gender_list) do |form| %> | ||
<% if personal_gender_list.errors.any? %> | ||
<div style="color: red"> | ||
<h2><%= pluralize(personal_gender_list.errors.count, "error") %> prohibited this personal_gender_list from being saved:</h2> | ||
|
||
<ul> | ||
<% personal_gender_list.errors.each do |error| %> | ||
<li><%= error.full_message %></li> | ||
<% end %> | ||
</ul> | ||
</div> | ||
<% end %> | ||
|
||
<div> | ||
<%= form.label :jenis_kelamin, style: "display: block" %> | ||
<%= form.text_field :jenis_kelamin %> | ||
</div> | ||
|
||
<div> | ||
<%= form.submit %> | ||
</div> | ||
<% end %> |
7 changes: 7 additions & 0 deletions
7
app/views/personal_gender_lists/_personal_gender_list.html.erb
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 @@ | ||
<div id="<%= dom_id personal_gender_list %>"> | ||
<p> | ||
<strong>Jenis kelamin:</strong> | ||
<%= personal_gender_list.jenis_kelamin %> | ||
</p> | ||
|
||
</div> |
2 changes: 2 additions & 0 deletions
2
app/views/personal_gender_lists/_personal_gender_list.json.jbuilder
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 @@ | ||
json.extract! personal_gender_list, :id, :jenis_kelamin, :created_at, :updated_at | ||
json.url personal_gender_list_url(personal_gender_list, format: :json) |
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,10 @@ | ||
<h1>Editing personal gender list</h1> | ||
|
||
<%= render "form", personal_gender_list: @personal_gender_list %> | ||
|
||
<br> | ||
|
||
<div> | ||
<%= link_to "Show this personal gender list", @personal_gender_list %> | | ||
<%= link_to "Back to personal gender lists", personal_gender_lists_path %> | ||
</div> |
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,14 @@ | ||
<p style="color: green"><%= notice %></p> | ||
|
||
<h1>Personal gender lists</h1> | ||
|
||
<div id="personal_gender_lists"> | ||
<% @personal_gender_lists.each do |personal_gender_list| %> | ||
<%= render personal_gender_list %> | ||
<p> | ||
<%= link_to "Show this personal gender list", personal_gender_list %> | ||
</p> | ||
<% end %> | ||
</div> | ||
|
||
<%= link_to "New personal gender list", new_personal_gender_list_path %> |
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 @@ | ||
json.array! @personal_gender_lists, partial: "personal_gender_lists/personal_gender_list", as: :personal_gender_list |
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,9 @@ | ||
<h1>New personal gender list</h1> | ||
|
||
<%= render "form", personal_gender_list: @personal_gender_list %> | ||
|
||
<br> | ||
|
||
<div> | ||
<%= link_to "Back to personal gender lists", personal_gender_lists_path %> | ||
</div> |
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,10 @@ | ||
<p style="color: green"><%= notice %></p> | ||
|
||
<%= render @personal_gender_list %> | ||
|
||
<div> | ||
<%= link_to "Edit this personal gender list", edit_personal_gender_list_path(@personal_gender_list) %> | | ||
<%= link_to "Back to personal gender lists", personal_gender_lists_path %> | ||
|
||
<%= button_to "Destroy this personal gender list", @personal_gender_list, method: :delete %> | ||
</div> |
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 @@ | ||
json.partial! "personal_gender_lists/personal_gender_list", personal_gender_list: @personal_gender_list |
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,22 @@ | ||
<%= form_with(model: personal_religion_list) do |form| %> | ||
<% if personal_religion_list.errors.any? %> | ||
<div style="color: red"> | ||
<h2><%= pluralize(personal_religion_list.errors.count, "error") %> prohibited this personal_religion_list from being saved:</h2> | ||
|
||
<ul> | ||
<% personal_religion_list.errors.each do |error| %> | ||
<li><%= error.full_message %></li> | ||
<% end %> | ||
</ul> | ||
</div> | ||
<% end %> | ||
|
||
<div> | ||
<%= form.label :agama, style: "display: block" %> | ||
<%= form.text_field :agama %> | ||
</div> | ||
|
||
<div> | ||
<%= form.submit %> | ||
</div> | ||
<% end %> |
7 changes: 7 additions & 0 deletions
7
app/views/personal_religion_lists/_personal_religion_list.html.erb
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 @@ | ||
<div id="<%= dom_id personal_religion_list %>"> | ||
<p> | ||
<strong>Agama:</strong> | ||
<%= personal_religion_list.agama %> | ||
</p> | ||
|
||
</div> |
2 changes: 2 additions & 0 deletions
2
app/views/personal_religion_lists/_personal_religion_list.json.jbuilder
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 @@ | ||
json.extract! personal_religion_list, :id, :agama, :created_at, :updated_at | ||
json.url personal_religion_list_url(personal_religion_list, format: :json) |
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,10 @@ | ||
<h1>Editing personal religion list</h1> | ||
|
||
<%= render "form", personal_religion_list: @personal_religion_list %> | ||
|
||
<br> | ||
|
||
<div> | ||
<%= link_to "Show this personal religion list", @personal_religion_list %> | | ||
<%= link_to "Back to personal religion lists", personal_religion_lists_path %> | ||
</div> |
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,14 @@ | ||
<p style="color: green"><%= notice %></p> | ||
|
||
<h1>Personal religion lists</h1> | ||
|
||
<div id="personal_religion_lists"> | ||
<% @personal_religion_lists.each do |personal_religion_list| %> | ||
<%= render personal_religion_list %> | ||
<p> | ||
<%= link_to "Show this personal religion list", personal_religion_list %> | ||
</p> | ||
<% end %> | ||
</div> | ||
|
||
<%= link_to "New personal religion list", new_personal_religion_list_path %> |
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 @@ | ||
json.array! @personal_religion_lists, partial: "personal_religion_lists/personal_religion_list", as: :personal_religion_list |
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,9 @@ | ||
<h1>New personal religion list</h1> | ||
|
||
<%= render "form", personal_religion_list: @personal_religion_list %> | ||
|
||
<br> | ||
|
||
<div> | ||
<%= link_to "Back to personal religion lists", personal_religion_lists_path %> | ||
</div> |
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,10 @@ | ||
<p style="color: green"><%= notice %></p> | ||
|
||
<%= render @personal_religion_list %> | ||
|
||
<div> | ||
<%= link_to "Edit this personal religion list", edit_personal_religion_list_path(@personal_religion_list) %> | | ||
<%= link_to "Back to personal religion lists", personal_religion_lists_path %> | ||
|
||
<%= button_to "Destroy this personal religion list", @personal_religion_list, method: :delete %> | ||
</div> |
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 @@ | ||
json.partial! "personal_religion_lists/personal_religion_list", personal_religion_list: @personal_religion_list |
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,9 @@ | ||
class CreatePersonalGenderLists < ActiveRecord::Migration[7.1] | ||
def change | ||
create_table :personal_gender_lists do |t| | ||
t.string :jenis_kelamin | ||
|
||
t.timestamps | ||
end | ||
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,9 @@ | ||
class CreatePersonalReligionLists < ActiveRecord::Migration[7.1] | ||
def change | ||
create_table :personal_religion_lists do |t| | ||
t.string :agama | ||
|
||
t.timestamps | ||
end | ||
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,53 @@ | ||
require "test_helper" | ||
|
||
class PersonalGenderListsControllerTest < ActionDispatch::IntegrationTest | ||
setup do | ||
get login_path | ||
post login_path, params: {session: { | ||
email: users(:michael).email, password: 'password' | ||
}} | ||
@personal_gender_list = personal_gender_lists(:one) | ||
end | ||
|
||
test "should get index" do | ||
get personal_gender_lists_url | ||
assert_response :success | ||
end | ||
|
||
test "should get new" do | ||
get new_personal_gender_list_url | ||
assert_response :success | ||
end | ||
|
||
test "should create personal_gender_list" do | ||
assert_difference("PersonalGenderList.count") do | ||
post personal_gender_lists_url, params: { personal_gender_list: { jenis_kelamin: 'perempuan' } } | ||
end | ||
|
||
assert_redirected_to personal_gender_list_url(PersonalGenderList.last) | ||
end | ||
|
||
test "should show personal_gender_list" do | ||
get personal_gender_list_url(@personal_gender_list) | ||
assert_response :success | ||
end | ||
|
||
test "should get edit" do | ||
get edit_personal_gender_list_url(@personal_gender_list) | ||
assert_response :success | ||
end | ||
|
||
test "should update personal_gender_list" do | ||
patch personal_gender_list_url(@personal_gender_list), | ||
params: { personal_gender_list: { jenis_kelamin: 'pria' } } | ||
assert_redirected_to personal_gender_list_url(@personal_gender_list) | ||
end | ||
|
||
test "should destroy personal_gender_list" do | ||
assert_difference("PersonalGenderList.count", -1) do | ||
delete personal_gender_list_url(@personal_gender_list) | ||
end | ||
|
||
assert_redirected_to personal_gender_lists_url | ||
end | ||
end |
Oops, something went wrong.