forked from bofh/fetsite
Abkürzungen zu Studien hinzugefügt
This commit is contained in:
@@ -12,14 +12,17 @@
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
class Studium < ActiveRecord::Base
|
||||
attr_accessible :desc, :name, :typ, :zahl, :semester
|
||||
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.strip.empty? ? self.name : self.abkuerzung
|
||||
end
|
||||
|
||||
def batch_add_semester
|
||||
# Semester automatisch zu Studien hinzufügen
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<ul>
|
||||
<% modul.modulgruppen.each do |g| %>
|
||||
|
||||
<li><%= link_to g.studium.name , studium_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>
|
||||
|
||||
@@ -1 +1 @@
|
||||
<b><%=link_to modulgruppe.name, modulgruppe %></b> <%= ' ( ' + modulgruppe.studium.name + ')' unless modulgruppe.studium.nil? %>
|
||||
<b><%=link_to modulgruppe.name, modulgruppe %></b> <%= ' ( ' + modulgruppe.studium.title_context + ')' unless modulgruppe.studium.nil? %>
|
||||
|
||||
@@ -5,18 +5,15 @@
|
||||
<%= f.inputs do %>
|
||||
|
||||
<div class="row-fluid">
|
||||
<div class="span6">
|
||||
<%= f.input :name,:append=>"NAME" %>
|
||||
</div>
|
||||
<div class="span3">
|
||||
<%= f.input :zahl %>
|
||||
</div>
|
||||
<div class="span3">
|
||||
<%= f.input :typ, :as=>:select, :include_blank=>false, :collection=>["Bachelor","Master"]%>
|
||||
</div>
|
||||
<%= 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 %>
|
||||
<%= f.input :desc, :as=>:tinymce_text , :wrapper_html=>{:class=>"span12"}%>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
|
||||
@@ -7,17 +7,18 @@
|
||||
<%= link_to "Alle Studien", studien_path %> </li>
|
||||
<% for s in Studium.all %>
|
||||
<% if !@studium.nil? && s == @studium %>
|
||||
<li class="active">
|
||||
<%= link_to s.name, s %>
|
||||
|
||||
<li class="active" title="<%= s.name %>">
|
||||
<%= link_to s.title_context, s %>
|
||||
</li>
|
||||
<% else %>
|
||||
<li> <%= link_to s.name, s %></li>
|
||||
<li title="<%= s.name %>"> <%= link_to s.title_context, s %></li>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% if request.fullpath == studien_verwalten_path %>
|
||||
<li class="active">
|
||||
<li class="active pull-right">
|
||||
<% else %>
|
||||
<li>
|
||||
<li class="pull-right">
|
||||
<% end %>
|
||||
<%= link_to "Verwaltung", studien_verwalten_path %>
|
||||
</li>
|
||||
|
||||
5
db/migrate/20130813145651_add_abkuerzung_to_studien.rb
Normal file
5
db/migrate/20130813145651_add_abkuerzung_to_studien.rb
Normal file
@@ -0,0 +1,5 @@
|
||||
class AddAbkuerzungToStudien < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :studien, :abkuerzung, :string
|
||||
end
|
||||
end
|
||||
90
db/schema.rb
90
db/schema.rb
@@ -11,28 +11,22 @@
|
||||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20130812070544) do
|
||||
ActiveRecord::Schema.define(:version => 20130813145651) do
|
||||
|
||||
create_table "beispiel_translations", :force => true do |t|
|
||||
t.string "locale"
|
||||
t.text "desc"
|
||||
create_table "attachments", :force => true do |t|
|
||||
t.string "name"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.integer "beispiele_id"
|
||||
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.string "beispieldatei"
|
||||
end
|
||||
|
||||
create_table "calendars", :force => true do |t|
|
||||
@@ -60,6 +54,25 @@ ActiveRecord::Schema.define(:version => 20130812070544) 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"
|
||||
@@ -91,14 +104,11 @@ ActiveRecord::Schema.define(:version => 20130812070544) do
|
||||
t.integer "modul_id"
|
||||
end
|
||||
|
||||
create_table "lvas_semesters", :id => false, :force => true do |t|
|
||||
create_table "lvas_semesters", :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"
|
||||
@@ -156,18 +166,6 @@ ActiveRecord::Schema.define(:version => 20130812070544) 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"
|
||||
@@ -204,6 +202,7 @@ ActiveRecord::Schema.define(:version => 20130812070544) 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|
|
||||
@@ -217,6 +216,43 @@ ActiveRecord::Schema.define(:version => 20130812070544) 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 "themen_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
|
||||
|
||||
Reference in New Issue
Block a user