Class: DirectoriesController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- DirectoriesController
- Defined in:
- app/controllers/directories_controller.rb
Overview
typed: false
Instance Method Summary collapse
-
#create ⇒ Object
POST /directories POST /directories.json.
-
#destroy ⇒ Object
DELETE /directories/1 DELETE /directories/1.json.
-
#edit ⇒ Object
GET /directories/1/edit.
-
#index ⇒ Object
GET /directories GET /directories.json.
-
#new ⇒ Object
GET /directories/new.
-
#show ⇒ Object
GET /directories/1 GET /directories/1.json.
-
#update ⇒ Object
PATCH/PUT /directories/1 PATCH/PUT /directories/1.json.
Methods inherited from ApplicationController
Instance Method Details
#create ⇒ Object
POST /directories POST /directories.json
64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'app/controllers/directories_controller.rb', line 64 def create @directory = Directory.new(directory_params) respond_to do |format| if @directory.save format.html { redirect_to @directory, notice: 'Directory was successfully created.' } format.json { render :show, status: :created, location: @directory } else format.html { render :new } format.json { render json: @directory.errors, status: :unprocessable_entity } end end end |
#destroy ⇒ Object
DELETE /directories/1 DELETE /directories/1.json
94 95 96 97 98 99 100 |
# File 'app/controllers/directories_controller.rb', line 94 def destroy @directory.destroy respond_to do |format| format.html { redirect_to directories_url, notice: 'Directory was successfully destroyed.' } format.json { head :no_content } end end |
#edit ⇒ Object
GET /directories/1/edit
59 60 |
# File 'app/controllers/directories_controller.rb', line 59 def edit end |
#index ⇒ Object
GET /directories GET /directories.json
7 8 9 |
# File 'app/controllers/directories_controller.rb', line 7 def index @directories = Directory.all end |
#new ⇒ Object
GET /directories/new
54 55 56 |
# File 'app/controllers/directories_controller.rb', line 54 def new @directory = Directory.new end |
#show ⇒ Object
GET /directories/1 GET /directories/1.json
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'app/controllers/directories_controller.rb', line 13 def show if params[:id] =~ /\A\// global_dir_path = params[:id] else global_dir_path = '/local' + File.(File.join(Rails.application.root.to_s,params[:id])) end @path = EziiOsPath.new(global_dir_path) case @path.file_system.machine_readable_identifier when 'local' @paths = Dir .entries(@path.file_system_path) .map do |entry| EziiOsPath.new( File.join(@path.global_path, entry) ) end .reject do |path| path.file_system_path =~ /\/\./ end # filter invisible files when 'dropbox' dropbox_directory = DropboxDirectory.new(@path.file_system_path) @paths = dropbox_directory .entries .take(25) .map do |entry| path = EziiOsPath.new( File.join(@path.global_path, entry['name']) ) path. = entry path end when 'github' redirect_to('https://github.com/ezii123/ezii-os/find/master') end end |
#update ⇒ Object
PATCH/PUT /directories/1 PATCH/PUT /directories/1.json
80 81 82 83 84 85 86 87 88 89 90 |
# File 'app/controllers/directories_controller.rb', line 80 def update respond_to do |format| if @directory.update(directory_params) format.html { redirect_to @directory, notice: 'Directory was successfully updated.' } format.json { render :show, status: :ok, location: @directory } else format.html { render :edit } format.json { render json: @directory.errors, status: :unprocessable_entity } end end end |