fotogallery
This commit is contained in:
@@ -44,8 +44,8 @@ class FotosController < ApplicationController
|
|||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
if @foto.save
|
if @foto.save
|
||||||
format.html { redirect_to @foto, notice: 'Foto was successfully created.' }
|
format.html { redirect_to gallery_foto_path(@foto.gallery,@foto), notice: 'Foto was successfully created.' }
|
||||||
format.json { render json: @foto, status: :created, location: @foto }
|
format.json { render json: gallery_foto_path(@foto.gallery,@foto), status: :created, location: @foto }
|
||||||
else
|
else
|
||||||
format.html { render action: "new" }
|
format.html { render action: "new" }
|
||||||
format.json { render json: @foto.errors, status: :unprocessable_entity }
|
format.json { render json: @foto.errors, status: :unprocessable_entity }
|
||||||
@@ -60,7 +60,7 @@ class FotosController < ApplicationController
|
|||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
if @foto.update_attributes(params[:foto])
|
if @foto.update_attributes(params[:foto])
|
||||||
format.html { redirect_to @foto, notice: 'Foto was successfully updated.' }
|
format.html { redirect_to gallery_foto_path(@foto.gallery,@foto), notice: 'Foto was successfully updated.' }
|
||||||
format.json { head :no_content }
|
format.json { head :no_content }
|
||||||
else
|
else
|
||||||
format.html { render action: "edit" }
|
format.html { render action: "edit" }
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
class Foto < ActiveRecord::Base
|
class Foto < ActiveRecord::Base
|
||||||
attr_accessible :datei, :desc, :gallery_id, :title
|
attr_accessible :datei, :desc, :gallery_id, :title
|
||||||
|
belongs_to :gallery
|
||||||
|
mount_uploader :datei, FotoUploader
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
class Gallery < ActiveRecord::Base
|
class Gallery < ActiveRecord::Base
|
||||||
attr_accessible :datum, :desc, :name
|
attr_accessible :datum, :desc, :name
|
||||||
|
has_many :fotos
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,25 +1,31 @@
|
|||||||
<p id="notice"><%= notice %></p>
|
|
||||||
|
|
||||||
|
<div class="container-fluid">
|
||||||
|
|
||||||
|
|
||||||
|
<div class="row-fluid">
|
||||||
|
<div class="span12">
|
||||||
|
<%= link_to image_tag(@foto.datei.resized.url), gallery_foto_path(@foto.gallery, ((@foto.gallery.fotos[@foto.gallery.fotos.index(@foto)+1].nil?) ? (@foto.gallery.fotos[0].try(:id).to_i) : @foto.gallery.fotos[@foto.gallery.fotos.index(@foto)+1].try(:id).to_i) ) %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row-fluid">
|
||||||
|
<div class="span9">
|
||||||
|
<h2><%= @foto.title %></h2>
|
||||||
|
<p><%= @foto.desc %></p>
|
||||||
|
</div>
|
||||||
|
<div class="span3">
|
||||||
<p>
|
<p>
|
||||||
<b>Title:</b>
|
<%= link_to 'last' , gallery_foto_path(@foto.gallery, @foto.gallery.fotos[@foto.gallery.fotos.index(@foto)-1].try(:id).to_i) unless @foto.gallery.fotos.index(@foto)==0 %>
|
||||||
<%= @foto.title %>
|
<%= link_to 'next' , gallery_foto_path(@foto.gallery, @foto.gallery.fotos[@foto.gallery.fotos.index(@foto)+1].try(:id).to_i) unless @foto.gallery.fotos[@foto.gallery.fotos.index(@foto)+1].nil? %>
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
<b>Desc:</b>
|
|
||||||
<%= @foto.desc %>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
<b>Gallery:</b>
|
|
||||||
<%= @foto.gallery_id %>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
<b>Datei:</b>
|
|
||||||
<%= @foto.datei %>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
|
|
||||||
<%= link_to 'Edit', edit_foto_path(@foto) %> |
|
<%= link_to 'Edit', edit_foto_path(@foto) %> |
|
||||||
<%= link_to 'Back', fotos_path %>
|
<%= link_to 'Back', gallery_path(@foto.gallery) %>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row-fluid">
|
||||||
|
<div class="span12">
|
||||||
|
<p id="notice"><%= notice %></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,14 @@
|
|||||||
<b>Datum:</b>
|
<b>Datum:</b>
|
||||||
<%= @gallery.datum %>
|
<%= @gallery.datum %>
|
||||||
</p>
|
</p>
|
||||||
|
<% @gallery.fotos.each do |f| %>
|
||||||
|
<%= link_to image_tag(f.datei.big_thumb.url,{:class=>"img-polaroid"}) , gallery_foto_path(@gallery,f) %>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
|
||||||
|
<%= link_to 'NewFoto' , new_gallery_foto_path(@gallery) %> |
|
||||||
<%= link_to 'Edit', edit_gallery_path(@gallery) %> |
|
<%= link_to 'Edit', edit_gallery_path(@gallery) %> |
|
||||||
<%= link_to 'Back', galleries_path %>
|
<%= link_to 'Back', galleries_path %>
|
||||||
|
|||||||
@@ -36,8 +36,10 @@
|
|||||||
get 'verwalten/studien', :controller=>:studien, :action=>:verwalten, :as=>'studien_verwalten'
|
get 'verwalten/studien', :controller=>:studien, :action=>:verwalten, :as=>'studien_verwalten'
|
||||||
|
|
||||||
resources :fetzneditions
|
resources :fetzneditions
|
||||||
resources :fotos
|
resources :fotos, :except=>[:new, :show]
|
||||||
resources :galleries
|
resources :galleries do
|
||||||
|
resources :fotos, :only=>[:new,:show]
|
||||||
|
end
|
||||||
resources :memberships
|
resources :memberships
|
||||||
resources :gremien
|
resources :gremien
|
||||||
resources :fetprofiles
|
resources :fetprofiles
|
||||||
|
|||||||
Reference in New Issue
Block a user