lib/gitdocs/server.rb in gitdocs-0.4.7 vs lib/gitdocs/server.rb in gitdocs-0.4.8

- old
+ new

@@ -31,19 +31,23 @@ if remote_branch = share.delete('remote_branch') share['remote_name'], share['branch_name'] = remote_branch.split('/', 2) end shares[Integer(idx)].update_attributes(share) end - manager.restart + EM.add_timer(0.1) { manager.restart } redirect! '/settings' end end path('search').get do render! "search", :layout => 'app', :locals => {:conf => manager.config, :results => manager.search(request.GET['q']), :nav_state => nil} end + path('shares').post do + Configuration::Share.create + end + var :int do |idx| gd = gds[idx] halt 404 if gd.nil? file_path = URI.unescape(request.path_info) file_ext = File.extname(file_path) @@ -66,10 +70,10 @@ FileUtils.mv(tempfile.path, File.expand_path(filename, expanded_path)) redirect! "/" + idx.to_s + file_path + "/" + filename elsif !File.exist?(expanded_path) # edit for non-existent file render! "edit", :layout => 'app', :locals => locals.merge(:contents => "") elsif File.directory?(expanded_path) # list directory - contents = gd.dir_files(expanded_path) + contents = gd.dir_files(expanded_path) render! "dir", :layout => 'app', :locals => locals.merge(:contents => contents) elsif mode == 'delete' # delete file FileUtils.rm(expanded_path) redirect! "/" + idx.to_s + parent elsif mode == 'edit' && mime.match(%r{text/}) # edit file \ No newline at end of file