This repository has been archived by the owner on Apr 9, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Static controllers, some templates and badge.js + main.css
- Loading branch information
Showing
10 changed files
with
218 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
Embadge::App.controllers :badge do | ||
|
||
# get :index, :map => '/foo/bar' do | ||
# session[:foo] = 'bar' | ||
# render 'index' | ||
# end | ||
|
||
# get :sample, :map => '/sample/url', :provides => [:any, :js] do | ||
# case content_type | ||
# when :js then ... | ||
# else ... | ||
# end | ||
|
||
# get :foo, :with => :id do | ||
# "Maps to url '/foo/#{params[:id]}'" | ||
# end | ||
|
||
# get '/example' do | ||
# 'Hello world!' | ||
# end | ||
|
||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Embadge::App.controllers :static do | ||
|
||
get :index, map: '/' do | ||
render :index | ||
end | ||
|
||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Helper methods defined here can be accessed in any controller or view in the application | ||
|
||
module Embadge | ||
class App | ||
module BadgeHelper | ||
# def simple_helper_method | ||
# ... | ||
# end | ||
end | ||
|
||
helpers BadgeHelper | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Helper methods defined here can be accessed in any controller or view in the application | ||
|
||
module Embadge | ||
class App | ||
module StaticHelper | ||
# def simple_helper_method | ||
# ... | ||
# end | ||
end | ||
|
||
helpers StaticHelper | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
!!! | ||
%html | ||
%head | ||
%title embadge.io | ||
%link{:href => "//fonts.googleapis.com/css?family=Source+Sans+Pro:400,700", :rel => "stylesheet", :type => "text/css"}/ | ||
%link{:href => "/css/main.css", :rel => "stylesheet", :type => "text/css"}/ | ||
%body | ||
%a{:href => "https://github.com/halfdan/embadge.io"} | ||
%img{:alt => "Fork me on GitHub", :src => "https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png", :style => "position: absolute; top: 0; right: 0; border: 0;"}/ | ||
#content | ||
%h1 embadge.io | ||
%main= yield |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
%p | ||
embadge.io is a simple Ember.js badge generator service. | ||
It provides a simple to use API. | ||
It's inspired by Matthew Beale's | ||
%a{:href => "https://github.com/mixonic/ember-community-versions"} Ember Community Versions | ||
and is open-sourced | ||
%a{:href => "https://github.com/halfdan/embadge.io"} on Github | ||
%h2#examples Examples | ||
%ul | ||
%li | ||
With start version: | ||
%br/ | ||
%a{:href => "//embadge.io/v1/badge.svg?start=1.13.0"} | ||
%img{:src => "//embadge.io/v1/badge.svg?start=1.13.0"}/ | ||
%li | ||
With start and end version: | ||
%br/ | ||
%a{:href => "//embadge.io/v1/badge.svg?start=1.13.0&end=2.0.0"} | ||
%img{:src => "//embadge.io/v1/badge.svg?start=1.13.0&end=2.0.0"}/ | ||
%li | ||
With range: | ||
%br/ | ||
%a{:href => "//embadge.io/v1/badge.svg?range=^2.3.0"} | ||
%img{:src => "//embadge.io/v1/badge.svg?range=^2.3.0"}/ | ||
%li | ||
With custom label: | ||
%br/ | ||
%a{:href => "//embadge.io/v1/badge.svg?label=ember-cli&start=1.13.13"} | ||
%img{:src => "//embadge.io/v1/badge.svg?label=ember-cli&start=1.13.13"}/ | ||
%li | ||
With custom label and range: | ||
%br/ | ||
%a{:href => "//embadge.io/v1/badge.svg?label=ember-data&range=^2.3.0"} | ||
%img{:src => "//embadge.io/v1/badge.svg?label=ember-data&range=^2.3.0"}/ | ||
%h2#usage Usage | ||
%p The embadge.io API supports four different parameters. | ||
%ul | ||
%li | ||
%pre> label | ||
Used to define the text label shown on the badge (default: 'ember-versions') | ||
%li | ||
%pre> start | ||
Valid semver string noting the earliest supported version. | ||
%li | ||
%pre> end | ||
(Optional) Valid semver string noting the last supported version. | ||
%li | ||
%pre> range | ||
(Optional) Valid semver range (e.g. "^2.3.0") noting a supported range of versions. If given, | ||
%code start | ||
and | ||
%code end | ||
will be ignored. | ||
%p | ||
The API supports HTTPS and is accessed from is | ||
%code https://embadge.io/v1/badge.svg | ||
%h3#browser Browser | ||
%p In order to easily add embadge.io to your website you can include the following script in the body: | ||
%code | ||
%pre <script src="//embadge.io/v1/badge.js" type="text/javascript"></script> | ||
%p | ||
This will search your page for | ||
%code span | ||
elements with the | ||
%code embadge | ||
class and use data attributes to generate the image URL. | ||
%code | ||
%pre <span class="embadge" data-start="2.3.0"><span> | ||
%h2#links Links | ||
%ul | ||
%li | ||
%a{:href => "http://emberup.co/dynamic-component-rendering/"} Dynamic component rendering | ||
%li | ||
%a{:href => "https://github.com/mixonic/ember-community-versions"} Ember Community Versions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
*, *:before, *:after { | ||
-moz-box-sizing: border-box; | ||
-webkit-box-sizing: border-box; | ||
box-sizing: border-box; | ||
} | ||
|
||
body { | ||
background: white; | ||
font-family: 'Georgia', serif; | ||
margin: 0; | ||
padding: 0; | ||
} | ||
|
||
#content { | ||
max-width: 600px; | ||
margin: 0 auto; | ||
position: relative; | ||
padding: 20px; | ||
} | ||
|
||
h1, h2 { | ||
font-family: 'Source Sans Pro', sans-serif; | ||
} | ||
|
||
h1 { | ||
font-size: 72px; | ||
line-height: 1.7; | ||
margin: 0; | ||
padding: 0; | ||
|
||
} | ||
|
||
h2 { | ||
color: #333; | ||
} | ||
|
||
p { | ||
color: #444; | ||
line-height: 1.6; | ||
font-size: 18px; | ||
} | ||
|
||
li { | ||
line-height: 1.6; | ||
font-size: 18px; | ||
} | ||
|
||
a { | ||
color: #d01040; | ||
} | ||
|
||
a:visited { | ||
color: rgba(208, 16, 64, 0.6); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
(function() { | ||
var elements = document.getElementsByClassName('embadge'), | ||
url = '//embadge.io/v1/badge.svg'; | ||
for (i=0; i < elements.length; i++) { | ||
var img = document.createElement('img'), | ||
el = elements[i]; | ||
if (el.dataset.range) { | ||
img.src = url + '?range=' + el.dataset.range; | ||
} else { | ||
img.src = url + '?start=' + el.dataset.start; | ||
if (el.dataset.end) { | ||
img.src += '&end=' + el.dataset.end; | ||
} | ||
} | ||
el.appendChild(img); | ||
}; | ||
})(); |