diff options
| author | mo k <mo@mokhan.ca> | 2012-09-18 17:05:04 -0600 |
|---|---|---|
| committer | mo k <mo@mokhan.ca> | 2012-09-18 17:05:04 -0600 |
| commit | 57d17d37faa8dcacbaf030eed353909ada7d3e4c (patch) | |
| tree | 1f0c682c1b829277b63285d10d461b33760e000e /app/views/tutorials | |
| parent | 1c526417be85ccd28e513fba9142ed1184818ac6 (diff) | |
connect the embedly service.
Diffstat (limited to 'app/views/tutorials')
| -rw-r--r-- | app/views/tutorials/_form.html.erb | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/app/views/tutorials/_form.html.erb b/app/views/tutorials/_form.html.erb index ff7c78ba..e61be881 100644 --- a/app/views/tutorials/_form.html.erb +++ b/app/views/tutorials/_form.html.erb @@ -1,23 +1,21 @@ <% content_for :javascript do %> <script type="text/javascript" charset="utf-8"> $(function(){ - $('#tutorial_url').change(function(){ - var url = $('#tutorial_url').val(); - $.embedly(url, {}, function(data){ - $('.tutorial-heading').val(data.title); - $('.tutorial-heading').text(data.title); - $('.tutorial-description').text(data.description); - $('img.embed-thumb').attr('src', data.thumbnail_url); - $('#tutorial_image_url').val(data.thumbnail_url); - }); - }); var view = { add_tag_button: $('#add-tag-button'), tag_list: $('#tag-list'), tag_input: $('#tags'), - hidden_tag_list: $('#hidden_tags') + hidden_tag_list: $('#hidden_tags'), + url_input: $('#tutorial_url'), + preview: { + heading: $('.tutorial-heading'), + description: $('.tutorial-description'), + image: $('img.embed-thumb'), + hidden_image_url: $('#tutorial_image_url'), + } }; - new NewTutorialPresenter(view).present(); + var service = new EmbedlyService($); + new NewTutorialPresenter(view, service).present(); }); </script> <% end %> |
