From 443dba3623858181905beee64610ee153be8f50b Mon Sep 17 00:00:00 2001 From: rubiii Date: Sat, 21 Aug 2010 20:20:15 +0200 Subject: [PATCH] cleaned up markup --- lib/git/store/front.rb | 11 +++++------ lib/git/store/front/public/stylesheets/screen.css | 8 +++++--- lib/git/store/front/views/_remove_value.haml | 2 +- lib/git/store/front/views/_revision.haml | 2 +- lib/git/store/front/views/_store_value.haml | 2 +- lib/git/store/front/views/_update_value.haml | 2 +- lib/git/store/front/views/api.haml | 15 +++++++++------ lib/git/store/front/views/index.haml | 15 +++++++++++++++ lib/git/store/front/views/layout.haml | 15 +-------------- 9 files changed, 39 insertions(+), 33 deletions(-) diff --git a/lib/git/store/front.rb b/lib/git/store/front.rb index 53b5851..b1c3f9b 100644 --- a/lib/git/store/front.rb +++ b/lib/git/store/front.rb @@ -34,7 +34,6 @@ def highlight?(value) # API get "/api" do - @api = true haml :api end @@ -89,17 +88,17 @@ def highlight?(value) post "/push" do key = git.push params[:value] - flash[:notice] = "Thanks for the value Sir. Here's your key: #{key}" + flash[:notice] = "Thanks for the value. Here's your key: #{key}" flash[:highlight] = params[:value] redirect "/" end put "/update" do if revision = git.update(params[:key], params[:value]) - flash[:notice] = "Great update Sir. The new revision is at: #{revision}" + flash[:notice] = "Great update. The new revision is at: #{revision}" flash[:highlight] = params[:value] else - flash[:alert] = "No can do. Please try something else Sir." + flash[:alert] = "No can do. Please don't try that again." end redirect "/" @@ -107,9 +106,9 @@ def highlight?(value) delete "/remove" do if revision = git.remove(params[:key]) - flash[:notice] = "Sir, you removed: #{params[:key]}" + flash[:notice] = "You just removed: #{params[:key]}" else - flash[:alert] = "I'm afraid I can't do that Sir." + flash[:alert] = "I'm afraid I can't do that." end redirect "/" diff --git a/lib/git/store/front/public/stylesheets/screen.css b/lib/git/store/front/public/stylesheets/screen.css index fb129a3..49f9343 100644 --- a/lib/git/store/front/public/stylesheets/screen.css +++ b/lib/git/store/front/public/stylesheets/screen.css @@ -5,8 +5,9 @@ body { background:#fff; color:#222; font:13px/21px helvetica,arial,sans-serif; m h1, h2, h3 { clear:both; font-family:Aller,helvetica,arial,sans-serif; } h1 { font-size:34px; } + h1 a:link, h1 a:visited, h1 a:hover, h1 a:active { color:#222; text-decoration:none; } h1 strong { color:#659833; font-weight:normal; } - h2 { border-top:4px solid #eee; font-size:20px; margin-top:2em; padding-top:0.5em; } + h2 { border-top:4px solid #eee; font-size:20px; margin-top:2em; padding-top:0.5em; } h3 { font-size:16px; margin-top:2em; } a:link, a:visited { color:#4183C4; text-decoration:none; } @@ -35,8 +36,9 @@ input { margin-right:15px; } #content { margin:0 auto; width:60em; } div.flash { border-width:1px; border-style:dashed; padding:1em 2em; } -div.flash.notice { border-color:#659833; } -div.flash.alert { border-color:#a00; } .notice, .notice code { color:#659833; } +div.notice { border-color:#659833; } + .alert, .alert code { color:#a00; } +div.alert { border-color:#a00; } diff --git a/lib/git/store/front/views/_remove_value.haml b/lib/git/store/front/views/_remove_value.haml index a034392..7dd4312 100644 --- a/lib/git/store/front/views/_remove_value.haml +++ b/lib/git/store/front/views/_remove_value.haml @@ -1,4 +1,4 @@ -%h2 Remove a value +%h3 Remove a value - form_tag "/remove", :method => "delete" do %label{ :for => "remove_key" } Key: diff --git a/lib/git/store/front/views/_revision.haml b/lib/git/store/front/views/_revision.haml index 64d8a1d..3494a96 100644 --- a/lib/git/store/front/views/_revision.haml +++ b/lib/git/store/front/views/_revision.haml @@ -5,7 +5,7 @@ %li Parent: %a{ :href => "/#{@revision.parent}" }= @revision.parent - %li This one: #{@revision.sha} + %li Current: #{@revision.sha} - if @revision.child %li Child: diff --git a/lib/git/store/front/views/_store_value.haml b/lib/git/store/front/views/_store_value.haml index 2c960ef..df65a88 100644 --- a/lib/git/store/front/views/_store_value.haml +++ b/lib/git/store/front/views/_store_value.haml @@ -1,4 +1,4 @@ -%h2 Store a new value +%h3 Store a value - form_tag "/push" do %label{ :for => "store_key" } Value: diff --git a/lib/git/store/front/views/_update_value.haml b/lib/git/store/front/views/_update_value.haml index c5fecb1..0ab45c4 100644 --- a/lib/git/store/front/views/_update_value.haml +++ b/lib/git/store/front/views/_update_value.haml @@ -1,4 +1,4 @@ -%h2 Update a value +%h3 Update a value - form_tag "/update", :method => "put" do %label{ :for => "update_key" } Key: diff --git a/lib/git/store/front/views/api.haml b/lib/git/store/front/views/api.haml index 106c4f6..d34a188 100644 --- a/lib/git/store/front/views/api.haml +++ b/lib/git/store/front/views/api.haml @@ -1,6 +1,9 @@ -%h2 Chunky API +- content_for :header do + %h1= link_to "Explore the Git Store API", "/" + %p + My API allows you to access all my features via HTTP. -%h3 Store a new value +%h3 Store values %pre %code :preserve @@ -10,7 +13,7 @@ %p Returns a key for you to retrieve the value. -%h3 Update an existing value +%h3 Update values %pre %code :preserve @@ -19,7 +22,7 @@ Params: { :key => "b806319115324c60d67eba7454007ddb27479616", :value => "my first value" } %p Returns the new revision. -%h3 Retrieve a value +%h3 Retrieve values %pre %code :preserve @@ -27,7 +30,7 @@ URL: http://localhost:4567/api/:key %p Returns the value for the given key. -%h3 Retrieve a value from a specific revision +%h3 Retrieve values from a specific revision %pre %code :preserve @@ -35,7 +38,7 @@ URL: http://localhost:4567/api/:revision/:key %p Returns the value for the given key and revision. -%h3 Remove a value +%h3 Remove values %pre %code :preserve diff --git a/lib/git/store/front/views/index.haml b/lib/git/store/front/views/index.haml index d9c272c..c009c15 100644 --- a/lib/git/store/front/views/index.haml +++ b/lib/git/store/front/views/index.haml @@ -1,3 +1,16 @@ +- content_for :header do + %h1= link_to "Hi, I'am your Git Store", "/" + %p + My job is to store values and hand out keys for you to retrieve them. + I'm based on #{link_to("Git", "http://git-scm.com")} and heavily inspired + by #{link_to("GitHub", "http://github.com")}. + += partial :getting_started unless @revision + +%h2 + Interact with my + = link_to "API", "/api" + = partial :store_value = partial :update_value = partial :remove_value @@ -10,3 +23,5 @@ %td.width.l %code= leaf.file %td= leaf.value + += partial :revision if @revision diff --git a/lib/git/store/front/views/layout.haml b/lib/git/store/front/views/layout.haml index cb8472b..6872c52 100644 --- a/lib/git/store/front/views/layout.haml +++ b/lib/git/store/front/views/layout.haml @@ -7,20 +7,7 @@ %body #content - %h1 - Hi, I'am your - %strong Git Store - - %p - My job is to store values and hand out keys for you to retrieve them. I'm based on - #{link_to("Git", "http://git-scm.com")}, so I'm not the fastest store in town. - %br - But guess what? I can also update/remove values and let you retrieve specific revisions of a value. - + = yield_content :header = partial :flash if flash[:notice] || flash[:alert] - = partial :getting_started unless @revision || @api - = yield - - = partial :revision if @revision = partial :footer