Merge remote-tracking branch 'origin/master'

Conflicts:
	.gitignore
This commit is contained in:
2014-04-13 15:55:25 +02:00
36 changed files with 242 additions and 161 deletions

1
.gitignore vendored
View File

@@ -29,6 +29,7 @@ Gemfile.lock
console
/server
/public/uploads/
/vendor/*
/bak/*
*#
Gemfile.lock

View File

@@ -2,6 +2,7 @@ source 'https://rubygems.org'
gem 'rails', '3.2.13'
gem 'sprockets', '2.2.2'
gem 'webrick', '1.3.1'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'mysql2'

View File

@@ -9,6 +9,11 @@ class NeuigkeitenController < ApplicationController
def show
@neuigkeit = Neuigkeit.find(params[:id])
@rubrik=@neuigkeit.rubrik
if can?(:shownonpublic, Rubrik)
@rubriken = Rubrik.all
else
@rubriken = Rubrik.where(:public=>true)
end
if !params[:version].nil?
@neuigkeit.assign_attributes(@neuigkeit.translation.versions.reverse[params[:version].to_i].reify.attributes.select{|k,v| @neuigkeit.translated_attribute_names.include? k.to_sym })

View File

@@ -2,14 +2,25 @@ class RubrikenController < ApplicationController
before_filter {@toolbar_elements=[]}
load_and_authorize_resource
def index
if can?(:shownonpublic, Rubrik)
@rubriken = Rubrik.all
@neuigkeiten = Neuigkeit.recent
@calentries= Calentry.public
else
@rubriken = Rubrik.where(:public=>true)
end
@neuigkeiten = @rubriken.collect(&:neuigkeiten).map(&:recent).flatten
@calentries= @rubriken.collect(&:calendar).collect(&:calentries).flatten
end
def show
if can?(:shownonpublic, Rubrik)
@rubriken = Rubrik.all
else
@rubriken = Rubrik.where(:public=>true)
end
@rubrik = Rubrik.find(params[:id])
@moderatoren=User.with_role(:newsmoderator,@rubrik)
@calentries= @rubrik.calentries
if can?(:showunpublished, Neuigkeit)
@neuigkeiten = @rubrik.neuigkeiten
else

View File

@@ -34,6 +34,7 @@ class StudienController < ApplicationController
@toolbar_elements=[{:icon=>:plus, :hicon =>'icon-plus-sign' ,:text=> I18n.t('studien.new') , :path => new_studium_path(@studium) },
{:icon=>:pencil, :hicon=>'icon-pencil',:text =>I18n.t('common.edit'),:path => edit_studium_path(@studium)},
{:icon=>:pencil, :hicon=>'icon-pencil',:text =>I18n.t('common.edit'),:path => edit_lvas_studium_path(@studium)},
{:hicon=>'icon-remove-circle', :text=> I18n.t('common.delete'),:path => studium_path(@studium), :method=> :delete,:confirm=>'Sure?' }]
@toolbar_modulgruppen =[ {:hicon=>'icon-plus-sign', :text=> I18n.t('modulgruppe.new'), :path=>new_studium_modulgruppe_path(@studium)},
@@ -57,6 +58,15 @@ class StudienController < ApplicationController
@toolbar_elements<<{:text =>I18n.t('studien.allestudien'),:path=>studien_path(@studium)}
end
def edit_lvas
@studium = Studium.find(params[:id])
@lvas=@studium.lvas
@semester=@studium.semester
@toolbar_elements=[{:text => I18n.t('studien.anzeigen') , :path => url_for(@studium) }]
@toolbar_elements<<{:text =>I18n.t('studien.allestudien'),:path=>studien_path(@studium)}
end
def create
@studium = Studium.new(params[:studium])
@@ -73,11 +83,15 @@ class StudienController < ApplicationController
def update
@studium = Studium.find(params[:id])
logger.info "params: #{params[:studium].inspect}"
if @studium.update_attributes(params[:studium])
if @studium.lvas.map(&:valid?).all?
redirect_to url_for(@studium), notice: 'Studium was successfully updated.'
else
render action: "edit"
end
else
render action: "edit"
end

View File

@@ -76,6 +76,7 @@ class Ability
if user.has_role?("newsadmin") || user.has_role?( "fetadmin") || user.has_role?( "fetuser")
can :manage, Rubrik
can :manage, Neuigkeit
can :shownonpublic, Rubrik
can :showunpublished, Neuigkeit
end

View File

@@ -36,14 +36,18 @@
class Lva < ActiveRecord::Base
ERLAUBTE_TYPEN = ['VO', 'UE', 'VU', 'LU', 'SE', 'andere'];
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
has_and_belongs_to_many :modul,:uniq=>true # Gehört zu einem Modul
has_and_belongs_to_many :semester
#Gehört zu einem Semester( derzeit nicht implementiert)
has_many :beispiele , :class_name => "Beispiel"
has_and_belongs_to_many :lecturers
translates :desc,:pruefungsinformation, :fallbacks_for_empty_translations => true, :versioning=>true
has_many :nlinks, as: :link
scope :search, ->(query) {where("name like ? or lvas.desc like ?", "%#{query}%", "%#{query}%")}
validates :lvanr,:format=>{ :with => /^[0-9][0-9][0-9]\.[0-9A][0-9][0-9]$/}, :presence=>true, :uniqueness=>true # , :uniqueness=>true # LVA-Nummer muss das Format 000.000 besitzen (uniqueness?) oder 000 für nicht
@@ -53,7 +57,7 @@ class Lva < ActiveRecord::Base
validates_presence_of :stunden # Stunden Eingetragen?
validates_presence_of :modul # Zugehöriges Modul eingetragen?
# (zumindest eines)
has_many :nlinks, as: :link
def title
self.name

View File

@@ -23,6 +23,7 @@ class Neuigkeit < ActiveRecord::Base
has_many :calentries, as: :object
mount_uploader :picture, PictureUploader
scope :published, -> {where("datum <= ? AND datum IS NOT NULL", Time.now.to_date).order(:datum).reverse_order}
scope :recent, -> { published.limit(15)}
scope :unpublished, -> {where("datum >= ? OR datum IS NULL", Date.today)}

View File

@@ -27,18 +27,24 @@
# created_at :datetime not null
# updated_at :datetime not null
class Studium < ActiveRecord::Base
attr_accessible :desc, :name,:abkuerzung, :typ, :zahl, :semester, :picture, :picture_cache, :qualifikation,:struktur, :jobmoeglichkeiten
attr_accessible :desc, :name,:abkuerzung, :typ, :zahl, :semester, :picture, :picture_cache, :qualifikation,:struktur, :jobmoeglichkeiten, :lvas_attributes
has_many :modulgruppen, inverse_of: :studium, :class_name => "Modulgruppe", :dependent => :destroy
scope :search, ->(query) {where("name like ? or studien.desc like ?", "%#{query}%", "%#{query}%")}
has_many :moduls, :through=>:modulgruppen
has_many :lvas, :through=>:moduls
has_many :semester, :dependent => :destroy
validates :abkuerzung, :length=>{:maximum=>5}, :format=>{:with=>/^[a-zA-z]{0,5}$/}
validates :typ, :inclusion => {:in => ["Bachelor","Master"] }
validates :name, :uniqueness => true, :presence=>true
validates :zahl, :presence=>true, :format=>{:with=>/^[0-9A-Z]{4,10}$/}, :uniqueness => true
mount_uploader :picture, PictureUploader
accepts_nested_attributes_for :lvas #, :allow_destroy=>true # , :reject_if=> lambda{|a| a[:name].blank?}
translates :desc,:shortdesc, :qualifikation,:struktur, :jobmoeglichkeiten, :versioning =>true,:fallbacks_for_empty_translations => true
def title_context
return self.abkuerzung.to_s.strip.empty? ? self.name : self.abkuerzung
end

View File

@@ -13,29 +13,13 @@
end %>
</div>
<div class="media-body">
<small class="pull-left"><%= gallery.fotos.size.to_s + " " + I18n.t('fotos.bilder')%> </small>
<small class="pull-right"><%=I18n.l(gallery.try(:datum).try(:to_date)) unless gallery.try(:datum).try(:to_date).nil? %></small></br>
<h1><%= gallery.name %></h1>
<p>
<%= if gallery.desc.split.size > Gallery::WORD_COUNT
gallery.desc.split[0..Gallery::WORD_COUNT].join(" ") + " ..."
else
gallery.desc
end%>
</p>
</div>
</div>
<div class="media gallery-block">
<div class="pull-left" href="#">
<%= if(gallery.fotos.empty?)
image_tag "no_image_128.png", {:class => "img-rounded"}
else
image_tag gallery.fotos.sample.datei.big_thumb.url, {:class => "img-rounded"}
end %>
</div>
<div class="media-body">
<small class="pull-left"><%= gallery.fotos.size.to_s + " " + I18n.t('fotos.bilder')%> </small>
<small class="pull-right"><%=I18n.l(gallery.try(:datum).try(:to_date)) unless gallery.try(:datum).try(:to_date).nil? %></small></br>
<small class="pull-left">
<%= gallery.fotos.size.to_s + " " + I18n.t('fotos.bilder')%>
</small>
<small class="pull-right">
<%=I18n.l(gallery.try(:datum).try(:to_date)) unless gallery.try(:datum).try(:to_date).nil? %>
</small>
</br>
<h1><%= gallery.name %></h1>
<p>
<%= if gallery.desc.split.size > Gallery::WORD_COUNT

View File

@@ -1,6 +1,5 @@
<div class="content-wrap content-column">
<h1><%= I18n.t('home.willkommen') %></h1>
<p><%= I18n.t('home.hallobeiderfet') %></p>
<h1><%= I18n.t('home.willkommen') %></h1></p>
<ul class="unstyled linkbox-list" style="max-width:70em">
<% @neuigkeiten.each do |n| %>
<li><%= render n if can?(:show, n) %> </li>
@@ -11,7 +10,7 @@
</p>
<div class="alert">
<h2>Beta Test</h2>
<p>Die Webseite befindet sich derzeit in einem Entsicklungsstadium,
<p>Die Webseite befindet sich derzeit in einem Entwicklungsstadium,
volle Funktionsfähigkeit ist noch nicht erreicht. Bitte Featurerequests und
Fehlermeldungen auf GitHub melden.
</p>

View File

@@ -17,6 +17,9 @@ Im angelegten Verzeichnis den bundle installer ausführen.
<pre>sudo gem install bundler</pre>
ImageMagick,sqlite3 installieren
<pre>sudo apt-get install libmagickwand-dev libsqlite3-dev nodejs</pre>
<pre>sudo apt-get install libmysql-ruby libmysqlclient-dev</pre>
gegebenenfalls g++ installieren
<pre>cd fetsite
sudo bundle install

View File

@@ -3,6 +3,8 @@
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" href="./public/favicon.ico">
<!--<link rel="shortcut icon" href="http://www.fet.at/favicon.ico">-->
<title>Fetsite</title>
@@ -27,7 +29,7 @@
<div class="span10 ">
<div class="header_wrap" style="background:7070a0">
<div class="header">
<%= image_tag('/fetlogo90.png',{:style=>"float:left;height:50px",:height=>"50"}) %>
<%= link_to image_tag('/fetlogo90.png',{:style=>"float:left;height:50px",:height=>"50"}),home_index_path %>
<h1 style="display:block"></h1>
</div>

View File

@@ -23,12 +23,23 @@
<%= link_to 'Admin' , config_path%>
</li>
</ul>
<span class="pull-right"><%if I18n.locale == :en %>
<ul class="nav navbar-nav">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><%= image_tag("/flaggen/png/"+I18n.locale.to_s+".png") + " " +I18n.t('sprache',:scope=>'home')%><b class="caret"></b></a>
<ul class="dropdown-menu">
<li><%= link_to image_tag("/flaggen/png/at.png") + " Deutsch" ,switch_locale_url(:de)%> </li>
<li><%= link_to image_tag("/flaggen/png/gb.png") + " English" ,switch_locale_url(:en)%> </li>
</ul>
</li>
</ul>
<!--<span class="pull-right"><%if I18n.locale == :en %>
<%= link_to image_tag("/flaggen/png/at.png") + " Deutsch" ,switch_locale_url(:de)%>
<% elsif I18n.locale == :de %>
<%= link_to image_tag("/flaggen/png/gb.png") + " English" ,switch_locale_url(:en)%>
<%end %>
</span>
</span>-->
</div>
</div>

View File

@@ -0,0 +1,21 @@
<tr>
<td>
<h4><%= %></h4>
<%= f.semantic_errors :state %>
<%= f.input :id, :as=>:hidden %>
</td>
<td><%= f.input :lvanr , :input_html => { "style"=>"width:7em" }%></td>
<td><%= f.input :name %></td>
<td>
<%= f.input :ects, :input_html => { "style"=>"width:4em" },:size=>5 %>
<%= f.input :stunden, :input_html => { "style"=>"width:4em" }%></td>
<td><%= f.input :typ, :input_html => { "style"=>"width:4em" }%></td>
<td>
<% f.input :semester , :input_html=>{:style=>"height:8em"},:collection=>@semester%>
</td>
<td><%= f.input :pruefungsinformation,:input_html=>{:rows=>5} %></td>
<td><%= f.input :desc, :input_html=>{:rows=>4}%></td>
</tr>

View File

@@ -3,33 +3,10 @@
<% i = 0 %>
<% @lvas.each do |lva|%>
<% i = i +1 %>
<tr>
<%= semantic_fields_for "lvas[#{i}]", lva do |f|%>
<td>
<h4><%= lva.name %></h4>
<%= f.semantic_errors :state %>
<%= f.input :id, :as=>:hidden %></td>
<td><%= f.input :lvanr , :input_html => { "style"=>"width:7em" }%></td>
<td><%= f.input :name %></td>
<td><%= f.input :ects, :input_html => { "style"=>"width:4em" },:size=>5 %>
<%= f.input :stunden, :input_html => { "style"=>"width:4em" }%></td>
<td><%= f.input :typ, :input_html => { "style"=>"width:4em" }%></td>
<td>
<%= f.input :semester , :input_html=>{:style=>"height:8em"},:collection=>@semester%></td>
<td><%= f.input :pruefungsinformation,:input_html=>{:rows=>4} %></td>
<td><%= f.input :desc, :input_html=>{:rows=>4}%></td>
<td>
<%= lva.valid? %>
</td>
<%= render 'lvas/nested_fields', :f => f,:lva=>lva %>
<% end%>
</tr>
<% end %>
<%= ff.actions do %>

View File

@@ -15,14 +15,13 @@
</div>
<div class="span6">
<%= f.input :author, :as=> :select %>
</div> </div>
</div>
</div>
<div class="row-fluid">
<div class="span12">
<%= f.input :picture, :as=> :file %>
</div> </div>
</div>
</div>
<%= f.semantic_fields_for :calentries , @calentries do |calentry| %>
<%= render 'calentries/nested_fields', :f => calentry %>

View File

@@ -1,7 +1,7 @@
<ul class="nav nav-tabs">
<li <%= 'class="active"'.html_safe if (request.fullpath == rubriken_path)%> >
<%= link_to I18n.t('rubriken.alle') , rubriken_path %> </li>
<% for r in Rubrik.all %>
<% for r in @rubriken %>
<% if can?(:show, r) %>
<li <%= (!@rubrik.nil? && r == @rubrik) ? 'class="active"'.html_safe : '' %> title="<%= r.name %>">
<%= link_to r.name, r %>

View File

@@ -31,7 +31,7 @@
</div>
<div class="span3">
<%= render 'calendars/calentries', :object=>@rubrik.calendar.calentries %>
<%= render 'calendars/calentries', :object=>@calentries %>
<%= link_to "ics-format", calendar_path(@rubrik.calendar,:format=>:ics) %>
</div>

View File

@@ -40,6 +40,7 @@
<%= tinymce %>
<%= f.actions do %>
<%= f.action :submit, :as => :input %>
<%= link_to 'Back', studien_path, :data=>{:locale=>I18n.locale}, class: :btn%>
<% end %>
<% end %>
</div>

View File

@@ -0,0 +1,15 @@
<%= semantic_form_for @studium do |ff|%>
<table>
<%= ff.semantic_fields_for :lvas, @lvas do |f|%>
<%= render 'lvas/nested_fields', :f => f %>
<% end %>
<%= ff.actions do %>
<%= ff.action :submit, :as => :button %>
<%= ff.action :cancel, :as => :link %>
<% end %>
</table>
<% end %>

View File

@@ -2,4 +2,6 @@
<%= render 'form' %>
<%= link_to 'Back', studien_path , :data=>{:locale=>I18n.locale}%>
<!--<%= link_to 'Back', studien_path , :data=>{:locale=>I18n.locale}, class: :btn%>-->

View File

@@ -21,7 +21,7 @@
</div>
<%= f.actions do %>
<%= f.action :submit, :as => :button, :label=>"Sdf"+raw(fa_icon("save"))%>
<%= f.action :submit, :as => :button %>
<%= f.action :cancel, :as => :link %>
<% end %>

View File

@@ -20,5 +20,7 @@
<h2><%= I18n.t('attachment.title')%>:</h2>
<div id="attachmentform">
</div>
<%= link_to new_thema_attachment_path(@thema) ,:remote=>true do %> new Attachment <% end %>
<%= render :partial => "themen/select", :object => @thema, :locals=>{:editor => :false} %>
<%= link_to I18n.t('common.back'), themengruppen_path, :class=>:btn %>

View File

@@ -9,5 +9,6 @@
<%= f.actions do %>
<%= f.action :submit, :as => :input %>
<%= f.action :cancel,:label => I18n.t("common.back"), :as => :link %>
<% end %>
<% end %>

View File

@@ -1,19 +1,24 @@
<div class="content-wrap content-column">
<% @themengruppen.each do |tg| %>
<a name="themengruppe_<%=tg.id.to_s%>">
<h2><%= tg.title%></h2></a>
<div class="contentbox">
<a name="themengruppe_<%=tg.id.to_s%>"></a>
<h2> <%= tg.title%></h2>
<ul>
<% tg.themen.order(:priority).reverse.each do |t| %>
<li> <%= t.title %>
<ul> <% t.fragen.each do |f| %>
<li>
<b> <%= f.title %></b>
<p> <%= f.text %></p>
</li>
<ul>
<% t.fragen.each do |f| %>
<li><b> <%= f.title %></b><p> <%= f.text %></p></li>
<% end %>
</ul>
</li>
<% end %>
</ul>
</div>
<% end %>
</div>

View File

@@ -1,5 +1,5 @@
<div class="content-wrap content-column">
<p> <%= link_to "FAQS", faqs_themengruppen_path %></p>
<p> <%= link_to "FAQS", faqs_themengruppen_path,class: :btn %></p>
<ul class="unstyled linkbox-list">
<li>
<% @themengruppen.each do |themengruppe| %>

View File

@@ -1,25 +1,35 @@
<h1>Listing themengruppen</h1>
<div class="content-wrap content-column">
<p> <%= link_to "FAQS", faqs_themengruppen_path,class=btn %></p>
<ul class="unstyled linkbox-list">
<li>
<% @themengruppen.each do |themengruppe| %>
<div class="container-fluid">
<%= render themengruppe %>
<br/>
<div class="row-fluid">
<!--
<%= link_to 'Edit', edit_themengruppe_path(themengruppe) %>
-->
</div>
</div>
<table>
<tr>
<th>Title</th>
<th>Text</th>
<th></th>
<th></th>
<th></th>
</tr>
<% @themengruppen.each do |themagruppen| %>
<tr>
<td><%= themagruppen.title %></td>
<td><%= themagruppen.text %></td>
<td><%= link_to 'Show', themagruppen %></td>
<td><%= link_to 'Edit', edit_themagruppen_path(themagruppen) %></td>
<td><%= link_to 'Destroy', themagruppen, method: :delete, data: { confirm: 'Are you sure?' } %></td>
</tr>
<% end %>
</table>
</li>
</ul>
<br/>
</div>
<script class="hidden-phone">
<%= link_to 'New Themengruppe', new_themagruppen_path %>
<!-- make_equal_height();
-->
</script>
<%= render :partial=>'layouts/pretty_toolbar' %>
<!--
<%= link_to 'New Themengruppe', new_themengruppe_path %>
-->

View File

@@ -12,11 +12,12 @@ de:
back: "Zurück"
sure_del: "Sicher endgültig löschen?"
home:
sprache: "Deutsch"
kontakt: "Kontakt"
mtitle: "Menu"
login: "FET Login"
willkommen: "Willkommen bei der Fachschaft Elektrotechnik"
hallobeiderfet: "auf der Seite der Fachschaft Elektrotechnik an der TU Wien. Wir sind die offizielle Vertretung aller Studierenden auf der Fakultät für Elektrotechnik und Informationstechnik. Wir vertreten eure Interessen in den offiziellen Gremien der Universität. Wir sind bemüht euch in Anliegen des Studiums bestmöglich zu unterstützen und beraten. Außerdem bieten wir ein Rahmenprogramm zum Studium in Form von Veranstaltungen und Festln. Wir freuen uns über Feedback und Anregungen, insbesondere von jenen, die gleich Nägel mit Köpfen machen und unser Team verstärken wollen oder ihre Themen und Meinungen in eine unserer Sitzungen einbringen möchten."
hallobeiderfet: "auf der Seite der Fachschaft Elektrotechnik an der TU Wien. Wir sind die offizielle Vertretung aller Studierenden Auf der Fakultät für Elektrotechnik und Informationstechnik. Wir vertreten eure Interessen in den offiziellen Gremien der Universität. Wir sind bemüht euch in Anliegen des Studiums bestmöglich zu unterstützen und beraten. Außerdem bieten wir ein Rahmenprogramm zum Studium in Form von Veranstaltungen und Festln. Wir freuen uns über Feedback und Anregungen, insbesondere von jenen, die gleich Nägel mit Köpfen machen und unser Team verstärken wollen oder ihre Themen und Meinungen in eine unserer Sitzungen einbringen möchten."
home: "Startseite"
studien: "Studien"
news: "Neuigkeiten"

View File

@@ -8,6 +8,7 @@ en:
edit: "Edit"
home:
sprache: "English"
mtitle: "Menu"
hallobeiderfet: "This is the page of Fachschaft Elektrotechnik at TU Wien"
home: "Home"

View File

@@ -25,8 +25,11 @@
# Studien
scope '(:ansicht)' do
resources :studien, :only=>[:new,:edit,:update,:destroy]
resources :studien, :only=>[:show]
resources :studien, :only=>[:new,:edit,:update,:destroy,:show] do
member do
get :edit_lvas
end
end
end
resources :modulgruppen,:only =>[:create,:index] do

Binary file not shown.

Before

Width:  |  Height:  |  Size: 0 B

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 545 B

After

Width:  |  Height:  |  Size: 403 B

BIN
public/flaggen/png/de.png.bak Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 545 B

BIN
public/flaggen/png/en.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 599 B