From 2f427ae5b9d6534e008a670a7a731ca5ce45a6e7 Mon Sep 17 00:00:00 2001 From: Sunandar Date: Tue, 24 Jan 2017 17:45:12 +0630 Subject: [PATCH] add new file --- Gemfile | 14 ++++++- Gemfile.lock | 46 +++++++++++++++++++++-- app/assets/javascripts/application.js | 2 + app/assets/stylesheets/application.css | 15 -------- app/controllers/application_controller.rb | 20 +++++++++- app/views/layouts/application.html.erb | 22 +++++++---- config/application.rb | 3 ++ config/database.yml | 7 ++-- config/environments/development.rb | 2 +- config/environments/test.rb | 1 + config/routes.rb | 31 ++++++++++++++- 11 files changed, 130 insertions(+), 33 deletions(-) delete mode 100644 app/assets/stylesheets/application.css diff --git a/Gemfile b/Gemfile index 4aa8f6b..7b7be0b 100644 --- a/Gemfile +++ b/Gemfile @@ -4,7 +4,7 @@ source 'https://rubygems.org' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '~> 5.0.0', '>= 5.0.0.1' # Use sqlite3 as the database for Active Record -gem 'sqlite3' +# gem 'sqlite3' # Use Puma as the app server gem 'puma', '~> 3.0' # Use SCSS for stylesheets @@ -16,6 +16,10 @@ gem 'coffee-rails', '~> 4.2' # See https://github.com/rails/execjs#readme for more supported runtimes # gem 'therubyracer', platforms: :ruby +platform :ruby do + gem 'pg' +end + # Use jquery as the JavaScript library gem 'jquery-rails' # Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks @@ -30,6 +34,14 @@ gem 'jbuilder', '~> 2.5' # Use Capistrano for deployment # gem 'capistrano-rails', group: :development +gem 'devise' +gem 'devise_uid' +gem 'bcrypt', '~> 3.1.7' +gem 'simple_form' +gem 'kaminari' +gem 'to_csv-rails' +gem 'bootstrap-multiselect-rails' + group :development, :test do # Call 'byebug' anywhere in the code to stop execution and get a debugger console gem 'byebug', platform: :mri diff --git a/Gemfile.lock b/Gemfile.lock index 7626de3..7dc7332 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -39,6 +39,9 @@ GEM minitest (~> 5.1) tzinfo (~> 1.1) arel (7.1.4) + bcrypt (3.1.11) + bootstrap-multiselect-rails (0.9.9) + rails (>= 4.0.0) builder (3.2.3) byebug (9.0.6) coffee-rails (4.2.1) @@ -50,6 +53,15 @@ GEM coffee-script-source (1.12.2) concurrent-ruby (1.0.4) debug_inspector (0.0.2) + devise (4.2.0) + bcrypt (~> 3.0) + orm_adapter (~> 0.1) + railties (>= 4.1.0, < 5.1) + responders + warden (~> 1.2.3) + devise_uid (0.1.1) + devise (>= 3.0.0) + railties (>= 3.0) erubis (2.7.0) execjs (2.7.0) ffi (1.9.17) @@ -63,6 +75,18 @@ GEM rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) + kaminari (1.0.1) + activesupport (>= 4.1.0) + kaminari-actionview (= 1.0.1) + kaminari-activerecord (= 1.0.1) + kaminari-core (= 1.0.1) + kaminari-actionview (1.0.1) + actionview + kaminari-core (= 1.0.1) + kaminari-activerecord (1.0.1) + activerecord + kaminari-core (= 1.0.1) + kaminari-core (1.0.1) listen (3.0.8) rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) @@ -80,6 +104,8 @@ GEM nio4r (1.2.1) nokogiri (1.7.0.1) mini_portile2 (~> 2.1.0) + orm_adapter (0.5.0) + pg (0.19.0) puma (3.6.2) rack (2.0.1) rack-test (0.6.3) @@ -111,6 +137,8 @@ GEM rb-fsevent (0.9.8) rb-inotify (0.9.7) ffi (>= 0.5.0) + responders (2.3.0) + railties (>= 4.2.0, < 5.1) sass (3.4.23) sass-rails (5.0.6) railties (>= 4.0.0, < 6) @@ -118,6 +146,9 @@ GEM sprockets (>= 2.8, < 4.0) sprockets-rails (>= 2.0, < 4.0) tilt (>= 1.1, < 3) + simple_form (3.4.0) + actionpack (> 4, < 5.1) + activemodel (> 4, < 5.1) spring (2.0.0) activesupport (>= 4.2) spring-watcher-listen (2.0.1) @@ -130,10 +161,10 @@ GEM actionpack (>= 4.0) activesupport (>= 4.0) sprockets (>= 3.0.0) - sqlite3 (1.3.13) thor (0.19.4) thread_safe (0.3.5) tilt (2.0.5) + to_csv-rails (0.1.5) turbolinks (5.0.1) turbolinks-source (~> 5) turbolinks-source (5.0.0) @@ -141,6 +172,8 @@ GEM thread_safe (~> 0.1) uglifier (3.0.4) execjs (>= 0.3.0, < 3) + warden (1.2.6) + rack (>= 1.0) web-console (3.4.0) actionview (>= 5.0) activemodel (>= 5.0) @@ -154,21 +187,28 @@ PLATFORMS ruby DEPENDENCIES + bcrypt (~> 3.1.7) + bootstrap-multiselect-rails byebug coffee-rails (~> 4.2) + devise + devise_uid jbuilder (~> 2.5) jquery-rails + kaminari listen (~> 3.0.5) + pg puma (~> 3.0) rails (~> 5.0.0, >= 5.0.0.1) sass-rails (~> 5.0) + simple_form spring spring-watcher-listen (~> 2.0.0) - sqlite3 + to_csv-rails turbolinks (~> 5) tzinfo-data uglifier (>= 1.3.0) web-console BUNDLED WITH - 1.13.6 + 1.13.7 diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index b12018d..29f4a47 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -13,4 +13,6 @@ //= require jquery //= require jquery_ujs //= require turbolinks +//= require bootstrap.v4a2.min +//= require bootstrap-multiselect //= require_tree . diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css deleted file mode 100644 index 0ebd7fe..0000000 --- a/app/assets/stylesheets/application.css +++ /dev/null @@ -1,15 +0,0 @@ -/* - * 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 any plugin's vendor/assets/stylesheets directory 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 bottom of the - * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS - * files in this directory. Styles in this file should be added after the last require_* statement. - * It is generally better to create a new file per style scope. - * - *= require_tree . - *= require_self - */ diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 1c07694..08b5105 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,3 +1,21 @@ class ApplicationController < ActionController::Base - protect_from_forgery with: :exception + protect_from_forgery with: :exception + helper_method :current_member, :logged_in?, :resource_name, :resource, :devise_mapping + + def logged_in? + current_member + end + def after_sign_in_path_for(resource) + dashboard_path + end + def resource_name + :member + end + def resource + @resource ||= Member.new + end + + def devise_mapping + @devise_mapping ||= Devise.mappings[:member] + end end diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 8c79e3f..ce5d9db 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -1,14 +1,20 @@ - + - NemoEncoder + + + + <%= content_for?(:title) ? yield(:title) : "Nemo Encoder" %> <%= csrf_meta_tags %> - - <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %> - <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %> + <%= stylesheet_link_tag 'application', media: 'all' %> + <%= javascript_include_tag 'application', 'data-turbolinks-eval' => true %> + - - <%= yield %> + <%= render "layouts/navigation" %> +
+
+ <%= yield %> +
- + \ No newline at end of file diff --git a/config/application.rb b/config/application.rb index 39d1278..31edef7 100644 --- a/config/application.rb +++ b/config/application.rb @@ -11,5 +11,8 @@ module NemoEncoder # 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. + config.before_initialize do + Rails.configuration.nemoencoder_configuration = YAML.load_file("#{Rails.root}/config/config.yml") + end end end diff --git a/config/database.yml b/config/database.yml index 1c1a37c..699bc9c 100644 --- a/config/database.yml +++ b/config/database.yml @@ -5,20 +5,21 @@ # gem 'sqlite3' # default: &default - adapter: sqlite3 + adapter: postgresql pool: 5 timeout: 5000 development: <<: *default - database: db/development.sqlite3 + database: nemo_encoder + username: nda # 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: <<: *default - database: db/test.sqlite3 + database: nemo_encoder production: <<: *default diff --git a/config/environments/development.rb b/config/environments/development.rb index 6f71970..be1ac98 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -44,7 +44,7 @@ Rails.application.configure do # Suppress logger output for asset requests. config.assets.quiet = true - + config.action_mailer.default_url_options = { host: 'localhost', port: 3001 } # Raises error for missing translations # config.action_view.raise_on_missing_translations = true diff --git a/config/environments/test.rb b/config/environments/test.rb index 30587ef..3534cd8 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -36,6 +36,7 @@ Rails.application.configure do # Print deprecation notices to the stderr. config.active_support.deprecation = :stderr + config.action_mailer.default_url_options = { host: 'localhost', port: 3001 } # Raises error for missing translations # config.action_view.raise_on_missing_translations = true diff --git a/config/routes.rb b/config/routes.rb index 787824f..c9e633c 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,3 +1,32 @@ Rails.application.routes.draw do + + # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html -end + root :to => 'home#index' + get "dashboard", to: "home#dashboard", as: "dashboard" + + resources :batches,:only =>[:index] + devise_for :members + resources :batch_line_items,:only =>[:index,:create] + resources :users + + #users + get 'check_registered_email' => "users#check_registered_email" + #Encoder + match 'batch_line_items/export' => 'batch_line_items#create', :as => 'export', :via => :post + + namespace :api, defaults: {format: :json} do + #login + post "auth/login" =>"auth#login" + post "auth/logout" =>"auth#logout" + + #Encoder + post "batch_line_items/register" =>"batch_line_items#register" + + #Batch + post "batches" => "batches#create" + post "batches/end" => "batches#batch_end" + get "batches/resume_batch" =>"batches#resume_batch" + get "batches/batch_progress_list" =>"batches#batch_progress_list" + end +end \ No newline at end of file