From 31c428a41334b009adaf1597443d8ec76a19edd7 Mon Sep 17 00:00:00 2001 From: Nicolas Bally Date: Sat, 15 May 2021 18:35:05 +0200 Subject: [PATCH] suite --- Gemfile | 10 ++++++--- Gemfile.lock | 29 ++++++++++--------------- app/assets/javascripts/public.js.coffee | 2 +- app/models/article.rb | 2 +- app/models/block.rb | 2 +- app/models/comment.rb | 2 +- app/models/gallery_content.rb | 2 +- app/models/newsletter.rb | 2 +- app/models/portfolio.rb | 2 +- app/models/table_content.rb | 2 +- app/models/table_row.rb | 2 +- app/views/layouts/public.html.haml | 3 +-- config/database.yml | 10 +++++---- 13 files changed, 34 insertions(+), 36 deletions(-) diff --git a/Gemfile b/Gemfile index 7e7d597..20729a6 100644 --- a/Gemfile +++ b/Gemfile @@ -6,9 +6,10 @@ gem 'rails', '4.2.10' gem 'bcrypt-ruby', '~> 3.0.0' # Use sqlite3 as the database for Active Record -gem 'sqlite3' + gem "mysql2", "0.4.10" +gem "sprockets-rails", "2.3.3" # Use Uglifier as compressor for JavaScript assets gem 'uglifier', '>= 1.3.0' @@ -18,6 +19,9 @@ gem 'coffee-rails', '~> 4.0.0' # See https://github.com/sstephenson/execjs#readme for more supported runtimes # gem 'therubyracer', platforms: :ruby +gem 'multi_json', '~> 1.11', '>= 1.11.2' + + # Use jquery as the JavaScript library gem 'jquery-rails' @@ -37,7 +41,7 @@ gem 'nokogiri' gem 'acts_as_tree' gem 'formtastic' - +gem "kaminari", "0.16.3" gem 'kaminari-bootstrap' @@ -55,7 +59,7 @@ gem 'unicorn' gem "nokogiri" -gem 'kaminari-bootstrap' + gem 'acts_as_commentable' diff --git a/Gemfile.lock b/Gemfile.lock index 5060515..d4f1f39 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -85,21 +85,12 @@ GEM rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) - kaminari (1.2.1) - activesupport (>= 4.1.0) - kaminari-actionview (= 1.2.1) - kaminari-activerecord (= 1.2.1) - kaminari-core (= 1.2.1) - kaminari-actionview (1.2.1) - actionview - kaminari-core (= 1.2.1) - kaminari-activerecord (1.2.1) - activerecord - kaminari-core (= 1.2.1) + kaminari (0.16.3) + actionpack (>= 3.0.0) + activesupport (>= 3.0.0) kaminari-bootstrap (3.0.1) kaminari (>= 0.13.0) rails - kaminari-core (1.2.1) kgio (2.11.3) less (2.6.0) commonjs (~> 0.2.7) @@ -119,6 +110,7 @@ GEM mini_mime (1.1.0) mini_portile2 (2.4.0) minitest (5.14.4) + multi_json (1.15.0) mysql2 (0.4.10) nokogiri (1.10.10) mini_portile2 (~> 2.4.0) @@ -162,11 +154,10 @@ GEM sprockets (3.7.2) concurrent-ruby (~> 1.0) rack (> 1, < 3) - sprockets-rails (3.2.2) - actionpack (>= 4.0) - activesupport (>= 4.0) - sprockets (>= 3.0.0) - sqlite3 (1.4.2) + sprockets-rails (2.3.3) + actionpack (>= 3.0) + activesupport (>= 3.0) + sprockets (>= 2.8, < 4.0) ssrf_filter (1.0.7) temple (0.8.2) therubyracer (0.12.3) @@ -205,14 +196,16 @@ DEPENDENCIES htmlentities jbuilder (~> 1.0.1) jquery-rails + kaminari (= 0.16.3) kaminari-bootstrap less-rails + multi_json (~> 1.11, >= 1.11.2) mysql2 (= 0.4.10) nokogiri rails (= 4.2.10) rmagick sdoc - sqlite3 + sprockets-rails (= 2.3.3) therubyracer turbolinks twitter-bootstrap-rails diff --git a/app/assets/javascripts/public.js.coffee b/app/assets/javascripts/public.js.coffee index c2c68a0..8507e29 100644 --- a/app/assets/javascripts/public.js.coffee +++ b/app/assets/javascripts/public.js.coffee @@ -1,5 +1,5 @@ -#= require ./shared/jquery +#= require jquery #= require ./shared/jquery-ui #= require jquery_ujs #= require ./shared/jquery.strings.js diff --git a/app/models/article.rb b/app/models/article.rb index 7a146dd..c07c86f 100644 --- a/app/models/article.rb +++ b/app/models/article.rb @@ -8,7 +8,7 @@ class Article < ActiveRecord::Base has_one :block, :as => :blockable belongs_to :category - has_many :enabled_comments,:conditions => {:enabled => true}, :source => :comments, :as => :commentable + has_many :enabled_comments, -> {where(:enabled => true)}, :source => :comments, :as => :commentable after_create :after_creation diff --git a/app/models/block.rb b/app/models/block.rb index 1accc54..ded9c59 100644 --- a/app/models/block.rb +++ b/app/models/block.rb @@ -19,7 +19,7 @@ class Block < ActiveRecord::Base belongs_to :blockable, :polymorphic => true - has_many :portlets, :order => :position, :dependent => :destroy + has_many :portlets, -> {order(:position)}, :dependent => :destroy accepts_nested_attributes_for :portlets diff --git a/app/models/comment.rb b/app/models/comment.rb index c6c8ad3..f98402c 100644 --- a/app/models/comment.rb +++ b/app/models/comment.rb @@ -8,7 +8,7 @@ class Comment < ActiveRecord::Base validates :pseudo, :presence => true validates :comment, :presence => true - scope :recents, where("enabled = ?",true ).order("created_at ASC") + scope :recents, -> {where("enabled = ?",true ).order("created_at ASC")} diff --git a/app/models/gallery_content.rb b/app/models/gallery_content.rb index 480a977..d428d66 100644 --- a/app/models/gallery_content.rb +++ b/app/models/gallery_content.rb @@ -1,6 +1,6 @@ # -*- encoding : utf-8 -*- class GalleryContent < ActiveRecord::Base - has_many :gallery_images, :order => :position + has_many :gallery_images,-> {order(:position)} has_one :portlet, :as => :content, :dependent => :destroy diff --git a/app/models/newsletter.rb b/app/models/newsletter.rb index 1a21aaa..33d9c49 100644 --- a/app/models/newsletter.rb +++ b/app/models/newsletter.rb @@ -35,7 +35,7 @@ class Newsletter < ActiveRecord::Base end - scope :recents, where("enabled = ?",true ).order("published_at DESC") + scope :recents, -> { where("enabled = ?",true ).order("published_at DESC") } scope :between, lambda { |start, stop| after(start).before(stop) diff --git a/app/models/portfolio.rb b/app/models/portfolio.rb index c09b258..5dc8393 100644 --- a/app/models/portfolio.rb +++ b/app/models/portfolio.rb @@ -1,6 +1,6 @@ class Portfolio < ActiveRecord::Base belongs_to :artwork - has_many :artworks, :order => "position", :dependent => :destroy + has_many :artworks, -> {order(:position)}, :dependent => :destroy before_validation do self.slug = self.title.to_slug diff --git a/app/models/table_content.rb b/app/models/table_content.rb index 439ea9e..9f4693c 100644 --- a/app/models/table_content.rb +++ b/app/models/table_content.rb @@ -1,7 +1,7 @@ # -*- encoding : utf-8 -*- class TableContent < ActiveRecord::Base has_one :portlet, :as => :content, :dependent => :destroy - has_many :table_rows, :include => :cel_tables, :order => :position + has_many :table_rows, -> {order(:position)} has_many :cel_tables, :through => :table_rows STYLES = [["avec bordures",1],["sans bordures",2]] diff --git a/app/models/table_row.rb b/app/models/table_row.rb index 5f3dd5c..afcf683 100644 --- a/app/models/table_row.rb +++ b/app/models/table_row.rb @@ -1,6 +1,6 @@ # -*- encoding : utf-8 -*- class TableRow < ActiveRecord::Base - has_many :cel_tables, :order => :position + has_many :cel_tables, -> {order(:position)} belongs_to :table_content attr_accessor :skip_before_update diff --git a/app/views/layouts/public.html.haml b/app/views/layouts/public.html.haml index 962091a..ff43a5b 100644 --- a/app/views/layouts/public.html.haml +++ b/app/views/layouts/public.html.haml @@ -76,9 +76,8 @@ %br %br %br - - =image_tag "smiley.png", :style => "width:20px;" + %br diff --git a/config/database.yml b/config/database.yml index 5765280..1505e81 100644 --- a/config/database.yml +++ b/config/database.yml @@ -4,10 +4,12 @@ # Ensure the SQLite 3 gem is defined in your Gemfile # gem 'sqlite3' development: - adapter: sqlite3 - database: db/development.sqlite3 + adapter: mysql2 + encoding: utf8mb4 + database: vivre_app pool: 5 - timeout: 5000 + username: root + host: 127.0.0.1 # Warning: The database defined as "test" will be erased and # re-generated from your development database when you run "rake". @@ -23,7 +25,7 @@ production: encoding: utf8mb4 database: vivre_app pool: 5 - username: vivre_app + username: vivre_app password: vivre_app socket: /var/run/mysqld/mysqld.sock