Sha256: 349608b66e12c75abec4079a74df3bf200f10ed958f0c86a834804fd5d42a0c0

Contents?: true

Size: 582 Bytes

Versions: 3

Compression:

Stored size: 582 Bytes

Contents

# -*- encoding : utf-8 -*-

require 'sinatra/base'
require 'haml'
require 'yaml'
require 'mimetype_fu'

module Gitdocs
  class SettingsApp < Sinatra::Base
    get('/') do
      haml(
        :settings,
        locals: { nav_state: 'settings' }
      )
    end

    post('/') do
      Configuration.update(request.POST['config'])
      Share.update_all(request.POST['share'])
      Manager.restart_synchronization
      redirect to('/')
    end

    delete('/:id') do
      id = params[:id].to_i
      halt(404) unless Share.remove_by_id(id)
      redirect to('/')
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
gitdocs-0.6.2 lib/gitdocs/settings_app.rb
gitdocs-0.6.1 lib/gitdocs/settings_app.rb
gitdocs-0.6.0 lib/gitdocs/settings_app.rb