-<%= ffi1_icon "academic" %><%= link_to I18n.t('home.login'), user_omniauth_authorize_path(:ldap) %>
-
<%= render 'beispiele' %>
diff --git a/app/views/themes/white_1/themengruppen/show.html.erb b/app/views/themes/white_1/themengruppen/show.html.erb
index 6da95cd..36f2358 100644
--- a/app/views/themes/white_1/themengruppen/show.html.erb
+++ b/app/views/themes/white_1/themengruppen/show.html.erb
@@ -1,29 +1,38 @@
-
diff --git a/config/routes.rb b/config/routes.rb
index 07d5b8f..d01752e 100755
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -73,6 +73,7 @@ Fetsite::Application.routes.draw do
get 'beispiel_sammlung'
get 'compare_tiss'
get 'load_tiss'
+ get 'verwalten'
end
resources :beispiele#, :only=>[:show,:index,:create]
@@ -135,7 +136,8 @@ Fetsite::Application.routes.draw do
get 'dev'
get 'startdev'
get 'linksnotimplemented'
- get 'kontakt'
+ get 'kontakt'
+ get 'choose_contact_topics'
end
end
From 74546b1d8db80176c5ae821a989c3086c3cd7a77 Mon Sep 17 00:00:00 2001
From: Andreas Stephanides
Date: Wed, 23 Jul 2014 22:57:25 +0530
Subject: [PATCH 02/10] geburtstag anzeigen
---
app/views/fetprofiles/_interninfo.html.erb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/views/fetprofiles/_interninfo.html.erb b/app/views/fetprofiles/_interninfo.html.erb
index bd5fc1f..4ea0119 100644
--- a/app/views/fetprofiles/_interninfo.html.erb
+++ b/app/views/fetprofiles/_interninfo.html.erb
@@ -1,5 +1,5 @@
-Geburtstag <%= %>
+Geburtstag <%= I18n.l(interninfo.birthday,format: :short) %>
Adresse:
From 3347ac89d9ef27a082b4a11a053a1f1c71e1724b Mon Sep 17 00:00:00 2001
From: Andreas Stephanides
Date: Wed, 23 Jul 2014 22:57:40 +0530
Subject: [PATCH 03/10] thmen nur rendern wenn erlaubt
---
app/views/layouts/_pretty_toolbar.html.erb | 4 ++--
app/views/themen/_small.html.erb | 4 ++++
app/views/themen/_thema.html.erb | 2 +-
3 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/app/views/layouts/_pretty_toolbar.html.erb b/app/views/layouts/_pretty_toolbar.html.erb
index 3ec90f4..096cac6 100644
--- a/app/views/layouts/_pretty_toolbar.html.erb
+++ b/app/views/layouts/_pretty_toolbar.html.erb
@@ -6,8 +6,8 @@ Verwendung: Aufruf mit
-->
<% toolbar_elements = !pretty_toolbar.nil? ? pretty_toolbar : @toolbar_elements %>
<% unless toolbar_elements.nil? || toolbar_elements.empty? %>
-<%= I18n.t("common.actions")%>
-
+
<% toolbar_elements.each do |t| %>
<% unless t[:method]==:versions %>
<% text='
'.html_safe+t[:text] %>
diff --git a/app/views/themen/_small.html.erb b/app/views/themen/_small.html.erb
index dfa0fc3..2e4b269 100644
--- a/app/views/themen/_small.html.erb
+++ b/app/views/themen/_small.html.erb
@@ -1,3 +1,4 @@
+<% if can? :show, small %>
<%= small.title %> <%= link_to fa_icon("pencil"), verwalten_thema_path(small) if can? :edit, small %>
@@ -30,3 +31,6 @@
@small_elements << {:icon=>:pencil, :hicon=>'icon-pencil', :text=>I18n.t('thema.edit'), :path=>small} if can? :edit, small
@small_elements << {:hicon=>'icon-remove-circle',:text=>I18n.t('thema.remove'), :path=>small, :method=>:delete,:confirm=>I18n.t('thema.sure')} if can? :delete, small %>
<% render :partial=>'layouts/pretty_toolbar', :object=>@small_elements unless @small_elements.empty? %>
+<% else %>
+Error
+<% end %>
diff --git a/app/views/themen/_thema.html.erb b/app/views/themen/_thema.html.erb
index ede7bb2..7d24eff 100644
--- a/app/views/themen/_thema.html.erb
+++ b/app/views/themen/_thema.html.erb
@@ -1,2 +1,2 @@
- <%= thema.title%>
+ <%= thema.title if can? :show , thema %>
From af9da058ab26d45829eceb3ec37089a9f6da7ea3 Mon Sep 17 00:00:00 2001
From: Andreas Stephanides
Date: Mon, 11 Aug 2014 14:38:14 +0530
Subject: [PATCH 04/10] Interface Neuigkeiten & Attachment
---
app/controllers/neuigkeiten_controller.rb | 23 ++++++++++------
app/models/ability.rb | 1 +
app/models/attachment.rb | 7 +++++
app/models/thema.rb | 4 ++-
app/uploaders/attachment_uploader.rb | 9 ++++---
app/views/layouts/_pretty_toolbar.html.erb | 24 ++++++++++++++---
.../neuigkeiten/_nlink_list_search.html.erb | 3 ++-
app/views/neuigkeiten/create_link.js.erb | 2 ++
app/views/themen/_attachment_list.html.erb | 12 ++++++---
app/views/themen/_select.html.erb | 26 ++++++++++++++-----
app/views/themen/_verw_liste.html.erb | 17 +++++++-----
.../themengruppen/_themengruppe.html.erb | 3 ++-
app/views/themengruppen/index.html.erb | 24 ++++++++---------
13 files changed, 111 insertions(+), 44 deletions(-)
create mode 100644 app/views/neuigkeiten/create_link.js.erb
diff --git a/app/controllers/neuigkeiten_controller.rb b/app/controllers/neuigkeiten_controller.rb
index 3e05c2c..29a54b9 100755
--- a/app/controllers/neuigkeiten_controller.rb
+++ b/app/controllers/neuigkeiten_controller.rb
@@ -113,9 +113,14 @@ class NeuigkeitenController < ApplicationController
render action:"show"
end
def create_link
- Nlink.create(:link=>params[:link_type].constantize.find(params[:link_id]),:neuigkeit=>Neuigkeit.find(params[:id]))
+ @neuigkeit = Neuigkeit.find(params[:id])
- redirect_to action:"show"
+ Nlink.create(:link=>params[:link_type].constantize.find(params[:link_id]),:neuigkeit=>Neuigkeit.find(params[:id]))
+ @nlinks=@neuigkeit.nlinks
+ respond_to do |format|
+ format.html { edirect_to action:"show" }
+ format.js
+ end
end
def create
@@ -159,21 +164,23 @@ private
def load_toolbar_elements
@neuigkeit=Neuigkeit.find(params[:id])
@toolbar_elements=[]
- @toolbar_elements << {:hicon=>'icon-plus', :text=> I18n.t('neuigkeit.publish'),:path => publish_rubrik_neuigkeit_path(@neuigkeit.rubrik,@neuigkeit),:confirm=> I18n.t('neuigkeit.publish_sure') } if can?(:publish, @neuigkeit) && !@neuigkeit.published?
- @toolbar_elements << {:hicon=>'icon-facebook', :text=> I18n.t('neuigkeit.publishfb'),:path => publish_to_facebook_rubrik_neuigkeit_path(@neuigkeit.rubrik,@neuigkeit),:confirm=>I18n.t('neuigkeit.publishfb_sure') } if can?(:publish, @neuigkeit) && @neuigkeit.published?
+ actions=[]
+ actions << {:hicon=>'icon-plus', :text=> I18n.t('neuigkeit.publish'),:path => publish_rubrik_neuigkeit_path(@neuigkeit.rubrik,@neuigkeit),:confirm=> I18n.t('neuigkeit.publish_sure') } if can?(:publish, @neuigkeit) && !@neuigkeit.published?
+ actions << {:hicon=>'ffi1-facebook1', :text=> I18n.t('neuigkeit.publishfb'),:path => publish_to_facebook_rubrik_neuigkeit_path(@neuigkeit.rubrik,@neuigkeit),:confirm=>I18n.t('neuigkeit.publishfb_sure') } if can?(:publish, @neuigkeit) && @neuigkeit.published?
-@toolbar_elements << {:hicon=>'icon-facebook', :text=> I18n.t('neuigkeit.publishfetmail'),:path => mail_to_fet_rubrik_neuigkeit_path(@neuigkeit.rubrik,@neuigkeit),:confirm=>I18n.t('neuigkeit.publishfetmail_sure') } if can?(:publish, @neuigkeit) && @neuigkeit.published?
+actions << {:hicon=>'icon-facebook', :text=> I18n.t('neuigkeit.publishfetmail'),:path => mail_to_fet_rubrik_neuigkeit_path(@neuigkeit.rubrik,@neuigkeit),:confirm=>I18n.t('neuigkeit.publishfetmail_sure') } if can?(:publish, @neuigkeit) && @neuigkeit.published?
- @toolbar_elements << {:hicon=>'icon-minus', :text=> I18n.t('neuigkeit.unpublish'),:path => unpublish_rubrik_neuigkeit_path(@neuigkeit.rubrik,@neuigkeit),:confirm=> I18n.t('neuigkeit.unpublish_sure') } if can?(:unpublish, @neuigkeit) && @neuigkeit.published?
+ actions << {:hicon=>'icon-minus', :text=> I18n.t('neuigkeit.unpublish'),:path => unpublish_rubrik_neuigkeit_path(@neuigkeit.rubrik,@neuigkeit),:confirm=> I18n.t('neuigkeit.unpublish_sure') } if can?(:unpublish, @neuigkeit) && @neuigkeit.published?
+
@toolbar_elements << {:text=>I18n.t('common.edit'),:path=>edit_rubrik_neuigkeit_path(@neuigkeit.rubrik,@neuigkeit),:icon=>:pencil} if can? :edit, @neuigkeit.rubrik
@versions= @neuigkeit.translation.versions.select([:created_at]).reverse
@toolbar_elements <<{:path=>rubrik_neuigkeit_path(@neuigkeit.rubrik,@neuigkeit),:method=>:versions,:versions=>@versions}
- @toolbar_elements << {:hicon=>'icon-remove-circle', :text=> I18n.t('common.delete'),:path => rubrik_neuigkeit_path(@neuigkeit.rubrik,@neuigkeit), :method=> :delete,:confirm=>'Sure?' } if can? :delete, @neuigkeit
-
+ actions << {:hicon=>'icon-remove-circle', :text=> I18n.t('common.delete'),:path => rubrik_neuigkeit_path(@neuigkeit.rubrik,@neuigkeit), :method=> :delete,:confirm=>'Sure?' } if can? :delete, @neuigkeit
+ @toolbar_elements << {:text => "action", :method => :dropdown, :elements=> actions}
end
diff --git a/app/models/ability.rb b/app/models/ability.rb
index 616979b..99fe04a 100755
--- a/app/models/ability.rb
+++ b/app/models/ability.rb
@@ -40,6 +40,7 @@ class Ability
can :showintern, Thema
can :manage, Thema
can :manage, Themengruppe
+ can :manage, Attachment
end
unless user.has_role?("fetadmin")
cannot :delete, Themengruppe
diff --git a/app/models/attachment.rb b/app/models/attachment.rb
index c61214f..3301381 100644
--- a/app/models/attachment.rb
+++ b/app/models/attachment.rb
@@ -18,6 +18,13 @@ class Attachment < ActiveRecord::Base
validates :thema, :presence => true
validates :name, :presence => true
+ def image?
+
+ # data_ext = datei.file.extension.downcase
+ # %w(jpg png jpeg).include?(data_ext)
+ datei.image?(datei.file)
+ end
+
def to_jq_upload
{
"id" => read_attribute(:id),
diff --git a/app/models/thema.rb b/app/models/thema.rb
index 3f73b38..d61bf46 100644
--- a/app/models/thema.rb
+++ b/app/models/thema.rb
@@ -49,7 +49,9 @@ include Rails.application.routes.url_helpers
def fix_links(host)
full_url= URI.parse(root_url(:host=>host))
- self.text.gsub!(/src="[^"]*attachment\/datei\/(\d+)[^"]*"/){|s| full_url.path=Attachment.find($1.to_i).datei.url; 'src="'+full_url.to_s+'"'}
+ self.text.gsub!(/src="[\.\/]*uploads\/attachment\/datei\/(\d+)\/thumb_big[^"]*"/){|s| full_url.path=Attachment.find($1.to_i).datei.thumb_big.url; 'src="'+full_url.to_s+'"'}
+ self.text.gsub!(/src="[\.\/^"]*uploads\/attachment\/datei\/(\d+)\/[^"]*"/){|s| full_url.path=Attachment.find($1.to_i).datei.url; 'src="'+full_url.to_s+'"'}
+
self.text.gsub!(/href="[^"]*themen\/(\d+)[^"]*"/){|s| full_url.path=thema_path(Thema.find($1.to_i)); 'href="'+full_url.to_s+'"'}
end
diff --git a/app/uploaders/attachment_uploader.rb b/app/uploaders/attachment_uploader.rb
index c7d10a4..d08f8cd 100644
--- a/app/uploaders/attachment_uploader.rb
+++ b/app/uploaders/attachment_uploader.rb
@@ -89,8 +89,11 @@ end
# def filename
# "something.jpg" if original_filename
# end
-protected
- def image?(file)
- %w(jpg png jpeg).include?(File.extname(full_filename(file)))
+ def extention
+ File.extname(full_filename(file.file)).downcase
+ end
+
+ def image?(for_file)
+ %w(.jpg .png .jpeg).include?(File.extname(full_filename(for_file.file)).downcase)
end
end
diff --git a/app/views/layouts/_pretty_toolbar.html.erb b/app/views/layouts/_pretty_toolbar.html.erb
index 096cac6..8405a4c 100644
--- a/app/views/layouts/_pretty_toolbar.html.erb
+++ b/app/views/layouts/_pretty_toolbar.html.erb
@@ -10,8 +10,26 @@ Verwendung: Aufruf mit
-->
<% toolbar_elements.each do |t| %>
<% unless t[:method]==:versions %>
- <% text='
'.html_safe+t[:text] %>
+ <% unless t[:method]==:dropdown %>
+
+ <% text=ff_icon(t[:hicon])+t[:text] %>
<%= link_to text, t[:path], :method=>t[:method], :confirm=>t[:confirm].to_s, :data=>t[:data], :class=>((t[:method].to_s=='delete') ? "btn btn-danger" : "btn") ,:remote=>(t[:remote])?true : false %>
+ <% else %>
+
+
+ <%= t[:text] %>
+
+
+<% end %>
<% else %>
@@ -28,9 +46,9 @@ Verwendung: Aufruf mit
q= q.merge(URI.decode_www_form(uri.query)) unless uri.query.nil?
uri.query= URI.encode_www_form(q<<["version",i.to_s])
- %>
+ %>
<%= link_to I18n.l(v[:created_at]).to_s,uri.to_s ,:version=>v[:id] %>
-<% end %>
+ <% end %>
<% end %>
diff --git a/app/views/neuigkeiten/_nlink_list_search.html.erb b/app/views/neuigkeiten/_nlink_list_search.html.erb
index be5a2c9..c50ead3 100644
--- a/app/views/neuigkeiten/_nlink_list_search.html.erb
+++ b/app/views/neuigkeiten/_nlink_list_search.html.erb
@@ -1,11 +1,12 @@
<%= link_to nlink_list_search.title, nlink_list_search %>
- <%= link_to "add:"+nlink_list_search.title, create_link_rubrik_neuigkeit_path(@neuigkeit.rubrik,@neuigkeit, :link_id=>nlink_list_search.id, :link_type=>nlink_list_search.class.to_s) %>
+ <%= link_to create_link_rubrik_neuigkeit_path(@neuigkeit.rubrik, @neuigkeit, :link_id=>nlink_list_search.id, :link_type=>nlink_list_search.class.to_s), remote: true do %>
<% p = nlink_list_search.class.to_s.downcase.pluralize+"/nlink" %>
<%= render :partial=>p, :object=>nlink_list_search %>
+<% end %>
diff --git a/app/views/neuigkeiten/create_link.js.erb b/app/views/neuigkeiten/create_link.js.erb
new file mode 100644
index 0000000..d24f9fc
--- /dev/null
+++ b/app/views/neuigkeiten/create_link.js.erb
@@ -0,0 +1,2 @@
+$('#nlink_list_search').html("");
+$('#nlink_list').html("<%= escape_javascript( render partial:"nlink_list", collection: @nlinks )%>");
\ No newline at end of file
diff --git a/app/views/themen/_attachment_list.html.erb b/app/views/themen/_attachment_list.html.erb
index a210446..818aa05 100644
--- a/app/views/themen/_attachment_list.html.erb
+++ b/app/views/themen/_attachment_list.html.erb
@@ -8,9 +8,15 @@
<% if editor %>
-<%= link_to "Edit", edit_thema_attachment_path(a.thema,a) %>
-<%= link_to "Delete", thema_attachment_path(a.thema,a), method: "DELETE", confirm: "Sure?" %>
-
+
|
<% end %>
diff --git a/app/views/themen/_select.html.erb b/app/views/themen/_select.html.erb
index a693ec0..02401a7 100644
--- a/app/views/themen/_select.html.erb
+++ b/app/views/themen/_select.html.erb
@@ -2,19 +2,33 @@
<% 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?) %>
+
<% end %>
diff --git a/app/views/themen/_verw_liste.html.erb b/app/views/themen/_verw_liste.html.erb
index 777a730..0c6f554 100644
--- a/app/views/themen/_verw_liste.html.erb
+++ b/app/views/themen/_verw_liste.html.erb
@@ -1,8 +1,13 @@
<% verw_liste.each do |thema| %>
-
<%= thema.title %>
-
-<%= link_to thema_path(thema),:remote=>true do %> Show <% end %>
-<%= link_to edit_thema_path(thema),:remote=>true do %> Edit <% end %>
-<%= link_to fragen_thema_path(thema),:remote=>true do %> Fragen <% end %>
-<%= link_to attachments_thema_path(thema),:remote=>true do %> Attachments <% end %>
+
+
+
<%= thema.title %> <%= link_to thema_path(thema),:remote=>true do %> <%= fa_icon('eye') %> <% end %><%= link_to edit_thema_path(thema),:remote=>true do %> <%= ff_icon('icon-pencil') %> <% end %>
+
+
+
<% end %>
diff --git a/app/views/themengruppen/_themengruppe.html.erb b/app/views/themengruppen/_themengruppe.html.erb
index 7e99e23..73c5c4f 100644
--- a/app/views/themengruppen/_themengruppe.html.erb
+++ b/app/views/themengruppen/_themengruppe.html.erb
@@ -1,4 +1,5 @@
<%= link_to themengruppe,{:class=>'linkbox color-1-dark'} do %>
+
<% end %>
diff --git a/app/views/themengruppen/index.html.erb b/app/views/themengruppen/index.html.erb
index 9e5acf4..f2cc8a9 100644
--- a/app/views/themengruppen/index.html.erb
+++ b/app/views/themengruppen/index.html.erb
@@ -2,21 +2,21 @@
<%= render :partial=>'layouts/pretty_toolbar' %>
-
- <%= link_to fa_icon("question")+ I18n.t("themengruppe.faqs"), faqs_themengruppen_path,class: :linkbox %>
-
-
-
-
+
+
+ <% @themengruppen.each do |themengruppe| %>
+ -
-
+ <%= render themengruppe if can?(:show,themengruppe)%>
+
+
+ <% end %>
+
+
+