Commit 541e9495bd26d2ca5f81827fe665ca987545c638
Exists in
web_steps_improvements
and in
8 other branches
Merge branch 'master' into serpro_api
Showing
179 changed files
with
1649 additions
and
1093 deletions
Show diff stats
Too many changes.
To preserve performance only 100 of 179 files displayed.
.travis.yml
@@ -24,6 +24,9 @@ addons: | @@ -24,6 +24,9 @@ addons: | ||
24 | - libreadline-dev | 24 | - libreadline-dev |
25 | - libsqlite3-dev | 25 | - libsqlite3-dev |
26 | - libxslt1-dev | 26 | - libxslt1-dev |
27 | + artifacts: | ||
28 | + paths: | ||
29 | + - $(ls tmp/artifact* | tr "\n" ":") | ||
27 | 30 | ||
28 | # workaround for https://github.com/travis-ci/travis-ci/issues/4536 | 31 | # workaround for https://github.com/travis-ci/travis-ci/issues/4536 |
29 | before_install: | 32 | before_install: |
@@ -32,7 +35,7 @@ before_install: | @@ -32,7 +35,7 @@ before_install: | ||
32 | cache: bundler | 35 | cache: bundler |
33 | 36 | ||
34 | before_script: | 37 | before_script: |
35 | - - mkdir -p tmp/{pids,cache} log | 38 | + - mkdir -p tmp/{pids,cache} log cache |
36 | - script/noosfero-plugins disableall | 39 | - script/noosfero-plugins disableall |
37 | #- bundle exec rake makemo &>/dev/null | 40 | #- bundle exec rake makemo &>/dev/null |
38 | # database | 41 | # database |
@@ -0,0 +1,12 @@ | @@ -0,0 +1,12 @@ | ||
1 | +If you made any significant change to the code that you consider worth being | ||
2 | +reminded on the Release Notes, also include a correspondent entry here. If you | ||
3 | +are not sure in which release your code will be released, include it on the | ||
4 | +latest release and leave it to the commiter or RM responsible for it. | ||
5 | + | ||
6 | +v 1.5.0 (unreleased) | ||
7 | + - Allow groups to disable admin email notificationo | ||
8 | + - Add option to HighlightsBlock to open link in a new tab | ||
9 | + - Move blocks html generation from models to helpers | ||
10 | + | ||
11 | +v 1.4.0 | ||
12 | + - Migration from Rails 3 to Rails 4! |
app/controllers/my_profile/profile_members_controller.rb
@@ -2,8 +2,27 @@ class ProfileMembersController < MyProfileController | @@ -2,8 +2,27 @@ class ProfileMembersController < MyProfileController | ||
2 | protect 'manage_memberships', :profile | 2 | protect 'manage_memberships', :profile |
3 | 3 | ||
4 | def index | 4 | def index |
5 | - @members = profile.members_by_name | ||
6 | - @member_role = environment.roles.find_by_name('member') | 5 | + @filters = params[:filters] || {:roles => []} |
6 | + all_roles = Profile::Roles.organization_member_roles(environment.id) | Profile::Roles.organization_custom_roles(environment.id, profile.id) | ||
7 | + @filters[:roles] = all_roles unless @filters[:roles].present? | ||
8 | + @data = {} | ||
9 | + field = 'name' | ||
10 | + field = 'email' if @filters[:name] =~ /\@/ | ||
11 | + | ||
12 | + @data[:members] = profile.members_by(field,@filters[:name]).by_role(@filters[:roles]) | ||
13 | + session[:members_filtered] = @data[:members].map{|m|m.id} if request.post? | ||
14 | + @data[:roles] = all_roles | ||
15 | + | ||
16 | + end | ||
17 | + | ||
18 | + def send_mail | ||
19 | + session[:members_filtered] = params[:members_filtered].select{|value| value!="0"} | ||
20 | + if session[:members_filtered].present? | ||
21 | + redirect_to :controller => :profile, :action => :send_mail | ||
22 | + else | ||
23 | + session[:notice] = _("Select at least one member.") | ||
24 | + redirect_to :action => :index | ||
25 | + end | ||
7 | end | 26 | end |
8 | 27 | ||
9 | def update_roles | 28 | def update_roles |
@@ -156,4 +175,13 @@ class ProfileMembersController < MyProfileController | @@ -156,4 +175,13 @@ class ProfileMembersController < MyProfileController | ||
156 | end | 175 | end |
157 | end | 176 | end |
158 | 177 | ||
178 | + def search_members | ||
179 | + field = 'name' | ||
180 | + field = 'email' if params[:filter_name] =~ /\@/ | ||
181 | + | ||
182 | + result = profile.members_like field, params[:filter_name] | ||
183 | + result = result.select{|member| member.can_view_field?(current_person, "email") } if field=="email" | ||
184 | + render :json => result.map { |member| {:label => "#{member.name}#{member.can_view_field?(current_person, "email") ? " <#{member.email}>" : ""}", :value => member.name }} | ||
185 | + end | ||
186 | + | ||
159 | end | 187 | end |
app/controllers/public/content_viewer_controller.rb
@@ -239,8 +239,12 @@ class ContentViewerController < ApplicationController | @@ -239,8 +239,12 @@ class ContentViewerController < ApplicationController | ||
239 | 239 | ||
240 | def get_posts(year = nil, month = nil) | 240 | def get_posts(year = nil, month = nil) |
241 | if year && month | 241 | if year && month |
242 | - filter_date = DateTime.parse("#{year}-#{month}-01") | ||
243 | - return @page.posts.by_range(filter_date..filter_date.at_end_of_month) | 242 | + begin |
243 | + filter_date = DateTime.parse("#{year}-#{month}-01") | ||
244 | + return @page.posts.by_range(filter_date..filter_date.at_end_of_month) | ||
245 | + rescue ArgumentError | ||
246 | + return @page.posts | ||
247 | + end | ||
244 | else | 248 | else |
245 | return @page.posts | 249 | return @page.posts |
246 | end | 250 | end |
app/controllers/public/profile_controller.rb
@@ -370,6 +370,7 @@ class ProfileController < PublicController | @@ -370,6 +370,7 @@ class ProfileController < PublicController | ||
370 | 370 | ||
371 | def send_mail | 371 | def send_mail |
372 | @mailing = profile.mailings.build(params[:mailing]) | 372 | @mailing = profile.mailings.build(params[:mailing]) |
373 | + @mailing.data = session[:members_filtered] ? {:members_filtered => session[:members_filtered]} : {} | ||
373 | if request.post? | 374 | if request.post? |
374 | @mailing.locale = locale | 375 | @mailing.locale = locale |
375 | @mailing.person = user | 376 | @mailing.person = user |
app/helpers/application_helper.rb
@@ -48,6 +48,8 @@ module ApplicationHelper | @@ -48,6 +48,8 @@ module ApplicationHelper | ||
48 | 48 | ||
49 | include PluginsHelper | 49 | include PluginsHelper |
50 | 50 | ||
51 | + include ButtonsHelper | ||
52 | + | ||
51 | def locale | 53 | def locale |
52 | (@page && !@page.language.blank?) ? @page.language : FastGettext.locale | 54 | (@page && !@page.language.blank?) ? @page.language : FastGettext.locale |
53 | end | 55 | end |
@@ -148,14 +150,8 @@ module ApplicationHelper | @@ -148,14 +150,8 @@ module ApplicationHelper | ||
148 | link_to text, profile_path(:profile => profile) , options | 150 | link_to text, profile_path(:profile => profile) , options |
149 | end | 151 | end |
150 | 152 | ||
151 | - def link_to_homepage(text, profile = nil, options = {}) | ||
152 | - p = if profile | ||
153 | - Profile[profile] | ||
154 | - else | ||
155 | - user | ||
156 | - end | ||
157 | - | ||
158 | - link_to text, p.url, options | 153 | + def link_to_homepage(text, profile, options = {}) |
154 | + link_to text, profile.url, options | ||
159 | end | 155 | end |
160 | 156 | ||
161 | def link_if_permitted(link, permission = nil, target = nil) | 157 | def link_if_permitted(link, permission = nil, target = nil) |
@@ -215,52 +211,6 @@ module ApplicationHelper | @@ -215,52 +211,6 @@ module ApplicationHelper | ||
215 | result | 211 | result |
216 | end | 212 | end |
217 | 213 | ||
218 | - def button(type, label, url, html_options = {}) | ||
219 | - html_options ||= {} | ||
220 | - the_class = 'with-text' | ||
221 | - if html_options.has_key?(:class) | ||
222 | - the_class << ' ' << html_options[:class] | ||
223 | - end | ||
224 | - button_without_text type, label, url, html_options.merge(:class => the_class) | ||
225 | - end | ||
226 | - | ||
227 | - def button_without_text(type, label, url, html_options = {}) | ||
228 | - the_class = "button icon-#{type}" | ||
229 | - if html_options.has_key?(:class) | ||
230 | - the_class << ' ' << html_options[:class] | ||
231 | - end | ||
232 | - the_title = html_options[:title] || label | ||
233 | - if html_options[:disabled] | ||
234 | - content_tag('a', ' '+content_tag('span', label), html_options.merge(:class => the_class, :title => the_title)) | ||
235 | - else | ||
236 | - link_to(' '+content_tag('span', label), url, html_options.merge(:class => the_class, :title => the_title)) | ||
237 | - end | ||
238 | - end | ||
239 | - | ||
240 | - def button_to_function(type, label, js_code, html_options = {}, &block) | ||
241 | - html_options[:class] = "button with-text" unless html_options[:class] | ||
242 | - html_options[:class] << " icon-#{type}" | ||
243 | - link_to_function(label, js_code, html_options, &block) | ||
244 | - end | ||
245 | - | ||
246 | - def button_to_function_without_text(type, label, js_code, html_options = {}, &block) | ||
247 | - html_options[:class] = "" unless html_options[:class] | ||
248 | - html_options[:class] << " button icon-#{type}" | ||
249 | - link_to_function(content_tag('span', label), js_code, html_options, &block) | ||
250 | - end | ||
251 | - | ||
252 | - def button_to_remote(type, label, options, html_options = {}) | ||
253 | - html_options[:class] = "button with-text" unless html_options[:class] | ||
254 | - html_options[:class] << " icon-#{type}" | ||
255 | - link_to_remote(label, options, html_options) | ||
256 | - end | ||
257 | - | ||
258 | - def button_to_remote_without_text(type, label, options, html_options = {}) | ||
259 | - html_options[:class] = "" unless html_options[:class] | ||
260 | - html_options[:class] << " button icon-#{type}" | ||
261 | - link_to_remote(content_tag('span', label), options, html_options.merge(:title => label)) | ||
262 | - end | ||
263 | - | ||
264 | def icon(icon_name, html_options = {}) | 214 | def icon(icon_name, html_options = {}) |
265 | the_class = "button #{icon_name}" | 215 | the_class = "button #{icon_name}" |
266 | if html_options.has_key?(:class) | 216 | if html_options.has_key?(:class) |
@@ -940,13 +890,6 @@ module ApplicationHelper | @@ -940,13 +890,6 @@ module ApplicationHelper | ||
940 | content_for(:head) { stylesheet_link_tag(*args) } | 890 | content_for(:head) { stylesheet_link_tag(*args) } |
941 | end | 891 | end |
942 | 892 | ||
943 | - def article_to_html(article, options = {}) | ||
944 | - options.merge!(:page => params[:npage]) | ||
945 | - content = article.to_html(options) | ||
946 | - content = content.kind_of?(Proc) ? self.instance_exec(&content).html_safe : content.html_safe | ||
947 | - filter_html(content, article) | ||
948 | - end | ||
949 | - | ||
950 | # Please, use link_to by default! | 893 | # Please, use link_to by default! |
951 | # This method was created to work around to inexplicable | 894 | # This method was created to work around to inexplicable |
952 | # chain of problems when display_short_format was called | 895 | # chain of problems when display_short_format was called |
@@ -1049,10 +992,11 @@ module ApplicationHelper | @@ -1049,10 +992,11 @@ module ApplicationHelper | ||
1049 | end | 992 | end |
1050 | 993 | ||
1051 | def search_contents_menu | 994 | def search_contents_menu |
995 | + host = environment.default_hostname | ||
1052 | links = [ | 996 | links = [ |
1053 | - {s_('contents|More recent') => {:href => url_for({:controller => 'search', :action => 'contents', :filter => 'more_recent'})}}, | ||
1054 | - {s_('contents|More viewed') => {:href => url_for({:controller => 'search', :action => 'contents', :filter => 'more_popular'})}}, | ||
1055 | - {s_('contents|Most commented') => {:href => url_for({:controller => 'search', :action => 'contents', :filter => 'more_comments'})}} | 997 | + {s_('contents|More recent') => {href: url_for({host: host, controller: 'search', action: 'contents', filter: 'more_recent'})}}, |
998 | + {s_('contents|More viewed') => {href: url_for({host: host, controller: 'search', action: 'contents', filter: 'more_popular'})}}, | ||
999 | + {s_('contents|Most commented') => {href: url_for({host: host, controller: 'search', action: 'contents', filter: 'more_comments'})}} | ||
1056 | ] | 1000 | ] |
1057 | if logged_in? | 1001 | if logged_in? |
1058 | links.push(_('New content') => modal_options({:href => url_for({:controller => 'cms', :action => 'new', :profile => current_user.login, :cms => true})})) | 1002 | links.push(_('New content') => modal_options({:href => url_for({:controller => 'cms', :action => 'new', :profile => current_user.login, :cms => true})})) |
@@ -1064,10 +1008,11 @@ module ApplicationHelper | @@ -1064,10 +1008,11 @@ module ApplicationHelper | ||
1064 | alias :browse_contents_menu :search_contents_menu | 1008 | alias :browse_contents_menu :search_contents_menu |
1065 | 1009 | ||
1066 | def search_people_menu | 1010 | def search_people_menu |
1011 | + host = environment.default_hostname | ||
1067 | links = [ | 1012 | links = [ |
1068 | - {s_('people|More recent') => {:href => url_for({:controller => 'search', :action => 'people', :filter => 'more_recent'})}}, | ||
1069 | - {s_('people|More active') => {:href => url_for({:controller => 'search', :action => 'people', :filter => 'more_active'})}}, | ||
1070 | - {s_('people|More popular') => {:href => url_for({:controller => 'search', :action => 'people', :filter => 'more_popular'})}} | 1013 | + {s_('people|More recent') => {href: url_for({host: host, controller: 'search', action: 'people', filter: 'more_recent'})}}, |
1014 | + {s_('people|More active') => {href: url_for({host: host, controller: 'search', action: 'people', filter: 'more_active'})}}, | ||
1015 | + {s_('people|More popular') => {href: url_for({host: host, controller: 'search', action: 'people', filter: 'more_popular'})}} | ||
1071 | ] | 1016 | ] |
1072 | if logged_in? | 1017 | if logged_in? |
1073 | links.push(_('My friends') => {:href => url_for({:profile => current_user.login, :controller => 'friends'})}) | 1018 | links.push(_('My friends') => {:href => url_for({:profile => current_user.login, :controller => 'friends'})}) |
@@ -1080,10 +1025,11 @@ module ApplicationHelper | @@ -1080,10 +1025,11 @@ module ApplicationHelper | ||
1080 | alias :browse_people_menu :search_people_menu | 1025 | alias :browse_people_menu :search_people_menu |
1081 | 1026 | ||
1082 | def search_communities_menu | 1027 | def search_communities_menu |
1028 | + host = environment.default_hostname | ||
1083 | links = [ | 1029 | links = [ |
1084 | - {s_('communities|More recent') => {:href => url_for({:controller => 'search', :action => 'communities', :filter => 'more_recent'})}}, | ||
1085 | - {s_('communities|More active') => {:href => url_for({:controller => 'search', :action => 'communities', :filter => 'more_active'})}}, | ||
1086 | - {s_('communities|More popular') => {:href => url_for({:controller => 'search', :action => 'communities', :filter => 'more_popular'})}} | 1030 | + {s_('communities|More recent') => {href: url_for({host: host, controller: 'search', action: 'communities', filter: 'more_recent'})}}, |
1031 | + {s_('communities|More active') => {href: url_for({host: host, controller: 'search', action: 'communities', filter: 'more_active'})}}, | ||
1032 | + {s_('communities|More popular') => {href: url_for({host: host, controller: 'search', action: 'communities', filter: 'more_popular'})}} | ||
1087 | ] | 1033 | ] |
1088 | if logged_in? | 1034 | if logged_in? |
1089 | links.push(_('My communities') => {:href => url_for({:profile => current_user.login, :controller => 'memberships'})}) | 1035 | links.push(_('My communities') => {:href => url_for({:profile => current_user.login, :controller => 'memberships'})}) |
@@ -1368,16 +1314,6 @@ module ApplicationHelper | @@ -1368,16 +1314,6 @@ module ApplicationHelper | ||
1368 | @no_design_blocks = true | 1314 | @no_design_blocks = true |
1369 | end | 1315 | end |
1370 | 1316 | ||
1371 | - def filter_html(html, source) | ||
1372 | - if @plugins && source && source.has_macro? | ||
1373 | - html = convert_macro(html, source) unless @plugins.enabled_macros.blank? | ||
1374 | - #TODO This parse should be done through the macro infra, but since there | ||
1375 | - # are old things that do not support it we are keeping this hot spot. | ||
1376 | - html = @plugins.pipeline(:parse_content, html, source).first | ||
1377 | - end | ||
1378 | - html && html.html_safe | ||
1379 | - end | ||
1380 | - | ||
1381 | def convert_macro(html, source) | 1317 | def convert_macro(html, source) |
1382 | doc = Nokogiri::HTML.fragment html | 1318 | doc = Nokogiri::HTML.fragment html |
1383 | #TODO This way is more efficient but do not support macro inside of | 1319 | #TODO This way is more efficient but do not support macro inside of |
app/helpers/article_helper.rb
@@ -181,4 +181,21 @@ module ArticleHelper | @@ -181,4 +181,21 @@ module ArticleHelper | ||
181 | end | 181 | end |
182 | end | 182 | end |
183 | 183 | ||
184 | + def filter_html(html, source) | ||
185 | + if @plugins && source && source.has_macro? | ||
186 | + html = convert_macro(html, source) unless @plugins.enabled_macros.blank? | ||
187 | + #TODO This parse should be done through the macro infra, but since there | ||
188 | + # are old things that do not support it we are keeping this hot spot. | ||
189 | + html = @plugins.pipeline(:parse_content, html, source).first | ||
190 | + end | ||
191 | + html && html.html_safe | ||
192 | + end | ||
193 | + | ||
194 | + def article_to_html(article, options = {}) | ||
195 | + options.merge!(:page => params[:npage]) | ||
196 | + content = article.to_html(options) | ||
197 | + content = content.kind_of?(Proc) ? self.instance_exec(&content).html_safe : content.html_safe | ||
198 | + filter_html(content, article) | ||
199 | + end | ||
200 | + | ||
184 | end | 201 | end |
app/helpers/block_helper.rb
@@ -14,6 +14,7 @@ module BlockHelper | @@ -14,6 +14,7 @@ module BlockHelper | ||
14 | </td> | 14 | </td> |
15 | <td>#{text_field_tag 'block[images][][address]', image[:address], :class => 'highlight-address', :size => 20}</td> | 15 | <td>#{text_field_tag 'block[images][][address]', image[:address], :class => 'highlight-address', :size => 20}</td> |
16 | <td>#{text_field_tag 'block[images][][position]', image[:position], :class => 'highlight-position', :size => 1}</td> | 16 | <td>#{text_field_tag 'block[images][][position]', image[:position], :class => 'highlight-position', :size => 1}</td> |
17 | + <td>#{check_box_tag 'block[images][][new_window]', '1', image[:new_window], :class => 'highlight-new_window', :size => 1}</td> | ||
17 | </tr><tr class=\"image-title\" data-row-number='#{row_number}'> | 18 | </tr><tr class=\"image-title\" data-row-number='#{row_number}'> |
18 | <td colspan=\"3\"><label>#{ | 19 | <td colspan=\"3\"><label>#{ |
19 | content_tag('span', _('Title')) + | 20 | content_tag('span', _('Title')) + |
app/helpers/boxes_helper.rb
@@ -87,10 +87,38 @@ module BoxesHelper | @@ -87,10 +87,38 @@ module BoxesHelper | ||
87 | box_decorator == DontMoveBlocks | 87 | box_decorator == DontMoveBlocks |
88 | end | 88 | end |
89 | 89 | ||
90 | - def display_block_content(block, person, main_content = nil) | ||
91 | - content = block.main? ? wrap_main_content(main_content) : block.content({:person => person}) | 90 | + def render_block block, prefix = nil, klass = block.class |
91 | + template_name = klass.name.underscore.sub '_block', '' | ||
92 | + begin | ||
93 | + render template: "blocks/#{prefix}#{template_name}", locals: { block: block } | ||
94 | + rescue ActionView::MissingTemplate | ||
95 | + return if klass.superclass === Block | ||
96 | + render_block block, prefix, klass.superclass | ||
97 | + end | ||
98 | + end | ||
99 | + | ||
100 | + def render_block_content block | ||
101 | + # FIXME: this conditional should be removed after all | ||
102 | + # block footer from plugins methods get refactored into helpers and views. | ||
103 | + # They are a failsafe until all of them are done. | ||
104 | + return block.content if block.method(:content).owner != Block | ||
105 | + render_block block | ||
106 | + end | ||
107 | + | ||
108 | + def render_block_footer block | ||
109 | + return block.footer if block.method(:footer).owner != Block | ||
110 | + render_block block, 'footers/' | ||
111 | + end | ||
112 | + | ||
113 | + def display_block_content(block, main_content = nil) | ||
114 | + content = nil | ||
115 | + if block.main? | ||
116 | + content = wrap_main_content(main_content) | ||
117 | + else | ||
118 | + content = render_block_content block | ||
119 | + end | ||
92 | result = extract_block_content(content) | 120 | result = extract_block_content(content) |
93 | - footer_content = extract_block_content(block.footer) | 121 | + footer_content = extract_block_content(render_block_footer block) |
94 | unless footer_content.blank? | 122 | unless footer_content.blank? |
95 | footer_content = content_tag('div', footer_content, :class => 'block-footer-content' ) | 123 | footer_content = content_tag('div', footer_content, :class => 'block-footer-content' ) |
96 | end | 124 | end |
@@ -0,0 +1,47 @@ | @@ -0,0 +1,47 @@ | ||
1 | +module ButtonsHelper | ||
2 | + def button(type, label, url, html_options = {}) | ||
3 | + html_options ||= {} | ||
4 | + the_class = 'with-text' | ||
5 | + if html_options.has_key?(:class) | ||
6 | + the_class << ' ' << html_options[:class] | ||
7 | + end | ||
8 | + button_without_text type, label, url, html_options.merge(:class => the_class) | ||
9 | + end | ||
10 | + | ||
11 | + def button_without_text(type, label, url, html_options = {}) | ||
12 | + the_class = "button icon-#{type}" | ||
13 | + if html_options.has_key?(:class) | ||
14 | + the_class << ' ' << html_options[:class] | ||
15 | + end | ||
16 | + the_title = html_options[:title] || label | ||
17 | + if html_options[:disabled] | ||
18 | + content_tag('a', ' '+content_tag('span', label), html_options.merge(:class => the_class, :title => the_title)) | ||
19 | + else | ||
20 | + link_to(' '+content_tag('span', label), url, html_options.merge(:class => the_class, :title => the_title)) | ||
21 | + end | ||
22 | + end | ||
23 | + | ||
24 | + def button_to_function(type, label, js_code, html_options = {}, &block) | ||
25 | + html_options[:class] = "button with-text" unless html_options[:class] | ||
26 | + html_options[:class] << " icon-#{type}" | ||
27 | + link_to_function(label, js_code, html_options, &block) | ||
28 | + end | ||
29 | + | ||
30 | + def button_to_function_without_text(type, label, js_code, html_options = {}, &block) | ||
31 | + html_options[:class] = "" unless html_options[:class] | ||
32 | + html_options[:class] << " button icon-#{type}" | ||
33 | + link_to_function(content_tag('span', label), js_code, html_options, &block) | ||
34 | + end | ||
35 | + | ||
36 | + def button_to_remote(type, label, options, html_options = {}) | ||
37 | + html_options[:class] = "button with-text" unless html_options[:class] | ||
38 | + html_options[:class] << " icon-#{type}" | ||
39 | + link_to_remote(label, options, html_options) | ||
40 | + end | ||
41 | + | ||
42 | + def button_to_remote_without_text(type, label, options, html_options = {}) | ||
43 | + html_options[:class] = "" unless html_options[:class] | ||
44 | + html_options[:class] << " button icon-#{type}" | ||
45 | + link_to_remote(content_tag('span', label), options, html_options.merge(:title => label)) | ||
46 | + end | ||
47 | +end |
app/helpers/forms_helper.rb
@@ -7,9 +7,10 @@ module FormsHelper | @@ -7,9 +7,10 @@ module FormsHelper | ||
7 | 7 | ||
8 | def labelled_check_box( human_name, name, value = "1", checked = false, options = {} ) | 8 | def labelled_check_box( human_name, name, value = "1", checked = false, options = {} ) |
9 | options[:id] ||= 'checkbox-' + FormsHelper.next_id_number | 9 | options[:id] ||= 'checkbox-' + FormsHelper.next_id_number |
10 | - hidden_field_tag(name, '0') + | ||
11 | - check_box_tag( name, value, checked, options ) + | ||
12 | - content_tag( 'label', human_name, :for => options[:id] ) | 10 | + html = options[:add_hidden] == false ? "" : hidden_field_tag(name, '0') |
11 | + | ||
12 | + html += check_box_tag( name, value, checked, options ) + | ||
13 | + content_tag( 'label', human_name, :for => options[:id] ) | ||
13 | end | 14 | end |
14 | 15 | ||
15 | def labelled_text_field( human_name, name, value=nil, options={} ) | 16 | def labelled_text_field( human_name, name, value=nil, options={} ) |
app/mailers/mailing.rb
@@ -2,7 +2,10 @@ require_dependency 'mailing_job' | @@ -2,7 +2,10 @@ require_dependency 'mailing_job' | ||
2 | 2 | ||
3 | class Mailing < ActiveRecord::Base | 3 | class Mailing < ActiveRecord::Base |
4 | 4 | ||
5 | - attr_accessible :subject, :body | 5 | + acts_as_having_settings :field => :data |
6 | + | ||
7 | + attr_accessible :subject, :body, :data | ||
8 | + | ||
6 | validates_presence_of :source_id, :subject, :body | 9 | validates_presence_of :source_id, :subject, :body |
7 | belongs_to :source, :foreign_key => :source_id, :polymorphic => true | 10 | belongs_to :source, :foreign_key => :source_id, :polymorphic => true |
8 | belongs_to :person | 11 | belongs_to :person |
app/mailers/organization_mailing.rb
@@ -5,9 +5,17 @@ class OrganizationMailing < Mailing | @@ -5,9 +5,17 @@ class OrganizationMailing < Mailing | ||
5 | end | 5 | end |
6 | 6 | ||
7 | def recipients(offset=0, limit=100) | 7 | def recipients(offset=0, limit=100) |
8 | - source.members.order(:id).offset(offset).limit(limit) | ||
9 | - .joins("LEFT OUTER JOIN mailing_sents m ON (m.mailing_id = #{id} AND m.person_id = profiles.id)") | 8 | + result = source.members.order(:id).offset(offset).limit(limit) |
9 | + | ||
10 | + if data.present? and data.is_a?(Hash) and data[:members_filtered] | ||
11 | + result = result.where('profiles.id IN (?)', data[:members_filtered]) | ||
12 | + end | ||
13 | + | ||
14 | + if result.blank? | ||
15 | + result = result.joins("LEFT OUTER JOIN mailing_sents m ON (m.mailing_id = #{id} AND m.person_id = profiles.id)") | ||
10 | .where("m.person_id" => nil) | 16 | .where("m.person_id" => nil) |
17 | + end | ||
18 | + result | ||
11 | end | 19 | end |
12 | 20 | ||
13 | def each_recipient | 21 | def each_recipient |
app/models/article_block.rb
@@ -18,18 +18,6 @@ class ArticleBlock < Block | @@ -18,18 +18,6 @@ class ArticleBlock < Block | ||
18 | _('This block displays one of your articles. You can edit the block to select which one of your articles is going to be displayed in the block.') | 18 | _('This block displays one of your articles. You can edit the block to select which one of your articles is going to be displayed in the block.') |
19 | end | 19 | end |
20 | 20 | ||
21 | - def content(args={}) | ||
22 | - block = self | ||
23 | - proc do | ||
24 | - block_title(block.title) + | ||
25 | - (block.article ? article_to_html(FilePresenter.for(block.article), | ||
26 | - :gallery_view => false, | ||
27 | - :inside_block => block, # For Blogs and folders | ||
28 | - :format => block.visualization_format # For Articles and contents | ||
29 | - ).html_safe : _('Article not selected yet.')) | ||
30 | - end | ||
31 | - end | ||
32 | - | ||
33 | def article_id | 21 | def article_id |
34 | self.settings[:article_id] | 22 | self.settings[:article_id] |
35 | end | 23 | end |
app/models/blog.rb
@@ -93,4 +93,20 @@ class Blog < Folder | @@ -93,4 +93,20 @@ class Blog < Folder | ||
93 | posts.where("type != 'RssFeed'").order(:updated_at).limit(limit) | 93 | posts.where("type != 'RssFeed'").order(:updated_at).limit(limit) |
94 | end | 94 | end |
95 | 95 | ||
96 | + def total_number_of_posts(group_by, year = nil) | ||
97 | + case group_by | ||
98 | + when :by_year | ||
99 | + posts.published.native_translations | ||
100 | + .except(:order) | ||
101 | + .count(:all, :group => 'EXTRACT(YEAR FROM published_at)') | ||
102 | + .sort_by {|year, count| -year.to_i} | ||
103 | + when :by_month | ||
104 | + posts.published.native_translations | ||
105 | + .except(:order) | ||
106 | + .where('EXTRACT(YEAR FROM published_at)=?', year.to_i) | ||
107 | + .group('EXTRACT(MONTH FROM published_at)') | ||
108 | + .count | ||
109 | + .sort_by {|month, count| -month.to_i} | ||
110 | + end | ||
111 | + end | ||
96 | end | 112 | end |
app/models/blog_archives_block.rb
@@ -21,30 +21,6 @@ class BlogArchivesBlock < Block | @@ -21,30 +21,6 @@ class BlogArchivesBlock < Block | ||
21 | blog_id && owner.blogs.exists?(blog_id) ? owner.blogs.find(blog_id) : owner.blog | 21 | blog_id && owner.blogs.exists?(blog_id) ? owner.blogs.find(blog_id) : owner.blog |
22 | end | 22 | end |
23 | 23 | ||
24 | - def visible_posts(person) | ||
25 | - #FIXME Performance issues with display_to. Must convert it to a scope. | ||
26 | - # Checkout this page for further information: http://noosfero.org/Development/ActionItem2705 | ||
27 | - blog.posts.published.native_translations #.select {|post| post.display_to?(person)} | ||
28 | - end | ||
29 | - | ||
30 | - def content(args={}) | ||
31 | - owner_blog = self.blog | ||
32 | - return nil unless owner_blog | ||
33 | - results = '' | ||
34 | - posts = visible_posts(args[:person]) | ||
35 | - posts.except(:order).count(:all, :group => 'EXTRACT(YEAR FROM published_at)').sort_by {|year, count| -year.to_i}.each do |year, count| | ||
36 | - results << content_tag('li', content_tag('strong', "#{year.to_i} (#{count})")) | ||
37 | - results << "<ul class='#{year.to_i}-archive'>" | ||
38 | - posts.except(:order).where('EXTRACT(YEAR FROM published_at)=?', year.to_i).group('EXTRACT(MONTH FROM published_at)').count.sort_by {|month, count| -month.to_i}.each do |month, count| | ||
39 | - results << content_tag('li', link_to("#{month_name(month.to_i)} (#{count})", owner_blog.url.merge(year: year.to_i, month: month.to_i))) | ||
40 | - end | ||
41 | - results << "</ul>" | ||
42 | - end | ||
43 | - block_title(title) + | ||
44 | - content_tag('ul', results, :class => 'blog-archives') + | ||
45 | - content_tag('div', link_to(_('Subscribe RSS Feed'), owner_blog.feed.url), :class => 'subscribe-feed') | ||
46 | - end | ||
47 | - | ||
48 | def self.expire_on | 24 | def self.expire_on |
49 | { :profile => [:article], :environment => [:article] } | 25 | { :profile => [:article], :environment => [:article] } |
50 | end | 26 | end |
app/models/categories_block.rb
@@ -30,13 +30,6 @@ class CategoriesBlock < Block | @@ -30,13 +30,6 @@ class CategoriesBlock < Block | ||
30 | Category.top_level_for(self.owner).from_types(self.category_types) | 30 | Category.top_level_for(self.owner).from_types(self.category_types) |
31 | end | 31 | end |
32 | 32 | ||
33 | - def content(args={}) | ||
34 | - block = self | ||
35 | - proc do | ||
36 | - render :file => 'blocks/categories', :locals => { :block => block } | ||
37 | - end | ||
38 | - end | ||
39 | - | ||
40 | def self.expire_on | 33 | def self.expire_on |
41 | { :profile => [], :environment => [:category] } | 34 | { :profile => [], :environment => [:category] } |
42 | end | 35 | end |
app/models/communities_block.rb
@@ -27,15 +27,6 @@ class CommunitiesBlock < ProfileListBlock | @@ -27,15 +27,6 @@ class CommunitiesBlock < ProfileListBlock | ||
27 | owner.profile_suggestions.of_community.enabled.limit(3).includes(:suggestion) | 27 | owner.profile_suggestions.of_community.enabled.limit(3).includes(:suggestion) |
28 | end | 28 | end |
29 | 29 | ||
30 | - def footer | ||
31 | - owner = self.owner | ||
32 | - suggestions = self.suggestions | ||
33 | - return '' unless owner.kind_of?(Profile) || owner.kind_of?(Environment) | ||
34 | - proc do | ||
35 | - render :file => 'blocks/communities', :locals => { :owner => owner, :suggestions => suggestions } | ||
36 | - end | ||
37 | - end | ||
38 | - | ||
39 | def profiles | 30 | def profiles |
40 | owner.communities | 31 | owner.communities |
41 | end | 32 | end |
app/models/disabled_enterprise_message_block.rb
@@ -12,13 +12,6 @@ class DisabledEnterpriseMessageBlock < Block | @@ -12,13 +12,6 @@ class DisabledEnterpriseMessageBlock < Block | ||
12 | _('Message') | 12 | _('Message') |
13 | end | 13 | end |
14 | 14 | ||
15 | - def content(args={}) | ||
16 | - message = self.owner.environment.message_for_disabled_enterprise || '' | ||
17 | - lambda do |_| | ||
18 | - render :file => 'blocks/disabled_enterprise_message', :locals => {:message => message} | ||
19 | - end | ||
20 | - end | ||
21 | - | ||
22 | def editable?(user=nil) | 15 | def editable?(user=nil) |
23 | false | 16 | false |
24 | end | 17 | end |
app/models/enterprises_block.rb
@@ -12,22 +12,6 @@ class EnterprisesBlock < ProfileListBlock | @@ -12,22 +12,6 @@ class EnterprisesBlock < ProfileListBlock | ||
12 | _('Enterprises') | 12 | _('Enterprises') |
13 | end | 13 | end |
14 | 14 | ||
15 | - def footer | ||
16 | - owner = self.owner | ||
17 | - case owner | ||
18 | - when Profile | ||
19 | - proc do | ||
20 | - link_to s_('enterprises|View all'), :profile => owner.identifier, :controller => 'profile', :action => 'enterprises' | ||
21 | - end | ||
22 | - when Environment | ||
23 | - proc do | ||
24 | - link_to s_('enterprises|View all'), :controller => 'search', :action => 'assets', :asset => 'enterprises' | ||
25 | - end | ||
26 | - else | ||
27 | - '' | ||
28 | - end | ||
29 | - end | ||
30 | - | ||
31 | def profiles | 15 | def profiles |
32 | owner.enterprises | 16 | owner.enterprises |
33 | end | 17 | end |
app/models/fans_block.rb
@@ -12,14 +12,6 @@ class FansBlock < ProfileListBlock | @@ -12,14 +12,6 @@ class FansBlock < ProfileListBlock | ||
12 | _('This block presents the fans of an enterprise.') | 12 | _('This block presents the fans of an enterprise.') |
13 | end | 13 | end |
14 | 14 | ||
15 | - def footer | ||
16 | - profile = self.owner | ||
17 | - proc do | ||
18 | - link_to _('View all'), :profile => profile.identifier, :controller => | ||
19 | - 'profile', :action => 'fans' | ||
20 | - end | ||
21 | - end | ||
22 | - | ||
23 | def profiles | 15 | def profiles |
24 | owner.fans | 16 | owner.fans |
25 | end | 17 | end |
app/models/favorite_enterprises_block.rb
@@ -12,14 +12,6 @@ class FavoriteEnterprisesBlock < ProfileListBlock | @@ -12,14 +12,6 @@ class FavoriteEnterprisesBlock < ProfileListBlock | ||
12 | _('Favorite Enterprises') | 12 | _('Favorite Enterprises') |
13 | end | 13 | end |
14 | 14 | ||
15 | - def footer | ||
16 | - owner = self.owner | ||
17 | - return '' unless owner.kind_of?(Person) | ||
18 | - proc do | ||
19 | - link_to _('enterprises|View all'), {:profile => owner.identifier, :controller => 'profile', :action => 'favorite_enterprises'}, :class => 'view-all' | ||
20 | - end | ||
21 | - end | ||
22 | - | ||
23 | def profiles | 15 | def profiles |
24 | owner.favorite_enterprises | 16 | owner.favorite_enterprises |
25 | end | 17 | end |
app/models/featured_products_block.rb
@@ -32,11 +32,4 @@ class FeaturedProductsBlock < Block | @@ -32,11 +32,4 @@ class FeaturedProductsBlock < Block | ||
32 | self.owner.highlighted_products_with_image | 32 | self.owner.highlighted_products_with_image |
33 | end | 33 | end |
34 | 34 | ||
35 | - def content(args={}) | ||
36 | - block = self | ||
37 | - proc do | ||
38 | - render :file => 'blocks/featured_products', :locals => { :block => block } | ||
39 | - end | ||
40 | - end | ||
41 | - | ||
42 | end | 35 | end |
app/models/feed_reader_block.rb
@@ -52,24 +52,6 @@ class FeedReaderBlock < Block | @@ -52,24 +52,6 @@ class FeedReaderBlock < Block | ||
52 | self.feed_title.nil? ? _('Feed Reader') : self.feed_title | 52 | self.feed_title.nil? ? _('Feed Reader') : self.feed_title |
53 | end | 53 | end |
54 | 54 | ||
55 | - def formatted_feed_content | ||
56 | - if error_message.blank? | ||
57 | - "<ul>\n".html_safe + | ||
58 | - self.feed_items[0..(limit-1)].map{ |item| "<li><a href='#{item[:link]}'>#{item[:title]}</a></li>" }.join("\n").html_safe + | ||
59 | - "</ul>".html_safe | ||
60 | - else | ||
61 | - "<p>#{error_message}</p>".html_safe | ||
62 | - end | ||
63 | - end | ||
64 | - | ||
65 | - def footer | ||
66 | - if self.fetched_at.nil? or self.feed_items.empty? | ||
67 | - _('Feed content was not loaded yet') | ||
68 | - else | ||
69 | - _("Updated: %s") % show_date(self.fetched_at) | ||
70 | - end | ||
71 | - end | ||
72 | - | ||
73 | def add_item(title, link, date, content) | 55 | def add_item(title, link, date, content) |
74 | self.feed_items.unshift( {:title => title, :link => link}) | 56 | self.feed_items.unshift( {:title => title, :link => link}) |
75 | end | 57 | end |
@@ -85,8 +67,4 @@ class FeedReaderBlock < Block | @@ -85,8 +67,4 @@ class FeedReaderBlock < Block | ||
85 | self.save! | 67 | self.save! |
86 | end | 68 | end |
87 | 69 | ||
88 | - def content(args={}) | ||
89 | - block_title(title) + formatted_feed_content | ||
90 | - end | ||
91 | - | ||
92 | end | 70 | end |
app/models/highlights_block.rb
@@ -15,6 +15,8 @@ class HighlightsBlock < Block | @@ -15,6 +15,8 @@ class HighlightsBlock < Block | ||
15 | if !Noosfero.root.nil? and !i[:address].start_with?(Noosfero.root + '/') | 15 | if !Noosfero.root.nil? and !i[:address].start_with?(Noosfero.root + '/') |
16 | i[:address] = Noosfero.root + i[:address] | 16 | i[:address] = Noosfero.root + i[:address] |
17 | end | 17 | end |
18 | + i[:new_window] = i[:new_window] == '1' ? true : false | ||
19 | + | ||
18 | begin | 20 | begin |
19 | file = UploadedFile.find(i[:image_id]) | 21 | file = UploadedFile.find(i[:image_id]) |
20 | i[:image_src] = file.public_filename | 22 | i[:image_src] = file.public_filename |
@@ -41,13 +43,6 @@ class HighlightsBlock < Block | @@ -41,13 +43,6 @@ class HighlightsBlock < Block | ||
41 | end | 43 | end |
42 | end | 44 | end |
43 | 45 | ||
44 | - def content(args={}) | ||
45 | - block = self | ||
46 | - proc do | ||
47 | - render :file => 'blocks/highlights', :locals => { :block => block } | ||
48 | - end | ||
49 | - end | ||
50 | - | ||
51 | def folder_choices | 46 | def folder_choices |
52 | owner.image_galleries | 47 | owner.image_galleries |
53 | end | 48 | end |
app/models/link_list_block.rb
@@ -59,20 +59,6 @@ class LinkListBlock < Block | @@ -59,20 +59,6 @@ class LinkListBlock < Block | ||
59 | _('Link list') | 59 | _('Link list') |
60 | end | 60 | end |
61 | 61 | ||
62 | - def content(args={}) | ||
63 | - block_title(title) + | ||
64 | - content_tag('ul', | ||
65 | - links.select{|i| !i[:name].blank? and !i[:address].blank?}.map{|i| content_tag('li', link_html(i))}.join | ||
66 | - ) | ||
67 | - end | ||
68 | - | ||
69 | - def link_html(link) | ||
70 | - klass = 'icon-' + link[:icon] if link[:icon] | ||
71 | - sanitize_link( | ||
72 | - link_to(link[:name], expand_address(link[:address]), :target => link[:target], :class => klass, :title => link[:title]) | ||
73 | - ) | ||
74 | - end | ||
75 | - | ||
76 | def expand_address(address) | 62 | def expand_address(address) |
77 | add = if owner.respond_to?(:identifier) | 63 | add = if owner.respond_to?(:identifier) |
78 | address.gsub('{profile}', owner.identifier) | 64 | address.gsub('{profile}', owner.identifier) |
@@ -99,8 +85,6 @@ class LinkListBlock < Block | @@ -99,8 +85,6 @@ class LinkListBlock < Block | ||
99 | end | 85 | end |
100 | end | 86 | end |
101 | 87 | ||
102 | - private | ||
103 | - | ||
104 | def sanitize_link(text) | 88 | def sanitize_link(text) |
105 | sanitizer = HTML::WhiteListSanitizer.new | 89 | sanitizer = HTML::WhiteListSanitizer.new |
106 | sanitizer.sanitize(text) | 90 | sanitizer.sanitize(text) |
app/models/location_block.rb
@@ -13,12 +13,4 @@ class LocationBlock < Block | @@ -13,12 +13,4 @@ class LocationBlock < Block | ||
13 | _('Shows where the profile is on the material world.') | 13 | _('Shows where the profile is on the material world.') |
14 | end | 14 | end |
15 | 15 | ||
16 | - def content(args={}) | ||
17 | - block = self | ||
18 | - profile = self.owner | ||
19 | - proc do | ||
20 | - render :file => 'blocks/location', :locals => {:block => block, :profile => profile} | ||
21 | - end | ||
22 | - end | ||
23 | - | ||
24 | end | 16 | end |
app/models/login_block.rb
@@ -8,12 +8,6 @@ class LoginBlock < Block | @@ -8,12 +8,6 @@ class LoginBlock < Block | ||
8 | _('This block presents a login/logout block.') | 8 | _('This block presents a login/logout block.') |
9 | end | 9 | end |
10 | 10 | ||
11 | - def content(args={}) | ||
12 | - lambda do |context| | ||
13 | - render :file => 'blocks/login_block' | ||
14 | - end | ||
15 | - end | ||
16 | - | ||
17 | def cacheable? | 11 | def cacheable? |
18 | false | 12 | false |
19 | end | 13 | end |
app/models/main_block.rb
@@ -8,10 +8,6 @@ class MainBlock < Block | @@ -8,10 +8,6 @@ class MainBlock < Block | ||
8 | _('This block presents the main content of your pages.') | 8 | _('This block presents the main content of your pages.') |
9 | end | 9 | end |
10 | 10 | ||
11 | - def content(args={}) | ||
12 | - nil | ||
13 | - end | ||
14 | - | ||
15 | def main? | 11 | def main? |
16 | true | 12 | true |
17 | end | 13 | end |
app/models/my_network_block.rb
@@ -14,16 +14,6 @@ class MyNetworkBlock < Block | @@ -14,16 +14,6 @@ class MyNetworkBlock < Block | ||
14 | _('This block displays some info about your networking.') | 14 | _('This block displays some info about your networking.') |
15 | end | 15 | end |
16 | 16 | ||
17 | - def content(args={}) | ||
18 | - block = self | ||
19 | - proc do | ||
20 | - render :file => 'blocks/my_network', :locals => { | ||
21 | - :title => block.title, | ||
22 | - :owner => block.owner | ||
23 | - } | ||
24 | - end | ||
25 | - end | ||
26 | - | ||
27 | def cacheable? | 17 | def cacheable? |
28 | false | 18 | false |
29 | end | 19 | end |
app/models/person.rb
@@ -16,10 +16,13 @@ class Person < Profile | @@ -16,10 +16,13 @@ class Person < Profile | ||
16 | acts_as_trackable :after_add => Proc.new {|p,t| notify_activity(t)} | 16 | acts_as_trackable :after_add => Proc.new {|p,t| notify_activity(t)} |
17 | acts_as_accessor | 17 | acts_as_accessor |
18 | 18 | ||
19 | - scope :members_of, -> resources { | 19 | + scope :members_of, lambda { |resources, field = ''| |
20 | resources = Array(resources) | 20 | resources = Array(resources) |
21 | + joins = [:role_assignments] | ||
22 | + joins << :user if User.attribute_names.include? field | ||
23 | + | ||
21 | conditions = resources.map {|resource| "role_assignments.resource_type = '#{resource.class.base_class.name}' AND role_assignments.resource_id = #{resource.id || -1}"}.join(' OR ') | 24 | conditions = resources.map {|resource| "role_assignments.resource_type = '#{resource.class.base_class.name}' AND role_assignments.resource_id = #{resource.id || -1}"}.join(' OR ') |
22 | - distinct.select('profiles.*').joins(:role_assignments).where([conditions]) | 25 | + distinct.select('profiles.*').joins(joins).where([conditions]) |
23 | } | 26 | } |
24 | 27 | ||
25 | scope :not_members_of, -> resources { | 28 | scope :not_members_of, -> resources { |
@@ -48,8 +51,7 @@ class Person < Profile | @@ -48,8 +51,7 @@ class Person < Profile | ||
48 | ['( roles.key = ? AND role_assignments.accessor_type = ? AND role_assignments.accessor_id = ? ) OR ( | 51 | ['( roles.key = ? AND role_assignments.accessor_type = ? AND role_assignments.accessor_id = ? ) OR ( |
49 | ( ( friendships.person_id = ? ) OR (profiles.public_profile = ?)) AND (profiles.visible = ?) )', 'environment_administrator', Profile.name, person.id, person.id, true, true] | 52 | ( ( friendships.person_id = ? ) OR (profiles.public_profile = ?)) AND (profiles.visible = ?) )', 'environment_administrator', Profile.name, person.id, person.id, true, true] |
50 | ).uniq | 53 | ).uniq |
51 | - } | ||
52 | - | 54 | + } |
53 | 55 | ||
54 | def has_permission_with_admin?(permission, resource) | 56 | def has_permission_with_admin?(permission, resource) |
55 | return true if resource.blank? || resource.admins.include?(self) | 57 | return true if resource.blank? || resource.admins.include?(self) |
app/models/product_categories_block.rb
@@ -13,26 +13,6 @@ class ProductCategoriesBlock < Block | @@ -13,26 +13,6 @@ class ProductCategoriesBlock < Block | ||
13 | _('Helps to filter the products catalog.') | 13 | _('Helps to filter the products catalog.') |
14 | end | 14 | end |
15 | 15 | ||
16 | - def content(args={}) | ||
17 | - profile = owner | ||
18 | - proc do | ||
19 | - if @categories.nil? or @categories.length == 0 | ||
20 | - categories = ProductCategory.on_level(nil).order(:name) | ||
21 | - if @categories and @categories.length == 0 | ||
22 | - notice = _('There are no sub-categories for %s') % @category.name | ||
23 | - end | ||
24 | - else | ||
25 | - categories = @categories | ||
26 | - end | ||
27 | - render :file => 'blocks/product_categories', | ||
28 | - :locals => { | ||
29 | - :profile => profile, | ||
30 | - :categories => categories, | ||
31 | - :notice => notice | ||
32 | - } | ||
33 | - end | ||
34 | - end | ||
35 | - | ||
36 | DISPLAY_OPTIONS = DISPLAY_OPTIONS.merge('catalog_only' => _('Only on the catalog')) | 16 | DISPLAY_OPTIONS = DISPLAY_OPTIONS.merge('catalog_only' => _('Only on the catalog')) |
37 | 17 | ||
38 | def display | 18 | def display |
app/models/products_block.rb
@@ -19,26 +19,6 @@ class ProductsBlock < Block | @@ -19,26 +19,6 @@ class ProductsBlock < Block | ||
19 | _('This block presents a list of your products.') | 19 | _('This block presents a list of your products.') |
20 | end | 20 | end |
21 | 21 | ||
22 | - def content(args={}) | ||
23 | - block_title(title) + | ||
24 | - content_tag( | ||
25 | - 'ul', | ||
26 | - products.map {|product| | ||
27 | - content_tag('li', | ||
28 | - link_to( product.name, | ||
29 | - product.url, | ||
30 | - :style => 'background-image:url(%s)' % product.default_image('minor') | ||
31 | - ), | ||
32 | - :class => 'product' | ||
33 | - ) | ||
34 | - }.join | ||
35 | - ) | ||
36 | - end | ||
37 | - | ||
38 | - def footer | ||
39 | - link_to(_('View all products'), owner.public_profile_url.merge(:controller => 'catalog', :action => 'index')) | ||
40 | - end | ||
41 | - | ||
42 | settings_items :product_ids, type: Array | 22 | settings_items :product_ids, type: Array |
43 | def product_ids=(array) | 23 | def product_ids=(array) |
44 | self.settings[:product_ids] = array | 24 | self.settings[:product_ids] = array |
app/models/profile.rb
@@ -5,7 +5,7 @@ class Profile < ActiveRecord::Base | @@ -5,7 +5,7 @@ class Profile < ActiveRecord::Base | ||
5 | 5 | ||
6 | attr_accessible :name, :identifier, :public_profile, :nickname, :custom_footer, :custom_header, :address, :zip_code, :contact_phone, :image_builder, :description, :closed, :template_id, :environment, :lat, :lng, :is_template, :fields_privacy, :preferred_domain_id, :category_ids, :country, :city, :state, :national_region_code, :email, :contact_email, :redirect_l10n, :notification_time, | 6 | attr_accessible :name, :identifier, :public_profile, :nickname, :custom_footer, :custom_header, :address, :zip_code, :contact_phone, :image_builder, :description, :closed, :template_id, :environment, :lat, :lng, :is_template, :fields_privacy, :preferred_domain_id, :category_ids, :country, :city, :state, :national_region_code, :email, :contact_email, :redirect_l10n, :notification_time, |
7 | :redirection_after_login, :custom_url_redirection, | 7 | :redirection_after_login, :custom_url_redirection, |
8 | - :email_suggestions, :allow_members_to_invite, :invite_friends_only, :secret | 8 | + :email_suggestions, :allow_members_to_invite, :invite_friends_only, :secret, :profile_admin_mail_notification |
9 | 9 | ||
10 | # use for internationalizable human type names in search facets | 10 | # use for internationalizable human type names in search facets |
11 | # reimplement on subclasses | 11 | # reimplement on subclasses |
@@ -49,6 +49,9 @@ class Profile < ActiveRecord::Base | @@ -49,6 +49,9 @@ class Profile < ActiveRecord::Base | ||
49 | def self.organization_member_roles(env_id) | 49 | def self.organization_member_roles(env_id) |
50 | all_roles(env_id).select{ |r| r.key.match(/^profile_/) unless r.key.blank? || !r.profile_id.nil?} | 50 | all_roles(env_id).select{ |r| r.key.match(/^profile_/) unless r.key.blank? || !r.profile_id.nil?} |
51 | end | 51 | end |
52 | + def self.organization_custom_roles(env_id, profile_id) | ||
53 | + all_roles(env_id).where('profile_id = ?', profile_id) | ||
54 | + end | ||
52 | def self.all_roles(env_id) | 55 | def self.all_roles(env_id) |
53 | Role.where(environment_id: env_id) | 56 | Role.where(environment_id: env_id) |
54 | end | 57 | end |
@@ -155,15 +158,23 @@ class Profile < ActiveRecord::Base | @@ -155,15 +158,23 @@ class Profile < ActiveRecord::Base | ||
155 | 158 | ||
156 | include TimeScopes | 159 | include TimeScopes |
157 | 160 | ||
158 | - def members | 161 | + def members(by_field = '') |
159 | scopes = plugins.dispatch_scopes(:organization_members, self) | 162 | scopes = plugins.dispatch_scopes(:organization_members, self) |
160 | - scopes << Person.members_of(self) | 163 | + scopes << Person.members_of(self,by_field) |
161 | return scopes.first if scopes.size == 1 | 164 | return scopes.first if scopes.size == 1 |
162 | ScopeTool.union *scopes | 165 | ScopeTool.union *scopes |
163 | end | 166 | end |
164 | 167 | ||
165 | - def members_by_name | ||
166 | - members.order('profiles.name') | 168 | + def members_by(field,value = nil) |
169 | + if value and !value.blank? | ||
170 | + members_like(field,value).order('profiles.name') | ||
171 | + else | ||
172 | + members.order('profiles.name') | ||
173 | + end | ||
174 | + end | ||
175 | + | ||
176 | + def members_like(field,value) | ||
177 | + members(field).where("LOWER(#{field}) LIKE ?", "%#{value.downcase}%") if value | ||
167 | end | 178 | end |
168 | 179 | ||
169 | class << self | 180 | class << self |
@@ -234,6 +245,7 @@ class Profile < ActiveRecord::Base | @@ -234,6 +245,7 @@ class Profile < ActiveRecord::Base | ||
234 | settings_items :description | 245 | settings_items :description |
235 | settings_items :fields_privacy, :type => :hash, :default => {} | 246 | settings_items :fields_privacy, :type => :hash, :default => {} |
236 | settings_items :email_suggestions, :type => :boolean, :default => false | 247 | settings_items :email_suggestions, :type => :boolean, :default => false |
248 | + settings_items :profile_admin_mail_notification, :type => :boolean, :default => true | ||
237 | 249 | ||
238 | validates_length_of :description, :maximum => 550, :allow_nil => true | 250 | validates_length_of :description, :maximum => 550, :allow_nil => true |
239 | 251 | ||
@@ -1102,6 +1114,10 @@ private :generate_url, :url_options | @@ -1102,6 +1114,10 @@ private :generate_url, :url_options | ||
1102 | end | 1114 | end |
1103 | end | 1115 | end |
1104 | 1116 | ||
1117 | + def can_view_field? current_person, field | ||
1118 | + display_private_info_to?(current_person) || (public_fields.include?(field) && public?) | ||
1119 | + end | ||
1120 | + | ||
1105 | validates_inclusion_of :redirection_after_login, :in => Environment.login_redirection_options.keys, :allow_nil => true | 1121 | validates_inclusion_of :redirection_after_login, :in => Environment.login_redirection_options.keys, :allow_nil => true |
1106 | def preferred_login_redirection | 1122 | def preferred_login_redirection |
1107 | redirection_after_login.blank? ? environment.redirection_after_login : redirection_after_login | 1123 | redirection_after_login.blank? ? environment.redirection_after_login : redirection_after_login |
app/models/profile_image_block.rb
@@ -12,17 +12,6 @@ class ProfileImageBlock < Block | @@ -12,17 +12,6 @@ class ProfileImageBlock < Block | ||
12 | _('This block presents the profile image') | 12 | _('This block presents the profile image') |
13 | end | 13 | end |
14 | 14 | ||
15 | - def content(args={}) | ||
16 | - block = self | ||
17 | - s = show_name | ||
18 | - lambda do |object| | ||
19 | - render( | ||
20 | - :file => 'blocks/profile_image', | ||
21 | - :locals => { :block => block, :show_name => s } | ||
22 | - ) | ||
23 | - end | ||
24 | - end | ||
25 | - | ||
26 | def cacheable? | 15 | def cacheable? |
27 | false | 16 | false |
28 | end | 17 | end |
app/models/profile_info_block.rb
@@ -16,13 +16,6 @@ class ProfileInfoBlock < Block | @@ -16,13 +16,6 @@ class ProfileInfoBlock < Block | ||
16 | _('Basic information about <i>%{user}</i>: how long <i>%{user}</i> is part of <i>%{env}</i> and useful links.') % { :user => self.owner.name(), :env => self.owner.environment.name() } | 16 | _('Basic information about <i>%{user}</i>: how long <i>%{user}</i> is part of <i>%{env}</i> and useful links.') % { :user => self.owner.name(), :env => self.owner.environment.name() } |
17 | end | 17 | end |
18 | 18 | ||
19 | - def content(args={}) | ||
20 | - block = self | ||
21 | - lambda do |_| | ||
22 | - render :file => 'blocks/profile_info', :locals => { :block => block } | ||
23 | - end | ||
24 | - end | ||
25 | - | ||
26 | def cacheable? | 19 | def cacheable? |
27 | false | 20 | false |
28 | end | 21 | end |
app/models/profile_list_block.rb
@@ -40,26 +40,6 @@ result = public_profiles.all(:limit => get_limit, :order => 'profiles.updated_at | @@ -40,26 +40,6 @@ result = public_profiles.all(:limit => get_limit, :order => 'profiles.updated_at | ||
40 | _('Clicking on the people or groups will take you to their home page.') | 40 | _('Clicking on the people or groups will take you to their home page.') |
41 | end | 41 | end |
42 | 42 | ||
43 | - def content(args={}) | ||
44 | - profiles = self.profile_list | ||
45 | - title = self.view_title | ||
46 | - nl = "\n" | ||
47 | - proc do |context| | ||
48 | - count=0 | ||
49 | - list = profiles.map {|item| | ||
50 | - count+=1 | ||
51 | - send(:profile_image_link, item, :minor ) | ||
52 | - }.join("\n ") | ||
53 | - if list.empty? | ||
54 | - list = content_tag 'div', _('None'), :class => 'common-profile-list-block-none' | ||
55 | - else | ||
56 | - list = content_tag 'ul', nl +' '+ list + nl | ||
57 | - end | ||
58 | - block_title(title) + nl + | ||
59 | - content_tag('div', nl + list + nl + tag('br', :style => 'clear:both')) | ||
60 | - end | ||
61 | - end | ||
62 | - | ||
63 | def view_title | 43 | def view_title |
64 | title.gsub('{#}', profile_count.to_s) | 44 | title.gsub('{#}', profile_count.to_s) |
65 | end | 45 | end |
app/models/profile_search_block.rb
@@ -4,11 +4,4 @@ class ProfileSearchBlock < Block | @@ -4,11 +4,4 @@ class ProfileSearchBlock < Block | ||
4 | _('Display a form to search the profile') | 4 | _('Display a form to search the profile') |
5 | end | 5 | end |
6 | 6 | ||
7 | - def content(args={}) | ||
8 | - title = self.title | ||
9 | - lambda do |_| | ||
10 | - render :file => 'blocks/profile_search', :locals => { :title => title } | ||
11 | - end | ||
12 | - end | ||
13 | - | ||
14 | end | 7 | end |
app/models/raw_html_block.rb
@@ -12,10 +12,6 @@ class RawHTMLBlock < Block | @@ -12,10 +12,6 @@ class RawHTMLBlock < Block | ||
12 | 12 | ||
13 | attr_accessible :html | 13 | attr_accessible :html |
14 | 14 | ||
15 | - def content(args={}) | ||
16 | - (title.blank? ? '' : block_title(title)).html_safe + html.to_s.html_safe | ||
17 | - end | ||
18 | - | ||
19 | def has_macro? | 15 | def has_macro? |
20 | true | 16 | true |
21 | end | 17 | end |
app/models/recent_documents_block.rb
@@ -22,24 +22,6 @@ class RecentDocumentsBlock < Block | @@ -22,24 +22,6 @@ class RecentDocumentsBlock < Block | ||
22 | 22 | ||
23 | settings_items :limit, :type => :integer, :default => 5 | 23 | settings_items :limit, :type => :integer, :default => 5 |
24 | 24 | ||
25 | - def content(args={}) | ||
26 | - docs = self.docs | ||
27 | - title = self.title | ||
28 | - proc do | ||
29 | - block_title(title) + | ||
30 | - content_tag('ul', docs.map {|item| content_tag('li', link_to(h(item.title), item.url))}.join("\n")) | ||
31 | - end | ||
32 | - end | ||
33 | - | ||
34 | - def footer | ||
35 | - return nil unless self.owner.is_a?(Profile) | ||
36 | - | ||
37 | - profile = self.owner | ||
38 | - proc do | ||
39 | - link_to _('All content'), :profile => profile.identifier, :controller => 'profile', :action => 'sitemap' | ||
40 | - end | ||
41 | - end | ||
42 | - | ||
43 | def docs | 25 | def docs |
44 | self.limit.nil? ? owner.recent_documents(nil, {}, false) : owner.recent_documents(self.get_limit, {}, false) | 26 | self.limit.nil? ? owner.recent_documents(nil, {}, false) : owner.recent_documents(self.get_limit, {}, false) |
45 | end | 27 | end |
app/models/sellers_search_block.rb
@@ -22,10 +22,4 @@ class SellersSearchBlock < Block | @@ -22,10 +22,4 @@ class SellersSearchBlock < Block | ||
22 | _('This block presents a search engine for products.') | 22 | _('This block presents a search engine for products.') |
23 | end | 23 | end |
24 | 24 | ||
25 | - def content(args={}) | ||
26 | - title = self.title | ||
27 | - lambda do |object| | ||
28 | - render :file => 'search/_sellers_form', :locals => { :title => title } | ||
29 | - end | ||
30 | - end | ||
31 | end | 25 | end |
app/models/slideshow_block.rb
@@ -33,23 +33,6 @@ class SlideshowBlock < Block | @@ -33,23 +33,6 @@ class SlideshowBlock < Block | ||
33 | gallery.images.reject {|item| item.folder?} | 33 | gallery.images.reject {|item| item.folder?} |
34 | end | 34 | end |
35 | 35 | ||
36 | - def content(args={}) | ||
37 | - block = self | ||
38 | - if gallery | ||
39 | - images = block_images | ||
40 | - if shuffle | ||
41 | - images = images.shuffle | ||
42 | - end | ||
43 | - proc do | ||
44 | - render :file => 'blocks/slideshow', :locals => { :block => block, :images => images } | ||
45 | - end | ||
46 | - else | ||
47 | - proc do | ||
48 | - render :file => 'blocks/slideshow', :locals => { :block => block, :images => nil } | ||
49 | - end | ||
50 | - end | ||
51 | - end | ||
52 | - | ||
53 | def folder_choices | 36 | def folder_choices |
54 | owner.image_galleries | 37 | owner.image_galleries |
55 | end | 38 | end |
app/models/tags_block.rb
@@ -28,42 +28,6 @@ class TagsBlock < Block | @@ -28,42 +28,6 @@ class TagsBlock < Block | ||
28 | Try to add some tags to some articles and you'l see your tag cloud growing.") | 28 | Try to add some tags to some articles and you'l see your tag cloud growing.") |
29 | end | 29 | end |
30 | 30 | ||
31 | - def content(args={}) | ||
32 | - is_env = owner.class == Environment | ||
33 | - tags = is_env ? owner.tag_counts : owner.article_tags | ||
34 | - return '' if tags.empty? | ||
35 | - | ||
36 | - if limit | ||
37 | - tags_tmp = tags.sort_by{ |k,v| -v }[0..(limit-1)] | ||
38 | - tags = {} | ||
39 | - tags_tmp.map{ |k,v| tags[k] = v } | ||
40 | - end | ||
41 | - | ||
42 | - url = is_env ? {:host=>owner.default_hostname, :controller=>'search', :action => 'tag'} : | ||
43 | - owner.public_profile_url.merge(:controller => 'profile', :action => 'content_tagged') | ||
44 | - tagname_option = is_env ? :tag : :id | ||
45 | - | ||
46 | - block_title(title) + | ||
47 | - "\n<div class='tag_cloud'>\n".html_safe+ | ||
48 | - tag_cloud( tags, tagname_option, url, :max_size => 16, :min_size => 9 ) + | ||
49 | - "\n</div><!-- end class='tag_cloud' -->\n".html_safe | ||
50 | - end | ||
51 | - | ||
52 | - def footer | ||
53 | - if owner.class == Environment | ||
54 | - proc do | ||
55 | - link_to s_('tags|View all'), | ||
56 | - :controller => 'search', :action => 'tags' | ||
57 | - end | ||
58 | - else | ||
59 | - owner_id = owner.identifier | ||
60 | - proc do | ||
61 | - link_to s_('tags|View all'), | ||
62 | - :profile => owner_id, :controller => 'profile', :action => 'tags' | ||
63 | - end | ||
64 | - end | ||
65 | - end | ||
66 | - | ||
67 | def timeout | 31 | def timeout |
68 | 15.minutes | 32 | 15.minutes |
69 | end | 33 | end |
app/models/task.rb
@@ -67,7 +67,9 @@ class Task < ActiveRecord::Base | @@ -67,7 +67,9 @@ class Task < ActiveRecord::Base | ||
67 | begin | 67 | begin |
68 | target_msg = task.target_notification_message | 68 | target_msg = task.target_notification_message |
69 | if target_msg && task.target && !task.target.notification_emails.empty? | 69 | if target_msg && task.target && !task.target.notification_emails.empty? |
70 | - TaskMailer.target_notification(task, target_msg).deliver | 70 | + if target_profile_accepts_notification?(task) |
71 | + TaskMailer.target_notification(task, target_msg).deliver | ||
72 | + end | ||
71 | end | 73 | end |
72 | rescue NotImplementedError => ex | 74 | rescue NotImplementedError => ex |
73 | Rails.logger.info ex.to_s | 75 | Rails.logger.info ex.to_s |
@@ -75,6 +77,14 @@ class Task < ActiveRecord::Base | @@ -75,6 +77,14 @@ class Task < ActiveRecord::Base | ||
75 | end | 77 | end |
76 | end | 78 | end |
77 | 79 | ||
80 | + def target_profile_accepts_notification?(task) | ||
81 | + if task.target.kind_of? Organization | ||
82 | + return task.target.profile_admin_mail_notification | ||
83 | + else | ||
84 | + true | ||
85 | + end | ||
86 | + end | ||
87 | + | ||
78 | # this method finished the task. It calls #perform, which must be overriden | 88 | # this method finished the task. It calls #perform, which must be overriden |
79 | # by subclasses. At the end a message (as returned by #finish_message) is | 89 | # by subclasses. At the end a message (as returned by #finish_message) is |
80 | # sent to the requestor with #notify_requestor. | 90 | # sent to the requestor with #notify_requestor. |
app/views/account/index.html.erb
@@ -0,0 +1,12 @@ | @@ -0,0 +1,12 @@ | ||
1 | +<%= block_title(block.title) %> | ||
2 | +<% if block.article %> | ||
3 | + <%= | ||
4 | + h(article_to_html(FilePresenter.for(block.article), | ||
5 | + :gallery_view => false, | ||
6 | + :inside_block => block, # For Blogs and folders | ||
7 | + :format => block.visualization_format # For Articles and contents | ||
8 | + )) | ||
9 | + %> | ||
10 | +<% else %> | ||
11 | + <%= _('Article not selected yet.') %> | ||
12 | +<% end %> |
@@ -0,0 +1,16 @@ | @@ -0,0 +1,16 @@ | ||
1 | +<% if block.blog %> | ||
2 | + <%= block_title(block.title) %> | ||
3 | + | ||
4 | + <ul class='blog-archives'> | ||
5 | + <% block.blog.total_number_of_posts(:by_year).each do |year, count| %> | ||
6 | + <%= content_tag('li', content_tag('strong', "#{year.to_i} (#{count})")) %> | ||
7 | + <ul class='<%= year.to_i %>-archive'> | ||
8 | + <% block.blog.total_number_of_posts(:by_month, year).each do |month, count| %> | ||
9 | + <%= content_tag('li', link_to("#{month_name(month.to_i)} (#{count})", block.blog.url.merge(year: year.to_i, month: month.to_i))) %> | ||
10 | + <% end %> | ||
11 | + </ul> | ||
12 | + <% end %> | ||
13 | + </ul> | ||
14 | + | ||
15 | + <%= content_tag('div', link_to(_('Subscribe RSS Feed'), block.blog.feed.url), :class => 'subscribe-feed') %> | ||
16 | +<% end %> |
app/views/blocks/communities.html.erb
@@ -1,17 +0,0 @@ | @@ -1,17 +0,0 @@ | ||
1 | -<% if owner.kind_of?(Profile) %> | ||
2 | - <%= link_to s_('communities|View all'), {:profile => owner.identifier, :controller => 'profile', :action => 'communities'}, :class => 'view-all' %> | ||
3 | -<% elsif owner.kind_of?(Environment) %> | ||
4 | - <%= link_to s_('communities|View all'), {:controller => 'search', :action => 'communities'}, :class => 'view-all' %> | ||
5 | -<% end %> | ||
6 | - | ||
7 | -<% if user && user == profile && suggestions && !suggestions.empty? %> | ||
8 | - <div class='suggestions-block common-profile-list-block'> | ||
9 | - <h4 class='block-subtitle'><%= _('Some suggestions for you') %></h4> | ||
10 | - <div class='profiles-suggestions'> | ||
11 | - <%= render :partial => 'shared/profile_suggestions_list', :locals => { :suggestions => suggestions, :collection => :communities_suggestions, :per_page => 3 } %> | ||
12 | - </div> | ||
13 | - <div class='more-suggestions'> | ||
14 | - <%= link_to _('See all suggestions'), profile.communities_suggestions_url %> | ||
15 | - </div> | ||
16 | - </div> | ||
17 | -<% end %> |
app/views/blocks/disabled_enterprise_message.html.erb
1 | +<% message = block.owner.environment.message_for_disabled_enterprise || '' %> | ||
2 | + | ||
1 | <div id='enterprise-disabled'> | 3 | <div id='enterprise-disabled'> |
2 | <%= message %> | 4 | <%= message %> |
3 | <% if profile.blocked? && user && user.is_admin?(profile.environment) %> | 5 | <% if profile.blocked? && user && user.is_admin?(profile.environment) %> |
@@ -0,0 +1,11 @@ | @@ -0,0 +1,11 @@ | ||
1 | +<%= block_title(block.title) %> | ||
2 | + | ||
3 | +<%= | ||
4 | + if block.error_message.blank? | ||
5 | + "<ul>\n".html_safe + | ||
6 | + block.feed_items[0..(block.limit-1)].map{ |item| "<li><a href='#{item[:link]}'>#{item[:title]}</a></li>" }.join("\n").html_safe + | ||
7 | + "</ul>".html_safe | ||
8 | + else | ||
9 | + "<p>#{block.error_message}</p>".html_safe | ||
10 | + end | ||
11 | +%> |
@@ -0,0 +1,19 @@ | @@ -0,0 +1,19 @@ | ||
1 | +<% if block.owner.kind_of?(Profile) || block.owner.kind_of?(Environment) %> | ||
2 | + <% if block.owner.kind_of?(Profile) %> | ||
3 | + <%= link_to s_('communities|View all'), {:profile => block.owner.identifier, :controller => 'profile', :action => 'communities'}, :class => 'view-all' %> | ||
4 | + <% elsif block.owner.kind_of?(Environment) %> | ||
5 | + <%= link_to s_('communities|View all'), {:controller => 'search', :action => 'communities'}, :class => 'view-all' %> | ||
6 | + <% end %> | ||
7 | + | ||
8 | + <% if user && user == profile && block.suggestions && !block.suggestions.empty? %> | ||
9 | + <div class='suggestions-block common-profile-list-block'> | ||
10 | + <h4 class='block-subtitle'><%= _('Some suggestions for you') %></h4> | ||
11 | + <div class='profiles-suggestions'> | ||
12 | + <%= render :partial => 'shared/profile_suggestions_list', :locals => { :suggestions => block.suggestions, :collection => :communities_suggestions, :per_page => 3 } %> | ||
13 | + </div> | ||
14 | + <div class='more-suggestions'> | ||
15 | + <%= link_to _('See all suggestions'), profile.communities_suggestions_url %> | ||
16 | + </div> | ||
17 | + </div> | ||
18 | + <% end %> | ||
19 | +<% end %> |
@@ -0,0 +1,5 @@ | @@ -0,0 +1,5 @@ | ||
1 | +<% if block.owner.is_a?(Profile) %> | ||
2 | + <%= link_to s_('enterprises|View all'), :profile => block.owner.identifier, :controller => 'profile', :action => 'enterprises' %> | ||
3 | +<% elsif block.owner.is_a?(Environment) %> | ||
4 | + <%= link_to s_('enterprises|View all'), :controller => 'search', :action => 'assets', :asset => 'enterprises' %> | ||
5 | +<% end %> |
@@ -0,0 +1 @@ | @@ -0,0 +1 @@ | ||
1 | +<%= link_to _('View all'), :profile => block.owner.identifier, :controller => 'profile', :action => 'fans' %> |
@@ -0,0 +1 @@ | @@ -0,0 +1 @@ | ||
1 | +<%= link_to(_('View all products'), block.owner.public_profile_url.merge(:controller => 'catalog', :action => 'index')) %> |
@@ -0,0 +1,5 @@ | @@ -0,0 +1,5 @@ | ||
1 | +<% if block.owner.is_a?(Environment) %> | ||
2 | + <%= link_to s_('tags|View all'), :controller => 'search', :action => 'tags' %> | ||
3 | +<% else %> | ||
4 | + <%= link_to s_('tags|View all'), :profile => block.owner.identifier, :controller => 'profile', :action => 'tags' %> | ||
5 | +<% end %> |
app/views/blocks/highlights.html.erb
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | <div class='highlights-border'> | 3 | <div class='highlights-border'> |
4 | <div class='highlights-container'> | 4 | <div class='highlights-container'> |
5 | <% block.featured_images.each do |img| %> | 5 | <% block.featured_images.each do |img| %> |
6 | - <a href="<%= img[:address] %>" title="<%= img[:title] %>" class="highlights-image-link"> | 6 | + <a href="<%= img[:address] %>" <%= 'target="_blank"' if img[:new_window] %> title="<%= img[:title] %>" class="highlights-image-link"> |
7 | <%= image_tag [Noosfero.root, img[:image_src]].join, alt: img[:title] %> | 7 | <%= image_tag [Noosfero.root, img[:image_src]].join, alt: img[:title] %> |
8 | <p class="highlights-label"><%= img[:title] %></p> | 8 | <p class="highlights-label"><%= img[:title] %></p> |
9 | </a> | 9 | </a> |
@@ -0,0 +1,14 @@ | @@ -0,0 +1,14 @@ | ||
1 | +<%= block_title(block.title) %> | ||
2 | + | ||
3 | +<%= block.links.empty? && block.title.empty? ? content_tag('em', _('Please, edit this block to add links')) : '' %> | ||
4 | + | ||
5 | +<ul> | ||
6 | + <% block.links.select{|i| !i[:name].blank? and !i[:address].blank?}.each do |link| %> | ||
7 | + <li> | ||
8 | + <%= block.sanitize_link(link_to(link[:name], block.expand_address(link[:address]), | ||
9 | + :target => link[:target], | ||
10 | + :class => (link[:icon] ? "icon-#{link[:icon]}" : ''), | ||
11 | + :title => link[:title])) %> | ||
12 | + </li> | ||
13 | + <% end %> | ||
14 | +</ul> |
app/views/blocks/location.html.erb
1 | -<% if profile.lat %> | 1 | +<% if block.owner.lat %> |
2 | <%= block_title block.title %> | 2 | <%= block_title block.title %> |
3 | <div class='the-localization-map'> | 3 | <div class='the-localization-map'> |
4 | - <img src="https://maps.google.com/maps/api/staticmap?center=<%=profile.lat%>,<%=profile.lng%>&zoom=<%=block.zoom%>&size=190x250&maptype=<%=block.map_type%>&markers=<%=profile.lat%>,<%=profile.lng%>&sensor=false"/> | 4 | + <img src="https://maps.google.com/maps/api/staticmap?center=<%=block.owner.lat%>,<%=block.owner.lng%>&zoom=<%=block.zoom%>&size=190x250&maptype=<%=block.map_type%>&markers=<%=block.owner.lat%>,<%=block.owner.lng%>&sensor=false"/> |
5 | </div> | 5 | </div> |
6 | <% else %> | 6 | <% else %> |
7 | <i><%= _('This profile has no geographical position registered.') %></i> | 7 | <i><%= _('This profile has no geographical position registered.') %></i> |
@@ -0,0 +1,16 @@ | @@ -0,0 +1,16 @@ | ||
1 | +<% if user.present? %> | ||
2 | + <div class="logged-user-info"> | ||
3 | + <h2><%= _('Logged in as %s') % user.identifier %></h2> | ||
4 | + <ul> | ||
5 | + <li><%= _('User since %s/%s') % [user.created_at.month, user.created_at.year] %></li> | ||
6 | + <li><%= link_to _('Homepage'), user.public_profile_url %></li> | ||
7 | + </ul> | ||
8 | + <div class="user-actions"> | ||
9 | + <%= button(:'menu-logout', _('Logout'), :controller => 'account', :action => 'logout') %> | ||
10 | + </div> | ||
11 | + </div> | ||
12 | +<% else %> | ||
13 | + <div class='not-logged-user'> | ||
14 | + <%= render :file => 'account/login_block' %> | ||
15 | + </div> | ||
16 | +<% end%> |
app/views/blocks/login_block.html.erb
@@ -1,16 +0,0 @@ | @@ -1,16 +0,0 @@ | ||
1 | -<% if user.present? %> | ||
2 | - <div class="logged-user-info"> | ||
3 | - <h2><%= _('Logged in as %s') % user.identifier %></h2> | ||
4 | - <ul> | ||
5 | - <li><%= _('User since %s/%s') % [user.created_at.month, user.created_at.year] %></li> | ||
6 | - <li><%= link_to _('Homepage'), user.public_profile_url %></li> | ||
7 | - </ul> | ||
8 | - <div class="user-actions"> | ||
9 | - <%= button(:'menu-logout', _('Logout'), :controller => 'account', :action => 'logout') %> | ||
10 | - </div> | ||
11 | - </div> | ||
12 | -<% else %> | ||
13 | - <div class='not-logged-user'> | ||
14 | - <%= render :file => 'account/login_block' %> | ||
15 | - </div> | ||
16 | -<% end%> |
app/views/blocks/my_network.html.erb
1 | -<%= block_title(title) %> | 1 | +<%= block_title(block.title) %> |
2 | 2 | ||
3 | <ul> | 3 | <ul> |
4 | - <li><%= link_to(_('Homepage'), owner.url, :class => 'url') %></li> | ||
5 | - <li><%= link_to(_('View profile'), owner.public_profile_url) %></li> | ||
6 | - <% if !user.nil? and owner.organization? and user.has_permission?('edit_profile', profile) %> | 4 | + <li><%= link_to(_('Homepage'), block.owner.url, :class => 'url') %></li> |
5 | + <li><%= link_to(_('View profile'), block.owner.public_profile_url) %></li> | ||
6 | + <% if !user.nil? and block.owner.organization? and user.has_permission?('edit_profile', profile) %> | ||
7 | <li><%= link_to _('Control panel'), :controller => 'profile_editor', :profile => profile.identifier %></li> | 7 | <li><%= link_to _('Control panel'), :controller => 'profile_editor', :profile => profile.identifier %></li> |
8 | <% end %> | 8 | <% end %> |
9 | </ul> | 9 | </ul> |
10 | 10 | ||
11 | <div class="my-network-actions"> | 11 | <div class="my-network-actions"> |
12 | - <%= render_profile_actions owner.class %> | 12 | + <%= render_profile_actions block.owner.class %> |
13 | </div> | 13 | </div> |
app/views/blocks/product_categories.html.erb
1 | -<%= link_to _('Catalog start'), profile.catalog_url, :class=>'catalog-home-link' %> | 1 | +<% |
2 | + if @categories.nil? or @categories.length == 0 | ||
3 | + categories = ProductCategory.on_level(nil).order(:name) | ||
4 | + else | ||
5 | + categories = @categories | ||
6 | + end | ||
7 | +%> | ||
8 | + | ||
9 | +<%= link_to _('Catalog start'), block.owner.catalog_url, :class=>'catalog-home-link' %> | ||
2 | <ul class="catalog-categories-list"> | 10 | <ul class="catalog-categories-list"> |
3 | <% categories.each do |category| %> | 11 | <% categories.each do |category| %> |
4 | <%= category_with_sub_list(category) %> | 12 | <%= category_with_sub_list(category) %> |
5 | <% end %> | 13 | <% end %> |
6 | </ul> | 14 | </ul> |
7 | -<% if notice %> | ||
8 | - <div class="catalog-categories-notice"><%= notice %></div> | 15 | +<% if @categories and @categories.length == 0 %> |
16 | + <div class="catalog-categories-notice"> | ||
17 | + <%= _('There are no sub-categories for %s') % @category.name %> | ||
18 | + </div> | ||
9 | <% end %> | 19 | <% end %> |
app/views/blocks/profile_image.html.erb
@@ -0,0 +1,17 @@ | @@ -0,0 +1,17 @@ | ||
1 | +<%= block_title(block.view_title) %> | ||
2 | + | ||
3 | +<% | ||
4 | + list = block.profile_list.map do |item| | ||
5 | + profile_image_link(item, :minor) | ||
6 | + end.join("\n ") | ||
7 | +%> | ||
8 | + | ||
9 | +<div> | ||
10 | + <% if list.empty? %> | ||
11 | + <div class='common-profile-list-block-none'><%= _('None') %></div> | ||
12 | + <% else %> | ||
13 | + <ul><%= list %></ul> | ||
14 | + <% end %> | ||
15 | +</div> | ||
16 | + | ||
17 | +<br style='clear:both'/> |
app/views/blocks/profile_search.html.erb
@@ -0,0 +1,24 @@ | @@ -0,0 +1,24 @@ | ||
1 | +<h3><%= block.title %></h3> | ||
2 | + | ||
3 | +<%= form_tag({:controller => 'search', :action => 'assets'}, {:method => 'get'}) do %> | ||
4 | + | ||
5 | + <div class="search-in-opt"><%= _('Search in:') %> | ||
6 | + <dir> | ||
7 | + <%= labelled_radio_button _('Enterprises'), 'asset', 'enterprises', true %><br /> | ||
8 | + <%= labelled_radio_button _('Products'), 'asset', 'products', false %> | ||
9 | + </dir> | ||
10 | + </div> | ||
11 | + | ||
12 | + <div class="formfield search-from-opt"> | ||
13 | + <%= select_city(true) %> | ||
14 | + </div> | ||
15 | + | ||
16 | + <div class="formfield search-distance-opt"> | ||
17 | + <%= labelled_select(_('Distance:'), 'radius', :first, :last, nil, [15, 30, 50, 100, 150, 200, 300, 400, 500, 1000].map{|n|[n, n.to_s + 'km']}) %> | ||
18 | + </div> | ||
19 | + | ||
20 | + <div class="button-bar"> | ||
21 | + <%= submit_button :search, _('Search') %> | ||
22 | + </div> | ||
23 | + | ||
24 | +<% end %> |
app/views/blocks/slideshow.html.erb
1 | +<% | ||
2 | + if block.gallery | ||
3 | + images = block.block_images | ||
4 | + if block.shuffle | ||
5 | + images = images.shuffle | ||
6 | + end | ||
7 | + end | ||
8 | +%> | ||
9 | + | ||
1 | <%= block_title(block.title) %> | 10 | <%= block_title(block.title) %> |
11 | + | ||
2 | <% if images %> | 12 | <% if images %> |
3 | <% description = images.any? { |img| !img.abstract.blank? } %> | 13 | <% description = images.any? { |img| !img.abstract.blank? } %> |
4 | <div class='slideshow-border<%= (description ? ' with-descriptions' : '')%>'> | 14 | <div class='slideshow-border<%= (description ? ' with-descriptions' : '')%>'> |
@@ -0,0 +1,25 @@ | @@ -0,0 +1,25 @@ | ||
1 | +<%= block_title(block.title) %> | ||
2 | + | ||
3 | +<% | ||
4 | + is_env = block.owner.class == Environment | ||
5 | + tags = is_env ? block.owner.tag_counts : block.owner.article_tags | ||
6 | + if block.limit | ||
7 | + tags_tmp = tags.sort_by{ |k,v| -v }[0..(block.limit-1)] | ||
8 | + tags = {} | ||
9 | + tags_tmp.map{ |k,v| tags[k] = v } | ||
10 | + end | ||
11 | +%> | ||
12 | + | ||
13 | +<% unless tags.empty? %> | ||
14 | + <div class='tag_cloud'> | ||
15 | + <% if is_env %> | ||
16 | + <%= tag_cloud(tags, :tag, | ||
17 | + {:host => block.owner.default_hostname, :controller=>'search', :action => 'tag'}, | ||
18 | + :max_size => 16, :min_size => 9) %> | ||
19 | + <% else %> | ||
20 | + <%= tag_cloud(tags, :id, | ||
21 | + block.owner.public_profile_url.merge(:controller => 'profile', :action => 'content_tagged'), | ||
22 | + :max_size => 16, :min_size => 9) %> | ||
23 | + <% end %> | ||
24 | + </div> | ||
25 | +<% end %> |
app/views/box_organizer/_highlights_block.html.erb
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | <strong><%= _('Highlights') %></strong> | 3 | <strong><%= _('Highlights') %></strong> |
4 | 4 | ||
5 | <table class="noborder"><tbody id="highlights-data-table"> | 5 | <table class="noborder"><tbody id="highlights-data-table"> |
6 | - <tr><th><%= _('Image') %></th><th><%= _('Address') %></th><th><%= _('Position') %></th></tr> | 6 | + <tr><th><%= _('Image') %></th><th><%= _('Address') %></th><th><%= _('Position') %></th><th><%= _('New Window') %></th></tr> |
7 | <% @block.images.each_with_index do |image, index| %> | 7 | <% @block.images.each_with_index do |image, index| %> |
8 | <%= highlights_block_config_image_fields @block, image, index %> | 8 | <%= highlights_block_config_image_fields @block, image, index %> |
9 | <% end %> | 9 | <% end %> |
app/views/cms/_drag_and_drop_note.html.erb
app/views/cms/_text_editor_sidebar.html.erb
@@ -17,8 +17,8 @@ | @@ -17,8 +17,8 @@ | ||
17 | :parent_id, profile, default_folder, {}, {}, | 17 | :parent_id, profile, default_folder, {}, {}, |
18 | "type='Folder' or type='Gallery'" | 18 | "type='Folder' or type='Gallery'" |
19 | ) %> | 19 | ) %> |
20 | + <%= button(:newfolder, _('New folder'), '#', :id => 'new-folder-button') %> | ||
20 | </div> | 21 | </div> |
21 | - <%= button(:newfolder, _('New folder'), '#', :id => 'new-folder-button') %> | ||
22 | <p><%= file_field_tag('file', :multiple => true) %></p> | 22 | <p><%= file_field_tag('file', :multiple => true) %></p> |
23 | <% end %> | 23 | <% end %> |
24 | </div> | 24 | </div> |
@@ -31,7 +31,7 @@ | @@ -31,7 +31,7 @@ | ||
31 | <div id='published-media' class='text-editor-sidebar-box' data-url='<%= url_for({:controller => 'cms', :action => 'published_media_items', :profile => profile.identifier}) %>'> | 31 | <div id='published-media' class='text-editor-sidebar-box' data-url='<%= url_for({:controller => 'cms', :action => 'published_media_items', :profile => profile.identifier}) %>'> |
32 | <%= select_profile_folder(nil, :parent_id, profile, 'recent-media', {}, {}, | 32 | <%= select_profile_folder(nil, :parent_id, profile, 'recent-media', {}, {}, |
33 | "type='Folder' or type='Gallery'", {:root_label => _('Recent media')}) %> | 33 | "type='Folder' or type='Gallery'", {:root_label => _('Recent media')}) %> |
34 | - <%= labelled_form_field _('Search'), text_field_tag('q') %> | 34 | + <%= labelled_form_field _('Search among your uploaded files'), text_field_tag('q', '', placeholder: _('Write words about the file you are looking for')) %> |
35 | <%= render :partial => 'drag_and_drop_note' %> | 35 | <%= render :partial => 'drag_and_drop_note' %> |
36 | <div class='items'> | 36 | <div class='items'> |
37 | <%= render :partial => 'published_media_items' %> | 37 | <%= render :partial => 'published_media_items' %> |
app/views/profile/send_mail.html.erb
@@ -4,6 +4,9 @@ | @@ -4,6 +4,9 @@ | ||
4 | 4 | ||
5 | <%= error_messages_for :mailing %> | 5 | <%= error_messages_for :mailing %> |
6 | 6 | ||
7 | + <% to = @mailing.data[:members_filtered].present? ? @mailing.recipients.map{|r| r.name}.join(', ') : _('All members')%> | ||
8 | + <%= labelled_form_field(_('To:'), text_area(:data, 'members_filtered', :value => to, :rows => 4, :disabled => 'disabled', :class => 'send-mail-recipients')) %> | ||
9 | + | ||
7 | <%= form_for :mailing, :url => {:action => 'send_mail'}, :html => {:id => 'mailing-form'} do |f| %> | 10 | <%= form_for :mailing, :url => {:action => 'send_mail'}, :html => {:id => 'mailing-form'} do |f| %> |
8 | 11 | ||
9 | <%= labelled_form_field(_('Subject:'), f.text_field(:subject)) %> | 12 | <%= labelled_form_field(_('Subject:'), f.text_field(:subject)) %> |
app/views/profile_editor/_moderation.html.erb
1 | <h2><%= _('Moderation options') %></h2> | 1 | <h2><%= _('Moderation options') %></h2> |
2 | <% if profile.community? %> | 2 | <% if profile.community? %> |
3 | <div style='margin-bottom: 1em'> | 3 | <div style='margin-bottom: 1em'> |
4 | + <h4><%= _('Email Configuration:')%></h4> | ||
5 | + </div> | ||
6 | + <div style='margin-bottom: 0.5em'> | ||
7 | + <%= check_box(:profile_data, :profile_admin_mail_notification, :style => 'float: left') %> | ||
8 | + <div style='margin-left: 30px'> | ||
9 | + <%= _('Send administrator Email for every task') %> | ||
10 | + </div> | ||
11 | + </div> | ||
12 | + | ||
13 | + <div style='margin-bottom: 1em'> | ||
4 | <h4><%= _('Invitation moderation:')%></h4> | 14 | <h4><%= _('Invitation moderation:')%></h4> |
5 | </div> | 15 | </div> |
6 | <div style='margin-bottom: 0.5em'> | 16 | <div style='margin-bottom: 0.5em'> |
app/views/profile_members/_index_buttons.html.erb
@@ -5,7 +5,7 @@ | @@ -5,7 +5,7 @@ | ||
5 | <%= button :person, _('Invite people to join'), :controller => 'invite', :action => 'invite_friends' %> | 5 | <%= button :person, _('Invite people to join'), :controller => 'invite', :action => 'invite_friends' %> |
6 | <% end %> | 6 | <% end %> |
7 | <% if profile.community? and user.has_permission?(:send_mail_to_members, profile) %> | 7 | <% if profile.community? and user.has_permission?(:send_mail_to_members, profile) %> |
8 | - <%= button :send, _('Send e-mail to members'), :controller => 'profile', :action => 'send_mail' %> | 8 | + <%= submit_button(:send, _('Send e-mail to members')) %> |
9 | <% end %> | 9 | <% end %> |
10 | <% @plugins.dispatch(:manage_members_extra_buttons).each do |plugin_button| %> | 10 | <% @plugins.dispatch(:manage_members_extra_buttons).each do |plugin_button| %> |
11 | <%= button plugin_button[:icon], plugin_button[:title], plugin_button[:url] %> | 11 | <%= button plugin_button[:icon], plugin_button[:title], plugin_button[:url] %> |
@@ -0,0 +1,18 @@ | @@ -0,0 +1,18 @@ | ||
1 | +<%= form_tag '#', :method => 'post' do %> | ||
2 | + | ||
3 | + <%= field_set_tag _('Filter'), :class => 'filter_fields' do %> | ||
4 | + <p> | ||
5 | + <%= labelled_text_field(_('Name or Email')+': ', "filters[name]", @filters[:name], {:id => 'filter-name-autocomplete',:size => 30}) %> | ||
6 | + </p> | ||
7 | + | ||
8 | + <p><%= _('Roles:') %> </p> | ||
9 | + <% @data[:roles].each do |r| %> | ||
10 | + <%= labelled_check_box(r.name, 'filters[roles][]', r.id, @filters[:roles].include?(r.id.to_s), :add_hidden => false) %><br/> | ||
11 | + <% end %> | ||
12 | + <p> | ||
13 | + <%= submit_button(:search, _('Search')) %> | ||
14 | + </p> | ||
15 | + <% end %> | ||
16 | +<% end %> | ||
17 | + | ||
18 | +<%= javascript_include_tag params[:controller] %> | ||
0 | \ No newline at end of file | 19 | \ No newline at end of file |
app/views/profile_members/_members_list.html.erb
1 | -<% collection = @collection == :profile_admins ? profile.admins : profile.members_by_name %> | 1 | +<% members = @data ? @data[:members] : profile.members_by('name') %> |
2 | +<% collection = @collection == :profile_admins ? profile.admins : members %> | ||
2 | <% title = @title ? @title : _('Current members') %> | 3 | <% title = @title ? @title : _('Current members') %> |
3 | <% remove_action = @remove_action ? @remove_action : {:action => 'unassociate'} %> | 4 | <% remove_action = @remove_action ? @remove_action : {:action => 'unassociate'} %> |
5 | +<%= javascript_include_tag params[:controller] %> | ||
4 | 6 | ||
5 | <h3><%= title %></h3> | 7 | <h3><%= title %></h3> |
6 | 8 | ||
7 | <table> | 9 | <table> |
10 | + <col width="1"> | ||
8 | <tr> | 11 | <tr> |
12 | + <th><%= check_box_tag 'checkbox-all', 1, false, :onClick => "toggle(this)" %></th> | ||
9 | <th><%= _('Member') %></th> | 13 | <th><%= _('Member') %></th> |
10 | <th><%= _('Actions') %></th> | 14 | <th><%= _('Actions') %></th> |
11 | </tr> | 15 | </tr> |
16 | + | ||
12 | <% collection.each do |m| %> | 17 | <% collection.each do |m| %> |
13 | <tr title="<%= m.name %>"> | 18 | <tr title="<%= m.name %>"> |
19 | + <td><%= labelled_check_box('', 'members_filtered[]', m.id.to_s, false, :id => 'checkbox-'+m.identifier) %></td> | ||
14 | <td><%= link_to_profile m.short_name, m.identifier, :title => m.name %> </td> | 20 | <td><%= link_to_profile m.short_name, m.identifier, :title => m.name %> </td> |
15 | <td> | 21 | <td> |
16 | <div class="members-buttons-cell"> | 22 | <div class="members-buttons-cell"> |
@@ -26,3 +32,8 @@ | @@ -26,3 +32,8 @@ | ||
26 | </tr> | 32 | </tr> |
27 | <% end %> | 33 | <% end %> |
28 | </table> | 34 | </table> |
35 | +<% if collection.empty? %> | ||
36 | + <p> | ||
37 | + <em><%= _('No members found to: %s') % profile.name %></em> | ||
38 | + </p> | ||
39 | +<% end %> |
app/views/profile_members/index.html.erb
1 | <h1><%= h profile.short_name(50) %></h1> | 1 | <h1><%= h profile.short_name(50) %></h1> |
2 | 2 | ||
3 | -<%= render :partial => 'index_buttons' %> | 3 | +<%= render :partial => 'members_filter' %> |
4 | 4 | ||
5 | -<div id="members-list"> | ||
6 | - <%= render :partial => 'members_list' %> | ||
7 | -</div> | 5 | +<%= form_tag 'profile_members/send_mail', :method => 'post' do %> |
6 | + <div id="members-list"> | ||
7 | + <%= render :partial => 'members_list' %> | ||
8 | + </div> | ||
8 | 9 | ||
9 | -<%= render :partial => 'index_buttons' %> | 10 | + <%= render :partial => 'index_buttons' %> |
11 | + | ||
12 | +<% end %> |
app/views/region_validators/region.html.erb
@@ -5,7 +5,7 @@ | @@ -5,7 +5,7 @@ | ||
5 | <ul> | 5 | <ul> |
6 | <% for validator in @region.validators %> | 6 | <% for validator in @region.validators %> |
7 | <li> | 7 | <li> |
8 | - <%= link_to_homepage validator.name, validator.identifier %> | 8 | + <%= link_to_homepage validator.name, validator %> |
9 | <%= link_to _('Remove validation rights'), { :action => 'remove', :id => @region.id, :validator_id => validator }, :method => 'post' %> | 9 | <%= link_to _('Remove validation rights'), { :action => 'remove', :id => @region.id, :validator_id => validator }, :method => 'post' %> |
10 | </li> | 10 | </li> |
11 | <% end %> | 11 | <% end %> |
app/views/search/_full_enterprise.html.erb
@@ -5,7 +5,7 @@ | @@ -5,7 +5,7 @@ | ||
5 | @order == 'more_recent' ? enterprise.send(@order + '_label') + show_date(enterprise.created_at) : enterprise.send(@order + '_label') %> | 5 | @order == 'more_recent' ? enterprise.send(@order + '_label') + show_date(enterprise.created_at) : enterprise.send(@order + '_label') %> |
6 | </div> | 6 | </div> |
7 | <div class="search-enterprise-item-column-right"> | 7 | <div class="search-enterprise-item-column-right"> |
8 | - <%= link_to_homepage(enterprise.name, enterprise.identifier, :class => "search-result-title") %> | 8 | + <%= link_to_homepage enterprise.name, enterprise, class: "search-result-title" %> |
9 | <div class="search-enterprise-description"> | 9 | <div class="search-enterprise-description"> |
10 | <% if enterprise.description %> | 10 | <% if enterprise.description %> |
11 | <% body_stripped = strip_tags(enterprise.description) %> | 11 | <% body_stripped = strip_tags(enterprise.description) %> |
app/views/search/_full_product.html.erb
@@ -44,7 +44,7 @@ | @@ -44,7 +44,7 @@ | ||
44 | <div class="search-product-item-second-column"> | 44 | <div class="search-product-item-second-column"> |
45 | <%= link_to_product product, :class => 'search-result-title' %> | 45 | <%= link_to_product product, :class => 'search-result-title' %> |
46 | <div class="search-product-supplier"> | 46 | <div class="search-product-supplier"> |
47 | - <span class="search-field-label"><%= _('Supplier') %> </span><%= link_to_homepage(product.enterprise.name, product.enterprise.identifier) %> | 47 | + <span class="search-field-label"><%= _('Supplier') %> </span><%= link_to_homepage product.enterprise.name, product.enterprise %> |
48 | </div> | 48 | </div> |
49 | <div class="search-product-description"> | 49 | <div class="search-product-description"> |
50 | <% if product.description %> | 50 | <% if product.description %> |
app/views/search/_sellers_form.html.erb
@@ -1,24 +0,0 @@ | @@ -1,24 +0,0 @@ | ||
1 | -<h3><%= title %></h3> | ||
2 | - | ||
3 | -<%= form_tag({:controller => 'search', :action => 'assets'}, {:method => 'get'}) do %> | ||
4 | - | ||
5 | - <div class="search-in-opt"><%= _('Search in:') %> | ||
6 | - <dir> | ||
7 | - <%= labelled_radio_button _('Enterprises'), 'asset', 'enterprises', true %><br /> | ||
8 | - <%= labelled_radio_button _('Products'), 'asset', 'products', false %> | ||
9 | - </dir> | ||
10 | - </div> | ||
11 | - | ||
12 | - <div class="formfield search-from-opt"> | ||
13 | - <%= select_city(true) %> | ||
14 | - </div> | ||
15 | - | ||
16 | - <div class="formfield search-distance-opt"> | ||
17 | - <%= labelled_select(_('Distance:'), 'radius', :first, :last, nil, [15, 30, 50, 100, 150, 200, 300, 400, 500, 1000].map{|n|[n, n.to_s + 'km']}) %> | ||
18 | - </div> | ||
19 | - | ||
20 | - <div class="button-bar"> | ||
21 | - <%= submit_button :search, _('Search') %> | ||
22 | - </div> | ||
23 | - | ||
24 | -<% end %> |
app/views/shared/block.html.erb
1 | <% if block.cacheable? && use_cache %> | 1 | <% if block.cacheable? && use_cache %> |
2 | <% cache_timeout(block.cache_key(language, user), block.timeout) do %> | 2 | <% cache_timeout(block.cache_key(language, user), block.timeout) do %> |
3 | - <%= display_block_content(block, user, main_content) %> | 3 | + <%= display_block_content(block, main_content) %> |
4 | <% end %> | 4 | <% end %> |
5 | <% else %> | 5 | <% else %> |
6 | - <%= display_block_content(block, user, main_content) %> | 6 | + <%= display_block_content(block, main_content) %> |
7 | <% end %> | 7 | <% end %> |
db/schema.rb
@@ -11,7 +11,7 @@ | @@ -11,7 +11,7 @@ | ||
11 | # | 11 | # |
12 | # It's strongly recommended that you check this file into your version control system. | 12 | # It's strongly recommended that you check this file into your version control system. |
13 | 13 | ||
14 | -ActiveRecord::Schema.define(version: 20160202142247) do | 14 | +ActiveRecord::Schema.define(version: 20160309122141) do |
15 | 15 | ||
16 | # These are extensions that must be enabled in order to support this database | 16 | # These are extensions that must be enabled in order to support this database |
17 | enable_extension "plpgsql" | 17 | enable_extension "plpgsql" |
@@ -51,7 +51,7 @@ ActiveRecord::Schema.define(version: 20160202142247) do | @@ -51,7 +51,7 @@ ActiveRecord::Schema.define(version: 20160202142247) do | ||
51 | add_index "action_tracker_notifications", ["profile_id", "action_tracker_id"], name: "index_action_tracker_notif_on_prof_id_act_tracker_id", unique: true, using: :btree | 51 | add_index "action_tracker_notifications", ["profile_id", "action_tracker_id"], name: "index_action_tracker_notif_on_prof_id_act_tracker_id", unique: true, using: :btree |
52 | add_index "action_tracker_notifications", ["profile_id"], name: "index_action_tracker_notifications_on_profile_id", using: :btree | 52 | add_index "action_tracker_notifications", ["profile_id"], name: "index_action_tracker_notifications_on_profile_id", using: :btree |
53 | 53 | ||
54 | - create_table "article_followers", id: false, force: :cascade do |t| | 54 | + create_table "article_followers", force: :cascade do |t| |
55 | t.integer "person_id" | 55 | t.integer "person_id" |
56 | t.integer "article_id" | 56 | t.integer "article_id" |
57 | t.datetime "since" | 57 | t.datetime "since" |
@@ -471,6 +471,7 @@ ActiveRecord::Schema.define(version: 20160202142247) do | @@ -471,6 +471,7 @@ ActiveRecord::Schema.define(version: 20160202142247) do | ||
471 | t.string "locale" | 471 | t.string "locale" |
472 | t.datetime "created_at" | 472 | t.datetime "created_at" |
473 | t.datetime "updated_at" | 473 | t.datetime "updated_at" |
474 | + t.text "data" | ||
474 | end | 475 | end |
475 | 476 | ||
476 | create_table "national_region_types", force: :cascade do |t| | 477 | create_table "national_region_types", force: :cascade do |t| |
features/send_email_to_organization_members.feature
@@ -31,7 +31,8 @@ Feature: send emails to organization members | @@ -31,7 +31,8 @@ Feature: send emails to organization members | ||
31 | Scenario: Send e-mail to members | 31 | Scenario: Send e-mail to members |
32 | Given I am logged in as "joaosilva" | 32 | Given I am logged in as "joaosilva" |
33 | And I go to Sample Community's members management | 33 | And I go to Sample Community's members management |
34 | - And I follow "Send e-mail to members" | 34 | + And I check "checkbox-manoel" |
35 | + And I press "Send e-mail to members" | ||
35 | And I fill in "Subject" with "Hello, member!" | 36 | And I fill in "Subject" with "Hello, member!" |
36 | And I fill in "Body" with "We have some news" | 37 | And I fill in "Body" with "We have some news" |
37 | When I press "Send" | 38 | When I press "Send" |
@@ -40,7 +41,8 @@ Feature: send emails to organization members | @@ -40,7 +41,8 @@ Feature: send emails to organization members | ||
40 | Scenario: Not send e-mail to members if subject is blank | 41 | Scenario: Not send e-mail to members if subject is blank |
41 | Given I am logged in as "joaosilva" | 42 | Given I am logged in as "joaosilva" |
42 | And I go to Sample Community's members management | 43 | And I go to Sample Community's members management |
43 | - And I follow "Send e-mail to members" | 44 | + And I check "checkbox-manoel" |
45 | + And I press "Send e-mail to members" | ||
44 | And I fill in "Body" with "We have some news" | 46 | And I fill in "Body" with "We have some news" |
45 | When I press "Send" | 47 | When I press "Send" |
46 | Then I should be on /profile/sample-community/send_mail | 48 | Then I should be on /profile/sample-community/send_mail |
@@ -48,7 +50,8 @@ Feature: send emails to organization members | @@ -48,7 +50,8 @@ Feature: send emails to organization members | ||
48 | Scenario: Not send e-mail to members if body is blank | 50 | Scenario: Not send e-mail to members if body is blank |
49 | Given I am logged in as "joaosilva" | 51 | Given I am logged in as "joaosilva" |
50 | And I go to Sample Community's members management | 52 | And I go to Sample Community's members management |
51 | - And I follow "Send e-mail to members" | 53 | + And I check "checkbox-manoel" |
54 | + And I press "Send e-mail to members" | ||
52 | And I fill in "Subject" with "Hello, user!" | 55 | And I fill in "Subject" with "Hello, user!" |
53 | When I press "Send" | 56 | When I press "Send" |
54 | Then I should be on /profile/sample-community/send_mail | 57 | Then I should be on /profile/sample-community/send_mail |
@@ -56,7 +59,8 @@ Feature: send emails to organization members | @@ -56,7 +59,8 @@ Feature: send emails to organization members | ||
56 | Scenario: Cancel creation of mailing | 59 | Scenario: Cancel creation of mailing |
57 | Given I am logged in as "joaosilva" | 60 | Given I am logged in as "joaosilva" |
58 | And I go to Sample Community's members management | 61 | And I go to Sample Community's members management |
59 | - And I follow "Send e-mail to members" | 62 | + And I check "checkbox-manoel" |
63 | + And I press "Send e-mail to members" | ||
60 | When I follow "Cancel e-mail" | 64 | When I follow "Cancel e-mail" |
61 | Then I should be on Sample Community's members management | 65 | Then I should be on Sample Community's members management |
62 | 66 |
gitignore.example
@@ -23,6 +23,7 @@ public/user_themes | @@ -23,6 +23,7 @@ public/user_themes | ||
23 | public/designs/themes/default | 23 | public/designs/themes/default |
24 | public/designs/themes/* | 24 | public/designs/themes/* |
25 | public/designs/icons/default | 25 | public/designs/icons/default |
26 | +cache | ||
26 | 27 | ||
27 | public/assets | 28 | public/assets |
28 | .sass-cache | 29 | .sass-cache |
lib/tasks/ci.rake
@@ -57,7 +57,8 @@ namespace :ci do | @@ -57,7 +57,8 @@ namespace :ci do | ||
57 | 57 | ||
58 | sh 'ruby', '-Itest', *tests unless tests.empty? | 58 | sh 'ruby', '-Itest', *tests unless tests.empty? |
59 | sh 'cucumber', *features unless features.empty? | 59 | sh 'cucumber', *features unless features.empty? |
60 | - sh 'xvfb-run', '-a', 'cucumber', '-p', 'selenium', *features unless features.empty? | 60 | + sh 'xvfb-run', '-a', '--server-args="-screen 0, 1280x1024x24"', |
61 | + 'cucumber', '-p', 'selenium', *features unless features.empty? | ||
61 | 62 | ||
62 | changed_plugins.each do |plugin| | 63 | changed_plugins.each do |plugin| |
63 | if $broken_plugins.include?(plugin) | 64 | if $broken_plugins.include?(plugin) |
lib/tasks/selenium.rake
1 | desc 'Runs Seleniun acceptance tests' | 1 | desc 'Runs Seleniun acceptance tests' |
2 | task :selenium do | 2 | task :selenium do |
3 | puts "Firefox version = #{`firefox --version`}" | 3 | puts "Firefox version = #{`firefox --version`}" |
4 | - sh "xvfb-run -a cucumber -p selenium --format #{ENV['CUCUMBER_FORMAT'] || 'progress'}" | 4 | + sh "xvfb-run -a --server-args=\"-screen 0, 1280x1024x24\" cucumber -p selenium --format #{ENV['CUCUMBER_FORMAT'] || 'progress'}" |
5 | end | 5 | end |