From 1a31842ba8e29c7982ce18624e883139d7c14533 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Muhammet=20DI=CC=87LEK?= Date: Thu, 5 Sep 2013 10:44:31 +0300 Subject: [PATCH] #5 project created with cybele --- .gitignore | 40 +++ .rspec | 1 + Gemfile | 39 +++ Gemfile.lock | 240 +++++++++++++++++ README.md | 2 + Rakefile | 6 + app/assets/images/.keep | 0 app/assets/javascripts/application.js.coffee | 17 ++ app/assets/stylesheets/application.css.sass | 47 ++++ app/controllers/application_controller.rb | 37 +++ app/controllers/concerns/.keep | 0 app/controllers/hq/base_controller.rb | 7 + app/controllers/hq/dashboard_controller.rb | 5 + app/controllers/hq/sessions_controller.rb | 3 + app/controllers/welcome_controller.rb | 4 + app/helpers/application_helper.rb | 2 + app/mailers/.keep | 0 app/models/.keep | 0 app/models/admin.rb | 7 + app/models/concerns/.keep | 0 app/models/user.rb | 7 + app/views/devise/confirmations/new.html.haml | 9 + .../confirmation_instructions.html.haml | 4 + .../reset_password_instructions.html.haml | 6 + .../mailer/unlock_instructions.html.haml | 5 + app/views/devise/passwords/edit.html.haml | 11 + app/views/devise/passwords/new.html.haml | 8 + app/views/devise/registrations/edit.html.haml | 18 ++ app/views/devise/registrations/new.html.haml | 11 + app/views/devise/sessions/new.html.haml | 9 + app/views/devise/shared/_links.haml | 19 ++ app/views/devise/unlocks/new.html.haml | 9 + app/views/hq/dashboard/index.html.haml | 2 + app/views/hq/sessions/new.html.haml | 8 + app/views/layouts/application.html.haml | 21 ++ app/views/layouts/hq/base.html.haml | 21 ++ app/views/welcome/index.html.haml | 14 + bin/bundle | 3 + bin/rails | 4 + bin/rake | 4 + config.ru | 4 + config/application.rb | 32 +++ config/boot.rb | 4 + config/database.yml | 13 + config/environment.rb | 5 + config/environments/development.rb | 35 +++ config/environments/production.rb | 95 +++++++ config/environments/test.rb | 40 +++ config/initializers/backtrace_silencers.rb | 7 + config/initializers/devise.rb | 252 ++++++++++++++++++ config/initializers/exception_notification.rb | 38 +++ .../initializers/filter_parameter_logging.rb | 4 + config/initializers/inflections.rb | 16 ++ config/initializers/mime_types.rb | 5 + config/initializers/rails_config.rb | 3 + config/initializers/sanitizers.rb | 1 + config/initializers/secret_token.rb | 12 + config/initializers/session_store.rb | 3 + config/initializers/simple_form.rb | 142 ++++++++++ config/initializers/simple_form_bootstrap.rb | 45 ++++ config/initializers/wrap_parameters.rb | 14 + config/locales/en.yml | 23 ++ config/locales/responders.en.yml | 10 + config/locales/responders.tr.yml | 10 + config/locales/simple_form.en.yml | 26 ++ config/locales/simple_form.tr.yml | 26 ++ config/locales/tr.yml | 25 ++ config/routes.rb | 65 +++++ config/settings.yml | 0 config/settings/development.yml | 0 config/settings/production.yml | 0 config/settings/test.yml | 0 db/migrate/.keep | 0 .../20130905072651_devise_create_users.rb | 47 ++++ .../20130905072654_add_time_zone_to_user.rb | 5 + .../20130905072700_devise_create_admins.rb | 46 ++++ db/seeds.rb | 7 + lib/application_responder.rb | 8 + lib/assets/.keep | 0 lib/tasks/.keep | 0 lib/templates/haml/scaffold/_form.html.haml | 10 + .../rails/responders_controller/controller.rb | 51 ++++ lib/user_sanitizer.rb | 6 + log/.keep | 0 public/404.html | 58 ++++ public/422.html | 58 ++++ public/500.html | 57 ++++ public/favicon.ico | 0 public/robots.txt | 5 + spec/controllers/.keep | 0 spec/factories/admins.rb | 6 + spec/factories/users.rb | 6 + spec/helpers/.keep | 0 spec/lib/.keep | 0 spec/models/.keep | 0 spec/models/admin_spec.rb | 5 + spec/models/user_spec.rb | 5 + spec/spec_helper.rb | 52 ++++ spec/support/.keep | 0 spec/views/.keep | 0 vendor/assets/javascripts/.keep | 0 vendor/assets/stylesheets/.keep | 0 102 files changed, 2037 insertions(+) create mode 100644 .gitignore create mode 100644 .rspec create mode 100644 Gemfile create mode 100644 Gemfile.lock create mode 100644 README.md create mode 100644 Rakefile create mode 100644 app/assets/images/.keep create mode 100644 app/assets/javascripts/application.js.coffee create mode 100644 app/assets/stylesheets/application.css.sass create mode 100644 app/controllers/application_controller.rb create mode 100644 app/controllers/concerns/.keep create mode 100644 app/controllers/hq/base_controller.rb create mode 100644 app/controllers/hq/dashboard_controller.rb create mode 100644 app/controllers/hq/sessions_controller.rb create mode 100644 app/controllers/welcome_controller.rb create mode 100644 app/helpers/application_helper.rb create mode 100644 app/mailers/.keep create mode 100644 app/models/.keep create mode 100644 app/models/admin.rb create mode 100644 app/models/concerns/.keep create mode 100644 app/models/user.rb create mode 100644 app/views/devise/confirmations/new.html.haml create mode 100644 app/views/devise/mailer/confirmation_instructions.html.haml create mode 100644 app/views/devise/mailer/reset_password_instructions.html.haml create mode 100644 app/views/devise/mailer/unlock_instructions.html.haml create mode 100644 app/views/devise/passwords/edit.html.haml create mode 100644 app/views/devise/passwords/new.html.haml create mode 100644 app/views/devise/registrations/edit.html.haml create mode 100644 app/views/devise/registrations/new.html.haml create mode 100644 app/views/devise/sessions/new.html.haml create mode 100644 app/views/devise/shared/_links.haml create mode 100644 app/views/devise/unlocks/new.html.haml create mode 100644 app/views/hq/dashboard/index.html.haml create mode 100644 app/views/hq/sessions/new.html.haml create mode 100644 app/views/layouts/application.html.haml create mode 100644 app/views/layouts/hq/base.html.haml create mode 100644 app/views/welcome/index.html.haml create mode 100755 bin/bundle create mode 100755 bin/rails create mode 100755 bin/rake create mode 100644 config.ru create mode 100644 config/application.rb create mode 100644 config/boot.rb create mode 100644 config/database.yml create mode 100644 config/environment.rb create mode 100644 config/environments/development.rb create mode 100644 config/environments/production.rb create mode 100644 config/environments/test.rb create mode 100644 config/initializers/backtrace_silencers.rb create mode 100644 config/initializers/devise.rb create mode 100644 config/initializers/exception_notification.rb create mode 100644 config/initializers/filter_parameter_logging.rb create mode 100644 config/initializers/inflections.rb create mode 100644 config/initializers/mime_types.rb create mode 100644 config/initializers/rails_config.rb create mode 100644 config/initializers/sanitizers.rb create mode 100644 config/initializers/secret_token.rb create mode 100644 config/initializers/session_store.rb create mode 100644 config/initializers/simple_form.rb create mode 100644 config/initializers/simple_form_bootstrap.rb create mode 100644 config/initializers/wrap_parameters.rb create mode 100644 config/locales/en.yml create mode 100644 config/locales/responders.en.yml create mode 100644 config/locales/responders.tr.yml create mode 100644 config/locales/simple_form.en.yml create mode 100644 config/locales/simple_form.tr.yml create mode 100644 config/locales/tr.yml create mode 100644 config/routes.rb create mode 100644 config/settings.yml create mode 100644 config/settings/development.yml create mode 100644 config/settings/production.yml create mode 100644 config/settings/test.yml create mode 100644 db/migrate/.keep create mode 100644 db/migrate/20130905072651_devise_create_users.rb create mode 100644 db/migrate/20130905072654_add_time_zone_to_user.rb create mode 100644 db/migrate/20130905072700_devise_create_admins.rb create mode 100644 db/seeds.rb create mode 100644 lib/application_responder.rb create mode 100644 lib/assets/.keep create mode 100644 lib/tasks/.keep create mode 100644 lib/templates/haml/scaffold/_form.html.haml create mode 100644 lib/templates/rails/responders_controller/controller.rb create mode 100644 lib/user_sanitizer.rb create mode 100644 log/.keep create mode 100644 public/404.html create mode 100644 public/422.html create mode 100644 public/500.html create mode 100644 public/favicon.ico create mode 100644 public/robots.txt create mode 100644 spec/controllers/.keep create mode 100644 spec/factories/admins.rb create mode 100644 spec/factories/users.rb create mode 100644 spec/helpers/.keep create mode 100644 spec/lib/.keep create mode 100644 spec/models/.keep create mode 100644 spec/models/admin_spec.rb create mode 100644 spec/models/user_spec.rb create mode 100644 spec/spec_helper.rb create mode 100644 spec/support/.keep create mode 100644 spec/views/.keep create mode 100644 vendor/assets/javascripts/.keep create mode 100644 vendor/assets/stylesheets/.keep diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a4bb393 --- /dev/null +++ b/.gitignore @@ -0,0 +1,40 @@ +# See http://help.github.com/ignore-files/ for more about ignoring files. +# +# If you find yourself ignoring temporary files generated by your text editor +# or operating system, you probably want to add a global ignore instead: +# git config --global core.excludesfile '~/.gitignore_global' + +# Ignore bundler config. +/.bundle + +# Ignore the default SQLite database. +/db/*.sqlite3 +/db/*.sqlite3-journal + +# Ignore log +/log/*.log + +/tmp +!.keep +*.swp +.env +bin/stubs +public/system +tags +vendor/bundler_gems + +# Ignore ide and text editor +.idea + +# Ignore pow files +.powrc + +# Ignore mac files +.DS_Store + +config/settings.local.yml +config/settings/*.local.yml +config/environments/*.local.yml +.rvmrc +.idea/ +.idea/**/* \ No newline at end of file diff --git a/.rspec b/.rspec new file mode 100644 index 0000000..4e1e0d2 --- /dev/null +++ b/.rspec @@ -0,0 +1 @@ +--color diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..b5d9eb8 --- /dev/null +++ b/Gemfile @@ -0,0 +1,39 @@ +source 'https://rubygems.org' + +gem 'rails', '~> 4.0.0' +gem 'pg', '~> 0.15.1' +gem 'sass-rails', '~> 4.0.0' +gem 'uglifier', '>= 1.3.0' +gem 'coffee-rails', '~> 4.0.0' +gem 'jquery-rails', '~> 3.0.4' +gem 'turbolinks', '~> 1.3.0' +gem 'haml', '~> 4.0.2' +gem 'haml-rails' +gem 'bootstrap-sass', '~> 2.3.1.0' +gem 'responders', '~> 1.0.0.rc' +gem 'exception_notification', '~> 4.0.0' +gem 'simple_form', '~> 3.0.0.rc' +gem 'rails_config', '~> 0.3.3' +gem 'compass-rails', github: 'Compass/compass-rails', branch: 'rails4-hack' +gem 'devise', '~> 3.0.0' +gem 'devise-i18n', '~> 0.8.6' +gem 'will_paginate', '~> 3.0.4' +gem 'will_paginate-bootstrap', '~> 0.2.3' +gem 'will-paginate-i18n', '~> 0.1.13' +gem 'paperclip', '~> 3.5.1' +gem 'kangal', '~> 0.1.2' + +group :doc do + gem 'sdoc', require: false +end + +group :development, :test do + gem 'better_errors' + gem 'binding_of_caller' + gem 'letter_opener' + gem 'katip' + gem 'rspec-rails', '~> 2.14.0' + gem 'capybara', '~> 2.1.0' + gem 'shoulda-matchers', '~> 2.2.0' + gem 'factory_girl_rails', '~> 4.0' +end diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..54de79b --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,240 @@ +GIT + remote: git://github.com/Compass/compass-rails.git + revision: 32c16cb90f78053310b35199a970c53355bcd300 + branch: rails4-hack + specs: + compass-rails (1.0.3) + compass (>= 0.12.2, < 0.14) + +GEM + remote: https://rubygems.org/ + specs: + actionmailer (4.0.0) + actionpack (= 4.0.0) + mail (~> 2.5.3) + actionpack (4.0.0) + activesupport (= 4.0.0) + builder (~> 3.1.0) + erubis (~> 2.7.0) + rack (~> 1.5.2) + rack-test (~> 0.6.2) + activemodel (4.0.0) + activesupport (= 4.0.0) + builder (~> 3.1.0) + activerecord (4.0.0) + activemodel (= 4.0.0) + activerecord-deprecated_finders (~> 1.0.2) + activesupport (= 4.0.0) + arel (~> 4.0.0) + activerecord-deprecated_finders (1.0.3) + activesupport (4.0.0) + i18n (~> 0.6, >= 0.6.4) + minitest (~> 4.2) + multi_json (~> 1.3) + thread_safe (~> 0.1) + tzinfo (~> 0.3.37) + addressable (2.3.5) + arel (4.0.0) + atomic (1.1.13) + bcrypt-ruby (3.1.2) + better_errors (0.9.0) + coderay (>= 1.0.0) + erubis (>= 2.6.6) + binding_of_caller (0.7.2) + debug_inspector (>= 0.0.1) + bootstrap-sass (2.3.1.3) + sass (~> 3.2) + builder (3.1.4) + capybara (2.1.0) + mime-types (>= 1.16) + nokogiri (>= 1.3.3) + rack (>= 1.0.0) + rack-test (>= 0.5.4) + xpath (~> 2.0) + chunky_png (1.2.8) + climate_control (0.0.3) + activesupport (>= 3.0) + cocaine (0.5.1) + climate_control (>= 0.0.3, < 1.0) + coderay (1.1.0) + coffee-rails (4.0.0) + coffee-script (>= 2.2.0) + railties (>= 4.0.0.beta, < 5.0) + coffee-script (2.2.0) + coffee-script-source + execjs + coffee-script-source (1.6.3) + compass (0.12.2) + chunky_png (~> 1.2) + fssm (>= 0.2.7) + sass (~> 3.1) + debug_inspector (0.0.2) + devise (3.0.3) + bcrypt-ruby (~> 3.0) + orm_adapter (~> 0.1) + railties (>= 3.2.6, < 5) + warden (~> 1.2.3) + devise-i18n (0.8.6) + diff-lcs (1.2.4) + erubis (2.7.0) + exception_notification (4.0.0) + actionmailer (>= 3.0.4) + activesupport (>= 3.0.4) + execjs (2.0.1) + factory_girl (4.2.0) + activesupport (>= 3.0.0) + factory_girl_rails (4.2.1) + factory_girl (~> 4.2.0) + railties (>= 3.0.0) + fssm (0.2.10) + haml (4.0.3) + 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) + hike (1.2.3) + i18n (0.6.5) + jquery-rails (3.0.4) + railties (>= 3.0, < 5.0) + thor (>= 0.14, < 2.0) + json (1.8.0) + kangal (0.1.2) + activemodel + mail + katip (1.1.0) + launchy (2.3.0) + addressable (~> 2.3) + letter_opener (1.1.2) + launchy (~> 2.2) + mail (2.5.4) + mime-types (~> 1.16) + treetop (~> 1.4.8) + mime-types (1.25) + mini_portile (0.5.1) + minitest (4.7.5) + multi_json (1.7.9) + nokogiri (1.6.0) + mini_portile (~> 0.5.0) + orm_adapter (0.4.0) + paperclip (3.5.1) + activemodel (>= 3.0.0) + activesupport (>= 3.0.0) + cocaine (~> 0.5.0) + mime-types + pg (0.15.1) + polyglot (0.3.3) + rack (1.5.2) + rack-test (0.6.2) + rack (>= 1.0) + rails (4.0.0) + actionmailer (= 4.0.0) + actionpack (= 4.0.0) + activerecord (= 4.0.0) + activesupport (= 4.0.0) + bundler (>= 1.3.0, < 2.0) + railties (= 4.0.0) + sprockets-rails (~> 2.0.0) + rails_config (0.3.3) + activesupport (>= 3.0) + railties (4.0.0) + actionpack (= 4.0.0) + activesupport (= 4.0.0) + rake (>= 0.8.7) + thor (>= 0.18.1, < 2.0) + rake (10.1.0) + rdoc (3.12.2) + json (~> 1.4) + responders (1.0.0.rc) + railties (>= 3.2, < 5) + rspec-core (2.14.5) + rspec-expectations (2.14.2) + diff-lcs (>= 1.1.3, < 2.0) + rspec-mocks (2.14.3) + rspec-rails (2.14.0) + actionpack (>= 3.0) + activesupport (>= 3.0) + railties (>= 3.0) + rspec-core (~> 2.14.0) + rspec-expectations (~> 2.14.0) + rspec-mocks (~> 2.14.0) + sass (3.2.10) + sass-rails (4.0.0) + railties (>= 4.0.0.beta, < 5.0) + sass (>= 3.1.10) + sprockets-rails (~> 2.0.0) + sdoc (0.3.20) + json (>= 1.1.3) + rdoc (~> 3.10) + shoulda-matchers (2.2.0) + activesupport (>= 3.0.0) + simple_form (3.0.0.rc) + actionpack (>= 4.0.0.rc1, < 4.1) + activemodel (>= 4.0.0.rc1, < 4.1) + sprockets (2.10.0) + hike (~> 1.2) + multi_json (~> 1.0) + rack (~> 1.0) + tilt (~> 1.1, != 1.3.0) + sprockets-rails (2.0.0) + actionpack (>= 3.0) + activesupport (>= 3.0) + sprockets (~> 2.8) + thor (0.18.1) + thread_safe (0.1.2) + atomic + tilt (1.4.1) + treetop (1.4.15) + polyglot + polyglot (>= 0.3.1) + turbolinks (1.3.0) + coffee-rails + tzinfo (0.3.37) + uglifier (2.2.1) + execjs (>= 0.3.0) + multi_json (~> 1.0, >= 1.0.2) + warden (1.2.3) + rack (>= 1.0) + will-paginate-i18n (0.1.13) + will_paginate (3.0.4) + will_paginate-bootstrap (0.2.4) + will_paginate (>= 3.0.3) + xpath (2.0.0) + nokogiri (~> 1.3) + +PLATFORMS + ruby + +DEPENDENCIES + better_errors + binding_of_caller + bootstrap-sass (~> 2.3.1.0) + capybara (~> 2.1.0) + coffee-rails (~> 4.0.0) + compass-rails! + devise (~> 3.0.0) + devise-i18n (~> 0.8.6) + exception_notification (~> 4.0.0) + factory_girl_rails (~> 4.0) + haml (~> 4.0.2) + haml-rails + jquery-rails (~> 3.0.4) + kangal (~> 0.1.2) + katip + letter_opener + paperclip (~> 3.5.1) + pg (~> 0.15.1) + rails (~> 4.0.0) + rails_config (~> 0.3.3) + responders (~> 1.0.0.rc) + rspec-rails (~> 2.14.0) + sass-rails (~> 4.0.0) + sdoc + shoulda-matchers (~> 2.2.0) + simple_form (~> 3.0.0.rc) + turbolinks (~> 1.3.0) + uglifier (>= 1.3.0) + will-paginate-i18n (~> 0.1.13) + will_paginate (~> 3.0.4) + will_paginate-bootstrap (~> 0.2.3) diff --git a/README.md b/README.md new file mode 100644 index 0000000..a7d37c5 --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# yakut + diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..41d2e05 --- /dev/null +++ b/Rakefile @@ -0,0 +1,6 @@ +# 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__) + +Yakut::Application.load_tasks diff --git a/app/assets/images/.keep b/app/assets/images/.keep new file mode 100644 index 0000000..e69de29 diff --git a/app/assets/javascripts/application.js.coffee b/app/assets/javascripts/application.js.coffee new file mode 100644 index 0000000..0466843 --- /dev/null +++ b/app/assets/javascripts/application.js.coffee @@ -0,0 +1,17 @@ +# This is a manifest file that will 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 +# 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 turbolinks +#= require bootstrap +#= require_tree . \ No newline at end of file diff --git a/app/assets/stylesheets/application.css.sass b/app/assets/stylesheets/application.css.sass new file mode 100644 index 0000000..aa0877b --- /dev/null +++ b/app/assets/stylesheets/application.css.sass @@ -0,0 +1,47 @@ +/* + * This is a manifest file that will be compiled into application.css, which will include all the files + * listed below. + * + * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, + * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path. + * + * You're free to add application-wide styles to this file and they'll appear at the top of the + * compiled file, but it's generally better to create a new file per style scope. + * + *= require_self + *= require_tree . + +@import "compass" +@import "bootstrap" +@import "bootstrap-responsive" + +body + padding-top: 20px + padding-bottom: 40px + +/* Custom container + +.container-narrow + margin: 0 auto + max-width: 700px + > hr + margin: 30px 0 + +/* Main marketing message and sign up button + +.jumbotron + margin: 60px 0 + text-align: center + h1 + font-size: 72px + line-height: 1 + .btn + font-size: 21px + padding: 14px 24px + +/* Supporting marketing content + +.marketing + margin: 60px 0 + p + h4 + margin-top: 28px \ No newline at end of file diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb new file mode 100644 index 0000000..7d1b7e6 --- /dev/null +++ b/app/controllers/application_controller.rb @@ -0,0 +1,37 @@ +require 'application_responder' + +class ApplicationController < ActionController::Base + before_filter :set_user_time_zone + + + self.responder = ApplicationResponder + respond_to :html, :json + WillPaginate.per_page = 10 + + # Prevent CSRF attacks by raising an exception. + # For APIs, you may want to use :null_session instead. + protect_from_forgery with: :exception + protected + def set_user_time_zone + Time.zone = current_user.time_zone if user_signed_in? && current_user.time_zone.present? + end + + + + def devise_parameter_sanitizer + if resource_class == User + User::ParameterSanitizer.new(User, :user, params) + else + super # Use the default one + end + end + + + def after_sign_in_path_for(resource_or_scope) + if current_user + super + else + hq_dashboard_index_path + end + end +end \ No newline at end of file diff --git a/app/controllers/concerns/.keep b/app/controllers/concerns/.keep new file mode 100644 index 0000000..e69de29 diff --git a/app/controllers/hq/base_controller.rb b/app/controllers/hq/base_controller.rb new file mode 100644 index 0000000..a4462de --- /dev/null +++ b/app/controllers/hq/base_controller.rb @@ -0,0 +1,7 @@ +require 'application_responder' + +class Hq::BaseController < ActionController::Base + before_action :authenticate_admin! + self.responder = ApplicationResponder + respond_to :html, :json +end \ No newline at end of file diff --git a/app/controllers/hq/dashboard_controller.rb b/app/controllers/hq/dashboard_controller.rb new file mode 100644 index 0000000..6e661be --- /dev/null +++ b/app/controllers/hq/dashboard_controller.rb @@ -0,0 +1,5 @@ +class Hq::DashboardController < Hq::BaseController + def index + + end +end \ No newline at end of file diff --git a/app/controllers/hq/sessions_controller.rb b/app/controllers/hq/sessions_controller.rb new file mode 100644 index 0000000..aa1d62b --- /dev/null +++ b/app/controllers/hq/sessions_controller.rb @@ -0,0 +1,3 @@ +class Hq::SessionsController < Devise::SessionsController + +end \ No newline at end of file diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb new file mode 100644 index 0000000..89f412e --- /dev/null +++ b/app/controllers/welcome_controller.rb @@ -0,0 +1,4 @@ +class WelcomeController < ApplicationController + def index + end +end \ No newline at end of file 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/mailers/.keep b/app/mailers/.keep new file mode 100644 index 0000000..e69de29 diff --git a/app/models/.keep b/app/models/.keep new file mode 100644 index 0000000..e69de29 diff --git a/app/models/admin.rb b/app/models/admin.rb new file mode 100644 index 0000000..13b10a0 --- /dev/null +++ b/app/models/admin.rb @@ -0,0 +1,7 @@ +class Admin < ActiveRecord::Base + # Include default devise modules. Others available are: + # :token_authenticatable, :confirmable, + # :lockable, :timeoutable and :omniauthable + devise :database_authenticatable, + :recoverable, :rememberable, :trackable, :validatable +end diff --git a/app/models/concerns/.keep b/app/models/concerns/.keep new file mode 100644 index 0000000..e69de29 diff --git a/app/models/user.rb b/app/models/user.rb new file mode 100644 index 0000000..c4b4742 --- /dev/null +++ b/app/models/user.rb @@ -0,0 +1,7 @@ +class User < ActiveRecord::Base + # Include default devise modules. Others available are: + # :token_authenticatable, :confirmable, + # :lockable, :timeoutable and :omniauthable + devise :database_authenticatable, :registerable, + :recoverable, :rememberable, :trackable, :validatable +end diff --git a/app/views/devise/confirmations/new.html.haml b/app/views/devise/confirmations/new.html.haml new file mode 100644 index 0000000..af24614 --- /dev/null +++ b/app/views/devise/confirmations/new.html.haml @@ -0,0 +1,9 @@ +%h2 Resend confirmation instructions += simple_form_for(resource, :as => resource_name, :url => confirmation_path(resource_name), :html => { :method => :post }) do |f| + = f.error_notification + = f.full_error :confirmation_token + .form-inputs + = f.input :email, :required => true, :autofocus => true + .form-actions + = f.button :submit, "Resend confirmation instructions" += render "devise/shared/links" diff --git a/app/views/devise/mailer/confirmation_instructions.html.haml b/app/views/devise/mailer/confirmation_instructions.html.haml new file mode 100644 index 0000000..eeab62b --- /dev/null +++ b/app/views/devise/mailer/confirmation_instructions.html.haml @@ -0,0 +1,4 @@ +%p + Welcome #{@email}! +%p You can confirm your account email through the link below: +%p= link_to 'Confirm my account', confirmation_url(@resource, :confirmation_token => @resource.confirmation_token) diff --git a/app/views/devise/mailer/reset_password_instructions.html.haml b/app/views/devise/mailer/reset_password_instructions.html.haml new file mode 100644 index 0000000..bc9e196 --- /dev/null +++ b/app/views/devise/mailer/reset_password_instructions.html.haml @@ -0,0 +1,6 @@ +%p + Hello #{@resource.email}! +%p Someone has requested a link to change your password. You can do this through the link below. +%p= link_to 'Change my password', edit_password_url(@resource, :reset_password_token => @resource.reset_password_token) +%p If you didn't request this, please ignore this email. +%p Your password won't change until you access the link above and create a new one. diff --git a/app/views/devise/mailer/unlock_instructions.html.haml b/app/views/devise/mailer/unlock_instructions.html.haml new file mode 100644 index 0000000..72f6a0b --- /dev/null +++ b/app/views/devise/mailer/unlock_instructions.html.haml @@ -0,0 +1,5 @@ +%p + Hello #{@resource.email}! +%p Your account has been locked due to an excessive number of unsuccessful sign in attempts. +%p Click the link below to unlock your account: +%p= link_to 'Unlock my account', unlock_url(@resource, :unlock_token => @resource.unlock_token) diff --git a/app/views/devise/passwords/edit.html.haml b/app/views/devise/passwords/edit.html.haml new file mode 100644 index 0000000..53aa7b6 --- /dev/null +++ b/app/views/devise/passwords/edit.html.haml @@ -0,0 +1,11 @@ +%h2 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 + .form-inputs + = f.input :password, :label => "New password", :required => true, :autofocus => true + = f.input :password_confirmation, :label => "Confirm your new password", :required => true + .form-actions + = f.button :submit, "Change my password" += render "devise/shared/links" diff --git a/app/views/devise/passwords/new.html.haml b/app/views/devise/passwords/new.html.haml new file mode 100644 index 0000000..83408b1 --- /dev/null +++ b/app/views/devise/passwords/new.html.haml @@ -0,0 +1,8 @@ +%h2 Forgot your password? += simple_form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :post }) do |f| + = f.error_notification + .form-inputs + = f.input :email, :required => true, :autofocus => true + .form-actions + = f.button :submit, "Send me reset password instructions" += render "devise/shared/links" diff --git a/app/views/devise/registrations/edit.html.haml b/app/views/devise/registrations/edit.html.haml new file mode 100644 index 0000000..48b0a13 --- /dev/null +++ b/app/views/devise/registrations/edit.html.haml @@ -0,0 +1,18 @@ +%h2 + 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 + .form-inputs + = f.input :email, :required => true, :autofocus => true + - if devise_mapping.confirmable? && resource.pending_reconfirmation? + %p + Currently waiting confirmation for: #{resource.unconfirmed_email} + = 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 + .form-actions + = f.button :submit, "Update" +%h3 Cancel my account +%p + 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.haml b/app/views/devise/registrations/new.html.haml new file mode 100644 index 0000000..1c4fa25 --- /dev/null +++ b/app/views/devise/registrations/new.html.haml @@ -0,0 +1,11 @@ +%h2 Sign up += simple_form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| + = f.error_notification + .form-inputs + = f.input :name, :autofocus => true + = f.input :email, :required => true + = f.input :password, :required => true + = f.input :password_confirmation, :required => true + .form-actions + = f.button :submit, "Sign up" += render "devise/shared/links" diff --git a/app/views/devise/sessions/new.html.haml b/app/views/devise/sessions/new.html.haml new file mode 100644 index 0000000..4008e35 --- /dev/null +++ b/app/views/devise/sessions/new.html.haml @@ -0,0 +1,9 @@ +%h2 Sign in += simple_form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| + .form-inputs + = f.input :email, :required => false, :autofocus => true + = f.input :password, :required => false + = f.input :remember_me, :as => :boolean if devise_mapping.rememberable? + .form-actions + = f.button :submit, "Sign in" += render "devise/shared/links" diff --git a/app/views/devise/shared/_links.haml b/app/views/devise/shared/_links.haml new file mode 100644 index 0000000..35d07ec --- /dev/null +++ b/app/views/devise/shared/_links.haml @@ -0,0 +1,19 @@ +- if controller_name != 'sessions' + = link_to "Sign in", new_session_path(resource_name) + %br/ +- if devise_mapping.registerable? && controller_name != 'registrations' + = link_to "Sign up", new_registration_path(resource_name) + %br/ +- if devise_mapping.recoverable? && controller_name != 'passwords' + = link_to "Forgot your password?", new_password_path(resource_name) + %br/ +- if devise_mapping.confirmable? && controller_name != 'confirmations' + = link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) + %br/ +- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' + = link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) + %br/ +- if devise_mapping.omniauthable? + - resource_class.omniauth_providers.each do |provider| + = link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider) + %br/ diff --git a/app/views/devise/unlocks/new.html.haml b/app/views/devise/unlocks/new.html.haml new file mode 100644 index 0000000..98304e5 --- /dev/null +++ b/app/views/devise/unlocks/new.html.haml @@ -0,0 +1,9 @@ +%h2 Resend unlock instructions += simple_form_for(resource, :as => resource_name, :url => unlock_path(resource_name), :html => { :method => :post }) do |f| + = f.error_notification + = f.full_error :unlock_token + .form-inputs + = f.input :email, :required => true, :autofocus => true + .form-actions + = f.button :submit, "Resend unlock instructions" += render "devise/shared/links" diff --git a/app/views/hq/dashboard/index.html.haml b/app/views/hq/dashboard/index.html.haml new file mode 100644 index 0000000..6ed37df --- /dev/null +++ b/app/views/hq/dashboard/index.html.haml @@ -0,0 +1,2 @@ +%h1= "Hi #{current_admin.email}" += link_to 'Sign out', destroy_admin_session_path, class: 'btn btn-large', method: :delete \ No newline at end of file diff --git a/app/views/hq/sessions/new.html.haml b/app/views/hq/sessions/new.html.haml new file mode 100644 index 0000000..2cdb090 --- /dev/null +++ b/app/views/hq/sessions/new.html.haml @@ -0,0 +1,8 @@ +%h2 Admin Sign in += simple_form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| + .form-inputs + = f.input :email, :required => false, :autofocus => true + = f.input :password, :required => false + = f.input :remember_me, :as => :boolean if devise_mapping.rememberable? + .form-actions + = f.button :submit, "Sign in" \ No newline at end of file diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml new file mode 100644 index 0000000..4ceeeb5 --- /dev/null +++ b/app/views/layouts/application.html.haml @@ -0,0 +1,21 @@ +!!! +%html + %head + %title yakut + = stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true + = javascript_include_tag "application", "data-turbolinks-track" => true + = csrf_meta_tags + %body + .container-narrow + .masthead + %ul.nav.nav-pills.pull-right + %li.active + %a{:href => "/"} Home + %li + %a{:href => "/rails/routes"} Routes + %h3.muted= link_to "yakut", root_path + %hr/ + = yield + %hr/ + .footer + %p © Company 2013 \ No newline at end of file diff --git a/app/views/layouts/hq/base.html.haml b/app/views/layouts/hq/base.html.haml new file mode 100644 index 0000000..4ceeeb5 --- /dev/null +++ b/app/views/layouts/hq/base.html.haml @@ -0,0 +1,21 @@ +!!! +%html + %head + %title yakut + = stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true + = javascript_include_tag "application", "data-turbolinks-track" => true + = csrf_meta_tags + %body + .container-narrow + .masthead + %ul.nav.nav-pills.pull-right + %li.active + %a{:href => "/"} Home + %li + %a{:href => "/rails/routes"} Routes + %h3.muted= link_to "yakut", root_path + %hr/ + = yield + %hr/ + .footer + %p © Company 2013 \ No newline at end of file diff --git a/app/views/welcome/index.html.haml b/app/views/welcome/index.html.haml new file mode 100644 index 0000000..441b038 --- /dev/null +++ b/app/views/welcome/index.html.haml @@ -0,0 +1,14 @@ +.jumbotron + %h1 Welcome to yakut + - if current_user + = link_to 'Sign out', destroy_user_session_path, class: 'btn btn-large', method: :delete + .row-fluid.marketing + %p + %strong Name: + = current_user.name + %p + %strong Email: + = current_user.email + - else + = link_to 'Sign up today', new_user_registration_path, class: 'btn btn-large btn-success' + = link_to 'Sign in', new_user_session_path, class: 'btn btn-large' \ No newline at end of file diff --git a/bin/bundle b/bin/bundle new file mode 100755 index 0000000..66e9889 --- /dev/null +++ b/bin/bundle @@ -0,0 +1,3 @@ +#!/usr/bin/env ruby +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) +load Gem.bin_path('bundler', 'bundle') diff --git a/bin/rails b/bin/rails new file mode 100755 index 0000000..728cd85 --- /dev/null +++ b/bin/rails @@ -0,0 +1,4 @@ +#!/usr/bin/env ruby +APP_PATH = File.expand_path('../../config/application', __FILE__) +require_relative '../config/boot' +require 'rails/commands' diff --git a/bin/rake b/bin/rake new file mode 100755 index 0000000..1724048 --- /dev/null +++ b/bin/rake @@ -0,0 +1,4 @@ +#!/usr/bin/env ruby +require_relative '../config/boot' +require 'rake' +Rake.application.run diff --git a/config.ru b/config.ru new file mode 100644 index 0000000..5bc2a61 --- /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 Rails.application diff --git a/config/application.rb b/config/application.rb new file mode 100644 index 0000000..9aef14b --- /dev/null +++ b/config/application.rb @@ -0,0 +1,32 @@ +require File.expand_path('../boot', __FILE__) + +# Pick the frameworks you want: +require "active_record/railtie" +require "action_controller/railtie" +require "action_mailer/railtie" +require "sprockets/railtie" +# require "rails/test_unit/railtie" + +# Require the gems listed in Gemfile, including any gems +# you've limited to :test, :development, or :production. +Bundler.require(:default, Rails.env) + +module Yakut + 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. + + # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. + # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. + # config.time_zone = 'Central Time (US & Canada)' + + # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. + # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] + # config.i18n.default_locale = :de + + config.assets.precompile += %w(*.png *.jpg *.jpeg *.gif) + config.sass.preferred_syntax = :sass + + end +end diff --git a/config/boot.rb b/config/boot.rb new file mode 100644 index 0000000..3596736 --- /dev/null +++ b/config/boot.rb @@ -0,0 +1,4 @@ +# Set up gems listed in the Gemfile. +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) + +require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE']) diff --git a/config/database.yml b/config/database.yml new file mode 100644 index 0000000..b3f7a88 --- /dev/null +++ b/config/database.yml @@ -0,0 +1,13 @@ +development: &default + adapter: postgresql + database: yakut_development + encoding: utf8 + min_messages: warning + pool: 5 + timeout: 5000 + host: localhost + port: 5432 + +test: + <<: *default + database: yakut_test \ No newline at end of file diff --git a/config/environment.rb b/config/environment.rb new file mode 100644 index 0000000..244b721 --- /dev/null +++ b/config/environment.rb @@ -0,0 +1,5 @@ +# Load the Rails application. +require File.expand_path('../application', __FILE__) + +# Initialize the Rails application. +Yakut::Application.initialize! diff --git a/config/environments/development.rb b/config/environments/development.rb new file mode 100644 index 0000000..f33c121 --- /dev/null +++ b/config/environments/development.rb @@ -0,0 +1,35 @@ +Yakut::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 + + # Do not eager load code on boot. + config.eager_load = false + + # 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 + + # Raise an error on page load if there are pending migrations + config.active_record.migration_error = :page_load + + # Debug mode disables concatenation and preprocessing of assets. + # This option may cause significant delays in view rendering with a large + # number of complex assets. + config.assets.debug = true + + # Mail Setting + config.action_mailer.default_url_options = { :host => 'yakut.dev' } + + + config.action_mailer.delivery_method = :letter_opener +end diff --git a/config/environments/production.rb b/config/environments/production.rb new file mode 100644 index 0000000..55fd722 --- /dev/null +++ b/config/environments/production.rb @@ -0,0 +1,95 @@ +Yakut::Application.configure do + # Settings specified here will take precedence over those in config/application.rb. + + # Code is not reloaded between requests. + config.cache_classes = true + + # Eager load code on boot. This eager loads most of Rails and + # your application in memory, allowing both thread web servers + # and those relying on copy on write to perform better. + # Rake tasks automatically ignore this option for performance. + config.eager_load = true + + # Full error reports are disabled and caching is turned on. + config.consider_all_requests_local = false + config.action_controller.perform_caching = true + + # Enable Rack::Cache to put a simple HTTP cache in front of your application + # Add `rack-cache` to your Gemfile before enabling this. + # For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid. + # config.action_dispatch.rack_cache = 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.js_compressor = :uglifier + # config.assets.css_compressor = :sass + + # Do not fallback to assets pipeline if a precompiled asset is missed. + config.assets.compile = false + + # Generate digests for assets URLs. + config.assets.digest = true + + # Version of your assets, change this if you want to expire all your assets. + config.assets.version = '1.0' + + # 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 + + # Set to :debug to see everything in the log. + config.log_level = :info + + # 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 in app/assets folder are already added. + # config.assets.precompile += %w( search.js ) + + # Ignore bad email addresses and do not raise email delivery errors. + # Set this to true and configure the email server for immediate delivery to raise delivery errors. + # config.action_mailer.raise_delivery_errors = false + + # 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 + + # Disable automatic flushing of the log to improve performance. + # config.autoflush_log = false + + # Use default logging formatter so that PID and timestamp are not suppressed. + config.log_formatter = ::Logger::Formatter.new + + # Mail Setting + config.action_mailer.default_url_options = { :host => 'yakut.com' } + + + config.action_mailer.delivery_method = :smtp + config.action_mailer.smtp_settings = { + :address => 'smtp.mandrillapp.com', + :port => 587, + :enable_starttls_auto => true, + :user_name => 'email@email.com', #TODO change this with original + :password => 'password', #TODO change this with original + :authentication => 'plain' + } + +end diff --git a/config/environments/test.rb b/config/environments/test.rb new file mode 100644 index 0000000..9c00a75 --- /dev/null +++ b/config/environments/test.rb @@ -0,0 +1,40 @@ +Yakut::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 + + # Do not eager load code on boot. This avoids loading your whole application + # just for the purpose of running a single test. If you are using a tool that + # preloads Rails for running tests, you may have to set it to true. + config.eager_load = false + + # Configure static asset server for tests with Cache-Control for performance. + config.serve_static_assets = true + config.static_cache_control = "public, max-age=3600" + + # 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 + + # Print deprecation notices to the stderr. + config.active_support.deprecation = :stderr + + # Mail Setting + config.action_mailer.default_url_options = { :host => 'yakut.com' } + +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..5990d5b --- /dev/null +++ b/config/initializers/devise.rb @@ -0,0 +1,252 @@ +# 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 = "CHANGEME@example.com" + + # 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 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. The supported strategies are: + # :database = Support basic authentication with authentication key + password + # :token = Support basic authentication with token authentication key + # :token_options = Support token authentication with options as defined in + # http://api.rubyonrails.org/classes/ActionController/HttpAuthentication/Token.html + # 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] + + # By default, Devise cleans up the CSRF token on authentication to + # avoid CSRF token fixation attacks. This means that, when using AJAX + # requests for sign in and sign up, you need to get a new CSRF token + # from the server. You can disable this option at your own risk. + # config.clean_up_csrf_token_on_authentication = true + + # ==> 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 = "5ae48c7acf0a99c1149e962989e090bd73ab1095c6d360d9d1e68e5b510cb8876262278fce1e291fd4d8e426435df26256b418a6c989ee9b1774331879795fbd" + + # ==> Configuration for :confirmable + # A period that the user is allowed to access the website even without + # confirming his account. For instance, if set to 2.days, the user will be + # able to access the website for two days without confirming his account, + # access will be blocked just in the third day. Default is 0.days, meaning + # the user cannot access the website without confirming his account. + # config.allow_unconfirmed_access_for = 2.days + + # A period that the user is allowed to confirm their account before their + # token becomes invalid. For example, if set to 3.days, the user can confirm + # their account within 3 days after the mail was sent, but on the fourth day + # their account can't be confirmed with the token any more. + # Default is nil, meaning there is no restriction on how long a user can take + # before confirming their account. + # config.confirm_within = 3.days + + # If true, requires any email changes to be confirmed (exactly the same way as + # initial account confirmation) to be applied. Requires additional unconfirmed_email + # db field (see migrations). Until confirmed new email is stored in + # unconfirmed email column, and copied to email column on successful confirmation. + config.reconfirmable = true + + # Defines which key will be used when confirming an account + # config.confirmation_keys = [ :email ] + + # ==> Configuration for :rememberable + # The time the user will be remembered without asking for credentials again. + # config.remember_for = 2.weeks + + # If true, extends the user's remember period when remembered via cookie. + # config.extend_remember_period = false + + # Options to be passed to the created cookie. For instance, you can set + # :secure => true in order to force SSL only cookies. + # config.rememberable_options = {} + + # ==> Configuration for :validatable + # Range for password length. Default is 8..128. + config.password_length = 8..128 + + # Email regex used to validate email formats. It simply asserts that + # 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). + # + # Require the `devise-encryptable` gem when using anything other than bcrypt + # config.encryptor = :sha512 + + # ==> Configuration for :token_authenticatable + # Defines name of the authentication token params key + # config.token_authentication_key = :auth_token + + # ==> Scopes configuration + # Turn scoped views on. Before rendering "sessions/new", it will first check for + # "users/sessions/new". It's turned off by default because it's slower if you + # are using only default views. + # config.scoped_views = false + + # Configure the default scope given to Warden. By default it's the first + # devise role declared in your routes (usually :user). + # config.default_scope = :user + + # Set this configuration to false if you want /users/sign_out to sign out + # only the current scope. By default, Devise signs out all scopes. + # config.sign_out_all_scopes = true + + # ==> Navigation configuration + # Lists the formats that should be treated as navigational. Formats like + # :html, should redirect to the sign in page when the user does not have + # access, but formats like :xml or :json, should return 401. + # + # If you have any extra navigational formats, like :iphone or :mobile, you + # should add them to the navigational formats lists. + # + # The "*/*" below is required to match Internet Explorer requests. + # config.navigational_formats = ["*/*", :html] + + # The default HTTP method used to sign out a resource. Default is :delete. + config.sign_out_via = :delete + + # ==> OmniAuth + # Add a new OmniAuth provider. Check the wiki for more information on setting + # up on your models and hooks. + # config.omniauth :github, 'APP_ID', 'APP_SECRET', :scope => 'user,public_repo' + + # ==> Warden configuration + # If you want to use other strategies, that are not supported by Devise, or + # change the failure app, you can configure them inside the config.warden block. + # + # config.warden do |manager| + # manager.intercept_401 = false + # manager.default_strategies(:scope => :user).unshift :some_external_strategy + # end + + # ==> Mountable engine configurations + # When using Devise inside an engine, let's call it `MyEngine`, and this engine + # is mountable, there are some extra configurations to be taken into account. + # The following options are available, assuming the engine is mounted as: + # + # mount MyEngine, at: "/my_engine" + # + # The router that invoked `devise_for`, in the example above, would be: + # config.router_name = :my_engine + # + # When using omniauth, Devise cannot automatically set Omniauth path, + # so you need to do it manually. For the users scope, it would be: + # config.omniauth_path_prefix = "/my_engine/users/auth" +end diff --git a/config/initializers/exception_notification.rb b/config/initializers/exception_notification.rb new file mode 100644 index 0000000..d1e8d4c --- /dev/null +++ b/config/initializers/exception_notification.rb @@ -0,0 +1,38 @@ +require 'exception_notification/rails' + + + +ExceptionNotification.configure do |config| + # Ignore additional exception types. + # ActiveRecord::RecordNotFound, AbstractController::ActionNotFound and ActionController::RoutingError are already added. + # config.ignored_exceptions += %w{ActionView::TemplateError CustomError} + + # Adds a condition to decide when an exception must be ignored or not. + # The ignore_if method can be invoked multiple times to add extra conditions. + # config.ignore_if do |exception, options| + # not Rails.env.production? + # end + + # Notifiers ================================================================= + + # Email notifier sends notifications by email. + config.add_notifier :email, { + :email_prefix => "[ERROR] ", + :sender_address => %{"Notifier" }, + :exception_recipients => %w{exceptions@example.com} + } + + # Campfire notifier sends notifications to your Campfire room. Requires 'tinder' gem. + # config.add_notifier :campfire, { + # :subdomain => 'my_subdomain', + # :token => 'my_token', + # :room_name => 'my_room' + # } + + # Webhook notifier sends notifications over HTTP protocol. Requires 'httparty' gem. + # config.add_notifier :webhook, { + # :url => 'http://example.com:5555/hubot/path', + # :http_method => :post + # } + +end diff --git a/config/initializers/filter_parameter_logging.rb b/config/initializers/filter_parameter_logging.rb new file mode 100644 index 0000000..2ab23e6 --- /dev/null +++ b/config/initializers/filter_parameter_logging.rb @@ -0,0 +1,4 @@ +# Be sure to restart your server when you modify this file. + +# Configure sensitive parameters which will be filtered from the log file. +Rails.application.config.filter_parameters += [:password, :password_confirmation] diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb new file mode 100644 index 0000000..ac033bf --- /dev/null +++ b/config/initializers/inflections.rb @@ -0,0 +1,16 @@ +# Be sure to restart your server when you modify this file. + +# Add new inflection rules using the following format. Inflections +# are locale specific, and you may define rules for as many different +# locales as you wish. All of these examples are active by default: +# ActiveSupport::Inflector.inflections(:en) do |inflect| +# inflect.plural /^(ox)$/i, '\1en' +# inflect.singular /^(ox)en/i, '\1' +# inflect.irregular 'person', 'people' +# inflect.uncountable %w( fish sheep ) +# end + +# These inflection rules are supported but not enabled by default: +# ActiveSupport::Inflector.inflections(:en) do |inflect| +# inflect.acronym 'RESTful' +# 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/rails_config.rb b/config/initializers/rails_config.rb new file mode 100644 index 0000000..5378de9 --- /dev/null +++ b/config/initializers/rails_config.rb @@ -0,0 +1,3 @@ +RailsConfig.setup do |config| + config.const_name = "Settings" +end \ No newline at end of file diff --git a/config/initializers/sanitizers.rb b/config/initializers/sanitizers.rb new file mode 100644 index 0000000..851cbcd --- /dev/null +++ b/config/initializers/sanitizers.rb @@ -0,0 +1 @@ +require "#{Rails.application.root}/lib/user_sanitizer.rb" diff --git a/config/initializers/secret_token.rb b/config/initializers/secret_token.rb new file mode 100644 index 0000000..d1ebda1 --- /dev/null +++ b/config/initializers/secret_token.rb @@ -0,0 +1,12 @@ +# Be sure to restart your server when you modify this file. + +# Your secret key is used 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. +# You can use `rake secret` to generate a secure secret key. + +# Make sure your secret_key_base is kept private +# if you're sharing your code publicly. +Yakut::Application.config.secret_key_base = '15dc70e229aa18a2508c1461a4fdc8ed0cc1866f257ace49d0260146250f74ddb86ff9b0bcfac7d0e216a6ae530faaa5940a9afe4ff0404dd6efdfbd3235d937' diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb new file mode 100644 index 0000000..f37947b --- /dev/null +++ b/config/initializers/session_store.rb @@ -0,0 +1,3 @@ +# Be sure to restart your server when you modify this file. + +Yakut::Application.config.session_store :cookie_store, key: '_yakut_session' diff --git a/config/initializers/simple_form.rb b/config/initializers/simple_form.rb new file mode 100644 index 0000000..40b05d8 --- /dev/null +++ b/config/initializers/simple_form.rb @@ -0,0 +1,142 @@ +# 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 the native HTML5 validations (novalidate form option). + # These validations are enabled in SimpleForm's internal config but disabled by default + # in this configuration, which is recommended due to some quirks from different browsers. + # To stop SimpleForm from generating the novalidate option, enabling the HTML5 validations, + # change this configuration to true. + 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 + + # 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? +end diff --git a/config/initializers/simple_form_bootstrap.rb b/config/initializers/simple_form_bootstrap.rb new file mode 100644 index 0000000..ad4ca74 --- /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..33725e9 --- /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] if respond_to?(:wrap_parameters) +end + +# To enable root element in JSON for ActiveRecord objects. +# ActiveSupport.on_load(:active_record) do +# self.include_root_in_json = true +# end diff --git a/config/locales/en.yml b/config/locales/en.yml new file mode 100644 index 0000000..0653957 --- /dev/null +++ b/config/locales/en.yml @@ -0,0 +1,23 @@ +# Files in the config/locales directory are used for internationalization +# and are automatically loaded by Rails. If you want to use locales other +# than English, add the necessary files in this directory. +# +# To use the locales, use `I18n.t`: +# +# I18n.t 'hello' +# +# In views, this is aliased to just `t`: +# +# <%= t('hello') %> +# +# To use a different locale, set it with `I18n.locale`: +# +# I18n.locale = :es +# +# This would use the information in config/locales/es.yml. +# +# To learn more, please read the Rails Internationalization guide +# available at http://guides.rubyonrails.org/i18n.html. + +en: + hello: "Hello world" diff --git a/config/locales/responders.en.yml b/config/locales/responders.en.yml new file mode 100644 index 0000000..4e5bf47 --- /dev/null +++ b/config/locales/responders.en.yml @@ -0,0 +1,10 @@ +en: + flash: + actions: + create: + notice: '%{resource_name} was successfully created.' + update: + notice: '%{resource_name} was successfully updated.' + destroy: + notice: '%{resource_name} was successfully destroyed.' + alert: '%{resource_name} could not be destroyed.' \ No newline at end of file diff --git a/config/locales/responders.tr.yml b/config/locales/responders.tr.yml new file mode 100644 index 0000000..497ddb8 --- /dev/null +++ b/config/locales/responders.tr.yml @@ -0,0 +1,10 @@ +tr: + flash: + actions: + create: + notice: '%{resource_name} başarı ile yaratıldı.' + update: + notice: '%{resource_name} başarı ile güncellendi.' + destroy: + notice: '%{resource_name} başarı ile silindi.' + alert: '%{resource_name} silinemedi.' \ No newline at end of file diff --git a/config/locales/simple_form.en.yml b/config/locales/simple_form.en.yml new file mode 100644 index 0000000..0df11fe --- /dev/null +++ b/config/locales/simple_form.en.yml @@ -0,0 +1,26 @@ +en: + simple_form: + "yes": 'Yes' + "no": 'No' + required: + text: 'required' + 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: "Please review the problems below:" + # Labels and hints examples + # labels: + # defaults: + # password: 'Password' + # 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/locales/simple_form.tr.yml b/config/locales/simple_form.tr.yml new file mode 100644 index 0000000..8c662e5 --- /dev/null +++ b/config/locales/simple_form.tr.yml @@ -0,0 +1,26 @@ +# encoding: utf-8 +tr: + simple_form: + "yes": 'Evet' + "no": 'Hayır' + required: + text: 'zorunlu' + 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: "Lütfen aşağıdaki problemleri gözden geçiriniz:" + # Labels and hints examples + # labels: + # defaults: + # password: 'Password' + # 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.' \ No newline at end of file diff --git a/config/locales/tr.yml b/config/locales/tr.yml new file mode 100644 index 0000000..851bc0a --- /dev/null +++ b/config/locales/tr.yml @@ -0,0 +1,25 @@ +# encoding: utf-8 +# +# Files in the config/locales directory are used for internationalization +# and are automatically loaded by Rails. If you want to use locales other +# than English, add the necessary files in this directory. +# +# To use the locales, use `I18n.t`: +# +# I18n.t 'hello' +# +# In views, this is aliased to just `t`: +# +# <%= t('hello') %> +# +# To use a different locale, set it with `I18n.locale`: +# +# I18n.locale = :es +# +# This would use the information in config/locales/es.yml. +# +# To learn more, please read the Rails Internationalization guide +# available at http://guides.rubyonrails.org/i18n.html. + +tr: + hello: "Merhaba Dünya" \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb new file mode 100644 index 0000000..f44b3ac --- /dev/null +++ b/config/routes.rb @@ -0,0 +1,65 @@ +Yakut::Application.routes.draw do + devise_for :admins, controllers: {sessions: 'hq/sessions'}, path: 'hq', + path_names: {sign_in: 'login', sign_out: 'logout', password: 'secret', + confirmation: 'verification'} + devise_for :users + root to: 'welcome#index' + namespace :hq do + resources :dashboard, only: [:index] + end + + # The priority is based upon order of creation: first created -> highest priority. + # See how all your routes lay out with "rake routes". + + # You can have the root of your site routed with "root" + # root 'welcome#index' + + # Example of regular route: + # get 'products/:id' => 'catalog#view' + + # Example of named route that can be invoked with purchase_url(id: product.id) + # get 'products/:id/purchase' => 'catalog#purchase', as: :purchase + + # Example resource route (maps HTTP verbs to controller actions automatically): + # resources :products + + # Example resource route with options: + # resources :products do + # member do + # get 'short' + # post 'toggle' + # end + # + # collection do + # get 'sold' + # end + # end + + # Example resource route with sub-resources: + # resources :products do + # resources :comments, :sales + # resource :seller + # end + + # Example resource route with more complex sub-resources: + # resources :products do + # resources :comments + # resources :sales do + # get 'recent', on: :collection + # end + # end + + # Example resource route with concerns: + # concern :toggleable do + # post 'toggle' + # end + # resources :posts, concerns: :toggleable + # resources :photos, concerns: :toggleable + + # Example resource route within a namespace: + # namespace :admin do + # # Directs /admin/products/* to Admin::ProductsController + # # (app/controllers/admin/products_controller.rb) + # resources :products + # end +end diff --git a/config/settings.yml b/config/settings.yml new file mode 100644 index 0000000..e69de29 diff --git a/config/settings/development.yml b/config/settings/development.yml new file mode 100644 index 0000000..e69de29 diff --git a/config/settings/production.yml b/config/settings/production.yml new file mode 100644 index 0000000..e69de29 diff --git a/config/settings/test.yml b/config/settings/test.yml new file mode 100644 index 0000000..e69de29 diff --git a/db/migrate/.keep b/db/migrate/.keep new file mode 100644 index 0000000..e69de29 diff --git a/db/migrate/20130905072651_devise_create_users.rb b/db/migrate/20130905072651_devise_create_users.rb new file mode 100644 index 0000000..3b75eb2 --- /dev/null +++ b/db/migrate/20130905072651_devise_create_users.rb @@ -0,0 +1,47 @@ +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.string :name + + 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/20130905072654_add_time_zone_to_user.rb b/db/migrate/20130905072654_add_time_zone_to_user.rb new file mode 100644 index 0000000..8f381a2 --- /dev/null +++ b/db/migrate/20130905072654_add_time_zone_to_user.rb @@ -0,0 +1,5 @@ +class AddTimeZoneToUser < ActiveRecord::Migration + def change + add_column :users, :time_zone, :string + end +end diff --git a/db/migrate/20130905072700_devise_create_admins.rb b/db/migrate/20130905072700_devise_create_admins.rb new file mode 100644 index 0000000..3dca553 --- /dev/null +++ b/db/migrate/20130905072700_devise_create_admins.rb @@ -0,0 +1,46 @@ +class DeviseCreateAdmins < ActiveRecord::Migration + def change + create_table(:admins) 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 :admins, :email, :unique => true + add_index :admins, :reset_password_token, :unique => true + # add_index :admins, :confirmation_token, :unique => true + # add_index :admins, :unlock_token, :unique => true + # add_index :admins, :authentication_token, :unique => true + end +end diff --git a/db/seeds.rb b/db/seeds.rb new file mode 100644 index 0000000..4edb1e8 --- /dev/null +++ b/db/seeds.rb @@ -0,0 +1,7 @@ +# 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) diff --git a/lib/application_responder.rb b/lib/application_responder.rb new file mode 100644 index 0000000..e82ed38 --- /dev/null +++ b/lib/application_responder.rb @@ -0,0 +1,8 @@ +class ApplicationResponder < ActionController::Responder + include Responders::FlashResponder + include Responders::HttpCacheResponder + + # Uncomment this responder if you want your resources to redirect to the collection + # path (index action) instead of the resource path for POST/PUT/DELETE requests. + # include Responders::CollectionResponder +end diff --git a/lib/assets/.keep b/lib/assets/.keep new file mode 100644 index 0000000..e69de29 diff --git a/lib/tasks/.keep b/lib/tasks/.keep 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/templates/rails/responders_controller/controller.rb b/lib/templates/rails/responders_controller/controller.rb new file mode 100644 index 0000000..97ce0dd --- /dev/null +++ b/lib/templates/rails/responders_controller/controller.rb @@ -0,0 +1,51 @@ +# encoding: UTF-8 +<% module_namespacing do -%> +class <%= controller_class_name %>Controller < ApplicationController + before_action :<%= "set_#{singular_table_name}" %>, only: [:show, :edit, :update, :destroy] + +<% unless options[:singleton] -%> + def index + @<%= table_name %> = <%= class_name %>.all.page(params[:page]) + respond_with(@<%= table_name %>) + end +<% end -%> + + def show + respond_with(@<%= file_name %>) + end + + def new + @<%= file_name %> = <%= orm_class.build(class_name) %> + respond_with(@<%= file_name %>) + end + + def edit + end + + def create + @<%= file_name %> = <%= orm_class.build(class_name, "#{singular_table_name}_params") %> + @<%= orm_instance.save %> + respond_with(@<%= file_name %>) + end + + def update + @<%= orm_instance.update_attributes("#{singular_table_name}_params") %> + respond_with(@<%= file_name %>) + end + + def destroy + @<%= orm_instance.destroy %> + respond_with(@<%= file_name %>) + end + + private + + def <%= "set_#{singular_table_name}" %> + @<%= file_name %> = <%= orm_class.find(class_name, "params[:id]") %> + end + + def <%= "#{singular_table_name}_params" %> + params.require(<%= ":#{singular_table_name}" %>).permit(<%= attributes.map {|a| ":#{a.name}" }.sort.join(', ') %>) + end +end +<% end -%> \ No newline at end of file diff --git a/lib/user_sanitizer.rb b/lib/user_sanitizer.rb new file mode 100644 index 0000000..edb1a89 --- /dev/null +++ b/lib/user_sanitizer.rb @@ -0,0 +1,6 @@ +class User::ParameterSanitizer < Devise::ParameterSanitizer + private + def sign_up + default_params.permit(:name, :email, :password, :password_confirmation) # TODO add other params here + end +end diff --git a/log/.keep b/log/.keep new file mode 100644 index 0000000..e69de29 diff --git a/public/404.html b/public/404.html new file mode 100644 index 0000000..a0daa0c --- /dev/null +++ b/public/404.html @@ -0,0 +1,58 @@ + + + + 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.

+
+

If you are the application owner check the logs for more information.

+ + diff --git a/public/422.html b/public/422.html new file mode 100644 index 0000000..fbb4b84 --- /dev/null +++ b/public/422.html @@ -0,0 +1,58 @@ + + + + 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.

+
+

If you are the application owner check the logs for more information.

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

We're sorry, but something went wrong.

+
+

If you are the application owner check the logs for more information.

+ + diff --git a/public/favicon.ico b/public/favicon.ico new file mode 100644 index 0000000..e69de29 diff --git a/public/robots.txt b/public/robots.txt new file mode 100644 index 0000000..1a3a5e4 --- /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/spec/controllers/.keep b/spec/controllers/.keep new file mode 100644 index 0000000..e69de29 diff --git a/spec/factories/admins.rb b/spec/factories/admins.rb new file mode 100644 index 0000000..401e8ab --- /dev/null +++ b/spec/factories/admins.rb @@ -0,0 +1,6 @@ +# Read about factories at https://github.com/thoughtbot/factory_girl + +FactoryGirl.define do + factory :admin do + end +end diff --git a/spec/factories/users.rb b/spec/factories/users.rb new file mode 100644 index 0000000..26b30ef --- /dev/null +++ b/spec/factories/users.rb @@ -0,0 +1,6 @@ +# Read about factories at https://github.com/thoughtbot/factory_girl + +FactoryGirl.define do + factory :user do + end +end diff --git a/spec/helpers/.keep b/spec/helpers/.keep new file mode 100644 index 0000000..e69de29 diff --git a/spec/lib/.keep b/spec/lib/.keep new file mode 100644 index 0000000..e69de29 diff --git a/spec/models/.keep b/spec/models/.keep new file mode 100644 index 0000000..e69de29 diff --git a/spec/models/admin_spec.rb b/spec/models/admin_spec.rb new file mode 100644 index 0000000..ccc4624 --- /dev/null +++ b/spec/models/admin_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe Admin do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb new file mode 100644 index 0000000..44032b4 --- /dev/null +++ b/spec/models/user_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe User do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb new file mode 100644 index 0000000..5b124f2 --- /dev/null +++ b/spec/spec_helper.rb @@ -0,0 +1,52 @@ +# This file is copied to spec/ when you run 'rails generate rspec:install' +ENV["RAILS_ENV"] ||= 'test' +require File.expand_path("../../config/environment", __FILE__) +require 'rspec/rails' +require 'rspec/autorun' +require 'capybara/rspec' + + +# Requires supporting ruby files with custom matchers and macros, etc, +# in spec/support/ and its subdirectories. +Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f } + +# Checks for pending migrations before tests are run. +# If you are not using ActiveRecord, you can remove this line. +ActiveRecord::Migration.check_pending! if defined?(ActiveRecord::Migration) + +RSpec.configure do |config| + # ## Mock Framework + # + # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line: + # + # config.mock_with :mocha + # config.mock_with :flexmock + # config.mock_with :rr + + # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures + config.fixture_path = "#{::Rails.root}/spec/fixtures" + + # If you're not using ActiveRecord, or you'd prefer not to run each of your + # examples within a transaction, remove the following line or assign false + # instead of true. + config.use_transactional_fixtures = true + + # If true, the base class of anonymous controllers will be inferred + # automatically. This will be the default behavior in future versions of + # rspec-rails. + config.infer_base_class_for_anonymous_controllers = false + + # Run specs in random order to surface order dependencies. If you find an + # order dependency and want to debug it, you can fix the order by providing + # the seed, which is printed after each run. + # --seed 1234 + config.order = "random" + + # Capybara DSL + config.include Capybara::DSL + + # Factory girl + config.include FactoryGirl::Syntax::Methods + + +end diff --git a/spec/support/.keep b/spec/support/.keep new file mode 100644 index 0000000..e69de29 diff --git a/spec/views/.keep b/spec/views/.keep new file mode 100644 index 0000000..e69de29 diff --git a/vendor/assets/javascripts/.keep b/vendor/assets/javascripts/.keep new file mode 100644 index 0000000..e69de29 diff --git a/vendor/assets/stylesheets/.keep b/vendor/assets/stylesheets/.keep new file mode 100644 index 0000000..e69de29