diff --git a/.gitignore b/.gitignore index 271cf26..987aa9b 100755 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ /config/omniauth_secrets.yml /config/database.yml /config/initializers/omniauth_secrets.rb +/config/databas* # See http://help.github.com/ignore-files/ for more about ignoring files. # # If you find yourself ignoring temporary files generated by your text editor @@ -33,3 +34,4 @@ console /bak/* *# Gemfile.lock +/config/database.yml diff --git a/Gemfile b/Gemfile index ec3165b..2ab6deb 100755 --- a/Gemfile +++ b/Gemfile @@ -45,7 +45,7 @@ gem 'jquery-rails' gem 'formtastic', '~>2.2.1' gem 'formtastic-bootstrap', '~>2.1.3' #, :git => "git://github.com/mjbellantoni/formtastic-bootstrap.git" # TinyMCE -gem "tinymce-rails" , '~>3.5.8' +gem "tinymce-rails" , '~>4.1.0' # Internationalisierung #gem "globalize3" ,'~>3.0.4' @@ -60,9 +60,10 @@ gem "omniauth" gem "omniauth-facebook" gem "omniauth-ldap" +gem "fb_graph" + # Roles for users gem "rolify" - # Abilities gem "cancan" @@ -72,8 +73,9 @@ gem 'paperclip' ,'~>3.4.0' gem 'git' gem 'haml' -#gem 'RedCloth' -#gem 'gollum' +gem 'RedCloth' +gem 'wikicloth' +gem 'gollum-lib' gem 'awesome_nested_set' gem 'annotate', ">=2.5.0" gem 'carrierwave', "~>0.9.0" @@ -89,9 +91,13 @@ gem 'bootstrap-addons-rails' gem "jquery-fileupload-rails" gem "jquery-ui-rails","~> 4.1.1" gem "font-awesome-rails" +gem "jquery-datetimepicker-rails" # gem "jquery-sortable-rails" gem "seed_dump", "~> 0.5.3" #gem "themes_for_rails" ,:git =>'git://github.com/tkriplean/themes_for_rails.git' #gem "themes_for_rails", :git=> 'git://github.com/lucasefe/themes_for_rails.git' gem 'themes_for_rails' +gem 'rubyzip' + +gem 'acts_as_votable' \ No newline at end of file diff --git a/Gemfile.lock b/Gemfile.lock index 5267261..ac311a3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -9,6 +9,7 @@ GIT GEM remote: https://rubygems.org/ specs: + RedCloth (4.2.9) actionmailer (3.2.13) actionpack (= 3.2.13) mail (~> 2.5.3) @@ -40,6 +41,7 @@ GEM activerecord (>= 2.3.0) rake (>= 0.8.7) arel (3.0.3) + attr_required (1.0.0) awesome_nested_set (2.1.6) activerecord (>= 3.0.0) bcrypt-ruby (3.1.2) @@ -53,6 +55,7 @@ GEM activemodel (>= 3.2.0) activesupport (>= 3.2.0) json (>= 1.7) + charlock_holmes (0.6.9.4) climate_control (0.0.3) activesupport (>= 3.0) cocaine (0.5.3) @@ -73,6 +76,7 @@ GEM erubis (2.7.0) execjs (1.4.0) multi_json (~> 1.0) + expression_parser (0.9.0) factory_girl (4.3.0) activesupport (>= 3.0.0) factory_girl_rails (4.3.0) @@ -80,6 +84,11 @@ GEM railties (>= 3.0.0) faraday (0.8.8) multipart-post (~> 1.2.0) + fb_graph (2.7.15) + httpclient (>= 2.2.0.2) + multi_json (>= 1.3) + rack-oauth2 (>= 0.14.4) + tzinfo font-awesome-rails (4.0.3.1) railties (>= 3.2, < 5.0) formtastic (2.2.1) @@ -87,19 +96,34 @@ GEM formtastic-bootstrap (2.1.3) formtastic (~> 2.2) git (1.2.6) + github-markup (0.7.5) + gitlab-grit (2.6.0) + charlock_holmes (~> 0.6.9) + diff-lcs (~> 1.1) + mime-types (~> 1.15) + posix-spawn (~> 0.3.6) globalize (3.0.4) activemodel (>= 3.0.0, < 4.0.0) activerecord (>= 3.0.0, < 4.0.0) globalize-versioning (0.1.0.alpha.1) globalize (>= 3, < 5) paper_trail (~> 3.0.0) + gollum-lib (2.0.0) + github-markup (>= 0.7.5, < 1.0.0) + gitlab-grit (= 2.6.0) + nokogiri (~> 1.6.0) + rouge (~> 1.3.1) + sanitize (~> 2.0.6) + stringex (~> 2.1.0) haml (4.0.5) tilt hashie (2.0.5) hike (1.2.3) httpauth (0.2.0) + httpclient (2.4.0) i18n (0.6.1) journey (1.0.4) + jquery-datetimepicker-rails (2.2.5.0) jquery-fileupload-rails (0.4.1) actionpack (>= 3.1) railties (>= 3.1) @@ -150,10 +174,17 @@ GEM cocaine (~> 0.5.0) mime-types polyglot (0.3.3) + posix-spawn (0.3.8) pyu-ruby-sasl (0.0.3.3) rack (1.4.5) rack-cache (1.2) rack (>= 0.4) + rack-oauth2 (1.0.8) + activesupport (>= 2.3) + attr_required (>= 0.0.5) + httpclient (>= 2.2.0.2) + multi_json (>= 1.3.6) + rack (>= 1.1) rack-ssl (1.3.3) rack rack-test (0.6.2) @@ -177,8 +208,10 @@ GEM rdoc (3.12.2) json (~> 1.4) ref (1.0.5) + rinku (1.7.3) rmagick (2.13.2) rolify (3.2.0) + rouge (1.3.4) rspec-core (2.14.7) rspec-expectations (2.14.4) diff-lcs (>= 1.1.3, < 2.0) @@ -208,6 +241,7 @@ GEM rack (~> 1.0) tilt (~> 1.1, != 1.3.0) sqlite3 (1.3.8) + stringex (2.1.2) themes_for_rails (0.5.1) rails (>= 3.0.0) therubyracer (0.12.0) @@ -215,7 +249,7 @@ GEM ref thor (0.18.1) tilt (1.4.1) - tinymce-rails (3.5.8) + tinymce-rails (4.1.0) railties (>= 3.1.1) treetop (1.4.15) polyglot @@ -226,11 +260,17 @@ GEM json (>= 1.8.0) warden (1.2.3) rack (>= 1.0) + webrick (1.3.1) + wikicloth (0.8.1) + builder + expression_parser + rinku PLATFORMS ruby DEPENDENCIES + RedCloth annotate (>= 2.5.0) awesome_nested_set bootstrap-addons-rails @@ -241,13 +281,16 @@ DEPENDENCIES devise (~> 2.2.3) execjs (~> 1.4.0) factory_girl_rails + fb_graph font-awesome-rails formtastic (~> 2.2.1) formtastic-bootstrap (~> 2.1.3) git globalize (~> 3.0.4) globalize-versioning + gollum-lib haml + jquery-datetimepicker-rails jquery-fileupload-rails jquery-rails jquery-ui-rails (~> 4.1.1) @@ -269,5 +312,7 @@ DEPENDENCIES sqlite3 themes_for_rails therubyracer - tinymce-rails (~> 3.5.8) + tinymce-rails (~> 4.1.0) uglifier (>= 1.0.3) + webrick (= 1.3.1) + wikicloth diff --git a/app/assets/fonts/flatfeticon.eot b/app/assets/fonts/flatfeticon.eot new file mode 100644 index 0000000..efcb7d2 Binary files /dev/null and b/app/assets/fonts/flatfeticon.eot differ diff --git a/app/assets/fonts/flatfeticon.svg b/app/assets/fonts/flatfeticon.svg new file mode 100644 index 0000000..ce499b4 --- /dev/null +++ b/app/assets/fonts/flatfeticon.svg @@ -0,0 +1,3 @@ + + + diff --git a/app/assets/fonts/flatfeticon.ttf b/app/assets/fonts/flatfeticon.ttf new file mode 100644 index 0000000..957497d Binary files /dev/null and b/app/assets/fonts/flatfeticon.ttf differ diff --git a/app/assets/fonts/flatfeticon.woff b/app/assets/fonts/flatfeticon.woff new file mode 100644 index 0000000..e70424b Binary files /dev/null and b/app/assets/fonts/flatfeticon.woff differ diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 50fb36d..f15c483 100755 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -26,24 +26,18 @@ //= require bootstrap/image-gallery.min //= require jquery-fileupload // require jquery.remotipart +//= require jquery.datetimepicker + function insertAttachment(url,name) { var ext = url.split('.').pop().toLowerCase(); var img_ext = [ "jpg", "png", "bmp" , "jpeg" ]; - - // if ( img_ext.indexOf(ext) > -1) { -// tinymce.activeEditor.setContent(tinymce.activeEditor.getContent({format : 'raw'}) + ""); -// } -// else { -// tinymce.activeEditor.setContent(tinymce.activeEditor.getContent({format : 'raw'}) + "" + name +""); -// } - - if ( img_ext.indexOf(ext) > -1) { tinymce.activeEditor.execCommand('mceInsertContent', false, ""); } else { tinymce.activeEditor.execCommand('mceInsertContent', false, "" + name +""); } - - +} +function insertIcon_ffi1(name) { + tinymce.activeEditor.execCommand('mceInsertContent',false,'  ') } diff --git a/app/assets/stylesheets/application.css.scss b/app/assets/stylesheets/application.css.scss index 9cd5a40..65e39bf 100755 --- a/app/assets/stylesheets/application.css.scss +++ b/app/assets/stylesheets/application.css.scss @@ -14,7 +14,7 @@ *= require 'calendars' *= require jquery.fileupload-ui * require 'bootstrap' - + *= require 'tinymce' */ // Colorshema #0A64A4 diff --git a/app/assets/stylesheets/flatfeticon1.css.scss b/app/assets/stylesheets/flatfeticon1.css.scss new file mode 100644 index 0000000..08ea9d3 --- /dev/null +++ b/app/assets/stylesheets/flatfeticon1.css.scss @@ -0,0 +1,786 @@ +@font-face { + font-family: "ffi1"; + src: url("/assets/flatfeticon.eot"); + src: url("/assets/flatfeticon.eot#iefix") format("embedded-opentype"), + url("/assets/flatfeticon.woff") format("woff"), + url("/assets/flatfeticon.ttf") format("truetype"), + url("/assets/flatfeticon.svg") format("svg"); + font-weight: normal; + font-style: normal; +} +[class^="ffi1-"]:before, [class*=" ffi1-"]:before, +[class^="ffi1-"]:after, [class*=" ffi1-"]:after { + font-family: ffi1; + font-style: normal; + margin-left: 4px; + font-weight:normal; +} + +.ffi1-academic:before { + content: "\e000"; +} +.ffi1-apple:before { + content: "\e001"; +} +.ffi1-auricular6:before { + content: "\e002"; +} +.ffi1-bag2:before { + content: "\e003"; +} +.ffi1-bald34:before { + content: "\e004"; +} +.ffi1-balloons2:before { + content: "\e005"; +} +.ffi1-banes:before { + content: "\e006"; +} +.ffi1-bar1:before { + content: "\e007"; +} +.ffi1-black268:before { + content: "\e008"; +} +.ffi1-book119:before { + content: "\e009"; +} +.ffi1-book135:before { + content: "\e00a"; +} +.ffi1-book137:before { + content: "\e00b"; +} +.ffi1-book139:before { + content: "\e00c"; +} +.ffi1-books17:before { + content: "\e00d"; +} +.ffi1-books19:before { + content: "\e00e"; +} +.ffi1-books20:before { + content: "\e00f"; +} +.ffi1-books30:before { + content: "\e010"; +} +.ffi1-books8:before { + content: "\e011"; +} +.ffi1-boy21:before { + content: "\e012"; +} +.ffi1-bricks2:before { + content: "\e013"; +} +.ffi1-briefcase32:before { + content: "\e014"; +} +.ffi1-businessman216:before { + content: "\e015"; +} +.ffi1-businessman217:before { + content: "\e016"; +} +.ffi1-businessman56:before { + content: "\e017"; +} +.ffi1-businessman65:before { + content: "\e018"; +} +.ffi1-businessmen32:before { + content: "\e019"; +} +.ffi1-calculator40:before { + content: "\e01a"; +} +.ffi1-calendar130:before { + content: "\e01b"; +} +.ffi1-call36:before { + content: "\e01c"; +} +.ffi1-call7:before { + content: "\e01d"; +} +.ffi1-candy1:before { + content: "\e01e"; +} +.ffi1-candy10:before { + content: "\e01f"; +} +.ffi1-career:before { + content: "\e020"; +} +.ffi1-certificate2:before { + content: "\e021"; +} +.ffi1-checkboxmark:before { + content: "\e022"; +} +.ffi1-chemistry:before { + content: "\e023"; +} +.ffi1-chemistry1:before { + content: "\e024"; +} +.ffi1-circular114:before { + content: "\e025"; +} +.ffi1-circular116:before { + content: "\e026"; +} +.ffi1-class6:before { + content: "\e027"; +} +.ffi1-classroom:before { + content: "\e028"; +} +.ffi1-cleaning1:before { + content: "\e029"; +} +.ffi1-clipboard44:before { + content: "\e02a"; +} +.ffi1-close13:before { + content: "\e02b"; +} +.ffi1-cocktail15:before { + content: "\e02c"; +} +.ffi1-cocktail7:before { + content: "\e02d"; +} +.ffi1-coffee20:before { + content: "\e02e"; +} +.ffi1-coins24:before { + content: "\e02f"; +} +.ffi1-colors3:before { + content: "\e030"; +} +.ffi1-comfortable:before { + content: "\e031"; +} +.ffi1-comments16:before { + content: "\e032"; +} +.ffi1-compass58:before { + content: "\e033"; +} +.ffi1-computer135:before { + content: "\e034"; +} +.ffi1-computer136:before { + content: "\e035"; +} +.ffi1-computers:before { + content: "\e036"; +} +.ffi1-connected20:before { + content: "\e037"; +} +.ffi1-contacts1:before { + content: "\e038"; +} +.ffi1-copy12:before { + content: "\e039"; +} +.ffi1-croissant1:before { + content: "\e03a"; +} +.ffi1-data39:before { + content: "\e03b"; +} +.ffi1-data45:before { + content: "\e03c"; +} +.ffi1-delivered:before { + content: "\e03d"; +} +.ffi1-delivery35:before { + content: "\e03e"; +} +.ffi1-descendant1:before { + content: "\e03f"; +} +.ffi1-diploma:before { + content: "\e040"; +} +.ffi1-dislike:before { + content: "\e041"; +} +.ffi1-dna9:before { + content: "\e042"; +} +.ffi1-domain1:before { + content: "\e043"; +} +.ffi1-drink24:before { + content: "\e044"; +} +.ffi1-dwelling1:before { + content: "\e045"; +} +.ffi1-earth23:before { + content: "\e046"; +} +.ffi1-ecological2:before { + content: "\e047"; +} +.ffi1-edit12:before { + content: "\e048"; +} +.ffi1-education14:before { + content: "\e049"; +} +.ffi1-education17:before { + content: "\e04a"; +} +.ffi1-education20:before { + content: "\e04b"; +} +.ffi1-educational8:before { + content: "\e04c"; +} +.ffi1-educative1:before { + content: "\e04d"; +} +.ffi1-electric6:before { + content: "\e04e"; +} +.ffi1-electrical7:before { + content: "\e04f"; +} +.ffi1-electronic32:before { + content: "\e050"; +} +.ffi1-electronic51:before { + content: "\e051"; +} +.ffi1-elegant8:before { + content: "\e052"; +} +.ffi1-email20:before { + content: "\e053"; +} +.ffi1-facebook1:before { + content: "\e054"; +} +.ffi1-facebook30:before { + content: "\e055"; +} +.ffi1-female188:before { + content: "\e056"; +} +.ffi1-female189:before { + content: "\e057"; +} +.ffi1-female218:before { + content: "\e058"; +} +.ffi1-food23:before { + content: "\e059"; +} +.ffi1-fork27:before { + content: "\e05a"; +} +.ffi1-gears3:before { + content: "\e05b"; +} +.ffi1-gingerbread:before { + content: "\e05c"; +} +.ffi1-girl16:before { + content: "\e05d"; +} +.ffi1-glass15:before { + content: "\e05e"; +} +.ffi1-good2:before { + content: "\e05f"; +} +.ffi1-graduate11:before { + content: "\e060"; +} +.ffi1-graduate8:before { + content: "\e061"; +} +.ffi1-graduate9:before { + content: "\e062"; +} +.ffi1-graduates2:before { + content: "\e063"; +} +.ffi1-graduation20:before { + content: "\e064"; +} +.ffi1-graduation25:before { + content: "\e065"; +} +.ffi1-grocery10:before { + content: "\e066"; +} +.ffi1-halloween10:before { + content: "\e067"; +} +.ffi1-hammer7:before { + content: "\e068"; +} +.ffi1-hand132:before { + content: "\e069"; +} +.ffi1-handbag6:before { + content: "\e06a"; +} +.ffi1-hands-shake:before { + content: "\e06b"; +} +.ffi1-handshake1:before { + content: "\e06c"; +} +.ffi1-hardbound:before { + content: "\e06d"; +} +.ffi1-head21:before { + content: "\e06e"; +} +.ffi1-hierarchical:before { + content: "\e06f"; +} +.ffi1-homework:before { + content: "\e070"; +} +.ffi1-hot31:before { + content: "\e071"; +} +.ffi1-hot50:before { + content: "\e072"; +} +.ffi1-house25:before { + content: "\e073"; +} +.ffi1-important:before { + content: "\e074"; +} +.ffi1-index3:before { + content: "\e075"; +} +.ffi1-instructor:before { + content: "\e076"; +} +.ffi1-italian1:before { + content: "\e077"; +} +.ffi1-job:before { + content: "\e078"; +} +.ffi1-judge:before { + content: "\e079"; +} +.ffi1-keys:before { + content: "\e07a"; +} +.ffi1-kids1:before { + content: "\e07b"; +} +.ffi1-kindergarden:before { + content: "\e07c"; +} +.ffi1-laptop88:before { + content: "\e07d"; +} +.ffi1-lecture1:before { + content: "\e07e"; +} +.ffi1-lecture2:before { + content: "\e07f"; +} +.ffi1-like3:before { + content: "\e080"; +} +.ffi1-live2:before { + content: "\e081"; +} +.ffi1-magnifier12:before { + content: "\e082"; +} +.ffi1-magnifier13:before { + content: "\e083"; +} +.ffi1-male103:before { + content: "\e084"; +} +.ffi1-man183:before { + content: "\e085"; +} +.ffi1-man204:before { + content: "\e086"; +} +.ffi1-man315:before { + content: "\e087"; +} +.ffi1-man388:before { + content: "\e088"; +} +.ffi1-man397:before { + content: "\e089"; +} +.ffi1-man82:before { + content: "\e08a"; +} +.ffi1-men9:before { + content: "\e08b"; +} +.ffi1-milk8:before { + content: "\e08c"; +} +.ffi1-mirrors:before { + content: "\e08d"; +} +.ffi1-money13:before { + content: "\e08e"; +} +.ffi1-mop1:before { + content: "\e08f"; +} +.ffi1-mop2:before { + content: "\e090"; +} +.ffi1-movie19:before { + content: "\e091"; +} +.ffi1-multiple25:before { + content: "\e092"; +} +.ffi1-news:before { + content: "\e093"; +} +.ffi1-newspaper9:before { + content: "\e094"; +} +.ffi1-note20:before { + content: "\e095"; +} +.ffi1-open127:before { + content: "\e096"; +} +.ffi1-open135:before { + content: "\e097"; +} +.ffi1-open160:before { + content: "\e098"; +} +.ffi1-open161:before { + content: "\e099"; +} +.ffi1-owl10:before { + content: "\e09a"; +} +.ffi1-package8:before { + content: "\e09b"; +} +.ffi1-paperclip14:before { + content: "\e09c"; +} +.ffi1-party:before { + content: "\e09d"; +} +.ffi1-party1:before { + content: "\e09e"; +} +.ffi1-pen38:before { + content: "\e09f"; +} +.ffi1-pen39:before { + content: "\e0a0"; +} +.ffi1-pen43:before { + content: "\e0a1"; +} +.ffi1-pencil54:before { + content: "\e0a2"; +} +.ffi1-pencil66:before { + content: "\e0a3"; +} +.ffi1-pens:before { + content: "\e0a4"; +} +.ffi1-people30:before { + content: "\e0a5"; +} +.ffi1-personal5:before { + content: "\e0a6"; +} +.ffi1-persong:before { + content: "\e0a7"; +} +.ffi1-persons8:before { + content: "\e0a8"; +} +.ffi1-phone25:before { + content: "\e0a9"; +} +.ffi1-pie46:before { + content: "\e0aa"; +} +.ffi1-plate7:before { + content: "\e0ab"; +} +.ffi1-plug12:before { + content: "\e0ac"; +} +.ffi1-plugin:before { + content: "\e0ad"; +} +.ffi1-power20:before { + content: "\e0ae"; +} +.ffi1-power48:before { + content: "\e0af"; +} +.ffi1-printer11:before { + content: "\e0b0"; +} +.ffi1-printer70:before { + content: "\e0b1"; +} +.ffi1-professor17:before { + content: "\e0b2"; +} +.ffi1-professor4:before { + content: "\e0b3"; +} +.ffi1-professor5:before { + content: "\e0b4"; +} +.ffi1-professor7:before { + content: "\e0b5"; +} +.ffi1-pumpkin2:before { + content: "\e0b6"; +} +.ffi1-puzzle25:before { + content: "\e0b7"; +} +.ffi1-question41:before { + content: "\e0b8"; +} +.ffi1-question42:before { + content: "\e0b9"; +} +.ffi1-quiz:before { + content: "\e0ba"; +} +.ffi1-regular2:before { + content: "\e0bb"; +} +.ffi1-remove9:before { + content: "\e0bc"; +} +.ffi1-resistor1:before { + content: "\e0bd"; +} +.ffi1-ruler14:before { + content: "\e0be"; +} +.ffi1-running5:before { + content: "\e0bf"; +} +.ffi1-sandwich:before { + content: "\e0c0"; +} +.ffi1-scales2:before { + content: "\e0c1"; +} +.ffi1-school31:before { + content: "\e0c2"; +} +.ffi1-school35:before { + content: "\e0c3"; +} +.ffi1-school6:before { + content: "\e0c4"; +} +.ffi1-science2:before { + content: "\e0c5"; +} +.ffi1-scissors3:before { + content: "\e0c6"; +} +.ffi1-search4:before { + content: "\e0c7"; +} +.ffi1-search54:before { + content: "\e0c8"; +} +.ffi1-services:before { + content: "\e0c9"; +} +.ffi1-serving1:before { + content: "\e0ca"; +} +.ffi1-setting:before { + content: "\e0cb"; +} +.ffi1-sheep1:before { + content: "\e0cc"; +} +.ffi1-shop3:before { + content: "\e0cd"; +} +.ffi1-shopping66:before { + content: "\e0ce"; +} +.ffi1-shopping8:before { + content: "\e0cf"; +} +.ffi1-soccer32:before { + content: "\e0d0"; +} +.ffi1-social19:before { + content: "\e0d1"; +} +.ffi1-speech84:before { + content: "\e0d2"; +} +.ffi1-square74:before { + content: "\e0d3"; +} +.ffi1-stack21:before { + content: "\e0d4"; +} +.ffi1-stopwatch6:before { + content: "\e0d5"; +} +.ffi1-store:before { + content: "\e0d6"; +} +.ffi1-student13:before { + content: "\e0d7"; +} +.ffi1-student15:before { + content: "\e0d8"; +} +.ffi1-student40:before { + content: "\e0d9"; +} +.ffi1-students3:before { + content: "\e0da"; +} +.ffi1-students5:before { + content: "\e0db"; +} +.ffi1-students6:before { + content: "\e0dc"; +} +.ffi1-students7:before { + content: "\e0dd"; +} +.ffi1-sweet8:before { + content: "\e0de"; +} +.ffi1-tags2:before { + content: "\e0df"; +} +.ffi1-tags3:before { + content: "\e0e0"; +} +.ffi1-talking2:before { + content: "\e0e1"; +} +.ffi1-teacher12:before { + content: "\e0e2"; +} +.ffi1-teacher13:before { + content: "\e0e3"; +} +.ffi1-teacher4:before { + content: "\e0e4"; +} +.ffi1-teacher8:before { + content: "\e0e5"; +} +.ffi1-teacher9:before { + content: "\e0e6"; +} +.ffi1-test17:before { + content: "\e0e7"; +} +.ffi1-text87:before { + content: "\e0e8"; +} +.ffi1-textile:before { + content: "\e0e9"; +} +.ffi1-three115:before { + content: "\e0ea"; +} +.ffi1-thumb31:before { + content: "\e0eb"; +} +.ffi1-toilet1:before { + content: "\e0ec"; +} +.ffi1-tools:before { + content: "\e0ed"; +} +.ffi1-two174:before { + content: "\e0ee"; +} +.ffi1-two185:before { + content: "\e0ef"; +} +.ffi1-two28:before { + content: "\e0f0"; +} +.ffi1-users1:before { + content: "\e0f1"; +} +.ffi1-users2:before { + content: "\e0f2"; +} +.ffi1-users5:before { + content: "\e0f3"; +} +.ffi1-users6:before { + content: "\e0f4"; +} +.ffi1-verified9:before { + content: "\e0f5"; +} +.ffi1-view2:before { + content: "\e0f6"; +} +.ffi1-wifi10:before { + content: "\e0f7"; +} +.ffi1-wind15:before { + content: "\e0f8"; +} +.ffi1-winners2:before { + content: "\e0f9"; +} +.ffi1-woman83:before { + content: "\e0fa"; +} +.ffi1-worker12:before { + content: "\e0fb"; +} +.ffi1-worker2:before { + content: "\e0fc"; +} +.ffi1-worker4:before { + content: "\e0fd"; +} +.ffi1-workers:before { + content: "\e0fe"; +} +.ffi1-writing17:before { + content: "\e0ff"; +} diff --git a/app/assets/stylesheets/layout.css.scss b/app/assets/stylesheets/layout.css.scss index b9dcd60..039053b 100755 --- a/app/assets/stylesheets/layout.css.scss +++ b/app/assets/stylesheets/layout.css.scss @@ -15,11 +15,9 @@ a:hover { text-decoration:none; } - - - - - +@import 'tinymce'; +@import 'fetlogo'; +@import 'flatfeticon1'; @@ -34,15 +32,78 @@ a.linkbox, div.contentbox padding:5px; border-radius:$box-border-radius; border: $box-border; - background: $box-background; - + background: $box-background; } + a.linkbox:hover { box-shadow: 1px 1px 2px 2px lightgray; } +a.linkbox.color-1 +{ +color:$color_schema_1; +} +a.linkbox.color-2 +{ +color:$color_schema_2; +} +a.linkbox.color-3 +{ +color:$color_schema_3; +} +a.linkbox.color-4 +{ +color:$color_schema_4; +} +a.linkbox.color-5 +{ +color:$color_schema_5; +} + +a.color-1-dark +{ +color:$color_schema_1_dark; +} +a.color-2-dark +{ +color:$color_schema_2_dark; +} +a.color-3-dark +{ +color:$color_schema_3_dark; +} +a.color-4-dark +{ +color:$color_schema_4_dark; +} +a.color-5-dark +{ +color:$color_schema_5_dark; +} +a.color-1-dark:hover +{ +color:$color_schema_1; +} +a.color-2-dark:hover +{ +color:$color_schema_2; +} +a.color-3-dark:hover +{ +color:$color_schema_3; +} +a.color-4-dark:hover +{ +color:$color_schema_4; +} +a.color-5-dark:hover +{ +color:$color_schema_5; +} + + a.linkbox li { } @@ -90,4 +151,25 @@ div.smallspan { min-height:0; } +ul.linklist +{max-width:25em; +padding:0; +margin:0; +} +ul.linklist li{ +list-style:none; +maring-bottom:5px; +} +ul.linklist li a i{ +vertical-align:middle; +margin-right:6px; +font-size:2em;} +span.linklist a { + padding:5px; + border-radius:$box-border-radius; + border: $box-border; + background: $box-background; + display:block; + float:left; +} \ No newline at end of file diff --git a/app/assets/stylesheets/themengruppen.css.scss b/app/assets/stylesheets/themengruppen.css.scss index a6d8688..bbd0ddb 100644 --- a/app/assets/stylesheets/themengruppen.css.scss +++ b/app/assets/stylesheets/themengruppen.css.scss @@ -1,22 +1,17 @@ // Place all the styles related to the themengruppen controller here. // They will automatically be included in application.css. // You can use Sass (SCSS) here: http://sass-lang.com/ -div.themengruppe -{padding:10px; -margin:2px; -border-radius: 10px; -min-width:13em; -border: #91B4FF solid 0px; -height: 90% -} -a.themengruppe:hover -{ - box-shadow: 1px 1px 2px 2px lightgray; -} -a.themengruppe +div.sticker { - padding: 5px; - display:block; + width: 90%; + text-align: center; + padding: 5px +} +div.sticker-red +{ background: red; +} +div.sticker-yellow +{ background: yellow; } \ No newline at end of file diff --git a/app/assets/stylesheets/themes/2003/application.css.scss b/app/assets/stylesheets/themes/2003/application.css.scss index d45d70e..3583ed2 100755 --- a/app/assets/stylesheets/themes/2003/application.css.scss +++ b/app/assets/stylesheets/themes/2003/application.css.scss @@ -17,6 +17,19 @@ * require 'neuigkeiten' */ // Colorshema #0A64A4 +$color_schema_1: #006599; +$color_schema_2: #630CE8; +$color_schema_3: #FF0021; +$color_schema_4: #E8820C; +$color_schema_5: #FFF30D; + +$color_schema_1_dark: darken($color_schema_1, 10%); +$color_schema_2_dark: darken($color_schema_2, 10%); +$color_schema_3_dark: darken($color_schema_3, 10%); +$color_schema_4_dark: darken($color_schema_4, 10%); +$color_schema_5_dark: darken($color_schema_5, 10%); + + $color_prim: #7070a0; $color_prim_light: lighten($color_prim ,10%); $color_prim_vlight: lighten($color_prim ,30%); diff --git a/app/assets/stylesheets/themes/blue1/application.css.scss b/app/assets/stylesheets/themes/blue1/application.css.scss index fe7a383..a24cf52 100755 --- a/app/assets/stylesheets/themes/blue1/application.css.scss +++ b/app/assets/stylesheets/themes/blue1/application.css.scss @@ -12,20 +12,35 @@ *= require_self * require_tree . *= require jquery.fileupload-ui +*= require jquery.datetimepicker * require 'bootstrap' * require 'neuigkeiten' */ -// Colorshema #0A64A4 -$color_prim: #071672; + +$color_schema_1: #006599; +$color_schema_2: #630CE8; +$color_schema_3: #FF0021; +$color_schema_4: #E8820C; +$color_schema_5: #FFF30D; + +$color_schema_1_dark: darken($color_schema_1, 10%); +$color_schema_2_dark: darken($color_schema_2, 10%); +$color_schema_3_dark: darken($color_schema_3, 10%); +$color_schema_4_dark: darken($color_schema_4, 10%); +$color_schema_5_dark: darken($color_schema_5, 10%); + +$color_prim: $color_schema_1_dark; // #006599; //071672; + $color_prim_light: lighten($color_prim ,10%); $color_prim_vlight: lighten($color_prim ,30%); $color_prim_dark: darken($color_prim ,10%); $color_prim_vdark: darken($color_prim ,30%); -$color_cont: FFDB73; -$color_cont_light:FFDB73; +$color_cont: $color_schema_3; +$color_cont_light:lighten($color_cont ,10%); $linkColor: $color_prim; +$linkColorHover: $color_schema_1; $white: #FFFFFF; $bodyBackground: #EEE; @@ -36,7 +51,7 @@ $bodyBackground: #EEE; $navbarBackground: #EEE;//$color_prim; $navbarText: $color_prim; $navbarLinkColor: $color_prim; -$navbarLinkColorHover: $color_prim_dark; +$navbarLinkColorHover: $color_schema_1; $dropdownLinkColor: black; $navbar-default-brand-color: black; $navbarBrandColor:black; @@ -45,7 +60,7 @@ $navbarBrandColor:black; $navbarBackgroundHighlight: #EEE; //$navbarBackgroundHighlight:#FFFFFF; -$navbarLinkBackgroundHover:#FFBE00; + $navbarLinkBackgroundHover: darken($navbarBackground,10%); @@ -58,28 +73,26 @@ $sansFontFamily: Helvetica, Arial; @import 'bootstrap/image-gallery'; @import 'font-awesome'; @import 'neuigkeiten'; - +@import 'themengruppen'; div.header { display: block; // background: url('../../../../header1.png') no-repeat; // background-color:white;// $color_prim; // background-position: right; - + vertical-align:middle; float:left; color:#000; - padding-left:87px; padding-top:0px; - overflow:visible; -height:45px; + height:45px; margin-bottom: 0 px } div.header h1 { padding:0; -margin:4px; -font-size:20px; -line-height:32px; + margin:4px; + font-size:20px; + line-height:32px; } div.header img { //top:2px; @@ -90,7 +103,8 @@ border-bottom: $color_prim solid 3px; } div.headerrow { } - $contentdiv-background:none; + +$contentdiv-background:none; $navbar-li-minwidth: 0; @@ -98,5 +112,6 @@ $navbar-li-minwidth: 0; $box-border: lightgray solid 1px; $box-border-radius:0px; $box-background: white; + @import 'layout'; -@import 'calendars'; \ No newline at end of file +@import 'calendars'; diff --git a/app/assets/stylesheets/themes/darkblue/application.css.scss b/app/assets/stylesheets/themes/darkblue/application.css.scss index 5f5e261..e623f4e 100755 --- a/app/assets/stylesheets/themes/darkblue/application.css.scss +++ b/app/assets/stylesheets/themes/darkblue/application.css.scss @@ -16,6 +16,18 @@ * require 'neuigkeiten' */ +$color_schema_1: #006599; +$color_schema_2: #630CE8; +$color_schema_3: #FF0021; +$color_schema_4: #E8820C; +$color_schema_5: #FFF30D; + +$color_schema_1_dark: darken($color_schema_1, 10%); +$color_schema_2_dark: darken($color_schema_2, 10%); +$color_schema_3_dark: darken($color_schema_3, 10%); +$color_schema_4_dark: darken($color_schema_4, 10%); +$color_schema_5_dark: darken($color_schema_5, 10%); + // Colorshema #0A64A4 $color_prim: #071672; $color_prim_light: lighten($color_prim ,10%); @@ -77,7 +89,7 @@ $sansFontFamily: cmunrm, Helvetica, Arial; @import 'neuigkeiten'; @import 'fetlogo'; #menudiv { - font-family: ayuma2yk; + } div.header { diff --git a/app/assets/stylesheets/themes/white_1/application.css.scss b/app/assets/stylesheets/themes/white_1/application.css.scss index 8cbca33..22de038 100644 --- a/app/assets/stylesheets/themes/white_1/application.css.scss +++ b/app/assets/stylesheets/themes/white_1/application.css.scss @@ -17,6 +17,20 @@ * require 'neuigkeiten' */ + +$color_schema_1: #006599; +$color_schema_2: #630CE8; +$color_schema_3: #FF0021; +$color_schema_4: #E8820C; +$color_schema_5: #FFF30D; + +$color_schema_1_dark: darken($color_schema_1, 30%); +$color_schema_2_dark: darken($color_schema_2, 30%); +$color_schema_3_dark: darken($color_schema_3, 30%); +$color_schema_4_dark: darken($color_schema_4, 30%); +$color_schema_5_dark: darken($color_schema_5, 30%); + + $color_prim: #0A64A4; $color_prim_light: #0B65A5; $color_prim_vlight: #2B85C5; @@ -73,4 +87,5 @@ $box-border: lightgray solid 1px; $box-border-radius:8px; $box-background: white; @import 'layout'; -@import 'calendars'; \ No newline at end of file +@import 'calendars'; +@import 'tinymce'; \ No newline at end of file diff --git a/app/assets/stylesheets/tinymce.css.scss b/app/assets/stylesheets/tinymce.css.scss new file mode 100644 index 0000000..d6b224d --- /dev/null +++ b/app/assets/stylesheets/tinymce.css.scss @@ -0,0 +1,19 @@ +i.mce-i-fa { + font: 400 17px/1 FontAwesome; + padding: 0; + vertical-align: middle; + speak: none; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + margin-left: -2px; + padding-right: 2px +} +i.fa-red { color:red; } + +.mc-important { + color: red; + font-weight:bold; + text-align: center; +} + +@import 'flatfeticon1' \ No newline at end of file diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index cdd3a1f..1691fd0 100755 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -18,7 +18,7 @@ def get_theme params[:theme] else -"2003" +"blue1" end end def default_url_options diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index 4a37fb1..59ea3df 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -46,19 +46,29 @@ class AttachmentsController < ApplicationController # POST /attachments.json def create @attachment = Attachment.new(params[:attachment]) - @thema = Thema.find(params[:thema_id]) - @attachment.thema_id = @thema.id - @action="create" - logger.info "#{@attachment.inspect}" + @thema = Thema.find_by_id(params[:thema_id]) + # logger.info "gg" + @attachment.thema = @thema + @attachment.name=@attachment.datei.filename + @action="create" + + + # logger.info "sdf" respond_to do |format| - if @attachment.save - format.html { redirect_to @thema, notice: 'Attachment was successfully created.' } - format.json { render json: @thema, status: :created, location: @thema } - format.js { } + if @attachment.save + format.html { + render :json => [@attachment.to_jq_upload].to_json, + :content_type => 'text/html', + :layout => false + } + + # format.html { redirect_to @thema, notice: 'Attachment was successfully created.' } + format.json { render json: {files: [@attachment.to_jq_upload]}, status: :created, location: [@thema, @attachment]} + else format.html { render action: "new" } format.json { render json: @attachment.errors, status: :unprocessable_entity } - format.js { render action: "new.js.erb"} + end end end diff --git a/app/controllers/beispiele_controller.rb b/app/controllers/beispiele_controller.rb index 286e91e..647c45f 100755 --- a/app/controllers/beispiele_controller.rb +++ b/app/controllers/beispiele_controller.rb @@ -1,16 +1,17 @@ class BeispieleController < ApplicationController # GET /beispiele - # GET /beispiele.json + load_and_authorize_resource + include LikeVoteable def index @beispiele = Beispiel.all - + respond_to do |format| format.html # index.html.erb format.json { render json: @beispiele } end end - + # GET /beispiele/1 # GET /beispiele/1.json def show @@ -44,11 +45,11 @@ class BeispieleController < ApplicationController params.delete(:lva_id) @beispiel = Beispiel.new(params[:beispiel]) @beispiel.lva=@lva - logger.info "New Beispiel: #{params.inspect}" + logger.info "New Beispiel: #{params.inspect}" # @backlink = @beispiel.lva.nil? ? root_url : lva_path(@beispiel.lva) - @beispiel.name=@beispiel.beispieldatei.filename - logger.info "New Beispiel: #{@beispiel.attributes.inspect}" + @beispiel.name=@beispiel.beispieldatei.filename + logger.info "New Beispiel: #{@beispiel.attributes.inspect}" @beispiel.datum=Time.now respond_to do |format| @@ -91,7 +92,7 @@ class BeispieleController < ApplicationController # DELETE /beispiele/1.json def destroy @beispiel = Beispiel.find(params[:id]) - @backlink = @beispiel.lva.nil? ? root_url : lva_path(@beispiel.lva) + @backlink = @beispiel.lva.nil? ? root_url : lva_path(@beispiel.lva) @beispiel.destroy respond_to do |format| @@ -99,4 +100,4 @@ class BeispieleController < ApplicationController format.json { head :no_content } end end -end + end diff --git a/app/controllers/fetprofiles_controller.rb b/app/controllers/fetprofiles_controller.rb index ad61588..fc8e881 100644 --- a/app/controllers/fetprofiles_controller.rb +++ b/app/controllers/fetprofiles_controller.rb @@ -7,14 +7,19 @@ class FetprofilesController < ApplicationController @fetprofiles = Fetprofile.active.order(:vorname,:nachname) @fetprofiles = Fetprofile.order(:vorname,:nachname) if params[:filter]== "all" - @fetprofiles = Fetprofile.where(:active=>false).order(:vorname,:nachname) if params[:filter]== "notactive" + @fetprofiles = Fetprofile.where(:active=>false).order(:nachname,:vorname) if params[:filter]== "notactive" @gremientabs = Gremium.tabs + @toolbar_elements << {:hicon=>'icon-plus', :text=> I18n.t('profile.new_profile'),:path => new_fetprofile_path(@fetprofile) } if can? :new, @fetprofile + respond_to do |format| format.html # index.html.erb - format.json { render json: @fetprofiles } - end + end end + def internlist + @fetprofiles = Fetprofile.order(:vorname,:nachname) + end + # GET /fetprofiles/1 # GET /fetprofiles/1.json @@ -84,7 +89,18 @@ class FetprofilesController < ApplicationController respond_to do |format| if @fetprofile.update_attributes(params[:fetprofile]) - format.html { redirect_to @fetprofile, notice: 'Fetprofile was successfully updated.' } + format.html { + unless params[:button]=="continue" || params[:commit]=="continue" + + redirect_to @fetprofile, notice: 'profile was successfully updated.' + else + @memberships=@fetprofile.memberships.order(:typ) + @memberships<< Membership.new + @memberships<< Membership.new + @memberships<< Membership.new + render action: "edit", notice: 'profile was successfully updated.' + end + } format.json { head :no_content } else @memberships=@fetprofile.memberships.order(:typ) diff --git a/app/controllers/galleries_controller.rb b/app/controllers/galleries_controller.rb index 5906b5c..7745872 100644 --- a/app/controllers/galleries_controller.rb +++ b/app/controllers/galleries_controller.rb @@ -6,7 +6,7 @@ class GalleriesController < ApplicationController # GET /galleries.json def index @galleries = Gallery.all - @toolbar_elements << {:hicon => 'icon-plus', :text => I18n.t('fotos.new-gallery'), :path => new_gallery_path } + @toolbar_elements << {:hicon => 'icon-plus', :text => I18n.t('fotos.new-gallery'), :path => new_gallery_path } if can? :new, Gallery respond_to do |format| format.html # index.html.erb diff --git a/app/controllers/gremien_controller.rb b/app/controllers/gremien_controller.rb index 497163f..6612e8c 100644 --- a/app/controllers/gremien_controller.rb +++ b/app/controllers/gremien_controller.rb @@ -2,11 +2,13 @@ class GremienController < ApplicationController # GET /gremien # GET /gremien.json load_and_authorize_resource - before_filter {@toolbar_elements=[]} + before_filter {@toolbar_elements=[]} def verwalten @gremien = Gremium.all @gremientabs=Gremium.tabs @toolbar_elements << {:text=>I18n.t('gremium.new'),:path=>new_gremium_path() ,:icon=>:plus} if can? :new, Gremium + @toolbar_elements << {:text=>I18n.t('profile.new'),:path=>new_fetprofile_path() ,:icon=>:plus} if can? :new, Fetprofile + respond_to do |format| format.html # index.html.erb format.json { render json: @gremien } @@ -83,7 +85,17 @@ class GremienController < ApplicationController respond_to do |format| if @gremium.update_attributes(params[:gremium]) - format.html { redirect_to @gremium, notice: 'Gremium was successfully updated.' } + format.html { + unless params[:button]=="continue" || params[:commit]=="continue" + redirect_to @gremium, notice: 'Gremium was successfully updated.' + else + @memberships=@gremium.memberships.order(:typ) + @memberships<< Membership.new + @memberships<< Membership.new + @memberships<< Membership.new + render action: "edit", notice: 'gremium was successfully updated.' + end + } format.json { head :no_content } else format.html { render action: "edit" } @@ -93,7 +105,8 @@ class GremienController < ApplicationController end # DELETE /gremien/1 - # DELETE /gremien/1.json + # + # def destroy @gremium = Gremium.find(params[:id]) @gremium.destroy diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index ba318ee..516cabb 100755 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -12,7 +12,14 @@ class HomeController < ApplicationController def intern authorize! :seeintern, User @neuigkeiten = Neuigkeit.intern.recent + @themengruppen=Themengruppe.intern.order(:priority).reverse end + def admin + authorize! :doadmin, User + + + end + def startdev render 'setup_fetsite_dev' end @@ -20,10 +27,20 @@ class HomeController < ApplicationController render 'links_notimplemented' end def search + unless params['query'].nil? || params['query'].empty? - @neuigkeiten=Neuigkeit.search(params['query']) + if can?(:showintern, Neuigkeit) + @neuigkeiten=Neuigkeit.search(params['query']) + else + @neuigkeiten =Neuigkeit.search(params['query']).public + end @fetprofiles = Fetprofile.search(params['query']) - @themen=Thema.search(params['query']) + if can?(:showintern, Neuigkeit) + @themen=Thema.search(params['query']) + else + @themen=Thema.search(params['query']).public + end + else @neuigkeiten=[] @fetprofiles=[] diff --git a/app/controllers/lvas_controller.rb b/app/controllers/lvas_controller.rb index 8ad623e..5423e28 100755 --- a/app/controllers/lvas_controller.rb +++ b/app/controllers/lvas_controller.rb @@ -1,5 +1,6 @@ class LvasController < ApplicationController # GET /lvas + require 'zip' before_filter :load_toolbar, :only => [:show] load_and_authorize_resource def index @@ -9,7 +10,34 @@ class LvasController < ApplicationController {:hicon=>'icon-list', :text=>I18n.t("modul.list"),:path=>moduls_path}, {:hicon=>'icon-list', :text=>I18n.t("lva.list"),:path=>lvas_path}] end - + def beispiel_sammlung + @lva = Lva.find_by_id(params[:id]) + #Attachment name + filename = 'beispiel_sammlung_' + @lva.lvanr.to_s + '_' + l(Date.today).to_s + '.zip' + temp_file = Tempfile.new(filename) + begin + #This is the tricky part + #Initialize the temp file as a zip file + Zip::OutputStream.open(temp_file) { |zos| } + #Add files to the zip file as usual + Zip::File.open(temp_file.path, Zip::File::CREATE) do |zip| + #Put files in here + i=1 + @lva.beispiele.each do |bsp| + zip.add(i.to_s + '_' + File.basename(bsp.beispieldatei.current_path), bsp.beispieldatei.current_path) + i = i + 1 + end + + end + #Read the binary data from the file + zip_data = File.read(temp_file.path) + send_data(zip_data, :type => 'application/zip', :filename => filename) + ensure + #Close and delete the temp file + temp_file.close + temp_file.unlink + end + end # GET /lvas/1 def show @@ -89,7 +117,7 @@ private @toolbar_elements =[] @toolbar_elements<<{:hicon=>'icon-pencil', :icon=>:pencil,:text =>I18n.t('common.edit'),:path => edit_lva_path(@lva)} if can? :edit, @lva @toolbar_elements << {:hicon=>'icon-remove-circle', :text=>"Tissvergleichladen", :path=> compare_tiss_lva_path(@lva)} if can? :compare_tiss, @lva - @toolbar_elements << {:hicon=>'icon-remove-circle', :text=>I18n.t('common.delete'), :path=> lva_path(@lva), :method=>:delete, :confirm=>'Sure?' } if can? :delete, @lva + @toolbar_elements << {:hicon=>'icon-remove-circle', :text=>I18n.t('lva.delete'), :path=> lva_path(@lva), :method=>:delete, :confirm=>t('lva.deletesure') } if can? :delete, @lva diff --git a/app/controllers/neuigkeiten_controller.rb b/app/controllers/neuigkeiten_controller.rb index e3bc175..0af5eac 100755 --- a/app/controllers/neuigkeiten_controller.rb +++ b/app/controllers/neuigkeiten_controller.rb @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- class NeuigkeitenController < ApplicationController before_filter :load_toolbar_elements, :only=>[:show,:find_link] before_filter :load_toolbar_elements_edit, :only=>[:edit] @@ -35,7 +36,7 @@ class NeuigkeitenController < ApplicationController if params[:calentry_id].nil? ce = Calentry.new(:start=>Time.now, :ende=>1.hour.from_now, :typ=>1, :calendar=>@neuigkeit.rubrik.calendar) else - ce=Calentry.find(params[:calentry_id]) + ce = Calentry.find(params[:calentry_id]) end @calentry=ce ce.object=@neuigkeit @@ -61,9 +62,30 @@ class NeuigkeitenController < ApplicationController if params[:verwalten] redirect_to verwalten_rubrik_path(@neuigkeit.rubrik) end - redirect_to rubrik_neuigkeit_path(@neuigkeit.rubrik,@neuigkeit) + redirect_to rubrik_neuigkeit_path(@neuigkeit.rubrik,@neuigkeit) end - + def publish_to_facebook + @neuigkeit = Neuigkeit.find(params[:id]) + unless @neuigkeit.published? + redirect_to [@neuigkeit.rubrik,@neuigkeit], notice: 'Neuigkeit muss veröffentlicht sein um sie auf Facebook zu posten.' + else + page=YAML.load_file("#{::Rails.root.to_s}/tmp/page.yml") + page.feed!(:access_token=>page.access_token, :message=>@neuigkeit.text_first_words, :name=>@neuigkeit.title, :link=>rubrik_neuigkeit_url(@neuigkeit.rubrik, @neuigkeit)+".html", :picture=>@neuigkeit.picture.url) + + redirect_to [@neuigkeit.rubrik,@neuigkeit], notice: 'Neuigkeit auf Facebook gepostet' + end + end + def mail_to_fet + @neuigkeit = Neuigkeit.find(params[:id]) + authorize! :publish, @neuigkeit + unless @neuigkeit.published? + redirect_to [@neuigkeit.rubrik,@neuigkeit], notice: 'Neuigkeit muss veröffentlicht sein um sie als Mail zu versenden.' + else + NewsMailer.neuigkeit_mail(current_user.email, params[:id]).deliver + redirect_to [@neuigkeit.rubrik,@neuigkeit], notice: 'Neuigkeit versendet' + + end + end def edit @neuigkeit = Neuigkeit.find(params[:id]) @@ -137,9 +159,15 @@ private def load_toolbar_elements @neuigkeit=Neuigkeit.find(params[:id]) @toolbar_elements=[] - @toolbar_elements << {:hicon=>'icon-plus', :text=> I18n.t('neuigkeit.publish'),:path => publish_rubrik_neuigkeit_path(@neuigkeit.rubrik,@neuigkeit),:confirm=>'Sure?' } if can?(:publish, @neuigkeit) && @neuigkeit.published? - @toolbar_elements << {:hicon=>'icon-minus', :text=> I18n.t('neuigkeit.unpublish'),:path => unpublish_rubrik_neuigkeit_path(@neuigkeit.rubrik,@neuigkeit),:confirm=>'Sure?' } if can?(:unpublish, @neuigkeit) && !@neuigkeit.published? - @toolbar_elements << {:text=>I18n.t('common.edit'),:path=>edit_rubrik_neuigkeit_path(@neuigkeit.rubrik,@neuigkeit),:icon=>:pencil} if can? :edit, @neuigkeit.rubrik + @toolbar_elements << {:hicon=>'icon-plus', :text=> I18n.t('neuigkeit.publish'),:path => publish_rubrik_neuigkeit_path(@neuigkeit.rubrik,@neuigkeit),:confirm=> I18n.t('neuigkeit.publish_sure') } if can?(:publish, @neuigkeit) && !@neuigkeit.published? + @toolbar_elements << {:hicon=>'icon-facebook', :text=> I18n.t('neuigkeit.publishfb'),:path => publish_to_facebook_rubrik_neuigkeit_path(@neuigkeit.rubrik,@neuigkeit),:confirm=>I18n.t('neuigkeit.publishfb_sure') } if can?(:publish, @neuigkeit) && @neuigkeit.published? + +@toolbar_elements << {:hicon=>'icon-facebook', :text=> I18n.t('neuigkeit.publishfetmail'),:path => mail_to_fet_rubrik_neuigkeit_path(@neuigkeit.rubrik,@neuigkeit),:confirm=>I18n.t('neuigkeit.publishfetmail_sure') } if can?(:publish, @neuigkeit) && @neuigkeit.published? + + @toolbar_elements << {:hicon=>'icon-minus', :text=> I18n.t('neuigkeit.unpublish'),:path => unpublish_rubrik_neuigkeit_path(@neuigkeit.rubrik,@neuigkeit),:confirm=> I18n.t('neuigkeit.unpublish_sure') } if can?(:unpublish, @neuigkeit) && @neuigkeit.published? + + + @toolbar_elements << {:text=>I18n.t('common.edit'),:path=>edit_rubrik_neuigkeit_path(@neuigkeit.rubrik,@neuigkeit),:icon=>:pencil} if can? :edit, @neuigkeit.rubrik @versions= @neuigkeit.translation.versions.select([:created_at]).reverse @toolbar_elements <<{:path=>rubrik_neuigkeit_path(@neuigkeit.rubrik,@neuigkeit),:method=>:versions,:versions=>@versions} diff --git a/app/controllers/rubriken_controller.rb b/app/controllers/rubriken_controller.rb index 436b990..42afaf2 100755 --- a/app/controllers/rubriken_controller.rb +++ b/app/controllers/rubriken_controller.rb @@ -2,13 +2,15 @@ class RubrikenController < ApplicationController before_filter {@toolbar_elements=[]} load_and_authorize_resource def index - if can?(:shownonpublic, Rubrik) + if can?(:showintern, Rubrik) @rubriken = Rubrik.all + @neuigkeiten = Neuigkeit.recent else @rubriken = Rubrik.where(:public=>true) + @neuigkeiten = Neuigkeit.public.recent end - @neuigkeiten = @rubriken.collect(&:neuigkeiten).map(&:recent).flatten - @calentries= @rubriken.collect(&:calendar).collect(&:calentries).flatten + + @calentries= @rubriken.collect(&:calentries).flatten end def intern diff --git a/app/controllers/studien_controller.rb b/app/controllers/studien_controller.rb index 79de843..9156f16 100755 --- a/app/controllers/studien_controller.rb +++ b/app/controllers/studien_controller.rb @@ -7,7 +7,7 @@ class StudienController < ApplicationController @topbar_elements=[{:hicon=>'icon-list', :text=>I18n.t("studien.allestudien"),:path=>studien_path}] @topbar_elements<<{:hicon=>'icon-list', :text=>I18n.t("modul.list"),:path=>moduls_path} @topbar_elements<<{:hicon=>'icon-list', :text=>I18n.t("lva.list"),:path=>lvas_path} - @toolbar_elements<<{:icon =>:plus, :hicon=>'icon-plus-sign', :text=> I18n.t('studien.new') ,:path=>new_studium_path } + @toolbar_elements<<{:icon =>:plus, :hicon=>'icon-plus-sign', :text=> I18n.t('studien.new') ,:path=>new_studium_path } if can? :new, Studium # @toolbar_elements<<{:text=> I18n.t('modulgruppe.show.link') ,:path=>modulgruppen_path } end @@ -31,14 +31,14 @@ class StudienController < ApplicationController end @studienphasen << {:modulgruppen=>modulgruppen, :phase => ph}.merge(opts) end - - @toolbar_elements=[{:icon=>:plus, :hicon =>'icon-plus-sign' ,:text=> I18n.t('studien.new') , :path => new_studium_path(@studium) }, - {:icon=>:pencil, :hicon=>'icon-pencil',:text =>I18n.t('common.edit'),:path => edit_studium_path(@studium)}, - {:icon=>:pencil, :hicon=>'icon-pencil',:text =>I18n.t('common.edit'),:path => edit_lvas_studium_path(@studium)}, - {:hicon=>'icon-remove-circle', :text=> I18n.t('common.delete'),:path => studium_path(@studium), :method=> :delete,:confirm=>'Sure?' }] - - @toolbar_modulgruppen =[ {:hicon=>'icon-plus-sign', :text=> I18n.t('modulgruppe.new'), :path=>new_studium_modulgruppe_path(@studium)}, - {:hicon=>'icon-list', :text => I18n.t('modulgruppe.list'), :path=>modulgruppen_path}] + @toolbar_elements=[] + @toolbar_elements<<{:icon=>:plus, :hicon =>'icon-plus-sign' ,:text=> I18n.t('studien.new') , :path => new_studium_path(@studium) } if can? :new, Studium + @toolbar_elements<<{:icon=>:pencil, :hicon=>'icon-pencil',:text =>I18n.t('common.edit'),:path => edit_studium_path(@studium)} if can? :edit, Studium +@toolbar_elements<<{:icon=>:pencil, :hicon=>'icon-pencil',:text =>I18n.t('lva.editlvas'),:path => edit_lvas_studium_path(@studium)} if can? :edit_lvas, Studium +@toolbar_elements<<{:hicon=>'icon-remove-circle', :text=> I18n.t('common.delete'),:path => studium_path(@studium), :method=> :delete,:confirm=>'Sure?' } if can? :delete, Studium + @toolbar_modulgruppen =[] + @toolbar_modulgruppen << {:hicon=>'icon-plus-sign', :text=> I18n.t('modulgruppe.new'), :path=>new_studium_modulgruppe_path(@studium)} if can? :new, Modulgruppe + @toolbar_modulgruppen << {:hicon=>'icon-list', :text => I18n.t('modulgruppe.list'), :path=>modulgruppen_path} if can? :index, Modulgruppe case params[:ansicht] when 'semesteransicht' when 'infoansicht' @@ -60,7 +60,7 @@ class StudienController < ApplicationController def edit_lvas @studium = Studium.find(params[:id]) - @lvas=@studium.lvas + @lvas=@studium.lvas.uniq @semester=@studium.semester @toolbar_elements=[{:text => I18n.t('studien.anzeigen') , :path => url_for(@studium) }] @toolbar_elements<<{:text =>I18n.t('studien.allestudien'),:path=>studien_path(@studium)} diff --git a/app/controllers/themen_controller.rb b/app/controllers/themen_controller.rb index 3a95e58..5b4d39c 100644 --- a/app/controllers/themen_controller.rb +++ b/app/controllers/themen_controller.rb @@ -3,24 +3,12 @@ class ThemenController < ApplicationController # GET /themen.json load_and_authorize_resource - def index - @themen = Thema.all - - respond_to do |format| - format.html # index.html.erb - format.json { render json: @themen } - end - end - - # GET /themen/1 - # GET /themen/1.json def show @thema = Thema.find(params[:id]) - @fragen=@thema.fragen - @toolbar_elements = [{:icon=>:pencil, :hicon=>'icon-pencil', :text=>"Verwalten", :path=>verwalten_thema_path(@thema)}] - @toolbar_elements = [{:icon=>:pencil, :hicon=>'icon-pencil', :text=>I18n.t('thema.edit'), :path=>edit_thema_path(@thema)}] + @toolbar_elements = [{:icon=>:pencil, :hicon=>'icon-pencil', :text=>I18n.t("thema.manage"), :path=>verwalten_thema_path(@thema)}] + @toolbar_elements << [{:icon=>:pencil, :hicon=>'icon-pencil', :text=>I18n.t('thema.edit'), :path=>edit_thema_path(@thema)}] @toolbar_elements << {:hicon=>'icon-remove-circle', :text=>I18n.t('thema.remove'), :path=>thema_path(@thema), :method=>:delete, :confirm=>I18n.t('thema.sure')} respond_to do |format| @@ -32,8 +20,8 @@ class ThemenController < ApplicationController end def verwalten @thema = Thema.find(params[:id]) + @attachment=Attachment.new @fragen=@thema.fragen - @toolbar_elements = [{:icon=>:pencil, :hicon=>'icon-pencil', :text=>"Verwalten", :path=>verwalten_thema_path(@thema)}] @toolbar_elements = [{:icon=>:pencil, :hicon=>'icon-pencil', :text=>I18n.t('thema.edit'), :path=>edit_thema_path(@thema)}] @toolbar_elements << {:hicon=>'icon-remove-circle', :text=>I18n.t('thema.remove'), :path=>thema_path(@thema), :method=>:delete, :confirm=>I18n.t('thema.sure')} @@ -54,9 +42,14 @@ class ThemenController < ApplicationController # GET /themen/1/edit def edit @thema = Thema.find(params[:id]) + + if @thema.is_wiki? + redirect_to edit_wiki_path(Wiki.find(@thema.id)) + return + end respond_to do |format| format.html - format.js + format.js { @themen= @thema.themengruppe.themen } end end @@ -64,14 +57,16 @@ class ThemenController < ApplicationController # POST /themen.json def create @thema = Thema.new(params[:thema]) - - @themen = @thema.themengruppe.themen.order(:priority).reverse + @themen = @thema.themengruppe.themen.order(:priority).reverse + respond_to do |format| if @thema.save - format.html { redirect_to @thema, notice: 'Thema was successfully created.' } + @themen = @thema.themengruppe.themen.order(:priority).reverse + format.html { redirect_to @thema, notice: I18n.t("thema.created") } format.json { render json: @thema, status: :created, location: @thema } format.js {render action: "update"} else + @themen = @thema.themengruppe.themen.order(:priority).reverse format.html { render action: "new" } format.json { render json: @thema.errors, status: :unprocessable_entity } format.js { render action: "edit" } @@ -88,6 +83,7 @@ class ThemenController < ApplicationController def attachments @thema = Thema.find(params[:id]) @attachments=@thema.attachments + @attachment=Attachment.new respond_to do |format| format.js end @@ -96,10 +92,19 @@ class ThemenController < ApplicationController # PUT /themen/1.json def update @thema = Thema.find(params[:id]) - @themen = @thema.themengruppe.themen.order(:priority).reverse + @themen = @thema.themengruppe.themen.order(:priority).reverse + @thema.assign_attributes(params[:thema]) + @thema.fix_links(request.host_with_port) + respond_to do |format| - if @thema.update_attributes(params[:thema]) - format.html { redirect_to @thema, notice: 'Thema was successfully updated.' } + if @thema.save + format.html { + if params["button"]=="continue" + render action: "edit", notice: I18n.t("thema.updated") + else + redirect_to @thema, notice: I18n.t("thema.updated") + end + } format.json { head :no_content } format.js else @@ -115,7 +120,7 @@ class ThemenController < ApplicationController def destroy @thema = Thema.find(params[:id]) @thema.destroy - + @themen = @thema.themengruppe.themen.order(:priority).reverse respond_to do |format| format.html { redirect_to themengruppe_path(@thema.themengruppe) } format.json { head :no_content } diff --git a/app/controllers/themengruppen_controller.rb b/app/controllers/themengruppen_controller.rb index f639b42..a648f77 100644 --- a/app/controllers/themengruppen_controller.rb +++ b/app/controllers/themengruppen_controller.rb @@ -3,9 +3,10 @@ class ThemengruppenController < ApplicationController # GET /themengruppen.json load_and_authorize_resource def index - @themengruppen = Themengruppe.order(:priority).reverse - @toolbar_elements = [{:icon=>:plus, :hicon=>'icon-plus-sign', :text=>I18n.t('themengruppe.new'), :path=>new_themengruppe_path()}] - @toolbar_elements = [{:icon=>:plus, :hicon=>'icon-plus-sign', :text=>I18n.t('common.verwalten'), :path=>verwalten_all_themengruppen_path()}] + @themengruppen = Themengruppe.where(:public=>true).order(:priority).reverse + @toolbar_elements = [] + @toolbar_elements << {:icon=>:plus, :hicon=>'icon-plus-sign', :text=>I18n.t('themengruppe.new'), :path=>new_themengruppe_path()} if can? :new, Themengruppe + @toolbar_elements << {:icon=>:plus, :hicon=>'icon-plus-sign', :text=>I18n.t('themengruppe.manage_all'), :path=>verwalten_all_themengruppen_path()} if can? :verwalten_all, Themengruppe respond_to do |format| format.html # index.html.erb @@ -21,13 +22,13 @@ class ThemengruppenController < ApplicationController # GET /themengruppen/1.json def show @themengruppe = Themengruppe.find(params[:id]) + if can? :showdraft , Thema @themen = @themengruppe.themen.order(:priority).reverse - + else + @themen = @themengruppe.themen.where(:isdraft=>false).order(:priority).reverse + end @toolbar_elements = [] - @toolbar_elements << {:icon=>:plus, :hicon=>'icon-plus-sign', :text=>I18n.t('thema.add'), :path=>new_themengruppe_thema_path(@themengruppe)} if can? :new, Themengruppe - @toolbar_elements << {:icon=>:pencil, :hicon=>'icon-pencil', :text=>I18n.t('themengruppe.edit'), :path=>edit_themengruppe_path(@themengruppe)} if can? :edit, @themengruppe @toolbar_elements << {:icon=>:pencil, :hicon=>'icon-pencil', :text=>I18n.t("themengruppe.manage"), :path=>themengruppe_verwalten_path(@themengruppe)} if can? :edit, @themengruppe - @toolbar_elements << {:hicon=>'icon-remove-circle',:text=>I18n.t('themengruppe.remove'), :path=>themengruppe_path(@themengruppe), :method=>:delete,:confirm=>I18n.t('themengruppe.sure')} if can? :delete, @themengruppe respond_to do |format| format.html # show.html.erb @@ -51,11 +52,20 @@ class ThemengruppenController < ApplicationController @themengruppe = Themengruppe.find(params[:id]) end def verwalten_all - @themengruppen =Themengruppe.order(:priority).reverse - end + @themengruppen =Themengruppe.public.order(:priority).reverse +@themengruppen_intern =Themengruppe.intern.order(:priority).reverse + @toolbar_elements = [{:icon=>:plus, :hicon=>'icon-plus-sign', :text=>I18n.t('themengruppe.new'), :path=>new_themengruppe_path()}] + + end def verwalten @themengruppe = Themengruppe.find(params[:themengruppe_id]) @themen = @themengruppe.themen.order(:priority).reverse + + @toolbar_elements =[] + @toolbar_elements << {:icon=>:pencil, :hicon=>'icon-pencil', :text=>I18n.t('themengruppe.edit'), :path=>edit_themengruppe_path(@themengruppe)} if can? :edit, @themengruppe + @toolbar_elements << {:icon=>:plus, :hicon=>'icon-plus-sign', :text=>I18n.t('thema.add'), :path=>new_themengruppe_thema_path(@themengruppe)} if can? :new, Themengruppe + @toolbar_elements << {:hicon=>'icon-remove-circle',:text=>I18n.t('themengruppe.remove'), :path=>themengruppe_path(@themengruppe), :method=>:delete,:confirm=>I18n.t('themengruppe.sure')} if can? :delete, @themengruppe + end def sort_themengruppen diff --git a/app/controllers/users/omniauth_callbacks_controller.rb b/app/controllers/users/omniauth_callbacks_controller.rb index 2c72832..82ed6ea 100644 --- a/app/controllers/users/omniauth_callbacks_controller.rb +++ b/app/controllers/users/omniauth_callbacks_controller.rb @@ -1,15 +1,17 @@ class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController -skip_before_filter :verify_authenticity_token -def failure - - # flash[:notice] = "Failure #{Hash.new(request.env)} #{Hash.new(params)}" -#redirect_to new_user_registration_url , :notice=>"Omniauth Login failed" -super -end -def facebook + skip_before_filter :verify_authenticity_token + def failure + + # flash[:notice] = "Failure #{Hash.new(request.env)} #{Hash.new(params)}" + #redirect_to new_user_registration_url , :notice=>"Omniauth Login failed" + super + end + def facebook # You need to implement the method below in your model (e.g. app/models/user.rb) @user = User.find_for_facebook_oauth(request.env["omniauth.auth"], current_user) + data=request.env["omniauth.auth"] + session[:fbuser_access_token]=data.credentials.token if @user sign_in_and_redirect @user, :event => :authentication #this will throw if @user is not activated diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 474839f..f5a0334 100755 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -12,9 +12,19 @@ class UsersController < ApplicationController end redirect_to users_url end + def fb_set_default_publish_page + if params["page"].nil? || !(current_user.provider=="facebook") + redirect_to intern_home_index_path + else + @fbu=FbGraph::User.new(current_user.uid.to_s).fetch(:access_token=>session["fbuser_access_token"]) + File.open("tmp/page.yml",'w'){|f| f.write(@fbu.accounts(:access_token=>session["fbuser_access_token"]).select { |p| p.name == params["page"] }.first.to_yaml)} + logger.debug @fbu.to_s + redirect_to admin_home_index_path + end + + end def all_update - params[:users].each do |id,u| user=User.find(id) user.fetprofile = Fetprofile.find(u[:fetprofile_id].to_i) if u[:fetprofile_id].to_i>0 @@ -26,7 +36,6 @@ class UsersController < ApplicationController def do_confirm @user= User.find(params[:id]) @user.confirm! - redirect_to users_url end end diff --git a/app/controllers/wikis_controller.rb b/app/controllers/wikis_controller.rb new file mode 100644 index 0000000..46b6b15 --- /dev/null +++ b/app/controllers/wikis_controller.rb @@ -0,0 +1,46 @@ +class WikisController < ApplicationController + load_and_authorize_resource + + def show + @wiki = Wiki.find(params[:id]) + @fragen = @wiki.fragen + @toolbar_elements = [{:icon=>:pencil, :hicon=>'icon-pencil', :text=>I18n.t('wiki.edit'), :path=>verwalten_thema_path(@wiki)}] + end + + def wiki + @wiki = Wiki.find_or_init(params[:name]) + @fragen = @wiki.fragen + @toolbar_elements = [] +# @toolbar_elements = [{:icon=>:pencil, :hicon=>'icon-pencil', :text=>I18n.t('wiki.edit'), :path=>verwalten_wiki_path(@wiki)}] + + redirect_to wiki_path(@wiki) + end + + + def edit + @wiki = Wiki.find(params[:id]) + respond_to do |format| + format.html + format.js + end + + end + + def update + @wiki = Wiki.find(params[:id]) + @themen = @wiki.themengruppe.themen.order(:priority).reverse + @wiki.raw_data=params[:wiki][:raw_data] + respond_to do |format| + if @wiki.update_attributes(params[:wiki]) + format.html { redirect_to verwalten_thema_path(@wiki), notice: 'Thema was successfully updated.' } + format.json { head :no_content } + format.js + else + format.html { render action: "edit" } + format.json { render json: @wiki.errors, status: :unprocessable_entity } + format.js { render action: "edit" } + end + end + + end +end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index b2acb74..32b5582 100755 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -8,6 +8,26 @@ module ApplicationHelper current_url1({:locale=>target_locale}) .sub "/"+I18n.locale.to_s+"/", "/"+target_locale.to_s+"/" end + def ffi1_icon (name) + content_tag("i","", class: "ffi1-"+name ) + end + def ff_icon (name) + content_tag("i","", class: name ) + end + + def ffi1_list + y=YAML.load_file("#{::Rails.root.to_s}/config/flatfeticon1.yml") + y["ffi1"] +end + + def tinymce_icon_choice + s="" + ffi1_list.each do |i| + s=s+''+ffi1_icon(i)+'' + end + raw(s) + end + def toolbar_html(elemente) html = "" limiter = " | " diff --git a/app/inputs/datetimepicker_input.rb b/app/inputs/datetimepicker_input.rb new file mode 100644 index 0000000..b26804c --- /dev/null +++ b/app/inputs/datetimepicker_input.rb @@ -0,0 +1,32 @@ +class DatetimepickerInput < FormtasticBootstrap::Inputs::StringInput + def input_html_options + s=super + value=builder.object.send(method) + value=I18n.l(value) unless value.nil? + super.merge(:class => "datetimepicker",:value=>value) + end + + def html_options + super + + end + def wrapper_html_options + super.merge(:class=>"") + #super.merge(:class=>"datepicker",'date-date-format'.to_sym=>"%d.%m.%Y") + end + def controls_wrapper_html_options + super.merge(:class=> " date input-append", 'data-date'.to_sym =>I18n.l(Date.today()).to_s, 'data-date-format'.to_sym=>I18n.t('date.formats.default-picker')) + end + def to_html + bootstrap_wrapping do + builder.text_field(method, input_html_options) + + ''.html_safe() + end + end + def options + super +#d.merge(:class=>"datepicker") + #super.merge(:append_content=>''') + end +end diff --git a/app/mailers/news_mailer.rb b/app/mailers/news_mailer.rb new file mode 100644 index 0000000..4859eee --- /dev/null +++ b/app/mailers/news_mailer.rb @@ -0,0 +1,7 @@ +class NewsMailer < ActionMailer::Base + default from: "salzamt@fet.at" + def neuigkeit_mail(email, neuigkeit_id) + @neuigkeit= Neuigkeit.find(neuigkeit_id) + mail(to: "andis@fet.at", subject: @neuigkeit.title) + end +end diff --git a/app/models/ability.rb b/app/models/ability.rb index f61425f..616979b 100755 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -2,57 +2,121 @@ class Ability include CanCan::Ability def initialize(user) - # Define abilities for the passed in user here. For example: - # - # if user.admin? - # can :manage, :all - # else - # can :read, :all - # end - # The first argument to `can` is the action you are giving the user permission to do. - # If you pass :manage it will apply to every action. Other common actions here are - # :read, :create, :update and :destroy. - # - # The second argument is the resource the user can perform the action on. If you pass - # :all it will apply to every resource. Otherwise pass a Ruby class of the resource. - # - # The third argument is an optional hash of conditions to further filter the objects. - # For example, here the user can only update published articles. - # - # can :update, Article, :published => true - # - # See the wiki for details: https://github.com/ryanb/cancan/wiki/Defining-Abilitiescan :manage, :all - + loggedin=!(user.nil?) user ||= User.new # guest user (not logged in) - - - # For Debug allow everything - # Remove this line in production environment and for testing user management -# can :manage, :all - can :addfetuser, User - can :addfetadmin, User - + #----------------------------------------------------- + # Rechteverwaltung fuer Studien Modul can [:show, :index], Studium can [:show, :index], Modulgruppe can [:show, :index], Modul can [:show, :index], Lva + can [:create, :show], Beispiel + if loggedin + can :like, Beispiel + can :dislike, Beispiel + end + if( user.has_role?("fetuser") || user.has_role?("fetadmin")) + can :manage, Modulgruppe + can :manage, Modul + can :manage, Lva + can :manage, Studium + end + unless user.has_role?("fetadmin") + cannot :delete, Studium + cannot :delete, Modulgruppe + cannot :delete, Modul + end + + #----------------------------------------------------- + # Rechteverwaltung fuer Informationen + can [:show, :index,:faqs], Themengruppe, :public=>true + can [:show], Thema, :isdraft=>false + can :show, Frage + if loggedin + end + if( user.has_role?("fetuser") || user.has_role?("fetadmin")) + can :manage, Frage + can :showdraft , Thema + can :showintern, Thema + can :manage, Thema + can :manage, Themengruppe + end + unless user.has_role?("fetadmin") + cannot :delete, Themengruppe + cannot :delete, Thema + end + + #----------------------------------------------------- + # Rechteverwaltung fuer Fotos + can [:show,:index], Gallery - can [:show, :index,:faqs], Themengruppe - can [:show], Thema - can [:create], Beispiel + if loggedin + end + if( user.has_role?("fetuser") || user.has_role?("fetadmin")) + can :manage, Gallery + end + unless user.has_role?("fetadmin") + cannot :delete, Gallery + end + + #----------------------------------------------------- + # Rechteverwaltung fuer Mitarbeiter can [:show, :index], Fetprofile can [:show, :index],Gremium - # Rechteverwaltung fuer Studien Modul - + if loggedin + end + if( user.has_role?("fetuser") || user.has_role?("fetadmin")) + can :manage, Fetprofile + can :manage, Gremium + can :manage, Membership + end + unless user.has_role?("fetadmin") + cannot :delete, Fetprofile + cannot :delete ,Gremium + end + #----------------------------------------------------- + # Rechteverwaltung fuer Neuigkeiten + can [:show,:index], Rubrik, :public=>true + can :show, Neuigkeit, :rubrik=>{:public=>true} + + if loggedin + end + if( user.has_role?("fetuser") || user.has_role?("fetadmin")) + can :showintern, Neuigkeit + can :showintern, Rubrik + can :seeintern, User + can :shownonpublic, Rubrik + + end + if user.has_role?("newsadmin") || user.has_role?("fetadmin") + can :addmoderator, Rubrik + end + if user.has_role?("fetadmin") + can :addfetuser, User + can :addfetadmin, User + end + + if user.has_role?("newsadmin") || user.has_role?( "fetadmin") || user.has_role?( "fetuser") + can :manage, Rubrik + can :manage, Neuigkeit + can :showunpublished, Neuigkeit + end + unless user.has_role?("fetadmin") + cannot :delete, Rubrik + cannot :delete, Neuigkeit + + end + + # Rechteverwaltung Kalender can [:show, :index], Calendar, :public => true can [:showics], Calendar can [:show], Calentry + if( user.has_role?("fetuser") || user.has_role?("fetadmin")) - can :manage,:all - can :manage, Modulgruppe + can [:show,:index], Calendar can [:edit, :update,:new,:create,:verwalten], Calendar @@ -61,28 +125,11 @@ class Ability if( user.has_role?("fetadmin")) can [:delete],Calendar can [:delete],Calentry + can :doadmin, User end - - # Rechteverwaltung fuer Neuigkeiten -# can :write, Neuigkeit if user.has_role?("newsmoderator", Neuigkeit.rubrik) - - if user.has_role?("newsadmin") || user.has_role?("fetadmin") - can :addmoderator, Rubrik - end - can [:show,:index], Rubrik, :public=>true - - can :show, Neuigkeit, :rubrik=>{:public=>true} - - if user.has_role?("newsadmin") || user.has_role?( "fetadmin") || user.has_role?( "fetuser") - can :manage, Rubrik - can :manage, Neuigkeit - can :shownonpublic, Rubrik - can :showunpublished, Neuigkeit - can :seeintern, User + unless user.has_role?("fetadmin") + end - end - - end end diff --git a/app/models/attachment.rb b/app/models/attachment.rb index 1efccd6..c61214f 100644 --- a/app/models/attachment.rb +++ b/app/models/attachment.rb @@ -12,9 +12,22 @@ class Attachment < ActiveRecord::Base has_paper_trail - attr_accessible :name, :datei + attr_accessible :name, :datei, :datei_cache belongs_to :thema mount_uploader :datei, AttachmentUploader validates :thema, :presence => true validates :name, :presence => true + + 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/beispiel.rb b/app/models/beispiel.rb index 6f87953..8e0ba3c 100755 --- a/app/models/beispiel.rb +++ b/app/models/beispiel.rb @@ -14,7 +14,9 @@ class Beispiel < ActiveRecord::Base has_paper_trail attr_accessible :desc, :name, :lva_id, :beispieldatei, :beispieldatei_cache, :datum + acts_as_votable belongs_to :lva + mount_uploader :beispieldatei, AttachmentUploader validates :beispieldatei, :presence => true validates :name, :presence => true diff --git a/app/models/calentry.rb b/app/models/calentry.rb index f7f0699..66c401f 100644 --- a/app/models/calentry.rb +++ b/app/models/calentry.rb @@ -32,9 +32,12 @@ class Calentry < ActiveRecord::Base resourcify def get_public - self.public = (self.try(:object).nil?)? (self.calendar.try(:public)) : object.try(:public) + self.public = (self.try(:object).nil?)? (self.calendar.try(:public?)) : object.try(:public?) true end + def s_time=(s_time) + start + end def start_time start end @@ -60,7 +63,7 @@ end end end def text - I18n.l(self.start) +" bis "+ I18n.l(self.ende) + I18n.l(self.start) +" "+ I18n.t("cal.bis")+" "+ I18n.l(self.ende) end scope :public, -> { where(:public => :true) } # scope :upcoming, -> { where("start >= ?" , Time.now).where("start <= ?", 28.days.from_now) } diff --git a/app/models/fetprofile.rb b/app/models/fetprofile.rb index 787c175..bf367bf 100644 --- a/app/models/fetprofile.rb +++ b/app/models/fetprofile.rb @@ -15,19 +15,29 @@ # class Fetprofile < ActiveRecord::Base - attr_accessible :active, :desc, :fetmailalias, :nachname, :picture, :short, :vorname, :memberships_attributes, :remove_picture, :picture_cache + attr_accessible :active, :desc, :fetmailalias, :nachname, :picture, :short, :vorname, :memberships_attributes, :remove_picture, :picture_cache, :plz, :street, :city, :instant,:skype, :telnr, :hdynr, :birth_day, :birth_month, :birth_year,:geschlecht has_many :memberships, dependent: :delete_all has_many :gremien, :through=> :membership mount_uploader :picture, PictureUploader has_paper_trail -validates :desc, :presence=>true + validates :desc, :presence=>true validates :nachname, length:{minimum: 3},:presence=>true validates :vorname, length:{minimum: 3},:presence=>true + validate :validate_birthday + GESCHLECHT={0=>"gendered", 1=>"maennlich", 2=>"weiblich"} has_many :users scope :search, ->(query) {where("nachname like ? or vorname like ? or short like ?", "%#{query}%", "%#{query}%", "%#{query}%")} accepts_nested_attributes_for :memberships, :reject_if=>lambda{|a| a[:typ].blank?|| a[:start].blank? ||a[:gremium_id].blank?}, :allow_destroy=>true has_many :nlinks, as: :link + def validate_birthday + unless birth_month.nil? || birth_day.nil? + unless Date.valid_date?((birth_year.nil?) ? Date.today.year : birth_year, birth_month, birth_day) + errors.add(:birth_month, "Invalides Datum") + errors.add(:birth_day, "Invalides Datum") + end +end + end def title self.name @@ -39,4 +49,15 @@ validates :desc, :presence=>true def fetmail (fetmailalias.nil? || fetmailalias.empty?) ? short.to_s + "@fet.at" : fetmailalias.to_s + "@fet.at" end + def adress + connector= (self.street.nil?||self.street.empty?||(self.city.empty? && self.plz.empty?)) ? '' : ', ' + self.plz.to_s + ' ' + self.city.to_s + connector.to_s + self.street.to_s + end + def birthday + if self.birth_year.nil? || self.birth_year.zero? + Date.new( Date.today.year,self.birth_month,self.birth_day) + else + Date.new( self.birth_year,self.birth_month,self.birth_day) + end + end end diff --git a/app/models/gremium.rb b/app/models/gremium.rb index ea92010..aef3387 100644 --- a/app/models/gremium.rb +++ b/app/models/gremium.rb @@ -12,16 +12,16 @@ # class Gremium < ActiveRecord::Base - TYPEN={1=>"offiziell", 2=>"offiziell-temporär", 3 => "inoffiziell",4=>"inoffiziell-tempo", 11=> "berufungskommission",12=> "habilitationskommission" } # Kategorien, im Wesentlichen wichtig für Listung oder nicht Listung + TYPEN={1=>"offiziell", 2=>"offiziell-notab", 3 => "inoffiziell",4=>"inoffiziell-notab", 11=> "berufungskommission",12=> "habilitationskommission" } # Kategorien, im Wesentlichen wichtig für Listung oder nicht Listung GESCHLECHT={0=>"saechlich", 1 => "maennlich", 2 => "weiblich"} # Geschlecht des Gremiums zur richtige Deklination - ART2FALL={0=>"des", 1=>"des",2=>"der"} # Artikel 2.Fall abhängig vom Geschlecht - ART4FALL={0=>"das", 1=>"den",2=>"die"} # Artikel 2.Fall abhängig vom Geschlecht + ART2FALL={0=>"des", 1=>"des",2=>"der"} # Artikel 2.Fall abhängig vom Geschlecht + ART4FALL={0=>"das", 1=>"den",2=>"die"} # Artikel 2.Fall abhängig vom Geschlecht FILTER={11=>I18n.t("gremium.filter.berufung.title"),12=>I18n.t("gremium.filter.habil.title")} TEXT={11=>I18n.t("gremium.filter.berufung.text"),12=>I18n.t("gremium.filter.habil.text")} attr_accessible :desc, :name, :typ, :geschlecht,:thema_id, :memberships_attributes - has_many :memberships # Mitgliedschaften bei dem Gremium - has_many :nlinks, as: :link + has_many :memberships, dependent: :destroy # Mitgliedschaften bei dem Gremium + has_many :nlinks, as: :link, dependent: :destroy scope :search, ->(query) {where("gremien.name like ? or gremien.desc like ?", "%#{query}%", "%#{query}%")} belongs_to :thema # Gehört zu einem Thema diff --git a/app/models/lva.rb b/app/models/lva.rb index 5a0f5d5..dcd7e17 100755 --- a/app/models/lva.rb +++ b/app/models/lva.rb @@ -40,7 +40,7 @@ class Lva < ActiveRecord::Base has_paper_trail :ignore=>[:desc, :pruefungsinformation]# Versionsverfolgung translates :desc,:pruefungsinformation, :fallbacks_for_empty_translations => true, :versioning=>true - attr_accessible :desc, :ects, :lvanr, :name, :stunden, :modul_ids, :semester_ids, :pruefungsinformation, :lernaufwand, :typ, :lecturer_ids + attr_accessible :desc, :ects, :lvanr, :name, :stunden, :modul_ids, :semester_ids, :pruefungsinformation, :lernaufwand, :typ, :lecturer_ids, :forumlink has_and_belongs_to_many :modul,:uniq=>true # Gehört zu einem Modul has_and_belongs_to_many :semester @@ -58,12 +58,14 @@ class Lva < ActiveRecord::Base validates_presence_of :modul # Zugehöriges Modul eingetragen? # (zumindest eines) - + def typ_n + typ=="andere" ? "" : typ + end def title self.name end def full_name - return self.typ + ' ' + self.name + return self.typ_n + ' ' + self.name end def add_semesters # Diese Methode fügt die Instanz automatisch zu allen Studien als "Ohne Semesterempfehlung" (Semester 0) zu, bei denen die Instanz im Studium noch nicht vorkommt. diff --git a/app/models/membership.rb b/app/models/membership.rb index 668dbce..272980b 100644 --- a/app/models/membership.rb +++ b/app/models/membership.rb @@ -14,6 +14,7 @@ class Membership < ActiveRecord::Base TYPEN={-2=>"VorsitzendeR", -1=>"stv VorsitzendeR", 0=>"2. stv VorsitzendeR", 1=>"Mitglied",2=> "Ersatzmitglied",3=>"VerantwortlicheR"} + TYPEN_g={0=>TYPEN, 1=>{ -2=>"Vorsitzender", -1=>"stv Vorsitzender", 0=>"2. stv Vorsitzender", 1=>"Mitglied",2=> "Ersatzmitglied",3=>"Verantwortlicher"},2=>{-2=>"Vorsitzende", -1=>"stv Vorsitzende", 0=>"2. stv Vorsitzende", 1=>"Mitglied",2=> "Ersatzmitglied",3=>"Verantwortliche"}} attr_accessible :fetprofile_id, :gremium_id, :start, :stop, :typ belongs_to :fetprofile belongs_to :gremium diff --git a/app/models/modul.rb b/app/models/modul.rb index 3b46cd9..1c3bb42 100755 --- a/app/models/modul.rb +++ b/app/models/modul.rb @@ -12,7 +12,7 @@ # class Modul < ActiveRecord::Base - attr_accessible :desc,:name, :depend, :studium_id, :modulgruppen + attr_accessible :desc,:name, :depend, :studium_id, :modulgruppen, :modulgruppe_ids has_and_belongs_to_many :lvas , :uniq=>true has_and_belongs_to_many :modulgruppen diff --git a/app/models/neuigkeit.rb b/app/models/neuigkeit.rb index 72946df..37cea90 100755 --- a/app/models/neuigkeit.rb +++ b/app/models/neuigkeit.rb @@ -22,9 +22,11 @@ class Neuigkeit < ActiveRecord::Base translates :title,:text, :versioning=>{:gem=>:paper_trail, :options=>{:fallbacks_for_empty_translations => true}} has_many :calentries, as: :object + has_many :nlinks + mount_uploader :picture, PictureUploader - default_scope order(:datum).reverse_order - #scope :published, -> {where("datum <= ? AND datum IS NOT NULL", Time.now.to_date)} + + default_scope order(:datum).reverse_order scope :recent, -> { published.limit(10)} scope :unpublished, -> {where("datum >= ? OR datum IS NULL", Date.today)} scope :public, ->{includes(:rubrik).where("rubriken.public"=>true)} @@ -34,7 +36,9 @@ class Neuigkeit < ActiveRecord::Base LINKTYPES=["Thema", "Gallery", "Lva","Studium","Fetprofile", "Gremium"] accepts_nested_attributes_for :calentries, :allow_destroy=>true , :reject_if=> lambda{|a| a[:start].blank?} before_validation :sanitize - has_many :nlinks + + + def self.published where("datum <= ? AND datum IS NOT NULL", Time.now.to_date) end @@ -46,7 +50,7 @@ class Neuigkeit < ActiveRecord::Base self.rubrik.public end def published? - self.datum_nilsave>=Time.now.to_date + self.datum_nilsave(?[^\<\>]*)/.match Sanitize.clean(self.text,:elements=>['p']) words=md[:text].split(" ") unless md.nil? @@ -68,15 +72,15 @@ end end end -def has_calentries? -!self.calentries.nil? && !self.calentries.empty? -end -private -def sanitize -self.calentries.each do |calentry| -calentry.calendar= self.rubrik.calendar -calentry.typ=1 -calentry.object=self -end -end + def has_calentries? + !self.calentries.nil? && !self.calentries.empty? + end + private + def sanitize + self.calentries.each do |calentry| + calentry.calendar= self.rubrik.calendar + calentry.typ=1 + calentry.object=self + end + end end diff --git a/app/models/rubrik.rb b/app/models/rubrik.rb index 74340d2..ca4bfec 100755 --- a/app/models/rubrik.rb +++ b/app/models/rubrik.rb @@ -11,7 +11,7 @@ # class Rubrik < ActiveRecord::Base - attr_accessible :desc, :name, :prio, :calendar, :public + attr_accessible :desc, :name, :prio, :calendar, :public, :icon, :color has_many :neuigkeiten, :class_name => "Neuigkeit" has_many :published, :class_name => "Neuigkeit", :conditions=>["Neuigkeit.published"] has_many :calentries, :through => :neuigkeiten, :as=>:object diff --git a/app/models/thema.rb b/app/models/thema.rb index c32149c..3f73b38 100644 --- a/app/models/thema.rb +++ b/app/models/thema.rb @@ -9,9 +9,10 @@ # updated_at :datetime not null # themengruppe_id :integer # - +require 'uri' class Thema < ActiveRecord::Base - attr_accessible :text, :title, :themengruppe_id +include Rails.application.routes.url_helpers + attr_accessible :text, :title, :themengruppe_id,:isdraft, :hidelink, :hideattachment has_many :fragen has_many :attachments belongs_to :themengruppe, :foreign_key => "themengruppe_id" @@ -20,9 +21,21 @@ class Thema < ActiveRecord::Base validates :themengruppe, :presence => true validates :title, :presence => true validates :text, :presence => true - scope :search, ->(query) {where("text like ? or title like ?", "%#{query}%", "%#{query}%")} - translates :title,:text, :versioning =>true, :fallbacks_for_empty_translations => true + scope :search, ->(query) {where("text like ? or title like ?", "%#{query}%", "%#{query}%")} + scope :outdated, -> {includes(:translations).where("thema_translations.updated_atI18n.t.locale) +} + translates :title,:text, :versioning =>true, :fallbacks_for_empty_translations => true + def is_outdated? + unless translation.try(:updated_at).nil? + translation.updated_at < 2.month.ago + else + false + end + end + def is_wiki? + !(wikiname.nil? || wikiname.empty?) + end def text_first_words md = /

(?[^\<\>]*)/.match Sanitize.clean(self.text,:elements=>['p']) words=md[:text].split(" ") unless md.nil? @@ -34,4 +47,10 @@ class Thema < ActiveRecord::Base end end + def fix_links(host) + full_url= URI.parse(root_url(:host=>host)) + self.text.gsub!(/src="[^"]*attachment\/datei\/(\d+)[^"]*"/){|s| full_url.path=Attachment.find($1.to_i).datei.url; 'src="'+full_url.to_s+'"'} + self.text.gsub!(/href="[^"]*themen\/(\d+)[^"]*"/){|s| full_url.path=thema_path(Thema.find($1.to_i)); 'href="'+full_url.to_s+'"'} + + end end diff --git a/app/models/themengruppe.rb b/app/models/themengruppe.rb index ca42007..8b22b5d 100644 --- a/app/models/themengruppe.rb +++ b/app/models/themengruppe.rb @@ -10,7 +10,7 @@ class Themengruppe < ActiveRecord::Base WORD_COUNT = 50 - attr_accessible :text, :title, :picture, :priority + attr_accessible :text, :title, :picture, :priority, :public, :icon has_many :themen, class_name: 'Thema' has_many :fragen, through: :themen @@ -20,4 +20,20 @@ class Themengruppe < ActiveRecord::Base validates :text, :presence => true translates :title,:text, :versioning =>true, :fallbacks_for_empty_translations => true + + scope :intern,-> {where(:public=>false)} + scope :public,-> {where(:public=>true)} + + def self.find_wiki_default + where(:wiki_default=>true).first + end + def intern + ! self.public +end + def make_wiki_default + Themengruppe.where(:wiki_default=>:true).update_all(:wiki_default=>:false) + self.wiki_default=true; + self.save; + end + end diff --git a/app/models/user.rb b/app/models/user.rb index ea6c46b..bcc6096 100755 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -30,7 +30,7 @@ class User < ActiveRecord::Base # :token_authenticatable, :confirmable, # :lockable, :timeoutable and :omniauthable devise :database_authenticatable, :recoverable, :rememberable, :trackable, :validatable,:omniauthable, :omniauth_providers => [:facebook,:ldap] - + acts_as_voter # Setup accessible (or protected) attributes for your model attr_accessible :email, :password, :password_confirmation, :remember_me, :provider, :uid, :name belongs_to :fetprofile @@ -38,39 +38,32 @@ belongs_to :fetprofile def self.find_for_facebook_oauth(auth, signed_in_resource=nil) logger.debug auth.to_s logger.debug "DDD Username= #{auth.username}" - # user = User.where(:provider => auth.provider, :uid => auth.uid).first + user = User.where(:provider => auth.provider, :uid => auth.uid).first unless user - user = User.create(name:auth.uid, + user = User.create(name: auth.uid, provider:auth.provider, - uid:auth.uid, + uid: auth.uid, email:auth.info.email, password:Devise.friendly_token[0,20] ) end + user end - def self.find_for_ldap_oauth(auth,signed_in_resource=nil) - # debug "sdfg" + def self.find_for_ldap_oauth(auth,signed_in_resource=nil) + # debug "sdfg" - user= User.where(:provider=>auth.provider,:uid=>auth.extra.raw_info.uid).first - unless user - user= User.create(name:auth.extra.raw_info.uid.first, - provider:auth.provider, - uid:auth.extra.raw_info.uid.first, - email:auth.extra.raw_info.mail.first.to_s, - password:Devise.friendly_token[0,20]) - user.add_role("fetuser") -logger.debug(auth.extra.raw_info.to_s) - end - unless user - # user=User.create(name:"fail", - # provider:"ldap", - # uid:"sdf", - # email:"sdf@fet.at", - # password:Devise.friendly_token[0,20]) - - end + user= User.where(:provider=>auth.provider,:uid=>auth.extra.raw_info.uid).first + unless user + user= User.create(name:auth.extra.raw_info.uid.first, + provider:auth.provider, + uid:auth.extra.raw_info.uid.first, + email:auth.extra.raw_info.mail.first.to_s, + password:Devise.friendly_token[0,20]) + user.add_role("fetuser") + logger.debug(auth.extra.raw_info.to_s) + end user end diff --git a/app/models/wiki.rb b/app/models/wiki.rb new file mode 100644 index 0000000..23cd374 --- /dev/null +++ b/app/models/wiki.rb @@ -0,0 +1,73 @@ +class Wiki < Thema + validates :wikiname, :uniqueness=>true, :presence=>true + after_initialize :load_wiki + attr_accessible :wikiname, :wikiformat, :hidelink, :raw_data + WIKIFORMATS={nil=> :textile, 0 =>:textile, 1=> :mediawiki} + + def self.find_or_init(name) + w = Wiki.where(:wikiname=>name).first + page = is_file_availaible(name) + if w.nil? + unless page.nil? + w=Wiki.new(:wikiname=>name, :title=>name, :wikiformat=>Wiki::WIKIFORMATS.invert[page.format], :hidelink=>true) + else + w=Wiki.new(:wikiname=>name, :title=>name, :wikiformat=>0, :hidelink=>true) + wiki = Gollum::Wiki.new("../wiki.git", :base_path => "/wiki") + page=wiki.write_page(name, :textile, "ioi", self.commit) + w.reload_page + end + + w.themengruppe = Themengruppe.find_wiki_default + w.raw_data="Neues Wiki" + w.save + end + w + end + + def raw_data + self.page.raw_data + end + + def raw_data=(data) + self.get_page(self.wikiname) + self.wiki.update_page(self.page, self.wikiname, Wiki::WIKIFORMATS[self.wikiformat], data, self.commit) + self.text=self.page.formatted_data + + end + + def page + self.get_page(wikiname) if @page.nil? + @page + end + + def wiki + @wiki + end + def reload_page + self.get_page(self.wikiname) + end + protected + + + def self.is_file_availaible(name) + wiki = Gollum::Wiki.new("../wiki.git", :base_path => "/wiki") + wiki.page(name) + end + + def load_wiki + @wiki = Gollum::Wiki.new("../wiki.git", :base_path => "/wiki") + end + + def get_page(name) + @page= @wiki.page(name) + @page=self.wiki.write_page(self.wikiname, Wiki::WIKIFORMATS[self.wikiformat]," ",self.commit) if @page.nil? + @page + end + def commit + {message: "RailsUpdate", name:"SomeUser", email: "ttt@t"} + end + + def self.commit + {message: "RailsUpdate", name:"SomeUser", email: "ttt@t"} + end +end diff --git a/app/uploaders/attachment_uploader.rb b/app/uploaders/attachment_uploader.rb index cba26e4..c7d10a4 100644 --- a/app/uploaders/attachment_uploader.rb +++ b/app/uploaders/attachment_uploader.rb @@ -4,8 +4,13 @@ class AttachmentUploader < CarrierWave::Uploader::Base # Include RMagick or MiniMagick support: include CarrierWave::RMagick +# include CarrierWave::Uploader::Processing + # include CarrierWave::RMagick # include CarrierWave::MiniMagick +def root + Rails.root.join 'public/' +end # Choose what kind of storage to use for this uploader: storage :file @@ -16,12 +21,44 @@ class AttachmentUploader < CarrierWave::Uploader::Base def store_dir "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" end + def cover + manipulate! do |frame, index| + index== 0 ? frame.convert(:jpg) : nil + + end + end + version :thumb ,:if=>:image? do + process :resize_to_fill => [64, 64] + process :convert => :jpg - version :thumb do - process :resize_to_fill => [64, 64] - end + def full_filename(for_file) + super.chomp(File.extname(super)) + '.jpg' + end + end - # Provide a default URL as a default if there hasn't been a file uploaded: + version :cover , :if=>:image? do + process :cover + process :resize_to_fit => [64,64] + process :convert => :jpg + def full_filename(for_file) + super.chomp(File.extname(super)) + '.jpg' + end + end + version :thumb_small , :if=>:image? do + process :resize_to_fill => [32, 32] + end + version :thumb_big , :if=>:image? do + + process :resize_to_fill => [200, 200] + process :convert => :jpg + def full_filename(for_file) + super.chomp(File.extname(super)) + '.jpg' + end + + end + version :resized, :if=>:image? do + process :resize_to_fit => [1024,1024] + end # def default_url # # For Rails 3.1+ asset pipeline compatibility: # # ActionController::Base.helpers.asset_path("fallback/" + [version_name, "default.png"].compact.join('_')) @@ -52,5 +89,8 @@ class AttachmentUploader < CarrierWave::Uploader::Base # def filename # "something.jpg" if original_filename # end - +protected + def image?(file) + %w(jpg png jpeg).include?(File.extname(full_filename(file))) + end end diff --git a/app/uploaders/beispieldatei_uploader.rb b/app/uploaders/beispieldatei_uploader.rb index 86da81e..947f813 100644 --- a/app/uploaders/beispieldatei_uploader.rb +++ b/app/uploaders/beispieldatei_uploader.rb @@ -12,6 +12,10 @@ class BeispieldateiUploader < CarrierWave::Uploader::Base # Override the directory where uploaded files will be stored. # This is a sensible default for uploaders that are meant to be mounted: +def root + Rails.root.join 'public/' +end + def store_dir "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" end diff --git a/app/views/attachments/_attachment.html.erb b/app/views/attachments/_attachment.html.erb index 1fc66d3..0045f70 100644 --- a/app/views/attachments/_attachment.html.erb +++ b/app/views/attachments/_attachment.html.erb @@ -1,9 +1,9 @@ <% data_ext = attachment.datei.file.extension.downcase %> - <%= attachment.name %>
+ <% if (!["jpg","png","jpeg"].find_index(data_ext).nil?) %> <%= image_tag attachment.datei.thumb.url %> <% else %> <%= image_tag "pdf-logo.jpg" %> <% end %> - + <%= attachment.name %> diff --git a/app/views/attachments/_form_bulk.html.erb b/app/views/attachments/_form_bulk.html.erb new file mode 100644 index 0000000..b8c8616 --- /dev/null +++ b/app/views/attachments/_form_bulk.html.erb @@ -0,0 +1,143 @@ + +

+ <%= semantic_form_for [@thema,@attachment], :remote=>true, :html => { :multipart => true, :id => "fileupload" } do |f| %> + +
+ +
+
+ + + + Add files... + <%= f.file_field :datei, :multiple=>true %> + <% f.input :thema %> + + + + + +
+
+ +
+
+
+
+
+
+ +
+
+ + +
+ <% end %> + +
+ + + + + + + + diff --git a/app/views/beispiele/_beispiel.html.erb b/app/views/beispiele/_beispiel.html.erb index 7ba58a7..b44dde7 100644 --- a/app/views/beispiele/_beispiel.html.erb +++ b/app/views/beispiele/_beispiel.html.erb @@ -1,10 +1,32 @@
-
-<%=link_to beispiel.name, beispiel.beispieldatei.url%> <%= link_to "edit", edit_beispiel_path(beispiel)%>
-<%= I18n.t("file.size") + ": " + (beispiel.beispieldatei.size/1024.0).round(2).to_s %>KiB +
+ +<%=link_to ffi1_icon("note20")+" " + beispiel.name, beispiel.beispieldatei.url, title: beispiel.desc %> + +<%= I18n.t("file.size") + ": " + (beispiel.beispieldatei.size/1024.0).round(2).to_s %>KiB
+<%= +if can?(:like, beispiel) +link_to ffi1_icon("like3")+" like" + "("+beispiel.get_likes.size.to_s+")", like_beispiel_path(beispiel),title: "liked by " + ((current_user.liked?(beispiel)) ? ("you and " + ((beispiel.get_likes.size - 1).to_s + " others")) : beispiel.get_likes.size.to_s) +else +"liked by " + beispiel.get_likes.size.to_s +end +%> + +<%= +if can?(:dislike, beispiel) +link_to ffi1_icon("dislike")+" dislike" + "("+beispiel.get_dislikes.size.to_s+")", dislike_beispiel_path(beispiel),title:"disliked by " + ((current_user.disliked?(beispiel)) ? ("you and " + ((beispiel.get_dislikes.size - 1).to_s + " others")) : beispiel.get_dislikes.size.to_s) +else +"disliked by " + beispiel.get_dislikes.size.to_s +end + +%> + +<%= link_to ff_icon("icon-pencil")+" edit", edit_beispiel_path(beispiel) if can? :edit, beispiel%> +<%= link_to ff_icon("icon-remove")+" delete", beispiel_path(beispiel), :method=>:delete, :data=>{:confirm=>I18n.t('beispiel.sure')} if can? :delete, beispiel %>
+
-
+
<%= beispiel.desc %>
diff --git a/app/views/beispiele/_form.html.erb b/app/views/beispiele/_form.html.erb index 8fd09ce..fd92b3f 100755 --- a/app/views/beispiele/_form.html.erb +++ b/app/views/beispiele/_form.html.erb @@ -14,6 +14,8 @@
+ <%= f.input :name %> + <%= f.input :desc %>
@@ -21,7 +23,7 @@
- <%= f.input :lva, :as=>:radio, :collection => Lva.all%> + <%= f.input :lva, :as=>:radio, :collection => Lva.all %>
diff --git a/app/views/calentries/_nested_fields.html.erb b/app/views/calentries/_nested_fields.html.erb index e4fc987..6f1f97d 100644 --- a/app/views/calentries/_nested_fields.html.erb +++ b/app/views/calentries/_nested_fields.html.erb @@ -4,7 +4,7 @@
- <%= f.input :start, :as => :datepicker %>
+ <%= f.input :start, :as => :datetimepicker %>
<%= f.input :dauer , :as => :string, :append=>"h" %>
<% f.input :typ %>
<%= f.check_box :_destroy %> <%= I18n.t 'common.delete' %>
diff --git a/app/views/fetprofiles/_form.html.erb b/app/views/fetprofiles/_form.html.erb index 8143c08..b179549 100644 --- a/app/views/fetprofiles/_form.html.erb +++ b/app/views/fetprofiles/_form.html.erb @@ -11,11 +11,11 @@
- <%= f.input :desc %> + <%= f.input :desc , input_html: {style: "width:100%"}%>
-
<%= f.input :active %>
+
<%= f.input :active %> <%= f.input :geschlecht,:as=>:select, :collection=>Fetprofile::GESCHLECHT.invert %>
<%= image_tag(@fetprofile.picture.thumb.url) unless @fetprofile.picture.nil? %> <%= f.file_field :picture %> @@ -28,28 +28,48 @@
<%= f.input :fetmailalias %>
-<% @memberships.each do |m| %> +
+
- <%= f.semantic_fields_for :memberships, m do |membership| %> - -
- - -
<%= membership.input :start, :as=>:datepicker, :prepend=>"von",:label=>false%>
-
<%= membership.input :stop, :as=>:datepicker,:label=>false, :prepend =>"bis" %>
-
<%= membership.input :typ ,:as=>:select, :collection=>Membership::TYPEN.invert, :label=>false %>
-
<%= membership.input :gremium, :label=>false %> +<%= I18n.t("fetprofile.adresse") %>: + +<%=f.input :street %> + +
+<%=f.input :plz, input_html: {style: "width:5em"} %><%=f.input :city, input_html: {style: "width:5em"} %>
+<%=f.input :telnr %> +<%=f.input :hdynr %>
-
<%= membership.check_box :_destroy %> <%= I18n.t 'common.delete' %>
- -
- <% end %> - <% end %> <% end %> +
+<%= I18n.t("fetprofile.geburtstag") %>: + + + + +
<%=f.input :birth_day, input_html: {style: "width:3em"}%><%=f.input :birth_month, input_html: {style: "width:3em"} %><%=f.input :birth_year, input_html: {style: "width:5em"} %>
+ + + +<%=f.input :instant %> +<%=f.input :skype %> + +
+ +
+
+<% @memberships.each do |m| %> +<%= render partial:"membership_fields", object: m , locals: {:f=>f} %> +<% end %> +
+ +<% end %>
<%= f.actions do %> - <%= f.action :submit, :as => :input %> + <%= f.action :submit, :as => :button, :label=>I18n.t("common.save") %> + <%= f.action :submit, :as => :button, :label=>I18n.t("common.savecont"), :button_html=>{value: "continue"} %> + <%= f.action :cancel, :as=> :link , :label=>I18n.t("common.cancel") %> <% end %>
diff --git a/app/views/fetprofiles/_interninfo.html.erb b/app/views/fetprofiles/_interninfo.html.erb new file mode 100644 index 0000000..bd5fc1f --- /dev/null +++ b/app/views/fetprofiles/_interninfo.html.erb @@ -0,0 +1,16 @@ +

+Geburtstag <%= %> +

+

+ Adresse: + <%= interninfo.plz %> + <%= interninfo.city %>, + <%= interninfo.street %> +

+

+ <%= raw("Telefon: ")+ interninfo.telnr + "
" unless (interninfo.telnr.nil? || interninfo.telnr.empty?) %> + <%= raw("Handy: ") +interninfo.hdynr unless interninfo.hdynr.nil? || interninfo.hdynr.empty? %>
+<%= raw("Skype: ") +interninfo.skype unless interninfo.skype.nil? || interninfo.skype.empty? %>
+<%= raw("Instant Messaging: ") +interninfo.instant unless interninfo.instant.nil? || interninfo.instant.empty? %>
+ +

diff --git a/app/views/fetprofiles/_internrow.html.erb b/app/views/fetprofiles/_internrow.html.erb new file mode 100644 index 0000000..63fbb75 --- /dev/null +++ b/app/views/fetprofiles/_internrow.html.erb @@ -0,0 +1,12 @@ + + <%= link_to internrow.name, internrow %> + + <%= internrow.adress %> + + <%= raw("Telefon: ")+ internrow.telnr + "
" unless internrow.telnr.nil? || internrow.telnr.empty?%> + <%= raw("Handy: ") +internrow.hdynr + raw("
") unless internrow.hdynr.nil? || internrow.hdynr.empty? %> +<%= raw("Skype: ") +internrow.skype + raw("
") unless internrow.skype.nil? || internrow.skype.empty? %> +<%= raw("Instant Messaging: ") +internrow.instant + raw("
") unless internrow.instant.nil? || internrow.instant.empty? %> + +<%= internrow.fetmail %> + diff --git a/app/views/fetprofiles/_membership_fields.html.erb b/app/views/fetprofiles/_membership_fields.html.erb new file mode 100644 index 0000000..957347e --- /dev/null +++ b/app/views/fetprofiles/_membership_fields.html.erb @@ -0,0 +1,13 @@ +<%= f.semantic_fields_for :memberships, membership_fields do |membership| %> +
+<%= membership.input :start, :as=>:datepicker, :prepend=>"von",:label=>false , :input_html => { :style => "width:6em"} %> + + <%= membership.input :stop, :as=>:datepicker,:label=>false, :prepend =>"bis" , :input_html => { :style => "width:6em"}%> + +<%= membership.input :typ ,:as=>:select, :collection=>Membership::TYPEN.invert, :label=>false , :input_html => { :style => "width:12em" }%> + +<%= membership.input :gremium, :label=>false %> + +<%= membership.check_box :_destroy %> <%= I18n.t 'common.delete' %>
+ +<% end %> diff --git a/app/views/fetprofiles/edit.html.erb b/app/views/fetprofiles/edit.html.erb index c2d79e3..f63468c 100644 --- a/app/views/fetprofiles/edit.html.erb +++ b/app/views/fetprofiles/edit.html.erb @@ -1,6 +1,7 @@ -

Editing fetprofile

+

<%= I18n.t("fetprofile.edit")%>

<%= render 'form' %> -<%= link_to 'Show', @fetprofile %> | -<%= link_to 'Back', fetprofiles_path %> + + + diff --git a/app/views/fetprofiles/index.html.erb b/app/views/fetprofiles/index.html.erb index d80a255..21c64a6 100644 --- a/app/views/fetprofiles/index.html.erb +++ b/app/views/fetprofiles/index.html.erb @@ -6,9 +6,15 @@ <%= I18n.t 'profile.active_members' if params[:filter].nil? || params[:filter]== "active" %> +
+
+ <%= render 'layouts/pretty_toolbar' %> + + <% link_to I18n.t('profile.new_profile'), new_fetprofile_path %> +
+
-
-
- <%= link_to I18n.t('profile.new_profile'), new_fetprofile_path %> -
-
+
diff --git a/app/views/fetprofiles/internlist.html.erb b/app/views/fetprofiles/internlist.html.erb new file mode 100644 index 0000000..5d8f566 --- /dev/null +++ b/app/views/fetprofiles/internlist.html.erb @@ -0,0 +1,5 @@ + +<% @fetprofiles.each do |item| %> +<%= render partial: "internrow", object: item %> +<% end %> +
diff --git a/app/views/fetprofiles/new.html.erb b/app/views/fetprofiles/new.html.erb index 0499665..08d39f3 100644 --- a/app/views/fetprofiles/new.html.erb +++ b/app/views/fetprofiles/new.html.erb @@ -2,4 +2,4 @@ <%= render 'form' %> -<%= link_to I18n.t('common.back'), fetprofiles_path %> + diff --git a/app/views/fetprofiles/show.html.erb b/app/views/fetprofiles/show.html.erb index ded2659..866cb66 100644 --- a/app/views/fetprofiles/show.html.erb +++ b/app/views/fetprofiles/show.html.erb @@ -13,7 +13,7 @@

<%= @fetprofile.desc %>

- + <%= render partial: "interninfo", object: @fetprofile if can?(:seeintern, @fetprofile) %>
    <% @memberships.each do |m| %>
  • diff --git a/app/views/fragen/_form.html.erb b/app/views/fragen/_form.html.erb index ce19bc5..07f8b7d 100644 --- a/app/views/fragen/_form.html.erb +++ b/app/views/fragen/_form.html.erb @@ -10,3 +10,5 @@ <%= f.action :submit, :as => :input %> <% end %> <% end %> +<%= tinymce :theme => "simple", :language => "de", :plugins => ["wordcount", "paste"] %> + <% tinymce :compact %> diff --git a/app/views/fragen/_frage.html.erb b/app/views/fragen/_frage.html.erb index 1197db7..d7357a8 100644 --- a/app/views/fragen/_frage.html.erb +++ b/app/views/fragen/_frage.html.erb @@ -1,8 +1,8 @@

    - <%= frage.title %>
    + <%= frage.title %>?
    <%= raw(frage.text) %>
    -<%= link_to 'Edit', edit_frage_path(frage),:remote=>true %> | -<%= link_to 'Destroy',frage, method: :delete, :remote=> true , data: { confirm: 'Are you sure?' } %> +<%= link_to 'Edit', edit_frage_path(frage),:remote=>true %> +<%= link_to 'Destroy',frage, method: :delete, :remote=> true , data: { confirm: I18n.t("frage.sure") } %>

    diff --git a/app/views/fragen/_rform.html.erb b/app/views/fragen/_rform.html.erb index a3780d1..b772066 100644 --- a/app/views/fragen/_rform.html.erb +++ b/app/views/fragen/_rform.html.erb @@ -10,3 +10,4 @@ <%= f.action :submit, :as => :input %> <% end %> <% end %> + <%= tinymce :menubar=>false %> diff --git a/app/views/galleries/index.html.erb b/app/views/galleries/index.html.erb index 258fd23..105c0a4 100644 --- a/app/views/galleries/index.html.erb +++ b/app/views/galleries/index.html.erb @@ -1,4 +1,5 @@

    <%= I18n.t('fotos.galleries')%>

    +<%= render :partial => 'layouts/pretty_toolbar' %> <% @galleries.each_slice(2) do |row| %>
    <% row.each do |gallery| %> @@ -37,4 +38,3 @@ <% end %>
    -<%= render :partial => 'layouts/pretty_toolbar' %> diff --git a/app/views/gremien/_form.html.erb b/app/views/gremien/_form.html.erb index d253575..7873320 100644 --- a/app/views/gremien/_form.html.erb +++ b/app/views/gremien/_form.html.erb @@ -5,41 +5,41 @@ <%= f.input :typ, :as => :select, :collection => Gremium::TYPEN.invert %> <%= f.input :geschlecht, :as => :select, :collection => Gremium::GESCHLECHT.invert %> <%= f.input :thema, :as=> :select, :collection => Thema.all %> - - - <% f.inputs :for => :memberships, :objects=>@memberships do |membership,i| %> -
    -
    -
    <%= membership.input :start, :as=>:datepicker, :prepend=>"von",:label=>false%>
    -
    <%= membership.input :stop, :as=>:datepicker,:label=>false, :prepend =>"bis" %>
    -
    <%= membership.input :typ ,:as=>:select, :collection=>Membership::TYPEN.invert, :label=>false %>
    -
    <%= membership.input :fetprofile, :as=>:select, :label=>false %>
    - - -
    - <% end %> - - -<% @memberships.each do |m| %> - + <% @memberships.each do |m| %> <%= f.semantic_fields_for :memberships, m do |memberships_attributes| %>
    -
    <%= memberships_attributes.input :start, :as=>:datepicker, :prepend=>"von",:label=>false%>
    -
    <%= memberships_attributes.input :stop, :as=>:datepicker,:label=>false, :prepend =>"bis" %>
    -
    <%= memberships_attributes.input :typ ,:as=>:select, :collection=>Membership::TYPEN.invert, :label=>false %>
    -
    <%= memberships_attributes.input :fetprofile, :as=>:select, :label=>false %>
    - - +
    + + + + + + +
    <%= memberships_attributes.input :start, :as=>:datepicker, :prepend=>"von",:label=>false , :input_html => { :style => "width:6em" } ,:value=>Proc.new { |c| I18n.l(c) }%> + + <%= memberships_attributes.input :stop, :as=>:datepicker,:label=>false, :prepend =>"bis" , :input_html => { :style => "width:6em"},:value_method=>Proc.new { |c| I18n.l(c) }%> + + <%= memberships_attributes.input :typ ,:as=>:select, :collection=>Membership::TYPEN.invert, :label=>false, :input_html => { :style => "width:12em" } %> + <%= memberships_attributes.input :fetprofile, :as=>:select, :label=>false %>
    +
    + <% end %> + <% end %> <% end %> -<% end %> - - <% end %> <%= f.actions do %> <%= f.action :submit, :as => :input %> + <%= f.action :submit, :as => :button, :label=>I18n.t("common.savecont"), :button_html=>{value: "continue"} %> + <%= f.action :cancel, :as=> :link , :label=>I18n.t("common.cancel") %> + <% end %> <% end %> <%= tinymce %> + + + + + + diff --git a/app/views/gremien/verwalten.html.erb b/app/views/gremien/verwalten.html.erb index 38a339e..62f3cc1 100644 --- a/app/views/gremien/verwalten.html.erb +++ b/app/views/gremien/verwalten.html.erb @@ -1,13 +1,13 @@

    Listing gremien

    +<%= render 'layouts/pretty_toolbar' %>
    <% @gremien.each do |gremium| %>
    - <%= gremium.typ %> + <%= Gremium::TYPEN[gremium.typ.to_i] %>
    <%= gremium.name %> - <%= gremium.desc %>
    @@ -17,10 +17,9 @@
    @@ -38,7 +37,7 @@
    -<%= render 'layouts/pretty_toolbar' %> + diff --git a/app/views/home/_beispiele.html.erb b/app/views/home/_beispiele.html.erb index b6f178b..5b73511 100644 --- a/app/views/home/_beispiele.html.erb +++ b/app/views/home/_beispiele.html.erb @@ -1,21 +1,16 @@
    -
    -

    Neueste Beispiele in unserer Sammlung

    +

    <%= I18n.t("home.newexamples") %>

    <%= link_to I18n.t("beispiel.add"), new_beispiel_path, :class=>"btn"%>
    - - - - diff --git a/app/views/home/admin.html.erb b/app/views/home/admin.html.erb new file mode 100644 index 0000000..55cc15d --- /dev/null +++ b/app/views/home/admin.html.erb @@ -0,0 +1,12 @@ +

    <%= link_to "Grant extra FB privileges", user_omniauth_authorize_path(:facebook,:params=>{scope:"manage_pages,publish_actions,email"}) %> +

    +

    +<%= link_to "user", users_path %> +

    +

    +<%= @fbu.to_yaml.to_s %> + +<%= semantic_form_for :set_page, url: fb_set_default_publish_page_user_path(current_user), html:{method: :get} do |f| %> +<%= f.input :page , :input_html => { :name => 'page' }%> +<% end %> +

    diff --git a/app/views/home/dev.html.erb b/app/views/home/dev.html.erb deleted file mode 100755 index 1eef047..0000000 --- a/app/views/home/dev.html.erb +++ /dev/null @@ -1,31 +0,0 @@ -

    Entwicklungsprojekt

    -<%= link_to "notimplemented", home_linksnotimplemented_path %> -

    Feature List: 2013-07-17

    -
      -
    • Info zu Studien/Studienpläne
    • -
    • Info zu LVAs
    • -
    • Beispielsammlung
    • -
    • Kalender
    • -
    • Events
    • -
    • Termine
    • -
    • Fotos
    • -
    • FET Mitarbeiter
    • -
    • Personen Profile (TISS?)
    • -
    • News
    • -
    • Gremien - Mitgliedschaften
    • -
    • Börse (JOBs) Sitzungsbeschluss:Derzeit Nein
    • -
    • Lost&Found
    • -
    • FAQ
    • -
    • Informationen (ZB Auslandssemester, Anfänerinfo
    • -
    • Impressum
    • -
    • Linksammlung
    • -
    • Fetzn
    • -
    • FET Sitzungstops
    • -
    -

    Testfeatures

    -Neuigkeiten -

    Wichtige Punkte die noch entwickelt werden sind:

    • Verwaltung bestehender Nachrichten
    • Facebook Interface

    -

    <%= link_to "Neuigkeiten", rubriken_path %>

    - -

    Wiki

    -

    diff --git a/app/views/home/index.html.erb b/app/views/home/index.html.erb index 7b57ca4..d89b64c 100755 --- a/app/views/home/index.html.erb +++ b/app/views/home/index.html.erb @@ -5,7 +5,7 @@
  • <%= render n if can?(:show, n) %>
  • <% end %>
-

+

<%= link_to I18n.t('home.login'), user_omniauth_authorize_path(:ldap) %>

@@ -23,14 +23,11 @@

<%= link_to "Steuerelemente und Komponenten", "http://getbootstrap.com/2.3.2/index.html" %>

Um bei der Entwicklung mitzuhelfen braucht nur Ruby on Rails installiert werden

<%= link_to "Getting Started" , startdev_home_index_path %>

-

Das Kalender Feature wird überarbeitet, in Zukunft soll folgender Link nicht mehr funktionieren <%= link_to "Kalender", calendars_path %> -

-
<%= link_to "Entwicklungsstatus" , dev_home_index_path %> <%= render 'beispiele' %> -Verschiedene Styles +<%= I18n.t("home.selectstyle") %>
  • <%= link_to "Darkblue", home_index_path({:theme=>"darkblue"}) %>
  • <%= link_to "Blue1", home_index_path({:theme=>"blue1"}) %>
  • diff --git a/app/views/home/intern.html.erb b/app/views/home/intern.html.erb index b419c02..4dbf69d 100644 --- a/app/views/home/intern.html.erb +++ b/app/views/home/intern.html.erb @@ -1,10 +1,34 @@

    FET Intern NEU

    -

    Neuigkeiten

    - - diff --git a/app/views/studien/semesteransicht.html.erb b/app/views/studien/semesteransicht.html.erb deleted file mode 100644 index 5ea2bde..0000000 --- a/app/views/studien/semesteransicht.html.erb +++ /dev/null @@ -1,51 +0,0 @@ - -
    -
    - <%= render 'studien/tabs' %> -
    -

    <%= @studium.typ %> <%= @studium.name %> (<%= @studium.zahl %>)

    -
    -
    -
    - <%= link_to @text, studium_path(@studium, :ansicht=>@flip), :class=>"btn" %> - <%= link_to "Infoansicht", studium_path(@studium, :ansicht=>'infoansicht'), :class=>"btn" unless params[:ansicht]=='infoansicht'%> -
    -
    -
    - - <% if params[:info].true? %> - <%= raw(@studium.desc) %> - <% else %> - <%= @studium.desc_first_words %> <%= link_to I18n.t('studium.info'), studium_path(@studium, :ansicht=>params[:ansicht], :info=>true) %> - <% end %> - - <% @studium.semester.each do |sem| %> -
    -
    -
    -
    -
    - -
    -

    <%= sem.name %>

    -
    -
    <%= link_to I18n.t("lva.addrem"), edit_semester_path(sem), :class=>"btn-small"%>
    -
    - <% sem.lvas.each do |lva| %> -
    - - - <%= render :partial=>'lvas/lva_semester', :locals =>{:lva => lva}%> - - -
    - <% end %> - -
    -
    -
    -
    - <% end %> - - <%= render :partial=>'layouts/pretty_toolbar', :locals=>{:elements=>@toolbar_elements} %> -
    diff --git a/app/views/studien/show.html.erb b/app/views/studien/show.html.erb index 5ec47b1..01dcdcd 100644 --- a/app/views/studien/show.html.erb +++ b/app/views/studien/show.html.erb @@ -2,30 +2,30 @@

    <%= notice %>

    <%= @studium.typ %> <%= @studium.name %> (<%= @studium.zahl %>)

    -

    +

    +

    <%= link_to I18n.t("studien.ansicht.semester"), studium_path(@studium, :ansicht=>"semesteransicht"), :class=>"btn" unless params[:ansicht]=='semesteransicht' %> <%= link_to I18n.t("studien.ansicht.modulgruppe"), studium_path(@studium, :ansicht=>"modulgruppenansicht"), :class=>"btn" unless params[:ansicht]=='modulgruppenansicht' %> <%= link_to I18n.t("studien.ansicht.info"), studium_path(@studium, :ansicht=>"infoansicht"), :class=>"btn" unless params[:ansicht]=='infoansicht' %>
    -

    +

    +
    <% if params[:ansicht]=='modulgruppenansicht' %> <%= render partial: 'modulgruppenansicht' %> <% else if params[:ansicht]=='infoansicht' %> - <%= render partial: 'infoansicht' %> + <%= render partial: 'infoansicht' %> <% else if params[:ansicht]== 'qualifikationsprofil' %> -

    Qualifikationsprofil

    -

    -<%= raw(@studium.qualifikation) %> -

    - <% else %> - <%= render partial: 'semesteransicht' %> - +

    Qualifikationsprofil

    +

    + <%= raw(@studium.qualifikation) %> +

    + <% else %> + <%= render partial: 'semesteransicht' %> + <% end %> + <% end %> <% end %> - - - <% end %> <% end %> <% end %> - - <%= render :partial=>'layouts/pretty_toolbar', :object=>@toolbar_modulgruppen %>
    + <%= render :partial=>'layouts/pretty_toolbar', :object=>@toolbar_modulgruppen %> +
    <%= render 'layouts/pretty_toolbar' %>
    diff --git a/app/views/themen/_attachment_list.html.erb b/app/views/themen/_attachment_list.html.erb index 7b9c0cf..a210446 100644 --- a/app/views/themen/_attachment_list.html.erb +++ b/app/views/themen/_attachment_list.html.erb @@ -1,12 +1,18 @@ - +
    <% attachment_list.each do |a| %> +<% if editor %> +<% end %> <% end %>
    + <%= link_to a.datei.url do %> <%= render a %> +<% end %> <%= link_to "Edit", edit_thema_attachment_path(a.thema,a) %> +<%= link_to "Delete", thema_attachment_path(a.thema,a), method: "DELETE", confirm: "Sure?" %> +
    diff --git a/app/views/themen/_attachment_verwalten.html.erb b/app/views/themen/_attachment_verwalten.html.erb new file mode 100644 index 0000000..8fb67c3 --- /dev/null +++ b/app/views/themen/_attachment_verwalten.html.erb @@ -0,0 +1,3 @@ + +<%= render :partial=>"attachments/form_bulk" %> +<%= render partial: "themen/attachment_list", object:@thema.attachments ,locals: {:editor => true}%> diff --git a/app/views/themen/_form.html.erb b/app/views/themen/_form.html.erb index 08e8b59..4995656 100644 --- a/app/views/themen/_form.html.erb +++ b/app/views/themen/_form.html.erb @@ -1,33 +1,68 @@ <%= tinymce_assets %> +
    - - -<%= semantic_form_for @thema, :remote=>true do |f| %> + <%= semantic_form_for @thema, :remote=>remote do |f| %> <%= f.inputs do %> -
    -
    - <%= f.input :title %> -
    -
    - <%= f.input :themengruppe %> -
    -
    -
    - <%= f.input :text, :as=>:tinymce_text,:label=>false, :input_html=>{:rows=>20} %> -
    -
    +
    +
    + <%= f.input :title %> +
    +
    + <%= f.input :themengruppe %> +
    +
    +
    +
    + <%= f.input :isdraft %> +
    +
    + <%= f.input :hidelink, :as=>:boolean %> +
    +
    + <%= f.input :hideattachment %> + +
    + +
    + +
    +
    + <%= f.input :text, :as=>:tinymce_text,:label=>false, :input_html=>{:rows=>20} %> +
    +
    + +
    +
    + +<% unless I18n.locale == :de %> + <% I18n.with_locale(:de) do %> + <%= raw(@thema.text) %> + <% end %> +<% end %> +
    +
    + +
    +
    + + <%= f.actions do %> + <%= f.action :submit, :as => :button, :label=> I18n.t("thema.save" ) %> + <%= f.action :submit, :as => :button, :label=> I18n.t("thema.savecont"), :button_html=>{:value=>"continue"} %> + <%= f.action :cancel, :as => :link %> + <% end %> +
    +
    + + <% end %> + <% end %> + <%= tinymce %>
    -<%= f.actions do %> -<%= f.action :submit, :as => :button %> - -<%= f.action :cancel, :as => :link %> -<% end %> -<% end %><% end %> - <%= tinymce %> +<%= tinymce_icon_choice %>

    Attachments:

    <%= render :partial => "themen/select", :object => @thema,:locals =>{ :editor => :true} %> + diff --git a/app/views/themen/_fragen.html.erb b/app/views/themen/_fragen.html.erb index 727a14f..ea30282 100644 --- a/app/views/themen/_fragen.html.erb +++ b/app/views/themen/_fragen.html.erb @@ -6,5 +6,5 @@
    <%= render :partial=>'fragen/rform' %>
    -<% @frage_elements = [{:icon=>:plus, :hicon=>'icon-plus', :text=>I18n.t('frage.add'), :path=>new_frage_path}] %> -<%= render :partial=>'layouts/pretty_toolbar', :object=>@frage_elements %> +<% # @frage_elements = [{:icon=>:plus, :hicon=>'icon-plus', :text=>I18n.t('frage.add'), :path=>new_frage_path}] %> +<% # render :partial=>'layouts/pretty_toolbar', :object=>@frage_elements %> diff --git a/app/views/themen/_select.html.erb b/app/views/themen/_select.html.erb index 2ddb1f9..a693ec0 100644 --- a/app/views/themen/_select.html.erb +++ b/app/views/themen/_select.html.erb @@ -23,10 +23,7 @@

    -<% unless @thema.id.nil? %> -<% @att_elements = [{:icon=>:plus, :hicon=>'icon-plus', :text=>I18n.t('attachment.add'), :path=>new_thema_attachment_path(@thema),:remote=>true}] %> -
    -
    -<%= render :partial=>'layouts/pretty_toolbar', :object=>@att_elements %> -<% end %> + + +
    diff --git a/app/views/themen/_small.html.erb b/app/views/themen/_small.html.erb index dfe8095..dfa0fc3 100644 --- a/app/views/themen/_small.html.erb +++ b/app/views/themen/_small.html.erb @@ -1,18 +1,30 @@ - -

    <%= small.title %>

    -
    + +

    <%= small.title %> <%= link_to fa_icon("pencil"), verwalten_thema_path(small) if can? :edit, small %>

    +
    +<% if small.is_outdated? %> +
    <%= I18n.t("thema.outdated") %>
    +<% end %> +<% if small.isdraft %> +
    <%= I18n.t("thema.isdraft") %>
    + +<% end %> <%= raw(small.text) %>
    -<%= raw("FAQs:") unless small.fragen.empty? %> +<%= raw("FAQs:") unless small.fragen.empty? %>
    <% small.fragen.each do |frage| %>

    <%= frage.title %>
    -<%= raw(frage.text) %> + <%= raw(frage.text) %>

    -
    <% end %> +<% unless small.hideattachment %> +<%= render partial: "themen/attachment_list", object: small.attachments, locals:{editor: false} unless small.attachments.empty? %> +<% end %> +
    + + <% @small_elements = [] @small_elements << {:icon=>:pencil, :hicon=>'icon-pencil', :text=>I18n.t('thema.edit'), :path=>small} if can? :edit, small diff --git a/app/views/themen/_verw_liste.html.erb b/app/views/themen/_verw_liste.html.erb index 8783dbe..777a730 100644 --- a/app/views/themen/_verw_liste.html.erb +++ b/app/views/themen/_verw_liste.html.erb @@ -1,4 +1,8 @@ <% verw_liste.each do |thema| %> -
  • <%= thema.title %>

    -<%= link_to thema_path(thema),:remote=>true do %> Show <% end %> <%= link_to edit_thema_path(thema),:remote=>true do %> Edit <% end %> <%= link_to fragen_thema_path(thema),:remote=>true do %> Fragen <% end %><%= link_to attachments_thema_path(thema),:remote=>true do %> Attachments <% end %>
  • +
  • <%= thema.title %>
    + +<%= link_to thema_path(thema),:remote=>true do %> Show <% end %> +<%= link_to edit_thema_path(thema),:remote=>true do %> Edit <% end %> +<%= link_to fragen_thema_path(thema),:remote=>true do %> Fragen <% end %> +<%= link_to attachments_thema_path(thema),:remote=>true do %> Attachments <% end %>
  • <% end %> diff --git a/app/views/themen/attachments.js.erb b/app/views/themen/attachments.js.erb index 79f8f32..e1dceb5 100644 --- a/app/views/themen/attachments.js.erb +++ b/app/views/themen/attachments.js.erb @@ -1 +1 @@ -$("#themaview").html("<%= escape_javascript(raw("

    "+I18n.t('thema.show')+"

    ")+render(:partial=>"themen/attachment_list", :object=>@attachments) )%>"); \ No newline at end of file +$("#themaview").html("<%= escape_javascript(raw("

    "+I18n.t('thema.show')+"

    ")+render(:partial=>"themen/attachment_verwalten") )%>"); \ No newline at end of file diff --git a/app/views/themen/edit.html.erb b/app/views/themen/edit.html.erb index de6c7a3..3518641 100644 --- a/app/views/themen/edit.html.erb +++ b/app/views/themen/edit.html.erb @@ -1,5 +1,5 @@
    -

    Editing thema

    -<%= render 'form' %> +

    <%= I18n.t("thema.edit")%>

    +<%= render 'form', :locals=>{:remote=>false}, :remote=>false %>

    <%= link_to 'Back', @thema %> diff --git a/app/views/themen/edit.js.erb b/app/views/themen/edit.js.erb index 30ca8ab..5c8ca30 100644 --- a/app/views/themen/edit.js.erb +++ b/app/views/themen/edit.js.erb @@ -1 +1,3 @@ -$("#themaview").html("<%= escape_javascript(raw("

    "+I18n.t('thema.edit')+"

    ")+render(:partial=>"themen/form") )%>"); +$("#themaview").html("<%= escape_javascript(raw("

    "+I18n.t('thema.edit')+"

    ")+render(:partial=>"themen/form", :locals=>{:remote=>true}) )%>"); + + diff --git a/app/views/themen/new.html.erb b/app/views/themen/new.html.erb index d2d719c..a7d70ce 100644 --- a/app/views/themen/new.html.erb +++ b/app/views/themen/new.html.erb @@ -1,6 +1,6 @@

    <%= I18n.t("thema.add") %>

    -<%= render 'form' %> +<%= render 'form', :remote=>false %>
    <%= link_to 'Back', themen_path %> diff --git a/app/views/themen/show.html.erb b/app/views/themen/show.html.erb index aa8912a..534a436 100644 --- a/app/views/themen/show.html.erb +++ b/app/views/themen/show.html.erb @@ -5,5 +5,3 @@ <%= render :partial=>'layouts/pretty_toolbar' %> -<%= link_to new_thema_attachment_path(@thema) ,:remote=>true do %> new Attachment <% end %> -<%= render :partial => "themen/select", :object => @thema, :locals=>{:editor => :false} %> diff --git a/app/views/themen/update.js.erb b/app/views/themen/update.js.erb index 82e2ffb..e65de53 100644 --- a/app/views/themen/update.js.erb +++ b/app/views/themen/update.js.erb @@ -1,4 +1,4 @@ -$("#themaview").html("<%= escape_javascript(raw("

    Bearbeiten

    ")+render(:partial=>"themen/small", :object=>@thema) )%>"); +$("#themaview").html("<%= escape_javascript(raw("

    "+I18n.t("thema.edit")+"

    ")+render(:partial=>"themen/small", :object=>@thema) )%>"); $("#themen").html("<%= escape_javascript(render(:partial=>"themen/verw_liste", :object=>@themen) )%>"); diff --git a/app/views/themen/verwalten.html.erb b/app/views/themen/verwalten.html.erb index 70177ca..6b1a1bd 100644 --- a/app/views/themen/verwalten.html.erb +++ b/app/views/themen/verwalten.html.erb @@ -1,6 +1,9 @@

    <%= notice %>

    -

    <%= @thema.title %>

    +
    +
    +
    +

    <%= raw(@thema.text) %>

    @@ -11,16 +14,22 @@ --> <%= render :partial=>'layouts/pretty_toolbar' %> +

    <%= I18n.t('attachment.title')%>:

    +
    +
    +<%= render partial: "attachment_verwalten" %> +<%= render :partial => "themen/select", :object => @thema, :locals=>{:editor => :false} %> + +
    +
    + <%= render :partial=>'themen/fragen' %>
    -

    <%= I18n.t('attachment.title')%>:

    -
    -
    - -<%= link_to new_thema_attachment_path(@thema) ,:remote=>true do %> new Attachment <% end %> -<%= render :partial => "themen/select", :object => @thema, :locals=>{:editor => :false} %> <%= link_to I18n.t('common.back'), themengruppen_path, :class=>:btn %> +
    +
    +
    diff --git a/app/views/themengruppen/_form.html.erb b/app/views/themengruppen/_form.html.erb index e8c5f15..f005481 100644 --- a/app/views/themengruppen/_form.html.erb +++ b/app/views/themengruppen/_form.html.erb @@ -2,9 +2,11 @@ <%= f.inputs do %> <%= f.input :title %> <%= f.input :priority %> + <%= f.input :public %> <%= f.input :picture, :as => :file %> <%= f.input :text %> - + <%= f.input :icon , :input_html=>{:id=>"iconfield"}%> + <% end %> <%= f.actions do %> @@ -12,3 +14,13 @@ <%= f.action :cancel,:label => I18n.t("common.back"), :as => :link %> <% end %> <% end %> + + + + <% ffi1_list.each do |i| %> + <%=ffi1_icon(i)%> + +<% end %> diff --git a/app/views/themengruppen/_themengruppe.html.erb b/app/views/themengruppen/_themengruppe.html.erb index a565d37..7e99e23 100644 --- a/app/views/themengruppen/_themengruppe.html.erb +++ b/app/views/themengruppen/_themengruppe.html.erb @@ -1,13 +1,21 @@ -<%= link_to themengruppe,{:class=>'linkbox'} do %> +<%= link_to themengruppe,{:class=>'linkbox color-1-dark'} do %>
    -
    +
    + <% if themengruppe.icon.nil? or themengruppe.icon.empty? %> <%= image_tag themengruppe.picture.thumb.url,{:class=>"img-rounded"} %> + <% end %> +
    -

    <%=themengruppe.title%>

    +

    + <% unless themengruppe.icon.nil? or themengruppe.icon.empty? %> + <% end %> + +<%=themengruppe.title%>

    +
    @@ -26,7 +34,7 @@
      - <% themengruppe.themen.order(:title).each do |t| %> + <% themengruppe.themen.where(" (NOT hidelink) and ( NOT isdraft) ").order(:priority).reverse.each do |t| %>
    • <%= render t %>
    • diff --git a/app/views/themengruppen/faqs.html.erb b/app/views/themengruppen/faqs.html.erb index d3a7ab0..4dc64ce 100644 --- a/app/views/themengruppen/faqs.html.erb +++ b/app/views/themengruppen/faqs.html.erb @@ -1,24 +1,25 @@ +

      <%= I18n.t("themengruppe.faqs") %>

      - <% @themengruppen.each do |tg| %> -
      - -

      <%= tg.title%>

      -
        - <% tg.themen.order(:priority).reverse.each do |t| %> -
      • <%= t.title %> -
          <% t.fragen.each do |f| %> -
        • - <%= f.title %> -

          <%= f.text %>

          -
        • - - <% end %> -
        - -
      • - <% end %> -
      - -
      - <% end %> + <% @themengruppen.each do |tg| %> +
      + +

      <%= tg.title%>

      +
        + <% tg.themen.order(:priority).reverse.each do |t| %> +
      • <%= t.title %> +
          <% t.fragen.each do |f| %> +
        • + <%= f.title %>? +

          <%= raw(f.text) %>

          +
        • + + <% end %> +
        + +
      • + <% end %> +
      + +
      + <% end %>
      diff --git a/app/views/themengruppen/index.html.erb b/app/views/themengruppen/index.html.erb index 2bcb394..9e5acf4 100644 --- a/app/views/themengruppen/index.html.erb +++ b/app/views/themengruppen/index.html.erb @@ -1,35 +1,31 @@
      -

      <%= link_to "FAQS", faqs_themengruppen_path,class: :btn %>

      -
      - -<%= render :partial=>'layouts/pretty_toolbar' %> + diff --git a/app/views/themengruppen/show.html.erb b/app/views/themengruppen/show.html.erb index daf766d..73681e3 100644 --- a/app/views/themengruppen/show.html.erb +++ b/app/views/themengruppen/show.html.erb @@ -1,41 +1,44 @@
      - <%= link_to fa_icon("arrow-circle-left 2x")+" Alle Themengruppen", themengruppen_path, :class=>"linkbox" %> - <%= link_to fa_icon("question 2x")+" Häufige Fragen", faqs_themengruppen_path(:anchor=>"themengruppe_"+@themengruppe.id.to_s), :class=>"linkbox" %> -

      <%= @themengruppe.title %>

      + + <%= render :partial=>'layouts/pretty_toolbar' %> + +

      <% unless @themengruppe.icon.nil? or @themengruppe.icon.empty? %> + <% end %> +<%= @themengruppe.title %>

      +

      <%= @themengruppe.text %>

      - <%= render :partial=>'layouts/pretty_toolbar' %>
      diff --git a/app/views/themengruppen/verwalten.html.erb b/app/views/themengruppen/verwalten.html.erb index 5522f5f..ce0b343 100644 --- a/app/views/themengruppen/verwalten.html.erb +++ b/app/views/themengruppen/verwalten.html.erb @@ -2,6 +2,8 @@ #themen { list-style-type: none; margin: 0; padding: 0; margin-bottom: 15px;zoom: 1; } #themen li { margin: 0 5px 5px 5px; padding: 5px; font-size: 1.2em; width: 95%; } +<%= render :partial=>'layouts/pretty_toolbar' %> +
      diff --git a/app/views/themengruppen/verwalten_all.html.erb b/app/views/themengruppen/verwalten_all.html.erb new file mode 100644 index 0000000..8d40ec1 --- /dev/null +++ b/app/views/themengruppen/verwalten_all.html.erb @@ -0,0 +1,54 @@ + +<%= render :partial=>'layouts/pretty_toolbar' %> +
      +
      +
      +
        +<% @themengruppen.each do |themengruppe| %> +
      • <%= themengruppe.title %>-<%= themengruppe.priority %>
      • +<% end %> +
      +
        +<% @themengruppen_intern.each do |themengruppe| %> +
      • <%= themengruppe.title %>-<%= themengruppe.priority %>
      • +<% end %> +
      + +
      +
      +
      + diff --git a/app/views/themes/2003/themengruppen/verwalten_all.html.erb b/app/views/themes/2003/themengruppen/verwalten_all.html.erb index 827bd69..6367fa7 100644 --- a/app/views/themes/2003/themengruppen/verwalten_all.html.erb +++ b/app/views/themes/2003/themengruppen/verwalten_all.html.erb @@ -1,4 +1,6 @@ +<%= render :partial=>'layouts/pretty_toolbar' %> +
        <% @themengruppen.each do |themengruppe| %>
      • <%= themengruppe.title %>-<%= themengruppe.priority %>
      • @@ -6,7 +8,6 @@