Skip to content
This repository has been archived by the owner on Jul 10, 2024. It is now read-only.

Feature/add event models #34

Open
wants to merge 42 commits into
base: master
Choose a base branch
from
Open

Feature/add event models #34

wants to merge 42 commits into from

Conversation

Jostavo
Copy link
Member

@Jostavo Jostavo commented Apr 19, 2018

Still working on it, but basically what I did was:

  • Added Event Model
  • Added Event Controller
  • Added validations
  • Added (back) the error messages
  • Refactored some of the code
  • Added a new gem to validate dates
  • Added a picker gem
  • Some more stuff

I'll add more information here later

This fixes #10 , #8 , #19

@Jostavo Jostavo self-assigned this Apr 19, 2018
@Jostavo Jostavo requested a review from eiguike April 19, 2018 23:19
@event = Event.find(params[:id])
end

def update
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar code found in events_controller.rb:34, users_controller.rb:35 (mass = 56) [flay:warning]

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ignore

redirect_to edit_user_path
end
end
def update
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar code found in events_controller.rb:34, users_controller.rb:35 (mass = 56) [flay:warning]

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ignore

@@ -0,0 +1,45 @@
<%= form_for @event do |form| %>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace instance variable with local variable [rails_best_practices:warning]


<div class="field">
<%= form.label :title, 'Título' %>
<%= form.text_field :title, class: 'form-control', :value => @event.title %>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace instance variable with local variable [rails_best_practices:warning]


<div class="field">
<%= form.label :semester, 'Tipo' %>
<%= form.text_field :semester, class: 'form-control', :value => @event.semester %>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace instance variable with local variable [rails_best_practices:warning]


<div class="field">
<%= form.label :url, 'URL' %>
<%= form.text_field :url, class: 'form-control', :value => @event.url %>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace instance variable with local variable [rails_best_practices:warning]


<div class="field">
<%= form.label :start, 'Data início' %>
<%= form.text_field :start, id: 'datepickerstart', class: 'form-control', :value => @event.start %>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace instance variable with local variable [rails_best_practices:warning]


<div class="field">
<%= form.label :end, 'Data fim' %>
<%= form.text_field :end, id: 'datepickerend', class: 'form-control', :value => @event.end %>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace instance variable with local variable [rails_best_practices:warning]


<div class="field">
<%= form.label :repeating, 'Repetindo' %>
<%= form.text_field :repeating, class: 'form-control', :value => @event.repeating %>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace instance variable with local variable [rails_best_practices:warning]

<div class="alert alert-danger">
The form contains <%= pluralize(@user.errors.count, "error") %>.
<% @select = yield(:modelo) %>
<% puts @select %>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace instance variable with local variable [rails_best_practices:warning]

The form contains <%= pluralize(@user.errors.count, "error") %>.
<% @select = yield(:modelo) %>
<% puts @select %>
<% if @select == "user" %>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace instance variable with local variable [rails_best_practices:warning]

<% @select = yield(:modelo) %>
<% puts @select %>
<% if @select == "user" %>
<% if @user.errors.any? %>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace instance variable with local variable [rails_best_practices:warning]

<% if @user.errors.any? %>
<div id="error_explanation">
<div class="alert alert-danger">
The form contains <%= pluralize(@user.errors.count, "error") %>.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace instance variable with local variable [rails_best_practices:warning]

The form contains <%= pluralize(@user.errors.count, "error") %>.
</div>
<ul>
<% @user.errors.full_messages.each do |msg| %>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace instance variable with local variable [rails_best_practices:warning]

<% end %>
<% elsif @select == 'event' %>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace instance variable with local variable [rails_best_practices:warning]

<% end %>
<% elsif @select == 'event' %>
<% puts @event.errors.any? %>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace instance variable with local variable [rails_best_practices:warning]

<% elsif @select == 'event' %>
<% puts @event.errors.any? %>
<% if @event.errors.any? %>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace instance variable with local variable [rails_best_practices:warning]

@caccs caccs deleted a comment from CACCSBot Aug 28, 2018
@caccs caccs deleted a comment from CACCSBot Aug 28, 2018
Dangerfile Outdated
markdown(message)

warn "Still Work in Progress" if github.pr_title.include? "WIP"
if (git.modified_files.empty? && git.added_files.empty? && git.deleted_files.empty?)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/ParenthesesAroundCondition: Don't use parentheses around the condition of an if. [rubocop:warning]

Dangerfile Outdated
markdown(message)

warn "Still Work in Progress" if github.pr_title.include? "WIP"
if (git.modified_files.empty? && git.added_files.empty? && git.deleted_files.empty?)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metrics/LineLength: Line is too long. [84/80] [rubocop:warning]

Dangerfile Outdated

warn "Still Work in Progress" if github.pr_title.include? "WIP"
if (git.modified_files.empty? && git.added_files.empty? && git.deleted_files.empty?)
warn "What is the point of this PR if you have not changed anything?"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols. [rubocop:warning]

Dangerfile Outdated
warn "What is the point of this PR if you have not changed anything?"
end

if git.added_files.include?('db/migrate/*.rb') && !git.modified_files.include?('db/schema.rb')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metrics/LineLength: Line is too long. [94/80] [rubocop:warning]

@caccs caccs deleted a comment from CACCSBot Aug 28, 2018
@caccs caccs deleted a comment from CACCSBot Aug 28, 2018
Dangerfile Outdated

markdown(message)

warn "Still Work in Progress" if github.pr_title.include? "WIP"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols. [rubocop:warning]

Dangerfile Outdated

warn "Still Work in Progress" if github.pr_title.include? "WIP"

if git.added_files.include?('db/migrate/*.rb') && !git.modified_files.include?('db/schema.rb')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metrics/LineLength: Line is too long. [94/80] [rubocop:warning]

Dangerfile Outdated

markdown(message)

<!-- warn "Still Work in Progress" if github.pr_title.include? "WIP"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lint/Syntax: unexpected token tLT
(Using Ruby 2.4 parser; configure using TargetRubyVersion parameter, under AllCops) [rubocop:error]

Dangerfile Outdated

markdown(message)

<!-- warn "Still Work in Progress" if github.pr_title.include? "WIP"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lint/Syntax: unexpected token tSTRING
(Using Ruby 2.4 parser; configure using TargetRubyVersion parameter, under AllCops) [rubocop:error]

Dangerfile Outdated

if git.added_files.include?('db/migrate/*.rb') && !git.modified_files.include?('db/schema.rb')
warn('Run `db:migrate` and commit `schema.rb` file')
end -->
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lint/Syntax: unexpected token tNL
(Using Ruby 2.4 parser; configure using TargetRubyVersion parameter, under AllCops) [rubocop:error]

Dangerfile Outdated

# TESTS

<!-- has_app_changes = !git.modified_files.grep(/(lib|app)/).empty?
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lint/Syntax: unexpected token tLT
(Using Ruby 2.4 parser; configure using TargetRubyVersion parameter, under AllCops) [rubocop:error]

Dangerfile Outdated
MESSAGE

warn(message.strip)
end -->
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lint/Syntax: unexpected token tNL
(Using Ruby 2.4 parser; configure using TargetRubyVersion parameter, under AllCops) [rubocop:error]

@event = Event.find(params[:id])
end

def update
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar code found in events_controller.rb:37, users_controller.rb:35 (mass = 56) [flay:warning]

redirect_to edit_user_path
end
end
def update
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar code found in events_controller.rb:37, users_controller.rb:35 (mass = 56) [flay:warning]

resources :users
resources :events
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Restrict auto-generated routes events (only: []) [rails_best_practices:warning]

flash[:notice] = "Email enviado com sucesso!"
redirect_to contact_path
end
nome = parametros['name'].to_s
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refers to 'parametros' more than self (maybe move it to another class?) (FeatureEnvy) [reek:info]

create_table "events", force: :cascade do |t|
t.string "title"
t.integer "semester"
t.datetime "start"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metrics/LineLength: Line is too long. [86/80] [rubocop:warning]

t.datetime "start"
t.datetime "end"
t.boolean "allday"
t.integer "repeating"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metrics/LineLength: Line is too long. [86/80] [rubocop:warning]

t.boolean "allday"
t.integer "repeating"
t.string "url"
t.datetime "created_at", null: false
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/NumericLiterals: Use underscores(_) as decimal mark and separate every 3 digits with them. [rubocop:warning]

t.integer "repeating"
t.string "url"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/EmptyLinesAroundBlockBody: Extra empty line detected at block body beginning. [rubocop:warning]

t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols. [rubocop:warning]

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create an Event Dashboard
3 participants