Skip to content

Commit

Permalink
cleaned up markup
Browse files Browse the repository at this point in the history
  • Loading branch information
rubiii committed Aug 21, 2010
1 parent c860c8d commit 443dba3
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 33 deletions.
11 changes: 5 additions & 6 deletions lib/git/store/front.rb
Expand Up @@ -34,7 +34,6 @@ def highlight?(value)
# API

get "/api" do
@api = true
haml :api
end

Expand Down Expand Up @@ -89,27 +88,27 @@ 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 "/"
end

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 "/"
Expand Down
8 changes: 5 additions & 3 deletions lib/git/store/front/public/stylesheets/screen.css
Expand Up @@ -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; }
Expand Down Expand Up @@ -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; }
2 changes: 1 addition & 1 deletion 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:
Expand Down
2 changes: 1 addition & 1 deletion lib/git/store/front/views/_revision.haml
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion 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:
Expand Down
2 changes: 1 addition & 1 deletion 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:
Expand Down
15 changes: 9 additions & 6 deletions lib/git/store/front/views/api.haml
@@ -1,6 +1,9 @@
%h2 Chunky API
- content_for :header do
%h1= link_to "Explore the <strong>Git Store API</strong>", "/"
%p
My API allows you to access all my features via HTTP.

%h3 Store a new value
%h3 Store values
%pre
%code
:preserve
Expand All @@ -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
Expand All @@ -19,23 +22,23 @@
Params: { :key => "b806319115324c60d67eba7454007ddb27479616", :value => "my first value" }
%p Returns the new revision.

%h3 Retrieve a value
%h3 Retrieve values
%pre
%code
:preserve
Request: GET
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
Request: GET
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
Expand Down
15 changes: 15 additions & 0 deletions lib/git/store/front/views/index.haml
@@ -1,3 +1,16 @@
- content_for :header do
%h1= link_to "Hi, I'am your <strong>Git Store</strong>", "/"
%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
Expand All @@ -10,3 +23,5 @@
%td.width.l
%code= leaf.file
%td= leaf.value

= partial :revision if @revision
15 changes: 1 addition & 14 deletions lib/git/store/front/views/layout.haml
Expand Up @@ -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

0 comments on commit 443dba3

Please sign in to comment.