-
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
b3a6458
commit 2595129
Showing
59 changed files
with
883 additions
and
40 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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,70 @@ | ||
class AddressKabupatenListsController < ApplicationController | ||
before_action :set_address_kabupaten_list, only: %i[ show edit update destroy ] | ||
|
||
# GET /address_kabupaten_lists or /address_kabupaten_lists.json | ||
def index | ||
@address_kabupaten_lists = AddressKabupatenList.all | ||
end | ||
|
||
# GET /address_kabupaten_lists/1 or /address_kabupaten_lists/1.json | ||
def show | ||
end | ||
|
||
# GET /address_kabupaten_lists/new | ||
def new | ||
@address_kabupaten_list = AddressKabupatenList.new | ||
end | ||
|
||
# GET /address_kabupaten_lists/1/edit | ||
def edit | ||
end | ||
|
||
# POST /address_kabupaten_lists or /address_kabupaten_lists.json | ||
def create | ||
@address_kabupaten_list = AddressKabupatenList.new(address_kabupaten_list_params) | ||
|
||
respond_to do |format| | ||
if @address_kabupaten_list.save | ||
format.html { redirect_to address_kabupaten_list_url(@address_kabupaten_list), notice: "Address kabupaten list was successfully created." } | ||
format.json { render :show, status: :created, location: @address_kabupaten_list } | ||
else | ||
format.html { render :new, status: :unprocessable_entity } | ||
format.json { render json: @address_kabupaten_list.errors, status: :unprocessable_entity } | ||
end | ||
end | ||
end | ||
|
||
# PATCH/PUT /address_kabupaten_lists/1 or /address_kabupaten_lists/1.json | ||
def update | ||
respond_to do |format| | ||
if @address_kabupaten_list.update(address_kabupaten_list_params) | ||
format.html { redirect_to address_kabupaten_list_url(@address_kabupaten_list), notice: "Address kabupaten list was successfully updated." } | ||
format.json { render :show, status: :ok, location: @address_kabupaten_list } | ||
else | ||
format.html { render :edit, status: :unprocessable_entity } | ||
format.json { render json: @address_kabupaten_list.errors, status: :unprocessable_entity } | ||
end | ||
end | ||
end | ||
|
||
# DELETE /address_kabupaten_lists/1 or /address_kabupaten_lists/1.json | ||
def destroy | ||
@address_kabupaten_list.destroy! | ||
|
||
respond_to do |format| | ||
format.html { redirect_to address_kabupaten_lists_url, notice: "Address kabupaten list was successfully destroyed." } | ||
format.json { head :no_content } | ||
end | ||
end | ||
|
||
private | ||
# Use callbacks to share common setup or constraints between actions. | ||
def set_address_kabupaten_list | ||
@address_kabupaten_list = AddressKabupatenList.find(params[:id]) | ||
end | ||
|
||
# Only allow a list of trusted parameters through. | ||
def address_kabupaten_list_params | ||
params.require(:address_kabupaten_list).permit(:kabupaten, :address_kecamatan_list_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,70 @@ | ||
class AddressKecamatanListsController < ApplicationController | ||
before_action :set_address_kecamatan_list, only: %i[ show edit update destroy ] | ||
|
||
# GET /address_kecamatan_lists or /address_kecamatan_lists.json | ||
def index | ||
@address_kecamatan_lists = AddressKecamatanList.all | ||
end | ||
|
||
# GET /address_kecamatan_lists/1 or /address_kecamatan_lists/1.json | ||
def show | ||
end | ||
|
||
# GET /address_kecamatan_lists/new | ||
def new | ||
@address_kecamatan_list = AddressKecamatanList.new | ||
end | ||
|
||
# GET /address_kecamatan_lists/1/edit | ||
def edit | ||
end | ||
|
||
# POST /address_kecamatan_lists or /address_kecamatan_lists.json | ||
def create | ||
@address_kecamatan_list = AddressKecamatanList.new(address_kecamatan_list_params) | ||
|
||
respond_to do |format| | ||
if @address_kecamatan_list.save | ||
format.html { redirect_to address_kecamatan_list_url(@address_kecamatan_list), notice: "Address kecamatan list was successfully created." } | ||
format.json { render :show, status: :created, location: @address_kecamatan_list } | ||
else | ||
format.html { render :new, status: :unprocessable_entity } | ||
format.json { render json: @address_kecamatan_list.errors, status: :unprocessable_entity } | ||
end | ||
end | ||
end | ||
|
||
# PATCH/PUT /address_kecamatan_lists/1 or /address_kecamatan_lists/1.json | ||
def update | ||
respond_to do |format| | ||
if @address_kecamatan_list.update(address_kecamatan_list_params) | ||
format.html { redirect_to address_kecamatan_list_url(@address_kecamatan_list), notice: "Address kecamatan list was successfully updated." } | ||
format.json { render :show, status: :ok, location: @address_kecamatan_list } | ||
else | ||
format.html { render :edit, status: :unprocessable_entity } | ||
format.json { render json: @address_kecamatan_list.errors, status: :unprocessable_entity } | ||
end | ||
end | ||
end | ||
|
||
# DELETE /address_kecamatan_lists/1 or /address_kecamatan_lists/1.json | ||
def destroy | ||
@address_kecamatan_list.destroy! | ||
|
||
respond_to do |format| | ||
format.html { redirect_to address_kecamatan_lists_url, notice: "Address kecamatan list was successfully destroyed." } | ||
format.json { head :no_content } | ||
end | ||
end | ||
|
||
private | ||
# Use callbacks to share common setup or constraints between actions. | ||
def set_address_kecamatan_list | ||
@address_kecamatan_list = AddressKecamatanList.find(params[:id]) | ||
end | ||
|
||
# Only allow a list of trusted parameters through. | ||
def address_kecamatan_list_params | ||
params.require(:address_kecamatan_list).permit(:kecamatan, :address_province_list_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,70 @@ | ||
class AddressProvinceListsController < ApplicationController | ||
before_action :set_address_province_list, only: %i[ show edit update destroy ] | ||
|
||
# GET /address_province_lists or /address_province_lists.json | ||
def index | ||
@address_province_lists = AddressProvinceList.all | ||
end | ||
|
||
# GET /address_province_lists/1 or /address_province_lists/1.json | ||
def show | ||
end | ||
|
||
# GET /address_province_lists/new | ||
def new | ||
@address_province_list = AddressProvinceList.new | ||
end | ||
|
||
# GET /address_province_lists/1/edit | ||
def edit | ||
end | ||
|
||
# POST /address_province_lists or /address_province_lists.json | ||
def create | ||
@address_province_list = AddressProvinceList.new(address_province_list_params) | ||
|
||
respond_to do |format| | ||
if @address_province_list.save | ||
format.html { redirect_to address_province_list_url(@address_province_list), notice: "Address province list was successfully created." } | ||
format.json { render :show, status: :created, location: @address_province_list } | ||
else | ||
format.html { render :new, status: :unprocessable_entity } | ||
format.json { render json: @address_province_list.errors, status: :unprocessable_entity } | ||
end | ||
end | ||
end | ||
|
||
# PATCH/PUT /address_province_lists/1 or /address_province_lists/1.json | ||
def update | ||
respond_to do |format| | ||
if @address_province_list.update(address_province_list_params) | ||
format.html { redirect_to address_province_list_url(@address_province_list), notice: "Address province list was successfully updated." } | ||
format.json { render :show, status: :ok, location: @address_province_list } | ||
else | ||
format.html { render :edit, status: :unprocessable_entity } | ||
format.json { render json: @address_province_list.errors, status: :unprocessable_entity } | ||
end | ||
end | ||
end | ||
|
||
# DELETE /address_province_lists/1 or /address_province_lists/1.json | ||
def destroy | ||
@address_province_list.destroy! | ||
|
||
respond_to do |format| | ||
format.html { redirect_to address_province_lists_url, notice: "Address province list was successfully destroyed." } | ||
format.json { head :no_content } | ||
end | ||
end | ||
|
||
private | ||
# Use callbacks to share common setup or constraints between actions. | ||
def set_address_province_list | ||
@address_province_list = AddressProvinceList.find(params[:id]) | ||
end | ||
|
||
# Only allow a list of trusted parameters through. | ||
def address_province_list_params | ||
params.require(:address_province_list).permit(:provinsi) | ||
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 AddressKabupatenListsHelper | ||
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 AddressKecamatanListsHelper | ||
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 AddressProvinceListsHelper | ||
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,5 @@ | ||
class AddressKabupatenList < ApplicationRecord | ||
belongs_to :address_kecamatan_list | ||
validates :kabupaten, presence: true, uniqueness: true, | ||
length: { minimum: 3, maximum: 35 } | ||
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,6 @@ | ||
class AddressKecamatanList < ApplicationRecord | ||
has_many :address_kabupaten_lists, dependent: :destroy | ||
belongs_to :address_province_list | ||
validates :kecamatan, presence: true, uniqueness: true, | ||
length: { minimum: 3, maximum: 35 } | ||
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,5 @@ | ||
class AddressProvinceList < ApplicationRecord | ||
has_many :address_kecamatan_lists, dependent: :destroy | ||
validates :provinsi, presence: true, uniqueness: true, | ||
length: { minimum: 3, maximum: 35 } | ||
end |
7 changes: 7 additions & 0 deletions
7
app/views/address_kabupaten_lists/_address_kabupaten_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 address_kabupaten_list %>"> | ||
<p> | ||
<strong>Kabupaten:</strong> | ||
<%= address_kabupaten_list.kabupaten %> | ||
</p> | ||
|
||
</div> |
2 changes: 2 additions & 0 deletions
2
app/views/address_kabupaten_lists/_address_kabupaten_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! address_kabupaten_list, :id, :kabupaten, :created_at, :updated_at | ||
json.url address_kabupaten_list_url(address_kabupaten_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,22 @@ | ||
<%= form_with(model: address_kabupaten_list) do |form| %> | ||
<% if address_kabupaten_list.errors.any? %> | ||
<div style="color: red"> | ||
<h2><%= pluralize(address_kabupaten_list.errors.count, "error") %> prohibited this address_kabupaten_list from being saved:</h2> | ||
|
||
<ul> | ||
<% address_kabupaten_list.errors.each do |error| %> | ||
<li><%= error.full_message %></li> | ||
<% end %> | ||
</ul> | ||
</div> | ||
<% end %> | ||
|
||
<div> | ||
<%= form.label :kabupaten, style: "display: block" %> | ||
<%= form.text_field :kabupaten %> | ||
</div> | ||
|
||
<div> | ||
<%= form.submit %> | ||
</div> | ||
<% 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,10 @@ | ||
<h1>Editing address kabupaten list</h1> | ||
|
||
<%= render "form", address_kabupaten_list: @address_kabupaten_list %> | ||
|
||
<br> | ||
|
||
<div> | ||
<%= link_to "Show this address kabupaten list", @address_kabupaten_list %> | | ||
<%= link_to "Back to address kabupaten lists", address_kabupaten_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>Address kabupaten lists</h1> | ||
|
||
<div id="address_kabupaten_lists"> | ||
<% @address_kabupaten_lists.each do |address_kabupaten_list| %> | ||
<%= render address_kabupaten_list %> | ||
<p> | ||
<%= link_to "Show this address kabupaten list", address_kabupaten_list %> | ||
</p> | ||
<% end %> | ||
</div> | ||
|
||
<%= link_to "New address kabupaten list", new_address_kabupaten_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! @address_kabupaten_lists, partial: "address_kabupaten_lists/address_kabupaten_list", as: :address_kabupaten_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 address kabupaten list</h1> | ||
|
||
<%= render "form", address_kabupaten_list: @address_kabupaten_list %> | ||
|
||
<br> | ||
|
||
<div> | ||
<%= link_to "Back to address kabupaten lists", address_kabupaten_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 @address_kabupaten_list %> | ||
|
||
<div> | ||
<%= link_to "Edit this address kabupaten list", edit_address_kabupaten_list_path(@address_kabupaten_list) %> | | ||
<%= link_to "Back to address kabupaten lists", address_kabupaten_lists_path %> | ||
|
||
<%= button_to "Destroy this address kabupaten list", @address_kabupaten_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! "address_kabupaten_lists/address_kabupaten_list", address_kabupaten_list: @address_kabupaten_list |
7 changes: 7 additions & 0 deletions
7
app/views/address_kecamatan_lists/_address_kecamatan_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 address_kecamatan_list %>"> | ||
<p> | ||
<strong>Kecamatan:</strong> | ||
<%= address_kecamatan_list.kecamatan %> | ||
</p> | ||
|
||
</div> |
2 changes: 2 additions & 0 deletions
2
app/views/address_kecamatan_lists/_address_kecamatan_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! address_kecamatan_list, :id, :kecamatan, :created_at, :updated_at | ||
json.url address_kecamatan_list_url(address_kecamatan_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,22 @@ | ||
<%= form_with(model: address_kecamatan_list) do |form| %> | ||
<% if address_kecamatan_list.errors.any? %> | ||
<div style="color: red"> | ||
<h2><%= pluralize(address_kecamatan_list.errors.count, "error") %> prohibited this address_kecamatan_list from being saved:</h2> | ||
|
||
<ul> | ||
<% address_kecamatan_list.errors.each do |error| %> | ||
<li><%= error.full_message %></li> | ||
<% end %> | ||
</ul> | ||
</div> | ||
<% end %> | ||
|
||
<div> | ||
<%= form.label :kecamatan, style: "display: block" %> | ||
<%= form.text_field :kecamatan %> | ||
</div> | ||
|
||
<div> | ||
<%= form.submit %> | ||
</div> | ||
<% 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,10 @@ | ||
<h1>Editing address kecamatan list</h1> | ||
|
||
<%= render "form", address_kecamatan_list: @address_kecamatan_list %> | ||
|
||
<br> | ||
|
||
<div> | ||
<%= link_to "Show this address kecamatan list", @address_kecamatan_list %> | | ||
<%= link_to "Back to address kecamatan lists", address_kecamatan_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>Address kecamatan lists</h1> | ||
|
||
<div id="address_kecamatan_lists"> | ||
<% @address_kecamatan_lists.each do |address_kecamatan_list| %> | ||
<%= render address_kecamatan_list %> | ||
<p> | ||
<%= link_to "Show this address kecamatan list", address_kecamatan_list %> | ||
</p> | ||
<% end %> | ||
</div> | ||
|
||
<%= link_to "New address kecamatan list", new_address_kecamatan_list_path %> |
Oops, something went wrong.