neuigkeiten rechte

This commit is contained in:
Andreas Stephanides
2014-02-07 22:15:30 +01:00
parent 48fc0455c7
commit 50bceaf017
4 changed files with 17 additions and 4 deletions

View File

@@ -50,7 +50,13 @@ self.title
end
def text_first_words
md = /<p>(?<text>[\w\s,\.!\?]*)/.match self.text
md[:text].split(" ")[0..100].join(" ")+ " ..." unless md[:text].split(" ").empty?
words=md[:text].split(" ") unless md.nil?
if words.nil? || words.empty?
"...."
else
words[0..100].join(" ")+ " ..." unless words.nil?
end
end
def has_calentries?
!self.calentries.nil? && !self.calentries.empty?