From 9d424df9fd8d8fc12d0e39da036ba2b8deddef89 Mon Sep 17 00:00:00 2001 From: yamin Date: Mon, 21 Aug 2017 17:31:17 +0630 Subject: [PATCH] updateCommissioner --- app/controllers/origami/commissioners_controller.rb | 8 ++++---- app/views/layouts/_header.html.erb | 2 +- app/views/origami/commissioners/_form.html.erb | 2 +- app/views/origami/commissioners/edit.html.erb | 2 +- app/views/origami/commissioners/index.html.erb | 10 ++++------ app/views/origami/commissioners/new.html.erb | 2 +- app/views/origami/commissioners/show.html.erb | 6 +++--- 7 files changed, 15 insertions(+), 17 deletions(-) diff --git a/app/controllers/origami/commissioners_controller.rb b/app/controllers/origami/commissioners_controller.rb index 091fd166..ae107ecf 100644 --- a/app/controllers/origami/commissioners_controller.rb +++ b/app/controllers/origami/commissioners_controller.rb @@ -1,5 +1,5 @@ class Origami::CommissionersController < BaseOrigamiController - # before_action :set_commissioner, only: [:show, :edit, :update, :destroy] + before_action :set_commissioner, only: [:show, :edit, :update, :destroy] # GET /commissioners # GET /commissioners.json @@ -29,7 +29,7 @@ class Origami::CommissionersController < BaseOrigamiController @commissioner.created_by = current_user.id respond_to do |format| if @commissioner.save - format.html { redirect_to @commissioner, notice: 'Commissioner was successfully created.' } + format.html { redirect_to origami_commissioners_path , notice: 'Commissioner was successfully created.' } format.json { render :show, status: :created, location: @commissioner } else format.html { render :new } @@ -43,7 +43,7 @@ class Origami::CommissionersController < BaseOrigamiController def update respond_to do |format| if @commissioner.update(commissioner_params) - format.html { redirect_to @commissioner, notice: 'Commissioner was successfully updated.' } + format.html { redirect_to origami_commissioner_path(@commissioner) , notice: 'Commissioner was successfully updated.' } format.json { render :show, status: :ok, location: @commissioner } else format.html { render :edit } @@ -57,7 +57,7 @@ class Origami::CommissionersController < BaseOrigamiController def destroy @commissioner.destroy respond_to do |format| - format.html { redirect_to commissioners_url, notice: 'Commissioner was successfully destroyed.' } + format.html { redirect_to origami_commissioners_path , notice: 'Commissioner was successfully destroyed.' } format.json { head :no_content } end end diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb index 364f8af2..d4062d26 100644 --- a/app/views/layouts/_header.html.erb +++ b/app/views/layouts/_header.html.erb @@ -28,7 +28,7 @@
  • <%= link_to "Print Setting", print_settings_path, :tabindex =>"-1" %>

  • <%= link_to "Employees", settings_employees_path, :tabindex =>"-1" %>
  • -
  • <%= link_to "Commissioners", commissioners_path, :tabindex =>"-1" %>
  • +
  • <%= link_to "Commissioners", origami_commissioners_path , :tabindex =>"-1" %>

  • <%= link_to "Accounts", settings_accounts_path, :tabindex =>"-1" %>

  • diff --git a/app/views/origami/commissioners/_form.html.erb b/app/views/origami/commissioners/_form.html.erb index 6768b139..6386b0f7 100644 --- a/app/views/origami/commissioners/_form.html.erb +++ b/app/views/origami/commissioners/_form.html.erb @@ -1,4 +1,4 @@ -<%= simple_form_for(@commissioner) do |f| %> +<%= simple_form_for([:origami,@commissioner]) do |f| %> <%= f.error_notification %>
    diff --git a/app/views/origami/commissioners/edit.html.erb b/app/views/origami/commissioners/edit.html.erb index 55f50020..0a2edab4 100644 --- a/app/views/origami/commissioners/edit.html.erb +++ b/app/views/origami/commissioners/edit.html.erb @@ -2,7 +2,7 @@ diff --git a/app/views/origami/commissioners/index.html.erb b/app/views/origami/commissioners/index.html.erb index 9fdaa90a..e7230fd9 100644 --- a/app/views/origami/commissioners/index.html.erb +++ b/app/views/origami/commissioners/index.html.erb @@ -3,7 +3,7 @@
  • Home
  • Commissioner
  • - <%= link_to t('.new', :default => t("helpers.links.new")),new_commissioner_path,:class => 'btn btn-primary btn-sm' %> + <%= link_to t('.new', :default => t("helpers.links.new")), new_origami_commissioner_path ,:class => 'btn btn-primary btn-sm' %>
    @@ -17,7 +17,6 @@ Employee Name Commission type Active - Created By @@ -35,10 +34,9 @@ <%= commissioner.commission_type %> <%= commissioner.is_active %> - <%= current_user.name %> - <%= link_to 'Show', commissioner_path(commissioner) %> - <%= link_to 'Edit', edit_commissioner_path(commissioner) %> - <%= link_to 'Destroy', commissioner_path(commissioner), method: :delete, data: { confirm: 'Are you sure?' } %> + <%= link_to 'Show', origami_commissioner_path(commissioner) %> + <%= link_to 'Edit', edit_origami_commissioner_path(commissioner) %> + <%= link_to 'Destroy', origami_commissioner_path(commissioner), method: :delete, data: { confirm: 'Are you sure?' } %> <% end %> diff --git a/app/views/origami/commissioners/new.html.erb b/app/views/origami/commissioners/new.html.erb index 6cadebcc..55b9b98c 100644 --- a/app/views/origami/commissioners/new.html.erb +++ b/app/views/origami/commissioners/new.html.erb @@ -2,7 +2,7 @@ diff --git a/app/views/origami/commissioners/show.html.erb b/app/views/origami/commissioners/show.html.erb index ba313550..579c9c0d 100644 --- a/app/views/origami/commissioners/show.html.erb +++ b/app/views/origami/commissioners/show.html.erb @@ -1,7 +1,7 @@