Admin Dashboard - #274
Conversation
| :recieving_hours, | ||
| :days_closed, | ||
| :is_approved, | ||
| :is_rejected, |
There was a problem hiding this comment.
Avoid comma after the last item of an array.
| # FORM_ATTRIBUTES | ||
| # an array of attributes that will be displayed | ||
| # on the model's form (`new` and `edit`) pages. | ||
| FORM_ATTRIBUTES = [ |
There was a problem hiding this comment.
Use %i or %I for an array of symbols.
| :recieving_hours, | ||
| :days_closed, | ||
| :is_approved, | ||
| :is_rejected, |
There was a problem hiding this comment.
Avoid comma after the last item of an array.
|
|
||
| # SHOW_PAGE_ATTRIBUTES | ||
| # an array of attributes that will be displayed on the model's show page. | ||
| SHOW_PAGE_ATTRIBUTES = [ |
There was a problem hiding this comment.
Use %i or %I for an array of symbols.
| :customer, | ||
| :id, | ||
| :business_name, | ||
| :contact_name, |
There was a problem hiding this comment.
Avoid comma after the last item of an array.
|
|
||
| # SHOW_PAGE_ATTRIBUTES | ||
| # an array of attributes that will be displayed on the model's show page. | ||
| SHOW_PAGE_ATTRIBUTES = [ |
There was a problem hiding this comment.
Use %i or %I for an array of symbols.
| :category, | ||
| :id, | ||
| :name, | ||
| :description, |
There was a problem hiding this comment.
Avoid comma after the last item of an array.
| # | ||
| # By default, it's limited to four items to reduce clutter on index pages. | ||
| # Feel free to add, remove, or rearrange items. | ||
| COLLECTION_ATTRIBUTES = [ |
There was a problem hiding this comment.
Use %i or %I for an array of symbols.
| description: Field::Text, | ||
| price: Field::String.with_options(searchable: false), | ||
| created_at: Field::DateTime, | ||
| updated_at: Field::DateTime, |
There was a problem hiding this comment.
Avoid comma after the last item of a hash.
| @@ -0,0 +1,60 @@ | |||
| require "administrate/base_dashboard" | |||
There was a problem hiding this comment.
Prefer single-quoted strings when you don't need string interpolation or special symbols.
| visit '/admin' | ||
| expect(current_path).to eq(admin_root_path) | ||
| end | ||
| end |
There was a problem hiding this comment.
end at 14, 4 is not aligned with RSpec.feature "Admin dashboard" do at 3, 0.
| # customer = create(:customer) | ||
| end | ||
| it 'logs in as admin' do | ||
| visit '/admin' |
There was a problem hiding this comment.
Use 2 (not 4) spaces for indentation.
| # employee = create(:employee) | ||
| # customer = create(:customer) | ||
| end | ||
| it 'logs in as admin' do |
There was a problem hiding this comment.
Inconsistent indentation detected.
| before :each do | ||
| admin = create(:admin) | ||
| # employee = create(:employee) | ||
| # customer = create(:customer) |
There was a problem hiding this comment.
Incorrect indentation detected (column 12 instead of 10).
| RSpec.feature "Admin dashboard" do | ||
| context 'visit admin page before logging in' | ||
| before :each do | ||
| admin = create(:admin) |
There was a problem hiding this comment.
Use 2 (not 4) spaces for indentation.
Useless assignment to variable - admin.
| @@ -0,0 +1,14 @@ | |||
| require "rails_helper" | |||
|
|
|||
| RSpec.feature "Admin dashboard" do | |||
There was a problem hiding this comment.
Prefer single-quoted strings when you don't need string interpolation or special symbols.
| @@ -0,0 +1,14 @@ | |||
| require "rails_helper" | |||
There was a problem hiding this comment.
Prefer single-quoted strings when you don't need string interpolation or special symbols.
| password_confirmation '12345678' | ||
| end | ||
| factory :admin, :class => 'Employee' do | ||
| sequence(:email){ |n| "employeedoe1#{n}@example.com" } |
| password '12345678' | ||
| password_confirmation '12345678' | ||
| end | ||
| factory :admin, :class => 'Employee' do |
| :recieving_hours, | ||
| :days_closed, | ||
| :is_approved, | ||
| :is_rejected, |
There was a problem hiding this comment.
Avoid comma after the last item of an array.
| :recieving_hours, | ||
| :days_closed, | ||
| :is_approved, | ||
| :is_rejected, |
There was a problem hiding this comment.
Avoid comma after the last item of an array.
| # it 'logs in as admin' do | ||
| # visit '/admin' | ||
| # expect(current_path).to eq(admin_root_path) | ||
| # end |
There was a problem hiding this comment.
Incorrect indentation detected (column 8 instead of 2).
| # end | ||
| # it 'not logged in' do | ||
| # visit '/admin' | ||
| # end |
There was a problem hiding this comment.
Incorrect indentation detected (column 4 instead of 8).
| :recieving_hours, | ||
| :days_closed, | ||
| :is_approved, | ||
| :is_rejected, |
There was a problem hiding this comment.
Avoid comma after the last item of an array.
| # it 'logs in as admin' do | ||
| # visit '/admin' | ||
| # expect(current_path).to eq(admin_root_path) | ||
| # end |
There was a problem hiding this comment.
Incorrect indentation detected (column 8 instead of 2).
| # end | ||
| # it 'not logged in' do | ||
| # visit '/admin' | ||
| # end |
There was a problem hiding this comment.
Incorrect indentation detected (column 4 instead of 8).
| :recieving_hours, | ||
| :days_closed, | ||
| :is_approved, | ||
| :is_rejected, |
There was a problem hiding this comment.
Avoid comma after the last item of an array.
…ck-yards-coffee-app into admin-dashboard
| @@ -1,5 +1,5 @@ | |||
| class Customer < ApplicationRecord | |||
|
|
|||
| has_many :orders | |||
| before_action :authenticate_admin | ||
|
|
||
| def authenticate_admin | ||
| redirect_to "/employees/sign_in" unless current_employee |
There was a problem hiding this comment.
Prefer single-quoted strings when you don't need string interpolation or special symbols.
| plan_opts.map{|sub| "#{sub.metadata.frequency} / #{number_to_currency(sub.amount.to_f / 100)} per bag" } | ||
|
|
||
| plans.sort!{|a,b| freq[a.metadata.frequency] <=> freq[b.metadata.frequency] } | ||
| plans.map{|sub| "#{sub.metadata.frequency} / #{number_to_currency(sub.amount.to_f / 100)} per bag" } |
There was a problem hiding this comment.
Space missing to the left of {.
Space between { and | missing.
| plan_opts.sort!{|a,b| freq[a.metadata.frequency] <=> freq[b.metadata.frequency] } | ||
| plan_opts.map{|sub| "#{sub.metadata.frequency} / #{number_to_currency(sub.amount.to_f / 100)} per bag" } | ||
|
|
||
| plans.sort!{|a,b| freq[a.metadata.frequency] <=> freq[b.metadata.frequency] } |
There was a problem hiding this comment.
Space missing to the left of {.
Space between { and | missing.
Space missing after comma.
| :recieving_hours, | ||
| :days_closed, | ||
| :is_approved, | ||
| :is_rejected, |
There was a problem hiding this comment.
Avoid comma after the last item of an array.
Add "Admin Panel" button to navbar for employees that are logged in
| password_confirmation '12345678' | ||
| end | ||
| factory :admin, :class => 'Employee' do | ||
| sequence(:email){ |n| "employeedoe1#{n}@example.com" } |
There was a problem hiding this comment.
Layout/SpaceBeforeBlockBraces: Space missing to the left of {.
| password '12345678' | ||
| password_confirmation '12345678' | ||
| end | ||
| factory :admin, :class => 'Employee' do |
There was a problem hiding this comment.
Style/HashSyntax: Use the new Ruby 1.9 hash syntax.
| :category, | ||
| :name, | ||
| :description, | ||
| :price, |
There was a problem hiding this comment.
Style/TrailingCommaInArrayLiteral: Avoid comma after the last item of an array.
| # FORM_ATTRIBUTES | ||
| # an array of attributes that will be displayed | ||
| # on the model's form (`new` and `edit`) pages. | ||
| FORM_ATTRIBUTES = [ |
There was a problem hiding this comment.
Style/SymbolArray: Use %i or %I for an array of symbols.
| :description, | ||
| :price, | ||
| :created_at, | ||
| :updated_at, |
There was a problem hiding this comment.
Style/TrailingCommaInArrayLiteral: Avoid comma after the last item of an array.
| # FORM_ATTRIBUTES | ||
| # an array of attributes that will be displayed | ||
| # on the model's form (`new` and `edit`) pages. | ||
| FORM_ATTRIBUTES = [ |
There was a problem hiding this comment.
Style/SymbolArray: Use %i or %I for an array of symbols.
| :grind_id, | ||
| :sku, | ||
| :name, | ||
| :price, |
There was a problem hiding this comment.
Style/TrailingCommaInArrayLiteral: Avoid comma after the last item of an array.
|
|
||
| # SHOW_PAGE_ATTRIBUTES | ||
| # an array of attributes that will be displayed on the model's show page. | ||
| SHOW_PAGE_ATTRIBUTES = [ |
There was a problem hiding this comment.
Style/SymbolArray: Use %i or %I for an array of symbols.
| :customer, | ||
| :order, | ||
| :id, | ||
| :created_at, |
There was a problem hiding this comment.
Style/TrailingCommaInArrayLiteral: Avoid comma after the last item of an array.
| # | ||
| # By default, it's limited to four items to reduce clutter on index pages. | ||
| # Feel free to add, remove, or rearrange items. | ||
| COLLECTION_ATTRIBUTES = [ |
There was a problem hiding this comment.
Style/SymbolArray: Use %i or %I for an array of symbols.
This pull request will add the admin page for employees and admins to have access to the following dashboards:
Other Tasks: