Merge remote-tracking branch 'hausdorff/master'

This commit is contained in:
Andreas Stephanides
2013-08-13 19:25:26 +02:00
111 changed files with 2391 additions and 30 deletions

View File

@@ -12,6 +12,8 @@
//
//= require jquery
//= require jquery_ujs
//= require jquery-ui
//= require_tree .
//= require tinymce-jquery
//= require bootstrap
//= require bootstrap

View File

@@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/

View File

@@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/

View File

@@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/

View File

@@ -0,0 +1,3 @@
var make_equal_height = function() {
$('.equalheight').height(function() {return ($(this).closest(".row-fluid").height())})
}

View File

@@ -30,7 +30,8 @@ border-bottom:1px solid black;
height:60px;
padding-left:160px;
padding-top:0px;
overflow:hidden
overflow:hidden;
margin-bottom: 20px
}
#menudiv

View File

@@ -0,0 +1,3 @@
// Place all the styles related to the attachments controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/

View File

@@ -0,0 +1,3 @@
// Place all the styles related to the fragen controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/

View File

@@ -0,0 +1,3 @@
// Place all the styles related to the themen controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/

View File

@@ -0,0 +1,11 @@
// Place all the styles related to the themengruppen controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
div.themengruppe
{padding:10px;
margin:2px;
border-radius:10px;
min-width:13em;
border: #91B4FF solid 2px;
height: 90%
}

View File

@@ -0,0 +1,83 @@
class AttachmentsController < ApplicationController
# GET /attachments
# GET /attachments.json
def index
@attachments = Attachment.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @attachments }
end
end
# GET /attachments/1
# GET /attachments/1.json
def show
@attachment = Attachment.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @attachment }
end
end
# GET /attachments/new
# GET /attachments/new.json
def new
@attachment = Attachment.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @attachment }
end
end
# GET /attachments/1/edit
def edit
@attachment = Attachment.find(params[:id])
end
# POST /attachments
# POST /attachments.json
def create
@attachment = Attachment.new(params[:attachment])
respond_to do |format|
if @attachment.save
format.html { redirect_to @attachment, notice: 'Attachment was successfully created.' }
format.json { render json: @attachment, status: :created, location: @attachment }
else
format.html { render action: "new" }
format.json { render json: @attachment.errors, status: :unprocessable_entity }
end
end
end
# PUT /attachments/1
# PUT /attachments/1.json
def update
@attachment = Attachment.find(params[:id])
respond_to do |format|
if @attachment.update_attributes(params[:attachment])
format.html { redirect_to @attachment, notice: 'Attachment was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @attachment.errors, status: :unprocessable_entity }
end
end
end
# DELETE /attachments/1
# DELETE /attachments/1.json
def destroy
@attachment = Attachment.find(params[:id])
@attachment.destroy
respond_to do |format|
format.html { redirect_to attachments_url }
format.json { head :no_content }
end
end
end

View File

@@ -0,0 +1,83 @@
class FragenController < ApplicationController
# GET /fragen
# GET /fragen.json
def index
@fragen = Frage.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @fragen }
end
end
# GET /fragen/1
# GET /fragen/1.json
def show
@frage = Frage.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @frage }
end
end
# GET /fragen/new
# GET /fragen/new.json
def new
@frage = Frage.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @frage }
end
end
# GET /fragen/1/edit
def edit
@frage = Frage.find(params[:id])
end
# POST /fragen
# POST /fragen.json
def create
@frage = Frage.new(params[:frage])
respond_to do |format|
if @frage.save
format.html { redirect_to @frage, notice: 'Frage was successfully created.' }
format.json { render json: @frage, status: :created, location: @frage }
else
format.html { render action: "new" }
format.json { render json: @frage.errors, status: :unprocessable_entity }
end
end
end
# PUT /fragen/1
# PUT /fragen/1.json
def update
@frage = Frage.find(params[:id])
respond_to do |format|
if @frage.update_attributes(params[:frage])
format.html { redirect_to @frage, notice: 'Frage was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @frage.errors, status: :unprocessable_entity }
end
end
end
# DELETE /fragen/1
# DELETE /fragen/1.json
def destroy
@frage = Frage.find(params[:id])
@frage.destroy
respond_to do |format|
format.html { redirect_to fragen_url }
format.json { head :no_content }
end
end
end

View File

@@ -0,0 +1,83 @@
class ThemenController < ApplicationController
# GET /themen
# GET /themen.json
def index
@themen = Thema.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @themen }
end
end
# GET /themen/1
# GET /themen/1.json
def show
@thema = Thema.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @thema }
end
end
# GET /themen/new
# GET /themen/new.json
def new
@thema = Thema.new
@thema.themengruppe = Themengruppe.find(params[:themengruppe_id]) unless params[:themengruppe_id].nil?
respond_to do |format|
format.html # new.html.erb
format.json { render json: @thema }
end
end
# GET /themen/1/edit
def edit
@thema = Thema.find(params[:id])
end
# POST /themen
# POST /themen.json
def create
@thema = Thema.new(params[:thema])
respond_to do |format|
if @thema.save
format.html { redirect_to @thema, notice: 'Thema was successfully created.' }
format.json { render json: @thema, status: :created, location: @thema }
else
format.html { render action: "new" }
format.json { render json: @thema.errors, status: :unprocessable_entity }
end
end
end
# PUT /themen/1
# PUT /themen/1.json
def update
@thema = Thema.find(params[:id])
respond_to do |format|
if @thema.update_attributes(params[:thema])
format.html { redirect_to @thema, notice: 'Thema was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @thema.errors, status: :unprocessable_entity }
end
end
end
# DELETE /themen/1
# DELETE /themen/1.json
def destroy
@thema = Thema.find(params[:id])
@thema.destroy
respond_to do |format|
format.html { redirect_to themen_url }
format.json { head :no_content }
end
end
end

View File

@@ -0,0 +1,83 @@
class ThemengruppenController < ApplicationController
# GET /themengruppen
# GET /themengruppen.json
def index
@themengruppen = Themengruppe.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @themengruppen }
end
end
# GET /themengruppen/1
# GET /themengruppen/1.json
def show
@themengruppe = Themengruppe.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @themengruppe }
end
end
# GET /themengruppen/new
# GET /themengruppen/new.json
def new
@themengruppe = Themengruppe.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @themengruppe }
end
end
# GET /themengruppen/1/edit
def edit
@themengruppe = Themengruppe.find(params[:id])
end
# POST /themengruppen
# POST /themengruppen.json
def create
@themengruppe = Themengruppe.new(params[:themengruppe])
respond_to do |format|
if @themengruppe.save
format.html { redirect_to @themengruppe, notice: 'Themengruppe was successfully created.' }
format.json { render json: @themengruppe, status: :created, location: @themengruppe }
else
format.html { render action: "new" }
format.json { render json: @themengruppe.errors, status: :unprocessable_entity }
end
end
end
# PUT /themengruppen/1
# PUT /themengruppen/1.json
def update
@themengruppe = Themengruppe.find(params[:id])
respond_to do |format|
if @themengruppe.update_attributes(params[:themengruppe])
format.html { redirect_to @themengruppe, notice: 'Themengruppe was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @themengruppe.errors, status: :unprocessable_entity }
end
end
end
# DELETE /themengruppen/1
# DELETE /themengruppen/1.json
def destroy
@themengruppe = Themengruppe.find(params[:id])
@themengruppe.destroy
respond_to do |format|
format.html { redirect_to themengruppen_url }
format.json { head :no_content }
end
end
end

View File

@@ -0,0 +1,2 @@
module AttachmentsHelper
end

View File

@@ -0,0 +1,2 @@
module FragenHelper
end

View File

@@ -0,0 +1,2 @@
module ThemenHelper
end

View File

@@ -0,0 +1,2 @@
module ThemengruppenHelper
end

8
app/models/attachment.rb Normal file
View File

@@ -0,0 +1,8 @@
class Attachment < ActiveRecord::Base
has_paper_trail
attr_accessible :name
belongs_to :thema
validates :thema, :presence => true
validates :name, :presence => true
end

View File

@@ -0,0 +1,4 @@
class Attachment < ActiveRecord::Base
attr_accessible :name
belongs_to :thema
end

9
app/models/frage.rb Normal file
View File

@@ -0,0 +1,9 @@
class Frage < ActiveRecord::Base
attr_accessible :text, :title
belongs_to :thema
validates :thema, :presence => true
validates :title, :presence => true
translates :title,:text, :versioning =>true, :fallbacks_for_empty_translations => true
end

10
app/models/frage.rb~ Normal file
View File

@@ -0,0 +1,10 @@
class Frage < ActiveRecord::Base
has_paper_trail
attr_accessible :text, :title
belongs_to :thema
validates :thema, :presence => true
validates :title, :presence => true
translates :title,:text, :versioning =>true, :fallbacks_for_empty_translations => true
end

52
app/models/lva.rb~ Executable file
View File

@@ -0,0 +1,52 @@
##
# Author:: Andreas Stephanides
# License:: GPL
# Dieses Model repräsentiert eine LVA. Die notwendigen Informationen können mit TISS (dem Online System der TU Wien) synchronisiert werden
class Lva < ActiveRecord::Base
has_paper_trail # Versionsver
attr_accessible :desc, :ects, :lvanr, :name, :stunden, :modul_ids
has_and_belongs_to_many :moduls
has_and_belongs_to_many :semester
translates :desc, :fallbacks_for_empty_translations => true
has_many :beispiele , :class_name => "Beispiel"
after_initialize :load_tissdata
##
# Lade den Hash aus TISS und speichere diesen in @hash
#
def hash
url= "https://tiss.tuwien.ac.at/api/course/"+ self.lvanr.to_s+"-2012W"
@hash=Hash.from_xml(open(url).read)
end
def objective
@hash["course"]["objective"][I18n.locale.to_s]
end
def techingContent
@hash["course"]["teachingContent"][I18n.locale.to_s]
end
def person
@person
end
private
def load_tissdata
url= "https://tiss.tuwien.ac.at/api/course/"+ self.lvanr.to_s+"-2012W"
begin
@hash=Hash.from_xml(open(url).read)["tuvienna"]
@person=[]
if @hash["course"]["lecturers"]["oid"].is_a? String
@person = @hash["course"]["lecturers"]["oid"]
else
@hash["course"]["lecturers"]["oid"].each do |pid|
@person << Hash.from_xml(open("https://tiss.tuwien.ac.at/adressbuch/adressbuch/person_via_oid/" + pid.to_s + ".xml").read)["tuvienna"]["person"]
end
end
rescue OpenURI::HTTPError => e
end
end
end

28
app/models/modulgruppe.rb~ Executable file
View File

@@ -0,0 +1,28 @@
# == Schema Information
#
# Table name: modulgruppen
#
# id :integer not null, primary key
# typ :string(255)
# phase :integer
# name :string(255)
# desc :text
# studium_id :integer
# created_at :datetime not null
# updated_at :datetime not null
#
class Modulgruppe < ActiveRecord::Base
attr_accessible :name, :phase, :typ,:desc, :studium_id
belongs_to :studium, :foreign_key => "studium_id"
has_and_belongs_to_many :moduls
resourcify
validates :studium_id, :presence => true # Bei der Abfrage ist student_id entscheidend
#validates :studium, :presence => true # Wird gesetzt, um das richtige Feld zu melden bei Fehlern
validates :name, :uniqueness =>{:scope => :studium_id}, :presence=>true # Pro Studium darf ein Name nur einmal vorkommen
validates :phase, :inclusion => {:in => [1, 2, 3, 4]}
validates :typ, :inclusion => {:in => ["Pflicht","Vertiefungspflicht","Wahl"] }
translates :desc, :versioning =>true,:fallbacks_for_empty_translations => true
end

11
app/models/thema.rb Normal file
View File

@@ -0,0 +1,11 @@
class Thema < ActiveRecord::Base
attr_accessible :text, :title, :themengruppe_id
has_many :fragen
has_many :attachments
belongs_to :themengruppe, :foreign_key => "themengruppe_id"
validates :themengruppe, :presence => true
validates :title, :presence => true
translates :title,:text, :versioning =>true, :fallbacks_for_empty_translations => true
end

11
app/models/thema.rb~ Normal file
View File

@@ -0,0 +1,11 @@
class Thema < ActiveRecord::Base
attr_accessible :text, :title
has_many :fragen
has_many :attachments
belongs_to :themengruppe
validates :themengruppe, :presence => true
validates :title, :presence => true
translates :title,:text, :versioning =>true, :fallbacks_for_empty_translations => true
end

View File

@@ -0,0 +1,9 @@
class Themengruppe < ActiveRecord::Base
attr_accessible :text, :title
has_many :themen, class_name: 'Thema'
has_many :fragen, through: :themen
validates :title, :presence => true
translates :title,:text, :versioning =>true, :fallbacks_for_empty_translations => true
end

View File

@@ -0,0 +1,8 @@
class Themengruppe < ActiveRecord::Base
has_paper_trail
attr_accessible :text, :title
has_many :themen
has_many :fragen, through: :themen
validates :title, :presence => true
end

View File

@@ -0,0 +1,9 @@
<%= semantic_form_for @attachment do |f| %>
<%= f.inputs do %>
<%= f.input :name %>
<% end %>
<%= f.actions do %>
<%= f.action :submit, :as => :input %>
<% end %>
<% end %>

View File

@@ -0,0 +1,6 @@
<h1>Editing attachment</h1>
<%= render 'form' %>
<%= link_to 'Show', @attachment %> |
<%= link_to 'Back', attachments_path %>

View File

@@ -0,0 +1,23 @@
<h1>Listing attachments</h1>
<table>
<tr>
<th>Name</th>
<th></th>
<th></th>
<th></th>
</tr>
<% @attachments.each do |attachment| %>
<tr>
<td><%= attachment.name %></td>
<td><%= link_to 'Show', attachment %></td>
<td><%= link_to 'Edit', edit_attachment_path(attachment) %></td>
<td><%= link_to 'Destroy', attachment, method: :delete, data: { confirm: 'Are you sure?' } %></td>
</tr>
<% end %>
</table>
<br />
<%= link_to 'New Attachment', new_attachment_path %>

View File

@@ -0,0 +1,5 @@
<h1>New attachment</h1>
<%= render 'form' %>
<%= link_to 'Back', attachments_path %>

View File

@@ -0,0 +1,10 @@
<p id="notice"><%= notice %></p>
<p>
<b>Name:</b>
<%= @attachment.name %>
</p>
<%= link_to 'Edit', edit_attachment_path(@attachment) %> |
<%= link_to 'Back', attachments_path %>

View File

@@ -0,0 +1,10 @@
<%= semantic_form_for @frage do |f| %>
<%= f.inputs do %>
<%= f.input :title %>
<%= f.input :text %>
<% end %>
<%= f.actions do %>
<%= f.action :submit, :as => :input %>
<% end %>
<% end %>

View File

@@ -0,0 +1,6 @@
<h1>Editing frage</h1>
<%= render 'form' %>
<%= link_to 'Show', @frage %> |
<%= link_to 'Back', fragen_path %>

View File

@@ -0,0 +1,25 @@
<h1>Listing fragen</h1>
<table>
<tr>
<th>Title</th>
<th>Text</th>
<th></th>
<th></th>
<th></th>
</tr>
<% @fragen.each do |frage| %>
<tr>
<td><%= frage.title %></td>
<td><%= frage.text %></td>
<td><%= link_to 'Show', frage %></td>
<td><%= link_to 'Edit', edit_frage_path(frage) %></td>
<td><%= link_to 'Destroy', frage, method: :delete, data: { confirm: 'Are you sure?' } %></td>
</tr>
<% end %>
</table>
<br />
<%= link_to 'New Frage', new_frage_path %>

View File

@@ -0,0 +1,5 @@
<h1>New frage</h1>
<%= render 'form' %>
<%= link_to 'Back', fragen_path %>

View File

@@ -0,0 +1,13 @@
<p id="notice"><%= notice %></p>
<h1>
<%= @frage.title %>
</h1>
<p>
<%= @frage.text %>
</p>
<%= link_to 'Edit', edit_frage_path(@frage) %> |
<%= link_to 'Back', fragen_path %>

View File

@@ -0,0 +1,15 @@
<p id="notice"><%= notice %></p>
<p>
<b>Title:</b>
<%= @frage.title %>
</p>
<p>
<b>Text:</b>
<%= @frage.text %>
</p>
<%= link_to 'Edit', edit_frage_path(@frage) %> |
<%= link_to 'Back', fragen_path %>

View File

@@ -12,7 +12,7 @@
<li><%= link_to I18n.t(:home,:scope=>'home' ), home_index_path %>
</li>
<li><%= link_to I18n.t(:news,:scope=>'home' ),rubriken_path %></li>
<li><%= link_to I18n.t(:info,:scope=>'home' ) %></li>
<li><%= link_to I18n.t(:info,:scope=>'home' ),themengruppen_path %></li>
<li><%= link_to I18n.t(:studien,:scope=>'home' ), studien_path %></li>
<li><%= link_to "Kalender", calendars_path %></li>
<% if user_signed_in? %>

View File

@@ -0,0 +1,13 @@
<%= tinymce_assets %>
<%= semantic_form_for @thema do |f| %>
<%= f.inputs do %>
<%= f.input :title %>
<%= f.input :themengruppe %>
<%= f.input :text, :as=>:tinymce_text%>
<% end %>
<%= tinymce %>
<%= f.actions do %>
<%= f.action :submit, :as => :input %>
<% end %>
<% end %>

View File

@@ -0,0 +1,3 @@
<%= raw(small.text) %>
<br/>
<%= link_to 'Edit', edit_thema_path(small) %>

View File

@@ -0,0 +1,2 @@
<%= link_to thema.title,themengruppe_thema_path(thema.themengruppe,thema)%>

View File

@@ -0,0 +1,6 @@
<h1>Editing thema</h1>
<%= render 'form' %>
<%= link_to 'Show', @thema %> |
<%= link_to 'Back', themen_path %>

View File

@@ -0,0 +1,25 @@
<h1>Listing themen</h1>
<table>
<tr>
<th>Title</th>
<th>Text</th>
<th></th>
<th></th>
<th></th>
</tr>
<% @themen.each do |thema| %>
<tr>
<td><%= thema.title %></td>
<td><%= thema.text %></td>
<td><%= link_to 'Show', thema %></td>
<td><%= link_to 'Edit', edit_thema_path(thema) %></td>
<td><%= link_to 'Destroy', thema, method: :delete, data: { confirm: 'Are you sure?' } %></td>
</tr>
<% end %>
</table>
<br />
<%= link_to 'New Thema', new_thema_path %>

View File

@@ -0,0 +1,5 @@
<h1>New thema</h1>
<%= render 'form' %>
<%= link_to 'Back', themen_path %>

View File

@@ -0,0 +1,10 @@
<p id="notice"><%= notice %></p>
<h1><%= @thema.title %></h1>
<p>
<%= raw(@thema.text) %>
</p>
<%= link_to 'Edit', edit_thema_path(@thema) %> |
<%= link_to 'Back', themengruppe_path(@thema.themengruppe) %>

View File

@@ -0,0 +1,10 @@
<%= semantic_form_for @themengruppe do |f| %>
<%= f.inputs do %>
<%= f.input :title %>
<%= f.input :text %>
<% end %>
<%= f.actions do %>
<%= f.action :submit, :as => :input %>
<% end %>
<% end %>

View File

@@ -0,0 +1,12 @@
<h3> <%= link_to themengruppe.title, themengruppe %> </h3>
<p>
<%=themengruppe.text %>
</p>
<ul>
<% themengruppe.themen.each do |t| %>
<li>
<%= render t %>
</li>
<% end %>
</ul>

View File

@@ -0,0 +1,6 @@
<h1>Editing themengruppen</h1>
<%= render 'form' %>
<%= link_to 'Show', @themengruppe %> |
<%= link_to 'Back', themengruppen_path %>

View File

@@ -0,0 +1,24 @@
<div class="container-fluid">
<% @themengruppen.each_slice(2) do |row| %>
<div class="row-fluid">
<% row.each do |themengruppe| %>
<div class="span6 equalheight">
<div class="themengruppe">
<%= render themengruppe %>
<p>
<%= link_to 'Edit', edit_themengruppe_path(themengruppe) %>
</p>
</div>
</div>
<% end %>
</div>
<% end %>
</div>
<br />
<script>
make_equal_height();
</script>
<%= link_to 'New Themengruppe', new_themengruppe_path %>

View File

@@ -0,0 +1,25 @@
<h1>Listing themengruppen</h1>
<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>
<br />
<%= link_to 'New Themengruppe', new_themagruppen_path %>

View File

@@ -0,0 +1,5 @@
<h1>New themagruppen</h1>
<%= render 'form' %>
<%= link_to 'Back', themengruppen_path %>

View File

@@ -0,0 +1,29 @@
<h1><%= @themengruppe.title %></h1>
<p>
<%= @themengruppe.text %>
</p>
<div class="accordion" id="accordion1">
<% @themengruppe.themen.each do |thema| %>
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion1" href="#collapse<%=thema.id%>">
<%= thema.title %>
</a>
</div>
<div id="collapse<%=thema.id%>" class="accordion-body collapse">
<div class="accordion-inner">
<%= render partial: "themen/small", object: thema %>
</div>
</div>
</div>
<% end %>
</div>
<%= link_to 'Add Thema', new_themengruppe_thema_path(@themengruppe) %>
<br/><br/>
<%= link_to 'Edit', edit_themengruppe_path(@themengruppe) %> |
<%= link_to 'Back', themengruppen_path %>