meeting fixes

This commit is contained in:
Andreas Stephanides
2015-02-14 17:25:51 +01:00
parent 195b982ef4
commit 14ebb13bc1
7 changed files with 12 additions and 7 deletions

View File

@@ -6,7 +6,7 @@ class MeetingsController < ApplicationController
unless parent.nil? unless parent.nil?
#authorize! :show, parent #authorize! :show, parent
if params[:filter]=="upcomming" if params[:filter]=="upcomming"
@meetings=parent.meetings.includes(:calentry).where("calentries.start>?",1.hour.ago) @meetings=parent.meetings.upcomming
else else
@meetings=parent.meetings @meetings=parent.meetings
end end

View File

@@ -92,6 +92,7 @@ class Ability
if loggedin if loggedin
end end
if( user.has_role?("fetuser") || user.has_role?("fetadmin")) if( user.has_role?("fetuser") || user.has_role?("fetadmin"))
can :showversions, Neuigkeit can :showversions, Neuigkeit
can :showintern, Neuigkeit can :showintern, Neuigkeit
can :showintern, Rubrik can :showintern, Rubrik

View File

@@ -10,7 +10,7 @@ class Meeting < ActiveRecord::Base
has_one :calentry, as: :object has_one :calentry, as: :object
has_one :calendar, :through=>:meetingtyp has_one :calendar, :through=>:meetingtyp
has_one :rubrik, :through=>:meetingtyp has_one :rubrik, :through=>:meetingtyp
scope :upcomming, includes(:calentry).where("calentries.start>?",1.hour.ago)
accepts_nested_attributes_for :calentry accepts_nested_attributes_for :calentry
# validate :agenda, :presence=>true # validate :agenda, :presence=>true
# validate :protocol, :presence=>true # validate :protocol, :presence=>true

View File

@@ -8,6 +8,8 @@
format =:default format =:default
end %> end %>
<%= calentry.text %> <%= calentry.text %>
<% if !(defined? manage) || manage %>
<%= link_to "edit", edit_calentry_path(calentry),:remote=>true if can? :edit, calentry %> <%= link_to "edit", edit_calentry_path(calentry),:remote=>true if can? :edit, calentry %>
<%= link_to 'Delete', calentry, method: :delete, data: { confirm: 'Are you sure?' } , remote: true if can? :delete, calentry %> <%= link_to 'Delete', calentry, method: :delete, data: { confirm: 'Are you sure?' } , remote: true if can? :delete, calentry %>
<% end %>
</div> </div>

View File

@@ -5,7 +5,7 @@
<%= link_to "ankündigen", announce_meeting_path(meeting), remote: true if meeting.neuigkeit.nil? %> <%= link_to "ankündigen", announce_meeting_path(meeting), remote: true if meeting.neuigkeit.nil? %>
<%= link_to "edit", edit_meeting_path(meeting), remote: true %> <%= link_to "edit", edit_meeting_path(meeting), remote: true %>
<%= link_to 'Delete', meeting, method: :delete, data: { confirm: 'Are you sure?' } , remote: true if can? :delete, meeting %> <%= link_to 'Delete', meeting, method: :delete, data: { confirm: 'Are you sure?' } , remote: true if can? :delete, meeting %>
<%= render meeting.calentry unless meeting.calentry.nil? %> <%= render meeting.calentry, locals: {manage: 0} unless meeting.calentry.nil? %>
<%= link_to "Agenda" , create_agenda_meeting_path(meeting), :remote=>true if meeting.agenda.nil? %> <%= link_to "Agenda" , create_agenda_meeting_path(meeting), :remote=>true if meeting.agenda.nil? %>
<%= link_to "Protokoll" , create_protocol_meeting_path(meeting),:remote=>true if meeting.protocol.nil? %> <%= link_to "Protokoll" , create_protocol_meeting_path(meeting),:remote=>true if meeting.protocol.nil? %>
<%= render meeting.agenda unless meeting.agenda.nil? %> <%= render meeting.agenda unless meeting.agenda.nil? %>

View File

@@ -27,8 +27,10 @@
<b>Treffen/Sitzungen</b> <b>Treffen/Sitzungen</b>
<%= link_to "Neues Meeting", new_meeting_path(:parent_id=>small.id, :parent_type=>"Thema"), :remote=>true %> <%= link_to "Neues Meeting", new_meeting_path(:parent_id=>small.id, :parent_type=>"Thema"), :remote=>true %>
<div id="<%= Meeting.new_divid_for(small) %>"></div> <div id="<%= Meeting.new_divid_for(small) %>"></div>
<%= link_to "All", meetings_path(:parent_id=>small.id, :parent_type=>"Thema"), :remote=>true %> <ul class="nav nav-tabs">
<%= link_to "upcomming", meetings_path(:parent_id=>small.id, :parent_type=>"Thema",:filter=>"upcomming"), :remote=>true %> <li><%= link_to "All", meetings_path(:parent_id=>small.id, :parent_type=>"Thema"), :remote=>true if small.meetings.accessible_by(current_ability).count >0 %></li>
<li><%= link_to "upcomming", meetings_path(:parent_id=>small.id, :parent_type=>"Thema",:filter=>"upcomming"), :remote=>true if small.meetings.accessible_by(current_ability).upcomming.count >0 %></li>
</ul>
<%= render :partial=>"meetings/meeting_list", object: small.meetings, locals: {parent: small} %> <%= render :partial=>"meetings/meeting_list", object: small.meetings, locals: {parent: small} %>
<% end %> <% end %>

View File

@@ -10,7 +10,7 @@
} }
%> %>
<%= <%
unless @thema.titlepics.first.nil? unless @thema.titlepics.first.nil?
picture_url=URI(root_url) picture_url=URI(root_url)
picture_url.path=@thema.titlepics.first.datei.url(:locale=>nil, :theme=>nil) picture_url.path=@thema.titlepics.first.datei.url(:locale=>nil, :theme=>nil)