commit 3d11400d5ef6c81904f68b8fe19c4aefd8311774 Author: Andreas Stephanides Date: Tue Feb 12 02:05:12 2013 +0100 GitHub Account angelegt diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..412eeda --- /dev/null +++ b/.gitattributes @@ -0,0 +1,22 @@ +# Auto detect text files and perform LF normalization +* text=auto + +# Custom for Visual Studio +*.cs diff=csharp +*.sln merge=union +*.csproj merge=union +*.vbproj merge=union +*.fsproj merge=union +*.dbproj merge=union + +# Standard to msysgit +*.doc diff=astextplain +*.DOC diff=astextplain +*.docx diff=astextplain +*.DOCX diff=astextplain +*.dot diff=astextplain +*.DOT diff=astextplain +*.pdf diff=astextplain +*.PDF diff=astextplain +*.rtf diff=astextplain +*.RTF diff=astextplain diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..eb3489a --- /dev/null +++ b/.gitignore @@ -0,0 +1,15 @@ +# See http://help.github.com/ignore-files/ for more about ignoring files. +# +# If you find yourself ignoring temporary files generated by your text editor +# or operating system, you probably want to add a global ignore instead: +# git config --global core.excludesfile ~/.gitignore_global + +# Ignore bundler config +/.bundle + +# Ignore the default SQLite database. +/db/*.sqlite3 + +# Ignore all logfiles and tempfiles. +/log/*.log +/tmp diff --git a/.project b/.project new file mode 100644 index 0000000..8722348 --- /dev/null +++ b/.project @@ -0,0 +1,19 @@ + + + fetsite + + + + + + com.aptana.ide.core.unifiedBuilder + + + + + + com.aptana.projects.webnature + org.radrails.rails.core.railsnature + com.aptana.ruby.core.rubynature + + diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..223acd3 --- /dev/null +++ b/Gemfile @@ -0,0 +1,55 @@ +source 'https://rubygems.org' + +gem 'rails', '3.2.9' + +# Bundle edge Rails instead: +# gem 'rails', :git => 'git://github.com/rails/rails.git' + +gem 'sqlite3' +gem 'execjs' + + +# Gems used only for assets and not required +# in production environments by default. +group :assets do + gem 'sass-rails', '~> 3.2.3' + gem 'coffee-rails', '~> 3.2.1' +gem 'bootstrap-sass','~> 2.2.0' + # See https://github.com/sstephenson/execjs#readme for more supported runtimes + gem 'therubyracer', :platforms => :ruby + + gem 'uglifier', '>= 1.0.3' +end + + +gem 'jquery-rails' + +# To use ActiveModel has_secure_password +# gem 'bcrypt-ruby', '~> 3.0.0' + +# To use Jbuilder templates for JSON +# gem 'jbuilder' + +# Use unicorn as the app server +# gem 'unicorn' + +# Deploy with Capistrano +# gem 'capistrano' + +# To use debugger +# gem 'debugger' + +# Formbuilder for easier form generation +gem 'formtastic' +gem 'formtastic-bootstrap' +gem "tinymce-rails" + +gem "globalize3" + +gem "paper_trail" + +gem "devise" + +gem "rolify" + +gem "cancan" diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..c2c696e --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,150 @@ +GEM + remote: https://rubygems.org/ + specs: + actionmailer (3.2.9) + actionpack (= 3.2.9) + mail (~> 2.4.4) + actionpack (3.2.9) + activemodel (= 3.2.9) + activesupport (= 3.2.9) + builder (~> 3.0.0) + erubis (~> 2.7.0) + journey (~> 1.0.4) + rack (~> 1.4.0) + rack-cache (~> 1.2) + rack-test (~> 0.6.1) + sprockets (~> 2.2.1) + activemodel (3.2.9) + activesupport (= 3.2.9) + builder (~> 3.0.0) + activerecord (3.2.9) + activemodel (= 3.2.9) + activesupport (= 3.2.9) + arel (~> 3.0.2) + tzinfo (~> 0.3.29) + activeresource (3.2.9) + activemodel (= 3.2.9) + activesupport (= 3.2.9) + activesupport (3.2.9) + i18n (~> 0.6) + multi_json (~> 1.0) + arel (3.0.2) + bcrypt-ruby (3.0.1) + bcrypt-ruby (3.0.1-x86-mingw32) + bootstrap-sass (2.2.2.0) + sass (~> 3.2) + builder (3.0.4) + cancan (1.6.8) + coffee-rails (3.2.2) + coffee-script (>= 2.2.0) + railties (~> 3.2.0) + coffee-script (2.2.0) + coffee-script-source + execjs + coffee-script-source (1.4.0) + devise (2.2.1) + bcrypt-ruby (~> 3.0) + orm_adapter (~> 0.1) + railties (~> 3.1) + warden (~> 1.2.1) + erubis (2.7.0) + execjs (1.4.0) + multi_json (~> 1.0) + formtastic (2.2.1) + actionpack (>= 3.0) + formtastic-bootstrap (2.0.0) + formtastic (~> 2.2) + formtastic-bootstrap + globalize3 (0.3.0) + activemodel (>= 3.0.0) + activerecord (>= 3.0.0) + paper_trail (~> 2) + hike (1.2.1) + i18n (0.6.1) + journey (1.0.4) + jquery-rails (2.1.4) + railties (>= 3.0, < 5.0) + thor (>= 0.14, < 2.0) + mail (2.4.4) + i18n (>= 0.4.0) + mime-types (~> 1.16) + treetop (~> 1.4.8) + mime-types (1.19) + multi_json (1.5.0) + orm_adapter (0.4.0) + paper_trail (2.7.0) + activerecord (~> 3.0) + railties (~> 3.0) + polyglot (0.3.3) + rack (1.4.3) + rack-cache (1.2) + rack (>= 0.4) + rack-ssl (1.3.2) + rack + rack-test (0.6.2) + rack (>= 1.0) + rails (3.2.9) + actionmailer (= 3.2.9) + actionpack (= 3.2.9) + activerecord (= 3.2.9) + activeresource (= 3.2.9) + activesupport (= 3.2.9) + bundler (~> 1.0) + railties (= 3.2.9) + railties (3.2.9) + actionpack (= 3.2.9) + activesupport (= 3.2.9) + rack-ssl (~> 1.3.2) + rake (>= 0.8.7) + rdoc (~> 3.4) + thor (>= 0.14.6, < 2.0) + rake (10.0.3) + rdoc (3.9.4) + rolify (3.2.0) + sass (3.2.3) + sass-rails (3.2.5) + railties (~> 3.2.0) + sass (>= 3.1.10) + tilt (~> 1.3) + sprockets (2.2.2) + hike (~> 1.2) + multi_json (~> 1.0) + rack (~> 1.0) + tilt (~> 1.1, != 1.3.0) + sqlite3 (1.3.6) + sqlite3 (1.3.6-x86-mingw32) + thor (0.16.0) + tilt (1.3.3) + tinymce-rails (3.5.8) + railties (>= 3.1.1) + treetop (1.4.12) + polyglot + polyglot (>= 0.3.1) + tzinfo (0.3.35) + uglifier (1.3.0) + execjs (>= 0.3.0) + multi_json (~> 1.0, >= 1.0.2) + warden (1.2.1) + rack (>= 1.0) + +PLATFORMS + x86-mingw32 + +DEPENDENCIES + bootstrap-sass (~> 2.2.0) + cancan + coffee-rails (~> 3.2.1) + devise + execjs + formtastic + formtastic-bootstrap + globalize3 + jquery-rails + paper_trail + rails (= 3.2.9) + rolify + sass-rails (~> 3.2.3) + sqlite3 + therubyracer + tinymce-rails + uglifier (>= 1.0.3) diff --git a/README.rdoc b/README.rdoc new file mode 100644 index 0000000..7c36f23 --- /dev/null +++ b/README.rdoc @@ -0,0 +1,261 @@ +== Welcome to Rails + +Rails is a web-application framework that includes everything needed to create +database-backed web applications according to the Model-View-Control pattern. + +This pattern splits the view (also called the presentation) into "dumb" +templates that are primarily responsible for inserting pre-built data in between +HTML tags. The model contains the "smart" domain objects (such as Account, +Product, Person, Post) that holds all the business logic and knows how to +persist themselves to a database. The controller handles the incoming requests +(such as Save New Account, Update Product, Show Post) by manipulating the model +and directing data to the view. + +In Rails, the model is handled by what's called an object-relational mapping +layer entitled Active Record. This layer allows you to present the data from +database rows as objects and embellish these data objects with business logic +methods. You can read more about Active Record in +link:files/vendor/rails/activerecord/README.html. + +The controller and view are handled by the Action Pack, which handles both +layers by its two parts: Action View and Action Controller. These two layers +are bundled in a single package due to their heavy interdependence. This is +unlike the relationship between the Active Record and Action Pack that is much +more separate. Each of these packages can be used independently outside of +Rails. You can read more about Action Pack in +link:files/vendor/rails/actionpack/README.html. + + +== Getting Started + +1. At the command prompt, create a new Rails application: + rails new myapp (where myapp is the application name) + +2. Change directory to myapp and start the web server: + cd myapp; rails server (run with --help for options) + +3. Go to http://localhost:3000/ and you'll see: + "Welcome aboard: You're riding Ruby on Rails!" + +4. Follow the guidelines to start developing your application. You can find +the following resources handy: + +* The Getting Started Guide: http://guides.rubyonrails.org/getting_started.html +* Ruby on Rails Tutorial Book: http://www.railstutorial.org/ + + +== Debugging Rails + +Sometimes your application goes wrong. Fortunately there are a lot of tools that +will help you debug it and get it back on the rails. + +First area to check is the application log files. Have "tail -f" commands +running on the server.log and development.log. Rails will automatically display +debugging and runtime information to these files. Debugging info will also be +shown in the browser on requests from 127.0.0.1. + +You can also log your own messages directly into the log file from your code +using the Ruby logger class from inside your controllers. Example: + + class WeblogController < ActionController::Base + def destroy + @weblog = Weblog.find(params[:id]) + @weblog.destroy + logger.info("#{Time.now} Destroyed Weblog ID ##{@weblog.id}!") + end + end + +The result will be a message in your log file along the lines of: + + Mon Oct 08 14:22:29 +1000 2007 Destroyed Weblog ID #1! + +More information on how to use the logger is at http://www.ruby-doc.org/core/ + +Also, Ruby documentation can be found at http://www.ruby-lang.org/. There are +several books available online as well: + +* Programming Ruby: http://www.ruby-doc.org/docs/ProgrammingRuby/ (Pickaxe) +* Learn to Program: http://pine.fm/LearnToProgram/ (a beginners guide) + +These two books will bring you up to speed on the Ruby language and also on +programming in general. + + +== Debugger + +Debugger support is available through the debugger command when you start your +Mongrel or WEBrick server with --debugger. This means that you can break out of +execution at any point in the code, investigate and change the model, and then, +resume execution! You need to install ruby-debug to run the server in debugging +mode. With gems, use sudo gem install ruby-debug. Example: + + class WeblogController < ActionController::Base + def index + @posts = Post.all + debugger + end + end + +So the controller will accept the action, run the first line, then present you +with a IRB prompt in the server window. Here you can do things like: + + >> @posts.inspect + => "[#nil, "body"=>nil, "id"=>"1"}>, + #"Rails", "body"=>"Only ten..", "id"=>"2"}>]" + >> @posts.first.title = "hello from a debugger" + => "hello from a debugger" + +...and even better, you can examine how your runtime objects actually work: + + >> f = @posts.first + => #nil, "body"=>nil, "id"=>"1"}> + >> f. + Display all 152 possibilities? (y or n) + +Finally, when you're ready to resume execution, you can enter "cont". + + +== Console + +The console is a Ruby shell, which allows you to interact with your +application's domain model. Here you'll have all parts of the application +configured, just like it is when the application is running. You can inspect +domain models, change values, and save to the database. Starting the script +without arguments will launch it in the development environment. + +To start the console, run rails console from the application +directory. + +Options: + +* Passing the -s, --sandbox argument will rollback any modifications + made to the database. +* Passing an environment name as an argument will load the corresponding + environment. Example: rails console production. + +To reload your controllers and models after launching the console run +reload! + +More information about irb can be found at: +link:http://www.rubycentral.org/pickaxe/irb.html + + +== dbconsole + +You can go to the command line of your database directly through rails +dbconsole. You would be connected to the database with the credentials +defined in database.yml. Starting the script without arguments will connect you +to the development database. Passing an argument will connect you to a different +database, like rails dbconsole production. Currently works for MySQL, +PostgreSQL and SQLite 3. + +== Description of Contents + +The default directory structure of a generated Ruby on Rails application: + + |-- app + | |-- assets + | |-- images + | |-- javascripts + | `-- stylesheets + | |-- controllers + | |-- helpers + | |-- mailers + | |-- models + | `-- views + | `-- layouts + |-- config + | |-- environments + | |-- initializers + | `-- locales + |-- db + |-- doc + |-- lib + | `-- tasks + |-- log + |-- public + |-- script + |-- test + | |-- fixtures + | |-- functional + | |-- integration + | |-- performance + | `-- unit + |-- tmp + | |-- cache + | |-- pids + | |-- sessions + | `-- sockets + `-- vendor + |-- assets + `-- stylesheets + `-- plugins + +app + Holds all the code that's specific to this particular application. + +app/assets + Contains subdirectories for images, stylesheets, and JavaScript files. + +app/controllers + Holds controllers that should be named like weblogs_controller.rb for + automated URL mapping. All controllers should descend from + ApplicationController which itself descends from ActionController::Base. + +app/models + Holds models that should be named like post.rb. Models descend from + ActiveRecord::Base by default. + +app/views + Holds the template files for the view that should be named like + weblogs/index.html.erb for the WeblogsController#index action. All views use + eRuby syntax by default. + +app/views/layouts + Holds the template files for layouts to be used with views. This models the + common header/footer method of wrapping views. In your views, define a layout + using the layout :default and create a file named default.html.erb. + Inside default.html.erb, call <% yield %> to render the view using this + layout. + +app/helpers + Holds view helpers that should be named like weblogs_helper.rb. These are + generated for you automatically when using generators for controllers. + Helpers can be used to wrap functionality for your views into methods. + +config + Configuration files for the Rails environment, the routing map, the database, + and other dependencies. + +db + Contains the database schema in schema.rb. db/migrate contains all the + sequence of Migrations for your schema. + +doc + This directory is where your application documentation will be stored when + generated using rake doc:app + +lib + Application specific libraries. Basically, any kind of custom code that + doesn't belong under controllers, models, or helpers. This directory is in + the load path. + +public + The directory available for the web server. Also contains the dispatchers and the + default HTML files. This should be set as the DOCUMENT_ROOT of your web + server. + +script + Helper scripts for automation and generation. + +test + Unit and functional tests along with fixtures. When using the rails generate + command, template test files will be generated for you and placed in this + directory. + +vendor + External libraries that the application depends on. Also includes the plugins + subdirectory. If the app has frozen rails, those gems also go here, under + vendor/rails/. This directory is in the load path. diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..a51e5da --- /dev/null +++ b/Rakefile @@ -0,0 +1,7 @@ +#!/usr/bin/env rake +# Add your own tasks in files placed in lib/tasks ending in .rake, +# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. + +require File.expand_path('../config/application', __FILE__) + +Fetsite::Application.load_tasks diff --git a/app/assets/images/edit.png b/app/assets/images/edit.png new file mode 100644 index 0000000..0947dbf Binary files /dev/null and b/app/assets/images/edit.png differ diff --git a/app/assets/images/fet_logo_2.png b/app/assets/images/fet_logo_2.png new file mode 100644 index 0000000..04c920f Binary files /dev/null and b/app/assets/images/fet_logo_2.png differ diff --git a/app/assets/images/rails.png b/app/assets/images/rails.png new file mode 100644 index 0000000..d5edc04 Binary files /dev/null and b/app/assets/images/rails.png differ diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js new file mode 100644 index 0000000..f261299 --- /dev/null +++ b/app/assets/javascripts/application.js @@ -0,0 +1,17 @@ +// This is a manifest file that'll be compiled into application.js, which will include all the files +// listed below. +// +// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, +// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path. +// +// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the +// the compiled file. +// +// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD +// GO AFTER THE REQUIRES BELOW. +// +//= require jquery +//= require jquery_ujs +//= require_tree . +//= require tinymce-jquery +//= require bootstrap \ No newline at end of file diff --git a/app/assets/javascripts/lvas.js.coffee b/app/assets/javascripts/lvas.js.coffee new file mode 100644 index 0000000..7615679 --- /dev/null +++ b/app/assets/javascripts/lvas.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/javascripts/modulgruppen.js.coffee b/app/assets/javascripts/modulgruppen.js.coffee new file mode 100644 index 0000000..7615679 --- /dev/null +++ b/app/assets/javascripts/modulgruppen.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/javascripts/moduls.js.coffee b/app/assets/javascripts/moduls.js.coffee new file mode 100644 index 0000000..7615679 --- /dev/null +++ b/app/assets/javascripts/moduls.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/javascripts/neuigkeiten.js.coffee b/app/assets/javascripts/neuigkeiten.js.coffee new file mode 100644 index 0000000..7615679 --- /dev/null +++ b/app/assets/javascripts/neuigkeiten.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/javascripts/rubriken.js.coffee b/app/assets/javascripts/rubriken.js.coffee new file mode 100644 index 0000000..7615679 --- /dev/null +++ b/app/assets/javascripts/rubriken.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/javascripts/semesters.js.coffee b/app/assets/javascripts/semesters.js.coffee new file mode 100644 index 0000000..7615679 --- /dev/null +++ b/app/assets/javascripts/semesters.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/javascripts/studia.js.coffee b/app/assets/javascripts/studia.js.coffee new file mode 100644 index 0000000..7615679 --- /dev/null +++ b/app/assets/javascripts/studia.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/javascripts/studmods.js.coffee b/app/assets/javascripts/studmods.js.coffee new file mode 100644 index 0000000..7615679 --- /dev/null +++ b/app/assets/javascripts/studmods.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/stylesheets/application.css.scss b/app/assets/stylesheets/application.css.scss new file mode 100644 index 0000000..7dc9389 --- /dev/null +++ b/app/assets/stylesheets/application.css.scss @@ -0,0 +1,35 @@ +/* + * This is a manifest file that'll be compiled into application.css, which will include all the files + * listed below. + * + * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, + * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path. + * + * You're free to add application-wide styles to this file and they'll appear at the top of the + * compiled file, but it's generally better to create a new file per style scope. + * + *= require_self + *= require_tree . + * require 'bootstrap' + */ + +@import 'bootstrap'; +@import 'bootstrap-responsive'; +h1 +{font-size: 23px} +h2 +{font-size: 19px} +body,html +{padding:0;margin:0;} + +div.header +{display: block; +background: url('/assets/fet_logo_2.png') rgb(200,200,200) no-repeat; +background-position:15px center; +height:60px; +padding-left:160px; +padding-top:0px; +overflow:hidden +} + + diff --git a/app/assets/stylesheets/layout.css.scss b/app/assets/stylesheets/layout.css.scss new file mode 100644 index 0000000..e69de29 diff --git a/app/assets/stylesheets/lvas.css.scss b/app/assets/stylesheets/lvas.css.scss new file mode 100644 index 0000000..797b72c --- /dev/null +++ b/app/assets/stylesheets/lvas.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the lvas controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/modulgruppen.css.scss b/app/assets/stylesheets/modulgruppen.css.scss new file mode 100644 index 0000000..6f8581d --- /dev/null +++ b/app/assets/stylesheets/modulgruppen.css.scss @@ -0,0 +1,25 @@ +// Place all the styles related to the modulgruppen controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ +div.modulgruppe_phase_1, div.modulgruppe_phase_2, div.modulgruppe_phase_3 +{padding:10px; +margin:2px; +border-radius:10px; +min-width:13em; +} + +div.modulgruppe_phase_1 , div.modulgruppe_phase_2 +{} + +div.modulgruppe_phase_1 +{border: #91B4FF solid 2px; + +} +div.modulgruppe_phase_2 +{border: #FF7575 solid 2px; + +} +div.modulgruppe_phase_3 +{border: #41B300 solid 2px; + +} \ No newline at end of file diff --git a/app/assets/stylesheets/moduls.css.scss b/app/assets/stylesheets/moduls.css.scss new file mode 100644 index 0000000..e7f0ba1 --- /dev/null +++ b/app/assets/stylesheets/moduls.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the moduls controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/neuigkeiten.css.scss b/app/assets/stylesheets/neuigkeiten.css.scss new file mode 100644 index 0000000..4a995b3 --- /dev/null +++ b/app/assets/stylesheets/neuigkeiten.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the neuigkeiten controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/rubriken.css.scss b/app/assets/stylesheets/rubriken.css.scss new file mode 100644 index 0000000..c2314eb --- /dev/null +++ b/app/assets/stylesheets/rubriken.css.scss @@ -0,0 +1,4 @@ +// Place all the styles related to the rubriken controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ + diff --git a/app/assets/stylesheets/scaffolds.css.scss b/app/assets/stylesheets/scaffolds.css.scss new file mode 100644 index 0000000..fb13622 --- /dev/null +++ b/app/assets/stylesheets/scaffolds.css.scss @@ -0,0 +1,60 @@ +body { + background-color: #fff; + color: #333; + font-family: verdana, arial, helvetica, sans-serif; + font-size: 13px; + line-height: 18px; +} + +p, ol, ul, td { + font-family: verdana, arial, helvetica, sans-serif; + font-size: 13px; + line-height: 18px; +} + +pre { + background-color: #eee; + padding: 10px; + font-size: 11px; +} + + + +div { + &.field, &.actions { + margin-bottom: 10px; + } +} + +#notice { + color: green; +} + +.field_with_errors { + padding: 2px; + background-color: red; + display: table; +} + +#error_explanation { + width: 450px; + border: 2px solid red; + padding: 7px; + padding-bottom: 0; + margin-bottom: 20px; + background-color: #f0f0f0; + h2 { + text-align: left; + font-weight: bold; + padding: 5px 5px 5px 15px; + font-size: 12px; + margin: -7px; + margin-bottom: 0px; + background-color: #c00; + color: #fff; + } + ul li { + + list-style: square; + } +} diff --git a/app/assets/stylesheets/semesters.css.scss b/app/assets/stylesheets/semesters.css.scss new file mode 100644 index 0000000..e7f20cf --- /dev/null +++ b/app/assets/stylesheets/semesters.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the semesters controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/studien.css.scss b/app/assets/stylesheets/studien.css.scss new file mode 100644 index 0000000..7b5973a --- /dev/null +++ b/app/assets/stylesheets/studien.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the studia controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb new file mode 100644 index 0000000..bdc1724 --- /dev/null +++ b/app/controllers/application_controller.rb @@ -0,0 +1,18 @@ +class ApplicationController < ActionController::Base + protect_from_forgery + before_filter :set_i18n_locale_from_params + protected + def set_i18n_locale_from_params + if params[:locale] + if I18n.available_locales.include?(params[:locale].to_sym) + I18n.locale=params[:locale].to_sym + else + flash.now[:notice]= "#{params[:locale]} translation not available" + logger.error flash.now[:notice] + end + end + end + def default_url_options + {locale: I18n.locale} + end +end diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb new file mode 100644 index 0000000..9fce75e --- /dev/null +++ b/app/controllers/home_controller.rb @@ -0,0 +1,6 @@ +class HomeController < ApplicationController + def index + + end + +end \ No newline at end of file diff --git a/app/controllers/lvas_controller.rb b/app/controllers/lvas_controller.rb new file mode 100644 index 0000000..ec2e929 --- /dev/null +++ b/app/controllers/lvas_controller.rb @@ -0,0 +1,84 @@ +class LvasController < ApplicationController + # GET /lvas + # GET /lvas.json + def index + @lvas = Lva.all + + respond_to do |format| + format.html # index.html.erb + format.json { render json: @lvas } + end + end + + # GET /lvas/1 + # GET /lvas/1.json + def show + @lva = Lva.find(params[:id]) + + respond_to do |format| + format.html # show.html.erb + format.json { render json: @lva } + end + end + + # GET /lvas/new + # GET /lvas/new.json + def new + @lva = Lva.new + modul=Modul.find(params[:modul_id]) + @lva.modul< true, :params => params.merge(overwrite).except(:controller,:action) + end + def switch_locale_url(target_locale) + current_url({:locale=>target_locale}) .sub "/"+I18n.locale.to_s+"/", "/"+target_locale.to_s+"/" + + end + +end diff --git a/app/helpers/lvas_helper.rb b/app/helpers/lvas_helper.rb new file mode 100644 index 0000000..f38e5b0 --- /dev/null +++ b/app/helpers/lvas_helper.rb @@ -0,0 +1,2 @@ +module LvasHelper +end diff --git a/app/helpers/modulgruppen_helper.rb b/app/helpers/modulgruppen_helper.rb new file mode 100644 index 0000000..eec6b8c --- /dev/null +++ b/app/helpers/modulgruppen_helper.rb @@ -0,0 +1,2 @@ +module ModulgruppenHelper +end diff --git a/app/helpers/moduls_helper.rb b/app/helpers/moduls_helper.rb new file mode 100644 index 0000000..d40cb7e --- /dev/null +++ b/app/helpers/moduls_helper.rb @@ -0,0 +1,2 @@ +module ModulsHelper +end diff --git a/app/helpers/neuigkeiten_helper.rb b/app/helpers/neuigkeiten_helper.rb new file mode 100644 index 0000000..e6cb104 --- /dev/null +++ b/app/helpers/neuigkeiten_helper.rb @@ -0,0 +1,2 @@ +module NeuigkeitenHelper +end diff --git a/app/helpers/rubriken_helper.rb b/app/helpers/rubriken_helper.rb new file mode 100644 index 0000000..ac76262 --- /dev/null +++ b/app/helpers/rubriken_helper.rb @@ -0,0 +1,2 @@ +module RubrikenHelper +end diff --git a/app/helpers/semesters_helper.rb b/app/helpers/semesters_helper.rb new file mode 100644 index 0000000..ccb76f0 --- /dev/null +++ b/app/helpers/semesters_helper.rb @@ -0,0 +1,2 @@ +module SemestersHelper +end diff --git a/app/helpers/studien_helper.rb b/app/helpers/studien_helper.rb new file mode 100644 index 0000000..5bf1ccc --- /dev/null +++ b/app/helpers/studien_helper.rb @@ -0,0 +1,2 @@ +module StudienHelper +end diff --git a/app/helpers/studmods_helper.rb b/app/helpers/studmods_helper.rb new file mode 100644 index 0000000..48667d4 --- /dev/null +++ b/app/helpers/studmods_helper.rb @@ -0,0 +1,2 @@ +module StudmodsHelper +end diff --git a/app/inputs/tinymce_text_input.rb b/app/inputs/tinymce_text_input.rb new file mode 100644 index 0000000..cc33657 --- /dev/null +++ b/app/inputs/tinymce_text_input.rb @@ -0,0 +1,5 @@ +class TinymceTextInput < FormtasticBootstrap::Inputs::TextInput + def input_html_options + super.merge(:class => "tinymce") + end +end diff --git a/app/mailers/.gitkeep b/app/mailers/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/app/mailers/confirmmailer.rb b/app/mailers/confirmmailer.rb new file mode 100644 index 0000000..77ccfa0 --- /dev/null +++ b/app/mailers/confirmmailer.rb @@ -0,0 +1,3 @@ +class Confirmmailer < ActionMailer::Base + default from: "from@example.com" +end diff --git a/app/models/.gitkeep b/app/models/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/app/models/ability.rb b/app/models/ability.rb new file mode 100644 index 0000000..359740c --- /dev/null +++ b/app/models/ability.rb @@ -0,0 +1,31 @@ +class Ability + include CanCan::Ability + + def initialize(user) + # Define abilities for the passed in user here. For example: + # + user ||= User.new # guest user (not logged in) + # if user.admin? + # can :manage, :all + # else + # can :read, :all + # end + can :read, Modulgruppe + if user.has_role? "newsadmin" + can :manage, Modulgruppe + 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-Abilities + end +end diff --git a/app/models/lva.rb b/app/models/lva.rb new file mode 100644 index 0000000..3b9ff5d --- /dev/null +++ b/app/models/lva.rb @@ -0,0 +1,7 @@ +class Lva < ActiveRecord::Base + has_paper_trail # Versionsver + attr_accessible :desc, :ects, :lvanr, :name, :stunden, :modul_ids + has_and_belongs_to_many :modul + has_and_belongs_to_many :semester + translates :desc, :fallbacks_for_empty_translations => true +end diff --git a/app/models/modul.rb b/app/models/modul.rb new file mode 100644 index 0000000..93d7165 --- /dev/null +++ b/app/models/modul.rb @@ -0,0 +1,9 @@ +class Modul < ActiveRecord::Base + attr_accessible :desc,:name, :depend, :studium_id, :modulgruppe_ids + + has_and_belongs_to_many :lvas + has_and_belongs_to_many :modulgruppen + + translates :desc,:depend, :versioning =>true, :fallbacks_for_empty_translations => true + +end diff --git a/app/models/modulgruppe.rb b/app/models/modulgruppe.rb new file mode 100644 index 0000000..7f21489 --- /dev/null +++ b/app/models/modulgruppe.rb @@ -0,0 +1,11 @@ +class Modulgruppe < ActiveRecord::Base + attr_accessible :name, :phase, :typ,:desc, :studium_id + belongs_to :studium, :foreign_key => "studium_id" + has_and_belongs_to_many :moduls + resourcify + validates :studium, :presence=>true + validates :name, :presence=>true,:uniqueness =>{:scope => :studium, :message => "Nur einmal je Studium erlaubt"} + validates :phase, :numericality => { :only_integer => true },:inclusion => {:in => [1, 2, 3, 4], :message => "%{value} is not valid, choose phase 1 to 4"}, :presence=>true + validates :typ, :inclusion => {:in => ["Pflicht","Vertiefungspflicht","Wahl"] } + translates :name,:desc, :versioning =>true,:fallbacks_for_empty_translations => true +end diff --git a/app/models/neuigkeit.rb b/app/models/neuigkeit.rb new file mode 100644 index 0000000..13db030 --- /dev/null +++ b/app/models/neuigkeit.rb @@ -0,0 +1,5 @@ +class Neuigkeit < ActiveRecord::Base + attr_accessible :datum, :text, :title + belongs_to :author, :class_name =>'User' + belongs_to :rubrik +end diff --git a/app/models/role.rb b/app/models/role.rb new file mode 100644 index 0000000..145baa7 --- /dev/null +++ b/app/models/role.rb @@ -0,0 +1,6 @@ +class Role < ActiveRecord::Base + has_and_belongs_to_many :users, :join_table => :users_roles + belongs_to :resource, :polymorphic => true + + scopify +end diff --git a/app/models/rubrik.rb b/app/models/rubrik.rb new file mode 100644 index 0000000..600438b --- /dev/null +++ b/app/models/rubrik.rb @@ -0,0 +1,10 @@ +class Rubrik < ActiveRecord::Base + attr_accessible :desc, :name, :prio + has_many :neuigkeiten +def moderator +end + +def moderator=(id) +User.find(id).add_role(:newsmoderator, self) +end +end diff --git a/app/models/semester.rb b/app/models/semester.rb new file mode 100644 index 0000000..13cb02d --- /dev/null +++ b/app/models/semester.rb @@ -0,0 +1,4 @@ +class Semester < ActiveRecord::Base + has_and_belongs_to_many :lvas + attr_accessible :name, :nummer, :ss, :ws +end diff --git a/app/models/studium.rb b/app/models/studium.rb new file mode 100644 index 0000000..7411b30 --- /dev/null +++ b/app/models/studium.rb @@ -0,0 +1,6 @@ +class Studium < ActiveRecord::Base + attr_accessible :desc, :name, :typ, :zahl + has_many :modulgruppen, inverse_of: :studium, :class_name => "Modulgruppe" + validates :zahl, :uniqueness => true + translates :desc,:shortdesc, :versioning =>true,:fallbacks_for_empty_translations => true +end diff --git a/app/models/user.rb b/app/models/user.rb new file mode 100644 index 0000000..673b7d6 --- /dev/null +++ b/app/models/user.rb @@ -0,0 +1,13 @@ +class User < ActiveRecord::Base + rolify + # Include default devise modules. Others available are: + # :token_authenticatable, :confirmable, + # :lockable, :timeoutable and :omniauthable + devise :database_authenticatable, :registerable,:confirmable, + :recoverable, :rememberable, :trackable, :validatable + + # Setup accessible (or protected) attributes for your model + attr_accessible :email, :password, :password_confirmation, :remember_me + # attr_accessible :title, :body + +end diff --git a/app/views/devise/confirmations/new.html.erb b/app/views/devise/confirmations/new.html.erb new file mode 100644 index 0000000..9c27eb7 --- /dev/null +++ b/app/views/devise/confirmations/new.html.erb @@ -0,0 +1,12 @@ +

Resend confirmation instructions

+ +<%= form_for(resource, :as => resource_name, :url => confirmation_path(resource_name), :html => { :method => :post }) do |f| %> + <%= devise_error_messages! %> + +
<%= f.label :email %>
+ <%= f.email_field :email, :autofocus => true %>
+ +
<%= f.submit "Resend confirmation instructions" %>
+<% end %> + +<%= render "devise/shared/links" %> diff --git a/app/views/devise/mailer/confirmation_instructions.html.erb b/app/views/devise/mailer/confirmation_instructions.html.erb new file mode 100644 index 0000000..5b04a72 --- /dev/null +++ b/app/views/devise/mailer/confirmation_instructions.html.erb @@ -0,0 +1,5 @@ +

Welcome <%= @email %>!

+ +

You can confirm your account email through the link below:

+ +

<%= link_to 'Confirm my account', confirmation_url(@resource, :confirmation_token => @resource.confirmation_token) %>

diff --git a/app/views/devise/mailer/reset_password_instructions.html.erb b/app/views/devise/mailer/reset_password_instructions.html.erb new file mode 100644 index 0000000..2713034 --- /dev/null +++ b/app/views/devise/mailer/reset_password_instructions.html.erb @@ -0,0 +1,8 @@ +

Hello <%= @resource.email %>!

+ +

Someone has requested a link to change your password. You can do this through the link below.

+ +

<%= link_to 'Change my password', edit_password_url(@resource, :reset_password_token => @resource.reset_password_token) %>

+ +

If you didn't request this, please ignore this email.

+

Your password won't change until you access the link above and create a new one.

diff --git a/app/views/devise/mailer/unlock_instructions.html.erb b/app/views/devise/mailer/unlock_instructions.html.erb new file mode 100644 index 0000000..a4152e1 --- /dev/null +++ b/app/views/devise/mailer/unlock_instructions.html.erb @@ -0,0 +1,7 @@ +

Hello <%= @resource.email %>!

+ +

Your account has been locked due to an excessive number of unsuccessful sign in attempts.

+ +

Click the link below to unlock your account:

+ +

<%= link_to 'Unlock my account', unlock_url(@resource, :unlock_token => @resource.unlock_token) %>

diff --git a/app/views/devise/passwords/edit.html.erb b/app/views/devise/passwords/edit.html.erb new file mode 100644 index 0000000..34a4960 --- /dev/null +++ b/app/views/devise/passwords/edit.html.erb @@ -0,0 +1,16 @@ +

Change your password

+ +<%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :put }) do |f| %> + <%= devise_error_messages! %> + <%= f.hidden_field :reset_password_token %> + +
<%= f.label :password, "New password" %>
+ <%= f.password_field :password, :autofocus => true %>
+ +
<%= f.label :password_confirmation, "Confirm new password" %>
+ <%= f.password_field :password_confirmation %>
+ +
<%= f.submit "Change my password" %>
+<% end %> + +<%= render "devise/shared/links" %> diff --git a/app/views/devise/passwords/new.html.erb b/app/views/devise/passwords/new.html.erb new file mode 100644 index 0000000..5a400df --- /dev/null +++ b/app/views/devise/passwords/new.html.erb @@ -0,0 +1,12 @@ +

Forgot your password?

+ +<%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :post }) do |f| %> + <%= devise_error_messages! %> + +
<%= f.label :email %>
+ <%= f.email_field :email, :autofocus => true %>
+ +
<%= f.submit "Send me reset password instructions" %>
+<% end %> + +<%= render "devise/shared/links" %> diff --git a/app/views/devise/registrations/edit.html.erb b/app/views/devise/registrations/edit.html.erb new file mode 100644 index 0000000..7d701c6 --- /dev/null +++ b/app/views/devise/registrations/edit.html.erb @@ -0,0 +1,29 @@ +

Edit <%= resource_name.to_s.humanize %>

+ +<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put }) do |f| %> + <%= devise_error_messages! %> + +
<%= f.label :email %>
+ <%= f.email_field :email, :autofocus => true %>
+ + <% if resource.class.reconfirmable && resource.unconfirmed_email.present? %> +
Currently waiting confirmation for: <%= resource.unconfirmed_email %>
+ <% end %> + +
<%= f.label :password %> (leave blank if you don't want to change it)
+ <%= f.password_field :password, :autocomplete => "off" %>
+ +
<%= f.label :password_confirmation %>
+ <%= f.password_field :password_confirmation %>
+ +
<%= f.label :current_password %> (we need your current password to confirm your changes)
+ <%= f.password_field :current_password %>
+ +
<%= f.submit "Update" %>
+<% end %> + +

Cancel my account

+ +

Unhappy? <%= link_to "Cancel my account", registration_path(resource_name), :data => { :confirm => "Are you sure?" }, :method => :delete %>.

+ +<%= link_to "Back", :back %> diff --git a/app/views/devise/registrations/new.html.erb b/app/views/devise/registrations/new.html.erb new file mode 100644 index 0000000..3f189d4 --- /dev/null +++ b/app/views/devise/registrations/new.html.erb @@ -0,0 +1,18 @@ +

Sign up

+ +<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| %> + <%= devise_error_messages! %> + +
<%= f.label :email %>
+ <%= f.email_field :email, :autofocus => true %>
+ +
<%= f.label :password %>
+ <%= f.password_field :password %>
+ +
<%= f.label :password_confirmation %>
+ <%= f.password_field :password_confirmation %>
+ +
<%= f.submit "Sign up" %>
+<% end %> + +<%= render "devise/shared/links" %> diff --git a/app/views/devise/sessions/new.html.erb b/app/views/devise/sessions/new.html.erb new file mode 100644 index 0000000..f9bc2c1 --- /dev/null +++ b/app/views/devise/sessions/new.html.erb @@ -0,0 +1,17 @@ +

Sign in

+ +<%= form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| %> +
<%= f.label :email %>
+ <%= f.email_field :email, :autofocus => true %>
+ +
<%= f.label :password %>
+ <%= f.password_field :password %>
+ + <% if devise_mapping.rememberable? -%> +
<%= f.check_box :remember_me %> <%= f.label :remember_me %>
+ <% end -%> + +
<%= f.submit "Sign in" %>
+<% end %> + +<%= render "devise/shared/links" %> diff --git a/app/views/devise/shared/_links.erb b/app/views/devise/shared/_links.erb new file mode 100644 index 0000000..eab783a --- /dev/null +++ b/app/views/devise/shared/_links.erb @@ -0,0 +1,25 @@ +<%- if controller_name != 'sessions' %> + <%= link_to "Sign in", new_session_path(resource_name) %>
+<% end -%> + +<%- if devise_mapping.registerable? && controller_name != 'registrations' %> + <%= link_to "Sign up", new_registration_path(resource_name) %>
+<% end -%> + +<%- if devise_mapping.recoverable? && controller_name != 'passwords' %> + <%= link_to "Forgot your password?", new_password_path(resource_name) %>
+<% end -%> + +<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %> + <%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %>
+<% end -%> + +<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %> + <%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %>
+<% end -%> + +<%- if devise_mapping.omniauthable? %> + <%- resource_class.omniauth_providers.each do |provider| %> + <%= link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider) %>
+ <% end -%> +<% end -%> \ No newline at end of file diff --git a/app/views/devise/unlocks/new.html.erb b/app/views/devise/unlocks/new.html.erb new file mode 100644 index 0000000..020787f --- /dev/null +++ b/app/views/devise/unlocks/new.html.erb @@ -0,0 +1,12 @@ +

Resend unlock instructions

+ +<%= form_for(resource, :as => resource_name, :url => unlock_path(resource_name), :html => { :method => :post }) do |f| %> + <%= devise_error_messages! %> + +
<%= f.label :email %>
+ <%= f.email_field :email, :autofocus => true %>
+ +
<%= f.submit "Resend unlock instructions" %>
+<% end %> + +<%= render "devise/shared/links" %> diff --git a/app/views/home/index.html.erb b/app/views/home/index.html.erb new file mode 100644 index 0000000..a7804fc --- /dev/null +++ b/app/views/home/index.html.erb @@ -0,0 +1,2 @@ +

<%= t :hello %>

+

<%= t 'home.hallobeiderfet' %>

diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb new file mode 100644 index 0000000..7979db7 --- /dev/null +++ b/app/views/layouts/application.html.erb @@ -0,0 +1,24 @@ + + + + Fetsite + <%= stylesheet_link_tag "application", :media => "all" %> + <%= javascript_include_tag "application" %> + <%= csrf_meta_tags %> + + + +
+

Fachschaft Elektrotechnik

+
+
+
+
+ +
+ + <%= yield %> +
+
+ + diff --git a/app/views/layouts/menu.html.erb b/app/views/layouts/menu.html.erb new file mode 100644 index 0000000..ac89b3e --- /dev/null +++ b/app/views/layouts/menu.html.erb @@ -0,0 +1,24 @@ +<%= t 'home.mtitle'%> + +<% if user_signed_in? %> +
  • Logged in as : <%= current_user.email %> + <%= link_to('Logout', destroy_user_session_path, :method => :delete) %> +
  • +<% else %> +
  • + <%= link_to('Login', new_user_session_path) %> +
  • +<% end %> +<%if I18n.locale == :en %> +<%= link_to "Deutsch" ,switch_locale_url(:de)%> +<% elsif I18n.locale == :de %> + <%= link_to "English" ,switch_locale_url(:en)%> + <%end %> diff --git a/app/views/lvas/_form.html.erb b/app/views/lvas/_form.html.erb new file mode 100644 index 0000000..06d8de7 --- /dev/null +++ b/app/views/lvas/_form.html.erb @@ -0,0 +1,18 @@ +<%= semantic_form_for @lva do |f| %> + <%= f.inputs do %> + <%= f.input :modul %> + <%= f.input :name %> + <%= f.input :ects %> + <%= f.input :stunden %> + + <%= f.input :desc %> + + <%= f.input :lvanr %> + + + <% end %> + + <%= f.actions do %> + <%= f.action :submit, :as => :input %> + <% end %> +<% end %> diff --git a/app/views/lvas/edit.html.erb b/app/views/lvas/edit.html.erb new file mode 100644 index 0000000..b728976 --- /dev/null +++ b/app/views/lvas/edit.html.erb @@ -0,0 +1,6 @@ +

    Editing lva

    + +<%= render 'form' %> + +<%= link_to 'Show', @lva %> | +<%= link_to 'Back', lvas_path %> diff --git a/app/views/lvas/index.html.erb b/app/views/lvas/index.html.erb new file mode 100644 index 0000000..c09b08a --- /dev/null +++ b/app/views/lvas/index.html.erb @@ -0,0 +1,31 @@ +

    Listing lvas

    + + + + + + + + + + + + + +<% @lvas.each do |lva| %> + + + + + + + + + + +<% end %> +
    NameDescEctsLvanrStunden
    <%= lva.name %><%= lva.desc %><%= lva.ects %><%= lva.lvanr %><%= lva.stunden %><%= link_to 'Show', lva %><%= link_to 'Edit', edit_lva_path(lva) %><%= link_to 'Destroy', lva, method: :delete, data: { confirm: 'Are you sure?' } %>
    + +
    + +<%= link_to 'New Lva', new_lva_path %> diff --git a/app/views/lvas/new.html.erb b/app/views/lvas/new.html.erb new file mode 100644 index 0000000..cc24a4c --- /dev/null +++ b/app/views/lvas/new.html.erb @@ -0,0 +1,5 @@ +

    New lva

    + +<%= render 'form' %> + +<%= link_to 'Back', lvas_path %> diff --git a/app/views/lvas/show.html.erb b/app/views/lvas/show.html.erb new file mode 100644 index 0000000..58e3be9 --- /dev/null +++ b/app/views/lvas/show.html.erb @@ -0,0 +1,20 @@ +

    <%= notice %>

    + +

    <%= @lva.lvanr %> + + <%= @lva.name %> (<%= @lva.ects %> ECTS/ <%= @lva.stunden %> Std)<%= link_to image_tag('edit.png'), edit_lva_path(@lva) %> | +

    +

    + <%= @lva.desc %> +

    + +<% @lva.modul.each do |modul| %> +<%= link_to modul.name , modul_path(modul)%>
    + <% modul.modulgruppen.each do |g| %> + <% link =g.studium.name + " - " +g.name %> + <%= link_to link , modulgruppe_path(g)%>
    + <%end%> +<%end%> + + +<%= link_to 'Back', lvas_path %> diff --git a/app/views/modulgruppen/_form.html.erb b/app/views/modulgruppen/_form.html.erb new file mode 100644 index 0000000..8191af5 --- /dev/null +++ b/app/views/modulgruppen/_form.html.erb @@ -0,0 +1,13 @@ +<%= semantic_form_for @modulgruppe do |f| %> + <%= f.inputs do %> + <%= f.input :studium_id, :as =>:select, :collection => Studium.all %> + <%= f.input :typ ,:as => :radio, :collection=>["Pflicht","Vertiefungspflicht","Wahl"]%> + <%= f.input :phase,:as => :radio,:collection=>1..3 %> + <%= f.input :name %> + <%= f.input :desc,:input_html=>{:rows=> 3 }%> + <% end %> + + <%= f.actions do %> + <%= f.action :submit, :as => :input %> + <% end %> +<% end %> diff --git a/app/views/modulgruppen/_modulgruppe.html.erb b/app/views/modulgruppen/_modulgruppe.html.erb new file mode 100644 index 0000000..3c710ae --- /dev/null +++ b/app/views/modulgruppen/_modulgruppe.html.erb @@ -0,0 +1,8 @@ +
    +

    <%= link_to modulgruppe.name, modulgruppe_path(modulgruppe) %><%= link_to image_tag('edit.png').html_safe+"Edit", edit_modulgruppe_path(modulgruppe),:class=>"btn" %>

    +<%= modulgruppe.desc%> + +<%= render :partial=>'moduls/kurz', :collection=>modulgruppe.moduls, :as=>:modul%> +
    +
    + diff --git a/app/views/modulgruppen/edit.html.erb b/app/views/modulgruppen/edit.html.erb new file mode 100644 index 0000000..ad76be3 --- /dev/null +++ b/app/views/modulgruppen/edit.html.erb @@ -0,0 +1,6 @@ +

    Editing modulgruppe

    + +<%= render 'form' %> + +<%= link_to 'Show', @modulgruppe %> | +<%= link_to 'Back', modulgruppen_path %> diff --git a/app/views/modulgruppen/index.html.erb b/app/views/modulgruppen/index.html.erb new file mode 100644 index 0000000..89e10b9 --- /dev/null +++ b/app/views/modulgruppen/index.html.erb @@ -0,0 +1,30 @@ +

    Listing modulgruppen

    + + + + + + + + + + + + +<% @modulgruppen.each do |modulgruppe| %> + + + + + + + + + +<% end %> +
    TypePhaseStudiumName
    <%= modulgruppe.typ %><%= modulgruppe.phase %><%= modulgruppe.studium.name %><%= modulgruppe.name %><%= link_to 'Show', modulgruppe %><%= link_to 'Edit', edit_modulgruppe_path(modulgruppe) %><%= link_to 'Destroy', modulgruppe, method: :delete, data: { confirm: 'Are you sure?' } %>
    + +
    +<% if !@studium.nil? %> +<%= link_to 'New Modulgruppe', new_modulgruppe_path %> +<% end%> diff --git a/app/views/modulgruppen/new.html.erb b/app/views/modulgruppen/new.html.erb new file mode 100644 index 0000000..d9eeb81 --- /dev/null +++ b/app/views/modulgruppen/new.html.erb @@ -0,0 +1,5 @@ +

    New modulgruppe

    + +<%= render 'form' %> + +<%= link_to 'Back', modulgruppen_path %> diff --git a/app/views/modulgruppen/show.html.erb b/app/views/modulgruppen/show.html.erb new file mode 100644 index 0000000..39eb89a --- /dev/null +++ b/app/views/modulgruppen/show.html.erb @@ -0,0 +1,27 @@ +

    <%= notice %>

    +
    +

    + <%= @modulgruppe.name %> +

    +

    + <%= link_to "Studium: "+@modulgruppe.studium.name, studium_path(@modulgruppe.studium) %> + +

    + <%= I18n.t "modulgruppe.typ"%>: + <%= @modulgruppe.typ %> +

    + + +<% @modulgruppe.moduls.each do |modul| %> +<%= render modul%> +<% end %> +
    + + +Default +
    +<%= link_to 'Add Modul', new_modul_path(:modulgruppen_id =>@modulgruppe.id) %> +<%= link_to 'Studium', studium_path(@modulgruppe.studium),:class =>"btn" %> +<%= link_to 'Edit', edit_modulgruppe_path(@modulgruppe),:class =>"btn" %> +<%= link_to 'Back', modulgruppen_path,:class =>"btn" %> +
    \ No newline at end of file diff --git a/app/views/moduls/_form.html.erb b/app/views/moduls/_form.html.erb new file mode 100644 index 0000000..7d73f6c --- /dev/null +++ b/app/views/moduls/_form.html.erb @@ -0,0 +1,14 @@ + +<%= semantic_form_for @modul do |f| %> + <%= f.inputs do %> + <%= f.input :modulgruppen,:as => :select, :collection => Hash[Modulgruppe.all.map{|m| [m.studium.name + " " + m.name,m.id]}] %> + <%= f.input :name ,:hint=>true%> + <%= f.input :desc, :as=>:tinymce_text %> + <%= f.input :depend %> + <% end %> + + <%= f.actions do %> + <%= f.action :submit, :as => :input %> + <% end %> +<% end %> +<%= tinymce %> \ No newline at end of file diff --git a/app/views/moduls/_kurz.html.erb b/app/views/moduls/_kurz.html.erb new file mode 100644 index 0000000..96e9726 --- /dev/null +++ b/app/views/moduls/_kurz.html.erb @@ -0,0 +1,9 @@ +

    + <%= link_to "Modul "+ modul.name , modul_path(modul) %> <%= link_to image_tag("edit.png"), edit_modul_path(modul) %> +

    +

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

    + +
    + diff --git a/app/views/moduls/_modul.html.erb b/app/views/moduls/_modul.html.erb new file mode 100644 index 0000000..c3fc650 --- /dev/null +++ b/app/views/moduls/_modul.html.erb @@ -0,0 +1,13 @@ +

    + <%= link_to "Modul "+ modul.name , modul_path(modul) %> <%= link_to image_tag("edit.png"), edit_modul_path(modul) %> +

    +

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

    +LVAs: +
      +<% modul.lvas.each do |lva| %> +
    • <%= link_to lva.lvanr+" "+ lva.name, lva %>
    • +<% end %> +
    +
    diff --git a/app/views/moduls/edit.html.erb b/app/views/moduls/edit.html.erb new file mode 100644 index 0000000..7ea122b --- /dev/null +++ b/app/views/moduls/edit.html.erb @@ -0,0 +1,8 @@ +

    <%= I18n.t "moduls.edit.title"%>

    + +<%= render 'form' %> + +<%= link_to 'Show', modul_path( @modul) %> | +<% if !@studium.nil? %> +<%= link_to 'Back', moduls_path(@modul) %> +<% end%> \ No newline at end of file diff --git a/app/views/moduls/index.html.erb b/app/views/moduls/index.html.erb new file mode 100644 index 0000000..cd23d5f --- /dev/null +++ b/app/views/moduls/index.html.erb @@ -0,0 +1,26 @@ +

    Listing moduls

    + + + + + + + + + + +<% @moduls.each do |modul| %> + + + + + + + +<% end %> +
    NameDesc
    <%= modul.name %><%= modul.desc %><%= link_to 'Show', modul_path(modul) %><%= link_to 'Edit', edit_modul_path(modul) %><%= link_to 'Destroy', [modul], method: :delete, data: { confirm: 'Are you sure?' } %>
    + +
    +<% if !@studium.nil? %> +<%= link_to 'New Modul', new_modul_path() %> +<% end%> diff --git a/app/views/moduls/new.html.erb b/app/views/moduls/new.html.erb new file mode 100644 index 0000000..b463dee --- /dev/null +++ b/app/views/moduls/new.html.erb @@ -0,0 +1,5 @@ +

    New modul

    + +<%= render 'form' %> + +<%= link_to 'Back', moduls_path %> diff --git a/app/views/moduls/show.html.erb b/app/views/moduls/show.html.erb new file mode 100644 index 0000000..e9160de --- /dev/null +++ b/app/views/moduls/show.html.erb @@ -0,0 +1,11 @@ +

    <%= notice %>

    + +<%= render @modul %> + +<% @modul.modulgruppen.each do |g| %> +<% link = g.studium.name + " - " +g.name %> +<%= link_to g.studium.name , studium_path(g.studium)%>
    +<%= link_to link , modulgruppe_path(g)%>
    +<%end%> + +<%= link_to 'Add LVA', new_lva_path(:modul_id =>@modul.id) %> diff --git a/app/views/neuigkeiten/_form.html.erb b/app/views/neuigkeiten/_form.html.erb new file mode 100644 index 0000000..f851941 --- /dev/null +++ b/app/views/neuigkeiten/_form.html.erb @@ -0,0 +1,11 @@ +<%= semantic_form_for @neuigkeit do |f| %> + <%= f.inputs do %> + <%= f.input :title, :placeholder=>"Titel" %> + <%= f.input :text %> + <%= f.input :datum %> + <% end %> + + <%= f.actions do %> + <%= f.action :submit, :as => :input %> + <% end %> +<% end %> diff --git a/app/views/neuigkeiten/edit.html.erb b/app/views/neuigkeiten/edit.html.erb new file mode 100644 index 0000000..a6c5a21 --- /dev/null +++ b/app/views/neuigkeiten/edit.html.erb @@ -0,0 +1,6 @@ +

    Editing neuigkeit

    + +<%= render 'form' %> + +<%= link_to 'Show', @neuigkeit %> | +<%= link_to 'Back', neuigkeiten_path %> diff --git a/app/views/neuigkeiten/index.html.erb b/app/views/neuigkeiten/index.html.erb new file mode 100644 index 0000000..b66a76d --- /dev/null +++ b/app/views/neuigkeiten/index.html.erb @@ -0,0 +1,27 @@ +

    Listing neuigkeiten

    + + + + + + + + + + + +<% @neuigkeiten.each do |neuigkeit| %> + + + + + + + + +<% end %> +
    TitleTextDatum
    <%= neuigkeit.title %><%= neuigkeit.text %><%= neuigkeit.datum %><%= link_to 'Show', neuigkeit %><%= link_to 'Edit', edit_neuigkeit_path(neuigkeit) %><%= link_to 'Destroy', neuigkeit, method: :delete, data: { confirm: 'Are you sure?' } %>
    + +
    + +<%= link_to 'New Neuigkeit', new_neuigkeit_path %> diff --git a/app/views/neuigkeiten/new.html.erb b/app/views/neuigkeiten/new.html.erb new file mode 100644 index 0000000..50aa224 --- /dev/null +++ b/app/views/neuigkeiten/new.html.erb @@ -0,0 +1,5 @@ +

    New neuigkeit

    + +<%= render 'form' %> + +<%= link_to 'Back', neuigkeiten_path %> diff --git a/app/views/neuigkeiten/show.html.erb b/app/views/neuigkeiten/show.html.erb new file mode 100644 index 0000000..f2d02f9 --- /dev/null +++ b/app/views/neuigkeiten/show.html.erb @@ -0,0 +1,20 @@ +

    <%= notice %>

    + +

    + Title: + <%= @neuigkeit.title %> +

    + +

    + Text: + <%= @neuigkeit.text %> +

    + +

    + Datum: + <%= @neuigkeit.datum %> +

    + + +<%= link_to 'Edit', edit_neuigkeit_path(@neuigkeit) %> | +<%= link_to 'Back', neuigkeiten_path %> diff --git a/app/views/rubriken/_form.html.erb b/app/views/rubriken/_form.html.erb new file mode 100644 index 0000000..a7071d5 --- /dev/null +++ b/app/views/rubriken/_form.html.erb @@ -0,0 +1,11 @@ +<%= semantic_form_for @rubrik do |f| %> + <%= f.inputs do %> + <%= f.input :name %> + <%= f.input :desc %> + <%= f.input :prio %> + <% end %> + + <%= f.actions do %> + <%= f.action :submit, :as => :input %> + <% end %> +<% end %> diff --git a/app/views/rubriken/edit.html.erb b/app/views/rubriken/edit.html.erb new file mode 100644 index 0000000..a4ebe5e --- /dev/null +++ b/app/views/rubriken/edit.html.erb @@ -0,0 +1,6 @@ +

    Editing rubrik

    + +<%= render 'form' %> + +<%= link_to 'Show', @rubrik %> | +<%= link_to 'Back', rubriken_path %> diff --git a/app/views/rubriken/index.html.erb b/app/views/rubriken/index.html.erb new file mode 100644 index 0000000..c53bbb4 --- /dev/null +++ b/app/views/rubriken/index.html.erb @@ -0,0 +1,27 @@ +

    Listing rubriken

    + + + + + + + + + + + +<% @rubriken.each do |rubrik| %> + + + + + + + + +<% end %> +
    NameDescPrio
    <%= rubrik.name %><%= rubrik.desc %><%= rubrik.prio %><%= link_to 'Show', rubrik %><%= link_to 'Edit', edit_rubrik_path(rubrik) %><%= link_to 'Destroy', rubrik, method: :delete, data: { confirm: 'Are you sure?' } %>
    + +
    + +<%= link_to 'New Rubrik', new_rubrik_path %> diff --git a/app/views/rubriken/new.html.erb b/app/views/rubriken/new.html.erb new file mode 100644 index 0000000..12dbebd --- /dev/null +++ b/app/views/rubriken/new.html.erb @@ -0,0 +1,5 @@ +

    New rubrik

    + +<%= render 'form' %> + +<%= link_to 'Back', rubriken_path %> diff --git a/app/views/rubriken/show.html.erb b/app/views/rubriken/show.html.erb new file mode 100644 index 0000000..8181a71 --- /dev/null +++ b/app/views/rubriken/show.html.erb @@ -0,0 +1,25 @@ +

    <%= notice %>

    + +

    + Name: + <%= @rubrik.name %> +

    + +

    + Desc: + <%= @rubrik.desc %> +

    + +

    + Prio: + <%= @rubrik.prio %> +

    +<%= semantic_form_for @rubrik, :url=> url_for(:action => 'addmoderator') do |f| %> +<%= f.inputs do %> +<%= f.input :moderator, :as => :select, :collection => Hash[User.all.map{|b| [b.email,b.id]}] %> + <% end %> + <%= f.action :submit %> + <% end %> + +<%= link_to 'Edit', edit_rubrik_path(@rubrik) %> | +<%= link_to 'Back', rubriken_path %> diff --git a/app/views/semesters/_form.html.erb b/app/views/semesters/_form.html.erb new file mode 100644 index 0000000..85a79e6 --- /dev/null +++ b/app/views/semesters/_form.html.erb @@ -0,0 +1,12 @@ +<%= semantic_form_for @semester do |f| %> + <%= f.inputs do %> + <%= f.input :name %> + <%= f.input :nummer %> + <%= f.input :ws %> + <%= f.input :ss %> + <% end %> + + <%= f.actions do %> + <%= f.action :submit, :as => :input %> + <% end %> +<% end %> diff --git a/app/views/semesters/edit.html.erb b/app/views/semesters/edit.html.erb new file mode 100644 index 0000000..10925ec --- /dev/null +++ b/app/views/semesters/edit.html.erb @@ -0,0 +1,6 @@ +

    Editing semester

    + +<%= render 'form' %> + +<%= link_to 'Show', @semester %> | +<%= link_to 'Back', semesters_path %> diff --git a/app/views/semesters/index.html.erb b/app/views/semesters/index.html.erb new file mode 100644 index 0000000..1a62a2f --- /dev/null +++ b/app/views/semesters/index.html.erb @@ -0,0 +1,29 @@ +

    Listing semesters

    + + + + + + + + + + + + +<% @semesters.each do |semester| %> + + + + + + + + + +<% end %> +
    NameNummerWsSs
    <%= semester.name %><%= semester.nummer %><%= semester.ws %><%= semester.ss %><%= link_to 'Show', semester %><%= link_to 'Edit', edit_semester_path(semester) %><%= link_to 'Destroy', semester, method: :delete, data: { confirm: 'Are you sure?' } %>
    + +
    + +<%= link_to 'New Semester', new_semester_path %> diff --git a/app/views/semesters/new.html.erb b/app/views/semesters/new.html.erb new file mode 100644 index 0000000..604ba79 --- /dev/null +++ b/app/views/semesters/new.html.erb @@ -0,0 +1,5 @@ +

    New semester

    + +<%= render 'form' %> + +<%= link_to 'Back', semesters_path %> diff --git a/app/views/semesters/show.html.erb b/app/views/semesters/show.html.erb new file mode 100644 index 0000000..b6607ef --- /dev/null +++ b/app/views/semesters/show.html.erb @@ -0,0 +1,25 @@ +

    <%= notice %>

    + +

    + Name: + <%= @semester.name %> +

    + +

    + Nummer: + <%= @semester.nummer %> +

    + +

    + Ws: + <%= @semester.ws %> +

    + +

    + Ss: + <%= @semester.ss %> +

    + + +<%= link_to 'Edit', edit_semester_path(@semester) %> | +<%= link_to 'Back', semesters_path %> diff --git a/app/views/studien/_form.html.erb b/app/views/studien/_form.html.erb new file mode 100644 index 0000000..471a8c3 --- /dev/null +++ b/app/views/studien/_form.html.erb @@ -0,0 +1,13 @@ + <%= tinymce_assets %> +<%= semantic_form_for @studium do |f| %> + <%= f.inputs do %> + <%= f.input :zahl %> + <%= f.input :name,:append=>"NAME" %> + <%= f.input :desc, :as=>:tinymce_text %> + <%= f.input :typ, :as=>:radio, :collection=>["Bachelor","Master"]%> + <% end %> +<%= tinymce %> + <%= f.actions do %> + <%= f.action :submit, :as => :input %> + <% end %> +<% end %> diff --git a/app/views/studien/edit.html.erb b/app/views/studien/edit.html.erb new file mode 100644 index 0000000..766d5b2 --- /dev/null +++ b/app/views/studien/edit.html.erb @@ -0,0 +1,6 @@ +

    Editing studium

    + +<%= render 'form' %> + +<%= link_to 'Show', @studium %> | +<%= link_to 'Back', studien_path %> \ No newline at end of file diff --git a/app/views/studien/index.html.erb b/app/views/studien/index.html.erb new file mode 100644 index 0000000..9eab1a1 --- /dev/null +++ b/app/views/studien/index.html.erb @@ -0,0 +1,31 @@ +

    <%= I18n.t("studien.list") %>

    + + + + + + + + + + + + +<% @studien.each do |studium| %> + + + + + + + + + + + +<% end %> +
    ZahlNameDescTyp
    <%= studium.zahl %><%= studium.name %><%= studium.typ %><%= link_to 'Show', studium_path(studium) %><%= link_to 'Edit', edit_studium_path(studium) %><%= link_to 'Destroy', studium, method: :delete, data: { confirm: 'Are you sure?' } %>
    + +
    + +<%= link_to I18n.t("studien.new"), new_studium_path %> diff --git a/app/views/studien/new.html.erb b/app/views/studien/new.html.erb new file mode 100644 index 0000000..a7cd516 --- /dev/null +++ b/app/views/studien/new.html.erb @@ -0,0 +1,5 @@ +

    New studium

    + +<%= render 'form' %> + +<%= link_to 'Back', studien_index_path , :data=>{:locale=>I16n.locale}%> diff --git a/app/views/studien/show.html.erb b/app/views/studien/show.html.erb new file mode 100644 index 0000000..0a5572b --- /dev/null +++ b/app/views/studien/show.html.erb @@ -0,0 +1,38 @@ + +

    <%= notice %>

    +

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

    + <%= raw(@studium.desc) %> +<% [1, 2 ,3].each do |ph| %> + + <% ph_mod = @studium.modulgruppen.where(:phase=>ph) + if ph_mod.count==1 + width=12 + slice=1 + elsif ph_mod.count <= 4 + width=6 + slice=2 + else + width=4 + slice=3 + end + + + %> + +<% ph_mod.each_slice(slice) do |row| %> +
    +<% row.each do |modulgruppe| %> +
    +<%= render modulgruppe %> +
    +<% end %> +
    +<% end %> +<% end %> +
    +
    +
    +<%= link_to 'New Modulgruppe', new_studium_modulgruppe_path(@studium) %> | +<%= link_to 'Edit', edit_studium_path(@studium) %> | +<%= link_to ' Alle Studien'.html_safe, studien_path,:class=>"btn",:raw=>true %> +
    \ No newline at end of file diff --git a/app/views/users/index.html.erb b/app/views/users/index.html.erb new file mode 100644 index 0000000..d06fe69 --- /dev/null +++ b/app/views/users/index.html.erb @@ -0,0 +1,10 @@ + + <% @users.each do |user|%> + + +<% end %> +
    + <%= user.email %>
      + <% user.roles.each do |role| %> +
    • <%= role.name%>
    • +<% end %>
    diff --git a/config.ru b/config.ru new file mode 100644 index 0000000..2beeae7 --- /dev/null +++ b/config.ru @@ -0,0 +1,4 @@ +# This file is used by Rack-based servers to start the application. + +require ::File.expand_path('../config/environment', __FILE__) +run Fetsite::Application diff --git a/config/application.rb b/config/application.rb new file mode 100644 index 0000000..60ec0ec --- /dev/null +++ b/config/application.rb @@ -0,0 +1,62 @@ +require File.expand_path('../boot', __FILE__) + +require 'rails/all' + +if defined?(Bundler) + # If you precompile assets before deploying to production, use this line + Bundler.require(*Rails.groups(:assets => %w(development test))) + # If you want your assets lazily compiled in production, use this line + # Bundler.require(:default, :assets, Rails.env) +end + +module Fetsite + class Application < Rails::Application + # Settings in config/environments/* take precedence over those specified here. + # Application configuration should go into files in config/initializers + # -- all .rb files in that directory are automatically loaded. + + # Custom directories with classes and modules you want to be autoloadable. + # config.autoload_paths += %W(#{config.root}/extras) + + # Only load the plugins named here, in the order given (default is alphabetical). + # :all can be used as a placeholder for all plugins not explicitly named. + # config.plugins = [ :exception_notification, :ssl_requirement, :all ] + + # Activate observers that should always be running. + # config.active_record.observers = :cacher, :garbage_collector, :forum_observer + + # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. + # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. + # config.time_zone = 'Central Time (US & Canada)' + + # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. + # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] + # config.i18n.default_locale = :de + + # Configure the default encoding used in templates for Ruby 1.9. + config.encoding = "utf-8" + + # Configure sensitive parameters which will be filtered from the log file. + config.filter_parameters += [:password] + + # Enable escaping HTML in JSON. + config.active_support.escape_html_entities_in_json = true + + # Use SQL instead of Active Record's schema dumper when creating the database. + # This is necessary if your schema can't be completely dumped by the schema dumper, + # like if you have constraints or database-specific column types + # config.active_record.schema_format = :sql + + # Enforce whitelist mode for mass assignment. + # This will create an empty whitelist of attributes available for mass-assignment for all models + # in your app. As such, your models will need to explicitly whitelist or blacklist accessible + # parameters by using an attr_accessible or attr_protected declaration. + config.active_record.whitelist_attributes = true + + # Enable the asset pipeline + config.assets.enabled = true + + # Version of your assets, change this if you want to expire all your assets + config.assets.version = '1.0' + end +end diff --git a/config/boot.rb b/config/boot.rb new file mode 100644 index 0000000..4489e58 --- /dev/null +++ b/config/boot.rb @@ -0,0 +1,6 @@ +require 'rubygems' + +# Set up gems listed in the Gemfile. +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) + +require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE']) diff --git a/config/database.yml b/config/database.yml new file mode 100644 index 0000000..51a4dd4 --- /dev/null +++ b/config/database.yml @@ -0,0 +1,25 @@ +# SQLite version 3.x +# gem install sqlite3 +# +# Ensure the SQLite 3 gem is defined in your Gemfile +# gem 'sqlite3' +development: + adapter: sqlite3 + database: db/development.sqlite3 + pool: 5 + timeout: 5000 + +# Warning: The database defined as "test" will be erased and +# re-generated from your development database when you run "rake". +# Do not set this db to the same as development or production. +test: + adapter: sqlite3 + database: db/test.sqlite3 + pool: 5 + timeout: 5000 + +production: + adapter: sqlite3 + database: db/production.sqlite3 + pool: 5 + timeout: 5000 diff --git a/config/environment.rb b/config/environment.rb new file mode 100644 index 0000000..346858f --- /dev/null +++ b/config/environment.rb @@ -0,0 +1,5 @@ +# Load the rails application +require File.expand_path('../application', __FILE__) + +# Initialize the rails application +Fetsite::Application.initialize! diff --git a/config/environments/development.rb b/config/environments/development.rb new file mode 100644 index 0000000..7e0febd --- /dev/null +++ b/config/environments/development.rb @@ -0,0 +1,37 @@ +Fetsite::Application.configure do + # Settings specified here will take precedence over those in config/application.rb + + # In the development environment your application's code is reloaded on + # every request. This slows down response time but is perfect for development + # since you don't have to restart the web server when you make code changes. + config.cache_classes = false + + # Log error messages when you accidentally call methods on nil. + config.whiny_nils = true + + # Show full error reports and disable caching + config.consider_all_requests_local = true + config.action_controller.perform_caching = false + + # Don't care if the mailer can't send + config.action_mailer.raise_delivery_errors = false +config.action_mailer.default_url_options = { :host => 'localhost:3000' } + # Print deprecation notices to the Rails logger + config.active_support.deprecation = :log + + # Only use best-standards-support built into browsers + config.action_dispatch.best_standards_support = :builtin + + # Raise exception on mass assignment protection for Active Record models + config.active_record.mass_assignment_sanitizer = :strict + + # Log the query plan for queries taking more than this (works + # with SQLite, MySQL, and PostgreSQL) + config.active_record.auto_explain_threshold_in_seconds = 0.5 + + # Do not compress assets + config.assets.compress = false + + # Expands the lines which load the assets + config.assets.debug = true +end diff --git a/config/environments/production.rb b/config/environments/production.rb new file mode 100644 index 0000000..6a0f219 --- /dev/null +++ b/config/environments/production.rb @@ -0,0 +1,67 @@ +Fetsite::Application.configure do + # Settings specified here will take precedence over those in config/application.rb + + # Code is not reloaded between requests + config.cache_classes = true + + # Full error reports are disabled and caching is turned on + config.consider_all_requests_local = false + config.action_controller.perform_caching = true + + # Disable Rails's static asset server (Apache or nginx will already do this) + config.serve_static_assets = false + + # Compress JavaScripts and CSS + config.assets.compress = true + + # Don't fallback to assets pipeline if a precompiled asset is missed + config.assets.compile = false + + # Generate digests for assets URLs + config.assets.digest = true + + # Defaults to nil and saved in location specified by config.assets.prefix + # config.assets.manifest = YOUR_PATH + + # Specifies the header that your server uses for sending files + # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache + # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx + + # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. + # config.force_ssl = true + + # See everything in the log (default is :info) + # config.log_level = :debug + + # Prepend all log lines with the following tags + # config.log_tags = [ :subdomain, :uuid ] + + # Use a different logger for distributed setups + # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) + + # Use a different cache store in production + # config.cache_store = :mem_cache_store + + # Enable serving of images, stylesheets, and JavaScripts from an asset server + # config.action_controller.asset_host = "http://assets.example.com" + + # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added) + # config.assets.precompile += %w( search.js ) + + # Disable delivery errors, bad email addresses will be ignored + # config.action_mailer.raise_delivery_errors = false + + # Enable threaded mode + # config.threadsafe! + + # Enable locale fallbacks for I18n (makes lookups for any locale fall back to + # the I18n.default_locale when a translation can not be found) + config.i18n.fallbacks = true + + # Send deprecation notices to registered listeners + config.active_support.deprecation = :notify + + # Log the query plan for queries taking more than this (works + # with SQLite, MySQL, and PostgreSQL) + # config.active_record.auto_explain_threshold_in_seconds = 0.5 +end diff --git a/config/environments/test.rb b/config/environments/test.rb new file mode 100644 index 0000000..2decd94 --- /dev/null +++ b/config/environments/test.rb @@ -0,0 +1,37 @@ +Fetsite::Application.configure do + # Settings specified here will take precedence over those in config/application.rb + + # The test environment is used exclusively to run your application's + # test suite. You never need to work with it otherwise. Remember that + # your test database is "scratch space" for the test suite and is wiped + # and recreated between test runs. Don't rely on the data there! + config.cache_classes = true + + # Configure static asset server for tests with Cache-Control for performance + config.serve_static_assets = true + config.static_cache_control = "public, max-age=3600" + + # Log error messages when you accidentally call methods on nil + config.whiny_nils = true + + # Show full error reports and disable caching + config.consider_all_requests_local = true + config.action_controller.perform_caching = false + + # Raise exceptions instead of rendering exception templates + config.action_dispatch.show_exceptions = false + + # Disable request forgery protection in test environment + config.action_controller.allow_forgery_protection = false + + # Tell Action Mailer not to deliver emails to the real world. + # The :test delivery method accumulates sent emails in the + # ActionMailer::Base.deliveries array. + config.action_mailer.delivery_method = :test + + # Raise exception on mass assignment protection for Active Record models + config.active_record.mass_assignment_sanitizer = :strict + + # Print deprecation notices to the stderr + config.active_support.deprecation = :stderr +end diff --git a/config/initializers/backtrace_silencers.rb b/config/initializers/backtrace_silencers.rb new file mode 100644 index 0000000..59385cd --- /dev/null +++ b/config/initializers/backtrace_silencers.rb @@ -0,0 +1,7 @@ +# Be sure to restart your server when you modify this file. + +# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. +# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } + +# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. +# Rails.backtrace_cleaner.remove_silencers! diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb new file mode 100644 index 0000000..d8e7d07 --- /dev/null +++ b/config/initializers/devise.rb @@ -0,0 +1,250 @@ +# Use this hook to configure devise mailer, warden hooks and so forth. +# Many of these configuration options can be set straight in your model. +Devise.setup do |config| + # ==> Mailer Configuration + # Configure the e-mail address which will be shown in Devise::Mailer, + # note that it will be overwritten if you use your own mailer class with default "from" parameter. + config.mailer_sender = "test@example.com" + + # Configure the class responsible to send e-mails. + # config.mailer = "Devise::Mailer" + config.mailer.default_url_options = { :host => 'localhost:3000' } + config.mailer.delivery_method = :smtp + config.mailer.smtp_settings = { + :address => "smtp.gmail.com", + :port => 587, + :user_name => 'testruby12345@gmail.com', + :password => 't12345678', + :authentication => 'plain', + :enable_starttls_auto => true } + + #config.mailer = "confirmmailer" + # ==> ORM configuration + # Load and configure the ORM. Supports :active_record (default) and + # :mongoid (bson_ext recommended) by default. Other ORMs may be + # available as additional gems. + require 'devise/orm/active_record' + + # ==> Configuration for any authentication mechanism + # Configure which keys are used when authenticating a user. The default is + # just :email. You can configure it to use [:username, :subdomain], so for + # authenticating a user, both parameters are required. Remember that those + # parameters are used only when authenticating and not when retrieving from + # session. If you need permissions, you should implement that in a before filter. + # You can also supply a hash where the value is a boolean determining whether + # or not authentication should be aborted when the value is not present. + # config.authentication_keys = [ :email ] + + # Configure parameters from the request object used for authentication. Each entry + # given should be a request method and it will automatically be passed to the + # find_for_authentication method and considered in your model lookup. For instance, + # if you set :request_keys to [:subdomain], :subdomain will be used on authentication. + # The same considerations mentioned for authentication_keys also apply to request_keys. + # config.request_keys = [] + + # Configure which authentication keys should be case-insensitive. + # These keys will be downcased upon creating or modifying a user and when used + # to authenticate or find a user. Default is :email. + config.case_insensitive_keys = [ :email ] + + # Configure which authentication keys should have whitespace stripped. + # These keys will have whitespace before and after removed upon creating or + # modifying a user and when used to authenticate or find a user. Default is :email. + config.strip_whitespace_keys = [ :email ] + + # Tell if authentication through request.params is enabled. True by default. + # It can be set to an array that will enable params authentication only for the + # given strategies, for example, `config.params_authenticatable = [:database]` will + # enable it only for database (email + password) authentication. + # config.params_authenticatable = true + + # Tell if authentication through HTTP Basic Auth is enabled. False by default. + # It can be set to an array that will enable http authentication only for the + # given strategies, for example, `config.http_authenticatable = [:token]` will + # enable it only for token authentication. + # config.http_authenticatable = false + + # If http headers should be returned for AJAX requests. True by default. + # config.http_authenticatable_on_xhr = true + + # The realm used in Http Basic Authentication. "Application" by default. + # config.http_authentication_realm = "Application" + + # It will change confirmation, password recovery and other workflows + # to behave the same regardless if the e-mail provided was right or wrong. + # Does not affect registerable. + # config.paranoid = true + + # By default Devise will store the user in session. You can skip storage for + # :http_auth and :token_auth by adding those symbols to the array below. + # Notice that if you are skipping storage for all authentication paths, you + # may want to disable generating routes to Devise's sessions controller by + # passing :skip => :sessions to `devise_for` in your config/routes.rb + config.skip_session_storage = [:http_auth] + + # ==> Configuration for :database_authenticatable + # For bcrypt, this is the cost for hashing the password and defaults to 10. If + # using other encryptors, it sets how many times you want the password re-encrypted. + # + # Limiting the stretches to just one in testing will increase the performance of + # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use + # a value less than 10 in other environments. + config.stretches = Rails.env.test? ? 1 : 10 + + # Setup a pepper to generate the encrypted password. + # config.pepper = "651a4e90f98836cdfcd54364486467655381acd7d989b042cc878199e0f9edb0314e5d57658bff1ce794955bb10cc220e54e0b2564976a6434798d50632e058f" + + # ==> Configuration for :confirmable + # A period that the user is allowed to access the website even without + # confirming his account. For instance, if set to 2.days, the user will be + # able to access the website for two days without confirming his account, + # access will be blocked just in the third day. Default is 0.days, meaning + # the user cannot access the website without confirming his account. + # config.allow_unconfirmed_access_for = 2.days + + # A period that the user is allowed to confirm their account before their + # token becomes invalid. For example, if set to 3.days, the user can confirm + # their account within 3 days after the mail was sent, but on the fourth day + # their account can't be confirmed with the token any more. + # Default is nil, meaning there is no restriction on how long a user can take + # before confirming their account. + # config.confirm_within = 3.days + + # If true, requires any email changes to be confirmed (exactly the same way as + # initial account confirmation) to be applied. Requires additional unconfirmed_email + # db field (see migrations). Until confirmed new email is stored in + # unconfirmed email column, and copied to email column on successful confirmation. + config.reconfirmable = true + + # Defines which key will be used when confirming an account + # config.confirmation_keys = [ :email ] + + # ==> Configuration for :rememberable + # The time the user will be remembered without asking for credentials again. + # config.remember_for = 2.weeks + + # If true, extends the user's remember period when remembered via cookie. + # config.extend_remember_period = false + + # Options to be passed to the created cookie. For instance, you can set + # :secure => true in order to force SSL only cookies. + # config.rememberable_options = {} + + # ==> Configuration for :validatable + # Range for password length. Default is 8..128. + config.password_length = 8..128 + + # Email regex used to validate email formats. It simply asserts that + # an one (and only one) @ exists in the given string. This is mainly + # to give user feedback and not to assert the e-mail validity. + # config.email_regexp = /\A[^@]+@[^@]+\z/ + + # ==> Configuration for :timeoutable + # The time you want to timeout the user session without activity. After this + # time the user will be asked for credentials again. Default is 30 minutes. + # config.timeout_in = 30.minutes + + # If true, expires auth token on session timeout. + # config.expire_auth_token_on_timeout = false + + # ==> Configuration for :lockable + # Defines which strategy will be used to lock an account. + # :failed_attempts = Locks an account after a number of failed attempts to sign in. + # :none = No lock strategy. You should handle locking by yourself. + # config.lock_strategy = :failed_attempts + + # Defines which key will be used when locking and unlocking an account + # config.unlock_keys = [ :email ] + + # Defines which strategy will be used to unlock an account. + # :email = Sends an unlock link to the user email + # :time = Re-enables login after a certain amount of time (see :unlock_in below) + # :both = Enables both strategies + # :none = No unlock strategy. You should handle unlocking by yourself. + # config.unlock_strategy = :both + + # Number of authentication tries before locking an account if lock_strategy + # is failed attempts. + # config.maximum_attempts = 20 + + # Time interval to unlock the account if :time is enabled as unlock_strategy. + # config.unlock_in = 1.hour + + # ==> Configuration for :recoverable + # + # Defines which key will be used when recovering the password for an account + # config.reset_password_keys = [ :email ] + + # Time interval you can reset your password with a reset password key. + # Don't put a too small interval or your users won't have the time to + # change their passwords. + config.reset_password_within = 6.hours + + # ==> Configuration for :encryptable + # Allow you to use another encryption algorithm besides bcrypt (default). You can use + # :sha1, :sha512 or encryptors from others authentication tools as :clearance_sha1, + # :authlogic_sha512 (then you should set stretches above to 20 for default behavior) + # and :restful_authentication_sha1 (then you should set stretches to 10, and copy + # REST_AUTH_SITE_KEY to pepper) + # config.encryptor = :sha512 + + # ==> Configuration for :token_authenticatable + # Defines name of the authentication token params key + # config.token_authentication_key = :auth_token + + # ==> Scopes configuration + # Turn scoped views on. Before rendering "sessions/new", it will first check for + # "users/sessions/new". It's turned off by default because it's slower if you + # are using only default views. + # config.scoped_views = false + + # Configure the default scope given to Warden. By default it's the first + # devise role declared in your routes (usually :user). + # config.default_scope = :user + + # Set this configuration to false if you want /users/sign_out to sign out + # only the current scope. By default, Devise signs out all scopes. + # config.sign_out_all_scopes = true + + # ==> Navigation configuration + # Lists the formats that should be treated as navigational. Formats like + # :html, should redirect to the sign in page when the user does not have + # access, but formats like :xml or :json, should return 401. + # + # If you have any extra navigational formats, like :iphone or :mobile, you + # should add them to the navigational formats lists. + # + # The "*/*" below is required to match Internet Explorer requests. + # config.navigational_formats = ["*/*", :html] + + # The default HTTP method used to sign out a resource. Default is :delete. + config.sign_out_via = :delete + + # ==> OmniAuth + # Add a new OmniAuth provider. Check the wiki for more information on setting + # up on your models and hooks. + # config.omniauth :github, 'APP_ID', 'APP_SECRET', :scope => 'user,public_repo' + + # ==> Warden configuration + # If you want to use other strategies, that are not supported by Devise, or + # change the failure app, you can configure them inside the config.warden block. + # + # config.warden do |manager| + # manager.intercept_401 = false + # manager.default_strategies(:scope => :user).unshift :some_external_strategy + # end + + # ==> Mountable engine configurations + # When using Devise inside an engine, let's call it `MyEngine`, and this engine + # is mountable, there are some extra configurations to be taken into account. + # The following options are available, assuming the engine is mounted as: + # + # mount MyEngine, at: "/my_engine" + # + # The router that invoked `devise_for`, in the example above, would be: + # config.router_name = :my_engine + # + # When using omniauth, Devise cannot automatically set Omniauth path, + # so you need to do it manually. For the users scope, it would be: + # config.omniauth_path_prefix = "/my_engine/users/auth" +end diff --git a/config/initializers/formtastic.rb b/config/initializers/formtastic.rb new file mode 100644 index 0000000..befce4d --- /dev/null +++ b/config/initializers/formtastic.rb @@ -0,0 +1,76 @@ +# encoding: utf-8 + +# Set the default text field size when input is a string. Default is nil. +# Formtastic::FormBuilder.default_text_field_size = 50 + +# Set the default text area height when input is a text. Default is 20. +# Formtastic::FormBuilder.default_text_area_height = 5 + +# Set the default text area width when input is a text. Default is nil. +# Formtastic::FormBuilder.default_text_area_width = 50 + +# Should all fields be considered "required" by default? +# Defaults to true. +# Formtastic::FormBuilder.all_fields_required_by_default = true + +# Should select fields have a blank option/prompt by default? +# Defaults to true. +# Formtastic::FormBuilder.include_blank_for_select_by_default = true + +# Set the string that will be appended to the labels/fieldsets which are required +# It accepts string or procs and the default is a localized version of +# '*'. In other words, if you configure formtastic.required +# in your locale, it will replace the abbr title properly. But if you don't want to use +# abbr tag, you can simply give a string as below +# Formtastic::FormBuilder.required_string = "(required)" + +# Set the string that will be appended to the labels/fieldsets which are optional +# Defaults to an empty string ("") and also accepts procs (see required_string above) +# Formtastic::FormBuilder.optional_string = "(optional)" + +# Set the way inline errors will be displayed. +# Defaults to :sentence, valid options are :sentence, :list, :first and :none +# Formtastic::FormBuilder.inline_errors = :sentence +# Formtastic uses the following classes as default for hints, inline_errors and error list + +# If you override the class here, please ensure to override it in your stylesheets as well +# Formtastic::FormBuilder.default_hint_class = "inline-hints" +# Formtastic::FormBuilder.default_inline_error_class = "inline-errors" +# Formtastic::FormBuilder.default_error_list_class = "errors" + +# Set the method to call on label text to transform or format it for human-friendly +# reading when formtastic is used without object. Defaults to :humanize. +# Formtastic::FormBuilder.label_str_method = :humanize + +# Set the array of methods to try calling on parent objects in :select and :radio inputs +# for the text inside each @