aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/assets/stylesheets/gallery_links.scss10
-rw-r--r--db/migrate/20180107152351_replace_title_with_date_bands_venue.refinery_gallery_links.rb32
-rw-r--r--vendor/extensions/gallery_links/app/models/refinery/gallery_links/gallery_link.rb9
-rw-r--r--vendor/extensions/gallery_links/app/views/refinery/gallery_links/admin/gallery_links/_form.html.erb14
-rw-r--r--vendor/extensions/gallery_links/app/views/refinery/gallery_links/gallery_links/index.html.erb14
-rw-r--r--vendor/extensions/gallery_links/db/migrate/2_replace_title_with_date_bands_venue.rb31
6 files changed, 100 insertions, 10 deletions
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 %>
<div class='field'>
- <%= f.label :title -%>
- <%= f.text_field :title, :class => 'larger widest' -%>
+ <%= 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'>
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| %>
<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.title, g.url %>
+ <%= link_to g.bands, g.url %>
</h1>
- <%= link_to image_tag(g.image.thumbnail(:medium).url), g.url %>
+ <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>
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..d53125d
--- /dev/null
+++ b/vendor/extensions/gallery_links/db/migrate/2_replace_title_with_date_bands_venue.rb
@@ -0,0 +1,31 @@
+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: '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}) @ ([^.]+).$/
+ 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