meeting style

This commit is contained in:
Andreas Stephanides
2015-03-15 13:09:05 +01:00
parent 3cc9de7d29
commit 34c0374877
11 changed files with 55 additions and 24 deletions

View File

@@ -21,6 +21,7 @@ class MeetingsController < ApplicationController
m=Meeting.find(params[:id])
m.create_announcement(current_user)
m.save
@meeting=Meeting.find(params[:id])
respond_to do |format|
format.html {redirect_to m.parent}

View File

@@ -85,8 +85,16 @@ end
summary
end
end
def icon_text
ApplicationController.helpers.fa_icon("calendar 2x") + self.text
end
def text
I18n.l(self.start) +" "+ I18n.t("cal.bis")+" "+ I18n.l(self.ende)
if (self.start.to_date - self.ende.to_date) < 1.day
format=:timeonly
else
format =:default
end
I18n.l(self.start) +" "+ I18n.t("cal.bis")+" "+ I18n.l(self.ende, :format=>format)
end
scope :public, -> { where(:public => :true) }
# scope :upcoming, -> { where("start >= ?" , Time.now).where("start <= ?", 28.days.from_now) }

View File

@@ -21,6 +21,7 @@ class Meeting < ActiveRecord::Base
def title
self.text
end
def text
unless self.meetingtyp.try(:name).to_s.empty?
t = self.meetingtyp.name.to_s+", "
@@ -29,18 +30,23 @@ class Meeting < ActiveRecord::Base
t = parent.title.to_s + ", " if self.name.empty?
end
t= t+ self.name.to_s
t = t + " " + I18n.l(self.calentry.start) unless self.calentry.nil?
# t = t + " " + I18n.l(self.calentry.start) unless self.calentry.nil?
t = t +" am "+ self.calentry.text unless self.calentry.nil?
t
end
def create_announcement(user)
if self.neuigkeit.nil?
n = Neuigkeit.new
n.title=self.text
n.text ="Agenda im Anhang"
n.rubrik = self.meetingtyp.rubrik
n.author=user
n.save
self.neuigkeit= n
end
end
def fix_calentry
self.calentry.object=self unless self.calentry.nil?
self.calentry.calendar = self.meetingtyp.rubrik.calendar

View File

@@ -1,11 +1,14 @@
class Meetingtyp < ActiveRecord::Base
attr_accessible :agendaintern, :desc, :name, :protocolintern, :rubrik_id
attr_accessible :agendaintern, :desc, :name, :protocolintern, :rubrik_id, :picture
belongs_to :rubrik
validate :rubrik, :presence=>true
has_many :meetings
has_one :calendar, through: :rubrik
has_one :protocol, :class_name=>'Document', :conditions=>{:typ=>10}, :as=>:parent
has_one :agenda , :as=>:parent, :conditions=>{:typ=>11}, :class_name=>'Document'
mount_uploader :picture, PictureUploader
def text
self.name
end

View File

@@ -39,7 +39,17 @@ class Neuigkeit < ActiveRecord::Base
before_validation :sanitize
after_save :update_cache
def picture_robust
unless self.picture.url.nil?
return self.picture
else
if self.has_meeting?
return self.meeting.meetingtyp.picture
else
return self.picture
end
end
end
def is_annoncement?
!self.meeting.nil?
end

View File

@@ -1,13 +1,6 @@
<div class="contentbox" id="calentry_<%= calentry.id%>">
<% image_tag("/iconnavy/time.png") %>
<%= fa_icon("calendar 2x") %>
<% if (calentry.start.to_date - calentry.ende.to_date) < 1.day
format=:timeonly
else
format =:default
end %>
<%= calentry.text %>
<%= calentry.icon_text %>
<% if !(defined? manage) || manage %>
<%= 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 %>

View File

@@ -1,11 +1,11 @@
<div class="contentbox" id="meeting_<%= meeting.id%>">
<b><%= link_to meeting.text, meeting %></b>
<b><%= image_tag meeting.meetingtyp.picture.thumb.url unless meeting.meetingtyp.picture.thumb.url.nil? %><%= link_to meeting.text.html_safe, meeting %></b>
<%= link_to "Ankündigung", rubrik_neuigkeit_path(meeting.neuigkeit.rubrik, meeting.neuigkeit) unless 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 'Delete', meeting, method: :delete, data: { confirm: 'Are you sure?' } , remote: true if can? :delete, meeting %>
<%= render meeting.calentry, locals: {manage: 0} 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 "Protokoll" , create_protocol_meeting_path(meeting),:remote=>true if meeting.protocol.nil? %>
<%= render meeting.agenda unless meeting.agenda.nil? %>

View File

@@ -4,6 +4,9 @@
<%= f.input :rubrik %>
<%= f.input :agendaintern %>
<%= f.input :protocolintern %>
<%= image_tag @meetingtyp.picture.thumb.url %>
<%= f.input :picture %>
<% end %>
<%= f.actions do %>
<%= f.action :submit, :as => :input %>

View File

@@ -1,8 +1,10 @@
<div class="media" itemscope itemtype="http://schema.org/Article">
<meta itemprop="sameAs" content="<%= rubrik_neuigkeit_path(neuigkeit.rubrik,neuigkeit, {theme: nil,locale: nil})%>"/>
<meta itemprop="url" content="<%= rubrik_neuigkeit_path(neuigkeit.rubrik,neuigkeit, {theme: nil,locale: nil})%>"/>
<div class="pull-left" href="#">
<p><br>
<% unless neuigkeit.picture.url.nil? %><%= image_tag neuigkeit.picture.thumb.url %> <meta imageprop="thumbnailUrl" content="<%= neuigkeit.picture.thumb.url%>"/>
<% unless neuigkeit.picture_robust.url.nil? %><%= image_tag neuigkeit.picture_robust.thumb.url %> <meta imageprop="thumbnailUrl" content="<%= neuigkeit.picture_robust.thumb.url%>"/>
<% end %> </p>
</div>
<div class="media-body">

View File

@@ -1,9 +1,9 @@
<%= content_for :header do %>
<title>Fetsite - <%= @neuigkeit.title %> (<%= @neuigkeit.rubrik.name %>)</title>
<% set_meta_tags :author => fetprofile_path(@neuigkeit.author.fetprofile) unless @neuigkeit.author.fetprofile.nil? %>
<% unless @neuigkeit.picture.url.nil?
<% unless @neuigkeit.picture_robust.url.nil?
picture_url=URI(root_url)
picture_url.path=@neuigkeit.picture.url(:locale=>nil, :theme=>nil)
picture_url.path=@neuigkeit.picture_robust.url(:locale=>nil, :theme=>nil)
end
%>
<% set_meta_tags :og => {
@@ -49,9 +49,9 @@ end
<div class="sticker sticker-red"> Not Published</div> <% end %>
<div class="media">
<% unless @neuigkeit.picture.big_thumb.to_s.empty? %>
<% unless @neuigkeit.picture_robust.big_thumb.to_s.empty? %>
<div class="pull-left" href="#">
<p><br><%= link_to image_tag(@neuigkeit.picture.big_thumb.url),@neuigkeit.picture.try(:url) %>
<p><br><%= link_to image_tag(@neuigkeit.picture_robust.big_thumb.url),@neuigkeit.picture_robust.try(:url) %>
</p>
</div>
<% end %>

View File

@@ -0,0 +1,5 @@
class AddPictureToMeetingtyps < ActiveRecord::Migration
def change
add_column :meetingtyps, :picture, :string
end
end