├── .babelrc ├── .editorconfig ├── .eslintignore ├── .eslintrc.js ├── .gitignore ├── Gemfile ├── Gemfile.lock ├── README.md ├── Rakefile ├── app ├── assets │ ├── config │ │ └── manifest.js │ ├── images │ │ ├── dutch.gif │ │ ├── favicon.ico │ │ ├── favicon.png │ │ ├── large.jpg │ │ ├── rails.png │ │ └── ruby-red.png │ ├── javascripts │ │ ├── application.js │ │ ├── cable.js │ │ ├── channels │ │ │ └── .keep │ │ ├── pages.coffee │ │ └── posts.coffee │ └── stylesheets │ │ ├── _defaults.scss │ │ ├── application.css │ │ └── styles.scss ├── channels │ └── application_cable │ │ ├── channel.rb │ │ └── connection.rb ├── controllers │ ├── application_controller.rb │ ├── concerns │ │ └── .keep │ ├── pages_controller.rb │ └── posts_controller.rb ├── helpers │ ├── application_helper.rb │ ├── pages_helper.rb │ └── posts_helper.rb ├── jobs │ └── application_job.rb ├── mailers │ └── application_mailer.rb ├── models │ ├── application_record.rb │ ├── concerns │ │ └── .keep │ └── post.rb └── views │ ├── layouts │ ├── application.html.erb │ ├── mailer.html.erb │ └── mailer.text.erb │ ├── pages │ ├── about.html.erb │ └── index.html.erb │ ├── partials │ ├── _emssg.html.erb │ └── _header.html.erb │ └── posts │ ├── edit.html.erb │ ├── index.html.erb │ ├── new.html.erb │ └── show.html.erb ├── bin ├── bundle ├── rails ├── rake ├── setup ├── update └── yarn ├── config.ru ├── config ├── application.rb ├── boot.rb ├── cable.yml ├── database.yml ├── environment.rb ├── environments │ ├── development.rb │ ├── production.rb │ └── test.rb ├── initializers │ ├── application_controller_renderer.rb │ ├── assets.rb │ ├── backtrace_silencers.rb │ ├── cookies_serializer.rb │ ├── filter_parameter_logging.rb │ ├── inflections.rb │ ├── mime_types.rb │ └── wrap_parameters.rb ├── locales │ └── en.yml ├── puma.rb ├── routes.rb └── secrets.yml ├── db.sql ├── db ├── migrate │ └── 20170913110049_create_posts.rb ├── schema.rb └── seeds.rb ├── lib ├── assets │ └── .keep └── tasks │ └── .keep ├── log └── .keep ├── package-lock.json ├── package.json ├── public ├── 404.html ├── 422.html ├── 500.html ├── js │ ├── dist │ │ └── bundle.js │ └── src │ │ └── main.js └── robots.txt ├── screenshots ├── Snap 2017-09-15 at 20.52.14.png ├── Snap 2017-09-15 at 20.52.25.png ├── Snap 2017-09-15 at 20.53.58.png └── Snap 2017-09-15 at 20.58.56.png ├── test ├── application_system_test_case.rb ├── controllers │ ├── .keep │ ├── pages_controller_test.rb │ └── posts_controller_test.rb ├── fixtures │ ├── .keep │ ├── files │ │ └── .keep │ └── posts.yml ├── helpers │ └── .keep ├── integration │ └── .keep ├── mailers │ └── .keep ├── models │ ├── .keep │ └── post_test.rb ├── system │ └── .keep └── test_helper.rb ├── tmp └── .keep ├── vendor └── .keep ├── webpack.config.js └── yarn.lock /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | "env" 4 | ] 5 | } -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # http.editorconfig.org 2 | root = true 3 | 4 | [*] 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | charset = utf8 9 | trim_trailing_whitespace = true 10 | insert_final_newline = true 11 | 12 | [*.md] 13 | trim_trailing_whitespace = false -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | .vscode/ 2 | node_modules/ 3 | app/assets/javascripts/* 4 | public/js/dist/* 5 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | "env": { 3 | "browser": true, 4 | "commonjs": true, 5 | "es6": true 6 | }, 7 | "extends": "eslint:recommended", 8 | "parserOptions": { 9 | "sourceType": "module" 10 | }, 11 | "rules": { 12 | "indent": [ 13 | "error", 14 | 2 15 | ], 16 | "quotes": [ 17 | "error", 18 | "single" 19 | ], 20 | "semi": [ 21 | "error", 22 | "never" 23 | ], 24 | 'no-console': 'off', 25 | 'no-ternary': 0, 26 | 'no-nested-ternary': 0, 27 | 'multiline-ternary': ["error", "never"] 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files for more about ignoring files. 2 | # 3 | # If you find yourself ignoring temporary files generated by your text editor 4 | # or operating system, you probably want to add a global ignore instead: 5 | # git config --global core.excludesfile '~/.gitignore_global' 6 | 7 | # Ignore bundler config. 8 | /.bundle 9 | 10 | # Ignore all logfiles and tempfiles. 11 | /log/* 12 | /tmp/* 13 | !/log/.keep 14 | !/tmp/.keep 15 | 16 | /node_modules 17 | /yarn-error.log 18 | 19 | .byebug_history 20 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | git_source(:github) do |repo_name| 4 | repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/") 5 | "https://github.com/#{repo_name}.git" 6 | end 7 | 8 | # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' 9 | gem 'rails', '~> 5.1.4' 10 | # Use mysql as the database for Active Record 11 | gem 'mysql2', '0.3.21' 12 | # Use Puma as the app server 13 | gem 'puma', '~> 3.7' 14 | # Use SCSS for stylesheets 15 | gem 'sass-rails', '~> 5.0' 16 | # Use Uglifier as compressor for JavaScript assets 17 | gem 'uglifier', '>= 1.3.0' 18 | # See https://github.com/rails/execjs#readme for more supported runtimes 19 | # gem 'therubyracer', platforms: :ruby 20 | 21 | # Use CoffeeScript for .coffee assets and views 22 | gem 'coffee-rails', '~> 4.2' 23 | # Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks 24 | gem 'turbolinks', '~> 5' 25 | # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder 26 | gem 'jbuilder', '~> 2.5' 27 | # Use Redis adapter to run Action Cable in production 28 | # gem 'redis', '~> 3.0' 29 | # Use ActiveModel has_secure_password 30 | # gem 'bcrypt', '~> 3.1.7' 31 | 32 | # Use Capistrano for deployment 33 | # gem 'capistrano-rails', group: :development 34 | 35 | group :development, :test do 36 | # Call 'byebug' anywhere in the code to stop execution and get a debugger console 37 | gem 'byebug', platforms: [:mri, :mingw, :x64_mingw] 38 | # Adds support for Capybara system testing and selenium driver 39 | gem 'capybara', '~> 2.13' 40 | gem 'selenium-webdriver' 41 | end 42 | 43 | group :development do 44 | # Access an IRB console on exception pages or by using <%= console %> anywhere in the code. 45 | gem 'web-console', '>= 3.3.0' 46 | end 47 | 48 | # Windows does not include zoneinfo files, so bundle the tzinfo-data gem 49 | gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] 50 | -------------------------------------------------------------------------------- /Gemfile.lock: -------------------------------------------------------------------------------- 1 | GEM 2 | remote: https://rubygems.org/ 3 | specs: 4 | actioncable (5.1.4) 5 | actionpack (= 5.1.4) 6 | nio4r (~> 2.0) 7 | websocket-driver (~> 0.6.1) 8 | actionmailer (5.1.4) 9 | actionpack (= 5.1.4) 10 | actionview (= 5.1.4) 11 | activejob (= 5.1.4) 12 | mail (~> 2.5, >= 2.5.4) 13 | rails-dom-testing (~> 2.0) 14 | actionpack (5.1.4) 15 | actionview (= 5.1.4) 16 | activesupport (= 5.1.4) 17 | rack (~> 2.0) 18 | rack-test (>= 0.6.3) 19 | rails-dom-testing (~> 2.0) 20 | rails-html-sanitizer (~> 1.0, >= 1.0.2) 21 | actionview (5.1.4) 22 | activesupport (= 5.1.4) 23 | builder (~> 3.1) 24 | erubi (~> 1.4) 25 | rails-dom-testing (~> 2.0) 26 | rails-html-sanitizer (~> 1.0, >= 1.0.3) 27 | activejob (5.1.4) 28 | activesupport (= 5.1.4) 29 | globalid (>= 0.3.6) 30 | activemodel (5.1.4) 31 | activesupport (= 5.1.4) 32 | activerecord (5.1.4) 33 | activemodel (= 5.1.4) 34 | activesupport (= 5.1.4) 35 | arel (~> 8.0) 36 | activesupport (5.1.4) 37 | concurrent-ruby (~> 1.0, >= 1.0.2) 38 | i18n (~> 0.7) 39 | minitest (~> 5.1) 40 | tzinfo (~> 1.1) 41 | addressable (2.5.2) 42 | public_suffix (>= 2.0.2, < 4.0) 43 | arel (8.0.0) 44 | bindex (0.5.0) 45 | builder (3.2.3) 46 | byebug (9.1.0) 47 | capybara (2.15.1) 48 | addressable 49 | mini_mime (>= 0.1.3) 50 | nokogiri (>= 1.3.3) 51 | rack (>= 1.0.0) 52 | rack-test (>= 0.5.4) 53 | xpath (~> 2.0) 54 | childprocess (0.7.1) 55 | ffi (~> 1.0, >= 1.0.11) 56 | coffee-rails (4.2.2) 57 | coffee-script (>= 2.2.0) 58 | railties (>= 4.0.0) 59 | coffee-script (2.4.1) 60 | coffee-script-source 61 | execjs 62 | coffee-script-source (1.12.2) 63 | concurrent-ruby (1.0.5) 64 | erubi (1.6.1) 65 | execjs (2.7.0) 66 | ffi (1.9.18-x86-mingw32) 67 | globalid (0.4.0) 68 | activesupport (>= 4.2.0) 69 | i18n (0.8.6) 70 | jbuilder (2.7.0) 71 | activesupport (>= 4.2.0) 72 | multi_json (>= 1.2) 73 | loofah (2.0.3) 74 | nokogiri (>= 1.5.9) 75 | mail (2.6.6) 76 | mime-types (>= 1.16, < 4) 77 | method_source (0.8.2) 78 | mime-types (3.1) 79 | mime-types-data (~> 3.2015) 80 | mime-types-data (3.2016.0521) 81 | mini_mime (0.1.4) 82 | mini_portile2 (2.2.0) 83 | minitest (5.10.3) 84 | multi_json (1.12.2) 85 | mysql2 (0.3.21-x86-mingw32) 86 | nio4r (2.1.0) 87 | nokogiri (1.8.0-x86-mingw32) 88 | mini_portile2 (~> 2.2.0) 89 | public_suffix (3.0.0) 90 | puma (3.10.0) 91 | rack (2.0.3) 92 | rack-test (0.7.0) 93 | rack (>= 1.0, < 3) 94 | rails (5.1.4) 95 | actioncable (= 5.1.4) 96 | actionmailer (= 5.1.4) 97 | actionpack (= 5.1.4) 98 | actionview (= 5.1.4) 99 | activejob (= 5.1.4) 100 | activemodel (= 5.1.4) 101 | activerecord (= 5.1.4) 102 | activesupport (= 5.1.4) 103 | bundler (>= 1.3.0) 104 | railties (= 5.1.4) 105 | sprockets-rails (>= 2.0.0) 106 | rails-dom-testing (2.0.3) 107 | activesupport (>= 4.2.0) 108 | nokogiri (>= 1.6) 109 | rails-html-sanitizer (1.0.3) 110 | loofah (~> 2.0) 111 | railties (5.1.4) 112 | actionpack (= 5.1.4) 113 | activesupport (= 5.1.4) 114 | method_source 115 | rake (>= 0.8.7) 116 | thor (>= 0.18.1, < 2.0) 117 | rake (12.1.0) 118 | rb-fsevent (0.10.2) 119 | rb-inotify (0.9.10) 120 | ffi (>= 0.5.0, < 2) 121 | rubyzip (1.2.1) 122 | sass (3.5.1) 123 | sass-listen (~> 4.0.0) 124 | sass-listen (4.0.0) 125 | rb-fsevent (~> 0.9, >= 0.9.4) 126 | rb-inotify (~> 0.9, >= 0.9.7) 127 | sass-rails (5.0.6) 128 | railties (>= 4.0.0, < 6) 129 | sass (~> 3.1) 130 | sprockets (>= 2.8, < 4.0) 131 | sprockets-rails (>= 2.0, < 4.0) 132 | tilt (>= 1.1, < 3) 133 | selenium-webdriver (3.5.2) 134 | childprocess (~> 0.5) 135 | rubyzip (~> 1.0) 136 | sprockets (3.7.1) 137 | concurrent-ruby (~> 1.0) 138 | rack (> 1, < 3) 139 | sprockets-rails (3.2.1) 140 | actionpack (>= 4.0) 141 | activesupport (>= 4.0) 142 | sprockets (>= 3.0.0) 143 | thor (0.20.0) 144 | thread_safe (0.3.6) 145 | tilt (2.0.8) 146 | turbolinks (5.0.1) 147 | turbolinks-source (~> 5) 148 | turbolinks-source (5.0.3) 149 | tzinfo (1.2.3) 150 | thread_safe (~> 0.1) 151 | tzinfo-data (1.2017.2) 152 | tzinfo (>= 1.0.0) 153 | uglifier (3.2.0) 154 | execjs (>= 0.3.0, < 3) 155 | web-console (3.5.1) 156 | actionview (>= 5.0) 157 | activemodel (>= 5.0) 158 | bindex (>= 0.4.0) 159 | railties (>= 5.0) 160 | websocket-driver (0.6.5) 161 | websocket-extensions (>= 0.1.0) 162 | websocket-extensions (0.1.2) 163 | xpath (2.1.0) 164 | nokogiri (~> 1.3) 165 | 166 | PLATFORMS 167 | x86-mingw32 168 | 169 | DEPENDENCIES 170 | byebug 171 | capybara (~> 2.13) 172 | coffee-rails (~> 4.2) 173 | jbuilder (~> 2.5) 174 | mysql2 (= 0.3.21) 175 | puma (~> 3.7) 176 | rails (~> 5.1.4) 177 | sass-rails (~> 5.0) 178 | selenium-webdriver 179 | turbolinks (~> 5) 180 | tzinfo-data 181 | uglifier (>= 1.3.0) 182 | web-console (>= 3.3.0) 183 | 184 | BUNDLED WITH 185 | 1.13.7 186 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Rails-Notes-App 2 | A Post-App created with Rails!! 3 | 4 | **No longer maintained.** 5 | 6 | # Quick Links 7 | 1. [Screenshots](#screenshots) 8 | 2. [Usage](#usage) 9 | 10 | # Screenshots 11 |  12 |  13 |  14 |  15 | 16 | # Usage 17 | 1. First install all the dependencies. 18 | ```javascript 19 | bundle install 20 | npm install [OR] yarn 21 | ``` 22 | 2. Open PHPMyAdmin, create a `DB` named `rails-notes-app` & import `db.sql` file. 23 | 3. Create the following environment variables: 24 | ```javascript 25 | RAILS_DB_PASSWORD="DB PASSWORD" 26 | RAILS_SOCKET="MySQL Socket" 27 | ``` 28 | 4. Start the server 29 | ```javascript 30 | rails s 31 | ``` 32 | 5. Now, open it in browser: 33 | ```javascript 34 | localhost:3000 35 | ``` 36 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | # Add your own tasks in files placed in lib/tasks ending in .rake, 2 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. 3 | 4 | require_relative 'config/application' 5 | 6 | Rails.application.load_tasks 7 | -------------------------------------------------------------------------------- /app/assets/config/manifest.js: -------------------------------------------------------------------------------- 1 | //= link_tree ../images 2 | //= link_directory ../javascripts .js 3 | //= link_directory ../stylesheets .css 4 | -------------------------------------------------------------------------------- /app/assets/images/dutch.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yTakkar/Rails-Notes-App/857bdffc198a938eff8da6f23594fb62833ef66e/app/assets/images/dutch.gif -------------------------------------------------------------------------------- /app/assets/images/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yTakkar/Rails-Notes-App/857bdffc198a938eff8da6f23594fb62833ef66e/app/assets/images/favicon.ico -------------------------------------------------------------------------------- /app/assets/images/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yTakkar/Rails-Notes-App/857bdffc198a938eff8da6f23594fb62833ef66e/app/assets/images/favicon.png -------------------------------------------------------------------------------- /app/assets/images/large.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yTakkar/Rails-Notes-App/857bdffc198a938eff8da6f23594fb62833ef66e/app/assets/images/large.jpg -------------------------------------------------------------------------------- /app/assets/images/rails.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yTakkar/Rails-Notes-App/857bdffc198a938eff8da6f23594fb62833ef66e/app/assets/images/rails.png -------------------------------------------------------------------------------- /app/assets/images/ruby-red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yTakkar/Rails-Notes-App/857bdffc198a938eff8da6f23594fb62833ef66e/app/assets/images/ruby-red.png -------------------------------------------------------------------------------- /app/assets/javascripts/application.js: -------------------------------------------------------------------------------- 1 | // This is a manifest file that'll be compiled into application.js, which will include all the files 2 | // listed below. 3 | // 4 | // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, or any plugin's 5 | // vendor/assets/javascripts directory can be referenced here using a relative path. 6 | // 7 | // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the 8 | // compiled file. JavaScript code in this file should be added after the last require_* statement. 9 | // 10 | // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details 11 | // about supported directives. 12 | // 13 | //= require rails-ujs 14 | //= require turbolinks 15 | //= require_tree . 16 | -------------------------------------------------------------------------------- /app/assets/javascripts/cable.js: -------------------------------------------------------------------------------- 1 | // Action Cable provides the framework to deal with WebSockets in Rails. 2 | // You can generate new channels where WebSocket features live using the `rails generate channel` command. 3 | // 4 | //= require action_cable 5 | //= require_self 6 | //= require_tree ./channels 7 | 8 | (function() { 9 | this.App || (this.App = {}); 10 | 11 | App.cable = ActionCable.createConsumer(); 12 | 13 | }).call(this); 14 | -------------------------------------------------------------------------------- /app/assets/javascripts/channels/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yTakkar/Rails-Notes-App/857bdffc198a938eff8da6f23594fb62833ef66e/app/assets/javascripts/channels/.keep -------------------------------------------------------------------------------- /app/assets/javascripts/pages.coffee: -------------------------------------------------------------------------------- 1 | # Place all the behaviors and hooks related to the matching controller here. 2 | # All this logic will automatically be available in application.js. 3 | # You can use CoffeeScript in this file: http://coffeescript.org/ 4 | -------------------------------------------------------------------------------- /app/assets/javascripts/posts.coffee: -------------------------------------------------------------------------------- 1 | # Place all the behaviors and hooks related to the matching controller here. 2 | # All this logic will automatically be available in application.js. 3 | # You can use CoffeeScript in this file: http://coffeescript.org/ 4 | -------------------------------------------------------------------------------- /app/assets/stylesheets/_defaults.scss: -------------------------------------------------------------------------------- 1 | $a: #2895F1; 2 | $family: 'Open Sans', 'Roboto', Tahoma, arial, sans-serif; 3 | $dark: #1b2733; 4 | $fb: #fbfbfb; 5 | $ff: #fff; 6 | $ee: #eee; 7 | $pric: #1b9be9; 8 | $d_light: #66757f; 9 | $header: #f9f9f9; 10 | $header_border: #f7f5f5; 11 | $second_border: #f7f9fa; 12 | $third-border: #f6f7f9; 13 | 14 | @mixin center{ 15 | position: absolute; 16 | top: 50%; 17 | left: 50%; 18 | transform: translate(-50%, -50%); 19 | } 20 | 21 | *{ 22 | padding: 0px; 23 | margin: 0px; 24 | } 25 | 26 | body{ 27 | font-family: $family; 28 | background: $fb; 29 | font-size: 13px; 30 | color: #3d464d; 31 | font-weight: normal; 32 | } 33 | 34 | a{ 35 | text-decoration: none; 36 | color: $a; 37 | outline: none; 38 | } 39 | 40 | i{ 41 | pointer-events: none; 42 | } 43 | 44 | hr{ 45 | border: 0; 46 | border-top: 1px solid #c1c7cd; 47 | } 48 | 49 | 50 | .a_disabled{ 51 | cursor: not-allowed !important; 52 | pointer-events: none !important; 53 | background: #6ab9e8 !important; 54 | } 55 | 56 | .sec_btn_disabled{ 57 | cursor: not-allowed !important; 58 | pointer-events: none !important; 59 | color: #d8c3c3 !important; 60 | } 61 | 62 | input[type="text"],input[type="email"],input[type="password"],textarea{ 63 | border: 1px solid $ee; 64 | border-radius: 4px; 65 | font-family: $family; 66 | color: #0b867a; 67 | outline: none; 68 | padding: 5px 5px; 69 | } 70 | 71 | input[type="submit"]::-moz-focus-inner, input[type="button"]::-moz-focus-inner{ 72 | padding: 0 !important; 73 | border: 0 none !important; 74 | } 75 | 76 | textarea{ 77 | word-break: break-all; 78 | font-size: 13px; 79 | } 80 | 81 | input[type="text"]:focus,input[type="password"]:focus, input[type="email"]:focus, textarea:focus{ 82 | border: 1px solid #56b4ef !important; 83 | box-shadow: 0px 0px 5px 1px #c8def0; 84 | } 85 | 86 | input[type="submit"],input[type="button"],.pri_btn{ 87 | font-weight: 600; 88 | background: $pric; 89 | border: 1px solid $pric; 90 | color: $ff;; 91 | border-radius: 3px; 92 | cursor: pointer; 93 | outline: none; 94 | &:hover{ opacity: .9; } 95 | &:focus{ background: #198bd0; } 96 | } 97 | 98 | input[type="submit"]:disabled, input[type="button"]:disabled{ 99 | background: #6ab9e8 !important; 100 | cursor: auto !important; 101 | &:hover{ opacity: 1 !important; } 102 | } 103 | 104 | .sec_btn{ 105 | border: 1px solid $ee; 106 | background: $fb; 107 | color: $dark; 108 | border-radius: 3px; 109 | cursor: pointer; 110 | font-weight: 600; 111 | outline: none; 112 | &:hover{ 113 | color: $dark; 114 | background-color: #fff7f7; 115 | } 116 | &:focus{ 117 | color: $dark; 118 | background: #f7ebeb; 119 | } 120 | } 121 | 122 | .home_last_mssg{ 123 | position: relative; 124 | border-radius: 4px; 125 | background:$ff; 126 | border: 1px solid $header_border; 127 | font-size: 14px; 128 | text-align: center; 129 | padding: 10px; 130 | cursor: default; 131 | & img{ 132 | position: relative; 133 | text-align: center; 134 | width: 150px; 135 | display: block; 136 | left: 48%; 137 | transform: translate(-50%); 138 | } 139 | & span{ 140 | position: relative; 141 | text-align: center; 142 | display: block; 143 | left: -5px; 144 | } 145 | } 146 | -------------------------------------------------------------------------------- /app/assets/stylesheets/application.css: -------------------------------------------------------------------------------- 1 | /* 2 | * This is a manifest file that'll be compiled into application.css, which will include all the files 3 | * listed below. 4 | * 5 | * Any CSS and SCSS file within this directory, lib/assets/stylesheets, or any plugin's 6 | * vendor/assets/stylesheets directory can be referenced here using a relative path. 7 | * 8 | * You're free to add application-wide styles to this file and they'll appear at the bottom of the 9 | * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS 10 | * files in this directory. Styles in this file should be added after the last require_* statement. 11 | * It is generally better to create a new file per style scope. 12 | * 13 | *= require_tree . 14 | *= require_self 15 | */ 16 | -------------------------------------------------------------------------------- /app/assets/stylesheets/styles.scss: -------------------------------------------------------------------------------- 1 | @import 'defaults'; 2 | 3 | .header_loggedin{ 4 | background: $ff; 5 | box-shadow: 0 0 5px rgba(0,0,0,0.1); 6 | position: fixed; 7 | width: 100%; 8 | height: 45px; 9 | background: white; 10 | z-index: 2; 11 | top: 0px; 12 | 13 | & a{ 14 | font-size: 14px; 15 | color: $dark; 16 | margin-left: 7px; 17 | padding: 5px 12px; 18 | border-radius: 3px; 19 | display: inline-block; 20 | 21 | &:hover{ background: $second_border; } 22 | 23 | &:focus{ background: $second_border; } 24 | 25 | } 26 | 27 | & .left{ 28 | display: inline-block; 29 | position: relative; 30 | top: 8px; 31 | left: 25px; 32 | } 33 | 34 | & .right { 35 | display: inline-block; 36 | position: absolute; 37 | top: 8px; 38 | right: 3%; 39 | } 40 | 41 | } 42 | 43 | .notes_wrapper{ margin-top: 70px; } 44 | 45 | .note{ 46 | background: $ff; 47 | padding: 10px; 48 | display: block; 49 | font-size: 14px; 50 | border: 1px solid $header_border; 51 | border-radius: 3px; 52 | margin-bottom: 10px; 53 | overflow: auto; 54 | 55 | &:hover{ 56 | border-color: $ee; 57 | } 58 | 59 | & .note_header{ 60 | margin-bottom: 7px; 61 | 62 | & img{ 63 | height: 31px; 64 | width: 31px; 65 | border-radius: 50%; 66 | display: inline-block; 67 | } 68 | 69 | & .note_h_left{ 70 | display: inline-block; 71 | margin-left: 5px; 72 | width: 90%; 73 | 74 | & .note_username{ 75 | display: block; 76 | color: $dark; 77 | font-weight: 600; 78 | position: relative; 79 | top: 2px; 80 | } 81 | 82 | & .note_time{ 83 | font-size: 13px; 84 | color: $d_light; 85 | position: relative; 86 | top: -1px; 87 | } 88 | 89 | } 90 | 91 | } 92 | 93 | & .note_title, & .note_content{ 94 | color: $dark; 95 | } 96 | 97 | & .note_title{ 98 | margin-bottom: 4px; 99 | font-weight: 600; 100 | } 101 | 102 | & .note_actions { 103 | position: relative; 104 | float: right; 105 | 106 | & a { 107 | display: inline-block; 108 | padding: 3px 10px; 109 | } 110 | 111 | } 112 | } 113 | 114 | .page_end{ 115 | padding: 10px; 116 | text-align: center; 117 | font-size: 14px; 118 | margin-top: 10px; 119 | color: $d_light; 120 | cursor: pointer; 121 | border-radius: 3px; 122 | border: 1px solid $fb; 123 | &:hover{ border: 1px solid $ee; } 124 | } 125 | 126 | .home{ 127 | position: relative; 128 | width: 607px; 129 | margin-left: 365px; 130 | margin-bottom: 60px; 131 | & .home_info{ 132 | margin-bottom: 10px; 133 | background: $ff; 134 | padding: 14px 10px; 135 | border: 1px solid $header_border; 136 | border-radius: 3px; 137 | font-size: 15px; 138 | & a{ 139 | position: absolute; 140 | right: 10px; 141 | padding: 4px 12px; 142 | top: 10px; 143 | } 144 | } 145 | } 146 | 147 | // EDIT 148 | .edit{ 149 | position: relative; 150 | width: 400px; 151 | left: 490px; 152 | font-size: 14px; 153 | top: 40px; 154 | 155 | & form > * { 156 | display: block; 157 | width: 100%; 158 | margin-top: 15px; 159 | } 160 | 161 | & form .flash { 162 | width: inherit !important; 163 | margin-top: inherit !important; 164 | } 165 | 166 | & .eb_btns{ 167 | text-align: right; 168 | 169 | & input[type="submit"]{ 170 | display: inline-block; 171 | margin-right: 38px; 172 | padding: 7px 20px; 173 | font-size: 14px; 174 | } 175 | 176 | } 177 | 178 | & .edit_span{ 179 | color: $d_light; 180 | display: block; 181 | position: relative; 182 | font-size: 14px; 183 | margin-bottom: 5px; 184 | } 185 | 186 | & .edit_info{ 187 | 188 | & img{ 189 | width: 35px; 190 | height: 35px; 191 | border-radius: 50%; 192 | position: relative; 193 | display: inline-block; 194 | } 195 | 196 | & span { 197 | position: relative; 198 | top: -12px; 199 | left: 8px; 200 | font-size: 18px; 201 | font-weight: 600; 202 | } 203 | 204 | } 205 | 206 | & input[type='text'], 207 | & input[type='email'], 208 | textarea{ 209 | width: 90%; 210 | padding: 8px; 211 | font-size: 14px; 212 | } 213 | 214 | & textarea{ 215 | height: 200px; 216 | } 217 | 218 | } 219 | 220 | // BLOG PAGE 221 | .blog{ 222 | position: relative; 223 | font-size: 14px; 224 | background: #fff; 225 | padding: 15px; 226 | border-radius: 3px; 227 | box-shadow: 0px 0px 5px 0px rgba(0,0,0,.1); 228 | top: 80px; 229 | 230 | & > * { 231 | display: block; 232 | margin-bottom: 15px; 233 | } 234 | 235 | & .blog_actions { 236 | text-align: right; 237 | margin-bottom: 0px; 238 | 239 | & a { 240 | padding: 4px 10px; 241 | display: inline-block; 242 | } 243 | } 244 | 245 | & .blog_c { 246 | 247 | & .blog_title { 248 | font-weight: 600; 249 | font-size: 17px; 250 | display: block; 251 | margin-bottom: 5px; 252 | } 253 | 254 | & .blog_content { 255 | display: block; 256 | } 257 | 258 | } 259 | 260 | 261 | } 262 | 263 | .flash{ 264 | position: fixed; 265 | background: #333; 266 | left: 2%; 267 | color: $ff; 268 | border-radius: 3px; 269 | padding: 12px 80px 12px 25px; 270 | font-size: 15px; 271 | cursor: pointer; 272 | text-align: left; 273 | z-index: 3; 274 | top: 90%; 275 | 276 | & .flash_mssg { 277 | position: relative; 278 | } 279 | 280 | & .flash_icon { 281 | position: absolute; 282 | display: inline-block; 283 | padding: 3px; 284 | border-radius: 2px; 285 | top: 10px; 286 | right: 10px; 287 | 288 | &:hover { 289 | background: #563d3d; 290 | } 291 | 292 | & i { 293 | font-size: 20px; 294 | } 295 | 296 | } 297 | 298 | } 299 | 300 | // HOME & ABOUT PAGES 301 | .welcome { 302 | text-align: center; 303 | top: 60px; 304 | position: relative; 305 | } 306 | -------------------------------------------------------------------------------- /app/channels/application_cable/channel.rb: -------------------------------------------------------------------------------- 1 | module ApplicationCable 2 | class Channel < ActionCable::Channel::Base 3 | end 4 | end 5 | -------------------------------------------------------------------------------- /app/channels/application_cable/connection.rb: -------------------------------------------------------------------------------- 1 | module ApplicationCable 2 | class Connection < ActionCable::Connection::Base 3 | end 4 | end 5 | -------------------------------------------------------------------------------- /app/controllers/application_controller.rb: -------------------------------------------------------------------------------- 1 | class ApplicationController < ActionController::Base 2 | protect_from_forgery with: :exception 3 | end 4 | -------------------------------------------------------------------------------- /app/controllers/concerns/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yTakkar/Rails-Notes-App/857bdffc198a938eff8da6f23594fb62833ef66e/app/controllers/concerns/.keep -------------------------------------------------------------------------------- /app/controllers/pages_controller.rb: -------------------------------------------------------------------------------- 1 | class PagesController < ApplicationController 2 | 3 | def index 4 | end 5 | 6 | def about 7 | end 8 | 9 | end 10 | -------------------------------------------------------------------------------- /app/controllers/posts_controller.rb: -------------------------------------------------------------------------------- 1 | class PostsController < ApplicationController 2 | 3 | def index 4 | @posts = Post.all 5 | end 6 | 7 | def show 8 | @post = Post.find(params[:id]) 9 | end 10 | 11 | def new 12 | @post = Post.new 13 | end 14 | 15 | def create 16 | @post = Post.new(post_params) 17 | if @post.save 18 | redirect_to posts_path, :notice => "Post created!!" 19 | else 20 | render 'new' 21 | end 22 | end 23 | 24 | def edit 25 | @post = Post.find(params[:id]) 26 | end 27 | 28 | def update 29 | @post = Post.find(params[:id]) 30 | if @post.update_attributes(post_params) 31 | redirect_to posts_path, :notice => "Post edited!!" 32 | else 33 | render 'edit' 34 | end 35 | end 36 | 37 | def delete 38 | @post = Post.find(params[:id]) 39 | @post.destroy 40 | redirect_to posts_path, :notice => "Post deleted!!" 41 | end 42 | 43 | private def post_params 44 | params.require(:post).permit(:title, :content) 45 | end 46 | 47 | end 48 | -------------------------------------------------------------------------------- /app/helpers/application_helper.rb: -------------------------------------------------------------------------------- 1 | module ApplicationHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/helpers/pages_helper.rb: -------------------------------------------------------------------------------- 1 | module PagesHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/helpers/posts_helper.rb: -------------------------------------------------------------------------------- 1 | module PostsHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/jobs/application_job.rb: -------------------------------------------------------------------------------- 1 | class ApplicationJob < ActiveJob::Base 2 | end 3 | -------------------------------------------------------------------------------- /app/mailers/application_mailer.rb: -------------------------------------------------------------------------------- 1 | class ApplicationMailer < ActionMailer::Base 2 | default from: 'from@example.com' 3 | layout 'mailer' 4 | end 5 | -------------------------------------------------------------------------------- /app/models/application_record.rb: -------------------------------------------------------------------------------- 1 | class ApplicationRecord < ActiveRecord::Base 2 | self.abstract_class = true 3 | end 4 | -------------------------------------------------------------------------------- /app/models/concerns/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yTakkar/Rails-Notes-App/857bdffc198a938eff8da6f23594fb62833ef66e/app/models/concerns/.keep -------------------------------------------------------------------------------- /app/models/post.rb: -------------------------------------------------------------------------------- 1 | class Post < ApplicationRecord 2 | validates :title, :content, :presence => true 3 | validates :title, :content, :length => { :minimum => 4 } 4 | validates :title, :content, :uniqueness => { :message => "already taken!!" } 5 | end 6 | -------------------------------------------------------------------------------- /app/views/layouts/application.html.erb: -------------------------------------------------------------------------------- 1 | <%= render 'partials/header' %> 2 | 3 |