forked from akiratosetiawan/realcount
-
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
1cd2b2f
commit 1565536
Showing
18 changed files
with
21,452 additions
and
2 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
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,3 @@ | ||
# Place all the behaviors and hooks related to the matching controller here. | ||
# All this logic will automatically be available in application.js. | ||
# You can use CoffeeScript in this file: http://coffeescript.org/ |
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 @@ | ||
class TpsController < ApplicationController | ||
before_action :set_tp, only: [:show, :edit, :update, :destroy] | ||
|
||
# GET /tps | ||
# GET /tps.json | ||
def index | ||
@tps = Tps.all | ||
end | ||
|
||
# GET /tps/1 | ||
# GET /tps/1.json | ||
def show | ||
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 TpsHelper | ||
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,5 @@ | ||
class Tps < ActiveRecord::Base | ||
def c1_url | ||
return "http://scanc1.kpu.go.id/viewp.php?f=#{self.kelurahan_id}#{self.tps_id.rjust(3, '0')}04.jpg" | ||
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,17 @@ | ||
%h1 Listing tps | ||
|
||
%table | ||
%tr | ||
%th Desa | ||
%th Kelurahan | ||
%th Tps | ||
%th | ||
%th | ||
%th | ||
|
||
- @tps.each do |tp| | ||
%tr | ||
%td= tp.desa | ||
%td= tp.kelurahan_id | ||
%td= tp.tps_id | ||
%td= link_to tp.c1_url, tp.c1_url |
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,4 @@ | ||
json.array!(@tps) do |tp| | ||
json.extract! tp, :id, :desa, :kelurahan_id, :tps_id | ||
json.url tp_url(tp, format: :json) | ||
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,15 @@ | ||
%p#notice= notice | ||
|
||
%p | ||
%b Desa: | ||
= @tp.desa | ||
%p | ||
%b Kelurahan: | ||
= @tp.kelurahan_id | ||
%p | ||
%b Tps: | ||
= @tp.tps_id | ||
|
||
= link_to 'Edit', edit_tp_path(@tp) | ||
\| | ||
= link_to 'Back', tps_index_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.extract! @tp, :id, :desa, :kelurahan_id, :tps_id, :created_at, :updated_at |
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
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,11 @@ | ||
class CreateTps < ActiveRecord::Migration | ||
def change | ||
create_table :tps do |t| | ||
t.string :desa | ||
t.string :kelurahan_id | ||
t.string :tps_id | ||
|
||
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
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
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,49 @@ | ||
require 'test_helper' | ||
|
||
class TpsControllerTest < ActionController::TestCase | ||
setup do | ||
@tp = tps(:one) | ||
end | ||
|
||
test "should get index" do | ||
get :index | ||
assert_response :success | ||
assert_not_nil assigns(:tps) | ||
end | ||
|
||
test "should get new" do | ||
get :new | ||
assert_response :success | ||
end | ||
|
||
test "should create tp" do | ||
assert_difference('Tps.count') do | ||
post :create, tp: { desa: @tp.desa, kelurahan_id: @tp.kelurahan_id, tps_id: @tp.tps_id } | ||
end | ||
|
||
assert_redirected_to tp_path(assigns(:tp)) | ||
end | ||
|
||
test "should show tp" do | ||
get :show, id: @tp | ||
assert_response :success | ||
end | ||
|
||
test "should get edit" do | ||
get :edit, id: @tp | ||
assert_response :success | ||
end | ||
|
||
test "should update tp" do | ||
patch :update, id: @tp, tp: { desa: @tp.desa, kelurahan_id: @tp.kelurahan_id, tps_id: @tp.tps_id } | ||
assert_redirected_to tp_path(assigns(:tp)) | ||
end | ||
|
||
test "should destroy tp" do | ||
assert_difference('Tps.count', -1) do | ||
delete :destroy, id: @tp | ||
end | ||
|
||
assert_redirected_to tps_index_path | ||
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,11 @@ | ||
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html | ||
|
||
one: | ||
desa: MyString | ||
kelurahan_id: MyString | ||
tps_id: MyString | ||
|
||
two: | ||
desa: MyString | ||
kelurahan_id: MyString | ||
tps_id: MyString |
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,4 @@ | ||
require 'test_helper' | ||
|
||
class TpsHelperTest < ActionView::TestCase | ||
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,7 @@ | ||
require 'test_helper' | ||
|
||
class TpsTest < ActiveSupport::TestCase | ||
# test "the truth" do | ||
# assert true | ||
# end | ||
end |