Commit 6e048943f4ac3dc8fd6b241b6e6f329844576f7a
Exists in
staging
and in
4 other branches
Merge branch 'master' into staging_rails4
Showing
8 changed files
with
60 additions
and
8 deletions
Show diff stats
app/views/profile/_profile_members_list.html.erb
plugins/piwik/lib/ext/environment.rb
... | ... | @@ -2,6 +2,7 @@ require_dependency 'environment' |
2 | 2 | |
3 | 3 | class Environment |
4 | 4 | settings_items :piwik_domain |
5 | + settings_items :piwik_path, :default => 'piwik' | |
5 | 6 | settings_items :piwik_site_id |
6 | - attr_accessible :piwik_domain, :piwik_site_id | |
7 | + attr_accessible :piwik_domain, :piwik_site_id, :piwik_path | |
7 | 8 | end | ... | ... |
plugins/piwik/lib/piwik_plugin.rb
... | ... | @@ -17,7 +17,9 @@ class PiwikPlugin < Noosfero::Plugin |
17 | 17 | domain = context.environment.piwik_domain |
18 | 18 | site_id = context.environment.piwik_site_id |
19 | 19 | unless domain.blank? || site_id.blank? |
20 | - expanded_template('tracking-code.rhtml',{:domain => domain, :site_id => site_id}) | |
20 | + piwik_url = "#{domain}/#{context.environment.piwik_path}" | |
21 | + piwik_url = "#{piwik_url}/" unless piwik_url.end_with?('/') | |
22 | + expanded_template('tracking-code.rhtml', {:site_id => site_id, :piwik_url => piwik_url}) | |
21 | 23 | end |
22 | 24 | end |
23 | 25 | ... | ... |
plugins/piwik/test/functional/piwik_plugin_test.rb
... | ... | @@ -19,10 +19,12 @@ class PiwikPluginAdminControllerTest < ActionController::TestCase |
19 | 19 | |
20 | 20 | should 'update piwik plugin settings' do |
21 | 21 | assert_nil @environment.reload.piwik_domain |
22 | + assert_equal 'piwik', @environment.reload.piwik_path | |
22 | 23 | assert_nil @environment.reload.piwik_site_id |
23 | - post :index, :environment => { :piwik_domain => 'http://something', :piwik_site_id => 10 } | |
24 | - assert_not_nil @environment.reload.piwik_domain | |
25 | - assert_not_nil @environment.reload.piwik_site_id | |
24 | + post :index, :environment => { :piwik_domain => 'something', :piwik_site_id => 10, :piwik_path => 'some_path' } | |
25 | + assert_equal 'something', @environment.reload.piwik_domain | |
26 | + assert_equal '10', @environment.reload.piwik_site_id | |
27 | + assert_equal 'some_path', @environment.reload.piwik_path | |
26 | 28 | end |
27 | 29 | |
28 | 30 | end | ... | ... |
plugins/piwik/test/unit/piwik_plugin_test.rb
... | ... | @@ -39,4 +39,19 @@ class PiwikPluginTest < ActiveSupport::TestCase |
39 | 39 | assert_respond_to Environment.new, :piwik_site_id |
40 | 40 | end |
41 | 41 | |
42 | + should 'set default path to piwik' do | |
43 | + @environment.piwik_domain = 'piwik.domain.example.com' | |
44 | + @environment.piwik_site_id = 5 | |
45 | + @plugin.expects(:expanded_template).with('tracking-code.rhtml', {:site_id => @environment.piwik_site_id, :piwik_url => "piwik.domain.example.com/piwik/"}) | |
46 | + @plugin.body_ending | |
47 | + end | |
48 | + | |
49 | + should 'allow empty path in piwik url' do | |
50 | + @environment.piwik_domain = 'piwik.domain.example.com' | |
51 | + @environment.piwik_path = '' | |
52 | + @environment.piwik_site_id = 5 | |
53 | + @plugin.expects(:expanded_template).with('tracking-code.rhtml', {:site_id => @environment.piwik_site_id, :piwik_url => "piwik.domain.example.com/"}) | |
54 | + @plugin.body_ending | |
55 | + end | |
56 | + | |
42 | 57 | end | ... | ... |
plugins/piwik/views/piwik_plugin_admin/index.html.erb
... | ... | @@ -4,6 +4,8 @@ |
4 | 4 | |
5 | 5 | <%= labelled_form_field _('Piwik domain'), f.text_field(:piwik_domain) %> |
6 | 6 | |
7 | + <%= labelled_form_field _('Piwik path'), f.text_field(:piwik_path) %> | |
8 | + | |
7 | 9 | <%= labelled_form_field _('Piwik site id'), f.text_field(:piwik_site_id) %> |
8 | 10 | |
9 | 11 | <% button_bar do %> | ... | ... |
plugins/piwik/views/tracking-code.rhtml
... | ... | @@ -4,12 +4,12 @@ |
4 | 4 | _paq.push(['trackPageView']); |
5 | 5 | _paq.push(['enableLinkTracking']); |
6 | 6 | (function() { |
7 | - var u=(("https:" == document.location.protocol) ? "https" : "http") + "://<%= escape_javascript locals[:domain] %>/piwik/"; | |
7 | + var u=(("https:" == document.location.protocol) ? "https" : "http") + "://<%= escape_javascript locals[:piwik_url] %>"; | |
8 | 8 | _paq.push(['setTrackerUrl', u+'piwik.php']); |
9 | 9 | _paq.push(['setSiteId', <%= escape_javascript locals[:site_id] %>]); |
10 | 10 | var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; g.type='text/javascript'; |
11 | 11 | g.defer=true; g.async=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s); |
12 | 12 | })(); |
13 | 13 | </script> |
14 | -<noscript><p><img src="http://<%= escape_javascript locals[:domain] %>/piwik/piwik.php?idsite=<%= escape_javascript locals[:site_id] %>" style="border:0;" alt="" /></p></noscript> | |
14 | +<noscript><p><img src="http://<%= escape_javascript locals[:piwik_url] %>piwik.php?idsite=<%= escape_javascript locals[:site_id] %>" style="border:0;" alt="" /></p></noscript> | |
15 | 15 | <!-- End Piwik Code --> | ... | ... |
public/designs/themes/noosfero/style.css
... | ... | @@ -18,3 +18,33 @@ |
18 | 18 | #buddy-list #environment-logo { |
19 | 19 | background-color: #BBB; |
20 | 20 | } |
21 | + | |
22 | +/* Members list*/ | |
23 | +.profile-members-tabs-container .ui-corner-all{ | |
24 | + padding-bottom: 10px; | |
25 | +} | |
26 | + | |
27 | +#content #members-tab ul.profile-list-members, | |
28 | +#content #admins-tab ul.profile-list-admins{ | |
29 | + margin: 10px auto; | |
30 | +} | |
31 | + | |
32 | +.common-profile-list-block .profile-image{ | |
33 | + height: auto; | |
34 | +} | |
35 | + | |
36 | +.common-profile-list-block .profile-image img{ | |
37 | + max-height: 80px; | |
38 | + max-width: 80px; | |
39 | +} | |
40 | + | |
41 | +.box-1 .common-profile-list-block span{ | |
42 | + width: 84px; | |
43 | +} | |
44 | + | |
45 | +.box-1 .common-profile-list-block span.fn { | |
46 | + margin-top: 5px; | |
47 | + height: 25px; | |
48 | + width: 80px; | |
49 | +} | |
50 | + | ... | ... |