Skip to content

Commit

Permalink
Merge pull request #116 from jamesvanmil/production_tweaks
Browse files Browse the repository at this point in the history
fix bugs for production environment
  • Loading branch information
Sean Crowe committed Mar 27, 2015
2 parents 9216de8 + 36d95c8 commit b4ba532
Show file tree
Hide file tree
Showing 12 changed files with 15 additions and 15 deletions.
8 changes: 4 additions & 4 deletions app/controllers/marc_uploads_controller.rb
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
class MarcUploadsController < ApplicationController
before_filter :authenticate_user!
def create
redirect_to '/marc_uploads' and flash[:notice] = 'Include file!' and return if params[:upload].nil?
redirect_to marc_uploads_path and flash[:notice] = 'Include file!' and return if params[:upload].nil?
name = params[:upload][:file].original_filename
redirect_to '/marc_uploads' and flash[:notice] = 'Input only .xlsx format files!' and return if File.extname(name) != '.xlsx'
redirect_to marc_uploads_path and flash[:notice] = 'Input only .xlsx format files!' and return if File.extname(name) != '.xlsx'
directory = "public/tmp/records"
@path = File.join(directory, name)

File.open(@path, "wb") { |f| f.write(params[:upload][:file].read) }
s = Roo::Excelx.new(@path)
redirect_to '/marc_uploads' and flash[:notice] = 'Columns must be in order: Label, Catalog, Title, UPC, Format, Invoice, Price' and return if s.row(1) != ['Label', 'Catalog', 'Title', 'UPC', 'Format', 'Invoice', 'Price']
redirect_to marc_uploads_path and flash[:notice] = 'Columns must be in order: Label, Catalog, Title, UPC, Format, Invoice, Price' and return if s.row(1) != ['Label', 'Catalog', 'Title', 'UPC', 'Format', 'Invoice', 'Price']

writer = MARC::Writer.new("#{directory}/#{name.gsub('xlsx', 'mrc')}")
s.drop(1).each do |row|
Expand All @@ -25,6 +25,6 @@ def create
end
writer.close()
flash[:notice] = "Records Processed"
redirect_to "/marc_downloads"
redirect_to marc_downloads_path
end
end
2 changes: 1 addition & 1 deletion app/mailers/order_mailer.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class OrderMailer < ActionMailer::Base
default from: "NO-REPLY@larry.libraries.uc.edu"
default from: "NO-REPLY@lucy.libraries.uc.edu"

def new_order(user, order)
@user = user
Expand Down
2 changes: 1 addition & 1 deletion app/views/marc_downloads/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<table class='table table-striped'>
<% Dir["public/tmp/records/*.*"].each do |file| %>
<tr>
<td><%= link_to file[/[A-Za-z0-9_\.]*$/], file.gsub('public', '') %></td>
<td><%= link_to File.basename(file), "#{root_url}tmp/records/#{File.basename(file)}" %></td>
</tr>
<% end %>
</table>
Expand Down
2 changes: 1 addition & 1 deletion app/views/marc_uploads/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<p class="lead">Upload Arkive invoices in *.xlsx format</p>

<div class="hero-unit">
<%= form_tag '/marc_uploads/create', { :multipart => true } do %>
<%= form_tag marc_uploads_create_path, { :multipart => true } do %>
<p>

<%= bootstrap_flash %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/order_mailer/new_order.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@
</tr>
</table>
</p>
<p><%= link_to orders_path(@order), orders_path(@order) %></p>
<p><%= link_to order_url(@order), order_url(@order) %></p>
</body>
</html>
2 changes: 1 addition & 1 deletion app/views/orders/_show_admin_actions.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</a>
<ul class="dropdown-menu">
<% @order.current_state.events.keys.each do |i| %>
<li> <%= link_to model_class.human_attribute_name(i), "/orders/#{@order.id}/#{i}", method: :put, data: {confirm: 'Are you sure?'}
<li> <%= link_to model_class.human_attribute_name(i), "#{root_url}orders/#{@order.id}/#{i}", method: :put, data: {confirm: 'Are you sure?'}
%> </li>
<% end %>
</ul>
Expand Down
2 changes: 1 addition & 1 deletion config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

module SelectorReporting
class Application < Rails::Application
config.action_mailer.default_url_options = { host: 'example.com' }
config.action_mailer.default_url_options = { host: 'lucy.libraries.uc.edu' }
config.autoload_paths += %W(#{config.root}/app/models/users)
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
Expand Down
1 change: 0 additions & 1 deletion config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
config.cache_classes = false

# Do not eager load code on boot.
config.eager_load = false

Expand Down
1 change: 1 addition & 0 deletions config/environments/production.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
SelectorReporting::Application.configure do
# Settings specified here will take precedence over those in config/application.rb.


# Code is not reloaded between requests.
config.cache_classes = true

Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20140328162816_create_losts.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ def change
create_table :losts do |t|
t.integer :item_number
t.integer :bib_number
t.string :title
t.text :title
t.string :imprint
t.string :isbn
t.string :status
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20150122191758_create_dda_expenditures.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class CreateDdaExpenditures < ActiveRecord::Migration
def change
create_table :dda_expenditures do |t|
t.string :title
t.text :title
t.integer :paid
t.string :fund
t.text :paid_date
Expand Down
4 changes: 2 additions & 2 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
ActiveRecord::Schema.define(version: 20150314191530) do

create_table "dda_expenditures", force: true do |t|
t.string "title"
t.text "title"
t.decimal "paid", precision: 2, scale: 0
t.string "fund"
t.text "paid_date"
Expand All @@ -25,7 +25,7 @@
create_table "losts", force: true do |t|
t.integer "item_number"
t.integer "bib_number"
t.string "title"
t.text "title"
t.string "imprint"
t.string "isbn"
t.string "status"
Expand Down

0 comments on commit b4ba532

Please sign in to comment.