Commit 8260f5ecec88c8acabf6c4b65d7fd225446895e4
Committed by
Paulo Meireles
1 parent
5f36bd63
Exists in
master
and in
29 other branches
adding new javascript for ajax result
Showing
3 changed files
with
16 additions
and
2 deletions
Show diff stats
plugins/mezuro/lib/mezuro_plugin.rb
@@ -17,7 +17,7 @@ class MezuroPlugin < Noosfero::Plugin | @@ -17,7 +17,7 @@ class MezuroPlugin < Noosfero::Plugin | ||
17 | end | 17 | end |
18 | 18 | ||
19 | def js_files | 19 | def js_files |
20 | - 'javascripts/toogle.js' | 20 | + ['javascripts/results.js', 'javascripts/toogle.js'] |
21 | end | 21 | end |
22 | 22 | ||
23 | end | 23 | end |
24 | \ No newline at end of file | 24 | \ No newline at end of file |
@@ -0,0 +1,14 @@ | @@ -0,0 +1,14 @@ | ||
1 | +function results($) { | ||
2 | + $('.mezuro-display-metrics').click(function() { | ||
3 | + var profile = 'qt-calculator'; // FIXME | ||
4 | + var project = $('#module-result').attr('data-project-id'); | ||
5 | + var module_name = $(this).attr('data-module-name'); | ||
6 | + var endpoint = '/profile/' + profile + '/plugins/mezuro/metrics/' + project; | ||
7 | + // FIXME turn on the 'loading ...' | ||
8 | + $.get(endpoint, { module_name: module_name }, function(content) { | ||
9 | + $('#module-result').html(content); | ||
10 | + // FIXME turn off the 'loading ...' | ||
11 | + }); | ||
12 | + return false; | ||
13 | + }); | ||
14 | +}; | ||
0 | \ No newline at end of file | 15 | \ No newline at end of file |
plugins/mezuro/test/unit/mezuro_plugin_test.rb
@@ -26,7 +26,7 @@ class MezuroPluginTest < Test::Unit::TestCase | @@ -26,7 +26,7 @@ class MezuroPluginTest < Test::Unit::TestCase | ||
26 | end | 26 | end |
27 | 27 | ||
28 | should 'list javascript files' do | 28 | should 'list javascript files' do |
29 | - assert_equal 'javascripts/toogle.js', @plugin.js_files | 29 | + assert_equal ['javascripts/results.js', 'javascripts/toogle.js'], @plugin.js_files |
30 | end | 30 | end |
31 | 31 | ||
32 | end | 32 | end |
33 | \ No newline at end of file | 33 | \ No newline at end of file |