forked from bofh/fetsite
CHANGE: Attachment-Einbindung in TinyMCE mit Thumbnails und eigenem Partial-View
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 |
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 %>
|
||||
@@ -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>
|
||||
|
||||
-->
|
||||
|
||||
|
||||
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' %>
|
||||
|
||||
<%= link_to 'Show', @thema %> |
|
||||
<%= link_to 'Back', themen_path %>
|
||||
</br><%= link_to 'Back', @thema %>
|
||||
|
||||
@@ -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 }%>
|
||||
|
||||
Reference in New Issue
Block a user