Commit d405f1a851b7d8fd863a0fd333a059eb3da8b067
Committed by
Rafael Manzo
1 parent
b33d8d0e
Exists in
colab
and in
4 other branches
some files was renamed and modified to mezuro_configuration
Showing
18 changed files
with
117 additions
and
82 deletions
Show diff stats
app/controllers/configurations_controller.rb
| ... | ... | @@ -1,29 +0,0 @@ |
| 1 | -class ConfigurationsController < ApplicationController | |
| 2 | - | |
| 3 | - def show | |
| 4 | - @configuration = Configuration.find(params[:id]) | |
| 5 | - end | |
| 6 | - | |
| 7 | - def new | |
| 8 | - @configuration = Configuration.new | |
| 9 | - end | |
| 10 | - | |
| 11 | - def create | |
| 12 | - @configuration = Configuration.new(configuration_params) | |
| 13 | - if @configuration.save | |
| 14 | - redirect_to @configuration, | |
| 15 | - notice: 'Configuração criada com sucesso!' | |
| 16 | - else | |
| 17 | - render action: :new | |
| 18 | - end | |
| 19 | - end | |
| 20 | - | |
| 21 | - private | |
| 22 | - | |
| 23 | - def configuration_params | |
| 24 | - params. | |
| 25 | - require(:configuration). | |
| 26 | - permit(:name, :description) | |
| 27 | - end | |
| 28 | - | |
| 29 | -end |
| ... | ... | @@ -0,0 +1,30 @@ |
| 1 | +class MezuroConfigurationsController < ApplicationController | |
| 2 | + | |
| 3 | + def show | |
| 4 | + @configuration = MezuroConfiguration.find(params[:id]) | |
| 5 | + end | |
| 6 | + | |
| 7 | + def new | |
| 8 | + @configuration = MezuroConfiguration.new | |
| 9 | + end | |
| 10 | + | |
| 11 | + def create | |
| 12 | + @configuration = MezuroConfiguration.new(configuration_params) | |
| 13 | + if @configuration.save | |
| 14 | + redirect_to @configuration, | |
| 15 | + notice: 'Configuração criada com sucesso!' | |
| 16 | + else | |
| 17 | + render action: :new | |
| 18 | + end | |
| 19 | + end | |
| 20 | + | |
| 21 | + private | |
| 22 | + | |
| 23 | + def configuration_params | |
| 24 | + params. | |
| 25 | + require(:mezuro_configuration). | |
| 26 | + permit(:name, :description) | |
| 27 | + end | |
| 28 | + | |
| 29 | +end | |
| 30 | + | ... | ... |
app/models/configuration.rb
| ... | ... | @@ -1,9 +0,0 @@ |
| 1 | -require "validators/kalibro_uniqueness_validator.rb" | |
| 2 | - | |
| 3 | -class Configuration < KalibroGem::Entities::Configuration | |
| 4 | - include KalibroRecord | |
| 5 | - | |
| 6 | - attr_accessor :name | |
| 7 | - validates :name, presence: true, kalibro_uniqueness: true | |
| 8 | - | |
| 9 | -end | |
| 10 | 0 | \ No newline at end of file |
| ... | ... | @@ -0,0 +1,9 @@ |
| 1 | +require "validators/kalibro_uniqueness_validator.rb" | |
| 2 | + | |
| 3 | +class MezuroConfiguration < KalibroGem::Entities::Configuration | |
| 4 | + include KalibroRecord | |
| 5 | + | |
| 6 | + attr_accessor :name | |
| 7 | + validates :name, presence: true, kalibro_uniqueness: true | |
| 8 | + | |
| 9 | +end | |
| 0 | 10 | \ No newline at end of file | ... | ... |
app/views/configurations/_form.html.erb
| ... | ... | @@ -1,16 +0,0 @@ |
| 1 | -<%= form_for(@configuration, :html => { role: 'form' }) do |f| %> | |
| 2 | - <%= render :partial => 'shared/form_errors', :locals => {:object => @configuration} %> | |
| 3 | - | |
| 4 | - <div class="form-group"> | |
| 5 | - <%= f.label :name, class: 'control-label' %><br> | |
| 6 | - <%= f.text_field :name, class: 'form-control' %> | |
| 7 | - </div> | |
| 8 | - | |
| 9 | - <div class="form-group"> | |
| 10 | - <%= f.label :description, class: 'control-label' %><br> | |
| 11 | - <%= f.text_area :description, class: 'form-control' %> | |
| 12 | - </div> | |
| 13 | - | |
| 14 | - <%= f.submit 'Save', class: 'btn btn-primary' %> | |
| 15 | - | |
| 16 | -<% end %> |
app/views/configurations/edit.html.erb
app/views/configurations/new.html.erb
app/views/configurations/show.html.erb
| ... | ... | @@ -0,0 +1,18 @@ |
| 1 | +<%= form_for(@configuration, :html => { role: 'form' }) do |f| %> | |
| 2 | + <%= render :partial => 'shared/form_errors', :locals => {:object => @configuration} %> | |
| 3 | + | |
| 4 | + <div class="form-group"> | |
| 5 | + <%= f.label :name, class: 'control-label' %><br> | |
| 6 | + <%= f.text_field :name, class: 'form-control' %> | |
| 7 | + </div> | |
| 8 | + | |
| 9 | + <div class="form-group"> | |
| 10 | + <%= f.label :description, class: 'control-label' %><br> | |
| 11 | + <%= f.text_area :description, class: 'form-control' %> | |
| 12 | + </div> | |
| 13 | + | |
| 14 | + <%= f.submit 'Save', class: 'btn btn-primary' %> | |
| 15 | + | |
| 16 | + <%= link_to 'Back', mezuro_configurations_path, class: 'btn btn-default' %> | |
| 17 | + | |
| 18 | +<% end %> | ... | ... |
| ... | ... | @@ -0,0 +1,17 @@ |
| 1 | +<%= form_for(@configuration, :html => { role: 'form' }) do |f| %> | |
| 2 | + | |
| 3 | + <div class="form-group"> | |
| 4 | + <%= f.label :name, class: 'control-label' %><br> | |
| 5 | + <%= f.text_field :name, class: 'form-control' %> | |
| 6 | + </div> | |
| 7 | + | |
| 8 | + <div class="form-group"> | |
| 9 | + <%= f.label :description, class: 'control-label' %><br> | |
| 10 | + <%= f.text_area :description, class: 'form-control' %> | |
| 11 | + </div> | |
| 12 | + | |
| 13 | + <%= f.submit 'Save', class: 'btn btn-primary' %> | |
| 14 | + | |
| 15 | + <%= link_to 'Back', mezuro_configurations_path, class: 'btn btn-default' %> | |
| 16 | + | |
| 17 | +<% end %> | ... | ... |
config/routes.rb
| ... | ... | @@ -12,7 +12,7 @@ Mezuro::Application.routes.draw do |
| 12 | 12 | get '/repositories/:id/process' => 'repositories#process_repository', as: :repository_process |
| 13 | 13 | end |
| 14 | 14 | |
| 15 | - resources :configurations | |
| 15 | + resources :mezuro_configurations | |
| 16 | 16 | |
| 17 | 17 | resources :reading_groups do |
| 18 | 18 | resources :readings, except: [:index, :update, :show] | ... | ... |
db/migrate/20140123125655_create_mezuro_configurations.rb
0 → 100644
db/schema.rb
| ... | ... | @@ -11,7 +11,14 @@ |
| 11 | 11 | # |
| 12 | 12 | # It's strongly recommended that you check this file into your version control system. |
| 13 | 13 | |
| 14 | -ActiveRecord::Schema.define(version: 20131219115819) do | |
| 14 | +ActiveRecord::Schema.define(version: 20140123125655) do | |
| 15 | + | |
| 16 | + create_table "mezuro_configurations", force: true do |t| | |
| 17 | + t.string "name" | |
| 18 | + t.text "description" | |
| 19 | + t.datetime "created_at" | |
| 20 | + t.datetime "updated_at" | |
| 21 | + end | |
| 15 | 22 | |
| 16 | 23 | create_table "project_ownerships", force: true do |t| |
| 17 | 24 | t.integer "user_id" | ... | ... |
spec/factories/configurations.rb
| ... | ... | @@ -1,13 +0,0 @@ |
| 1 | -FactoryGirl.define do | |
| 2 | - factory :configuration, class: Configuration do | |
| 3 | - id 1 | |
| 4 | - name "Java" | |
| 5 | - description "Code metrics for Java." | |
| 6 | - end | |
| 7 | - | |
| 8 | - factory :another_configuration, class: Configuration do | |
| 9 | - id 12 | |
| 10 | - name "Perl" | |
| 11 | - description "Code metrics for Perl." | |
| 12 | - end | |
| 13 | -end | |
| 14 | 0 | \ No newline at end of file |
| ... | ... | @@ -0,0 +1,13 @@ |
| 1 | +FactoryGirl.define do | |
| 2 | + factory :mezuro_configuration, class: MezuroConfiguration do | |
| 3 | + id 1 | |
| 4 | + name "Java" | |
| 5 | + description "Code metrics for Java." | |
| 6 | + end | |
| 7 | + | |
| 8 | + factory :another_mezuro_configuration, class: MezuroConfiguration do | |
| 9 | + id 12 | |
| 10 | + name "Perl" | |
| 11 | + description "Code metrics for Perl." | |
| 12 | + end | |
| 13 | +end | |
| 0 | 14 | \ No newline at end of file | ... | ... |