forked from forem/forem
    
        
        - 
                Notifications
    You must be signed in to change notification settings 
- Fork 1
Vistas creadas junto con el controlador. #19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Open
      
      
            diegoOG09
  wants to merge
  6
  commits into
  dev
  
    
      
        
          
  
    
      Choose a base branch
      
     
    
      
        
      
      
        
          
          
        
        
          
            
              
              
              
  
           
        
        
          
            
              
              
           
        
       
     
  
        
          
            
          
            
          
        
       
    
      
from
feature#1/chambas-1-views-backend-init
  
      
      
   
  
    
  
  
  
 
  
      
    base: dev
Could not load branches
            
              
  
    Branch not found: {{ refName }}
  
            
                
      Loading
              
            Could not load tags
            
            
              Nothing to show
            
              
  
            
                
      Loading
              
            Are you sure you want to change the base?
            Some commits from the old base branch may be removed from the timeline,
            and old review comments may become outdated.
          
          
  
     Open
                    Changes from 3 commits
      Commits
    
    
            Show all changes
          
          
            6 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      40302ba
              
                Views created, "Chambas" controller created and edited and draft data…
              
              
                 3329949
              
                We resolved the observations from the last PR
              
              
                 531f813
              
                Chambas usuario y admin OK|Create chamba Admin OK
              
              
                diegoOG09 97b012c
              
                Migrations added to Chambas db
              
              
                diegoOG09 b35dc93
              
                Migrations modified
              
              
                diegoOG09 bff3b39
              
                CRUD views and admin Chambas created
              
              
                diegoOG09 File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
      
      Loading
      
  Sorry, something went wrong. Reload?
      Sorry, we cannot display this file.
      Sorry, this file is invalid so it cannot be displayed.
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,57 @@ | ||||||||
| module Admin | ||||||||
| class ChambasController < Admin::ApplicationController | ||||||||
| layout "admin" | ||||||||
|  | ||||||||
| @chamba_record_save = nil | ||||||||
|  | ||||||||
| def index | ||||||||
| @chambas = Chamba.all | ||||||||
| @chamba_save = @chamba_record_save | ||||||||
| # variable para crear una nueva chamba | ||||||||
| @chamba = Chamba.new | ||||||||
| end | ||||||||
|  | ||||||||
| # //////para crear nueva chamaba | ||||||||
|  | ||||||||
| def create | ||||||||
| @chamba = Chamba.new(chamba_params) | ||||||||
| if @chamba.save | ||||||||
| @chamba_record_save = true | ||||||||
| else | ||||||||
| @chamba_record_save = false | ||||||||
| render admin_path | ||||||||
| end | ||||||||
| end | ||||||||
|  | ||||||||
| # def create | ||||||||
| # @employee = Employee.new(employee_params) | ||||||||
| # if @employee.save | ||||||||
| # redirect_to pages_employees_path | ||||||||
| # else | ||||||||
| # render :new | ||||||||
| # end | ||||||||
| # end | ||||||||
|  | ||||||||
| # //////para editar una chamaba | ||||||||
| def edit | ||||||||
| @chamba = Chamba.find(params[:id_chamba]) | ||||||||
| end | ||||||||
|  | ||||||||
| # //////para borrar una chamaba | ||||||||
| def delete | ||||||||
| id_to_delete = params[:id_chamba] | ||||||||
|  | ||||||||
| # modificar esto despues para eliminar en cascada (por medio de los modelos) | ||||||||
| RequerimientosChamba.find(id_to_delete).destroy | ||||||||
| AreasChamba.find(id_to_delete).destroy | ||||||||
| Chamba.find(id_to_delete).destroy | ||||||||
| Area.find(id_to_delete).destroy | ||||||||
| end | ||||||||
|  | ||||||||
| private | ||||||||
| There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [rubocop] <Layout/EmptyLinesAroundAccessModifier> reported by reviewdog 🐶 
        Suggested change
       
 | ||||||||
|  | ||||||||
| def chamba_params | ||||||||
| params.require(:chamba).permit(:title, :exp_date, :location, :description, :organization, :salary) | ||||||||
| end | ||||||||
| end | ||||||||
| end | ||||||||
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| class ChambasController < ApplicationController | ||
| # vista index (chambas) | ||
| def index | ||
| @chambas_vec = req_chambas | ||
| @areas = %w[Mexico Web-Developer Programación Issues] | ||
| @filters = req_filters | ||
| @areas_chambas = AreasChamba.all | ||
| end | ||
|  | ||
| # vista chamba | ||
| def chamba | ||
| @chamba = Chamba.find(params[:chamba_id]) | ||
| @requerimientos = RequerimientosChamba.where(chamba_id: params[:chamba_id]) | ||
| end | ||
|  | ||
| def req_chambas | ||
| # DESIDO HACERLO FUERA EN OTRO METODO PARA DESPUES PRE-PROSESAR LAS PUBS | ||
| Chamba.all | ||
| end | ||
|  | ||
| def req_filters | ||
| %w[Mexico Web-Developer Programación Issues] | ||
| # @var_back = params[:filter_active] | ||
| end | ||
| end | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| module ChambasHelper | ||
| end | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| class Area < ApplicationRecord | ||
| has_many :areas_chamba, dependent: :nil | ||
| end | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| class AreasChamba < ApplicationRecord | ||
| belongs_to :chamba | ||
| belongs_to :area | ||
| end | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| class Chamba < ApplicationRecord | ||
| has_many :requerimientos_chamba, dependent: :nil | ||
| end | 
      
      Oops, something went wrong.
        
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Me pregunto si agregaste mini_magick en el
Gemfilepara que el proyecto pudiera correr en tu ambiente local, o si esto se agrego solo 🤔Si no es necesario, podriamos remover esto del commit? 😄