diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..81de96d --- /dev/null +++ b/.gitignore @@ -0,0 +1,20 @@ +config/database.yml +config/deploy.rb +config/newrelic.yml +.rvmrc +*.rbc +*.sassc +.sass-cache +capybara-*.html +.rspec +/.bundle +/vendor/bundle +/log/* +/tmp/* +/db/*.sqlite3 +/public/system/* +/coverage/ +/spec/tmp/* +**.orig +rerun.txt +pickle-email-*.html diff --git a/Capfile b/Capfile new file mode 100644 index 0000000..6a798eb --- /dev/null +++ b/Capfile @@ -0,0 +1,4 @@ +load 'deploy' +# Uncomment if you are using Rails' asset pipeline + # load 'deploy/assets' +load 'config/deploy' # remove this line to skip loading any of the default tasks \ No newline at end of file diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..896f3ec --- /dev/null +++ b/Gemfile @@ -0,0 +1,42 @@ +source 'https://rubygems.org' + +gem 'rails', '3.2.13' + +group :assets do + gem 'sass-rails', '~> 3.2.3' + gem 'coffee-rails', '~> 3.2.1' + + gem 'bootstrap-sass', '~> 2.2.1.1' + gem 'font-awesome-sass-rails' + + gem 'uglifier', '>= 1.0.3' +end + +group :development do + gem "better_errors" + gem "binding_of_caller" + gem "therubyracer" + gem 'unicorn' + gem 'quiet_assets' +end + +gem 'bootstrap-will_paginate' +gem 'capistrano' +gem 'devise', '>= 2.0.0' +gem 'devise_invitable', '~> 1.0.0' +gem 'exception_notification' +gem 'formatize' +gem 'haml-rails' +gem 'jquery-rails'#, '2.1.4' # rails3-jquery-autocomplete no longer compatible with jquery 2.2.0.. follow up please +gem 'jquery-ui-rails' +gem "kaminari" +gem 'localeapp' +gem 'mysql2' +gem "nested_form" +gem 'newrelic_rpm' +gem 'openminds_deploy' +gem "opinio" +gem "paperclip", "~> 3.0" +gem 'rails3-jquery-autocomplete' +gem "select2-rails" +gem 'simple_form' diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..fe96d3f --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,249 @@ +GEM + remote: https://rubygems.org/ + specs: + RedCloth (4.2.9) + actionmailer (3.2.13) + actionpack (= 3.2.13) + mail (~> 2.5.3) + actionpack (3.2.13) + activemodel (= 3.2.13) + activesupport (= 3.2.13) + builder (~> 3.0.0) + erubis (~> 2.7.0) + journey (~> 1.0.4) + rack (~> 1.4.5) + rack-cache (~> 1.2) + rack-test (~> 0.6.1) + sprockets (~> 2.2.1) + activemodel (3.2.13) + activesupport (= 3.2.13) + builder (~> 3.0.0) + activerecord (3.2.13) + activemodel (= 3.2.13) + activesupport (= 3.2.13) + arel (~> 3.0.2) + tzinfo (~> 0.3.29) + activeresource (3.2.13) + activemodel (= 3.2.13) + activesupport (= 3.2.13) + activesupport (3.2.13) + i18n (= 0.6.1) + multi_json (~> 1.0) + arel (3.0.2) + bcrypt-ruby (3.0.1) + better_errors (0.7.2) + coderay (>= 1.0.0) + erubis (>= 2.6.6) + binding_of_caller (0.7.1) + debug_inspector (>= 0.0.1) + bluecloth (2.2.0) + bootstrap-sass (2.2.1.1) + sass (~> 3.2) + bootstrap-will_paginate (0.0.9) + will_paginate + builder (3.0.4) + capistrano (2.14.2) + highline + net-scp (>= 1.0.0) + net-sftp (>= 2.0.0) + net-ssh (>= 2.0.14) + net-ssh-gateway (>= 1.1.0) + climate_control (0.0.3) + activesupport (>= 3.0) + cocaine (0.5.1) + climate_control (>= 0.0.3, < 1.0) + coderay (1.0.9) + 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.6.1) + debug_inspector (0.0.2) + devise (2.2.3) + bcrypt-ruby (~> 3.0) + orm_adapter (~> 0.1) + railties (~> 3.1) + warden (~> 1.2.1) + devise_invitable (1.0.3) + actionmailer (~> 3.0) + devise (>= 2.0.0) + railties (~> 3.0) + erubis (2.7.0) + exception_notification (3.0.1) + actionmailer (>= 3.0.4) + execjs (1.4.0) + multi_json (~> 1.0) + font-awesome-sass-rails (3.0.2.2) + railties (>= 3.1.1) + sass-rails (>= 3.1.1) + formatize (1.1.0) + RedCloth (~> 4.2) + actionpack (~> 3.0) + bluecloth (~> 2.2) + gli (2.5.5) + haml (4.0.0) + tilt + haml-rails (0.4) + actionpack (>= 3.1, < 4.1) + activesupport (>= 3.1, < 4.1) + haml (>= 3.1, < 4.1) + railties (>= 3.1, < 4.1) + highline (1.6.16) + hike (1.2.1) + i18n (0.6.1) + journey (1.0.4) + jquery-rails (2.2.1) + railties (>= 3.0, < 5.0) + thor (>= 0.14, < 2.0) + jquery-ui-rails (4.0.2) + jquery-rails + railties (>= 3.1.0) + json (1.7.7) + kaminari (0.14.1) + actionpack (>= 3.0.0) + activesupport (>= 3.0.0) + kgio (2.8.0) + libv8 (3.11.8.13) + localeapp (0.6.9) + gli + i18n + json + rest-client + ya2yaml + mail (2.5.3) + i18n (>= 0.4.0) + mime-types (~> 1.16) + treetop (~> 1.4.8) + mime-types (1.21) + multi_json (1.7.1) + mysql2 (0.3.11) + nested_form (0.3.1) + net-scp (1.1.0) + net-ssh (>= 2.6.5) + net-sftp (2.1.1) + net-ssh (>= 2.6.5) + net-ssh (2.6.6) + net-ssh-gateway (1.2.0) + net-ssh (>= 2.6.5) + newrelic_rpm (3.5.8.72) + openminds_deploy (1.0.7) + capistrano (>= 2.5) + opinio (0.6) + jquery-rails + kaminari + rails (~> 3) + orm_adapter (0.4.0) + paperclip (3.4.1) + activemodel (>= 3.0.0) + activerecord (>= 3.0.0) + activesupport (>= 3.0.0) + cocaine (~> 0.5.0) + mime-types + polyglot (0.3.3) + quiet_assets (1.0.2) + railties (>= 3.1, < 5.0) + rack (1.4.5) + rack-cache (1.2) + rack (>= 0.4) + rack-ssl (1.3.3) + rack + rack-test (0.6.2) + rack (>= 1.0) + rails (3.2.13) + actionmailer (= 3.2.13) + actionpack (= 3.2.13) + activerecord (= 3.2.13) + activeresource (= 3.2.13) + activesupport (= 3.2.13) + bundler (~> 1.0) + railties (= 3.2.13) + rails3-jquery-autocomplete (1.0.11) + rails (~> 3.0) + railties (3.2.13) + actionpack (= 3.2.13) + activesupport (= 3.2.13) + rack-ssl (~> 1.3.2) + rake (>= 0.8.7) + rdoc (~> 3.4) + thor (>= 0.14.6, < 2.0) + raindrops (0.10.0) + rake (10.0.3) + rdoc (3.12.2) + json (~> 1.4) + ref (1.0.3) + rest-client (1.6.7) + mime-types (>= 1.16) + sass (3.2.7) + sass-rails (3.2.6) + railties (~> 3.2.0) + sass (>= 3.1.10) + tilt (~> 1.3) + select2-rails (3.3.1) + sass-rails (>= 3.2) + thor (~> 0.14) + simple_form (2.1.0) + actionpack (~> 3.0) + activemodel (~> 3.0) + sprockets (2.2.2) + hike (~> 1.2) + multi_json (~> 1.0) + rack (~> 1.0) + tilt (~> 1.1, != 1.3.0) + therubyracer (0.11.4) + libv8 (~> 3.11.8.12) + ref + thor (0.17.0) + tilt (1.3.6) + treetop (1.4.12) + polyglot + polyglot (>= 0.3.1) + tzinfo (0.3.37) + uglifier (1.3.0) + execjs (>= 0.3.0) + multi_json (~> 1.0, >= 1.0.2) + unicorn (4.6.2) + kgio (~> 2.6) + rack + raindrops (~> 0.7) + warden (1.2.1) + rack (>= 1.0) + will_paginate (3.0.4) + ya2yaml (0.31) + +PLATFORMS + ruby + +DEPENDENCIES + better_errors + binding_of_caller + bootstrap-sass (~> 2.2.1.1) + bootstrap-will_paginate + capistrano + coffee-rails (~> 3.2.1) + devise (>= 2.0.0) + devise_invitable (~> 1.0.0) + exception_notification + font-awesome-sass-rails + formatize + haml-rails + jquery-rails + jquery-ui-rails + kaminari + localeapp + mysql2 + nested_form + newrelic_rpm + openminds_deploy + opinio + paperclip (~> 3.0) + quiet_assets + rails (= 3.2.13) + rails3-jquery-autocomplete + sass-rails (~> 3.2.3) + select2-rails + simple_form + therubyracer + uglifier (>= 1.0.3) + unicorn diff --git a/README.md b/README.md new file mode 100644 index 0000000..6ddd253 --- /dev/null +++ b/README.md @@ -0,0 +1,6 @@ +moederse +======== + +Moederse Recepten + +Work in Progress 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..efe3d46 --- /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__) + +Moederse::Application.load_tasks diff --git a/app/assets/images/item-big.png b/app/assets/images/item-big.png new file mode 100755 index 0000000..639320b Binary files /dev/null and b/app/assets/images/item-big.png differ diff --git a/app/assets/images/item-small.png b/app/assets/images/item-small.png new file mode 100755 index 0000000..77e967a Binary files /dev/null and b/app/assets/images/item-small.png differ diff --git a/app/assets/images/logo.png b/app/assets/images/logo.png new file mode 100644 index 0000000..a1e3931 Binary files /dev/null and b/app/assets/images/logo.png differ diff --git a/app/assets/images/logo@2x.png b/app/assets/images/logo@2x.png new file mode 100644 index 0000000..e552d1e Binary files /dev/null and b/app/assets/images/logo@2x.png differ diff --git a/app/assets/images/map.png b/app/assets/images/map.png new file mode 100755 index 0000000..e1d1465 Binary files /dev/null and b/app/assets/images/map.png differ diff --git a/app/assets/images/navigation-divider.png b/app/assets/images/navigation-divider.png new file mode 100755 index 0000000..ca74461 Binary files /dev/null and b/app/assets/images/navigation-divider.png differ diff --git a/app/assets/images/post-img-1.jpeg b/app/assets/images/post-img-1.jpeg new file mode 100755 index 0000000..2a6eecf Binary files /dev/null and b/app/assets/images/post-img-1.jpeg differ diff --git a/app/assets/images/post-img.jpeg b/app/assets/images/post-img.jpeg new file mode 100755 index 0000000..5bec6a8 Binary files /dev/null and b/app/assets/images/post-img.jpeg differ diff --git a/app/assets/images/slide-4.jpg b/app/assets/images/slide-4.jpg new file mode 100755 index 0000000..aacf9f9 Binary files /dev/null and b/app/assets/images/slide-4.jpg differ diff --git a/app/assets/images/slide-5.jpg b/app/assets/images/slide-5.jpg new file mode 100755 index 0000000..4e92ec7 Binary files /dev/null and b/app/assets/images/slide-5.jpg differ diff --git a/app/assets/images/spaghetti.jpg b/app/assets/images/spaghetti.jpg new file mode 100644 index 0000000..9425290 Binary files /dev/null and b/app/assets/images/spaghetti.jpg differ diff --git a/app/assets/images/team-1.jpg b/app/assets/images/team-1.jpg new file mode 100755 index 0000000..c2a59ab Binary files /dev/null and b/app/assets/images/team-1.jpg differ diff --git a/app/assets/images/team-2.jpg b/app/assets/images/team-2.jpg new file mode 100755 index 0000000..ff7f6ae Binary files /dev/null and b/app/assets/images/team-2.jpg differ diff --git a/app/assets/images/team-3.jpg b/app/assets/images/team-3.jpg new file mode 100755 index 0000000..fadf17b Binary files /dev/null and b/app/assets/images/team-3.jpg differ diff --git a/app/assets/images/team-4.jpg b/app/assets/images/team-4.jpg new file mode 100755 index 0000000..0bba087 Binary files /dev/null and b/app/assets/images/team-4.jpg differ diff --git a/app/assets/images/user-1.jpg b/app/assets/images/user-1.jpg new file mode 100755 index 0000000..cfd71c6 Binary files /dev/null and b/app/assets/images/user-1.jpg differ diff --git a/app/assets/images/user-2.jpg b/app/assets/images/user-2.jpg new file mode 100755 index 0000000..c7bb294 Binary files /dev/null and b/app/assets/images/user-2.jpg differ diff --git a/app/assets/images/user-3.jpg b/app/assets/images/user-3.jpg new file mode 100755 index 0000000..72dbaea Binary files /dev/null and b/app/assets/images/user-3.jpg differ diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js new file mode 100644 index 0000000..380275d --- /dev/null +++ b/app/assets/javascripts/application.js @@ -0,0 +1,21 @@ +// 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 jquery_nested_form +//= require jquery.ui.all +//= require bootstrap +//= require autocomplete-rails +//= require select2 +//= require retina +//= require site diff --git a/app/assets/javascripts/bootstrapped.js.coffee b/app/assets/javascripts/bootstrapped.js.coffee new file mode 100644 index 0000000..c9404a8 --- /dev/null +++ b/app/assets/javascripts/bootstrapped.js.coffee @@ -0,0 +1,4 @@ +jQuery -> + $("a[rel=popover]").popover() + $(".tooltip").tooltip() + $("a[rel=tooltip]").tooltip() \ No newline at end of file diff --git a/app/assets/javascripts/recipes.js.coffee b/app/assets/javascripts/recipes.js.coffee new file mode 100644 index 0000000..7615679 --- /dev/null +++ b/app/assets/javascripts/recipes.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/retina.js b/app/assets/javascripts/retina.js new file mode 100644 index 0000000..aefb3a8 --- /dev/null +++ b/app/assets/javascripts/retina.js @@ -0,0 +1,3 @@ +// retina.js, a high-resolution image swapper (http://retinajs.com), v0.0.2 + +(function(){function t(e){this.path=e;var t=this.path.split("."),n=t.slice(0,t.length-1).join("."),r=t[t.length-1];this.at_2x_path=n+"@2x."+r}function n(e){this.el=e,this.path=new t(this.el.getAttribute("src"));var n=this;this.path.check_2x_variant(function(e){e&&n.swap()})}var e=typeof exports=="undefined"?window:exports;e.RetinaImagePath=t,t.confirmed_paths=[],t.prototype.is_external=function(){return!!this.path.match(/^https?\:/i)&&!this.path.match("//"+document.domain)},t.prototype.check_2x_variant=function(e){var n,r=this;if(this.is_external())return e(!1);if(this.at_2x_path in t.confirmed_paths)return e(!0);n=new XMLHttpRequest,n.open("HEAD",this.at_2x_path),n.onreadystatechange=function(){return n.readyState!=4?e(!1):n.status>=200&&n.status<=399?(t.confirmed_paths.push(r.at_2x_path),e(!0)):e(!1)},n.send()},e.RetinaImage=n,n.prototype.swap=function(e){function n(){t.el.complete?(t.el.setAttribute("width",t.el.offsetWidth),t.el.setAttribute("height",t.el.offsetHeight),t.el.setAttribute("src",e)):setTimeout(n,5)}typeof e=="undefined"&&(e=this.path.at_2x_path);var t=this;n()},e.devicePixelRatio>1&&(window.onload=function(){var e=document.getElementsByTagName("img"),t=[],r,i;for(r=0;rToon alle resultaten ', picture_file_name: null}] + return {results: all_results.concat(data)}; + } + }, + formatResult: recipesFormatResult, + formatSelection: recipesFormatSelection, + dropdownCssClass: "bigdrop" + }); + $('#e1').select2('focus'); +}); + +function recipesFormatResult(recipe) { + if (recipe.picture_file_name == null) + { + var markup = ""; + markup += "
" + recipe.name + "
"; + markup += "
" + recipe.description + "
"; + markup += "
" + } + else + { + var markup = ""; + markup += ""; + markup += "
" + recipe.name + "
"; + markup += "
" + recipe.description + "
"; + markup += "
" + } + return markup; +} + +function recipesFormatSelection(recipe) { + window.location = '/recipes/' + recipe.id; +} diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css new file mode 100644 index 0000000..d6b9456 --- /dev/null +++ b/app/assets/stylesheets/application.css @@ -0,0 +1,44 @@ +/* + * 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 jquery.ui.all + *= require_tree . + *= require select2 + */ + +#s2id_e1 { + width: 470px; + padding-top:20px; +} + +@media screen and (max-device-width: 480px) and (-webkit-min-device-pixel-ratio: 2){ + #s2id_e1 { + width: 200px; + padding-top:0px; + } +} + +@media only screen and (min-device-width : 768px) and (max-device-width : 1024px) { + #s2id_e1 { + width: 300px; + } +} + + +.select2-results { + max-height: 400px !important; + padding: 0 0 0 4px; + margin: 4px 4px 4px 0; + position: relative; + overflow-x: hidden; + overflow-y: auto; + -webkit-tap-highlight-color: rgba(0,0,0,0); +} diff --git a/app/assets/stylesheets/bootstrap_and_overrides.css.scss b/app/assets/stylesheets/bootstrap_and_overrides.css.scss new file mode 100644 index 0000000..9e71d36 --- /dev/null +++ b/app/assets/stylesheets/bootstrap_and_overrides.css.scss @@ -0,0 +1,14 @@ +// Set the correct sprite paths +$iconSpritePath: asset-path("twitter/bootstrap/glyphicons-halflings", image); +$iconWhiteSpritePath: asset-path("twitter/bootstrap/glyphicons-halflings-white", image); + +// Font Awesome + +@import 'bootstrap'; +@import 'bootstrap-responsive'; +@import 'font-awesome'; + +@import 'theme'; + +// Glyphicons +// @import "twitter/bootstrap/sprites.less"; diff --git a/app/assets/stylesheets/print.css b/app/assets/stylesheets/print.css new file mode 100644 index 0000000..f7e87f5 --- /dev/null +++ b/app/assets/stylesheets/print.css @@ -0,0 +1,33 @@ +@media print { +.navbar {display: none;} + +.span3 {display: none;} + +.span4 {display:none;} + +.form-actions {display: none;} + +.alert {display: none;} + +#comments {display: none;} + +#new_comment {display: none;} + +#comments {display: none;} + +body { + margin: 3cm; + font-size: 11px; + font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif; + } + +h1 {font-size: 200%; font-weight: bold} +h2 {font-size: 200%; font-style: italic; font-weight: normal} +h3 {font-size: 160%; font-weight: bold} +h4 {font-size: 160%; font-weight: bold} +h5 {font-size: 110%; font-weight: normal} +h6 {font-size: 110%; font-style: italic; font-weight: normal} + +img { display: none;} + +} diff --git a/app/assets/stylesheets/site.css.scss b/app/assets/stylesheets/site.css.scss new file mode 100644 index 0000000..b5f45cc --- /dev/null +++ b/app/assets/stylesheets/site.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the site 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/theme.css b/app/assets/stylesheets/theme.css new file mode 100755 index 0000000..580a741 --- /dev/null +++ b/app/assets/stylesheets/theme.css @@ -0,0 +1,545 @@ +.decorative-shadow { + -webkit-box-shadow: 0px 0px 0px 4px #e6e6e6; + -moz-box-shadow: 0px 0px 0px 4px #e6e6e6; + box-shadow: 0px 0px 0px 4px #e6e6e6; +} +body { + color: #666666; + font-family: 'Arial', sans-serif; + font-size: 12px; + background: #ffffff; +} +.wrapper { + margin-top: 40px; + margin-bottom: 25px; +} +h1, +h2, +h3, +h4, +h5, +h6 { + color: #333333; +} +a { + color: #72b626; +} +a:hover { + color: #588c1d; + text-decoration: none; +} +.well { + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + border-radius: 3px; + -webkit-background-clip: padding-box; + -moz-background-clip: padding; + background-clip: padding-box; + -webkit-box-shadow: inset 0 0 0; + -moz-box-shadow: inset 0 0 0; + box-shadow: inset 0 0 0; + background: #F4F5F7; +} +.label { + -webkit-border-radius: 2px; + -moz-border-radius: 2px; + border-radius: 2px; + -webkit-background-clip: padding-box; + -moz-background-clip: padding; + background-clip: padding-box; + padding: 2px 6px; +} +.centered { + text-align: center; +} +.navbar { + margin-top: 20px ; +} +.navbar-inner { + background: #2d3032; + background-color: #2d3032; + background-image: none; + background-repeat: no-repeat; + -ms-filter: none; + filter: none; + border: none; + -webkit-border-radius: 0; + -moz-border-radius: 0; + border-radius: 0; + -webkit-background-clip: padding-box; + -moz-background-clip: padding; + background-clip: padding-box; +} +.navbar .brand, +.navbar .nav > li > a { + color: #ffffff; + font-size: 13px; + text-shadow: none; + padding: 15px 30px; + background: url(../assets/navigation-divider.png) no-repeat right 50%; +} +.navbar .brand:hover, +.navbar .nav > li > a:hover { + color: #ffffff; + background: #72b626; +} +.navbar .nav > .active > a, +.navbar .nav > .active > a:hover, +.navbar .nav > .active > a:focus { + color: #ffffff; + background: #72b626; + background-color: #72b626; + box-shadow: none; +} +.navbar .brand:hover { + background-color: transparent; +} +.navbar .btn-navbar { + margin-top: 8px; + color: #ffffff; + text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); + background-color: #222222; + background-image: none; + background-repeat: repeat-x; + border-color: #040404 #040404 black; +} +.navbar .btn-navbar:hover { + background-color: #222222; +} +.navbar .nav li.dropdown.open > .dropdown-toggle, +.navbar .nav li.dropdown.active > .dropdown-toggle, +.navbar .nav li.dropdown.open.active > .dropdown-toggle { + background-color: #72b626; + color: #ffffff; +} +.navbar .nav li.open > a { + background: none; +} +.dropdown-menu { + margin-top: -1px; + -webkit-border-radius: 0; + -moz-border-radius: 0; + border-radius: 0; + -webkit-background-clip: padding-box; + -moz-background-clip: padding; + background-clip: padding-box; + background-color: #2d3032; +} +.dropdown-menu li > a { + color: #ffffff; +} +.dropdown-menu li > a:hover, +.dropdown-menu li > a:focus, +.dropdown-submenu:hover > a { + background-color: #72b626; + background-image: none; + -ms-filter: none; + filter: none; +} +.navbar .nav li.dropdown > .dropdown-toggle .caret, +.navbar .nav li.dropdown.open > .dropdown-toggle .caret, +.navbar .nav li.dropdown.active > .dropdown-toggle .caret, +.navbar .nav li.dropdown.open.active > .dropdown-toggle .caret { + border-top-color: #ffffff; +} +.navbar .nav > li > .dropdown-menu::before, +.navbar .nav > li > .dropdown-menu::after { + display: none; +} +.info-column { + margin-bottom: 25px; +} +.social-media { + list-style: none; + text-align: center; + margin-top: 25px; + margin-left: 0; +} +.social-media li { + display: inline-block; +} +.social-media li a { + font-size: 30px; +} +.social-media li a:hover { + -webkit-transition: all 0.3s; + -moz-transition: all 0.3s; + -o-transition: all 0.3s; + transition: all 0.3s; +} +header form { + margin-top: 20px; + text-align: right; +} +.portfolio { + padding-top: 5px; +} +.portfolio li { + margin-left: 27px; +} +.portfolio .thumbnail { + padding: 8px; + -webkit-box-shadow: 0 0 0 5px rgba(0, 0, 0, 0.05); + -moz-box-shadow: 0 0 0 5px rgba(0, 0, 0, 0.05); + box-shadow: 0 0 0 5px rgba(0, 0, 0, 0.05); +} +.portfolio .thumbnail:hover { + -webkit-box-shadow: 0 0 0 5px rgba(0, 0, 0, 0.1); + -moz-box-shadow: 0 0 0 5px rgba(0, 0, 0, 0.1); + box-shadow: 0 0 0 5px rgba(0, 0, 0, 0.1); +} +.portfolio .thumbnail a img { + width: 100%; + height: auto; +} +.filter { + margin-left: 0; + margin-bottom: 40px; + padding: 0; + list-style: none; +} +.filter li { + display: inline-block; + margin-bottom: 15px; + position: relative; +} +.filter a { + margin-right: 5px; + padding: 6px 12px; + background: #454a4d; + color: #fff; + text-decoration: none; + -webkit-border-radius: 2px; + -moz-border-radius: 2px; + border-radius: 2px; + -webkit-background-clip: padding-box; + -moz-background-clip: padding; + background-clip: padding-box; +} +.filter a:hover { + background: #72b626; +} +.filter span { + margin-right: 5px; +} +.filter .active { + background: #72b626; +} +.pricing-table { + position: relative; + margin-left: 0; + padding: 10px; + list-style: none; + text-align: center; + border: 1px solid #ddd; + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + border-radius: 3px; + -webkit-background-clip: padding-box; + -moz-background-clip: padding; + background-clip: padding-box; + -webkit-box-shadow: 0 0 0px 5px rgba(0, 0, 0, 0.05); + -moz-box-shadow: 0 0 0px 5px rgba(0, 0, 0, 0.05); + box-shadow: 0 0 0px 5px rgba(0, 0, 0, 0.05); +} +.pricing-table li { + padding-top: 5px; + padding-bottom: 5px; + border-bottom: 1px dashed #ddd; +} +.pricing-table .footer { + border: 0; + margin-top: 18px; + margin-bottom: 8px; +} +.ribbon-wrapper { + width: 85px; + width: 100%\8; + height: 88px; + overflow: hidden; + position: absolute; + top: -3px; + right: -3px; +} +.ribbon { + position: relative; + left: -5px; + top: 15px; + top: 0px\8; + width: 120px; + width: 100%\8; + padding: 7px 0; + font: bold 15px Sans-Serif; + text-align: center; + color: #304d10; + text-shadow: 0px 1px 0px rgba(255, 255, 255, 0.5); + -webkit-transform: rotate(45deg); + -moz-transform: rotate(45deg); + -ms-transform: rotate(45deg); + -o-transform: rotate(45deg); + transform: rotate(45deg); + background-color: #7fcb2a; + background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #7fcb2a), color-stop(100% #588c1d)); + background-image: -webkit-linear-gradient(top, #7fcb2a 0%, #588c1d 100%); + background-image: -moz-linear-gradient(top, #7fcb2a 0%, #588c1d 100%); + background-image: -ms-linear-gradient(top, #7fcb2a 0%, #588c1d 100%); + background-image: -o-linear-gradient(top, #7fcb2a 0%, #588c1d 100%); + background-image: linear-gradient(top, #7fcb2a 0%, #588c1d 100%); + -webkit-box-shadow: 0px 0px 3px rgba(0, 0, 0, 0.3); + -moz-box-shadow: 0px 0px 3px rgba(0, 0, 0, 0.3); + box-shadow: 0px 0px 3px rgba(0, 0, 0, 0.3); +} +.avatar { + margin-right: 8px; + margin-bottom: 10px; +} +.post-img { + margin-bottom: 15px; +} +article { + margin-bottom: 50px; +} +article h3 { + margin-top: 0; +} +article h3 a { + color: #2d3032; +} +article h3 a:hover { + color: #72b626; +} +.comment-form { + padding: 3px; +} +#widget-carousel .carousel-control { + width: 25px; + height: 25px; + top: 35%; + -webkit-border-radius: 2px; + -moz-border-radius: 2px; + border-radius: 2px; + -webkit-background-clip: padding-box; + -moz-background-clip: padding; + background-clip: padding-box; + border: 0; + font-size: 20px; + font-weight: bold; + line-height: 22px; +} +textarea, +input[type="text"], +input[type="password"], +input[type="datetime"], +input[type="datetime-local"], +input[type="date"], +input[type="month"], +input[type="time"], +input[type="week"], +input[type="number"], +input[type="email"], +input[type="url"], +input[type="search"], +input[type="tel"], +input[type="color"], +.uneditable-input { + -webkit-box-shadow: 0px 0px 0px 4px #e6e6e6; + -moz-box-shadow: 0px 0px 0px 4px #e6e6e6; + box-shadow: 0px 0px 0px 4px #e6e6e6; +} +textarea:focus, +input[type="text"]:focus, +input[type="password"]:focus, +input[type="datetime"]:focus, +input[type="datetime-local"]:focus, +input[type="date"]:focus, +input[type="month"]:focus, +input[type="time"]:focus, +input[type="week"]:focus, +input[type="number"]:focus, +input[type="email"]:focus, +input[type="url"]:focus, +input[type="search"]:focus, +input[type="tel"]:focus, +input[type="color"]:focus, +.uneditable-input:focus { + border-color: #72b626; + -webkit-box-shadow: 0px 0px 0px 4px #e6e6e6; + -moz-box-shadow: 0px 0px 0px 4px #e6e6e6; + box-shadow: 0px 0px 0px 4px #e6e6e6; +} +.tag-cloud { + margin-left: 0; + padding: 0; + list-style: none; +} +.tag-cloud li { + display: inline-block; + margin-bottom: 15px; + position: relative; +} +.tag-cloud a { + margin-right: 5px; + padding: 6px 12px; + border: 0; + background: #454a4d; + color: #fff; + text-decoration: none; + -webkit-border-radius: 2px; + -moz-border-radius: 2px; + border-radius: 2px; + -webkit-background-clip: padding-box; + -moz-background-clip: padding; + background-clip: padding-box; +} +.tag-cloud a:hover { + background: #72b626; +} +.tag-cloud span { + margin-right: 5px; +} +.tag-cloud .active { + background: #72b626; +} +.btn { + background-color: none; + background-image: none; + background: #5d6468; + color: #fff; + cursor: pointer; + text-shadow: 0 -1px 0 #2d3032; + border: 1px solid #51575a; + -webkit-border-radius: 2px; + -moz-border-radius: 2px; + border-radius: 2px; + -webkit-background-clip: padding-box; + -moz-background-clip: padding; + background-clip: padding-box; + -webkit-box-shadow: 0px 0px 0px 4px #e6e6e6; + -moz-box-shadow: 0px 0px 0px 4px #e6e6e6; + box-shadow: 0px 0px 0px 4px #e6e6e6; +} +.btn:hover { + color: #fff; + background: #757d83; + -webkit-transition: all 0.1s ease-in-out; + -moz-transition: all 0.1s ease-in-out; + -o-transition: all 0.1s ease-in-out; + transition: all 0.1s ease-in-out; + border-color: #5d6468; +} +.btn.btn-primary { + background: #72b626; + text-shadow: 0 -1px 0 #3d6214; + border: 1px solid #65a122; +} +.btn.btn-primary:hover { + background: #7fcb2a; + border: 1px solid #72b626; +} +footer { + padding-top: 15px; + color: #aaaaaa; + border-top: 5px solid #212325; + background: #2d3032; +} +footer h4 { + color: #fff; + font-size: 14px; +} +footer a { + color: #72b626; + border-bottom: 1px dotted #aaaaaa; +} +footer a:hover { + color: #fff; +} +footer .bottom-line { + width: auto; + padding: 20px; + background: #212325; +} +footer .bottom-line p { + margin: 0; +} +footer hr { + border-top: 0; + border-bottom: 1px solid #454a4d; +} +.footer-form .btn { + border: 0; + text-shadow: 0 0 0 transparent; + -webkit-box-shadow: 0 0 0 0 transparent; + -moz-box-shadow: 0 0 0 0 transparent; + box-shadow: 0 0 0 0 transparent; +} +.footer-form .btn:hover { + border: 0; +} +.footer-form fieldset input[type="text"] { + border: 1px solid #000; + -webkit-box-shadow: 0 0 0 0 transparent; + -moz-box-shadow: 0 0 0 0 transparent; + box-shadow: 0 0 0 0 transparent; +} +@media (min-width: 1200px) { + input.flexible { + width: 73%; + } +} +@media (max-width: 1199px) { + input.flexible { + width: 70%; + } +} +@media (max-width: 979px) { + .navbar .nav-collapse .nav > li > a, + .navbar .nav-collapse .dropdown-menu a { + color: #ffffff; + } + .navbar .nav > li > a { + background: none; + } + .navbar .nav-collapse .nav > li > a:hover, + .navbar .nav-collapse .dropdown-menu a:hover { + background-color: #72b626; + } + .info-box { + text-align: center; + } + input.flexible { + width: 50%; + } +} +@media (min-width: 768px) and (max-width: 979px) { + .footer-form input[type="text"] { + width: 90%; + } +} +@media (max-width: 767px) { + header, + header form { + text-align: center; + } + .social-media { + margin: 0; + } + footer { + margin-left: -20px; + margin-right: -20px; + padding-left: 20px; + padding-right: 20px; + } + footer .bottom-line { + margin-left: -20px; + margin-right: -20px; + } +} + +textarea { + width: 70%; + height: 150px; +} + +ul#comments { + list-style-type: none; +} diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb new file mode 100644 index 0000000..ae953a2 --- /dev/null +++ b/app/controllers/application_controller.rb @@ -0,0 +1,4 @@ +class ApplicationController < ActionController::Base + protect_from_forgery + before_filter :authenticate_user! +end diff --git a/app/controllers/recipes_controller.rb b/app/controllers/recipes_controller.rb new file mode 100644 index 0000000..ef80211 --- /dev/null +++ b/app/controllers/recipes_controller.rb @@ -0,0 +1,139 @@ +class RecipesController < ApplicationController + autocomplete :ingredient, :name + + # GET /recipes + # GET /recipes.json + + def index + @recipes_filtered = Recipe.where("origin LIKE '%#{params[:q]}%' OR name LIKE '%#{params[:q]}%' OR description LIKE '%#{params[:q]}%' OR preparation LIKE '%#{params[:q]}%'").limit(10).order('name') + @recipes = Recipe.paginate(:page => params[:page], :per_page => 8, :order => 'id DESC') + @types = Type.all + + if !params[:search].blank? + @recipes = Recipe.where("origin LIKE '%#{params[:search]}%' OR name LIKE '%#{params[:search]}%' OR description LIKE '%#{params[:search]}%' OR preparation LIKE '%#{params[:search]}%'").limit(10).order('name').paginate(:page => params[:page], :per_page => 8, :order => 'id DESC') + end + + respond_to do |format| + format.html # index.html.erb + format.json{ render json: @recipes_filtered.to_json} + end + end + + def show_category + @types = Type.all + type = Type.find_by_name(params[:type].gsub('-','/')) + @recipes = Recipe.where(type_id: type.id).paginate(:page => params[:page], :per_page => 8, :order => 'id DESC') + end + + def ingredients + @ingredients = Ingredient.where('name LIKE ?', "%#{params[:term]}%").limit(20).order('name').uniq_by { |obj| obj.name } + respond_to do |format| + format.json + end + end + + # GET /recipten + # GET /recipten.json + def list + @recipes = Recipe.paginate(:page => params[:page], :per_page => 10, :order => 'id DESC').where(user_id: current_user.id) + + respond_to do |format| + format.html # index.html.erb + format.json { render json: @recipes } + end + end + + # GET /recipes/1 + # GET /recipes/1.json + def show + @recipe = Recipe.find(params[:id]) + + respond_to do |format| + format.html # show.html.erb + format.json { render json: @recipe } + end + end + + # GET /recipes/new + # GET /recipes/new.json + def new + @recipe = Recipe.new + + respond_to do |format| + format.html # new.html.erb + format.json { render json: @recipe } + end + end + + # GET /recipes/1/edit + def edit + @recipe = Recipe.find(params[:id]) + redirect_if_invalid_user + end + + # POST /recipes + # POST /recipes.json + def create + @recipe = Recipe.new(params[:recipe]) + + respond_to do |format| + if @recipe.save + format.html { redirect_to @recipe, notice: 'Het recept werd aangemaakt.' } + format.json { render json: @recipe, status: :created, location: @recipe } + else + format.html { render action: "new" } + format.json { render json: @recipe.errors, status: :unprocessable_entity } + end + end + end + + # PUT /recipes/1 + # PUT /recipes/1.json + def update + @recipe = Recipe.find(params[:id]) + + redirect_if_invalid_user + + respond_to do |format| + if @recipe.update_attributes(params[:recipe]) + format.html { redirect_to @recipe, notice: 'Het recept werd aangepast.' } + format.json { head :no_content } + else + format.html { render action: "edit" } + format.json { render json: @recipe.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /recipes/1 + # DELETE /recipes/1.json + def destroy + @recipe = Recipe.find(params[:id]) + redirect_if_invalid_user + @recipe.destroy + + respond_to do |format| + format.html { redirect_to recipes_url } + format.json { head :no_content } + end + end + + def edit_all + @recipes = Recipe.all + @people = User.all + end + + def update_all + params['recipe'].keys.each do |id| + @recipe = Recipe.find(id.to_i) + @recipe.update_attributes(params['recipe'][id]) + end + redirect_to(recipes_url) + end + + def redirect_if_invalid_user + if @recipe.user_id != current_user.id + redirect_to @recipe, alert: "Jij mag dit recept niet aanpassen." + end + end +end diff --git a/app/controllers/site_controller.rb b/app/controllers/site_controller.rb new file mode 100644 index 0000000..fc83279 --- /dev/null +++ b/app/controllers/site_controller.rb @@ -0,0 +1,4 @@ +class SiteController < ApplicationController + def about + end +end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb new file mode 100644 index 0000000..de6be79 --- /dev/null +++ b/app/helpers/application_helper.rb @@ -0,0 +1,2 @@ +module ApplicationHelper +end diff --git a/app/helpers/recipes_helper.rb b/app/helpers/recipes_helper.rb new file mode 100644 index 0000000..f526316 --- /dev/null +++ b/app/helpers/recipes_helper.rb @@ -0,0 +1,2 @@ +module RecipesHelper +end diff --git a/app/helpers/site_helper.rb b/app/helpers/site_helper.rb new file mode 100644 index 0000000..c879486 --- /dev/null +++ b/app/helpers/site_helper.rb @@ -0,0 +1,2 @@ +module SiteHelper +end diff --git a/app/mailers/.gitkeep b/app/mailers/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/app/models/.gitkeep b/app/models/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/app/models/comment.rb b/app/models/comment.rb new file mode 100644 index 0000000..3d8f1ff --- /dev/null +++ b/app/models/comment.rb @@ -0,0 +1,3 @@ +class Comment < ActiveRecord::Base + opinio +end diff --git a/app/models/ingredient.rb b/app/models/ingredient.rb new file mode 100644 index 0000000..d8ecf83 --- /dev/null +++ b/app/models/ingredient.rb @@ -0,0 +1,11 @@ +class Ingredient < ActiveRecord::Base + before_save :set_quantity + belongs_to :recipe + + attr_accessible :name, :quantity, :unit + + def set_quantity + self.quantity = self.unit.gsub(',','.').to_f + end + +end diff --git a/app/models/recipe.rb b/app/models/recipe.rb new file mode 100644 index 0000000..bb18114 --- /dev/null +++ b/app/models/recipe.rb @@ -0,0 +1,27 @@ +class Recipe < ActiveRecord::Base + before_save :default_values + + has_many :ingredients + belongs_to :type + belongs_to :user + accepts_nested_attributes_for :ingredients, :allow_destroy => true + + delegate :url, to: :picture, allow_nil: true + + attr_accessible :description, :name, :preparation, :ingredients_attributes, :picture, :duration, :type_id, :user_id, :servings, :url, :picture, :origin + validates_presence_of :name, :description, :preparation, :type + + has_attached_file :picture, :styles => { + :banner => "670x195#", + :medium => "500x500>", + :thumb => "100x100>", + :default_url => '/assets/missing.png' + } + + opinio_subjectum + + def default_values + self.servings ||= 1 + end + +end diff --git a/app/models/type.rb b/app/models/type.rb new file mode 100644 index 0000000..67c288c --- /dev/null +++ b/app/models/type.rb @@ -0,0 +1,3 @@ +class Type < ActiveRecord::Base + attr_accessible :name +end diff --git a/app/models/user.rb b/app/models/user.rb new file mode 100644 index 0000000..8bef359 --- /dev/null +++ b/app/models/user.rb @@ -0,0 +1,7 @@ +class User < ActiveRecord::Base + devise :invitable, :database_authenticatable, :recoverable, :rememberable, :trackable, :validatable + + attr_accessible :name, :email, :password, :password_confirmation, :remember_me + + validates_presence_of :name +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..aa04165 --- /dev/null +++ b/app/views/devise/confirmations/new.html.erb @@ -0,0 +1,15 @@ +

Bevestiging opnieuw verzenden

+ +<%= simple_form_for(resource, :as => resource_name, :url => confirmation_path(resource_name), :html => { :method => :post }) do |f| %> + <%= f.error_notification %> + +
+ <%= f.input :email, :required => true %> +
+ +
+ <%= f.button :submit, "Resend confirmation instructions" %> +
+<% end %> + +<%= render "devise/shared/links" %> diff --git a/app/views/devise/invitations/edit.html.erb b/app/views/devise/invitations/edit.html.erb new file mode 100644 index 0000000..6d8530f --- /dev/null +++ b/app/views/devise/invitations/edit.html.erb @@ -0,0 +1,12 @@ +

<%= t 'devise.invitations.edit.header' %>

+ +<%= simple_form_for resource, :as => resource_name, :url => invitation_path(resource_name), :html => { :method => :put } do |f| %> + <%= devise_error_messages! %> + <%= f.hidden_field :invitation_token %> + + <%= f.input :name, :label => "Naam" %> + <%= f.input :password, :label => "Wachtwoord" %> + <%= f.input :password_confirmation, :label => "Bevestiging wachtwoord" %> + + <%= f.submit "Klaar", :class => "btn btn-primary" %> +<% end %> diff --git a/app/views/devise/invitations/new.html.haml b/app/views/devise/invitations/new.html.haml new file mode 100644 index 0000000..a782a90 --- /dev/null +++ b/app/views/devise/invitations/new.html.haml @@ -0,0 +1,12 @@ +%h2= t "devise.invitations.new.header" += simple_form_for resource, :as => resource_name, :url => invitation_path(resource_name), :html => {:method => :post} do |f| + = devise_error_messages! + - resource.class.invite_key_fields.each do |field| + = f.input field + = f.submit t("devise.invitations.new.submit_button"), :class => "btn btn-primary" + +%h3 Zijn reeds uitgenodigd: +%ul + - User.all.each do |user| + %li + = "#{user.name || user.email} (uitgenodigd door #{User.find(user.invited_by_id || 1).name})" 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..7a95ec0 --- /dev/null +++ b/app/views/devise/mailer/confirmation_instructions.html.erb @@ -0,0 +1,5 @@ +

Welkom <%= @resource.email %>!

+ +

Je kan het e-mail adres van je account bevestigen adhv onderstaande link:

+ +

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

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

Hallo <%= @resource.email %>!

+ +

Iemand heeft je uitgenodigd voor Moederse Recepten (<%= root_url %>), je kan deze uitnodiging accepteren door te klikken op onderstaande link.

+ +

<%= link_to 'Accepteer uitnodiging', accept_invitation_url(@resource, :invitation_token => @resource.invitation_token) %>

+ +

Als je helemaal niet wil uitgenodigd worden, mag je deze mail negeren.
+ Je account zal niet worden aangemaakt tot je op bovenstaande link klikt en een wachtwoord aanmaakt.

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..64c1ee6 --- /dev/null +++ b/app/views/devise/mailer/reset_password_instructions.html.erb @@ -0,0 +1,8 @@ +

Hallo <%= @resource.email %>!

+ +

Iemand heeft aangevraagd om je wachtwoord te veranderen, je kan dit doen door op onderstaande link te klikken.

+ +

<%= link_to 'Verander mijn wachtwoord', edit_password_url(@resource, :reset_password_token => @resource.reset_password_token) %>

+ +

Als je helemaal niet had gevraagd om je wachtwoord te veranderen, mag je deze mail negeren.

+

Je wachtwoord zal niet veranderen tot je op bovenstaande link klikt en een nieuw wachtwoord ingeeft.

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..a0ad218 --- /dev/null +++ b/app/views/devise/mailer/unlock_instructions.html.erb @@ -0,0 +1,7 @@ +

Hallo <%= @resource.email %>!

+ +

Je account werd geblokkeerd omdat iemand meermaals heeft proberen inloggen met jouw email-adres en een foutief wachtwoord.

+ +

Klik op onderstaande link om je account te deblokkeren:

+ +

<%= link_to 'Deblokkeer mijn 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..149520c --- /dev/null +++ b/app/views/devise/passwords/edit.html.erb @@ -0,0 +1,19 @@ +

Change your password

+ +<%= simple_form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :put }) do |f| %> + <%= f.error_notification %> + + <%= f.input :reset_password_token, :as => :hidden %> + <%= f.full_error :reset_password_token %> + +
+ <%= f.input :password, :label => "New password", :required => true %> + <%= f.input :password_confirmation, :label => "Confirm your new password", :required => true %> +
+ +
+ <%= f.button :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..de33627 --- /dev/null +++ b/app/views/devise/passwords/new.html.erb @@ -0,0 +1,15 @@ +

Forgot your password?

+ +<%= simple_form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :post }) do |f| %> + <%= f.error_notification %> + +
+ <%= f.input :email, :required => true %> +
+ +
+ <%= f.button :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..6a9a4b3 --- /dev/null +++ b/app/views/devise/registrations/edit.html.erb @@ -0,0 +1,22 @@ +

Edit <%= resource_name.to_s.humanize %>

+ +<%= simple_form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put }) do |f| %> + <%= f.error_notification %> + +
+ <%= f.input :email, :required => true, :autofocus => true %> + <%= f.input :password, :autocomplete => "off", :hint => "leave it blank if you don't want to change it", :required => false %> + <%= f.input :password_confirmation, :required => false %> + <%= f.input :current_password, :hint => "we need your current password to confirm your changes", :required => true %> +
+ +
+ <%= f.button :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..2665b08 --- /dev/null +++ b/app/views/devise/registrations/new.html.erb @@ -0,0 +1,17 @@ +

Sign up

+ +<%= simple_form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| %> + <%= f.error_notification %> + +
+ <%= f.input :email, :required => true, :autofocus => true %> + <%= f.input :password, :required => true %> + <%= f.input :password_confirmation, :required => true %> +
+ +
+ <%= f.button :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..2d7dcb9 --- /dev/null +++ b/app/views/devise/sessions/new.html.erb @@ -0,0 +1,14 @@ +

Aanmelden

+<%= simple_form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| %> +
+ <%= f.input :email, :required => false, :autofocus => true %> + <%= f.input :password, :required => false %> + <%= f.input :remember_me, :label => "Onthoud mij", :as => :boolean if devise_mapping.rememberable? %> +
+ +
+ <%= f.button :submit, "Aanmelden", :class => "btn btn-primary" %> +
+<% 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..e31e50f --- /dev/null +++ b/app/views/devise/shared/_links.erb @@ -0,0 +1,25 @@ +<%- if controller_name != 'sessions' %> +<%= link_to "Aanmelden", new_session_path(resource_name) %>
+<% end -%> + +<%- if devise_mapping.registerable? && controller_name != 'registrations' %> +<%= link_to "Inschrijven", new_registration_path(resource_name) %>
+<% end -%> + +<%- if devise_mapping.recoverable? && controller_name != 'passwords' %> +<%= link_to "Wachtwoord vergeten?", new_password_path(resource_name) %>
+<% end -%> + +<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %> +<%= link_to "Geen bevestigings-instructies gekregen?", new_confirmation_path(resource_name) %>
+<% end -%> + +<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %> +<%= link_to "Geen deblokkeer-instructies gekregen?", new_unlock_path(resource_name) %>
+<% end -%> + +<%- if devise_mapping.omniauthable? %> + <%- resource_class.omniauth_providers.each do |provider| %> + <%= link_to "Aanmelden met #{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..4a9b1f8 --- /dev/null +++ b/app/views/devise/unlocks/new.html.erb @@ -0,0 +1,15 @@ +

Deblokkeer-instructies opnieuw verzenden

+ +<%= simple_form_for(resource, :as => resource_name, :url => unlock_path(resource_name), :html => { :method => :post }) do |f| %> + <%= f.error_notification %> + +
+ <%= f.input :email, :required => true %> +
+ +
+ <%= f.button :submit, "Verzend deblokkeer-instructies" %> +
+<% end %> + +<%= render "devise/shared/links" %> diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml new file mode 100644 index 0000000..5cb03ee --- /dev/null +++ b/app/views/layouts/application.html.haml @@ -0,0 +1,57 @@ +!!! +%html + %head + %title Moederse Recepten + /[if lt IE 9] + + = stylesheet_link_tag "application", :media => "screen" + = stylesheet_link_tag "print", :media => "print" + %link{rel: "stylesheet", href: 'http://fonts.googleapis.com/css?family=Patua+One'} + = javascript_include_tag "application" + = csrf_meta_tags + %meta{:content => "width=device-width, initial-scale=1.0", :name => "viewport"} + %body + .container.wrapper + %header + .row + .span7 + %h1 + %a{:href => "/"} + = image_tag "logo.png" + .span5 + %p + #e1.select2-container.bigdrop.select2-container-active + .row + .span12 + .navbar + .navbar-inner + .container + %ul.nav + %li{:class => ('active' if controller.action_name == 'new_index' && params[:controller] == 'recipes')}= link_to t(:all_recipes), recipes_index_path + %li{:class => ('active' if controller.action_name == 'list' && params[:controller] == 'recipes')}= link_to t(:my_recipes), list_recipes_path + %li{:class => ('active' if controller.action_name == 'new' && params[:controller] == 'recipes')}= link_to t(:add_recipe), new_recipe_url + %li{:class => ('active' if controller.action_name == 'new' && params[:controller] == 'devise/invitations')}= link_to t(:invite_someone), new_invitation_url + %li{:class => ('active' if controller.action_name == 'about' && params[:controller] == 'site')}= link_to t(:woordje_uitleg), :controller => '/site', :action => 'about' + %li= link_to t(:afmelden), destroy_user_session_path, method: :delete + + - flash.each do |name, msg| + %div{:class => "alert alert-#{name == :notice ? 'success' : 'errors'}"} + %a{:class => "close", :'data-dismiss' => "alert"} + x + = msg + .row + - if current_user + .span12= yield + / .span3 + / .user_nav + / - if user_signed_in? + / Aangemeld als + / %strong + / = current_user.name + / (#{current_user.email}) + / %br/ + / = link_to "Klik hier om af te melden", destroy_user_session_path, method: :delete + / - else + / = link_to "Aanmelden", new_user_session_path + - else + .span12= yield diff --git a/app/views/layouts/login.html.haml b/app/views/layouts/login.html.haml new file mode 100644 index 0000000..a0a038e --- /dev/null +++ b/app/views/layouts/login.html.haml @@ -0,0 +1,28 @@ +!!! +%html + %head + %title Moederse Recepten + /[if lt IE 9] + + = stylesheet_link_tag "application", :media => "screen" + = stylesheet_link_tag "print", :media => "print" + %link{rel: "stylesheet", href: 'http://fonts.googleapis.com/css?family=Patua+One'} + = javascript_include_tag "application" + = csrf_meta_tags + %meta{:content => "width=device-width, initial-scale=1.0", :name => "viewport"} + %body + .container.wrapper + %header + .row + .span12 + %h1 + %a{:href => "/"} + = image_tag "logo.png" + - flash.each do |name, msg| + %div{:class => "alert alert-#{name == :notice ? 'success' : 'errors'}"} + %a{:class => "close", :'data-dismiss' => "alert"} + x + = msg + .row + .span12 + = yield diff --git a/app/views/opinio/comments/_comment.html.erb b/app/views/opinio/comments/_comment.html.erb new file mode 100644 index 0000000..23dc3de --- /dev/null +++ b/app/views/opinio/comments/_comment.html.erb @@ -0,0 +1,13 @@ +<% reply = defined?(reply) ? reply : false %> +
  • + (<%= comment.created_at %>) <%= comment.owner.name -%>: + <%= (comment.body) -%> + (<%= link_to t('opinio.actions.delete'), comment_path(comment), :method => :delete, :remote => true %>) + <%# this enables only 1 level of replies %> + <% if Opinio.accept_replies && !reply %> + <%= link_to t('opinio.actions.reply'), reply_comment_path(comment), :remote => true %> +
      + <%= render :partial => "opinio/comments/comment", :collection => comment.comments, :locals => {:reply => true} %> +
    + <% end %> +
  • diff --git a/app/views/opinio/comments/_comments.html.erb b/app/views/opinio/comments/_comments.html.erb new file mode 100644 index 0000000..73124fe --- /dev/null +++ b/app/views/opinio/comments/_comments.html.erb @@ -0,0 +1,17 @@ +
    + <%= paginate comments %> +
    + +

    Reacties

    + +
      + <% unless comments.empty? %> + <%= render :partial => 'opinio/comments/comment', :collection => comments %> + <% else %> +
    • <%= t('opinio.messages.no_comments_found') %>
    • + <% end %> +
    + +
    + <%= paginate comments %> +
    diff --git a/app/views/opinio/comments/_new.html.erb b/app/views/opinio/comments/_new.html.erb new file mode 100644 index 0000000..b3ca926 --- /dev/null +++ b/app/views/opinio/comments/_new.html.erb @@ -0,0 +1,17 @@ +
    + <% if send(Opinio.current_user_method) %> +

    <%= t('opinio.messages.add_comment') %>

    + <%= form_for Comment.new, :remote => false do |f| %> +

    + <%= f.text_area :body %> +

    + <%= hidden_field_tag :commentable_id, commentable.id %> + <%= hidden_field_tag :commentable_type, commentable.class.base_class.name.to_s %> + <%= f.submit t('opinio.actions.add') %> + <% end %> + <% else %> +

    + <%= t('opinio.messages.must_be_logged_in_to_comment') %> +

    + <% end %> +
    diff --git a/app/views/opinio/comments/create.js.erb b/app/views/opinio/comments/create.js.erb new file mode 100644 index 0000000..2129152 --- /dev/null +++ b/app/views/opinio/comments/create.js.erb @@ -0,0 +1,16 @@ +$('#no_comments').hide(); +<% if @comment.valid? %> + <% if @reply %> + if($('#comment_<%= @comment.commentable_id %> ul').length == 0) + $('#comment_<%= @comment.commentable_id %>').append('
      '); + $('#comment_<%= @comment.commentable_id %>_replies').append("<%= escape_javascript( render @comment, :locals => {:reply => @reply} ) %>"); + $('#commentable_id').val('<%= @comment.commentable.commentable_id %>'); + $('#commentable_type').val('<%= @comment.commentable.commentable_type %>'); + <% else %> + $('#comments').<%= Opinio.sort_order == 'ASC' ? 'append' : 'prepend'%>("<%= escape_javascript( render @comment, :locals => {:reply => @reply} ) %>"); + <% end %> + $('textarea#comment_body').val(''); +<% else %> + $('#comments').prepend("<%= escape_javascript(flash[:notice]) %>"); + $('#comments').prepend("<%= escape_javascript(flash[:error]) %>"); +<% end %> diff --git a/app/views/opinio/comments/destroy.js.erb b/app/views/opinio/comments/destroy.js.erb new file mode 100644 index 0000000..b5f26b7 --- /dev/null +++ b/app/views/opinio/comments/destroy.js.erb @@ -0,0 +1,3 @@ +jQuery('#comment_<%= @comment.id %>').remove(); +jQuery('#comments').prepend("<%= escape_javascript(flash[:notice]) %>"); +jQuery('#comments').prepend("<%= escape_javascript(flash[:error]) %>"); diff --git a/app/views/opinio/comments/index.html.erb b/app/views/opinio/comments/index.html.erb new file mode 100644 index 0000000..0480957 --- /dev/null +++ b/app/views/opinio/comments/index.html.erb @@ -0,0 +1,7 @@ +

      <%= t('opinio.messages.comments') %>

      + +<%= paginate @comments %> + +<%= render :partial => "opinio/comments/comments", :locals => { :comments => @comments } %> + +<%= paginate @comments %> diff --git a/app/views/opinio/comments/reply.js.erb b/app/views/opinio/comments/reply.js.erb new file mode 100644 index 0000000..e1da044 --- /dev/null +++ b/app/views/opinio/comments/reply.js.erb @@ -0,0 +1,4 @@ +$("#commentable_id").val('<%= @commentable_id %>'); +$("#commentable_type").val('<%= @commentable_type %>'); +$("#new_comment textarea").val(''); +$("#new_comment textarea").focus(); \ No newline at end of file diff --git a/app/views/recipes/_form.html.haml b/app/views/recipes/_form.html.haml new file mode 100644 index 0000000..a673255 --- /dev/null +++ b/app/views/recipes/_form.html.haml @@ -0,0 +1,21 @@ += simple_nested_form_for @recipe, :html => { :class => 'form-horizontal' } do |f| + = f.input :name, :label => t('recepten.naam') + = f.input :origin, :label => t('recepten.origin') + = f.input :servings, label: t('recepten.aantal_personen'), placeholder: "1" + = f.input :duration, label: t('recepten.duur'), placeholder: t('recepten.in_minuten') + = f.association :type, :collection => Type.all(:order => 'id'), :prompt => t('recepten.kies_een_type') + = f.input :description, :input_html => { :class => "span6" }, :label => t('recepten.beschrijving') + = f.simple_fields_for :ingredients do |ingredient| + = ingredient.input :unit, :label => " ", :placeholder => "bv. 2 eetlepels", :label => t('recepten.aantal_en_eenheid') + = ingredient.input :name, :url => ingredients_path, :as => :autocomplete, :label => t('recepten.ingredient') + = ingredient.link_to_remove t('recepten.ingredient_verwijderen') + %p + = f.link_to_add t('recepten.voeg_ingredient_toe'), :ingredients + = f.input :preparation, :input_html => { :class => "span6" }, :label => t('recepten.bereiding') + = f.hidden_field :user_id, :value => current_user.id + + = f.input :picture, :label => "#{t('recepten.foto_uploaden')} #{image_tag(@recipe.picture.url(:thumb)) if controller.action_name == "edit"}" + + .form-actions + = f.submit "Klaar", :class => 'btn btn-primary' + = link_to t('.cancel', :default => t('annuleer')), recipes_path, :class => 'btn' diff --git a/app/views/recipes/_responsive_index.html.haml b/app/views/recipes/_responsive_index.html.haml new file mode 100644 index 0000000..7eb90b0 --- /dev/null +++ b/app/views/recipes/_responsive_index.html.haml @@ -0,0 +1,41 @@ +.row + .span12 + %h2= t :all_recipes + %hr +.row + .span9 + - @recipes.each do |recipe| + %article.row + .span2.hidden-phone + %p + = l(recipe.created_at, :format => "%e %b %Y") + %br + - if !recipe.origin.blank? + %b Origineel recept van: + %br + = recipe.origin + %br + %b Toegevoegd door: + %br + = recipe.user.name + %hr + %p= "#{t('recepten.ingredienten')}:" + %ul.post-tags + - recipe.ingredients.each do |ingredient| + %li= ingredient.name + .span7 + %h3 + %i.icon.icon-food + = link_to recipe.name, recipe + = link_to image_tag(recipe.picture.url(:banner)), recipe unless recipe.picture.url.match(/missing.png$/) + %p= recipe.description + = link_to "#{t('recepten.recept_bekijken')} »", recipe, class: "btn btn-primary" + = will_paginate @recipes + %aside.span3 + .well + %strong= t('recepten.types_gerechten') + %hr + %ul.tag-cloud + - @types.each do |type| + %li + = link_to type.name, "/categorie/#{type.name.gsub('/','-')}" diff --git a/app/views/recipes/edit.html.haml b/app/views/recipes/edit.html.haml new file mode 100644 index 0000000..2993def --- /dev/null +++ b/app/views/recipes/edit.html.haml @@ -0,0 +1,4 @@ +- model_class = Recipe +.page-header + %h1= t('recepten.recept_aanpassen') += render :partial => "form" diff --git a/app/views/recipes/edit_all.html.haml b/app/views/recipes/edit_all.html.haml new file mode 100644 index 0000000..beb6728 --- /dev/null +++ b/app/views/recipes/edit_all.html.haml @@ -0,0 +1,14 @@ += form_for :recipe, :url => update_all_path, :html => { :method => :put } do + %table + %tr + %th Name + %th description + %th origin + - @recipes.each do |recipe| + = fields_for "recipe[]", recipe do |recipe_fields| + %tr + %td= recipe_fields.text_field :name + %td= recipe_fields.text_area :description + %td= recipe_fields.text_field :origin + .actions + = submit_tag diff --git a/app/views/recipes/index.html.haml b/app/views/recipes/index.html.haml new file mode 100644 index 0000000..57b3307 --- /dev/null +++ b/app/views/recipes/index.html.haml @@ -0,0 +1 @@ += render :partial => "responsive_index" diff --git a/app/views/recipes/ingredients.json.haml b/app/views/recipes/ingredients.json.haml new file mode 100644 index 0000000..2c810eb --- /dev/null +++ b/app/views/recipes/ingredients.json.haml @@ -0,0 +1 @@ += raw @ingredients.map(&:name).to_json diff --git a/app/views/recipes/list.html.haml b/app/views/recipes/list.html.haml new file mode 100644 index 0000000..e8dea8c --- /dev/null +++ b/app/views/recipes/list.html.haml @@ -0,0 +1,36 @@ +- model_class = Recipe +.page-header + %h1= t('recepten.my_recipes') + +- if @recipes.blank? + %p + =t('recepten.you_have_no_recipes') +- else + %table.table.table-striped + %thead + %tr + %th # + %th= t('recepten.naam') + %th= t('recepten.beschrijving') + %th= t('recepten.type') + %th=t '.actions' + + %tbody + - @recipes.each do |recipe| + %tr + %td= link_to recipe.id, recipe_path(recipe) + %td + = link_to recipe.name, recipe_path(recipe) + %br + = link_to image_tag(recipe.picture.url(:thumb)), recipe_path(recipe) + %td= link_to truncate(recipe.description, length: 100), recipe_path(recipe) + %td= link_to recipe.type.name, recipe_path(recipe) + %td + = link_to t('details'), recipe_path(recipe), :class => 'btn btn-mini' + = link_to t('.edit'), edit_recipe_path(recipe), :class => 'btn btn-mini' + = link_to t('.destroy'), recipe_path(recipe), :method => :delete, :data => { :confirm => t('.confirm', :default => t("helpers.links.confirm", :default => 'Ben je zeker? Het recept zal onheroepelijk verwijderd worden.')) }, :class => 'btn btn-mini btn-danger' + + = will_paginate @recipes + + += link_to t('.new', :default => t('add_a_recipe')), new_recipe_path, :class => 'btn btn-primary' diff --git a/app/views/recipes/new.html.haml b/app/views/recipes/new.html.haml new file mode 100644 index 0000000..2634a9b --- /dev/null +++ b/app/views/recipes/new.html.haml @@ -0,0 +1,4 @@ +- model_class = Recipe +.page-header + %h1= t 'recepten.nieuw_recept_titel' += render :partial => "form" diff --git a/app/views/recipes/show.html.haml b/app/views/recipes/show.html.haml new file mode 100644 index 0000000..5c7fef4 --- /dev/null +++ b/app/views/recipes/show.html.haml @@ -0,0 +1,38 @@ +- model_class = Recipe +.page-header + %h1= @recipe.name + %h6= "#{@recipe.type.name} voor #{pluralize(@recipe.servings, "persoon") || "onbepaald aantal personen"}, duurtijd: #{pluralize(@recipe.duration.to_s, "minuut") if not @recipe.duration.blank?} #{"onbepaald aantal minuten" if @recipe.duration.blank?}" + %h6= "Origineel van: #{@recipe.origin}" if !@recipe.origin.blank? + + +%p + = image_tag @recipe.picture.url(:medium) unless /missing.png$/.match(@recipe.picture.url) +%p + %strong + = "#{t('recepten.beschrijving')}:" + %br + = @recipe.description +%p + %strong + = "#{t('recepten.ingredienten')}:" + %br + %ul + - @recipe.ingredients.each do |ingredient| + %li + = "#{ingredient.unit.gsub('.',',')} #{ingredient.name}" +%p + %strong + ="#{t('recepten.bereiding')}:" + %br + = markdown @recipe.preparation +%p + %strong + = "#{t('recepten.toegevoegd_door')}:" + %br + = @recipe.user.name + +.form-actions + = link_to t('.back'), recipes_path, :class => 'btn' + = link_to t('.edit'), edit_recipe_path(@recipe), :class => 'btn' if @recipe.user_id == current_user.id + += comments_for @recipe diff --git a/app/views/recipes/show_category.html.haml b/app/views/recipes/show_category.html.haml new file mode 100644 index 0000000..57b3307 --- /dev/null +++ b/app/views/recipes/show_category.html.haml @@ -0,0 +1 @@ += render :partial => "responsive_index" diff --git a/app/views/site/about.html.haml b/app/views/site/about.html.haml new file mode 100644 index 0000000..1806d2f --- /dev/null +++ b/app/views/site/about.html.haml @@ -0,0 +1,18 @@ +:markdown + + ## Woordje uitleg + + Voor Marianne kon koken stond er voornamelijk [spaghetti met ketchup](http://www.heinz.com/our-food/products/ketchup.aspx) op het menu. + Maar sinds een goeie dertig jaar groeide het aantal recepten exponentieel. + Op de [pillekenssaus](http://moederserecepten.be/recipes/14) volgde de betere wereldkeuken met [tagliatelli op z'n moeders](http://moederserecepten.be/recipes/9), [Noord-Afrikaanse gevulde aubergines](http://moederserecepten.be/recipes/3) en [Jambalaya](http://moederserecepten.be/recipes/29). + Na heel wat geknoei met ringmappen, kookboeken, plastieken mapjes en kilo's Pritt + durfde Marianne al eens luidop te dromen van een databank met al haar recepten. + Maar omdat goeie voornemens meestal beperkt blijven tot de eerste week van de vakantie, + bleef het bij een bescheiden Word-documentje met de naam 'Moederse recepten'. + + Sommige dromen worden op latere leeftijd werkelijkheid. + Voor haar zestigste verjaardag leek ons een digitaal alternatief wel op zijn plaats. + En mochten er nog twijfels bestaan over een nuttige tijdsbesteding tijdens het pensioen, is het selecteren, + uitproberen en inputten van recepten toch alvast een fijn idee. + + [Dat wil er wel in](http://moederserecepten.be/recipes/35)! diff --git a/config.ru b/config.ru new file mode 100644 index 0000000..d56956e --- /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 Moederse::Application diff --git a/config/application.rb b/config/application.rb new file mode 100644 index 0000000..12aadf1 --- /dev/null +++ b/config/application.rb @@ -0,0 +1,67 @@ +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 Moederse + 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 = "nl-BE" + + # 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' + + # Different devise layouts + config.to_prepare do + Devise::SessionsController.layout "login" +end + 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.example b/config/database.yml.example new file mode 100644 index 0000000..10ffd50 --- /dev/null +++ b/config/database.yml.example @@ -0,0 +1,42 @@ +# MySQL. Versions 4.1 and 5.0 are recommended. +# +# Install the MYSQL driver +# gem install mysql2 +# +# Ensure the MySQL gem is defined in your Gemfile +# gem 'mysql2' +# +# And be sure to use new-style password hashing: +# http://dev.mysql.com/doc/refman/5.0/en/old-client.html +development: + adapter: mysql2 + encoding: utf8 + reconnect: false + database: moederse_development + pool: 5 + username: root + password: + socket: /tmp/mysql.sock + +# 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: mysql2 + encoding: utf8 + reconnect: false + database: moederse_test + pool: 5 + username: root + password: + socket: /tmp/mysql.sock + +production: + adapter: mysql2 + encoding: utf8 + reconnect: false + database: moederse_production + pool: 5 + username: root + password: + socket: /tmp/mysql.sock diff --git a/config/environment.rb b/config/environment.rb new file mode 100644 index 0000000..db69d74 --- /dev/null +++ b/config/environment.rb @@ -0,0 +1,7 @@ +# Load the rails application +require File.expand_path('../application', __FILE__) + +# Initialize the rails application +Moederse::Application.initialize! + +APP_VERSION = `git describe --tags`.gsub(/\s+/, "") \ No newline at end of file diff --git a/config/environments/development.rb b/config/environments/development.rb new file mode 100644 index 0000000..f80d84f --- /dev/null +++ b/config/environments/development.rb @@ -0,0 +1,42 @@ +Moederse::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 + + # 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 + + # let Paperclip know to look for ImageMagick + # make sure ImageMagick and GhostScript are installed + Paperclip.options[:command_path] = "/usr/local/bin/" + +end diff --git a/config/environments/production.rb b/config/environments/production.rb new file mode 100644 index 0000000..c38551e --- /dev/null +++ b/config/environments/production.rb @@ -0,0 +1,77 @@ +Moederse::Application.configure do + require 'www_ditcher' + config.middleware.use "WwwDitcher" + + # 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 += ["print.css"] + + # 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 + + config.action_mailer.default_url_options = { :host => "moederserecepten.be" } + + config.middleware.use ExceptionNotifier, + :email_prefix => "[Moederse Error] ", + :sender_address => %{"notifier" }, + :exception_recipients => %w{moederse-error@banteng.be} +end diff --git a/config/environments/test.rb b/config/environments/test.rb new file mode 100644 index 0000000..c41d311 --- /dev/null +++ b/config/environments/test.rb @@ -0,0 +1,37 @@ +Moederse::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..26e5b88 --- /dev/null +++ b/config/initializers/devise.rb @@ -0,0 +1,260 @@ +# 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 = "no-reply@moederserecepten.be" + + # Configure the class responsible to send e-mails. + # config.mailer = "Devise::Mailer" + + # ==> 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 = "3a13ad9a58a65d37a2b3ce0ca9a0288e7518d7509986a1fcaf269c6f0078927db202bf9612bd4202be8c9e78105160722f01b99db51e188fd92cf4193c0bb102" + + # ==> Configuration for :invitable + # The period the generated invitation token is valid, after + # this period, the invited resource won't be able to accept the invitation. + # When invite_for is 0 (the default), the invitation won't expire. + # config.invite_for = 2.weeks + + # Number of invitations users can send. + # If invitation_limit is nil, users can send unlimited invitations. + # If invitation_limit is 0, users can't send invitations. + # If invitation_limit n > 0, users can send n invitations. + # Default: nil + # config.invitation_limit = 5 + + # The key to be used to check existing users when sending an invitation + # and the regexp used to test it when validate_on_invite is not set. + # config.invite_key = {:email => /A[^@]+@[^@]+z/} + # config.invite_key = {:email => /A[^@]+@[^@]+z/, :username => nil} + + # Flag that force a record to be valid before being actually invited + # Default: false + # config.validate_on_invite = true + + # ==> 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 + + # 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 6..128. + # config.password_length = 6..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" + + # ==> Configuration for :invitable + # The period the generated invitation token is valid, after + # this period, the invited resource won't be able to accept the invitation. + # When invite_for is 0 (the default), the invitation won't expire. + # config.invite_for = 2.weeks +end diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb new file mode 100644 index 0000000..ffe8000 --- /dev/null +++ b/config/initializers/inflections.rb @@ -0,0 +1,60 @@ +#encoding: utf-8 + +ActiveSupport::Inflector.inflections do |inflect| + + inflect.singular(/en$/, '') + + inflect.plural(/cees$/, "cesen") + inflect.plural(/chys$/, "chen") + inflect.plural(/(c|m|n|t)us$/, '\1i') + inflect.plural(/(c|d|e|i|t|tr|v)um$/, '\1a') + inflect.plural(/ee$/, "eeën") + inflect.plural(/eum$/, "ea") + inflect.plural(/heid$/, "heden") + inflect.plural(/dix$/, "dices") + inflect.plural(/lid$/, "leden") + inflect.plural(/(nuens)is$/, '\1es') + inflect.plural(/stad$/, "steden") + inflect.plural(/(gave)$/, '\1n') + inflect.plural(/(a|ë|i|o|u|y)$/, "\1's") + inflect.plural(/(blad|kind)$/, '\1eren') + inflect.plural(/(ige)$/, '\1n') + inflect.plural(/(allerg|bat|scop|fantas|fib|log|mal|metr|nest|nom|or|path)ie$/, '\1ieën') + inflect.plural(/(alka|o)(l)ie?$/, '\1\2iën') + inflect.plural(/(schip)$/, 'schepen') + inflect.plural(/(abort|act|acquisit|advis|amat|inspect)(eur)$/, '\1\2s') + inflect.plural(/(gevoel)$/, '\1ens') + inflect.plural(/(accent|agent)([-\s])(\w+)/, '\1s\2\3s') + inflect.plural(/advocaat-(\w+)/, 'advocaten-\1') + inflect.plural(/(bike|borstel|distel|kabel|prikkel|winkel)$/, '\1s') + inflect.plural(/(aar|aard|age|ah|bag|beignet|bike|chef|chon|club|e|é|eau|eër|el|em|en|eon|er|erd|festival|filet|film|foon|ie|ier|iër|kon|lation|lieu|lotion|marshal|nal|oir|oor|ose|ou|our|ount|pon|poo|prop|rak|rant|rn|sar|sion|sit|show|sor|spray|sun|tank|tant|test|um|view)$/, '\1s') + inflect.plural(/((aan|ge|ver|voor).*de|afe|ate|denkende|dode|einde|ene|isme|ïsme|ke|oïde|eose|ste|tride|valide|verwante|vrage|zijde)$/, "\1n") + inflect.plural(/(bel|bier|cel|contractant|deur|dier|dienaar|eem|een|eel|eer|engel|gezwel|gier|iel|iem|jaar|kel|krant|lem|lier|regel|migrant|model|officier|oor|oen|oer|penaar|schel|schijnsel|sien|spier|stel|stem|taar|tenaar|tier|uaar|vaar)$/,"\1en") + inflect.plural(/(a|e|o|u)\1f$/, '\1ven') + inflect.plural(/(a|e|o|u)\1s$/, '\1zen') + inflect.plural(/(ver|cijn)s$/, '\1zen') + inflect.plural(/(a|e|o|u)\1([^aeiou])$/, '\1\2en') + inflect.plural(/(aï|alia)(s)/, '\1\2\2en') + inflect.plural(/([^aeiou][aeiou])([^aeioux])$/, '\1\2\3en') + inflect.plural(/^([aeiou])([^aeioux])$/, '\1\2\2en') + inflect.plural(/(de|ene)$/, '\1n') + inflect.plural(/f$/, 'ven') + inflect.plural(/([aeiou]|aar|eur|ij)s$/, '\1zen') + inflect.plural(/(lo)$/, '\1oien') + inflect.plural(/(wei|zij)$/, '\1den') + inflect.plural(/(e)$/, '\1n') + inflect.plural(/$/, 'en') + + inflect.irregular 'persoon', 'personen' + inflect.irregular 'minuut', 'minuten' + inflect.irregular 'user', 'users' + inflect.irregular 'recipe', 'recipes' + inflect.irregular 'type', 'types' + inflect.irregular 'ingredient', 'ingredients' + inflect.irregular 'ingrediënt', 'ingrediënten' + inflect.irregular 'comment', 'comments' + inflect.irregular 'picture', 'pictures' + + inflect.uncountable(%w(geld informatie rijst afrokapsel)) + +end diff --git a/config/initializers/localeapp.rb b/config/initializers/localeapp.rb new file mode 100644 index 0000000..74cac53 --- /dev/null +++ b/config/initializers/localeapp.rb @@ -0,0 +1,5 @@ +require 'localeapp/rails' + +Localeapp.configure do |config| + config.api_key = 'kwaM2Ns3WU2Rq1kHfHSvzY7uuLgTlCcPol5ZrKDKP3GDau3esF' +end diff --git a/config/initializers/mime_types.rb b/config/initializers/mime_types.rb new file mode 100644 index 0000000..72aca7e --- /dev/null +++ b/config/initializers/mime_types.rb @@ -0,0 +1,5 @@ +# Be sure to restart your server when you modify this file. + +# Add new mime types for use in respond_to blocks: +# Mime::Type.register "text/richtext", :rtf +# Mime::Type.register_alias "text/html", :iphone diff --git a/config/initializers/opinio.rb b/config/initializers/opinio.rb new file mode 100644 index 0000000..c8b40ed --- /dev/null +++ b/config/initializers/opinio.rb @@ -0,0 +1,28 @@ +# Opinio Configuration + +Opinio.setup do |config| + + # Use this to change the class that calls +opinio+ method + config.model_name = "Comment" + + # This is the owner class of the comment (opinio model) + # config.owner_class_name = "User" + + # Change this if you do not want to allow replies on your comments + # config.accept_replies = true + + # Here you can change the method called to check who is the current user + # config.current_user_method = :current_user + + # Strip html tags on save comment + config.strip_html_tags_on_save = true + + # Comments sort order by created_at (DESC or ASC) + # Note: you can override that easily within each opinio subjectum + config.sort_order = 'DESC' + + # Wether or not the default opinio controller should set the flash + # when creating/removing comments + config.set_flash = true + +end diff --git a/config/initializers/secret_token.rb b/config/initializers/secret_token.rb new file mode 100644 index 0000000..e4aa5ad --- /dev/null +++ b/config/initializers/secret_token.rb @@ -0,0 +1,7 @@ +# Be sure to restart your server when you modify this file. + +# Your secret key for verifying the integrity of signed cookies. +# If you change this key, all old signed cookies will become invalid! +# Make sure the secret is at least 30 characters and all random, +# no regular words or you'll be exposed to dictionary attacks. +Moederse::Application.config.secret_token = '3c16e813d406b690a365cead3ef0177bc407338b14239343f741abe05d28d2c4d8c04c765d144e1970a616932f7d039a729ec4224ce680cf16ca590112a5974c' diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb new file mode 100644 index 0000000..cdade09 --- /dev/null +++ b/config/initializers/session_store.rb @@ -0,0 +1,8 @@ +# Be sure to restart your server when you modify this file. + +Moederse::Application.config.session_store :cookie_store, key: '_moederse_session' + +# Use the database for sessions instead of the cookie-based default, +# which shouldn't be used to store highly confidential information +# (create the session table with "rails generate session_migration") +# Moederse::Application.config.session_store :active_record_store diff --git a/config/initializers/simple_form.rb b/config/initializers/simple_form.rb new file mode 100644 index 0000000..b5e7247 --- /dev/null +++ b/config/initializers/simple_form.rb @@ -0,0 +1,144 @@ +# Use this setup block to configure all options available in SimpleForm. +SimpleForm.setup do |config| + # Wrappers are used by the form builder to generate a + # complete input. You can remove any component from the + # wrapper, change the order or even add your own to the + # stack. The options given below are used to wrap the + # whole input. + config.wrappers :default, :class => :input, + :hint_class => :field_with_hint, :error_class => :field_with_errors do |b| + ## Extensions enabled by default + # Any of these extensions can be disabled for a + # given input by passing: `f.input EXTENSION_NAME => false`. + # You can make any of these extensions optional by + # renaming `b.use` to `b.optional`. + + # Determines whether to use HTML5 (:email, :url, ...) + # and required attributes + b.use :html5 + + # Calculates placeholders automatically from I18n + # You can also pass a string as f.input :placeholder => "Placeholder" + b.use :placeholder + + ## Optional extensions + # They are disabled unless you pass `f.input EXTENSION_NAME => :lookup` + # to the input. If so, they will retrieve the values from the model + # if any exists. If you want to enable the lookup for any of those + # extensions by default, you can change `b.optional` to `b.use`. + + # Calculates maxlength from length validations for string inputs + b.optional :maxlength + + # Calculates pattern from format validations for string inputs + b.optional :pattern + + # Calculates min and max from length validations for numeric inputs + b.optional :min_max + + # Calculates readonly automatically from readonly attributes + b.optional :readonly + + ## Inputs + b.use :label_input + b.use :hint, :wrap_with => { :tag => :span, :class => :hint } + b.use :error, :wrap_with => { :tag => :span, :class => :error } + end + + # The default wrapper to be used by the FormBuilder. + config.default_wrapper = :default + + # Define the way to render check boxes / radio buttons with labels. + # Defaults to :nested for bootstrap config. + # :inline => input + label + # :nested => label > input + config.boolean_style = :nested + + # Default class for buttons + config.button_class = 'btn' + + # Method used to tidy up errors. Specify any Rails Array method. + # :first lists the first message for each field. + # Use :to_sentence to list all errors for each field. + # config.error_method = :first + + # Default tag used for error notification helper. + config.error_notification_tag = :div + + # CSS class to add for error notification helper. + config.error_notification_class = 'alert alert-error' + + # ID to add for error notification helper. + # config.error_notification_id = nil + + # Series of attempts to detect a default label method for collection. + # config.collection_label_methods = [ :to_label, :name, :title, :to_s ] + + # Series of attempts to detect a default value method for collection. + # config.collection_value_methods = [ :id, :to_s ] + + # You can wrap a collection of radio/check boxes in a pre-defined tag, defaulting to none. + # config.collection_wrapper_tag = nil + + # You can define the class to use on all collection wrappers. Defaulting to none. + # config.collection_wrapper_class = nil + + # You can wrap each item in a collection of radio/check boxes with a tag, + # defaulting to :span. Please note that when using :boolean_style = :nested, + # SimpleForm will force this option to be a label. + # config.item_wrapper_tag = :span + + # You can define a class to use in all item wrappers. Defaulting to none. + # config.item_wrapper_class = nil + + # How the label text should be generated altogether with the required text. + # config.label_text = lambda { |label, required| "#{required} #{label}" } + + # You can define the class to use on all labels. Default is nil. + config.label_class = 'control-label' + + # You can define the class to use on all forms. Default is simple_form. + # config.form_class = :simple_form + + # You can define which elements should obtain additional classes + # config.generate_additional_classes_for = [:wrapper, :label, :input] + + # Whether attributes are required by default (or not). Default is true. + # config.required_by_default = true + + # Tell browsers whether to use default HTML5 validations (novalidate option). + # Default is enabled. + config.browser_validations = false + + # Collection of methods to detect if a file type was given. + # config.file_methods = [ :mounted_as, :file?, :public_filename ] + + # Custom mappings for input types. This should be a hash containing a regexp + # to match as key, and the input type that will be used when the field name + # matches the regexp as value. + # config.input_mappings = { /count/ => :integer } + + # Custom wrappers for input types. This should be a hash containing an input + # type as key and the wrapper that will be used for all inputs with specified type. + # config.wrapper_mappings = { :string => :prepend } + + # Default priority for time_zone inputs. + # config.time_zone_priority = nil + + # Default priority for country inputs. + # config.country_priority = nil + + # Default size for text inputs. + # config.default_input_size = 50 + + # When false, do not use translations for labels. + # config.translate_labels = true + + # Automatically discover new inputs in Rails' autoload path. + # config.inputs_discovery = true + + # Cache SimpleForm inputs discovery + # config.cache_discovery = !Rails.env.development? + + config.form_class = 'simple_form form-horizontal' +end diff --git a/config/initializers/simple_form_bootstrap.rb b/config/initializers/simple_form_bootstrap.rb new file mode 100644 index 0000000..1a22967 --- /dev/null +++ b/config/initializers/simple_form_bootstrap.rb @@ -0,0 +1,45 @@ +# Use this setup block to configure all options available in SimpleForm. +SimpleForm.setup do |config| + config.wrappers :bootstrap, :tag => 'div', :class => 'control-group', :error_class => 'error' do |b| + b.use :html5 + b.use :placeholder + b.use :label + b.wrapper :tag => 'div', :class => 'controls' do |ba| + ba.use :input + ba.use :error, :wrap_with => { :tag => 'span', :class => 'help-inline' } + ba.use :hint, :wrap_with => { :tag => 'p', :class => 'help-block' } + end + end + + config.wrappers :prepend, :tag => 'div', :class => "control-group", :error_class => 'error' do |b| + b.use :html5 + b.use :placeholder + b.use :label + b.wrapper :tag => 'div', :class => 'controls' do |input| + input.wrapper :tag => 'div', :class => 'input-prepend' do |prepend| + prepend.use :input + end + input.use :hint, :wrap_with => { :tag => 'span', :class => 'help-block' } + input.use :error, :wrap_with => { :tag => 'span', :class => 'help-inline' } + end + end + + config.wrappers :append, :tag => 'div', :class => "control-group", :error_class => 'error' do |b| + b.use :html5 + b.use :placeholder + b.use :label + b.wrapper :tag => 'div', :class => 'controls' do |input| + input.wrapper :tag => 'div', :class => 'input-append' do |append| + append.use :input + end + input.use :hint, :wrap_with => { :tag => 'span', :class => 'help-block' } + input.use :error, :wrap_with => { :tag => 'span', :class => 'help-inline' } + end + end + + # Wrappers for forms and inputs using the Twitter Bootstrap toolkit. + # Check the Bootstrap docs (http://twitter.github.com/bootstrap) + # to learn about the different styles for forms and inputs, + # buttons and other elements. + config.default_wrapper = :bootstrap +end diff --git a/config/initializers/wrap_parameters.rb b/config/initializers/wrap_parameters.rb new file mode 100644 index 0000000..999df20 --- /dev/null +++ b/config/initializers/wrap_parameters.rb @@ -0,0 +1,14 @@ +# Be sure to restart your server when you modify this file. +# +# This file contains settings for ActionController::ParamsWrapper which +# is enabled by default. + +# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. +ActiveSupport.on_load(:action_controller) do + wrap_parameters format: [:json] +end + +# Disable root element in JSON by default. +ActiveSupport.on_load(:active_record) do + self.include_root_in_json = false +end diff --git a/config/locales/algemeen.nl-BE.yml b/config/locales/algemeen.nl-BE.yml new file mode 100644 index 0000000..fafba27 --- /dev/null +++ b/config/locales/algemeen.nl-BE.yml @@ -0,0 +1,31 @@ +nl-BE: + add_a_recipe: "Voeg een recept toe" + afmelden: "Afmelden" + all_recipes: "Alle recepten" + invite_someone: "Iemand uitnodigen" + my_recipes: "Mijn recepten" + woordje_uitleg: "Woordje uitleg" + + recepten: + aantal_en_eenheid: "Aantal en eenheid" + aantal_personen: "Aantal personen" + annuleer: "Annuleer" + bereiding: "Bereiding" + beschrijving: "Beschrijving" + details: "Details" + duur: "Duur" + foto_uploaden: "Foto uploaden" + in_minuten: "in minuten" + ingredient: "Ingrediënt" + ingredient_verwijderen: "ingredient verwijderen" + ingredienten: 'Ingrediënten' + kies_een_type: "Kies een type" + naam: "Naam" + nieuw-recept-titel: "Nieuw recept" + recept_aanpassen: "Recept aanpassen" + recept_bekijken: 'Recept bekijken' + toegevoegd_door: "Toegevoegd door" + type: "Type" + types_gerechten: 'Types gerechten' + voeg_ingredient_toe: "Voeg ingredient toe" + you_have_no_recipes: "Je hebt zelf nog geen recepten toegevoegd." diff --git a/config/locales/devise.nl-BE.yml b/config/locales/devise.nl-BE.yml new file mode 100644 index 0000000..82761fd --- /dev/null +++ b/config/locales/devise.nl-BE.yml @@ -0,0 +1,53 @@ +# Additional translations at https://github.com/plataformatec/devise/wiki/I18n + +nl-BE: + errors: + messages: + expired: "is verlopen, vraag een nieuwe aan." + not_found: "niet gevonden" + already_confirmed: "werd reeds bevestigd, probeer eens aan te melden." + not_locked: "was niet geblokkeerd" + not_saved: + one: "1 error zorgde er voor dat %{resource} niet kon worden opgeslaan:" + other: "%{count} zorgden er voor dat %{resource} niet kon worden opgeslaan:" + + devise: + failure: + already_authenticated: 'Je bent reeds aangemeld.' + unauthenticated: 'Je moet aanmelden voor je kan verder doen.' + unconfirmed: 'Je dient eerst je account te bevestigen voor je kan verder doen.' + locked: 'Je account werd geblokkeerd.' + invalid: 'Onjuist email-adres of wachtwoord.' + invalid_token: 'Onjuiste authenticatie-token.' + timeout: 'Je sessie is verlopen, gelieve opnieuw aan te melden.' + inactive: 'Je account werd nog niet geactiveerd.' + sessions: + signed_in: 'Jeej! Je bent aangemeld.' + signed_out: 'Je bent afgemeld. Bu-bye!' + passwords: + send_instructions: 'Je zal een email ontvangen met instructies om je wachtwoord te resetten.' + updated: 'Je wachtwoord werd aangepast, je bent nu aangemald.' + updated_not_active: 'Je wachtwoord is veranderd.' + no_token: "Je kan deze pagina niet zien vanuit een 'paswoord reset'-link. Als je toch van een 'wachtwoord reset'-mail komt, zorg dat je zeker de volledige URL gebruikt." + confirmations: + send_instructions: 'Je zal een email ontvangen met instructies om je account te bevestigen.' + confirmed: 'Je account werd bevestigd. Je bent nu ingelogd.' + registrations: + signed_up: 'Welkom! Je account werd aangemaakt. :-)' + signed_up_but_unconfirmed: 'Een bericht met een bevestigingslink werd naar je email-adres verstuurd. Gelieve de link te openen om je account te activeren.' + signed_up_but_inactive: 'Je gegevens waren correct, maar we kunnen je nog niet aanmelden omdat je gegevens nog niet bevestigd zijn.' + signed_up_but_locked: 'Je gegevens waren correct, maar we kunnen je niet aanmelden omdat je account geblokkeerd is.' + updated: 'Je account werd ge-update.' + update_needs_confirmation: "Je account werd ge-update, maar we moeten je nieuwe email-adres nog even bevestigen. Kijk je even je mail na? Je zou een bevestigingsmail moeten ontvangen hebben." + destroyed: 'Au revoir! Bye! Daaaag! Je account werd gecancelt. :(' + unlocks: + send_instructions: 'Je zal binnen enkele minuten een mail ontvangen met instructies om je account te deblokkeeren.' + unlocked: 'Je account werd gedeblokkeerd. Meld je aan om verder te gaan.' + send_paranoid_instructions: 'Indien je account bestaat, zal je een mail ontvangen met deblokkeer-instructies.' + mailer: + confirmation_instructions: + subject: 'Bevestigings-instructies' + reset_password_instructions: + subject: 'Wachtwoord reset instructies' + unlock_instructions: + subject: 'Deblokeer instructies' diff --git a/config/locales/devise_invitable.nl-BE.yml b/config/locales/devise_invitable.nl-BE.yml new file mode 100644 index 0000000..33de768 --- /dev/null +++ b/config/locales/devise_invitable.nl-BE.yml @@ -0,0 +1,16 @@ +nl-be: + devise: + invitations: + send_instructions: 'Een uitnodiging werd verstuurd naar %{email}.' + invitation_token_invalid: 'Het uitnodigingstoken is niet correct!' + updated: ' Je wachtwoord werd ingesteld. Je bent nu aangemeld.' + no_invitations_remaining: "Geen uitnodiging meer beschikbaar" + new: + header: "Verstuur een uitnodiging" + submit_button: "Verstuur uitnodiging" + edit: + header: "Stel je naam en wachtwoord in" + submit_button: "Instellen" + mailer: + invitation_instructions: + subject: 'Instructies uitnodiging' diff --git a/config/locales/en.yml b/config/locales/en.yml new file mode 100644 index 0000000..539af6f --- /dev/null +++ b/config/locales/en.yml @@ -0,0 +1,338 @@ +en: + add_a_recipe: Add a recipe + add_recipe: Add recipe + afmelden: Log out + all_recipes: All recipes + annuleer: Cancel + beschrijving: Description + date: + abbr_day_names: + - Sun + - Mon + - Tue + - Wed + - Thu + - Fri + - Sat + abbr_month_names: + - + - Jan + - Feb + - Mar + - Apr + - May + - Jun + - Jul + - Aug + - Sep + - Oct + - Nov + - Dec + day_names: + - Sunday + - Monday + - Tuesday + - Wednesday + - Thursday + - Friday + - Saturday + formats: + default: ! '%Y-%m-%d' + long: ! '%B %d, %Y' + short: ! '%b %d' + month_names: + - + - January + - February + - March + - April + - May + - June + - July + - August + - September + - October + - November + - December + order: + - :year + - :month + - :day + datetime: + distance_in_words: + about_x_hours: + one: about 1 hour + other: about %{count} hours + about_x_months: + one: about 1 month + other: about %{count} months + about_x_years: + one: about 1 year + other: about %{count} years + almost_x_years: + one: almost 1 year + other: almost %{count} years + half_a_minute: half a minute + less_than_x_minutes: + one: less than a minute + other: less than %{count} minutes + less_than_x_seconds: + one: less than 1 second + other: less than %{count} seconds + over_x_years: + one: over 1 year + other: over %{count} years + x_days: + one: 1 day + other: ! '%{count} days' + x_minutes: + one: 1 minute + other: ! '%{count} minutes' + x_months: + one: 1 month + other: ! '%{count} months' + x_seconds: + one: 1 second + other: ! '%{count} seconds' + prompts: + day: Day + hour: Hour + minute: Minute + month: Month + second: Seconds + year: Year + details: + devise: + confirmations: + confirmed: Confirmed + send_instructions: Send instructions + failure: + already_authenticated: Already authenticated + inactive: Inactive + invalid: Invalid + invalid_token: Invalid token + locked: Locked + timeout: Time-out + unauthenticated: Unauthenticated + unconfirmed: Unconfirmed + invitations: + edit: + header: + submit_button: + invitation_token_invalid: Invitiation invalid + new: + header: + submit_button: + no_invitations_remaining: No invitations remaining + send_instructions: Send instructions + updated: Updated + mailer: + confirmation_instructions: + subject: + invitation_instructions: + subject: + reset_password_instructions: + subject: + unlock_instructions: + subject: + passwords: + no_token: No token + send_instructions: Send instructions + updated: Updated + updated_not_active: + registrations: + destroyed: Destroyed + signed_up: Signed up + signed_up_but_inactive: + signed_up_but_locked: + signed_up_but_unconfirmed: + update_needs_confirmation: + updated: + sessions: + signed_in: + signed_out: + unlocks: + send_instructions: + send_paranoid_instructions: + unlocked: + errors: + format: ! '%{attribute} %{message}' + messages: + accepted: must be accepted + already_confirmed: + blank: can't be blank + confirmation: doesn't match confirmation + empty: can't be empty + equal_to: must be equal to %{count} + even: must be even + exclusion: is reserved + expired: + greater_than: must be greater than %{count} + greater_than_or_equal_to: must be greater than or equal to %{count} + inclusion: is not included in the list + invalid: is invalid + less_than: must be less than %{count} + less_than_or_equal_to: must be less than or equal to %{count} + not_a_number: is not a number + not_an_integer: must be an integer + not_found: + not_locked: + not_saved: + odd: must be odd + record_invalid: ! 'Validation failed: %{errors}' + taken: has already been taken + too_long: + one: is too long (maximum is 1 character) + other: is too long (maximum is %{count} characters) + too_short: + one: is too short (minimum is 1 character) + other: is too short (minimum is %{count} characters) + wrong_length: + one: is the wrong length (should be 1 character) + other: is the wrong length (should be %{count} characters) + template: + body: ! 'There were problems with the following fields:' + header: + one: 1 error prohibited this %{model} from being saved + other: ! '%{count} errors prohibited this %{model} from being saved' + hello: + helpers: + links: + confirm: + select: + prompt: Please select + submit: + create: Create %{model} + submit: Save %{model} + update: Update %{model} + invite_someone: + my_recipes: + naam: + next_label: Next + number: + currency: + format: + delimiter: ! ',' + format: ! '%u%n' + precision: 2 + separator: . + significant: false + strip_insignificant_zeros: false + unit: $ + format: + delimiter: ! ',' + precision: 3 + separator: . + significant: false + strip_insignificant_zeros: false + human: + decimal_units: + format: ! '%n %u' + units: + billion: Billion + million: Million + quadrillion: Quadrillion + thousand: Thousand + trillion: Trillion + unit: '' + format: + delimiter: '' + precision: 3 + significant: true + strip_insignificant_zeros: true + storage_units: + format: ! '%n %u' + units: + byte: + one: Byte + other: Bytes + gb: GB + kb: KB + mb: MB + tb: TB + percentage: + format: + delimiter: '' + precision: + format: + delimiter: '' + opinio: + actions: + add: + delete: + messages: + add_comment: + no_comments_found: + comment_sent: + previous_label: Previous + recepten: + aantal_en_eenheid: + aantal_personen: + annuleer: + bereiding: + beschrijving: + details: + duur: + foto_uploaden: + in_minuten: + ingredient: + ingredient_verwijderen: + ingredienten: + kies_een_type: + my_recipes: + naam: + nieuw-recept-titel: + nieuw_recept_titel: + recept_aanpassen: + recept_bekijken: + toegevoegd_door: + type: + types_gerechten: + voeg_ingredient_toe: + you_have_no_recipes: + recipes: + form: + cancel: + list: + actions: + confirm: + destroy: + edit: + new: + show: + back: + confirm: + destroy: + edit: + simple_form: + error_notification: + default_message: + labels: + defaults: + password: Password + password_confirmation: Confirmation of password + 'no': + required: + html: + mark: + text: + 'yes': + support: + array: + last_word_connector: ! ', and ' + two_words_connector: ! ' and ' + words_connector: ! ', ' + time: + am: am + formats: + default: ! '%a, %d %b %Y %H:%M:%S %z' + long: ! '%B %d, %Y %H:%M' + short: ! '%d %b %H:%M' + pm: pm + type: + user: + signed_in: Signed in + signed_out: Signed out + unauthenticated: Unauthenticated + woordje_uitleg: + woordje_uitleg_titel: diff --git a/config/locales/nl-BE.yml b/config/locales/nl-BE.yml new file mode 100644 index 0000000..99631b1 --- /dev/null +++ b/config/locales/nl-BE.yml @@ -0,0 +1,437 @@ +/nl-be: + hello: Dag wrede wereld! + date: + abbr_day_names: + - zon + - maa + - din + - woe + - don + - vri + - zat + abbr_month_names: + - + - jan + - feb + - mar + - apr + - mei + - jun + - jul + - aug + - sep + - okt + - nov + - dec + day_names: + - zondag + - maandag + - dinsdag + - woensdag + - donderdag + - vrijdag + - zaterdag + formats: + default: ! '%d-%m-%Y' + long: ! '%e %B %Y' + short: ! '%e %b' + month_names: + - + - januari + - februari + - maart + - april + - mei + - juni + - juli + - augustus + - september + - oktober + - november + - december + order: + - :day + - :month + - :year + datetime: + distance_in_words: + about_x_hours: + one: ongeveer een uur + other: ongeveer %{count} uur + about_x_months: + one: ongeveer een maand + other: ongeveer %{count} maanden + about_x_years: + one: ongeveer een jaar + other: ongeveer %{count} jaar + almost_x_years: + one: bijna een jaar + other: bijna %{count} jaar + half_a_minute: een halve minuut + less_than_x_minutes: + one: minder dan een minuut + other: minder dan %{count} minuten + less_than_x_seconds: + one: minder dan een seconde + other: minder dan %{count} seconden + over_x_years: + one: meer dan een jaar + other: meer dan %{count} jaar + x_days: + one: 1 dag + other: ! '%{count} dagen' + x_minutes: + one: 1 minuut + other: ! '%{count} minuten' + x_months: + one: 1 maand + other: ! '%{count} maanden' + x_seconds: + one: 1 seconde + other: ! '%{count} seconden' + prompts: + day: dag + hour: uur + minute: minuut + month: maand + second: seconde + year: jaar + devise: + confirmations: + confirmed: Je account werd bevestigd. Je bent nu ingelogd. + send_instructions: Je zal een email ontvangen met instructies om je account te bevestigen. + failure: + already_authenticated: Je bent reeds aangemeld. + inactive: Je account werd nog niet geactiveerd. + invalid: Onjuist email-adres of wachtwoord. + invalid_token: Onjuiste authenticatie-token. + locked: Je account werd geblokkeerd. + timeout: Je sessie is verlopen, gelieve opnieuw aan te melden. + unauthenticated: Je moet aanmelden voor je kan verder doen. + unconfirmed: Je dient eerst je account te bevestigen voor je kan verder doen. + mailer: + confirmation_instructions: + subject: Bevestigings-instructies + reset_password_instructions: + subject: Wachtwoord reset instructies + unlock_instructions: + subject: Deblokeer instructies + passwords: + no_token: Je kan deze pagina niet zien vanuit een 'paswoord reset'-link. Als je toch van een 'wachtwoord reset'-mail komt, zorg dat je zeker de volledige URL gebruikt. + send_instructions: Je zal een email ontvangen met instructies om je wachtwoord te resetten. + updated: Je wachtwoord werd aangepast, je bent nu aangemald. + updated_not_active: Je wachtwoord is veranderd. + registrations: + destroyed: Au revoir! Bye! Daaaag! Je account werd gecancelt. :( + signed_up: Welkom! Je account werd aangemaakt. :-) + signed_up_but_inactive: Je gegevens waren correct, maar we kunnen je nog niet aanmelden omdat je gegevens nog niet bevestigd zijn. + signed_up_but_locked: Je gegevens waren correct, maar we kunnen je niet aanmelden omdat je account geblokkeerd is. + signed_up_but_unconfirmed: Een bericht met een bevestigingslink werd naar je email-adres verstuurd. Gelieve de link te openen om je account te activeren. + update_needs_confirmation: Je account werd ge-update, maar we moeten je nieuwe email-adres nog even bevestigen. Kijk je even je mail na? Je zou een bevestigingsmail moeten ontvangen hebben. + updated: Je account werd ge-update. + sessions: + signed_in: Jeej! Je bent aangemeld. + signed_out: Je bent afgemeld. Bu-bye! + unlocks: + send_instructions: Je zal binnen enkele minuten een mail ontvangen met instructies om je account te deblokkeeren. + send_paranoid_instructions: Indien je account bestaat, zal je een mail ontvangen met deblokkeer-instructies. + unlocked: Je account werd gedeblokkeerd. Meld je aan om verder te gaan. + errors: + format: ! '%{attribute} %{message}' + messages: &70287933765680 + accepted: moet worden geaccepteerd + already_confirmed: werd reeds bevestigd, probeer eens aan te melden. + blank: moet opgegeven zijn + confirmation: komt niet met de bevestiging overeen + empty: moet opgegeven zijn + equal_to: moet gelijk zijn aan %{count} + even: moet even zijn + exclusion: is niet beschikbaar + expired: is verlopen, vraag een nieuwe aan. + greater_than: moet groter zijn dan %{count} + greater_than_or_equal_to: moet groter dan of gelijk zijn aan %{count} + inclusion: is niet in de lijst opgenomen + invalid: is ongeldig + less_than: moet minder zijn dan %{count} + less_than_or_equal_to: moet minder dan of gelijk zijn aan %{count} + not_a_number: is geen getal + not_an_integer: moet een geheel getal zijn + not_found: niet gevonden + not_locked: was niet geblokkeerd + not_saved: + one: ! '1 error zorgde er voor dat %{resource} niet kon worden opgeslaan:' + other: ! '%{count} zorgden er voor dat %{resource} niet kon worden opgeslaan:' + odd: moet oneven zijn + record_invalid: ! 'Validatie mislukt: %{errors}' + taken: is al in gebruik + too_long: is te lang (maximaal %{count} tekens) + too_short: is te kort (minimaal %{count} tekens) + wrong_length: heeft onjuiste lengte (moet %{count} tekens lang zijn) + template: &70287933791940 + body: ! 'Controleer de volgende velden:' + header: + one: ! '%{model} niet opgeslagen: 1 fout gevonden' + other: ! '%{model} niet opgeslagen: %{count} fouten gevonden' + helpers: + select: + prompt: Selecteer + submit: + create: ! '%{model} toevoegen' + submit: ! '%{model} opslaan' + update: ! '%{model} bewaren' + number: + currency: + format: + delimiter: . + format: ! '%u%n' + precision: 2 + separator: ! ',' + significant: false + strip_insignificant_zeros: false + unit: € + format: + delimiter: . + precision: 2 + separator: ! ',' + significant: false + strip_insignificant_zeros: false + human: + decimal_units: + format: ! '%n %u' + units: + billion: miljard + million: miljoen + quadrillion: biljard + thousand: duizend + trillion: biljoen + unit: '' + format: + delimiter: '' + precision: 3 + significant: true + strip_insignificant_zeros: true + storage_units: + format: ! '%n %u' + units: + byte: + one: Byte + other: Bytes + gb: GB + kb: KB + mb: MB + tb: TB + percentage: + format: + delimiter: '' + precision: + format: + delimiter: '' + support: + array: + last_word_connector: ! ' en ' + two_words_connector: ! ' en ' + words_connector: ! ', ' + time: + am: ! '''s ochtends' + formats: + default: ! '%a %d %b %Y %H:%M:%S %Z' + long: ! '%d %B %Y %H:%M' + short: ! '%d %b %H:%M' + pm: ! '''s middags' +nl-BE: + devise: + confirmations: + confirmed: Je account werd bevestigd. Je bent nu ingelogd. + send_instructions: Je zal een e-mail ontvangen met instructies om je account te bevestigen. + failure: + already_authenticated: Je bent al aangemeld. + inactive: Je account werd nog niet geactiveerd. + invalid: Onjuist e-mailadres of wachtwoord. + invalid_token: Onjuiste authenticatie-token. + locked: Je account werd geblokkeerd. + timeout: Je sessie is verlopen, gelieve opnieuw aan te melden. + unauthenticated: Je moet aanmelden voor je kan verder doen. + unconfirmed: Je dient eerst je account te bevestigen voor je kan verder doen. + invitations: + edit: + header: ! 'Vul deze gegevens in om toegang te krijgen tot Moederse Recepten:' + submit_button: Bevestigen + invitation_token_invalid: Je uitnodiging is niet meer geldig. + new: + header: ! 'Geef iemand toegang tot Moederse Recepten:' + submit_button: Bevestigen + no_invitations_remaining: ! 'Je hebt je maximum aantal uitnodigingen bereikt. ' + send_instructions: De uitnodiging werd verstuurd. + updated: Je account werd succesvol aangemaakt. + mailer: + confirmation_instructions: + subject: Bevestigings-instructies + invitation_instructions: + subject: Onderwerp + reset_password_instructions: + subject: Wachtwoord reset instructies + unlock_instructions: + subject: Deblokeer instructies + passwords: + no_token: Je kan deze pagina niet zien vanuit een 'wachtwoord reset'-link. Als je toch van een 'wachtwoord reset'-mail komt, zorg dat je zeker de volledige URL gebruikt. + send_instructions: Je zal een e-mail ontvangen met instructies om je wachtwoord te resetten. + updated: Je wachtwoord werd aangepast, je bent nu aangemeld. + updated_not_active: Je wachtwoord is veranderd. + registrations: + destroyed: Au revoir! Bye! Daaaag! Je account werd gecanceld. :( + signed_up: Welkom! Je account werd aangemaakt. :-) + signed_up_but_inactive: Je gegevens waren correct, maar we kunnen je nog niet aanmelden omdat je gegevens nog niet bevestigd zijn. + signed_up_but_locked: Je gegevens waren correct, maar we kunnen je niet aanmelden omdat je account geblokkeerd is. + signed_up_but_unconfirmed: Een bericht met een bevestigingslink werd naar je e-mailadres verstuurd. Gelieve de link te openen om je account te activeren. + update_needs_confirmation: Je account werd ge-update, maar we moeten je nieuwe e-mailadres nog even bevestigen. Kijk je even je mail na? Je zou een bevestigingsmail moeten ontvangen hebben. + updated: Je account werd ge-update. + sessions: + signed_in: Jeej! Je bent aangemeld. + signed_out: Je bent afgemeld. Bu-bye! + unlocks: + send_instructions: Je zal binnen enkele minuten een mail ontvangen met instructies om je account te deblokkeeren. + send_paranoid_instructions: Indien je account bestaat, zal je een mail ontvangen met deblokkeer-instructies. + unlocked: Je account werd gedeblokkeerd. Meld je aan om verder te gaan. + errors: + messages: + already_confirmed: werd reeds bevestigd, probeer eens aan te melden. + expired: is verlopen, vraag een nieuwe aan. + not_found: niet gevonden + not_locked: was niet geblokkeerd + not_saved: + one: ! '1 error zorgde er voor dat %{resource} niet kon worden opgeslaan:' + other: ! '%{count} zorgden er voor dat %{resource} niet kon worden opgeslaan:' + accepted: Moet worden geaccepteerd + blank: moet opgegeven zijn + confirmation: komt niet met de bevestiging overeen + empty: moet opgegeven zijn + equal_to: moet gelijk zijn aan %{count} + even: moet even zijn + will_paginate: + previous_label: Vorige + next_label: Volgende + hello: Hey! + next_label: Volgende + number: + human: + decimal_units: + units: + unit: '' + format: + delimiter: '' + percentage: + format: + delimiter: '' + precision: + format: + delimiter: '' + previous_label: Vorige + simple_form: + error_notification: + default_message: Er was een probleem bij het opslaan. + labels: + defaults: + password: Wachtwoord + password_confirmation: Bevestiging wachtwoord + 'no': Nee + required: + mark: ! '*' + text: Verplicht + html: * + 'yes': Ja + user: + signed_in: Ingelogd + signed_out: Uitgelogd + unauthenticated: Niet geauthoriseerd + add_recipe: Voeg recept toe + helpers: + links: + confirm: Ben je zeker? Het recept zal onherroepelijk verwijderd worden. + opinio: + actions: + add: Voeg een reactie toe + delete: verwijderen + messages: + add_comment: Voeg een reactie toe + no_comments_found: Er zijn geen reacties op dit recept + comment_sent: Je reactie werd toegevoegd. + recipes: + show: + back: Terug + confirm: Ben je zeker? Het recept zal onheroepelijk verwijderd worden. + destroy: Verwijderen + edit: Aanpassen + form: + cancel: Annuleer + list: + actions: Acties + confirm: Ben je zeker? Het recept zal onheroepelijk verwijderd worden. + destroy: Verwijderen + edit: Aanpassen + new: Voeg een recept toe + woordje_uitleg_titel: Woordje Uitleg + add_a_recipe: Voeg een recept toe + afmelden: Afmelden + all_recipes: Recepten + annuleer: Annuleer + invite_someone: Iemand uitnodigen + my_recipes: Mijn recepten + recepten: + aantal_en_eenheid: Aantal en eenheid + aantal_personen: Aantal personen + annuleer: Annuleer + origin: Origineel van + bereiding: Bereiding + beschrijving: Beschrijving + duur: Duur + foto_uploaden: Foto uploaden + in_minuten: in minuten + ingredient: Ingrediënt + ingredient_verwijderen: Ingrediënt verwijderen + kies_een_type: Kies een type + naam: Naam + voeg_ingredient_toe: Voeg ingrediënt toe + my_recipes: Mijn recepten + nieuw_recept_titel: Titel + details: Details + ingredienten: Ingrediënten + nieuw-recept-titel: Nieuw recept + recept_aanpassen: Recept aanpassen + recept_bekijken: Recept bekijken + toegevoegd_door: Toegevoegd door + type: Type + types_gerechten: Types gerechten + you_have_no_recipes: Je hebt zelf nog geen recepten toegevoegd. + woordje_uitleg: Woordje uitleg + beschrijving: Beschrijving + naam: Naam + type: Type + details: Details + datetime: + prompts: + day: Dag + activemodel: + errors: + format: ! '%{attribute} %{message}' + messages: *70287933765680 + template: *70287933791940 + activerecord: + errors: + format: ! '%{attribute} %{message}' + messages: *70287933765680 + template: *70287933791940 + date: + abbr_month_names: + - + - januari + - februari + - maart + - april + - mei + - juni + - juli + - augustus + - september + - oktober + - november + - december diff --git a/config/locales/simple_form.nl-BE.yml b/config/locales/simple_form.nl-BE.yml new file mode 100644 index 0000000..7f686b6 --- /dev/null +++ b/config/locales/simple_form.nl-BE.yml @@ -0,0 +1,27 @@ +nl-be: + simple_form: + "yes": 'Ja' + "no": 'Neen' + required: + text: 'verplicht' + mark: '*' + # You can uncomment the line below if you need to overwrite the whole required html. + # When using html, text and mark won't be used. + # html: '*' + error_notification: + default_message: "Problemen. Kijk even na:" + # Labels and hints examples + labels: + defaults: + password: 'Wachtwoord' + password_confirmation: 'Bevestiging wachtwoord' + # user: + # new: + # email: 'E-mail to sign in.' + # edit: + # email: 'E-mail.' + # hints: + # defaults: + # username: 'User name to sign in.' + # password: 'No special characters, please.' + diff --git a/config/routes.rb b/config/routes.rb new file mode 100644 index 0000000..9411c14 --- /dev/null +++ b/config/routes.rb @@ -0,0 +1,30 @@ +Moederse::Application.routes.draw do + get "site/about" + + match 'recipes/all/edit' => 'recipes#edit_all', :as => :edit_all, :via => :get + match 'recipes/all' => 'recipes#update_all', :as => :update_all, :via => :put + + opinio_model + + root :to => 'recipes#index' + + match 'recepten/nieuw' => 'recipes#new', :as => 'new_recipe' + match 'recepten/index' => 'recipes#index', :as => 'recipes_index' + get 'recepten' => 'recipes#list', :as => 'list_recipes' + resources :recipes + + match "/categorie/:type" => "recipes#show_category" + + get 'ingredients' => 'recipes#ingredients' #, :on => :collection + + resources :posts do + opinio + end + + devise_for :users, :skip => [:registrations] + as :user do + get 'users/edit' => 'devise/registrations#edit', :as => 'edit_user_registration' + put 'users' => 'devise/registrations#update', :as => 'user_registration' + match 'uitnodigingen/nieuw' => 'devise/invitations#new', :as => "new_invitation" + end +end diff --git a/db/migrate/20121121080358_create_recipes.rb b/db/migrate/20121121080358_create_recipes.rb new file mode 100644 index 0000000..c720622 --- /dev/null +++ b/db/migrate/20121121080358_create_recipes.rb @@ -0,0 +1,11 @@ +class CreateRecipes < ActiveRecord::Migration + def change + create_table :recipes do |t| + t.string :name + t.text :description + t.text :preparation + + t.timestamps + end + end +end diff --git a/db/migrate/20121121101832_devise_create_users.rb b/db/migrate/20121121101832_devise_create_users.rb new file mode 100644 index 0000000..2099d99 --- /dev/null +++ b/db/migrate/20121121101832_devise_create_users.rb @@ -0,0 +1,46 @@ +class DeviseCreateUsers < ActiveRecord::Migration + def change + create_table(:users) do |t| + ## Database authenticatable + t.string :email, :null => false, :default => "" + t.string :encrypted_password, :null => false, :default => "" + + ## Recoverable + t.string :reset_password_token + t.datetime :reset_password_sent_at + + ## Rememberable + t.datetime :remember_created_at + + ## Trackable + t.integer :sign_in_count, :default => 0 + t.datetime :current_sign_in_at + t.datetime :last_sign_in_at + t.string :current_sign_in_ip + t.string :last_sign_in_ip + + ## Confirmable + # t.string :confirmation_token + # t.datetime :confirmed_at + # t.datetime :confirmation_sent_at + # t.string :unconfirmed_email # Only if using reconfirmable + + ## Lockable + # t.integer :failed_attempts, :default => 0 # Only if lock strategy is :failed_attempts + # t.string :unlock_token # Only if unlock strategy is :email or :both + # t.datetime :locked_at + + ## Token authenticatable + # t.string :authentication_token + + + t.timestamps + end + + add_index :users, :email, :unique => true + add_index :users, :reset_password_token, :unique => true + # add_index :users, :confirmation_token, :unique => true + # add_index :users, :unlock_token, :unique => true + # add_index :users, :authentication_token, :unique => true + end +end diff --git a/db/migrate/20121121130747_devise_invitable_add_to_users.rb b/db/migrate/20121121130747_devise_invitable_add_to_users.rb new file mode 100644 index 0000000..fd1373a --- /dev/null +++ b/db/migrate/20121121130747_devise_invitable_add_to_users.rb @@ -0,0 +1,23 @@ +class DeviseInvitableAddToUsers < ActiveRecord::Migration + def up + change_table :users do |t| + t.string :invitation_token, :limit => 60 + t.datetime :invitation_sent_at + t.datetime :invitation_accepted_at + t.integer :invitation_limit + t.references :invited_by, :polymorphic => true + t.index :invitation_token # for invitable + t.index :invited_by_id + end + + # And allow null encrypted_password and password_salt: + change_column_null :users, :encrypted_password, true + end + + def down + change_table :users do |t| + t.remove_references :invited_by, :polymorphic => true + t.remove :invitation_limit, :invitation_sent_at, :invitation_accepted_at, :invitation_token + end + end +end diff --git a/db/migrate/20121209154017_add_name_to_user.rb b/db/migrate/20121209154017_add_name_to_user.rb new file mode 100644 index 0000000..74142b0 --- /dev/null +++ b/db/migrate/20121209154017_add_name_to_user.rb @@ -0,0 +1,5 @@ +class AddNameToUser < ActiveRecord::Migration + def change + add_column :users, :name, :string + end +end diff --git a/db/migrate/20121215144701_create_ingredients.rb b/db/migrate/20121215144701_create_ingredients.rb new file mode 100644 index 0000000..1c22faf --- /dev/null +++ b/db/migrate/20121215144701_create_ingredients.rb @@ -0,0 +1,9 @@ +class CreateIngredients < ActiveRecord::Migration + def change + create_table :ingredients do |t| + t.string :name + + t.timestamps + end + end +end diff --git a/db/migrate/20121215144758_create_recipe_ingredients.rb b/db/migrate/20121215144758_create_recipe_ingredients.rb new file mode 100644 index 0000000..ac39039 --- /dev/null +++ b/db/migrate/20121215144758_create_recipe_ingredients.rb @@ -0,0 +1,11 @@ +class CreateRecipeIngredients < ActiveRecord::Migration + def change + create_table :recipe_ingredients do |t| + t.integer :recipe_id + t.integer :ingredient_id + t.integer :quantity + + t.timestamps + end + end +end diff --git a/db/migrate/20121216125743_add_picture_columns_to_recipes.rb b/db/migrate/20121216125743_add_picture_columns_to_recipes.rb new file mode 100644 index 0000000..1553230 --- /dev/null +++ b/db/migrate/20121216125743_add_picture_columns_to_recipes.rb @@ -0,0 +1,9 @@ +class AddPictureColumnsToRecipes < ActiveRecord::Migration + def self.up + add_attachment :recipes, :picture + end + + def self.down + remove_attachment :recipes, :picture + end +end diff --git a/db/migrate/20121216130949_create_comments.rb b/db/migrate/20121216130949_create_comments.rb new file mode 100644 index 0000000..11f92e6 --- /dev/null +++ b/db/migrate/20121216130949_create_comments.rb @@ -0,0 +1,13 @@ +class CreateComments < ActiveRecord::Migration + def self.up + create_table :comments do |t| + t.opinio + + t.timestamps + end + end + + def self.down + drop_table :comments + end +end diff --git a/db/migrate/20121227193750_drop_recipe_ingredients.rb b/db/migrate/20121227193750_drop_recipe_ingredients.rb new file mode 100644 index 0000000..66176dd --- /dev/null +++ b/db/migrate/20121227193750_drop_recipe_ingredients.rb @@ -0,0 +1,8 @@ +class DropRecipeIngredients < ActiveRecord::Migration + def up + drop_table :recipe_ingredients + end + + def down + end +end diff --git a/db/migrate/20121227194043_add_recipe_id_to_ingredient.rb b/db/migrate/20121227194043_add_recipe_id_to_ingredient.rb new file mode 100644 index 0000000..5984180 --- /dev/null +++ b/db/migrate/20121227194043_add_recipe_id_to_ingredient.rb @@ -0,0 +1,7 @@ +class AddRecipeIdToIngredient < ActiveRecord::Migration + def change + add_column :ingredients, :recipe_id, :integer + add_column :ingredients, :quantity, :integer + add_column :ingredients, :unit, :string + end +end diff --git a/db/migrate/20121227195926_add_duration_to_recipe.rb b/db/migrate/20121227195926_add_duration_to_recipe.rb new file mode 100644 index 0000000..1347bd3 --- /dev/null +++ b/db/migrate/20121227195926_add_duration_to_recipe.rb @@ -0,0 +1,5 @@ +class AddDurationToRecipe < ActiveRecord::Migration + def change + add_column :recipes, :duration, :integer + end +end diff --git a/db/migrate/20121227200804_create_types.rb b/db/migrate/20121227200804_create_types.rb new file mode 100644 index 0000000..a4ab61e --- /dev/null +++ b/db/migrate/20121227200804_create_types.rb @@ -0,0 +1,9 @@ +class CreateTypes < ActiveRecord::Migration + def change + create_table :types do |t| + t.string :name + + t.timestamps + end + end +end diff --git a/db/migrate/20121227200824_add_type_id_to_recipe.rb b/db/migrate/20121227200824_add_type_id_to_recipe.rb new file mode 100644 index 0000000..23cef18 --- /dev/null +++ b/db/migrate/20121227200824_add_type_id_to_recipe.rb @@ -0,0 +1,5 @@ +class AddTypeIdToRecipe < ActiveRecord::Migration + def change + add_column :recipes, :type_id, :integer + end +end diff --git a/db/migrate/20121227202834_add_chef_to_recipe.rb b/db/migrate/20121227202834_add_chef_to_recipe.rb new file mode 100644 index 0000000..2eaac02 --- /dev/null +++ b/db/migrate/20121227202834_add_chef_to_recipe.rb @@ -0,0 +1,5 @@ +class AddChefToRecipe < ActiveRecord::Migration + def change + add_column :recipes, :user_id, :integer + end +end diff --git a/db/migrate/20121228122154_add_servings_to_recipe.rb b/db/migrate/20121228122154_add_servings_to_recipe.rb new file mode 100644 index 0000000..f250aaa --- /dev/null +++ b/db/migrate/20121228122154_add_servings_to_recipe.rb @@ -0,0 +1,5 @@ +class AddServingsToRecipe < ActiveRecord::Migration + def change + add_column :recipes, :servings, :integer + end +end diff --git a/db/migrate/20121229115107_change_data_type_for_recipe_quantity.rb b/db/migrate/20121229115107_change_data_type_for_recipe_quantity.rb new file mode 100644 index 0000000..90f94c5 --- /dev/null +++ b/db/migrate/20121229115107_change_data_type_for_recipe_quantity.rb @@ -0,0 +1,13 @@ +class ChangeDataTypeForRecipeQuantity < ActiveRecord::Migration + def up + change_table :ingredients do |t| + t.change :quantity, :float + end + end + + def down + change_table :ingredients do |t| + t.change :quantity, :integer + end + end +end diff --git a/db/migrate/20130313180243_add_origin_to_recipes.rb b/db/migrate/20130313180243_add_origin_to_recipes.rb new file mode 100644 index 0000000..793c3fa --- /dev/null +++ b/db/migrate/20130313180243_add_origin_to_recipes.rb @@ -0,0 +1,5 @@ +class AddOriginToRecipes < ActiveRecord::Migration + def change + add_column :recipes, :origin, :string + end +end diff --git a/db/schema.rb b/db/schema.rb new file mode 100644 index 0000000..13f335a --- /dev/null +++ b/db/schema.rb @@ -0,0 +1,84 @@ +# encoding: UTF-8 +# This file is auto-generated from the current state of the database. Instead +# of editing this file, please use the migrations feature of Active Record to +# incrementally modify your database, and then regenerate this schema definition. +# +# Note that this schema.rb definition is the authoritative source for your +# database schema. If you need to create the application database on another +# system, you should be using db:schema:load, not running all the migrations +# from scratch. The latter is a flawed and unsustainable approach (the more migrations +# you'll amass, the slower it'll run and the greater likelihood for issues). +# +# It's strongly recommended to check this file into your version control system. + +ActiveRecord::Schema.define(:version => 20130313180243) do + + create_table "comments", :force => true do |t| + t.integer "owner_id", :null => false + t.integer "commentable_id", :null => false + t.string "commentable_type", :null => false + t.text "body", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "ingredients", :force => true do |t| + t.string "name" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "recipe_id" + t.float "quantity" + t.string "unit" + end + + create_table "recipes", :force => true do |t| + t.string "name" + t.text "description" + t.text "preparation" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "picture_file_name" + t.string "picture_content_type" + t.integer "picture_file_size" + t.datetime "picture_updated_at" + t.integer "duration" + t.integer "type_id" + t.integer "user_id" + t.integer "servings" + t.string "origin" + end + + create_table "types", :force => true do |t| + t.string "name" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "users", :force => true do |t| + t.string "email", :default => "", :null => false + t.string "encrypted_password", :default => "" + t.string "reset_password_token" + t.datetime "reset_password_sent_at" + t.datetime "remember_created_at" + t.integer "sign_in_count", :default => 0 + t.datetime "current_sign_in_at" + t.datetime "last_sign_in_at" + t.string "current_sign_in_ip" + t.string "last_sign_in_ip" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "invitation_token", :limit => 60 + t.datetime "invitation_sent_at" + t.datetime "invitation_accepted_at" + t.integer "invitation_limit" + t.integer "invited_by_id" + t.string "invited_by_type" + t.string "name" + end + + add_index "users", ["email"], :name => "index_users_on_email", :unique => true + add_index "users", ["invitation_token"], :name => "index_users_on_invitation_token" + add_index "users", ["invited_by_id"], :name => "index_users_on_invited_by_id" + add_index "users", ["reset_password_token"], :name => "index_users_on_reset_password_token", :unique => true + +end diff --git a/db/seeds.rb b/db/seeds.rb new file mode 100644 index 0000000..1e1dc2f --- /dev/null +++ b/db/seeds.rb @@ -0,0 +1,8 @@ +# This file should contain all the record creation needed to seed the database with its default values. +# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). +# +# Examples: +# +# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) +# Mayor.create(name: 'Emanuel', city: cities.first) +types = Type.create([{ name: 'Voorgerecht' }, { name: 'Hoofdgerecht' }, { name: 'Bijgerecht' }, { name: 'Nagerecht' }, { name: 'Soep' }, { name: 'Sauzen/Dressing' }, { name: 'Dranken/Mocktails' }, { name: 'Alcoholische dranken / Cocktails' }, { name: 'Gebak' }, { name: 'Ontbijt'}]) diff --git a/doc/README_FOR_APP b/doc/README_FOR_APP new file mode 100644 index 0000000..fe41f5c --- /dev/null +++ b/doc/README_FOR_APP @@ -0,0 +1,2 @@ +Use this README file to introduce your application and point to useful places in the API for learning more. +Run "rake doc:app" to generate API documentation for your models, controllers, helpers, and libraries. diff --git a/lib/assets/.gitkeep b/lib/assets/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/lib/tasks/.gitkeep b/lib/tasks/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/lib/templates/haml/scaffold/_form.html.haml b/lib/templates/haml/scaffold/_form.html.haml new file mode 100644 index 0000000..ac3aa7b --- /dev/null +++ b/lib/templates/haml/scaffold/_form.html.haml @@ -0,0 +1,10 @@ += simple_form_for(@<%= singular_table_name %>) do |f| + = f.error_notification + + .form-inputs + <%- attributes.each do |attribute| -%> + = f.<%= attribute.reference? ? :association : :input %> :<%= attribute.name %> + <%- end -%> + + .form-actions + = f.button :submit diff --git a/lib/www_ditcher.rb b/lib/www_ditcher.rb new file mode 100644 index 0000000..b2b629b --- /dev/null +++ b/lib/www_ditcher.rb @@ -0,0 +1,21 @@ +class WwwDitcher + + def initialize(app) + @app = app + end + + def call(env) + request = Rack::Request.new(env) + + if request.host.starts_with?("www.") + [301, {"Location" => request.url.sub("//www.", "//")}, self] + else + @app.call(env) + end + + end + + def each(&block) + end + +end \ No newline at end of file diff --git a/public/404.html b/public/404.html new file mode 100644 index 0000000..9a48320 --- /dev/null +++ b/public/404.html @@ -0,0 +1,26 @@ + + + + The page you were looking for doesn't exist (404) + + + + + +
      +

      The page you were looking for doesn't exist.

      +

      You may have mistyped the address or the page may have moved.

      +
      + + diff --git a/public/422.html b/public/422.html new file mode 100644 index 0000000..83660ab --- /dev/null +++ b/public/422.html @@ -0,0 +1,26 @@ + + + + The change you wanted was rejected (422) + + + + + +
      +

      The change you wanted was rejected.

      +

      Maybe you tried to change something you didn't have access to.

      +
      + + diff --git a/public/500.html b/public/500.html new file mode 100644 index 0000000..f3648a0 --- /dev/null +++ b/public/500.html @@ -0,0 +1,25 @@ + + + + We're sorry, but something went wrong (500) + + + + + +
      +

      We're sorry, but something went wrong.

      +
      + + diff --git a/public/favicon.ico b/public/favicon.ico new file mode 100644 index 0000000..e69de29 diff --git a/public/javascripts/autocomplete-rails.js b/public/javascripts/autocomplete-rails.js new file mode 100644 index 0000000..8c54fa3 --- /dev/null +++ b/public/javascripts/autocomplete-rails.js @@ -0,0 +1,16 @@ +/* +* Unobtrusive autocomplete +* +* To use it, you just have to include the HTML attribute autocomplete +* with the autocomplete URL as the value +* +* Example: +* +* +* Optionally, you can use a jQuery selector to specify a field that can +* be updated with the element id whenever you find a matching value +* +* Example: +* +*/ +(function(e){var t=null;e.fn.railsAutocomplete=function(){return this.live("focus",function(){this.railsAutoCompleter||(this.railsAutoCompleter=new e.railsAutocomplete(this))})},e.railsAutocomplete=function(e){_e=e,this.init(_e)},e.railsAutocomplete.fn=e.railsAutocomplete.prototype={railsAutocomplete:"0.0.1"},e.railsAutocomplete.fn.extend=e.railsAutocomplete.extend=e.extend,e.railsAutocomplete.fn.extend({init:function(t){function n(e){return e.split(t.delimiter)}function r(e){return n(e).pop().replace(/^\s+/,"")}t.delimiter=e(t).attr("data-delimiter")||null,e(t).autocomplete({source:function(n,i){e.getJSON(e(t).attr("data-autocomplete"),{term:r(n.term)},function(){arguments[0].length==0&&(arguments[0]=[],arguments[0][0]={id:"",label:"no existing match"}),e(arguments[0]).each(function(n,r){var i={};i[r.id]=r,e(t).data(i)}),i.apply(null,arguments)})},change:function(t,n){if(e(e(this).attr("data-id-element")).val()=="")return;e(e(this).attr("data-id-element")).val(n.item?n.item.id:"");var r=e.parseJSON(e(this).attr("data-update-elements")),i=n.item?e(this).data(n.item.id.toString()):{};if(r&&e(r["id"]).val()=="")return;for(var s in r)e(r[s]).val(n.item?i[s]:"")},search:function(){var e=r(this.value);if(e.length<2)return!1},focus:function(){return!1},select:function(r,i){var s=n(this.value);s.pop(),s.push(i.item.value);if(t.delimiter!=null)s.push(""),this.value=s.join(t.delimiter);else{this.value=s.join(""),e(this).attr("data-id-element")&&e(e(this).attr("data-id-element")).val(i.item.id);if(e(this).attr("data-update-elements")){var o=e(this).data(i.item.id.toString()),u=e.parseJSON(e(this).attr("data-update-elements"));for(var a in u)e(u[a]).val(o[a])}}var f=this.value;return e(this).bind("keyup.clearId",function(){e(this).val().trim()!=f.trim()&&(e(e(this).attr("data-id-element")).val(""),e(this).unbind("keyup.clearId"))}),e(t).trigger("railsAutocomplete.select",i),!1}})}}),e(document).ready(function(){e("input[data-autocomplete]").railsAutocomplete()})})(jQuery); \ No newline at end of file diff --git a/public/pictures/medium/missing.png b/public/pictures/medium/missing.png new file mode 100644 index 0000000..672918a Binary files /dev/null and b/public/pictures/medium/missing.png differ diff --git a/public/pictures/missing.png b/public/pictures/missing.png new file mode 100644 index 0000000..672918a Binary files /dev/null and b/public/pictures/missing.png differ diff --git a/public/pictures/original/missing.png b/public/pictures/original/missing.png new file mode 100644 index 0000000..672918a Binary files /dev/null and b/public/pictures/original/missing.png differ diff --git a/public/pictures/thumb/missing.png b/public/pictures/thumb/missing.png new file mode 100644 index 0000000..6bb2784 Binary files /dev/null and b/public/pictures/thumb/missing.png differ diff --git a/public/robots.txt b/public/robots.txt new file mode 100644 index 0000000..8e1d420 --- /dev/null +++ b/public/robots.txt @@ -0,0 +1,5 @@ +# See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file +# +# To ban all spiders from the entire site uncomment the next two lines: +User-Agent: * +Disallow: / diff --git a/script/rails b/script/rails new file mode 100755 index 0000000..f8da2cf --- /dev/null +++ b/script/rails @@ -0,0 +1,6 @@ +#!/usr/bin/env ruby +# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. + +APP_PATH = File.expand_path('../../config/application', __FILE__) +require File.expand_path('../../config/boot', __FILE__) +require 'rails/commands' diff --git a/test/fixtures/.gitkeep b/test/fixtures/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/test/fixtures/ingredients.yml b/test/fixtures/ingredients.yml new file mode 100644 index 0000000..0227c60 --- /dev/null +++ b/test/fixtures/ingredients.yml @@ -0,0 +1,7 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html + +one: + name: MyString + +two: + name: MyString diff --git a/test/fixtures/recipes.yml b/test/fixtures/recipes.yml new file mode 100644 index 0000000..14685d5 --- /dev/null +++ b/test/fixtures/recipes.yml @@ -0,0 +1,11 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html + +one: + name: MyString + description: MyText + preparation: MyText + +two: + name: MyString + description: MyText + preparation: MyText diff --git a/test/fixtures/types.yml b/test/fixtures/types.yml new file mode 100644 index 0000000..0227c60 --- /dev/null +++ b/test/fixtures/types.yml @@ -0,0 +1,7 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html + +one: + name: MyString + +two: + name: MyString diff --git a/test/fixtures/users.yml b/test/fixtures/users.yml new file mode 100644 index 0000000..c63aac0 --- /dev/null +++ b/test/fixtures/users.yml @@ -0,0 +1,11 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html + +# This model initially had no columns defined. If you add columns to the +# model remove the '{}' from the fixture names and add the columns immediately +# below each fixture, per the syntax in the comments below +# +one: {} +# column: value +# +two: {} +# column: value diff --git a/test/functional/.gitkeep b/test/functional/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/test/functional/recipes_controller_test.rb b/test/functional/recipes_controller_test.rb new file mode 100644 index 0000000..7f19d3b --- /dev/null +++ b/test/functional/recipes_controller_test.rb @@ -0,0 +1,49 @@ +require 'test_helper' + +class RecipesControllerTest < ActionController::TestCase + setup do + @recipe = recipes(:one) + end + + test "should get index" do + get :index + assert_response :success + assert_not_nil assigns(:recipes) + end + + test "should get new" do + get :new + assert_response :success + end + + test "should create recipe" do + assert_difference('Recipe.count') do + post :create, recipe: { description: @recipe.description, name: @recipe.name, preparation: @recipe.preparation } + end + + assert_redirected_to recipe_path(assigns(:recipe)) + end + + test "should show recipe" do + get :show, id: @recipe + assert_response :success + end + + test "should get edit" do + get :edit, id: @recipe + assert_response :success + end + + test "should update recipe" do + put :update, id: @recipe, recipe: { description: @recipe.description, name: @recipe.name, preparation: @recipe.preparation } + assert_redirected_to recipe_path(assigns(:recipe)) + end + + test "should destroy recipe" do + assert_difference('Recipe.count', -1) do + delete :destroy, id: @recipe + end + + assert_redirected_to recipes_path + end +end diff --git a/test/functional/site_controller_test.rb b/test/functional/site_controller_test.rb new file mode 100644 index 0000000..93326e4 --- /dev/null +++ b/test/functional/site_controller_test.rb @@ -0,0 +1,9 @@ +require 'test_helper' + +class SiteControllerTest < ActionController::TestCase + test "should get about" do + get :about + assert_response :success + end + +end diff --git a/test/integration/.gitkeep b/test/integration/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/test/performance/browsing_test.rb b/test/performance/browsing_test.rb new file mode 100644 index 0000000..3fea27b --- /dev/null +++ b/test/performance/browsing_test.rb @@ -0,0 +1,12 @@ +require 'test_helper' +require 'rails/performance_test_help' + +class BrowsingTest < ActionDispatch::PerformanceTest + # Refer to the documentation for all available options + # self.profile_options = { :runs => 5, :metrics => [:wall_time, :memory] + # :output => 'tmp/performance', :formats => [:flat] } + + def test_homepage + get '/' + end +end diff --git a/test/test_helper.rb b/test/test_helper.rb new file mode 100644 index 0000000..8bf1192 --- /dev/null +++ b/test/test_helper.rb @@ -0,0 +1,13 @@ +ENV["RAILS_ENV"] = "test" +require File.expand_path('../../config/environment', __FILE__) +require 'rails/test_help' + +class ActiveSupport::TestCase + # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order. + # + # Note: You'll currently still have to declare fixtures explicitly in integration tests + # -- they do not yet inherit this setting + fixtures :all + + # Add more helper methods to be used by all tests here... +end diff --git a/test/unit/.gitkeep b/test/unit/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/test/unit/helpers/recipes_helper_test.rb b/test/unit/helpers/recipes_helper_test.rb new file mode 100644 index 0000000..6f5acc1 --- /dev/null +++ b/test/unit/helpers/recipes_helper_test.rb @@ -0,0 +1,4 @@ +require 'test_helper' + +class RecipesHelperTest < ActionView::TestCase +end diff --git a/test/unit/helpers/site_helper_test.rb b/test/unit/helpers/site_helper_test.rb new file mode 100644 index 0000000..fda64d0 --- /dev/null +++ b/test/unit/helpers/site_helper_test.rb @@ -0,0 +1,4 @@ +require 'test_helper' + +class SiteHelperTest < ActionView::TestCase +end diff --git a/test/unit/ingredient_test.rb b/test/unit/ingredient_test.rb new file mode 100644 index 0000000..511fcf8 --- /dev/null +++ b/test/unit/ingredient_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class IngredientTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/unit/recipe_test.rb b/test/unit/recipe_test.rb new file mode 100644 index 0000000..5f53f19 --- /dev/null +++ b/test/unit/recipe_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class RecipeTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/unit/type_test.rb b/test/unit/type_test.rb new file mode 100644 index 0000000..0ce1172 --- /dev/null +++ b/test/unit/type_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class TypeTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/unit/user_test.rb b/test/unit/user_test.rb new file mode 100644 index 0000000..82f61e0 --- /dev/null +++ b/test/unit/user_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class UserTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/vendor/assets/javascripts/.gitkeep b/vendor/assets/javascripts/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/vendor/assets/stylesheets/.gitkeep b/vendor/assets/stylesheets/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/vendor/plugins/.gitkeep b/vendor/plugins/.gitkeep new file mode 100644 index 0000000..e69de29