diff --git a/app/assets/stylesheets/layout.css.scss b/app/assets/stylesheets/layout.css.scss index c0827a1..6c63179 100755 --- a/app/assets/stylesheets/layout.css.scss +++ b/app/assets/stylesheets/layout.css.scss @@ -1,6 +1,13 @@ @import 'blueimp-gallery-all'; - +.left +{ + float: left; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + /* etc. */ +} h1 { font-size: 23px } diff --git a/app/controllers/galleries_controller.rb b/app/controllers/galleries_controller.rb index 7745872..c68fe1d 100644 --- a/app/controllers/galleries_controller.rb +++ b/app/controllers/galleries_controller.rb @@ -18,7 +18,7 @@ class GalleriesController < ApplicationController # GET /galleries/1.json def show @gallery = Gallery.find(params[:id]) - + @pppage_array = [ 25 , 50 , 100 ] #defines number & size of picture chunks @pppage = 0 #starting index of pppage_array @@ -56,6 +56,7 @@ class GalleriesController < ApplicationController # GET /galleries/1/edit def edit @gallery = Gallery.find(params[:id]) + @fotos_old = @gallery.fotos end # POST /galleries @@ -81,6 +82,10 @@ class GalleriesController < ApplicationController @foto = Foto.new respond_to do |format| if @gallery.update_attributes(params[:gallery]) + + Foto.where(:gallery_id=>nil).each do |tbd| + tbd.destroy + end format.html { redirect_to @gallery, notice: 'Gallery was successfully updated.' } format.json { head :no_content } else diff --git a/app/models/gallery.rb b/app/models/gallery.rb index 7c2079e..9371f2d 100644 --- a/app/models/gallery.rb +++ b/app/models/gallery.rb @@ -12,7 +12,7 @@ class Gallery < ActiveRecord::Base WORD_COUNT = 20 - attr_accessible :datum, :desc, :name + attr_accessible :datum, :desc, :name, :foto_ids has_many :fotos has_many :nlinks, as: :link # scope :search, ->(query) {where("name like ? or galleries.desc like ?", "%#{query}%", "%#{query}%")} diff --git a/app/views/galleries/_form.html.erb b/app/views/galleries/_form.html.erb index 6322dc2..9a63688 100644 --- a/app/views/galleries/_form.html.erb +++ b/app/views/galleries/_form.html.erb @@ -1,11 +1,20 @@ -<%= semantic_form_for @gallery do |f| %> - <%= f.inputs do %> - <%= f.input :name %> - <%= f.input :desc %> - <%= f.input :datum %> - <% end %> +