Merge branch 'master' of http://github.com/andreassteph/fetsite
This commit is contained in:
@@ -7,7 +7,7 @@ class FetprofilesController < ApplicationController
|
|||||||
|
|
||||||
@fetprofiles = Fetprofile.active.order(:vorname,:nachname)
|
@fetprofiles = Fetprofile.active.order(:vorname,:nachname)
|
||||||
@fetprofiles = Fetprofile.order(:vorname,:nachname) if params[:filter]== "all"
|
@fetprofiles = Fetprofile.order(:vorname,:nachname) if params[:filter]== "all"
|
||||||
@fetprofiles = Fetprofile.where(:active=>false).order(:vorname,:nachname) if params[:filter]== "notactive"
|
@fetprofiles = Fetprofile.where(:active=>false).order(:nachname,:vorname) if params[:filter]== "notactive"
|
||||||
|
|
||||||
@gremientabs = Gremium.tabs
|
@gremientabs = Gremium.tabs
|
||||||
@toolbar_elements << {:hicon=>'icon-plus', :text=> I18n.t('profile.new_profile'),:path => new_fetprofile_path(@fetprofile) } if can? :new, @fetprofile
|
@toolbar_elements << {:hicon=>'icon-plus', :text=> I18n.t('profile.new_profile'),:path => new_fetprofile_path(@fetprofile) } if can? :new, @fetprofile
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ class GremienController < ApplicationController
|
|||||||
# GET /gremien
|
# GET /gremien
|
||||||
# GET /gremien.json
|
# GET /gremien.json
|
||||||
load_and_authorize_resource
|
load_and_authorize_resource
|
||||||
before_filter {@toolbar_elements=[]}
|
before_filter {@toolbar_elements=[]}
|
||||||
def verwalten
|
def verwalten
|
||||||
@gremien = Gremium.all
|
@gremien = Gremium.all
|
||||||
@gremientabs=Gremium.tabs
|
@gremientabs=Gremium.tabs
|
||||||
@@ -105,7 +105,8 @@ class GremienController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
# DELETE /gremien/1
|
# DELETE /gremien/1
|
||||||
# DELETE /gremien/1.json
|
#
|
||||||
|
#
|
||||||
def destroy
|
def destroy
|
||||||
@gremium = Gremium.find(params[:id])
|
@gremium = Gremium.find(params[:id])
|
||||||
@gremium.destroy
|
@gremium.destroy
|
||||||
|
|||||||
@@ -27,10 +27,20 @@ class HomeController < ApplicationController
|
|||||||
render 'links_notimplemented'
|
render 'links_notimplemented'
|
||||||
end
|
end
|
||||||
def search
|
def search
|
||||||
|
|
||||||
unless params['query'].nil? || params['query'].empty?
|
unless params['query'].nil? || params['query'].empty?
|
||||||
@neuigkeiten=Neuigkeit.search(params['query'])
|
if can?(:showintern, Neuigkeit)
|
||||||
|
@neuigkeiten=Neuigkeit.search(params['query'])
|
||||||
|
else
|
||||||
|
@neuigkeiten =Neuigkeit.search(params['query']).public
|
||||||
|
end
|
||||||
@fetprofiles = Fetprofile.search(params['query'])
|
@fetprofiles = Fetprofile.search(params['query'])
|
||||||
@themen=Thema.search(params['query'])
|
if can?(:showintern, Neuigkeit)
|
||||||
|
@themen=Thema.search(params['query'])
|
||||||
|
else
|
||||||
|
@themen=Thema.search(params['query']).public
|
||||||
|
end
|
||||||
|
|
||||||
else
|
else
|
||||||
@neuigkeiten=[]
|
@neuigkeiten=[]
|
||||||
@fetprofiles=[]
|
@fetprofiles=[]
|
||||||
|
|||||||
@@ -2,13 +2,15 @@ class RubrikenController < ApplicationController
|
|||||||
before_filter {@toolbar_elements=[]}
|
before_filter {@toolbar_elements=[]}
|
||||||
load_and_authorize_resource
|
load_and_authorize_resource
|
||||||
def index
|
def index
|
||||||
if can?(:shownonpublic, Rubrik)
|
if can?(:showintern, Rubrik)
|
||||||
@rubriken = Rubrik.all
|
@rubriken = Rubrik.all
|
||||||
|
@neuigkeiten = Neuigkeit.recent
|
||||||
else
|
else
|
||||||
@rubriken = Rubrik.where(:public=>true)
|
@rubriken = Rubrik.where(:public=>true)
|
||||||
|
@neuigkeiten = Neuigkeit.public.recent
|
||||||
end
|
end
|
||||||
@neuigkeiten = @rubriken.collect(&:neuigkeiten).map(&:recent).flatten
|
|
||||||
@calentries= @rubriken.collect(&:calentries).flatten
|
@calentries= @rubriken.collect(&:calentries).flatten
|
||||||
end
|
end
|
||||||
def intern
|
def intern
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ class StudienController < ApplicationController
|
|||||||
@toolbar_elements=[]
|
@toolbar_elements=[]
|
||||||
@toolbar_elements<<{:icon=>:plus, :hicon =>'icon-plus-sign' ,:text=> I18n.t('studien.new') , :path => new_studium_path(@studium) } if can? :new, Studium
|
@toolbar_elements<<{:icon=>:plus, :hicon =>'icon-plus-sign' ,:text=> I18n.t('studien.new') , :path => new_studium_path(@studium) } if can? :new, Studium
|
||||||
@toolbar_elements<<{:icon=>:pencil, :hicon=>'icon-pencil',:text =>I18n.t('common.edit'),:path => edit_studium_path(@studium)} if can? :edit, Studium
|
@toolbar_elements<<{:icon=>:pencil, :hicon=>'icon-pencil',:text =>I18n.t('common.edit'),:path => edit_studium_path(@studium)} if can? :edit, Studium
|
||||||
@toolbar_elements<<{:icon=>:pencil, :hicon=>'icon-pencil',:text =>I18n.t('common.edit'),:path => edit_lvas_studium_path(@studium)} if can? :edit_lvas, Studium
|
@toolbar_elements<<{:icon=>:pencil, :hicon=>'icon-pencil',:text =>I18n.t('lva.editlvas'),:path => edit_lvas_studium_path(@studium)} if can? :edit_lvas, Studium
|
||||||
@toolbar_elements<<{:hicon=>'icon-remove-circle', :text=> I18n.t('common.delete'),:path => studium_path(@studium), :method=> :delete,:confirm=>'Sure?' } if can? :delete, Studium
|
@toolbar_elements<<{:hicon=>'icon-remove-circle', :text=> I18n.t('common.delete'),:path => studium_path(@studium), :method=> :delete,:confirm=>'Sure?' } if can? :delete, Studium
|
||||||
@toolbar_modulgruppen =[]
|
@toolbar_modulgruppen =[]
|
||||||
@toolbar_modulgruppen << {:hicon=>'icon-plus-sign', :text=> I18n.t('modulgruppe.new'), :path=>new_studium_modulgruppe_path(@studium)} if can? :new, Modulgruppe
|
@toolbar_modulgruppen << {:hicon=>'icon-plus-sign', :text=> I18n.t('modulgruppe.new'), :path=>new_studium_modulgruppe_path(@studium)} if can? :new, Modulgruppe
|
||||||
@@ -60,7 +60,7 @@ class StudienController < ApplicationController
|
|||||||
|
|
||||||
def edit_lvas
|
def edit_lvas
|
||||||
@studium = Studium.find(params[:id])
|
@studium = Studium.find(params[:id])
|
||||||
@lvas=@studium.lvas
|
@lvas=@studium.lvas.uniq
|
||||||
@semester=@studium.semester
|
@semester=@studium.semester
|
||||||
@toolbar_elements=[{:text => I18n.t('studien.anzeigen') , :path => url_for(@studium) }]
|
@toolbar_elements=[{:text => I18n.t('studien.anzeigen') , :path => url_for(@studium) }]
|
||||||
@toolbar_elements<<{:text =>I18n.t('studien.allestudien'),:path=>studien_path(@studium)}
|
@toolbar_elements<<{:text =>I18n.t('studien.allestudien'),:path=>studien_path(@studium)}
|
||||||
|
|||||||
@@ -2,58 +2,34 @@
|
|||||||
class Ability
|
class Ability
|
||||||
include CanCan::Ability
|
include CanCan::Ability
|
||||||
def initialize(user)
|
def initialize(user)
|
||||||
# Define abilities for the passed in user here. For example:
|
|
||||||
#
|
|
||||||
# if user.admin?
|
|
||||||
# can :manage, :all
|
|
||||||
# else
|
|
||||||
# can :read, :all
|
|
||||||
# end
|
|
||||||
# The first argument to `can` is the action you are giving the user permission to do.
|
|
||||||
# If you pass :manage it will apply to every action. Other common actions here are
|
|
||||||
# :read, :create, :update and :destroy.
|
|
||||||
#
|
|
||||||
# The second argument is the resource the user can perform the action on. If you pass
|
|
||||||
# :all it will apply to every resource. Otherwise pass a Ruby class of the resource.
|
|
||||||
#
|
|
||||||
# The third argument is an optional hash of conditions to further filter the objects.
|
|
||||||
# For example, here the user can only update published articles.
|
|
||||||
#
|
|
||||||
# can :update, Article, :published => true
|
|
||||||
#
|
|
||||||
# See the wiki for details: https://github.com/ryanb/cancan/wiki/Defining-Abilitiescan :manage, :all
|
|
||||||
|
|
||||||
user ||= User.new # guest user (not logged in)
|
user ||= User.new # guest user (not logged in)
|
||||||
|
|
||||||
|
|
||||||
# For Debug allow everything
|
|
||||||
# Remove this line in production environment and for testing user management
|
|
||||||
# can :manage, :all
|
|
||||||
can :addfetuser, User
|
|
||||||
can :addfetadmin, User
|
|
||||||
|
|
||||||
|
# Rechteverwaltung fuer Studien Modul
|
||||||
can [:show, :index], Studium
|
can [:show, :index], Studium
|
||||||
can [:show, :index], Modulgruppe
|
can [:show, :index], Modulgruppe
|
||||||
can [:show, :index], Modul
|
can [:show, :index], Modul
|
||||||
can [:show, :index], Lva
|
can [:show, :index], Lva
|
||||||
|
can [:create, :show], Beispiel
|
||||||
|
|
||||||
can [:show,:index], Gallery
|
can [:show,:index], Gallery
|
||||||
can [:show, :index,:faqs], Themengruppe
|
can [:show, :index,:faqs], Themengruppe
|
||||||
can [:show], Thema, :isdraft=>false
|
can [:show], Thema, :isdraft=>false
|
||||||
can [:create], Beispiel
|
|
||||||
can [:show, :index], Fetprofile
|
can [:show, :index], Fetprofile
|
||||||
can [:show, :index],Gremium
|
can [:show, :index],Gremium
|
||||||
# Rechteverwaltung fuer Studien Modul
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Rechteverwaltung Kalender
|
# Rechteverwaltung Kalender
|
||||||
can [:show, :index], Calendar, :public => true
|
can [:show, :index], Calendar, :public => true
|
||||||
can [:showics], Calendar
|
can [:showics], Calendar
|
||||||
can [:show], Calentry
|
can [:show], Calentry
|
||||||
|
|
||||||
if( user.has_role?("fetuser") || user.has_role?("fetadmin"))
|
if( user.has_role?("fetuser") || user.has_role?("fetadmin"))
|
||||||
can :manage,:all
|
can :manage,:all
|
||||||
can :manage, Modulgruppe
|
can :manage, Modulgruppe
|
||||||
can :showdraft , Thema
|
can :showdraft , Thema
|
||||||
|
can :showintern, Thema
|
||||||
|
can :showintern, Neuigkeit
|
||||||
|
can :showintern, Rubrik
|
||||||
can [:show,:index], Calendar
|
can [:show,:index], Calendar
|
||||||
can [:edit, :update,:new,:create,:verwalten], Calendar
|
can [:edit, :update,:new,:create,:verwalten], Calendar
|
||||||
can [:edit, :update,:new,:create,:verwalten], Calentry
|
can [:edit, :update,:new,:create,:verwalten], Calentry
|
||||||
@@ -82,6 +58,10 @@ class Ability
|
|||||||
can [:show,:index], Rubrik, :public=>true
|
can [:show,:index], Rubrik, :public=>true
|
||||||
|
|
||||||
can :show, Neuigkeit, :rubrik=>{:public=>true}
|
can :show, Neuigkeit, :rubrik=>{:public=>true}
|
||||||
|
if user.has_role?("fetadmin")
|
||||||
|
can :addfetuser, User
|
||||||
|
can :addfetadmin, User
|
||||||
|
end
|
||||||
|
|
||||||
if user.has_role?("newsadmin") || user.has_role?( "fetadmin") || user.has_role?( "fetuser")
|
if user.has_role?("newsadmin") || user.has_role?( "fetadmin") || user.has_role?( "fetuser")
|
||||||
can :manage, Rubrik
|
can :manage, Rubrik
|
||||||
|
|||||||
@@ -22,9 +22,11 @@ class Neuigkeit < ActiveRecord::Base
|
|||||||
translates :title,:text, :versioning=>{:gem=>:paper_trail, :options=>{:fallbacks_for_empty_translations => true}}
|
translates :title,:text, :versioning=>{:gem=>:paper_trail, :options=>{:fallbacks_for_empty_translations => true}}
|
||||||
|
|
||||||
has_many :calentries, as: :object
|
has_many :calentries, as: :object
|
||||||
|
has_many :nlinks
|
||||||
|
|
||||||
mount_uploader :picture, PictureUploader
|
mount_uploader :picture, PictureUploader
|
||||||
default_scope order(:datum).reverse_order
|
|
||||||
#scope :published, -> {where("datum <= ? AND datum IS NOT NULL", Time.now.to_date)}
|
default_scope order(:datum).reverse_order
|
||||||
scope :recent, -> { published.limit(10)}
|
scope :recent, -> { published.limit(10)}
|
||||||
scope :unpublished, -> {where("datum >= ? OR datum IS NULL", Date.today)}
|
scope :unpublished, -> {where("datum >= ? OR datum IS NULL", Date.today)}
|
||||||
scope :public, ->{includes(:rubrik).where("rubriken.public"=>true)}
|
scope :public, ->{includes(:rubrik).where("rubriken.public"=>true)}
|
||||||
@@ -34,7 +36,9 @@ class Neuigkeit < ActiveRecord::Base
|
|||||||
LINKTYPES=["Thema", "Gallery", "Lva","Studium","Fetprofile", "Gremium"]
|
LINKTYPES=["Thema", "Gallery", "Lva","Studium","Fetprofile", "Gremium"]
|
||||||
accepts_nested_attributes_for :calentries, :allow_destroy=>true , :reject_if=> lambda{|a| a[:start].blank?}
|
accepts_nested_attributes_for :calentries, :allow_destroy=>true , :reject_if=> lambda{|a| a[:start].blank?}
|
||||||
before_validation :sanitize
|
before_validation :sanitize
|
||||||
has_many :nlinks
|
|
||||||
|
|
||||||
|
|
||||||
def self.published
|
def self.published
|
||||||
where("datum <= ? AND datum IS NOT NULL", Time.now.to_date)
|
where("datum <= ? AND datum IS NOT NULL", Time.now.to_date)
|
||||||
end
|
end
|
||||||
@@ -55,9 +59,9 @@ class Neuigkeit < ActiveRecord::Base
|
|||||||
def reverse_publish
|
def reverse_publish
|
||||||
self.datum = nil
|
self.datum = nil
|
||||||
end
|
end
|
||||||
def name
|
def name
|
||||||
self.title
|
self.title
|
||||||
end
|
end
|
||||||
def text_first_words
|
def text_first_words
|
||||||
md = /<p>(?<text>[^\<\>]*)/.match Sanitize.clean(self.text,:elements=>['p'])
|
md = /<p>(?<text>[^\<\>]*)/.match Sanitize.clean(self.text,:elements=>['p'])
|
||||||
words=md[:text].split(" ") unless md.nil?
|
words=md[:text].split(" ") unless md.nil?
|
||||||
@@ -68,15 +72,15 @@ end
|
|||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
def has_calentries?
|
def has_calentries?
|
||||||
!self.calentries.nil? && !self.calentries.empty?
|
!self.calentries.nil? && !self.calentries.empty?
|
||||||
end
|
end
|
||||||
private
|
private
|
||||||
def sanitize
|
def sanitize
|
||||||
self.calentries.each do |calentry|
|
self.calentries.each do |calentry|
|
||||||
calentry.calendar= self.rubrik.calendar
|
calentry.calendar= self.rubrik.calendar
|
||||||
calentry.typ=1
|
calentry.typ=1
|
||||||
calentry.object=self
|
calentry.object=self
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
|
|
||||||
<div class="row-fluid contentbox">
|
<div class="row-fluid contentbox">
|
||||||
<div class="span5">
|
<div class="span5">
|
||||||
<b><%=link_to beispiel.name, beispiel.beispieldatei.url%></b> <%= link_to "edit", edit_beispiel_path(beispiel)%></br>
|
<b><%=link_to beispiel.name, beispiel.beispieldatei.url%></b>
|
||||||
|
<%= link_to "edit", edit_beispiel_path(beispiel)%>
|
||||||
|
<%= link_to "delete", beispiel_path(beispiel), :method=>:delete, :data=>{:confirm=>I18n.t('beispiel.sure')}%></br>
|
||||||
|
|
||||||
<%= I18n.t("file.size") + ": " + (beispiel.beispieldatei.size/1024.0).round(2).to_s %>KiB
|
<%= I18n.t("file.size") + ": " + (beispiel.beispieldatei.size/1024.0).round(2).to_s %>KiB
|
||||||
</div>
|
</div>
|
||||||
<div class="span7">
|
<div class="span7">
|
||||||
|
|||||||
@@ -14,6 +14,8 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row-fluid">
|
<div class="row-fluid">
|
||||||
|
<%= f.input :name %>
|
||||||
|
|
||||||
<%= f.input :desc %>
|
<%= f.input :desc %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -16,4 +16,4 @@
|
|||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<%= render :partial=>'layouts/pretty_toolbar', :locals=>{:elements=>@toolbar_elements} %>
|
|
||||||
|
|||||||
@@ -3,31 +3,29 @@
|
|||||||
<p id="notice"><%= notice %></p>
|
<p id="notice"><%= notice %></p>
|
||||||
<h1><%= @studium.typ %> <%= @studium.name %> (<%= @studium.zahl %>)</h1>
|
<h1><%= @studium.typ %> <%= @studium.name %> (<%= @studium.zahl %>)</h1>
|
||||||
<div>
|
<div>
|
||||||
<p>
|
<p>
|
||||||
<div class="pull-right">
|
<div class="pull-right">
|
||||||
<%= link_to I18n.t("studien.ansicht.semester"), studium_path(@studium, :ansicht=>"semesteransicht"), :class=>"btn" unless params[:ansicht]=='semesteransicht' %>
|
<%= link_to I18n.t("studien.ansicht.semester"), studium_path(@studium, :ansicht=>"semesteransicht"), :class=>"btn" unless params[:ansicht]=='semesteransicht' %>
|
||||||
<%= link_to I18n.t("studien.ansicht.modulgruppe"), studium_path(@studium, :ansicht=>"modulgruppenansicht"), :class=>"btn" unless params[:ansicht]=='modulgruppenansicht' %>
|
<%= link_to I18n.t("studien.ansicht.modulgruppe"), studium_path(@studium, :ansicht=>"modulgruppenansicht"), :class=>"btn" unless params[:ansicht]=='modulgruppenansicht' %>
|
||||||
<%= link_to I18n.t("studien.ansicht.info"), studium_path(@studium, :ansicht=>"infoansicht"), :class=>"btn" unless params[:ansicht]=='infoansicht' %>
|
<%= link_to I18n.t("studien.ansicht.info"), studium_path(@studium, :ansicht=>"infoansicht"), :class=>"btn" unless params[:ansicht]=='infoansicht' %>
|
||||||
</div>
|
</div>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<% if params[:ansicht]=='modulgruppenansicht' %>
|
<% if params[:ansicht]=='modulgruppenansicht' %>
|
||||||
<%= render partial: 'modulgruppenansicht' %>
|
<%= render partial: 'modulgruppenansicht' %>
|
||||||
<% else if params[:ansicht]=='infoansicht' %>
|
<% else if params[:ansicht]=='infoansicht' %>
|
||||||
<%= render partial: 'infoansicht' %>
|
<%= render partial: 'infoansicht' %>
|
||||||
<% else if params[:ansicht]== 'qualifikationsprofil' %>
|
<% else if params[:ansicht]== 'qualifikationsprofil' %>
|
||||||
<h2>Qualifikationsprofil</h2>
|
<h2>Qualifikationsprofil</h2>
|
||||||
<p>
|
<p>
|
||||||
<%= raw(@studium.qualifikation) %>
|
<%= raw(@studium.qualifikation) %>
|
||||||
</p>
|
</p>
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= render partial: 'semesteransicht' %>
|
<%= render partial: 'semesteransicht' %>
|
||||||
|
<% end %>
|
||||||
|
<% end %> <% end %>
|
||||||
|
|
||||||
|
<%= render :partial=>'layouts/pretty_toolbar', :object=>@toolbar_modulgruppen %>
|
||||||
|
<br>
|
||||||
<% end %> <% end %> <% end %>
|
|
||||||
|
|
||||||
<%= render :partial=>'layouts/pretty_toolbar', :object=>@toolbar_modulgruppen %><br>
|
|
||||||
<%= render 'layouts/pretty_toolbar' %>
|
<%= render 'layouts/pretty_toolbar' %>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<%= link_to themengruppe,{:class=>'linkbox color-4-dark'} do %>
|
<%= link_to themengruppe,{:class=>'linkbox color-1-dark'} do %>
|
||||||
<div class="row-fluid">
|
<div class="row-fluid">
|
||||||
<div class="span12">
|
<div class="span12">
|
||||||
<div class="media">
|
<div class="media">
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ de:
|
|||||||
lva:
|
lva:
|
||||||
add: "Lva hinzufügen"
|
add: "Lva hinzufügen"
|
||||||
addrem: "Lva hinzufügen/entfernen"
|
addrem: "Lva hinzufügen/entfernen"
|
||||||
|
editlvas: "Lvas bearbeiten"
|
||||||
list: "Alle Lvas"
|
list: "Alle Lvas"
|
||||||
modulgruppe:
|
modulgruppe:
|
||||||
typ: "Typ"
|
typ: "Typ"
|
||||||
|
|||||||
Reference in New Issue
Block a user