forked from bofh/fetsite
fixed fetprofiles
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
<ul class="nav nav-tabs">
|
||||
<li <%= (request.fullpath == fetprofiles_path(filter: "active")|| request.fullpath == fetprofiles_path) ? 'class="active"'.html_safe : ''%> >
|
||||
<%= link_to "Aktive Mitglieder" , fetprofiles_path( filter: "active") %> </li>
|
||||
<li><%= link_to "Alle Gremien und Gruppen", gremien_path %></li>
|
||||
<%= link_to "Aktive Mitglieder" , fetprofiles_path( filter: "active") %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to "Alle Gremien und Gruppen", gremien_path %>
|
||||
</li>
|
||||
<% for g in @gremientabs %>
|
||||
<li <%= (!@gremium.nil? && g == @gremium) ? 'class="active"'.html_safe : '' %> title="<%= g.name %>">
|
||||
<%= link_to g.name, g %>
|
||||
</li>
|
||||
<% end %>
|
||||
|
||||
<li <%= (request.fullpath == fetprofiles_path(filter: "all")) ? 'class="active"'.html_safe : ''%> >
|
||||
<%= link_to "Alle Mitglieder" , fetprofiles_path( filter: "all") %> </li>
|
||||
|
||||
|
||||
<%= link_to "Alle Mitglieder" , fetprofiles_path( filter: "all") %>
|
||||
</li>
|
||||
<% if can?(:verwalten,Gremium) %>
|
||||
<% if request.fullpath == verwalten_gremien_path %>
|
||||
<li class="active pull-right">
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
<%= image_tag fetprofile.picture.portrait.url %>
|
||||
</span>
|
||||
<div class="media-body">
|
||||
|
||||
<h2><%= fetprofile.name %></h2>
|
||||
<p><%= fetprofile.fetmail %></p>
|
||||
<p><%= fetprofile.desc %></p>
|
||||
@@ -28,4 +27,6 @@
|
||||
<div class="row-fluid">
|
||||
<div class="span12">
|
||||
<%= link_to I18n.t('fetprofiles.new'), new_fetprofile_path %>
|
||||
</div></div></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
</div>
|
||||
<div class="span9">
|
||||
<h2><%= @fetprofile.name %></h2>
|
||||
|
||||
<p>
|
||||
<%= @fetprofile.fetmailalias %>
|
||||
</p>
|
||||
@@ -14,9 +13,8 @@
|
||||
<%= @fetprofile.desc %>
|
||||
</p>
|
||||
<p>
|
||||
<%= "<b>"+I18n.t('fetprofiles.active')+"</b>".html_safe if @fetprofile.active %>
|
||||
<%= link_to 'Destroy', @fetprofile, method: :delete, data: { confirm: 'Are you sure?' } %>
|
||||
</p>
|
||||
<p><%= link_to 'Destroy', @fetprofile, method: :delete, data: { confirm: 'Are you sure?' } %></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -26,15 +24,11 @@
|
||||
<% @fetprofile.memberships.each do |m| %>
|
||||
<li>
|
||||
<%= 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"] %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
||||
|
||||
<%= 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' %>
|
||||
</div>
|
||||
</div></div>
|
||||
|
||||
@@ -16,10 +16,14 @@
|
||||
<% 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 %>
|
||||
<%= image_tag m.fetprofile.try(:picture).try(:portrait) %>
|
||||
<p>
|
||||
<% if m.fetprofile.nil?%>
|
||||
PROFIL fehlt
|
||||
<% else %>
|
||||
<%= m.fetprofile.name %> <br>
|
||||
<%= render(m) %>
|
||||
<% end %>
|
||||
</p>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
@@ -5,14 +5,24 @@
|
||||
<div class="span2">
|
||||
<%= gremium.typ %>
|
||||
</div>
|
||||
<div class="span18">
|
||||
<div class="span8">
|
||||
<b><%= gremium.name %></b>
|
||||
<%= gremium.desc %>
|
||||
</div>
|
||||
<div span="2">
|
||||
<%= link_to 'Show', gremium %>
|
||||
<%= link_to 'Edit', edit_gremium_path(gremium) %>
|
||||
<%= link_to 'Destroy', gremium, method: :delete, data: { confirm: 'Are you sure?' } %>
|
||||
<div class="span2">
|
||||
<div class="btn-group">
|
||||
<%= link_to 'Show', gremium,{:class=>"btn"} %>
|
||||
|
||||
<button class="btn dropdown-toggle" data-toggle="dropdown">
|
||||
<span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu">
|
||||
<li>
|
||||
<%= link_to 'Show', gremium %></li>
|
||||
<li> <%= link_to 'Edit', edit_gremium_path(gremium) %></li>
|
||||
<li> <%= link_to 'Destroy', gremium, method: :delete, data: { confirm: 'Are you sure?' }, class:"btn-danger" %>
|
||||
</li> </ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
Reference in New Issue
Block a user