Conflicts:
	app/views/layouts/menu.html.erb
	config/routes.rb
This commit is contained in:
HausdorffHimself
2013-08-13 19:05:26 +02:00
94 changed files with 2318 additions and 327 deletions

3
.gitignore vendored
View File

@@ -9,6 +9,8 @@
# Ignore the default SQLite database.
/db/*.sqlite3
/db/schema.rb
/db/structure.sql
/config/initializers/devise.rb
# Ignore all logfiles and tempfiles.
@@ -16,6 +18,7 @@
/tmp
/config/initializers/devise.rb
/app/doc/*
console
/server
/public/uploads/

View File

@@ -12,9 +12,9 @@ gem 'rails', '3.2.9'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'sass-rails', '~> 3.2'
gem 'coffee-rails', '~> 3.2.1'
gem 'bootstrap-sass','~> 2.2.0'
gem 'bootstrap-sass','~> 2.3.2.1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
gem 'therubyracer', :platforms => :ruby
gem 'uglifier', '>= 1.0.3'
@@ -75,3 +75,6 @@ group :development, :test do
gem 'factory_girl_rails'
gem 'rspec-rails'
end
gem "simple_calendar", "~> 0.1.9"
gem 'rmagick'

View File

@@ -35,7 +35,7 @@ GEM
activerecord (>= 3.0.0)
bcrypt-ruby (3.0.1)
bcrypt-ruby (3.0.1-x86-mingw32)
bootstrap-sass (2.2.2.0)
bootstrap-sass (2.3.2.1)
sass (~> 3.2)
builder (3.0.4)
cancan (1.6.9)
@@ -128,6 +128,7 @@ GEM
rdoc (3.12.1)
json (~> 1.4)
ref (1.0.2)
rmagick (2.13.2)
rolify (3.2.0)
rspec-core (2.14.4)
rspec-expectations (2.14.0)
@@ -145,6 +146,8 @@ GEM
railties (~> 3.2.0)
sass (>= 3.1.10)
tilt (~> 1.3)
simple_calendar (0.1.9)
rails (>= 3.0)
sprockets (2.2.2)
hike (~> 1.2)
multi_json (~> 1.0)
@@ -176,7 +179,7 @@ PLATFORMS
DEPENDENCIES
annotate (>= 2.5.0)
awesome_nested_set
bootstrap-sass (~> 2.2.0)
bootstrap-sass (~> 2.3.2.1)
cancan
carrierwave
coffee-rails (~> 3.2.1)
@@ -192,9 +195,11 @@ DEPENDENCIES
paper_trail (>= 2.7.0)
paperclip (~> 3.4.0)
rails (= 3.2.9)
rmagick
rolify
rspec-rails
sass-rails (~> 3.2.3)
sass-rails (~> 3.2)
simple_calendar (~> 0.1.9)
sqlite3
therubyracer
tinymce-rails (>= 3.5.8)

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

@@ -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,5 @@
@import "bootstrap/responsive";
@media (max-width: 979px){
.earlymax {
min-width: 100%;
}}

View File

@@ -0,0 +1,3 @@
// Place all the styles related to the calendars 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 calentries 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,15 @@
form.formtastic .stringish input {
width:90%;
}
form.formtastic select {
width:90%
}
form.formtastic textarea {
width:90%;
height:20em;
}
form.formtastic .input label.control-label {
font-weight:bold;
font-size:125%;
}

View File

@@ -1,3 +1,27 @@
// Place all the styles related to the lvas controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
div.lva-semester {
border: solid;
border-width: 1px;
margin: 1px;
padding: 5px;
border-color: green;
border-radius: 5px;
}
div.lva-sidebar {
border:solid;
border-width: 1px;
margin: 2px;
padding:5px;
border-radius:5px;
}
div.lva-beispiele {
border:solid;
border-width: 1px;
margin: 2px;
padding:5px;
border-radius:5px;
border-color: green;
}

View File

@@ -1,3 +1,18 @@
// Place all the styles related to the studia controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
div.verwalten-block {
border-width: 1px;
border-style: solid;
padding: 5px;
border-radius:10px;
margin: 2px;
}
div.studien-semester {
border-width: 1px;
border-style: solid;
padding: 5px;
border-radius:10px;
border-color: blue;
margin: 2px;
}

View File

@@ -26,7 +26,8 @@ class BeispieleController < ApplicationController
# GET /beispiele/new.json
def new
@beispiel = Beispiel.new
@beispiel.lva_id = params[:lva_id]
@beispiel.lva = Lva.find(params[:lva_id])
respond_to do |format|
format.html # new.html.erb
format.json { render json: @beispiel }
@@ -41,8 +42,9 @@ class BeispieleController < ApplicationController
# POST /beispiele
# POST /beispiele.json
def create
lvaid=params[:lva_id]
params.delete(:lva_id)
@beispiel = Beispiel.new(params[:beispiel])
respond_to do |format|
if @beispiel.save
format.html { redirect_to @beispiel, notice: 'Beispiel was successfully created.' }

View File

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

View File

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

View File

@@ -16,14 +16,6 @@ class LvasController < ApplicationController
@toolbar_elements<<{:hicon=>'icon-plus-sign', :icon=>:plus, :text => "Neues Beispiel", :path=> new_beispiel_path(:lva_id =>@lva.id)}
@toolbar_elements<<{:hicon=>'icon-pencil', :icon=>:pencil,:text =>I18n.t('common.edit'),:path => edit_lva_path(@lva)}
@topbar_elements =[{:hicon=>'icon-list', :text=>I18n.t("lva.list"), :path=>lvas_path}]
for m in @lva.modul
@topbar_elements << {:newline=>true}
@topbar_elements << {:text=> '<b>' + m.name + '</b>', :path=>modul_path(m)}
for mg in m.modulgruppen
@topbar_elements << {:text => mg.studium.name + ' (' + mg.name + ')', :path=>studium_path(mg.studium)}
end
end
end
# GET /lvas/new

View File

@@ -51,15 +51,10 @@ class ModulgruppenController < ApplicationController
def create
@modulgruppe = Modulgruppe.new(params[:modulgruppe])
if !params[:studium_id].nil?
@studium=Studium.find_by_id(params[:studium_id])
else
@studium=Studium.find_by_id(params[:modulgruppe][:studium_id])
end
respond_to do |format|
if @modulgruppe.save
format.html { redirect_to @studium, notice: 'Modulgruppe was successfully created.' }
format.html { redirect_to @modulgruppe.studium, notice: 'Modulgruppe was successfully created.' }
else
format.html { render action: "new" }

View File

@@ -16,6 +16,7 @@ class SemestersController < ApplicationController
def edit
@semester = Semester.find(params[:id])
@studium = @semester.studium
end
def create
@@ -33,7 +34,7 @@ class SemestersController < ApplicationController
def update
@semester = Semester.find(params[:id])
@studium= @semester.studium
respond_to do |format|
if @semester.update_attributes(params[:semester])
format.html { redirect_to @semester, notice: 'Semester was successfully updated.' }

View File

@@ -1,6 +1,6 @@
class StudienController < ApplicationController
before_filter {@toolbar_elements =[]}
# before_filter :authorize, :only => :verwalten
def index
@studien = Studium.all
@@ -39,7 +39,7 @@ class StudienController < ApplicationController
@toolbar_modulgruppen =[ {:hicon=>'icon-plus-sign', :text=> I18n.t('modulgruppe.new'), :path=>new_studium_modulgruppe_path(@studium)},
{:hicon=>'icon-list', :text => I18n.t('modulgruppe.list'), :path=>modulgruppen_path}]
if params[:ansicht] == 'semesteransicht'
if params[:ansicht] != 'modulgruppenansicht'
@text = 'Zu Modulansicht wechseln'
@flip = 'modulgruppenansicht'
render 'semesteransicht'
@@ -90,7 +90,147 @@ class StudienController < ApplicationController
@studium.destroy
redirect_to studien_url
end
def verwalten
@new_params={:std_verw=>params[:std_verw], :mg_verw=>params[:mg_verw], :m_verw=>params[:m_verw], :lva_verw=>params[:lva_verw], :b_verw=>params[:b_verw]}
if @new_params.values.compact.empty?
@studien=Studium.all
@modulgruppen=Modulgruppe.all
@module=Modul.all
@lvas=Lva.all
@beispiele=Beispiel.all
else
if !@new_params[:std_verw].nil?
@studien = [Studium.find(@new_params[:std_verw])]
else
@studien = Studium.all
end
if !@new_params[:mg_verw].nil?
@modulgruppen = [Modulgruppe.find(@new_params[:mg_verw])]
temp = @modulgruppen.map{|x| x.studium}.flatten.uniq # Force Studien
@studien=@studien.select{|k| temp.include?(k)}
else
@modulgruppen = Modulgruppe.all
temp = @studien.map{|x| x.modulgruppen}.flatten.uniq # Studien forcen Modulgruppen
@modulgruppen = @modulgruppen.select{|k| temp.include?(k)}
end
if !@new_params[:m_verw].nil?
@module = [Modul.find(@new_params[:m_verw])]
temp = @module.map{|x| x.modulgruppen}.flatten.uniq # Force Modulgruppen
@modulgruppen = @modulgruppen.select{|k| temp.include?(k)}
temp = @modulgruppen.map{|x| x.studium}.flatten.uniq # Force Studien
@studien=@studien.select{|k| temp.include?(k)}
else
@module = Modul.all
temp = @modulgruppen.map{|x| x.moduls}.flatten.uniq
@module=@module.select{|k| temp.include?(k)}
end
if !@new_params[:lva_verw].nil?
@lvas = [Lva.find(@new_params[:lva_verw])]
temp = @lvas.map{|x| x.modul}.flatten.uniq
@module=@module.select{|k| temp.include?(k)}
temp = @module.map{|x| x.modulgruppen}.flatten.uniq # Force Modulgruppen
@modulgruppen = @modulgruppen.select{|k| temp.include?(k)}
temp = @modulgruppen.map{|x| x.studium}.flatten.uniq # Force Studien
@studien=@studien.select{|k| temp.include?(k)}
else
@lvas = Lva.all
temp = @module.map{|x| x.lvas}.flatten.uniq #Force Module
@lvas=@lvas.select{|k| temp.include?(k)}
end
if !@new_params[:b_verw].nil?
@beispiele = [Beispiel.find(@new_params[:b_verw])]
temp = @lvas.map{|x| x.beispiele}.flatten.uniq #Force Force Lvas
@lvas=@lvas.select{|k| temp.include?(k)}
temp = @module.map{|x| x.lvas}.flatten.uniq #Force Module
@module=@module.select{|k| temp.include?(k)}
temp = @module.map{|x| x.modulgruppen}.flatten.uniq # Force Modulgruppen
@modulgruppen = @modulgruppen.select{|k| temp.include?(k)}
temp = @modulgruppen.map{|x| x.studium}.flatten.uniq # Force Studien
@studien=@studien.select{|k| temp.include?(k)}
else
@beispiele = Beispiel.all
temp = @lvas.map{|x| x.beispiele}.flatten.uniq # Force beispiel
@beispiele=@beispiele.select{|k| temp.include?(k)}
end
end
@messages = []
for s in @studien
if s.valid?
@messages << s.name + ' hat keine Modulgruppe' if s.modulgruppen.count == 0
else
@messages << '<font color="red"><b>'+s.name + ': '
@messages << s.errors.full_messages
@messages << '</font></b>'
end
end
for mg in @modulgruppen
if mg.valid?
@messages << mg.name + ' hat kein Modul' if mg.moduls.count == 0
else
@messages << '<font color="red"><b>'+mg.name + ': '
@messages << mg.errors.full_messages
@messages << '</font></b>'
end
end
for m in @module
if m.valid?
@messages << m.name.to_s + ' hat keine Modulgruppe' if m.modulgruppen.count == 0
@messages << m.name.to_s + ' hat keine Lvas' if m.lvas.count == 0
else
@messages << '<font color="red"><b>'+m.name.to_s + ': '
@messages << m.errors.full_messages
@messages << '</font></b>'
end
end
for lva in @lvas
if lva.valid?
@messages << lva.name + ' hat keine Module' if lva.modul.count == 0
for s in @studien
stu_sem = s.semester.map{|l| l.lvas}.flatten.uniq.index(lva)
stu_mod = s.modulgruppen.map{|m| m.moduls}.flatten.map{|l| l.lvas}.flatten.uniq.index(lva)
if (stu_sem.nil? && !stu_mod.nil?)
@messages << lva.name + ' erscheint nicht in der Semesteransicht von ' +s.name + ' aber in der Modulgruppenansicht'
end
if (!stu_sem.nil? && stu_mod.nil?)
@messages << lva.name + ' erscheint in der Semesteransicht von ' +s.name + ' aber nicht in der Modulgruppenansicht'
end
end
else
@messages << '<font color="red"><b>'+lva.name + ': '
@messages << lva.errors.full_messages
@messages << '</font></b>'
end
end
for b in @beispiele
if b.valid?
@messages << b.name + ' hat keine Lva' if b.lva.nil?
else
@messages << '<font color="red"><b>'+b.name + ': '
@messages << b.errors.full_messages
@messages << '</font></b>'
end
end
render 'studien/verwalten'
end
def default_url_options
{ansicht: params[:ansicht]}.merge(super)
{:ansicht=> params[:ansicht],
:std_verw=> params[:std_verw],
:mg_verw=> params[:mg_verw],
:m_verw=>params[:m_verw],
:lva_verw=>params[:lva_verw],
:b_verw=>params[:b_verw]}.merge(super)
end
end

View File

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

View File

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

View File

@@ -0,0 +1,7 @@
class DateStringInput < FormtasticBootstrap::Inputs::StringInput
def input_html_options
value = (@object.send(method.to_sym))
super.merge(:class => "datetext", :onclick =>"beep", :value=>I18n.l((value.is_a?(Time)||value.is_a?(Date)||value.is_a?(DateTime)) ? value : Time.now))
end
end

5
app/models/calendar.rb Normal file
View File

@@ -0,0 +1,5 @@
class Calendar < ActiveRecord::Base
attr_accessible :name, :public, :picture
has_and_belongs_to_many :calentries
mount_uploader :picture, PictureUploader
end

20
app/models/calentry.rb Normal file
View File

@@ -0,0 +1,20 @@
class Calentry < ActiveRecord::Base
attr_accessible :ende, :start, :summary, :typ,:calendar_ids
has_and_belongs_to_many :calendars
validates :start, :presence => true
validates :typ, :presence => true
validate do |entry|
if entry.ende.nil?
errors.add(:ende, "Es muss ein Endzeitpunkt vorhanden sein")
end
end
def start_time
start
end
def start1
start.to_date
end
def name
summary
end
end

View File

@@ -16,8 +16,9 @@
#
class Lva < ActiveRecord::Base
ERLAUBTE_TYPEN = ['VO', 'UE', 'VU', 'LU', 'SE', 'andere'];
has_paper_trail # Versionsverfolgung
attr_accessible :desc, :ects, :lvanr, :name, :stunden, :modul_ids, :semester_ids
attr_accessible :desc, :ects, :lvanr, :name, :stunden, :modul_ids, :semester_ids, :pruefungsinformation, :lernaufwand, :typ
has_and_belongs_to_many :modul # Gehört zu einem Modul
has_and_belongs_to_many :semester
#Gehört zu einem Semester( derzeit nicht implementiert)
@@ -27,8 +28,8 @@ class Lva < ActiveRecord::Base
validates :lvanr,:format=>{ :with => /^[0-9][0-9][0-9]\.[0-9][0-9][0-9]$/}, :presence=>true, :uniqueness=>true # , :uniqueness=>true # LVA-Nummer muss das Format 000.000 besitzen (uniqueness?) oder 000 für nicht
validates_presence_of :ects # ECTS vorhanden?
validates :name, :presence=>true
validates :name, :uniqueness=>true# Name Eingetragen?
validates :name, :presence=>true, :uniqueness=>true# Name Eingetragen?
validates :typ, :presence=>true, :inclusion=> ERLAUBTE_TYPEN
validates_presence_of :stunden # Stunden Eingetragen?
validates_presence_of :modul # Zugehöriges Modul eingetragen? (zumindest eines)
def add_semesters

View File

@@ -13,7 +13,7 @@
#
class Modulgruppe < ActiveRecord::Base
attr_accessible :name, :phase, :typ,:desc, :studium_id
attr_accessible :name, :phase, :typ,:desc, :studium_id, :modul_ids
belongs_to :studium, :foreign_key => "studium_id"
has_and_belongs_to_many :moduls

View File

@@ -12,14 +12,17 @@
# created_at :datetime not null
# updated_at :datetime not null
class Studium < ActiveRecord::Base
attr_accessible :desc, :name, :typ, :zahl
attr_accessible :desc, :name,:abkuerzung, :typ, :zahl, :semester
has_many :modulgruppen, inverse_of: :studium, :class_name => "Modulgruppe", :dependent => :destroy
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(33|66)[0-9]{3}$/}, :uniqueness => true
translates :desc,:shortdesc, :versioning =>true,:fallbacks_for_empty_translations => true
def title_context
return self.abkuerzung.to_s.strip.empty? ? self.name : self.abkuerzung
end
def batch_add_semester
# Semester automatisch zu Studien hinzufügen

View File

@@ -0,0 +1,51 @@
# encoding: utf-8
class PictureUploader < CarrierWave::Uploader::Base
# Include RMagick or MiniMagick support:
include CarrierWave::RMagick
# include CarrierWave::MiniMagick
# Choose what kind of storage to use for this uploader:
storage :file
# storage :fog
# Override the directory where uploaded files will be stored.
# This is a sensible default for uploaders that are meant to be mounted:
def store_dir
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end
# Provide a default URL as a default if there hasn't been a file uploaded:
# def default_url
# # For Rails 3.1+ asset pipeline compatibility:
# # ActionController::Base.helpers.asset_path("fallback/" + [version_name, "default.png"].compact.join('_'))
#
# "/images/fallback/" + [version_name, "default.png"].compact.join('_')
# end
# Process files as they are uploaded:
# process :scale => [200, 300]
#
# def scale(width, height)
# # do something
# end
# Create different versions of your uploaded files:
version :thumb do
process :resize_to_fill => [64, 64]
end
# Add a white list of extensions which are allowed to be uploaded.
# For images you might use something like this:
def extension_white_list
%w(jpg jpeg gif png)
end
# Override the filename of the uploaded files:
# Avoid using model.id or version_name here, see uploader/store.rb for details.
# def filename
# "something.jpg" if original_filename
# end
end

View File

@@ -1,4 +1,4 @@
<div class="span4">
<div class="lva-beispiele">
<h4><%=link_to beispiel.name, beispiel.beispieldatei.url%></h4>
<%= beispiel.desc %>
</div>

View File

@@ -1,13 +1,25 @@
<%= semantic_form_for @beispiel, :html => { :multipart => true } do |f| %>
<%= f.inputs do %>
<%= f.input :name %>
<%= f.input :desc %>
<%= f.file_field :beispieldatei %>
<%= f.hidden_field :beispieldatei_cache %>
<%= f.input :lva, :as=>:select, :collection => Lva.all%>
<%= f.file_field :beispieldatei, :wrapper_html=>{:class=>"span4"}%>
<div class="row-fluid">
<%= f.input :name, :wrapper_html=>{:class=>'span6'} %>
<%= f.input :lva, :as=>:select, :collection => Lva.all, :wrapper_html=>{:class=>'span6'}%>
</div>
<div class="row-fluid">
<%= f.input :desc %>
</div>
<% end %>
<%= f.actions do %>
<%= f.action :submit, :as => :input %>
<% end %>
<% end %>

View File

@@ -10,7 +10,9 @@
<%= @beispiel.desc %>
<%= @beispiel.beispieldatei.url %>
</p>
<p>
<%= @beispiel.lva.name %>
</p>
<%= link_to 'Edit', edit_beispiel_path(@beispiel) %> |
<%= link_to 'Back', beispiele_path %>

View File

@@ -0,0 +1,11 @@
<%= semantic_form_for @calendar do |f| %>
<%= f.inputs do %>
<%= f.input :name %>
<%= f.input :public %>
<%= f.input :picture, :as => :file %>
<% end %>
<%= f.actions do %>
<%= f.action :submit, :as => :input %>
<% end %>
<% end %>

View File

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

View File

@@ -0,0 +1,14 @@
<h1>Listing calendars</h1>
<% @calendars.each do |calendar| %>
<div class="media">
<a class="pull-left" href="#">
<img class="media-object img-circle" src="<%= calendar.picture.thumb.url %>"/>
</a>
<div class="media-body">
<h4><%= link_to calendar.name, calendar %></h4>
</div>
</div>
<% end %>
<%= link_to 'New Calendar', new_calendar_path %>

View File

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

View File

@@ -0,0 +1,30 @@
<div class="container-fluid">
<div class="row-fluid">
<p id="notice"><%= notice %></p>
<h1>
<%= '<i class="icon-globe"></i>'.html_safe unless !@calendar.public%>
<%= @calendar.name %>
</h1>
<div class="row-fluid">
<ul class="list-group">
<% @calendar.calentries.each do |entry| %>
<li class="list-group-item">
<%= link_to entry.summary+ " - " + I18n.l(entry.start1), entry %>
</li>
<% end %>
</ul>
</div>
<div class="row-fluid">
<%= calendar @calendar.calentries do |entry| %>
<div><%= link_to entry.name, entry %></div>
<% end %>
</div>
<div class="row-fluid">
<div class="btn-group">
<%= link_to 'New Entry', new_calentry_path, {:class=>"btn"} %>
<%= link_to 'Edit', edit_calendar_path(@calendar), {:class=>"btn"} %>
<%= link_to 'Back', calendars_path, {:class=>"btn"} %>
</div>
</div>
</div>

View File

@@ -0,0 +1,3 @@
<% @calendar.calentries.each do |entry| %>
<%= render entry %>
<% end %>

View File

@@ -0,0 +1,5 @@
<%= calentry.start %>
<%= calentry.ende %>
<%= calentry.summary %>
<%= calentry.typ %>

View File

@@ -0,0 +1,34 @@
<div class="container-fluid">
<%= semantic_form_for @calentry do |f| %>
<%= f.inputs do %>
<div class="row-fluid">
<div class="span6">
<%= f.input :start , :as => :date_string %>
</div>
<div class="span6">
<%= f.input :ende , :as => :date_string %>
</div>
</div>
<div class="row-fluid">
<div class="span12">
<%= f.input :summary %>
</div>
</div>
<div class="row-fluid">
<div class="span6">
<%= f.input :calendars, :as=> :radio %>
</div>
<div class="span6">
<%= f.input :typ %>
</div>
</div>
<% end %>
<div class="row-fluid">
<div class="span12">
<%= f.actions do %>
<%= f.action :submit, :as => :input %>
<% end %>
</div>
</div>
<% end %>
</div>

View File

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

View File

@@ -0,0 +1,29 @@
<h1>Listing calentries</h1>
<table>
<tr>
<th>Start</th>
<th>Ende</th>
<th>Summary</th>
<th>Typ</th>
<th></th>
<th></th>
<th></th>
</tr>
<% @calentries.each do |calentry| %>
<tr>
<td><%= calentry.start %></td>
<td><%= calentry.ende %></td>
<td><%= calentry.summary %></td>
<td><%= calentry.typ %></td>
<td><%= link_to 'Show', calentry %></td>
<td><%= link_to 'Edit', edit_calentry_path(calentry) %></td>
<td><%= link_to 'Destroy', calentry, method: :delete, data: { confirm: 'Are you sure?' } %></td>
</tr>
<% end %>
</table>
<br />
<%= link_to 'New Calentry', new_calentry_path %>

View File

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

View File

@@ -0,0 +1,25 @@
<p id="notice"><%= notice %></p>
<div class="container-fluid">
<div class="row-fluid">
<div class="span12">
<b>
<%= @calentry.summary %>
</b>
</div>
</div>
<div class="row-fluid">
<div class="span9">
<%= I18n.l @calentry.start %>
<%= " bis " unless @calentry.ende.nil? %>
<%= I18n.l @calentry.ende %>
</div>
<div class="span3">
<%= @calentry.typ %>
</div></div>
<div class="row-fluid">
<div class="span12">
<%= link_to 'Edit', edit_calentry_path(@calentry) %> |
<%= link_to 'Back', calentries_path %>
</div></div></div>

View File

@@ -0,0 +1,25 @@
<p id="notice"><%= notice %></p>
<p>
<b>Start:</b>
<%= @calentry.start %>
</p>
<p>
<b>Ende:</b>
<%= @calentry.ende %>
</p>
<p>
<b>Summary:</b>
<%= @calentry.summary %>
</p>
<p>
<b>Typ:</b>
<%= @calentry.typ %>
</p>
<%= link_to 'Edit', edit_calentry_path(@calentry) %> |
<%= link_to 'Back', calentries_path %>

View File

@@ -1,3 +1,21 @@
<h1><%= t 'home.willkommen' %></h1>
<div class="alert alert-info">
<h2>Alpha Test</h2>
<p>Die Webseite befindet sich derzeit in einem Entsicklungsstadium,
volle Funktionsfähigkeit ist noch nicht erreicht. Bitte Featurerequests und
Fehlermeldungen auf GitHub melden.
</p>
<p>
<%= link_to "Issues", "http://www.github.com/fetsite/fetsite/issues" %>
</p>
<p>
Folgene Features sind schon soweit, dass Bugreports sinnvoll sind:
<ul>
<li>Studien/Beispielsammlung</li>
</ul>
alle anderen sind nur zur Voransicht. Bezüglich Design und Steuerung sind Vorschläge erwünscht.
</p>
<p><%= link_to "Steuerelemente und Komponenten", "http://getbootstrap.com/2.3.2/index.html" %></p>
</div>
<p><%= t 'home.hallobeiderfet' %></p>
<%= link_to "Entwicklungsstatus" , home_dev_path %>

View File

@@ -1,6 +1,8 @@
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Fetsite</title>
<%= stylesheet_link_tag "application", :media => "all" %>
@@ -15,9 +17,9 @@
</div>
<div class="container-fluid">
<div class="row-fluid">
<div class="span2">
<div class="span2 earlymax">
<div id="menudiv"><%= render :template => 'layouts/menu' %></div>
</div> <div class="span10">
</div> <div class="span10 earlymax">
<%= yield %>
</div>

View File

@@ -1,14 +1,20 @@
<%= t 'home.mtitle'%>
<div class="navbar">
<div class="navbar-inner">
<div class="container-fluid">
<a class="brand" href="#"><%= t 'home.mtitle'%></a>
<a class ="btn btn-navbar" data-toggle="collapse" data-parent="#menudiv" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<div class="nav-collapse collapse">
<ul class="nav nav-pills nav-stacked">
<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' ),themengruppen_path %></li>
<li><%= link_to I18n.t(:studien,:scope=>'home' ), studien_path %>
</li>
<li><%= link_to "wiki intern", page_path(1) %>
</li>
</ul>
<li><%= link_to I18n.t(:studien,:scope=>'home' ), studien_path %></li>
<li><%= link_to "Kalender", calendars_path %></li>
<% if user_signed_in? %>
<li>Logged in as : <%= current_user.email %>
<%= link_to('Logout', destroy_user_session_path, :method => :delete) %>
@@ -18,10 +24,18 @@
<%= link_to('Login', new_user_session_path) %>
</li>
<% end %>
<%if I18n.locale == :en %>
<li><%if I18n.locale == :en %>
<%= link_to "Deutsch" ,switch_locale_url(:de)%>
<% elsif I18n.locale == :de %>
<%= link_to "English" ,switch_locale_url(:en)%>
<%end %>
<%= link_to 'Admin' , config_url
%>
</li>
<li>
<%= link_to 'Admin' , config_path%>
</li>
</ul>
</div>
</div>
</div>
</div>

View File

@@ -1,14 +1,48 @@
<%= semantic_form_for @lva do |f| %>
<%= f.inputs do %>
<%= f.input :semester, :collection=>Semester.all.sort_by{|n| [:name]}%>
<%= f.input :modul %>
<%= f.input :name %>
<%= f.input :ects %>
<%= f.input :stunden %>
<%= f.input :desc %>
<%= f.input :lvanr %>
<% end %>
<%= semantic_form_for @lva do |f| %>
<div class="row-fluid">
<%= f.inputs do %>
<div class="span9">
<div class="row-fluid">
<div class="span9">
<div class="form-group">
<div class="row-fluid">
<%= f.input :typ, :as=>:select, :include_blank=>false, :collection=>Lva::ERLAUBTE_TYPEN, :wrapper_html=>{:class=>'span2'}%>
<%= f.input :name, :wrapper_html=>{:class=>'span10'}%>
</div>
<div class="row-fluid">
<div class="span7"%>
<div class="row-fluid">
<%= f.input :lvanr, :wrapper_html=>{:class=>'span4'}%>
<%= f.input :ects, :wrapper_html=>{:class=>'span4'} %>
<%= f.input :stunden, :wrapper_html=>{:class=>'span4'} %>
</div>
</div>
</div>
</div>
<div class="form-group">
<div class="row-fluid">
<%= f.input :desc %>
<%= f.input :pruefungsinformation %>
<%= f.input :lernaufwand %>
</div></div>
</div>
<div class="span3">
<h1> BILD </h1>
<%= f.input :modul, :as=>:check_boxes%>
</div>
</div>
</div>
<div class="span3">
<%= f.input :semester, :as=>:check_boxes%>
</div>
<% end %>
<%= f.actions do %>
<%= f.action :submit, :as => :input %>
<% end %>

View File

@@ -1,10 +1,9 @@
<p class="lva_semester">
<div class="lva-semester">
<b><%= link_to lva.name, lva_path(lva)%></b><br>
Module: /<% lva.modul.each do |m| %> <%= link_to m.name + ' / ', modul_path(m) unless m.modulgruppen.map{|x| x.studium}.index(@studium).nil? && !@studium.nil? %><% end %>
<br>
<%="LVa-Nr " + lva.lvanr.to_s %>
<%= lva.ects %> ECTS / <%= lva.stunden %> Std <% " / " + lva.beispiele.count.to_s + " Beispiele"%> <br>
<%= link_to "Edit", edit_lva_path(lva) %> | <%= link_to "Beispiel hinzufügen", new_beispiel_path(:lva_id=>lva.id) %>
</p class="lva_semester">
<% #toolbar_html(@toolbar_elements) %>
</div class="lva-semester">

View File

@@ -1,36 +1,60 @@
<div class="container-fluid">
<%= render 'layouts/topbar'%>
<%= render 'studien/tabs'%>
<p id="notice"><%= notice %></p>
<p>
<h2><%= @lva.lvanr %><%= @lva.name %> <%= @lva.ects %> ECTS/ <%= @lva.stunden %> Std</h2>
</p>
<div class="row-fluid">
<div class="span8">
<h1><%=@lva.typ.to_s + ' ' + @lva.name %></h1>
<h2>Prüfungsinformation</h2>
<div class="lva-beschreibung">
<%= @lva.pruefungsinformation %>
</div>
<h2>Lernaufwand</h2>
<div class="lva-beschreibung">
<%= @lva.lernaufwand %>
</div>
<h2>Beschreibung</h2>
<div class="lva-beschreibung">
<%= @lva.desc %>
</div>
<div class="row-fluid">
<h2>Beispiele</h2>
<p><h4>Beschreibung</h4>
<%= @lva.desc %>
<%= link_to "Beispiel neu" , new_beispiel_path(:lva_id=>@lva.id) %>
</p>
<div class="row-fluid">
<h4>Beispiele</h4>
<ul>
<% @lva.beispiele.each do |b|%>
<%= render b%>
<% end %>
</div>
<h4>Module</h4>
</div>
<div class="span4">
<div class="lva-sidebar">
<ul>
<li><b>LVA-Nummer:</b> <%=@lva.lvanr %></li>
<li><b>ECTS:</b> <%=@lva.ects %></li>
<li><b>Stunden:</b> <%=@lva.ects %></li>
</ul>
<h2>Module</h2>
<ul>
<% @lva.modul.each do |modul| %>
<li><b><%= link_to modul.name , modul_path(modul)%></b>
<ul>
<% modul.modulgruppen.each do |g| %>
<li><%= link_to g.studium.name , studium_semesteransicht_path(g.studium)%> (<%=link_to g.name, modulgruppe_path(g)%>)</li>
<li><%= link_to g.studium.title_context , studium_path(g.studium)%> (<%=link_to g.name, modulgruppe_path(g)%>)</li>
<% end %>
</ul>
</li>
<% end %>
</ul>
</div>
</div>
</div>
<%= render 'layouts/pretty_toolbar' %>
</div>

View File

@@ -1,13 +1,29 @@
<%= semantic_form_for @modulgruppe do |f| %>
<%= f.inputs do %>
<%= f.input :studium_id, :as =>:select, :collection => Studium.all %>
<%= f.input :typ ,:as => :radio, :collection=>["Pflicht","Vertiefungspflicht","Wahl"]%>
<%= f.input :phase,:as => :radio,:collection=>1..3 %>
<%= f.input :name %>
<%= f.input :desc,:input_html=>{:rows=> 3 }%>
<% end %>
<div class="span8">
<div class="row-fluid">
<%= f.input :name, :wrapper_html=>{:class=>"span12"}%>
</div>
<div class="row-fluid">
<%= f.input :studium_id, :as =>:select, :collection => Studium.all, :wrapper_html=>{:class=>"span4"} %>
<%= f.input :typ, :collection=>["Pflicht","Vertiefungspflicht","Wahl"], :wrapper_html=>{:class=>"span4"}%>
<%= f.input :phase, :as=>:select, :collection=>1..3, :wrapper_html=>{:class=>"span4"} %>
</div>
<div class="row-fluid">
<%= f.input :desc %>
</div>
</div>
<div class="span4">
<%= f.input :moduls, :as=>:check_boxes %>
</div>
<% end %>
<%= f.actions do %>
<%= f.action :submit, :as => :input %>
<% end %>
<% end %>

View File

@@ -0,0 +1 @@
<b><%=link_to modulgruppe.name, modulgruppe %></b> <%= ' ( ' + modulgruppe.studium.title_context + ')' unless modulgruppe.studium.nil? %>

View File

@@ -1,11 +1,4 @@
<ul class="breadcrumb">
<li>
<%= link_to @modulgruppe.studium.name, studium_path(@modulgruppe.studium) %> <span class="divider">/</span></li>
</ul><p id="notice"><%= notice %></p>
<div class ="modulgruppe_phase_<%= @modulgruppe.phase %>">
<h1>
<%= @modulgruppe.name %>
</h1>
@@ -19,9 +12,8 @@
<% @modulgruppe.moduls.each do |modul| %>
<%= render modul%>
<%= render 'moduls/kurz', :modul=>modul%>
<% end %>
</div>
<span class="label"><%= I18n.t("common.actions")%></span>

View File

@@ -1,15 +1,30 @@
<div class="container-fluid">
<%= semantic_form_for @modul do |f| %>
<%= f.inputs do %>
<% # f.input :modulgruppen,:as => :select, :collection => Hash[Modulgruppe.all.map{|m| [m.studium.name + " " + m.name,m.id]}] %>
<%= f.input :modulgruppen %>
<div class="row-fluid">
<div class="span9">
<%= f.input :name ,:hint=>true%>
<div class="row-fluid">
<div class="span8">
<%= f.input :desc, :as=>:tinymce_text %>
</div>
<div class="span4">
<%= f.input :depend %>
</div>
</div>
</div>
<div class="span3">
<%= f.input :modulgruppen,:as => :check_boxes, :collection => Hash[Modulgruppe.all.map{|m| [m.studium.name + " " + m.name,m.id]}.sort] %>
</div>
</div>
<% end %>
<%= f.actions do %>
<%= f.action :submit, :as => :input %>
<% end %>
<% end %>
</div>
<%= tinymce %>

View File

@@ -1,10 +1,6 @@
<div style="border: solid 1px; padding:2px;margin-top:5px;"><p>
<b><% if !modul.name.nil? %><%= link_to "Modul "+ modul.name , modul_path(modul) %> <%end%></b>
</p>
<p >
<%= raw(modul.desc) %>
</p>
<% link_to '<i class="icon-pencil"></i>'.html_safe+I18n.t("common.edit"), edit_modul_path(modul) %>
</div>

View File

@@ -1,26 +1,28 @@
<div style="border: solid 1px; padding:2px"><p>
<b><%=
if modul.name.nil?
name=""
else
name=modul.name
end
link_to "Modul "+name , modul_path(modul) %> </b>
</p>
<h1><%=@modul.name %></h1>
<div class="row-fluid">
<div class="span8">
<h2>Beschreibung </h2>
<p>
<%= raw(modul.desc) %>
<%= raw(@modul.desc) %>
</p>
LVAs:
<ul>
<% modul.lvas.each do |lv| %>
<li>
<%= link_to lv.name.to_s, lva_path(lv.id) %>
</li>
</div>
<div class="span4">
<h2>Modulgruppen</h2>
<% @modul.modulgruppen.each do |mg| %>
<%= render 'modulgruppen/kurz', :modulgruppe=>mg %><br>
<% end %>
</ul>
<h2>Lvas</h2>
<% @modul.lvas.each_slice(3) do |row| %>
<% row.each do |lv| %>
<%= render 'lvas/lva_semester', :lva=>lv%>
<% end %>
<% # @toolbar_elements << {:icon=>:pencil,:text=>I18n.t("common.edit"),:path=> edit_modul_path(modul)} %>
</div>
<% end %>
</div></div>

View File

@@ -1,8 +1,6 @@
<%= render 'layouts/topbar'%>
<%= render 'studien/tabs'%>
<p id="notice"><%= notice %></p>
<%= render @modul %>
<%= render 'layouts/pretty_toolbar' %>
<% # link_to 'Add LVA', %>
<% # link_to '<i class="icon-pencil"></i>'.html_safe+ I18n.t("common.edit") , edit_modul_path(@modul) %>
<% # link_to "Loeschen", [@modul],:method=>:delete ,:data => {:confirm =>"Are you sure" } %>

View File

@@ -1,12 +1,11 @@
<%= semantic_form_for @semester do |f| %>
<%= f.inputs do %>
<%= f.input :name %>
<%= f.input :nummer %>
<%= f.input :ssws %>
<%= f.input :lvas %>
<%= f.input :lvas, :as=>:check_boxes%>
<% end %>
<%= f.actions do %>
<%= f.action :submit, :as => :input %>
<% end %>
<% end %>
<%= link_to 'Zurück',@studium, :class=>"btn"%>
x

View File

@@ -1,6 +1,3 @@
<h1>Editing semester</h1>
<h1><%=@semester.name%></h1>
<%= render 'form' %>
<%= link_to 'Show', @semester %> |
<%= link_to 'Back', semesters_path %>

View File

@@ -1,13 +1,25 @@
<div class="container-fluid">
<%= tinymce_assets %>
<%= semantic_form_for @studium do |f| %>
<%= f.inputs do %>
<%= f.input :zahl %>
<%= f.input :name,:append=>"NAME" %>
<%= f.input :desc, :as=>:tinymce_text %>
<%= f.input :typ, :as=>:radio, :collection=>["Bachelor","Master"]%>
<div class="row-fluid">
<%= f.input :name,:append=>"NAME", :wrapper_html=>{:class=>"span6"}%>
<%= f.input :abkuerzung, :wrapper_html=>{:class=>"span1"}%>
<%= f.input :zahl , :wrapper_html=>{:class=>"span2"}%>
<%= f.input :typ, :as=>:select, :include_blank=>false, :collection=>["Bachelor","Master"], :wrapper_html=>{:class=>"span2"}%>
</div>
<div class="row-fluid">
<%= f.input :desc, :as=>:tinymce_text , :wrapper_html=>{:class=>"span12"}%>
</div>
<% end %>
<%= tinymce %>
<%= f.actions do %>
<%= f.action :submit, :as => :input %>
<% end %>
<% end %>
</div>

View File

@@ -1,5 +1,5 @@
<ul class="nav nav-tabs">
<% if @studium.nil? %>
<% if request.fullpath == studien_path%>
<li class="active">
<% else %>
<li>
@@ -7,12 +7,19 @@
<%= link_to "Alle Studien", studien_path %> </li>
<% for s in Studium.all %>
<% if !@studium.nil? && s == @studium %>
<li class="active">
<%= link_to s.name, studium_path(s) %>
<li class="active" title="<%= s.name %>">
<%= link_to s.title_context, s %>
</li>
<% else %>
<li> <%= link_to s.name, studium_path(s) %></li>
<li title="<%= s.name %>"> <%= link_to s.title_context, s %></li>
<% end %>
<% end %>
<% if request.fullpath == studien_verwalten_path %>
<li class="active pull-right">
<% else %>
<li class="pull-right">
<% end %>
<%= link_to "Verwaltung", studien_verwalten_path %>
</li>
</ul>

View File

@@ -11,16 +11,19 @@
<% @studium.semester.each do |sem| %>
<div class="row-fluid">
<div class="span12">
<div class="modulgruppe_phase_1">
<div class="studien-semester">
<div class="container-fluid">
<div class="row-fluid">
<div class="span8">
<h2><%= sem.name %></h2>
<% sem.lvas.each_slice(2) do |row| %>
</div>
<div class="span4"><div class="pull-right"><%= link_to 'Lvas hinzufügen/entfernen', edit_semester_path(sem), :class=>"btn"%></div>
</div></div>
<% sem.lvas.each_slice(4) do |row| %>
<div class="row-fluid">
<% row.each do |l| %>
<div class="span<%= 12/row.length%>">
<div class="span3">
<%= render :partial=>'lvas/lva_semester', :locals =>{:lva => l}%>
</div>
<% end %>

View File

@@ -0,0 +1,172 @@
<div class="container-fluid">
<%= render 'studien/tabs'%>
<div class="row-fluid">
<div class="span9">
<h1><%= I18n.t("studien.verwaltung.title") %></h1>
<%= I18n.t("studien.verwaltung.explanation").html_safe %>
<h2>Studien </h2>
<div class="verwalten-block">
|
<% @studien.each do |s| %>
<%= (s.valid?) ? '<i class="icon-ok"> </i>'.html_safe : '<i class="icon-remove"></i>'.html_safe %> <%= link_to s.name, s %> | <%=link_to '<i class="icon-pencil"></i>'.html_safe+ 'edit', edit_studium_path(s)%> ||<% end %>
<div class="btn-toolbar">
<div class="btn-group">
<a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
<%= params[:std_verw].nil? ? I18n.t("filter.studium") : Studium.find(params[:std_verw]).name %>
<span class="caret"></span>
</a>
<ul class="dropdown-menu">
<li> <%= link_to 'Alle Studien', studien_verwalten_path(:std_verw=>nil) %></li>
<% for s in @studien %>
<li> <%= link_to s.name, studien_verwalten_path(:std_verw=>s)%> </li>
<% end %>
</ul>
</div>
<%= link_to 'Neues Studium', new_studium_path, :class=>'btn'%>
</div>
</div>
<div class="row-fluid">
<div class="span4">
<h2>Modulgruppen </h2>
<div class="verwalten-block">
<% @modulgruppen.each do |mg| %>
<%= (mg.valid?) ? '<i class="icon-ok"> </i>'.html_safe : '<i class="icon-remove"></i>'.html_safe %> <%= link_to mg.name, mg %> | <%=link_to '<i class="icon-pencil"></i>'.html_safe+ 'edit', edit_modulgruppe_path(mg)%><br>
<% end %>
<div class="btn-toolbar">
<div class="btn-group">
<a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
<%= params[:mg_verw].nil? ? I18n.t("filter.modulgruppe") : Modulgruppe.find(params[:mg_verw]).name %>
<span class="caret"></span>
</a>
<ul class="dropdown-menu">
<li> <%= link_to 'Alle Modulgruppen', studien_verwalten_path(:mg_verw=>nil) %></li>
<% for mg in @modulgruppen %>
<li> <%= link_to mg.name, studien_verwalten_path(:mg_verw=>mg)%> </li>
<% end %>
</ul>
</div>
<%= link_to "Neue Modulgruppe", new_studium_modulgruppe_path(Studium.first), :class=>"btn" unless Studium.first.nil?%>
</div>
</div>
</div>
<div class="span4">
<h2>Module </h2>
<div class="verwalten-block">
<% @module.each do |m| %>
<%= (m.valid?) ? '<i class="icon-ok"> </i>'.html_safe : '<i class="icon-remove"></i>'.html_safe %> <%= link_to m.name, m %>
| <%=link_to '<i class="icon-pencil"></i>'.html_safe+ 'edit', edit_modul_path(m)%><br>
<% end %>
<div class="btn-toolbar">
<div class="btn-group">
<a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
<%= params[:m_verw].nil? ? I18n.t("filter.modul") : Modul.find(params[:m_verw]).name %>
<span class="caret"></span>
</a>
<ul class="dropdown-menu">
<li> <%= link_to 'Alle Module', studien_verwalten_path(:m_verw=>nil) %></li>
<% for m in @module %>
<li> <%= link_to m.name, studien_verwalten_path(:m_verw=>m)%> </li>
<% end %>
</ul>
</div>
<%= link_to "Neues Modul", new_modul_path, :class=>"btn"%>
</div>
</div>
</div>
<div class="span4">
<h2>Lvas </h2>
<div class="verwalten-block">
<% @lvas.each do |lva| %>
<%= (lva.valid?) ? '<i class="icon-ok"> </i>'.html_safe : '<i class="icon-remove"></i>'.html_safe %><%= link_to lva.name, lva %> |
<%=link_to '<i class="icon-pencil"></i>'.html_safe+ 'edit', edit_lva_path(lva)%><br>
<% end %>
<div class="btn-toolbar">
<div class="btn-group">
<a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
<%= params[:lva_verw].nil? ? I18n.t("filter.lva") : Lva.find(params[:lva_verw]).name %>
<span class="caret"></span>
</a>
<ul class="dropdown-menu">
<li> <%= link_to 'Alle Lvas', studien_verwalten_path(:lva_verw=>nil) %></li>
<% for lva in @lvas %>
<li> <%= link_to lva.name, studien_verwalten_path(:lva_verw=>lva)%> </li>
<% end %>
</ul>
</div>
<%= link_to "Neue LVa", new_lva_path, :class=>'btn'%>
</div>
</div>
</div>
</div>
</div>
<div class="span3">
<%= link_to I18n.t("filter.reset"), studien_verwalten_path(:std_verw=>nil, :mg_verw=>nil, :m_verw=>nil, :lva_verw=>nil, :b_verw=>nil), :class=>"btn" %>
<h2>Error Log</h2>
<ul>
<li><font color="red"><b>Red</b></font>: Error, Solve immediately</li>
<li>Black: Warning, should be solved</li>
<li><font color="green"><b>Green</b></font>: Everything is fine</li>
</ul>
<div class="verwalten-block">
<ul>
<% @messages.flatten.each do |m| %>
<% if !m.strip.empty? %>
<li><%= m.html_safe %></li>
<% end %>
<% end %>
</ul>
<b><font color="green"><%= I18n.t("verwalten.fehler.keine").html_safe if @messages.empty?%></font></b>
</div>
<h2>Beispiele </h2>
<div class="verwalten-block">
<% @beispiele.each do |b| %>
<%= (b.valid?) ? '<i class="icon-ok"> </i>'.html_safe : '<i class="icon-remove"></i>'.html_safe %> <%= link_to b.name, b %> | <%=link_to '<i class="icon-pencil"></i>'.html_safe+ 'edit', edit_beispiel_path(b)%>
<% end %>
<div class="btn-toolbar">
<div class="btn-group">
<a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
<%= params[:b_verw].nil? ? I18n.t("filter.beispiel") : Beispiel.find(params[:b_verw]).name %>
<span class="caret"></span>
</a>
<ul class="dropdown-menu">
<li> <%= link_to 'Alle Beispiele', studien_verwalten_path(:b_verw=>nil) %></li>
<% for b in @beispiele %>
<li> <%= link_to b.name, studien_verwalten_path(:b_verw=>b)%> </li>
<% end %>
</ul>
</div>
<%= link_to "Neues Beispiel", new_beispiel_path, :class=>"btn"%>
</div>
</div>
</div>
</div>
</div>

View File

@@ -13,6 +13,12 @@ de:
allestudien: "Alle Studien"
loeschen: "Dieses Studium löschen"
edit: "Studium bearbeiten"
verwaltung:
title: "Studien verwalten"
explanation: "<ul>
<li>Klick auf den Namen eines Objektes führt zu dessen Ansicht, ein Klick auf edit direkt zum Bearbeitungsformular</li>
<li>Per Dropdown-Menü kann nach einzelnen Objekten gefiltert werden. Die Filter können kombiniert werden, wobei nur erlaubte Kombinationen möglich sind. <b>Solange validation-Fehler (im Log rot und fett) auftreten, keine Filter verwenden</b></li>
</ul>"
modul:
edit: "Modul bearbeiten"
list: "Alle Module"
@@ -82,15 +88,21 @@ de:
lva:
attributes:
modul:
blank: "Wählen Sie zumindest ein Modul aus"
blank: "Lva muss zumindest einem Modul zugewiesen sein"
name:
blank: "Geben Sie bitte den Namen der LVA an"
blank: "Die Lva muss einen Namen haben"
ects:
blank: "Geben Sie die ECTS der LVA an"
blank: "Es müssen ECTS eingetragen sein"
stunden:
blank: "Geben Sie die Stunden der LVA an"
blank: "Es muss die Studenanzahl eingettragen sein"
lvanr:
invalid: "Geben Sie eine LVA-Nummer in richtigem Format an. Wenn die LVA noch keine Nummer hat, so geben sie 000 an."
invalid: "Die Nummer muss im Format 000.000 eingegeben sein"
blank: "Geben sie eine Lva-Nr an"
taken: "Die Lva-Nummer ist vergeben"
typ:
blank: "Es muss ein Lva-Typ angegeben sein"
inclusion: "Der Typ ist nicht aus der Auswahl der gültigen Typen"
studium:
attributes:
zahl:
@@ -102,6 +114,215 @@ de:
taken: "Der Name ist bereits vergeben"
typ:
inclusion: 'Wählen Sie "Bachelor" oder "Master" aus'
modul:
attributes:
modulgruppen:
blank: "Wählen Sie zumindest eine Modulgruppe aus"
filter:
studium: "Studium"
modulgruppe: "Modulgruppe"
modul: "Modul"
lva: "Lva"
beispiel: "Beispiel"
reset: "Alle Filter zurücksetzen"
verwalten:
fehler:
keine: "Keine Fehlermeldungen oder Warnungen"
support:
array:
two_words_connector: ', '
date:
abbr_day_names:
- So
- Mo
- Di
- Mi
- Do
- Fr
- Sa
abbr_month_names:
-
- Jan
- Feb
- Mär
- Apr
- Mai
- Jun
- Jul
- Aug
- Sep
- Okt
- Nov
- Dez
day_names:
- Sonntag
- Montag
- Dienstag
- Mittwoch
- Donnerstag
- Freitag
- Samstag
formats:
default: ! '%d.%m.%Y'
long: ! '%e. %B %Y'
short: ! '%e. %b'
month_names:
-
- Januar
- Februar
- März
- April
- Mai
- Juni
- Juli
- August
- September
- Oktober
- November
- Dezember
order:
- :day
- :month
- :year
datetime:
distance_in_words:
about_x_hours:
one: etwa eine Stunde
other: etwa %{count} Stunden
about_x_months:
one: etwa ein Monat
other: etwa %{count} Monate
about_x_years:
one: etwa ein Jahr
other: etwa %{count} Jahre
almost_x_years:
one: fast ein Jahr
other: fast %{count} Jahre
half_a_minute: eine halbe Minute
less_than_x_minutes:
one: weniger als eine Minute
other: weniger als %{count} Minuten
less_than_x_seconds:
one: weniger als eine Sekunde
other: weniger als %{count} Sekunden
over_x_years:
one: mehr als ein Jahr
other: mehr als %{count} Jahre
x_days:
one: ein Tag
other: ! '%{count} Tage'
x_minutes:
one: eine Minute
other: ! '%{count} Minuten'
x_months:
one: ein Monat
other: ! '%{count} Monate'
x_seconds:
one: eine Sekunde
other: ! '%{count} Sekunden'
prompts:
day: Tag
hour: Stunden
minute: Minuten
month: Monat
second: Sekunden
year: Jahr
errors:
format: ! '%{attribute} %{message}'
messages:
accepted: muss akzeptiert werden
blank: muss ausgefüllt werden
confirmation: stimmt nicht mit der Bestätigung überein
empty: muss ausgefüllt werden
equal_to: muss genau %{count} sein
even: muss gerade sein
exclusion: ist nicht verfügbar
greater_than: muss größer als %{count} sein
greater_than_or_equal_to: muss größer oder gleich %{count} sein
inclusion: ist kein gültiger Wert
invalid: ist nicht gültig
less_than: muss kleiner als %{count} sein
less_than_or_equal_to: muss kleiner oder gleich %{count} sein
not_a_number: ist keine Zahl
not_an_integer: muss ganzzahlig sein
odd: muss ungerade sein
record_invalid: ! 'Gültigkeitsprüfung ist fehlgeschlagen: %{errors}'
taken: ist bereits vergeben
too_long: ist zu lang (nicht mehr als %{count} Zeichen)
too_short: ist zu kurz (nicht weniger als %{count} Zeichen)
wrong_length: hat die falsche Länge (muss genau %{count} Zeichen haben)
template:
body: ! 'Bitte überprüfen Sie die folgenden Felder:'
header:
one: ! 'Konnte %{model} nicht speichern: ein Fehler.'
other: ! 'Konnte %{model} nicht speichern: %{count} Fehler.'
helpers:
select:
prompt: Bitte wählen
submit:
create: ! '%{model} erstellen'
submit: ! '%{model} speichern'
update: ! '%{model} aktualisieren'
number:
currency:
format:
delimiter: .
format: ! '%n %u'
precision: 2
separator: ! ','
significant: false
strip_insignificant_zeros: false
unit:
format:
delimiter: .
precision: 2
separator: ! ','
significant: false
strip_insignificant_zeros: false
human:
decimal_units:
format: ! '%n %u'
units:
billion:
one: Milliarde
other: Milliarden
million: Millionen
quadrillion:
one: Billiarde
other: Billiarden
thousand: Tausend
trillion: Billionen
unit: ''
format:
delimiter: ''
precision: 1
significant: true
strip_insignificant_zeros: true
storage_units:
format: ! '%n %u'
units:
byte:
one: Byte
other: Bytes
gb: GB
kb: KB
mb: MB
tb: TB
percentage:
format:
delimiter: ''
precision:
format:
delimiter: ''
support:
array:
last_word_connector: ! ' und '
two_words_connector: ! ' und '
words_connector: ! ', '
time:
am: vormittags
formats:
default: ! '%d.%m.%Y, %H:%M Uhr'
long: ! '%A, %d. %B %Y, %H:%M Uhr'
short: ! '%d.%m.%Y, %H:%M Uhr'
pm: nachmittags

View File

@@ -1,17 +1,5 @@
Fetsite::Application.routes.draw do
resources :fragen
resources :attachments
devise_for :users
resources :home, :only=>[:index]
#get 'home',:controller=>home,:action=>:index,:as=>"home_index"
@@ -42,7 +30,7 @@ resources :studien,:except=>[:show,:new,:edit,:update,:destroy], :shallow=>true
resources :modulgruppen, :path => "(:locale)/modulgruppen"
end
# get 'studien/(:ansicht)/:id', :controller=>:studien, :action=>:show, :as=>'studium_ansicht'
get 'verwalten/studien', :controller=>:studien, :action=>:verwalten, :as=>'studien_verwalten'
resources :semesters
resources :moduls
resources :lvas
@@ -62,6 +50,8 @@ resources :themengruppen do
resources :themen, :only=>[:new, :show]
end
resources :calendars
resources :calentries
end
# The priority is based upon order of creation:

View File

@@ -0,0 +1,12 @@
class CreateCalentries < ActiveRecord::Migration
def change
create_table :calentries do |t|
t.timestamp :start
t.timestamp :ende
t.string :summary
t.integer :typ
t.timestamps
end
end
end

View File

@@ -0,0 +1,10 @@
class CreateCalendars < ActiveRecord::Migration
def change
create_table :calendars do |t|
t.string :name
t.boolean :public
t.timestamps
end
end
end

View File

@@ -0,0 +1,13 @@
class CreateCalendarCalentriesJoinTable < ActiveRecord::Migration
def up
create_table :calendars_calentries, :id=>false do |t|
t.integer :calentry_id
t.integer :calendar_id
end
add_index :calendars_calentries, [:calentry_id, :calendar_id]
add_index :calendars_calentries, :calendar_id
end
def down
end
end

View File

@@ -0,0 +1,5 @@
class AddPictureToCalendars < ActiveRecord::Migration
def change
add_column :calendars, :picture, :string
end
end

View File

@@ -0,0 +1,6 @@
class AddPruefungsinfosToLvas < ActiveRecord::Migration
def change
add_column :lvas, :pruefungsinformation, :text
add_column :lvas, :lernaufwand, :text
end
end

View File

@@ -0,0 +1,5 @@
class AddTypToLvas < ActiveRecord::Migration
def change
add_column :lvas, :typ, :string
end
end

View File

@@ -0,0 +1,5 @@
class AddAbkuerzungToStudien < ActiveRecord::Migration
def change
add_column :studien, :abkuerzung, :string
end
end

View File

@@ -11,7 +11,14 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20130729085446) do
ActiveRecord::Schema.define(:version => 20130813145651) do
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
create_table "beispiele", :force => true do |t|
t.string "name"
@@ -22,6 +29,50 @@ ActiveRecord::Schema.define(:version => 20130729085446) do
t.string "beispieldatei"
end
create_table "calendars", :force => true do |t|
t.string "name"
t.boolean "public"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "picture"
end
create_table "calendars_calentries", :id => false, :force => true do |t|
t.integer "calentry_id"
t.integer "calendar_id"
end
add_index "calendars_calentries", ["calendar_id"], :name => "index_calendars_calentries_on_calendar_id"
add_index "calendars_calentries", ["calentry_id", "calendar_id"], :name => "index_calendars_calentries_on_calentry_id_and_calendar_id"
create_table "calentries", :force => true do |t|
t.datetime "start"
t.datetime "ende"
t.string "summary"
t.integer "typ"
t.datetime "created_at", :null => false
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"
@@ -43,6 +94,9 @@ ActiveRecord::Schema.define(:version => 20130729085446) do
t.datetime "updated_at", :null => false
t.integer "modul_id"
t.integer "semester_id"
t.text "pruefungsinformation"
t.text "lernaufwand"
t.string "typ"
end
create_table "lvas_moduls", :id => false, :force => true do |t|
@@ -50,11 +104,14 @@ ActiveRecord::Schema.define(:version => 20130729085446) do
t.integer "modul_id"
end
create_table "lvas_semesters", :force => true do |t|
create_table "lvas_semesters", :id => false, :force => true do |t|
t.integer "lva_id"
t.integer "semester_id"
end
add_index "lvas_semesters", ["lva_id", "semester_id"], :name => "index_lvas_semesters_on_lva_id_and_semester_id"
add_index "lvas_semesters", ["semester_id"], :name => "index_lvas_semesters_on_semester_id"
create_table "modul_translations", :force => true do |t|
t.integer "modul_id"
t.string "locale"
@@ -148,6 +205,7 @@ ActiveRecord::Schema.define(:version => 20130729085446) do
t.string "typ"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "abkuerzung"
end
create_table "studium_translations", :force => true do |t|
@@ -161,6 +219,43 @@ ActiveRecord::Schema.define(:version => 20130729085446) 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 CalendarsController do
# This should return the minimal set of attributes required to create a valid
# Calendar. As you add validations to Calendar, 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
# CalendarsController. Be sure to keep this updated too.
let(:valid_session) { {} }
describe "GET index" do
it "assigns all calendars as @calendars" do
calendar = Calendar.create! valid_attributes
get :index, {}, valid_session
assigns(:calendars).should eq([calendar])
end
end
describe "GET show" do
it "assigns the requested calendar as @calendar" do
calendar = Calendar.create! valid_attributes
get :show, {:id => calendar.to_param}, valid_session
assigns(:calendar).should eq(calendar)
end
end
describe "GET new" do
it "assigns a new calendar as @calendar" do
get :new, {}, valid_session
assigns(:calendar).should be_a_new(Calendar)
end
end
describe "GET edit" do
it "assigns the requested calendar as @calendar" do
calendar = Calendar.create! valid_attributes
get :edit, {:id => calendar.to_param}, valid_session
assigns(:calendar).should eq(calendar)
end
end
describe "POST create" do
describe "with valid params" do
it "creates a new Calendar" do
expect {
post :create, {:calendar => valid_attributes}, valid_session
}.to change(Calendar, :count).by(1)
end
it "assigns a newly created calendar as @calendar" do
post :create, {:calendar => valid_attributes}, valid_session
assigns(:calendar).should be_a(Calendar)
assigns(:calendar).should be_persisted
end
it "redirects to the created calendar" do
post :create, {:calendar => valid_attributes}, valid_session
response.should redirect_to(Calendar.last)
end
end
describe "with invalid params" do
it "assigns a newly created but unsaved calendar as @calendar" do
# Trigger the behavior that occurs when invalid params are submitted
Calendar.any_instance.stub(:save).and_return(false)
post :create, {:calendar => { "name" => "invalid value" }}, valid_session
assigns(:calendar).should be_a_new(Calendar)
end
it "re-renders the 'new' template" do
# Trigger the behavior that occurs when invalid params are submitted
Calendar.any_instance.stub(:save).and_return(false)
post :create, {:calendar => { "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 calendar" do
calendar = Calendar.create! valid_attributes
# Assuming there are no other calendars in the database, this
# specifies that the Calendar created on the previous line
# receives the :update_attributes message with whatever params are
# submitted in the request.
Calendar.any_instance.should_receive(:update_attributes).with({ "name" => "MyString" })
put :update, {:id => calendar.to_param, :calendar => { "name" => "MyString" }}, valid_session
end
it "assigns the requested calendar as @calendar" do
calendar = Calendar.create! valid_attributes
put :update, {:id => calendar.to_param, :calendar => valid_attributes}, valid_session
assigns(:calendar).should eq(calendar)
end
it "redirects to the calendar" do
calendar = Calendar.create! valid_attributes
put :update, {:id => calendar.to_param, :calendar => valid_attributes}, valid_session
response.should redirect_to(calendar)
end
end
describe "with invalid params" do
it "assigns the calendar as @calendar" do
calendar = Calendar.create! valid_attributes
# Trigger the behavior that occurs when invalid params are submitted
Calendar.any_instance.stub(:save).and_return(false)
put :update, {:id => calendar.to_param, :calendar => { "name" => "invalid value" }}, valid_session
assigns(:calendar).should eq(calendar)
end
it "re-renders the 'edit' template" do
calendar = Calendar.create! valid_attributes
# Trigger the behavior that occurs when invalid params are submitted
Calendar.any_instance.stub(:save).and_return(false)
put :update, {:id => calendar.to_param, :calendar => { "name" => "invalid value" }}, valid_session
response.should render_template("edit")
end
end
end
describe "DELETE destroy" do
it "destroys the requested calendar" do
calendar = Calendar.create! valid_attributes
expect {
delete :destroy, {:id => calendar.to_param}, valid_session
}.to change(Calendar, :count).by(-1)
end
it "redirects to the calendars list" do
calendar = Calendar.create! valid_attributes
delete :destroy, {:id => calendar.to_param}, valid_session
response.should redirect_to(calendars_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 CalentriesController do
# This should return the minimal set of attributes required to create a valid
# Calentry. As you add validations to Calentry, be sure to
# adjust the attributes here as well.
let(:valid_attributes) { { "start" => "2013-08-05 21:17:10" } }
# 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
# CalentriesController. Be sure to keep this updated too.
let(:valid_session) { {} }
describe "GET index" do
it "assigns all calentries as @calentries" do
calentry = Calentry.create! valid_attributes
get :index, {}, valid_session
assigns(:calentries).should eq([calentry])
end
end
describe "GET show" do
it "assigns the requested calentry as @calentry" do
calentry = Calentry.create! valid_attributes
get :show, {:id => calentry.to_param}, valid_session
assigns(:calentry).should eq(calentry)
end
end
describe "GET new" do
it "assigns a new calentry as @calentry" do
get :new, {}, valid_session
assigns(:calentry).should be_a_new(Calentry)
end
end
describe "GET edit" do
it "assigns the requested calentry as @calentry" do
calentry = Calentry.create! valid_attributes
get :edit, {:id => calentry.to_param}, valid_session
assigns(:calentry).should eq(calentry)
end
end
describe "POST create" do
describe "with valid params" do
it "creates a new Calentry" do
expect {
post :create, {:calentry => valid_attributes}, valid_session
}.to change(Calentry, :count).by(1)
end
it "assigns a newly created calentry as @calentry" do
post :create, {:calentry => valid_attributes}, valid_session
assigns(:calentry).should be_a(Calentry)
assigns(:calentry).should be_persisted
end
it "redirects to the created calentry" do
post :create, {:calentry => valid_attributes}, valid_session
response.should redirect_to(Calentry.last)
end
end
describe "with invalid params" do
it "assigns a newly created but unsaved calentry as @calentry" do
# Trigger the behavior that occurs when invalid params are submitted
Calentry.any_instance.stub(:save).and_return(false)
post :create, {:calentry => { "start" => "invalid value" }}, valid_session
assigns(:calentry).should be_a_new(Calentry)
end
it "re-renders the 'new' template" do
# Trigger the behavior that occurs when invalid params are submitted
Calentry.any_instance.stub(:save).and_return(false)
post :create, {:calentry => { "start" => "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 calentry" do
calentry = Calentry.create! valid_attributes
# Assuming there are no other calentries in the database, this
# specifies that the Calentry created on the previous line
# receives the :update_attributes message with whatever params are
# submitted in the request.
Calentry.any_instance.should_receive(:update_attributes).with({ "start" => "2013-08-05 21:17:10" })
put :update, {:id => calentry.to_param, :calentry => { "start" => "2013-08-05 21:17:10" }}, valid_session
end
it "assigns the requested calentry as @calentry" do
calentry = Calentry.create! valid_attributes
put :update, {:id => calentry.to_param, :calentry => valid_attributes}, valid_session
assigns(:calentry).should eq(calentry)
end
it "redirects to the calentry" do
calentry = Calentry.create! valid_attributes
put :update, {:id => calentry.to_param, :calentry => valid_attributes}, valid_session
response.should redirect_to(calentry)
end
end
describe "with invalid params" do
it "assigns the calentry as @calentry" do
calentry = Calentry.create! valid_attributes
# Trigger the behavior that occurs when invalid params are submitted
Calentry.any_instance.stub(:save).and_return(false)
put :update, {:id => calentry.to_param, :calentry => { "start" => "invalid value" }}, valid_session
assigns(:calentry).should eq(calentry)
end
it "re-renders the 'edit' template" do
calentry = Calentry.create! valid_attributes
# Trigger the behavior that occurs when invalid params are submitted
Calentry.any_instance.stub(:save).and_return(false)
put :update, {:id => calentry.to_param, :calentry => { "start" => "invalid value" }}, valid_session
response.should render_template("edit")
end
end
end
describe "DELETE destroy" do
it "destroys the requested calentry" do
calentry = Calentry.create! valid_attributes
expect {
delete :destroy, {:id => calentry.to_param}, valid_session
}.to change(Calentry, :count).by(-1)
end
it "redirects to the calentries list" do
calentry = Calentry.create! valid_attributes
delete :destroy, {:id => calentry.to_param}, valid_session
response.should redirect_to(calentries_url)
end
end
end

View File

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

View File

@@ -0,0 +1,10 @@
# Read about factories at https://github.com/thoughtbot/factory_girl
FactoryGirl.define do
factory :calentry do
start "2013-08-05 21:17:10"
ende "2013-08-05 21:17:10"
summary "MyString"
typ 1
end
end

View File

@@ -0,0 +1,15 @@
require 'spec_helper'
# Specs in this file have access to a helper object that includes
# the CalendarsHelper. For example:
#
# describe CalendarsHelper 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 CalendarsHelper 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 CalentriesHelper. For example:
#
# describe CalentriesHelper 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 CalentriesHelper do
pending "add some examples to (or delete) #{__FILE__}"
end

View File

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

View File

@@ -0,0 +1,20 @@
require 'spec_helper'
describe Calentry do
it "should be valid with full data" do
e = FactoryGirl.build(:calentry)
c = FactoryGirl.create(:calendar)
e.calendars<<c
e.should be_valid
end
[:ende,:start,:typ].each do |attr|
it "should not be valid without #{attr}" do
e= FactoryGirl.build(:calentry, attr => nil)
c=FactoryGirl.create(:calendar)
e.calendars<<c
e.should_not be_valid
e.should have_at_least(1).errors_on(attr)
end
end
end

View File

@@ -0,0 +1,11 @@
require 'spec_helper'
describe "Calendars" do
describe "GET /calendars" 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 calendars_path
response.status.should be(200)
end
end
end

View File

@@ -0,0 +1,11 @@
require 'spec_helper'
describe "Calentries" do
describe "GET /calentries" 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 calentries_path
response.status.should be(200)
end
end
end

View File

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

View File

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

View File

@@ -0,0 +1,20 @@
require 'spec_helper'
describe "calendars/edit" do
before(:each) do
@calendar = assign(:calendar, stub_model(Calendar,
:name => "MyString",
:public => false
))
end
it "renders the edit calendar form" do
render
# Run the generator again with the --webrat flag if you want to use webrat matchers
assert_select "form[action=?][method=?]", calendar_path(@calendar), "post" do
assert_select "input#calendar_name[name=?]", "calendar[name]"
assert_select "input#calendar_public[name=?]", "calendar[public]"
end
end
end

View File

@@ -0,0 +1,23 @@
require 'spec_helper'
describe "calendars/index" do
before(:each) do
assign(:calendars, [
stub_model(Calendar,
:name => "Name",
:public => false
),
stub_model(Calendar,
:name => "Name",
:public => false
)
])
end
it "renders a list of calendars" 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
assert_select "tr>td", :text => false.to_s, :count => 2
end
end

View File

@@ -0,0 +1,20 @@
require 'spec_helper'
describe "calendars/new" do
before(:each) do
assign(:calendar, stub_model(Calendar,
:name => "MyString",
:public => false
).as_new_record)
end
it "renders new calendar form" do
render
# Run the generator again with the --webrat flag if you want to use webrat matchers
assert_select "form[action=?][method=?]", calendars_path, "post" do
assert_select "input#calendar_name[name=?]", "calendar[name]"
assert_select "input#calendar_public[name=?]", "calendar[public]"
end
end
end

View File

@@ -0,0 +1,17 @@
require 'spec_helper'
describe "calendars/show" do
before(:each) do
@calendar = assign(:calendar, stub_model(Calendar,
:name => "Name",
:public => false
))
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/)
rendered.should match(/false/)
end
end

View File

@@ -0,0 +1,20 @@
require 'spec_helper'
describe "calentries/edit" do
before(:each) do
@calentry = assign(:calentry, stub_model(Calentry,
:summary => "MyString",
:typ => 1
))
end
it "renders the edit calentry form" do
render
# Run the generator again with the --webrat flag if you want to use webrat matchers
assert_select "form[action=?][method=?]", calentry_path(@calentry), "post" do
assert_select "input#calentry_summary[name=?]", "calentry[summary]"
assert_select "input#calentry_typ[name=?]", "calentry[typ]"
end
end
end

View File

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

View File

@@ -0,0 +1,20 @@
require 'spec_helper'
describe "calentries/new" do
before(:each) do
assign(:calentry, stub_model(Calentry,
:summary => "MyString",
:typ => 1
).as_new_record)
end
it "renders new calentry form" do
render
# Run the generator again with the --webrat flag if you want to use webrat matchers
assert_select "form[action=?][method=?]", calentries_path, "post" do
assert_select "input#calentry_summary[name=?]", "calentry[summary]"
assert_select "input#calentry_typ[name=?]", "calentry[typ]"
end
end
end

View File

@@ -0,0 +1,17 @@
require 'spec_helper'
describe "calentries/show" do
before(:each) do
@calentry = assign(:calentry, stub_model(Calentry,
:summary => "Summary",
:typ => 1
))
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(/Summary/)
rendered.should match(/1/)
end
end