Skip to content
This repository has been archived by the owner on May 14, 2022. It is now read-only.

Remove floors logic #83

Merged
merged 4 commits into from
Dec 13, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions app/assets/javascripts/locations/floors.js

This file was deleted.

9 changes: 0 additions & 9 deletions app/assets/javascripts/locations/libraries.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
// Place all the behaviors and hooks related to the matching controller here.
// All this logic will automatically be available in application.js.
$(document).ready(function(){
$( ".edit-link" ).last().text("Add Floor")
$( ".edit-link" ).last().siblings("input,label").remove()

$( ".edit-link" ).on( "click", function(event) {
event.preventDefault();
console.log(this);
$(this).siblings('.floor-form').toggle();
});

// tablesorter editable position
$("table.reorder").tablesorter({
sortList: [[0,0]],
Expand Down
4 changes: 0 additions & 4 deletions app/assets/stylesheets/locations/floors.css

This file was deleted.

65 changes: 0 additions & 65 deletions app/controllers/locations/floors_controller.rb

This file was deleted.

4 changes: 1 addition & 3 deletions app/controllers/locations/libraries_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,10 @@ def show
# GET /libraries/new
def new
@library = Library.new
@library.floors.build
end

# GET /libraries/1/edit
def edit
@library.floors.build
end

# POST /libraries
Expand Down Expand Up @@ -67,7 +65,7 @@ def set_library

# Only allow a trusted parameter "white list" through.
def library_params
params.require(:library).permit(:label, :code, :order, locations_floor_ids: [], floors_attributes: [ :id, :label, :floor_plan_image, :_destroy])
params.require(:library).permit(:label, :code, :order)
end
end
end
4 changes: 0 additions & 4 deletions app/helpers/locations/floors_helper.rb

This file was deleted.

9 changes: 0 additions & 9 deletions app/models/locations/floor.rb

This file was deleted.

5 changes: 0 additions & 5 deletions app/models/locations/library.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
module Locations
class Library < ActiveRecord::Base
has_many :floors, class_name: 'Locations::Floor', foreign_key: :locations_library_id
include Locations::Labeled
include Locations::Coded

accepts_nested_attributes_for :floors,
reject_if: proc { |attributes| attributes['label'].blank? },
allow_destroy: true
end
end
52 changes: 0 additions & 52 deletions app/uploaders/locations/floorplan_uploader.rb

This file was deleted.

39 changes: 0 additions & 39 deletions app/views/locations/floors/_form.html.erb

This file was deleted.

6 changes: 0 additions & 6 deletions app/views/locations/floors/edit.html.erb

This file was deleted.

29 changes: 0 additions & 29 deletions app/views/locations/floors/index.html.erb

This file was deleted.

5 changes: 0 additions & 5 deletions app/views/locations/floors/new.html.erb

This file was deleted.

27 changes: 0 additions & 27 deletions app/views/locations/floors/show.html.erb

This file was deleted.

30 changes: 0 additions & 30 deletions app/views/locations/libraries/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -12,36 +12,6 @@
<%= f.label :order %><br>
<%= f.text_field :order %>
</div>
<% if params[:action] == 'edit' %>
<div class="floors">
<h2>Floors</h2>
<ul>
<%= f.fields_for :floors do |floor| %>

<li><%= floor.object.label %> <a class="edit-link" href="#">edit</a> |
<%= floor.check_box :_destroy %>
<%= floor.label :_destroy, 'remove' %>

<div class="floor-form" style="display:none">
<div class="field">
<%= floor.label :label %><br>
<%= floor.text_field :label %>
</div>

<div class="form-group form-text-box">
<%= floor.label :floor_plan_image %><br>
<%= image_tag(floor.object.floor_plan_image_url, width: "300") if floor.object.floor_plan_image? %>
<div class="col-sm-10">
<%= floor.file_field :floor_plan_image %>
</div>
</div>
</div>
</li>

<% end %>
</ul>
</div>
<% end %>
<div class="actions">
<%= f.submit %>
</div>
Expand Down
17 changes: 0 additions & 17 deletions app/views/locations/libraries/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,6 @@
<%= @library.order %>
</p>

<p>
<dl>
<dt><strong>Floors:</strong></dt>
<dd>
<% if @library.floors.any? %>
<ul>
<% @library.floors.each do |f| %>
<li><%= f.label %> <%= image_tag(f.floor_plan_image_url, height: '32') if f.floor_plan_image? %></li>
<% end %>
</ul>
<% else %>
No floors specified.
<% end %>
</dd>
</dl>
</p>

<%= link_to 'Edit', edit_library_path(@library) %> |
<%= link_to 'View as JSON', format: :json %> |
<%= link_to 'All Libraries', libraries_path %>
20 changes: 0 additions & 20 deletions config/initializers/locations/floorplan_uploader_initializer.rb

This file was deleted.

4 changes: 1 addition & 3 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
resources :map, only: [:index]
resources :hours_locations, path_names: { new: 'create' }
resources :holding_locations, path_names: { new: 'create' }
resources :libraries, path_names: { new: 'create' } do
resources :floors, path_names: { new: 'create' }
end
resources :libraries, path_names: { new: 'create' }
resources :delivery_locations, path_names: { new: 'create' }
get 'digital_locations', to: 'delivery_locations#digital_locations'
root 'home#index'
Expand Down
Loading