Commit cd1a5cd2a0dbf7056f777b12852b65ca7fd65e62
Committed by
Rodrigo Souto
1 parent
d82b1b03
Exists in
master
and in
26 other branches
Allow noosfero template system to use javascript
Signed-off-by: Fabio Teixeira <fabio1079@gmail.com>
Showing
3 changed files
with
24 additions
and
5 deletions
Show diff stats
app/helpers/application_helper.rb
... | ... | @@ -707,6 +707,24 @@ module ApplicationHelper |
707 | 707 | javascript_include_tag script if script |
708 | 708 | end |
709 | 709 | |
710 | + def template_path | |
711 | + if profile.nil? | |
712 | + "/designs/templates/#{environment.layout_template}" | |
713 | + else | |
714 | + "/designs/templates/#{profile.layout_template}" | |
715 | + end | |
716 | + end | |
717 | + | |
718 | + def template_javascript_src | |
719 | + script = File.join template_path, '/javascripts/template.js' | |
720 | + script if File.exists? File.join(Rails.root, 'public', script) | |
721 | + end | |
722 | + | |
723 | + def templete_javascript_ng | |
724 | + script = template_javascript_src | |
725 | + javascript_include_tag script if script | |
726 | + end | |
727 | + | |
710 | 728 | def file_field_or_thumbnail(label, image, i) |
711 | 729 | display_form_field label, ( |
712 | 730 | render :partial => (image && image.valid? ? 'shared/show_thumbnail' : 'shared/change_image'), | ... | ... |
app/helpers/layout_helper.rb
... | ... | @@ -38,6 +38,8 @@ module LayoutHelper |
38 | 38 | output += theme_javascript_ng.to_s |
39 | 39 | output += javascript_tag 'render_all_jquery_ui_widgets()' |
40 | 40 | |
41 | + output += templete_javascript_ng.to_s | |
42 | + | |
41 | 43 | output |
42 | 44 | end |
43 | 45 | |
... | ... | @@ -70,11 +72,7 @@ module LayoutHelper |
70 | 72 | end |
71 | 73 | |
72 | 74 | def template_stylesheet_path |
73 | - if profile.nil? | |
74 | - "/designs/templates/#{environment.layout_template}/stylesheets/style.css" | |
75 | - else | |
76 | - "/designs/templates/#{profile.layout_template}/stylesheets/style.css" | |
77 | - end | |
75 | + File.join template_path, "/stylesheets/style.css" | |
78 | 76 | end |
79 | 77 | |
80 | 78 | ... | ... |
public/designs/templates/lefttopright/javascripts/template.js
0 → 100644