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. --- .../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 ++++++++++++++++++++++ 4 files changed, 62 insertions(+), 6 deletions(-) create mode 100644 vendor/extensions/gallery_links/db/migrate/2_replace_title_with_date_bands_venue.rb (limited to 'vendor/extensions/gallery_links') 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| %>