From cdcbce6803aef2da44d8047c26a9947fe367e1ed Mon Sep 17 00:00:00 2001 From: Bernhard Stampfer Date: Tue, 27 Jan 2015 17:26:55 +0100 Subject: [PATCH 01/35] Fixes bug in Neuigkeiten mobile view, see picture If display width forced header (Rubrik / User+Date) to display in two lines whole content of Neuigkeit was squeezed to the width of the whitespace left to the lower line --- app/views/neuigkeiten/show.html.erb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/views/neuigkeiten/show.html.erb b/app/views/neuigkeiten/show.html.erb index 8e33317..e96a52e 100755 --- a/app/views/neuigkeiten/show.html.erb +++ b/app/views/neuigkeiten/show.html.erb @@ -23,6 +23,7 @@ end

<%= notice %>

+
<%= ff_icon(@neuigkeit.rubrik.icon) unless @neuigkeit.rubrik.icon.nil? or @neuigkeit.rubrik.icon.empty? %> <%= @neuigkeit.rubrik.name %> @@ -30,6 +31,7 @@ end <%= @neuigkeit.author.email.to_s unless @neuigkeit.try(:author).try(:email).to_s %> <%= @neuigkeit.author.text+ " "+ I18n.t("neuigkeit.am")+" " + I18n.l(@neuigkeit.try(:datum).try(:to_date)) unless @neuigkeit.try(:datum).try(:to_date).nil? %> +
<% unless @neuigkeit.picture.big_thumb.to_s.empty? %>
From db0a50acf2015d206b47f84f9184e3af1eec78f9 Mon Sep 17 00:00:00 2001 From: Bernhard Stampfer Date: Wed, 28 Jan 2015 09:18:26 +0100 Subject: [PATCH 02/35] LVA ECTS/Std right-aligned Uses style="overflow:auto" to keep the Box arround the Modul sized correctly, even if left and right aligned text uses more than one line. This seems to hide the bulltes in chromium for some reason (shown in firefox) --- app/views/lvas/_lva_semester.html.erb | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/app/views/lvas/_lva_semester.html.erb b/app/views/lvas/_lva_semester.html.erb index 85b076e..f0c1bc6 100755 --- a/app/views/lvas/_lva_semester.html.erb +++ b/app/views/lvas/_lva_semester.html.erb @@ -1,5 +1,8 @@ - -
- <%=lva.lvanr.to_s %> <%= link_to lva.full_name, lva_path(lva)%> <%= lva.ects %> ECTS / <%= lva.stunden %> Std
- -
+
+ + <%=lva.lvanr.to_s %> <%= link_to lva.full_name, lva_path(lva)%> + + + <%= lva.ects %> ECTS / <%= lva.stunden %> Std + +
From 17317143671cad38b3a830d8c648547bf621e4f4 Mon Sep 17 00:00:00 2001 From: Bernhard Stampfer Date: Wed, 28 Jan 2015 09:35:08 +0100 Subject: [PATCH 03/35] Layout changes for blue1 Ist das so ok, oder soll ich besser ein neues theme machen? --- app/views/home/_beispiele.html.erb | 2 +- app/views/themes/blue1/home/index.html.erb | 19 ++++++------------- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/app/views/home/_beispiele.html.erb b/app/views/home/_beispiele.html.erb index 23d90c4..042288c 100644 --- a/app/views/home/_beispiele.html.erb +++ b/app/views/home/_beispiele.html.erb @@ -7,7 +7,7 @@ <%= link_to I18n.t("beispiel.add"), new_beispiel_path, :class=>"linkbox"%>
-
+
- +
+<%= render @thema.themengruppe %> +
<% # render :partial=>'layouts/pretty_toolbar' %> From 5439d33a3c953d2ced23f36da2755f6ed5532204 Mon Sep 17 00:00:00 2001 From: Andreas Stephanides Date: Wed, 11 Feb 2015 18:54:10 +0100 Subject: [PATCH 12/35] thema show width --- app/views/themen/show.html.erb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/views/themen/show.html.erb b/app/views/themen/show.html.erb index 93e79ec..2a51a58 100644 --- a/app/views/themen/show.html.erb +++ b/app/views/themen/show.html.erb @@ -19,7 +19,8 @@ end

<%= notice %>

<% link_to "Zurück", @thema.themengruppe %> -<% thema=@thema %> +<% thema=@thema %>
+
<%= render :partial => 'themen/small', :object => thema %>
    @@ -43,6 +44,6 @@ end
    <%= render @thema.themengruppe %>
    - +
<% # render :partial=>'layouts/pretty_toolbar' %> From 29a35f76d8531761f2ac491642afecee249478f1 Mon Sep 17 00:00:00 2001 From: Andreas Stephanides Date: Wed, 11 Feb 2015 20:53:25 +0100 Subject: [PATCH 13/35] modify attachments --- app/controllers/attachments_controller.rb | 11 ++++++- app/models/attachment.rb | 4 +-- app/models/thema.rb | 1 + app/views/themen/_attachment_list.html.erb | 3 ++ app/views/themen/_small.html.erb | 3 +- app/views/themen/show.html.erb | 29 +++++++++++-------- config/routes.rb | 6 +++- ...20150211180445_add_parent_to_attachment.rb | 7 +++++ .../20150211180912_add_flags_to_attachment.rb | 5 ++++ 9 files changed, 52 insertions(+), 17 deletions(-) create mode 100644 db/migrate/20150211180445_add_parent_to_attachment.rb create mode 100644 db/migrate/20150211180912_add_flags_to_attachment.rb diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index 59ea3df..d05b234 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -13,6 +13,15 @@ class AttachmentsController < ApplicationController # GET /attachments/1 # GET /attachments/1.json + def set_titlepic + @attachment = Attachment.find(params[:id]) + if @attachment.image? + @attachment.flag_titlepic = params[:titlepic] + @attachment.thema.titlepics << @attachment + @attachment.save + end + redirect_to @attachment.thema + end def show @attachment = Attachment.find(params[:id]) @@ -27,7 +36,7 @@ class AttachmentsController < ApplicationController def new @attachment = Attachment.new @thema = Thema.find(params[:thema_id]) - @attachment.thema = @thema + @attachment.thema = @thema respond_to do |format| format.html # new.html.erb diff --git a/app/models/attachment.rb b/app/models/attachment.rb index 3301381..b1e7883 100644 --- a/app/models/attachment.rb +++ b/app/models/attachment.rb @@ -12,12 +12,12 @@ class Attachment < ActiveRecord::Base has_paper_trail - attr_accessible :name, :datei, :datei_cache + attr_accessible :name, :datei, :datei_cache,:flag_titlepic belongs_to :thema mount_uploader :datei, AttachmentUploader validates :thema, :presence => true validates :name, :presence => true - + belongs_to :parent, :polymorphic=>true def image? # data_ext = datei.file.extension.downcase diff --git a/app/models/thema.rb b/app/models/thema.rb index 8f5fe2a..f9d506f 100644 --- a/app/models/thema.rb +++ b/app/models/thema.rb @@ -22,6 +22,7 @@ include Rails.application.routes.url_helpers validates :themengruppe, :presence => true validates :title, :presence => true validates :text, :presence => true + has_many :titlepics, :as=>:parent, :class_name=>'Attachment', :conditions=>{:flag_titlepic=>true} has_many :meetings, :as=>:parent has_many :documents, :as=>:parent scope :public, where(:isdraft=>false).includes(:themengruppe).where("themengruppen.public"=>true) diff --git a/app/views/themen/_attachment_list.html.erb b/app/views/themen/_attachment_list.html.erb index 818aa05..d8ddb52 100644 --- a/app/views/themen/_attachment_list.html.erb +++ b/app/views/themen/_attachment_list.html.erb @@ -12,6 +12,9 @@ Actions
diff --git a/app/views/meetings/_meeting.html.erb b/app/views/meetings/_meeting.html.erb index 9298e28..08c3362 100644 --- a/app/views/meetings/_meeting.html.erb +++ b/app/views/meetings/_meeting.html.erb @@ -5,7 +5,7 @@ <%= 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 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? %> diff --git a/app/views/themen/_small.html.erb b/app/views/themen/_small.html.erb index ac371e3..82a4409 100644 --- a/app/views/themen/_small.html.erb +++ b/app/views/themen/_small.html.erb @@ -27,8 +27,10 @@ Treffen/Sitzungen <%= link_to "Neues Meeting", new_meeting_path(:parent_id=>small.id, :parent_type=>"Thema"), :remote=>true %>
-<%= link_to "All", meetings_path(:parent_id=>small.id, :parent_type=>"Thema"), :remote=>true %> -<%= link_to "upcomming", meetings_path(:parent_id=>small.id, :parent_type=>"Thema",:filter=>"upcomming"), :remote=>true %> + <%= render :partial=>"meetings/meeting_list", object: small.meetings, locals: {parent: small} %> <% end %> diff --git a/app/views/themen/show.html.erb b/app/views/themen/show.html.erb index af06bba..692df6f 100644 --- a/app/views/themen/show.html.erb +++ b/app/views/themen/show.html.erb @@ -10,7 +10,7 @@ } %> -<%= +<% unless @thema.titlepics.first.nil? picture_url=URI(root_url) picture_url.path=@thema.titlepics.first.datei.url(:locale=>nil, :theme=>nil) From b4683bd3967093f0269d7b1764f205bb55358817 Mon Sep 17 00:00:00 2001 From: Andreas Stephanides Date: Sat, 14 Feb 2015 17:26:33 +0100 Subject: [PATCH 16/35] rubrik / Themen -> accessible by --- app/controllers/rubriken_controller.rb | 33 +++++++++++--------------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/app/controllers/rubriken_controller.rb b/app/controllers/rubriken_controller.rb index 8131a8a..2a75c97 100755 --- a/app/controllers/rubriken_controller.rb +++ b/app/controllers/rubriken_controller.rb @@ -2,13 +2,16 @@ class RubrikenController < ApplicationController before_filter {@toolbar_elements=[]} load_and_authorize_resource def index - if can?(:showintern, Rubrik) - @rubriken = Rubrik.all - @neuigkeiten = Neuigkeit.page(params[:page]).per(3) - else - @rubriken = Rubrik.where(:public=>true) - @neuigkeiten = Neuigkeit.public.published.page(params[:page]).per(3) - end + # if can?(:showintern, Rubrik) + # @rubriken = Rubrik.all + # @neuigkeiten = Neuigkeit.page(params[:page]).per(3) + # else + # @rubriken = Rubrik.where(:public=>true) + # @neuigkeiten = Neuigkeit.public.published.page(params[:page]).per(3) + # end + + @rubriken= Rubrik.accessible_by(current_ability, :show) + @neuigkeiten = Neuigkeit.accessible_by(current_ability, :show).page(params[:page]).per(3) @calentries= (@rubriken.map {|r| r.calendar}).collect(&:calentries).flatten.select {|c| c.object !=nil} respond_to do |format| @@ -21,20 +24,13 @@ class RubrikenController < ApplicationController end def show - if can?(:shownonpublic, Rubrik) - @rubriken = Rubrik.all - else - @rubriken = Rubrik.where(:public=>true) - end - + @rubriken= Rubrik.accessible_by(current_ability, :show) @rubrik = Rubrik.find(params[:id]) @moderatoren=User.with_role(:newsmoderator,@rubrik) + @calentries= @rubrik.calendar.calentries.select {|c| c.object !=nil} - if can?(:showunpublished, Neuigkeit) - @neuigkeiten = @rubrik.neuigkeiten.page(params[:page]).per(3) - else - @neuigkeiten = @rubrik.neuigkeiten.published.page(params[:page]).per(3) - end + @neuigkeiten = @rubrik.neuigkeiten.accessible_by(current_ability, :show).page(params[:page]).per(3) + @toolbar_elements << {:text=>I18n.t('neuigkeit.new.title'), :path=> new_rubrik_neuigkeit_path(@rubrik),:hicon=>'icon-plus-sign'} if can? :verwalten, @rubrik @toolbar_elements << {:text=>I18n.t('common.verwalten'), :path=>verwalten_rubrik_path(@rubrik),:icon=>:pencil} if can? :verwalten, @rubrik @@ -47,7 +43,6 @@ class RubrikenController < ApplicationController def new @rubrik = Rubrik.new - end def edit From 5c8b8dcfe69112133718adcd216c90510cb84980 Mon Sep 17 00:00:00 2001 From: Andreas Stephanides Date: Sat, 14 Feb 2015 17:26:37 +0100 Subject: [PATCH 17/35] fixes --- app/controllers/themengruppen_controller.rb | 12 ++++-------- app/views/themen/_attachment_verwalten.html.erb | 11 ++++++++++- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/app/controllers/themengruppen_controller.rb b/app/controllers/themengruppen_controller.rb index d47a734..64d79ba 100644 --- a/app/controllers/themengruppen_controller.rb +++ b/app/controllers/themengruppen_controller.rb @@ -3,7 +3,7 @@ class ThemengruppenController < ApplicationController # GET /themengruppen.json load_and_authorize_resource def index - @themengruppen = Themengruppe.where(:public=>true).order(:priority).reverse + @themengruppen = Themengruppe.accessible_by(current_ability, :show).order(:priority).reverse_order @toolbar_elements = [] @toolbar_elements << {:icon=>:plus, :hicon=>'icon-plus-sign', :text=>I18n.t('themengruppe.new'), :path=>new_themengruppe_path()} if can? :new, Themengruppe @toolbar_elements << {:icon=>:plus, :hicon=>'icon-plus-sign', :text=>I18n.t('themengruppe.manage_all'), :path=>verwalten_all_themengruppen_path()} if can? :verwalten_all, Themengruppe @@ -22,11 +22,8 @@ class ThemengruppenController < ApplicationController # GET /themengruppen/1.json def show @themengruppe = Themengruppe.find(params[:id]) - if can? :showdraft , Thema - @themen = @themengruppe.themen - else - @themen = @themengruppe.themen.public - end + @themen=@themengruppe.themen.accessible_by(current_ability, :show) + @toolbar_elements = [] @toolbar_elements << {:icon=>:pencil, :hicon=>'icon-pencil', :text=>I18n.t("themengruppe.manage"), :path=>themengruppe_verwalten_path(@themengruppe)} if can? :edit, @themengruppe @@ -53,7 +50,7 @@ class ThemengruppenController < ApplicationController end def verwalten_all @themengruppen =Themengruppe.public.order(:priority).reverse -@themengruppen_intern =Themengruppe.intern.order(:priority).reverse + @themengruppen_intern =Themengruppe.intern.order(:priority).reverse @toolbar_elements = [{:icon=>:plus, :hicon=>'icon-plus-sign', :text=>I18n.t('themengruppe.new'), :path=>new_themengruppe_path()}] end @@ -63,7 +60,6 @@ class ThemengruppenController < ApplicationController @toolbar_elements =[] @toolbar_elements << {:text=>I18n.t('themengruppe.show'), :path=>themengruppe_path(@themengruppe)} if can? :show, @themengruppe - @toolbar_elements << {:icon=>:pencil, :hicon=>'icon-pencil', :text=>I18n.t('themengruppe.edit'), :path=>edit_themengruppe_path(@themengruppe)} if can? :edit, @themengruppe @toolbar_elements << {:icon=>:plus, :hicon=>'icon-plus-sign', :text=>I18n.t('thema.add'), :path=>new_themengruppe_thema_path(@themengruppe), :remote=>true} if can? :new, Thema @toolbar_elements << {:hicon=>'icon-remove-circle',:text=>I18n.t('themengruppe.remove'), :path=>themengruppe_path(@themengruppe), :method=>:delete,:confirm=>I18n.t('themengruppe.sure')} if can? :delete, @themengruppe diff --git a/app/views/themen/_attachment_verwalten.html.erb b/app/views/themen/_attachment_verwalten.html.erb index 8fb67c3..e4180d9 100644 --- a/app/views/themen/_attachment_verwalten.html.erb +++ b/app/views/themen/_attachment_verwalten.html.erb @@ -1,3 +1,12 @@ +
+Titlepics -<%= render :partial=>"attachments/form_bulk" %> +<% @thema.titlepics.each do |tp| %> +<%= link_to image_tag(tp.datei.thumb.url) , set_titlepic_thema_attachment_path(tp.thema,tp,:params=>{:titlepic=>false}) %> +<% end %>
+ List <%= render partial: "themen/attachment_list", object:@thema.attachments ,locals: {:editor => true}%> +
+Form +<%= render :partial=>"attachments/form_bulk" %> +
From ebe8d1f8df1fb3203bf78b46ff52405aa15a1cf1 Mon Sep 17 00:00:00 2001 From: Andreas Stephanides Date: Sat, 14 Feb 2015 18:24:46 +0100 Subject: [PATCH 18/35] opengraph --- Gemfile | 2 ++ app/models/neuigkeit.rb | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/Gemfile b/Gemfile index 4d026e7..ba1a015 100755 --- a/Gemfile +++ b/Gemfile @@ -117,6 +117,8 @@ gem 'whenever' gem 'yaml_db' gem 'etherpad-lite' +gem 'opengraph_parser' + # Image gallery gem 'blueimp-gallery' gem 'blueimp-gallery-rails' \ No newline at end of file diff --git a/app/models/neuigkeit.rb b/app/models/neuigkeit.rb index 198ca66..19091b0 100755 --- a/app/models/neuigkeit.rb +++ b/app/models/neuigkeit.rb @@ -64,6 +64,18 @@ class Neuigkeit < ActiveRecord::Base def name self.title end + def load_from_facebook(link) + event=FbGraph::Event.new(link).fetch(:access_token=>"CAABtfB8SO7kBADyHVHnWHqsxsU1bqqmeDdZCp7V1KF9G4o3oFHcZBq0IB8X3ird4muVIPuWKZB8jL1o9JCON60Lmnvk8rkZA2dyZAuU95dC0SWzOEnhtAEkyzZCN6hkKXdl87o38OloLBivc2kjJYmpUVKzdZAD5ywxKG7Hv5FWxXf6amWA782JSmcxgWsRDH4ZAZBXsUrhpnILNOVoKSBf1mGyfrFiPvA3QZD") + self.title=event.name + self.text=event.description + unless event.start_time.nil? + ce=Calentry.new(:start=>event.start_time, :ende=>event.end_time , :typ=>1) + ce.ende=ce.start if ce.ende.nil? + self.calentries<< ce + ce.save + + end + end def text_first_words md = /

(?[^\<\>]*)/.match Sanitize.clean(self.text,:elements=>['p']) words=md[:text].split(" ") unless md.nil? From 415da41236cd09875e624a971ba501b074de2b7e Mon Sep 17 00:00:00 2001 From: Andreas Stephanides Date: Tue, 17 Feb 2015 18:59:28 +0100 Subject: [PATCH 19/35] log file view --- app/controllers/home_controller.rb | 11 ++++++++++- app/views/home/log.html.erb | 1 + config/routes.rb | 1 + 3 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 app/views/home/log.html.erb diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index 0410a28..8d4ccd0 100755 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -26,7 +26,16 @@ class HomeController < ApplicationController end - + def log + authorize! :doadmin, User + lines = params[:lines] + if Rails.env == "production" + @logs = `tail -n #{lines} log/production.log | grep Error` + else + @logs = `tail -n #{lines} log/development.log | grep -v 'actionpack\\|railties\\|activesupport\\|::Translation'` + end + + end def startdev render 'setup_fetsite_dev' end diff --git a/app/views/home/log.html.erb b/app/views/home/log.html.erb new file mode 100644 index 0000000..5359341 --- /dev/null +++ b/app/views/home/log.html.erb @@ -0,0 +1 @@ +

<%= @logs %>
diff --git a/config/routes.rb b/config/routes.rb index 421f549..b38910c 100755 --- a/config/routes.rb +++ b/config/routes.rb @@ -135,6 +135,7 @@ get 'linksnotimplemented' get 'kontakt' get 'choose_contact_topics' + get 'log' end end From a82bafd7acf60350fd7a2fae0c5ba0bd6c90bb2b Mon Sep 17 00:00:00 2001 From: Andreas Stephanides Date: Tue, 17 Feb 2015 18:59:49 +0100 Subject: [PATCH 20/35] absolut url helper --- app/helpers/application_helper.rb | 8 ++++++++ app/views/layouts/application.html.erb | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 400de60..23d9f2f 100755 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -94,4 +94,12 @@ end end raw(html) end + def absurl(path) + if path.nil? + return nil + end + url=URI(root_url) + url.path=path + return url + end end diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 442d443..c6c40b8 100755 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -3,7 +3,7 @@ - + "> From aa6d291495287dc3bdfe5780a773fb0684e24de7 Mon Sep 17 00:00:00 2001 From: Andreas Stephanides Date: Tue, 17 Feb 2015 18:59:58 +0100 Subject: [PATCH 21/35] admin link --- app/views/rubriken/_admin_liste.html.erb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/views/rubriken/_admin_liste.html.erb b/app/views/rubriken/_admin_liste.html.erb index db6a999..c113119 100755 --- a/app/views/rubriken/_admin_liste.html.erb +++ b/app/views/rubriken/_admin_liste.html.erb @@ -5,8 +5,7 @@ <%= fa_icon "globe" if r.public%> <%= r.name %> - <%= n.title %> - + <%= link_to n.title, n %> <%= unless n.datum.nil? From 743914dc58fae9d0ce0f71a6cb886ba7ffd7ebb3 Mon Sep 17 00:00:00 2001 From: Andreas Stephanides Date: Tue, 17 Feb 2015 19:01:57 +0100 Subject: [PATCH 22/35] Themen show corrected --- app/views/themen/show.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/themen/show.html.erb b/app/views/themen/show.html.erb index af06bba..692df6f 100644 --- a/app/views/themen/show.html.erb +++ b/app/views/themen/show.html.erb @@ -10,7 +10,7 @@ } %> -<%= +<% unless @thema.titlepics.first.nil? picture_url=URI(root_url) picture_url.path=@thema.titlepics.first.datei.url(:locale=>nil, :theme=>nil) From e1ffc5ae851035c7c451336422c25042e637b2f4 Mon Sep 17 00:00:00 2001 From: Andreas Stephanides Date: Tue, 17 Feb 2015 19:04:04 +0100 Subject: [PATCH 23/35] gallery order --- app/models/gallery.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/gallery.rb b/app/models/gallery.rb index 2dcbadc..1bb18fc 100644 --- a/app/models/gallery.rb +++ b/app/models/gallery.rb @@ -15,7 +15,7 @@ class Gallery < ActiveRecord::Base attr_accessible :datum, :desc, :name, :foto_ids has_many :fotos, :dependent => :destroy # Delete fotos if gallery is destroyed has_many :nlinks, as: :link -# scope :search, ->(query) {where("name like ? or galleries.desc like ?", "%#{query}%", "%#{query}%")} + default_scope order("galleries.datum").reverse_order searchable do text :desc text :name, :boost=>3.0 From 81e97837defc603ba51f519df798bc33b5d93e03 Mon Sep 17 00:00:00 2001 From: Andreas Stephanides Date: Tue, 17 Feb 2015 19:31:32 +0100 Subject: [PATCH 24/35] filter log fix --- app/controllers/home_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index 8d4ccd0..20a9a49 100755 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -30,7 +30,7 @@ class HomeController < ApplicationController authorize! :doadmin, User lines = params[:lines] if Rails.env == "production" - @logs = `tail -n #{lines} log/production.log | grep Error` + @logs = `tail -n #{lines} log/production.log | grep -v 'actionpack\\|railties\\|activesupport\\|::Translation'` else @logs = `tail -n #{lines} log/development.log | grep -v 'actionpack\\|railties\\|activesupport\\|::Translation'` end From a0427336c8639a07388702407401124930023dce Mon Sep 17 00:00:00 2001 From: Andreas Stephanides Date: Mon, 23 Feb 2015 09:19:30 +0100 Subject: [PATCH 25/35] sticky topics --- app/controllers/home_controller.rb | 1 + app/models/thema.rb | 2 +- app/views/themen/_form.html.erb | 2 ++ db/migrate/20150219142123_add_sticky_to_thema.rb | 9 +++++++++ 4 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20150219142123_add_sticky_to_thema.rb diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index 20a9a49..dedb4e7 100755 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -8,6 +8,7 @@ class HomeController < ApplicationController else @starttopic=@themen = nil end + @stickythemen = Thema.where(:sticky_startpage=>true) end def dev diff --git a/app/models/thema.rb b/app/models/thema.rb index f9d506f..2149dcd 100644 --- a/app/models/thema.rb +++ b/app/models/thema.rb @@ -13,7 +13,7 @@ require 'uri' class Thema < ActiveRecord::Base include Rails.application.routes.url_helpers - attr_accessible :text, :title, :themengruppe_id,:isdraft, :hidelink, :hideattachment + attr_accessible :text, :title, :themengruppe_id,:isdraft, :hidelink, :hideattachment, :sticky_startpage,:sticky_intern has_many :fragen has_many :attachments belongs_to :themengruppe, :foreign_key => "themengruppe_id" diff --git a/app/views/themen/_form.html.erb b/app/views/themen/_form.html.erb index 4995656..3ee1ba9 100644 --- a/app/views/themen/_form.html.erb +++ b/app/views/themen/_form.html.erb @@ -21,6 +21,8 @@
<%= f.input :hideattachment %> + <%= f.input :sticky_intern %> + <%= f.input :sticky_startpage %>
diff --git a/db/migrate/20150219142123_add_sticky_to_thema.rb b/db/migrate/20150219142123_add_sticky_to_thema.rb new file mode 100644 index 0000000..0f6bef7 --- /dev/null +++ b/db/migrate/20150219142123_add_sticky_to_thema.rb @@ -0,0 +1,9 @@ +class AddStickyToThema < ActiveRecord::Migration + def change + add_column :themen, :sticky_startpage, :boolean + add_column :themen, :sticky_intern, :boolean + add_column :themengruppen, :sticky_startpage, :boolean + add_column :themengruppen, :sticky_intern, :boolean + add_column :galleries, :sticky_startpage, :boolean + end +end From 088b3562cc910b5214c074b3480c7eaca62cb9af Mon Sep 17 00:00:00 2001 From: Andreas Stephanides Date: Mon, 23 Feb 2015 09:21:14 +0100 Subject: [PATCH 26/35] admin fixes --- app/controllers/home_controller.rb | 12 ++++++++++-- app/controllers/users_controller.rb | 19 ++++++++++--------- app/views/home/admin.html.erb | 26 ++++++++++++++++++-------- config/environments/development.rb | 2 ++ config/environments/production.rb | 3 +++ 5 files changed, 43 insertions(+), 19 deletions(-) diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index dedb4e7..3d49f08 100755 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -24,7 +24,8 @@ class HomeController < ApplicationController end def admin authorize! :doadmin, User - + t=YAML.load_file("#{::Rails.root.to_s}/config/contact_topic.yml") + @kontaktthemen = Thema.where(:id=>t) end def log @@ -81,7 +82,14 @@ class HomeController < ApplicationController end end def choose_contact_topics - File.open("config/contact_topic.yml",'w'){|f| f.write(params[:themen].to_yaml)} + t=YAML.load_file("#{::Rails.root.to_s}/config/contact_topic.yml") + unless params[:themen].nil? + t=([t].flatten+params[:themen]).uniq + end + unless params[:rmthema].nil? + t=t-[params[:rmthema]] + end + File.open("config/contact_topic.yml",'w'){|f| f.write(t.to_yaml)} redirect_to admin_home_index_path end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 8f55d85..1e73890 100755 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -13,16 +13,17 @@ class UsersController < ApplicationController redirect_to users_url end def fb_set_default_publish_page - if params["page"].nil? || !(current_user.provider=="facebook") - redirect_to intern_home_index_path - else - @fbu=FbGraph::User.new(current_user.uid.to_s).fetch(:access_token=>session["fbuser_access_token"]) - File.open("config/page.yml",'w'){|f| f.write(@fbu.accounts(:access_token=>session["fbuser_access_token"]).select { |p| p.name == params["page"] }.first.to_yaml)} - logger.info @fbu.to_s - logger.info "FbGraph Access" + session["fbuser_access_token"] - redirect_to admin_home_index_path + if Fetsite::Application.config.facebookconfig_enabled + if params["page"].nil? || !(current_user.provider=="facebook") + redirect_to intern_home_index_path + else + @fbu=FbGraph::User.new(current_user.uid.to_s).fetch(:access_token=>session["fbuser_access_token"]) + File.open("config/page.yml",'w'){|f| f.write(@fbu.accounts(:access_token=>session["fbuser_access_token"]).select { |p| p.name == params["page"] }.first.to_yaml)} + logger.info @fbu.to_s + logger.info "FbGraph Access" + session["fbuser_access_token"] + redirect_to admin_home_index_path + end end - end def all_update diff --git a/app/views/home/admin.html.erb b/app/views/home/admin.html.erb index 1c65a34..351dd50 100644 --- a/app/views/home/admin.html.erb +++ b/app/views/home/admin.html.erb @@ -1,20 +1,30 @@ -

<%= link_to "Grant extra FB privileges", user_omniauth_authorize_path(:facebook,:params=>{scope:"manage_pages,publish_actions,email"}) %> -

+

Administration

<%= link_to "user", users_path %>

+<% if Fetsite::Application.config.facebookconfig_enabled %> +

Facebook Konfiguration

+

<%= link_to "Grant extra FB privileges", user_omniauth_authorize_path(:facebook,:params=>{scope:"manage_pages,publish_actions,email"}), :confirm=>"Wirklich?" %> +

<%= @fbu.to_yaml.to_s %> <%= semantic_form_for :set_page, url: fb_set_default_publish_page_user_path(current_user), html:{method: :get} do |f| %> <%= f.input :page , :input_html => { :name => 'page' }%> -<% end %> - -<%= semantic_form_for :set_thema, url: choose_contact_topics_home_index_path, html:{method: :get} do |f| %> -<%= f.input :themen, :input_html=> {:name=>'themen'}, :as=>:select ,:multiple=>true,:collection =>Thema.all%> - - <%= f.actions do %> <%= f.action :submit, :as => :button, :label=> I18n.t("common.save" ) %> <% end %> <% end %> + +

Kontaktseite, Themen:

+<% @kontaktthemen.each do |tt| %> +<%= render tt %> +<%= link_to "rm" ,choose_contact_topics_home_index_path(:params=>{:rmthema=>tt.id}) %> +<% end %> +<%= semantic_form_for :set_thema, url: choose_contact_topics_home_index_path, html:{method: :get} do |f| %> +<%= f.input :themen, :input_html=> {:name=>'themen'}, :as=>:select ,:multiple=>true,:collection =>Thema.all,:value=>10 %> + +<%= f.actions do %> +<%= f.action :submit, :as => :button, :label=> "Hinzufuegen" %> +<% end %> +<% end %>

diff --git a/config/environments/development.rb b/config/environments/development.rb index 6ea22ef..63ff982 100755 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -35,4 +35,6 @@ Fetsite::Application.configure do # Expands the lines which load the assets config.assets.debug = false + + config.facebookconfig_enabled=true end diff --git a/config/environments/production.rb b/config/environments/production.rb index 8f85baf..ec09ad2 100755 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -65,4 +65,7 @@ Fetsite::Application.configure do # Log the query plan for queries taking more than this (works # with SQLite, MySQL, and PostgreSQL) # config.active_record.auto_explain_threshold_in_seconds = 0.5 + + config.facebookconfig_enabled=true + end From 63d4e90d72d8f42d4b2410b889e774736dec1775 Mon Sep 17 00:00:00 2001 From: Andreas Stephanides Date: Mon, 23 Feb 2015 09:21:24 +0100 Subject: [PATCH 27/35] show sticky topics --- app/views/themes/blue1/home/index.html.erb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/views/themes/blue1/home/index.html.erb b/app/views/themes/blue1/home/index.html.erb index bde27db..90d43c1 100644 --- a/app/views/themes/blue1/home/index.html.erb +++ b/app/views/themes/blue1/home/index.html.erb @@ -34,6 +34,15 @@
  • <%= link_to "Alte Beispielsammlung", "http://www.fet.at/alt/bin/view/Beispielsammlung/WebHome" ,class: :btn ,class: :linkbox %>
  • + + From 15327c75de2a9ad118b245d40f279bfbca5b82cf Mon Sep 17 00:00:00 2001 From: Andreas Stephanides Date: Tue, 24 Feb 2015 13:49:29 +0100 Subject: [PATCH 33/35] alle themen anzeigen --- app/views/themen/index.html.erb | 27 +++++++-------------------- 1 file changed, 7 insertions(+), 20 deletions(-) diff --git a/app/views/themen/index.html.erb b/app/views/themen/index.html.erb index 3c9e293..7a47b5f 100644 --- a/app/views/themen/index.html.erb +++ b/app/views/themen/index.html.erb @@ -1,25 +1,12 @@ -

    Listing themen

    - - - - - - - - - - -<% @themen.each do |thema| %> - - - - - - - +

    Listing theme1n

    drafts

    +<% @themen_drafts.each do |thema| %> +<%= render partial:"themen/nlink", object: thema %> <% end %> -
    TitleText
    <%= thema.title %><%= thema.text %><%= link_to 'Show', thema %><%= link_to 'Edit', edit_thema_path(thema) %><%= link_to 'Destroy', thema, method: :delete, data: { confirm: 'Are you sure?' } %>
    +

    All

    +<% @themen.each do |thema| %> +<%= render partial:"themen/nlink", object: thema %> +<% end %>
    <%= link_to 'New Thema', new_thema_path %> From 6197f1d15e1ac96d7f8f22a120f6e37c079759fd Mon Sep 17 00:00:00 2001 From: Andreas Stephanides Date: Tue, 24 Feb 2015 13:50:09 +0100 Subject: [PATCH 34/35] themen index --- app/controllers/themen_controller.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/controllers/themen_controller.rb b/app/controllers/themen_controller.rb index 18b9dfb..15a03ec 100644 --- a/app/controllers/themen_controller.rb +++ b/app/controllers/themen_controller.rb @@ -3,7 +3,11 @@ class ThemenController < ApplicationController # GET /themen # GET /themen.json load_and_authorize_resource - + def index + @themen = Thema.accessible_by(current_ability,:show) + @themen_drafts = Thema.accessible_by(current_ability,:show).where(:isdraft=>true) + + end def show @thema = Thema.find(params[:id]) @fragen=@thema.fragen From 2ab6be038fc20b1c7e43ab6eaffc783d7bae4920 Mon Sep 17 00:00:00 2001 From: Andreas Stephanides Date: Tue, 24 Feb 2015 13:50:29 +0100 Subject: [PATCH 35/35] neuigkeiten schema.org --- app/views/memberships/_membership.html.erb | 8 +++++--- app/views/neuigkeiten/show.html.erb | 9 +++++---- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/app/views/memberships/_membership.html.erb b/app/views/memberships/_membership.html.erb index ad5daef..7d63c00 100644 --- a/app/views/memberships/_membership.html.erb +++ b/app/views/memberships/_membership.html.erb @@ -1,6 +1,8 @@ - + <%= membership.stop.nil? ? I18n.t("gremium.seit")+" " : I18n.t("gremium.von")+" " %> <%=membership.start.to_s %> <%= " "+I18n.t("gremium.bis")+" "+membership.stop.to_s unless membership.stop.nil? %> -<%= Membership::TYPEN_g[membership.fetprofile.geschlecht.to_i][membership.typ.to_i] %> -<%= membership.gremium.fall2 %> +<%= Membership::TYPEN_g[membership.fetprofile.geschlecht.to_i][membership.typ.to_i] %> +<%= membership.gremium.fall2 %> + + diff --git a/app/views/neuigkeiten/show.html.erb b/app/views/neuigkeiten/show.html.erb index c339c8c..57e38fc 100755 --- a/app/views/neuigkeiten/show.html.erb +++ b/app/views/neuigkeiten/show.html.erb @@ -34,15 +34,16 @@ end

    <%= notice %>

    - +
    <%= ff_icon(@neuigkeit.rubrik.icon) unless @neuigkeit.rubrik.icon.nil? or @neuigkeit.rubrik.icon.empty? %> <%= @neuigkeit.rubrik.name %> -
    <% unless @neuigkeit.published? %>
    Not Published
    <% end %>