diff --git a/app/models/studium.rb b/app/models/studium.rb index 8a204dc..0650702 100755 --- a/app/models/studium.rb +++ b/app/models/studium.rb @@ -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 diff --git a/app/views/lvas/show.html.erb b/app/views/lvas/show.html.erb index f7b7230..a294a2e 100755 --- a/app/views/lvas/show.html.erb +++ b/app/views/lvas/show.html.erb @@ -45,7 +45,7 @@ diff --git a/app/views/modulgruppen/_kurz.html.erb b/app/views/modulgruppen/_kurz.html.erb index 610f838..73fad72 100644 --- a/app/views/modulgruppen/_kurz.html.erb +++ b/app/views/modulgruppen/_kurz.html.erb @@ -1 +1 @@ -<%=link_to modulgruppe.name, modulgruppe %> <%= ' ( ' + modulgruppe.studium.name + ')' unless modulgruppe.studium.nil? %> +<%=link_to modulgruppe.name, modulgruppe %> <%= ' ( ' + modulgruppe.studium.title_context + ')' unless modulgruppe.studium.nil? %> diff --git a/app/views/studien/_form.html.erb b/app/views/studien/_form.html.erb index 9bff027..6cdb5c2 100755 --- a/app/views/studien/_form.html.erb +++ b/app/views/studien/_form.html.erb @@ -5,18 +5,15 @@ <%= f.inputs do %>
-
- <%= f.input :name,:append=>"NAME" %> -
-
- <%= f.input :zahl %> -
-
- <%= f.input :typ, :as=>:select, :include_blank=>false, :collection=>["Bachelor","Master"]%> -
+ <%= 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"}%>
- <%= f.input :desc, :as=>:tinymce_text %> + <%= f.input :desc, :as=>:tinymce_text , :wrapper_html=>{:class=>"span12"}%>
<% end %> diff --git a/app/views/studien/_tabs.html.erb b/app/views/studien/_tabs.html.erb index 2760f1b..12684ca 100644 --- a/app/views/studien/_tabs.html.erb +++ b/app/views/studien/_tabs.html.erb @@ -7,17 +7,18 @@ <%= link_to "Alle Studien", studien_path %> <% for s in Studium.all %> <% if !@studium.nil? && s == @studium %> -
  • - <%= link_to s.name, s %> + +
  • + <%= link_to s.title_context, s %>
  • <% else %> -
  • <%= link_to s.name, s %>
  • +
  • <%= link_to s.title_context, s %>
  • <% end %> <% end %> <% if request.fullpath == studien_verwalten_path %> -
  • +
  • <% else %> -
  • +
  • <% end %> <%= link_to "Verwaltung", studien_verwalten_path %>
  • diff --git a/db/migrate/20130813145651_add_abkuerzung_to_studien.rb b/db/migrate/20130813145651_add_abkuerzung_to_studien.rb new file mode 100644 index 0000000..bc8ee06 --- /dev/null +++ b/db/migrate/20130813145651_add_abkuerzung_to_studien.rb @@ -0,0 +1,5 @@ +class AddAbkuerzungToStudien < ActiveRecord::Migration + def change + add_column :studien, :abkuerzung, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index 3b2d2f9..95500ad 100755 --- a/db/schema.rb +++ b/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" - 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 => 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