chore: rubocop
chore: fix api test conventions chore: rubocop -A spec/ chore: more rubocop -A fix failing test rubocop fixes removes helper methods that are in my opinion dead code more rubocop fixes rubocop -a --auto-gen-config
This commit is contained in:
parent
f6fb804bbe
commit
fb2b4d8a8a
331 changed files with 4263 additions and 4507 deletions
|
|
@ -20,7 +20,7 @@ RDoc::Task.new(:rdoc) do |rdoc|
|
|||
rdoc.rdoc_files.include('lib/**/*.rb')
|
||||
end
|
||||
|
||||
APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
|
||||
APP_RAKEFILE = File.expand_path('test/dummy/Rakefile', __dir__)
|
||||
load 'rails/tasks/engine.rake'
|
||||
|
||||
Bundler::GemHelper.install_tasks
|
||||
|
|
@ -34,4 +34,4 @@ Rake::TestTask.new(:test) do |t|
|
|||
t.verbose = false
|
||||
end
|
||||
|
||||
task :default => :test
|
||||
task default: :test
|
||||
|
|
|
|||
|
|
@ -37,8 +37,8 @@ class Admin::LinksController < Admin::BaseController
|
|||
link = Link.find(params[:id])
|
||||
link.destroy!
|
||||
redirect_to admin_links_path
|
||||
rescue => error
|
||||
redirect_to admin_links_path, I18n.t('errors.general_msg', msg: error.message)
|
||||
rescue StandardError => e
|
||||
redirect_to admin_links_path, I18n.t('errors.general_msg', msg: e.message)
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
|||
|
|
@ -5,9 +5,7 @@ class LinksController < ApplicationController
|
|||
link = Link.find(params[:id])
|
||||
url = link.url
|
||||
|
||||
if link.workgroup && !current_user.role_admin? && !link.workgroup.member?(current_user)
|
||||
return deny_access
|
||||
end
|
||||
return deny_access if link.workgroup && !current_user.role_admin? && !link.workgroup.member?(current_user)
|
||||
|
||||
if link.indirect
|
||||
uri = URI.parse url
|
||||
|
|
@ -19,11 +17,9 @@ class LinksController < ApplicationController
|
|||
|
||||
url = result.header['Location']
|
||||
|
||||
unless url
|
||||
return redirect_to root_url, alert: t('.indirect_no_location')
|
||||
end
|
||||
return redirect_to root_url, alert: t('.indirect_no_location') unless url
|
||||
end
|
||||
|
||||
redirect_to url, status: 302
|
||||
redirect_to url, status: :found
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,20 +1,21 @@
|
|||
$:.push File.expand_path("../lib", __FILE__)
|
||||
$:.push File.expand_path('lib', __dir__)
|
||||
|
||||
# Maintain your gem's version:
|
||||
require "foodsoft_links/version"
|
||||
require 'foodsoft_links/version'
|
||||
|
||||
# Describe your gem and declare its dependencies:
|
||||
Gem::Specification.new do |s|
|
||||
s.name = "foodsoft_links"
|
||||
s.name = 'foodsoft_links'
|
||||
s.version = FoodsoftLinks::VERSION
|
||||
s.authors = ["paroga"]
|
||||
s.email = ["paroga@paroga.com"]
|
||||
s.homepage = "https://github.com/foodcoops/foodsoft"
|
||||
s.summary = "Links plugin for foodsoft."
|
||||
s.description = "Adds simple link management to foodsoft."
|
||||
s.authors = ['paroga']
|
||||
s.email = ['paroga@paroga.com']
|
||||
s.homepage = 'https://github.com/foodcoops/foodsoft'
|
||||
s.summary = 'Links plugin for foodsoft.'
|
||||
s.description = 'Adds simple link management to foodsoft.'
|
||||
|
||||
s.files = Dir["{app,config,db,lib}/**/*"] + ["Rakefile", "README.md"]
|
||||
s.files = Dir['{app,config,db,lib}/**/*'] + ['Rakefile', 'README.md']
|
||||
|
||||
s.add_dependency "rails"
|
||||
s.add_dependency "deface", "~> 1.0"
|
||||
s.add_dependency 'rails'
|
||||
s.add_dependency 'deface', '~> 1.0'
|
||||
s.metadata['rubygems_mfa_required'] = 'true'
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
module FoodsoftLinks
|
||||
class Engine < ::Rails::Engine
|
||||
def navigation(primary, context)
|
||||
primary.item :links, I18n.t('navigation.links'), '#', if: Proc.new { visble_links(context).any? } do |subnav|
|
||||
primary.item :links, I18n.t('navigation.links'), '#', if: proc { visble_links(context).any? } do |subnav|
|
||||
visble_links(context).each do |link|
|
||||
subnav.item link.id, link.name, context.link_path(link)
|
||||
end
|
||||
|
|
@ -11,15 +11,15 @@ module FoodsoftLinks
|
|||
primary.items.insert(i, primary.items.delete_at(-1))
|
||||
end
|
||||
|
||||
unless primary[:admin].nil?
|
||||
sub_nav = primary[:admin].sub_navigation
|
||||
sub_nav.items <<
|
||||
SimpleNavigation::Item.new(primary, :links, I18n.t('navigation.admin.links'), context.admin_links_path)
|
||||
# move to right before config item
|
||||
if i = sub_nav.items.index(sub_nav[:config])
|
||||
sub_nav.items.insert(i, sub_nav.items.delete_at(-1))
|
||||
end
|
||||
end
|
||||
return if primary[:admin].nil?
|
||||
|
||||
sub_nav = primary[:admin].sub_navigation
|
||||
sub_nav.items <<
|
||||
SimpleNavigation::Item.new(primary, :links, I18n.t('navigation.admin.links'), context.admin_links_path)
|
||||
# move to right before config item
|
||||
return unless i = sub_nav.items.index(sub_nav[:config])
|
||||
|
||||
sub_nav.items.insert(i, sub_nav.items.delete_at(-1))
|
||||
end
|
||||
|
||||
def visble_links(context)
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
module FoodsoftLinks
|
||||
VERSION = "0.0.1"
|
||||
VERSION = '0.0.1'
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue