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 %>

View File

@@ -31,7 +31,8 @@ module Fetsite
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de
config.i18n.default_locale = :de
config.i18n.fallbacks = [:en, :de]
# Configure the default encoding used in templates for Ruby 1.9.
config.encoding = "utf-8"

View File

@@ -0,0 +1,37 @@
Fetsite::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
config.cache_classes = false
# Log error messages when you accidentally call methods on nil.
config.whiny_nils = true
# Show full error reports and disable caching
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
# Don't care if the mailer can't send
config.action_mailer.raise_delivery_errors = false
config.action_mailer.default_url_options = { :host => 'glonass.htu.tuwien.ac.at' }
# Print deprecation notices to the Rails logger
config.active_support.deprecation = :log
# Only use best-standards-support built into browsers
config.action_dispatch.best_standards_support = :builtin
# Raise exception on mass assignment protection for Active Record models
config.active_record.mass_assignment_sanitizer = :strict
# 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
# Do not compress assets
config.assets.compress = false
# Expands the lines which load the assets
config.assets.debug = true
end

View File

@@ -25,4 +25,10 @@ inflect.plural 'rubrik', 'rubriken'
inflect.singular 'rubriken', 'rubrik'
inflect.plural 'beispiel', 'beispiele'
inflect.singular 'beispiele', 'beispiel'
inflect.plural 'themengruppe', 'themengruppen'
inflect.singular 'themengruppen', 'themengruppe'
inflect.plural /thema$/, 'themen'
inflect.singular /themen$/, 'thema'
inflect.plural 'frage', 'fragen'
inflect.singular 'fragen', 'frage'
end

View File

@@ -0,0 +1,34 @@
# Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format
# (all these examples are active by default):
# ActiveSupport::Inflector.inflections do |inflect|
# inflect.plural /^(ox)$/i, '\1en'
# inflect.singular /^(ox)en/i, '\1'
# inflect.irregular 'person', 'people'
# inflect.uncountable %w( fish sheep )
# end
#
# These inflection rules are supported but not enabled by default:
# ActiveSupport::Inflector.inflections do |inflect|
# inflect.acronym 'RESTful'
# end
ActiveSupport::Inflector.inflections do |inflect|
inflect.plural 'studium', 'studien'
inflect.singular 'studien', 'studium'
inflect.plural 'neuigkeit', 'neuigkeiten'
inflect.singular 'neuigkeiten', 'neuigkeit'
inflect.plural 'modulgruppe', 'modulgruppen'
inflect.singular 'modulgruppen', 'modulgruppe'
inflect.irregular 'modulgruppe', 'modulgruppen'
inflect.plural 'rubrik', 'rubriken'
inflect.singular 'rubriken', 'rubrik'
inflect.plural 'beispiel', 'beispiele'
inflect.singular 'beispiele', 'beispiel'
inflect.plural 'themengruppe', 'themengruppen'
inflect.singular 'themengruppen', 'themengruppe'
inflect.plural /thema$/, 'themen'
inflect.singular /^themen$/, 'thema'
inflect.plural 'frage', 'fragen'
inflect.singular 'fragen', 'frage'
end

View File

@@ -46,6 +46,10 @@
resources :home, :only=>[:index]
get 'home/dev', :controller=>:home, :action=>:dev, :as=>'home_dev'
resources :beispiele
resources :themen
resources :themengruppen do
resources :themen, :only=>[:new, :show]
end
resources :calendars
resources :calentries

View File

@@ -0,0 +1,21 @@
class CreateLvaSemesterJoinTable < ActiveRecord::Migration
def self.up
create_table :lvas_semesters, :id=>false do |t|
t.integer :lva_id
t.integer :semester_id
end
add_index :lva_semesters, [:lva_id, :semester_id]
add_index :lva_semesters, :semester_id
end
def change
create_table :lvas_semesters, :id=>false do |t|
t.integer :lva_id
t.integer :semester_id
end
add_index :lva_semesters, [:lva_id, :semester_id]
add_index :lva_semesters, :semester_id
end
def self.down
drop_table :lva_semesters
end
end

View File

@@ -0,0 +1,10 @@
class CreateThemengruppen < ActiveRecord::Migration
def change
create_table :themengruppen do |t|
t.string :title
t.text :text
t.timestamps
end
end
end

View File

@@ -0,0 +1,10 @@
class CreateThemen < ActiveRecord::Migration
def change
create_table :themen do |t|
t.string :title
t.text :text
t.timestamps
end
end
end

View File

@@ -0,0 +1,9 @@
class CreateAttachments < ActiveRecord::Migration
def change
create_table :attachments do |t|
t.string :name
t.timestamps
end
end
end

View File

@@ -0,0 +1,10 @@
class CreateFragen < ActiveRecord::Migration
def change
create_table :fragen do |t|
t.string :title
t.text :text
t.timestamps
end
end
end

View File

@@ -0,0 +1,7 @@
class AddIdToThemen < ActiveRecord::Migration
def change
add_column :themen, :themengruppe_id, :integer
add_column :attachments, :thema_id, :integer
add_column :fragen, :thema_id, :integer
end
end

View File

@@ -0,0 +1,7 @@
class AddIdToThemen < ActiveRecord::Migration
def change
add_column :themen, :themengruppe_id, :integer
add_column :attachments, :thema_id, :integer
add_column :fragen, :thema_id, :integer
end
end

View File

@@ -0,0 +1,38 @@
class TranslateThemen < ActiveRecord::Migration
def up
Thema.create_translation_table!({
:title => :string,
:text => :text
}, {
#:migrate_data => true
})
add_column :thema_translations, :theman_id, :integer
remove_column :thema_translations, :thema_id
Themengruppe.create_translation_table!({
:title => :string,
:text => :text
}, {
#:migrate_data => true
})
add_column :themengruppe_translations, :themengruppen_id, :integer
remove_column :themengruppe_translations, :themengruppe_id
Frage.create_translation_table!({
:title => :string,
:text => :text
}, {
#:migrate_data => true
})
add_column :frage_translations, :fragen_id, :integer
remove_column :frage_translations, :frage_id
end
def down
Thema.drop_translation_table! #:migrate_data => true
Themengruppe.drop_translation_table! #:migrate_data => true
Frage.drop_translation_table! #:migrate_data => true
end
end

View File

@@ -0,0 +1,38 @@
class TranslateThemen < ActiveRecord::Migration
def up
Thema.create_translation_table!({
:title => :string,
:text => :text
}, {
#:migrate_data => true
})
add_column :thema_translations, :themen_id, :integer
remove_column :themagruppe_translations, :thema_id
Themengruppe.create_translation_table!({
:title => :string,
:text => :text
}, {
#:migrate_data => true
})
add_column :themengruppe_translations, :themengruppen_id, :integer
remove_column :themengruppe_translations, :themengruppe_id
Frage.create_translation_table!({
:title => :string,
:text => :text
}, {
#:migrate_data => true
})
add_column :frage_translations, :fragen_id, :integer
remove_column :frage_translations, :frage_id
end
def down
Thema.drop_translation_table! #:migrate_data => true
Themengruppe.drop_translation_table! #:migrate_data => true
Frage.drop_translation_table! #:migrate_data => true
end
end

View File

@@ -0,0 +1,6 @@
class AddThemaidToThemaTranslations < ActiveRecord::Migration
def change
add_column :thema_translations, :theman_id, :integer
remove_column :thema_translations, :themen_id, :integer
end
end

View File

@@ -13,26 +13,20 @@
ActiveRecord::Schema.define(:version => 20130813145651) do
create_table "beispiel_translations", :force => true do |t|
t.string "locale"
t.text "desc"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.integer "beispiele_id"
create_table "attachments", :force => true do |t|
t.string "name"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.integer "thema_id"
end
add_index "beispiel_translations", ["locale"], :name => "index_beispiel_translations_on_locale"
create_table "beispiele", :force => true do |t|
t.string "name"
t.text "desc"
t.integer "lva_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "file_file_name"
t.string "file_content_type"
t.integer "file_file_size"
t.datetime "file_updated_at"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "beispieldatei"
end
create_table "calendars", :force => true do |t|
@@ -60,6 +54,25 @@ ActiveRecord::Schema.define(:version => 20130813145651) do
t.datetime "updated_at", :null => false
end
create_table "frage_translations", :force => true do |t|
t.string "locale"
t.string "title"
t.text "text"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.integer "fragen_id"
end
add_index "frage_translations", ["locale"], :name => "index_frage_translations_on_locale"
create_table "fragen", :force => true do |t|
t.string "title"
t.text "text"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.integer "thema_id"
end
create_table "lva_translations", :force => true do |t|
t.integer "lva_id"
t.string "locale"
@@ -156,18 +169,6 @@ ActiveRecord::Schema.define(:version => 20130813145651) do
t.datetime "updated_at", :null => false
end
create_table "pages", :force => true do |t|
t.string "name"
t.string "url"
t.integer "parent_id"
t.integer "lft"
t.integer "rgt"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
add_index "pages", ["parent_id"], :name => "index_pages_on_parent_id"
create_table "roles", :force => true do |t|
t.string "name"
t.integer "resource_id"
@@ -218,6 +219,43 @@ ActiveRecord::Schema.define(:version => 20130813145651) do
add_index "studium_translations", ["locale"], :name => "index_studium_translations_on_locale"
create_table "thema_translations", :force => true do |t|
t.string "locale"
t.string "title"
t.text "text"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.integer "theman_id"
end
add_index "thema_translations", ["locale"], :name => "index_thema_translations_on_locale"
create_table "themen", :force => true do |t|
t.string "title"
t.text "text"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.integer "themengruppe_id"
end
create_table "themengruppe_translations", :force => true do |t|
t.string "locale"
t.string "title"
t.text "text"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.integer "themengruppen_id"
end
add_index "themengruppe_translations", ["locale"], :name => "index_themengruppe_translations_on_locale"
create_table "themengruppen", :force => true do |t|
t.string "title"
t.text "text"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "users", :force => true do |t|
t.string "email", :default => "", :null => false
t.string "encrypted_password", :default => "", :null => false

View File

@@ -0,0 +1,160 @@
require 'spec_helper'
# This spec was generated by rspec-rails when you ran the scaffold generator.
# It demonstrates how one might use RSpec to specify the controller code that
# was generated by Rails when you ran the scaffold generator.
#
# It assumes that the implementation code is generated by the rails scaffold
# generator. If you are using any extension libraries to generate different
# controller code, this generated spec may or may not pass.
#
# It only uses APIs available in rails and/or rspec-rails. There are a number
# of tools you can use to make these specs even more expressive, but we're
# sticking to rails and rspec-rails APIs to keep things simple and stable.
#
# Compared to earlier versions of this generator, there is very limited use of
# stubs and message expectations in this spec. Stubs are only used when there
# is no simpler way to get a handle on the object needed for the example.
# Message expectations are only used when there is no simpler way to specify
# that an instance is receiving a specific message.
describe AttachmentsController do
# This should return the minimal set of attributes required to create a valid
# Attachment. As you add validations to Attachment, be sure to
# adjust the attributes here as well.
let(:valid_attributes) { { "name" => "MyString" } }
# This should return the minimal set of values that should be in the session
# in order to pass any filters (e.g. authentication) defined in
# AttachmentsController. Be sure to keep this updated too.
let(:valid_session) { {} }
describe "GET index" do
it "assigns all attachments as @attachments" do
attachment = Attachment.create! valid_attributes
get :index, {}, valid_session
assigns(:attachments).should eq([attachment])
end
end
describe "GET show" do
it "assigns the requested attachment as @attachment" do
attachment = Attachment.create! valid_attributes
get :show, {:id => attachment.to_param}, valid_session
assigns(:attachment).should eq(attachment)
end
end
describe "GET new" do
it "assigns a new attachment as @attachment" do
get :new, {}, valid_session
assigns(:attachment).should be_a_new(Attachment)
end
end
describe "GET edit" do
it "assigns the requested attachment as @attachment" do
attachment = Attachment.create! valid_attributes
get :edit, {:id => attachment.to_param}, valid_session
assigns(:attachment).should eq(attachment)
end
end
describe "POST create" do
describe "with valid params" do
it "creates a new Attachment" do
expect {
post :create, {:attachment => valid_attributes}, valid_session
}.to change(Attachment, :count).by(1)
end
it "assigns a newly created attachment as @attachment" do
post :create, {:attachment => valid_attributes}, valid_session
assigns(:attachment).should be_a(Attachment)
assigns(:attachment).should be_persisted
end
it "redirects to the created attachment" do
post :create, {:attachment => valid_attributes}, valid_session
response.should redirect_to(Attachment.last)
end
end
describe "with invalid params" do
it "assigns a newly created but unsaved attachment as @attachment" do
# Trigger the behavior that occurs when invalid params are submitted
Attachment.any_instance.stub(:save).and_return(false)
post :create, {:attachment => { "name" => "invalid value" }}, valid_session
assigns(:attachment).should be_a_new(Attachment)
end
it "re-renders the 'new' template" do
# Trigger the behavior that occurs when invalid params are submitted
Attachment.any_instance.stub(:save).and_return(false)
post :create, {:attachment => { "name" => "invalid value" }}, valid_session
response.should render_template("new")
end
end
end
describe "PUT update" do
describe "with valid params" do
it "updates the requested attachment" do
attachment = Attachment.create! valid_attributes
# Assuming there are no other attachments in the database, this
# specifies that the Attachment created on the previous line
# receives the :update_attributes message with whatever params are
# submitted in the request.
Attachment.any_instance.should_receive(:update_attributes).with({ "name" => "MyString" })
put :update, {:id => attachment.to_param, :attachment => { "name" => "MyString" }}, valid_session
end
it "assigns the requested attachment as @attachment" do
attachment = Attachment.create! valid_attributes
put :update, {:id => attachment.to_param, :attachment => valid_attributes}, valid_session
assigns(:attachment).should eq(attachment)
end
it "redirects to the attachment" do
attachment = Attachment.create! valid_attributes
put :update, {:id => attachment.to_param, :attachment => valid_attributes}, valid_session
response.should redirect_to(attachment)
end
end
describe "with invalid params" do
it "assigns the attachment as @attachment" do
attachment = Attachment.create! valid_attributes
# Trigger the behavior that occurs when invalid params are submitted
Attachment.any_instance.stub(:save).and_return(false)
put :update, {:id => attachment.to_param, :attachment => { "name" => "invalid value" }}, valid_session
assigns(:attachment).should eq(attachment)
end
it "re-renders the 'edit' template" do
attachment = Attachment.create! valid_attributes
# Trigger the behavior that occurs when invalid params are submitted
Attachment.any_instance.stub(:save).and_return(false)
put :update, {:id => attachment.to_param, :attachment => { "name" => "invalid value" }}, valid_session
response.should render_template("edit")
end
end
end
describe "DELETE destroy" do
it "destroys the requested attachment" do
attachment = Attachment.create! valid_attributes
expect {
delete :destroy, {:id => attachment.to_param}, valid_session
}.to change(Attachment, :count).by(-1)
end
it "redirects to the attachments list" do
attachment = Attachment.create! valid_attributes
delete :destroy, {:id => attachment.to_param}, valid_session
response.should redirect_to(attachments_url)
end
end
end

View File

@@ -0,0 +1,160 @@
require 'spec_helper'
# This spec was generated by rspec-rails when you ran the scaffold generator.
# It demonstrates how one might use RSpec to specify the controller code that
# was generated by Rails when you ran the scaffold generator.
#
# It assumes that the implementation code is generated by the rails scaffold
# generator. If you are using any extension libraries to generate different
# controller code, this generated spec may or may not pass.
#
# It only uses APIs available in rails and/or rspec-rails. There are a number
# of tools you can use to make these specs even more expressive, but we're
# sticking to rails and rspec-rails APIs to keep things simple and stable.
#
# Compared to earlier versions of this generator, there is very limited use of
# stubs and message expectations in this spec. Stubs are only used when there
# is no simpler way to get a handle on the object needed for the example.
# Message expectations are only used when there is no simpler way to specify
# that an instance is receiving a specific message.
describe FragenController do
# This should return the minimal set of attributes required to create a valid
# Frage. As you add validations to Frage, be sure to
# adjust the attributes here as well.
let(:valid_attributes) { { "title" => "MyString" } }
# This should return the minimal set of values that should be in the session
# in order to pass any filters (e.g. authentication) defined in
# FragenController. Be sure to keep this updated too.
let(:valid_session) { {} }
describe "GET index" do
it "assigns all fragenn as @fragenn" do
frage = Frage.create! valid_attributes
get :index, {}, valid_session
assigns(:fragen).should eq([frage])
end
end
describe "GET show" do
it "assigns the requested frage as @frage" do
frage = Frage.create! valid_attributes
get :show, {:id => frage.to_param}, valid_session
assigns(:frage).should eq(frage)
end
end
describe "GET new" do
it "assigns a new frage as @frage" do
get :new, {}, valid_session
assigns(:frage).should be_a_new(Frage)
end
end
describe "GET edit" do
it "assigns the requested frage as @frage" do
frage = Frage.create! valid_attributes
get :edit, {:id => frage.to_param}, valid_session
assigns(:frage).should eq(frage)
end
end
describe "POST create" do
describe "with valid params" do
it "creates a new Frage" do
expect {
post :create, {:frage => valid_attributes}, valid_session
}.to change(Frage, :count).by(1)
end
it "assigns a newly created frage as @frage" do
post :create, {:frage => valid_attributes}, valid_session
assigns(:frage).should be_a(Frage)
assigns(:frage).should be_persisted
end
it "redirects to the created frage" do
post :create, {:frage => valid_attributes}, valid_session
response.should redirect_to(Frage.last)
end
end
describe "with invalid params" do
it "assigns a newly created but unsaved frage as @frage" do
# Trigger the behavior that occurs when invalid params are submitted
Frage.any_instance.stub(:save).and_return(false)
post :create, {:frage => { "title" => "invalid value" }}, valid_session
assigns(:frage).should be_a_new(Frage)
end
it "re-renders the 'new' template" do
# Trigger the behavior that occurs when invalid params are submitted
Frage.any_instance.stub(:save).and_return(false)
post :create, {:frage => { "title" => "invalid value" }}, valid_session
response.should render_template("new")
end
end
end
describe "PUT update" do
describe "with valid params" do
it "updates the requested frage" do
frage = Frage.create! valid_attributes
# Assuming there are no other fragen in the database, this
# specifies that the Frage created on the previous line
# receives the :update_attributes message with whatever params are
# submitted in the request.
Frage.any_instance.should_receive(:update_attributes).with({ "title" => "MyString" })
put :update, {:id => frage.to_param, :frage => { "title" => "MyString" }}, valid_session
end
it "assigns the requested frage as @frage" do
frage = Frage.create! valid_attributes
put :update, {:id => frage.to_param, :frage => valid_attributes}, valid_session
assigns(:frage).should eq(frage)
end
it "redirects to the frage" do
frage = Frage.create! valid_attributes
put :update, {:id => frage.to_param, :frage => valid_attributes}, valid_session
response.should redirect_to(frage)
end
end
describe "with invalid params" do
it "assigns the frage as @frage" do
frage = Frage.create! valid_attributes
# Trigger the behavior that occurs when invalid params are submitted
Frage.any_instance.stub(:save).and_return(false)
put :update, {:id => frage.to_param, :frage => { "title" => "invalid value" }}, valid_session
assigns(:frage).should eq(frage)
end
it "re-renders the 'edit' template" do
frage = Frage.create! valid_attributes
# Trigger the behavior that occurs when invalid params are submitted
Frage.any_instance.stub(:save).and_return(false)
put :update, {:id => frage.to_param, :frage => { "title" => "invalid value" }}, valid_session
response.should render_template("edit")
end
end
end
describe "DELETE destroy" do
it "destroys the requested frage" do
frage = Frage.create! valid_attributes
expect {
delete :destroy, {:id => frage.to_param}, valid_session
}.to change(Frage, :count).by(-1)
end
it "redirects to the fragen list" do
frage = Frage.create! valid_attributes
delete :destroy, {:id => frage.to_param}, valid_session
response.should redirect_to(fragen_url)
end
end
end

View File

@@ -0,0 +1,160 @@
require 'spec_helper'
# This spec was generated by rspec-rails when you ran the scaffold generator.
# It demonstrates how one might use RSpec to specify the controller code that
# was generated by Rails when you ran the scaffold generator.
#
# It assumes that the implementation code is generated by the rails scaffold
# generator. If you are using any extension libraries to generate different
# controller code, this generated spec may or may not pass.
#
# It only uses APIs available in rails and/or rspec-rails. There are a number
# of tools you can use to make these specs even more expressive, but we're
# sticking to rails and rspec-rails APIs to keep things simple and stable.
#
# Compared to earlier versions of this generator, there is very limited use of
# stubs and message expectations in this spec. Stubs are only used when there
# is no simpler way to get a handle on the object needed for the example.
# Message expectations are only used when there is no simpler way to specify
# that an instance is receiving a specific message.
describe ThemenController do
# This should return the minimal set of attributes required to create a valid
# Thema. As you add validations to Thema, be sure to
# adjust the attributes here as well.
let(:valid_attributes) { { "title" => "MyString" } }
# This should return the minimal set of values that should be in the session
# in order to pass any filters (e.g. authentication) defined in
# ThemenController. Be sure to keep this updated too.
let(:valid_session) { {} }
describe "GET index" do
it "assigns all themen as @themen" do
thema = Thema.create! valid_attributes
get :index, {}, valid_session
assigns(:themen).should eq([thema])
end
end
describe "GET show" do
it "assigns the requested thema as @thema" do
thema = Thema.create! valid_attributes
get :show, {:id => thema.to_param}, valid_session
assigns(:thema).should eq(thema)
end
end
describe "GET new" do
it "assigns a new thema as @thema" do
get :new, {}, valid_session
assigns(:thema).should be_a_new(Thema)
end
end
describe "GET edit" do
it "assigns the requested thema as @thema" do
thema = Thema.create! valid_attributes
get :edit, {:id => thema.to_param}, valid_session
assigns(:thema).should eq(thema)
end
end
describe "POST create" do
describe "with valid params" do
it "creates a new Thema" do
expect {
post :create, {:thema => valid_attributes}, valid_session
}.to change(Thema, :count).by(1)
end
it "assigns a newly created thema as @thema" do
post :create, {:thema => valid_attributes}, valid_session
assigns(:thema).should be_a(Thema)
assigns(:thema).should be_persisted
end
it "redirects to the created thema" do
post :create, {:thema => valid_attributes}, valid_session
response.should redirect_to(Thema.last)
end
end
describe "with invalid params" do
it "assigns a newly created but unsaved thema as @thema" do
# Trigger the behavior that occurs when invalid params are submitted
Thema.any_instance.stub(:save).and_return(false)
post :create, {:thema => { "title" => "invalid value" }}, valid_session
assigns(:thema).should be_a_new(Thema)
end
it "re-renders the 'new' template" do
# Trigger the behavior that occurs when invalid params are submitted
Thema.any_instance.stub(:save).and_return(false)
post :create, {:thema => { "title" => "invalid value" }}, valid_session
response.should render_template("new")
end
end
end
describe "PUT update" do
describe "with valid params" do
it "updates the requested thema" do
thema = Thema.create! valid_attributes
# Assuming there are no other themen in the database, this
# specifies that the Thema created on the previous line
# receives the :update_attributes message with whatever params are
# submitted in the request.
Thema.any_instance.should_receive(:update_attributes).with({ "title" => "MyString" })
put :update, {:id => thema.to_param, :thema => { "title" => "MyString" }}, valid_session
end
it "assigns the requested thema as @thema" do
thema = Thema.create! valid_attributes
put :update, {:id => thema.to_param, :thema => valid_attributes}, valid_session
assigns(:thema).should eq(thema)
end
it "redirects to the thema" do
thema = Thema.create! valid_attributes
put :update, {:id => thema.to_param, :thema => valid_attributes}, valid_session
response.should redirect_to(thema)
end
end
describe "with invalid params" do
it "assigns the thema as @thema" do
thema = Thema.create! valid_attributes
# Trigger the behavior that occurs when invalid params are submitted
Thema.any_instance.stub(:save).and_return(false)
put :update, {:id => thema.to_param, :thema => { "title" => "invalid value" }}, valid_session
assigns(:thema).should eq(thema)
end
it "re-renders the 'edit' template" do
thema = Thema.create! valid_attributes
# Trigger the behavior that occurs when invalid params are submitted
Thema.any_instance.stub(:save).and_return(false)
put :update, {:id => thema.to_param, :thema => { "title" => "invalid value" }}, valid_session
response.should render_template("edit")
end
end
end
describe "DELETE destroy" do
it "destroys the requested thema" do
thema = Thema.create! valid_attributes
expect {
delete :destroy, {:id => thema.to_param}, valid_session
}.to change(Thema, :count).by(-1)
end
it "redirects to the themen list" do
thema = Thema.create! valid_attributes
delete :destroy, {:id => thema.to_param}, valid_session
response.should redirect_to(themen_url)
end
end
end

View File

@@ -0,0 +1,160 @@
require 'spec_helper'
# This spec was generated by rspec-rails when you ran the scaffold generator.
# It demonstrates how one might use RSpec to specify the controller code that
# was generated by Rails when you ran the scaffold generator.
#
# It assumes that the implementation code is generated by the rails scaffold
# generator. If you are using any extension libraries to generate different
# controller code, this generated spec may or may not pass.
#
# It only uses APIs available in rails and/or rspec-rails. There are a number
# of tools you can use to make these specs even more expressive, but we're
# sticking to rails and rspec-rails APIs to keep things simple and stable.
#
# Compared to earlier versions of this generator, there is very limited use of
# stubs and message expectations in this spec. Stubs are only used when there
# is no simpler way to get a handle on the object needed for the example.
# Message expectations are only used when there is no simpler way to specify
# that an instance is receiving a specific message.
describe ThemengruppenController do
# This should return the minimal set of attributes required to create a valid
# Themengruppe. As you add validations to Themengruppe, be sure to
# adjust the attributes here as well.
let(:valid_attributes) { { "title" => "MyString" } }
# This should return the minimal set of values that should be in the session
# in order to pass any filters (e.g. authentication) defined in
# ThemengruppenController. Be sure to keep this updated too.
let(:valid_session) { {} }
describe "GET index" do
it "assigns all themengruppenn as @themengruppenn" do
themengruppe = Themengruppe.create! valid_attributes
get :index, {}, valid_session
assigns(:themengruppen).should eq([themengruppe])
end
end
describe "GET show" do
it "assigns the requested themengruppe as @themengruppe" do
themengruppe = Themengruppe.create! valid_attributes
get :show, {:id => themengruppe.to_param}, valid_session
assigns(:themengruppe).should eq(themengruppe)
end
end
describe "GET new" do
it "assigns a new themengruppe as @themengruppe" do
get :new, {}, valid_session
assigns(:themengruppe).should be_a_new(Themengruppe)
end
end
describe "GET edit" do
it "assigns the requested themengruppe as @themengruppe" do
themengruppe = Themengruppe.create! valid_attributes
get :edit, {:id => themengruppe.to_param}, valid_session
assigns(:themengruppe).should eq(themengruppe)
end
end
describe "POST create" do
describe "with valid params" do
it "creates a new Themengruppe" do
expect {
post :create, {:themengruppe => valid_attributes}, valid_session
}.to change(Themengruppe, :count).by(1)
end
it "assigns a newly created themengruppe as @themengruppe" do
post :create, {:themengruppe => valid_attributes}, valid_session
assigns(:themengruppe).should be_a(Themengruppe)
assigns(:themengruppe).should be_persisted
end
it "redirects to the created themengruppe" do
post :create, {:themengruppe => valid_attributes}, valid_session
response.should redirect_to(Themengruppe.last)
end
end
describe "with invalid params" do
it "assigns a newly created but unsaved themengruppe as @themengruppe" do
# Trigger the behavior that occurs when invalid params are submitted
Themengruppe.any_instance.stub(:save).and_return(false)
post :create, {:themengruppe => { "title" => "invalid value" }}, valid_session
assigns(:themengruppe).should be_a_new(Themengruppe)
end
it "re-renders the 'new' template" do
# Trigger the behavior that occurs when invalid params are submitted
Themengruppe.any_instance.stub(:save).and_return(false)
post :create, {:themengruppe => { "title" => "invalid value" }}, valid_session
response.should render_template("new")
end
end
end
describe "PUT update" do
describe "with valid params" do
it "updates the requested themengruppe" do
themengruppe = Themengruppe.create! valid_attributes
# Assuming there are no other themengruppen in the database, this
# specifies that the Themengruppe created on the previous line
# receives the :update_attributes message with whatever params are
# submitted in the request.
Themengruppe.any_instance.should_receive(:update_attributes).with({ "title" => "MyString" })
put :update, {:id => themengruppe.to_param, :themengruppe => { "title" => "MyString" }}, valid_session
end
it "assigns the requested themengruppe as @themengruppe" do
themengruppe = Themengruppe.create! valid_attributes
put :update, {:id => themengruppe.to_param, :themengruppe => valid_attributes}, valid_session
assigns(:themengruppe).should eq(themengruppe)
end
it "redirects to the themengruppe" do
themengruppe = Themengruppe.create! valid_attributes
put :update, {:id => themengruppe.to_param, :themengruppe => valid_attributes}, valid_session
response.should redirect_to(themengruppe)
end
end
describe "with invalid params" do
it "assigns the themengruppe as @themengruppe" do
themengruppe = Themengruppe.create! valid_attributes
# Trigger the behavior that occurs when invalid params are submitted
Themengruppe.any_instance.stub(:save).and_return(false)
put :update, {:id => themengruppe.to_param, :themengruppe => { "title" => "invalid value" }}, valid_session
assigns(:themengruppe).should eq(themengruppe)
end
it "re-renders the 'edit' template" do
themengruppe = Themengruppe.create! valid_attributes
# Trigger the behavior that occurs when invalid params are submitted
Themengruppe.any_instance.stub(:save).and_return(false)
put :update, {:id => themengruppe.to_param, :themengruppe => { "title" => "invalid value" }}, valid_session
response.should render_template("edit")
end
end
end
describe "DELETE destroy" do
it "destroys the requested themengruppe" do
themengruppe = Themengruppe.create! valid_attributes
expect {
delete :destroy, {:id => themengruppe.to_param}, valid_session
}.to change(Themengruppe, :count).by(-1)
end
it "redirects to the themengruppen list" do
themengruppe = Themengruppe.create! valid_attributes
delete :destroy, {:id => themengruppe.to_param}, valid_session
response.should redirect_to(themengruppen_url)
end
end
end

View File

@@ -0,0 +1,7 @@
# Read about factories at https://github.com/thoughtbot/factory_girl
FactoryGirl.define do
factory :attachment do
name "MyString"
end
end

8
spec/factories/fragen.rb Normal file
View File

@@ -0,0 +1,8 @@
# Read about factories at https://github.com/thoughtbot/factory_girl
FactoryGirl.define do
factory :frage do
title "MyString"
text "MyText"
end
end

View File

@@ -0,0 +1,12 @@
# Read about factories at https://github.com/thoughtbot/factory_girl
FactoryGirl.define do
factory :studium do
zahl "066.506"
name "Automatisierung"
desc "TEST DESC"
typ "Master"
end
end

8
spec/factories/themen.rb Normal file
View File

@@ -0,0 +1,8 @@
# Read about factories at https://github.com/thoughtbot/factory_girl
FactoryGirl.define do
factory :thema do
title "MyString"
text "MyText"
end
end

View File

@@ -0,0 +1,8 @@
# Read about factories at https://github.com/thoughtbot/factory_girl
FactoryGirl.define do
factory :themagruppen, :class => 'Themengruppe' do
title "MyString"
text "MyText"
end
end

View File

@@ -0,0 +1,15 @@
require 'spec_helper'
# Specs in this file have access to a helper object that includes
# the AttachmentsHelper. For example:
#
# describe AttachmentsHelper do
# describe "string concat" do
# it "concats two strings with spaces" do
# expect(helper.concat_strings("this","that")).to eq("this that")
# end
# end
# end
describe AttachmentsHelper do
pending "add some examples to (or delete) #{__FILE__}"
end

View File

@@ -0,0 +1,15 @@
require 'spec_helper'
# Specs in this file have access to a helper object that includes
# the FragenHelper. For example:
#
# describe FragenHelper do
# describe "string concat" do
# it "concats two strings with spaces" do
# expect(helper.concat_strings("this","that")).to eq("this that")
# end
# end
# end
describe FragenHelper do
pending "add some examples to (or delete) #{__FILE__}"
end

View File

@@ -0,0 +1,15 @@
require 'spec_helper'
# Specs in this file have access to a helper object that includes
# the ThemenHelper. For example:
#
# describe ThemenHelper do
# describe "string concat" do
# it "concats two strings with spaces" do
# expect(helper.concat_strings("this","that")).to eq("this that")
# end
# end
# end
describe ThemenHelper do
pending "add some examples to (or delete) #{__FILE__}"
end

View File

@@ -0,0 +1,15 @@
require 'spec_helper'
# Specs in this file have access to a helper object that includes
# the ThemengruppenHelper. For example:
#
# describe ThemengruppenHelper do
# describe "string concat" do
# it "concats two strings with spaces" do
# expect(helper.concat_strings("this","that")).to eq("this that")
# end
# end
# end
describe ThemengruppenHelper do
pending "add some examples to (or delete) #{__FILE__}"
end

View File

@@ -0,0 +1,5 @@
require 'spec_helper'
describe Attachment do
pending "add some examples to (or delete) #{__FILE__}"
end

View File

@@ -0,0 +1,5 @@
require 'spec_helper'
describe Frage do
pending "add some examples to (or delete) #{__FILE__}"
end

View File

@@ -0,0 +1,5 @@
require 'spec_helper'
describe Thema do
pending "add some examples to (or delete) #{__FILE__}"
end

View File

@@ -0,0 +1,5 @@
require 'spec_helper'
describe Themengruppe do
pending "add some examples to (or delete) #{__FILE__}"
end

View File

@@ -0,0 +1,11 @@
require 'spec_helper'
describe "Attachments" do
describe "GET /attachments" do
it "works! (now write some real specs)" do
# Run the generator again with the --webrat flag if you want to use webrat methods/matchers
get attachments_path
response.status.should be(200)
end
end
end

View File

@@ -0,0 +1,11 @@
require 'spec_helper'
describe "Frages" do
describe "GET /fragen" do
it "works! (now write some real specs)" do
# Run the generator again with the --webrat flag if you want to use webrat methods/matchers
get fragen_path
response.status.should be(200)
end
end
end

View File

@@ -0,0 +1,11 @@
require 'spec_helper'
describe "Themas" do
describe "GET /themen" do
it "works! (now write some real specs)" do
# Run the generator again with the --webrat flag if you want to use webrat methods/matchers
get themen_path
response.status.should be(200)
end
end
end

View File

@@ -0,0 +1,11 @@
require 'spec_helper'
describe "Themengruppes" do
describe "GET /themengruppen" do
it "works! (now write some real specs)" do
# Run the generator again with the --webrat flag if you want to use webrat methods/matchers
get themengruppen_path
response.status.should be(200)
end
end
end

View File

@@ -0,0 +1,35 @@
require "spec_helper"
describe AttachmentsController do
describe "routing" do
it "routes to #index" do
get("/attachments").should route_to("attachments#index")
end
it "routes to #new" do
get("/attachments/new").should route_to("attachments#new")
end
it "routes to #show" do
get("/attachments/1").should route_to("attachments#show", :id => "1")
end
it "routes to #edit" do
get("/attachments/1/edit").should route_to("attachments#edit", :id => "1")
end
it "routes to #create" do
post("/attachments").should route_to("attachments#create")
end
it "routes to #update" do
put("/attachments/1").should route_to("attachments#update", :id => "1")
end
it "routes to #destroy" do
delete("/attachments/1").should route_to("attachments#destroy", :id => "1")
end
end
end

View File

@@ -0,0 +1,35 @@
require "spec_helper"
describe FragenController do
describe "routing" do
it "routes to #index" do
get("/fragen").should route_to("fragen#index")
end
it "routes to #new" do
get("/fragen/new").should route_to("fragen#new")
end
it "routes to #show" do
get("/fragen/1").should route_to("fragen#show", :id => "1")
end
it "routes to #edit" do
get("/fragen/1/edit").should route_to("fragen#edit", :id => "1")
end
it "routes to #create" do
post("/fragen").should route_to("fragen#create")
end
it "routes to #update" do
put("/fragen/1").should route_to("fragen#update", :id => "1")
end
it "routes to #destroy" do
delete("/fragen/1").should route_to("fragen#destroy", :id => "1")
end
end
end

View File

@@ -0,0 +1,35 @@
require "spec_helper"
describe ThemenController do
describe "routing" do
it "routes to #index" do
get("/themen").should route_to("themen#index")
end
it "routes to #new" do
get("/themen/new").should route_to("themen#new")
end
it "routes to #show" do
get("/themen/1").should route_to("themen#show", :id => "1")
end
it "routes to #edit" do
get("/themen/1/edit").should route_to("themen#edit", :id => "1")
end
it "routes to #create" do
post("/themen").should route_to("themen#create")
end
it "routes to #update" do
put("/themen/1").should route_to("themen#update", :id => "1")
end
it "routes to #destroy" do
delete("/themen/1").should route_to("themen#destroy", :id => "1")
end
end
end

View File

@@ -0,0 +1,35 @@
require "spec_helper"
describe ThemengruppenController do
describe "routing" do
it "routes to #index" do
get("/themengruppen").should route_to("themengruppen#index")
end
it "routes to #new" do
get("/themengruppen/new").should route_to("themengruppen#new")
end
it "routes to #show" do
get("/themengruppen/1").should route_to("themengruppen#show", :id => "1")
end
it "routes to #edit" do
get("/themengruppen/1/edit").should route_to("themengruppen#edit", :id => "1")
end
it "routes to #create" do
post("/themengruppen").should route_to("themengruppen#create")
end
it "routes to #update" do
put("/themengruppen/1").should route_to("themengruppen#update", :id => "1")
end
it "routes to #destroy" do
delete("/themengruppen/1").should route_to("themengruppen#destroy", :id => "1")
end
end
end

View File

@@ -0,0 +1,18 @@
require 'spec_helper'
describe "attachments/edit" do
before(:each) do
@attachment = assign(:attachment, stub_model(Attachment,
:name => "MyString"
))
end
it "renders the edit attachment form" do
render
# Run the generator again with the --webrat flag if you want to use webrat matchers
assert_select "form[action=?][method=?]", attachment_path(@attachment), "post" do
assert_select "input#attachment_name[name=?]", "attachment[name]"
end
end
end

View File

@@ -0,0 +1,20 @@
require 'spec_helper'
describe "attachments/index" do
before(:each) do
assign(:attachments, [
stub_model(Attachment,
:name => "Name"
),
stub_model(Attachment,
:name => "Name"
)
])
end
it "renders a list of attachments" do
render
# Run the generator again with the --webrat flag if you want to use webrat matchers
assert_select "tr>td", :text => "Name".to_s, :count => 2
end
end

View File

@@ -0,0 +1,18 @@
require 'spec_helper'
describe "attachments/new" do
before(:each) do
assign(:attachment, stub_model(Attachment,
:name => "MyString"
).as_new_record)
end
it "renders new attachment form" do
render
# Run the generator again with the --webrat flag if you want to use webrat matchers
assert_select "form[action=?][method=?]", attachments_path, "post" do
assert_select "input#attachment_name[name=?]", "attachment[name]"
end
end
end

View File

@@ -0,0 +1,15 @@
require 'spec_helper'
describe "attachments/show" do
before(:each) do
@attachment = assign(:attachment, stub_model(Attachment,
:name => "Name"
))
end
it "renders attributes in <p>" do
render
# Run the generator again with the --webrat flag if you want to use webrat matchers
rendered.should match(/Name/)
end
end

View File

@@ -0,0 +1,20 @@
require 'spec_helper'
describe "fragen/edit" do
before(:each) do
@frage = assign(:frage, stub_model(Frage,
:title => "MyString",
:text => "MyText"
))
end
it "renders the edit frage form" do
render
# Run the generator again with the --webrat flag if you want to use webrat matchers
assert_select "form[action=?][method=?]", frage_path(@frage), "post" do
assert_select "input#frage_title[name=?]", "frage[title]"
assert_select "textarea#frage_text[name=?]", "frage[text]"
end
end
end

Some files were not shown because too many files have changed in this diff Show More