diff --git a/.geanyprojekt b/.geanyprojekt index abc039c..cd9ac3d 100644 --- a/.geanyprojekt +++ b/.geanyprojekt @@ -23,38 +23,46 @@ long_line_behaviour=1 long_line_column=72 [files] -current_page=1 +current_page=31 FILE_NAME_0=29;HTML;0;16;1;1;0;%2Fhome%2Fandreas%2Fwww%2Ffetsite%2Fapp%2Fviews%2Fcalendars%2Fshow.html.erb;0;4 -FILE_NAME_1=58;HTML;0;16;1;1;0;%2Fhome%2Fandreas%2Fwww%2Ffetsite%2Fapp%2Fviews%2Fcalendars%2F_tabs.html.erb;0;4 +FILE_NAME_1=573;HTML;0;16;1;1;0;%2Fhome%2Fandreas%2Fwww%2Ffetsite%2Fapp%2Fviews%2Fcalendars%2F_tabs.html.erb;0;4 FILE_NAME_2=1179;Ruby;0;16;1;1;0;%2Fhome%2Fandreas%2Fwww%2Ffetsite%2Fapp%2Fmodels%2Fability.rb;0;4 FILE_NAME_3=115;None;0;16;1;1;0;%2Fhome%2Fandreas%2Fwww%2Ffetsite%2Fapp%2Fviews%2Fcalendars%2Fshow.ics.erb;0;4 FILE_NAME_4=454;Ruby;0;16;1;1;0;%2Fhome%2Fandreas%2Fwww%2Ffetsite%2Fapp%2Fcontrollers%2Fusers_controller.rb;0;4 FILE_NAME_5=571;Ruby;0;16;1;1;0;%2Fhome%2Fandreas%2Fwww%2Ffetsite%2Fconfig%2Finitializers%2Fdevise.rb;0;4 -FILE_NAME_6=627;Ruby;0;16;1;1;0;%2Fhome%2Fandreas%2Fwww%2Ffetsite%2Fapp%2Fmodels%2Fneuigkeit.rb;0;4 -FILE_NAME_7=421;Ruby;0;16;1;1;0;%2Fhome%2Fandreas%2Fwww%2Ffetsite%2Fapp%2Fmodels%2Fmodulgruppe.rb;0;4 -FILE_NAME_8=0;Ruby;0;16;1;1;0;%2Fhome%2Fandreas%2Fwww%2Ffetsite%2Fapp%2Fmodels%2Flva.rb;0;4 -FILE_NAME_9=363;Ruby;0;16;1;1;0;%2Fhome%2Fandreas%2Fwww%2Ffetsite%2Fapp%2Fmodels%2Fthema.rb;0;4 -FILE_NAME_10=255;Ruby;0;16;1;1;0;%2Fhome%2Fandreas%2Fwww%2Ffetsite%2Fdb%2Fmigrate%2F20130124000300_translate_lvas.rb;0;4 -FILE_NAME_11=222;Ruby;0;16;1;1;0;%2Fhome%2Fandreas%2Fwww%2Ffetsite%2Fdb%2Fmigrate%2F20130818161841_translate_neuigkeiten.rb;0;4 -FILE_NAME_12=1383;Ruby;0;16;1;1;0;%2Fhome%2Fandreas%2Fwww%2Ffetsite%2Fconfig%2Finitializers%2Finflections.rb;0;4 -FILE_NAME_13=1010;Ruby;0;16;1;1;0;%2Fhome%2Fandreas%2Fwww%2Ffetsite%2Fdb%2Fmigrate%2F20130818175905_fix_translation_tables.rb;0;4 -FILE_NAME_14=615;Ruby;0;16;1;1;0;%2Fhome%2Fandreas%2Fwww%2Ffetsite%2Fdb%2Fmigrate%2F20130805171433_translate_themen.rb;0;4 -FILE_NAME_15=844;Ruby;0;16;1;1;0;%2Fhome%2Fandreas%2Fwww%2Ftmp%2Ffetsite%2Fdb%2Fmigrate%2F20130818175905_fix_translation_tables.rb;0;4 -FILE_NAME_16=114;Ruby;0;16;1;1;0;%2Fhome%2Fandreas%2Fwww%2Ftmp%2Ffetsite%2Fdb%2Fmigrate%2F20130805171433_translate_themen.rb;0;4 -FILE_NAME_17=191;Ruby;0;16;1;1;0;%2Fhome%2Fandreas%2Fwww%2Ftmp%2Ffetsite%2Fdb%2Fmigrate%2F20130805143719_create_themen.rb;0;4 -FILE_NAME_18=0;Ruby;0;16;1;1;0;%2Fhome%2Fandreas%2Fwww%2Ffetsite%2Fdb%2Fmigrate%2F20130112110800_create_semesters.rb;0;4 -FILE_NAME_19=0;Ruby;0;16;1;1;0;%2Fhome%2Fandreas%2Fwww%2Ffetsite%2Fdb%2Fmigrate%2F20130113160023_create_versions.rb;0;4 -FILE_NAME_20=0;HTML;0;16;1;1;0;%2Fhome%2Fandreas%2Fwww%2Ffetsite%2Fapp%2Fviews%2Frubriken%2Fshow.html.erb;0;4 -FILE_NAME_21=161;HTML;0;16;1;1;0;%2Fhome%2Fandreas%2Fwww%2Ffetsite%2Fapp%2Fviews%2Frubriken%2F_tabs.html.erb;0;4 -FILE_NAME_22=439;HTML;0;16;1;1;0;%2Fhome%2Fandreas%2Fwww%2Ffetsite%2Fapp%2Fviews%2Flayouts%2Fapplication.html.erb;0;4 -FILE_NAME_23=0;HTML;0;16;1;1;0;%2Fhome%2Fandreas%2Fwww%2Ffetsite%2Fapp%2Fviews%2Fusers%2Findex.html.erb;0;4 -FILE_NAME_24=3143;Ruby;0;16;1;1;0;%2Fhome%2Fandreas%2Fwww%2Ffetsite%2Fapp%2Fcontrollers%2Fmoduls_controller.rb;0;4 -FILE_NAME_25=0;Ruby;0;16;1;1;0;%2Fhome%2Fandreas%2Fwww%2Ffetsite%2Fapp%2Fcontrollers%2Fconfig_controller.rb;0;4 -FILE_NAME_26=0;Ruby;0;16;1;1;0;%2Fhome%2Fandreas%2Fwww%2Ffetsite%2Fapp%2Fcontrollers%2Fmodulgruppen_controller.rb;0;4 -FILE_NAME_27=783;HTML;0;16;1;1;0;%2Fhome%2Fandreas%2Fwww%2Ffetsite%2Fapp%2Fviews%2Flayouts%2Fmenu.html.erb;0;4 +FILE_NAME_6=883;Ruby;0;16;1;1;0;%2Fhome%2Fandreas%2Fwww%2Ffetsite%2Fapp%2Fmodels%2Fmodulgruppe.rb;0;4 +FILE_NAME_7=0;Ruby;0;16;1;1;0;%2Fhome%2Fandreas%2Fwww%2Ffetsite%2Fapp%2Fmodels%2Flva.rb;0;4 +FILE_NAME_8=363;Ruby;0;16;1;1;0;%2Fhome%2Fandreas%2Fwww%2Ffetsite%2Fapp%2Fmodels%2Fthema.rb;0;4 +FILE_NAME_9=255;Ruby;0;16;1;1;0;%2Fhome%2Fandreas%2Fwww%2Ffetsite%2Fdb%2Fmigrate%2F20130124000300_translate_lvas.rb;0;4 +FILE_NAME_10=222;Ruby;0;16;1;1;0;%2Fhome%2Fandreas%2Fwww%2Ffetsite%2Fdb%2Fmigrate%2F20130818161841_translate_neuigkeiten.rb;0;4 +FILE_NAME_11=1383;Ruby;0;16;1;1;0;%2Fhome%2Fandreas%2Fwww%2Ffetsite%2Fconfig%2Finitializers%2Finflections.rb;0;4 +FILE_NAME_12=1010;Ruby;0;16;1;1;0;%2Fhome%2Fandreas%2Fwww%2Ffetsite%2Fdb%2Fmigrate%2F20130818175905_fix_translation_tables.rb;0;4 +FILE_NAME_13=615;Ruby;0;16;1;1;0;%2Fhome%2Fandreas%2Fwww%2Ffetsite%2Fdb%2Fmigrate%2F20130805171433_translate_themen.rb;0;4 +FILE_NAME_14=844;Ruby;0;16;1;1;0;%2Fhome%2Fandreas%2Fwww%2Ftmp%2Ffetsite%2Fdb%2Fmigrate%2F20130818175905_fix_translation_tables.rb;0;4 +FILE_NAME_15=114;Ruby;0;16;1;1;0;%2Fhome%2Fandreas%2Fwww%2Ftmp%2Ffetsite%2Fdb%2Fmigrate%2F20130805171433_translate_themen.rb;0;4 +FILE_NAME_16=169;Ruby;0;16;1;1;0;%2Fhome%2Fandreas%2Fwww%2Ftmp%2Ffetsite%2Fdb%2Fmigrate%2F20130805143719_create_themen.rb;0;4 +FILE_NAME_17=0;Ruby;0;16;1;1;0;%2Fhome%2Fandreas%2Fwww%2Ffetsite%2Fdb%2Fmigrate%2F20130112110800_create_semesters.rb;0;4 +FILE_NAME_18=0;Ruby;0;16;1;1;0;%2Fhome%2Fandreas%2Fwww%2Ffetsite%2Fdb%2Fmigrate%2F20130113160023_create_versions.rb;0;4 +FILE_NAME_19=0;HTML;0;16;1;1;0;%2Fhome%2Fandreas%2Fwww%2Ffetsite%2Fapp%2Fviews%2Frubriken%2Fshow.html.erb;0;4 +FILE_NAME_20=161;HTML;0;16;1;1;0;%2Fhome%2Fandreas%2Fwww%2Ffetsite%2Fapp%2Fviews%2Frubriken%2F_tabs.html.erb;0;4 +FILE_NAME_21=439;HTML;0;16;1;1;0;%2Fhome%2Fandreas%2Fwww%2Ffetsite%2Fapp%2Fviews%2Flayouts%2Fapplication.html.erb;0;4 +FILE_NAME_22=0;HTML;0;16;1;1;0;%2Fhome%2Fandreas%2Fwww%2Ffetsite%2Fapp%2Fviews%2Fusers%2Findex.html.erb;0;4 +FILE_NAME_23=3143;Ruby;0;16;1;1;0;%2Fhome%2Fandreas%2Fwww%2Ffetsite%2Fapp%2Fcontrollers%2Fmoduls_controller.rb;0;4 +FILE_NAME_24=0;Ruby;0;16;1;1;0;%2Fhome%2Fandreas%2Fwww%2Ffetsite%2Fapp%2Fcontrollers%2Fconfig_controller.rb;0;4 +FILE_NAME_25=0;Ruby;0;16;1;1;0;%2Fhome%2Fandreas%2Fwww%2Ffetsite%2Fapp%2Fcontrollers%2Fmodulgruppen_controller.rb;0;4 +FILE_NAME_26=783;HTML;0;16;1;1;0;%2Fhome%2Fandreas%2Fwww%2Ffetsite%2Fapp%2Fviews%2Flayouts%2Fmenu.html.erb;0;4 +FILE_NAME_27=375;HTML;0;16;1;1;0;%2Fhome%2Fandreas%2Fwww%2Ffetsite%2Fapp%2Fviews%2Fneuigkeiten%2Fshow.html.erb;0;4 +FILE_NAME_28=1;HTML;0;16;1;1;0;%2Fhome%2Fandreas%2Fwww%2Ffetsite%2Fapp%2Fviews%2Fneuigkeiten%2F_neuigkeit.html.erb;0;4 +FILE_NAME_29=1;HTML;0;16;1;1;0;%2Fhome%2Fandreas%2Fwww%2Ffetsite%2Fapp%2Fviews%2Fstudien%2Fshow.html.erb;0;4 +FILE_NAME_30=658;Ruby;0;16;1;1;0;%2Fhome%2Fandreas%2Fwww%2Ffetsite%2Fapp%2Fmodels%2Fcalentry.rb;0;4 +FILE_NAME_31=218;Ruby;0;16;1;1;0;%2Fhome%2Fandreas%2Fwww%2Ffetsite%2Fdb%2Fmigrate%2F20130823084252_add_object_to_calentries.rb;0;4 +FILE_NAME_32=1069;HTML;0;16;1;1;0;%2Fhome%2Fandreas%2Fwww%2Ffetsite%2Fapp%2Fviews%2Ffetprofiles%2F_form.html.erb;0;4 +FILE_NAME_33=0;Ruby;0;16;1;1;0;%2Fhome%2Fandreas%2Fwww%2Ffetsite%2Fapp%2Fmodels%2Fbeispiel.rb;0;4 +FILE_NAME_34=0;Ruby;0;16;1;1;0;%2Fhome%2Fandreas%2Fwww%2Ffetsite%2Fapp%2Fmodels%2Fcalendar.rb;0;4 +FILE_NAME_35=477;Ruby;0;16;1;1;0;%2Fhome%2Fandreas%2Fwww%2Ffetsite%2Fapp%2Fmodels%2Frubrik.rb;0;4 [gproject] -source_patterns=*.rb;*.erb +source_patterns=*.rb;*.erb; header_patterns=*.h;*.H;*.hpp;*.hxx;*.h++;*.hh;*.m; ignored_dirs_patterns=.*;CVS; generate_tags=false diff --git a/.gitignore b/.gitignore index a978807..d88beef 100755 --- a/.gitignore +++ b/.gitignore @@ -6,7 +6,7 @@ # Ignore bundler config /.bundle - +*.*~ # Ignore the default SQLite database. /db/*.sqlite3 /db/schema.rb diff --git a/Gemfile b/Gemfile index 98dc781..7f63ecb 100755 --- a/Gemfile +++ b/Gemfile @@ -78,3 +78,6 @@ end gem "simple_calendar", "~> 0.1.9" gem 'rmagick' + +gem 'bootstrap-addons-rails' +gem "jquery-fileupload-rails" \ No newline at end of file diff --git a/Gemfile.lock b/Gemfile.lock index ff6d52b..797788d 100755 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -35,6 +35,8 @@ GEM activerecord (>= 3.0.0) bcrypt-ruby (3.0.1) bcrypt-ruby (3.0.1-x86-mingw32) + bootstrap-addons-rails (0.1.2) + rails bootstrap-sass (2.3.2.1) sass (~> 3.2) builder (3.0.4) @@ -80,6 +82,9 @@ GEM hike (1.2.1) i18n (0.6.1) journey (1.0.4) + jquery-fileupload-rails (0.4.1) + actionpack (>= 3.1) + railties (>= 3.1) jquery-rails (2.2.1) railties (>= 3.0, < 5.0) thor (>= 0.14, < 2.0) @@ -179,6 +184,7 @@ PLATFORMS DEPENDENCIES annotate (>= 2.5.0) awesome_nested_set + bootstrap-addons-rails bootstrap-sass (~> 2.3.2.1) cancan carrierwave @@ -191,6 +197,7 @@ DEPENDENCIES git globalize3 (~> 0.3.0) haml + jquery-fileupload-rails jquery-rails paper_trail (>= 2.7.0) paperclip (~> 3.4.0) diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 68c0b94..97ab022 100755 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -16,4 +16,8 @@ //= require_tree . //= require tinymce-jquery //= require bootstrap - +//= require bootstrap/colorpicker +//= require bootstrap/datepicker +//= require bootstrap/load-image.min +//= require bootstrap/image-gallery.min +//= require jquery-fileupload diff --git a/app/assets/stylesheets/application.css.scss b/app/assets/stylesheets/application.css.scss index bd9a219..194f5be 100755 --- a/app/assets/stylesheets/application.css.scss +++ b/app/assets/stylesheets/application.css.scss @@ -10,11 +10,16 @@ * *= require_self *= require_tree . + *= require jquery.fileupload-ui * require 'bootstrap' + */ $linkColor: #03006E; @import 'bootstrap'; @import 'bootstrap-responsive'; +@import 'bootstrap/image-gallery'; + + h1 {font-size: 23px} h2 diff --git a/app/assets/stylesheets/lvas.css.scss b/app/assets/stylesheets/lvas.css.scss index d9b9a12..3e95e92 100755 --- a/app/assets/stylesheets/lvas.css.scss +++ b/app/assets/stylesheets/lvas.css.scss @@ -4,7 +4,7 @@ div.lva-semester { border: solid; -border-width: 1px; +border-width: 0px; margin: 1px; padding: 5px; border-color: green; diff --git a/app/controllers/fotos_controller.rb b/app/controllers/fotos_controller.rb index 591bf1f..af920da 100644 --- a/app/controllers/fotos_controller.rb +++ b/app/controllers/fotos_controller.rb @@ -25,7 +25,8 @@ class FotosController < ApplicationController # GET /fotos/new.json def new @foto = Foto.new - + @gallery = Gallery.find_by_id(params[:gallery_id]) + @foto.gallery_id = @gallery.id respond_to do |format| format.html # new.html.erb format.json { render json: @foto } @@ -42,10 +43,17 @@ class FotosController < ApplicationController def create @foto = Foto.new(params[:foto]) + @foto.gallery_id = (params[:gallery_id]) + @gallery = @foto.gallery respond_to do |format| + @foto.title = @foto.datei.filename if @foto.save - format.html { redirect_to @foto, notice: 'Foto was successfully created.' } - format.json { render json: @foto, status: :created, location: @foto } + format.html { + render :json => [@foto.to_jq_upload].to_json, + :content_type => 'text/html', + :layout => false + } + format.json { render json: {files: [@foto.to_jq_upload]}, status: :created, location: [@gallery, @foto] } else format.html { render action: "new" } format.json { render json: @foto.errors, status: :unprocessable_entity } @@ -60,8 +68,12 @@ class FotosController < ApplicationController respond_to do |format| if @foto.update_attributes(params[:foto]) - format.html { redirect_to @foto, notice: 'Foto was successfully updated.' } - format.json { head :no_content } + format.html { + render :json => [@foto.to_jq_upload].to_json, + :content_type => 'text/html', + :layout => false + } + format.json { render json: {files: [@foto.to_jq_upload]}, status: :created, location: [@gallery, @foto] } else format.html { render action: "edit" } format.json { render json: @foto.errors, status: :unprocessable_entity } @@ -76,7 +88,7 @@ class FotosController < ApplicationController @foto.destroy respond_to do |format| - format.html { redirect_to fotos_url } + format.html { redirect_to galleries_url } format.json { head :no_content } end end diff --git a/app/controllers/galleries_controller.rb b/app/controllers/galleries_controller.rb index 8ebf183..b51e1f8 100644 --- a/app/controllers/galleries_controller.rb +++ b/app/controllers/galleries_controller.rb @@ -25,7 +25,7 @@ class GalleriesController < ApplicationController # GET /galleries/new.json def new @gallery = Gallery.new - + @foto = Foto.new respond_to do |format| format.html # new.html.erb format.json { render json: @gallery } @@ -41,7 +41,7 @@ class GalleriesController < ApplicationController # POST /galleries.json def create @gallery = Gallery.new(params[:gallery]) - + @foto = Foto.new respond_to do |format| if @gallery.save format.html { redirect_to @gallery, notice: 'Gallery was successfully created.' } @@ -57,7 +57,7 @@ class GalleriesController < ApplicationController # PUT /galleries/1.json def update @gallery = Gallery.find(params[:id]) - + @foto = Foto.new respond_to do |format| if @gallery.update_attributes(params[:gallery]) format.html { redirect_to @gallery, notice: 'Gallery was successfully updated.' } diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index 150a2c3..8c5379b 100755 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -7,4 +7,7 @@ class HomeController < ApplicationController def startdev render 'setup_fetsite_dev' end + def linksnotimplemented + render 'links_notimplemented' + end end diff --git a/app/controllers/lvas_controller.rb b/app/controllers/lvas_controller.rb index d2ee71f..7a2667c 100755 --- a/app/controllers/lvas_controller.rb +++ b/app/controllers/lvas_controller.rb @@ -16,6 +16,7 @@ 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)} + @toolbar_elements << {:hicon=>'icon-remove-circle', :text=>I18n.t('common.delete'), :path=> lva_path(@lva), :method=>:delete, :confirm=>"Sure?"} end # GET /lvas/new diff --git a/app/controllers/memberships_controller.rb b/app/controllers/memberships_controller.rb index fa9c90c..ae0383f 100644 --- a/app/controllers/memberships_controller.rb +++ b/app/controllers/memberships_controller.rb @@ -1,31 +1,9 @@ class MembershipsController < ApplicationController - # GET /memberships - # GET /memberships.json - def index - @memberships = Membership.all - - respond_to do |format| - format.html # index.html.erb - format.json { render json: @memberships } - end - end - - # GET /memberships/1 - # GET /memberships/1.json - def show - @membership = Membership.find(params[:id]) - - respond_to do |format| - format.html # show.html.erb - format.json { render json: @membership } - end - end - # GET /memberships/new # GET /memberships/new.json def new @membership = Membership.new - + @membership.fetprofile=Fetprofile.find(params[:fetprofile_id]) respond_to do |format| format.html # new.html.erb format.json { render json: @membership } @@ -44,8 +22,8 @@ class MembershipsController < ApplicationController respond_to do |format| if @membership.save - format.html { redirect_to @membership, notice: 'Membership was successfully created.' } - format.json { render json: @membership, status: :created, location: @membership } + format.html { redirect_to @membership.fetprofile, notice: 'Membership was successfully created.' } + format.json { render json: @membership.fetprofile, status: :created, location: @membership.fetprofile } else format.html { render action: "new" } format.json { render json: @membership.errors, status: :unprocessable_entity } @@ -60,7 +38,7 @@ class MembershipsController < ApplicationController respond_to do |format| if @membership.update_attributes(params[:membership]) - format.html { redirect_to @membership, notice: 'Membership was successfully updated.' } + format.html { redirect_to @membership.fetprofile, notice: 'Membership was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } @@ -73,10 +51,11 @@ class MembershipsController < ApplicationController # DELETE /memberships/1.json def destroy @membership = Membership.find(params[:id]) + fp = @membership.fetprofile @membership.destroy respond_to do |format| - format.html { redirect_to memberships_url } + format.html { redirect_to fp } format.json { head :no_content } end end diff --git a/app/controllers/studien_controller.rb b/app/controllers/studien_controller.rb index f5b9d63..f94a440 100755 --- a/app/controllers/studien_controller.rb +++ b/app/controllers/studien_controller.rb @@ -92,14 +92,16 @@ class StudienController < ApplicationController 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]} + @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], :lec_verw=>params[:lec_verw]} if @new_params.values.compact.empty? @studien=Studium.all @modulgruppen=Modulgruppe.all @module=Modul.all @lvas=Lva.all @beispiele=Beispiel.all + @lecturers=Lecturer.all else + if !@new_params[:std_verw].nil? @studien = [Studium.find(@new_params[:std_verw])] else @@ -144,7 +146,7 @@ class StudienController < ApplicationController @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 + temp = @lva.map{|x| x.moduls}.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)} @@ -157,6 +159,21 @@ class StudienController < ApplicationController temp = @lvas.map{|x| x.beispiele}.flatten.uniq # Force beispiel @beispiele=@beispiele.select{|k| temp.include?(k)} end + if !@new_params[:lec_verw].nil? + @lecturers=[Lecturer.find(@new_params[:lec_verw])] + temp = @lecturers.map{|x| x.lvas}.flatten.uniq #Force Force Lvas + @lvas=@lvas.select{|k| temp.include?(k)} + temp = @lvas.map{|x| x.modul}.flatten.uniq #Force Force Lvas + @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)} + temp = @lvas.map{|x| x.beispiele}.flatten.uniq # Force beispiel + @beispiele=@beispiele.select{|k| temp.include?(k)} + else + @lecturers = @lvas.map{|k| k.lecturers}.flatten.uniq + end end @messages = [] @@ -230,7 +247,9 @@ class StudienController < ApplicationController :mg_verw=> params[:mg_verw], :m_verw=>params[:m_verw], :lva_verw=>params[:lva_verw], - :b_verw=>params[:b_verw]}.merge(super) + :b_verw=>params[:b_verw], + :lec_verw=>params[:lec_verw]}.merge(super) + end end diff --git a/app/models/ability.rb b/app/models/ability.rb index 293df62..dd9aefd 100755 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- class Ability include CanCan::Ability def initialize(user) @@ -27,7 +28,7 @@ class Ability # For Debug allow everything # Remove this line in production environment and for testing user management - # can :manage, :all + can :manage, :all can :addfetuser, User can :addfetadmin, User can [:show, :index], Studium diff --git a/app/models/attachment.rb b/app/models/attachment.rb index fe3d597..f375f87 100644 --- a/app/models/attachment.rb +++ b/app/models/attachment.rb @@ -1,3 +1,14 @@ +# == Schema Information +# +# Table name: attachments +# +# id :integer not null, primary key +# name :string(255) +# created_at :datetime not null +# updated_at :datetime not null +# thema_id :integer +# + class Attachment < ActiveRecord::Base has_paper_trail attr_accessible :name diff --git a/app/models/beispiel.rb b/app/models/beispiel.rb index 2ad10de..d779617 100755 --- a/app/models/beispiel.rb +++ b/app/models/beispiel.rb @@ -2,16 +2,13 @@ # # Table name: beispiele # -# id :integer not null, primary key -# name :string(255) -# desc :text -# lva_id :integer -# created_at :datetime not null -# updated_at :datetime not null -# file_file_name :string(255) -# file_content_type :string(255) -# file_file_size :integer -# file_updated_at :datetime +# id :integer not null, primary key +# name :string(255) +# desc :text +# lva_id :integer +# created_at :datetime not null +# updated_at :datetime not null +# beispieldatei :string(255) # class Beispiel < ActiveRecord::Base diff --git a/app/models/calendar.rb b/app/models/calendar.rb index 5f317b1..92e6c15 100644 --- a/app/models/calendar.rb +++ b/app/models/calendar.rb @@ -1,3 +1,15 @@ +# == Schema Information +# +# Table name: calendars +# +# id :integer not null, primary key +# name :string(255) +# public :boolean +# created_at :datetime not null +# updated_at :datetime not null +# picture :string(255) +# + class Calendar < ActiveRecord::Base attr_accessible :name, :public, :picture has_and_belongs_to_many :calentries diff --git a/app/models/calentry.rb b/app/models/calentry.rb index d4c64bc..9dbc178 100644 --- a/app/models/calentry.rb +++ b/app/models/calentry.rb @@ -1,3 +1,16 @@ +# == Schema Information +# +# Table name: calentries +# +# id :integer not null, primary key +# start :datetime +# ende :datetime +# summary :string(255) +# typ :integer +# created_at :datetime not null +# updated_at :datetime not null +# + class Calentry < ActiveRecord::Base attr_accessible :ende, :start, :summary, :typ,:calendar_ids has_and_belongs_to_many :calendars @@ -8,6 +21,8 @@ class Calentry < ActiveRecord::Base errors.add(:ende, "Es muss ein Endzeitpunkt vorhanden sein") end end + belongs_to :object, polymorphic: true + resourcify def start_time start @@ -18,5 +33,5 @@ class Calentry < ActiveRecord::Base def name summary end - + scope :upcoming, -> { where("start >= ?" , Time.now).where("start <= ?", 8.days.from_now) } end diff --git a/app/models/fetprofile.rb b/app/models/fetprofile.rb index 34ae476..fba5c01 100644 --- a/app/models/fetprofile.rb +++ b/app/models/fetprofile.rb @@ -1,3 +1,26 @@ +# == Schema Information +# +# Table name: fetprofiles +# +# id :integer not null, primary key +# vorname :string(255) +# nachname :string(255) +# short :string(255) +# fetmailalias :string(255) +# desc :text +# picture :string(255) +# active :boolean +# created_at :datetime not null +# updated_at :datetime not null +# + class Fetprofile < ActiveRecord::Base attr_accessible :active, :desc, :fetmailalias, :nachname, :picture, :short, :vorname + has_many :memberships + has_many :gremien, :through=> :membership + mount_uploader :picture, PictureUploader + def name + [vorname, nachname, "(",short,")"].join(" ") + end + scope :active, -> { where(:active=>:true).order(:vorname) } end diff --git a/app/models/fetznedition.rb b/app/models/fetznedition.rb index ff3046d..54fda42 100644 --- a/app/models/fetznedition.rb +++ b/app/models/fetznedition.rb @@ -1,3 +1,16 @@ +# == Schema Information +# +# Table name: fetzneditions +# +# id :integer not null, primary key +# title :string(255) +# desc :text +# datum :date +# datei :string(255) +# created_at :datetime not null +# updated_at :datetime not null +# + class Fetznedition < ActiveRecord::Base attr_accessible :datei, :datum, :desc, :title end diff --git a/app/models/foto.rb b/app/models/foto.rb index 08a5d59..cbe9761 100644 --- a/app/models/foto.rb +++ b/app/models/foto.rb @@ -1,3 +1,31 @@ +# == Schema Information +# +# Table name: fotos +# +# id :integer not null, primary key +# title :string(255) +# desc :text +# gallery_id :integer +# datei :string(255) +# created_at :datetime not null +# updated_at :datetime not null +# + class Foto < ActiveRecord::Base attr_accessible :datei, :desc, :gallery_id, :title + belongs_to :gallery + mount_uploader :datei, FotoUploader + resourcify + def to_jq_upload + { + "id" => read_attribute(:id), + "title" => read_attribute(:title), + "description" => read_attribute(:desc), + "name" => read_attribute(:title), + "size" => datei.size, + "url" => datei.url, + "thumbnail_url" => datei.thumb.url, + "delete_type" => "DELETE" + } + end end diff --git a/app/models/frage.rb b/app/models/frage.rb index 0508fc2..beed787 100644 --- a/app/models/frage.rb +++ b/app/models/frage.rb @@ -1,3 +1,15 @@ +# == Schema Information +# +# Table name: fragen +# +# id :integer not null, primary key +# title :string(255) +# text :text +# created_at :datetime not null +# updated_at :datetime not null +# thema_id :integer +# + class Frage < ActiveRecord::Base attr_accessible :text, :title, :thema_id belongs_to :thema diff --git a/app/models/gallery.rb b/app/models/gallery.rb index 746a1d1..ac5e8c9 100644 --- a/app/models/gallery.rb +++ b/app/models/gallery.rb @@ -1,3 +1,16 @@ +# == Schema Information +# +# Table name: galleries +# +# id :integer not null, primary key +# name :string(255) +# desc :text +# datum :date +# created_at :datetime not null +# updated_at :datetime not null +# + class Gallery < ActiveRecord::Base attr_accessible :datum, :desc, :name + has_many :fotos end diff --git a/app/models/gremium.rb b/app/models/gremium.rb index 3c0bfae..2b0d20b 100644 --- a/app/models/gremium.rb +++ b/app/models/gremium.rb @@ -1,3 +1,16 @@ +# == Schema Information +# +# Table name: gremien +# +# id :integer not null, primary key +# name :string(255) +# desc :text +# typ :string(255) +# created_at :datetime not null +# updated_at :datetime not null +# + class Gremium < ActiveRecord::Base attr_accessible :desc, :name, :typ + has_many :memberships end diff --git a/app/models/lecturer.rb b/app/models/lecturer.rb index 773e2de..f860542 100644 --- a/app/models/lecturer.rb +++ b/app/models/lecturer.rb @@ -1,4 +1,19 @@ +# == Schema Information +# +# Table name: lecturers +# +# id :integer not null, primary key +# name :string(255) +# email :string(255) +# oid :integer +# picture :string(255) +# created_at :datetime not null +# updated_at :datetime not null +# + class Lecturer < ActiveRecord::Base - attr_accessible :email, :name, :oid, :picture, :lva_ids + attr_accessible :email, :name, :oid, :picture, :remove_picture, :picture_cache, :lva_ids, :link has_and_belongs_to_many :lvas + mount_uploader :picture, PictureUploader + resourcify end diff --git a/app/models/lva.rb b/app/models/lva.rb index 68cb831..a649467 100755 --- a/app/models/lva.rb +++ b/app/models/lva.rb @@ -1,4 +1,23 @@ # -*- coding: utf-8 -*- +# == Schema Information +# +# Table name: lvas +# +# id :integer not null, primary key +# name :string(255) +# desc :text +# ects :decimal(, ) +# lvanr :string(255) +# stunden :decimal(, ) +# created_at :datetime not null +# updated_at :datetime not null +# modul_id :integer +# semester_id :integer +# pruefungsinformation :text +# lernaufwand :text +# typ :string(255) +# + # == Schema Information # # Table name: lvas diff --git a/app/models/membership.rb b/app/models/membership.rb index 701d603..ad17ee4 100644 --- a/app/models/membership.rb +++ b/app/models/membership.rb @@ -1,3 +1,19 @@ +# == Schema Information +# +# Table name: memberships +# +# id :integer not null, primary key +# fetprofile_id :string(255) +# gremium_id :string(255) +# start :date +# stop :date +# typ :string(255) +# created_at :datetime not null +# updated_at :datetime not null +# + class Membership < ActiveRecord::Base attr_accessible :fetprofile_id, :gremium_id, :start, :stop, :typ + belongs_to :fetprofile + belongs_to :gremium end diff --git a/app/models/neuigkeit.rb b/app/models/neuigkeit.rb index e2b655e..45bd7f8 100755 --- a/app/models/neuigkeit.rb +++ b/app/models/neuigkeit.rb @@ -9,6 +9,7 @@ # rubrik_id :integer # created_at :datetime not null # updated_at :datetime not null +# author_id :integer # class Neuigkeit < ActiveRecord::Base @@ -19,4 +20,8 @@ class Neuigkeit < ActiveRecord::Base validates :rubrik, :presence=>true validates :author, :presence=>true translates :title,:text, :versioning=>true, :fallbacks_for_empty_translations => true + + scope :published, -> {where("datum >= ?", Time.now.to_date)} + scope :recent, -> { where("updated_at >= ? ",Time.now - 7.days)} + end diff --git a/app/models/semester.rb b/app/models/semester.rb index 913a370..2adb3aa 100755 --- a/app/models/semester.rb +++ b/app/models/semester.rb @@ -13,9 +13,23 @@ # class Semester < ActiveRecord::Base - attr_accessible :name, :nummer, :ssws, :lva_ids + attr_accessible :nummer, :ssws, :lva_ids has_and_belongs_to_many :lvas belongs_to :studium, :foreign_key => "studium_id" - validates :name, :presence => true validates :nummer, :presence => true + + def name + if self.nummer == 0 + return I18n.t("ohnezuordnung") + " (" + self.studium.name + ")" + else + return self.nummer.to_s + ". " + self.studium.name + end + end + def name_kurz + if self.nummer == 0 + return I18n.t("ohnezuordnung") + " (" + self.studium.abkuerzung + ")" + else + return self.nummer.to_s + ". " + self.studium.abkuerzung + end + end end diff --git a/app/models/studium.rb b/app/models/studium.rb index be8f3be..af783be 100755 --- a/app/models/studium.rb +++ b/app/models/studium.rb @@ -1,4 +1,19 @@ # -*- coding: utf-8 -*- +# == Schema Information +# +# Table name: studien +# +# id :integer not null, primary key +# zahl :string(255) +# name :string(255) +# shortdesc :text +# desc :text +# typ :string(255) +# created_at :datetime not null +# updated_at :datetime not null +# abkuerzung :string(255) +# + # == Schema Information # # Table name: studien diff --git a/app/models/thema.rb b/app/models/thema.rb index 64bdea9..5d5797b 100644 --- a/app/models/thema.rb +++ b/app/models/thema.rb @@ -1,3 +1,15 @@ +# == Schema Information +# +# Table name: themen +# +# id :integer not null, primary key +# title :string(255) +# text :text +# created_at :datetime not null +# updated_at :datetime not null +# themengruppe_id :integer +# + class Thema < ActiveRecord::Base attr_accessible :text, :title, :themengruppe_id has_many :fragen diff --git a/app/models/themengruppe.rb b/app/models/themengruppe.rb index 0966914..7cee6f8 100644 --- a/app/models/themengruppe.rb +++ b/app/models/themengruppe.rb @@ -1,3 +1,14 @@ +# == Schema Information +# +# Table name: themengruppen +# +# id :integer not null, primary key +# title :string(255) +# text :text +# created_at :datetime not null +# updated_at :datetime not null +# + class Themengruppe < ActiveRecord::Base WORD_COUNT = 50 attr_accessible :text, :title diff --git a/app/uploaders/foto_uploader.rb b/app/uploaders/foto_uploader.rb new file mode 100644 index 0000000..a47f073 --- /dev/null +++ b/app/uploaders/foto_uploader.rb @@ -0,0 +1,56 @@ +# encoding: utf-8 + +class FotoUploader < 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 + version :big_thumb do + process :resize_to_fill => [128, 128] + end + version :resized do + process :resize_to_fit => [1024, 1024] + 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 diff --git a/app/uploaders/picture_uploader.rb b/app/uploaders/picture_uploader.rb index ec0f27a..58d233a 100644 --- a/app/uploaders/picture_uploader.rb +++ b/app/uploaders/picture_uploader.rb @@ -36,6 +36,9 @@ class PictureUploader < CarrierWave::Uploader::Base process :resize_to_fill => [64, 64] end + version :portrait do + process :resize_to_fill => [128,192] + 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 diff --git a/app/views/calendars/index.html.erb b/app/views/calendars/index.html.erb index ad394cb..fd90c6c 100644 --- a/app/views/calendars/index.html.erb +++ b/app/views/calendars/index.html.erb @@ -1,28 +1,28 @@
| Vorname | -Nachname | -Short | -Fetmailalias | -Desc | -Picture | -Active | -- | - | - |
|---|---|---|---|---|---|---|---|---|---|
| <%= fetprofile.vorname %> | -<%= fetprofile.nachname %> | -<%= fetprofile.short %> | -<%= fetprofile.fetmailalias %> | -<%= fetprofile.desc %> | -<%= fetprofile.picture %> | -<%= fetprofile.active %> | -<%= link_to 'Show', fetprofile %> | -<%= link_to 'Edit', edit_fetprofile_path(fetprofile) %> | -<%= link_to 'Destroy', fetprofile, method: :delete, data: { confirm: 'Are you sure?' } %> | -
<%= notice %>
+- Vorname: - <%= @fetprofile.vorname %> -
- -- Nachname: - <%= @fetprofile.nachname %> -
- -- Short: - <%= @fetprofile.short %> -
- -- Fetmailalias: <%= @fetprofile.fetmailalias %>
-- Desc: <%= @fetprofile.desc %>
-- Picture: - <%= @fetprofile.picture %> + <%= "Aktiv".html_safe if @fetprofile.active %>
+<%= link_to 'Destroy', @fetprofile, method: :delete, data: { confirm: 'Are you sure?' } %>
+- Active: - <%= @fetprofile.active %> -
+<%= notice %>
-- Title: - <%= @foto.title %> -
+- Desc: - <%= @foto.desc %> -
+ +- Gallery: - <%= @foto.gallery_id %> -
+<%= @foto.desc %>
++ <%= link_to 'last' , gallery_foto_path(@foto.gallery, @foto.gallery.fotos[@foto.gallery.fotos.index(@foto)-1].try(:id).to_i) unless @foto.gallery.fotos.index(@foto)==0 %> + <%= link_to 'next' , gallery_foto_path(@foto.gallery, @foto.gallery.fotos[@foto.gallery.fotos.index(@foto)+1].try(:id).to_i) unless @foto.gallery.fotos[@foto.gallery.fotos.index(@foto)+1].nil? %> + <%= link_to 'Edit', edit_foto_path(@foto) %> | + <%= link_to 'Back', gallery_path(@foto.gallery) %> +
+<%= notice %>
+- Datei: - <%= @foto.datei %> -
- - -<%= link_to 'Edit', edit_foto_path(@foto) %> | -<%= link_to 'Back', fotos_path %> diff --git a/app/views/galleries/show.html.erb b/app/views/galleries/show.html.erb index 2fa130b..052f027 100644 --- a/app/views/galleries/show.html.erb +++ b/app/views/galleries/show.html.erb @@ -1,3 +1,4 @@ +<%= notice %>
@@ -14,7 +15,35 @@ Datum: <%= @gallery.datum %>
+ + + +sudo apt-get install git git-cola-Repository auf Github forken und dann auf dem Rechner clonen. +Repository auf Github forken und dann auf dem Rechner clonen. +Den folgenden Befehl im Verzeichnis in das gekont werden soll ausführen.
git clone https://github.com//fetsite
sudo update-alternatives --config rubyüberprüfen, dass Ruby 1.9 verwendet wird.
sudo apt-get install rubygems1.9+Im angelegten Verzeichnis den bundle installer ausführen.
sudo gem install bundlerImageMagick,sqlite3 installieren
sudo apt-get install libmagickwand-dev libsqlite3-dev nodejsdiff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 81c8440..774d3c9 100755 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -5,9 +5,14 @@
+ + <%= image_tag(@lecturer.picture.thumb.url) unless @lecturer.picture.nil? %> + <%= f.file_field :picture %> + <%= f.hidden_field :picture_cache %> +
++ +
+<%= notice %>
- -<%= render @neuigkeit %> -- Datum: - <%= @neuigkeit.datum %> -
+<%= notice %>
++ <%= @neuigkeit.try(:author).email.to_s %> am + <%= I18n.l @neuigkeit.datum.to_date %>
+
<%= "FOTO" %>