Skip to content

Commit

Permalink
buildings
Browse files Browse the repository at this point in the history
  • Loading branch information
padrta committed Sep 23, 2016
1 parent 25cda65 commit 0d8ac72
Show file tree
Hide file tree
Showing 44 changed files with 995 additions and 2 deletions.
3 changes: 3 additions & 0 deletions app/assets/javascripts/buildings.coffee
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/
3 changes: 3 additions & 0 deletions app/assets/stylesheets/buildings.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Place all the styles related to the Buildings controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
74 changes: 74 additions & 0 deletions app/controllers/buildings_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
class BuildingsController < ApplicationController
before_action :set_building, only: [:show, :edit, :update, :destroy]

# GET /buildings
# GET /buildings.json
def index
@buildings = Building.all
end

# GET /buildings/1
# GET /buildings/1.json
def show
end

# GET /buildings/new
def new
@building = Building.new
end

# GET /buildings/1/edit
def edit
end

# POST /buildings
# POST /buildings.json
def create
@building = Building.new(building_params)

respond_to do |format|
if @building.save
format.html { redirect_to @building, notice: 'Building was successfully created.' }
format.json { render :show, status: :created, location: @building }
else
format.html { render :new }
format.json { render json: @building.errors, status: :unprocessable_entity }
end
end
end

# PATCH/PUT /buildings/1
# PATCH/PUT /buildings/1.json
def update
respond_to do |format|
if @building.update(building_params)
format.html { redirect_to @building, notice: 'Building was successfully updated.' }
format.json { render :show, status: :ok, location: @building }
else
format.html { render :edit }
format.json { render json: @building.errors, status: :unprocessable_entity }
end
end
end

# DELETE /buildings/1
# DELETE /buildings/1.json
def destroy
@building.destroy
respond_to do |format|
format.html { redirect_to buildings_url, notice: 'Building was successfully destroyed.' }
format.json { head :no_content }
end
end

private
# Use callbacks to share common setup or constraints between actions.
def set_building
@building = Building.find(params[:id])
end

# Never trust parameters from the scary internet, only allow the white list through.
def building_params
params.require(:building).permit(:type, :name, :description, :population_bonus, :melange_bonus, :material_bonus, :solar_bonus, :exp_bonus, :population_cost, :melange_cost, :material_cost, :solar_cost, :exp_cost)
end
end
2 changes: 2 additions & 0 deletions app/helpers/buildings_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module BuildingsHelper
end
26 changes: 26 additions & 0 deletions app/models/building.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# == Schema Information
#
# Table name: buildings
#
# id :integer not null, primary key
# type :string
# name :string not null
# description :string default("")
# population_bonus :decimal(12, 4) default(0.0)
# melange_bonus :decimal(12, 4) default(0.0)
# material_bonus :decimal(12, 4) default(0.0)
# solar_bonus :decimal(12, 4) default(0.0)
# exp_bonus :decimal(12, 4) default(0.0)
# population_cost :decimal(12, 4) default(0.0)
# melange_cost :decimal(12, 4) default(0.0)
# material_cost :decimal(12, 4) default(0.0)
# solar_cost :decimal(12, 4) default(0.0)
# exp_cost :decimal(12, 4) default(0.0)
# created_at :datetime not null
# updated_at :datetime not null
#

class Building < ApplicationRecord
has_many :estates
has_many :fields, through: :estates
end
24 changes: 24 additions & 0 deletions app/models/building/material.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# == Schema Information
#
# Table name: buildings
#
# id :integer not null, primary key
# type :string
# name :string not null
# description :string default("")
# population_bonus :decimal(12, 4) default(0.0)
# melange_bonus :decimal(12, 4) default(0.0)
# material_bonus :decimal(12, 4) default(0.0)
# solar_bonus :decimal(12, 4) default(0.0)
# exp_bonus :decimal(12, 4) default(0.0)
# population_cost :decimal(12, 4) default(0.0)
# melange_cost :decimal(12, 4) default(0.0)
# material_cost :decimal(12, 4) default(0.0)
# solar_cost :decimal(12, 4) default(0.0)
# exp_cost :decimal(12, 4) default(0.0)
# created_at :datetime not null
# updated_at :datetime not null
#

class Building::Material < Building
end
24 changes: 24 additions & 0 deletions app/models/building/material/borehole.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# == Schema Information
#
# Table name: buildings
#
# id :integer not null, primary key
# type :string
# name :string not null
# description :string default("")
# population_bonus :decimal(12, 4) default(0.0)
# melange_bonus :decimal(12, 4) default(0.0)
# material_bonus :decimal(12, 4) default(0.0)
# solar_bonus :decimal(12, 4) default(0.0)
# exp_bonus :decimal(12, 4) default(0.0)
# population_cost :decimal(12, 4) default(0.0)
# melange_cost :decimal(12, 4) default(0.0)
# material_cost :decimal(12, 4) default(0.0)
# solar_cost :decimal(12, 4) default(0.0)
# exp_cost :decimal(12, 4) default(0.0)
# created_at :datetime not null
# updated_at :datetime not null
#

class Building::Material::Borehole < Building::Material
end
24 changes: 24 additions & 0 deletions app/models/building/material/deep_core.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# == Schema Information
#
# Table name: buildings
#
# id :integer not null, primary key
# type :string
# name :string not null
# description :string default("")
# population_bonus :decimal(12, 4) default(0.0)
# melange_bonus :decimal(12, 4) default(0.0)
# material_bonus :decimal(12, 4) default(0.0)
# solar_bonus :decimal(12, 4) default(0.0)
# exp_bonus :decimal(12, 4) default(0.0)
# population_cost :decimal(12, 4) default(0.0)
# melange_cost :decimal(12, 4) default(0.0)
# material_cost :decimal(12, 4) default(0.0)
# solar_cost :decimal(12, 4) default(0.0)
# exp_cost :decimal(12, 4) default(0.0)
# created_at :datetime not null
# updated_at :datetime not null
#

class Building::Material::DeepCore < Building::Material
end
24 changes: 24 additions & 0 deletions app/models/building/material/mine.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# == Schema Information
#
# Table name: buildings
#
# id :integer not null, primary key
# type :string
# name :string not null
# description :string default("")
# population_bonus :decimal(12, 4) default(0.0)
# melange_bonus :decimal(12, 4) default(0.0)
# material_bonus :decimal(12, 4) default(0.0)
# solar_bonus :decimal(12, 4) default(0.0)
# exp_bonus :decimal(12, 4) default(0.0)
# population_cost :decimal(12, 4) default(0.0)
# melange_cost :decimal(12, 4) default(0.0)
# material_cost :decimal(12, 4) default(0.0)
# solar_cost :decimal(12, 4) default(0.0)
# exp_cost :decimal(12, 4) default(0.0)
# created_at :datetime not null
# updated_at :datetime not null
#

class Building::Material::Mine < Building::Material
end
25 changes: 25 additions & 0 deletions app/models/building/melange.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# == Schema Information
#
# Table name: buildings
#
# id :integer not null, primary key
# type :string
# name :string not null
# description :string default("")
# population_bonus :decimal(12, 4) default(0.0)
# melange_bonus :decimal(12, 4) default(0.0)
# material_bonus :decimal(12, 4) default(0.0)
# solar_bonus :decimal(12, 4) default(0.0)
# exp_bonus :decimal(12, 4) default(0.0)
# population_cost :decimal(12, 4) default(0.0)
# melange_cost :decimal(12, 4) default(0.0)
# material_cost :decimal(12, 4) default(0.0)
# solar_cost :decimal(12, 4) default(0.0)
# exp_cost :decimal(12, 4) default(0.0)
# created_at :datetime not null
# updated_at :datetime not null
#

class Building::Melange < Building

end
24 changes: 24 additions & 0 deletions app/models/building/melange/arraken.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# == Schema Information
#
# Table name: buildings
#
# id :integer not null, primary key
# type :string
# name :string not null
# description :string default("")
# population_bonus :decimal(12, 4) default(0.0)
# melange_bonus :decimal(12, 4) default(0.0)
# material_bonus :decimal(12, 4) default(0.0)
# solar_bonus :decimal(12, 4) default(0.0)
# exp_bonus :decimal(12, 4) default(0.0)
# population_cost :decimal(12, 4) default(0.0)
# melange_cost :decimal(12, 4) default(0.0)
# material_cost :decimal(12, 4) default(0.0)
# solar_cost :decimal(12, 4) default(0.0)
# exp_cost :decimal(12, 4) default(0.0)
# created_at :datetime not null
# updated_at :datetime not null
#

class Building::Melange::Arraken < Building::Melange
end
24 changes: 24 additions & 0 deletions app/models/building/melange/harvester.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# == Schema Information
#
# Table name: buildings
#
# id :integer not null, primary key
# type :string
# name :string not null
# description :string default("")
# population_bonus :decimal(12, 4) default(0.0)
# melange_bonus :decimal(12, 4) default(0.0)
# material_bonus :decimal(12, 4) default(0.0)
# solar_bonus :decimal(12, 4) default(0.0)
# exp_bonus :decimal(12, 4) default(0.0)
# population_cost :decimal(12, 4) default(0.0)
# melange_cost :decimal(12, 4) default(0.0)
# material_cost :decimal(12, 4) default(0.0)
# solar_cost :decimal(12, 4) default(0.0)
# exp_cost :decimal(12, 4) default(0.0)
# created_at :datetime not null
# updated_at :datetime not null
#

class Building::Melange::Harvester < Building::Melange
end
24 changes: 24 additions & 0 deletions app/models/building/population.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# == Schema Information
#
# Table name: buildings
#
# id :integer not null, primary key
# type :string
# name :string not null
# description :string default("")
# population_bonus :decimal(12, 4) default(0.0)
# melange_bonus :decimal(12, 4) default(0.0)
# material_bonus :decimal(12, 4) default(0.0)
# solar_bonus :decimal(12, 4) default(0.0)
# exp_bonus :decimal(12, 4) default(0.0)
# population_cost :decimal(12, 4) default(0.0)
# melange_cost :decimal(12, 4) default(0.0)
# material_cost :decimal(12, 4) default(0.0)
# solar_cost :decimal(12, 4) default(0.0)
# exp_cost :decimal(12, 4) default(0.0)
# created_at :datetime not null
# updated_at :datetime not null
#

class Building::Population < Building
end
24 changes: 24 additions & 0 deletions app/models/building/population/city.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# == Schema Information
#
# Table name: buildings
#
# id :integer not null, primary key
# type :string
# name :string not null
# description :string default("")
# population_bonus :decimal(12, 4) default(0.0)
# melange_bonus :decimal(12, 4) default(0.0)
# material_bonus :decimal(12, 4) default(0.0)
# solar_bonus :decimal(12, 4) default(0.0)
# exp_bonus :decimal(12, 4) default(0.0)
# population_cost :decimal(12, 4) default(0.0)
# melange_cost :decimal(12, 4) default(0.0)
# material_cost :decimal(12, 4) default(0.0)
# solar_cost :decimal(12, 4) default(0.0)
# exp_cost :decimal(12, 4) default(0.0)
# created_at :datetime not null
# updated_at :datetime not null
#

class Building::Population::City < Building::Population
end
24 changes: 24 additions & 0 deletions app/models/building/population/metropolis.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# == Schema Information
#
# Table name: buildings
#
# id :integer not null, primary key
# type :string
# name :string not null
# description :string default("")
# population_bonus :decimal(12, 4) default(0.0)
# melange_bonus :decimal(12, 4) default(0.0)
# material_bonus :decimal(12, 4) default(0.0)
# solar_bonus :decimal(12, 4) default(0.0)
# exp_bonus :decimal(12, 4) default(0.0)
# population_cost :decimal(12, 4) default(0.0)
# melange_cost :decimal(12, 4) default(0.0)
# material_cost :decimal(12, 4) default(0.0)
# solar_cost :decimal(12, 4) default(0.0)
# exp_cost :decimal(12, 4) default(0.0)
# created_at :datetime not null
# updated_at :datetime not null
#

class Building::Population::Metropolis < Building::Population
end
24 changes: 24 additions & 0 deletions app/models/building/population/town.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# == Schema Information
#
# Table name: buildings
#
# id :integer not null, primary key
# type :string
# name :string not null
# description :string default("")
# population_bonus :decimal(12, 4) default(0.0)
# melange_bonus :decimal(12, 4) default(0.0)
# material_bonus :decimal(12, 4) default(0.0)
# solar_bonus :decimal(12, 4) default(0.0)
# exp_bonus :decimal(12, 4) default(0.0)
# population_cost :decimal(12, 4) default(0.0)
# melange_cost :decimal(12, 4) default(0.0)
# material_cost :decimal(12, 4) default(0.0)
# solar_cost :decimal(12, 4) default(0.0)
# exp_cost :decimal(12, 4) default(0.0)
# created_at :datetime not null
# updated_at :datetime not null
#

class Building::Population::Town < Building::Population
end
Loading

0 comments on commit 0d8ac72

Please sign in to comment.