Remove unused new, edit user_projects views

This commit is contained in:
Luka Murn 2016-11-19 17:01:10 +01:00
parent 911b7ba72f
commit 59eb1c1d18
4 changed files with 2 additions and 67 deletions

View file

@ -4,7 +4,7 @@ class UserProjectsController < ApplicationController
before_action :load_vars
before_action :check_view_tab_permissions, only: [ :index ]
before_action :check_view_permissions, only: [ :index_edit ]
before_action :check_create_permissions, only: [:new, :create]
before_action :check_create_permissions, only: [:create]
# TODO check update permissions
before_action :check_update_permisisons, only: [:update]
before_action :check_delete_permisisons, only: [:destroy]
@ -44,13 +44,6 @@ class UserProjectsController < ApplicationController
end
end
def new
@up = UserProject.new(
project: @project
)
init_gui
end
def create
@up = UserProject.new(up_params.merge(project: @project))
@up.assigned_by = current_user
@ -109,10 +102,6 @@ class UserProjectsController < ApplicationController
end
end
def edit
@up = UserProject.find(params[:id])
end
def update
@up = UserProject.find(params[:id])

View file

@ -1,26 +0,0 @@
<% provide(:head_title, raw(t("user_projects.edit.head_title", project: @project.name))) %>
<h2><%=t "user_projects.edit.title", user: @up.user.full_name, project: @project.name %></h2>
<%= bootstrap_form_for [@project, @up] do |f| %>
<%= f.label t("user_projects.new.role"), style: "margin-top: 10px;" %><br />
<div class="btn-group" data-toggle="buttons">
<label class="btn btn-primary<%= @up.owner? ? " active" : "" %>">
<%= f.radio_button_without_bootstrap :role, :owner, :checked => @up.owner? %>
<%=t "user_projects.enums.role.owner" %>
</label>
<label class="btn btn-primary<%= @up.normal_user? ? " active" : "" %>">
<%= f.radio_button_without_bootstrap :role, :normal_user, :checked => @up.normal_user? %>
<%=t "user_projects.enums.role.normal_user" %>
</label>
<label class="btn btn-primary<%= @up.technician? ? " active" : "" %>">
<%= f.radio_button_without_bootstrap :role, :technician, :checked => @up.technician? %>
<%=t "user_projects.enums.role.technician" %>
</label>
<label class="btn btn-primary<%= @up.viewer? ? " active" : "" %>">
<%= f.radio_button_without_bootstrap :role, :viewer, :checked => @up.viewer? %>
<%=t "user_projects.enums.role.viewer" %>
</label>
</div>
<br />
<%= f.submit t("user_projects.edit.update"), style: "margin-top: 10px;" %>
<% end %>

View file

@ -1,28 +0,0 @@
<% provide(:head_title, raw(t("user_projects.new.head_title", project: @project.name))) %>
<h2><%=t "user_projects.new.title", project: @project.name %></h2>
<%= bootstrap_form_for [@project, @up] do |f| %>
<%= collection_select(:user_project, :user_id, @users, :id, :full_name ) %>
<br />
<%= f.label t("user_projects.new.role"), style: "margin-top: 10px;" %><br />
<div class="btn-group" data-toggle="buttons">
<label class="btn btn-primary">
<%= f.radio_button_without_bootstrap :role, :owner %>
<%=t "user_projects.enums.role.owner" %>
</label>
<label class="btn btn-primary active">
<%= f.radio_button_without_bootstrap :role, :normal_user, :checked => true %>
<%=t "user_projects.enums.role.normal_user" %>
</label>
<label class="btn btn-primary">
<%= f.radio_button_without_bootstrap :role, :technician %>
<%=t "user_projects.enums.role.technician" %>
</label>
<label class="btn btn-primary">
<%= f.radio_button_without_bootstrap :role, :viewer %>
<%=t "user_projects.enums.role.viewer" %>
</label>
</div>
<br />
<%= f.submit t("user_projects.new.create"), style: "margin-top: 10px;" %>
<% end %>

View file

@ -74,7 +74,7 @@ Rails.application.routes.draw do
get 'projects/archive', to: 'projects#archive', as: 'projects_archive'
resources :projects, except: [:new, :destroy] do
resources :user_projects, path: "/users", only: [:new, :create, :index, :edit, :update, :destroy]
resources :user_projects, path: "/users", only: [:create, :index, :update, :destroy]
resources :project_comments,
path: '/comments',
only: [:create, :index, :edit, :update, :destroy]