app/controllers/phcscriptcdnpro/script/extensions_controller.rb in phcscriptcdnpro-73.1.0 vs app/controllers/phcscriptcdnpro/script/extensions_controller.rb in phcscriptcdnpro-74.0.0
- old
+ new
@@ -7,66 +7,65 @@
include Phccorehelpers::PhcpluginsproHelper
before_action :authenticate_user!
before_action :set_paper_trail_whodunnit
before_action :set_script_extension, only: [:show, :edit, :update, :destroy]
- # INDEX - Script Extension
+ # INDEX
def index
- @script_extensions = Script::Extension.where(org_id: current_user.org_id)
+ @script_extensions = Script::Extension.all
end
- # DETAILS - Script Extension
+ # SHOW
def show
@script_extensions = Script::Extension.friendly.find(params[:id])
@versions = Phcscriptcdnpro::ExtensionVersions.where(item_id: params[:id], item_type: 'Phcscriptcdnpro::Script::Extension')
end
- # NEW - Script Extension
+ # NEW
def new
@script_extension = Script::Extension.new
end
- # EDIT - Script Extension
+ # EDIT
def edit
end
- # CREATE - Script Extension
+ # CREATE
def create
@script_extension = Script::Extension.new(script_extension_params)
@script_extension.user_id = current_user.id
- @script_extension.org_id = current_user.org_id
if @script_extension.save
- redirect_to script_extensions_url, notice: 'Extension was successfully created.'
- else
+ redirect_to script_extensions_url, :flash => { :success => 'Extension was successfully created.' }
+ else
render :new
end
end
- # PATCH/PUT - Script Extension
+ # UPDATE
def update
if @script_extension.update(script_extension_params)
- redirect_to script_extensions_url, notice: 'Extension was successfully updated.'
- else
- render :edit
+ redirect_to script_extensions_url, :flash => { :success => 'Extension was successfully updated.' }
+ else
+ render :edit
end
end
- # DELETE - Script Extension
+ # DELETE
def destroy
@script_extension.destroy
- redirect_to script_extensions_url, notice: 'Extension was successfully destroyed.'
+ redirect_to script_extensions_url, :flash => { :error => 'Extension was successfully destroyed.' }
end
private
# Common Callbacks
- def set_script_extension
- @script_extension = Script::Extension.friendly.find(params[:id])
+ def set_script_extension
+ @script_extension = Script::Extension.friendly.find(params[:id])
end
# Whitelists
def script_extension_params
- params.require(:script_extension).permit(:script_extension_name, :script_extension_description, :script_extension, :slug, :user_id, :org_id)
+ params.require(:script_extension).permit(:script_extension_name, :script_extension_description, :script_extension, :slug, :user_id)
end
end
end