diff options
66 files changed, 1578 insertions, 26 deletions
@@ -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 } @@ -21,10 +21,10 @@ 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.6.1' + gem 'capistrano-postgresql', '~> 4.7.0' end # Gems used only for assets and not required @@ -53,6 +53,8 @@ gem 'puma' # To use debugger # gem 'debugger' +gem 'test-unit', '~> 3.0' + # Refinery CMS gem 'refinerycms', '~> 2.1.0' @@ -66,6 +68,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/Gemfile.lock b/Gemfile.lock index ec3b52a..56dbe3e 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: @@ -65,26 +71,27 @@ 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) - capistrano-postgresql (4.6.1) + capistrano-postgresql (4.7.0) capistrano (>= 3.0) 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) @@ -92,6 +99,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) @@ -111,7 +119,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) @@ -125,7 +134,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) @@ -133,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) @@ -160,7 +170,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) @@ -238,9 +248,11 @@ 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) + test-unit (3.2.7) + power_assert thor (0.19.1) tilt (1.4.1) treetop (1.4.15) @@ -261,9 +273,9 @@ DEPENDENCIES SyslogLogger activerecord-postgresql-adapter bcrypt-ruby (~> 3.0.0) - capistrano (~> 3.3.4) + capistrano (~> 3.10.0) capistrano-bundler - capistrano-postgresql (~> 4.6.1) + capistrano-postgresql (~> 4.7.0) capistrano-rails coffee-rails (~> 3.2) jquery-rails (~> 2.3.0) @@ -275,6 +287,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) @@ -285,6 +298,7 @@ DEPENDENCIES spork spork-testunit sqlite3 + test-unit (~> 3.0) uglifier (>= 1.0.3) BUNDLED WITH diff --git a/Vagrantfile b/Vagrantfile index d24ce9d..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/ vendor/bundle/] + config.vm.synced_folder ".", "/vagrant", type: "rsync", rsync__exclude: %w[.git/ db/*.sqlite3 public/system/ vendor/bundle/] end 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..302fd3e --- /dev/null +++ b/app/assets/stylesheets/gallery_links.scss @@ -0,0 +1,24 @@ +.gallery_link { + display: inline-block; + width: 225px; + vertical-align: top; + margin: { + bottom: 8mm; + right: 10mm; + } + + header { + h1 { + font-size: 100%; + margin-bottom: 0; + } + + margin-bottom: 2mm; + } + img { + margin: 0; + } + .gallery_link_meta { + font-size: 80%; + } +} diff --git a/app/helpers/sidebar_helper.rb b/app/helpers/sidebar_helper.rb index e8e076a..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.body.empty? + #part = page.part_with_title("Side Body") + #return part.present? && !part.try(:body).try(:empty?) + false end end 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 @@ <!DOCTYPE html> <%= 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' %> <body> <%= site_bar -%> - <%= render '/refinery/ie6check' if request.env['HTTP_USER_AGENT'] =~ /MSIE/ -%> + <%= render 'refinery/ie6check' if request.env['HTTP_USER_AGENT'] =~ /MSIE/ -%> <div id="page_container"> <header id="header"> - <%= render '/refinery/header' -%> + <%= render 'refinery/header' -%> </header> <section id="page"> <%= render 'common/left_sidebar' %> @@ -16,10 +16,10 @@ <%= render 'common/right_sidebar' %> </section> <footer> - <%= render '/refinery/footer' -%> + <%= render 'refinery/footer' -%> </footer> </div> - <%= render '/refinery/javascripts' %> + <%= render 'refinery/javascripts' %> <%= piwik_tracking_tag %> </body> </html> diff --git a/config/application.rb b/config/application.rb index 7006797..dbefb32 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']}/assets" end end 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 <haraldei@anduin.net> + +# 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/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 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. 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/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..2f79338 --- /dev/null +++ b/db/migrate/20180107152351_replace_title_with_date_bands_venue.refinery_gallery_links.rb @@ -0,0 +1,38 @@ +# 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: '2000-01-01', 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}) @ ([^.]+).$/ + if m + g.date = Date.strptime(m[2], '%d/%m/%y') + g.bands = m[1] + g.venue = m[3] + else + g.date = Date.today + g.bands = g.title + g.venue = nil + end + + 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/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 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), 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 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 diff --git a/vagrant/bootstrap.sh b/vagrant/bootstrap.sh index 3d6570f..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 node +pkg install -y -q ruby rubygem-bundler postgresql93-server postgresql93-client git node sqlite3 imagemagick-nox11 echo 'postgresql_enable="YES"' >> /etc/rc.conf diff --git a/vendor/extensions/gallery_links/.gitignore b/vendor/extensions/gallery_links/.gitignore new file mode 100644 index 0000000..627b10e --- /dev/null +++ b/vendor/extensions/gallery_links/.gitignore @@ -0,0 +1 @@ +vendor/bundle 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..8fcbdbe --- /dev/null +++ b/vendor/extensions/gallery_links/app/controllers/refinery/gallery_links/gallery_links_controller.rb @@ -0,0 +1,37 @@ +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') + logger.debug "Found #{@gallery_links.length} galleries..." + end + + def find_page + @page = ::Refinery::Page.where( + :link_url => "#{ENV['RAILS_RELATIVE_URL_ROOT']}/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..0c7a204 --- /dev/null +++ b/vendor/extensions/gallery_links/app/models/refinery/gallery_links/gallery_link.rb @@ -0,0 +1,18 @@ +module Refinery + module GalleryLinks + class GalleryLink < Refinery::Core::BaseModel + self.table_name = 'refinery_gallery_links' + + belongs_to :image, class_name: ::Refinery::Image + + attr_accessible :date, :bands, :venue, :url, :photographer, :description, :image_id, :position + + 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/_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 @@ +<ul> + <% if ::Refinery::GalleryLinks::Admin::GalleryLinksController.searchable? %> + <li> + <%= render '/refinery/admin/search', :url => refinery.gallery_links_admin_gallery_links_path %> + </li> + <% end %> + <li> + <%= link_to t('.create_new'), refinery.new_gallery_links_admin_gallery_link_path, + :class => "add_icon" %> + </li> +<% if !searching? && ::Refinery::GalleryLinks::Admin::GalleryLinksController.sortable? && ::Refinery::GalleryLinks::GalleryLink.many? %> + <li> + <%= link_to t('.reorder', :what => "Gallery Links"), + refinery.gallery_links_admin_gallery_links_path, + :id => "reorder_action", + :class => "reorder_icon" %> + + <%= link_to t('.reorder_done', :what => "Gallery Links"), + refinery.gallery_links_admin_gallery_links_path, + :id => "reorder_action_done", + :style => "display: none;", + :class => "reorder_icon" %> + </li> +<% end %> +</ul> 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..ba872b7 --- /dev/null +++ b/vendor/extensions/gallery_links/app/views/refinery/gallery_links/admin/gallery_links/_form.html.erb @@ -0,0 +1,60 @@ +<%= form_for [refinery, :gallery_links_admin, @gallery_link] do |f| -%> + <%= render '/refinery/admin/error_messages', + :object => @gallery_link, + :include_object_name => true %> + + <div class='field'> + <%= f.label :date -%> + <%= f.date_select :date -%> + </div> + + <div class='field'> + <%= f.label :bands -%> + <%= f.text_field :bands, class: 'larger wider' -%> + </div> + + <div class='field'> + <%= f.label :venue -%> + <%= f.text_field :venue -%> + </div> + + <div class='field'> + <%= f.label :url -%> + <%= f.text_field :url -%> + </div> + + <div class='field'> + <%= f.label :photographer -%> + <%= f.text_field :photographer -%> + </div> + + <div class='field'> + <%= render '/refinery/admin/wysiwyg', + :f => f, + :fields => [:description], + :object => "gallery_links/gallery_link" -%> + </div> + + <div class='field'> + <%= f.label :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 -%> + </div> + + <%= 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 -%> + <script> + $(document).ready(function(){ + page_options.init(false, '', ''); + }); + </script> +<% 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 @@ +<li class='clearfix record <%= cycle("on", "on-hover") %>' id="<%= dom_id(gallery_link) -%>"> + <span class='title'> + <%= gallery_link.title %> + + </span> + <span class='actions'> + + <%= 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 %> + </span> +</li> 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 %> +<div class='pagination_container'> + <% if @gallery_links.any? %> + <%= render 'gallery_links' %> + <% else %> + <p> + <% unless searching? %> + <strong> + <%= t('.no_items_yet') %> + </strong> + <% else %> + <%= t('no_results', :scope => 'refinery.admin.search') %> + <% end %> + </p> + <% end %> +</div> 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 @@ +<ul id='sortable_list'> + <%= render :partial => 'gallery_link', :collection => @gallery_links %> +</ul> +<%= 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 @@ +<section id='records'> + <%= render 'records' %> +</section> +<aside id='actions'> + <%= render 'actions' %> +</aside> +<%= 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..baad049 --- /dev/null +++ b/vendor/extensions/gallery_links/app/views/refinery/gallery_links/gallery_links/index.html.erb @@ -0,0 +1,47 @@ +<% content_for :body do %> + <section id="gallery_links"> + <% @gallery_links.each do |g| %> + <article class="gallery_link" id="gallery_link_<%= g.id %>"> + <header> + <div class="gallery_link_meta"> + <time datetime="<%= g.date.xmlschema %>"> + <%= l(g.date) %> + </time> + </div> + <h1> + <%= link_to g.bands, g.url %> + </h1> + <div class="gallery_link_meta"> + <%= g.venue %> + </div> + </header> + <section class="gallery_link_preview"> + <%= link_to image_tag(g.image.thumbnail(:medium).url), g.url %> + </section> + <section class="gallery_link_description"> + <%=raw g.description %> + </section> + <section class="gallery_link_meta"> + <div> + <span class="gallery_link_label"> + <%= t('.photographer') %>: + </span> + <span class="gallery_link_photographer"> + <%= g.photographer %> + </span> + </div> + <div> + <span class="gallery_link_label"> + <%= t('.created') %>: + </span> + <time datetime="<%= g.created_at %>"> + <%= l(g.created_at) %> + </time> + </div> + </section> + </article> + <% end %> + </section> +<% 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 %> + <section> + <h1>Title</h1> + <p> + <%=raw @gallery_link.title %> + </p> + </section> + <section> + <h1>Url</h1> + <p> + <%=raw @gallery_link.url %> + </p> + </section> + <section> + <h1>Photographer</h1> + <p> + <%=raw @gallery_link.photographer %> + </p> + </section> + <section> + <h1>Description</h1> + <p> + <%=raw @gallery_link.description %> + </p> + </section> + <section> + <h1>Image</h1> + <p> + <%=raw @gallery_link.image_id %> + </p> + </section> +<% end %> + +<% content_for :side_body do %> + <aside> + <h2><%= t('.other') %></h2> + <ul id="gallery_links"> + <% @gallery_links.each do |gallery_link| %> + <li> + <%= link_to gallery_link.title, refinery.gallery_links_gallery_link_path(gallery_link) %> + </li> + <% end %> + </ul> + </aside> +<% 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..880b973 --- /dev/null +++ b/vendor/extensions/gallery_links/config/locales/cs.yml @@ -0,0 +1,34 @@ +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<br/><em>(otevře se v novém okně)</em> + edit: Upravit gallery link + delete: Smazat gallery link + gallery_links: + show: + other: Další Gallery Links + index: + photographer: Photographer + created: Created + 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..8715d2d --- /dev/null +++ b/vendor/extensions/gallery_links/config/locales/en.yml @@ -0,0 +1,34 @@ +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 <br/><em>(opens in a new window)</em> + edit: Edit this gallery link + delete: Remove this gallery link forever + gallery_links: + show: + other: Other Gallery Links + index: + photographer: Photographer + created: Created + 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..4f8ca9d --- /dev/null +++ b/vendor/extensions/gallery_links/config/locales/es.yml @@ -0,0 +1,35 @@ +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 <br/><em>(abre en ventana nueva)</em> + edit: Editar este gallery link + delete: Borrar este gallery link para siempre + gallery_links: + show: + other: Otros gallery links + index: + photographer: Photographer + created: Created + 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..cc8e329 --- /dev/null +++ b/vendor/extensions/gallery_links/config/locales/fr.yml @@ -0,0 +1,34 @@ +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 <br/><em>(Ouvre une nouvelle fenêtre)</em> + edit: Modifier ce(t/tte) gallery link + delete: Supprimer définitivement ce(t/tte) gallery link + gallery_links: + show: + other: Autres Gallery Links + index: + photographer: Photographer + created: Created + 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..a08c218 --- /dev/null +++ b/vendor/extensions/gallery_links/config/locales/it.yml @@ -0,0 +1,34 @@ +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 <br/><em>(apre una nuova finestra)</em> + edit: Modifica questo gallery link + delete: Rimuovi per sempre questo gallery link + gallery_links: + show: + other: Altri Gallery Links + index: + photographer: Photographer + created: Created + 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..cb1dd6b --- /dev/null +++ b/vendor/extensions/gallery_links/config/locales/nb.yml @@ -0,0 +1,34 @@ +nb: + refinery: + plugins: + gallery_links: + title: Gallerier + gallery_links: + admin: + gallery_links: + actions: + create_new: Lag et nytt galleri + reorder: Endre rekkefølgen på galleriene + reorder_done: Ferdig å endre rekkefølgen på galleriene + records: + title: Gallerier + sorry_no_results: Beklager! Vi fant ikke noen resultater. + 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 dette galleriet ser ut offentlig <br/><em>(åpner i et nytt vindu)</em> + edit: Rediger dette galleriet + delete: Fjern dette galleret + gallery_links: + show: + other: Andre gallerier + index: + photographer: Fotograf + created: Lastet opp + activerecord: + attributes: + 'refinery/gallery_links/gallery_link': + title: Tittel + url: Lenke + photographer: Fotograf + description: Beskrivelse + image_id: Bilde
\ 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..3b81530 --- /dev/null +++ b/vendor/extensions/gallery_links/config/locales/nl.yml @@ -0,0 +1,34 @@ +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 <br/><em>(opent in een nieuw venster)</em> + edit: Bewerk deze gallery link + delete: Deze gallery link definitief verwijderen + gallery_links: + show: + other: Andere Gallery Links + index: + photographer: Photographer + created: Created + 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..b875c91 --- /dev/null +++ b/vendor/extensions/gallery_links/config/locales/sk.yml @@ -0,0 +1,34 @@ +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<br/><em>(otvorí sa v novom okne)</em> + edit: Upraviť gallery link + delete: Zmazať gallery link + gallery_links: + show: + other: Daľšie Gallery Links + index: + photographer: Photographer + created: Created + 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..62a0ab4 --- /dev/null +++ b/vendor/extensions/gallery_links/config/locales/tr.yml @@ -0,0 +1,34 @@ +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 <br/><em>(yeni bir pencerede acar)</em> + edit: Bunu Duzenle gallery link + delete: Bunu Sil gallery link sonsuza dek + gallery_links: + show: + other: Diger Gallery Links + index: + photographer: Photographer + created: Created + 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..7d21989 --- /dev/null +++ b/vendor/extensions/gallery_links/config/locales/zh-CN.yml @@ -0,0 +1,36 @@ +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 的最新内容.<br/><em>(新窗口中打开)</em> + edit: 编辑 gallery link + delete: 永久删除 gallery link + gallery_links: + show: + other: 其他 Gallery Links + index: + photographer: Photographer + created: Created + 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/migrate/2_replace_title_with_date_bands_venue.rb b/vendor/extensions/gallery_links/db/migrate/2_replace_title_with_date_bands_venue.rb new file mode 100644 index 0000000..87492b6 --- /dev/null +++ b/vendor/extensions/gallery_links/db/migrate/2_replace_title_with_date_bands_venue.rb @@ -0,0 +1,37 @@ +class ReplaceTitleWithDateBandsVenue < ActiveRecord::Migration + def up + add_column :refinery_gallery_links, :date, :date, null: false, default: '2000-01-01', index: true + add_column :refinery_gallery_links, :bands, :string, null: false, default: 'Unknown 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}) @ ([^.]+).$/ + if m + g.date = Date.strptime(m[2], '%d/%m/%y') + g.bands = m[1] + g.venue = m[3] + else + g.date = Date.today + g.bands = g.title + g.venue = nil + end + + 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/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..be39428 --- /dev/null +++ b/vendor/extensions/gallery_links/refinerycms-gallery_links.gemspec @@ -0,0 +1,21 @@ +# 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 <haraldei@anduin.net>'] + 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' + s.add_development_dependency 'rake', '~> 11.1.0' +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 |