Skip to content

Commit

Permalink
working settings page
Browse files Browse the repository at this point in the history
  • Loading branch information
joshbuddy authored and nesquena committed Dec 5, 2011
1 parent 5b9a855 commit af45aa1
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 11 deletions.
1 change: 0 additions & 1 deletion lib/gitdocs.rb
Expand Up @@ -9,7 +9,6 @@
require 'yajl'
require 'dante'


module Gitdocs

DEBUG = ENV['DEBUG']
Expand Down
2 changes: 1 addition & 1 deletion lib/gitdocs/migration/001_create_shares.rb
Expand Up @@ -3,7 +3,7 @@ def self.up
create_table :shares do |t|
t.column :path, :string
t.column :polling_interval, :integer, :default => 15
t.column :notifications, :boolean, :default => true
t.column :notification, :boolean, :default => true
end
end

Expand Down
9 changes: 9 additions & 0 deletions lib/gitdocs/public/css/app.css
Expand Up @@ -17,6 +17,15 @@ body h2 { font-size: 1.5em; margin-top: 0.2em; }
text-align: center;
}

.nav h1 a {
text-decoration: none;
color: black;
}

.nav h1 a:hover {
text-decoration: none;
}

.menu {
margin-top :10px;
display: absolute;
Expand Down
2 changes: 1 addition & 1 deletion lib/gitdocs/runner.rb
Expand Up @@ -5,7 +5,7 @@ class Runner
def initialize(share)
@share = share
out, status = sh_with_code "which growlnotify"
@use_growl = share.notifications && status.success?
@use_growl = share.notification && status.success?
@root = share.path
@polling_interval = share.polling_interval
@icon = File.expand_path("../../img/icon.png", __FILE__)
Expand Down
5 changes: 3 additions & 2 deletions lib/gitdocs/server.rb
Expand Up @@ -10,15 +10,16 @@ def initialize(config, *gitdocs)
end

def start(port = 8888)
gds = @gitdocs.sort { |a, b| a.root <=> b.root }
gds = @gitdocs
conf = @config
Thin::Server.start('127.0.0.1', port) do
use Rack::Static, :urls => ['/css', '/js', '/img', '/doc'], :root => File.expand_path("../public", __FILE__)
run Renee {
if request.path_info == '/'
render! "home", :layout => 'app', :locals => {:gds => gds}
else
path 'settings' do
get.render! 'settings', :layout => 'app', :locals => {:config => @config}
get.render! 'settings', :layout => 'app', :locals => {:conf => conf}
end

var :int do |idx|
Expand Down
7 changes: 4 additions & 3 deletions lib/gitdocs/views/app.haml
Expand Up @@ -12,9 +12,10 @@
%body
.nav
%h1
%img{ :src => "/img/git_logo.png", :width => 30, :height => 30}
Gitdocs
=Gitdocs::VERSION
%a{:href => '/'}
%img{ :src => "/img/git_logo.png", :width => 30, :height => 30}
Gitdocs
=Gitdocs::VERSION
.container
= preserve(yield)

Expand Down
18 changes: 15 additions & 3 deletions lib/gitdocs/views/settings.haml
@@ -1,5 +1,17 @@
%h1 Settings

%dl
%dt
%dd
%h2 Shares

-conf.shares.each_with_index do |share, idx|
%div{:id => "share-#{idx}", :class => 'share'}
%dl
%dt Path
%dd #{share.path}
%dl
%dt Polling interval
%dd #{share.polling_interval}
%dl
%dt Notifications?
%dd #{share.notification}


0 comments on commit af45aa1

Please sign in to comment.