Run rubocop --fix-layout and remove encoding comments
This commit is contained in:
parent
fa63e6e81d
commit
ea2862fdef
283 changed files with 1164 additions and 1969 deletions
|
|
@ -23,8 +23,6 @@ end
|
|||
APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
|
||||
load 'rails/tasks/engine.rake'
|
||||
|
||||
|
||||
|
||||
Bundler::GemHelper.install_tasks
|
||||
|
||||
require 'rake/testtask'
|
||||
|
|
@ -36,5 +34,4 @@ Rake::TestTask.new(:test) do |t|
|
|||
t.verbose = false
|
||||
end
|
||||
|
||||
|
||||
task :default => :test
|
||||
|
|
|
|||
|
|
@ -6,10 +6,10 @@ class DocumentsController < ApplicationController
|
|||
def index
|
||||
if params["sort"]
|
||||
sort = case params["sort"]
|
||||
when "name" then "data IS NULL DESC, name"
|
||||
when "created_at" then "created_at"
|
||||
when "name_reverse" then "data IS NULL, name DESC"
|
||||
when "created_at_reverse" then "created_at DESC"
|
||||
when "name" then "data IS NULL DESC, name"
|
||||
when "created_at" then "created_at"
|
||||
when "name_reverse" then "data IS NULL, name DESC"
|
||||
when "created_at_reverse" then "created_at DESC"
|
||||
end
|
||||
else
|
||||
sort = "data IS NULL DESC, name"
|
||||
|
|
@ -31,6 +31,7 @@ class DocumentsController < ApplicationController
|
|||
@document.data = data.read
|
||||
@document.mime = FileMagic.new(FileMagic::MAGIC_MIME).buffer(@document.data)
|
||||
raise t('.not_allowed_mime', mime: @document.mime) unless allowed_mime? @document.mime
|
||||
|
||||
if @document.name.empty?
|
||||
name = File.basename(data.original_filename)
|
||||
@document.name = name.gsub(/[^\w\.\-]/, '_')
|
||||
|
|
|
|||
|
|
@ -27,5 +27,4 @@ class Document < ApplicationRecord
|
|||
|
||||
"#{name}.#{types.first.preferred_extension}"
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,13 +1,9 @@
|
|||
Rails.application.routes.draw do
|
||||
|
||||
scope '/:foodcoop' do
|
||||
|
||||
resources :documents do
|
||||
get :move
|
||||
get :new
|
||||
get :new_folder
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ module FoodsoftDocuments
|
|||
def navigation(primary, context)
|
||||
return unless FoodsoftDocuments.enabled?
|
||||
return if primary[:foodcoop].nil?
|
||||
|
||||
sub_nav = primary[:foodcoop].sub_navigation
|
||||
sub_nav.items <<
|
||||
SimpleNavigation::Item.new(primary, :documents, I18n.t('navigation.documents'), context.documents_path)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue