Skip to content
This repository was archived by the owner on Mar 22, 2019. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ gem "redcarpet"
gem "activesupport"
gem "highline"
gem "rake"
gem "coderay"
gem "coderay", :git => "git://github.com/dgeb/coderay.git", :branch => "handlebars"
gem "middleman", '~> 3.0'
gem "middleman-blog", "~> 3.0"
gem "thin"
Expand Down
10 changes: 8 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
GIT
remote: git://github.com/dgeb/coderay.git
revision: 73767aa80301ef5de74f625d597dde5cd940e74d
branch: handlebars
specs:
coderay (1.0.8.rc1)

GEM
remote: http://rubygems.org/
specs:
Expand All @@ -6,7 +13,6 @@ GEM
multi_json (~> 1.0)
builder (3.1.3)
chunky_png (1.2.5)
coderay (1.0.7)
coffee-script (2.2.0)
coffee-script-source
execjs
Expand Down Expand Up @@ -119,7 +125,7 @@ PLATFORMS
DEPENDENCIES
activesupport
builder
coderay
coderay!
highline
listen
middleman (~> 3.0)
Expand Down
7 changes: 2 additions & 5 deletions lib/highlighter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@ def registered(app)

module Helpers
def _highlight(string, language, class_name=nil)
language_class = language
language = 'html' if language == 'handlebars'

result = %Q{<div class="highlight #{language_class} #{class_name}">}
result = %Q{<div class="highlight #{language} #{class_name}">}
result += '<div class="ribbon"></div>'
code = string.gsub(/^\n+/, '').rstrip
code = CodeRay.scan(code, language)
Expand All @@ -23,7 +20,7 @@ def _highlight(string, language, class_name=nil)
line_number_anchors: false

result += %Q{</div>}
result
result
end

def highlight(language, class_name, &block)
Expand Down
11 changes: 4 additions & 7 deletions source/about.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -71,21 +71,18 @@ App.Person = DS.Model.extend({

App.peopleController = Em.ArrayController.create({
content: App.Person.findAll()
});<% end %>
});
<% end %>

<% highlight :html, :right do %>
<% highlight :handlebars, :right do %>
<h1>People</h1>

<ul>
{{#each peopleController}}
<li>Hello, <b>{{fullName}}</b>!</li>
{{/each}}
</ul>




<% end %>
<% end %>

</div>

Expand Down
95 changes: 46 additions & 49 deletions source/docs/handlebars.md
Original file line number Diff line number Diff line change
Expand Up @@ -667,42 +667,42 @@ Ember comes pre-packaged with a set of views for building a few basic controls l
They are:

####Ember.Checkbox

```handlebars
<label>
{{view Ember.Checkbox checkedBinding="content.isDone"}}
{{content.title}}
</label>
<label>
{{view Ember.Checkbox checkedBinding="content.isDone"}}
{{content.title}}
</label>
```

####Ember.TextField

```javascript
App.MyText = Ember.TextField.extend({
formBlurredBinding: 'App.adminController.formBlurred',
change: function(evt) {
this.set('formBlurred', true);
}
});
App.MyText = Ember.TextField.extend({
formBlurredBinding: 'App.adminController.formBlurred',
change: function(evt) {
this.set('formBlurred', true);
}
});
```

####Ember.Select

```handlebars
{{view Ember.Select viewName="select"
contentBinding="App.peopleController"
optionLabelPath="content.fullName"
optionValuePath="content.id"
prompt="Pick a person:"
selectionBinding="App.selectedPersonController.person"}}
{{view Ember.Select viewName="select"
contentBinding="App.peopleController"
optionLabelPath="content.fullName"
optionValuePath="content.id"
prompt="Pick a person:"
selectionBinding="App.selectedPersonController.person"}}
```

####Ember.TextArea

```javascript
var textArea = Ember.TextArea.create({
valueBinding: 'TestObject.value'
});
var textArea = Ember.TextArea.create({
valueBinding: 'TestObject.value'
});
```


Expand All @@ -714,29 +714,26 @@ Example:

```javascript
App.MyText = Ember.TextField.extend({
formBlurredBinding: 'App.adminController.formBlurred',
change: function(evt) {
this.set('formBlurred', true);
}
});
formBlurredBinding: 'App.adminController.formBlurred',
change: function(evt) {
this.set('formBlurred', true);
}
});
```

You can then use this view as a sub view and capture the events. In the following example, a change to the Name input would blurr the form and cause the save button to appear.

```handlebars
<script id="formDetail" data-template-name='formDetail' type="text/x-handlebars">
<form>
<fieldset>
<legend>Info:</legend>

{{view App.MyText name="Name" id="Name" valueBinding="myObj.Name"}}
<label for="Name">Name</label><br/>

{{#if formBlurred}}
<a href="#" {{action "syncData" on="click"}}>Save</a>
{{/if}}

</fieldset>
</form>
</script>
You can then use this view as a sub view and capture the events. In the following example, a change to the Name input would blur the form and cause the save button to appear.

```handlebars
<form>
<fieldset>
<legend>Info:</legend>

{{view App.MyText name="Name" id="Name" valueBinding="myObj.Name"}}
<label for="Name">Name</label><br/>

{{#if formBlurred}}
<a href="#" {{action "syncData" on="click"}}>Save</a>
{{/if}}
</fieldset>
</form>
```
19 changes: 11 additions & 8 deletions source/stylesheets/highlight.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,16 @@ $border-radius: 5px;
height: 20px;
}

&.javascript .ribbon {
background-image: url(/images/js-ribbon.png);
}

&.html .ribbon {
background-image: url(/images/html-ribbon.png);
}
&.javascript .ribbon {
background-image: url(/images/js-ribbon.png);
}
&.html .ribbon {
background-image: url(/images/html-ribbon.png);
}
/* TODO - create custom handlebars-ribbon.png */
&.handlebars .ribbon {
background-image: url(/images/html-ribbon.png);
}
}

.CodeRay {
Expand All @@ -53,7 +56,7 @@ $border-radius: 5px;

/* HTML */
.CodeRay {
.tag {
.tag, .error {
color: red;
}

Expand Down