diff --git a/app/assets/images/pdf-logo.jpg b/app/assets/images/pdf-logo.jpg new file mode 100644 index 0000000..729b9a7 Binary files /dev/null and b/app/assets/images/pdf-logo.jpg differ diff --git a/app/views/attachments/_show_image_list.erb b/app/views/attachments/_show_image_list.erb new file mode 100644 index 0000000..c57b330 --- /dev/null +++ b/app/views/attachments/_show_image_list.erb @@ -0,0 +1,12 @@ +<% if images.size > 0 %> + +<% else %> + No Images Uploaded Yet. +<% end %> diff --git a/app/views/themen/_form.html.erb b/app/views/themen/_form.html.erb index 7185578..b967041 100644 --- a/app/views/themen/_form.html.erb +++ b/app/views/themen/_form.html.erb @@ -9,6 +9,13 @@

Attachments:

+<%= render :partial => "themen/select", :object => @thema,:locals =>{ :editor => :true} %> + +<%= f.actions do %> +<%= f.action :submit, :as => :input %> +<% end %> + + - diff --git a/app/views/themen/_select.html.erb b/app/views/themen/_select.html.erb new file mode 100644 index 0000000..4964693 --- /dev/null +++ b/app/views/themen/_select.html.erb @@ -0,0 +1,26 @@ +
+ <% select.attachments.each_slice(6) do |row| %> +
+ <% row.each do |attachment| + data_ext = attachment.datei.file.extension.downcase %> +
+ <%= link_to attachment.name, edit_thema_attachment_path(@thema,attachment) %>
+ <% if (!["jpg","png","jpeg"].find_index(data_ext).nil?) %> + <%= image_tag attachment.datei.thumb.url %> + <% else %> + <%= image_tag "pdf-logo.jpg" %> + <% end %> + <% if(editor) %> +
+ <% else %> +
<%= link_to 'Destroy',[@thema,attachment], method: :delete, data: { confirm: 'Are you sure?' } %> + <% end %> +
+ <% end %> +
+
+ <% end %> +
+
+<%= link_to 'Neues Attachment', new_thema_attachment_path(@thema) %> +
diff --git a/app/views/themen/edit.html.erb b/app/views/themen/edit.html.erb index 9230c28..5376cfb 100644 --- a/app/views/themen/edit.html.erb +++ b/app/views/themen/edit.html.erb @@ -2,5 +2,4 @@ <%= render 'form' %> -<%= link_to 'Show', @thema %> | -<%= link_to 'Back', themen_path %> +
<%= link_to 'Back', @thema %> diff --git a/app/views/themen/show.html.erb b/app/views/themen/show.html.erb index 6fe1cd7..aaf3fa6 100644 --- a/app/views/themen/show.html.erb +++ b/app/views/themen/show.html.erb @@ -24,12 +24,4 @@

Attachments:

-<% @thema.attachments.each do |attachment| %> - -<% end %> -<%= link_to 'Neues Attachment', new_thema_attachment_path(@thema) %> -
+<%= render :partial => "themen/select", :object => @thema, :locals => { :editor => :false }%>