From 75667ae6ceb1f4ec56240fa4a40c000832d06db7 Mon Sep 17 00:00:00 2001 From: Thomas Blazek Date: Fri, 16 Jan 2015 00:03:09 +0100 Subject: [PATCH] work in progress --- app/assets/stylesheets/layout.css.scss | 9 +++++++- app/controllers/galleries_controller.rb | 7 +++++- app/models/gallery.rb | 2 +- app/views/galleries/_form.html.erb | 29 ++++++++++++++++--------- config/sunspot.yml | 7 +++--- solr/conf/schema.xml | 14 ++++-------- 6 files changed, 41 insertions(+), 27 deletions(-) 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 %> +
+
+
+ <%= semantic_form_for @gallery do |f| %> + <%= f.inputs do %> + <%= f.input :name %> + <%= f.input :desc %> + <%= f.input :datum %> + <%= f.input :fotos,:label=>"test", :as=>:check_boxes, :member_label =>Proc.new{|u| u.title.html_safe+"
".html_safe+image_tag(u.datei.thumb.url,{:class=>"img-polaroid img-rounded"})}, :wrapper_html => {:class => "left"}%> + <% end %> - <%= f.actions do %> - <%= f.action :submit, :as => :input %> - <% end %> -<% end %> + <%= f.actions do %> + <%= f.action :submit, :as => :input %> + <% end %> + <% end %> +
+ +
+ <%= @fotos_old %> +
diff --git a/config/sunspot.yml b/config/sunspot.yml index cef12a4..5e81092 100644 --- a/config/sunspot.yml +++ b/config/sunspot.yml @@ -1,10 +1,9 @@ production: solr: hostname: localhost - port: 8080 + port: 8983 log_level: WARNING - path: /solr-4.10.2/default #production #ollection1 #production -# solr_home: solr + path: /solr/production # read_timeout: 2 # open_timeout: 0.5 @@ -21,4 +20,4 @@ test: port: 8981 log_level: WARNING path: /solr/test - + \ No newline at end of file diff --git a/solr/conf/schema.xml b/solr/conf/schema.xml index 8da24f2..adcb9a8 100644 --- a/solr/conf/schema.xml +++ b/solr/conf/schema.xml @@ -60,17 +60,11 @@ - - + + + - - - - - - - - +