LVA Tiss Einbindung - erster Entwurf
This commit is contained in:
57
app/controllers/page_controller.rb
Normal file
57
app/controllers/page_controller.rb
Normal file
@@ -0,0 +1,57 @@
|
||||
class PagesController < ApplicationController
|
||||
|
||||
layout :get_layout
|
||||
|
||||
before_filter :find_page, :except => [:new, :show, :create]
|
||||
before_filter :find_body, :only => [:edit]
|
||||
|
||||
def new
|
||||
@page = Page.new
|
||||
end
|
||||
|
||||
def edit
|
||||
end
|
||||
|
||||
def show
|
||||
@page = Page.find(params[:id] || Page.welcome)
|
||||
end
|
||||
|
||||
def create
|
||||
@page = Page.new(params[:page])
|
||||
if @page.save
|
||||
flash[:notice] = "Successfully created page."
|
||||
redirect_to @page
|
||||
else
|
||||
render :action => 'new'
|
||||
end
|
||||
end
|
||||
|
||||
def update
|
||||
if @page.update_attributes(params[:page])
|
||||
flash[:notice] = "Successfully updated page."
|
||||
redirect_to @page
|
||||
else
|
||||
render :action => 'edit'
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@page.destroy
|
||||
flash[:notice] = "Successfully destroyed page."
|
||||
end
|
||||
|
||||
def preview
|
||||
render :text => @page.preview(params[:data])
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def find_page
|
||||
@page = Page.find(params[:id])
|
||||
end
|
||||
|
||||
def find_body
|
||||
@page.body = params[:page][:body] rescue @page.raw_content
|
||||
end
|
||||
|
||||
end
|
||||
@@ -28,10 +28,13 @@ end
|
||||
begin
|
||||
@hash=Hash.from_xml(open(url).read)["tuvienna"]
|
||||
@person=[]
|
||||
# @person = @hash["course"]["lecturers"]["oid"]
|
||||
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
|
||||
|
||||
@@ -5,18 +5,24 @@
|
||||
<span class="divider">/</span></li>
|
||||
<li><%= link_to g.name , modulgruppe_path(g)%><span class="divider">/</span></li>
|
||||
<li><%= link_to modul.name , modul_path(modul)%></li>
|
||||
<%end%>
|
||||
<% end %>
|
||||
</ul>
|
||||
<%end%>
|
||||
<% end %>
|
||||
|
||||
<p id="notice"><%= notice %></p>
|
||||
<p> <%= @lva.lvanr %>
|
||||
<b>
|
||||
<%= @lva.name %> (<%= @lva.ects %> ECTS/ <%= @lva.stunden %> Std)</b><%= link_to image_tag('edit.png'), edit_lva_path(@lva) %> |
|
||||
<%= @lva.name %>
|
||||
<%= @lva.ects %> ECTS/ <%= @lva.stunden %> Std</b>
|
||||
<%= link_to image_tag('edit.png'), edit_lva_path(@lva.id) %> |
|
||||
</p>
|
||||
<p>
|
||||
<%= @lva.desc %>
|
||||
</p>
|
||||
<% @lva.beispiele.each do |beispiel| %>
|
||||
<%= link_to beispiel.name, beispiel.file.url %>
|
||||
<%= @lva.objective %>
|
||||
<%= # @lva.teachingContent %>
|
||||
<% @lva.beispiele.each do |beispiel| %>
|
||||
<%= # link_to beispiel.name, beispiel.file.url %>
|
||||
|
||||
<% end%>
|
||||
<% end
|
||||
end %>
|
||||
|
||||
@@ -11,10 +11,15 @@ link_to "Modul "+name , modul_path(modul) %> </b>
|
||||
<%= raw(modul.desc) %>
|
||||
</p>
|
||||
LVAs:
|
||||
|
||||
<ul>
|
||||
<% modul.lvas.each do |lva| %>
|
||||
<li><%= link_to lva.lvanr+" "+ lva.name, lva %></li>
|
||||
|
||||
<% modul.lvas.each do |lv| %>
|
||||
<li>
|
||||
<%= link_to lv.name.to_s, lva_path(lv.id) %>
|
||||
</li>
|
||||
<% end %>
|
||||
|
||||
</ul>
|
||||
|
||||
<% # @toolbar_elements << {:icon=>:pencil,:text=>I18n.t("common.edit"),:path=> edit_modul_path(modul)} %>
|
||||
|
||||
Reference in New Issue
Block a user