Merge branch 'master' of github.com:fetsite/fetsite
Conflicts: app/views/galleries/index.html.erb
This commit is contained in:
BIN
app/assets/images/pdf-logo.jpg
Normal file
BIN
app/assets/images/pdf-logo.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.6 KiB |
@@ -23,13 +23,13 @@
|
|||||||
//= require jquery-fileupload
|
//= require jquery-fileupload
|
||||||
|
|
||||||
function insertAttachment(url,name) {
|
function insertAttachment(url,name) {
|
||||||
var ext = url.split('.').pop();
|
var ext = url.split('.').pop().toLowerCase();
|
||||||
var img_ext = [ "jpg", "png", "bmp" , "jpeg" ];
|
var img_ext = [ "jpg", "png", "bmp" , "jpeg" ];
|
||||||
|
|
||||||
if ( img_ext.indexOf(ext) > -1) {
|
if ( img_ext.indexOf(ext) > -1) {
|
||||||
tinymce.activeEditor.setContent(tinymce.activeEditor.getContent({format : 'raw'}) + "<img src=\"" + url + "\" title=\"" + name + "\">");
|
tinymce.activeEditor.setContent(tinymce.activeEditor.getContent({format : 'raw'}) + "<img src=\"" + url + "\" title=\"" + name + "\">");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
tinymce.activeEditor.setContent(tinymce.activeEditor.getContent({format : 'raw'}) + "<a href=\"" + url + "\">" + name +"</a>");
|
tinymce.activeEditor.setContent(tinymce.activeEditor.getContent({format : 'raw'}) + "<a href=\"" + url + "\">" + name +"</a>");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
*= require_tree .
|
*= require_tree .
|
||||||
*= require jquery.fileupload-ui
|
*= require jquery.fileupload-ui
|
||||||
* require 'bootstrap'
|
* require 'bootstrap'
|
||||||
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
$linkColor: #03006E;
|
$linkColor: #03006E;
|
||||||
@@ -55,4 +56,4 @@ border-style: solid;
|
|||||||
border-width: 1px 0px 0px 0px;
|
border-width: 1px 0px 0px 0px;
|
||||||
border-color: grey;
|
border-color: grey;
|
||||||
min-width: 100%;
|
min-width: 100%;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ class Attachment < ActiveRecord::Base
|
|||||||
has_paper_trail
|
has_paper_trail
|
||||||
attr_accessible :name, :datei
|
attr_accessible :name, :datei
|
||||||
belongs_to :thema
|
belongs_to :thema
|
||||||
mount_uploader :datei, BeispieldateiUploader
|
mount_uploader :datei, AttachmentUploader
|
||||||
validates :thema, :presence => true
|
validates :thema, :presence => true
|
||||||
validates :name, :presence => true
|
validates :name, :presence => true
|
||||||
end
|
end
|
||||||
|
|||||||
56
app/uploaders/attachment_uploader.rb
Normal file
56
app/uploaders/attachment_uploader.rb
Normal 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
|
||||||
12
app/views/attachments/_show_image_list.erb
Normal file
12
app/views/attachments/_show_image_list.erb
Normal 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 %>
|
||||||
@@ -17,16 +17,17 @@
|
|||||||
</div>
|
</div>
|
||||||
<% @fetprofiles.each do |fetprofile| %>
|
<% @fetprofiles.each do |fetprofile| %>
|
||||||
<div class="row-fluid">
|
<div class="row-fluid">
|
||||||
|
<%= link_to fetprofile do %>
|
||||||
<div class="span3">
|
<div class="span3">
|
||||||
<%= image_tag fetprofile.picture.portrait.url %>
|
<%= image_tag fetprofile.picture.portrait.url %>
|
||||||
</div>
|
</div>
|
||||||
<div class="span9">
|
<div class="span9">
|
||||||
|
|
||||||
<h2><%= link_to fetprofile.name, fetprofile %></h2>
|
<h2><%= fetprofile.name %></h2>
|
||||||
<p><%= fetprofile.fetmail %></p>
|
<p><%= fetprofile.fetmail %></p>
|
||||||
<p><%= fetprofile.desc %></p>
|
<p><%= fetprofile.desc %></p>
|
||||||
<p><%= fetprofile.active %> </p>
|
|
||||||
</div>
|
</div> <% end %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<div class="row-fluid">
|
<div class="row-fluid">
|
||||||
|
|||||||
@@ -1,19 +1,26 @@
|
|||||||
<h1>Listing galleries</h1>
|
<h1>Listing galleries</h1>
|
||||||
|
<%= %>
|
||||||
|
<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 %>
|
||||||
|
<%= link_to 'Edit', edit_gallery_path(gallery) %>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div
|
||||||
|
|
||||||
<% @galleries.each_slice(2) do |row| %>
|
<br />
|
||||||
<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>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
<%= link_to 'New Gallery', new_gallery_path %>
|
<%= link_to 'New Gallery', new_gallery_path %>
|
||||||
|
|||||||
@@ -1,20 +1,41 @@
|
|||||||
<p id="notice"><%= notice %></p>
|
<div class="container-fluid">
|
||||||
<%= render 'fetprofiles/tabs' %>
|
<div class="row-fluid">
|
||||||
<h1>
|
<div class="span12">
|
||||||
<%= @gremium.name %>
|
<%= render 'fetprofiles/tabs' %>
|
||||||
</h1>
|
<p id="notice"><%= notice %></p>
|
||||||
<p>
|
</div>
|
||||||
<%= @gremium.desc %>
|
</div>
|
||||||
</p>
|
<div class="row-fluid">
|
||||||
|
<div class="span12">
|
||||||
<% @gremium.memberships.order(:typ).active.each do |m| %>
|
<h1>
|
||||||
<%= image_tag m.fetprofile.picture.portrait %>
|
<%= @gremium.name %>
|
||||||
<%= m.fetprofile.name + " ist" + render(m) %>
|
</h1>
|
||||||
<% end %>
|
<% Gremium::TYPEN[@gremium.typ.to_i].to_s %>
|
||||||
<p>
|
<p>
|
||||||
<%= Gremium::TYPEN[@gremium.typ.to_i].to_s %>
|
<%= @gremium.desc %>
|
||||||
</p>
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<%= link_to 'Edit', edit_gremium_path(@gremium) %> |
|
<% @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 %>
|
||||||
|
<p>
|
||||||
|
<%= m.fetprofile.name %> <br><%= render(m) %>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
|
||||||
|
<%= link_to 'Edit', edit_gremium_path(@gremium) %> |
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
|
|
||||||
|
<%= link_to neuigkeit do %>
|
||||||
<div class="media">
|
<div class="media">
|
||||||
<div class="pull-left" href="#">
|
<div class="pull-left" href="#">
|
||||||
<p><br><%= image_tag neuigkeit.picture.thumb.url unless neuigkeit.picture.url.nil? %></p>
|
<p><br><%= image_tag neuigkeit.picture.thumb.url unless neuigkeit.picture.url.nil? %></p>
|
||||||
</div>
|
</div>
|
||||||
<div class="media-body"><div><small><%= neuigkeit.rubrik.name %></small>
|
<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>
|
<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?%>
|
<%= raw(neuigkeit.text_first_words) unless neuigkeit.text.nil?%>
|
||||||
<%= link_to "more" , neuigkeit_path(neuigkeit) %>
|
|
||||||
<p></p>
|
<p></p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<% end %>
|
||||||
|
|||||||
@@ -9,6 +9,13 @@
|
|||||||
|
|
||||||
|
|
||||||
<h2>Attachments:</h2>
|
<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| %>
|
<% @thema.attachments.each do |attachment| %>
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
@@ -18,11 +25,9 @@
|
|||||||
</ul>
|
</ul>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<%= f.actions do %>
|
|
||||||
<%= f.action :submit, :as => :input %>
|
|
||||||
<% end %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
|
<% end %>
|
||||||
|
-->
|
||||||
<!--
|
<!--
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@@ -34,4 +39,3 @@ function insertAttachment(url) {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
|||||||
26
app/views/themen/_select.html.erb
Normal file
26
app/views/themen/_select.html.erb
Normal 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/>
|
||||||
@@ -2,5 +2,4 @@
|
|||||||
|
|
||||||
<%= render 'form' %>
|
<%= render 'form' %>
|
||||||
|
|
||||||
<%= link_to 'Show', @thema %> |
|
</br><%= link_to 'Back', @thema %>
|
||||||
<%= link_to 'Back', themen_path %>
|
|
||||||
|
|||||||
@@ -24,12 +24,4 @@
|
|||||||
<br/>
|
<br/>
|
||||||
|
|
||||||
<h2>Attachments:</h2>
|
<h2>Attachments:</h2>
|
||||||
<% @thema.attachments.each do |attachment| %>
|
<%= render :partial => "themen/select", :object => @thema, :locals => { :editor => :false }%>
|
||||||
<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/>
|
|
||||||
|
|||||||
Reference in New Issue
Block a user