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

Commit

Permalink
link to holding location and sort based on code
Browse files Browse the repository at this point in the history
  • Loading branch information
tampakis committed Dec 16, 2015
1 parent ab14d3d commit e8e351d
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
log/*.log
pkg/
Gemfile.lock
spec/internal/
.internal_test_app/

# Ignore coverage
coverage/
21 changes: 16 additions & 5 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,28 @@ source 'https://rubygems.org'
# development dependencies will be added by default to the :development group.
gemspec

file = File.expand_path("Gemfile", ENV['ENGINE_CART_DESTINATION'] || ENV['RAILS_ROOT'] || File.expand_path("../spec/internal", __FILE__))
if File.exists?(file)
puts "Loading #{file} ..." if $DEBUG # `ruby -d` or `bundle -v`
instance_eval File.read(file)
# BEGIN ENGINE_CART BLOCK
# engine_cart: 0.8.0
# engine_cart stanza: 0.8.0
# the below comes from engine_cart, a gem used to test this Rails engine gem in the context of a Rails app.
file = File.expand_path("Gemfile", ENV['ENGINE_CART_DESTINATION'] || ENV['RAILS_ROOT'] || File.expand_path(".internal_test_app", File.dirname(__FILE__)))
if File.exist?(file)
begin
eval_gemfile file
rescue Bundler::GemfileError => e
Bundler.ui.warn '[EngineCart] Skipping Rails application dependencies:'
Bundler.ui.warn e.message
end
else
Bundler.ui.warn "[EngineCart] Unable to find test application dependencies in #{file}, using placeholder dependencies"

gem 'rails', ENV['RAILS_VERSION'] if ENV['RAILS_VERSION']

if ENV['RAILS_VERSION'] and ENV['RAILS_VERSION'] =~ /^4.2/
if ENV['RAILS_VERSION'].nil? || ENV['RAILS_VERSION'] =~ /^4.2/
gem 'responders', "~> 2.0"
gem 'sass-rails', ">= 5.0"
else
gem 'sass-rails', "< 5.0"
end
end
# END ENGINE_CART BLOCK
2 changes: 1 addition & 1 deletion app/controllers/locations/holding_locations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class HoldingLocationsController < ApplicationController

# GET /holding_locations
def index
@holding_locations = HoldingLocation.all
@holding_locations = HoldingLocation.order(code: :asc)
end

# GET /holding_locations/1
Expand Down
6 changes: 3 additions & 3 deletions app/views/locations/holding_locations/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<table class="table">
<thead>
<tr>
<th>Label</th>
<th>Code</th>
<th>Label</th>
<th>Library</th>
<th>Hours Location</th>
<th>Aeon Location</th>
Expand All @@ -19,8 +19,8 @@
<tbody>
<% @holding_locations.each do |holding_location| %>
<tr>
<td><%= link_to holding_location.label, holding_location %></td>
<td><%= holding_location.code %></td>
<td><%= link_to holding_location.code, holding_location %></td>
<td><%= holding_location.label %></td>
<td><%= link_to holding_location.library.code, holding_location.library %></td>
<td><%= hours_render holding_location %></td>
<td><%= holding_location.aeon_location %></td>
Expand Down
2 changes: 1 addition & 1 deletion lib/locations/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Locations
VERSION = "0.1.1"
VERSION = "0.1.2"
end
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
scenario 'Link to holding location from holding location label rather than extra show link' do
holding_location
visit holding_locations_path
click_link holding_location.label
click_link holding_location.code
end

scenario 'Link to delivery location from delivery location label rather than extra show link' do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module Locations
it "/holding_locations looks as we'd expect" do
2.times { FactoryGirl.create(:holding_location) }
expected = []
HoldingLocation.all.each do |holding_location|
HoldingLocation.order(code: :asc).each do |holding_location|
attrs = {
label: holding_location.label,
code: holding_location.code,
Expand Down
2 changes: 1 addition & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ENV['RAILS_ENV'] ||= 'test'

require File.expand_path('../../spec/internal/config/environment', __FILE__)
require File.expand_path('../../.internal_test_app/config/environment', __FILE__)
require 'factory_girl_rails'
require 'rspec/rails'
require 'engine_cart'
Expand Down

0 comments on commit e8e351d

Please sign in to comment.