Skip to content
This repository was archived by the owner on Sep 24, 2025. It is now read-only.
Closed
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: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
para (1.1.0)
para (1.1.1)
active_decorator (~> 0.9)
activejob-status
bootstrap-sass (~> 3.3.0)
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/para/admin/resources_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def edit
end

def update
if resource.update_attributes(resource_params)
if resource.update(resource_params)
flash_message(:success, resource)
redirect_to after_form_submit_path
else
Expand Down
6 changes: 3 additions & 3 deletions app/helpers/para/admin/base_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ def find_partial_for(relation, partial, partial_dir: 'admin/resources')
end

def find_relation_name_for(relation, partial, options = {})
return relation if partial_exists?(relation, partial, options)
return relation if partial_exists?(relation: relation, partial: partial, **options)
return nil unless options[:relation_class]

relation = options[:relation_class].ancestors.find do |ancestor|
next unless model?(ancestor)
break if ancestor == ActiveRecord::Base

ancestor_name = plural_file_path_for(ancestor.name)
partial_exists?(ancestor_name, partial, options)
partial_exists?(relation: ancestor_name, partial: partial, **options)
end

plural_file_path_for(relation) if relation
Expand Down Expand Up @@ -88,7 +88,7 @@ def model?(object)
object.respond_to?(:model_name)
end

def partial_exists?(relation, partial, overrides_root: 'admin', **options)
def partial_exists?(relation:, partial:, overrides_root: 'admin', **options)
partial_path = partial.to_s.split('/')
partial_path[-1] = "_#{ partial_path.last }"
lookup_context.find_all("#{ overrides_root }/#{relation}/#{ partial_path.join('/') }").any?
Expand Down
2 changes: 1 addition & 1 deletion app/views/para/admin/main/index.html.haml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
= render file: template_path_lookup('admin/dashboard', 'para/admin/dashboard')
= render template: template_path_lookup('admin/dashboard', 'para/admin/dashboard')
10 changes: 5 additions & 5 deletions lib/generators/para/exporter/exporter_generator.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module Para
class ExporterGenerator < Rails::Generators::NamedBase
source_root File.expand_path('../templates', __FILE__)
source_root File.expand_path('templates', __dir__)

argument :formats, type: :array

Expand All @@ -13,8 +13,8 @@ def copy_resource_exporter
@format = format

template(
"#{ base_exporter_template_name_for(format) }_exporter.rb",
"app/exporters/#{ exporter_name }.rb"
"#{base_exporter_template_name_for(format)}_exporter.rb",
"app/exporters/#{exporter_name}.rb"
)
end
end
Expand All @@ -30,9 +30,9 @@ def exporter_name
end

def base_exporter_template_name_for(format)
format_specific_template = "../templates/#{ format }_exporter.rb"
format_specific_template = "../templates/#{format}_exporter.rb"

if File.exists?(File.expand_path(format_specific_template, __FILE__))
if File.exist?(File.expand_path(format_specific_template, __FILE__))
format
else
'base'
Expand Down
2 changes: 1 addition & 1 deletion lib/para/components_configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def components_installed?
#
def eager_load_components!
$LOAD_PATH.each do |path|
next unless path.match(/\/components$/)
next unless path.to_s.match(%r{/components})

glob = File.join(path, '**', '*_component.rb')

Expand Down
26 changes: 13 additions & 13 deletions lib/para/postgres_extensions_checker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,27 @@ module Para
class PostgresExtensionsChecker
class << self
def check_all
%w(hstore unaccent).each do |extname|
unless extension_exists?(extname)
# Could not use Rails.logger here, using puts as a temporary
# solution.
puts "[Warning] PostgreSQL \"#{ extname }\" extension is not " +
"installed in your database. This means that you " +
"missing some migrations that you can install " +
"with the following command : " +
"`rake para_engine:install:migrations` and then migrate."
end
%w[hstore unaccent].each do |extname|
next if extension_exists?(extname)

# Could not use Rails.logger here, using puts as a temporary
# solution.
puts "[Warning] PostgreSQL \"#{extname}\" extension is not " +
'installed in your database. This means that you ' +
'missing some migrations that you can install ' +
'with the following command : ' +
'`rake para_engine:install:migrations` and then migrate.'
end
end

private

def extension_exists?(extname)
ActiveRecord::Base.connection.execute(
"SELECT COUNT(*) FROM pg_catalog.pg_extension " +
"WHERE extname = '#{ extname }'"
'SELECT COUNT(*) FROM pg_catalog.pg_extension ' +
"WHERE extname = '#{extname}'"
).first['count'].to_i > 0
rescue ActiveRecord::NoDatabaseError
rescue ActiveRecord::NoDatabaseError, NoMethodError
true # Do not issue warning when no database is installed
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/para/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module Para
VERSION = '1.1.1'
VERSION = '1.2.0'
end
6 changes: 3 additions & 3 deletions para.gemspec
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$:.push File.expand_path('../lib', __FILE__)
$:.push File.expand_path('lib', __dir__)

# Maintain your gem's version:
require 'para/version'
Expand All @@ -20,7 +20,7 @@ Gem::Specification.new do |s|
s.add_dependency 'activejob-status'
s.add_dependency 'bootstrap-sass', '~> 3.3.0'
s.add_dependency 'cancancan'
s.add_dependency 'closure_tree', '~> 6.2'
s.add_dependency 'closure_tree'
s.add_dependency 'cocoon'
s.add_dependency 'coffee-rails'
s.add_dependency 'deep_cloneable', '~> 3.2.0'
Expand All @@ -33,7 +33,7 @@ Gem::Specification.new do |s|
s.add_dependency 'kaminari'
s.add_dependency 'paperclip', '~> 6.0'
s.add_dependency 'pg'
s.add_dependency 'rails', '>= 4.0', '<= 6.0.6.1'
s.add_dependency 'rails', '>= 4.0', '< 7.1'
s.add_dependency 'rails-i18n'
s.add_dependency 'ransack'
s.add_dependency 'request_store'
Expand Down