diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index ee897d1..806822f 100755 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -32,7 +32,7 @@ class HomeController < ApplicationController def search unless params['query'].nil? || params['query'].empty? - @results = Sunspot.search Neuigkeit, Fetprofile do + @results = Sunspot.search Neuigkeit,Rubrik, Fetprofile, Thema, Themengruppe, Lva, Studium, Modul, Modulgruppe do fulltext params['query'] end @neuigkeiten=[]; @@ -43,12 +43,13 @@ class HomeController < ApplicationController end # @fetprofiles = Fetprofile.search(params['query']) @fetprofiles=[] - if can?(:showintern, Neuigkeit) - @themen=Thema.search(params['query']) - else - @themen=Thema.search(params['query']).public - end - + # if can?(:showintern, Neuigkeit) + # @themen=Thema.search(params['query']) + # else + # @themen=Thema.search(params['query']).public + # end + @themen=[] + else @neuigkeiten=[] @fetprofiles=[] diff --git a/app/models/lva.rb b/app/models/lva.rb index adf7d32..0021a71 100755 --- a/app/models/lva.rb +++ b/app/models/lva.rb @@ -198,6 +198,15 @@ class Lva < ActiveRecord::Base newlvas end + + searchable do + text :desc + text :pruefungsinformation + text :lernaufwand + text :typ + text :name, :boost=>3.0 + end + def self.update_multiple_with_modul(hash,modul) newlvas=[] hash.each do |i,l| @@ -222,5 +231,5 @@ class Lva < ActiveRecord::Base newlvas end - + end diff --git a/app/models/modul.rb b/app/models/modul.rb index 1c3bb42..f1bbd40 100755 --- a/app/models/modul.rb +++ b/app/models/modul.rb @@ -53,4 +53,9 @@ class Modul < ActiveRecord::Base end m end + + searchable do + text :desc + text :name, :boost=>3.0 + end end diff --git a/app/models/modulgruppe.rb b/app/models/modulgruppe.rb index 7e45fd7..782af3b 100755 --- a/app/models/modulgruppe.rb +++ b/app/models/modulgruppe.rb @@ -32,4 +32,10 @@ class Modulgruppe < ActiveRecord::Base def studium_name self.studium.nil? ? "Kein Studium vorhanden" : self.studium.name end + searchable do + text :desc + text :typ + text :name, :boost=>3.0 + end + end diff --git a/app/models/neuigkeit.rb b/app/models/neuigkeit.rb index 9f36e6e..c23be25 100755 --- a/app/models/neuigkeit.rb +++ b/app/models/neuigkeit.rb @@ -84,7 +84,8 @@ class Neuigkeit < ActiveRecord::Base end end searchable do - text :text, :datum + text :text + text :datum text :title, :boost=>3.0 end end diff --git a/app/models/rubrik.rb b/app/models/rubrik.rb index ca4bfec..8d862fb 100755 --- a/app/models/rubrik.rb +++ b/app/models/rubrik.rb @@ -35,4 +35,10 @@ end self.calendar.public=self.public self.calendar.save end + + searchable do + text :desc + text :name, :boost=>4.0 + end + end diff --git a/app/models/studium.rb b/app/models/studium.rb index 044ae08..ceb73c6 100755 --- a/app/models/studium.rb +++ b/app/models/studium.rb @@ -84,5 +84,12 @@ validates :abkuerzung, :length=>{:maximum=>5}, :format=>{:with=>/^[a-zA-z]{0,5}$ "" end end + searchable do + text :desc + text :zahl + text :typ + text :abkuerzung + text :name, :boost=>3.0 + end end diff --git a/app/models/thema.rb b/app/models/thema.rb index 997b88c..6635dd8 100644 --- a/app/models/thema.rb +++ b/app/models/thema.rb @@ -23,8 +23,14 @@ include Rails.application.routes.url_helpers validates :text, :presence => true scope :public, where(:isdraft=>false).includes(:themengruppe).where("themengruppen.public"=>true) default_scope order("themen.priority").reverse_order - scope :search, ->(query) {where("themen.text like ? or themen.title like ?", "%#{query}%", "%#{query}%")} - scope :outdated, -> {includes(:translations).where("thema_translations.updated_atI18n.t.locale) + # scope :search, ->(query) {where("themen.text like ? or themen.title like ?", "%#{query}%", "%#{query}%")} + searchable do + text :text + text :title, :boost=>4.0 + end + + +scope :outdated, -> {includes(:translations).where("thema_translations.updated_atI18n.t.locale) } translates :title,:text, :versioning =>true, :fallbacks_for_empty_translations => true def is_outdated? diff --git a/app/models/themengruppe.rb b/app/models/themengruppe.rb index 8b22b5d..53ec90b 100644 --- a/app/models/themengruppe.rb +++ b/app/models/themengruppe.rb @@ -36,4 +36,9 @@ end self.save; end + searchable do + text :text + text :title, :boost=>4.0 + end + end diff --git a/app/views/home/_search_results.html.erb b/app/views/home/_search_results.html.erb index e640bd6..fe722ad 100644 --- a/app/views/home/_search_results.html.erb +++ b/app/views/home/_search_results.html.erb @@ -1,8 +1,17 @@ <% unless @results.nil? %> -<%= @results.results.each do |res| %> -<%= render res %> + <% end %> <% unless @neuigkeiten.empty? %> diff --git a/app/views/modulgruppen/_nlink.html.erb b/app/views/modulgruppen/_nlink.html.erb new file mode 100644 index 0000000..d37790d --- /dev/null +++ b/app/views/modulgruppen/_nlink.html.erb @@ -0,0 +1 @@ +

<%= nlink.name %>

diff --git a/app/views/moduls/_modul.html.erb b/app/views/moduls/_modul.html.erb index 93844aa..c9855d5 100755 --- a/app/views/moduls/_modul.html.erb +++ b/app/views/moduls/_modul.html.erb @@ -1,9 +1,9 @@ -

<%= @modul.name %>

+

<%= modul.name %>

<%=I18n.t("modul.lvas")%>

- <% @modul.lvas.each_slice(3) do |row| %> + <% modul.lvas.each_slice(3) do |row| %>

<%=I18n.t("modul.mgs")%>

    - <% @modul.modulgruppen.each do |mg| %> + <% modul.modulgruppen.each do |mg| %>
  • <%= render 'modulgruppen/kurz', :modulgruppe=>mg %>
  • diff --git a/app/views/moduls/_nlink.html.erb b/app/views/moduls/_nlink.html.erb new file mode 100644 index 0000000..e8eddd0 --- /dev/null +++ b/app/views/moduls/_nlink.html.erb @@ -0,0 +1,2 @@ +Modul: +<%= nlink.name %> diff --git a/app/views/neuigkeiten/_nlink.html.erb b/app/views/neuigkeiten/_nlink.html.erb new file mode 100644 index 0000000..41e90b0 --- /dev/null +++ b/app/views/neuigkeiten/_nlink.html.erb @@ -0,0 +1,3 @@ + +

    <%= nlink.title %>

    + diff --git a/app/views/rubriken/_nlink.html.erb b/app/views/rubriken/_nlink.html.erb new file mode 100644 index 0000000..48fdb92 --- /dev/null +++ b/app/views/rubriken/_nlink.html.erb @@ -0,0 +1,3 @@ + +

    <%= nlink.name %>

    + diff --git a/app/views/rubriken/_rubrik.html.erb b/app/views/rubriken/_rubrik.html.erb new file mode 100644 index 0000000..e69de29 diff --git a/app/views/studien/_nlink.html.erb b/app/views/studien/_nlink.html.erb index 0e415ab..70b25f7 100644 --- a/app/views/studien/_nlink.html.erb +++ b/app/views/studien/_nlink.html.erb @@ -1,2 +1,17 @@ -

    <%= nlink.name %>

    -

    <%= nlink.desc_first_words %>

    +<% studium=nlink %> +
    +<% unless studium.picture.thumb.url.nil? %> +
    + <%= image_tag studium.picture.thumb.url %> +
    +<% end %> +
    +

    + <%= studium.name + " " + studium.zahl.to_s %> +

    +

    + <%= studium.typ%> +

    + +
    +
    diff --git a/app/views/themengruppen/_nlink.html.erb b/app/views/themengruppen/_nlink.html.erb new file mode 100644 index 0000000..35f5eab --- /dev/null +++ b/app/views/themengruppen/_nlink.html.erb @@ -0,0 +1 @@ +

    <%= nlink.title %>