Commit dbc3f779
Changed files (3)
app
assets
javascripts
presenters
views
tutorials
spec
javascripts
presenters
app/assets/javascripts/presenters/new_tutorial_presenter.js.coffee
@@ -23,3 +23,5 @@ class window.NewTutorialPresenter
@view.preview.description.text(data.description)
@view.preview.image.attr('src', data.thumbnail_url)
@view.preview.hidden_image_url.val(data.thumbnail_url)
+ @view.preview.author.val(data.provider_name)
+ @view.preview.author_url.val(data.provider_url)
app/views/tutorials/_form.html.erb
@@ -33,6 +33,18 @@ $(function(){
<%= f.text_field :heading, :class => "input-xlarge, tutorial-heading" %>
</div>
</div>
+ <div class="control-group">
+ <%= f.label :author, :class => "control-label" %>
+ <div class="controls">
+ <%= f.text_field :author, :class => "input-xlarge, tutorial-author" %>
+ </div>
+ </div>
+ <div class="control-group">
+ <%= f.label :author_url, :class => "control-label" %>
+ <div class="controls">
+ <%= f.text_field :author_url, :class => "input-xlarge, tutorial-author-url" %>
+ </div>
+ </div>
<div class="control-group">
<%= f.label :description, :class => "control-label" %>
<div class="controls">
spec/javascripts/presenters/new_tutorial_presenter_spec.js
@@ -11,6 +11,8 @@ describe ("NewTutorialPresenter", function() {
description: $('<p>'),
image: $('<img>'),
hidden_image_url: $('<input type="hidden">'),
+ author: $('<input type="text">'),
+ author_url: $('<input type="text">'),
}
};
service = {
@@ -73,11 +75,19 @@ describe ("NewTutorialPresenter", function() {
it ("should update the hidden input image url", function() {
expect(view.preview.hidden_image_url.val()).toEqual('http://');
});
+ it ("should display the author name", function() {
+ expect(view.preview.author.val()).toEqual('superman');
+ });
+ it ("should display the author url", function() {
+ expect(view.preview.author_url.val()).toEqual('http://www.superman.com');
+ });
beforeEach (function() {
var payload = {
title: 'the title',
description: 'the description',
- thumbnail_url: 'http://'
+ thumbnail_url: 'http://',
+ provider_url: 'http://www.superman.com',
+ provider_name: 'superman'
};
sut.display_url_info(payload);
});