etforum link

This commit is contained in:
2014-07-09 23:49:48 +05:30
parent 4bc7c4b001
commit 38394df7c3
5 changed files with 22 additions and 8 deletions

View File

@@ -40,7 +40,7 @@ class Lva < ActiveRecord::Base
has_paper_trail :ignore=>[:desc, :pruefungsinformation]# Versionsverfolgung
translates :desc,:pruefungsinformation, :fallbacks_for_empty_translations => true, :versioning=>true
attr_accessible :desc, :ects, :lvanr, :name, :stunden, :modul_ids, :semester_ids, :pruefungsinformation, :lernaufwand, :typ, :lecturer_ids
attr_accessible :desc, :ects, :lvanr, :name, :stunden, :modul_ids, :semester_ids, :pruefungsinformation, :lernaufwand, :typ, :lecturer_ids, :forumlink
has_and_belongs_to_many :modul,:uniq=>true # Gehört zu einem Modul
has_and_belongs_to_many :semester

View File

@@ -23,10 +23,11 @@ include Rails.application.routes.url_helpers
validates :text, :presence => true
scope :search, ->(query) {where("text like ? or title like ?", "%#{query}%", "%#{query}%")}
scope :outdated, -> {where("updated_at < ?", 2.month.ago)}
scope :outdated, -> {includes(:translations).where("thema_translations.updated_at<?",2.month.ago).where("thema_translations.locale"=>I18n.t.locale)
}
translates :title,:text, :versioning =>true, :fallbacks_for_empty_translations => true
def is_outdated?
updated_at < 1.month.ago
translation.updated_at < 2.month.ago
end
def is_wiki?
!(wikiname.nil? || wikiname.empty?)

View File

@@ -20,15 +20,20 @@
<%= f.input :ects, :wrapper_html=>{:class=>'span4'} %>
<%= f.input :stunden, :wrapper_html=>{:class=>'span4'} %>
</div>
<div class="row-fluid">
<%= f.input :forumlink, :wrapper_html=>{:class=>'span12'}%>
</div>
</div>
</div>
</div>
<div class="form-group">
<div class="row-fluid">
<%= f.input :desc , :as=>:tinymce_text %>
<%= f.input :pruefungsinformation %>
<%= f.input :lernaufwand %>
</div></div>
<%= f.input :desc , :as=>:tinymce_text %>
<%= f.input :pruefungsinformation %>
<%= f.input :lernaufwand %>
</div>
</div>
</div>
<div class="span3">

View File

@@ -4,7 +4,10 @@
<div class="row-fluid">
<div class="span8">
<h1><%= @lva.full_name %></h1>
<ul class="linklist">
<li><%= link_to ffi1_icon("live2")+"ET-Forum",@lva.forumlink, class: :linkbox unless @lva.forumlink.nil? or @lva.forumlink.empty?%></li>
</ul>
<h2>Prüfungsinformation</h2>
<div class="">
<%= @lva.pruefungsinformation.to_s.html_safe %>

View File

@@ -0,0 +1,5 @@
class AddForumLinkToLvas < ActiveRecord::Migration
def change
add_column :lvas, :forumlink, :string
end
end