Merge branch 'master' of github.com:fetsite/fetsite

Conflicts:
	app/views/galleries/index.html.erb
This commit is contained in:
Thomas Blazek
2013-08-27 21:27:05 +02:00
14 changed files with 185 additions and 66 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@@ -23,7 +23,7 @@
//= require jquery-fileupload
function insertAttachment(url,name) {
var ext = url.split('.').pop();
var ext = url.split('.').pop().toLowerCase();
var img_ext = [ "jpg", "png", "bmp" , "jpeg" ];
if ( img_ext.indexOf(ext) > -1) {

View File

@@ -13,6 +13,7 @@
*= require jquery.fileupload-ui
* require 'bootstrap'
*/
$linkColor: #03006E;
@import 'bootstrap';

View File

@@ -14,7 +14,7 @@ class Attachment < ActiveRecord::Base
has_paper_trail
attr_accessible :name, :datei
belongs_to :thema
mount_uploader :datei, BeispieldateiUploader
mount_uploader :datei, AttachmentUploader
validates :thema, :presence => true
validates :name, :presence => true
end

View File

@@ -0,0 +1,56 @@
# encoding: utf-8
class AttachmentUploader < CarrierWave::Uploader::Base
# Include RMagick or MiniMagick support:
include CarrierWave::RMagick
# include CarrierWave::RMagick
# include CarrierWave::MiniMagick
# Choose what kind of storage to use for this uploader:
storage :file
# storage :fog
# Override the directory where uploaded files will be stored.
# This is a sensible default for uploaders that are meant to be mounted:
def store_dir
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end
version :thumb do
process :resize_to_fill => [64, 64]
end
# Provide a default URL as a default if there hasn't been a file uploaded:
# def default_url
# # For Rails 3.1+ asset pipeline compatibility:
# # ActionController::Base.helpers.asset_path("fallback/" + [version_name, "default.png"].compact.join('_'))
#
# "/images/fallback/" + [version_name, "default.png"].compact.join('_')
# end
# Process files as they are uploaded:
# process :scale => [200, 300]
#
# def scale(width, height)
# # do something
# end
# Create different versions of your uploaded files:
# version :thumb do
# process :scale => [50, 50]
# end
# Add a white list of extensions which are allowed to be uploaded.
# For images you might use something like this:
# def extension_white_list
# %w(jpg jpeg gif png)
# end
# Override the filename of the uploaded files:
# Avoid using model.id or version_name here, see uploader/store.rb for details.
# def filename
# "something.jpg" if original_filename
# end
end

View File

@@ -0,0 +1,12 @@
<% if images.size > 0 %>
<ul>
<% images.each do |image| %>
<li>
<a href="javascript:void(0)" onclick="<%="ts_insert_image('#{image.val.public_filename()}', '#{image.name}');" %>">
<%= image_tag( image.val.public_filename(:thumb) ) %></a>
</li>
<% end %>
</ul>
<% else %>
No Images Uploaded Yet.
<% end %>

View File

@@ -17,16 +17,17 @@
</div>
<% @fetprofiles.each do |fetprofile| %>
<div class="row-fluid">
<%= link_to fetprofile do %>
<div class="span3">
<%= image_tag fetprofile.picture.portrait.url %>
</div>
<div class="span9">
<h2><%= link_to fetprofile.name, fetprofile %></h2>
<h2><%= fetprofile.name %></h2>
<p><%= fetprofile.fetmail %></p>
<p><%= fetprofile.desc %></p>
<p><%= fetprofile.active %> </p>
</div>
</div> <% end %>
</div>
<% end %>
<div class="row-fluid">

View File

@@ -1,19 +1,26 @@
<h1>Listing galleries</h1>
<% @galleries.each_slice(2) do |row| %>
<div class="row-fluid">
<% row.each do |gallery| %>
<div class="span6">
<h2><%=link_to gallery.name, gallery %></h2>
<%= gallery.desc %>
<%= gallery.datum %>
<br>
<%gallery.fotos.slice(1..[gallery.fotos.length, 4].min).each do |f|%>
<%=image_tag(f.datei.thumb.url,{:class=>"img-polaroid"}) %>
<% end %><br>
<%= link_to 'Edit', edit_gallery_path(gallery) %> | <%= link_to 'Destroy', gallery, method: :delete, data: { confirm: 'Are you sure?' } %>
<%= %>
<div class="container-fluid">
<div class="row-fluid">
<div class="span12">
<% @galleries.each do |gallery| %>
<%= link_to gallery do %>
<div class="media">
<div class="pull-left" href="#">
<%= image_tag gallery.fotos.first.datei.big_thumb.url %>
</div>
<div class="media-body">
<h1><%= gallery.datum %> - <%= gallery.name %></h1>
<p><%= gallery.desc %>
</p>
</div>
</div>
<% end %>
</div>
<% end %>
<%= link_to 'Edit', edit_gallery_path(gallery) %>
<% end %>
</div>
</div>
</div
<br />
<%= link_to 'New Gallery', new_gallery_path %>

View File

@@ -1,20 +1,41 @@
<p id="notice"><%= notice %></p>
<%= render 'fetprofiles/tabs' %>
<h1>
<div class="container-fluid">
<div class="row-fluid">
<div class="span12">
<%= render 'fetprofiles/tabs' %>
<p id="notice"><%= notice %></p>
</div>
</div>
<div class="row-fluid">
<div class="span12">
<h1>
<%= @gremium.name %>
</h1>
<p>
<%= @gremium.desc %>
</p>
</h1>
<% Gremium::TYPEN[@gremium.typ.to_i].to_s %>
<p>
<%= @gremium.desc %>
</p>
</div>
</div>
<% @gremium.memberships.order(:typ).active.each do |m| %>
<% @gremium.memberships.order(:typ).active.each_slice(4) do |r| %>
<div class="row-fluid"><% r.each do |m| %>
<%= link_to m.fetprofile do %>
<div class="span3" style="vertical-align:middle; text-align:center">
<%= image_tag m.fetprofile.picture.portrait %>
<%= m.fetprofile.name + " ist" + render(m) %>
<% end %>
<p>
<%= Gremium::TYPEN[@gremium.typ.to_i].to_s %>
</p>
<p>
<%= m.fetprofile.name %> <br><%= render(m) %>
</p>
</div>
<% end %>
<% end %>
</div>
<% end %>
<%= link_to 'Edit', edit_gremium_path(@gremium) %> |
<%= link_to 'Edit', edit_gremium_path(@gremium) %> |
</div>
</div>
</div>

View File

@@ -1,15 +1,15 @@
<%= link_to neuigkeit do %>
<div class="media">
<div class="pull-left" href="#">
<p><br><%= image_tag neuigkeit.picture.thumb.url unless neuigkeit.picture.url.nil? %></p>
</div>
<div class="media-body"><div><small><%= neuigkeit.rubrik.name %></small>
<small class="pull-right"><%= "am "+ I18n.l(neuigkeit.try(:datum).try(:to_date)) unless neuigkeit.try(:datum).try(:to_date).nil? %></small> </div>
<h1><%= link_to neuigkeit.title,neuigkeit_path(neuigkeit) %></h1>
<h1><%= neuigkeit.title%></h1>
<%= raw(neuigkeit.text_first_words) unless neuigkeit.text.nil?%>
<%= link_to "more" , neuigkeit_path(neuigkeit) %>
<p></p>
</div>
</div>
<% end %>

View File

@@ -9,6 +9,13 @@
<h2>Attachments:</h2>
<%= render :partial => "themen/select", :object => @thema,:locals =>{ :editor => :true} %>
<%= f.actions do %>
<%= f.action :submit, :as => :input %>
<% end %>
<!--
<% @thema.attachments.each do |attachment| %>
<ul>
<li>
@@ -18,11 +25,9 @@
</ul>
<% end %>
<%= f.actions do %>
<%= f.action :submit, :as => :input %>
<% end %>
<% end %>
<% end %>
-->
<!--
<script>
@@ -34,4 +39,3 @@ function insertAttachment(url) {
</script>
-->

View File

@@ -0,0 +1,26 @@
<div class="container-fluid">
<% select.attachments.each_slice(6) do |row| %>
<div class="row-fluid">
<% row.each do |attachment|
data_ext = attachment.datei.file.extension.downcase %>
<div class="span2" align="center">
<%= link_to attachment.name, edit_thema_attachment_path(@thema,attachment) %></br>
<% if (!["jpg","png","jpeg"].find_index(data_ext).nil?) %>
<%= image_tag attachment.datei.thumb.url %>
<% else %>
<%= image_tag "pdf-logo.jpg" %>
<% end %>
<% if(editor) %>
</br><button type="button" onclick="insertAttachment(<%="\"" + attachment.datei.url + "\""%>,<%="\""+attachment.name+"\""%>)">Insert Me!</button>
<% else %>
</br><%= link_to 'Destroy',[@thema,attachment], method: :delete, data: { confirm: 'Are you sure?' } %>
<% end %>
</div>
<% end %>
</div>
</br>
<% end %>
</div>
</br>
<%= link_to 'Neues Attachment', new_thema_attachment_path(@thema) %>
<br/>

View File

@@ -2,5 +2,4 @@
<%= render 'form' %>
<%= link_to 'Show', @thema %> |
<%= link_to 'Back', themen_path %>
</br><%= link_to 'Back', @thema %>

View File

@@ -24,12 +24,4 @@
<br/>
<h2>Attachments:</h2>
<% @thema.attachments.each do |attachment| %>
<ul>
<li>
<%= link_to attachment.name, edit_thema_attachment_path(@thema,attachment) %> | <%= link_to 'Destroy',[@thema,attachment], method: :delete, data: { confirm: 'Are you sure?' } %>
</li>
</ul>
<% end %>
<%= link_to 'Neues Attachment', new_thema_attachment_path(@thema) %>
<br/>
<%= render :partial => "themen/select", :object => @thema, :locals => { :editor => :false }%>