Commit 2849a9c05181f279381b0e2d139c6fa3618c87d9
1 parent
3ae088de
Exists in
master
and in
11 other branches
proposals_discussion: move js functions to proposals_list.js
Showing
3 changed files
with
32 additions
and
36 deletions
Show diff stats
public/main.js
... | ... | @@ -1,14 +0,0 @@ |
1 | -function initTwitterButton() { | |
2 | - !function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs'); | |
3 | -} | |
4 | - | |
5 | -jQuery(document).ready(function($) { | |
6 | - initTwitterButton(); | |
7 | - $('.proposals').on('mouseenter', '.proposal', function() { | |
8 | - twttr.widgets.load(); | |
9 | - $('.proposal .social').hide(); | |
10 | - $(this).find('.social').show("fast"); | |
11 | - }).on('mouseleave', '.proposal', function() { | |
12 | - $(this).find('.social').hide("fast"); | |
13 | - }); | |
14 | -}); |
... | ... | @@ -0,0 +1,31 @@ |
1 | +function initTwitterButton() { | |
2 | + !function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs'); | |
3 | +} | |
4 | + | |
5 | +jQuery(document).ready(function($) { | |
6 | + initTwitterButton(); | |
7 | + $('.proposals').on('mouseenter', '.proposal', function() { | |
8 | + twttr.widgets.load(); | |
9 | + $('.proposal .social').hide(); | |
10 | + $(this).find('.social').show("fast"); | |
11 | + }).on('mouseleave', '.proposal', function() { | |
12 | + $(this).find('.social').hide("fast"); | |
13 | + }); | |
14 | + | |
15 | + function proposalsScroll() { | |
16 | + $('.proposals').data('jscroll', null); | |
17 | + $('.proposals').jscroll({ | |
18 | + loadingHtml: '<img src="/images/loading.gif" alt="Loading" />Loading...', | |
19 | + nextSelector: 'div.more a' | |
20 | + }); | |
21 | + $('.proposals').trigger('scroll.jscroll'); | |
22 | + } | |
23 | + proposalsScroll(); | |
24 | + | |
25 | + $('.proposals_list .filters a.order').on('ajax:success', function(event, data, status, xhr) { | |
26 | + $('.proposals_list .filters a.order').removeClass('selected'); | |
27 | + $(this).addClass('selected'); | |
28 | + $(this).parents('div.proposals_list').find('.proposals').html(data); | |
29 | + proposalsScroll(); | |
30 | + }); | |
31 | +}); | ... | ... |
views/content_viewer/_proposals_list.html.erb
1 | 1 | <script src="/javascripts/plugins/proposals_discussion/jquery.jscroll.min.js" type="text/javascript"></script> |
2 | -<%= javascript_include_tag 'plugins/proposals_discussion/main.js' %> | |
3 | - | |
4 | -<script> | |
5 | - jQuery(document).ready(function($) { | |
6 | - function proposalsScroll() { | |
7 | - $('.proposals').data('jscroll', null); | |
8 | - $('.proposals').jscroll({ | |
9 | - loadingHtml: '<img src="/images/loading.gif" alt="Loading" /> <%= _("Loading...") %>', | |
10 | - nextSelector: 'div.more a' | |
11 | - }); | |
12 | - $('.proposals').trigger('scroll.jscroll'); | |
13 | - } | |
14 | - proposalsScroll(); | |
15 | - | |
16 | - $('.proposals_list .filters a.order').on('ajax:success', function(event, data, status, xhr) { | |
17 | - $('.proposals_list .filters a.order').removeClass('selected'); | |
18 | - $(this).addClass('selected'); | |
19 | - $(this).parents('div.proposals_list').find('.proposals').html(data); | |
20 | - proposalsScroll(); | |
21 | - }); | |
22 | - }); | |
23 | -</script> | |
2 | +<%= javascript_include_tag 'plugins/proposals_discussion/proposals_list.js' %> | |
24 | 3 | |
25 | 4 | <% extend ProposalsDiscussionPlugin::ProposalsListHelper %> |
26 | 5 | ... | ... |