diff --git a/.env b/.env index d0c634f..0a4a651 100644 --- a/.env +++ b/.env @@ -1,3 +1,4 @@ DATABASE_HOST="localhost" DATABASE_USERNAME="postgres" DATABASE_PASSWORD="123456789" +GMAPS_API_KEY="AIzaSyDER_9uXL3OuxKC8xktXfEZQIs8jRr0ZaY" diff --git a/Gemfile b/Gemfile index 6d2ae6e..7d2a119 100644 --- a/Gemfile +++ b/Gemfile @@ -19,6 +19,8 @@ gem 'cancancan' # Manejo de permisos gem 'slim-rails' # Hacer HTML mas legible gem 'dotenv' # Gema para manejar claves y variables de la maquina gem 'aasm' # Gema para manejar estados +gem 'gmaps-rails' + # Gemas solo para usar en la maquina local group :development, :test do diff --git a/Gemfile.lock b/Gemfile.lock index d3d65dc..002872f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -82,6 +82,8 @@ GEM ffi (1.10.0) globalid (0.4.2) activesupport (>= 4.2.0) + gmaps-rails (0.0.2) + rails i18n (1.5.1) concurrent-ruby (~> 1.0) jbuilder (2.8.0) @@ -236,6 +238,7 @@ DEPENDENCIES devise dotenv erd + gmaps-rails jbuilder (~> 2.5) letter_opener listen (>= 3.0.5, < 3.2) @@ -258,4 +261,4 @@ RUBY VERSION ruby 2.5.3p105 BUNDLED WITH - 1.17.2 + 1.17.3 diff --git a/app/assets/javascripts/access_points.coffee b/app/assets/javascripts/access_points.coffee new file mode 100644 index 0000000..24f83d1 --- /dev/null +++ b/app/assets/javascripts/access_points.coffee @@ -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/ diff --git a/app/assets/javascripts/cordinates.coffee b/app/assets/javascripts/cordinates.coffee new file mode 100644 index 0000000..24f83d1 --- /dev/null +++ b/app/assets/javascripts/cordinates.coffee @@ -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/ diff --git a/app/assets/javascripts/data.coffee b/app/assets/javascripts/data.coffee new file mode 100644 index 0000000..24f83d1 --- /dev/null +++ b/app/assets/javascripts/data.coffee @@ -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/ diff --git a/app/assets/javascripts/location_devices.coffee b/app/assets/javascripts/location_devices.coffee new file mode 100644 index 0000000..24f83d1 --- /dev/null +++ b/app/assets/javascripts/location_devices.coffee @@ -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/ diff --git a/app/assets/javascripts/mobiles.coffee b/app/assets/javascripts/mobiles.coffee new file mode 100644 index 0000000..24f83d1 --- /dev/null +++ b/app/assets/javascripts/mobiles.coffee @@ -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/ diff --git a/app/assets/javascripts/permises.coffee b/app/assets/javascripts/permises.coffee new file mode 100644 index 0000000..24f83d1 --- /dev/null +++ b/app/assets/javascripts/permises.coffee @@ -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/ diff --git a/app/assets/javascripts/permises_roles.coffee b/app/assets/javascripts/permises_roles.coffee new file mode 100644 index 0000000..24f83d1 --- /dev/null +++ b/app/assets/javascripts/permises_roles.coffee @@ -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/ diff --git a/app/assets/javascripts/roles.coffee b/app/assets/javascripts/roles.coffee new file mode 100644 index 0000000..24f83d1 --- /dev/null +++ b/app/assets/javascripts/roles.coffee @@ -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/ diff --git a/app/assets/javascripts/zone.coffee b/app/assets/javascripts/zone.coffee new file mode 100644 index 0000000..24f83d1 --- /dev/null +++ b/app/assets/javascripts/zone.coffee @@ -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/ diff --git a/app/assets/javascripts/zone__devices.coffee b/app/assets/javascripts/zone__devices.coffee new file mode 100644 index 0000000..24f83d1 --- /dev/null +++ b/app/assets/javascripts/zone__devices.coffee @@ -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/ diff --git a/app/assets/javascripts/zones.coffee b/app/assets/javascripts/zones.coffee new file mode 100644 index 0000000..24f83d1 --- /dev/null +++ b/app/assets/javascripts/zones.coffee @@ -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/ diff --git a/app/assets/stylesheets/access_points.scss b/app/assets/stylesheets/access_points.scss new file mode 100644 index 0000000..1fb7ade --- /dev/null +++ b/app/assets/stylesheets/access_points.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the access_points controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/cordinates.scss b/app/assets/stylesheets/cordinates.scss new file mode 100644 index 0000000..beaa800 --- /dev/null +++ b/app/assets/stylesheets/cordinates.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the cordinates controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/data.scss b/app/assets/stylesheets/data.scss new file mode 100644 index 0000000..36909b2 --- /dev/null +++ b/app/assets/stylesheets/data.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the data controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/location_devices.scss b/app/assets/stylesheets/location_devices.scss new file mode 100644 index 0000000..a51ba86 --- /dev/null +++ b/app/assets/stylesheets/location_devices.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the location_devices controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/mobiles.scss b/app/assets/stylesheets/mobiles.scss new file mode 100644 index 0000000..15f069e --- /dev/null +++ b/app/assets/stylesheets/mobiles.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the mobiles controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/permises.scss b/app/assets/stylesheets/permises.scss new file mode 100644 index 0000000..dd77e2a --- /dev/null +++ b/app/assets/stylesheets/permises.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the permises controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/permises_roles.scss b/app/assets/stylesheets/permises_roles.scss new file mode 100644 index 0000000..9429750 --- /dev/null +++ b/app/assets/stylesheets/permises_roles.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the permises_roles controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/roles.scss b/app/assets/stylesheets/roles.scss new file mode 100644 index 0000000..e229ce0 --- /dev/null +++ b/app/assets/stylesheets/roles.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the roles controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/scaffolds.scss b/app/assets/stylesheets/scaffolds.scss new file mode 100644 index 0000000..6045188 --- /dev/null +++ b/app/assets/stylesheets/scaffolds.scss @@ -0,0 +1,84 @@ +body { + background-color: #fff; + color: #333; + margin: 33px; + font-family: verdana, arial, helvetica, sans-serif; + font-size: 13px; + line-height: 18px; +} + +p, ol, ul, td { + font-family: verdana, arial, helvetica, sans-serif; + font-size: 13px; + line-height: 18px; +} + +pre { + background-color: #eee; + padding: 10px; + font-size: 11px; +} + +a { + color: #000; + + &:visited { + color: #666; + } + + &:hover { + color: #fff; + background-color: #000; + } +} + +th { + padding-bottom: 5px; +} + +td { + padding: 0 5px 7px; +} + +div { + &.field, &.actions { + margin-bottom: 10px; + } +} + +#notice { + color: green; +} + +.field_with_errors { + padding: 2px; + background-color: red; + display: table; +} + +#error_explanation { + width: 450px; + border: 2px solid red; + padding: 7px 7px 0; + margin-bottom: 20px; + background-color: #f0f0f0; + + h2 { + text-align: left; + font-weight: bold; + padding: 5px 5px 5px 15px; + font-size: 12px; + margin: -7px -7px 0; + background-color: #c00; + color: #fff; + } + + ul li { + font-size: 12px; + list-style: square; + } +} + +label { + display: block; +} diff --git a/app/assets/stylesheets/zone.scss b/app/assets/stylesheets/zone.scss new file mode 100644 index 0000000..dfab000 --- /dev/null +++ b/app/assets/stylesheets/zone.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the zone controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/zone__devices.scss b/app/assets/stylesheets/zone__devices.scss new file mode 100644 index 0000000..9e50b64 --- /dev/null +++ b/app/assets/stylesheets/zone__devices.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the zone__devices controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/zones.scss b/app/assets/stylesheets/zones.scss new file mode 100644 index 0000000..b567b7e --- /dev/null +++ b/app/assets/stylesheets/zones.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the zones controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/controllers/access_points_controller.rb b/app/controllers/access_points_controller.rb new file mode 100644 index 0000000..9e2d9b6 --- /dev/null +++ b/app/controllers/access_points_controller.rb @@ -0,0 +1,74 @@ +class AccessPointsController < ApplicationController + before_action :set_access_point, only: [:show, :edit, :update, :destroy] + + # GET /access_points + # GET /access_points.json + def index + @access_points = AccessPoint.all + end + + # GET /access_points/1 + # GET /access_points/1.json + def show + end + + # GET /access_points/new + def new + @access_point = AccessPoint.new + end + + # GET /access_points/1/edit + def edit + end + + # POST /access_points + # POST /access_points.json + def create + @access_point = AccessPoint.new(access_point_params) + + respond_to do |format| + if @access_point.save + format.html { redirect_to @access_point, notice: 'Access point was successfully created.' } + format.json { render :show, status: :created, location: @access_point } + else + format.html { render :new } + format.json { render json: @access_point.errors, status: :unprocessable_entity } + end + end + end + + # PATCH/PUT /access_points/1 + # PATCH/PUT /access_points/1.json + def update + respond_to do |format| + if @access_point.update(access_point_params) + format.html { redirect_to @access_point, notice: 'Access point was successfully updated.' } + format.json { render :show, status: :ok, location: @access_point } + else + format.html { render :edit } + format.json { render json: @access_point.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /access_points/1 + # DELETE /access_points/1.json + def destroy + @access_point.destroy + respond_to do |format| + format.html { redirect_to access_points_url, notice: 'Access point was successfully destroyed.' } + format.json { head :no_content } + end + end + + private + # Use callbacks to share common setup or constraints between actions. + def set_access_point + @access_point = AccessPoint.find(params[:id]) + end + + # Never trust parameters from the scary internet, only allow the white list through. + def access_point_params + params.require(:access_point).permit(:ip_address, :mac_address, :user, :password) + end +end diff --git a/app/controllers/cordinates_controller.rb b/app/controllers/cordinates_controller.rb new file mode 100644 index 0000000..1c7e10a --- /dev/null +++ b/app/controllers/cordinates_controller.rb @@ -0,0 +1,74 @@ +class CordinatesController < ApplicationController + before_action :set_cordinate, only: [:show, :edit, :update, :destroy] + + # GET /cordinates + # GET /cordinates.json + def index + @cordinates = Cordinate.all + end + + # GET /cordinates/1 + # GET /cordinates/1.json + def show + end + + # GET /cordinates/new + def new + @cordinate = Cordinate.new + end + + # GET /cordinates/1/edit + def edit + end + + # POST /cordinates + # POST /cordinates.json + def create + @cordinate = Cordinate.new(cordinate_params) + + respond_to do |format| + if @cordinate.save + format.html { redirect_to @cordinate, notice: 'Cordinate was successfully created.' } + format.json { render :show, status: :created, location: @cordinate } + else + format.html { render :new } + format.json { render json: @cordinate.errors, status: :unprocessable_entity } + end + end + end + + # PATCH/PUT /cordinates/1 + # PATCH/PUT /cordinates/1.json + def update + respond_to do |format| + if @cordinate.update(cordinate_params) + format.html { redirect_to @cordinate, notice: 'Cordinate was successfully updated.' } + format.json { render :show, status: :ok, location: @cordinate } + else + format.html { render :edit } + format.json { render json: @cordinate.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /cordinates/1 + # DELETE /cordinates/1.json + def destroy + @cordinate.destroy + respond_to do |format| + format.html { redirect_to cordinates_url, notice: 'Cordinate was successfully destroyed.' } + format.json { head :no_content } + end + end + + private + # Use callbacks to share common setup or constraints between actions. + def set_cordinate + @cordinate = Cordinate.find(params[:id]) + end + + # Never trust parameters from the scary internet, only allow the white list through. + def cordinate_params + params.require(:cordinate).permit(:latitude, :longitude) + end +end diff --git a/app/controllers/dashboard_controller.rb b/app/controllers/dashboard_controller.rb index e8f129a..f93d5e9 100644 --- a/app/controllers/dashboard_controller.rb +++ b/app/controllers/dashboard_controller.rb @@ -1,4 +1,15 @@ class DashboardController < ApplicationController def home + @map = GMaps.new(div: '#map', lat: -12.043333, lng: -77.028333) + @map.addMarker(lat: -12.043333, + lng: -77.028333, + title: 'Lima', + click: GMaps::JS["function(e) { alert('You clicked in this marker'); }"]) + @map.addMarker(lat: -12.042, + lng: -77.028333, + title: 'Marker with InfoWindow', + infoWindow: { + content: '

HTML Content

' + }) end end diff --git a/app/controllers/data_controller.rb b/app/controllers/data_controller.rb new file mode 100644 index 0000000..86f5599 --- /dev/null +++ b/app/controllers/data_controller.rb @@ -0,0 +1,74 @@ +class DataController < ApplicationController + before_action :set_datum, only: [:show, :edit, :update, :destroy] + + # GET /data + # GET /data.json + def index + @data = Datum.all + end + + # GET /data/1 + # GET /data/1.json + def show + end + + # GET /data/new + def new + @datum = Datum.new + end + + # GET /data/1/edit + def edit + end + + # POST /data + # POST /data.json + def create + @datum = Datum.new(datum_params) + + respond_to do |format| + if @datum.save + format.html { redirect_to @datum, notice: 'Datum was successfully created.' } + format.json { render :show, status: :created, location: @datum } + else + format.html { render :new } + format.json { render json: @datum.errors, status: :unprocessable_entity } + end + end + end + + # PATCH/PUT /data/1 + # PATCH/PUT /data/1.json + def update + respond_to do |format| + if @datum.update(datum_params) + format.html { redirect_to @datum, notice: 'Datum was successfully updated.' } + format.json { render :show, status: :ok, location: @datum } + else + format.html { render :edit } + format.json { render json: @datum.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /data/1 + # DELETE /data/1.json + def destroy + @datum.destroy + respond_to do |format| + format.html { redirect_to data_url, notice: 'Datum was successfully destroyed.' } + format.json { head :no_content } + end + end + + private + # Use callbacks to share common setup or constraints between actions. + def set_datum + @datum = Datum.find(params[:id]) + end + + # Never trust parameters from the scary internet, only allow the white list through. + def datum_params + params.require(:datum).permit(:mobile_id, :type, :value) + end +end diff --git a/app/controllers/devices_controller.rb b/app/controllers/devices_controller.rb new file mode 100644 index 0000000..aceeae1 --- /dev/null +++ b/app/controllers/devices_controller.rb @@ -0,0 +1,74 @@ +class DevicesController < ApplicationController + before_action :set_device, only: [:show, :edit, :update, :destroy] + + # GET /devices + # GET /devices.json + def index + @devices = Device.all + end + + # GET /devices/1 + # GET /devices/1.json + def show + end + + # GET /devices/new + def new + @device = Device.new + end + + # GET /devices/1/edit + def edit + end + + # POST /devices + # POST /devices.json + def create + @device = Device.new(device_params) + + respond_to do |format| + if @device.save + format.html { redirect_to @device, notice: 'Device was successfully created.' } + format.json { render :show, status: :created, location: @device } + else + format.html { render :new } + format.json { render json: @device.errors, status: :unprocessable_entity } + end + end + end + + # PATCH/PUT /devices/1 + # PATCH/PUT /devices/1.json + def update + respond_to do |format| + if @device.update(device_params) + format.html { redirect_to @device, notice: 'Device was successfully updated.' } + format.json { render :show, status: :ok, location: @device } + else + format.html { render :edit } + format.json { render json: @device.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /devices/1 + # DELETE /devices/1.json + def destroy + @device.destroy + respond_to do |format| + format.html { redirect_to devices_url, notice: 'Device was successfully destroyed.' } + format.json { head :no_content } + end + end + + private + # Use callbacks to share common setup or constraints between actions. + def set_device + @device = Device.find(params[:id]) + end + + # Never trust parameters from the scary internet, only allow the white list through. + def device_params + params.fetch(:device, {}) + end +end diff --git a/app/controllers/location_devices_controller.rb b/app/controllers/location_devices_controller.rb new file mode 100644 index 0000000..cbc1926 --- /dev/null +++ b/app/controllers/location_devices_controller.rb @@ -0,0 +1,74 @@ +class LocationDevicesController < ApplicationController + before_action :set_location_device, only: [:show, :edit, :update, :destroy] + + # GET /location_devices + # GET /location_devices.json + def index + @location_devices = LocationDevice.all + end + + # GET /location_devices/1 + # GET /location_devices/1.json + def show + end + + # GET /location_devices/new + def new + @location_device = LocationDevice.new + end + + # GET /location_devices/1/edit + def edit + end + + # POST /location_devices + # POST /location_devices.json + def create + @location_device = LocationDevice.new(location_device_params) + + respond_to do |format| + if @location_device.save + format.html { redirect_to @location_device, notice: 'Location device was successfully created.' } + format.json { render :show, status: :created, location: @location_device } + else + format.html { render :new } + format.json { render json: @location_device.errors, status: :unprocessable_entity } + end + end + end + + # PATCH/PUT /location_devices/1 + # PATCH/PUT /location_devices/1.json + def update + respond_to do |format| + if @location_device.update(location_device_params) + format.html { redirect_to @location_device, notice: 'Location device was successfully updated.' } + format.json { render :show, status: :ok, location: @location_device } + else + format.html { render :edit } + format.json { render json: @location_device.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /location_devices/1 + # DELETE /location_devices/1.json + def destroy + @location_device.destroy + respond_to do |format| + format.html { redirect_to location_devices_url, notice: 'Location device was successfully destroyed.' } + format.json { head :no_content } + end + end + + private + # Use callbacks to share common setup or constraints between actions. + def set_location_device + @location_device = LocationDevice.find(params[:id]) + end + + # Never trust parameters from the scary internet, only allow the white list through. + def location_device_params + params.require(:location_device).permit(:access_point_id, :coordenate_id) + end +end diff --git a/app/controllers/mobiles_controller.rb b/app/controllers/mobiles_controller.rb new file mode 100644 index 0000000..03e3a10 --- /dev/null +++ b/app/controllers/mobiles_controller.rb @@ -0,0 +1,74 @@ +class MobilesController < ApplicationController + before_action :set_mobile, only: [:show, :edit, :update, :destroy] + + # GET /mobiles + # GET /mobiles.json + def index + @mobiles = Mobile.all + end + + # GET /mobiles/1 + # GET /mobiles/1.json + def show + end + + # GET /mobiles/new + def new + @mobile = Mobile.new + end + + # GET /mobiles/1/edit + def edit + end + + # POST /mobiles + # POST /mobiles.json + def create + @mobile = Mobile.new(mobile_params) + + respond_to do |format| + if @mobile.save + format.html { redirect_to @mobile, notice: 'Mobile was successfully created.' } + format.json { render :show, status: :created, location: @mobile } + else + format.html { render :new } + format.json { render json: @mobile.errors, status: :unprocessable_entity } + end + end + end + + # PATCH/PUT /mobiles/1 + # PATCH/PUT /mobiles/1.json + def update + respond_to do |format| + if @mobile.update(mobile_params) + format.html { redirect_to @mobile, notice: 'Mobile was successfully updated.' } + format.json { render :show, status: :ok, location: @mobile } + else + format.html { render :edit } + format.json { render json: @mobile.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /mobiles/1 + # DELETE /mobiles/1.json + def destroy + @mobile.destroy + respond_to do |format| + format.html { redirect_to mobiles_url, notice: 'Mobile was successfully destroyed.' } + format.json { head :no_content } + end + end + + private + # Use callbacks to share common setup or constraints between actions. + def set_mobile + @mobile = Mobile.find(params[:id]) + end + + # Never trust parameters from the scary internet, only allow the white list through. + def mobile_params + params.require(:mobile).permit(:modelo, :mac_address) + end +end diff --git a/app/controllers/permises_controller.rb b/app/controllers/permises_controller.rb new file mode 100644 index 0000000..a420a5a --- /dev/null +++ b/app/controllers/permises_controller.rb @@ -0,0 +1,74 @@ +class PermisesController < ApplicationController + before_action :set_permise, only: [:show, :edit, :update, :destroy] + + # GET /permises + # GET /permises.json + def index + @permises = Permise.all + end + + # GET /permises/1 + # GET /permises/1.json + def show + end + + # GET /permises/new + def new + @permise = Permise.new + end + + # GET /permises/1/edit + def edit + end + + # POST /permises + # POST /permises.json + def create + @permise = Permise.new(permise_params) + + respond_to do |format| + if @permise.save + format.html { redirect_to @permise, notice: 'Permise was successfully created.' } + format.json { render :show, status: :created, location: @permise } + else + format.html { render :new } + format.json { render json: @permise.errors, status: :unprocessable_entity } + end + end + end + + # PATCH/PUT /permises/1 + # PATCH/PUT /permises/1.json + def update + respond_to do |format| + if @permise.update(permise_params) + format.html { redirect_to @permise, notice: 'Permise was successfully updated.' } + format.json { render :show, status: :ok, location: @permise } + else + format.html { render :edit } + format.json { render json: @permise.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /permises/1 + # DELETE /permises/1.json + def destroy + @permise.destroy + respond_to do |format| + format.html { redirect_to permises_url, notice: 'Permise was successfully destroyed.' } + format.json { head :no_content } + end + end + + private + # Use callbacks to share common setup or constraints between actions. + def set_permise + @permise = Permise.find(params[:id]) + end + + # Never trust parameters from the scary internet, only allow the white list through. + def permise_params + params.require(:permise).permit(:object, :method) + end +end diff --git a/app/controllers/permises_roles_controller.rb b/app/controllers/permises_roles_controller.rb new file mode 100644 index 0000000..febd399 --- /dev/null +++ b/app/controllers/permises_roles_controller.rb @@ -0,0 +1,74 @@ +class PermisesRolesController < ApplicationController + before_action :set_permises_role, only: [:show, :edit, :update, :destroy] + + # GET /permises_roles + # GET /permises_roles.json + def index + @permises_roles = PermisesRole.all + end + + # GET /permises_roles/1 + # GET /permises_roles/1.json + def show + end + + # GET /permises_roles/new + def new + @permises_role = PermisesRole.new + end + + # GET /permises_roles/1/edit + def edit + end + + # POST /permises_roles + # POST /permises_roles.json + def create + @permises_role = PermisesRole.new(permises_role_params) + + respond_to do |format| + if @permises_role.save + format.html { redirect_to @permises_role, notice: 'Permises role was successfully created.' } + format.json { render :show, status: :created, location: @permises_role } + else + format.html { render :new } + format.json { render json: @permises_role.errors, status: :unprocessable_entity } + end + end + end + + # PATCH/PUT /permises_roles/1 + # PATCH/PUT /permises_roles/1.json + def update + respond_to do |format| + if @permises_role.update(permises_role_params) + format.html { redirect_to @permises_role, notice: 'Permises role was successfully updated.' } + format.json { render :show, status: :ok, location: @permises_role } + else + format.html { render :edit } + format.json { render json: @permises_role.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /permises_roles/1 + # DELETE /permises_roles/1.json + def destroy + @permises_role.destroy + respond_to do |format| + format.html { redirect_to permises_roles_url, notice: 'Permises role was successfully destroyed.' } + format.json { head :no_content } + end + end + + private + # Use callbacks to share common setup or constraints between actions. + def set_permises_role + @permises_role = PermisesRole.find(params[:id]) + end + + # Never trust parameters from the scary internet, only allow the white list through. + def permises_role_params + params.require(:permises_role).permit(:permises_id, :roles_id) + end +end diff --git a/app/controllers/roles_controller.rb b/app/controllers/roles_controller.rb new file mode 100644 index 0000000..1e814d3 --- /dev/null +++ b/app/controllers/roles_controller.rb @@ -0,0 +1,74 @@ +class RolesController < ApplicationController + before_action :set_role, only: [:show, :edit, :update, :destroy] + + # GET /roles + # GET /roles.json + def index + @roles = Role.all + end + + # GET /roles/1 + # GET /roles/1.json + def show + end + + # GET /roles/new + def new + @role = Role.new + end + + # GET /roles/1/edit + def edit + end + + # POST /roles + # POST /roles.json + def create + @role = Role.new(role_params) + + respond_to do |format| + if @role.save + format.html { redirect_to @role, notice: 'Role was successfully created.' } + format.json { render :show, status: :created, location: @role } + else + format.html { render :new } + format.json { render json: @role.errors, status: :unprocessable_entity } + end + end + end + + # PATCH/PUT /roles/1 + # PATCH/PUT /roles/1.json + def update + respond_to do |format| + if @role.update(role_params) + format.html { redirect_to @role, notice: 'Role was successfully updated.' } + format.json { render :show, status: :ok, location: @role } + else + format.html { render :edit } + format.json { render json: @role.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /roles/1 + # DELETE /roles/1.json + def destroy + @role.destroy + respond_to do |format| + format.html { redirect_to roles_url, notice: 'Role was successfully destroyed.' } + format.json { head :no_content } + end + end + + private + # Use callbacks to share common setup or constraints between actions. + def set_role + @role = Role.find(params[:id]) + end + + # Never trust parameters from the scary internet, only allow the white list through. + def role_params + params.require(:role).permit(:name, :description) + end +end diff --git a/app/controllers/zone__devices_controller.rb b/app/controllers/zone__devices_controller.rb new file mode 100644 index 0000000..d370cfd --- /dev/null +++ b/app/controllers/zone__devices_controller.rb @@ -0,0 +1,74 @@ +class ZoneDevicesController < ApplicationController + before_action :set_zone__device, only: [:show, :edit, :update, :destroy] + + # GET /zone__devices + # GET /zone__devices.json + def index + @zone__devices = ZoneDevice.all + end + + # GET /zone__devices/1 + # GET /zone__devices/1.json + def show + end + + # GET /zone__devices/new + def new + @zone__device = ZoneDevice.new + end + + # GET /zone__devices/1/edit + def edit + end + + # POST /zone__devices + # POST /zone__devices.json + def create + @zone__device = ZoneDevice.new(zone__device_params) + + respond_to do |format| + if @zone__device.save + format.html { redirect_to @zone__device, notice: 'Zone device was successfully created.' } + format.json { render :show, status: :created, location: @zone__device } + else + format.html { render :new } + format.json { render json: @zone__device.errors, status: :unprocessable_entity } + end + end + end + + # PATCH/PUT /zone__devices/1 + # PATCH/PUT /zone__devices/1.json + def update + respond_to do |format| + if @zone__device.update(zone__device_params) + format.html { redirect_to @zone__device, notice: 'Zone device was successfully updated.' } + format.json { render :show, status: :ok, location: @zone__device } + else + format.html { render :edit } + format.json { render json: @zone__device.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /zone__devices/1 + # DELETE /zone__devices/1.json + def destroy + @zone__device.destroy + respond_to do |format| + format.html { redirect_to zone__devices_url, notice: 'Zone device was successfully destroyed.' } + format.json { head :no_content } + end + end + + private + # Use callbacks to share common setup or constraints between actions. + def set_zone__device + @zone__device = ZoneDevice.find(params[:id]) + end + + # Never trust parameters from the scary internet, only allow the white list through. + def zone__device_params + params.require(:zone__device).permit(:access_point_id, :zone_id) + end +end diff --git a/app/controllers/zones_controller.rb b/app/controllers/zones_controller.rb new file mode 100644 index 0000000..07d46d2 --- /dev/null +++ b/app/controllers/zones_controller.rb @@ -0,0 +1,74 @@ +class ZonesController < ApplicationController + before_action :set_zone, only: [:show, :edit, :update, :destroy] + + # GET /zones + # GET /zones.json + def index + @zones = Zone.all + end + + # GET /zones/1 + # GET /zones/1.json + def show + end + + # GET /zones/new + def new + @zone = Zone.new + end + + # GET /zones/1/edit + def edit + end + + # POST /zones + # POST /zones.json + def create + @zone = Zone.new(zone_params) + + respond_to do |format| + if @zone.save + format.html { redirect_to @zone, notice: 'Zone was successfully created.' } + format.json { render :show, status: :created, location: @zone } + else + format.html { render :new } + format.json { render json: @zone.errors, status: :unprocessable_entity } + end + end + end + + # PATCH/PUT /zones/1 + # PATCH/PUT /zones/1.json + def update + respond_to do |format| + if @zone.update(zone_params) + format.html { redirect_to @zone, notice: 'Zone was successfully updated.' } + format.json { render :show, status: :ok, location: @zone } + else + format.html { render :edit } + format.json { render json: @zone.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /zones/1 + # DELETE /zones/1.json + def destroy + @zone.destroy + respond_to do |format| + format.html { redirect_to zones_url, notice: 'Zone was successfully destroyed.' } + format.json { head :no_content } + end + end + + private + # Use callbacks to share common setup or constraints between actions. + def set_zone + @zone = Zone.find(params[:id]) + end + + # Never trust parameters from the scary internet, only allow the white list through. + def zone_params + params.require(:zone).permit(:name, :description) + end +end diff --git a/app/helpers/access_points_helper.rb b/app/helpers/access_points_helper.rb new file mode 100644 index 0000000..2983ed1 --- /dev/null +++ b/app/helpers/access_points_helper.rb @@ -0,0 +1,2 @@ +module AccessPointsHelper +end diff --git a/app/helpers/cordinates_helper.rb b/app/helpers/cordinates_helper.rb new file mode 100644 index 0000000..3707e13 --- /dev/null +++ b/app/helpers/cordinates_helper.rb @@ -0,0 +1,2 @@ +module CordinatesHelper +end diff --git a/app/helpers/data_helper.rb b/app/helpers/data_helper.rb new file mode 100644 index 0000000..e68f25e --- /dev/null +++ b/app/helpers/data_helper.rb @@ -0,0 +1,2 @@ +module DataHelper +end diff --git a/app/helpers/devices_helper.rb b/app/helpers/devices_helper.rb new file mode 100644 index 0000000..c0e9e88 --- /dev/null +++ b/app/helpers/devices_helper.rb @@ -0,0 +1,2 @@ +module DevicesHelper +end diff --git a/app/helpers/location_devices_helper.rb b/app/helpers/location_devices_helper.rb new file mode 100644 index 0000000..506a71e --- /dev/null +++ b/app/helpers/location_devices_helper.rb @@ -0,0 +1,2 @@ +module LocationDevicesHelper +end diff --git a/app/helpers/mobiles_helper.rb b/app/helpers/mobiles_helper.rb new file mode 100644 index 0000000..c720206 --- /dev/null +++ b/app/helpers/mobiles_helper.rb @@ -0,0 +1,2 @@ +module MobilesHelper +end diff --git a/app/helpers/permises_helper.rb b/app/helpers/permises_helper.rb new file mode 100644 index 0000000..96c0867 --- /dev/null +++ b/app/helpers/permises_helper.rb @@ -0,0 +1,2 @@ +module PermisesHelper +end diff --git a/app/helpers/permises_roles_helper.rb b/app/helpers/permises_roles_helper.rb new file mode 100644 index 0000000..8d14d05 --- /dev/null +++ b/app/helpers/permises_roles_helper.rb @@ -0,0 +1,2 @@ +module PermisesRolesHelper +end diff --git a/app/helpers/roles_helper.rb b/app/helpers/roles_helper.rb new file mode 100644 index 0000000..6b6b6cc --- /dev/null +++ b/app/helpers/roles_helper.rb @@ -0,0 +1,2 @@ +module RolesHelper +end diff --git a/app/helpers/zone__devices_helper.rb b/app/helpers/zone__devices_helper.rb new file mode 100644 index 0000000..7158a1b --- /dev/null +++ b/app/helpers/zone__devices_helper.rb @@ -0,0 +1,2 @@ +module ZoneDevicesHelper +end diff --git a/app/helpers/zone_helper.rb b/app/helpers/zone_helper.rb new file mode 100644 index 0000000..e2fa4a1 --- /dev/null +++ b/app/helpers/zone_helper.rb @@ -0,0 +1,2 @@ +module ZoneHelper +end diff --git a/app/helpers/zones_helper.rb b/app/helpers/zones_helper.rb new file mode 100644 index 0000000..0963690 --- /dev/null +++ b/app/helpers/zones_helper.rb @@ -0,0 +1,2 @@ +module ZonesHelper +end diff --git a/app/models/access_point.rb b/app/models/access_point.rb new file mode 100644 index 0000000..2586d3a --- /dev/null +++ b/app/models/access_point.rb @@ -0,0 +1,2 @@ +class AccessPoint < ApplicationRecord +end diff --git a/app/models/cordinate.rb b/app/models/cordinate.rb new file mode 100644 index 0000000..177ba76 --- /dev/null +++ b/app/models/cordinate.rb @@ -0,0 +1,2 @@ +class Cordinate < ApplicationRecord +end diff --git a/app/models/datum.rb b/app/models/datum.rb new file mode 100644 index 0000000..0237e5f --- /dev/null +++ b/app/models/datum.rb @@ -0,0 +1,3 @@ +class Datum < ApplicationRecord + belongs_to :mobile +end diff --git a/app/models/device.rb b/app/models/device.rb deleted file mode 100644 index 8e4f9a0..0000000 --- a/app/models/device.rb +++ /dev/null @@ -1,6 +0,0 @@ -class Device < ApplicationRecord - include AASM - - aasm :column => 'status' do - end -end diff --git a/app/models/devise_position.rb b/app/models/devise_position.rb deleted file mode 100644 index 20ee549..0000000 --- a/app/models/devise_position.rb +++ /dev/null @@ -1,8 +0,0 @@ -class DevisePosition < ApplicationRecord - include AASM - - aasm :column => 'status' do - end - belongs_to :device - belongs_to :location -end diff --git a/app/models/limite_zone.rb b/app/models/limite_zone.rb new file mode 100644 index 0000000..2707bb6 --- /dev/null +++ b/app/models/limite_zone.rb @@ -0,0 +1,4 @@ +class LimiteZone < ApplicationRecord + belongs_to :zones + belongs_to :coordinate +end diff --git a/app/models/location.rb b/app/models/location.rb deleted file mode 100644 index ff1668e..0000000 --- a/app/models/location.rb +++ /dev/null @@ -1,2 +0,0 @@ -class Location < ApplicationRecord -end diff --git a/app/models/location_device.rb b/app/models/location_device.rb new file mode 100644 index 0000000..cdfc5ce --- /dev/null +++ b/app/models/location_device.rb @@ -0,0 +1,4 @@ +class LocationDevice < ApplicationRecord + belongs_to :access_point + belongs_to :coordenate +end diff --git a/app/models/mobile.rb b/app/models/mobile.rb index 73102fd..3c639a3 100644 --- a/app/models/mobile.rb +++ b/app/models/mobile.rb @@ -1,7 +1,2 @@ class Mobile < ApplicationRecord - include AASM - - aasm :column => 'status' do - end - belongs_to :user end diff --git a/app/models/mobile_ip.rb b/app/models/mobile_ip.rb deleted file mode 100644 index fd055b7..0000000 --- a/app/models/mobile_ip.rb +++ /dev/null @@ -1,3 +0,0 @@ -class MobileIp < ApplicationRecord - belongs_to :mobile -end diff --git a/app/models/mobile_location.rb b/app/models/mobile_location.rb deleted file mode 100644 index 0cf299a..0000000 --- a/app/models/mobile_location.rb +++ /dev/null @@ -1,4 +0,0 @@ -class MobileLocation < ApplicationRecord - belongs_to :mobile - belongs_to :location -end diff --git a/app/models/permise.rb b/app/models/permise.rb new file mode 100644 index 0000000..0844a89 --- /dev/null +++ b/app/models/permise.rb @@ -0,0 +1,2 @@ +class Permise < ApplicationRecord +end diff --git a/app/models/permises_role.rb b/app/models/permises_role.rb new file mode 100644 index 0000000..8fab56e --- /dev/null +++ b/app/models/permises_role.rb @@ -0,0 +1,4 @@ +class PermisesRole < ApplicationRecord + belongs_to :permises + belongs_to :roles +end diff --git a/app/models/permission.rb b/app/models/permission.rb deleted file mode 100644 index 1cdff7b..0000000 --- a/app/models/permission.rb +++ /dev/null @@ -1,2 +0,0 @@ -class Permission < ApplicationRecord -end diff --git a/app/models/role_permission.rb b/app/models/role_permission.rb deleted file mode 100644 index bee3877..0000000 --- a/app/models/role_permission.rb +++ /dev/null @@ -1,4 +0,0 @@ -class RolePermission < ApplicationRecord - belongs_to :role - belongs_to :permission -end diff --git a/app/models/user.rb b/app/models/user.rb deleted file mode 100644 index 9a81135..0000000 --- a/app/models/user.rb +++ /dev/null @@ -1,11 +0,0 @@ -class User < ApplicationRecord - include AASM - - aasm :column => 'status' do - end - # Include default devise modules. Others available are: - # :confirmable, :lockable, :timeoutable, :trackable and :omniauthable - devise :database_authenticatable, :registerable, - :recoverable, :rememberable, :validatable, - :trackable -end diff --git a/app/models/zone.rb b/app/models/zone.rb index 8dbebd3..f4c6e23 100644 --- a/app/models/zone.rb +++ b/app/models/zone.rb @@ -1,6 +1,2 @@ class Zone < ApplicationRecord - include AASM - - aasm :column => 'status' do - end end diff --git a/app/models/zone__device.rb b/app/models/zone__device.rb new file mode 100644 index 0000000..f810c61 --- /dev/null +++ b/app/models/zone__device.rb @@ -0,0 +1,4 @@ +class ZoneDevice < ApplicationRecord + belongs_to :access_point + belongs_to :zone +end diff --git a/app/models/zone_limit.rb b/app/models/zone_limit.rb deleted file mode 100644 index a185689..0000000 --- a/app/models/zone_limit.rb +++ /dev/null @@ -1,4 +0,0 @@ -class ZoneLimit < ApplicationRecord - belongs_to :zone - belongs_to :location -end diff --git a/app/views/access_points/_access_point.json.jbuilder b/app/views/access_points/_access_point.json.jbuilder new file mode 100644 index 0000000..e80caf3 --- /dev/null +++ b/app/views/access_points/_access_point.json.jbuilder @@ -0,0 +1,2 @@ +json.extract! access_point, :id, :ip_address, :mac_address, :user, :password, :created_at, :updated_at +json.url access_point_url(access_point, format: :json) diff --git a/app/views/access_points/_form.html.slim b/app/views/access_points/_form.html.slim new file mode 100644 index 0000000..a41c514 --- /dev/null +++ b/app/views/access_points/_form.html.slim @@ -0,0 +1,21 @@ += form_for @access_point do |f| + - if @access_point.errors.any? + #error_explanation + h2 = "#{pluralize(@access_point.errors.count, "error")} prohibited this access_point from being saved:" + ul + - @access_point.errors.full_messages.each do |message| + li = message + + .field + = f.label :ip_address + = f.text_field :ip_address + .field + = f.label :mac_address + = f.text_field :mac_address + .field + = f.label :user + = f.text_field :user + .field + = f.label :password + = f.text_field :password + .actions = f.submit diff --git a/app/views/access_points/edit.html.slim b/app/views/access_points/edit.html.slim new file mode 100644 index 0000000..53b9cb8 --- /dev/null +++ b/app/views/access_points/edit.html.slim @@ -0,0 +1,8 @@ +h1 Editing access_point + +== render 'form' + +=> link_to 'Show', @access_point +'| +=< link_to 'Back', access_points_path + diff --git a/app/views/access_points/index.html.slim b/app/views/access_points/index.html.slim new file mode 100644 index 0000000..b34f6c5 --- /dev/null +++ b/app/views/access_points/index.html.slim @@ -0,0 +1,27 @@ +h1 Listing access_points + +table + thead + tr + th Ip address + th Mac address + th User + th Password + th + th + th + + tbody + - @access_points.each do |access_point| + tr + td = access_point.ip_address + td = access_point.mac_address + td = access_point.user + td = access_point.password + td = link_to 'Show', access_point + td = link_to 'Edit', edit_access_point_path(access_point) + td = link_to 'Destroy', access_point, data: { confirm: 'Are you sure?' }, method: :delete + +br + += link_to 'New Access point', new_access_point_path diff --git a/app/views/access_points/index.json.jbuilder b/app/views/access_points/index.json.jbuilder new file mode 100644 index 0000000..1ea9a86 --- /dev/null +++ b/app/views/access_points/index.json.jbuilder @@ -0,0 +1 @@ +json.array! @access_points, partial: 'access_points/access_point', as: :access_point diff --git a/app/views/access_points/new.html.slim b/app/views/access_points/new.html.slim new file mode 100644 index 0000000..540c054 --- /dev/null +++ b/app/views/access_points/new.html.slim @@ -0,0 +1,5 @@ +h1 New access_point + +== render 'form' + += link_to 'Back', access_points_path diff --git a/app/views/access_points/show.html.slim b/app/views/access_points/show.html.slim new file mode 100644 index 0000000..825e79a --- /dev/null +++ b/app/views/access_points/show.html.slim @@ -0,0 +1,18 @@ +p#notice = notice + +p + strong Ip address: + = @access_point.ip_address +p + strong Mac address: + = @access_point.mac_address +p + strong User: + = @access_point.user +p + strong Password: + = @access_point.password + +=> link_to 'Edit', edit_access_point_path(@access_point) +'| +=< link_to 'Back', access_points_path diff --git a/app/views/access_points/show.json.jbuilder b/app/views/access_points/show.json.jbuilder new file mode 100644 index 0000000..bd6df4f --- /dev/null +++ b/app/views/access_points/show.json.jbuilder @@ -0,0 +1 @@ +json.partial! "access_points/access_point", access_point: @access_point diff --git a/app/views/dashboard/home.html.erb b/app/views/dashboard/home.html.erb index 20d9e6f..c438426 100644 --- a/app/views/dashboard/home.html.erb +++ b/app/views/dashboard/home.html.erb @@ -1,2 +1,14 @@ -

Dashboard#home

-

Find me in app/views/dashboard/home.html.erb

+
+ + \ No newline at end of file diff --git a/app/views/data/_datum.json.jbuilder b/app/views/data/_datum.json.jbuilder new file mode 100644 index 0000000..bcbb2e4 --- /dev/null +++ b/app/views/data/_datum.json.jbuilder @@ -0,0 +1,2 @@ +json.extract! datum, :id, :mobile_id, :type, :value, :created_at, :updated_at +json.url datum_url(datum, format: :json) diff --git a/app/views/data/_form.html.slim b/app/views/data/_form.html.slim new file mode 100644 index 0000000..d4f1e01 --- /dev/null +++ b/app/views/data/_form.html.slim @@ -0,0 +1,18 @@ += form_for @datum do |f| + - if @datum.errors.any? + #error_explanation + h2 = "#{pluralize(@datum.errors.count, "error")} prohibited this datum from being saved:" + ul + - @datum.errors.full_messages.each do |message| + li = message + + .field + = f.label :mobile + = f.text_field :mobile + .field + = f.label :type + = f.text_field :type + .field + = f.label :value + = f.text_field :value + .actions = f.submit diff --git a/app/views/data/edit.html.slim b/app/views/data/edit.html.slim new file mode 100644 index 0000000..8885fc0 --- /dev/null +++ b/app/views/data/edit.html.slim @@ -0,0 +1,8 @@ +h1 Editing datum + +== render 'form' + +=> link_to 'Show', @datum +'| +=< link_to 'Back', data_path + diff --git a/app/views/data/index.html.slim b/app/views/data/index.html.slim new file mode 100644 index 0000000..b1eabb5 --- /dev/null +++ b/app/views/data/index.html.slim @@ -0,0 +1,25 @@ +h1 Listing data + +table + thead + tr + th Mobile + th Type + th Value + th + th + th + + tbody + - @data.each do |datum| + tr + td = datum.mobile + td = datum.type + td = datum.value + td = link_to 'Show', datum + td = link_to 'Edit', edit_datum_path(datum) + td = link_to 'Destroy', datum, data: { confirm: 'Are you sure?' }, method: :delete + +br + += link_to 'New Datum', new_datum_path diff --git a/app/views/data/index.json.jbuilder b/app/views/data/index.json.jbuilder new file mode 100644 index 0000000..aa55beb --- /dev/null +++ b/app/views/data/index.json.jbuilder @@ -0,0 +1 @@ +json.array! @data, partial: 'data/datum', as: :datum diff --git a/app/views/data/new.html.slim b/app/views/data/new.html.slim new file mode 100644 index 0000000..aea6830 --- /dev/null +++ b/app/views/data/new.html.slim @@ -0,0 +1,5 @@ +h1 New datum + +== render 'form' + += link_to 'Back', data_path diff --git a/app/views/data/show.html.slim b/app/views/data/show.html.slim new file mode 100644 index 0000000..25d6a2c --- /dev/null +++ b/app/views/data/show.html.slim @@ -0,0 +1,15 @@ +p#notice = notice + +p + strong Mobile: + = @datum.mobile +p + strong Type: + = @datum.type +p + strong Value: + = @datum.value + +=> link_to 'Edit', edit_datum_path(@datum) +'| +=< link_to 'Back', data_path diff --git a/app/views/data/show.json.jbuilder b/app/views/data/show.json.jbuilder new file mode 100644 index 0000000..0d93c38 --- /dev/null +++ b/app/views/data/show.json.jbuilder @@ -0,0 +1 @@ +json.partial! "data/datum", datum: @datum diff --git a/app/views/layouts/application.html.slim b/app/views/layouts/application.html.slim index 29105e1..c610fd5 100644 --- a/app/views/layouts/application.html.slim +++ b/app/views/layouts/application.html.slim @@ -1,13 +1,14 @@ doctype html html head - title + title | JPIR = csrf_meta_tags = csp_meta_tag = stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' = javascript_include_tag 'application', 'data-turbolinks-track': 'reload' + javascript_include_tag "http://maps.googleapis.com/maps/api/js?key=#{ENV["GMAPS_A"]}&sensor=true" body.page-session.page-header-fixed.page-sidebar-fixed section#wrapper = render "shared/nav/header" @@ -19,3 +20,4 @@ html = render "shared/nav/footer" #back-top.animated.pulse.circle i.fa.fa-angle-up + script async="" defer="" src="https://maps.googleapis.com/maps/api/js?key=#{ENV['GMAPS_API_KEY']}&callback=initMap" diff --git a/app/views/location_devices/_form.html.slim b/app/views/location_devices/_form.html.slim new file mode 100644 index 0000000..e3cbd37 --- /dev/null +++ b/app/views/location_devices/_form.html.slim @@ -0,0 +1,15 @@ += form_for @location_device do |f| + - if @location_device.errors.any? + #error_explanation + h2 = "#{pluralize(@location_device.errors.count, "error")} prohibited this location_device from being saved:" + ul + - @location_device.errors.full_messages.each do |message| + li = message + + .field + = f.label :access_point + = f.text_field :access_point + .field + = f.label :coordenate + = f.text_field :coordenate + .actions = f.submit diff --git a/app/views/location_devices/_location_device.json.jbuilder b/app/views/location_devices/_location_device.json.jbuilder new file mode 100644 index 0000000..e64f626 --- /dev/null +++ b/app/views/location_devices/_location_device.json.jbuilder @@ -0,0 +1,2 @@ +json.extract! location_device, :id, :access_point_id, :coordenate_id, :created_at, :updated_at +json.url location_device_url(location_device, format: :json) diff --git a/app/views/location_devices/edit.html.slim b/app/views/location_devices/edit.html.slim new file mode 100644 index 0000000..81c0c7d --- /dev/null +++ b/app/views/location_devices/edit.html.slim @@ -0,0 +1,8 @@ +h1 Editing location_device + +== render 'form' + +=> link_to 'Show', @location_device +'| +=< link_to 'Back', location_devices_path + diff --git a/app/views/location_devices/index.html.slim b/app/views/location_devices/index.html.slim new file mode 100644 index 0000000..74b2ec2 --- /dev/null +++ b/app/views/location_devices/index.html.slim @@ -0,0 +1,23 @@ +h1 Listing location_devices + +table + thead + tr + th Access point + th Coordenate + th + th + th + + tbody + - @location_devices.each do |location_device| + tr + td = location_device.access_point + td = location_device.coordenate + td = link_to 'Show', location_device + td = link_to 'Edit', edit_location_device_path(location_device) + td = link_to 'Destroy', location_device, data: { confirm: 'Are you sure?' }, method: :delete + +br + += link_to 'New Location device', new_location_device_path diff --git a/app/views/location_devices/index.json.jbuilder b/app/views/location_devices/index.json.jbuilder new file mode 100644 index 0000000..51afdfb --- /dev/null +++ b/app/views/location_devices/index.json.jbuilder @@ -0,0 +1 @@ +json.array! @location_devices, partial: 'location_devices/location_device', as: :location_device diff --git a/app/views/location_devices/new.html.slim b/app/views/location_devices/new.html.slim new file mode 100644 index 0000000..68d3205 --- /dev/null +++ b/app/views/location_devices/new.html.slim @@ -0,0 +1,5 @@ +h1 New location_device + +== render 'form' + += link_to 'Back', location_devices_path diff --git a/app/views/location_devices/show.html.slim b/app/views/location_devices/show.html.slim new file mode 100644 index 0000000..687c458 --- /dev/null +++ b/app/views/location_devices/show.html.slim @@ -0,0 +1,12 @@ +p#notice = notice + +p + strong Access point: + = @location_device.access_point +p + strong Coordenate: + = @location_device.coordenate + +=> link_to 'Edit', edit_location_device_path(@location_device) +'| +=< link_to 'Back', location_devices_path diff --git a/app/views/location_devices/show.json.jbuilder b/app/views/location_devices/show.json.jbuilder new file mode 100644 index 0000000..5ea6987 --- /dev/null +++ b/app/views/location_devices/show.json.jbuilder @@ -0,0 +1 @@ +json.partial! "location_devices/location_device", location_device: @location_device diff --git a/app/views/mobiles/_form.html.slim b/app/views/mobiles/_form.html.slim new file mode 100644 index 0000000..1bb971c --- /dev/null +++ b/app/views/mobiles/_form.html.slim @@ -0,0 +1,15 @@ += form_for @mobile do |f| + - if @mobile.errors.any? + #error_explanation + h2 = "#{pluralize(@mobile.errors.count, "error")} prohibited this mobile from being saved:" + ul + - @mobile.errors.full_messages.each do |message| + li = message + + .field + = f.label :modelo + = f.text_field :modelo + .field + = f.label :mac_address + = f.text_field :mac_address + .actions = f.submit diff --git a/app/views/mobiles/_mobile.json.jbuilder b/app/views/mobiles/_mobile.json.jbuilder new file mode 100644 index 0000000..794e562 --- /dev/null +++ b/app/views/mobiles/_mobile.json.jbuilder @@ -0,0 +1,2 @@ +json.extract! mobile, :id, :modelo, :mac_address, :created_at, :updated_at +json.url mobile_url(mobile, format: :json) diff --git a/app/views/mobiles/edit.html.slim b/app/views/mobiles/edit.html.slim new file mode 100644 index 0000000..9c23b05 --- /dev/null +++ b/app/views/mobiles/edit.html.slim @@ -0,0 +1,8 @@ +h1 Editing mobile + +== render 'form' + +=> link_to 'Show', @mobile +'| +=< link_to 'Back', mobiles_path + diff --git a/app/views/mobiles/index.html.slim b/app/views/mobiles/index.html.slim new file mode 100644 index 0000000..9fb7014 --- /dev/null +++ b/app/views/mobiles/index.html.slim @@ -0,0 +1,23 @@ +h1 Listing mobiles + +table + thead + tr + th Modelo + th Mac address + th + th + th + + tbody + - @mobiles.each do |mobile| + tr + td = mobile.modelo + td = mobile.mac_address + td = link_to 'Show', mobile + td = link_to 'Edit', edit_mobile_path(mobile) + td = link_to 'Destroy', mobile, data: { confirm: 'Are you sure?' }, method: :delete + +br + += link_to 'New Mobile', new_mobile_path diff --git a/app/views/mobiles/index.json.jbuilder b/app/views/mobiles/index.json.jbuilder new file mode 100644 index 0000000..cb0bfaf --- /dev/null +++ b/app/views/mobiles/index.json.jbuilder @@ -0,0 +1 @@ +json.array! @mobiles, partial: 'mobiles/mobile', as: :mobile diff --git a/app/views/mobiles/new.html.slim b/app/views/mobiles/new.html.slim new file mode 100644 index 0000000..2b7c358 --- /dev/null +++ b/app/views/mobiles/new.html.slim @@ -0,0 +1,5 @@ +h1 New mobile + +== render 'form' + += link_to 'Back', mobiles_path diff --git a/app/views/mobiles/show.html.slim b/app/views/mobiles/show.html.slim new file mode 100644 index 0000000..5ee7203 --- /dev/null +++ b/app/views/mobiles/show.html.slim @@ -0,0 +1,12 @@ +p#notice = notice + +p + strong Modelo: + = @mobile.modelo +p + strong Mac address: + = @mobile.mac_address + +=> link_to 'Edit', edit_mobile_path(@mobile) +'| +=< link_to 'Back', mobiles_path diff --git a/app/views/mobiles/show.json.jbuilder b/app/views/mobiles/show.json.jbuilder new file mode 100644 index 0000000..4c1f6a5 --- /dev/null +++ b/app/views/mobiles/show.json.jbuilder @@ -0,0 +1 @@ +json.partial! "mobiles/mobile", mobile: @mobile diff --git a/app/views/permises/_form.html.slim b/app/views/permises/_form.html.slim new file mode 100644 index 0000000..4b56dc4 --- /dev/null +++ b/app/views/permises/_form.html.slim @@ -0,0 +1,15 @@ += form_for @permise do |f| + - if @permise.errors.any? + #error_explanation + h2 = "#{pluralize(@permise.errors.count, "error")} prohibited this permise from being saved:" + ul + - @permise.errors.full_messages.each do |message| + li = message + + .field + = f.label :object + = f.text_field :object + .field + = f.label :method + = f.text_field :method + .actions = f.submit diff --git a/app/views/permises/_permise.json.jbuilder b/app/views/permises/_permise.json.jbuilder new file mode 100644 index 0000000..6b468be --- /dev/null +++ b/app/views/permises/_permise.json.jbuilder @@ -0,0 +1,2 @@ +json.extract! permise, :id, :object, :method, :created_at, :updated_at +json.url permise_url(permise, format: :json) diff --git a/app/views/permises/edit.html.slim b/app/views/permises/edit.html.slim new file mode 100644 index 0000000..27a951f --- /dev/null +++ b/app/views/permises/edit.html.slim @@ -0,0 +1,8 @@ +h1 Editing permise + +== render 'form' + +=> link_to 'Show', @permise +'| +=< link_to 'Back', permises_path + diff --git a/app/views/permises/index.html.slim b/app/views/permises/index.html.slim new file mode 100644 index 0000000..397dce9 --- /dev/null +++ b/app/views/permises/index.html.slim @@ -0,0 +1,23 @@ +h1 Listing permises + +table + thead + tr + th Object + th Method + th + th + th + + tbody + - @permises.each do |permise| + tr + td = permise.object + td = permise.method + td = link_to 'Show', permise + td = link_to 'Edit', edit_permise_path(permise) + td = link_to 'Destroy', permise, data: { confirm: 'Are you sure?' }, method: :delete + +br + += link_to 'New Permise', new_permise_path diff --git a/app/views/permises/index.json.jbuilder b/app/views/permises/index.json.jbuilder new file mode 100644 index 0000000..723f763 --- /dev/null +++ b/app/views/permises/index.json.jbuilder @@ -0,0 +1 @@ +json.array! @permises, partial: 'permises/permise', as: :permise diff --git a/app/views/permises/new.html.slim b/app/views/permises/new.html.slim new file mode 100644 index 0000000..7f99c95 --- /dev/null +++ b/app/views/permises/new.html.slim @@ -0,0 +1,5 @@ +h1 New permise + +== render 'form' + += link_to 'Back', permises_path diff --git a/app/views/permises/show.html.slim b/app/views/permises/show.html.slim new file mode 100644 index 0000000..8332908 --- /dev/null +++ b/app/views/permises/show.html.slim @@ -0,0 +1,12 @@ +p#notice = notice + +p + strong Object: + = @permise.object +p + strong Method: + = @permise.method + +=> link_to 'Edit', edit_permise_path(@permise) +'| +=< link_to 'Back', permises_path diff --git a/app/views/permises/show.json.jbuilder b/app/views/permises/show.json.jbuilder new file mode 100644 index 0000000..92b5729 --- /dev/null +++ b/app/views/permises/show.json.jbuilder @@ -0,0 +1 @@ +json.partial! "permises/permise", permise: @permise diff --git a/app/views/roles/_form.html.slim b/app/views/roles/_form.html.slim new file mode 100644 index 0000000..e336e6f --- /dev/null +++ b/app/views/roles/_form.html.slim @@ -0,0 +1,15 @@ += form_for @role do |f| + - if @role.errors.any? + #error_explanation + h2 = "#{pluralize(@role.errors.count, "error")} prohibited this role from being saved:" + ul + - @role.errors.full_messages.each do |message| + li = message + + .field + = f.label :name + = f.text_field :name + .field + = f.label :description + = f.text_field :description + .actions = f.submit diff --git a/app/views/roles/_role.json.jbuilder b/app/views/roles/_role.json.jbuilder new file mode 100644 index 0000000..4294dcf --- /dev/null +++ b/app/views/roles/_role.json.jbuilder @@ -0,0 +1,2 @@ +json.extract! role, :id, :name, :description, :created_at, :updated_at +json.url role_url(role, format: :json) diff --git a/app/views/roles/edit.html.slim b/app/views/roles/edit.html.slim new file mode 100644 index 0000000..679e8fb --- /dev/null +++ b/app/views/roles/edit.html.slim @@ -0,0 +1,8 @@ +h1 Editing role + +== render 'form' + +=> link_to 'Show', @role +'| +=< link_to 'Back', roles_path + diff --git a/app/views/roles/index.html.slim b/app/views/roles/index.html.slim new file mode 100644 index 0000000..7098ba5 --- /dev/null +++ b/app/views/roles/index.html.slim @@ -0,0 +1,23 @@ +h1 Listing roles + +table + thead + tr + th Name + th Description + th + th + th + + tbody + - @roles.each do |role| + tr + td = role.name + td = role.description + td = link_to 'Show', role + td = link_to 'Edit', edit_role_path(role) + td = link_to 'Destroy', role, data: { confirm: 'Are you sure?' }, method: :delete + +br + += link_to 'New Role', new_role_path diff --git a/app/views/roles/index.json.jbuilder b/app/views/roles/index.json.jbuilder new file mode 100644 index 0000000..ebbe951 --- /dev/null +++ b/app/views/roles/index.json.jbuilder @@ -0,0 +1 @@ +json.array! @roles, partial: 'roles/role', as: :role diff --git a/app/views/roles/new.html.slim b/app/views/roles/new.html.slim new file mode 100644 index 0000000..bd506f4 --- /dev/null +++ b/app/views/roles/new.html.slim @@ -0,0 +1,5 @@ +h1 New role + +== render 'form' + += link_to 'Back', roles_path diff --git a/app/views/roles/show.html.slim b/app/views/roles/show.html.slim new file mode 100644 index 0000000..458e4ba --- /dev/null +++ b/app/views/roles/show.html.slim @@ -0,0 +1,12 @@ +p#notice = notice + +p + strong Name: + = @role.name +p + strong Description: + = @role.description + +=> link_to 'Edit', edit_role_path(@role) +'| +=< link_to 'Back', roles_path diff --git a/app/views/roles/show.json.jbuilder b/app/views/roles/show.json.jbuilder new file mode 100644 index 0000000..f71a4d3 --- /dev/null +++ b/app/views/roles/show.json.jbuilder @@ -0,0 +1 @@ +json.partial! "roles/role", role: @role diff --git a/app/views/shared/nav/_breadcrumb.html.slim b/app/views/shared/nav/_breadcrumb.html.slim index 8f761ce..5dd13aa 100644 --- a/app/views/shared/nav/_breadcrumb.html.slim +++ b/app/views/shared/nav/_breadcrumb.html.slim @@ -2,7 +2,7 @@ h2 i.fa.fa-home | Dashboard - span dashboard & statistics + span .breadcrumb-wrapper.hidden-xs span.label You are here: ol.breadcrumb diff --git a/app/views/shared/nav/_left_bar.html.slim b/app/views/shared/nav/_left_bar.html.slim index 2fb9d8e..5545625 100644 --- a/app/views/shared/nav/_left_bar.html.slim +++ b/app/views/shared/nav/_left_bar.html.slim @@ -1,33 +1,25 @@ aside#sidebar-left.sidebar-circle = render "shared/nav/left_bar/user_card" ul.sidebar-menu - li.submenu.active + li.submenu a href="javascript:void(0);" span.icon i.fa.fa-home - span.text Dashboard + span.text Configuración span.arrow span.selected ul - li.active - a href="dashboard.html" Basic li - a href="dashboard-ecommerce.html" E-Commerce + a href="dashboard.html" Usuario + li + a href="dashboard.html" Equipo + li + a href="dashboard.html" Área + li.submenu a href="javascript:void(0);" span.icon i.fa.fa-leaf - span.text Frontend themes + span.text Áreas span.arrow - ul - li - a href="frontend-themes.html" One page - li - a href="blankon-versions.html" - span.icon - i.fa.fa-dropbox - span.text Blankon Versions - li.sidebar-category - span UI KIT - span.pull-right - i.fa.fa-magic + diff --git a/app/views/zones/_form.html.slim b/app/views/zones/_form.html.slim new file mode 100644 index 0000000..fccf258 --- /dev/null +++ b/app/views/zones/_form.html.slim @@ -0,0 +1,15 @@ += form_for @zone do |f| + - if @zone.errors.any? + #error_explanation + h2 = "#{pluralize(@zone.errors.count, "error")} prohibited this zone from being saved:" + ul + - @zone.errors.full_messages.each do |message| + li = message + + .field + = f.label :name + = f.text_field :name + .field + = f.label :description + = f.text_field :description + .actions = f.submit diff --git a/app/views/zones/_zone.json.jbuilder b/app/views/zones/_zone.json.jbuilder new file mode 100644 index 0000000..81829fd --- /dev/null +++ b/app/views/zones/_zone.json.jbuilder @@ -0,0 +1,2 @@ +json.extract! zone, :id, :name, :description, :created_at, :updated_at +json.url zone_url(zone, format: :json) diff --git a/app/views/zones/edit.html.slim b/app/views/zones/edit.html.slim new file mode 100644 index 0000000..42b5585 --- /dev/null +++ b/app/views/zones/edit.html.slim @@ -0,0 +1,8 @@ +h1 Editing zone + +== render 'form' + +=> link_to 'Show', @zone +'| +=< link_to 'Back', zones_path + diff --git a/app/views/zones/index.html.slim b/app/views/zones/index.html.slim new file mode 100644 index 0000000..b230500 --- /dev/null +++ b/app/views/zones/index.html.slim @@ -0,0 +1,23 @@ +h1 Listing zones + +table + thead + tr + th Name + th Description + th + th + th + + tbody + - @zones.each do |zone| + tr + td = zone.name + td = zone.description + td = link_to 'Show', zone + td = link_to 'Edit', edit_zone_path(zone) + td = link_to 'Destroy', zone, data: { confirm: 'Are you sure?' }, method: :delete + +br + += link_to 'New Zone', new_zone_path diff --git a/app/views/zones/index.json.jbuilder b/app/views/zones/index.json.jbuilder new file mode 100644 index 0000000..ab0eba3 --- /dev/null +++ b/app/views/zones/index.json.jbuilder @@ -0,0 +1 @@ +json.array! @zones, partial: 'zones/zone', as: :zone diff --git a/app/views/zones/new.html.slim b/app/views/zones/new.html.slim new file mode 100644 index 0000000..8a09b25 --- /dev/null +++ b/app/views/zones/new.html.slim @@ -0,0 +1,5 @@ +h1 New zone + +== render 'form' + += link_to 'Back', zones_path diff --git a/app/views/zones/show.html.slim b/app/views/zones/show.html.slim new file mode 100644 index 0000000..dda738a --- /dev/null +++ b/app/views/zones/show.html.slim @@ -0,0 +1,12 @@ +p#notice = notice + +p + strong Name: + = @zone.name +p + strong Description: + = @zone.description + +=> link_to 'Edit', edit_zone_path(@zone) +'| +=< link_to 'Back', zones_path diff --git a/app/views/zones/show.json.jbuilder b/app/views/zones/show.json.jbuilder new file mode 100644 index 0000000..85f87c1 --- /dev/null +++ b/app/views/zones/show.json.jbuilder @@ -0,0 +1 @@ +json.partial! "zones/zone", zone: @zone diff --git a/config/routes.rb b/config/routes.rb index c1efdd5..4a5a3d7 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,8 +1,19 @@ Rails.application.routes.draw do - devise_for :users + resources :data + resources :mobiles + resources :zone__devices + resources :location_devices + resources :access_points + resources :cordinates + resources :permises_roles + resources :permises + resources :roles + # devise_for :users namespace :api do get 'location/get' end get 'dashboard/home' root 'dashboard#home' + resources :zones + resources :devices end diff --git a/db/migrate/20190129034343_devise_create_users.rb b/db/migrate/20190129034343_devise_create_users.rb deleted file mode 100644 index bf089a1..0000000 --- a/db/migrate/20190129034343_devise_create_users.rb +++ /dev/null @@ -1,45 +0,0 @@ -# frozen_string_literal: true - -class DeviseCreateUsers < ActiveRecord::Migration[5.2] - def change - create_table :users do |t| - t.references :role - ## Database authenticatable - t.string :email, null: false, default: "" - t.string :encrypted_password, null: false, default: "" - - ## Recoverable - t.string :reset_password_token - t.datetime :reset_password_sent_at - - ## Rememberable - t.datetime :remember_created_at - - ## Trackable - t.integer :sign_in_count, default: 0, null: false - t.datetime :current_sign_in_at - t.datetime :last_sign_in_at - t.inet :current_sign_in_ip - t.inet :last_sign_in_ip - - ## Confirmable - # t.string :confirmation_token - # t.datetime :confirmed_at - # t.datetime :confirmation_sent_at - # t.string :unconfirmed_email # Only if using reconfirmable - - ## Lockable - # t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts - # t.string :unlock_token # Only if unlock strategy is :email or :both - # t.datetime :locked_at - - - t.timestamps null: false - end - - add_index :users, :email, unique: true - add_index :users, :reset_password_token, unique: true - # add_index :users, :confirmation_token, unique: true - # add_index :users, :unlock_token, unique: true - end -end diff --git a/db/migrate/20190129134543_create_permissions.rb b/db/migrate/20190129134543_create_permissions.rb deleted file mode 100644 index 5d3e909..0000000 --- a/db/migrate/20190129134543_create_permissions.rb +++ /dev/null @@ -1,12 +0,0 @@ -class CreatePermissions < ActiveRecord::Migration[5.2] - def change - create_table :permissions do |t| - t.string :object - t.string :method - t.string :name - t.string :description - - t.timestamps - end - end -end diff --git a/db/migrate/20190129134635_create_rol_permissions.rb b/db/migrate/20190129134635_create_rol_permissions.rb deleted file mode 100644 index 7249c7e..0000000 --- a/db/migrate/20190129134635_create_rol_permissions.rb +++ /dev/null @@ -1,10 +0,0 @@ -class CreateRolPermissions < ActiveRecord::Migration[5.2] - def change - create_table :role_permissions do |t| - t.references :role, foreign_key: true - t.references :permission, foreign_key: true - - t.timestamps - end - end -end diff --git a/db/migrate/20190129134707_create_locations.rb b/db/migrate/20190129134707_create_locations.rb deleted file mode 100644 index a43b90e..0000000 --- a/db/migrate/20190129134707_create_locations.rb +++ /dev/null @@ -1,10 +0,0 @@ -class CreateLocations < ActiveRecord::Migration[5.2] - def change - create_table :locations do |t| - t.float :lat - t.float :lon - - t.timestamps - end - end -end diff --git a/db/migrate/20190129134854_create_zone_limits.rb b/db/migrate/20190129134854_create_zone_limits.rb deleted file mode 100644 index 493ac68..0000000 --- a/db/migrate/20190129134854_create_zone_limits.rb +++ /dev/null @@ -1,10 +0,0 @@ -class CreateZoneLimits < ActiveRecord::Migration[5.2] - def change - create_table :zone_limits do |t| - t.references :zone, foreign_key: true - t.references :location, foreign_key: true - - t.timestamps - end - end -end diff --git a/db/migrate/20190129140341_create_devices.rb b/db/migrate/20190129140341_create_devices.rb deleted file mode 100644 index dbd65a6..0000000 --- a/db/migrate/20190129140341_create_devices.rb +++ /dev/null @@ -1,12 +0,0 @@ -class CreateDevices < ActiveRecord::Migration[5.2] - def change - create_table :devices do |t| - t.inet :ip_address - t.string :mac_address - t.string :user - t.string :password - - t.timestamps - end - end -end diff --git a/db/migrate/20190129140354_add_status_to_devices.rb b/db/migrate/20190129140354_add_status_to_devices.rb deleted file mode 100644 index 7b861c3..0000000 --- a/db/migrate/20190129140354_add_status_to_devices.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddStatusToDevices < ActiveRecord::Migration[5.2] - def change - add_column :devices, :status, :string - end -end diff --git a/db/migrate/20190129140414_add_status_to_zones.rb b/db/migrate/20190129140414_add_status_to_zones.rb deleted file mode 100644 index bf970e8..0000000 --- a/db/migrate/20190129140414_add_status_to_zones.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddStatusToZones < ActiveRecord::Migration[5.2] - def change - add_column :zones, :status, :string - end -end diff --git a/db/migrate/20190129140430_add_status_to_users.rb b/db/migrate/20190129140430_add_status_to_users.rb deleted file mode 100644 index e0c2d79..0000000 --- a/db/migrate/20190129140430_add_status_to_users.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddStatusToUsers < ActiveRecord::Migration[5.2] - def change - add_column :users, :status, :string - end -end diff --git a/db/migrate/20190129140500_create_devise_positions.rb b/db/migrate/20190129140500_create_devise_positions.rb deleted file mode 100644 index 3f6ab66..0000000 --- a/db/migrate/20190129140500_create_devise_positions.rb +++ /dev/null @@ -1,10 +0,0 @@ -class CreateDevisePositions < ActiveRecord::Migration[5.2] - def change - create_table :devise_positions do |t| - t.references :device, foreign_key: true - t.references :location, foreign_key: true - - t.timestamps - end - end -end diff --git a/db/migrate/20190129140518_add_status_to_devise_positions.rb b/db/migrate/20190129140518_add_status_to_devise_positions.rb deleted file mode 100644 index c67ee59..0000000 --- a/db/migrate/20190129140518_add_status_to_devise_positions.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddStatusToDevisePositions < ActiveRecord::Migration[5.2] - def change - add_column :devise_positions, :status, :string - end -end diff --git a/db/migrate/20190129171914_add_status_to_mobiles.rb b/db/migrate/20190129171914_add_status_to_mobiles.rb deleted file mode 100644 index df20491..0000000 --- a/db/migrate/20190129171914_add_status_to_mobiles.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddStatusToMobiles < ActiveRecord::Migration[5.2] - def change - add_column :mobiles, :status, :string - end -end diff --git a/db/migrate/20190129171947_create_mobile_locations.rb b/db/migrate/20190129171947_create_mobile_locations.rb deleted file mode 100644 index ea9b5cc..0000000 --- a/db/migrate/20190129171947_create_mobile_locations.rb +++ /dev/null @@ -1,10 +0,0 @@ -class CreateMobileLocations < ActiveRecord::Migration[5.2] - def change - create_table :mobile_locations do |t| - t.references :mobile, foreign_key: true - t.references :location, foreign_key: true - - t.timestamps - end - end -end diff --git a/db/migrate/20190129172009_create_mobile_ips.rb b/db/migrate/20190129172009_create_mobile_ips.rb deleted file mode 100644 index c4ce841..0000000 --- a/db/migrate/20190129172009_create_mobile_ips.rb +++ /dev/null @@ -1,10 +0,0 @@ -class CreateMobileIps < ActiveRecord::Migration[5.2] - def change - create_table :mobile_ips do |t| - t.references :mobile, foreign_key: true - t.inet :ip_address - - t.timestamps - end - end -end diff --git a/db/migrate/20190129023854_create_roles.rb b/db/migrate/20190212005827_create_roles.rb similarity index 100% rename from db/migrate/20190129023854_create_roles.rb rename to db/migrate/20190212005827_create_roles.rb diff --git a/db/migrate/20190212005833_create_permises.rb b/db/migrate/20190212005833_create_permises.rb new file mode 100644 index 0000000..3be84e2 --- /dev/null +++ b/db/migrate/20190212005833_create_permises.rb @@ -0,0 +1,10 @@ +class CreatePermises < ActiveRecord::Migration[5.2] + def change + create_table :permises do |t| + t.string :object + t.string :method + + t.timestamps + end + end +end diff --git a/db/migrate/20190212010155_create_permises_roles.rb b/db/migrate/20190212010155_create_permises_roles.rb new file mode 100644 index 0000000..32b1c2d --- /dev/null +++ b/db/migrate/20190212010155_create_permises_roles.rb @@ -0,0 +1,10 @@ +class CreatePermisesRoles < ActiveRecord::Migration[5.2] + def change + create_table :permises_roles do |t| + t.belongs_to :permises, foreign_key: true + t.belongs_to :roles, foreign_key: true + + t.timestamps + end + end +end diff --git a/db/migrate/20190212010352_create_coordinates.rb b/db/migrate/20190212010352_create_coordinates.rb new file mode 100644 index 0000000..e681a93 --- /dev/null +++ b/db/migrate/20190212010352_create_coordinates.rb @@ -0,0 +1,10 @@ +class CreateCoordinates < ActiveRecord::Migration[5.2] + def change + create_table :coordinates do |t| + t.float :latitude + t.float :longitude + + t.timestamps + end + end +end diff --git a/db/migrate/20190129134813_create_zones.rb b/db/migrate/20190212011004_create_zones.rb similarity index 100% rename from db/migrate/20190129134813_create_zones.rb rename to db/migrate/20190212011004_create_zones.rb diff --git a/db/migrate/20190212011006_create_limite_zones.rb b/db/migrate/20190212011006_create_limite_zones.rb new file mode 100644 index 0000000..3f7f540 --- /dev/null +++ b/db/migrate/20190212011006_create_limite_zones.rb @@ -0,0 +1,10 @@ +class CreateLimiteZones < ActiveRecord::Migration[5.2] + def change + create_table :limite_zones do |t| + t.belongs_to :zones, foreign_key: true + t.belongs_to :coordinate, foreign_key: true + + t.timestamps + end + end +end diff --git a/db/migrate/20190212011248_create_access_points.rb b/db/migrate/20190212011248_create_access_points.rb new file mode 100644 index 0000000..5733703 --- /dev/null +++ b/db/migrate/20190212011248_create_access_points.rb @@ -0,0 +1,13 @@ +class CreateAccessPoints < ActiveRecord::Migration[5.2] + def change + create_table :access_points do |t| + t.string :ip_address + t.string :mac_address + t.string :user + t.string :password + t.integer :status + + t.timestamps + end + end +end diff --git a/db/migrate/20190212011517_create_location_devices.rb b/db/migrate/20190212011517_create_location_devices.rb new file mode 100644 index 0000000..6d0b677 --- /dev/null +++ b/db/migrate/20190212011517_create_location_devices.rb @@ -0,0 +1,10 @@ +class CreateLocationDevices < ActiveRecord::Migration[5.2] + def change + create_table :location_devices do |t| + t.belongs_to :access_point, foreign_key: true + t.belongs_to :coordinate, foreign_key: true + + t.timestamps + end + end +end diff --git a/db/migrate/20190212011608_create_zone__devices.rb b/db/migrate/20190212011608_create_zone__devices.rb new file mode 100644 index 0000000..84d9998 --- /dev/null +++ b/db/migrate/20190212011608_create_zone__devices.rb @@ -0,0 +1,10 @@ +class CreateZoneDevices < ActiveRecord::Migration[5.2] + def change + create_table :zone__devices do |t| + t.belongs_to :access_point, foreign_key: true + t.belongs_to :zone, foreign_key: true + + t.timestamps + end + end +end diff --git a/db/migrate/20190129171902_create_mobiles.rb b/db/migrate/20190212011945_create_mobiles.rb similarity index 64% rename from db/migrate/20190129171902_create_mobiles.rb rename to db/migrate/20190212011945_create_mobiles.rb index 5dd77e4..3f26a14 100644 --- a/db/migrate/20190129171902_create_mobiles.rb +++ b/db/migrate/20190212011945_create_mobiles.rb @@ -1,9 +1,7 @@ class CreateMobiles < ActiveRecord::Migration[5.2] def change create_table :mobiles do |t| - t.references :user, foreign_key: true - t.string :model - t.string :brand + t.string :modelo t.string :mac_address t.timestamps diff --git a/db/migrate/20190212012259_create_data.rb b/db/migrate/20190212012259_create_data.rb new file mode 100644 index 0000000..e27d7b1 --- /dev/null +++ b/db/migrate/20190212012259_create_data.rb @@ -0,0 +1,11 @@ +class CreateData < ActiveRecord::Migration[5.2] + def change + create_table :data do |t| + t.belongs_to :mobile, foreign_key: true + t.string :type + t.string :value + + t.timestamps + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 3a5d03d..3d46fc6 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,82 +10,76 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2019_01_29_172009) do +ActiveRecord::Schema.define(version: 2019_02_12_012259) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" - create_table "devices", force: :cascade do |t| - t.inet "ip_address" + create_table "access_points", force: :cascade do |t| + t.string "ip_address" t.string "mac_address" t.string "user" t.string "password" + t.integer "status" t.datetime "created_at", null: false t.datetime "updated_at", null: false - t.string "status" end - create_table "devise_positions", force: :cascade do |t| - t.bigint "device_id" - t.bigint "location_id" + create_table "coordinates", force: :cascade do |t| + t.float "latitude" + t.float "longitude" t.datetime "created_at", null: false t.datetime "updated_at", null: false - t.string "status" - t.index ["device_id"], name: "index_devise_positions_on_device_id" - t.index ["location_id"], name: "index_devise_positions_on_location_id" end - create_table "locations", force: :cascade do |t| - t.float "lat" - t.float "lon" + create_table "data", force: :cascade do |t| + t.bigint "mobile_id" + t.string "type" + t.string "value" t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.index ["mobile_id"], name: "index_data_on_mobile_id" end - create_table "mobile_ips", force: :cascade do |t| - t.bigint "mobile_id" - t.inet "ip_address" + create_table "limite_zones", force: :cascade do |t| + t.bigint "zones_id" + t.bigint "coordinate_id" t.datetime "created_at", null: false t.datetime "updated_at", null: false - t.index ["mobile_id"], name: "index_mobile_ips_on_mobile_id" + t.index ["coordinate_id"], name: "index_limite_zones_on_coordinate_id" + t.index ["zones_id"], name: "index_limite_zones_on_zones_id" end - create_table "mobile_locations", force: :cascade do |t| - t.bigint "mobile_id" - t.bigint "location_id" + create_table "location_devices", force: :cascade do |t| + t.bigint "access_point_id" + t.bigint "coordinate_id" t.datetime "created_at", null: false t.datetime "updated_at", null: false - t.index ["location_id"], name: "index_mobile_locations_on_location_id" - t.index ["mobile_id"], name: "index_mobile_locations_on_mobile_id" + t.index ["access_point_id"], name: "index_location_devices_on_access_point_id" + t.index ["coordinate_id"], name: "index_location_devices_on_coordinate_id" end create_table "mobiles", force: :cascade do |t| - t.bigint "user_id" - t.string "model" - t.string "brand" + t.string "modelo" t.string "mac_address" t.datetime "created_at", null: false t.datetime "updated_at", null: false - t.string "status" - t.index ["user_id"], name: "index_mobiles_on_user_id" end - create_table "permissions", force: :cascade do |t| + create_table "permises", force: :cascade do |t| t.string "object" t.string "method" - t.string "name" - t.string "description" t.datetime "created_at", null: false t.datetime "updated_at", null: false end - create_table "role_permissions", force: :cascade do |t| - t.bigint "role_id" - t.bigint "permission_id" + create_table "permises_roles", force: :cascade do |t| + t.bigint "permises_id" + t.bigint "roles_id" t.datetime "created_at", null: false t.datetime "updated_at", null: false - t.index ["permission_id"], name: "index_role_permissions_on_permission_id" - t.index ["role_id"], name: "index_role_permissions_on_role_id" + t.index ["permises_id"], name: "index_permises_roles_on_permises_id" + t.index ["roles_id"], name: "index_permises_roles_on_roles_id" end create_table "roles", force: :cascade do |t| @@ -95,33 +89,13 @@ t.datetime "updated_at", null: false end - create_table "users", force: :cascade do |t| - t.bigint "role_id" - t.string "email", default: "", null: false - t.string "encrypted_password", default: "", null: false - t.string "reset_password_token" - t.datetime "reset_password_sent_at" - t.datetime "remember_created_at" - t.integer "sign_in_count", default: 0, null: false - t.datetime "current_sign_in_at" - t.datetime "last_sign_in_at" - t.inet "current_sign_in_ip" - t.inet "last_sign_in_ip" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.string "status" - t.index ["email"], name: "index_users_on_email", unique: true - t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true - t.index ["role_id"], name: "index_users_on_role_id" - end - - create_table "zone_limits", force: :cascade do |t| + create_table "zone__devices", force: :cascade do |t| + t.bigint "access_point_id" t.bigint "zone_id" - t.bigint "location_id" t.datetime "created_at", null: false t.datetime "updated_at", null: false - t.index ["location_id"], name: "index_zone_limits_on_location_id" - t.index ["zone_id"], name: "index_zone_limits_on_zone_id" + t.index ["access_point_id"], name: "index_zone__devices_on_access_point_id" + t.index ["zone_id"], name: "index_zone__devices_on_zone_id" end create_table "zones", force: :cascade do |t| @@ -129,17 +103,15 @@ t.string "description" t.datetime "created_at", null: false t.datetime "updated_at", null: false - t.string "status" end - add_foreign_key "devise_positions", "devices" - add_foreign_key "devise_positions", "locations" - add_foreign_key "mobile_ips", "mobiles" - add_foreign_key "mobile_locations", "locations" - add_foreign_key "mobile_locations", "mobiles" - add_foreign_key "mobiles", "users" - add_foreign_key "role_permissions", "permissions" - add_foreign_key "role_permissions", "roles" - add_foreign_key "zone_limits", "locations" - add_foreign_key "zone_limits", "zones" + add_foreign_key "data", "mobiles" + add_foreign_key "limite_zones", "coordinates" + add_foreign_key "limite_zones", "zones", column: "zones_id" + add_foreign_key "location_devices", "access_points" + add_foreign_key "location_devices", "coordinates" + add_foreign_key "permises_roles", "permises", column: "permises_id" + add_foreign_key "permises_roles", "roles", column: "roles_id" + add_foreign_key "zone__devices", "access_points" + add_foreign_key "zone__devices", "zones" end diff --git a/public/javascripts/gmaps_google.js b/public/javascripts/gmaps_google.js new file mode 100644 index 0000000..4644eab --- /dev/null +++ b/public/javascripts/gmaps_google.js @@ -0,0 +1,985 @@ +(function() { + this.Gmaps = { + build: function(type, options) { + var model; + if (options == null) { + options = {}; + } + model = _.isFunction(options.handler) ? options.handler : Gmaps.Objects.Handler; + return new model(type, options); + }, + Builders: {}, + Objects: {}, + Google: { + Objects: {}, + Builders: {} + } + }; + +}).call(this); +(function() { + var moduleKeywords, + __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; + + moduleKeywords = ['extended', 'included']; + + this.Gmaps.Base = (function() { + function Base() {} + + Base.extend = function(obj) { + var key, value, _ref; + for (key in obj) { + value = obj[key]; + if (__indexOf.call(moduleKeywords, key) < 0) { + this[key] = value; + } + } + if ((_ref = obj.extended) != null) { + _ref.apply(this); + } + return this; + }; + + Base.include = function(obj) { + var key, value, _ref; + for (key in obj) { + value = obj[key]; + if (__indexOf.call(moduleKeywords, key) < 0) { + this.prototype[key] = value; + } + } + if ((_ref = obj.included) != null) { + _ref.apply(this); + } + return this; + }; + + return Base; + + })(); + +}).call(this); +(function() { + this.Gmaps.Objects.BaseBuilder = (function() { + function BaseBuilder() {} + + BaseBuilder.prototype.build = function() { + return new (this.model_class())(this.serviceObject); + }; + + BaseBuilder.prototype.before_init = function() {}; + + BaseBuilder.prototype.after_init = function() {}; + + BaseBuilder.prototype.addListener = function(action, fn) { + return this.primitives().addListener(this.getServiceObject(), action, fn); + }; + + BaseBuilder.prototype.getServiceObject = function() { + return this.serviceObject; + }; + + BaseBuilder.prototype.primitives = function() { + return this.constructor.PRIMITIVES; + }; + + BaseBuilder.prototype.model_class = function() { + return this.constructor.OBJECT; + }; + + return BaseBuilder; + + })(); + +}).call(this); +(function() { + this.Gmaps.Objects.Builders = function(builderClass, objectClass, primitivesProvider) { + return { + build: function(args, provider_options, internal_options) { + var builder; + objectClass.PRIMITIVES = primitivesProvider; + builderClass.OBJECT = objectClass; + builderClass.PRIMITIVES = primitivesProvider; + builder = new builderClass(args, provider_options, internal_options); + return builder.build(); + } + }; + }; + +}).call(this); +(function() { + this.Gmaps.Objects.Handler = (function() { + function Handler(type, options) { + this.type = type; + if (options == null) { + options = {}; + } + this.setPrimitives(options); + this.setOptions(options); + this._cacheAllBuilders(); + this.resetBounds(); + } + + Handler.prototype.buildMap = function(options, onMapLoad) { + var _this = this; + if (onMapLoad == null) { + onMapLoad = function() {}; + } + return this.map = this._builder('Map').build(options, function() { + _this._createClusterer(); + return onMapLoad(); + }); + }; + + Handler.prototype.addMarkers = function(markers_data, provider_options) { + var _this = this; + return _.map(markers_data, function(marker_data) { + return _this.addMarker(marker_data, provider_options); + }); + }; + + Handler.prototype.addMarker = function(marker_data, provider_options) { + var marker; + marker = this._builder('Marker').build(marker_data, provider_options, this.marker_options); + marker.setMap(this.getMap()); + this.clusterer.addMarker(marker); + return marker; + }; + + Handler.prototype.addCircles = function(circles_data, provider_options) { + var _this = this; + return _.map(circles_data, function(circle_data) { + return _this.addCircle(circle_data, provider_options); + }); + }; + + Handler.prototype.addCircle = function(circle_data, provider_options) { + return this._addResource('circle', circle_data, provider_options); + }; + + Handler.prototype.addPolylines = function(polylines_data, provider_options) { + var _this = this; + return _.map(polylines_data, function(polyline_data) { + return _this.addPolyline(polyline_data, provider_options); + }); + }; + + Handler.prototype.addPolyline = function(polyline_data, provider_options) { + return this._addResource('polyline', polyline_data, provider_options); + }; + + Handler.prototype.addPolygons = function(polygons_data, provider_options) { + var _this = this; + return _.map(polygons_data, function(polygon_data) { + return _this.addPolygon(polygon_data, provider_options); + }); + }; + + Handler.prototype.addPolygon = function(polygon_data, provider_options) { + return this._addResource('polygon', polygon_data, provider_options); + }; + + Handler.prototype.addKmls = function(kmls_data, provider_options) { + var _this = this; + return _.map(kmls_data, function(kml_data) { + return _this.addKml(kml_data, provider_options); + }); + }; + + Handler.prototype.addKml = function(kml_data, provider_options) { + return this._addResource('kml', kml_data, provider_options); + }; + + Handler.prototype.removeMarkers = function(gem_markers) { + var _this = this; + return _.map(gem_markers, function(gem_marker) { + return _this.removeMarker(gem_marker); + }); + }; + + Handler.prototype.removeMarker = function(gem_marker) { + gem_marker.clear(); + return this.clusterer.removeMarker(gem_marker); + }; + + Handler.prototype.fitMapToBounds = function() { + return this.map.fitToBounds(this.bounds.getServiceObject()); + }; + + Handler.prototype.getMap = function() { + return this.map.getServiceObject(); + }; + + Handler.prototype.setOptions = function(options) { + this.marker_options = _.extend(this._default_marker_options(), options.markers); + this.builders = _.extend(this._default_builders(), options.builders); + return this.models = _.extend(this._default_models(), options.models); + }; + + Handler.prototype.resetBounds = function() { + return this.bounds = this._builder('Bound').build(); + }; + + Handler.prototype.setPrimitives = function(options) { + return this.primitives = options.primitives === void 0 ? this._rootModule().Primitives() : _.isFunction(options.primitives) ? options.primitives() : options.primitives; + }; + + Handler.prototype.currentInfowindow = function() { + return this.builders.Marker.CURRENT_INFOWINDOW; + }; + + Handler.prototype._addResource = function(resource_name, resource_data, provider_options) { + var resource; + resource = this._builder(resource_name).build(resource_data, provider_options); + resource.setMap(this.getMap()); + return resource; + }; + + Handler.prototype._cacheAllBuilders = function() { + var that; + that = this; + return _.each(['Bound', 'Circle', 'Clusterer', 'Kml', 'Map', 'Marker', 'Polygon', 'Polyline'], function(kind) { + return that._builder(kind); + }); + }; + + Handler.prototype._clusterize = function() { + return _.isObject(this.marker_options.clusterer); + }; + + Handler.prototype._createClusterer = function() { + return this.clusterer = this._builder('Clusterer').build({ + map: this.getMap() + }, this.marker_options.clusterer); + }; + + Handler.prototype._default_marker_options = function() { + return _.clone({ + singleInfowindow: true, + maxRandomDistance: 0, + clusterer: { + maxZoom: 5, + gridSize: 50 + } + }); + }; + + Handler.prototype._builder = function(name) { + var _name; + name = this._capitalize(name); + if (this[_name = "__builder" + name] == null) { + this[_name] = Gmaps.Objects.Builders(this.builders[name], this.models[name], this.primitives); + } + return this["__builder" + name]; + }; + + Handler.prototype._default_models = function() { + var models; + models = _.clone(this._rootModule().Objects); + if (this._clusterize()) { + return models; + } else { + models.Clusterer = Gmaps.Objects.NullClusterer; + return models; + } + }; + + Handler.prototype._capitalize = function(string) { + return string.charAt(0).toUpperCase() + string.slice(1); + }; + + Handler.prototype._default_builders = function() { + return _.clone(this._rootModule().Builders); + }; + + Handler.prototype._rootModule = function() { + if (this.__rootModule == null) { + this.__rootModule = Gmaps[this.type]; + } + return this.__rootModule; + }; + + return Handler; + + })(); + +}).call(this); +(function() { + this.Gmaps.Objects.NullClusterer = (function() { + function NullClusterer() {} + + NullClusterer.prototype.addMarkers = function() {}; + + NullClusterer.prototype.addMarker = function() {}; + + NullClusterer.prototype.clear = function() {}; + + NullClusterer.prototype.removeMarker = function() {}; + + return NullClusterer; + + })(); + +}).call(this); +(function() { + this.Gmaps.Google.Objects.Common = { + getServiceObject: function() { + return this.serviceObject; + }, + setMap: function(map) { + return this.getServiceObject().setMap(map); + }, + clear: function() { + return this.getServiceObject().setMap(null); + }, + show: function() { + return this.getServiceObject().setVisible(true); + }, + hide: function() { + return this.getServiceObject().setVisible(false); + }, + isVisible: function() { + return this.getServiceObject().getVisible(); + }, + primitives: function() { + return this.constructor.PRIMITIVES; + } + }; + +}).call(this); +(function() { + var __hasProp = {}.hasOwnProperty, + __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; + + this.Gmaps.Google.Builders.Bound = (function(_super) { + __extends(Bound, _super); + + function Bound(options) { + this.before_init(); + this.serviceObject = new (this.primitives().latLngBounds); + this.after_init(); + } + + return Bound; + + })(Gmaps.Objects.BaseBuilder); + +}).call(this); +(function() { + var __hasProp = {}.hasOwnProperty, + __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; + + this.Gmaps.Google.Builders.Circle = (function(_super) { + __extends(Circle, _super); + + function Circle(args, provider_options) { + this.args = args; + this.provider_options = provider_options != null ? provider_options : {}; + this.before_init(); + this.serviceObject = this.create_circle(); + this.after_init(); + } + + Circle.prototype.create_circle = function() { + return new (this.primitives().circle)(this.circle_options()); + }; + + Circle.prototype.circle_options = function() { + var base_options; + base_options = { + center: new (this.primitives().latLng)(this.args.lat, this.args.lng), + radius: this.args.radius + }; + return _.defaults(base_options, this.provider_options); + }; + + return Circle; + + })(Gmaps.Objects.BaseBuilder); + +}).call(this); +(function() { + var __hasProp = {}.hasOwnProperty, + __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; + + this.Gmaps.Google.Builders.Clusterer = (function(_super) { + __extends(Clusterer, _super); + + function Clusterer(args, options) { + this.args = args; + this.options = options; + this.before_init(); + this.serviceObject = new (this.primitives().clusterer)(this.args.map, [], this.options); + this.after_init(); + } + + return Clusterer; + + })(Gmaps.Objects.BaseBuilder); + +}).call(this); +(function() { + var __hasProp = {}.hasOwnProperty, + __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; + + this.Gmaps.Google.Builders.Kml = (function(_super) { + __extends(Kml, _super); + + function Kml(args, provider_options) { + this.args = args; + this.provider_options = provider_options != null ? provider_options : {}; + this.before_init(); + this.serviceObject = this.create_kml(); + this.after_init(); + } + + Kml.prototype.create_kml = function() { + return new (this.primitives().kml)(this.args.url, this.kml_options()); + }; + + Kml.prototype.kml_options = function() { + var base_options; + base_options = {}; + return _.defaults(base_options, this.provider_options); + }; + + return Kml; + + })(Gmaps.Objects.BaseBuilder); + +}).call(this); +(function() { + var __hasProp = {}.hasOwnProperty, + __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; + + this.Gmaps.Google.Builders.Map = (function(_super) { + __extends(Map, _super); + + function Map(options, onMapLoad) { + var provider_options; + this.before_init(); + provider_options = _.extend(this.default_options(), options.provider); + this.internal_options = options.internal; + this.serviceObject = new (this.primitives().map)(document.getElementById(this.internal_options.id), provider_options); + this.on_map_load(onMapLoad); + this.after_init(); + } + + Map.prototype.build = function() { + return new (this.model_class())(this.serviceObject, this.primitives()); + }; + + Map.prototype.on_map_load = function(onMapLoad) { + return this.primitives().addListenerOnce(this.serviceObject, 'idle', onMapLoad); + }; + + Map.prototype.default_options = function() { + return { + mapTypeId: this.primitives().mapTypes('ROADMAP'), + center: new (this.primitives().latLng)(0, 0), + zoom: 8 + }; + }; + + return Map; + + })(Gmaps.Objects.BaseBuilder); + +}).call(this); +(function() { + var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, + __hasProp = {}.hasOwnProperty, + __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; + + this.Gmaps.Google.Builders.Marker = (function(_super) { + __extends(Marker, _super); + + Marker.CURRENT_INFOWINDOW = void 0; + + Marker.CACHE_STORE = {}; + + function Marker(args, provider_options, internal_options) { + this.args = args; + this.provider_options = provider_options != null ? provider_options : {}; + this.internal_options = internal_options != null ? internal_options : {}; + this.infowindow_binding = __bind(this.infowindow_binding, this); + this.before_init(); + this.create_marker(); + this.create_infowindow_on_click(); + this.after_init(); + } + + Marker.prototype.build = function() { + return this.marker = new (this.model_class())(this.serviceObject); + }; + + Marker.prototype.create_marker = function() { + return this.serviceObject = new (this.primitives().marker)(this.marker_options()); + }; + + Marker.prototype.create_infowindow = function() { + if (!_.isString(this.args.infowindow)) { + return null; + } + return new (this.primitives().infowindow)({ + content: this.args.infowindow + }); + }; + + Marker.prototype.marker_options = function() { + var base_options, coords; + coords = this._randomized_coordinates(); + base_options = { + title: this.args.marker_title, + position: new (this.primitives().latLng)(coords[0], coords[1]), + icon: this._get_picture('picture'), + shadow: this._get_picture('shadow') + }; + return _.extend(this.provider_options, base_options); + }; + + Marker.prototype.create_infowindow_on_click = function() { + return this.addListener('click', this.infowindow_binding); + }; + + Marker.prototype.infowindow_binding = function() { + var _base; + if (this._should_close_infowindow()) { + this.constructor.CURRENT_INFOWINDOW.close(); + } + this.marker.panTo(); + if (this.infowindow == null) { + this.infowindow = this.create_infowindow(); + } + if (this.infowindow == null) { + return; + } + this.infowindow.open(this.getServiceObject().getMap(), this.getServiceObject()); + if ((_base = this.marker).infowindow == null) { + _base.infowindow = this.infowindow; + } + return this.constructor.CURRENT_INFOWINDOW = this.infowindow; + }; + + Marker.prototype._get_picture = function(picture_name) { + if (!_.isObject(this.args[picture_name]) || !_.isString(this.args[picture_name].url)) { + return null; + } + return this._create_or_retrieve_image(this._picture_args(picture_name)); + }; + + Marker.prototype._create_or_retrieve_image = function(picture_args) { + if (this.constructor.CACHE_STORE[picture_args.url] === void 0) { + this.constructor.CACHE_STORE[picture_args.url] = new (this.primitives().markerImage)(picture_args.url, picture_args.size, picture_args.origin, picture_args.anchor, picture_args.scaledSize); + } + return this.constructor.CACHE_STORE[picture_args.url]; + }; + + Marker.prototype._picture_args = function(picture_name) { + return { + url: this.args[picture_name].url, + anchor: this._createImageAnchorPosition(this.args[picture_name].anchor), + size: new (this.primitives().size)(this.args[picture_name].width, this.args[picture_name].height), + scaledSize: null, + origin: null + }; + }; + + Marker.prototype._createImageAnchorPosition = function(anchorLocation) { + if (!_.isArray(anchorLocation)) { + return null; + } + return new (this.primitives().point)(anchorLocation[0], anchorLocation[1]); + }; + + Marker.prototype._should_close_infowindow = function() { + return this.internal_options.singleInfowindow && (this.constructor.CURRENT_INFOWINDOW != null); + }; + + Marker.prototype._randomized_coordinates = function() { + var Lat, Lng, dx, dy, random; + if (!_.isNumber(this.internal_options.maxRandomDistance)) { + return [this.args.lat, this.args.lng]; + } + random = function() { + return Math.random() * 2 - 1; + }; + dx = this.internal_options.maxRandomDistance * random(); + dy = this.internal_options.maxRandomDistance * random(); + Lat = parseFloat(this.args.lat) + (180 / Math.PI) * (dy / 6378137); + Lng = parseFloat(this.args.lng) + (90 / Math.PI) * (dx / 6378137) / Math.cos(this.args.lat); + return [Lat, Lng]; + }; + + return Marker; + + })(Gmaps.Objects.BaseBuilder); + +}).call(this); +(function() { + var __hasProp = {}.hasOwnProperty, + __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; + + this.Gmaps.Google.Builders.Polygon = (function(_super) { + __extends(Polygon, _super); + + function Polygon(args, provider_options) { + this.args = args; + this.provider_options = provider_options != null ? provider_options : {}; + this.before_init(); + this.serviceObject = this.create_polygon(); + this.after_init(); + } + + Polygon.prototype.create_polygon = function() { + return new (this.primitives().polygon)(this.polygon_options()); + }; + + Polygon.prototype.polygon_options = function() { + var base_options; + base_options = { + path: this._build_path() + }; + return _.defaults(base_options, this.provider_options); + }; + + Polygon.prototype._build_path = function() { + var _this = this; + return _.map(this.args, function(arg) { + return new (_this.primitives().latLng)(arg.lat, arg.lng); + }); + }; + + return Polygon; + + })(Gmaps.Objects.BaseBuilder); + +}).call(this); +(function() { + var __hasProp = {}.hasOwnProperty, + __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; + + this.Gmaps.Google.Builders.Polyline = (function(_super) { + __extends(Polyline, _super); + + function Polyline(args, provider_options) { + this.args = args; + this.provider_options = provider_options != null ? provider_options : {}; + this.before_init(); + this.serviceObject = this.create_polyline(); + this.after_init(); + } + + Polyline.prototype.create_polyline = function() { + return new (this.primitives().polyline)(this.polyline_options()); + }; + + Polyline.prototype.polyline_options = function() { + var base_options; + base_options = { + path: this._build_path() + }; + return _.defaults(base_options, this.provider_options); + }; + + Polyline.prototype._build_path = function() { + var _this = this; + return _.map(this.args, function(arg) { + return new (_this.primitives().latLng)(arg.lat, arg.lng); + }); + }; + + return Polyline; + + })(Gmaps.Objects.BaseBuilder); + +}).call(this); +(function() { + var __hasProp = {}.hasOwnProperty, + __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; + + this.Gmaps.Google.Objects.Bound = (function(_super) { + __extends(Bound, _super); + + Bound.include(Gmaps.Google.Objects.Common); + + function Bound(serviceObject) { + this.serviceObject = serviceObject; + } + + Bound.prototype.extendWith = function(array_or_object) { + var collection, + _this = this; + collection = _.isArray(array_or_object) ? array_or_object : [array_or_object]; + return _.each(collection, function(object) { + return object.updateBounds(_this); + }); + }; + + Bound.prototype.extend = function(value) { + return this.getServiceObject().extend(this.primitives().latLngFromPosition(value)); + }; + + return Bound; + + })(Gmaps.Base); + +}).call(this); +(function() { + var __hasProp = {}.hasOwnProperty, + __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; + + this.Gmaps.Google.Objects.Circle = (function(_super) { + __extends(Circle, _super); + + Circle.include(Gmaps.Google.Objects.Common); + + function Circle(serviceObject) { + this.serviceObject = serviceObject; + } + + Circle.prototype.updateBounds = function(bounds) { + bounds.extend(this.getServiceObject().getBounds().getNorthEast()); + return bounds.extend(this.getServiceObject().getBounds().getSouthWest()); + }; + + return Circle; + + })(Gmaps.Base); + +}).call(this); +(function() { + this.Gmaps.Google.Objects.Clusterer = (function() { + function Clusterer(serviceObject) { + this.serviceObject = serviceObject; + } + + Clusterer.prototype.addMarkers = function(markers) { + var _this = this; + return _.each(markers, function(marker) { + return _this.addMarker(marker); + }); + }; + + Clusterer.prototype.addMarker = function(marker) { + return this.getServiceObject().addMarker(marker.getServiceObject()); + }; + + Clusterer.prototype.clear = function() { + return this.getServiceObject().clearMarkers(); + }; + + Clusterer.prototype.removeMarker = function(marker) { + return this.getServiceObject().removeMarker(marker.getServiceObject()); + }; + + Clusterer.prototype.getServiceObject = function() { + return this.serviceObject; + }; + + return Clusterer; + + })(); + +}).call(this); +(function() { + var __hasProp = {}.hasOwnProperty, + __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; + + this.Gmaps.Google.Objects.Kml = (function(_super) { + __extends(Kml, _super); + + function Kml(serviceObject) { + this.serviceObject = serviceObject; + } + + Kml.prototype.updateBounds = function(bounds) {}; + + Kml.prototype.setMap = function(map) { + return this.getServiceObject().setMap(map); + }; + + Kml.prototype.getServiceObject = function() { + return this.serviceObject; + }; + + Kml.prototype.primitives = function() { + return this.constructor.PRIMITIVES; + }; + + return Kml; + + })(Gmaps.Base); + +}).call(this); +(function() { + var __hasProp = {}.hasOwnProperty, + __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; + + this.Gmaps.Google.Objects.Map = (function(_super) { + __extends(Map, _super); + + function Map(serviceObject) { + this.serviceObject = serviceObject; + } + + Map.prototype.getServiceObject = function() { + return this.serviceObject; + }; + + Map.prototype.centerOn = function(position) { + return this.getServiceObject().setCenter(this.primitives().latLngFromPosition(position)); + }; + + Map.prototype.fitToBounds = function(boundsObject) { + if (!boundsObject.isEmpty()) { + return this.getServiceObject().fitBounds(boundsObject); + } + }; + + Map.prototype.primitives = function() { + return this.constructor.PRIMITIVES; + }; + + return Map; + + })(Gmaps.Base); + +}).call(this); +(function() { + var __hasProp = {}.hasOwnProperty, + __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; + + this.Gmaps.Google.Objects.Marker = (function(_super) { + __extends(Marker, _super); + + Marker.include(Gmaps.Google.Objects.Common); + + function Marker(serviceObject) { + this.serviceObject = serviceObject; + } + + Marker.prototype.updateBounds = function(bounds) { + return bounds.extend(this.getServiceObject().position); + }; + + Marker.prototype.panTo = function() { + return this.getServiceObject().getMap().panTo(this.getServiceObject().getPosition()); + }; + + return Marker; + + })(Gmaps.Base); + +}).call(this); +(function() { + var __hasProp = {}.hasOwnProperty, + __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; + + this.Gmaps.Google.Objects.Polygon = (function(_super) { + __extends(Polygon, _super); + + Polygon.include(Gmaps.Google.Objects.Common); + + function Polygon(serviceObject) { + this.serviceObject = serviceObject; + } + + Polygon.prototype.updateBounds = function(bounds) { + var ll, _i, _len, _ref, _results; + _ref = this.serviceObject.getPath().getArray(); + _results = []; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + ll = _ref[_i]; + _results.push(bounds.extend(ll)); + } + return _results; + }; + + return Polygon; + + })(Gmaps.Base); + +}).call(this); +(function() { + var __hasProp = {}.hasOwnProperty, + __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; + + this.Gmaps.Google.Objects.Polyline = (function(_super) { + __extends(Polyline, _super); + + Polyline.include(Gmaps.Google.Objects.Common); + + function Polyline(serviceObject) { + this.serviceObject = serviceObject; + } + + Polyline.prototype.updateBounds = function(bounds) { + var ll, _i, _len, _ref, _results; + _ref = this.serviceObject.getPath().getArray(); + _results = []; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + ll = _ref[_i]; + _results.push(bounds.extend(ll)); + } + return _results; + }; + + return Polyline; + + })(Gmaps.Base); + +}).call(this); +(function() { + this.Gmaps.Google.Primitives = function() { + var factory; + factory = { + point: google.maps.Point, + size: google.maps.Size, + circle: google.maps.Circle, + latLng: google.maps.LatLng, + latLngBounds: google.maps.LatLngBounds, + map: google.maps.Map, + mapTypez: google.maps.MapTypeId, + markerImage: google.maps.MarkerImage, + marker: google.maps.Marker, + infowindow: google.maps.InfoWindow, + listener: google.maps.event.addListener, + clusterer: MarkerClusterer, + listenerOnce: google.maps.event.addListenerOnce, + polyline: google.maps.Polyline, + polygon: google.maps.Polygon, + kml: google.maps.KmlLayer, + addListener: function(object, event_name, fn) { + return factory.listener(object, event_name, fn); + }, + addListenerOnce: function(object, event_name, fn) { + return factory.listenerOnce(object, event_name, fn); + }, + mapTypes: function(type) { + return factory.mapTypez[type]; + }, + latLngFromPosition: function(position) { + if (_.isArray(position)) { + return new factory.latLng(position[0], position[1]); + } else { + if (_.isNumber(position.lat) && _.isNumber(position.lng)) { + return new factory.latLng(position.lat, position.lng); + } else { + if (_.isFunction(position.getServiceObject)) { + return position.getServiceObject().getPosition(); + } else { + return position; + } + } + } + } + }; + return factory; + }; + +}).call(this); +(function() { + + +}).call(this); diff --git a/test/controllers/access_points_controller_test.rb b/test/controllers/access_points_controller_test.rb new file mode 100644 index 0000000..2605b93 --- /dev/null +++ b/test/controllers/access_points_controller_test.rb @@ -0,0 +1,48 @@ +require 'test_helper' + +class AccessPointsControllerTest < ActionDispatch::IntegrationTest + setup do + @access_point = access_points(:one) + end + + test "should get index" do + get access_points_url + assert_response :success + end + + test "should get new" do + get new_access_point_url + assert_response :success + end + + test "should create access_point" do + assert_difference('AccessPoint.count') do + post access_points_url, params: { access_point: { ip_address: @access_point.ip_address, mac_address: @access_point.mac_address, password: @access_point.password, user: @access_point.user } } + end + + assert_redirected_to access_point_url(AccessPoint.last) + end + + test "should show access_point" do + get access_point_url(@access_point) + assert_response :success + end + + test "should get edit" do + get edit_access_point_url(@access_point) + assert_response :success + end + + test "should update access_point" do + patch access_point_url(@access_point), params: { access_point: { ip_address: @access_point.ip_address, mac_address: @access_point.mac_address, password: @access_point.password, user: @access_point.user } } + assert_redirected_to access_point_url(@access_point) + end + + test "should destroy access_point" do + assert_difference('AccessPoint.count', -1) do + delete access_point_url(@access_point) + end + + assert_redirected_to access_points_url + end +end diff --git a/test/controllers/cordinates_controller_test.rb b/test/controllers/cordinates_controller_test.rb new file mode 100644 index 0000000..84ff9ae --- /dev/null +++ b/test/controllers/cordinates_controller_test.rb @@ -0,0 +1,48 @@ +require 'test_helper' + +class CordinatesControllerTest < ActionDispatch::IntegrationTest + setup do + @cordinate = cordinates(:one) + end + + test "should get index" do + get cordinates_url + assert_response :success + end + + test "should get new" do + get new_cordinate_url + assert_response :success + end + + test "should create cordinate" do + assert_difference('Cordinate.count') do + post cordinates_url, params: { cordinate: { latitude: @cordinate.latitude, longitude: @cordinate.longitude } } + end + + assert_redirected_to cordinate_url(Cordinate.last) + end + + test "should show cordinate" do + get cordinate_url(@cordinate) + assert_response :success + end + + test "should get edit" do + get edit_cordinate_url(@cordinate) + assert_response :success + end + + test "should update cordinate" do + patch cordinate_url(@cordinate), params: { cordinate: { latitude: @cordinate.latitude, longitude: @cordinate.longitude } } + assert_redirected_to cordinate_url(@cordinate) + end + + test "should destroy cordinate" do + assert_difference('Cordinate.count', -1) do + delete cordinate_url(@cordinate) + end + + assert_redirected_to cordinates_url + end +end diff --git a/test/controllers/data_controller_test.rb b/test/controllers/data_controller_test.rb new file mode 100644 index 0000000..5bb1407 --- /dev/null +++ b/test/controllers/data_controller_test.rb @@ -0,0 +1,48 @@ +require 'test_helper' + +class DataControllerTest < ActionDispatch::IntegrationTest + setup do + @datum = data(:one) + end + + test "should get index" do + get data_url + assert_response :success + end + + test "should get new" do + get new_datum_url + assert_response :success + end + + test "should create datum" do + assert_difference('Datum.count') do + post data_url, params: { datum: { mobile_id: @datum.mobile_id, type: @datum.type, value: @datum.value } } + end + + assert_redirected_to datum_url(Datum.last) + end + + test "should show datum" do + get datum_url(@datum) + assert_response :success + end + + test "should get edit" do + get edit_datum_url(@datum) + assert_response :success + end + + test "should update datum" do + patch datum_url(@datum), params: { datum: { mobile_id: @datum.mobile_id, type: @datum.type, value: @datum.value } } + assert_redirected_to datum_url(@datum) + end + + test "should destroy datum" do + assert_difference('Datum.count', -1) do + delete datum_url(@datum) + end + + assert_redirected_to data_url + end +end diff --git a/test/controllers/devices_controller_test.rb b/test/controllers/devices_controller_test.rb new file mode 100644 index 0000000..8521160 --- /dev/null +++ b/test/controllers/devices_controller_test.rb @@ -0,0 +1,48 @@ +require 'test_helper' + +class DevicesControllerTest < ActionDispatch::IntegrationTest + setup do + @device = devices(:one) + end + + test "should get index" do + get devices_url + assert_response :success + end + + test "should get new" do + get new_device_url + assert_response :success + end + + test "should create device" do + assert_difference('Device.count') do + post devices_url, params: { device: { } } + end + + assert_redirected_to device_url(Device.last) + end + + test "should show device" do + get device_url(@device) + assert_response :success + end + + test "should get edit" do + get edit_device_url(@device) + assert_response :success + end + + test "should update device" do + patch device_url(@device), params: { device: { } } + assert_redirected_to device_url(@device) + end + + test "should destroy device" do + assert_difference('Device.count', -1) do + delete device_url(@device) + end + + assert_redirected_to devices_url + end +end diff --git a/test/controllers/location_devices_controller_test.rb b/test/controllers/location_devices_controller_test.rb new file mode 100644 index 0000000..a9e2072 --- /dev/null +++ b/test/controllers/location_devices_controller_test.rb @@ -0,0 +1,48 @@ +require 'test_helper' + +class LocationDevicesControllerTest < ActionDispatch::IntegrationTest + setup do + @location_device = location_devices(:one) + end + + test "should get index" do + get location_devices_url + assert_response :success + end + + test "should get new" do + get new_location_device_url + assert_response :success + end + + test "should create location_device" do + assert_difference('LocationDevice.count') do + post location_devices_url, params: { location_device: { access_point_id: @location_device.access_point_id, coordenate_id: @location_device.coordenate_id } } + end + + assert_redirected_to location_device_url(LocationDevice.last) + end + + test "should show location_device" do + get location_device_url(@location_device) + assert_response :success + end + + test "should get edit" do + get edit_location_device_url(@location_device) + assert_response :success + end + + test "should update location_device" do + patch location_device_url(@location_device), params: { location_device: { access_point_id: @location_device.access_point_id, coordenate_id: @location_device.coordenate_id } } + assert_redirected_to location_device_url(@location_device) + end + + test "should destroy location_device" do + assert_difference('LocationDevice.count', -1) do + delete location_device_url(@location_device) + end + + assert_redirected_to location_devices_url + end +end diff --git a/test/controllers/mobiles_controller_test.rb b/test/controllers/mobiles_controller_test.rb new file mode 100644 index 0000000..1adcea7 --- /dev/null +++ b/test/controllers/mobiles_controller_test.rb @@ -0,0 +1,48 @@ +require 'test_helper' + +class MobilesControllerTest < ActionDispatch::IntegrationTest + setup do + @mobile = mobiles(:one) + end + + test "should get index" do + get mobiles_url + assert_response :success + end + + test "should get new" do + get new_mobile_url + assert_response :success + end + + test "should create mobile" do + assert_difference('Mobile.count') do + post mobiles_url, params: { mobile: { mac_address: @mobile.mac_address, modelo: @mobile.modelo } } + end + + assert_redirected_to mobile_url(Mobile.last) + end + + test "should show mobile" do + get mobile_url(@mobile) + assert_response :success + end + + test "should get edit" do + get edit_mobile_url(@mobile) + assert_response :success + end + + test "should update mobile" do + patch mobile_url(@mobile), params: { mobile: { mac_address: @mobile.mac_address, modelo: @mobile.modelo } } + assert_redirected_to mobile_url(@mobile) + end + + test "should destroy mobile" do + assert_difference('Mobile.count', -1) do + delete mobile_url(@mobile) + end + + assert_redirected_to mobiles_url + end +end diff --git a/test/controllers/permises_controller_test.rb b/test/controllers/permises_controller_test.rb new file mode 100644 index 0000000..9185e3d --- /dev/null +++ b/test/controllers/permises_controller_test.rb @@ -0,0 +1,48 @@ +require 'test_helper' + +class PermisesControllerTest < ActionDispatch::IntegrationTest + setup do + @permise = permises(:one) + end + + test "should get index" do + get permises_url + assert_response :success + end + + test "should get new" do + get new_permise_url + assert_response :success + end + + test "should create permise" do + assert_difference('Permise.count') do + post permises_url, params: { permise: { method: @permise.method, object: @permise.object } } + end + + assert_redirected_to permise_url(Permise.last) + end + + test "should show permise" do + get permise_url(@permise) + assert_response :success + end + + test "should get edit" do + get edit_permise_url(@permise) + assert_response :success + end + + test "should update permise" do + patch permise_url(@permise), params: { permise: { method: @permise.method, object: @permise.object } } + assert_redirected_to permise_url(@permise) + end + + test "should destroy permise" do + assert_difference('Permise.count', -1) do + delete permise_url(@permise) + end + + assert_redirected_to permises_url + end +end diff --git a/test/controllers/permises_roles_controller_test.rb b/test/controllers/permises_roles_controller_test.rb new file mode 100644 index 0000000..e281576 --- /dev/null +++ b/test/controllers/permises_roles_controller_test.rb @@ -0,0 +1,48 @@ +require 'test_helper' + +class PermisesRolesControllerTest < ActionDispatch::IntegrationTest + setup do + @permises_role = permises_roles(:one) + end + + test "should get index" do + get permises_roles_url + assert_response :success + end + + test "should get new" do + get new_permises_role_url + assert_response :success + end + + test "should create permises_role" do + assert_difference('PermisesRole.count') do + post permises_roles_url, params: { permises_role: { permises_id: @permises_role.permises_id, roles_id: @permises_role.roles_id } } + end + + assert_redirected_to permises_role_url(PermisesRole.last) + end + + test "should show permises_role" do + get permises_role_url(@permises_role) + assert_response :success + end + + test "should get edit" do + get edit_permises_role_url(@permises_role) + assert_response :success + end + + test "should update permises_role" do + patch permises_role_url(@permises_role), params: { permises_role: { permises_id: @permises_role.permises_id, roles_id: @permises_role.roles_id } } + assert_redirected_to permises_role_url(@permises_role) + end + + test "should destroy permises_role" do + assert_difference('PermisesRole.count', -1) do + delete permises_role_url(@permises_role) + end + + assert_redirected_to permises_roles_url + end +end diff --git a/test/controllers/roles_controller_test.rb b/test/controllers/roles_controller_test.rb new file mode 100644 index 0000000..70bf36d --- /dev/null +++ b/test/controllers/roles_controller_test.rb @@ -0,0 +1,48 @@ +require 'test_helper' + +class RolesControllerTest < ActionDispatch::IntegrationTest + setup do + @role = roles(:one) + end + + test "should get index" do + get roles_url + assert_response :success + end + + test "should get new" do + get new_role_url + assert_response :success + end + + test "should create role" do + assert_difference('Role.count') do + post roles_url, params: { role: { description: @role.description, name: @role.name } } + end + + assert_redirected_to role_url(Role.last) + end + + test "should show role" do + get role_url(@role) + assert_response :success + end + + test "should get edit" do + get edit_role_url(@role) + assert_response :success + end + + test "should update role" do + patch role_url(@role), params: { role: { description: @role.description, name: @role.name } } + assert_redirected_to role_url(@role) + end + + test "should destroy role" do + assert_difference('Role.count', -1) do + delete role_url(@role) + end + + assert_redirected_to roles_url + end +end diff --git a/test/controllers/zone__devices_controller_test.rb b/test/controllers/zone__devices_controller_test.rb new file mode 100644 index 0000000..379a78a --- /dev/null +++ b/test/controllers/zone__devices_controller_test.rb @@ -0,0 +1,48 @@ +require 'test_helper' + +class ZoneDevicesControllerTest < ActionDispatch::IntegrationTest + setup do + @zone__device = zone__devices(:one) + end + + test "should get index" do + get zone__devices_url + assert_response :success + end + + test "should get new" do + get new_zone__device_url + assert_response :success + end + + test "should create zone__device" do + assert_difference('ZoneDevice.count') do + post zone__devices_url, params: { zone__device: { access_point_id: @zone__device.access_point_id, zone_id: @zone__device.zone_id } } + end + + assert_redirected_to zone__device_url(ZoneDevice.last) + end + + test "should show zone__device" do + get zone__device_url(@zone__device) + assert_response :success + end + + test "should get edit" do + get edit_zone__device_url(@zone__device) + assert_response :success + end + + test "should update zone__device" do + patch zone__device_url(@zone__device), params: { zone__device: { access_point_id: @zone__device.access_point_id, zone_id: @zone__device.zone_id } } + assert_redirected_to zone__device_url(@zone__device) + end + + test "should destroy zone__device" do + assert_difference('ZoneDevice.count', -1) do + delete zone__device_url(@zone__device) + end + + assert_redirected_to zone__devices_url + end +end diff --git a/test/controllers/zone_controller_test.rb b/test/controllers/zone_controller_test.rb new file mode 100644 index 0000000..6d834f0 --- /dev/null +++ b/test/controllers/zone_controller_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class ZoneControllerTest < ActionDispatch::IntegrationTest + # test "the truth" do + # assert true + # end +end diff --git a/test/controllers/zones_controller_test.rb b/test/controllers/zones_controller_test.rb new file mode 100644 index 0000000..ff6bafa --- /dev/null +++ b/test/controllers/zones_controller_test.rb @@ -0,0 +1,48 @@ +require 'test_helper' + +class ZonesControllerTest < ActionDispatch::IntegrationTest + setup do + @zone = zones(:one) + end + + test "should get index" do + get zones_url + assert_response :success + end + + test "should get new" do + get new_zone_url + assert_response :success + end + + test "should create zone" do + assert_difference('Zone.count') do + post zones_url, params: { zone: { description: @zone.description, name: @zone.name } } + end + + assert_redirected_to zone_url(Zone.last) + end + + test "should show zone" do + get zone_url(@zone) + assert_response :success + end + + test "should get edit" do + get edit_zone_url(@zone) + assert_response :success + end + + test "should update zone" do + patch zone_url(@zone), params: { zone: { description: @zone.description, name: @zone.name } } + assert_redirected_to zone_url(@zone) + end + + test "should destroy zone" do + assert_difference('Zone.count', -1) do + delete zone_url(@zone) + end + + assert_redirected_to zones_url + end +end diff --git a/test/fixtures/access_points.yml b/test/fixtures/access_points.yml new file mode 100644 index 0000000..974b8b2 --- /dev/null +++ b/test/fixtures/access_points.yml @@ -0,0 +1,13 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + ip_address: MyString + mac_address: MyString + user: MyString + password: MyString + +two: + ip_address: MyString + mac_address: MyString + user: MyString + password: MyString diff --git a/test/fixtures/cordinates.yml b/test/fixtures/cordinates.yml new file mode 100644 index 0000000..245be9b --- /dev/null +++ b/test/fixtures/cordinates.yml @@ -0,0 +1,9 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + latitude: 1.5 + longitude: 1.5 + +two: + latitude: 1.5 + longitude: 1.5 diff --git a/test/fixtures/data.yml b/test/fixtures/data.yml new file mode 100644 index 0000000..783e156 --- /dev/null +++ b/test/fixtures/data.yml @@ -0,0 +1,11 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + mobile: one + type: + value: MyString + +two: + mobile: two + type: + value: MyString diff --git a/test/fixtures/limite_zones.yml b/test/fixtures/limite_zones.yml new file mode 100644 index 0000000..c1f799b --- /dev/null +++ b/test/fixtures/limite_zones.yml @@ -0,0 +1,9 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + zones: one + coordinate: one + +two: + zones: two + coordinate: two diff --git a/test/fixtures/location_devices.yml b/test/fixtures/location_devices.yml new file mode 100644 index 0000000..00e6d8f --- /dev/null +++ b/test/fixtures/location_devices.yml @@ -0,0 +1,9 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + access_point: one + coordenate: one + +two: + access_point: two + coordenate: two diff --git a/test/fixtures/mobiles.yml b/test/fixtures/mobiles.yml index 5027624..3d361b6 100644 --- a/test/fixtures/mobiles.yml +++ b/test/fixtures/mobiles.yml @@ -1,13 +1,9 @@ # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html one: - user: one - model: MyString - brand: MyString + modelo: MyString mac_address: MyString two: - user: two - model: MyString - brand: MyString + modelo: MyString mac_address: MyString diff --git a/test/fixtures/permises.yml b/test/fixtures/permises.yml new file mode 100644 index 0000000..c4124d0 --- /dev/null +++ b/test/fixtures/permises.yml @@ -0,0 +1,9 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + object: MyString + method: MyString + +two: + object: MyString + method: MyString diff --git a/test/fixtures/permises_roles.yml b/test/fixtures/permises_roles.yml new file mode 100644 index 0000000..36e9406 --- /dev/null +++ b/test/fixtures/permises_roles.yml @@ -0,0 +1,9 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + permises: one + roles: one + +two: + permises: two + roles: two diff --git a/test/fixtures/zone__devices.yml b/test/fixtures/zone__devices.yml new file mode 100644 index 0000000..8a6ea41 --- /dev/null +++ b/test/fixtures/zone__devices.yml @@ -0,0 +1,9 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + access_point: one + zone: one + +two: + access_point: two + zone: two diff --git a/test/models/access_point_test.rb b/test/models/access_point_test.rb new file mode 100644 index 0000000..e5505e7 --- /dev/null +++ b/test/models/access_point_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class AccessPointTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/models/cordinate_test.rb b/test/models/cordinate_test.rb new file mode 100644 index 0000000..102520f --- /dev/null +++ b/test/models/cordinate_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class CordinateTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/models/datum_test.rb b/test/models/datum_test.rb new file mode 100644 index 0000000..1332056 --- /dev/null +++ b/test/models/datum_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class DatumTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/models/limite_zone_test.rb b/test/models/limite_zone_test.rb new file mode 100644 index 0000000..6e64e7b --- /dev/null +++ b/test/models/limite_zone_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class LimiteZoneTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/models/location_device_test.rb b/test/models/location_device_test.rb new file mode 100644 index 0000000..ea935fb --- /dev/null +++ b/test/models/location_device_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class LocationDeviceTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/models/permise_test.rb b/test/models/permise_test.rb new file mode 100644 index 0000000..659ac02 --- /dev/null +++ b/test/models/permise_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class PermiseTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/models/permises_role_test.rb b/test/models/permises_role_test.rb new file mode 100644 index 0000000..aa8365d --- /dev/null +++ b/test/models/permises_role_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class PermisesRoleTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/models/zone__device_test.rb b/test/models/zone__device_test.rb new file mode 100644 index 0000000..30d1d7e --- /dev/null +++ b/test/models/zone__device_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class ZoneDeviceTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/system/access_points_test.rb b/test/system/access_points_test.rb new file mode 100644 index 0000000..f0c9973 --- /dev/null +++ b/test/system/access_points_test.rb @@ -0,0 +1,49 @@ +require "application_system_test_case" + +class AccessPointsTest < ApplicationSystemTestCase + setup do + @access_point = access_points(:one) + end + + test "visiting the index" do + visit access_points_url + assert_selector "h1", text: "Access Points" + end + + test "creating a Access point" do + visit access_points_url + click_on "New Access Point" + + fill_in "Ip address", with: @access_point.ip_address + fill_in "Mac address", with: @access_point.mac_address + fill_in "Password", with: @access_point.password + fill_in "User", with: @access_point.user + click_on "Create Access point" + + assert_text "Access point was successfully created" + click_on "Back" + end + + test "updating a Access point" do + visit access_points_url + click_on "Edit", match: :first + + fill_in "Ip address", with: @access_point.ip_address + fill_in "Mac address", with: @access_point.mac_address + fill_in "Password", with: @access_point.password + fill_in "User", with: @access_point.user + click_on "Update Access point" + + assert_text "Access point was successfully updated" + click_on "Back" + end + + test "destroying a Access point" do + visit access_points_url + page.accept_confirm do + click_on "Destroy", match: :first + end + + assert_text "Access point was successfully destroyed" + end +end diff --git a/test/system/cordinates_test.rb b/test/system/cordinates_test.rb new file mode 100644 index 0000000..a66e6d0 --- /dev/null +++ b/test/system/cordinates_test.rb @@ -0,0 +1,45 @@ +require "application_system_test_case" + +class CordinatesTest < ApplicationSystemTestCase + setup do + @cordinate = cordinates(:one) + end + + test "visiting the index" do + visit cordinates_url + assert_selector "h1", text: "Cordinates" + end + + test "creating a Cordinate" do + visit cordinates_url + click_on "New Cordinate" + + fill_in "Latitude", with: @cordinate.latitude + fill_in "Longitude", with: @cordinate.longitude + click_on "Create Cordinate" + + assert_text "Cordinate was successfully created" + click_on "Back" + end + + test "updating a Cordinate" do + visit cordinates_url + click_on "Edit", match: :first + + fill_in "Latitude", with: @cordinate.latitude + fill_in "Longitude", with: @cordinate.longitude + click_on "Update Cordinate" + + assert_text "Cordinate was successfully updated" + click_on "Back" + end + + test "destroying a Cordinate" do + visit cordinates_url + page.accept_confirm do + click_on "Destroy", match: :first + end + + assert_text "Cordinate was successfully destroyed" + end +end diff --git a/test/system/data_test.rb b/test/system/data_test.rb new file mode 100644 index 0000000..a91f18e --- /dev/null +++ b/test/system/data_test.rb @@ -0,0 +1,47 @@ +require "application_system_test_case" + +class DataTest < ApplicationSystemTestCase + setup do + @datum = data(:one) + end + + test "visiting the index" do + visit data_url + assert_selector "h1", text: "Data" + end + + test "creating a Datum" do + visit data_url + click_on "New Datum" + + fill_in "Mobile", with: @datum.mobile_id + fill_in "Type", with: @datum.type + fill_in "Value", with: @datum.value + click_on "Create Datum" + + assert_text "Datum was successfully created" + click_on "Back" + end + + test "updating a Datum" do + visit data_url + click_on "Edit", match: :first + + fill_in "Mobile", with: @datum.mobile_id + fill_in "Type", with: @datum.type + fill_in "Value", with: @datum.value + click_on "Update Datum" + + assert_text "Datum was successfully updated" + click_on "Back" + end + + test "destroying a Datum" do + visit data_url + page.accept_confirm do + click_on "Destroy", match: :first + end + + assert_text "Datum was successfully destroyed" + end +end diff --git a/test/system/devices_test.rb b/test/system/devices_test.rb new file mode 100644 index 0000000..4a43205 --- /dev/null +++ b/test/system/devices_test.rb @@ -0,0 +1,41 @@ +require "application_system_test_case" + +class DevicesTest < ApplicationSystemTestCase + setup do + @device = devices(:one) + end + + test "visiting the index" do + visit devices_url + assert_selector "h1", text: "Devices" + end + + test "creating a Device" do + visit devices_url + click_on "New Device" + + click_on "Create Device" + + assert_text "Device was successfully created" + click_on "Back" + end + + test "updating a Device" do + visit devices_url + click_on "Edit", match: :first + + click_on "Update Device" + + assert_text "Device was successfully updated" + click_on "Back" + end + + test "destroying a Device" do + visit devices_url + page.accept_confirm do + click_on "Destroy", match: :first + end + + assert_text "Device was successfully destroyed" + end +end diff --git a/test/system/location_devices_test.rb b/test/system/location_devices_test.rb new file mode 100644 index 0000000..973f107 --- /dev/null +++ b/test/system/location_devices_test.rb @@ -0,0 +1,45 @@ +require "application_system_test_case" + +class LocationDevicesTest < ApplicationSystemTestCase + setup do + @location_device = location_devices(:one) + end + + test "visiting the index" do + visit location_devices_url + assert_selector "h1", text: "Location Devices" + end + + test "creating a Location device" do + visit location_devices_url + click_on "New Location Device" + + fill_in "Access point", with: @location_device.access_point_id + fill_in "Coordenate", with: @location_device.coordenate_id + click_on "Create Location device" + + assert_text "Location device was successfully created" + click_on "Back" + end + + test "updating a Location device" do + visit location_devices_url + click_on "Edit", match: :first + + fill_in "Access point", with: @location_device.access_point_id + fill_in "Coordenate", with: @location_device.coordenate_id + click_on "Update Location device" + + assert_text "Location device was successfully updated" + click_on "Back" + end + + test "destroying a Location device" do + visit location_devices_url + page.accept_confirm do + click_on "Destroy", match: :first + end + + assert_text "Location device was successfully destroyed" + end +end diff --git a/test/system/mobiles_test.rb b/test/system/mobiles_test.rb new file mode 100644 index 0000000..ddbece7 --- /dev/null +++ b/test/system/mobiles_test.rb @@ -0,0 +1,45 @@ +require "application_system_test_case" + +class MobilesTest < ApplicationSystemTestCase + setup do + @mobile = mobiles(:one) + end + + test "visiting the index" do + visit mobiles_url + assert_selector "h1", text: "Mobiles" + end + + test "creating a Mobile" do + visit mobiles_url + click_on "New Mobile" + + fill_in "Mac address", with: @mobile.mac_address + fill_in "Modelo", with: @mobile.modelo + click_on "Create Mobile" + + assert_text "Mobile was successfully created" + click_on "Back" + end + + test "updating a Mobile" do + visit mobiles_url + click_on "Edit", match: :first + + fill_in "Mac address", with: @mobile.mac_address + fill_in "Modelo", with: @mobile.modelo + click_on "Update Mobile" + + assert_text "Mobile was successfully updated" + click_on "Back" + end + + test "destroying a Mobile" do + visit mobiles_url + page.accept_confirm do + click_on "Destroy", match: :first + end + + assert_text "Mobile was successfully destroyed" + end +end diff --git a/test/system/permises_roles_test.rb b/test/system/permises_roles_test.rb new file mode 100644 index 0000000..bad3ae3 --- /dev/null +++ b/test/system/permises_roles_test.rb @@ -0,0 +1,45 @@ +require "application_system_test_case" + +class PermisesRolesTest < ApplicationSystemTestCase + setup do + @permises_role = permises_roles(:one) + end + + test "visiting the index" do + visit permises_roles_url + assert_selector "h1", text: "Permises Roles" + end + + test "creating a Permises role" do + visit permises_roles_url + click_on "New Permises Role" + + fill_in "Permises", with: @permises_role.permises_id + fill_in "Roles", with: @permises_role.roles_id + click_on "Create Permises role" + + assert_text "Permises role was successfully created" + click_on "Back" + end + + test "updating a Permises role" do + visit permises_roles_url + click_on "Edit", match: :first + + fill_in "Permises", with: @permises_role.permises_id + fill_in "Roles", with: @permises_role.roles_id + click_on "Update Permises role" + + assert_text "Permises role was successfully updated" + click_on "Back" + end + + test "destroying a Permises role" do + visit permises_roles_url + page.accept_confirm do + click_on "Destroy", match: :first + end + + assert_text "Permises role was successfully destroyed" + end +end diff --git a/test/system/permises_test.rb b/test/system/permises_test.rb new file mode 100644 index 0000000..be08bd1 --- /dev/null +++ b/test/system/permises_test.rb @@ -0,0 +1,45 @@ +require "application_system_test_case" + +class PermisesTest < ApplicationSystemTestCase + setup do + @permise = permises(:one) + end + + test "visiting the index" do + visit permises_url + assert_selector "h1", text: "Permises" + end + + test "creating a Permise" do + visit permises_url + click_on "New Permise" + + fill_in "Method", with: @permise.method + fill_in "Object", with: @permise.object + click_on "Create Permise" + + assert_text "Permise was successfully created" + click_on "Back" + end + + test "updating a Permise" do + visit permises_url + click_on "Edit", match: :first + + fill_in "Method", with: @permise.method + fill_in "Object", with: @permise.object + click_on "Update Permise" + + assert_text "Permise was successfully updated" + click_on "Back" + end + + test "destroying a Permise" do + visit permises_url + page.accept_confirm do + click_on "Destroy", match: :first + end + + assert_text "Permise was successfully destroyed" + end +end diff --git a/test/system/roles_test.rb b/test/system/roles_test.rb new file mode 100644 index 0000000..563e191 --- /dev/null +++ b/test/system/roles_test.rb @@ -0,0 +1,45 @@ +require "application_system_test_case" + +class RolesTest < ApplicationSystemTestCase + setup do + @role = roles(:one) + end + + test "visiting the index" do + visit roles_url + assert_selector "h1", text: "Roles" + end + + test "creating a Role" do + visit roles_url + click_on "New Role" + + fill_in "Description", with: @role.description + fill_in "Name", with: @role.name + click_on "Create Role" + + assert_text "Role was successfully created" + click_on "Back" + end + + test "updating a Role" do + visit roles_url + click_on "Edit", match: :first + + fill_in "Description", with: @role.description + fill_in "Name", with: @role.name + click_on "Update Role" + + assert_text "Role was successfully updated" + click_on "Back" + end + + test "destroying a Role" do + visit roles_url + page.accept_confirm do + click_on "Destroy", match: :first + end + + assert_text "Role was successfully destroyed" + end +end diff --git a/test/system/zone__devices_test.rb b/test/system/zone__devices_test.rb new file mode 100644 index 0000000..6170062 --- /dev/null +++ b/test/system/zone__devices_test.rb @@ -0,0 +1,45 @@ +require "application_system_test_case" + +class ZoneDevicesTest < ApplicationSystemTestCase + setup do + @zone__device = zone__devices(:one) + end + + test "visiting the index" do + visit zone__devices_url + assert_selector "h1", text: "Zone Devices" + end + + test "creating a Zone device" do + visit zone__devices_url + click_on "New Zone Device" + + fill_in "Access point", with: @zone__device.access_point_id + fill_in "Zone", with: @zone__device.zone_id + click_on "Create Zone device" + + assert_text "Zone device was successfully created" + click_on "Back" + end + + test "updating a Zone device" do + visit zone__devices_url + click_on "Edit", match: :first + + fill_in "Access point", with: @zone__device.access_point_id + fill_in "Zone", with: @zone__device.zone_id + click_on "Update Zone device" + + assert_text "Zone device was successfully updated" + click_on "Back" + end + + test "destroying a Zone device" do + visit zone__devices_url + page.accept_confirm do + click_on "Destroy", match: :first + end + + assert_text "Zone device was successfully destroyed" + end +end diff --git a/test/system/zones_test.rb b/test/system/zones_test.rb new file mode 100644 index 0000000..c2ae8fe --- /dev/null +++ b/test/system/zones_test.rb @@ -0,0 +1,45 @@ +require "application_system_test_case" + +class ZonesTest < ApplicationSystemTestCase + setup do + @zone = zones(:one) + end + + test "visiting the index" do + visit zones_url + assert_selector "h1", text: "Zones" + end + + test "creating a Zone" do + visit zones_url + click_on "New Zone" + + fill_in "Description", with: @zone.description + fill_in "Name", with: @zone.name + click_on "Create Zone" + + assert_text "Zone was successfully created" + click_on "Back" + end + + test "updating a Zone" do + visit zones_url + click_on "Edit", match: :first + + fill_in "Description", with: @zone.description + fill_in "Name", with: @zone.name + click_on "Update Zone" + + assert_text "Zone was successfully updated" + click_on "Back" + end + + test "destroying a Zone" do + visit zones_url + page.accept_confirm do + click_on "Destroy", match: :first + end + + assert_text "Zone was successfully destroyed" + end +end diff --git a/vendor/javascripts/application.js b/vendor/javascripts/application.js index 82e6f0f..eb3f4bf 100644 --- a/vendor/javascripts/application.js +++ b/vendor/javascripts/application.js @@ -13,4 +13,6 @@ //= require rails-ujs //= require activestorage //= require turbolinks +//= gmaps +//= gmaps_ujs //= require_tree .