work in progress

This commit is contained in:
Thomas Blazek
2015-01-16 00:03:09 +01:00
parent 978d923082
commit 75667ae6ce
6 changed files with 41 additions and 27 deletions

View File

@@ -1,6 +1,13 @@
@import 'blueimp-gallery-all';
.left
{
float: left;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
/* etc. */
}
h1 {
font-size: 23px
}

View File

@@ -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

View File

@@ -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}%")}

View File

@@ -1,11 +1,20 @@
<%= semantic_form_for @gallery do |f| %>
<%= f.inputs do %>
<%= f.input :name %>
<%= f.input :desc %>
<%= f.input :datum %>
<% end %>
<div class="container-fluid">
<div class="fluid-row">
<div class="span4">
<%= 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+"<br>".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 %>
</div>
</div>
<%= @fotos_old %>
</div>