mirror of https://github.com/docusealco/docuseal
				
				
				
			
			You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							26 lines
						
					
					
						
							702 B
						
					
					
				
			
		
		
	
	
							26 lines
						
					
					
						
							702 B
						
					
					
				# frozen_string_literal: true
 | 
						|
 | 
						|
class TemplatesFoldersController < ApplicationController
 | 
						|
  load_and_authorize_resource :template
 | 
						|
 | 
						|
  def edit; end
 | 
						|
 | 
						|
  def update
 | 
						|
    name = [params[:parent_name], params[:name]].compact_blank.join(' / ')
 | 
						|
 | 
						|
    @template.folder = TemplateFolders.find_or_create_by_name(current_user, name)
 | 
						|
 | 
						|
    if @template.save
 | 
						|
      redirect_back(fallback_location: template_path(@template), notice: I18n.t('document_template_has_been_moved'))
 | 
						|
    else
 | 
						|
      redirect_back(fallback_location: template_path(@template), notice: I18n.t('unable_to_move_template_into_folder'))
 | 
						|
    end
 | 
						|
  end
 | 
						|
 | 
						|
  private
 | 
						|
 | 
						|
  def template_folder_params
 | 
						|
    params.require(:template_folder).permit(:name)
 | 
						|
  end
 | 
						|
end
 |