This commit is contained in:
2014-10-21 13:31:46 +02:00
7 changed files with 30 additions and 17 deletions

View File

@@ -23,9 +23,9 @@ class ThemengruppenController < ApplicationController
def show
@themengruppe = Themengruppe.find(params[:id])
if can? :showdraft , Thema
@themen = @themengruppe.themen.order(:priority).reverse
@themen = @themengruppe.themen
else
@themen = @themengruppe.themen.where(:isdraft=>false).order(:priority).reverse
@themen = @themengruppe.themen.public
end
@toolbar_elements = []
@toolbar_elements << {:icon=>:pencil, :hicon=>'icon-pencil', :text=>I18n.t("themengruppe.manage"), :path=>themengruppe_verwalten_path(@themengruppe)} if can? :edit, @themengruppe

View File

@@ -21,7 +21,8 @@ include Rails.application.routes.url_helpers
validates :themengruppe, :presence => true
validates :title, :presence => true
validates :text, :presence => true
scope :public, where(:isdraft=>false)
default_scope order(:priority).reverse_order
scope :search, ->(query) {where("text like ? or title like ?", "%#{query}%", "%#{query}%")}
scope :outdated, -> {includes(:translations).where("thema_translations.updated_at<?",2.month.ago).where("thema_translations.locale"=>I18n.t.locale)
}

View File

@@ -1,17 +1,20 @@
<div class="content-wrap content-column">
<p>
<%= semantic_form_for :search,:remote=>true, :url=>search_home_index_path, :html=>{:id=>"search_form",:class=>"navbar-search", :method=>'get'} do |f| %>
<%= f.input :query, :input_html => { :name => 'query' } , :label=>false, :class=>"search-query" %>
<%= f.actions do %>
<%= f.action :submit, :as => :input %>
<% end %>
<% end %>
<script>
$( document ).ready(function() {
$("#search_query").bind("keyup", function(event){
$("#search_form").submit();
});
$("#search_query").value="df"
});
</script>
</p>
<p>
<div id="searchresults">
<%= render :partial=>"home/search_results" %>
</div>
</p>
</div>

View File

@@ -36,11 +36,11 @@
<div class="span4">
<div class="contentbox">
<ul>
<li><b>LVA-Nummer:</b> <%=@lva.lvanr %></li>
<li><b><%= I18n.t('lva.lvanr')%>:</b> <%=@lva.lvanr %></li>
<li><b>ECTS:</b> <%=@lva.ects %></li>
<li><b>Stunden:</b> <%=@lva.stunden %></li>
<li><b><%= I18n.t('lva.stunden')%>:</b> <%=@lva.stunden %></li>
</ul>
<h2>Module</h2>
<h2><%= I18n.t('lva.module')%></h2>
<ul>
<% @lva.modul.each do |modul| %>
<li><b><%= link_to modul.name , modul_path(modul)%></b>
@@ -68,6 +68,8 @@
<div class="span12">
<h2><%= I18n.t("lva.bspe") %></h2>
<p><%= I18n.t("lva.ratebsp")%> <%= link_to ffi1_icon("facebook1") + I18n.t('home.fblogin'), user_omniauth_authorize_path(:facebook) ,class: :linkbox %>
</p>
<%= link_to t("beispiel.zip") , beispiel_sammlung_lva_path(@lva), class: :linkbox %>
<% @lva.beispiele.order(:datum).each do |b| %>
<%= render b%>
@@ -78,7 +80,7 @@
<div class="row-fluid">
<div class="span12">
<% unless @lva.nlinks.empty? %>
<h2>Neuigkeiten</h2>
<h2><%= I18n.t("rubrik.title") %></h2>
<% @lva.nlinks.each do |l| %>
<%= render l.neuigkeit %>
<% end %>

View File

@@ -6,6 +6,8 @@
<ul class="dropdown-menu">
<li><%= link_to thema_path(thema),:remote=>true do %> <%= fa_icon('eye') %> Show <% end %></li>
<li><%= link_to edit_thema_path(thema),:remote=>true do %> <%= ff_icon('icon-pencil') %> Edit <% end %> </li>
<li><%= link_to sanitize_thema_path(thema),:remote=>true do %> <%= ff_icon('icon-leaf') %> Sanitize <% end %> </li>
<li><%= link_to fragen_thema_path(thema),:remote=>true do %> Fragen <% end %></li>
<li><%= link_to attachments_thema_path(thema),:remote=>true do %> Attachments <% end %></li>
</ul>

View File

@@ -34,8 +34,9 @@
<div class="span6">
<!--<b><%= I18n.t("themengruppe.themen") %></b>
--><ul>
<% themengruppe.themen.where(" (NOT hidelink) and ( NOT isdraft) ").order(:priority).reverse.each do |t| %>
-->
<ul>
<% themengruppe.themen.where(:hidelink=>false).where(:isdraft=>false).each do |t| %>
<li>
<%= render t %>
</li>

View File

@@ -29,5 +29,9 @@ de:
lernaufwand: "Lernaufwand"
desc: "Beschreibung"
bspe: "Beispiele"
module: "Module"
lvanr: "LVA-Nummer"
stunden: "Stunden"
ratebsp: "Möchtest du die Beispiele bewerten musst du dich einloggen. Derzeit funktioniert das über Facebook, wir arbeiten an einem Login über TISS!"
home:
newexamples: "Neueste Beispiele"