From 9be44b3fa9985b8a93160434ce9f6dc922ec4387 Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Sun, 17 Dec 2017 11:36:55 +0100 Subject: New extension GalleryLinks --- Gemfile | 1 + vendor/extensions/gallery_links/Gemfile | 38 ++++++++ vendor/extensions/gallery_links/Rakefile | 20 ++++ .../admin/gallery_links_controller.rb | 12 +++ .../gallery_links/gallery_links_controller.rb | 34 +++++++ .../models/refinery/gallery_links/gallery_link.rb | 11 +++ .../admin/gallery_links/_actions.html.erb | 25 +++++ .../admin/gallery_links/_form.html.erb | 45 +++++++++ .../admin/gallery_links/_gallery_link.html.erb | 20 ++++ .../admin/gallery_links/_gallery_links.html.erb | 2 + .../admin/gallery_links/_records.html.erb | 16 ++++ .../admin/gallery_links/_sortable_list.html.erb | 5 + .../admin/gallery_links/edit.html.erb | 1 + .../admin/gallery_links/index.html.erb | 7 ++ .../gallery_links/admin/gallery_links/new.html.erb | 1 + .../gallery_links/gallery_links/index.html.erb | 11 +++ .../gallery_links/gallery_links/show.html.erb | 51 +++++++++++ .../extensions/gallery_links/config/locales/cs.yml | 31 +++++++ .../extensions/gallery_links/config/locales/en.yml | 31 +++++++ .../extensions/gallery_links/config/locales/es.yml | 32 +++++++ .../extensions/gallery_links/config/locales/fr.yml | 31 +++++++ .../extensions/gallery_links/config/locales/it.yml | 31 +++++++ .../extensions/gallery_links/config/locales/nb.yml | 31 +++++++ .../extensions/gallery_links/config/locales/nl.yml | 31 +++++++ .../extensions/gallery_links/config/locales/sk.yml | 31 +++++++ .../extensions/gallery_links/config/locales/tr.yml | 31 +++++++ .../gallery_links/config/locales/zh-CN.yml | 33 +++++++ vendor/extensions/gallery_links/config/routes.rb | 19 ++++ .../1_create_gallery_links_gallery_links.rb | 30 ++++++ vendor/extensions/gallery_links/db/seeds.rb | 25 +++++ .../generators/refinery/gallery_links_generator.rb | 19 ++++ .../gallery_links/lib/refinery/gallery_links.rb | 21 +++++ .../lib/refinery/gallery_links/engine.rb | 26 ++++++ .../gallery_links/lib/refinerycms-gallery_links.rb | 1 + .../lib/tasks/refinery/gallery_links.rake | 13 +++ vendor/extensions/gallery_links/readme.md | 10 ++ .../refinerycms-gallery_links.gemspec | 18 ++++ vendor/extensions/gallery_links/script/rails | 10 ++ .../gallery_links/admin/gallery_links_spec.rb | 101 +++++++++++++++++++++ .../refinery/gallery_links/gallery_link_spec.rb | 18 ++++ .../extensions/gallery_links/spec/spec_helper.rb | 31 +++++++ .../support/factories/refinery/gallery_links.rb | 7 ++ vendor/extensions/gallery_links/tasks/rspec.rake | 6 ++ vendor/extensions/gallery_links/tasks/testing.rake | 8 ++ 44 files changed, 976 insertions(+) create mode 100644 vendor/extensions/gallery_links/Gemfile create mode 100644 vendor/extensions/gallery_links/Rakefile create mode 100644 vendor/extensions/gallery_links/app/controllers/refinery/gallery_links/admin/gallery_links_controller.rb create mode 100644 vendor/extensions/gallery_links/app/controllers/refinery/gallery_links/gallery_links_controller.rb create mode 100644 vendor/extensions/gallery_links/app/models/refinery/gallery_links/gallery_link.rb create mode 100644 vendor/extensions/gallery_links/app/views/refinery/gallery_links/admin/gallery_links/_actions.html.erb create mode 100644 vendor/extensions/gallery_links/app/views/refinery/gallery_links/admin/gallery_links/_form.html.erb create mode 100644 vendor/extensions/gallery_links/app/views/refinery/gallery_links/admin/gallery_links/_gallery_link.html.erb create mode 100644 vendor/extensions/gallery_links/app/views/refinery/gallery_links/admin/gallery_links/_gallery_links.html.erb create mode 100644 vendor/extensions/gallery_links/app/views/refinery/gallery_links/admin/gallery_links/_records.html.erb create mode 100644 vendor/extensions/gallery_links/app/views/refinery/gallery_links/admin/gallery_links/_sortable_list.html.erb create mode 100644 vendor/extensions/gallery_links/app/views/refinery/gallery_links/admin/gallery_links/edit.html.erb create mode 100644 vendor/extensions/gallery_links/app/views/refinery/gallery_links/admin/gallery_links/index.html.erb create mode 100644 vendor/extensions/gallery_links/app/views/refinery/gallery_links/admin/gallery_links/new.html.erb create mode 100644 vendor/extensions/gallery_links/app/views/refinery/gallery_links/gallery_links/index.html.erb create mode 100644 vendor/extensions/gallery_links/app/views/refinery/gallery_links/gallery_links/show.html.erb create mode 100644 vendor/extensions/gallery_links/config/locales/cs.yml create mode 100644 vendor/extensions/gallery_links/config/locales/en.yml create mode 100644 vendor/extensions/gallery_links/config/locales/es.yml create mode 100644 vendor/extensions/gallery_links/config/locales/fr.yml create mode 100644 vendor/extensions/gallery_links/config/locales/it.yml create mode 100644 vendor/extensions/gallery_links/config/locales/nb.yml create mode 100644 vendor/extensions/gallery_links/config/locales/nl.yml create mode 100644 vendor/extensions/gallery_links/config/locales/sk.yml create mode 100644 vendor/extensions/gallery_links/config/locales/tr.yml create mode 100644 vendor/extensions/gallery_links/config/locales/zh-CN.yml create mode 100644 vendor/extensions/gallery_links/config/routes.rb create mode 100644 vendor/extensions/gallery_links/db/migrate/1_create_gallery_links_gallery_links.rb create mode 100644 vendor/extensions/gallery_links/db/seeds.rb create mode 100644 vendor/extensions/gallery_links/lib/generators/refinery/gallery_links_generator.rb create mode 100644 vendor/extensions/gallery_links/lib/refinery/gallery_links.rb create mode 100644 vendor/extensions/gallery_links/lib/refinery/gallery_links/engine.rb create mode 100644 vendor/extensions/gallery_links/lib/refinerycms-gallery_links.rb create mode 100644 vendor/extensions/gallery_links/lib/tasks/refinery/gallery_links.rake create mode 100644 vendor/extensions/gallery_links/readme.md create mode 100644 vendor/extensions/gallery_links/refinerycms-gallery_links.gemspec create mode 100644 vendor/extensions/gallery_links/script/rails create mode 100644 vendor/extensions/gallery_links/spec/features/refinery/gallery_links/admin/gallery_links_spec.rb create mode 100644 vendor/extensions/gallery_links/spec/models/refinery/gallery_links/gallery_link_spec.rb create mode 100644 vendor/extensions/gallery_links/spec/spec_helper.rb create mode 100644 vendor/extensions/gallery_links/spec/support/factories/refinery/gallery_links.rb create mode 100644 vendor/extensions/gallery_links/tasks/rspec.rake create mode 100644 vendor/extensions/gallery_links/tasks/testing.rake diff --git a/Gemfile b/Gemfile index 19c8dd2..c1a91ec 100644 --- a/Gemfile +++ b/Gemfile @@ -66,6 +66,7 @@ gem 'refinerycms-videojs' gem 'refinerycms-pc_banners', :git => "https://github.com/DriesS/refinerycms-pc_banners.git", :branch => "2-1-stable" +gem 'refinerycms-gallery_links', :path => 'vendor/extensions' gem 'refinerycms-acts-as-indexed', :git => "https://github.com/refinery/refinerycms-acts-as-indexed.git", diff --git a/vendor/extensions/gallery_links/Gemfile b/vendor/extensions/gallery_links/Gemfile new file mode 100644 index 0000000..d0dd650 --- /dev/null +++ b/vendor/extensions/gallery_links/Gemfile @@ -0,0 +1,38 @@ +source "http://rubygems.org" + +gemspec + +gem 'refinerycms', '~> 2.1.0' + +# Database Configuration +platforms :jruby do + gem 'activerecord-jdbcsqlite3-adapter' + gem 'activerecord-jdbcmysql-adapter' + gem 'activerecord-jdbcpostgresql-adapter' + gem 'jruby-openssl' +end + +platforms :ruby do + gem 'sqlite3' + gem 'mysql2' + gem 'pg' +end + +group :development, :test do + gem 'refinerycms-testing', '~> 2.1.0' + + platforms :ruby do + require 'rbconfig' + if RbConfig::CONFIG['target_os'] =~ /linux/i + gem 'therubyracer', '~> 0.11.4' + end + end +end + +# Gems used only for assets and not required +# in production environments by default. +group :assets do + gem 'sass-rails' + gem 'coffee-rails' + gem 'uglifier' +end diff --git a/vendor/extensions/gallery_links/Rakefile b/vendor/extensions/gallery_links/Rakefile new file mode 100644 index 0000000..3e2480d --- /dev/null +++ b/vendor/extensions/gallery_links/Rakefile @@ -0,0 +1,20 @@ +#!/usr/bin/env rake +begin + require 'bundler/setup' +rescue LoadError + puts 'You must `gem install bundler` and `bundle install` to run rake tasks' +end + +ENGINE_PATH = File.dirname(__FILE__) +APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__) + +if File.exists?(APP_RAKEFILE) + load 'rails/tasks/engine.rake' +end + +require "refinerycms-testing" +Refinery::Testing::Railtie.load_tasks +Refinery::Testing::Railtie.load_dummy_tasks(ENGINE_PATH) + +load File.expand_path('../tasks/testing.rake', __FILE__) +load File.expand_path('../tasks/rspec.rake', __FILE__) diff --git a/vendor/extensions/gallery_links/app/controllers/refinery/gallery_links/admin/gallery_links_controller.rb b/vendor/extensions/gallery_links/app/controllers/refinery/gallery_links/admin/gallery_links_controller.rb new file mode 100644 index 0000000..89c5a66 --- /dev/null +++ b/vendor/extensions/gallery_links/app/controllers/refinery/gallery_links/admin/gallery_links_controller.rb @@ -0,0 +1,12 @@ +module Refinery + module GalleryLinks + module Admin + class GalleryLinksController < ::Refinery::AdminController + + crudify :'refinery/gallery_links/gallery_link', + :xhr_paging => true + + end + end + end +end diff --git a/vendor/extensions/gallery_links/app/controllers/refinery/gallery_links/gallery_links_controller.rb b/vendor/extensions/gallery_links/app/controllers/refinery/gallery_links/gallery_links_controller.rb new file mode 100644 index 0000000..c6a4e7e --- /dev/null +++ b/vendor/extensions/gallery_links/app/controllers/refinery/gallery_links/gallery_links_controller.rb @@ -0,0 +1,34 @@ +module Refinery + module GalleryLinks + class GalleryLinksController < ::ApplicationController + + before_filter :find_all_gallery_links + before_filter :find_page + + def index + # you can use meta fields from your model instead (e.g. browser_title) + # by swapping @page for @gallery_link in the line below: + present(@page) + end + + def show + @gallery_link = GalleryLink.find(params[:id]) + + # you can use meta fields from your model instead (e.g. browser_title) + # by swapping @page for @gallery_link in the line below: + present(@page) + end + + protected + + def find_all_gallery_links + @gallery_links = GalleryLink.order('position ASC') + end + + def find_page + @page = ::Refinery::Page.where(:link_url => "/gallery_links").first + end + + end + end +end diff --git a/vendor/extensions/gallery_links/app/models/refinery/gallery_links/gallery_link.rb b/vendor/extensions/gallery_links/app/models/refinery/gallery_links/gallery_link.rb new file mode 100644 index 0000000..b83cdd1 --- /dev/null +++ b/vendor/extensions/gallery_links/app/models/refinery/gallery_links/gallery_link.rb @@ -0,0 +1,11 @@ +module Refinery + module GalleryLinks + class GalleryLink < Refinery::Core::BaseModel + self.table_name = 'refinery_gallery_links' + + attr_accessible :title, :url, :photographer, :description, :image_id, :position + + validates :title, :presence => true, :uniqueness => true + end + end +end diff --git a/vendor/extensions/gallery_links/app/views/refinery/gallery_links/admin/gallery_links/_actions.html.erb b/vendor/extensions/gallery_links/app/views/refinery/gallery_links/admin/gallery_links/_actions.html.erb new file mode 100644 index 0000000..31a33b9 --- /dev/null +++ b/vendor/extensions/gallery_links/app/views/refinery/gallery_links/admin/gallery_links/_actions.html.erb @@ -0,0 +1,25 @@ + diff --git a/vendor/extensions/gallery_links/app/views/refinery/gallery_links/admin/gallery_links/_form.html.erb b/vendor/extensions/gallery_links/app/views/refinery/gallery_links/admin/gallery_links/_form.html.erb new file mode 100644 index 0000000..0692e6c --- /dev/null +++ b/vendor/extensions/gallery_links/app/views/refinery/gallery_links/admin/gallery_links/_form.html.erb @@ -0,0 +1,45 @@ +<%= form_for [refinery, :gallery_links_admin, @gallery_link] do |f| -%> + <%= render '/refinery/admin/error_messages', + :object => @gallery_link, + :include_object_name => true %> + +
+ <%= f.label :title -%> + <%= f.text_field :title, :class => 'larger widest' -%> +
+ +
+ <%= f.label :url -%> + <%= f.text_field :url -%> +
+ +
+ <%= f.label :photographer -%> + <%= f.text_field :photographer -%> +
+ +
+ <%= render '/refinery/admin/wysiwyg', + :f => f, + :fields => [:description], + :object => "gallery_links/gallery_link" -%> +
+ +
+ <%= f.label :image_id -%> + <%= f.text_field :image_id -%> +
+ + <%= render '/refinery/admin/form_actions', :f => f, + :continue_editing => false, + :delete_title => t('delete', :scope => 'refinery.gallery_links.admin.gallery_links.gallery_link'), + :delete_confirmation => t('message', :scope => 'refinery.admin.delete', :title => @gallery_link.title) -%> +<% end -%> + +<% content_for :javascripts do -%> + +<% end -%> diff --git a/vendor/extensions/gallery_links/app/views/refinery/gallery_links/admin/gallery_links/_gallery_link.html.erb b/vendor/extensions/gallery_links/app/views/refinery/gallery_links/admin/gallery_links/_gallery_link.html.erb new file mode 100644 index 0000000..7ad61a0 --- /dev/null +++ b/vendor/extensions/gallery_links/app/views/refinery/gallery_links/admin/gallery_links/_gallery_link.html.erb @@ -0,0 +1,20 @@ +
  • + + <%= gallery_link.title %> + + + + + <%= link_to refinery_icon_tag("application_go.png"), refinery.gallery_links_gallery_link_path(gallery_link), + :title => t('.view_live_html'), + :target => "_blank" %> + + <%= link_to refinery_icon_tag("application_edit.png"), refinery.edit_gallery_links_admin_gallery_link_path(gallery_link), + :title => t('.edit') %> + <%= link_to refinery_icon_tag("delete.png"), refinery.gallery_links_admin_gallery_link_path(gallery_link), + :class => "cancel confirm-delete", + :title => t('.delete'), + :confirm => t('message', :scope => 'refinery.admin.delete', :title => gallery_link.title), + :method => :delete %> + +
  • diff --git a/vendor/extensions/gallery_links/app/views/refinery/gallery_links/admin/gallery_links/_gallery_links.html.erb b/vendor/extensions/gallery_links/app/views/refinery/gallery_links/admin/gallery_links/_gallery_links.html.erb new file mode 100644 index 0000000..4d7ef99 --- /dev/null +++ b/vendor/extensions/gallery_links/app/views/refinery/gallery_links/admin/gallery_links/_gallery_links.html.erb @@ -0,0 +1,2 @@ +<%= will_paginate @gallery_links if Refinery::GalleryLinks::Admin::GalleryLinksController.pageable? %> +<%= render 'sortable_list' %> diff --git a/vendor/extensions/gallery_links/app/views/refinery/gallery_links/admin/gallery_links/_records.html.erb b/vendor/extensions/gallery_links/app/views/refinery/gallery_links/admin/gallery_links/_records.html.erb new file mode 100644 index 0000000..7ec7a2a --- /dev/null +++ b/vendor/extensions/gallery_links/app/views/refinery/gallery_links/admin/gallery_links/_records.html.erb @@ -0,0 +1,16 @@ +<%= render 'refinery/admin/search_header', :url => refinery.gallery_links_admin_gallery_links_path %> +
    + <% if @gallery_links.any? %> + <%= render 'gallery_links' %> + <% else %> +

    + <% unless searching? %> + + <%= t('.no_items_yet') %> + + <% else %> + <%= t('no_results', :scope => 'refinery.admin.search') %> + <% end %> +

    + <% end %> +
    diff --git a/vendor/extensions/gallery_links/app/views/refinery/gallery_links/admin/gallery_links/_sortable_list.html.erb b/vendor/extensions/gallery_links/app/views/refinery/gallery_links/admin/gallery_links/_sortable_list.html.erb new file mode 100644 index 0000000..b7489c3 --- /dev/null +++ b/vendor/extensions/gallery_links/app/views/refinery/gallery_links/admin/gallery_links/_sortable_list.html.erb @@ -0,0 +1,5 @@ + +<%= render '/refinery/admin/sortable_list', + :continue_reordering => (local_assigns.keys.include?(:continue_reordering)) ? continue_reordering : true %> diff --git a/vendor/extensions/gallery_links/app/views/refinery/gallery_links/admin/gallery_links/edit.html.erb b/vendor/extensions/gallery_links/app/views/refinery/gallery_links/admin/gallery_links/edit.html.erb new file mode 100644 index 0000000..2d34363 --- /dev/null +++ b/vendor/extensions/gallery_links/app/views/refinery/gallery_links/admin/gallery_links/edit.html.erb @@ -0,0 +1 @@ +<%= render 'form' %> diff --git a/vendor/extensions/gallery_links/app/views/refinery/gallery_links/admin/gallery_links/index.html.erb b/vendor/extensions/gallery_links/app/views/refinery/gallery_links/admin/gallery_links/index.html.erb new file mode 100644 index 0000000..55fcbb8 --- /dev/null +++ b/vendor/extensions/gallery_links/app/views/refinery/gallery_links/admin/gallery_links/index.html.erb @@ -0,0 +1,7 @@ +
    + <%= render 'records' %> +
    + +<%= render '/refinery/admin/make_sortable', :tree => false if !searching? and ::Refinery::GalleryLinks::Admin::GalleryLinksController.sortable? and ::Refinery::GalleryLinks::GalleryLink.many? %> diff --git a/vendor/extensions/gallery_links/app/views/refinery/gallery_links/admin/gallery_links/new.html.erb b/vendor/extensions/gallery_links/app/views/refinery/gallery_links/admin/gallery_links/new.html.erb new file mode 100644 index 0000000..2d34363 --- /dev/null +++ b/vendor/extensions/gallery_links/app/views/refinery/gallery_links/admin/gallery_links/new.html.erb @@ -0,0 +1 @@ +<%= render 'form' %> diff --git a/vendor/extensions/gallery_links/app/views/refinery/gallery_links/gallery_links/index.html.erb b/vendor/extensions/gallery_links/app/views/refinery/gallery_links/gallery_links/index.html.erb new file mode 100644 index 0000000..684af05 --- /dev/null +++ b/vendor/extensions/gallery_links/app/views/refinery/gallery_links/gallery_links/index.html.erb @@ -0,0 +1,11 @@ +<% content_for :body do %> + +<% end %> + +<%= render '/refinery/content_page' %> diff --git a/vendor/extensions/gallery_links/app/views/refinery/gallery_links/gallery_links/show.html.erb b/vendor/extensions/gallery_links/app/views/refinery/gallery_links/gallery_links/show.html.erb new file mode 100644 index 0000000..5496612 --- /dev/null +++ b/vendor/extensions/gallery_links/app/views/refinery/gallery_links/gallery_links/show.html.erb @@ -0,0 +1,51 @@ +<% content_for :body_content_title do %> + <%= @gallery_link.title %> +<% end %> + +<% content_for :body do %> +
    +

    Title

    +

    + <%=raw @gallery_link.title %> +

    +
    +
    +

    Url

    +

    + <%=raw @gallery_link.url %> +

    +
    +
    +

    Photographer

    +

    + <%=raw @gallery_link.photographer %> +

    +
    +
    +

    Description

    +

    + <%=raw @gallery_link.description %> +

    +
    +
    +

    Image

    +

    + <%=raw @gallery_link.image_id %> +

    +
    +<% end %> + +<% content_for :side_body do %> + +<% end %> + +<%= render '/refinery/content_page' %> diff --git a/vendor/extensions/gallery_links/config/locales/cs.yml b/vendor/extensions/gallery_links/config/locales/cs.yml new file mode 100644 index 0000000..0227010 --- /dev/null +++ b/vendor/extensions/gallery_links/config/locales/cs.yml @@ -0,0 +1,31 @@ +cs: + refinery: + plugins: + gallery_links: + title: Gallery Links + gallery_links: + admin: + gallery_links: + actions: + create_new: Přidat Gallery Link + reorder: Řadit Gallery Links + reorder_done: Konec řazení Gallery Links + records: + title: Gallery Links + sorry_no_results: Litujeme, ale nebyly nalezny žádné výsledky. + no_items_yet: Zatím nebyly vytvořeny žádné Gallery Links. Zvolte "Přidat Gallery Link" pro přidání prvního gallery link. + gallery_link: + view_live_html: Zobrazit náhled gallery link
    (otevře se v novém okně) + edit: Upravit gallery link + delete: Smazat gallery link + gallery_links: + show: + other: Další Gallery Links + activerecord: + attributes: + 'refinery/gallery_links/gallery_link': + title: Title + url: Url + photographer: Photographer + description: Description + image_id: Image \ No newline at end of file diff --git a/vendor/extensions/gallery_links/config/locales/en.yml b/vendor/extensions/gallery_links/config/locales/en.yml new file mode 100644 index 0000000..6fc5882 --- /dev/null +++ b/vendor/extensions/gallery_links/config/locales/en.yml @@ -0,0 +1,31 @@ +en: + refinery: + plugins: + gallery_links: + title: Gallery Links + gallery_links: + admin: + gallery_links: + actions: + create_new: Add New Gallery Link + reorder: Reorder Gallery Links + reorder_done: Done Reordering Gallery Links + records: + title: Gallery Links + sorry_no_results: Sorry! There are no results found. + no_items_yet: There are no Gallery Links yet. Click "Add New Gallery Link" to add your first gallery link. + gallery_link: + view_live_html: View this gallery link live
    (opens in a new window) + edit: Edit this gallery link + delete: Remove this gallery link forever + gallery_links: + show: + other: Other Gallery Links + activerecord: + attributes: + 'refinery/gallery_links/gallery_link': + title: Title + url: Url + photographer: Photographer + description: Description + image_id: Image \ No newline at end of file diff --git a/vendor/extensions/gallery_links/config/locales/es.yml b/vendor/extensions/gallery_links/config/locales/es.yml new file mode 100644 index 0000000..34b7554 --- /dev/null +++ b/vendor/extensions/gallery_links/config/locales/es.yml @@ -0,0 +1,32 @@ +es: + refinery: + plugins: + gallery_links: + title: Gallery Links +# article: masculino/femenino + gallery_links: + admin: + gallery_links: + actions: + create_new: Crear nuevo gallery link + reorder: Reordenar gallery links + reorder_done: Reordenación de gallery links completada + records: + title: Gallery Links + sorry_no_results: Lo siento, no hay resultados + no_items_yet: No hay gallery links todavía. Pulsa en "Crear nuevo Gallery Link" para crear tu primer gallery link. + gallery_link: + view_live_html: Ver este gallery link como abierto al público
    (abre en ventana nueva) + edit: Editar este gallery link + delete: Borrar este gallery link para siempre + gallery_links: + show: + other: Otros gallery links + activerecord: + attributes: + 'refinery/gallery_links/gallery_link': + title: Title + url: Url + photographer: Photographer + description: Description + image_id: Image \ No newline at end of file diff --git a/vendor/extensions/gallery_links/config/locales/fr.yml b/vendor/extensions/gallery_links/config/locales/fr.yml new file mode 100644 index 0000000..6cca0de --- /dev/null +++ b/vendor/extensions/gallery_links/config/locales/fr.yml @@ -0,0 +1,31 @@ +fr: + refinery: + plugins: + gallery_links: + title: Gallery Links + gallery_links: + admin: + gallery_links: + actions: + create_new: Créer un(e) nouve(au/l/lle) Gallery Link + reorder: Réordonner les Gallery Links + reorder_done: Fin de réordonnancement des Gallery Links + records: + title: Gallery Links + sorry_no_results: "Désolé ! Aucun résultat." + no_items_yet: 'Il n''y a actuellement aucun(e) Gallery Link. Cliquer sur "Créer un(e) nouve(au/l/lle) Gallery Link" pour créer votre premi(er/ère) gallery link.' + gallery_link: + view_live_html: Voir ce(t/tte) gallery link
    (Ouvre une nouvelle fenêtre) + edit: Modifier ce(t/tte) gallery link + delete: Supprimer définitivement ce(t/tte) gallery link + gallery_links: + show: + other: Autres Gallery Links + activerecord: + attributes: + 'refinery/gallery_links/gallery_link': + title: Title + url: Url + photographer: Photographer + description: Description + image_id: Image \ No newline at end of file diff --git a/vendor/extensions/gallery_links/config/locales/it.yml b/vendor/extensions/gallery_links/config/locales/it.yml new file mode 100644 index 0000000..ea0f3d7 --- /dev/null +++ b/vendor/extensions/gallery_links/config/locales/it.yml @@ -0,0 +1,31 @@ +it: + refinery: + plugins: + gallery_links: + title: Gallery Links + gallery_links: + admin: + gallery_links: + actions: + create_new: Aggiungi Nuovo Gallery Link + reorder: Riordina Gallery Links + reorder_done: Termina il Riordino di Gallery Links + records: + title: Gallery Links + sorry_no_results: "Spiacenti! Nessun risultato trovato" + no_items_yet: Non ci sono ancora Gallery Links. Clicca "Aggiungi Nuovo Gallery Link" per aggiungere il tuo primo gallery link. + gallery_link: + view_live_html: Guarda live questo gallery link
    (apre una nuova finestra) + edit: Modifica questo gallery link + delete: Rimuovi per sempre questo gallery link + gallery_links: + show: + other: Altri Gallery Links + activerecord: + attributes: + 'refinery/gallery_links/gallery_link': + title: Title + url: Url + photographer: Photographer + description: Description + image_id: Image \ No newline at end of file diff --git a/vendor/extensions/gallery_links/config/locales/nb.yml b/vendor/extensions/gallery_links/config/locales/nb.yml new file mode 100644 index 0000000..e4680c0 --- /dev/null +++ b/vendor/extensions/gallery_links/config/locales/nb.yml @@ -0,0 +1,31 @@ +nb: + refinery: + plugins: + gallery_links: + title: Gallery Links + gallery_links: + admin: + gallery_links: + actions: + create_new: Lag en ny Gallery Link + reorder: Endre rekkefølgen på Gallery Links + reorder_done: Ferdig å endre rekkefølgen Gallery Links + records: + title: Gallery Links + sorry_no_results: Beklager! Vi fant ikke noen resultater. + no_items_yet: Det er ingen Gallery Links enda. Klikk på "Lag en ny Gallery Link" for å legge til din første gallery link. + gallery_link: + view_live_html: Vis hvordan denne gallery link ser ut offentlig
    (åpner i et nytt vindu) + edit: Rediger denne gallery link + delete: Fjern denne gallery link permanent + gallery_links: + show: + other: Andre Gallery Links + activerecord: + attributes: + 'refinery/gallery_links/gallery_link': + title: Title + url: Url + photographer: Photographer + description: Description + image_id: Image \ No newline at end of file diff --git a/vendor/extensions/gallery_links/config/locales/nl.yml b/vendor/extensions/gallery_links/config/locales/nl.yml new file mode 100644 index 0000000..e8a6ec6 --- /dev/null +++ b/vendor/extensions/gallery_links/config/locales/nl.yml @@ -0,0 +1,31 @@ +nl: + refinery: + plugins: + gallery_links: + title: Gallery Links + gallery_links: + admin: + gallery_links: + actions: + create_new: Nieuwe Gallery Link toevoegen + reorder: De volgorde van de Gallery Links wijzigen + reorder_done: Klaar met het wijzingen van de van de Gallery Link-volgorde + records: + title: Gallery Links + sorry_no_results: Helaas! Er zijn geen resultaten gevonden. + no_items_yet: Er zijn nog geen Gallery Links. Druk op 'Nieuwe Gallery Link toevoegen' om de eerste toe te voegen. + gallery_link: + view_live_html: Deze gallery link op de website bekijken
    (opent in een nieuw venster) + edit: Bewerk deze gallery link + delete: Deze gallery link definitief verwijderen + gallery_links: + show: + other: Andere Gallery Links + activerecord: + attributes: + 'refinery/gallery_links/gallery_link': + title: Title + url: Url + photographer: Photographer + description: Description + image_id: Image \ No newline at end of file diff --git a/vendor/extensions/gallery_links/config/locales/sk.yml b/vendor/extensions/gallery_links/config/locales/sk.yml new file mode 100644 index 0000000..17153ee --- /dev/null +++ b/vendor/extensions/gallery_links/config/locales/sk.yml @@ -0,0 +1,31 @@ +sk: + refinery: + plugins: + gallery_links: + title: Gallery Links + gallery_links: + admin: + gallery_links: + actions: + create_new: Pridať Gallery Link + reorder: Preusporiadať Gallery Links + reorder_done: Koniec radenia Gallery Links + records: + title: Gallery Links + sorry_no_results: Ľutujeme, ale neboli nájdené žiadne výsledky. + no_items_yet: Nie sú vytvorené žiadne Gallery Links. Kliknite na "Pridať Gallery Link" pre pridanie prvého gallery link. + gallery_link: + view_live_html: Zobraziť náhľad gallery link
    (otvorí sa v novom okne) + edit: Upraviť gallery link + delete: Zmazať gallery link + gallery_links: + show: + other: Daľšie Gallery Links + activerecord: + attributes: + 'refinery/gallery_links/gallery_link': + title: Title + url: Url + photographer: Photographer + description: Description + image_id: Image \ No newline at end of file diff --git a/vendor/extensions/gallery_links/config/locales/tr.yml b/vendor/extensions/gallery_links/config/locales/tr.yml new file mode 100644 index 0000000..6162dc6 --- /dev/null +++ b/vendor/extensions/gallery_links/config/locales/tr.yml @@ -0,0 +1,31 @@ +tr: + refinery: + plugins: + gallery_links: + title: Gallery Links + gallery_links: + admin: + gallery_links: + actions: + create_new: Yeni Ekle Gallery Link + reorder: Tekrar sirala Gallery Links + reorder_done: Tekrar siralama tamamlandiGallery Links + records: + title: Gallery Links + sorry_no_results: Uzgunum! Herhangi bir sonuc bulunamadi. + no_items_yet: Herhangi bir Gallery Links yok henuz. Tikla "Yeni Ekle Gallery Link" eklemek senin ilk gallery link. + gallery_link: + view_live_html: Bunu canlu gallery link goruntule
    (yeni bir pencerede acar) + edit: Bunu Duzenle gallery link + delete: Bunu Sil gallery link sonsuza dek + gallery_links: + show: + other: Diger Gallery Links + activerecord: + attributes: + 'refinery/gallery_links/gallery_link': + title: Title + url: Url + photographer: Photographer + description: Description + image_id: Image \ No newline at end of file diff --git a/vendor/extensions/gallery_links/config/locales/zh-CN.yml b/vendor/extensions/gallery_links/config/locales/zh-CN.yml new file mode 100644 index 0000000..186173c --- /dev/null +++ b/vendor/extensions/gallery_links/config/locales/zh-CN.yml @@ -0,0 +1,33 @@ +zh-CN: + refinery: + plugins: + gallery_links: + title: Gallery Links + gallery_links: + admin: + gallery_links: + actions: + create_new: 建立新的 Gallery Link + reorder: 对 Gallery Links 重新排序 + reorder_done: 对 Gallery Links 的重新排序结束 + records: + title: Gallery Links + sorry_no_results: 对不起,未找到结果。 #Sorry! There are no results found. + + # There are no Gallery Links yet. Click "Add New Gallery Link" to add your first gallery link. + no_items_yet: 目前没有 Gallery Links . 点击 "Add New Gallery Link" 创建一个gallery link. + gallery_link: + view_live_html: 查看 gallery link 的最新内容.
    (新窗口中打开) + edit: 编辑 gallery link + delete: 永久删除 gallery link + gallery_links: + show: + other: 其他 Gallery Links + activerecord: + attributes: + 'refinery/gallery_links/gallery_link': + title: Title + url: Url + photographer: Photographer + description: Description + image_id: Image \ No newline at end of file diff --git a/vendor/extensions/gallery_links/config/routes.rb b/vendor/extensions/gallery_links/config/routes.rb new file mode 100644 index 0000000..9c7a3d9 --- /dev/null +++ b/vendor/extensions/gallery_links/config/routes.rb @@ -0,0 +1,19 @@ +Refinery::Core::Engine.routes.draw do + + # Frontend routes + namespace :gallery_links do + resources :gallery_links, :path => '', :only => [:index, :show] + end + + # Admin routes + namespace :gallery_links, :path => '' do + namespace :admin, :path => Refinery::Core.backend_route do + resources :gallery_links, :except => :show do + collection do + post :update_positions + end + end + end + end + +end diff --git a/vendor/extensions/gallery_links/db/migrate/1_create_gallery_links_gallery_links.rb b/vendor/extensions/gallery_links/db/migrate/1_create_gallery_links_gallery_links.rb new file mode 100644 index 0000000..b55d337 --- /dev/null +++ b/vendor/extensions/gallery_links/db/migrate/1_create_gallery_links_gallery_links.rb @@ -0,0 +1,30 @@ +class CreateGalleryLinksGalleryLinks < ActiveRecord::Migration + + def up + create_table :refinery_gallery_links do |t| + t.string :title + t.string :url + t.string :photographer + t.text :description + t.integer :image_id + t.integer :position + + t.timestamps + end + + end + + def down + if defined?(::Refinery::UserPlugin) + ::Refinery::UserPlugin.destroy_all({:name => "refinerycms-gallery_links"}) + end + + if defined?(::Refinery::Page) + ::Refinery::Page.delete_all({:link_url => "/gallery_links/gallery_links"}) + end + + drop_table :refinery_gallery_links + + end + +end diff --git a/vendor/extensions/gallery_links/db/seeds.rb b/vendor/extensions/gallery_links/db/seeds.rb new file mode 100644 index 0000000..65e3615 --- /dev/null +++ b/vendor/extensions/gallery_links/db/seeds.rb @@ -0,0 +1,25 @@ +Refinery::I18n.frontend_locales.each do |lang| + I18n.locale = lang + + if defined?(Refinery::User) + Refinery::User.all.each do |user| + if user.plugins.where(:name => 'refinerycms-gallery_links').blank? + user.plugins.create(:name => 'refinerycms-gallery_links', + :position => (user.plugins.maximum(:position) || -1) +1) + end + end + end + + url = "/gallery_links" + if defined?(Refinery::Page) && Refinery::Page.where(:link_url => url).empty? + page = Refinery::Page.create( + :title => 'Gallery Links', + :link_url => url, + :deletable => false, + :menu_match => "^#{url}(\/|\/.+?|)$" + ) + Refinery::Pages.default_parts.each_with_index do |default_page_part, index| + page.parts.create(:title => default_page_part, :body => nil, :position => index) + end + end +end diff --git a/vendor/extensions/gallery_links/lib/generators/refinery/gallery_links_generator.rb b/vendor/extensions/gallery_links/lib/generators/refinery/gallery_links_generator.rb new file mode 100644 index 0000000..c28bcf9 --- /dev/null +++ b/vendor/extensions/gallery_links/lib/generators/refinery/gallery_links_generator.rb @@ -0,0 +1,19 @@ +module Refinery + class GalleryLinksGenerator < Rails::Generators::Base + + def rake_db + rake "refinery_gallery_links:install:migrations" + end + + def append_load_seed_data + create_file 'db/seeds.rb' unless File.exists?(File.join(destination_root, 'db', 'seeds.rb')) + append_file 'db/seeds.rb', :verbose => true do + <<-EOH + +# Added by Refinery CMS GalleryLinks extension +Refinery::GalleryLinks::Engine.load_seed + EOH + end + end + end +end diff --git a/vendor/extensions/gallery_links/lib/refinery/gallery_links.rb b/vendor/extensions/gallery_links/lib/refinery/gallery_links.rb new file mode 100644 index 0000000..cf8dcee --- /dev/null +++ b/vendor/extensions/gallery_links/lib/refinery/gallery_links.rb @@ -0,0 +1,21 @@ +require 'refinerycms-core' + +module Refinery + autoload :GalleryLinksGenerator, 'generators/refinery/gallery_links_generator' + + module GalleryLinks + require 'refinery/gallery_links/engine' + + class << self + attr_writer :root + + def root + @root ||= Pathname.new(File.expand_path('../../../', __FILE__)) + end + + def factory_paths + @factory_paths ||= [ root.join('spec', 'factories').to_s ] + end + end + end +end diff --git a/vendor/extensions/gallery_links/lib/refinery/gallery_links/engine.rb b/vendor/extensions/gallery_links/lib/refinery/gallery_links/engine.rb new file mode 100644 index 0000000..9f1b713 --- /dev/null +++ b/vendor/extensions/gallery_links/lib/refinery/gallery_links/engine.rb @@ -0,0 +1,26 @@ +module Refinery + module GalleryLinks + class Engine < Rails::Engine + extend Refinery::Engine + isolate_namespace Refinery::GalleryLinks + + engine_name :refinery_gallery_links + + before_inclusion do + Refinery::Plugin.register do |plugin| + plugin.name = "gallery_links" + plugin.url = proc { Refinery::Core::Engine.routes.url_helpers.gallery_links_admin_gallery_links_path } + plugin.pathname = root + plugin.activity = { + :class_name => :'refinery/gallery_links/gallery_link' + } + + end + end + + config.after_initialize do + Refinery.register_extension(Refinery::GalleryLinks) + end + end + end +end diff --git a/vendor/extensions/gallery_links/lib/refinerycms-gallery_links.rb b/vendor/extensions/gallery_links/lib/refinerycms-gallery_links.rb new file mode 100644 index 0000000..6c265d5 --- /dev/null +++ b/vendor/extensions/gallery_links/lib/refinerycms-gallery_links.rb @@ -0,0 +1 @@ +require 'refinery/gallery_links' diff --git a/vendor/extensions/gallery_links/lib/tasks/refinery/gallery_links.rake b/vendor/extensions/gallery_links/lib/tasks/refinery/gallery_links.rake new file mode 100644 index 0000000..bd3442e --- /dev/null +++ b/vendor/extensions/gallery_links/lib/tasks/refinery/gallery_links.rake @@ -0,0 +1,13 @@ +namespace :refinery do + + namespace :gallery_links do + + # call this task by running: rake refinery:gallery_links:my_task + # desc "Description of my task below" + # task :my_task => :environment do + # # add your logic here + # end + + end + +end \ No newline at end of file diff --git a/vendor/extensions/gallery_links/readme.md b/vendor/extensions/gallery_links/readme.md new file mode 100644 index 0000000..eccc7f9 --- /dev/null +++ b/vendor/extensions/gallery_links/readme.md @@ -0,0 +1,10 @@ +# Gallery Links extension for Refinery CMS. + +## How to build this extension as a gem + + cd vendor/extensions/gallery_links + gem build refinerycms-gallery_links.gemspec + gem install refinerycms-gallery_links.gem + + # Sign up for a http://rubygems.org/ account and publish the gem + gem push refinerycms-gallery_links.gem \ No newline at end of file diff --git a/vendor/extensions/gallery_links/refinerycms-gallery_links.gemspec b/vendor/extensions/gallery_links/refinerycms-gallery_links.gemspec new file mode 100644 index 0000000..96995f2 --- /dev/null +++ b/vendor/extensions/gallery_links/refinerycms-gallery_links.gemspec @@ -0,0 +1,18 @@ +# Encoding: UTF-8 + +Gem::Specification.new do |s| + s.platform = Gem::Platform::RUBY + s.name = 'refinerycms-gallery_links' + s.version = '1.0' + s.description = 'Ruby on Rails Gallery Links extension for Refinery CMS' + s.date = '2017-12-17' + s.summary = 'Gallery Links extension for Refinery CMS' + s.require_paths = %w(lib) + s.files = Dir["{app,config,db,lib}/**/*"] + ["readme.md"] + + # Runtime dependencies + s.add_dependency 'refinerycms-core', '~> 2.1.5' + + # Development dependencies (usually used for testing) + s.add_development_dependency 'refinerycms-testing', '~> 2.1.5' +end diff --git a/vendor/extensions/gallery_links/script/rails b/vendor/extensions/gallery_links/script/rails new file mode 100644 index 0000000..8c9932a --- /dev/null +++ b/vendor/extensions/gallery_links/script/rails @@ -0,0 +1,10 @@ +#!/usr/bin/env ruby +# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. + +ENGINE_PATH = File.expand_path('../..', __FILE__) +dummy_rails_path = File.expand_path('../../spec/dummy/script/rails', __FILE__) +if File.exist?(dummy_rails_path) + load dummy_rails_path +else + puts "Please first run 'rake refinery:testing:dummy_app' to create a dummy Refinery CMS application." +end diff --git a/vendor/extensions/gallery_links/spec/features/refinery/gallery_links/admin/gallery_links_spec.rb b/vendor/extensions/gallery_links/spec/features/refinery/gallery_links/admin/gallery_links_spec.rb new file mode 100644 index 0000000..f49e600 --- /dev/null +++ b/vendor/extensions/gallery_links/spec/features/refinery/gallery_links/admin/gallery_links_spec.rb @@ -0,0 +1,101 @@ +# encoding: utf-8 +require "spec_helper" + +describe Refinery do + describe "GalleryLinks" do + describe "Admin" do + describe "gallery_links" do + refinery_login_with :refinery_user + + describe "gallery_links list" do + before do + FactoryGirl.create(:gallery_link, :title => "UniqueTitleOne") + FactoryGirl.create(:gallery_link, :title => "UniqueTitleTwo") + end + + it "shows two items" do + visit refinery.gallery_links_admin_gallery_links_path + page.should have_content("UniqueTitleOne") + page.should have_content("UniqueTitleTwo") + end + end + + describe "create" do + before do + visit refinery.gallery_links_admin_gallery_links_path + + click_link "Add New Gallery Link" + end + + context "valid data" do + it "should succeed" do + fill_in "Title", :with => "This is a test of the first string field" + click_button "Save" + + page.should have_content("'This is a test of the first string field' was successfully added.") + Refinery::GalleryLinks::GalleryLink.count.should == 1 + end + end + + context "invalid data" do + it "should fail" do + click_button "Save" + + page.should have_content("Title can't be blank") + Refinery::GalleryLinks::GalleryLink.count.should == 0 + end + end + + context "duplicate" do + before { FactoryGirl.create(:gallery_link, :title => "UniqueTitle") } + + it "should fail" do + visit refinery.gallery_links_admin_gallery_links_path + + click_link "Add New Gallery Link" + + fill_in "Title", :with => "UniqueTitle" + click_button "Save" + + page.should have_content("There were problems") + Refinery::GalleryLinks::GalleryLink.count.should == 1 + end + end + + end + + describe "edit" do + before { FactoryGirl.create(:gallery_link, :title => "A title") } + + it "should succeed" do + visit refinery.gallery_links_admin_gallery_links_path + + within ".actions" do + click_link "Edit this gallery link" + end + + fill_in "Title", :with => "A different title" + click_button "Save" + + page.should have_content("'A different title' was successfully updated.") + page.should have_no_content("A title") + end + end + + describe "destroy" do + before { FactoryGirl.create(:gallery_link, :title => "UniqueTitleOne") } + + it "should succeed" do + visit refinery.gallery_links_admin_gallery_links_path + + click_link "Remove this gallery link forever" + + page.should have_content("'UniqueTitleOne' was successfully removed.") + Refinery::GalleryLinks::GalleryLink.count.should == 0 + end + end + + end + end + end +end diff --git a/vendor/extensions/gallery_links/spec/models/refinery/gallery_links/gallery_link_spec.rb b/vendor/extensions/gallery_links/spec/models/refinery/gallery_links/gallery_link_spec.rb new file mode 100644 index 0000000..d7e9e13 --- /dev/null +++ b/vendor/extensions/gallery_links/spec/models/refinery/gallery_links/gallery_link_spec.rb @@ -0,0 +1,18 @@ +require 'spec_helper' + +module Refinery + module GalleryLinks + describe GalleryLink do + describe "validations" do + subject do + FactoryGirl.create(:gallery_link, + :title => "Refinery CMS") + end + + it { should be_valid } + its(:errors) { should be_empty } + its(:title) { should == "Refinery CMS" } + end + end + end +end diff --git a/vendor/extensions/gallery_links/spec/spec_helper.rb b/vendor/extensions/gallery_links/spec/spec_helper.rb new file mode 100644 index 0000000..d3214e2 --- /dev/null +++ b/vendor/extensions/gallery_links/spec/spec_helper.rb @@ -0,0 +1,31 @@ +# Configure Rails Environment +ENV["RAILS_ENV"] ||= 'test' + +if File.exist?(dummy_path = File.expand_path('../dummy/config/environment.rb', __FILE__)) + require dummy_path +elsif File.dirname(__FILE__) =~ %r{vendor/extensions} + # Require the path to the refinerycms application this is vendored inside. + require File.expand_path('../../../../../config/environment', __FILE__) +else + puts "Could not find a config/environment.rb file to require. Please specify this in #{File.expand_path(__FILE__)}" +end + +require 'rspec/rails' +require 'capybara/rspec' + +Rails.backtrace_cleaner.remove_silencers! + +RSpec.configure do |config| + config.mock_with :rspec + config.treat_symbols_as_metadata_keys_with_true_values = true + config.filter_run :focus => true + config.run_all_when_everything_filtered = true +end + +# Requires supporting files with custom matchers and macros, etc, +# in ./support/ and its subdirectories including factories. +([Rails.root.to_s] | ::Refinery::Plugins.registered.pathnames).map{|p| + Dir[File.join(p, 'spec', 'support', '**', '*.rb').to_s] +}.flatten.sort.each do |support_file| + require support_file +end diff --git a/vendor/extensions/gallery_links/spec/support/factories/refinery/gallery_links.rb b/vendor/extensions/gallery_links/spec/support/factories/refinery/gallery_links.rb new file mode 100644 index 0000000..8b84ed2 --- /dev/null +++ b/vendor/extensions/gallery_links/spec/support/factories/refinery/gallery_links.rb @@ -0,0 +1,7 @@ + +FactoryGirl.define do + factory :gallery_link, :class => Refinery::GalleryLinks::GalleryLink do + sequence(:title) { |n| "refinery#{n}" } + end +end + diff --git a/vendor/extensions/gallery_links/tasks/rspec.rake b/vendor/extensions/gallery_links/tasks/rspec.rake new file mode 100644 index 0000000..c89c0d7 --- /dev/null +++ b/vendor/extensions/gallery_links/tasks/rspec.rake @@ -0,0 +1,6 @@ +require 'rspec/core/rake_task' + +desc "Run specs" +RSpec::Core::RakeTask.new do |t| + t.pattern = "./spec" +end diff --git a/vendor/extensions/gallery_links/tasks/testing.rake b/vendor/extensions/gallery_links/tasks/testing.rake new file mode 100644 index 0000000..5f8b63a --- /dev/null +++ b/vendor/extensions/gallery_links/tasks/testing.rake @@ -0,0 +1,8 @@ +namespace :refinery do + namespace :testing do + # Put any code in here that you want run when you test this extension against a dummy app. + # For example, the call to require your gem and start your generator. + task :setup_extension do + end + end +end -- cgit v1.2.3 From 09b23f8457bb1a3c26d10ffbfab930176d984015 Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Sun, 17 Dec 2017 12:36:47 +0100 Subject: Add authors to GalleryLinks gemspec. --- vendor/extensions/gallery_links/refinerycms-gallery_links.gemspec | 2 ++ 1 file changed, 2 insertions(+) diff --git a/vendor/extensions/gallery_links/refinerycms-gallery_links.gemspec b/vendor/extensions/gallery_links/refinerycms-gallery_links.gemspec index 96995f2..851da2b 100644 --- a/vendor/extensions/gallery_links/refinerycms-gallery_links.gemspec +++ b/vendor/extensions/gallery_links/refinerycms-gallery_links.gemspec @@ -1,10 +1,12 @@ # Encoding: UTF-8 +# :jedit:mode=ruby: Gem::Specification.new do |s| s.platform = Gem::Platform::RUBY s.name = 'refinerycms-gallery_links' s.version = '1.0' s.description = 'Ruby on Rails Gallery Links extension for Refinery CMS' + s.authors = ['Harald Eilertsen '] s.date = '2017-12-17' s.summary = 'Gallery Links extension for Refinery CMS' s.require_paths = %w(lib) -- cgit v1.2.3 From 189407cc44275016a0b00798a3dac704f870f8c0 Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Sun, 17 Dec 2017 12:37:40 +0100 Subject: Install GalleryLinks extension into main app. --- Gemfile.lock | 7 +++++ ...y_links_gallery_links.refinery_gallery_links.rb | 31 ++++++++++++++++++++++ db/schema.rb | 13 ++++++++- db/seeds.rb | 3 +++ 4 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20171217104241_create_gallery_links_gallery_links.refinery_gallery_links.rb diff --git a/Gemfile.lock b/Gemfile.lock index ec3b52a..2d41d61 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -29,6 +29,12 @@ GIT refinerycms-settings (~> 2.1.0) seo_meta (~> 1.4.0) +PATH + remote: vendor/extensions + specs: + refinerycms-gallery_links (1.0) + refinerycms-core (~> 2.1.5) + GEM remote: https://rubygems.org/ specs: @@ -275,6 +281,7 @@ DEPENDENCIES refinerycms (~> 2.1.0) refinerycms-acts-as-indexed! refinerycms-blog (~> 2.1.0)! + refinerycms-gallery_links! refinerycms-i18n (~> 2.1.0) refinerycms-inquiries (~> 2.1.0) refinerycms-page-images (~> 2.1.0) diff --git a/db/migrate/20171217104241_create_gallery_links_gallery_links.refinery_gallery_links.rb b/db/migrate/20171217104241_create_gallery_links_gallery_links.refinery_gallery_links.rb new file mode 100644 index 0000000..03a5865 --- /dev/null +++ b/db/migrate/20171217104241_create_gallery_links_gallery_links.refinery_gallery_links.rb @@ -0,0 +1,31 @@ +# This migration comes from refinery_gallery_links (originally 1) +class CreateGalleryLinksGalleryLinks < ActiveRecord::Migration + + def up + create_table :refinery_gallery_links do |t| + t.string :title + t.string :url + t.string :photographer + t.text :description + t.integer :image_id + t.integer :position + + t.timestamps + end + + end + + def down + if defined?(::Refinery::UserPlugin) + ::Refinery::UserPlugin.destroy_all({:name => "refinerycms-gallery_links"}) + end + + if defined?(::Refinery::Page) + ::Refinery::Page.delete_all({:link_url => "/gallery_links/gallery_links"}) + end + + drop_table :refinery_gallery_links + + end + +end diff --git a/db/schema.rb b/db/schema.rb index 4d3fe93..512de33 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20151210191646) do +ActiveRecord::Schema.define(:version => 20171217104241) do create_table "refinery_banners", :force => true do |t| t.string "name" @@ -115,6 +115,17 @@ ActiveRecord::Schema.define(:version => 20151210191646) do add_index "refinery_blog_posts", ["id"], :name => "index_refinery_blog_posts_on_id" add_index "refinery_blog_posts", ["slug"], :name => "index_refinery_blog_posts_on_slug" + create_table "refinery_gallery_links", :force => true do |t| + t.string "title" + t.string "url" + t.string "photographer" + t.text "description" + t.integer "image_id" + t.integer "position" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + create_table "refinery_image_page_translations", :force => true do |t| t.integer "refinery_image_page_id" t.string "locale" diff --git a/db/seeds.rb b/db/seeds.rb index 7391f95..f351030 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -19,3 +19,6 @@ Refinery::Inquiries::Engine.load_seed Refinery::Search::Engine.load_seed Refinery::Banners::Engine.load_seed + +# Added by Refinery CMS GalleryLinks extension +Refinery::GalleryLinks::Engine.load_seed -- cgit v1.2.3 From 4db686f9e5d4963c4fdfadbdbae6416370f881d6 Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Sun, 17 Dec 2017 12:38:13 +0100 Subject: Don't copy database files from host systemt to vagrant box. --- Vagrantfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Vagrantfile b/Vagrantfile index d24ce9d..c5e6a76 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -7,5 +7,5 @@ Vagrant.configure("2") do |config| config.vm.guest = :freebsd config.vm.network :forwarded_port, host: 3000, guest: 3000 config.vm.provision :shell, :path => "vagrant/bootstrap.sh" - config.vm.synced_folder ".", "/vagrant", type: "rsync", rsync__exclude: %w[.git/ vendor/bundle/] + config.vm.synced_folder ".", "/vagrant", type: "rsync", rsync__exclude: %w[.git/ db/*.sqlite3 vendor/bundle/] end -- cgit v1.2.3 From cd056817733076d7430c0c85ce2ff767d627aa6a Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Sun, 17 Dec 2017 12:49:16 +0100 Subject: GalleryLinks: Fix norwegian translations. --- .../extensions/gallery_links/config/locales/nb.yml | 30 +++++++++++----------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/vendor/extensions/gallery_links/config/locales/nb.yml b/vendor/extensions/gallery_links/config/locales/nb.yml index e4680c0..971e333 100644 --- a/vendor/extensions/gallery_links/config/locales/nb.yml +++ b/vendor/extensions/gallery_links/config/locales/nb.yml @@ -2,30 +2,30 @@ nb: refinery: plugins: gallery_links: - title: Gallery Links + title: Gallerier gallery_links: admin: gallery_links: actions: - create_new: Lag en ny Gallery Link - reorder: Endre rekkefølgen på Gallery Links - reorder_done: Ferdig å endre rekkefølgen Gallery Links + create_new: Lag et nytt galleri + reorder: Endre rekkefølgen på galleriene + reorder_done: Ferdig å endre rekkefølgen på galleriene records: - title: Gallery Links + title: Gallerier sorry_no_results: Beklager! Vi fant ikke noen resultater. - no_items_yet: Det er ingen Gallery Links enda. Klikk på "Lag en ny Gallery Link" for å legge til din første gallery link. + no_items_yet: Det er ingen gallerier enda. Klikk på "Lag et nytt galleri" for å legge til ditt første galleri. gallery_link: - view_live_html: Vis hvordan denne gallery link ser ut offentlig
    (åpner i et nytt vindu) - edit: Rediger denne gallery link - delete: Fjern denne gallery link permanent + view_live_html: Vis hvordan dette galleriet ser ut offentlig
    (åpner i et nytt vindu) + edit: Rediger dette galleriet + delete: Fjern dette galleret gallery_links: show: - other: Andre Gallery Links + other: Andre gallerier activerecord: attributes: 'refinery/gallery_links/gallery_link': - title: Title - url: Url - photographer: Photographer - description: Description - image_id: Image \ No newline at end of file + title: Tittel + url: Lenke + photographer: Fotograf + description: Beskrivelse + image_id: Bilde \ No newline at end of file -- cgit v1.2.3 From c9c1d27ae1de01e4fcf07f2c72042b471784260a Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Sun, 17 Dec 2017 14:36:47 +0100 Subject: GalleryLinks: Update index view. --- .../gallery_links/gallery_links/index.html.erb | 38 ++++++++++++++++++---- .../extensions/gallery_links/config/locales/cs.yml | 3 ++ .../extensions/gallery_links/config/locales/en.yml | 3 ++ .../extensions/gallery_links/config/locales/es.yml | 3 ++ .../extensions/gallery_links/config/locales/fr.yml | 3 ++ .../extensions/gallery_links/config/locales/it.yml | 3 ++ .../extensions/gallery_links/config/locales/nb.yml | 3 ++ .../extensions/gallery_links/config/locales/nl.yml | 3 ++ .../extensions/gallery_links/config/locales/sk.yml | 3 ++ .../extensions/gallery_links/config/locales/tr.yml | 3 ++ .../gallery_links/config/locales/zh-CN.yml | 3 ++ 11 files changed, 62 insertions(+), 6 deletions(-) diff --git a/vendor/extensions/gallery_links/app/views/refinery/gallery_links/gallery_links/index.html.erb b/vendor/extensions/gallery_links/app/views/refinery/gallery_links/gallery_links/index.html.erb index 684af05..e9121d6 100644 --- a/vendor/extensions/gallery_links/app/views/refinery/gallery_links/gallery_links/index.html.erb +++ b/vendor/extensions/gallery_links/app/views/refinery/gallery_links/gallery_links/index.html.erb @@ -1,11 +1,37 @@ <% content_for :body do %> - + <% end %> <%= render '/refinery/content_page' %> diff --git a/vendor/extensions/gallery_links/config/locales/cs.yml b/vendor/extensions/gallery_links/config/locales/cs.yml index 0227010..880b973 100644 --- a/vendor/extensions/gallery_links/config/locales/cs.yml +++ b/vendor/extensions/gallery_links/config/locales/cs.yml @@ -21,6 +21,9 @@ cs: gallery_links: show: other: Další Gallery Links + index: + photographer: Photographer + created: Created activerecord: attributes: 'refinery/gallery_links/gallery_link': diff --git a/vendor/extensions/gallery_links/config/locales/en.yml b/vendor/extensions/gallery_links/config/locales/en.yml index 6fc5882..8715d2d 100644 --- a/vendor/extensions/gallery_links/config/locales/en.yml +++ b/vendor/extensions/gallery_links/config/locales/en.yml @@ -21,6 +21,9 @@ en: gallery_links: show: other: Other Gallery Links + index: + photographer: Photographer + created: Created activerecord: attributes: 'refinery/gallery_links/gallery_link': diff --git a/vendor/extensions/gallery_links/config/locales/es.yml b/vendor/extensions/gallery_links/config/locales/es.yml index 34b7554..4f8ca9d 100644 --- a/vendor/extensions/gallery_links/config/locales/es.yml +++ b/vendor/extensions/gallery_links/config/locales/es.yml @@ -22,6 +22,9 @@ es: gallery_links: show: other: Otros gallery links + index: + photographer: Photographer + created: Created activerecord: attributes: 'refinery/gallery_links/gallery_link': diff --git a/vendor/extensions/gallery_links/config/locales/fr.yml b/vendor/extensions/gallery_links/config/locales/fr.yml index 6cca0de..cc8e329 100644 --- a/vendor/extensions/gallery_links/config/locales/fr.yml +++ b/vendor/extensions/gallery_links/config/locales/fr.yml @@ -21,6 +21,9 @@ fr: gallery_links: show: other: Autres Gallery Links + index: + photographer: Photographer + created: Created activerecord: attributes: 'refinery/gallery_links/gallery_link': diff --git a/vendor/extensions/gallery_links/config/locales/it.yml b/vendor/extensions/gallery_links/config/locales/it.yml index ea0f3d7..a08c218 100644 --- a/vendor/extensions/gallery_links/config/locales/it.yml +++ b/vendor/extensions/gallery_links/config/locales/it.yml @@ -21,6 +21,9 @@ it: gallery_links: show: other: Altri Gallery Links + index: + photographer: Photographer + created: Created activerecord: attributes: 'refinery/gallery_links/gallery_link': diff --git a/vendor/extensions/gallery_links/config/locales/nb.yml b/vendor/extensions/gallery_links/config/locales/nb.yml index 971e333..cb1dd6b 100644 --- a/vendor/extensions/gallery_links/config/locales/nb.yml +++ b/vendor/extensions/gallery_links/config/locales/nb.yml @@ -21,6 +21,9 @@ nb: gallery_links: show: other: Andre gallerier + index: + photographer: Fotograf + created: Lastet opp activerecord: attributes: 'refinery/gallery_links/gallery_link': diff --git a/vendor/extensions/gallery_links/config/locales/nl.yml b/vendor/extensions/gallery_links/config/locales/nl.yml index e8a6ec6..3b81530 100644 --- a/vendor/extensions/gallery_links/config/locales/nl.yml +++ b/vendor/extensions/gallery_links/config/locales/nl.yml @@ -21,6 +21,9 @@ nl: gallery_links: show: other: Andere Gallery Links + index: + photographer: Photographer + created: Created activerecord: attributes: 'refinery/gallery_links/gallery_link': diff --git a/vendor/extensions/gallery_links/config/locales/sk.yml b/vendor/extensions/gallery_links/config/locales/sk.yml index 17153ee..b875c91 100644 --- a/vendor/extensions/gallery_links/config/locales/sk.yml +++ b/vendor/extensions/gallery_links/config/locales/sk.yml @@ -21,6 +21,9 @@ sk: gallery_links: show: other: Daľšie Gallery Links + index: + photographer: Photographer + created: Created activerecord: attributes: 'refinery/gallery_links/gallery_link': diff --git a/vendor/extensions/gallery_links/config/locales/tr.yml b/vendor/extensions/gallery_links/config/locales/tr.yml index 6162dc6..62a0ab4 100644 --- a/vendor/extensions/gallery_links/config/locales/tr.yml +++ b/vendor/extensions/gallery_links/config/locales/tr.yml @@ -21,6 +21,9 @@ tr: gallery_links: show: other: Diger Gallery Links + index: + photographer: Photographer + created: Created activerecord: attributes: 'refinery/gallery_links/gallery_link': diff --git a/vendor/extensions/gallery_links/config/locales/zh-CN.yml b/vendor/extensions/gallery_links/config/locales/zh-CN.yml index 186173c..7d21989 100644 --- a/vendor/extensions/gallery_links/config/locales/zh-CN.yml +++ b/vendor/extensions/gallery_links/config/locales/zh-CN.yml @@ -23,6 +23,9 @@ zh-CN: gallery_links: show: other: 其他 Gallery Links + index: + photographer: Photographer + created: Created activerecord: attributes: 'refinery/gallery_links/gallery_link': -- cgit v1.2.3 From 9a5008f1b3ed11f3e052d156d1879cbb429106f8 Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Sun, 17 Dec 2017 14:37:39 +0100 Subject: GalleryLinks: Fix image upload --- .../app/models/refinery/gallery_links/gallery_link.rb | 2 ++ .../refinery/gallery_links/admin/gallery_links/_form.html.erb | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/vendor/extensions/gallery_links/app/models/refinery/gallery_links/gallery_link.rb b/vendor/extensions/gallery_links/app/models/refinery/gallery_links/gallery_link.rb index b83cdd1..e275fb2 100644 --- a/vendor/extensions/gallery_links/app/models/refinery/gallery_links/gallery_link.rb +++ b/vendor/extensions/gallery_links/app/models/refinery/gallery_links/gallery_link.rb @@ -3,6 +3,8 @@ module Refinery class GalleryLink < Refinery::Core::BaseModel self.table_name = 'refinery_gallery_links' + belongs_to :image, class_name: ::Refinery::Image + attr_accessible :title, :url, :photographer, :description, :image_id, :position validates :title, :presence => true, :uniqueness => true diff --git a/vendor/extensions/gallery_links/app/views/refinery/gallery_links/admin/gallery_links/_form.html.erb b/vendor/extensions/gallery_links/app/views/refinery/gallery_links/admin/gallery_links/_form.html.erb index 0692e6c..1ec8b93 100644 --- a/vendor/extensions/gallery_links/app/views/refinery/gallery_links/admin/gallery_links/_form.html.erb +++ b/vendor/extensions/gallery_links/app/views/refinery/gallery_links/admin/gallery_links/_form.html.erb @@ -27,7 +27,12 @@
    <%= f.label :image_id -%> - <%= f.text_field :image_id -%> + <%#= f.text_field :image_id -%> + <%= render '/refinery/admin/image_picker', + :f => f, + :field => :image_id, + :image => @gallery_link.image, + :toggle_image_display => false -%>
    <%= render '/refinery/admin/form_actions', :f => f, -- cgit v1.2.3 From 81a17a794d37b40f38d8b45d247dc182cdb59dea Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Sun, 17 Dec 2017 14:38:02 +0100 Subject: Add imagemagick-nox11 to vagrant box for image processing. --- vagrant/bootstrap.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vagrant/bootstrap.sh b/vagrant/bootstrap.sh index 2ff62a6..a57d3a1 100644 --- a/vagrant/bootstrap.sh +++ b/vagrant/bootstrap.sh @@ -1,6 +1,6 @@ #!/bin/sh pkg upgrade -y -q -f -pkg install -y -q ruby rubygem-bundler postgresql93-server postgresql93-client git sqlite3 +pkg install -y -q ruby rubygem-bundler postgresql93-server postgresql93-client git sqlite3 imagemagick-nox11 echo 'postgresql_enable="YES"' >> /etc/rc.conf -- cgit v1.2.3 From d42a39f8a562bc36c66b3506a31d5909fb0cfda1 Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Sun, 17 Dec 2017 14:38:32 +0100 Subject: Exclude public/system from syncing from host to vagrant box. This overwrites uploaded images etc in the box. --- Vagrantfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Vagrantfile b/Vagrantfile index c5e6a76..2dfe550 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -7,5 +7,5 @@ Vagrant.configure("2") do |config| config.vm.guest = :freebsd config.vm.network :forwarded_port, host: 3000, guest: 3000 config.vm.provision :shell, :path => "vagrant/bootstrap.sh" - config.vm.synced_folder ".", "/vagrant", type: "rsync", rsync__exclude: %w[.git/ db/*.sqlite3 vendor/bundle/] + config.vm.synced_folder ".", "/vagrant", type: "rsync", rsync__exclude: %w[.git/ db/*.sqlite3 public/system/ vendor/bundle/] end -- cgit v1.2.3 From b70546f2783503bf98febfe5ffc146131552b741 Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Sun, 17 Dec 2017 14:53:32 +0100 Subject: Add styling for GalleryLinks. --- app/assets/stylesheets/application.css | 1 + app/assets/stylesheets/gallery_links.scss | 9 +++++++++ 2 files changed, 10 insertions(+) create mode 100644 app/assets/stylesheets/gallery_links.scss diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index 1f93b7e..fbd78ca 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -15,4 +15,5 @@ *= require hmno_main *= require hmno_page *= require hmno_sidebars + *= require gallery_links */ diff --git a/app/assets/stylesheets/gallery_links.scss b/app/assets/stylesheets/gallery_links.scss new file mode 100644 index 0000000..ebfc852 --- /dev/null +++ b/app/assets/stylesheets/gallery_links.scss @@ -0,0 +1,9 @@ +.gallery_link { + display: inline-block; + width: 235px; + vertical-align: top; + + .gallery_link_meta { + font-size: 80%; + } +} \ No newline at end of file -- cgit v1.2.3 From 03bc78d2a69fe12a575197e969153282b5f3a144 Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Mon, 18 Dec 2017 19:48:10 +0100 Subject: Use custom version of capistrano-postgresql. Needed to overcome bugs with the latest released gem. --- Gemfile | 2 +- Gemfile.lock | 22 +++++++++++++++------- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/Gemfile b/Gemfile index c1a91ec..8649166 100644 --- a/Gemfile +++ b/Gemfile @@ -24,7 +24,7 @@ group :deployment do gem 'capistrano', '~> 3.3.4' gem 'capistrano-bundler' gem 'capistrano-rails' - gem 'capistrano-postgresql', '~> 4.6.1' + gem 'capistrano-postgresql', '~> 4.6.1', :git => 'https://github.com/snake66/capistrano-postgresql/', :branch => 'use-systemdb-for-creating-users-dbs' end # Gems used only for assets and not required diff --git a/Gemfile.lock b/Gemfile.lock index 2d41d61..a28f67d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -29,6 +29,14 @@ GIT refinerycms-settings (~> 2.1.0) seo_meta (~> 1.4.0) +GIT + remote: https://github.com/snake66/capistrano-postgresql/ + revision: f8acac461b24e6f9446a071447bc3797ac110cf2 + branch: use-systemdb-for-creating-users-dbs + specs: + capistrano-postgresql (4.6.1) + capistrano (>= 3.0) + PATH remote: vendor/extensions specs: @@ -85,8 +93,6 @@ GEM capistrano-bundler (1.1.2) capistrano (~> 3.0) sshkit (~> 1.2) - capistrano-postgresql (4.6.1) - capistrano (>= 3.0) capistrano-rails (1.1.1) capistrano (~> 3.1) capistrano-bundler (~> 1.1) @@ -98,6 +104,7 @@ GEM coffee-script-source execjs coffee-script-source (1.6.2) + concurrent-ruby (1.0.5) decorators (1.0.5) railties (>= 3.0.19) devise (2.2.8) @@ -117,7 +124,8 @@ GEM activemodel (>= 3.1.0, < 4.0.0) activerecord (>= 3.1.0, < 4.0.0) hike (1.2.3) - i18n (0.7.0) + i18n (0.9.1) + concurrent-ruby (~> 1.0) journey (1.0.4) jquery-rails (2.3.0) railties (>= 3.0, < 5.0) @@ -131,7 +139,7 @@ GEM multi_json (1.11.2) net-scp (1.2.1) net-ssh (>= 2.6.5) - net-ssh (3.0.1) + net-ssh (4.2.0) orm_adapter (0.5.0) pg (0.15.1) piwik_analytics (1.0.2) @@ -166,7 +174,7 @@ GEM rake (>= 0.8.7) rdoc (~> 3.4) thor (>= 0.14.6, < 2.0) - rake (10.4.2) + rake (12.3.0) rdoc (3.12.2) json (~> 1.4) refinerycms (2.1.5) @@ -244,7 +252,7 @@ GEM rack (~> 1.0) tilt (~> 1.1, != 1.3.0) sqlite3 (1.3.11) - sshkit (1.8.1) + sshkit (1.15.1) net-scp (>= 1.1.2) net-ssh (>= 2.8.0) thor (0.19.1) @@ -269,7 +277,7 @@ DEPENDENCIES bcrypt-ruby (~> 3.0.0) capistrano (~> 3.3.4) capistrano-bundler - capistrano-postgresql (~> 4.6.1) + capistrano-postgresql (~> 4.6.1)! capistrano-rails coffee-rails (~> 3.2) jquery-rails (~> 2.3.0) -- cgit v1.2.3 From ad7591bbac5b65bdaebba795300a37fe04295cc1 Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Tue, 26 Dec 2017 14:05:09 +0100 Subject: Go back to release version of capistrano-postgresql gem again. --- Gemfile | 2 +- Gemfile.lock | 12 +++--------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/Gemfile b/Gemfile index 8649166..aefd8ef 100644 --- a/Gemfile +++ b/Gemfile @@ -24,7 +24,7 @@ group :deployment do gem 'capistrano', '~> 3.3.4' gem 'capistrano-bundler' gem 'capistrano-rails' - gem 'capistrano-postgresql', '~> 4.6.1', :git => 'https://github.com/snake66/capistrano-postgresql/', :branch => 'use-systemdb-for-creating-users-dbs' + gem 'capistrano-postgresql', '~> 4.7.0' end # Gems used only for assets and not required diff --git a/Gemfile.lock b/Gemfile.lock index a28f67d..2f177ef 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -29,14 +29,6 @@ GIT refinerycms-settings (~> 2.1.0) seo_meta (~> 1.4.0) -GIT - remote: https://github.com/snake66/capistrano-postgresql/ - revision: f8acac461b24e6f9446a071447bc3797ac110cf2 - branch: use-systemdb-for-creating-users-dbs - specs: - capistrano-postgresql (4.6.1) - capistrano (>= 3.0) - PATH remote: vendor/extensions specs: @@ -93,6 +85,8 @@ GEM capistrano-bundler (1.1.2) capistrano (~> 3.0) sshkit (~> 1.2) + capistrano-postgresql (4.7.0) + capistrano (>= 3.0) capistrano-rails (1.1.1) capistrano (~> 3.1) capistrano-bundler (~> 1.1) @@ -277,7 +271,7 @@ DEPENDENCIES bcrypt-ruby (~> 3.0.0) capistrano (~> 3.3.4) capistrano-bundler - capistrano-postgresql (~> 4.6.1)! + capistrano-postgresql (~> 4.7.0) capistrano-rails coffee-rails (~> 3.2) jquery-rails (~> 2.3.0) -- cgit v1.2.3 From 2612e429af202633bc1472a46157d8803bf7037c Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Tue, 26 Dec 2017 14:06:27 +0100 Subject: Mount Refinery under suburl if specified in environment. This is to make sure all generated url's within the application uses the correct base URL. --- config/routes.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/routes.rb b/config/routes.rb index 2eb025f..0c10b0d 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -5,7 +5,7 @@ BetaWebApp::Application.routes.draw do # If you would like to change where this extension is mounted, simply change the :at option to something different. # # We ask that you don't use the :as option here, as Refinery relies on it being the default of "refinery" - mount Refinery::Core::Engine, :at => '/' + mount Refinery::Core::Engine, at: ENV['RAILS_RELATIVE_URL_ROOT'] || '/' # The priority is based upon order of creation: # first created -> highest priority. -- cgit v1.2.3 From 4bb64a9f140266dccd9601b653c71b556f96fad7 Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Tue, 26 Dec 2017 19:43:18 +0100 Subject: Upgrade capistrano to version 3.10.1 --- Capfile | 3 +++ Gemfile | 2 +- Gemfile.lock | 11 ++++++----- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Capfile b/Capfile index 7c089aa..735eb24 100644 --- a/Capfile +++ b/Capfile @@ -18,10 +18,13 @@ require 'capistrano/deploy' # require 'capistrano/rbenv' # require 'capistrano/chruby' require 'capistrano/bundler' +require 'capistrano/scm/git' require 'capistrano/rails/assets' require 'capistrano/rails/migrations' require 'capistrano/postgresql' # require 'capistrano/passenger' +install_plugin Capistrano::SCM::Git + # Loads custom tasks from `lib/capistrano/tasks' if you have any defined. Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r } diff --git a/Gemfile b/Gemfile index aefd8ef..72fb0c0 100644 --- a/Gemfile +++ b/Gemfile @@ -21,7 +21,7 @@ end group :deployment do # Deploy with Capistrano - gem 'capistrano', '~> 3.3.4' + gem 'capistrano', '~> 3.10.0' gem 'capistrano-bundler' gem 'capistrano-rails' gem 'capistrano-postgresql', '~> 4.7.0' diff --git a/Gemfile.lock b/Gemfile.lock index 2f177ef..ad1b897 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -71,17 +71,19 @@ GEM acts-as-taggable-on (2.4.1) rails (>= 3, < 5) acts_as_indexed (0.8.3) + airbrussh (1.3.0) + sshkit (>= 1.6.1, != 1.7.0) arel (3.0.3) awesome_nested_set (2.1.6) activerecord (>= 3.0.0) babosa (1.0.2) bcrypt-ruby (3.0.1) builder (3.0.4) - capistrano (3.3.5) - capistrano-stats (~> 1.1.0) + capistrano (3.10.1) + airbrussh (>= 1.0.0) i18n rake (>= 10.0.0) - sshkit (~> 1.3) + sshkit (>= 1.9.0) capistrano-bundler (1.1.2) capistrano (~> 3.0) sshkit (~> 1.2) @@ -90,7 +92,6 @@ GEM capistrano-rails (1.1.1) capistrano (~> 3.1) capistrano-bundler (~> 1.1) - capistrano-stats (1.1.1) coffee-rails (3.2.2) coffee-script (>= 2.2.0) railties (~> 3.2.0) @@ -269,7 +270,7 @@ DEPENDENCIES SyslogLogger activerecord-postgresql-adapter bcrypt-ruby (~> 3.0.0) - capistrano (~> 3.3.4) + capistrano (~> 3.10.0) capistrano-bundler capistrano-postgresql (~> 4.7.0) capistrano-rails -- cgit v1.2.3 From 42e4eaa01504dadd3ff37fce49119ae3f156b23e Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Tue, 26 Dec 2017 19:45:43 +0100 Subject: Capistrano task for uploading puma config. --- config/deploy/templates/puma.rb.erb | 121 +++++++++++++++++++++++++++++++ lib/capistrano/tasks/configure_puma.rake | 15 ++++ 2 files changed, 136 insertions(+) create mode 100644 config/deploy/templates/puma.rb.erb create mode 100644 lib/capistrano/tasks/configure_puma.rake diff --git a/config/deploy/templates/puma.rb.erb b/config/deploy/templates/puma.rb.erb new file mode 100644 index 0000000..abc68cc --- /dev/null +++ b/config/deploy/templates/puma.rb.erb @@ -0,0 +1,121 @@ +#!/usr/bin/env puma + +# Original from: +# https://gist.githubusercontent.com/thanhhh/5610668/raw/fdfe2a865c3a0afe912c8784c971ea7ca3e64cfd/puma.rb +# Modified for heavymetal.no by Harald Eilertsen + +# Start Puma with next command: +# RAILS_ENV=production bundle exec puma -C ./config/puma.rb + +# uncomment and customize to run in non-root path +# ENV['RAILS_RELATIVE_URL_ROOT'] = "/suburl" + +application_path = '<%= fetch(:deploy_to) %>' + +# The directory to operate out of. +# +# Make it pick up the current path from capistrano deploy. +# +directory File.join(application_path, 'current') + +# Set the environment in which the rack's app will run. +# +# Pick it up from the app environment. +# +environment ENV['RACK_ENV'] + +# Daemonize the server into the background. Highly suggest that +# this be combined with “pidfile” and “stdout_redirect”. +# +# The default is “false”. +# +daemonize true + +# Store the pid of the server in the file at “path”. +# +pidfile "#{application_path}/shared/tmp/pids/puma.pid" + +# Use “path” as the file to store the server info state. This is +# used by “pumactl” to query and control the server. +# +state_path "#{application_path}/shared/tmp/pids/puma.state" + +# Redirect STDOUT and STDERR to files specified. The 3rd parameter +# (“append”) specifies whether the output is appended, the default is +# “false”. +# +stdout_redirect "#{application_path}/shared/log/puma.stdout.log", + "#{application_path}/shared/log/puma.stderr.log" + +# Disable request logging. +# +# The default is “false”. +# +# quiet + +# Configure “min” to be the minimum number of threads to use to answer +# requests and “max” the maximum. +# +# The default is “0, 16”. +# +# threads 0, 16 + +# Bind the server to “url”. “tcp://”, “unix://” and “ssl://” are the only +# accepted protocols. +# +# The default is “tcp://0.0.0.0:9292”. +# +# bind 'tcp://0.0.0.0:9292' +bind "unix://#{application_path}/shared/tmp/sockets/puma.sock" + +# Instead of “bind 'ssl://127.0.0.1:9292?key=path_to_key&cert=path_to_cert'” you +# can also use the “ssl_bind” option. +# +# ssl_bind '127.0.0.1', '9292', { key: path_to_key, cert: path_to_cert } + +# Code to run before doing a restart. This code should +# close log files, database connections, etc. +# +# This can be called multiple times to add code each time. +# +# on_restart do +# puts 'On restart...' +# end + +# Command to use to restart puma. This should be just how to +# load puma itself (ie. 'ruby -Ilib bin/puma'), not the arguments +# to puma, as those are the same as the original process. +# +# restart_command '/u/app/lolcat/bin/restart_puma' + +# === Cluster mode === + +# How many worker processes to run. +# +# The default is “0”. +# +# workers 2 + +# Code to run when a worker boots to setup the process before booting +# the app. +# +# This can be called multiple times to add hooks. +# +# on_worker_boot do +# puts 'On worker boot...' +# end + +# === Puma control rack application === + +# Start the puma control rack application on “url”. This application can +# be communicated with to control the main server. Additionally, you can +# provide an authentication token, so all requests to the control server +# will need to include that token as a query parameter. This allows for +# simple authentication. +# +# Check out https://github.com/puma/puma/blob/master/lib/puma/app/status.rb +# to see what the app has available. +# +# activate_control_app 'unix:///var/run/pumactl.sock' +# activate_control_app 'unix:///var/run/pumactl.sock', { auth_token: '12345' } +# activate_control_app 'unix:///var/run/pumactl.sock', { no_token: true } diff --git a/lib/capistrano/tasks/configure_puma.rake b/lib/capistrano/tasks/configure_puma.rake new file mode 100644 index 0000000..ccea36b --- /dev/null +++ b/lib/capistrano/tasks/configure_puma.rake @@ -0,0 +1,15 @@ +# :mode=ruby: +namespace :deploy do + desc 'Configure Puma' + task :configure_puma do + target_file = File.join(shared_path, 'config', 'puma.rb') + on roles(:app) do + unless test "[ -f #{target_file} ]" + template = ERB.new(IO.read(File.join(Dir.pwd, 'config', 'deploy', 'templates', 'puma.rb.erb'))) + upload!(StringIO.new(template.result(binding)), target_file) + end + end + end + + before 'deploy:finishing', 'deploy:generate_secret_token' +end -- cgit v1.2.3 From 2cb29eb625786458c89ab32829fbfb6215b6f89c Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Tue, 26 Dec 2017 19:46:56 +0100 Subject: Capistrano task for cold deploys. Run this for first time deploy (after setting up the database.) It loads the checked in schema instead of running through all the migrations to rebuild the database schema. The task will be skipped if the database schema already exists, and let the migrations run as normally. --- lib/capistrano/tasks/deploy_cold.rake | 42 +++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 lib/capistrano/tasks/deploy_cold.rake diff --git a/lib/capistrano/tasks/deploy_cold.rake b/lib/capistrano/tasks/deploy_cold.rake new file mode 100644 index 0000000..f91ede6 --- /dev/null +++ b/lib/capistrano/tasks/deploy_cold.rake @@ -0,0 +1,42 @@ +# Capistrano task for cold deploys +# +# Taken from: https://stackoverflow.com/a/28001351/270280 +# Licensed under cc by-sa 3.0 +# +# Generalized and fixed running with the correct environment +# by Harald Eilertsen +# +namespace :deploy do + + # + # Run this for first time deploy (after setting up the database.) It + # loads the checked in schema instead of running through all the + # migrations to rebuild the database schema. + # + # The task will be skipped if the database schema already exists, and + # let the migrations run as normally. + # + + desc "deploy app for the first time (expects pre-created but empty DB)" + task :cold do + before 'deploy:migrate', 'deploy:initdb' + invoke 'deploy' + end + + desc "initialize a brand-new database (db:schema:load, db:seed)" + task :initdb => [ :set_rails_env ] do + on primary :db do |host| + within release_path do + if test(:psql, %Q{#{fetch(:pg_database)} -U #{fetch(:pg_user)} -c "SELECT table_name FROM information_schema.tables WHERE table_schema='public' AND table_type='BASE TABLE';"|grep schema_migrations}) + puts '*** THE PRODUCTION DATABASE IS ALREADY INITIALIZED, YOU IDIOT! ***' + else + with rails_env: fetch(:rails_env) do + execute :rake, 'db:schema:load' + execute :rake, 'db:seed' + end + end + end + end + end + +end -- cgit v1.2.3 From ab9be5dd966c65f290660682d60e9f27eaaca0e4 Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Tue, 26 Dec 2017 19:52:49 +0100 Subject: Add configs for stagingtest and prodtest environments. --- config/environments/prodtest.rb | 69 ++++++++++++++++++++++++++++++++++++++ config/environments/stagingtest.rb | 67 ++++++++++++++++++++++++++++++++++++ 2 files changed, 136 insertions(+) create mode 100644 config/environments/prodtest.rb create mode 100644 config/environments/stagingtest.rb diff --git a/config/environments/prodtest.rb b/config/environments/prodtest.rb new file mode 100644 index 0000000..e39ab27 --- /dev/null +++ b/config/environments/prodtest.rb @@ -0,0 +1,69 @@ +require 'syslog/logger' + +BetaWebApp::Application.configure do + # Settings specified here will take precedence over those in config/application.rb + + # Code is not reloaded between requests + config.cache_classes = true + + # Full error reports are disabled and caching is turned on + config.consider_all_requests_local = false + config.action_controller.perform_caching = true + + # Disable Rails's static asset server (Apache or nginx will already do this) + config.serve_static_assets = false + + # Compress JavaScripts and CSS + config.assets.compress = true + + # Don't fallback to assets pipeline if a precompiled asset is missed + config.assets.compile = true + + # Generate digests for assets URLs + config.assets.digest = true + + # Defaults to nil and saved in location specified by config.assets.prefix + # config.assets.manifest = YOUR_PATH + + # Specifies the header that your server uses for sending files + # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache + # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx + + # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. + # config.force_ssl = true + + # See everything in the log (default is :info) + # config.log_level = :debug + + # Prepend all log lines with the following tags + # config.log_tags = [ :subdomain, :uuid ] + + # Use a different logger for distributed setups + config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new('hmno')) + + # Use a different cache store in production + # config.cache_store = :mem_cache_store + + # Enable serving of images, stylesheets, and JavaScripts from an asset server + # config.action_controller.asset_host = "http://assets.example.com" + + # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added) + # config.assets.precompile += %w( search.js ) + + # Disable delivery errors, bad email addresses will be ignored + # config.action_mailer.raise_delivery_errors = false + + # Enable threaded mode + # config.threadsafe! + + # Enable locale fallbacks for I18n (makes lookups for any locale fall back to + # the I18n.default_locale when a translation can not be found) + config.i18n.fallbacks = true + + # Send deprecation notices to registered listeners + config.active_support.deprecation = :notify + + # Log the query plan for queries taking more than this (works + # with SQLite, MySQL, and PostgreSQL) + # config.active_record.auto_explain_threshold_in_seconds = 0.5 +end diff --git a/config/environments/stagingtest.rb b/config/environments/stagingtest.rb new file mode 100644 index 0000000..65c0e3c --- /dev/null +++ b/config/environments/stagingtest.rb @@ -0,0 +1,67 @@ +BetaWebApp::Application.configure do + # Settings specified here will take precedence over those in config/application.rb + + # Code is not reloaded between requests + config.cache_classes = true + + # Full error reports are disabled and caching is turned on + config.consider_all_requests_local = false + config.action_controller.perform_caching = true + + # Disable Rails's static asset server (Apache or nginx will already do this) + config.serve_static_assets = false + + # Compress JavaScripts and CSS + config.assets.compress = true + + # Don't fallback to assets pipeline if a precompiled asset is missed + config.assets.compile = true + + # Generate digests for assets URLs + config.assets.digest = true + + # Defaults to nil and saved in location specified by config.assets.prefix + # config.assets.manifest = YOUR_PATH + + # Specifies the header that your server uses for sending files + # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache + # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx + + # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. + # config.force_ssl = true + + # See everything in the log (default is :info) + # config.log_level = :debug + + # Prepend all log lines with the following tags + # config.log_tags = [ :subdomain, :uuid ] + + # Use a different logger for distributed setups + # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) + + # Use a different cache store in production + # config.cache_store = :mem_cache_store + + # Enable serving of images, stylesheets, and JavaScripts from an asset server + # config.action_controller.asset_host = "http://assets.example.com" + + # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added) + # config.assets.precompile += %w( search.js ) + + # Disable delivery errors, bad email addresses will be ignored + # config.action_mailer.raise_delivery_errors = false + + # Enable threaded mode + # config.threadsafe! + + # Enable locale fallbacks for I18n (makes lookups for any locale fall back to + # the I18n.default_locale when a translation can not be found) + config.i18n.fallbacks = true + + # Send deprecation notices to registered listeners + config.active_support.deprecation = :notify + + # Log the query plan for queries taking more than this (works + # with SQLite, MySQL, and PostgreSQL) + # config.active_record.auto_explain_threshold_in_seconds = 0.5 +end -- cgit v1.2.3 From 25ae20f29cc452dcd412dda50a0421745675e094 Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Tue, 26 Dec 2017 19:53:20 +0100 Subject: vagrant: Install dependency nodejs. --- vagrant/bootstrap.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vagrant/bootstrap.sh b/vagrant/bootstrap.sh index a57d3a1..2d2dc3d 100644 --- a/vagrant/bootstrap.sh +++ b/vagrant/bootstrap.sh @@ -1,6 +1,6 @@ #!/bin/sh pkg upgrade -y -q -f -pkg install -y -q ruby rubygem-bundler postgresql93-server postgresql93-client git sqlite3 imagemagick-nox11 +pkg install -y -q ruby rubygem-bundler postgresql93-server postgresql93-client git node sqlite3 imagemagick-nox11 echo 'postgresql_enable="YES"' >> /etc/rc.conf -- cgit v1.2.3 From 1e7370fc998c64c42606b676c7003dd4bd82436b Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Sat, 30 Dec 2017 15:31:55 +0100 Subject: Make the sidebar processing more robust when there's nothing to show. --- app/helpers/sidebar_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/helpers/sidebar_helper.rb b/app/helpers/sidebar_helper.rb index e8e076a..97bb560 100644 --- a/app/helpers/sidebar_helper.rb +++ b/app/helpers/sidebar_helper.rb @@ -15,6 +15,6 @@ module SidebarHelper def page_has_side_body?(page) part = page.part_with_title("Side Body") - return part.present? && !part.body.empty? + return part.present? && !part.try(:body).try(:empty?) end end -- cgit v1.2.3 From c1bf3b1e9584d7070f2aa5ab143d02d7f88e80b4 Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Sat, 30 Dec 2017 15:44:47 +0100 Subject: use relative URLs for page parts in layout. --- app/views/layouts/application.html.erb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 6a92b7f..547013d 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -1,13 +1,13 @@ <%= render '/refinery/html_tag' %> - <% site_bar = render('/refinery/site_bar', :head => true) -%> - <%= render '/refinery/head' %> + <% site_bar = render('refinery/site_bar', :head => true) -%> + <%= render 'refinery/head' %> <%= site_bar -%> - <%= render '/refinery/ie6check' if request.env['HTTP_USER_AGENT'] =~ /MSIE/ -%> + <%= render 'refinery/ie6check' if request.env['HTTP_USER_AGENT'] =~ /MSIE/ -%>
    <%= render 'common/left_sidebar' %> @@ -16,10 +16,10 @@ <%= render 'common/right_sidebar' %>
    - <%= render '/refinery/footer' -%> + <%= render 'refinery/footer' -%>
    - <%= render '/refinery/javascripts' %> + <%= render 'refinery/javascripts' %> <%= piwik_tracking_tag %> -- cgit v1.2.3 From 0ce1d3ed2b7e7a2c57e98177eb35525beed46981 Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Sun, 31 Dec 2017 17:18:41 +0100 Subject: Use stage name to configure piwik. --- lib/capistrano/tasks/configure_piwik.rake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/capistrano/tasks/configure_piwik.rake b/lib/capistrano/tasks/configure_piwik.rake index 99c42bb..d503cb0 100644 --- a/lib/capistrano/tasks/configure_piwik.rake +++ b/lib/capistrano/tasks/configure_piwik.rake @@ -7,7 +7,7 @@ namespace :deploy do on roles(:app) do unless test "[ -f #{output_file} ]" conf = { - fetch(:rails_env) => { + fetch(:stage) => { 'piwik' => { 'id_site' => fetch(:piwik_site_id), 'url' => fetch(:piwik_url), -- cgit v1.2.3 From 9c22d9e8978b836da2fdaa3bd3d05fcff0124b91 Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Sat, 6 Jan 2018 15:49:08 +0100 Subject: Set prefix for assets in prodtest. --- config/environments/prodtest.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config/environments/prodtest.rb b/config/environments/prodtest.rb index e39ab27..0bcf9e2 100644 --- a/config/environments/prodtest.rb +++ b/config/environments/prodtest.rb @@ -25,6 +25,8 @@ BetaWebApp::Application.configure do # Defaults to nil and saved in location specified by config.assets.prefix # config.assets.manifest = YOUR_PATH + config.assets.prefix = '/beta/assets' + # Specifies the header that your server uses for sending files # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx -- cgit v1.2.3 From b93d0bf68c25d266c6106e09bafbfd565296b76a Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Sat, 6 Jan 2018 18:12:37 +0100 Subject: Allways pick up relative url for asset prefix. --- config/application.rb | 2 ++ config/environments/prodtest.rb | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config/application.rb b/config/application.rb index 7006797..d3de916 100644 --- a/config/application.rb +++ b/config/application.rb @@ -64,5 +64,7 @@ module BetaWebApp # Version of your assets, change this if you want to expire all your assets config.assets.version = '1.0' + + config.assets.prefix = "#{ENV['RAILS_RELATIVE_URL_ROOT']}/asserts" end end diff --git a/config/environments/prodtest.rb b/config/environments/prodtest.rb index 0bcf9e2..e39ab27 100644 --- a/config/environments/prodtest.rb +++ b/config/environments/prodtest.rb @@ -25,8 +25,6 @@ BetaWebApp::Application.configure do # Defaults to nil and saved in location specified by config.assets.prefix # config.assets.manifest = YOUR_PATH - config.assets.prefix = '/beta/assets' - # Specifies the header that your server uses for sending files # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx -- cgit v1.2.3 From e1b7c417707c656c5bd2a41c6fa426e7dc94e97d Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Sat, 6 Jan 2018 18:13:29 +0100 Subject: Consider relative root when matching gallery_links url to page. --- .../controllers/refinery/gallery_links/gallery_links_controller.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vendor/extensions/gallery_links/app/controllers/refinery/gallery_links/gallery_links_controller.rb b/vendor/extensions/gallery_links/app/controllers/refinery/gallery_links/gallery_links_controller.rb index c6a4e7e..8fcbdbe 100644 --- a/vendor/extensions/gallery_links/app/controllers/refinery/gallery_links/gallery_links_controller.rb +++ b/vendor/extensions/gallery_links/app/controllers/refinery/gallery_links/gallery_links_controller.rb @@ -23,10 +23,13 @@ module Refinery def find_all_gallery_links @gallery_links = GalleryLink.order('position ASC') + logger.debug "Found #{@gallery_links.length} galleries..." end def find_page - @page = ::Refinery::Page.where(:link_url => "/gallery_links").first + @page = ::Refinery::Page.where( + :link_url => "#{ENV['RAILS_RELATIVE_URL_ROOT']}/gallery_links") + .first end end -- cgit v1.2.3 From c832ed49cc39f009e3db5df8e8e40d19a6b62643 Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Sat, 6 Jan 2018 18:46:14 +0100 Subject: Typo 'asserts' => 'assets', old habits die hard. --- config/application.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/application.rb b/config/application.rb index d3de916..dbefb32 100644 --- a/config/application.rb +++ b/config/application.rb @@ -65,6 +65,6 @@ module BetaWebApp # Version of your assets, change this if you want to expire all your assets config.assets.version = '1.0' - config.assets.prefix = "#{ENV['RAILS_RELATIVE_URL_ROOT']}/asserts" + config.assets.prefix = "#{ENV['RAILS_RELATIVE_URL_ROOT']}/assets" end end -- cgit v1.2.3 From a45c1191c7d0cced2e069fe558124bb36c436828 Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Sat, 6 Jan 2018 19:08:27 +0100 Subject: Just turn off display of page side body. --- app/helpers/sidebar_helper.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/helpers/sidebar_helper.rb b/app/helpers/sidebar_helper.rb index 97bb560..ad9c6de 100644 --- a/app/helpers/sidebar_helper.rb +++ b/app/helpers/sidebar_helper.rb @@ -14,7 +14,8 @@ module SidebarHelper end def page_has_side_body?(page) - part = page.part_with_title("Side Body") - return part.present? && !part.try(:body).try(:empty?) + #part = page.part_with_title("Side Body") + #return part.present? && !part.try(:body).try(:empty?) + false end end -- cgit v1.2.3 From 774e390752950730f9110679c3baac5345bfca8e Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Sat, 6 Jan 2018 19:37:52 +0100 Subject: Add dependency to test-unit v 3.0 --- Gemfile | 2 ++ Gemfile.lock | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/Gemfile b/Gemfile index 72fb0c0..f02cadd 100644 --- a/Gemfile +++ b/Gemfile @@ -53,6 +53,8 @@ gem 'puma' # To use debugger # gem 'debugger' +gem 'test-unit', '~> 3.0' + # Refinery CMS gem 'refinerycms', '~> 2.1.0' diff --git a/Gemfile.lock b/Gemfile.lock index ad1b897..56dbe3e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -142,6 +142,7 @@ GEM activesupport rails (>= 3.0.0) polyglot (0.3.5) + power_assert (1.1.1) puma (3.9.1) rack (1.4.7) rack-cache (1.5.1) @@ -250,6 +251,8 @@ GEM sshkit (1.15.1) net-scp (>= 1.1.2) net-ssh (>= 2.8.0) + test-unit (3.2.7) + power_assert thor (0.19.1) tilt (1.4.1) treetop (1.4.15) @@ -295,6 +298,7 @@ DEPENDENCIES spork spork-testunit sqlite3 + test-unit (~> 3.0) uglifier (>= 1.0.3) BUNDLED WITH -- cgit v1.2.3 From 737c36d242339b6d678842dad4edcf17a5f4c8b9 Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Sat, 6 Jan 2018 22:10:47 +0100 Subject: Add spacing between rows in the gallery_links index. --- app/assets/stylesheets/gallery_links.scss | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/assets/stylesheets/gallery_links.scss b/app/assets/stylesheets/gallery_links.scss index ebfc852..e113a4c 100644 --- a/app/assets/stylesheets/gallery_links.scss +++ b/app/assets/stylesheets/gallery_links.scss @@ -1,9 +1,16 @@ .gallery_link { display: inline-block; width: 235px; + margin-bottom: 8mm; vertical-align: top; + header { + h1 { + font-size: 100%; + } + } + .gallery_link_meta { font-size: 80%; } -} \ No newline at end of file +} -- cgit v1.2.3 From 5e00e8d5e1d7b54bc1bebf3d3bbcffc64531733a Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Sun, 7 Jan 2018 00:06:16 +0100 Subject: Set width of gallery_link to same as image. --- app/assets/stylesheets/gallery_links.scss | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/assets/stylesheets/gallery_links.scss b/app/assets/stylesheets/gallery_links.scss index e113a4c..5556db6 100644 --- a/app/assets/stylesheets/gallery_links.scss +++ b/app/assets/stylesheets/gallery_links.scss @@ -1,8 +1,11 @@ .gallery_link { display: inline-block; - width: 235px; - margin-bottom: 8mm; + width: 225px; vertical-align: top; + margin: { + bottom: 8mm; + right: 10mm; + } header { h1 { -- cgit v1.2.3 From a43ed4dcf9173a6faadf260fb1bd93aa2d391257 Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Sun, 7 Jan 2018 00:16:03 +0100 Subject: Drop margin around image in gallery_links. --- app/assets/stylesheets/gallery_links.scss | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/assets/stylesheets/gallery_links.scss b/app/assets/stylesheets/gallery_links.scss index 5556db6..305d484 100644 --- a/app/assets/stylesheets/gallery_links.scss +++ b/app/assets/stylesheets/gallery_links.scss @@ -11,6 +11,9 @@ h1 { font-size: 100%; } + img { + margin: 0; + } } .gallery_link_meta { -- cgit v1.2.3 From 41b0d6bc69e3b0f751290b442e2f171a0ae8090d Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Sun, 7 Jan 2018 17:12:47 +0100 Subject: Split GalleryLink header into date, venue and bands. --- app/assets/stylesheets/gallery_links.scss | 10 ++++--- ...with_date_bands_venue.refinery_gallery_links.rb | 32 ++++++++++++++++++++++ .../models/refinery/gallery_links/gallery_link.rb | 9 ++++-- .../admin/gallery_links/_form.html.erb | 14 ++++++++-- .../gallery_links/gallery_links/index.html.erb | 14 ++++++++-- .../2_replace_title_with_date_bands_venue.rb | 31 +++++++++++++++++++++ 6 files changed, 100 insertions(+), 10 deletions(-) create mode 100644 db/migrate/20180107152351_replace_title_with_date_bands_venue.refinery_gallery_links.rb create mode 100644 vendor/extensions/gallery_links/db/migrate/2_replace_title_with_date_bands_venue.rb diff --git a/app/assets/stylesheets/gallery_links.scss b/app/assets/stylesheets/gallery_links.scss index 305d484..302fd3e 100644 --- a/app/assets/stylesheets/gallery_links.scss +++ b/app/assets/stylesheets/gallery_links.scss @@ -10,12 +10,14 @@ header { h1 { font-size: 100%; + margin-bottom: 0; } - img { - margin: 0; - } - } + margin-bottom: 2mm; + } + img { + margin: 0; + } .gallery_link_meta { font-size: 80%; } diff --git a/db/migrate/20180107152351_replace_title_with_date_bands_venue.refinery_gallery_links.rb b/db/migrate/20180107152351_replace_title_with_date_bands_venue.refinery_gallery_links.rb new file mode 100644 index 0000000..8e2fcbd --- /dev/null +++ b/db/migrate/20180107152351_replace_title_with_date_bands_venue.refinery_gallery_links.rb @@ -0,0 +1,32 @@ +# This migration comes from refinery_gallery_links (originally 2) +class ReplaceTitleWithDateBandsVenue < ActiveRecord::Migration + def up + add_column :refinery_gallery_links, :date, :date, null: false, default: '0000-00-00', index: true + add_column :refinery_gallery_links, :bands, :string, null: false, default: 'Unkown bands', index: true + add_column :refinery_gallery_links, :venue, :string, index: true + + Refinery::GalleryLinks::GalleryLink.all.each do |g| + m = g.title.match /^(.+) (\d{2}\/\d{2}\/\d{2}) @ ([^.]+).$/ + g.date = Date.strptime(m[2], '%d/%m/%y') + g.bands = m[1] + g.venue = m[3] + + g.save! + end + + remove_column :refinery_gallery_links, :title + end + + def down + add_column :refineru_gallery_links, title, index: true + + Refinery::GalleryLinks::GalleryLink.all.each do |g| + g.title = "#{g.bands} #{g.strftime('%d/%m/%y')} @ #{g.venue}." + g.save! + end + + remove_column :refinery_gallery_links, :venue + remove_column :refinery_gallery_links, :bands + remove_column :refinery_gallery_links, :date + end +end diff --git a/vendor/extensions/gallery_links/app/models/refinery/gallery_links/gallery_link.rb b/vendor/extensions/gallery_links/app/models/refinery/gallery_links/gallery_link.rb index e275fb2..0c7a204 100644 --- a/vendor/extensions/gallery_links/app/models/refinery/gallery_links/gallery_link.rb +++ b/vendor/extensions/gallery_links/app/models/refinery/gallery_links/gallery_link.rb @@ -5,9 +5,14 @@ module Refinery belongs_to :image, class_name: ::Refinery::Image - attr_accessible :title, :url, :photographer, :description, :image_id, :position + attr_accessible :date, :bands, :venue, :url, :photographer, :description, :image_id, :position - validates :title, :presence => true, :uniqueness => true + validates :date, :presence => true + validates :bands, :presence => true + + def title + "#{date.try(:strftime, '%d/%m/%y')}: #{bands} @ #{venue}" + end end end end diff --git a/vendor/extensions/gallery_links/app/views/refinery/gallery_links/admin/gallery_links/_form.html.erb b/vendor/extensions/gallery_links/app/views/refinery/gallery_links/admin/gallery_links/_form.html.erb index 1ec8b93..ba872b7 100644 --- a/vendor/extensions/gallery_links/app/views/refinery/gallery_links/admin/gallery_links/_form.html.erb +++ b/vendor/extensions/gallery_links/app/views/refinery/gallery_links/admin/gallery_links/_form.html.erb @@ -4,8 +4,18 @@ :include_object_name => true %>
    - <%= f.label :title -%> - <%= f.text_field :title, :class => 'larger widest' -%> + <%= f.label :date -%> + <%= f.date_select :date -%> +
    + +
    + <%= f.label :bands -%> + <%= f.text_field :bands, class: 'larger wider' -%> +
    + +
    + <%= f.label :venue -%> + <%= f.text_field :venue -%>
    diff --git a/vendor/extensions/gallery_links/app/views/refinery/gallery_links/gallery_links/index.html.erb b/vendor/extensions/gallery_links/app/views/refinery/gallery_links/gallery_links/index.html.erb index e9121d6..baad049 100644 --- a/vendor/extensions/gallery_links/app/views/refinery/gallery_links/gallery_links/index.html.erb +++ b/vendor/extensions/gallery_links/app/views/refinery/gallery_links/gallery_links/index.html.erb @@ -3,11 +3,21 @@ <% @gallery_links.each do |g| %>