From 5a7eb23a1faf663329893dd7d90b2fb71a843c72 Mon Sep 17 00:00:00 2001 From: Andreas Stephanides Date: Thu, 28 May 2015 20:17:36 +0200 Subject: [PATCH] studium form update --- .../themes/blue1/application.css.scss | 2 + app/controllers/lvas_controller.rb | 4 +- app/controllers/moduls_controller.rb | 4 +- app/models/lva.rb | 2 +- app/models/modul.rb | 2 +- app/views/lvas/show.html.erb | 4 +- app/views/modulgruppen/_form.html.erb | 53 +++++++++++--- app/views/modulgruppen/_modulgruppe.html.erb | 4 +- app/views/modulgruppen/show.html.erb | 2 +- app/views/moduls/_form.html.erb | 60 ++++++++++++--- app/views/moduls/_kurz.html.erb | 2 +- app/views/moduls/_modul.html.erb | 5 ++ app/views/moduls/load_tiss.html.erb | 2 +- app/views/studien/_form.html.erb | 73 +++++++++++++------ app/views/studien/_infoansicht.html.erb | 3 + config/locales/studien_public.en.yml | 4 +- config/tinymce.yml | 3 + 17 files changed, 172 insertions(+), 57 deletions(-) diff --git a/app/assets/stylesheets/themes/blue1/application.css.scss b/app/assets/stylesheets/themes/blue1/application.css.scss index 27a8bc0..fdc57b0 100755 --- a/app/assets/stylesheets/themes/blue1/application.css.scss +++ b/app/assets/stylesheets/themes/blue1/application.css.scss @@ -15,6 +15,8 @@ *= require jquery.fileupload-ui *= require jquery.datetimepicker *= require jquery.ui.dialog + *= require jquery.ui.autocomplete + *= require jquery.ui.tabs * require 'bootstrap' * require 'neuigkeiten' */ diff --git a/app/controllers/lvas_controller.rb b/app/controllers/lvas_controller.rb index 22757a6..44f1a9b 100755 --- a/app/controllers/lvas_controller.rb +++ b/app/controllers/lvas_controller.rb @@ -77,13 +77,13 @@ class LvasController < ApplicationController @lva = Lva.find_by_id(params[:id]) @lvatiss = Lva.new @lvatiss.lvanr=@lva.lvanr - @lvatiss.load_tissdata("-2013W") + @lvatiss.load_tissdata end def load_tiss @lva = Lva.find_by_id(params[:id]) - @lva.load_tissdata("-2013W") + @lva.load_tissdata if @lva.save redirect_to @lva , notice: 'Lva von TISS geladen.' else diff --git a/app/controllers/moduls_controller.rb b/app/controllers/moduls_controller.rb index 0055551..95be7ed 100755 --- a/app/controllers/moduls_controller.rb +++ b/app/controllers/moduls_controller.rb @@ -125,13 +125,13 @@ end def show_tiss @lvas=[]; - @semester = @modul.modulgruppen.flatten.map(&:studium).map(&:semester).flatten.uniq + @semester = @modul.modulgruppen.flatten.map(&:studium).map(&:semester).uniq params["lvas"].to_a.each do |l| unless l.last["lvanr"].empty? l=l.last lva=Lva.new lva.lvanr=l["lvanr"] - lva.load_tissdata("-"+ l["sem"]) + lva.load_tissdata lva.modul<<@modul @lvas<true has_and_belongs_to_many :modulgruppen diff --git a/app/views/lvas/show.html.erb b/app/views/lvas/show.html.erb index ce779ef..644c8d8 100755 --- a/app/views/lvas/show.html.erb +++ b/app/views/lvas/show.html.erb @@ -113,7 +113,7 @@ <% end %> - + <% unless @crawlobjects.nil? %>
<% @crawlobjects.each do |co| %> @@ -121,7 +121,7 @@ <% end %>
- + <% end %> diff --git a/app/views/modulgruppen/_form.html.erb b/app/views/modulgruppen/_form.html.erb index 52a558e..d358876 100755 --- a/app/views/modulgruppen/_form.html.erb +++ b/app/views/modulgruppen/_form.html.erb @@ -1,29 +1,62 @@ <%= semantic_form_for @modulgruppe do |f| %> <%= f.inputs do %> -
+
<%= f.input :name, :wrapper_html=>{:class=>"span12"}%> -
-
- <%= 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 :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"} %> -
+ +
<%= f.input :desc %>
+
+
+ + +"> + + <%= f.input :moduls, :as=>:check_boxes, :collection=>@modulgruppe.moduls %> + + +
- -
- <%= f.input :moduls, :as=>:check_boxes %> -
<% end %> <%= f.actions do %> <%= f.action :submit, :as => :input %> <% end %> <% end %> + diff --git a/app/views/modulgruppen/_modulgruppe.html.erb b/app/views/modulgruppen/_modulgruppe.html.erb index 9c598eb..2359462 100755 --- a/app/views/modulgruppen/_modulgruppe.html.erb +++ b/app/views/modulgruppen/_modulgruppe.html.erb @@ -1,6 +1,6 @@
-

<%= link_to modulgruppe.name, modulgruppe_path(modulgruppe) %> -

+

<%= link_to modulgruppe.name, modulgruppe_path(modulgruppe) %> <%= link_to fa_icon("pencil") , edit_modulgruppe_path(modulgruppe) %>

+ <%= modulgruppe.desc%>
    <%= render :partial=>'moduls/kurz', :collection=>modulgruppe.moduls, :as=>:modul%> diff --git a/app/views/modulgruppen/show.html.erb b/app/views/modulgruppen/show.html.erb index d466a07..653b851 100755 --- a/app/views/modulgruppen/show.html.erb +++ b/app/views/modulgruppen/show.html.erb @@ -3,7 +3,7 @@

    <%= notice %>

    - <%= @modulgruppe.name %> + <%= @modulgruppe.name %><%= link_to fa_icon("pencil") , edit_modulgruppe_path(@modulgruppe) %>

    diff --git a/app/views/moduls/_form.html.erb b/app/views/moduls/_form.html.erb index d3af507..9147828 100755 --- a/app/views/moduls/_form.html.erb +++ b/app/views/moduls/_form.html.erb @@ -6,24 +6,37 @@

    - <%= f.input :name ,:hint=>true%> + <%= f.input :name , :as=>:hidden %> +
    +

    <%= @modul.name %>

    -
    +
    - <%= f.input :desc, :as=>:tinymce_text %> -
    -
    -
    -
    - <%= f.input :depend %> +
    + +
    +
    + <%= raw(@modul.desc) %> +
    + <%= f.input :desc, :as=>:hidden %> +
    +
    + <%= f.input :depend %> +
    +
    +
    - <%= f.input :modulgruppen, :as => :check_boxes, :member_label=>:long_name, :collection => Modulgruppe.all %> + +"> + <%= f.input :lvas, :as => :check_boxes, :member_label=>:full_name, :collection => @modul.lvas %> +"> + <%= f.input :modulgruppen, :as => :check_boxes, :member_label=>:long_name, :collection => @modul.modulgruppen %>
@@ -34,5 +47,34 @@ <% end %> <% end %> + + +<%= tinymce :inline_simple %> +<%= tinymce :inline_div %> <%= tinymce %> + diff --git a/app/views/moduls/_kurz.html.erb b/app/views/moduls/_kurz.html.erb index a1b818f..9a82cd5 100755 --- a/app/views/moduls/_kurz.html.erb +++ b/app/views/moduls/_kurz.html.erb @@ -1,7 +1,7 @@
  • - <%= link_to "Modul "+ modul.name.to_s , modul_path(modul) %> + <%= link_to "Modul "+ modul.name.to_s , modul_path(modul) %> <%= link_to fa_icon("pencil") , edit_modul_path(modul) %>

      <% modul.lvas.each do |lva| %> diff --git a/app/views/moduls/_modul.html.erb b/app/views/moduls/_modul.html.erb index c9855d5..61753f9 100755 --- a/app/views/moduls/_modul.html.erb +++ b/app/views/moduls/_modul.html.erb @@ -16,6 +16,11 @@

      <%= raw(modul.desc) %>

      +

      <%=I18n.t("modul.depend")%>

      +

      + <%= raw(modul.depend) %> +

      +
    diff --git a/app/views/moduls/load_tiss.html.erb b/app/views/moduls/load_tiss.html.erb index 93a5df0..83ed87e 100644 --- a/app/views/moduls/load_tiss.html.erb +++ b/app/views/moduls/load_tiss.html.erb @@ -3,7 +3,7 @@ <%= semantic_fields_for "lvas[#{i}]" do |f| %> <%= f.input :lvanr %> -<%= f.input :sem , :input_html => { "style"=>"width:7em" },:as=>:select, :collection=>["2012S", "2012W","2013S","2013W","2014S","2014W","2015S","2015W"] %> +<% f.input :sem , :input_html => { "style"=>"width:7em" },:as=>:select, :collection=>["2012S", "2012W","2013S","2013W","2014S","2014W","2015S","2015W"] %> <% end %> <% end %> diff --git a/app/views/studien/_form.html.erb b/app/views/studien/_form.html.erb index 3640757..7d0bef3 100755 --- a/app/views/studien/_form.html.erb +++ b/app/views/studien/_form.html.erb @@ -7,37 +7,62 @@
    <%= 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 , :wrapper_html=>{:class=>"span12"}%> -
    -
    - <%= f.input :qualifikation, :as=>:tinymce_text , :wrapper_html=>{:class=>"span12"}%> -
    -
    - <%= f.input :struktur, :as=>:tinymce_text , :wrapper_html=>{:class=>"span12"}%> -
    -
    - <%= f.input :jobmoeglichkeiten, :as=>:tinymce_text , :wrapper_html=>{:class=>"span12"}%> -
    -
    -
    - - - <%= image_tag(@studium.picture.thumb.url) unless @studium.picture.nil? %> - <%= f.file_field :picture %> - <%= f.hidden_field :picture_cache %> - +

    +

    +
    + +
    + <%= f.input :abkuerzung %> + <%= f.input :zahl %> + <%= f.input :typ, :as=>:select, :include_blank=>false, :collection=>["Bachelor","Master"] %> + + <%= image_tag(@studium.picture.thumb.url) unless @studium.picture.nil? %> + <%= f.file_field :picture %> + <%= f.hidden_field :picture_cache %> +
    + +
    +
    + <%= raw(@studium.desc) %> +
    + <%= f.input :desc, :as=>:hidden %> +
    + +
    +
    + <%= raw(@studium.qualifikation) %> +
    + <%= f.input :qualifikation, :as=>:hidden %> +
    + +
    +
    + <%= raw(@studium.struktur) %> +
    + <%= f.input :struktur, :as=>:hidden %> +
    +
    +
    + <%= raw(@studium.jobmoeglichkeiten) %> +
    + <%= f.input :jobmoeglichkeiten, :as=>:hidden %> +
    +
    - <% end %> + <%= tinymce %> + <%= tinymce :inline_div %> <%= f.actions do %> <%= f.action :submit, :as => :input %> <%= link_to 'Back', studien_path, :data=>{:locale=>I18n.locale}, class: :btn%> diff --git a/app/views/studien/_infoansicht.html.erb b/app/views/studien/_infoansicht.html.erb index d8e6dba..9ff1d5f 100644 --- a/app/views/studien/_infoansicht.html.erb +++ b/app/views/studien/_infoansicht.html.erb @@ -6,6 +6,9 @@ <%= render_attachments_for(@studium) %> <%= raw(@studium.desc) %> + <%= raw(@studium.struktur) %> + <%= raw(@studium.jobmoeglichkeiten) %> +
    diff --git a/config/locales/studien_public.en.yml b/config/locales/studien_public.en.yml index d0c5e4b..d3e498e 100644 --- a/config/locales/studien_public.en.yml +++ b/config/locales/studien_public.en.yml @@ -30,4 +30,6 @@ en: desc: "Description" bspe: "Examples" home: - newexamples: "Newest Examples" \ No newline at end of file + newexamples: "Newest Examples" + modul: + depend: "Voraussetzungen" \ No newline at end of file diff --git a/config/tinymce.yml b/config/tinymce.yml index a628a08..d954a02 100755 --- a/config/tinymce.yml +++ b/config/tinymce.yml @@ -40,6 +40,9 @@ inline_simple: toolbar: - undo redo menubar: false + setup: function(ed) { + ed.on('NodeChange',function(){$($("#"+ed.id).attr("data-target")).val(this.getContent())}) + } inline_div: selector: "div.editable" inline: true