diff --git a/app/models/fetprofile.rb b/app/models/fetprofile.rb
index 360e19a..a83834c 100644
--- a/app/models/fetprofile.rb
+++ b/app/models/fetprofile.rb
@@ -16,15 +16,16 @@
class Fetprofile < ActiveRecord::Base
attr_accessible :active, :desc, :fetmailalias, :nachname, :picture, :short, :vorname,:memberships_attributes,:remove_picture,:picture_cache
- has_many :memberships
+ has_many :memberships, dependent: :delete_all
has_many :gremien, :through=> :membership
mount_uploader :picture, PictureUploader
+ has_paper_trail
def name
[vorname, nachname, "(",short,")"].join(" ")
end
accepts_nested_attributes_for :memberships
scope :active, -> { where(:active=>true).order(:vorname) }
def fetmail
- fetmailalias.empty? ? short + "@fet.at" : fetmailalias + "@fet.at"
+ (fetmailalias.nil? || fetmail.empty?) ? short.to_s + "@fet.at" : fetmailalias.to_s + "@fet.at"
end
end
diff --git a/app/views/fetprofiles/_tabs.html.erb b/app/views/fetprofiles/_tabs.html.erb
index 902e756..71f204d 100644
--- a/app/views/fetprofiles/_tabs.html.erb
+++ b/app/views/fetprofiles/_tabs.html.erb
@@ -1,24 +1,25 @@
- - >
- <%= link_to "Aktive Mitglieder" , fetprofiles_path( filter: "active") %>
-- <%= link_to "Alle Gremien und Gruppen", gremien_path %>
-<% for g in @gremientabs %>
+ - >
+ <%= link_to "Aktive Mitglieder" , fetprofiles_path( filter: "active") %>
+
+ -
+ <%= link_to "Alle Gremien und Gruppen", gremien_path %>
+
+ <% for g in @gremientabs %>
- title="<%= g.name %>">
<%= link_to g.name, g %>
-
-<% end %>
-
- - >
- <%= link_to "Alle Mitglieder" , fetprofiles_path( filter: "all") %>
-
-
-<% if can?(:verwalten,Gremium) %>
-<% if request.fullpath == verwalten_gremien_path %>
+
+ <% end %>
+ - >
+ <%= link_to "Alle Mitglieder" , fetprofiles_path( filter: "all") %>
+
+ <% if can?(:verwalten,Gremium) %>
+ <% if request.fullpath == verwalten_gremien_path %>
-
<% else %>
-
-<% end %>
-<%= link_to "Verwaltung", verwalten_gremien_path %>
-
-<% end %>
+ <% end %>
+ <%= link_to "Verwaltung", verwalten_gremien_path %>
+
+ <% end %>
diff --git a/app/views/fetprofiles/index.html.erb b/app/views/fetprofiles/index.html.erb
index 2da2a16..080f97c 100644
--- a/app/views/fetprofiles/index.html.erb
+++ b/app/views/fetprofiles/index.html.erb
@@ -6,26 +6,27 @@
%>
-<% @fetprofiles.each do |fetprofile| %>
--
-<%= link_to fetprofile do %>
-
+ <% end %>
+
+ <% end %>
<%= link_to I18n.t('fetprofiles.new'), new_fetprofile_path %>
-
+
+
+
diff --git a/app/views/fetprofiles/show.html.erb b/app/views/fetprofiles/show.html.erb
index bf632cc..ba637c8 100644
--- a/app/views/fetprofiles/show.html.erb
+++ b/app/views/fetprofiles/show.html.erb
@@ -6,7 +6,6 @@
<%= @fetprofile.name %>
-
<%= @fetprofile.fetmailalias %>
@@ -14,9 +13,8 @@
<%= @fetprofile.desc %>
- <%= ""+I18n.t('fetprofiles.active')+"".html_safe if @fetprofile.active %>
-
-
<%= link_to 'Destroy', @fetprofile, method: :delete, data: { confirm: 'Are you sure?' } %>
+ <%= link_to 'Destroy', @fetprofile, method: :delete, data: { confirm: 'Are you sure?' } %>
+
@@ -26,15 +24,11 @@
<% @fetprofile.memberships.each do |m| %>
<%= render m %>
- <% link_to 'edit', edit_fetprofile_membership_path(@fetprofile,m) %>
+ <%= link_to 'edit', edit_fetprofile_membership_path(@fetprofile,m) if params["verwalten"]%>
+ <%= link_to 'delete', [@fetprofile, m], method: :delete, data: {confirm: 'Sure?'} if params["verwalten"] %>
<% end %>
-
-
- <%= link_to 'Neue Mitgliedschaft', new_fetprofile_membership_path(@fetprofile) %> |
-
- <%= link_to 'Edit', edit_fetprofile_path(@fetprofile) %> |
- <%= link_to 'Back', fetprofiles_path %>
+ <%= render 'layouts/pretty_toolbar' %>
diff --git a/app/views/gremien/show.html.erb b/app/views/gremien/show.html.erb
index 0383c88..d87e96a 100644
--- a/app/views/gremien/show.html.erb
+++ b/app/views/gremien/show.html.erb
@@ -16,10 +16,14 @@
<% r.each do |m| %>
<%= link_to m.fetprofile do %>
- <%= image_tag m.fetprofile.picture.portrait %>
-
+ <%= image_tag m.fetprofile.try(:picture).try(:portrait) %>
+
+ <% if m.fetprofile.nil?%>
+ PROFIL fehlt
+ <% else %>
<%= m.fetprofile.name %>
<%= render(m) %>
+ <% end %>
<% end %>
diff --git a/app/views/gremien/verwalten.html.erb b/app/views/gremien/verwalten.html.erb
index ec214f0..3348678 100644
--- a/app/views/gremien/verwalten.html.erb
+++ b/app/views/gremien/verwalten.html.erb
@@ -5,15 +5,25 @@
<%= gremium.typ %>
-
+
<%= gremium.name %>
<%= gremium.desc %>
-
- <%= link_to 'Show', gremium %>
- <%= link_to 'Edit', edit_gremium_path(gremium) %>
- <%= link_to 'Destroy', gremium, method: :delete, data: { confirm: 'Are you sure?' } %>
+
+
+ <%= link_to 'Show', gremium,{:class=>"btn"} %>
+
+
+
+
<% end %>