Commit 6860896b authored by Alexandru Lupu - Tremend's avatar Alexandru Lupu - Tremend
Browse files

[DIFE-1733] Decidim upgrade

Merge branch 'maintenance/decidim-version' into 'master'

See merge request future-of-europe/digit-cofe-libraries/digit-cofe-media-gallery!8
parents 658af075 025289db
Pipeline #232571 passed with stage
in 2 minutes and 35 seconds
variables:
POSTGRES_DB: decidim_test
POSTGRES_USER: test_user
POSTGRES_PASSWORD: test_user_password
POSTGRES_HOST_AUTH_METHOD: trust
DATABASE_URL: "postgres://test_user@postgres:5432/decidim_test"
DATABASE_USERNAME: test_user
DATABASE_PASSWORD: test_user_password
DATABASE_HOST: postgres
SIMPLECOV: "true"
RUBYOPT: '-W:no-deprecated'
RAILS_ENV: test
stages:
- build
rubocop:
stage: build
image: circleci/ruby:2.7.1-node-browsers
script:
- bundle install --jobs 4 --retry 3
- bundle exec rubocop -P app config lib
rubycritic:
stage: build
image: circleci/ruby:2.7.1-node-browsers
script:
- gem install rubycritic
- rubycritic --no-browser app config lib
inherit_from:
- .rubocop_ruby.yml
- .rubocop_rails.yml
\ No newline at end of file
require: rubocop-rails
Rails:
Enabled: true
Rails/ActionFilter:
Include:
- app/controllers/**/*.rb
Rails/ContentTag:
Enabled: false
Rails/CreateTableWithTimestamps:
Enabled: false
Rails/EnumUniqueness:
Include:
- app/models/**/*.rb
Rails/Exit:
Include:
- app/**/*.rb
- config/**/*.rb
- lib/**/*.rb
Exclude:
- lib/**/*.rake
Rails/FindBy:
Include:
- "**/*.rb"
Rails/FindEach:
Include:
- app/models/**/*.rb
Rails/HasAndBelongsToMany:
Include:
- app/models/**/*.rb
Rails/HasManyOrHasOneDependent:
Include:
- app/models/**/*.rb
Rails/InverseOf:
Enabled: false
Rails/LexicallyScopedActionFilter:
Include:
- app/controllers/**/*.rb
Rails/NotNullColumn:
Enabled: false
Rails/Output:
Include:
- app/**/*.rb
- config/**/*.rb
- db/**/*.rb
- lib/**/*.rb
Rails/OutputSafety:
Enabled: false
Rails/Pluck:
Enabled: false
Rails/RakeEnvironment:
Enabled: false
Rails/ReadWriteAttribute:
Include:
- app/models/**/*.rb
Rails/ReversibleMigration:
Enabled: false
Rails/ScopeArgs:
Include:
- app/models/**/*.rb
Rails/SkipsModelValidations:
Enabled: true
Rails/Validation:
Include:
- app/models/**/*.rb
This diff is collapsed.
# frozen_string_literal: true
source "https://rubygems.org"
ruby RUBY_VERSION
DECIDIM_VERSION = { git: "https://github.com/tremend-cofe/decidim", branch: "fix-foe" }.freeze
gem "decidim", DECIDIM_VERSION
gem "decidim-admin", DECIDIM_VERSION
gem "decidim-core", DECIDIM_VERSION
gem "bootsnap", "~> 1.3"
gem "decidim-gallery", path: "."
group :development, :test do
gem "decidim-dev", DECIDIM_VERSION
gem "rubocop-performance"
gem "simplecov", require: false
end
group :development do
gem "faker", "~> 2.18"
gem "letter_opener_web", "~> 1.4"
gem "listen", "~> 3.1"
gem "spring", "~> 2.0"
gem "spring-watcher-listen", "~> 2.0"
gem "web-console", "~> 4.0"
end
group :test do
gem "rubocop-faker"
end
\ No newline at end of file
This diff is collapsed.
......@@ -12,7 +12,7 @@ module Decidim
end
def public_name_key
return I18n.t(model.public_name_key) unless model.public_name_key.respond_to? :call
return I18n.t(model.public_name_key) unless model.public_name_key.respond_to? :call
model.public_name_key.call(model)
end
......
......@@ -14,18 +14,23 @@ module Decidim
end
def list_items
return "" if gallery_component.settings.gallery_type == "video"
return "" if gallery_component.settings.gallery_type == "video"
render "#{gallery_component.settings.gallery_type}_list"
end
def items
@items ||= Decidim::Gallery::GalleryItem.published.where(decidim_component_id: gallery_component.id).order(weight: :desc, published_at: :desc).page(options[:page]).per(per_page)
@items ||= Decidim::Gallery::GalleryItem
.published
.where(decidim_component_id: gallery_component.id)
.order(weight: :desc, published_at: :desc)
.page(options[:page])
.per(per_page)
end
def gallery_path(**options)
current_params = try(:params) || {}
EngineRouter.main_proxy(gallery_component).root_path({locale: current_params[:locale]}.reverse_merge(options))
EngineRouter.main_proxy(gallery_component).root_path({ locale: current_params[:locale] }.reverse_merge(options))
end
def stubbed_video_object(item)
......@@ -41,7 +46,7 @@ module Decidim
end
def gallery_component
@gallery ||= Decidim::Component.where(id: model.gallery_id).first
@gallery_component ||= Decidim::Component.find_by(id: model.gallery_id)
end
def browser
......@@ -60,8 +65,6 @@ module Decidim
def per_page
model.per_page.to_i
end
end
end
end
......@@ -3,18 +3,17 @@
module Decidim
module Gallery
class MainContainerCell < Decidim::ViewModel
delegate :settings, to: :model
def title
translated_attribute(settings.title)
end
def gallery1_settings
OpenStruct.new(id: model.id, css: settings.css, section: :gallery1, gallery_id: settings.gallery1_id, per_page: settings.gallery1_per_page )
OpenStruct.new(id: model.id, css: settings.css, section: :gallery1, gallery_id: settings.gallery1_id, per_page: settings.gallery1_per_page)
end
def gallery0_settings
OpenStruct.new(id: model.id, css: settings.css, section: :gallery0, gallery_id: settings.gallery0_id, per_page: settings.gallery0_per_page )
OpenStruct.new(id: model.id, css: settings.css, section: :gallery0, gallery_id: settings.gallery0_id, per_page: settings.gallery0_per_page)
end
end
end
......
......@@ -3,7 +3,6 @@
module Decidim
module Gallery
class PageMainContainerSettingsFormCell < MainContainerSettingsFormCell
end
end
end
......@@ -20,7 +20,9 @@ module Decidim
broadcast(:ok, @gallery_item)
end
private
attr_reader :form
def create_gallery_item!
......
......@@ -4,7 +4,6 @@ module Decidim
module Gallery
module Admin
class PublishGalleryItem < Rectify::Command
def initialize(gallery_item, current_user)
@gallery_item = gallery_item
@current_user = current_user
......@@ -21,6 +20,7 @@ module Decidim
end
private
def publish_gallery_item!
@gallery_item = Decidim.traceability.perform_action!(
:publish,
......@@ -33,7 +33,6 @@ module Decidim
end
end
end
end
end
end
......@@ -4,7 +4,6 @@ module Decidim
module Gallery
module Admin
class UnpublishGalleryItem < Rectify::Command
def initialize(gallery_item, current_user)
@gallery_item = gallery_item
@current_user = current_user
......@@ -21,6 +20,7 @@ module Decidim
end
private
def unpublish_gallery_item!
@gallery_item = Decidim.traceability.perform_action!(
:unpublish,
......
......@@ -22,6 +22,7 @@ module Decidim
end
private
attr_reader :form
def update_gallery_item!
......
......@@ -4,8 +4,6 @@ module Decidim
module Gallery
module GalleryAdmin
class ReorderContentBlocks < Rectify::Command
# Public: Initializes the command.
#
# organization - the Organization where the content blocks reside
......
......@@ -7,8 +7,8 @@ module Decidim
extend ActiveSupport::Concern
included do
protected
def blog_components
current_participatory_space.components.where(manifest_name: "blogs")
end
......@@ -25,16 +25,16 @@ module Decidim
end
def permission_class_chain
[ Decidim::ContentBlocks::Admin::Permissions ] # + super
[Decidim::ContentBlocks::Admin::Permissions] # + super
end
def current_settings; end
def component_settings; end
def content_block_scope
:gallery_blog
end
end
end
end
......
......@@ -8,7 +8,7 @@ module Decidim
included do
def permission_class_chain
[ Decidim::ContentBlocks::Admin::Permissions ] # + super
[Decidim::ContentBlocks::Admin::Permissions] # + super
end
def pages
......@@ -29,7 +29,6 @@ module Decidim
def content_block_scope
:gallery_page
end
end
end
end
......
......@@ -4,7 +4,6 @@ module Decidim
module Gallery
module Admin
class GalleryItemController < ::Decidim::Gallery::Admin::ApplicationController
# def index
# enforce_permission_to :create, :gallery
#
......@@ -95,8 +94,8 @@ module Decidim
end
end
private
def fetch_form
current_component.settings["gallery_type"] == "image" ? GalleryItemImageForm : GalleryItemVideoForm
end
......
......@@ -3,7 +3,7 @@
module Decidim
module Gallery
module GalleryAdmin
class ContentBlocksController < Decidim::ContentBlocks::Admin::ApplicationController
class ContentBlocksController < Decidim::ContentBlocks::Admin::ApplicationController
include Decidim::Assemblies::Admin::Concerns::AssemblyAdmin
include Decidim::Gallery::GalleryAdmin::ContentBlock
......
......@@ -50,6 +50,7 @@ module Decidim
def unused_manifests
return [] if content_blocks.size == blog_components.size
@unused_manifests = []
blog_components.find_each do |component|
@unused_manifests.push content_blocks.where(scoped_resource_id: component.id).first_or_create!
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment