7 | Site:
8 | Twitter:
9 | Location:
10 |
11 | /* THANKS */
12 | Daniel Kehoe (@rails_apps) for the RailsApps project
13 |
14 | /* SITE */
15 | Standards: HTML5, CSS3
16 | Components: jQuery
17 | Software: Ruby on Rails
18 |
19 | /* GENERATED BY */
20 | Rails Composer: http://railscomposer.com/
21 |
--------------------------------------------------------------------------------
/spec/config/aws_yml_spec.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 | # code: config/aws.yml
3 | # test: spec/config/aws_spec.rb
4 | #
5 | # source: https://github.com/VisitMeet/visitmeet/blob/master/config/aws.yml
6 | # reference: http://code.openhub.net/file?fid=20H7wxracfDRbV9KIsBs-XWrGCc&cid=cbp-nkS3ZFQ&s=&fp=304075&mp=&projSelected=true#L0
7 | # reference: https://github.com/tiy-austin-ror-jan2015/tiy-rails-template/issues/38
8 | #
9 | # tests to be written
10 |
--------------------------------------------------------------------------------
/app/views/conversations/show.html.erb:
--------------------------------------------------------------------------------
1 | <%= @conversation.subject %>
2 |
3 | <% @conversation.receipts_for(current_user).each do |receipt| %>
4 |
5 | <%= receipt.message.sender.email %> said
6 | <%= receipt.message.body %>
7 |
8 | <% end %>
9 |
10 |
11 | <%= form_tag conversation_messages_path(@conversation), method: :post do %>
12 |
13 | <%= text_area_tag :body %>
14 |
15 | <%= submit_tag %>
16 | <% end %>
17 |
--------------------------------------------------------------------------------
/app/views/devise/invitations/edit.html.erb:
--------------------------------------------------------------------------------
1 | <%= t 'devise.invitations.edit.header' %>
2 |
3 | <%= simple_form_for resource, as: resource_name, url: invitation_path(resource_name), html: { method: :put } do |f| %>
4 | <%= devise_error_messages! %>
5 | <%= f.hidden_field :invitation_token %>
6 |
7 | <%= f.input :password %>
8 | <%= f.input :password_confirmation %>
9 |
10 | <%= f.button :submit, t("devise.invitations.edit.submit_button") %>
11 | <% end %>
12 |
--------------------------------------------------------------------------------
/app/views/users/invitations/edit.html.erb:
--------------------------------------------------------------------------------
1 | <%= t 'devise.invitations.edit.header' %>
2 |
3 | <%= simple_form_for resource, as: resource_name, url: invitation_path(resource_name), html: { method: :put } do |f| %>
4 | <%= devise_error_messages! %>
5 | <%= f.hidden_field :invitation_token %>
6 |
7 | <%= f.input :password %>
8 | <%= f.input :password_confirmation %>
9 |
10 | <%= f.button :submit, t("devise.invitations.edit.submit_button") %>
11 | <% end %>
12 |
--------------------------------------------------------------------------------
/spec/factories/categories.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 | # code: spec/factories/categories.rb
3 | # test: spec/models/categories_spec.rb
4 | #
5 | # == Schema Information
6 | #
7 | # Table name: categories
8 | #
9 | # id :integer not null, primary key
10 | # name :string
11 | # created_at :datetime not null
12 | # updated_at :datetime not null
13 | #
14 | FactoryGirl.define do
15 | factory :category do
16 | name 'Foods'
17 | end
18 | end
19 |
--------------------------------------------------------------------------------
/app/views/conversations/new.html.erb:
--------------------------------------------------------------------------------
1 | New Conversation
2 | <%= form_tag conversations_path, method: :post do %>
3 |
4 | <%= select_tag :user_id, options_from_collection_for_select(@recipients, :id, :email) %>
5 |
6 |
7 | <%= text_field_tag :subject,nil, placeholder: "Subject" %>
8 |
9 |
10 |
11 | <%= text_area_tag :body, nil, placeholder: "Body" %>
12 |
13 |
14 |
15 | <%= submit_tag, "Send Message" %>
16 | <% end %>
17 |
--------------------------------------------------------------------------------
/config/exception_notification.yml:
--------------------------------------------------------------------------------
1 | # frozen_string_literal
2 | # code : config/exception_notification.yml
3 | # test : TODO: 20160423 : to be written
4 | # ref : http://edgeguides.rubyonrails.org/4_2_release_notes.html
5 | # Introduced Rails::Application.config_for to load a configuration
6 | # for the current environment.
7 | production:
8 | url: http://127.0.0.1:8080
9 | namespace: visitmeet_production
10 | development:
11 | url: http://localhost:3001
12 | namespace: visitmeet_development
13 |
--------------------------------------------------------------------------------
/app/controllers/profile_controller.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 | # app/controllers/profile_controller.rb
3 | # tests: spec/controllers/profile_controller_spec.rb
4 | #
5 | # See FAILING TESTS NOTE: spec/controllers/users_controller.rb
6 | # the above note concerns the NoMethodError: undefined method `authenticate!' for nil:NilClass
7 | #
8 | class ProfileController < ApplicationController
9 | include ActionController::Helpers
10 |
11 | def index
12 | @user = current_user
13 | end
14 | end
15 |
--------------------------------------------------------------------------------
/app/views/devise/mailer/reset_password_instructions.html.erb:
--------------------------------------------------------------------------------
1 | Hello <%= @resource.email %>!
2 |
3 | Someone has requested a link to change your password. You can do this through the link below.
4 |
5 | <%= link_to 'Change my password', edit_password_url(@resource, reset_password_token: @token) %>
6 |
7 | If you didn't request this, please ignore this email.
8 | Your password won't change until you access the link above and create a new one.
9 |
10 | <%= render 'footer.html.erb' %>
--------------------------------------------------------------------------------
/config/initializers/stripe.rb:
--------------------------------------------------------------------------------
1 | # Rails.configuration.stripe = {
2 | # :publishable_key => Rails.application.secrets.stripe_publishable_key,
3 | # :secret_key => Rails.application.secrets.stripe_secret_key
4 | # }
5 | #
6 | # Stripe.api_key = Rails.application.secrets.stripe_secret_key
7 |
8 |
9 | Rails.configuration.stripe = {
10 | :publishable_key => ENV['STRIPE_PUBLISHABLE_KEY'],
11 | :secret_key => ENV['STRIPE_API_KEY']
12 | }
13 |
14 | Stripe.api_key = Rails.configuration.stripe[:secret_key]
15 |
--------------------------------------------------------------------------------
/db/migrate/20160410113614_add_delivery_tracking_info_to_mailboxer_receipts.mailboxer_engine.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 | # This migration comes from mailboxer_engine (originally 20151103080417)
3 | class AddDeliveryTrackingInfoToMailboxerReceipts < ActiveRecord::Migration
4 | def change
5 | add_column :mailboxer_receipts, :is_delivered, :boolean, default: false
6 | add_column :mailboxer_receipts, :delivery_method, :string
7 | add_column :mailboxer_receipts, :message_id, :string
8 | end
9 | end
10 |
--------------------------------------------------------------------------------
/app/views/devise/passwords/new.html.erb:
--------------------------------------------------------------------------------
1 | Forgot your password?
2 |
3 | <%= simple_form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %>
4 | <%= f.error_notification %>
5 |
6 |
7 | <%= f.input :email, required: true, autofocus: true %>
8 |
9 |
10 |
11 | <%= f.button :submit, "Send me reset password instructions" %>
12 |
13 | <% end %>
14 |
15 | <%= render "devise/shared/links" %>
16 |
--------------------------------------------------------------------------------
/db/migrate/20160201171700_create_likes.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 | class CreateLikes < ActiveRecord::Migration
3 | def change
4 | create_table :likes do |t|
5 | t.string :liker_type
6 | t.integer :liker_id
7 | t.string :likeable_type
8 | t.integer :likeable_id
9 | t.datetime :created_at
10 | end
11 |
12 | add_index :likes, ['liker_id', 'liker_type'], :name => 'fk_likes'
13 | add_index :likes, ['likeable_id', 'likeable_type'], :name => 'fk_likeables'
14 | end
15 | end
16 |
--------------------------------------------------------------------------------
/app/views/devise/unlocks/new.html.erb:
--------------------------------------------------------------------------------
1 | Resend unlock instructions
2 |
3 | <%= simple_form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f| %>
4 | <%= f.error_notification %>
5 | <%= f.full_error :unlock_token %>
6 |
7 |
8 | <%= f.input :email, required: true, autofocus: true %>
9 |
10 |
11 |
12 | <%= f.button :submit, "Resend unlock instructions" %>
13 |
14 | <% end %>
15 |
16 | <%= render "devise/shared/links" %>
17 |
--------------------------------------------------------------------------------
/db/migrate/20160201171659_create_follows.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 | class CreateFollows < ActiveRecord::Migration
3 | def change
4 | create_table :follows do |t|
5 | t.string :follower_type
6 | t.integer :follower_id
7 | t.string :followable_type
8 | t.integer :followable_id
9 | t.datetime :created_at
10 | end
11 |
12 | add_index :follows, ['follower_id', 'follower_type'], :name => 'fk_follows'
13 | add_index :follows, ['followable_id', 'followable_type'], :name => 'fk_followables'
14 | end
15 | end
16 |
--------------------------------------------------------------------------------
/app/views/mailboxer/notification_mailer/new_notification_email.text.erb:
--------------------------------------------------------------------------------
1 | You have a new notification: <%= @notification.subject.html_safe? ? @notification.subject : strip_tags(@notification.subject) %>
2 | ===============================================
3 |
4 | You have received a new notification:
5 |
6 | -----------------------------------------------
7 | <%= @notification.body.html_safe? ? @notification.body : strip_tags(@notification.body) %>
8 | -----------------------------------------------
9 |
10 | Visit <%= root_url %> and go to your notifications for more info.
11 |
--------------------------------------------------------------------------------
/db/migrate/20160201171701_create_mentions.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 | class CreateMentions < ActiveRecord::Migration
3 | def change
4 | create_table :mentions do |t|
5 | t.string :mentioner_type
6 | t.integer :mentioner_id
7 | t.string :mentionable_type
8 | t.integer :mentionable_id
9 | t.datetime :created_at
10 | end
11 |
12 | add_index :mentions, ['mentioner_id', 'mentioner_type'], :name => 'fk_mentions'
13 | add_index :mentions, ['mentionable_id', 'mentionable_type'], :name => 'fk_mentionables'
14 | end
15 | end
16 |
--------------------------------------------------------------------------------
/app/views/mailboxer/message_mailer/new_message_email.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | You have a new message: <%= @subject %>
8 |
9 | You have received a new message:
10 |
11 |
12 |
13 | <%= raw @message.body %>
14 |
15 |
16 |
17 | Visit <%= link_to root_url, root_url %> and go to your inbox for more info.
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/app/views/mailboxer/message_mailer/reply_message_email.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | You have a new reply: <%= @subject %>
8 |
9 | You have received a new reply:
10 |
11 |
12 |
13 | <%= raw @message.body %>
14 |
15 |
16 |
17 | Visit <%= link_to root_url, root_url %> and go to your inbox for more info.
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/config/environment.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 | # code: config/environment.rb
3 | # test: to be determined
4 | # Load the Rails application.
5 | require File.expand_path('../application', __FILE__)
6 |
7 | # Initialize the Rails application.
8 | Rails.application.initialize!
9 |
10 | ActionMailer::Base.smtp_settings = {
11 | address: 'smtp.sendgrid.net',
12 | port: '587',
13 | authentication: :plain,
14 | user_name: ENV['SENDGRID_USERNAME'],
15 | password: ENV['SENDGRID_PASSWORD'],
16 | domain: 'visitmeet.herokuapp.com',
17 | enable_starttls_auto: true
18 | }
19 |
--------------------------------------------------------------------------------
/spec/support/selectors.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 | # code : spec/support/selectors.rb
3 | # source : http://stackoverflow.com/questions/14957981/capybara-click-link-with-href-match
4 | # usage : find(:href, 'google.com')
5 | # used : spec/config/oauth_spec.rb
6 | # used : spec/features/users/sign_in_spec.rb
7 | # used : spec/features/users/user_show_spec.rb
8 | # used : spec/features/welcome/home_page_spec.rb
9 | module Selectors
10 | Capybara.add_selector(:href) do
11 | xpath { |href| XPath.descendant[XPath.attr(:href).contains(href)] }
12 | end
13 | end
14 |
--------------------------------------------------------------------------------
/app/views/devise/confirmations/new.html.erb:
--------------------------------------------------------------------------------
1 | Resend confirmation instructions
2 |
3 | <%= simple_form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| %>
4 | <%= f.error_notification %>
5 | <%= f.full_error :confirmation_token %>
6 |
7 |
8 | <%= f.input :email, required: true, autofocus: true %>
9 |
10 |
11 |
12 | <%= f.button :submit, "Resend confirmation instructions" %>
13 |
14 | <% end %>
15 |
16 | <%= render "devise/shared/links" %>
17 |
--------------------------------------------------------------------------------
/spec/factories/shopping_cart_items.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 | # code: spec/factories/shopping_cart_items.rb
3 | # test: spec/features/shopping_cart_items.rb
4 | #
5 | # == Schema Information : last verified accurate : 20160501 at version : 20160425175528
6 | #
7 | # Table name: shopping_cart_items
8 | # # t.integer "owner_id"
9 | # # t.string "owner_type"
10 | # # t.integer "quantity"
11 | # # t.integer "item_id"
12 | # # t.string "item_type"
13 | # # t.float "price"
14 | #
15 | FactoryGirl.define do
16 | factory :shopping_cart_item do
17 | # TODO: set this up
18 | end
19 | end
20 |
--------------------------------------------------------------------------------
/app/views/users/mailer/invitation_instructions.text.erb:
--------------------------------------------------------------------------------
1 | <%= t("devise.mailer.invitation_instructions.hello", email: @resource.email) %>
2 |
3 | <%= t("devise.mailer.invitation_instructions.someone_invited_you", url: root_url) %>
4 |
5 | <%= accept_invitation_url(@resource, :invitation_token => @token) %>
6 |
7 | <% if @resource.invitation_due_at %>
8 | <%= t("devise.mailer.invitation_instructions.accept_until", due_date: l(@resource.invitation_due_at, format: :'devise.mailer.invitation_instructions.accept_until_format')) %>
9 | <% end %>
10 |
11 | <%= strip_tags t("devise.mailer.invitation_instructions.ignore") %>
12 |
--------------------------------------------------------------------------------
/config/initializers/backtrace_silencers.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 | # code: config/initializers/backtrace_silencers.rb
3 | # test: to be determined / probably not requred at all
4 | #
5 | # Be sure to restart your server when you modify this file.
6 |
7 | # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
8 | # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
9 |
10 | # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
11 | # Rails.backtrace_cleaner.remove_silencers!
12 |
--------------------------------------------------------------------------------
/app/helpers/products_helper.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 | # app/helpers/products_helper.rb
3 | #
4 | # == Schema Information
5 | #
6 | # Table name: products
7 | #
8 | # id :integer not null, primary key
9 | # title :string
10 | # description :text
11 | # price :integer
12 | # user_id :integer
13 | # created_at :datetime not null
14 | # updated_at :datetime not null
15 | # category :integer
16 | # latitude :float
17 | # longitude :float
18 | # location :string
19 | # category_id :integer
20 | # Product helpers here.
21 | module ProductsHelper
22 | end
23 |
--------------------------------------------------------------------------------
/spec/factories/shopping_carts.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 | # code: spec/factories/shopping_carts.rb
3 | # test: spec/features/shopping_carts_spec.rb
4 | #
5 | # == Schema Information : last verified accurate : 20160501 at version : 20160425175528
6 | #
7 | # Table name: shopping_carts
8 | # # PROBLEM ? what is missing ??
9 | # # How can this be, the table has no useful columns besides these two:
10 | #
11 | # t.datetime "created_at", null: false
12 | # t.datetime "updated_at", null: false
13 | #
14 | FactoryGirl.define do
15 | factory :shopping_cart do
16 | # so far, nothing can be or is created
17 | end
18 | end
19 |
--------------------------------------------------------------------------------
/config/puma.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 | # code: config/puma.rb
3 | # test: to be determined
4 | workers Integer(ENV['WEB_CONCURRENCY'] || 2)
5 | threads_count = Integer(ENV['MAX_THREADS'] || 5)
6 | threads threads_count, threads_count
7 |
8 | preload_app!
9 |
10 | rackup DefaultRackup
11 | port ENV['PORT'] || 3001
12 | environment ENV['RACK_ENV'] || 'development'
13 |
14 | on_worker_boot do
15 | # Worker specific setup for Rails 4.1+
16 | # See: https://devcenter.heroku.com/articles/deploying-rails-applications-with-the-puma-web-server#on-worker-boot
17 | ActiveRecord::Base.establish_connection
18 | end
19 |
--------------------------------------------------------------------------------
/app/views/devise/mailer/invitation_instructions.text.erb:
--------------------------------------------------------------------------------
1 | <%= t("devise.mailer.invitation_instructions.hello", email: @resource.email) %>
2 |
3 | <%= t("devise.mailer.invitation_instructions.someone_invited_you", url: root_url) %>
4 |
5 | <%= accept_invitation_url(@resource, :invitation_token => @token) %>
6 |
7 | <% if @resource.invitation_due_at %>
8 | <%= t("devise.mailer.invitation_instructions.accept_until", due_date: l(@resource.invitation_due_at, format: :'devise.mailer.invitation_instructions.accept_until_format')) %>
9 | <% end %>
10 |
11 | <%= strip_tags t("devise.mailer.invitation_instructions.ignore") %>
12 |
13 | <%= render 'footer.html.erb' %>
--------------------------------------------------------------------------------
/spec/support/database_cleaner.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 | RSpec.configure do |config|
3 | config.before(:suite) do
4 | DatabaseCleaner.clean_with(:truncation)
5 | end
6 |
7 | config.before :each do
8 | # DatabaseCleaner.start
9 | DatabaseCleaner.strategy = :transaction
10 | end
11 |
12 | config.before(:each, js: true) do
13 | DatabaseCleaner.strategy = :truncation
14 | end
15 |
16 | config.before(:each) do
17 | DatabaseCleaner.start
18 | end
19 |
20 | config.after :each do
21 | DatabaseCleaner.clean
22 | end
23 |
24 | # config.append_after(:each) do
25 | # DatabaseCleaner.clean
26 | # end
27 | end
28 |
--------------------------------------------------------------------------------
/config/initializers/assets.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 | # code: config/initializers/assets.rb
3 | # test: to be determined
4 | #
5 | # Be sure to restart your server when you modify this file.
6 |
7 | # Version of your assets, change this if you want to expire all your assets.
8 | Rails.application.config.assets.version = '1.0'
9 |
10 | # Add additional assets to the asset load path
11 | # Rails.application.config.assets.paths << Emoji.images_path
12 |
13 | # Precompile additional assets.
14 | # application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
15 | Rails.application.config.assets.precompile += %w( jquery.geocomplete.js )
16 |
--------------------------------------------------------------------------------
/app/controllers/messages_controller.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 | # code: app/controllers/messages_controller.rb
3 | # test: spec/controllers/messages_controller_spec.rb
4 | #
5 | # Controller for messages
6 | # Messages belong to conversations
7 | class MessagesController < ApplicationController
8 | before_action :set_conversation
9 |
10 | def create
11 | receipt = current_user.reply_to_conversation(@conversation, params[:body])
12 | redirect_to conversation_path(receipt.conversation)
13 | end
14 |
15 | private
16 |
17 | def set_conversation
18 | @conversation = current_user.mailbox.conversations.find(params[:conversation_id])
19 | end
20 | end
21 |
--------------------------------------------------------------------------------
/.rubocop.yml:
--------------------------------------------------------------------------------
1 | # encoding: utf-8
2 | # https://github.com/bbatsov/rubocop/blob/master/config/default.yml
3 | AlignParameters:
4 | Enabled: true
5 |
6 | AllCops:
7 | Exclude:
8 | - 'vendor/**/*'
9 | - 'spec/fixtures/**/*'
10 | - 'tmp/**/*'
11 |
12 | TargetRubyVersion: 2.3
13 |
14 | Rails:
15 | Enabled: true
16 |
17 | Metrics/LineLength:
18 | Max: 300
19 |
20 | Style/Encoding:
21 | Enabled: true
22 |
23 | Exclude:
24 | - 'bin/*'
25 | - 'db/seeds.rb'
26 | - 'db/schema.rb'
27 | - 'vendor/bundle/**/*'
28 |
29 | Include:
30 | - '**/Gemfile'
31 | - '**/Rakefile'
32 |
33 | Style/FrozenStringLiteralComment:
34 | EnforcedStyle: when_needed
35 |
--------------------------------------------------------------------------------
/public/assets/administrate/search-360c782d91a21edd53f5754c3fd8f8984ec5d9b36389f6df1fe618a4e50405b6.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 | search
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/app/views/layouts/application.html.slim:
--------------------------------------------------------------------------------
1 | doctype html
2 | html
3 | head
4 | meta[name="viewport" content="width=device-width, initial-scale=1.0"]
5 | title
6 | = content_for?(:title) ? yield(:title) : 'Visitmeet'
7 | meta name="description" content="#{content_for?(:description) ? yield(:description) : 'Visitmeet'}"
8 | == stylesheet_link_tag "application", :media => 'all', 'data-turbolinks-track' => true
9 | == javascript_include_tag 'application', 'data-turbolinks-track' => true
10 | == csrf_meta_tags
11 | body
12 | header
13 | == render 'layouts/navigation'
14 | main[role="main"]
15 | == render 'layouts/messages'
16 | == yield
17 |
--------------------------------------------------------------------------------
/app/views/mailboxer/notification_mailer/new_notification_email.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | You have a new notification: <%= @notification.subject.html_safe? ? @notification.subject : strip_tags(@notification.subject) %>
8 |
9 | You have received a new notification:
10 |
11 |
12 |
13 | <%= raw @notification.body %>
14 |
15 |
16 |
17 | Visit <%= link_to root_url,root_url %> and go to your notifications for more info.
18 |
19 |
20 |
--------------------------------------------------------------------------------
/app/views/users/mailer/invitation_instructions.html.erb:
--------------------------------------------------------------------------------
1 | <%= t("devise.mailer.invitation_instructions.hello", email: @resource.email) %>
2 |
3 | <%= t("devise.mailer.invitation_instructions.someone_invited_you", url: root_url) %>
4 |
5 | <%= link_to t("devise.mailer.invitation_instructions.accept"), accept_invitation_url(@resource, :invitation_token => @token) %>
6 |
7 | <% if @resource.invitation_due_at %>
8 | <%= t("devise.mailer.invitation_instructions.accept_until", due_date: l(@resource.invitation_due_at, format: :'devise.mailer.invitation_instructions.accept_until_format')) %>
9 | <% end %>
10 |
11 | <%= t("devise.mailer.invitation_instructions.ignore").html_safe %>
12 |
--------------------------------------------------------------------------------
/db/migrate/20160118081841_create_products.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 | # db/migrate/20160118081841_create_products.rb
3 | # db/migrate/20160203171325_add_categories_to_product.rb
4 | # db/migrate/20160204160517_add_latitude_longitude_location_to_products.rb
5 | # db/migrate/20160304162257_add_category_id_to_products.rb
6 | # db/migrate/20160304163929_remove_category_from_products.rb
7 | class CreateProducts < ActiveRecord::Migration
8 | def change
9 | create_table :products do |t|
10 | t.string :title
11 | t.text :description
12 | t.integer :price
13 | t.references :user, index: true, foreign_key: true
14 |
15 | t.timestamps null: false
16 | end
17 | end
18 | end
19 |
--------------------------------------------------------------------------------
/config/initializers/wrap_parameters.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 | # code: config/initializers/wrap_parameters.rb
3 | # test: to be determined if needed at all
4 | #
5 | # Be sure to restart your server when you modify this file.
6 |
7 | # This file contains settings for ActionController::ParamsWrapper which
8 | # is enabled by default.
9 |
10 | # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
11 | ActiveSupport.on_load(:action_controller) do
12 | wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
13 | end
14 |
15 | # To enable root element in JSON for ActiveRecord objects.
16 | # ActiveSupport.on_load(:active_record) do
17 | # self.include_root_in_json = true
18 | # end
19 |
--------------------------------------------------------------------------------
/app/views/devise/mailer/invitation_instructions.html.erb:
--------------------------------------------------------------------------------
1 | <%= t("devise.mailer.invitation_instructions.hello", email: @resource.email) %>
2 |
3 | <%= t("devise.mailer.invitation_instructions.someone_invited_you", url: root_url) %>
4 |
5 | <%= link_to t("devise.mailer.invitation_instructions.accept"), accept_invitation_url(@resource, :invitation_token => @token) %>
6 |
7 | <% if @resource.invitation_due_at %>
8 | <%= t("devise.mailer.invitation_instructions.accept_until", due_date: l(@resource.invitation_due_at, format: :'devise.mailer.invitation_instructions.accept_until_format')) %>
9 | <% end %>
10 |
11 | <%= t("devise.mailer.invitation_instructions.ignore").html_safe %>
12 |
13 | <%= render 'footer.html.erb' %>
--------------------------------------------------------------------------------
/db/migrate/20160410113612_add_conversation_optout.mailboxer_engine.rb:
--------------------------------------------------------------------------------
1 | # This migration comes from mailboxer_engine (originally 20131206080416)
2 | class AddConversationOptout < ActiveRecord::Migration
3 | def self.up
4 | create_table :mailboxer_conversation_opt_outs do |t|
5 | t.references :unsubscriber, :polymorphic => true
6 | t.references :conversation
7 | end
8 | add_foreign_key "mailboxer_conversation_opt_outs", "mailboxer_conversations", :name => "mb_opt_outs_on_conversations_id", :column => "conversation_id"
9 | end
10 |
11 | def self.down
12 | remove_foreign_key "mailboxer_conversation_opt_outs", :name => "mb_opt_outs_on_conversations_id"
13 | drop_table :mailboxer_conversation_opt_outs
14 | end
15 | end
16 |
--------------------------------------------------------------------------------
/app/views/devise/sessions/new.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
3 | <%= render 'devise/shared/links' %>
4 |
Log in
5 |
6 | <%= simple_form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>
7 |
8 | <%= f.input :email, required: false, autofocus: true %>
9 | <%= f.input :password, required: false %>
10 | <%= f.input :remember_me, as: :boolean if devise_mapping.rememberable? %>
11 |
12 |
13 |
14 | <%= f.button :submit, 'Sign in', class: 'btn btn-primary btn-lg btn-block' %>
15 |
16 | <% end %>
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/app/models/category.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 | # app/models/category.rb
3 | # spec/models/category_spec.rb
4 | #
5 | # Migrations involved
6 | #
7 | # db/migrate/20160118081841_create_products.rb
8 | # db/migrate/20160203171325_add_categories_to_product.rb
9 | # db/migrate/20160304162257_add_category_id_to_products.rb
10 | # db/migrate/20160304163929_remove_category_from_products.rb
11 | # db/migrate/20160304162459_create_categories.rb
12 | #
13 | # == Schema Information
14 | #
15 | # Table name: categories
16 | #
17 | # id :integer not null, primary key
18 | # name :string
19 | # created_at :datetime not null
20 | # updated_at :datetime not null
21 | #
22 | # Category model.
23 | class Category < ActiveRecord::Base
24 | has_many :products
25 | end
26 |
--------------------------------------------------------------------------------
/app/models/profile.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 | # app/models/profile.rb
3 | # test: spec/factories/profiles.rb
4 | # test: spec/models/profile_spec.rb
5 | #
6 | # Migrations : last verified accurate : 20160422 ko
7 | # # db/migrate/20160303161926_create_profiles.rb
8 | # # db/migrate/20160305150015_add_name_to_profile.rb
9 | # # db/migrate/20160412165928_add_bio_to_profile.rb
10 | # # db/schema.rb
11 | #
12 | # == Schema Information
13 | # Table name: profiles
14 | # id :integer not null, primary key
15 | # name :string
16 | # bio :text
17 | # user_id :integer
18 | # created_at :datetime not null
19 | # updated_at :datetime not null
20 | #
21 | # User's Profile model.
22 | class Profile < ActiveRecord::Base
23 | belongs_to :user
24 | end
25 |
--------------------------------------------------------------------------------
/spec/support/helpers/session_helpers.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 | # code: spec/support/helpers/session_helpers.rb
3 | # used: spec/features/users/sign_in_spec.rb
4 | #
5 | module Features
6 | module SessionHelpers
7 | def sign_up_with(email, password, confirmation)
8 | visit new_user_registration_path
9 | fill_in :user_email, with: email
10 | fill_in :user_password, with: password
11 | fill_in :user_password_confirmation, with: confirmation
12 | click_button 'Sign up'
13 | end
14 |
15 | def signin(email, password)
16 | # visit '/users/login' # or ..
17 | visit new_user_session_path
18 | fill_in :user_email, with: email
19 | fill_in :user_password, with: password
20 | click_button 'Sign in'
21 | end
22 | end
23 | end
24 |
--------------------------------------------------------------------------------
/app/views/devise/passwords/edit.html.erb:
--------------------------------------------------------------------------------
1 | Change your password
2 |
3 | <%= simple_form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| %>
4 | <%= f.error_notification %>
5 |
6 | <%= f.input :reset_password_token, as: :hidden %>
7 | <%= f.full_error :reset_password_token %>
8 |
9 |
10 | <%= f.input :password, label: "New password", required: true, autofocus: true, hint: ("#{@minimum_password_length} characters minimum" if @minimum_password_length) %>
11 | <%= f.input :password_confirmation, label: "Confirm your new password", required: true %>
12 |
13 |
14 |
15 | <%= f.button :submit, "Change my password" %>
16 |
17 | <% end %>
18 |
19 | <%= render "devise/shared/links" %>
20 |
--------------------------------------------------------------------------------
/.codeclimate.yml:
--------------------------------------------------------------------------------
1 | ---
2 | engines:
3 | brakeman:
4 | enabled: true
5 | bundler-audit:
6 | enabled: true
7 | csslint:
8 | enabled: true
9 | coffeelint:
10 | enabled: true
11 | duplication:
12 | enabled: true
13 | config:
14 | languages:
15 | - ruby
16 | - javascript
17 | - python
18 | - php
19 | eslint:
20 | enabled: true
21 | fixme:
22 | enabled: true
23 | rubocop:
24 | enabled: true
25 | ratings:
26 | paths:
27 | - Gemfile.lock
28 | - "**.erb"
29 | - "**.haml"
30 | - "**.rb"
31 | - "**.rhtml"
32 | - "**.slim"
33 | - "**.css"
34 | - "**.coffee"
35 | - "**.inc"
36 | - "**.js"
37 | - "**.jsx"
38 | - "**.module"
39 | - "**.php"
40 | - "**.py"
41 | exclude_paths:
42 | - config/
43 | - db/
44 | - spec/
45 | - vendor/
46 | - public/
47 |
--------------------------------------------------------------------------------
/config/aws.yml:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 | # code: config/aws.yml
3 | # test: spec/config/aws_spec.rb
4 | development:
5 | access_key_id: 'AKIAJNCN6JXNV4ZSXOZA'
6 | secret_access_key: '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'
7 |
8 | production:
9 | access_key_id: 'AKIAJNCN6JXNV4ZSXOZA'
10 | secret_access_key: '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'
11 |
12 | # ref for this addition
13 | # https://github.com/tiy-austin-ror-jan2015/tiy-rails-template/issues/38
14 | test:
15 | access_key_id: 'AKIAJNCN6JXNV4ZSXOZA'
16 | secret_access_key: '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'
17 |
18 | # Note: again, we are exposiing api keys, and this is a no no.
19 | # TODO: this must be fixed with tests to prevent their showing up
20 | # then we change our keys and use the Rails call method from the
21 | # environment variables. tests to be written
22 |
--------------------------------------------------------------------------------
/Guardfile:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 | # A sample Guardfile
3 | # More info at https://github.com/guard/guard#readme
4 |
5 | ## Uncomment and set this to only include directories you want to watch
6 | # directories %w(app lib config test spec features) \
7 | # .select{|d| Dir.exists?(d) ? d : UI.warning("Directory #{d} does not exist")}
8 |
9 | ## Note: if you are using the `directories` clause above and you are not
10 | ## watching the project directory ('.'), then you will want to move
11 | ## the Guardfile to a watched dir and symlink it back, e.g.
12 | #
13 | # $ mkdir config
14 | # $ mv Guardfile config/
15 | # $ ln -s config/Guardfile .
16 | #
17 | # and, you'll have to watch "config/Guardfile" instead of "Guardfile"
18 |
19 | guard :rubocop do
20 | watch(%r{.+\.rb$})
21 | watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
22 | end
23 |
--------------------------------------------------------------------------------
/config/oauth.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 | # code: config/oauth.rb
3 | # test: spec/config/oauth_spec.rb
4 | # route: get '/login/oauth/authorize'
5 | #
6 | # ref : https://github.com/intridea/omniauth/wiki
7 | # OmniAuth will configure the path /auth/:provider
8 | # start the auth process by going to that path
9 | # OmniAuth will return auth information to the path /auth/:provider/callback
10 | # if user authentication fails on the provider side, OmniAuth will catch the
11 | # response and then redirect the request to the path /auth/failure, passing
12 | # a corresponding error message in a parameter named message
13 | Rails.application.config.middleware.use OmniAuth::Builder do
14 | require 'openid/store/filesystem'
15 | provider :github, ENV['GITHUB_KEY'], ENV['GITHUB_SECRET']
16 | provider :openid, store: OpenID::Store::Filesystem.new('/tmp')
17 | end
18 |
--------------------------------------------------------------------------------
/config/initializers/inflections.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 | # code: config/initializers/inflections.rb
3 | # test: to be determined, if needed at all
4 | #
5 | # Be sure to restart your server when you modify this file.
6 |
7 | # Add new inflection rules using the following format. Inflections
8 | # are locale specific, and you may define rules for as many different
9 | # locales as you wish. All of these examples are active by default:
10 | # ActiveSupport::Inflector.inflections(:en) do |inflect|
11 | # inflect.plural /^(ox)$/i, '\1en'
12 | # inflect.singular /^(ox)en/i, '\1'
13 | # inflect.irregular 'person', 'people'
14 | # inflect.uncountable %w( fish sheep )
15 | # end
16 |
17 | # These inflection rules are supported but not enabled by default:
18 | # ActiveSupport::Inflector.inflections(:en) do |inflect|
19 | # inflect.acronym 'RESTful'
20 | # end
21 |
--------------------------------------------------------------------------------
/app/controllers/socializations_controller.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 | # app/controllers/socializations_controller.rb
3 | class SocializationsController < ApplicationController
4 | include ActionController::Helpers
5 | before_action :load_socializable
6 |
7 | def follow
8 | current_user.follow!(@socializable)
9 | render json: { follow: true }
10 | end
11 |
12 | def unfollow
13 | current_user.unfollow!(@socializable)
14 | render json: { follow: false }
15 | end
16 |
17 | private
18 |
19 | def load_socializable
20 | @socializable = case
21 | when id = params[:user_id]
22 | User.find(id)
23 | else
24 | raise ArgumentError, 'Unsupported model, params:' + params.keys.inspect
25 | end
26 | raise ActiveRecord::RecordNotFound unless @socializable
27 | end
28 | end
29 |
--------------------------------------------------------------------------------
/spec/config/env_variables_spec.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 | # spec/config/env_variables_spec.rb
3 | # require 'pry'
4 | # include Devise::TestHelpers
5 | # include Features::SessionHelpers
6 | # include Warden::Test::Helpers
7 | # Warden.test_mode!
8 | # describe Config, :devise, js: true do
9 | # # it 'tests things' do
10 | # # expect(config.paperclip_defaults).to be_an Array
11 | # # expect(config.paperclip_defaults.storage).to eq ':s3'
12 | # # expect(config.paperclip_defaults.storage[:s3_credentials].count).to eq 3
13 | # # expect(config.paperclip_defaults.storage[:s3_credentials][:bucket]).to eq "ENV['S3_BUCKET_NAME']"
14 | # # expect(config.paperclip_defaults.storage[:s3_credentials][:access_key_id]).to eq "ENV['AWS_ACCESS_KEY_ID']"
15 | # # expect(config.paperclip_defaults.storage[:s3_credentials][:secret_access_key]).to eq "ENV['AWS_SECRET_ACCESS_KEY']"
16 | # # end
17 | # end
18 | #
19 |
--------------------------------------------------------------------------------
/config/locales/en.yml:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 | # Files in the config/locales directory are used for internationalization
3 | # and are automatically loaded by Rails. If you want to use locales other
4 | # than English, add the necessary files in this directory.
5 | #
6 | # To use the locales, use `I18n.t`:
7 | #
8 | # I18n.t 'hello'
9 | #
10 | # In views, this is aliased to just `t`:
11 | #
12 | # <%= t('hello') %>
13 | #
14 | # To use a different locale, set it with `I18n.locale`:
15 | #
16 | # I18n.locale = :es
17 | #
18 | # This would use the information in config/locales/es.yml.
19 | #
20 | # To learn more, please read the Rails Internationalization guide
21 | # available at http://guides.rubyonrails.org/i18n.html.
22 |
23 | en:
24 | hello: "Hello World"
25 | introduction: "We are a not-for-profit company aimed at poverty alleviation with employments and exchanges amongst all on earth"
26 |
--------------------------------------------------------------------------------
/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "App",
3 | "icons": [
4 | {
5 | "src": "\/android-icon-36x36.png",
6 | "sizes": "36x36",
7 | "type": "image\/png",
8 | "density": "0.75"
9 | },
10 | {
11 | "src": "\/android-icon-48x48.png",
12 | "sizes": "48x48",
13 | "type": "image\/png",
14 | "density": "1.0"
15 | },
16 | {
17 | "src": "\/android-icon-72x72.png",
18 | "sizes": "72x72",
19 | "type": "image\/png",
20 | "density": "1.5"
21 | },
22 | {
23 | "src": "\/android-icon-96x96.png",
24 | "sizes": "96x96",
25 | "type": "image\/png",
26 | "density": "2.0"
27 | },
28 | {
29 | "src": "\/android-icon-144x144.png",
30 | "sizes": "144x144",
31 | "type": "image\/png",
32 | "density": "3.0"
33 | },
34 | {
35 | "src": "\/android-icon-192x192.png",
36 | "sizes": "192x192",
37 | "type": "image\/png",
38 | "density": "4.0"
39 | }
40 | ]
41 | }
--------------------------------------------------------------------------------
/spec/factories/profiles.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 | # code: app/models/profile.rb
3 | # test: spec/factories/profiles.rb
4 | # test: spec/models/profile_spec.rb
5 | #
6 | # Migrations : last verified accurate : 20160422 ko
7 | # # db/migrate/20160303161926_create_profiles.rb
8 | # # db/migrate/20160305150015_add_name_to_profile.rb
9 | # # db/migrate/20160412165928_add_bio_to_profile.rb
10 | # # db/schema.rb
11 | #
12 | # == Schema Information
13 | # Table name: profiles
14 | # id :integer not null, primary key
15 | # name :string
16 | # bio :text
17 | # user_id :integer
18 | # created_at :datetime not null
19 | # updated_at :datetime not null
20 | #
21 | FactoryGirl.define do
22 | factory :profile do
23 | user nil
24 | # user_id 1
25 | name 'any string i want it to be'
26 | bio 'any text i want it to be, as long as the text column is set'
27 | end
28 | end
29 |
--------------------------------------------------------------------------------
/bin/setup:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | # frozen_string_literal: true
3 | require 'pathname'
4 |
5 | # path to your application root.
6 | APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
7 |
8 | Dir.chdir APP_ROOT do
9 | # This script is a starting point to setup your application.
10 | # Add necessary setup steps to this file:
11 |
12 | puts '== Installing dependencies =='
13 | system 'gem install bundler --conservative'
14 | system 'bundle check || bundle install'
15 |
16 | # puts "\n== Copying sample files =="
17 | # unless File.exist?("config/database.yml")
18 | # system "cp config/database.yml.sample config/database.yml"
19 | # end
20 |
21 | puts "\n== Preparing database =="
22 | system 'bin/rake db:setup'
23 |
24 | puts "\n== Removing old logs and tempfiles =="
25 | system 'rm -f log/*'
26 | system 'rm -rf tmp/cache'
27 |
28 | puts "\n== Restarting application server =="
29 | system 'touch tmp/restart.txt'
30 | end
31 |
--------------------------------------------------------------------------------
/app/helpers/users/application_helper.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 | # app/helpers/users/application_helper.rb
3 | module Users::ApplicationHelper
4 | # `helper_method` must be placed in app/controllers/application_controller.rb : reference :
5 | # http://stackoverflow.com/questions/4081744/devise-form-within-a-different-controller
6 | # helper_method :resource_name, :resource_class, :resource, :devise_mapping
7 |
8 | # next three helper methods : reference:
9 | # http://stackoverflow.com/questions/14866353/devise-sign-in-not-completing
10 | def resource_name
11 | :user
12 | end
13 |
14 | def resource
15 | @resource ||= User.new
16 | end
17 |
18 | def devise_mapping
19 | @devise_mapping ||= Devise.mappings[:user]
20 | end
21 |
22 | # `resource_class` reference:
23 | # http://stackoverflow.com/questions/15348421/devise-render-sign-up-in-form-partials-elsewhere-in-code
24 | def resource_class
25 | devise_mapping.to
26 | end
27 | end
28 |
--------------------------------------------------------------------------------
/spec/routing/profile_routing_spec.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 | # code: config/routes.rb
3 | # test: spec/routing/profile_routing_spec.rb
4 | describe ProfileController, type: :routing do
5 | describe 'routing' do
6 | # tests app/views/visitors/index
7 | # root GET / welcome#index
8 | it 'routes to root_path' do
9 | expect(get('visitors/index')).to route_to('visitors#index') # original
10 | # expect(get('welcome/index')).to route_to('welcome#index')
11 | end
12 |
13 | # tests app/views/profile/user
14 | # users_profile GET /users/profile(.:format) users#profile
15 | it 'routes to users#profile' do
16 | expect(get('/users/profile')).to route_to('users#profile')
17 | end
18 |
19 | # tests new_user_session
20 | # new_user_session GET /users/login(.:format) devise/sessions#new
21 | it 'routes to users#login' do
22 | expect(get('/users/login')).to route_to('devise/sessions#new')
23 | end
24 | end
25 | end
26 |
--------------------------------------------------------------------------------
/db/migrate/20160115121151_devise_invitable_add_to_users.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 | class DeviseInvitableAddToUsers < ActiveRecord::Migration
3 | def up
4 | change_table :users do |t|
5 | t.string :invitation_token
6 | t.datetime :invitation_created_at
7 | t.datetime :invitation_sent_at
8 | t.datetime :invitation_accepted_at
9 | t.integer :invitation_limit
10 | t.references :invited_by, polymorphic: true
11 | t.integer :invitations_count, default: 0
12 | t.index :invitations_count
13 | t.index :invitation_token, unique: true # for invitable
14 | t.index :invited_by_id
15 | end
16 | end
17 |
18 | def down
19 | change_table :users do |t|
20 | t.remove_references :invited_by, polymorphic: true
21 | t.remove :invitations_count, :invitation_limit, :invitation_sent_at, :invitation_accepted_at, :invitation_token, :invitation_created_at
22 | end
23 | end
24 | end
25 |
--------------------------------------------------------------------------------
/app/views/devise/registrations/new.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
3 |
Register to Visit & Meet
4 | <%= simple_form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %>
5 | <%= f.error_notification %>
6 |
7 |
8 | <%= f.input :email, required: true, autofocus: true %>
9 | <%= f.input :password, required: true, hint: ( "#{@minimum_password_length} characters minimum" if @minimum_password_length) %>
10 | <%= f.input :password_confirmation, required: true %>
11 |
12 |
13 |
14 | <%= f.button :submit, "Sign up", class: "btn btn-primary btn-lg btn-block" %>
15 |
16 | <% end %>
17 |
18 | Already have an account?
19 | <%= render "devise/shared/links" %>
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/config/initializers/mailboxer.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 | # code: config/initializers/mailboxer.rb
3 | # test: spec/config/ : assigned kathyonu : 20160416
4 | Mailboxer.setup do |config|
5 | # Configures if your application uses or not email sending for Notifications and Messages
6 | config.uses_emails = true
7 |
8 | # Configures the default from for emails sent for Messages and Notifications
9 | # TODO: verify this should or should not be no-reply@visitmeet.com
10 | config.default_from = 'no-reply@mailboxer.com'
11 |
12 | # Configures the methods needed by mailboxer
13 | config.email_method = :mailboxer_email
14 | config.name_method = :name
15 |
16 | # Configures if you use or not a search engine and which one you are using
17 | # Supported engines: [:solr, :sphinx]
18 | config.search_enabled = false
19 | config.search_engine = :solr
20 |
21 | # Configures maximum length of the message subject and body
22 | config.subject_max_length = 255
23 | config.body_max_length = 32_000
24 | end
25 |
--------------------------------------------------------------------------------
/config/locales/simple_form.en.yml:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 | en:
3 | simple_form:
4 | "yes": 'Yes'
5 | "no": 'No'
6 | required:
7 | text: 'required'
8 | mark: '*'
9 | # You can uncomment the line below if you need to overwrite the whole required html.
10 | # When using html, text and mark won't be used.
11 | # html: '* '
12 | error_notification:
13 | default_message: "Please review the problems below:"
14 | # Examples
15 | # labels:
16 | # defaults:
17 | # password: 'Password'
18 | # user:
19 | # new:
20 | # email: 'E-mail to sign in.'
21 | # edit:
22 | # email: 'E-mail.'
23 | # hints:
24 | # defaults:
25 | # username: 'User name to sign in.'
26 | # password: 'No special characters, please.'
27 | # include_blanks:
28 | # defaults:
29 | # age: 'Rather not say'
30 | # prompts:
31 | # defaults:
32 | # age: 'Select your age'
33 |
--------------------------------------------------------------------------------
/spec/routing/users_routing_spec.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 | # code: config/routes.rb
3 | # test: spec/routing/users_routing_spec.rb
4 | describe UsersController, type: :routing do
5 | describe 'routing' do
6 | # tests app/views/visitors/index
7 | # root GET / welcome#index
8 | it 'routes to root_path' do
9 | expect(get(root_path)).to route_to('welcome#index')
10 | end
11 |
12 | it 'routes to visitors#index' do
13 | expect(get('visitors/index')).to route_to('visitors#index') # original
14 | end
15 |
16 | # tests app/views/profile/index.html.slim
17 | # profile_index GET /profile/index(.:format) profile#index
18 | it 'routes to profile#index' do
19 | expect(get('/profile/index')).to route_to('profile#index')
20 | end
21 |
22 | # tests new_user_session
23 | # new_user_session GET /users/login(.:format) devise/sessions#new
24 | it 'routes to users#login' do
25 | expect(get('/users/login')).to route_to('devise/sessions#new')
26 | end
27 | end
28 | end
29 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: ruby
2 | rvm:
3 | - 2.3.1
4 | before_script: "bundle exec rake db:drop db:create db:migrate"
5 | script: "bundle exec rspec spec/"
6 | deploy:
7 | provider: heroku
8 | api_key:
9 | secure: YIN1HrVC6jdtHHoGxuR4czf45I/dcjbtfUlcQapYONlN2WPKcfdW8B4ZxvgzWcgWWEDHHHwOQ11wjZmfQiDGtOCx8HXii4Kob1oVmT9z9FRfkxfay26ZKBV5SFY8ROzlmCgZ09pKFNVIaaNkLN/uXgDmrXmNvuwKEYPRq7dCVSzGxxtmzVf773iaXnE9ObsrQanPxa3BT9g5vpvncJA+QzecL04vuCGVDrOYnz8Ib+15JRIWWaHjjLOCJXbuBcy/z4q8qYzE8mYptiWO4Z7nyoN0Qbp7D5FVLK6lpIvCRG4ms31b29IV//4kWYjuDbUxA57/j6bxPe1bC/zA9t3YUEHgWNsTaw8AApOqrIVq6XYMsZsTxct6SCFsSuDm6RMXkIJZpVa4o8UGms4OaK+RE5ZjuEgK83B+0Q49Li625ya/QUj4FicUec7wQUEmra62/iI+EXlUcCS2VqgXjexHDnzqSPP863LruaEvomYFdTOpvVnTX31QNFlM06irRAij87qZjg6mEiD7/Ed1kzgrp1GNr/E3cs55Zy24IIvD0tOx6r2hhgnLxtvDa83uoRadLquxu5qVAqS+6NTPrIiX0QEBe+QZbb7mbvMdX3NaONlXEICUgTZ3r1ws67e0CmqB98W3XM3slLYwjoxhRUq/Yhl42zui3axBCokwv3BNYcI=
10 | app: visitmeet
11 | on:
12 | repo: VisitMeet/visitmeet
13 | notifications:
14 | slack:
15 | rooms:
16 | - narmadainfosys:8dMgPLd6RzpSx7eom3WaYNHn#visitmeet
--------------------------------------------------------------------------------
/app/views/pages/full-width.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
10 |
11 | <%= link_to 'Home', root_path %>
12 |
13 | Full Width Page
14 |
15 |
16 |
17 |
18 |
19 |
20 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/app/views/visitors/team.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | The VisitMeet Team
7 |
8 |
9 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/app/views/users/profile.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
<%= current_user.email %>'s Profile
5 |
6 |
7 |
8 |
9 | Full Name:
10 |
11 | <%= best_in_place @user, :name %>
12 |
13 |
<%= current_user.email.capitalize %>'s Profile
14 |
15 |
16 |
17 |
Bio:
18 |
19 | <%= best_in_place @user, :bio, as: :textarea %>
20 |
21 |
22 |
23 | Our Code Repository
24 |
25 |
26 | Learn more
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/db/migrate/20160410113613_add_missing_indices.mailboxer_engine.rb:
--------------------------------------------------------------------------------
1 | # This migration comes from mailboxer_engine (originally 20131206080417)
2 | class AddMissingIndices < ActiveRecord::Migration
3 | def change
4 | # We'll explicitly specify its name, as the auto-generated name is too long and exceeds 63
5 | # characters limitation.
6 | add_index :mailboxer_conversation_opt_outs, [:unsubscriber_id, :unsubscriber_type],
7 | name: 'index_mailboxer_conversation_opt_outs_on_unsubscriber_id_type'
8 | add_index :mailboxer_conversation_opt_outs, :conversation_id
9 |
10 | add_index :mailboxer_notifications, :type
11 | add_index :mailboxer_notifications, [:sender_id, :sender_type]
12 |
13 | # We'll explicitly specify its name, as the auto-generated name is too long and exceeds 63
14 | # characters limitation.
15 | add_index :mailboxer_notifications, [:notified_object_id, :notified_object_type],
16 | name: 'index_mailboxer_notifications_on_notified_object_id_and_type'
17 |
18 | add_index :mailboxer_receipts, [:receiver_id, :receiver_type]
19 | end
20 | end
21 |
--------------------------------------------------------------------------------
/bin/spring:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | # frozen_string_literal: true
3 | #
4 | # DEVELOPERS NOTE: From the https://gitter.im/rails/rails chat room:
5 | # # Whenever something is squirrelly you can't go wrong with `spring stop`.
6 | # # That alone can avert a lot of head banging. Just run `spring stop` in Terminal
7 | # # and continue on with tests, or server run, whatever. It resets the system.
8 | #
9 | # This file loads spring without using Bundler, in order to be fast.
10 | # It gets overwritten when you run the `spring binstub` command.
11 |
12 | unless defined?(Spring)
13 | require 'rubygems'
14 | require 'bundler'
15 |
16 | if (match = Bundler.default_lockfile.read.match(/^GEM$.*?^ (?: )*spring \((.*?)\)$.*?^$/m))
17 | # ref for new gem paths line : https://github.com/rubygems/rubygems/issues/1551
18 | Gem.paths = { 'GEM_PATH' => [Bundler.bundle_path.to_s, *Gem.path].uniq.join(File::PATH_SEPARATOR) }
19 | # Gem.paths = { 'GEM_PATH' => [Bundler.bundle_path.to_s, *Gem.path].uniq.join(Gem.path_separator) }
20 | gem 'spring', match[1]
21 | require 'spring/binstub'
22 | end
23 | end
24 |
--------------------------------------------------------------------------------
/config/initializers/rails_admin.rb:
--------------------------------------------------------------------------------
1 | RailsAdmin.config do |config|
2 |
3 | ### Popular gems integration
4 |
5 | ## == Devise ==
6 | # config.authenticate_with do
7 | # warden.authenticate! scope: :user
8 | # end
9 | # config.current_user_method(&:current_user)
10 |
11 | ## == Cancan ==
12 | # config.authorize_with :cancan
13 |
14 | ## == Pundit ==
15 | # config.authorize_with :pundit
16 |
17 | ## == PaperTrail ==
18 | # config.audit_with :paper_trail, 'User', 'PaperTrail::Version' # PaperTrail >= 3.0.0
19 |
20 | ### More at https://github.com/sferik/rails_admin/wiki/Base-configuration
21 |
22 | ## == Gravatar integration ==
23 | ## To disable Gravatar integration in Navigation Bar set to false
24 | # config.show_gravatar true
25 |
26 | config.actions do
27 | dashboard # mandatory
28 | index # mandatory
29 | new
30 | export
31 | bulk_delete
32 | show
33 | edit
34 | delete
35 | show_in_app
36 |
37 | ## With an audit adapter, you can add:
38 | # history_index
39 | # history_show
40 | end
41 | end
42 |
--------------------------------------------------------------------------------
/app/views/layouts/_navigation.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
7 | <%= link_to 'Products', products_path %>
8 | <%= link_to 'Team', visitors_team_url %>
9 |
10 | <%= link_to 'About', page_path('about') %>
11 |
12 |
13 | <% if user_signed_in? %>
14 | <%= link_to 'Messages', conversations_path %>
15 | <%= link_to 'Profile', users_profile_path %>
16 | <%= link_to 'Account Settings', edit_user_registration_path %>
17 | <%= link_to('Logout', destroy_user_session_path, method: :delete) %>
18 | <% else %>
19 | <%= link_to 'Login', new_user_session_path %>
20 | <%= link_to 'Sign Up', new_user_registration_path %>
21 | <% end %>
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/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, vendor/assets/javascripts,
5 | // or vendor/assets/javascripts of plugins, if any, 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.
9 | //
10 | // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
11 | // about supported directives.
12 | //
13 | // Sprockets concatenates all JavaScript files into this application.js file
14 | // Sprockets concatenates all CSS files into one master application.css file
15 | //
16 | //= require jquery
17 | //= require best_in_place
18 | //= require jquery-ui
19 | //= require best_in_place.jquery-ui
20 | //= require gmaps/google
21 | //= require jquery_ujs
22 | //= require underscore
23 | //= require jquery.geocomplete
24 | //= require bootstrap-sprockets
25 | //= require turbolinks
26 | //= require_tree .
27 |
--------------------------------------------------------------------------------
/config/database.yml:
--------------------------------------------------------------------------------
1 | development:
2 | adapter: postgresql
3 | host: localhost
4 | encoding:
5 | database: visitmeet_development
6 | username: postgres
7 | password: kathmandu143.
8 | pool: 5
9 | # puma changes
10 | # encoding: unicode
11 | # Ref https://github.com/rails/rails/commit/391061a30d7ab2923ea342048fe643469de3f1a9
12 | # pool: <%%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
13 |
14 | test:
15 | adapter: postgresql
16 | host: localhost
17 | encoding: utf8
18 | database: visitmeet_test
19 | username: postgres
20 | password: kathmandu143.
21 | pool: 5
22 | # puma changes
23 | # encoding: unicode
24 | # Ref https://github.com/rails/rails/commit/391061a30d7ab2923ea342048fe643469de3f1a9
25 | # pool: <%%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
26 |
27 | production:
28 | adapter: postgresql
29 | host: localhost
30 | encoding: utf8
31 | database: visitmeet_production
32 | pool: 5
33 | # puma changes
34 | # encoding: unicode
35 | # Ref https://github.com/rails/rails/commit/391061a30d7ab2923ea342048fe643469de3f1a9
36 | # pool: <%%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
37 | template: template0
38 |
--------------------------------------------------------------------------------
/app/views/shopping_carts/_shopping_cart_item.html.erb:
--------------------------------------------------------------------------------
1 |
2 | <% if shopping_cart_item.item %>
3 |
4 |
5 |
14 |
15 | Quanity: 2
16 |
17 | Total: <%= shopping_cart_item.item.price %>
18 |
19 |
20 |
21 | Remove
22 |
23 |
24 | <% end %>
25 |
--------------------------------------------------------------------------------
/app/views/devise/registrations/edit.html.erb:
--------------------------------------------------------------------------------
1 | Edit <%= resource_name.to_s.humanize %>
2 |
3 | <%= simple_form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %>
4 | <%= f.error_notification %>
5 |
6 |
17 |
18 |
19 | <%= f.button :submit, "Update" %>
20 |
21 | <% end %>
22 |
23 | Cancel my account
24 |
25 | Unhappy? <%= link_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete %>
26 |
27 | <%= link_to "Back", :back %>
28 |
--------------------------------------------------------------------------------
/app/views/devise/shared/_links.html.erb:
--------------------------------------------------------------------------------
1 | <%- if controller_name != 'sessions' %>
2 | <%= link_to "Log in", new_session_path(resource_name) %>
3 | <% end -%>
4 |
5 | <%- if devise_mapping.registerable? && controller_name != 'registrations' %>
6 | <%= link_to "Sign up", new_registration_path(resource_name) %>
7 | <% end -%>
8 |
9 | <%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %>
10 | <%= link_to "Forgot your password?", new_password_path(resource_name) %>
11 | <% end -%>
12 |
13 | <%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
14 | <%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %>
15 | <% end -%>
16 |
17 | <%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
18 | <%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %>
19 | <% end -%>
20 |
21 | <%- if devise_mapping.omniauthable? %>
22 | <%- resource_class.omniauth_providers.each do |provider| %>
23 | <%= link_to "Sign in with #{OmniAuth::Utils.camelize(provider)}", omniauth_authorize_path(resource_name, provider) %>
24 | <% end -%>
25 | <% end -%>
26 |
--------------------------------------------------------------------------------
/config/local_env_example.yml:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 | # code: config/local_env.yml
3 | # test: to be determined
4 | # ref : http://railsapps.github.io/rails-environment-variables.html
5 | #
6 | # Change the name of this file to config/local_env.yml THEN ensure
7 | # /config/local_env.yml is listed in .gitignore to keep your settings secret!
8 | #
9 | # Add account settings and API keys here, AND
10 | # Each entry gets set as a local environment variable.
11 | # This file overrides ENV variables in the Unix shell.
12 | # For example, setting:
13 | # GMAIL_USERNAME: 'Your_Gmail_Username'
14 | # makes 'Your_Gmail_Username' available as ENV["GMAIL_USERNAME"]
15 | ADMIN_NAME: 'First User'
16 | ADMIN_PASSWORD: 'changmenow'
17 | AWS_ACCESS_KEY_ID: ''
18 | AWS_SECRET_ACCESS_KEY_ID: ''
19 | GITHUB_KEY: 'how do we submit test key ?'
20 | GITHUB_SECRET: 'how do we submit test secret ?'
21 | MAILCHIMP_USERNAME: ''
22 | MAILCHIMP_PASSWORD: ''
23 | MAILCHIMP_API_KEY: ''
24 | MAILCHIMP_LIST_ID: ''
25 | OMNIAUTH_APP_ID: ''
26 | OMNIAUTH_APP_SECRET: ''
27 | S3_BUCKET_NAME: ''
28 | SECRET_KEY: ''
29 | SECRET_KEY_BASE: ''
30 | SENDGRID_PASSWORD: ''
31 | SENDGRID_USERNAME: ''
32 | SMTP_ADDRESS: 'address ?'
33 | SMTP_DOMAIN: 'smtp_domain ?'
34 | SMTP_USERNAME: 'user_name ?'
35 | SMTP_PASSWORD: 'password ?'
--------------------------------------------------------------------------------
/config/locales/locale_env.yaml:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 | # code: config/local_env.yml
3 | # test: to be determined
4 | # ref : http://railsapps.github.io/rails-environment-variables.html
5 | #
6 | # Change the name of this file to config/local_env.yml THEN ensure
7 | # /config/local_env.yml is listed in .gitignore to keep your settings secret!
8 | #
9 | # Add account settings and API keys here, AND
10 | # Each entry gets set as a local environment variable.
11 | # This file overrides ENV variables in the Unix shell.
12 | # For example, setting:
13 | # GMAIL_USERNAME: 'Your_Gmail_Username'
14 | # makes 'Your_Gmail_Username' available as ENV["GMAIL_USERNAME"]
15 | ADMIN_NAME: 'First User'
16 | ADMIN_PASSWORD: 'changmenow'
17 | AWS_ACCESS_KEY_ID: ''
18 | AWS_SECRET_ACCESS_KEY_ID: ''
19 | GITHUB_KEY: 'how do we submit test key ?'
20 | GITHUB_SECRET: 'how do we submit test secret ?'
21 | MAILCHIMP_USERNAME: ''
22 | MAILCHIMP_PASSWORD: ''
23 | MAILCHIMP_API_KEY: ''
24 | MAILCHIMP_LIST_ID: ''
25 | OMNIAUTH_APP_ID: ''
26 | OMNIAUTH_APP_SECRET: ''
27 | S3_BUCKET_NAME: ''
28 | SECRET_KEY: ''
29 | SECRET_KEY_BASE: ''
30 | SENDGRID_PASSWORD: ''
31 | SENDGRID_USERNAME: ''
32 | SMTP_ADDRESS: 'address ?'
33 | SMTP_DOMAIN: 'smtp_domain ?'
34 | SMTP_USERNAME: 'user_name ?'
35 | SMTP_PASSWORD: 'password ?'
--------------------------------------------------------------------------------
/spec/factories/products.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 | # code: spec/factories/products.rb
3 | # test: spec/products/products_spec.rb
4 | #
5 | # == Schema Information
6 | #
7 | # Table name: products
8 | #
9 | # id :integer not null, primary key
10 | # title :string
11 | # description :text
12 | # price :integer
13 | # user_id :integer
14 | # created_at :datetime not null
15 | # updated_at :datetime not null
16 | # category :integer
17 | # category_id :integer
18 | # latitude :float
19 | # longitude :float
20 | # location :string
21 | # image :string
22 | # image_file_name :string
23 | # image_content_type :string
24 | # image_file_size :integer
25 | # image_updated_at :datetime
26 |
27 | FactoryGirl.define do
28 | factory :product do
29 | title 'AWARENESS'
30 | description 'Star Art of Awareness'
31 | price 1900
32 | category 3
33 | category_id 4
34 | latitude 44.05396
35 | longitude '-123.09273'.to_f
36 | location ''
37 | image ''
38 | image_file_name 'awareness-snowflame-thumb.jpg'
39 | image_content_type 'image/jpg'
40 | image_file_size nil
41 | image_updated_at nil
42 | end
43 | end
44 |
--------------------------------------------------------------------------------
/app/controllers/conversations_controller.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 | # code: app/controllers/conversations_controller.rb
3 | # test: spec/controllers/conversations_controller_spec.rb
4 | #
5 | # See FAILING TESTS NOTE: spec/controllers/users_controller_spec.rb
6 | #
7 | # These are Functional Tests for Rail Controllers testing the
8 | # various actions of a single controller. Controllers handle the
9 | # incoming web requests to your application and eventually respond
10 | # with a rendered view.
11 | #
12 | # Conversations Controller
13 | class ConversationsController < ApplicationController
14 | # get conversations for the current user
15 | def index
16 | @conversations = current_user.mailbox.conversations
17 | end
18 |
19 | def inbox
20 | @incoming_messages = current_user.mailbox.inbox
21 | end
22 |
23 | def sentbox
24 | @sent_messages = current_user.mailbox.sentbox
25 | end
26 |
27 | def trash
28 | @deleted_messages = current_user.mailbox.trash
29 | end
30 |
31 | def show
32 | @conversation = current_user.mailbox.conversations.find(params[:id])
33 | end
34 |
35 | def new
36 | @recipients = User.all - [current_user]
37 | end
38 |
39 | def create
40 | recipient = User.find(params[:user_id])
41 | receipt = current_user.send_message(recipient, params[:body], params[:subject])
42 | redirect_to conversations_path(receipt.conversation)
43 | end
44 | end
45 |
--------------------------------------------------------------------------------
/app/views/shopping_carts/show.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
Shopping Cart
3 |
4 |
5 | <%= render :partial => 'shopping_cart_item', :collection => @shopping_cart.shopping_cart_items %>
6 | <%= form_tag shopping_carts_checkout_path do %>
7 |
8 |
9 |
10 | Subtotal: <%= number_to_currency @shopping_cart.subtotal %>
11 |
12 |
13 |
14 | Taxes: <%= number_to_currency @shopping_cart.taxes %>
15 |
16 |
17 |
18 | Total : <%= number_to_currency @shopping_cart.total %>
19 |
20 |
21 |
22 |
23 | <%= link_to 'Back to Products', products_path, class: "btn btn-default btn-info" %>
24 |
29 |
30 |
31 |
32 |
33 |
34 | <% end %>
35 |
36 |
37 |
--------------------------------------------------------------------------------
/sitemap.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 | http://visitmeet.herokuapp.com/
11 | daily
12 | 1.00
13 |
14 |
15 | http://visitmeet.herokuapp.com/visitors/team
16 | daily
17 | 0.80
18 |
19 |
20 | http://visitmeet.herokuapp.com/about
21 | daily
22 | 0.80
23 |
24 |
25 | http://visitmeet.herokuapp.com/users/login
26 | daily
27 | 0.80
28 |
29 |
30 | http://visitmeet.herokuapp.com/users/sign_up
31 | daily
32 | 0.80
33 |
34 |
35 | http://visitmeet.herokuapp.com/visitors/index
36 | daily
37 | 0.80
38 |
39 |
40 | http://visitmeet.herokuapp.com/users/password/new
41 | daily
42 | 0.64
43 |
44 |
--------------------------------------------------------------------------------
/app/views/layouts/_footer.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
Copyright © VisitMeet 2016
10 |
11 | This application is released under Public Alpha Version.
12 |
13 | Company is subjected to make any changes without prior notice.
14 |
15 | You are encouraged to provide feedback to us at any time.
16 |
17 | We are accepting donations through Bountysource. Please check VisitMeet Team page on Bountysource.
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
43 |
--------------------------------------------------------------------------------
/spec/stripe/stripe_config_spec.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 | # code: to be listed when stripe is installed
3 | # test: spec/stripe/strpe_config_spec.rb
4 | describe 'Config Variables' do
5 | describe 'STRIPE_API_KEY' do
6 | # this tests env variables against config/secrets.yml which reads from your env variables $ env
7 | # to set this env variable $ export STRIPE_API_KEY=yourverylongStripApiKey
8 | # to set this heroku config variable in production $ heroku config:add STRIPE_API_KEY=sk_live_yourlongstring
9 | # notice we can retrieve and test the keys in two ways
10 | # it 'a stripe api key is set' do
11 | # api_key = ENV.fetch('STRIPE_API_KEY')
12 | # expect(api_key).to eq(Rails.application.secrets.stripe_api_key),
13 | # 'Your STRIPE_API_KEY is not set, Please refer to the "Configure the Stripe Initializer" section of the README'
14 | # end
15 | end
16 |
17 | describe 'STRIPE_PUBLISHABLE_KEY' do
18 | # to set this env variable $ export STRIPE_PUBLISHABLE_KEY=yourverylongStripPublishableKey
19 | # to set this heroku config variable in production $ heroku config:add STRIPE_PUBLISHABLE_KEY=pk_live_yourlongstring
20 | # it 'a STRIPE_PUBLISHING_KEY is set' do
21 | # expect(ENV['STRIPE_PUBLISHABLE_KEY']).to eq(Rails.application.secrets.stripe_publishable_key),
22 | # 'Your STRIPE_PUBLISHABLE_KEY is not set, Please refer to the "Configure the Stripe Initializer" section of the README'
23 | # end
24 | end
25 | end
26 |
--------------------------------------------------------------------------------
/app/helpers/users_helper.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 | # == Schema Information
3 | #
4 | # Table name: users
5 | #
6 | # id :integer not null, primary key
7 | # email :string default(""), not null
8 | # encrypted_password :string default(""), not null
9 | # reset_password_token :string
10 | # reset_password_sent_at :datetime
11 | # remember_created_at :datetime
12 | # sign_in_count :integer default(0), not null
13 | # current_sign_in_at :datetime
14 | # last_sign_in_at :datetime
15 | # current_sign_in_ip :inet
16 | # last_sign_in_ip :inet
17 | # created_at :datetime not null
18 | # updated_at :datetime not null
19 | # name :string
20 | # confirmation_token :string
21 | # confirmed_at :datetime
22 | # confirmation_sent_at :datetime
23 | # unconfirmed_email :string
24 | # role :integer
25 | # invitation_token :string
26 | # invitation_created_at :datetime
27 | # invitation_sent_at :datetime
28 | # invitation_accepted_at :datetime
29 | # invitation_limit :integer
30 | # invited_by_id :integer
31 | # invited_by_type :string
32 | # invitations_count :integer default(0)
33 | # provider :string
34 | # uid :string
35 | #
36 | # Helpers for User Controller/View
37 | module UsersHelper
38 | end
39 |
--------------------------------------------------------------------------------
/config/locales/devise_invitable.en.yml:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 | en:
3 | devise:
4 | failure:
5 | invited: "You have a pending invitation, accept it to finish creating your account."
6 | invitations:
7 | send_instructions: "An invitation email has been sent to %{email}."
8 | invitation_token_invalid: "The invitation token provided is not valid!"
9 | updated: "Your password was set successfully. You are now signed in."
10 | updated_not_active: "Your password was set successfully."
11 | no_invitations_remaining: "No invitations remaining"
12 | invitation_removed: "Your invitation was removed."
13 | new:
14 | header: "Send invitation"
15 | submit_button: "Send an invitation"
16 | edit:
17 | header: "Set your password"
18 | submit_button: "Set my password"
19 | mailer:
20 | invitation_instructions:
21 | subject: "Invitation instructions"
22 | hello: "Hello %{email}"
23 | someone_invited_you: "Someone has invited you to %{url}, you can accept it through the link below."
24 | accept: "Accept invitation"
25 | accept_until: "This invitation will be due in %{due_date}."
26 | ignore: "If you don't want to accept the invitation, please ignore this email. Your account won't be created until you access the link above and set your password."
27 | time:
28 | formats:
29 | devise:
30 | mailer:
31 | invitation_instructions:
32 | accept_until_format: "%B %d, %Y %I:%M %p"
33 |
--------------------------------------------------------------------------------
/spec/routing/visitors_routing_spec.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 | # code:
3 | # test: spec/routing/visitors_routing_spec.rb
4 | # from $ `rake routes`:
5 | # # Prefix | Verb | URI Pattern | Controller#Action
6 | # # profile_index | GET | /profile/index(.:format) | profile#index
7 | # # users_profile | GET | /users/profile(.:format) | users#profile
8 | # # visitors_index | GET | /visitors/index(.:format) | visitors#index
9 | # # visitors_team | GET | /visitors/team(.:format) | visitors#team
10 | # # pages_about | GET | /pages/about(.:format) | high_voltage/pages#show {:id=>"about"}
11 | #
12 | describe VisitorsController, type: :routing do
13 | describe 'Visitors routing' do
14 | it 'routes to root_path' do
15 | expect(get('/')).to route_to('welcome#index')
16 | end
17 |
18 | it 'routes to visitors#index' do
19 | expect(get('/visitors/index')).to route_to('visitors#index')
20 | end
21 |
22 | it 'routes to visitors#team' do
23 | expect(get('/visitors/team')).to route_to('visitors#team')
24 | end
25 |
26 | # The recognized options:
27 | # <{"controller"=>"devise_invitable/registrations", "action"=>"new"}>
28 | it 'routes to users#sign_up' do
29 | expect(get('/users/sign_up')).to route_to('devise_invitable/registrations#new')
30 | end
31 |
32 | # only way to delete visitors is via console
33 | it 'routes to #destroy' do
34 | expect(delete('/visitors/1')).not_to route_to('visitors#destroy', id: '1')
35 | end
36 | end
37 | end
38 |
--------------------------------------------------------------------------------
/app/views/products/_awareness.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
3 | This is the AWARENESS Star Art.
4 |
5 |
6 |
7 |
8 | Shipping:
9 | Global: $19.00
10 | USA: $11.50
11 |
12 |
13 |
14 | You will receive:
15 |
16 |
17 | 5 AWARENESS
18 | Border Star Art prints for your own artings
19 | <%= image_tag('awareness-thumb.jpg', size: '180x315', alt: 'AWARENESS thumbnail') %>
20 |
21 |
22 |
23 |
24 |
25 | 1 AWARENESS
26 | SnowFlame Star Art print delighting all who see it
27 | <%= image_tag('awareness-snowflame-thumb.jpg', size: '180x315', alt: 'AWARENESS thumbnail') %>
28 |
29 |
30 |
31 | <%= image_tag('awareness-snowflame.jpg', size: '1122x419', alt: 'AWARENESS SnowFlame') %>
32 |
33 |
34 |
35 |
45 |
46 | <%= image_tag('awareness.jpg', size: '1122x419', alt: 'AWARENESS Star Art') %>
47 |
48 |
49 |
50 |
51 |
52 |
--------------------------------------------------------------------------------
/db/migrate/20160115121043_devise_create_users.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 | class DeviseCreateUsers < ActiveRecord::Migration
3 | def change
4 | create_table(:users) do |t|
5 | ## Database authenticatable
6 | t.string :email, null: false, default: ''
7 | t.string :encrypted_password, null: false, default: ''
8 |
9 | ## Recoverable
10 | t.string :reset_password_token
11 | t.datetime :reset_password_sent_at
12 |
13 | ## Rememberable
14 | t.datetime :remember_created_at
15 |
16 | ## Trackable
17 | t.integer :sign_in_count, default: 0, null: false
18 | t.datetime :current_sign_in_at
19 | t.datetime :last_sign_in_at
20 | t.inet :current_sign_in_ip
21 | t.inet :last_sign_in_ip
22 |
23 | ## Confirmable
24 | # t.string :confirmation_token
25 | # t.datetime :confirmed_at
26 | # t.datetime :confirmation_sent_at
27 | # t.string :unconfirmed_email # Only if using reconfirmable
28 |
29 | ## Lockable
30 | # t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts
31 | # t.string :unlock_token # Only if unlock strategy is :email or :both
32 | # t.datetime :locked_at
33 |
34 | t.timestamps null: false
35 | end
36 |
37 | add_index :users, :email, unique: true
38 | add_index :users, :reset_password_token, unique: true
39 | # add_index :users, :confirmation_token, unique: true
40 | # add_index :users, :unlock_token, unique: true
41 | end
42 | end
43 |
--------------------------------------------------------------------------------
/spec/models/category_spec.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 | # spec/models/category_spec.rb
3 | # testing app/models/category.rb
4 | #
5 | # Migrations
6 | #
7 | # db/migrate/20160118081841_create_products.rb
8 | # db/migrate/20160203171325_add_categories_to_product.rb
9 | # db/migrate/20160304162459_create_categories.rb
10 | # db/migrate/20160304162257_add_category_id_to_products.rb
11 | # db/migrate/20160304163929_remove_category_from_products.rb
12 | #
13 | # == Schema Information
14 | #
15 | # Table name: categories
16 | #
17 | # id :integer not null, primary key
18 | # name :string
19 | # created_at :datetime not null
20 | # updated_at :datetime not null
21 | #
22 | include Warden::Test::Helpers
23 | Warden.test_mode!
24 |
25 | RSpec.describe Category, type: :model do
26 | after(:each) do
27 | Warden.test_reset!
28 | end
29 |
30 | it 'has a valid factory' do
31 | expect(build(:category)).to be_valid
32 |
33 | category = FactoryGirl.create(:category)
34 | expect(category.persisted?).to eq true
35 | expect(category.name).to_not be nil
36 | expect(category.name).to eq 'Foods'
37 | end
38 |
39 | it 'allows a new category to be added' do
40 | pending 'write the code we wish we had'
41 | expect(2 + 2).to eq 5
42 | end
43 |
44 | it 'allows a category to be deleted' do
45 | pending 'write the code we wish we had'
46 | expect(2 * 2).to eq 5
47 | end
48 |
49 | it 'associates categories with products' do
50 | pending 'write the code we wish we had'
51 | expect(2 / 2).to eq 'what'
52 | end
53 | end
54 |
--------------------------------------------------------------------------------
/config/locales/devise_invitable.fr.yml:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 | fr:
3 | devise:
4 | failure:
5 | invited: "Vous avez une invitation en attente, veuillez l'accepter afin de créer votre compte."
6 | invitations:
7 | send_instructions: "Un e-mail d'invitation a été envoyé à %{email}."
8 | invitation_token_invalid: "Le jeton d'invitation fourni n'est pas valide !"
9 | updated: "Votre mot de passe a été défini avec succès. Vous êtes maintenant connecté."
10 | no_invitations_remaining: "Il n'y a plus d'invitation restante"
11 | invitation_removed: 'Votre invitation a été supprimée.'
12 | new:
13 | header: "Envoyer une invitation"
14 | submit_button: "Envoyer l'invitation"
15 | edit:
16 | header: "Définissez votre mot de passe"
17 | submit_button: "Valider mon mot de passe"
18 | mailer:
19 | invitation_instructions:
20 | subject: "Instructions d'invitation"
21 | hello: "Bonjour %{email}"
22 | someone_invited_you: "Quelqu'un vous a invité %{url}, vous pouvez accepter cette invitation en cliquant sur le lien suivant :"
23 | accept: "Accepter l'invitation"
24 | accept_until: "Cette invitation expirera le %{due_date}."
25 | ignore: "Si vous ne voulez pas accepter cette invitation, veuillez ignorer cet email. Votre compte ne sera créé que si vous cliquez sur le lien suivant et que vous définissez un mot de passe."
26 | time:
27 | formats:
28 | devise:
29 | mailer:
30 | invitation_instructions:
31 | accept_until_format: "%B %d, %Y %I:%M %p"
32 |
--------------------------------------------------------------------------------
/app/helpers/admin/application_helper.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 | # code: app/helpers/admin/application_helper.rb
3 | # test: to be determined
4 | #
5 | # See FAILING TESTS NOTE: spec/controllers/users_controller.rb
6 | # the above note concerns the NoMethodError: undefined method `authenticate!' for nil:NilClass
7 | #
8 | module Admin::ApplicationHelper
9 | # `helper_method` placed in app/controllers/application_controller.rb : reference :
10 | # http://stackoverflow.com/questions/4081744/devise-form-within-a-different-controller
11 | # helper_method :resource_name, :resource_class, :resource, :devise_mapping
12 |
13 | # reference for next three methods
14 | # http://stackoverflow.com/questions/14866353/devise-sign-in-not-completing
15 | # also see admin_controller? method in app/controllers/application_controller.rb
16 | def resource_name
17 | @resource_name ||= if admin_controller?
18 | :admin_user
19 | else
20 | :user
21 | end
22 | end # rubocop passes the format above
23 |
24 | def resource
25 | @resource ||= resource_name.to_s.classify.constantize.new
26 | # @resource ||= User.new : old ? ^^ new ??
27 | end
28 |
29 | def devise_mapping
30 | @devise_mapping ||= Devise.mappings[resource_name]
31 | # @devise_mapping ||= Devise.mappings[:user] : old ? ^^ new ?
32 | end
33 |
34 | # resource_class reference:
35 | # http://stackoverflow.com/questions/15348421/devise-render-sign-up-in-form-partials-elsewhere-in-code
36 | def resource_class
37 | devise_mapping.to
38 | end
39 | end
40 |
--------------------------------------------------------------------------------
/spec/models/profile_spec.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 | # code: app/models/profile.rb
3 | # also: spec/factories/profiles.rb
4 | # test: spec/models/profile_spec.rb
5 | #
6 | # Migrations : last verified accurate : 20160422 ko
7 | # # db/migrate/20160303161926_create_profiles.rb
8 | # # db/migrate/20160305150015_add_name_to_profile.rb
9 | # # db/migrate/20160412165928_add_bio_to_profile.rb
10 | # # db/schema.rb
11 | #
12 | # == Schema Information
13 | # Table name: profiles
14 | # id :integer not null, primary key
15 | # name :string
16 | # bio :text
17 | # user_id :integer
18 | # created_at :datetime not null
19 | # updated_at :datetime not null
20 | #
21 | include Warden::Test::Helpers
22 | Warden.test_mode!
23 |
24 | RSpec.describe Profile, type: :model do
25 | after(:each) do
26 | Warden.test_reset!
27 | end
28 |
29 | it 'has a valid factory' do
30 | user = FactoryGirl.create(:user, email: 'profileme@example.com')
31 | expect(user.persisted?).to eq true
32 | expect(FactoryGirl.build(:profile)).to be_valid
33 |
34 | profile = FactoryGirl.create(
35 | :profile, user_id: 1,
36 | name: 'any string i want it to be',
37 | bio: 'any text i want it to be, as long as the text column is set'
38 | )
39 | expect(profile.user_id).to eq 1
40 | expect(Profile.last.user_id).not_to eq nil
41 | expect(Profile.last.user_id).to eq 1
42 | expect(profile.name).to eq 'any string i want it to be'
43 | expect(profile.persisted?).to eq true
44 | expect(profile.bio).to eq 'any text i want it to be, as long as the text column is set'
45 | end
46 | end
47 |
--------------------------------------------------------------------------------
/spec/features/users/user_delete_spec.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 | # code: user delete action
3 | # test: spec/features/users/user_delete_spec.rb
4 | #
5 | # see NOTE ON : include Devise::TestHelpers at top of
6 | # # spec/features/users/sign_in_spec.rb
7 | # # include Devise::TestHelpers
8 | include Warden::Test::Helpers
9 | Warden.test_mode!
10 | # Feature: User delete
11 | # As a user
12 | # I want to delete my user profile
13 | # So I can close my account
14 | feature 'User delete', :devise, js: true do
15 | before(:each) do
16 | FactoryGirl.reload
17 | end
18 |
19 | after(:each) do
20 | Warden.test_reset!
21 | end
22 |
23 | # Scenario: User can delete own account
24 | # Given I am signed in
25 | # When I delete my account
26 | # Then I should see an account deleted message
27 | # User cannot currently delete their own account : noted 20160131
28 | scenario 'user cannot delete own account' do
29 | # @request.env["devise.mapping"] = Devise.mappings[:user]
30 | user = FactoryGirl.create(:user, email: 'destroyme@example.com')
31 | login_as(user, scope: :user)
32 |
33 | visit edit_user_registration_path(user)
34 | expect(current_path).to match(%r{users/edit.\d})
35 | expect(current_path).to eq "/users/edit.#{user.id}"
36 | expect(page).to have_content 'Cancel my account'
37 |
38 | click_link_or_button 'Cancel my account'
39 | page.driver.browser.switch_to.alert.accept
40 | # expect(page).to have_content 'Welcome'
41 | expect(current_path).to eq '/'
42 | # TODO: get this next test working again:
43 | # expect(page).to have_content I18n.t 'devise.registrations.destroyed'
44 | end
45 | end
46 |
--------------------------------------------------------------------------------
/app/controllers/shopping_carts_controller.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 | # code: app/controllers/shopping_cart_controller.rb
3 | # test: spec/controllers/shopping_cart_controller_spec.rb
4 | #
5 | # See FAILING TESTS NOTE: spec/controllers/users_controller.rb
6 | # the above note concerns the NoMethodError: undefined method `authenticate!' for nil:NilClass
7 | #
8 | # Shopping Carts controller
9 | class ShoppingCartsController < ApplicationController
10 | before_action :extract_shopping_cart
11 |
12 | def index
13 | end
14 |
15 | def create
16 | @product = Product.find(params[:product_id])
17 | @shopping_cart.add(@product, @product.price)
18 | redirect_to shopping_cart_path(@shopping_cart)
19 | end
20 |
21 | def checkout
22 | @@customer = Stripe::Customer.create email: stripe_params["stripeEmail"],
23 | card: stripe_params["stripeToken"]
24 |
25 | Stripe::Charge.create customer: @@customer,
26 | amount: (@shopping_cart.total * 100).round,
27 | description: "Bought by: " + current_user.email,
28 | currency: 'usd'
29 | redirect_to products_path
30 | flash[:notice] = "Succefully made payment of $" + @shopping_cart.total.to_s
31 | end
32 |
33 | def show
34 | end
35 |
36 | private
37 |
38 | def extract_shopping_cart
39 | shopping_cart_id = session[:shopping_cart_id]
40 | @shopping_cart = session[:shopping_cart_id] ? ShoppingCart.find(shopping_cart_id) : ShoppingCart.create
41 | session[:shopping_cart_id] = @shopping_cart.id
42 | end
43 |
44 | def stripe_params
45 | params.permit :stripeEmail, :stripeToken
46 | end
47 | end
48 |
--------------------------------------------------------------------------------
/public/500.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | We're sorry, but something went wrong (500)
5 |
6 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
We're sorry, but something went wrong.
62 |
63 |
If you are the application owner check the logs for more information.
64 |
65 |
66 |
67 |
--------------------------------------------------------------------------------
/app/views/products/show.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | <%= link_to image_tag(@product.image.url, class: 'media-object'), @product.image.url, target: '_blank' %>
8 |
9 |
10 |
11 |
12 | <%= @product.title %>
13 |
14 |
15 | <%= @product.description %>
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 | <%= number_to_currency @product.price %>
26 |
27 |
In Stock
28 |
29 | <%= link_to 'Add to cart', shopping_cart_path(@product.id), class: 'btn btn-success' %>
30 |
31 |
32 |
33 | Add to wishlist
34 |
35 |
36 | <% if user_signed_in? %>
37 | <% if current_user.role? == 'admin' %>
38 | <%= link_to 'Edit', edit_product_path(@product) %> |
39 | <% end %>
40 | <% end %>
41 | <%= link_to 'Back to Product page', products_path, 'data-no-turbolink': true, class: 'btn btn-primary' %>
42 |
43 |
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/public/422.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | The change you wanted was rejected (422)
5 |
6 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
The change you wanted was rejected.
62 |
Maybe you tried to change something you didn't have access to.
63 |
64 |
If you are the application owner check the logs for more information.
65 |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/public/404.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | The page you were looking for doesn't exist (404)
5 |
6 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
The page you were looking for doesn't exist.
62 |
You may have mistyped the address or the page may have moved.
63 |
64 |
If you are the application owner check the logs for more information.
65 |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/app/assets/stylesheets/modern-business.css.scss:
--------------------------------------------------------------------------------
1 | /*!
2 | * Start Bootstrap - Modern Business HTML Template (http://startbootstrap.com)
3 | * Code licensed under the Apache License v2.0.
4 | * For details, see http://www.apache.org/licenses/LICENSE-2.0.
5 | */
6 | /* ref:: http://guides.rubyonrails.org/asset_pipeline.html */
7 |
8 | /* Global Styles */
9 | html,
10 | body {
11 | height: 100%;
12 | }
13 | body {
14 | /* padding-top: 50px; Required padding for .navbar-fixed-top. Remove if using .navbar-static-top. Change if height of navigation changes. */
15 | padding-top: 20px; /* Neither of the above are being used. */
16 | }
17 | .img-portfolio {
18 | margin-bottom: 30px;
19 | }
20 | .img-hover:hover {
21 | opacity: 0.8;
22 | }
23 | /* Home Page Carousel */
24 | header.carousel {
25 | height: 50%;
26 | }
27 | header.carousel .item,
28 | header.carousel .item.active,
29 | header.carousel .carousel-inner {
30 | height: 100%;
31 | }
32 | header.carousel .fill {
33 | width: 100%;
34 | height: 100%;
35 | background-position: center;
36 | background-size: cover;
37 | }
38 | /* 404 Page Styles */
39 | .error-404 {
40 | font-size: 100px;
41 | }
42 | /* Pricing Page Styles */
43 | .price {
44 | display: block;
45 | font-size: 50px;
46 | line-height: 50px;
47 | }
48 | .price sup {
49 | top: -20px;
50 | left: 2px;
51 | font-size: 20px;
52 | }
53 | .period {
54 | display: block;
55 | font-style: italic;
56 | }
57 | /* Footer Styles */
58 | footer {
59 | margin: 50px 0;
60 | }
61 | /* Responsive Styles */
62 | @media(max-width:991px) {
63 | .customer-img,
64 | .img-related {
65 | margin-bottom: 30px;
66 | }
67 | }
68 | @media(max-width:767px) {
69 | .img-portfolio {
70 | margin-bottom: 15px;
71 | }
72 | header.carousel .carousel {
73 | height: 70%;
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/app/views/products/_form.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
3 | <% content_for :head do %>
4 | <%= javascript_include_tag 'http://maps.googleapis.com/maps/api/js?libraries=places&sensor=false' %>
5 | <%= javascript_include_tag 'jquery.geocomplete.js' %>
6 | <% end %>
7 | <%= simple_form_for @product, html: { multipart: true } do |p| %>
8 | <% if @product.errors.any? %>
9 |
10 |
11 | <%= pluralize(@product.errors.count, 'error') %>
12 | prohibited this article from being saved:
13 |
14 |
15 | <% @product.errors.full_messages.each do |msg| %>
16 | <%= msg %>
17 | <% end %>
18 |
19 |
20 | <% end %>
21 |
22 | <%= p.input :title %>
23 |
24 |
25 | <%= p.input :description %>
26 |
27 |
28 | <%= p.input :price %>
29 |
30 |
31 | <%= p.input :location %>
32 |
33 |
34 |
35 | *
36 | Image
37 |
38 |
39 | <%= p.file_field :image %>
40 |
41 |
42 |
43 | *
44 | Category
45 |
46 |
47 |
48 | <%= p.collection_select(:category_id, Category.all, :id, :name) %>
49 |
50 | <%= p.button :submit, class: 'btn btn-primary' %>
51 | <% end %>
52 |
53 |
54 |
55 |
58 |
--------------------------------------------------------------------------------
/app/models/product.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 | # code: app/models/product.rb
3 | # tests: spec/models/product_spec.rb
4 | #
5 | # Migrations
6 | #
7 | # db/migrate/20160115121043_devise_create_users.rb
8 | # db/migrate/20160115121047_add_name_to_users.rb
9 | # db/migrate/20160115121051_add_confirmable_to_users.rb
10 | # db/migrate/20160115121058_add_role_to_users.rb
11 | # db/migrate/20160115121151_devise_invitable_add_to_users.rb
12 | # db/migrate/20160118081841_create_products.rb
13 | # db/migrate/20160125172412_add_omniauth_to_users.rb
14 | # db/migrate/20160303161926_create_profiles.rb
15 | #
16 | # == Schema Information
17 | #
18 | # Table name: products : last verified accurate 20160417 -ko
19 | #
20 | # id :integer not null, primary key
21 | # title :string
22 | # description :text
23 | # price :integer
24 | # user_id :integer
25 | # created_at :datetime not null
26 | # updated_at :datetime not null
27 | # category :integer
28 | # latitude :float
29 | # longitude :float
30 | # location :string
31 | # category_id :integer
32 | # image_file_name :string
33 | # image_content_type :string
34 | # image_file_size :integer
35 | # image_updated_at :datetime
36 | #
37 | class Product < ActiveRecord::Base
38 | validates :title, presence: true, length: { maximum: 60 }
39 | validates :description, presence: true, length: { maximum: 160 }
40 | validates :price, numericality: { less_than_or_equal_to: 999_999_00 } # stripe limit is 99999999 in cents
41 | validates :price, numericality: { greater_than_or_equal_to: 98 } # minimum in cents in US currency
42 |
43 | enum category: [:Foods, :Travels, :Lodges, :Shops]
44 |
45 | belongs_to :user
46 | belongs_to :category
47 |
48 | geocoded_by :location
49 | after_validation :geocode
50 |
51 | has_attached_file :image
52 | validates_attachment_content_type :image, content_type: ['image/jpg', 'image/jpeg', 'image/png', 'image/gif']
53 | end
54 |
--------------------------------------------------------------------------------
/public/assets/normalize-rails/normalize-f7978b7258ff8172fb5553402664fdded2759efb041e94dce212e4d7cc914c13.css:
--------------------------------------------------------------------------------
1 | /*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,hgroup,main,menu,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background-color:transparent}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:bold}dfn{font-style:italic}h1{font-size:2em;margin:0.67em 0}mark{background:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-0.5em}sub{bottom:-0.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:1em 40px}hr{box-sizing:content-box;height:0}pre{overflow:auto}code,kbd,pre,samp{font-family:monospace, monospace;font-size:1em}button,input,optgroup,select,textarea{color:inherit;font:inherit;margin:0}button{overflow:visible}button,select{text-transform:none}button,html input[type="button"],input[type="reset"],input[type="submit"]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}input{line-height:normal}input[type="checkbox"],input[type="radio"]{box-sizing:border-box;padding:0}input[type="number"]::-webkit-inner-spin-button,input[type="number"]::-webkit-outer-spin-button{height:auto}input[type="search"]{-webkit-appearance:textfield;box-sizing:content-box}input[type="search"]::-webkit-search-cancel-button,input[type="search"]::-webkit-search-decoration{-webkit-appearance:none}fieldset{border:1px solid #c0c0c0;margin:0 2px;padding:0.35em 0.625em 0.75em}legend{border:0;padding:0}textarea{overflow:auto}optgroup{font-weight:bold}table{border-collapse:collapse;border-spacing:0}td,th{padding:0}
2 |
--------------------------------------------------------------------------------
/spec/features/visitors/about_page_spec.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 | # code: app/views/pages/about.html.erb
3 | # code: spec/support/selectors.rb
4 | # test: spec/features/visitors/about_page_spec.rb
5 | #
6 | include Selectors
7 | include Warden::Test::Helpers
8 | Warden.test_mode!
9 | # Feature: 'About' page
10 | # As a visitor
11 | # I want to visit an 'about' page
12 | # So I can learn more about the website
13 | feature 'About page' do
14 | # Scenario: Visit the 'about' page
15 | # Given I am a visitor
16 | # When I visit the 'about' page
17 | # Then I see 'About the Website'
18 | scenario 'Visit the about page' do
19 | visit page_path('about')
20 | visit '/about'
21 | expect(current_path).to eq '/about'
22 | expect(page).to have_selector('#twowhales')
23 | # TODO: Write the xpath finder to verify the 'alt' text is 'Two Whales'
24 | # TODO: Write the xpath finder to verify the image address is 'two-whales.jpg'
25 | # TODO: Write the xpath finder to verify the 'class' is 'img-responsive'
26 | # <%= image_tag('two-whales.jpg', class: 'img-responsive',
27 | # height: '468',
28 | # width: '459',
29 | # alt: 'Two Whales'
30 | # ) %>
31 | # We are not displaying the image title:
32 | expect(page).not_to have_content 'Two Whales'
33 | expect(page).to have_content 'What About VisitMeet . . that makes it unique'
34 | expect(page).to have_content 'Three strangers meet and visit . .'
35 | expect(page).to have_content 'and in what you might consider a middle of nowhere,'
36 | expect(page).to have_content 'they share their story of how they came to be at that roadside cafe.'
37 | expect(page).to have_content 'A native born asked the two strangers that question.'
38 | expect(page).to have_content 'One was a Guide for a tour company, and the other the Traveller.'
39 | expect(page).to have_selector('#twowhales')
40 | end
41 | end
42 |
--------------------------------------------------------------------------------
/app/views/layouts/_carousel.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
Meetings and Eatings
17 |
18 |
19 |
20 |
21 |
22 |
Lodgings and Sleepings
23 |
24 |
25 |
26 |
27 |
28 |
Guides and Travellings
29 |
30 |
31 |
32 |
33 |
34 |
Visiting and Exchanging
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/spec/routing/products_routing_spec.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 | # code: config/routes.rb
3 | # test: spec/routing/products_routing_spec.rb
4 | RSpec.configure do
5 | include Warden::Test::Helpers
6 | end
7 | Warden.test_mode!
8 |
9 | # Feature: Products routing
10 | # As an administrator
11 | # I want to test products and product routings
12 | # So I can verify our product routes
13 | describe ProductsController, type: :routing do
14 | before(:each) do
15 | FactoryGirl.reload
16 | @product = FactoryGirl.create(:product)
17 | end
18 |
19 | after(:each) do
20 | Warden.test_reset!
21 | end
22 |
23 | describe 'Products routing' do
24 | it 'routes to products_path' do
25 | expect(get(products_path)).to route_to('products#index')
26 | end
27 |
28 | it 'routes to individual product' do
29 | visit "/products/#{@product.id}"
30 | expect(current_path).to eq '/products/2'
31 |
32 | product = FactoryGirl.create(:product)
33 | visit "/products/#{product.id}"
34 | expect(current_path).to eq '/products/3'
35 | expect(page).to have_current_path(product_path(product))
36 |
37 | product = Product.last
38 | expect(page).to have_current_path(product_path(product))
39 | expect(page.current_path).to eq(product_path(product))
40 | expect(page.current_path).to eq(product_path(product.id))
41 | end
42 |
43 | it 'routes to admin/products#index' do
44 | expect(get('admin/products#index')).to route_to('admin/products#index')
45 | end
46 |
47 | it 'routes to DashboardManifest::ROOT_DASHBOARD, action: :index admin_products/show/#index' do
48 | user = FactoryGirl.build(:user, email: 'dashboard@example.com')
49 | user.role = 'admin'
50 | user.save!
51 | expect(User.last.persisted?).to be true
52 | expect(User.first).not_to eq nil
53 | expect(User.first.role).to eq 'admin'
54 | expect(User.last).to eq User.first
55 | expect(get(admin_products_path)).to route_to(controller: 'admin/products', action: 'index')
56 | end
57 | end
58 | end
59 |
--------------------------------------------------------------------------------
/app/assets/stylesheets/shopping_cart.css.scss:
--------------------------------------------------------------------------------
1 | /* CSS used here will be applied after bootstrap.css *//* CSS used here will be applied after bootstrap.css */
2 | .menu
3 | {
4 | background-color:#274A77;
5 | margin-right:-22px;
6 | height:50px;
7 | padding-top:3px
8 | }
9 | .header
10 | {
11 | margin-left:0px;
12 | margin-right:20px;
13 | padding-top:10px;
14 | padding-bottom:10px;
15 | }
16 |
17 | .navbar
18 | {
19 | display:block;
20 |
21 |
22 | }
23 |
24 | .product-list {
25 | margin-top: 25px;
26 | }
27 |
28 | .product-list .product {
29 | border: 1px solid #eee;
30 | border-radius: 3px;
31 | padding: 10px;
32 | margin-bottom: 20px;
33 | text-align: center;
34 | min-height: 300px;
35 | }
36 | .product-list .product .product-info {
37 | min-height: 220px;
38 | }
39 | .product-info button
40 | {
41 | border:0;
42 | background:none;
43 | }
44 | .navbar-nav>li>a
45 | {
46 | color:#fff;
47 | margin-top:-2px;
48 | margin-bottom:0px;
49 | padding-bottom:14px;
50 | padding-top:14px;
51 | }
52 | .navbar-default .navbar-nav>.active>a, .navbar-default .navbar-nav>.active>a:hover, .navbar-default .navbar-nav>.active>a:focus
53 | {
54 | background-color:#FFFFFF;
55 | color:#274A77;
56 | font-weight:bold;
57 | }
58 | .navbar-default .navbar-nav>li>a
59 | {
60 | color:#FFF;
61 | }
62 | .navbar-toggle, .navbar-toggle:hover
63 | {
64 | margin-right:35px;
65 |
66 |
67 | }
68 | .navbar-default .navbar-toggle,.navbar-default .navbar-toggle:hover
69 | {
70 | background:none;
71 | border:0px;
72 | }
73 | .navbar-default .navbar-toggle .icon-bar
74 | {
75 | background-color:#FFF;
76 | }
77 | .navbar-default .navbar-toggle .icon-bar:hover
78 | {
79 | background-color:#CCC;
80 | border-bottom:1px solid #FFF;
81 | }
82 | @media(max-width:991px){
83 | .categories-menu
84 | {
85 | border-top:solid 1px #EEE;
86 | margin-bottom:10px;
87 | padding:10px;
88 | padding-right:14px;
89 | padding-top:5px;
90 | padding-bottom:5px;
91 | }
92 | }
93 |
94 | .product-row
95 | {
96 | border-bottom:2px dashed #DEDEDE;padding-bottom:10px;
97 | padding-top:10px;
98 | }
--------------------------------------------------------------------------------
/app.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "First use of a variable acts as a comment",
3 | "name": "Visitmeet",
4 | "description": "http://stackoverflow.com/questions/244777/can-i-use-comments-inside-a-json-file"
5 | "description": "Travel cheaply, visit, meet, exchange, and so much more",
6 | "logo": "/assets/images/favicon.jpg and remember, first use of variable acts as a comment",
7 | "logo": "https://avatars3.githubusercontent.com/u/788200",
8 | "repository": "https://github.com/bishishtbhatta/visitmeet",
9 | "keywords": [
10 | "Guides",
11 | "Travellers",
12 | "Foods",
13 | "Shops",
14 | "Travelling",
15 | "Locals",
16 | "Arts",
17 | "Products",
18 | "Services",
19 | "Exchanges",
20 | "Offers",
21 | "Acceptances",
22 | "Trades",
23 | "Cheap Travel",
24 | "Develop Poor Country"
25 | ],
26 | "scripts": {"postdeploy": "bundle exec rake db:migrate; bundle exec rake db:seed"},
27 | "env": {
28 | "SENDGRID_SMTP_USERNAME": {
29 | "description": "Your SENDGRID_SMTP_USERNAME for sending mail.",
30 | "value": ENV['SENDGRID_SMTP_USERNAME'],
31 | "required": false
32 | },
33 | "SENDGRID_SMTP_PASSWORD": {
34 | "description": "Your SENDGRID_SMTP_PASSWORD for sending mail.",
35 | "value": ENV['SENDGRID_SMTP_PASSWORD'],
36 | "required": false
37 | },
38 | "ADMIN_EMAIL": {
39 | "description": "The administrator's email address for signing in.",
40 | "value": ENV['ADMIN_EMAIL'],
41 | "required": true
42 | },
43 | "ADMIN_PASSWORD": {
44 | "description": "The administrator's password for signing in.",
45 | "value": ENV['ADMIN_PASSWORD'],
46 | "required": true
47 | },
48 | "DOMAIN_NAME": {
49 | "description": "Required for sending mail. Give an app name or use a custom domain.",
50 | "value": "visitmeet.herokuapp.com",
51 | "required": false
52 | },
53 | "addons": {
54 | "addons": [
55 | "zerigo_dns:zerigo-dns-asymmetrical-90919",
56 | "heroku-postgresql:postgresql-clear-61373"
57 | ]
58 | }
59 | "RAILS_ENV": "production"
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/spec/features/visitors/navigation_spec.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 | # code: app/views/layouts/_navigation.html.erb
3 | # test: spec/features/visitors/navigation_spec.rb
4 | #
5 | include Warden::Test::Helpers
6 | Warden.test_mode!
7 | # Feature: Navigation links
8 | # As a visitor
9 | # I want to see navigation links
10 | # So I can find home, sign in, or sign up
11 | feature 'Navigation links', :devise, js: true do
12 | before(:each) do
13 | FactoryGirl.reload
14 | end
15 |
16 | after(:each) do
17 | Warden.test_reset!
18 | end
19 |
20 | # Scenario: View navigation links
21 | # Given I am a visitor
22 | # When I visit the home page
23 | # Then I see "VisitMeet," and "Login"
24 | scenario 'view navigation links on sign_up page' do
25 | visit new_user_registration_path
26 | expect(current_path).to eq '/users/sign_up'
27 | expect(page).to have_content 'VisitMeet'
28 | expect(page).to have_content 'Visit'
29 | expect(page).to have_content 'Meet'
30 | expect(page).to have_content 'Products'
31 | # expect(page).to have_content 'Services'
32 | expect(page).to have_content 'Register to Visit & Meet'
33 | expect(page).to have_content 'Already have an account? Log in'
34 | expect(page).to have_content 'Sign in with GitHub'
35 | expect(page).to have_content 'Copyright © VisitMeet 2016'
36 |
37 | click_on 'Login'
38 | expect(current_path).to eq '/users/login'
39 | end
40 |
41 | scenario 'view navigation links on home page' do
42 | visit root_path
43 | expect(current_path).to eq '/'
44 | # expect(current_path).to eq '/welcome/index'
45 | expect(page).to have_link 'Login'
46 | within '.jumbotron h2 b' do
47 | expect(page).to have_content 'VisitMeet'
48 | end
49 |
50 | click_on 'Login'
51 | expect(current_path).to eq '/users/login'
52 | end
53 |
54 | scenario 'users login page does not display Login link' do
55 | visit new_user_session_path
56 | expect(current_path).to eq '/users/login'
57 | expect(page).to have_link 'Sign up'
58 | expect(page).to have_link 'Login'
59 | expect(page).to have_content 'Login'
60 | expect(page).to have_link 'About'
61 | expect(page).to have_link 'Team'
62 | expect(page).to have_link 'Products'
63 | expect(page).to have_link 'VisitMeet'
64 | end
65 | end
66 |
--------------------------------------------------------------------------------
/config/application.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 | # code: config/application.rb
3 | # test: TODO: to be identified
4 | require File.expand_path('../boot', __FILE__)
5 |
6 | require 'rails/all'
7 |
8 | # Require the gems listed in Gemfile, including any gems
9 | # you've limited to :test, :development, or :production.
10 | Bundler.require(*Rails.groups)
11 |
12 | module Visitmeet
13 | # generates test framework and factories
14 | class Application < Rails::Application
15 | config.generators do |g|
16 | g.test_framework :rspec,
17 | fixtures: true,
18 | view_specs: false,
19 | helper_specs: false,
20 | routing_specs: false,
21 | controller_specs: false,
22 | request_specs: false
23 | g.fixture_replacement :factory_girl, dir: 'spec/factories'
24 | end
25 |
26 | # Settings in config/environments/* take precedence over those specified here.
27 | # Application configuration should go into files in config/initializers
28 | # -- all .rb files in that directory are automatically loaded.
29 |
30 | # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
31 | # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
32 | # config.time_zone = 'Central Time (US & Canada)'
33 |
34 | # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
35 | # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
36 | # config.i18n.default_locale = :de
37 |
38 | # Do not swallow errors in after_commit/after_rollback callbacks.
39 | config.active_record.raise_in_transactional_callbacks = true
40 |
41 | # precompile the assets.
42 | # this line addeed by bishisht.
43 | config.assets.precompile += %w(.jpg)
44 |
45 | config.encoding = 'utf-8'
46 |
47 | # Version of your assets, change this if you want to expire all your assets
48 | config.assets.version = '1.0'
49 |
50 | config.before_configuration do
51 | env_file = File.join(Rails.root, 'config', 'local_env.yml')
52 | YAML.load(File.open(env_file)).each do |key, value|
53 | ENV[key.to_s] = value
54 | end if File.exist?(env_file)
55 | end
56 | end
57 | end
58 |
--------------------------------------------------------------------------------
/config/environments/test.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 | # code: config/environments/test.rb
3 | # test: spec/config/ : assigned kathyonu : 20160416
4 | Rails.application.configure do
5 | # Settings specified here will take precedence over those in config/application.rb.
6 |
7 | # The test environment is used exclusively to run your application's
8 | # test suite. You never need to work with it otherwise. Remember that
9 | # your test database is "scratch space" for the test suite and is wiped
10 | # and recreated between test runs. Don't rely on the data there!
11 | config.cache_classes = true
12 |
13 | # Do not eager load code on boot. This avoids loading your whole application
14 | # just for the purpose of running a single test. If you are using a tool that
15 | # preloads Rails for running tests, you may have to set it to true.
16 | config.eager_load = false
17 |
18 | # Configure static file server for tests with Cache-Control for performance.
19 | config.serve_static_files = true
20 | config.static_cache_control = 'public, max-age=3600'
21 |
22 | # Show full error reports and disable caching.
23 | config.consider_all_requests_local = true
24 | config.action_controller.perform_caching = false
25 |
26 | # Raise exceptions instead of rendering exception templates.
27 | config.action_dispatch.show_exceptions = false
28 |
29 | # Disable request forgery protection in test environment.
30 | config.action_controller.allow_forgery_protection = false
31 |
32 | # Tell Action Mailer not to deliver emails to the real world.
33 | # The :test delivery method accumulates sent emails in the
34 | # ActionMailer::Base.deliveries array.
35 | config.action_mailer.delivery_method = :test
36 | config.action_mailer.default_url_options = { host: Rails.application.secrets.domain_name }
37 |
38 | # Randomize the order test cases are executed.
39 | config.active_support.test_order = :random
40 |
41 | # Print deprecation notices to the stderr.
42 | config.active_support.deprecation = :stderr
43 |
44 | # Raises error for missing translations : also in development.rb
45 | # TODO: Research how this command works, then uncomment as need be
46 | # config.action_view.raise_on_missing_translations = true
47 |
48 | # Enable stdout logger
49 | config.logger = Logger.new(STDOUT)
50 |
51 | # Set log level
52 | config.log_level = :ERROR
53 | end
54 |
--------------------------------------------------------------------------------
/app/helpers/application_helper.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 | # code: app/controllers/application_controller.rb
3 | #
4 | # See FAILING TESTS NOTE: spec/controllers/users_controller.rb
5 | # the above note concerns the NoMethodError: undefined method `authenticate!' for nil:NilClass
6 | #
7 | # ######################
8 | # SECURITY UPGRADE NOTE:
9 | # REFERENCE: http://edgeguides.rubyonrails.org/4_1_release_notes.html
10 | # 2.8 CSRF protection from remote