Commit 4c381ac2e65742587ce267f679a35bf4ad803c1c
Exists in
theme-brasil-digital-from-staging
and in
9 other branches
Merge branch 'master' into I4-Video-Gallery-Plugin
Showing
776 changed files
with
58370 additions
and
34996 deletions
Show diff stats
Too many changes.
To preserve performance only 100 of 776 files displayed.
AUTHORS.md
| ... | ... | @@ -120,16 +120,21 @@ Diego Araujo + Rodrigo Souto + Rafael Manzo <rr.manzo@gmail.com> |
| 120 | 120 | Diego + Jefferson <diegoamc90@gmail.com> |
| 121 | 121 | Diego Martinez <diegoamc90@gmail.com> |
| 122 | 122 | Diego + Renan <renanteruoc@gmail.com> |
| 123 | +DylanGuedes <djmgguedes@gmail.com> | |
| 124 | +Eduardo Passos <eduardo@risa.localdomain.localhost> | |
| 125 | +Eduardo Passos <eduardosteps@gmail.com> | |
| 123 | 126 | Eduardo Tourinho Edington <eduardo.edington@serpro.gov.br> |
| 124 | 127 | Evandro Jr <evandrojr@gmail.com> |
| 125 | 128 | Evandro Junior <evandrojr@gmail.com> |
| 126 | 129 | Fabio Teixeira <fabio1079@gmail.com> |
| 130 | +FAMMA TV NOTICIAS MEDIOS DE CO <revistafammatvmusic.oficial@gmail.com> | |
| 127 | 131 | Fernanda Lopes <nanda.listas+psl@gmail.com> |
| 128 | 132 | Francisco Marcelo A. Lima Júnior <francisco.lima-junior@serpro.gov.br> |
| 129 | 133 | Francisco Marcelo de Araujo Lima Junior <79350259591@serpro-1457614.(none)> |
| 130 | 134 | Francisco Marcelo de Araújo Lima Júnior <francisco.lima-junior@serpro.gov.br> |
| 131 | 135 | Francisco Marcelo de Araújo Lima Júnior <maljunior@gmail.com> |
| 132 | 136 | Gabriela Navarro <navarro1703@gmail.com> |
| 137 | +Gonzalo Exequiel Pedone <hipersayan.x@gmail.com> | |
| 133 | 138 | Grazieno Pellegrino <grazieno@gmail.com> |
| 134 | 139 | Gust <darksshades@hotmail.com> |
| 135 | 140 | Hebert Douglas <hebertdougl@gmail.com> |
| ... | ... | @@ -186,18 +191,23 @@ Leandro Nunes dos Santos <81665687568@serpro-1541727.(none)> |
| 186 | 191 | Leandro Nunes dos Santos <leandronunes@gmail.com> |
| 187 | 192 | Leandro Nunes dos Santos <leandro.santos@serpro.gov.br> |
| 188 | 193 | LinguÁgil 2010 <linguagil.bahia@gmail.com> |
| 194 | +Lucas Kanashiro <kanashiro.duarte@gmail.com> | |
| 189 | 195 | Lucas Melo <lucas@colivre.coop.br> |
| 190 | 196 | Lucas Melo <lucaspradomelo@gmail.com> |
| 191 | 197 | Luciano <lucianopcbr@gmail.com> |
| 192 | 198 | Luciano Prestes Cavalcanti <lucianopcbr@gmail.com> |
| 193 | 199 | Luis David Aguilar Carlos <ludwig9003@gmail.com> |
| 194 | 200 | Luiz Fernando de Freitas Matos <luiz@luizff.matos@gmail.com> |
| 201 | +Marcos <marcos.rpj2@gmail.com> | |
| 195 | 202 | Marcos Ramos <ms.ramos@outlook.com> |
| 196 | 203 | Martín Olivera <molivera@solar.org.ar> |
| 204 | +Maurilio Atila <cabelotaina@gmail.com> | |
| 205 | +M for Momo <mo@rtnp.org> | |
| 197 | 206 | Michal Čihař <michal@cihar.com> |
| 198 | 207 | Moises Machado <moises@colivre.coop.br> |
| 199 | 208 | Naíla Alves <naila@colivre.coop.br> |
| 200 | 209 | Nanda Lopes <nanda.listas+psl@gmail.com> |
| 210 | +Niemand Jedermann <predatorix@web.de> | |
| 201 | 211 | Parley Martins <parleypachecomartins@gmail.com> |
| 202 | 212 | Paulo Meirelles + Alessandro Palmeira + João M. M. da Silva <paulo@softwarelivre.org> |
| 203 | 213 | Paulo Meirelles + Alessandro Palmeira <paulo@softwarelivre.org> |
| ... | ... | @@ -234,8 +244,11 @@ Ronny Kursawe <kursawe.ronny@googlemail.com> |
| 234 | 244 | root <root@debian.sdr.serpro> |
| 235 | 245 | Samuel R. C. Vale <srcvale@holoscopio.com> |
| 236 | 246 | Tallys Martins <tallysmartins@gmail.com> |
| 247 | +Tallys Martins <tallysmartins@yahoo.com.br> | |
| 248 | +tallys <tallys@tallys> | |
| 237 | 249 | tallys <tallys@tallys.(none)> |
| 238 | 250 | Thiago Zoroastro <thiago.zoroastro@bol.com.br> |
| 251 | +Tuux <tuxa@galaxie.eu.org> | |
| 239 | 252 | Valessio Brito <contato@valessiobrito.com.br> |
| 240 | 253 | Valessio Brito <contato@valessiobrito.info> |
| 241 | 254 | Valessio Brito <valessio@gmail.com> | ... | ... |
Gemfile
| ... | ... | @@ -2,9 +2,7 @@ source "https://rubygems.org" |
| 2 | 2 | gem 'rails', '~> 3.2.21' |
| 3 | 3 | gem 'minitest', '~> 3.2.0' |
| 4 | 4 | gem 'fast_gettext', '~> 0.6.8' |
| 5 | -gem 'acts-as-taggable-on', '~> 3.0.2' | |
| 6 | -gem 'prototype-rails', '~> 3.2.1' | |
| 7 | -gem 'prototype_legacy_helper', '0.0.0', :path => 'vendor/prototype_legacy_helper' | |
| 5 | +gem 'acts-as-taggable-on', '~> 3.4.2' | |
| 8 | 6 | gem 'rails_autolink', '~> 1.1.5' |
| 9 | 7 | gem 'pg', '~> 0.13.2' |
| 10 | 8 | gem 'rmagick', '~> 2.13.1' |
| ... | ... | @@ -13,18 +11,14 @@ gem 'will_paginate', '~> 3.0.3' |
| 13 | 11 | gem 'ruby-feedparser', '~> 0.7' |
| 14 | 12 | gem 'daemons', '~> 1.1.5' |
| 15 | 13 | gem 'thin', '~> 1.3.1' |
| 16 | -gem 'hpricot', '~> 0.8.6' | |
| 17 | 14 | gem 'nokogiri', '~> 1.5.5' |
| 18 | 15 | gem 'rake', :require => false |
| 19 | 16 | gem 'rest-client', '~> 1.6.7' |
| 20 | 17 | gem 'exception_notification', '~> 4.0.1' |
| 21 | -gem 'gettext', '~> 2.2.1', :require => false, :group => :development | |
| 18 | +gem 'gettext', '~> 2.2.1', :require => false | |
| 22 | 19 | gem 'locale', '~> 2.0.5' |
| 23 | - | |
| 24 | 20 | gem 'whenever', :require => false |
| 25 | - | |
| 26 | -# FIXME list here all actual dependencies (i.e. the ones in debian/control), | |
| 27 | -# with their GEM names (not the Debian package names) | |
| 21 | +gem 'eita-jrails', '>= 0.9.5', :require => 'jrails' | |
| 28 | 22 | |
| 29 | 23 | group :production do |
| 30 | 24 | gem 'dalli', '~> 2.7.0' |
| ... | ... | @@ -44,6 +38,9 @@ group :cucumber do |
| 44 | 38 | gem 'selenium-webdriver', '~> 2.39.0' |
| 45 | 39 | end |
| 46 | 40 | |
| 41 | +# Requires custom dependencies | |
| 42 | +eval(File.read('config/Gemfile'), binding) rescue nil | |
| 43 | + | |
| 47 | 44 | # include gemfiles from enabled plugins |
| 48 | 45 | # plugins in baseplugins/ are not included on purpose. They should not have any |
| 49 | 46 | # dependencies. | ... | ... |
INSTALL.md
| ... | ... | @@ -21,7 +21,7 @@ Noosfero is written in Ruby with the "[Rails framework](http://www.rubyonrails.o |
| 21 | 21 | You need to install some packages Noosfero depends on. On Debian GNU/Linux or Debian-based systems, all of these packages are available through the Debian archive. You can install them with the following command: |
| 22 | 22 | |
| 23 | 23 | # apt-get install ruby rake po4a libgettext-ruby-util libgettext-ruby1.8 \ |
| 24 | - libsqlite3-ruby rcov librmagick-ruby libredcloth-ruby libhpricot-ruby \ | |
| 24 | + libsqlite3-ruby rcov librmagick-ruby libredcloth-ruby \ | |
| 25 | 25 | libwill-paginate-ruby iso-codes libfeedparser-ruby libdaemons-ruby thin \ |
| 26 | 26 | tango-icon-theme |
| 27 | 27 | |
| ... | ... | @@ -40,7 +40,6 @@ On other systems, they may or may not be available through your regular package |
| 40 | 40 | * Daemons - http://daemons.rubyforge.org |
| 41 | 41 | * Thin: http://code.macournoyer.com/thin |
| 42 | 42 | * tango-icon-theme: http://tango.freedesktop.org/Tango_Icon_Library |
| 43 | -* Hpricot: http://hpricot.com | |
| 44 | 43 | |
| 45 | 44 | If you manage to install Noosfero successfully on other systems than Debian, |
| 46 | 45 | please feel free to contact the Noosfero development mailing with the | ... | ... |
INSTALL.multitenancy.md
| ... | ... | @@ -26,7 +26,7 @@ The file config/database.yml must follow a structure in order to achieve multite |
| 26 | 26 | |
| 27 | 27 | Each "hosted" environment must have an entry like this: |
| 28 | 28 | |
| 29 | - env1_production: | |
| 29 | + env1_production: &DEFAULT | |
| 30 | 30 | adapter: postgresql |
| 31 | 31 | encoding: unicode |
| 32 | 32 | database: noosfero |
| ... | ... | @@ -61,7 +61,7 @@ The "hosted" environments define, besides the `schema_search_path`, a list of do |
| 61 | 61 | You must also tell the application which is the default environment. |
| 62 | 62 | |
| 63 | 63 | production: |
| 64 | - env1_production | |
| 64 | + <<: *DEFAULT | |
| 65 | 65 | |
| 66 | 66 | On the example above there are only three hosted environments, but it can be more than three. The schemas `env2` and `env3` must already exist in the same database of the hosting environment. As postgres user, you can create them typing: |
| 67 | 67 | ... | ... |
| ... | ... | @@ -0,0 +1,18 @@ |
| 1 | +# This Rakefile is intentionally independent from Rails to it can be used to | |
| 2 | +# handle release-related tasks without having to load the entire Rails | |
| 3 | +# environment (which is slow, requires a database connection and several other | |
| 4 | +# inconveniences). | |
| 5 | + | |
| 6 | +$: << 'lib' | |
| 7 | +require 'noosfero' | |
| 8 | +require 'noosfero/version' | |
| 9 | + | |
| 10 | +load 'lib/tasks/gettext.rake' | |
| 11 | +load 'lib/tasks/doc.rake' | |
| 12 | +load 'lib/tasks/error_messages.rake' | |
| 13 | +load 'lib/tasks/translation.rake' | |
| 14 | + | |
| 15 | +load 'lib/tasks/package.rake' | |
| 16 | +load 'lib/tasks/release.rake' | |
| 17 | + | |
| 18 | +task :default => 'noosfero:translations:compile' | ... | ... |
| ... | ... | @@ -0,0 +1,10 @@ |
| 1 | +# Noosfero security | |
| 2 | + | |
| 3 | +## Reporting security issues in Noosfero | |
| 4 | + | |
| 5 | +Security vulnerabilities should be reported via an email to | |
| 6 | +noosfero-security@listas.softwarelivre.org, which ia a private mailing list. | |
| 7 | +Reported problems will be published after fixes are available. | |
| 8 | + | |
| 9 | +The members of the mailing list are people who provide Noosfero (Noosfero | |
| 10 | +committers, mainly). | ... | ... |
app/controllers/admin/admin_panel_controller.rb
| ... | ... | @@ -87,6 +87,6 @@ class AdminPanelController < AdminController |
| 87 | 87 | scope = scope.order('name ASC') |
| 88 | 88 | |
| 89 | 89 | @q = params[:q] |
| 90 | - @collection = find_by_contents(:organizations, scope, @q, {:per_page => 10, :page => params[:npage]})[:results] | |
| 90 | + @collection = find_by_contents(:organizations, environment, scope, @q, {:per_page => 10, :page => params[:npage]})[:results] | |
| 91 | 91 | end |
| 92 | 92 | end | ... | ... |
app/controllers/application_controller.rb
| ... | ... | @@ -28,6 +28,7 @@ class ApplicationController < ActionController::Base |
| 28 | 28 | unless environment.access_control_allow_methods.blank? |
| 29 | 29 | response.headers["Access-Control-Allow-Methods"] = environment.access_control_allow_methods |
| 30 | 30 | end |
| 31 | + response.headers["Access-Control-Allow-Credentials"] = 'true' | |
| 31 | 32 | elsif environment.restrict_to_access_control_origins |
| 32 | 33 | render_access_denied _('Origin not in allowed.') |
| 33 | 34 | end |
| ... | ... | @@ -59,15 +60,7 @@ class ApplicationController < ActionController::Base |
| 59 | 60 | helper :document |
| 60 | 61 | helper :language |
| 61 | 62 | |
| 62 | - def self.no_design_blocks | |
| 63 | - @no_design_blocks = true | |
| 64 | - end | |
| 65 | - def self.uses_design_blocks? | |
| 66 | - !@no_design_blocks | |
| 67 | - end | |
| 68 | - def uses_design_blocks? | |
| 69 | - !@no_design_blocks && self.class.uses_design_blocks? | |
| 70 | - end | |
| 63 | + include DesignHelper | |
| 71 | 64 | |
| 72 | 65 | # Be sure to include AuthenticationSystem in Application Controller instead |
| 73 | 66 | include AuthenticatedSystem | ... | ... |
app/controllers/public/chat_controller.rb
| ... | ... | @@ -6,6 +6,7 @@ class ChatController < PublicController |
| 6 | 6 | def start_session |
| 7 | 7 | login = user.jid |
| 8 | 8 | password = current_user.crypted_password |
| 9 | + session[:chat] ||= {:rooms => []} | |
| 9 | 10 | begin |
| 10 | 11 | jid, sid, rid = RubyBOSH.initialize_session(login, password, "http://#{environment.default_hostname}/http-bind", |
| 11 | 12 | :wait => 30, :hold => 1, :window => 5) |
| ... | ... | @@ -16,6 +17,31 @@ class ChatController < PublicController |
| 16 | 17 | end |
| 17 | 18 | end |
| 18 | 19 | |
| 20 | + def toggle | |
| 21 | + session[:chat][:status] = session[:chat][:status] == 'opened' ? 'closed' : 'opened' | |
| 22 | + render :nothing => true | |
| 23 | + end | |
| 24 | + | |
| 25 | + def tab | |
| 26 | + session[:chat][:tab_id] = params[:tab_id] | |
| 27 | + render :nothing => true | |
| 28 | + end | |
| 29 | + | |
| 30 | + def join | |
| 31 | + session[:chat][:rooms] << params[:room_id] | |
| 32 | + session[:chat][:rooms].uniq! | |
| 33 | + render :nothing => true | |
| 34 | + end | |
| 35 | + | |
| 36 | + def leave | |
| 37 | + session[:chat][:rooms].delete(params[:room_id]) | |
| 38 | + render :nothing => true | |
| 39 | + end | |
| 40 | + | |
| 41 | + def my_session | |
| 42 | + render :text => session[:chat].to_json, :layout => false | |
| 43 | + end | |
| 44 | + | |
| 19 | 45 | def avatar |
| 20 | 46 | profile = environment.profiles.find_by_identifier(params[:id]) |
| 21 | 47 | filename, mimetype = profile_icon(profile, :minor, true) |
| ... | ... | @@ -28,15 +54,6 @@ class ChatController < PublicController |
| 28 | 54 | end |
| 29 | 55 | end |
| 30 | 56 | |
| 31 | - def index | |
| 32 | - presence = current_user.last_chat_status | |
| 33 | - if presence.blank? or presence == 'chat' | |
| 34 | - render :action => 'auto_connect_online' | |
| 35 | - else | |
| 36 | - render :action => 'auto_connect_busy' | |
| 37 | - end | |
| 38 | - end | |
| 39 | - | |
| 40 | 57 | def update_presence_status |
| 41 | 58 | if request.xhr? |
| 42 | 59 | current_user.update_attributes({:chat_status_at => DateTime.now}.merge(params[:status] || {})) |
| ... | ... | @@ -44,6 +61,44 @@ class ChatController < PublicController |
| 44 | 61 | render :nothing => true |
| 45 | 62 | end |
| 46 | 63 | |
| 64 | + def save_message | |
| 65 | + to = environment.profiles.find_by_identifier(params[:to]) | |
| 66 | + body = params[:body] | |
| 67 | + | |
| 68 | + ChatMessage.create!(:to => to, :from => user, :body => body) | |
| 69 | + render :text => 'ok' | |
| 70 | + end | |
| 71 | + | |
| 72 | + def recent_messages | |
| 73 | + other = environment.profiles.find_by_identifier(params[:identifier]) | |
| 74 | + if other.kind_of?(Organization) | |
| 75 | + messages = ChatMessage.where('to_id=:other', :other => other.id) | |
| 76 | + else | |
| 77 | + messages = ChatMessage.where('(to_id=:other and from_id=:me) or (to_id=:me and from_id=:other)', {:me => user.id, :other => other.id}) | |
| 78 | + end | |
| 79 | + | |
| 80 | + messages = messages.order('created_at DESC').includes(:to, :from).offset(params[:offset]).limit(20) | |
| 81 | + messages_json = messages.map do |message| | |
| 82 | + { | |
| 83 | + :body => message.body, | |
| 84 | + :to => {:id => message.to.identifier, :name => message.to.name}, | |
| 85 | + :from => {:id => message.from.identifier, :name => message.from.name}, | |
| 86 | + :created_at => message.created_at | |
| 87 | + } | |
| 88 | + end | |
| 89 | + render :json => messages_json.reverse | |
| 90 | + end | |
| 91 | + | |
| 92 | + def recent_conversations | |
| 93 | + conversations_order = ActiveRecord::Base.connection.execute("select profiles.identifier from profiles inner join (select distinct r.id as id, MAX(r.created_at) as created_at from (select from_id, to_id, created_at, (case when from_id=#{user.id} then to_id else from_id end) as id from chat_messages where from_id=#{user.id} or to_id=#{user.id}) as r group by id order by created_at desc, id) as t on profiles.id=t.id order by t.created_at desc").entries.map {|e| e['identifier']} | |
| 94 | + render :json => {:order => conversations_order.reverse, :domain => environment.default_hostname.gsub('.','-')}.to_json | |
| 95 | + end | |
| 96 | + | |
| 97 | + #TODO Ideally this is done through roster table on ejabberd. | |
| 98 | + def roster_groups | |
| 99 | + render :text => user.memberships.map {|m| {:jid => m.jid, :name => m.name}}.to_json | |
| 100 | + end | |
| 101 | + | |
| 47 | 102 | protected |
| 48 | 103 | |
| 49 | 104 | def check_environment_feature | ... | ... |
app/controllers/public/contact_controller.rb
app/controllers/public/content_viewer_controller.rb
| ... | ... | @@ -107,10 +107,12 @@ class ContentViewerController < ApplicationController |
| 107 | 107 | if translation.language == locale |
| 108 | 108 | @page = translation |
| 109 | 109 | redirect_to :profile => @page.profile.identifier, :page => @page.explode_path |
| 110 | + return true | |
| 110 | 111 | end |
| 111 | 112 | end |
| 112 | 113 | end |
| 113 | 114 | end |
| 115 | + false | |
| 114 | 116 | end |
| 115 | 117 | |
| 116 | 118 | def pass_without_comment_captcha? |
| ... | ... | @@ -221,7 +223,7 @@ class ContentViewerController < ApplicationController |
| 221 | 223 | # relation. |
| 222 | 224 | posts = posts.native_translations if blog_with_translation?(@page) |
| 223 | 225 | |
| 224 | - @posts = posts.paginate({ :page => params[:npage], :per_page => @page.posts_per_page }.merge(Article.display_filter(user, profile))).to_a | |
| 226 | + @posts = posts.display_filter(user, profile).paginate({ :page => params[:npage], :per_page => @page.posts_per_page }).to_a | |
| 225 | 227 | |
| 226 | 228 | if blog_with_translation?(@page) |
| 227 | 229 | @posts.replace @posts.map{ |p| p.get_translation_to(FastGettext.locale) }.compact | ... | ... |
app/controllers/public/events_controller.rb
app/controllers/public/home_controller.rb
| ... | ... | @@ -2,13 +2,13 @@ class HomeController < PublicController |
| 2 | 2 | |
| 3 | 3 | def index |
| 4 | 4 | @has_news = false |
| 5 | - if environment.enabled?('use_portal_community') && environment.portal_community | |
| 5 | + if environment.portal_enabled | |
| 6 | 6 | @has_news = true |
| 7 | 7 | @news_cache_key = environment.portal_news_cache_key(FastGettext.locale) |
| 8 | 8 | if !read_fragment(@news_cache_key) |
| 9 | 9 | portal_community = environment.portal_community |
| 10 | - @highlighted_news = portal_community.news(2, true) | |
| 11 | - @portal_news = portal_community.news(7, true) - @highlighted_news | |
| 10 | + @highlighted_news = portal_community.news(environment.highlighted_news_amount, true) | |
| 11 | + @portal_news = portal_community.news(environment.portal_news_amount, true).offset(environment.highlighted_news_amount) | |
| 12 | 12 | @area_news = environment.portal_folders |
| 13 | 13 | end |
| 14 | 14 | end | ... | ... |
app/controllers/public/profile_controller.rb
| ... | ... | @@ -16,13 +16,7 @@ class ProfileController < PublicController |
| 16 | 16 | @activities = @profile.activities.paginate(:per_page => 15, :page => params[:page]) |
| 17 | 17 | end |
| 18 | 18 | @tags = profile.article_tags |
| 19 | - unless profile.display_info_to?(user) | |
| 20 | - if profile.visible? | |
| 21 | - private_profile | |
| 22 | - else | |
| 23 | - invisible_profile | |
| 24 | - end | |
| 25 | - end | |
| 19 | + allow_access_to_page | |
| 26 | 20 | end |
| 27 | 21 | |
| 28 | 22 | def tags |
| ... | ... | @@ -396,17 +390,6 @@ class ProfileController < PublicController |
| 396 | 390 | end |
| 397 | 391 | end |
| 398 | 392 | |
| 399 | - def private_profile | |
| 400 | - private_profile_partial_parameters | |
| 401 | - render :action => 'index', :status => 403 | |
| 402 | - end | |
| 403 | - | |
| 404 | - def invisible_profile | |
| 405 | - unless profile.is_template? | |
| 406 | - render_access_denied(_("This profile is inaccessible. You don't have the permission to view the content here."), _("Oops ... you cannot go ahead here")) | |
| 407 | - end | |
| 408 | - end | |
| 409 | - | |
| 410 | 393 | def per_page |
| 411 | 394 | Noosfero::Constants::PROFILE_PER_PAGE |
| 412 | 395 | end | ... | ... |
app/controllers/public/search_controller.rb
| ... | ... | @@ -61,7 +61,7 @@ class SearchController < PublicController |
| 61 | 61 | end |
| 62 | 62 | |
| 63 | 63 | def articles |
| 64 | - @scope = @environment.articles.public | |
| 64 | + @scope = @environment.articles.public.paginate(paginate_options) | |
| 65 | 65 | full_text_search |
| 66 | 66 | end |
| 67 | 67 | |
| ... | ... | @@ -75,7 +75,7 @@ class SearchController < PublicController |
| 75 | 75 | end |
| 76 | 76 | |
| 77 | 77 | def products |
| 78 | - @scope = @environment.products | |
| 78 | + @scope = @environment.products.paginate(paginate_options) | |
| 79 | 79 | full_text_search |
| 80 | 80 | end |
| 81 | 81 | |
| ... | ... | @@ -238,7 +238,7 @@ class SearchController < PublicController |
| 238 | 238 | def visible_profiles(klass, *extra_relations) |
| 239 | 239 | relations = [:image, :domains, :environment, :preferred_domain] |
| 240 | 240 | relations += extra_relations |
| 241 | - @environment.send(klass.name.underscore.pluralize).visible.includes(relations) | |
| 241 | + @environment.send(klass.name.underscore.pluralize).visible.includes(relations).paginate(paginate_options) | |
| 242 | 242 | end |
| 243 | 243 | |
| 244 | 244 | def per_page | ... | ... |
app/controllers/public_controller.rb
| 1 | 1 | class PublicController < ApplicationController |
| 2 | + protected | |
| 3 | + | |
| 4 | + def allow_access_to_page | |
| 5 | + unless profile.display_info_to?(user) | |
| 6 | + if profile.visible? | |
| 7 | + private_profile | |
| 8 | + else | |
| 9 | + invisible_profile | |
| 10 | + end | |
| 11 | + end | |
| 12 | + end | |
| 13 | + | |
| 14 | + def private_profile | |
| 15 | + private_profile_partial_parameters | |
| 16 | + render :template => 'profile/_private_profile', :status => 403, :formats => [:html] | |
| 17 | + end | |
| 18 | + | |
| 19 | + def invisible_profile | |
| 20 | + unless profile.is_template? | |
| 21 | + render_access_denied(_("This profile is inaccessible. You don't have the permission to view the content here."), _("Oops ... you cannot go ahead here")) | |
| 22 | + end | |
| 23 | + end | |
| 2 | 24 | end | ... | ... |
app/helpers/application_helper.rb
| ... | ... | @@ -8,11 +8,7 @@ module ApplicationHelper |
| 8 | 8 | |
| 9 | 9 | include PermissionNameHelper |
| 10 | 10 | |
| 11 | - include LightboxHelper | |
| 12 | - | |
| 13 | - include ThickboxHelper | |
| 14 | - | |
| 15 | - include ColorboxHelper | |
| 11 | + include ModalHelper | |
| 16 | 12 | |
| 17 | 13 | include BoxesHelper |
| 18 | 14 | |
| ... | ... | @@ -46,6 +42,8 @@ module ApplicationHelper |
| 46 | 42 | |
| 47 | 43 | include CatalogHelper |
| 48 | 44 | |
| 45 | + include PluginsHelper | |
| 46 | + | |
| 49 | 47 | def locale |
| 50 | 48 | (@page && !@page.language.blank?) ? @page.language : FastGettext.locale |
| 51 | 49 | end |
| ... | ... | @@ -594,7 +592,7 @@ module ApplicationHelper |
| 594 | 592 | extra_info = extra_info.nil? ? '' : content_tag( 'span', extra_info, :class => 'extra_info' ) |
| 595 | 593 | links = links_for_balloon(profile) |
| 596 | 594 | content_tag('div', content_tag(tag, |
| 597 | - (environment.enabled?(:show_balloon_with_profile_links_when_clicked) ? link_to( content_tag( 'span', _('Profile links')), '#', :onclick => "toggleSubmenu(this, '#{profile.short_name}', #{CGI::escapeHTML(links.to_json)}); return false", :class => "menu-submenu-trigger #{trigger_class}", :url => url) : "") + | |
| 595 | + (environment.enabled?(:show_balloon_with_profile_links_when_clicked) ? popover_menu(_('Profile links'),profile.short_name,links,{:class => trigger_class, :url => url}) : "") + | |
| 598 | 596 | link_to( |
| 599 | 597 | content_tag( 'span', profile_image( profile, size ), :class => 'profile-image' ) + |
| 600 | 598 | content_tag( 'span', h(name), :class => ( profile.class == Person ? 'fn' : 'org' ) ) + |
| ... | ... | @@ -606,6 +604,14 @@ module ApplicationHelper |
| 606 | 604 | :class => 'vcard'), :class => 'common-profile-list-block') |
| 607 | 605 | end |
| 608 | 606 | |
| 607 | + def popover_menu(title,menu_title,links,html_options={}) | |
| 608 | + html_options[:class] = "" unless html_options[:class] | |
| 609 | + html_options[:class] << " menu-submenu-trigger" | |
| 610 | + html_options[:onclick] = "toggleSubmenu(this, '#{menu_title}', #{CGI::escapeHTML(links.to_json)}); return false" | |
| 611 | + | |
| 612 | + link_to(content_tag(:span, title), '#', html_options) | |
| 613 | + end | |
| 614 | + | |
| 609 | 615 | def gravatar_default |
| 610 | 616 | (respond_to?(:theme_option) && theme_option.present? && theme_option['gravatar']) || NOOSFERO_CONF['gravatar'] || 'mm' |
| 611 | 617 | end |
| ... | ... | @@ -649,8 +655,8 @@ module ApplicationHelper |
| 649 | 655 | ' onfocus="if(this.value==\''+s+'\'){this.value=\'\'} this.form.className=\'focus-in\'"'+ |
| 650 | 656 | ' onblur="if(/^\s*$/.test(this.value)){this.value=\''+s+'\'} this.form.className=\'focus-out\'">'+ |
| 651 | 657 | '</form>' |
| 652 | - else #opt == 'lightbox_link' is default | |
| 653 | - lightbox_link_to '<span class="icon-menu-search"></span>'+ _('Search'), { | |
| 658 | + else | |
| 659 | + modal_link_to '<span class="icon-menu-search"></span>'+ _('Search'), { | |
| 654 | 660 | :controller => 'search', |
| 655 | 661 | :action => 'popup', |
| 656 | 662 | :category_path => (@category ? @category.explode_path : nil)}, |
| ... | ... | @@ -720,7 +726,7 @@ module ApplicationHelper |
| 720 | 726 | class NoosferoFormBuilder < ActionView::Helpers::FormBuilder |
| 721 | 727 | extend ActionView::Helpers::TagHelper |
| 722 | 728 | |
| 723 | - def self.output_field(text, field_html, field_id = nil) | |
| 729 | + def self.output_field(text, field_html, field_id = nil, options = {}) | |
| 724 | 730 | # try to guess an id if none given |
| 725 | 731 | if field_id.nil? |
| 726 | 732 | field_html =~ /id=['"]([^'"]*)['"]/ |
| ... | ... | @@ -1048,11 +1054,11 @@ module ApplicationHelper |
| 1048 | 1054 | {s_('contents|Most commented') => {:href => url_for({:controller => 'search', :action => 'contents', :filter => 'more_comments'})}} |
| 1049 | 1055 | ] |
| 1050 | 1056 | if logged_in? |
| 1051 | - links.push(_('New content') => colorbox_options({:href => url_for({:controller => 'cms', :action => 'new', :profile => current_user.login, :cms => true})})) | |
| 1057 | + links.push(_('New content') => modal_options({:href => url_for({:controller => 'cms', :action => 'new', :profile => current_user.login, :cms => true})})) | |
| 1052 | 1058 | end |
| 1053 | 1059 | |
| 1054 | 1060 | link_to(content_tag(:span, _('Contents'), :class => 'icon-menu-articles'), {:controller => "search", :action => 'contents', :category_path => nil}, :id => 'submenu-contents') + |
| 1055 | - link_to(content_tag(:span, _('Contents menu')), '#', :onclick => "toggleSubmenu(this,'',#{CGI::escapeHTML(links.to_json)}); return false", :class => 'menu-submenu-trigger up', :id => 'submenu-contents-trigger') | |
| 1061 | + popover_menu(_('Contents menu'),'',links,:class => 'up', :id => 'submenu-contents-trigger') | |
| 1056 | 1062 | end |
| 1057 | 1063 | alias :browse_contents_menu :search_contents_menu |
| 1058 | 1064 | |
| ... | ... | @@ -1068,7 +1074,7 @@ module ApplicationHelper |
| 1068 | 1074 | end |
| 1069 | 1075 | |
| 1070 | 1076 | link_to(content_tag(:span, _('People'), :class => 'icon-menu-people'), {:controller => "search", :action => 'people', :category_path => ''}, :id => 'submenu-people') + |
| 1071 | - link_to(content_tag(:span, _('People menu')), '#', :onclick => "toggleSubmenu(this,'',#{CGI::escapeHTML(links.to_json)}); return false", :class => 'menu-submenu-trigger up', :id => 'submenu-people-trigger') | |
| 1077 | + popover_menu(_('People menu'),'',links,:class => 'up', :id => 'submenu-people-trigger') | |
| 1072 | 1078 | end |
| 1073 | 1079 | alias :browse_people_menu :search_people_menu |
| 1074 | 1080 | |
| ... | ... | @@ -1084,7 +1090,7 @@ module ApplicationHelper |
| 1084 | 1090 | end |
| 1085 | 1091 | |
| 1086 | 1092 | link_to(content_tag(:span, _('Communities'), :class => 'icon-menu-community'), {:controller => "search", :action => 'communities'}, :id => 'submenu-communities') + |
| 1087 | - link_to(content_tag(:span, _('Communities menu')), '#', :onclick => "toggleSubmenu(this,'',#{CGI::escapeHTML(links.to_json)}); return false", :class => 'menu-submenu-trigger up', :id => 'submenu-communities-trigger') | |
| 1093 | + popover_menu(_('Communities menu'),'',links,:class => 'up', :id => 'submenu-communities-trigger') | |
| 1088 | 1094 | end |
| 1089 | 1095 | alias :browse_communities_menu :search_communities_menu |
| 1090 | 1096 | |
| ... | ... | @@ -1396,16 +1402,16 @@ module ApplicationHelper |
| 1396 | 1402 | end |
| 1397 | 1403 | |
| 1398 | 1404 | def convert_macro(html, source) |
| 1399 | - doc = Hpricot(html) | |
| 1405 | + doc = Nokogiri::HTML.fragment html | |
| 1400 | 1406 | #TODO This way is more efficient but do not support macro inside of |
| 1401 | 1407 | # macro. You must parse them from the inside-out in order to enable |
| 1402 | 1408 | # that. |
| 1403 | - doc.search('.macro').each do |macro| | |
| 1409 | + doc.css('.macro').each do |macro| | |
| 1404 | 1410 | macro_name = macro['data-macro'] |
| 1405 | 1411 | result = @plugins.parse_macro(macro_name, macro, source) |
| 1406 | 1412 | macro.inner_html = result.kind_of?(Proc) ? self.instance_exec(&result) : result |
| 1407 | 1413 | end |
| 1408 | - doc.html | |
| 1414 | + doc.to_html | |
| 1409 | 1415 | end |
| 1410 | 1416 | |
| 1411 | 1417 | def default_folder_for_image_upload(profile) | ... | ... |
app/helpers/article_helper.rb
| 1 | 1 | module ArticleHelper |
| 2 | 2 | |
| 3 | - include PrototypeHelper | |
| 4 | 3 | include TokenHelper |
| 5 | 4 | |
| 6 | 5 | def article_reported_version(article) |
| ... | ... | @@ -35,7 +34,7 @@ module ArticleHelper |
| 35 | 34 | 'div', |
| 36 | 35 | check_box(:article, :notify_comments) + |
| 37 | 36 | content_tag('label', _('I want to receive a notification of each comment written by e-mail'), :for => 'article_notify_comments') + |
| 38 | - observe_field(:article_accept_comments, :function => "$('article_notify_comments').disabled = ! $('article_accept_comments').checked;$('article_moderate_comments').disabled = ! $('article_accept_comments').checked") | |
| 37 | + observe_field(:article_accept_comments, :function => "jQuery('#article_notify_comments')[0].disabled = ! jQuery('#article_accept_comments')[0].checked;jQuery('#article_moderate_comments')[0].disabled = ! jQuery('#article_accept_comments')[0].checked") | |
| 39 | 38 | ) + |
| 40 | 39 | |
| 41 | 40 | content_tag( | ... | ... |
app/helpers/block_helper.rb
| ... | ... | @@ -19,7 +19,7 @@ module BlockHelper |
| 19 | 19 | content_tag('span', _('Title')) + |
| 20 | 20 | text_field_tag('block[images][][title]', image[:title], :class => 'highlight-title', :size => 45) |
| 21 | 21 | }</label></td> |
| 22 | - <td>#{link_to '', '#', :class=>'button icon-button icon-delete delete-highlight', :confirm=>_('Are you sure you want to remove this highlight')}</td> | |
| 22 | + <td>#{button_without_text(:delete, _('Remove'), '#', class: 'delete-highlight', :confirm=>_('Are you sure you want to remove this highlight'))}</td> | |
| 23 | 23 | </tr> |
| 24 | 24 | " |
| 25 | 25 | end | ... | ... |
app/helpers/boxes_helper.rb
| ... | ... | @@ -38,8 +38,12 @@ module BoxesHelper |
| 38 | 38 | end |
| 39 | 39 | end |
| 40 | 40 | |
| 41 | + def boxes_limit holder | |
| 42 | + controller.send(:custom_design)[:boxes_limit] || holder.boxes_limit(controller.send(:custom_design)[:layout_template]) | |
| 43 | + end | |
| 44 | + | |
| 41 | 45 | def display_boxes(holder, main_content) |
| 42 | - boxes = holder.boxes.with_position.first(holder.boxes_limit) | |
| 46 | + boxes = holder.boxes.with_position.first(boxes_limit(holder)) | |
| 43 | 47 | content = boxes.reverse.map { |item| display_box(item, main_content) }.join("\n") |
| 44 | 48 | content = main_content if (content.blank?) |
| 45 | 49 | |
| ... | ... | @@ -65,11 +69,13 @@ module BoxesHelper |
| 65 | 69 | end |
| 66 | 70 | |
| 67 | 71 | def display_box_content(box, main_content) |
| 68 | - context = { :article => @page, :request_path => request.path, :locale => locale, :params => request.params, :user => user } | |
| 69 | - box_decorator.select_blocks(box.blocks.includes(:box), context).map { |item| display_block(item, main_content) }.join("\n") + box_decorator.block_target(box) | |
| 72 | + context = { :article => @page, :request_path => request.path, :locale => locale, :params => request.params, :user => user, :controller => controller } | |
| 73 | + box_decorator.select_blocks(box, box.blocks.includes(:box), context).map do |item| | |
| 74 | + display_block item, main_content | |
| 75 | + end.join("\n") + box_decorator.block_target(box) | |
| 70 | 76 | end |
| 71 | 77 | |
| 72 | - def select_blocks(arr, context) | |
| 78 | + def select_blocks box, arr, context | |
| 73 | 79 | arr |
| 74 | 80 | end |
| 75 | 81 | |
| ... | ... | @@ -150,8 +156,22 @@ module BoxesHelper |
| 150 | 156 | def self.block_edit_buttons(block) |
| 151 | 157 | '' |
| 152 | 158 | end |
| 153 | - def self.select_blocks(arr, context) | |
| 154 | - arr.select { |block| block.visible?(context) } | |
| 159 | + def self.select_blocks box, arr, context | |
| 160 | + arr = arr.select{ |block| block.visible? context } | |
| 161 | + | |
| 162 | + custom_design = context[:controller].send(:custom_design) | |
| 163 | + inserts = [custom_design[:insert]].flatten.compact | |
| 164 | + inserts.each do |insert_opts| | |
| 165 | + next unless box.position == insert_opts[:box] | |
| 166 | + position, block = insert_opts[:position], insert_opts[:block] | |
| 167 | + block = block.new box: box if block.is_a? Class | |
| 168 | + | |
| 169 | + if not insert_opts[:uniq] or not box.blocks.map(&:class).include? block.klass | |
| 170 | + arr = arr.insert position, block | |
| 171 | + end | |
| 172 | + end | |
| 173 | + | |
| 174 | + arr | |
| 155 | 175 | end |
| 156 | 176 | end |
| 157 | 177 | |
| ... | ... | @@ -211,7 +231,7 @@ module BoxesHelper |
| 211 | 231 | end |
| 212 | 232 | |
| 213 | 233 | if block.editable? |
| 214 | - buttons << colorbox_icon_button(:edit, _('Edit'), { :action => 'edit', :id => block.id }) | |
| 234 | + buttons << modal_icon_button(:edit, _('Edit'), { :action => 'edit', :id => block.id }) | |
| 215 | 235 | end |
| 216 | 236 | |
| 217 | 237 | if !block.main? |
| ... | ... | @@ -221,7 +241,7 @@ module BoxesHelper |
| 221 | 241 | end |
| 222 | 242 | |
| 223 | 243 | if block.respond_to?(:help) |
| 224 | - buttons << thickbox_inline_popup_icon(:help, _('Help on this block'), {}, "help-on-box-#{block.id}") << content_tag('div', content_tag('h2', _('Help')) + content_tag('div', block.help, :style => 'margin-bottom: 1em;') + thickbox_close_button(_('Close')), :style => 'display: none;', :id => "help-on-box-#{block.id}") | |
| 244 | + buttons << modal_inline_icon(:help, _('Help on this block'), {}, "#help-on-box-#{block.id}") << content_tag('div', content_tag('h2', _('Help')) + content_tag('div', block.help, :style => 'margin-bottom: 1em;') + modal_close_button(_('Close')), :style => 'display: none;', :id => "help-on-box-#{block.id}") | |
| 225 | 245 | end |
| 226 | 246 | |
| 227 | 247 | if block.embedable? | ... | ... |
app/helpers/categories_helper.rb
| ... | ... | @@ -25,10 +25,13 @@ module CategoriesHelper |
| 25 | 25 | ) |
| 26 | 26 | end |
| 27 | 27 | |
| 28 | - def update_categories_link(body, category_id=nil, html_options={}) | |
| 28 | + #TODO: remove this function and, in views, use existing basic buttons | |
| 29 | + def update_categories_link(type, body, category_id=nil, html_options={}) | |
| 30 | + html_class = 'select-subcategory-link' | |
| 31 | + html_class = " icon-#{type} btn btn-primary btn-xs" if type.present? | |
| 29 | 32 | link_to body, |
| 30 | 33 | { :action => "update_categories", :category_id => category_id, :id => @object }, |
| 31 | - {:id => category_id ? "select-category-#{category_id}-link" : nil, :remote => true, :class => 'select-subcategory-link'}.merge(html_options) | |
| 34 | + {:id => category_id ? "select-category-#{category_id}-link" : nil, :remote => true, :class => html_class}.merge(html_options) | |
| 32 | 35 | end |
| 33 | 36 | |
| 34 | 37 | end | ... | ... |
app/helpers/chat_helper.rb
| ... | ... | @@ -6,8 +6,9 @@ module ChatHelper |
| 6 | 6 | ['icon-menu-busy', _('Busy'), 'chat-busy'], |
| 7 | 7 | ['icon-menu-offline', _('Sign out of chat'), 'chat-disconnect'], |
| 8 | 8 | ] |
| 9 | + avatar = profile_image(user, :portrait, :class => 'avatar') | |
| 9 | 10 | content_tag('span', |
| 10 | - link_to(content_tag('span', status) + ui_icon('ui-icon-triangle-1-s'), | |
| 11 | + link_to(avatar + content_tag('span', user.name) + ui_icon('ui-icon-triangle-1-s'), | |
| 11 | 12 | '#', |
| 12 | 13 | :onclick => 'toggleMenu(this); return false', |
| 13 | 14 | :class => icon_class + ' simplemenu-trigger' | ... | ... |
app/helpers/cms_helper.rb
| ... | ... | @@ -9,12 +9,6 @@ module CmsHelper |
| 9 | 9 | mime_type.gsub('/', '_').gsub('-', '') |
| 10 | 10 | end |
| 11 | 11 | |
| 12 | - def add_upload_file_field(name, locals) | |
| 13 | - button_to_function :add, name, nil do |page| | |
| 14 | - page.insert_html :bottom, :uploaded_files, CGI::escapeHTML(render(:partial => 'upload_file', :locals => locals, :object => UploadedFile.new)) | |
| 15 | - end | |
| 16 | - end | |
| 17 | - | |
| 18 | 12 | def pagination_links(collection, options={}) |
| 19 | 13 | options = {:previous_label => '« ', :next_label => ' »', :page_links => false}.merge(options) |
| 20 | 14 | will_paginate(collection, options) | ... | ... |
app/helpers/colorbox_helper.rb
| ... | ... | @@ -1,25 +0,0 @@ |
| 1 | -module ColorboxHelper | |
| 2 | - | |
| 3 | - def colorbox_close_button(text, options = {}) | |
| 4 | - button(:close, text, '#', colorbox_options(options, :close)) | |
| 5 | - end | |
| 6 | - | |
| 7 | - def colorbox_button(type, label, url, options = {}) | |
| 8 | - button(type, label, url, colorbox_options(options)) | |
| 9 | - end | |
| 10 | - | |
| 11 | - def colorbox_icon_button(type, label, url, options = {}) | |
| 12 | - icon_button(type, label, url, colorbox_options(options)) | |
| 13 | - end | |
| 14 | - | |
| 15 | - # options must be an HTML options hash as passed to link_to etc. | |
| 16 | - # | |
| 17 | - # returns a new hash with colorbox class added. Keeps existing classes. | |
| 18 | - def colorbox_options(options, type=nil) | |
| 19 | - the_class = 'colorbox' | |
| 20 | - the_class += "-#{type.to_s}" unless type.nil? | |
| 21 | - the_class << " #{options[:class]}" if options.has_key?(:class) | |
| 22 | - options.merge(:class => the_class) | |
| 23 | - end | |
| 24 | - | |
| 25 | -end |
app/helpers/comment_helper.rb
| ... | ... | @@ -65,7 +65,7 @@ module CommentHelper |
| 65 | 65 | |
| 66 | 66 | def link_for_edit(comment) |
| 67 | 67 | if comment.can_be_updated_by?(user) |
| 68 | - {:link => expirable_comment_link(comment, :edit, _('Edit'), url_for(:profile => profile.identifier, :controller => :comment, :action => :edit, :id => comment.id),:class => 'colorbox')} | |
| 68 | + {:link => expirable_comment_link(comment, :edit, _('Edit'), url_for(:profile => profile.identifier, :controller => :comment, :action => :edit, :id => comment.id),:class => 'modal')} | |
| 69 | 69 | end |
| 70 | 70 | end |
| 71 | 71 | ... | ... |
app/helpers/dates_helper.rb
| ... | ... | @@ -2,24 +2,16 @@ require 'noosfero/i18n' |
| 2 | 2 | |
| 3 | 3 | module DatesHelper |
| 4 | 4 | |
| 5 | - # FIXME Date#strftime should translate this for us !!!! | |
| 6 | - MONTHS = [ | |
| 7 | - N_('January'), | |
| 8 | - N_('February'), | |
| 9 | - N_('March'), | |
| 10 | - N_('April'), | |
| 11 | - N_('May'), | |
| 12 | - N_('June'), | |
| 13 | - N_('July'), | |
| 14 | - N_('August'), | |
| 15 | - N_('September'), | |
| 16 | - N_('October'), | |
| 17 | - N_('November'), | |
| 18 | - N_('December') | |
| 19 | - ] | |
| 20 | - | |
| 21 | - def month_name(n) | |
| 22 | - _(MONTHS[n-1]) | |
| 5 | + def months | |
| 6 | + I18n.t('date.month_names') | |
| 7 | + end | |
| 8 | + | |
| 9 | + def month_name(n, abbreviated = false) | |
| 10 | + if abbreviated | |
| 11 | + I18n.t('date.abbr_month_names')[n] | |
| 12 | + else | |
| 13 | + months[n] | |
| 14 | + end | |
| 23 | 15 | end |
| 24 | 16 | |
| 25 | 17 | # formats a date for displaying. |
| ... | ... | @@ -47,7 +39,7 @@ module DatesHelper |
| 47 | 39 | end |
| 48 | 40 | end |
| 49 | 41 | |
| 50 | - # formats a datetime for displaying. | |
| 42 | + # formats a datetime for displaying. | |
| 51 | 43 | def show_time(time) |
| 52 | 44 | if time |
| 53 | 45 | _('%{day} %{month} %{year}, %{hour}:%{minutes}') % { :year => time.year, :month => month_name(time.month), :day => time.day, :hour => time.hour, :minutes => time.strftime("%M") } |
| ... | ... | @@ -91,15 +83,7 @@ module DatesHelper |
| 91 | 83 | _(date.strftime("%a")) |
| 92 | 84 | else |
| 93 | 85 | # FIXME Date#strftime should translate this for us !!!! |
| 94 | - _([ | |
| 95 | - N_('Sunday'), | |
| 96 | - N_('Monday'), | |
| 97 | - N_('Tuesday'), | |
| 98 | - N_('Wednesday'), | |
| 99 | - N_('Thursday'), | |
| 100 | - N_('Friday'), | |
| 101 | - N_('Saturday'), | |
| 102 | - ][date.wday]) | |
| 86 | + I18n.t('date.day_names')[date.wday] | |
| 103 | 87 | end |
| 104 | 88 | end |
| 105 | 89 | |
| ... | ... | @@ -111,7 +95,7 @@ module DatesHelper |
| 111 | 95 | date = date << 1 |
| 112 | 96 | end |
| 113 | 97 | if opts[:only_month] |
| 114 | - _('%{month}') % {:month => month_name(date.month.to_i) } | |
| 98 | + _('%{month}') % { :month => month_name(date.month.to_i) } | |
| 115 | 99 | else |
| 116 | 100 | _('%{month} %{year}') % { :year => date.year, :month => month_name(date.month.to_i) } |
| 117 | 101 | end |
| ... | ... | @@ -156,7 +140,7 @@ module DatesHelper |
| 156 | 140 | else |
| 157 | 141 | order = [:day, :month, :year] |
| 158 | 142 | end |
| 159 | - date_select(object, method, html_options.merge(options.merge(:include_blank => true, :order => order, :use_month_names => MONTHS.map {|item| gettext(item)}))) | |
| 143 | + date_select(object, method, html_options.merge(options.merge(:include_blank => true, :order => order, :use_month_names => months))) | |
| 160 | 144 | end |
| 161 | 145 | |
| 162 | 146 | end | ... | ... |
| ... | ... | @@ -0,0 +1,50 @@ |
| 1 | +module DesignHelper | |
| 2 | + | |
| 3 | + extend ActiveSupport::Concern | |
| 4 | + | |
| 5 | + included do | |
| 6 | + extend ClassMethods | |
| 7 | + include InstanceMethods | |
| 8 | + before_filter :load_custom_design if self.respond_to? :before_filter | |
| 9 | + end | |
| 10 | + | |
| 11 | + module ClassMethods | |
| 12 | + | |
| 13 | + def no_design_blocks | |
| 14 | + @no_design_blocks = true | |
| 15 | + end | |
| 16 | + | |
| 17 | + def use_custom_design options = {} | |
| 18 | + @custom_design = options | |
| 19 | + end | |
| 20 | + | |
| 21 | + def custom_design | |
| 22 | + @custom_design ||= {} | |
| 23 | + end | |
| 24 | + | |
| 25 | + def uses_design_blocks? | |
| 26 | + !@no_design_blocks | |
| 27 | + end | |
| 28 | + | |
| 29 | + end | |
| 30 | + | |
| 31 | + module InstanceMethods | |
| 32 | + | |
| 33 | + protected | |
| 34 | + | |
| 35 | + def uses_design_blocks? | |
| 36 | + !@no_design_blocks && self.class.uses_design_blocks? | |
| 37 | + end | |
| 38 | + | |
| 39 | + def load_custom_design | |
| 40 | + # see also: LayoutHelper#body_classes | |
| 41 | + @layout_template = self.class.custom_design[:layout_template] | |
| 42 | + end | |
| 43 | + | |
| 44 | + def custom_design | |
| 45 | + @custom_design || self.class.custom_design | |
| 46 | + end | |
| 47 | + | |
| 48 | + end | |
| 49 | + | |
| 50 | +end | ... | ... |
app/helpers/language_helper.rb
| 1 | 1 | module LanguageHelper |
| 2 | 2 | def language |
| 3 | - locale | |
| 3 | + locale.to_s | |
| 4 | 4 | end |
| 5 | 5 | |
| 6 | 6 | def tinymce_language |
| ... | ... | @@ -20,7 +20,7 @@ module LanguageHelper |
| 20 | 20 | separator = options[:separator] || ' — ' |
| 21 | 21 | |
| 22 | 22 | if options[:element] == 'dropdown' |
| 23 | - select_tag('lang', | |
| 23 | + select_tag('lang', | |
| 24 | 24 | options_for_select(locales.map{|code,name| [name, code]}, current), |
| 25 | 25 | :onchange => "document.location.href= #{url_for(params.merge(:lang => 'LANGUAGE'))}.replace(/LANGUAGE/, this.value) ;", |
| 26 | 26 | :help => _('The language you choose here is the language used for options, buttons, etc. It does not affect the language of the content created by other users.') | ... | ... |
app/helpers/layout_helper.rb
| ... | ... | @@ -31,12 +31,12 @@ module LayoutHelper |
| 31 | 31 | plugins_javascripts = @plugins.map { |plugin| [plugin.js_files].flatten.map { |js| plugin.class.public_path(js) } }.flatten |
| 32 | 32 | |
| 33 | 33 | output = '' |
| 34 | - output += render :file => 'layouts/_javascript' | |
| 35 | - output += javascript_tag 'render_all_jquery_ui_widgets()' | |
| 34 | + output += render 'layouts/javascript' | |
| 36 | 35 | unless plugins_javascripts.empty? |
| 37 | 36 | output += javascript_include_tag plugins_javascripts, :cache => "cache/plugins-#{Digest::MD5.hexdigest plugins_javascripts.to_s}" |
| 38 | 37 | end |
| 39 | 38 | output += theme_javascript_ng.to_s |
| 39 | + output += javascript_tag 'render_all_jquery_ui_widgets()' | |
| 40 | 40 | |
| 41 | 41 | output |
| 42 | 42 | end |
| ... | ... | @@ -45,11 +45,10 @@ module LayoutHelper |
| 45 | 45 | standard_stylesheets = [ |
| 46 | 46 | 'application', |
| 47 | 47 | 'search', |
| 48 | - 'thickbox', | |
| 49 | - 'lightbox', | |
| 50 | 48 | 'colorbox', |
| 51 | 49 | 'selectordie', |
| 52 | 50 | 'inputosaurus', |
| 51 | + 'chat', | |
| 53 | 52 | pngfix_stylesheet_path, |
| 54 | 53 | ] + tokeninput_stylesheets |
| 55 | 54 | plugins_stylesheets = @plugins.select(&:stylesheet?).map { |plugin| plugin.class.public_path('style.css') } |
| ... | ... | @@ -86,6 +85,7 @@ module LayoutHelper |
| 86 | 85 | end |
| 87 | 86 | end |
| 88 | 87 | |
| 88 | + | |
| 89 | 89 | def icon_theme_stylesheet_path |
| 90 | 90 | icon_themes = [] |
| 91 | 91 | theme_icon_themes = theme_option(:icon_theme) || [] |
| ... | ... | @@ -116,8 +116,5 @@ module LayoutHelper |
| 116 | 116 | end |
| 117 | 117 | end |
| 118 | 118 | |
| 119 | - def meta_description_tag(article=nil) | |
| 120 | - article ? CGI.escapeHTML(truncate(strip_tags(article.body.to_s), :length => 200)) : environment.name | |
| 121 | - end | |
| 122 | 119 | end |
| 123 | 120 | ... | ... |
app/helpers/lightbox_helper.rb
| ... | ... | @@ -1,36 +0,0 @@ |
| 1 | -module LightboxHelper | |
| 2 | - | |
| 3 | - def lightbox_link_to(text, url, options = {}) | |
| 4 | - link_to(text, url, lightbox_options(options)) | |
| 5 | - end | |
| 6 | - | |
| 7 | - def lightbox_close_button(text, options = {}) | |
| 8 | - button(:close, text, '#', lightbox_options(options, 'lbAction').merge(:rel => 'deactivate')) | |
| 9 | - end | |
| 10 | - | |
| 11 | - def lightbox_button(type, label, url, options = {}) | |
| 12 | - button(type, label, url, lightbox_options(options)) | |
| 13 | - end | |
| 14 | - | |
| 15 | - def lightbox_icon_button(type, label, url, options = {}) | |
| 16 | - icon_button(type, label, url, lightbox_options(options)) | |
| 17 | - end | |
| 18 | - | |
| 19 | - # options must be an HTML options hash as passed to link_to etc. | |
| 20 | - # | |
| 21 | - # returns a new hash with lightbox class added. Keeps existing classes. | |
| 22 | - def lightbox_options(options, lightbox_type = 'lbOn') | |
| 23 | - the_class = lightbox_type | |
| 24 | - the_class << " #{options[:class]}" if options.has_key?(:class) | |
| 25 | - options.merge(:class => the_class) | |
| 26 | - end | |
| 27 | - | |
| 28 | - def lightbox? | |
| 29 | - request.xhr? | |
| 30 | - end | |
| 31 | - | |
| 32 | - def lightbox_remote_button(type, label, url, options = {}) | |
| 33 | - button(type, label, url, lightbox_options(options, 'remote-lbOn')) | |
| 34 | - end | |
| 35 | - | |
| 36 | -end |
app/helpers/manage_products_helper.rb
| ... | ... | @@ -137,7 +137,7 @@ module ManageProductsHelper |
| 137 | 137 | ui_button_to_remote(label, |
| 138 | 138 | {:update => "product-#{field}", |
| 139 | 139 | :url => { :controller => 'manage_products', :action => "edit", :id => product.id, :field => field }, |
| 140 | - :complete => "$('edit-product-button-ui-#{field}').hide()", | |
| 140 | + :complete => "jQuery('#edit-product-button-ui-#{field}').hide()", | |
| 141 | 141 | :method => :get, |
| 142 | 142 | :loading => "loading_for_button('##{id}')"}, |
| 143 | 143 | options) | ... | ... |
| ... | ... | @@ -0,0 +1,46 @@ |
| 1 | +module ModalHelper | |
| 2 | + | |
| 3 | + def modal_inline_link_to title, url, selector, options = {} | |
| 4 | + link_to title, url, modal_options(options.merge(:inline => selector)) | |
| 5 | + end | |
| 6 | + | |
| 7 | + def modal_inline_icon type, title, url, selector, options = {} | |
| 8 | + icon_button type, title, url, modal_options(options.merge(:inline => selector)) | |
| 9 | + end | |
| 10 | + | |
| 11 | + def modal_link_to title, url, options = {} | |
| 12 | + link_to title, url, modal_options(options) | |
| 13 | + end | |
| 14 | + | |
| 15 | + def modal_close_link text, options = {} | |
| 16 | + link_to text, '#', modal_options(options, :close) | |
| 17 | + end | |
| 18 | + | |
| 19 | + def modal_close_button(text, options = {}) | |
| 20 | + button :close, text, '#', modal_options(options, :close).merge(:rel => 'deactivate') | |
| 21 | + end | |
| 22 | + | |
| 23 | + def modal_button(type, label, url, options = {}) | |
| 24 | + button type, label, url, modal_options(options) | |
| 25 | + end | |
| 26 | + | |
| 27 | + def modal_icon_button(type, label, url, options = {}) | |
| 28 | + icon_button type, label, url, modal_options(options) | |
| 29 | + end | |
| 30 | + | |
| 31 | + # options must be an HTML options hash as passed to link_to etc. | |
| 32 | + # | |
| 33 | + # returns a new hash with modal class added. Keeps existing classes. | |
| 34 | + def modal_options(options, type=nil) | |
| 35 | + inline_selector = options.delete :inline | |
| 36 | + options[:onclick] = "return noosfero.modal.inline('#{inline_selector}')" if inline_selector | |
| 37 | + | |
| 38 | + classes = if inline_selector then '' else 'modal-toggle' end | |
| 39 | + classes += " modal-#{type.to_s}" if type.present? | |
| 40 | + classes << " #{options[:class]}" if options.has_key? :class | |
| 41 | + options.merge!(:class => classes) | |
| 42 | + | |
| 43 | + options | |
| 44 | + end | |
| 45 | + | |
| 46 | +end | ... | ... |
app/helpers/thickbox_helper.rb
| ... | ... | @@ -1,11 +0,0 @@ |
| 1 | -module ThickboxHelper | |
| 2 | - def thickbox_inline_popup_link(title, url, id, options = {}) | |
| 3 | - link_to(title, url_for(url) + "#TB_inline?height=300&width=500&inlineId=#{id}&modal=true", {:class => 'thickbox'}.merge(options)) | |
| 4 | - end | |
| 5 | - def thickbox_inline_popup_icon(type, title, url, id, options = {}) | |
| 6 | - icon_button(type, title, url_for(url) + "#TB_inline?height=300&width=500&inlineId=#{id}&modal=true", {:class => "thickbox"}.merge(options)) | |
| 7 | - end | |
| 8 | - def thickbox_close_button(title) | |
| 9 | - button_to_function(:close, title, 'tb_remove();') | |
| 10 | - end | |
| 11 | -end |
app/mailers/comment_notifier.rb
app/mailers/scrap_notifier.rb
app/models/add_friend.rb
| ... | ... | @@ -4,7 +4,7 @@ class AddFriend < Task |
| 4 | 4 | |
| 5 | 5 | validates_presence_of :requestor_id, :target_id |
| 6 | 6 | |
| 7 | - validates_uniqueness_of :target_id, :scope => [ :requestor_id ] | |
| 7 | + validates_uniqueness_of :target_id, scope: [ :requestor_id, :status ], if: proc{ |t| t.status == Task::Status::ACTIVE } | |
| 8 | 8 | |
| 9 | 9 | validates_length_of :group_for_person, :group_for_friend, :maximum => 150, :allow_nil => true |
| 10 | 10 | ... | ... |
app/models/article.rb
| 1 | -require 'hpricot' | |
| 2 | 1 | |
| 3 | 2 | class Article < ActiveRecord::Base |
| 4 | 3 | |
| ... | ... | @@ -390,6 +389,10 @@ class Article < ActiveRecord::Base |
| 390 | 389 | {} |
| 391 | 390 | end |
| 392 | 391 | |
| 392 | + def alternate_languages | |
| 393 | + self.translations.map(&:language) | |
| 394 | + end | |
| 395 | + | |
| 393 | 396 | scope :native_translations, :conditions => { :translation_of_id => nil } |
| 394 | 397 | |
| 395 | 398 | def translatable? |
| ... | ... | @@ -483,15 +486,18 @@ class Article < ActiveRecord::Base |
| 483 | 486 | scope :more_comments, :order => "comments_count DESC" |
| 484 | 487 | scope :more_recent, :order => "created_at DESC" |
| 485 | 488 | |
| 486 | - def self.display_filter(user, profile) | |
| 487 | - return {:conditions => ['articles.published = ?', true]} if !user | |
| 488 | - {:conditions => [" articles.published = ? OR | |
| 489 | - articles.last_changed_by_id = ? OR | |
| 490 | - articles.profile_id = ? OR | |
| 491 | - ? OR articles.show_to_followers = ? AND ?", | |
| 492 | - true, user.id, user.id, user.has_permission?(:view_private_content, profile), | |
| 493 | - true, user.follows?(profile)]} | |
| 494 | - end | |
| 489 | + scope :display_filter, lambda {|user, profile| | |
| 490 | + return published if (user.nil? && profile && profile.public?) | |
| 491 | + return [] if user.nil? || (profile && !profile.public? && !user.follows?(profile)) | |
| 492 | + where( | |
| 493 | + [ | |
| 494 | + "published = ? OR last_changed_by_id = ? OR profile_id = ? OR ? | |
| 495 | + OR (show_to_followers = ? AND ?)", true, user.id, user.id, | |
| 496 | + profile.nil? ? false : user.has_permission?(:view_private_content, profile), | |
| 497 | + true, user.follows?(profile) | |
| 498 | + ] | |
| 499 | + ) | |
| 500 | + } | |
| 495 | 501 | |
| 496 | 502 | |
| 497 | 503 | def display_unpublished_article_to?(user) |
| ... | ... | @@ -703,7 +709,7 @@ class Article < ActiveRecord::Base |
| 703 | 709 | end |
| 704 | 710 | |
| 705 | 711 | def first_paragraph |
| 706 | - paragraphs = Hpricot(to_html).search('p') | |
| 712 | + paragraphs = Nokogiri::HTML.fragment(to_html).css('p') | |
| 707 | 713 | paragraphs.empty? ? '' : paragraphs.first.to_html |
| 708 | 714 | end |
| 709 | 715 | |
| ... | ... | @@ -725,8 +731,8 @@ class Article < ActiveRecord::Base |
| 725 | 731 | |
| 726 | 732 | def body_images_paths |
| 727 | 733 | require 'uri' |
| 728 | - Hpricot(self.body.to_s).search('img[@src]').collect do |i| | |
| 729 | - (self.profile && self.profile.environment) ? URI.join(self.profile.environment.top_url, URI.escape(i.attributes['src'])).to_s : i.attributes['src'] | |
| 734 | + Nokogiri::HTML.fragment(self.body.to_s).css('img[src]').collect do |i| | |
| 735 | + (self.profile && self.profile.environment) ? URI.join(self.profile.environment.top_url, URI.escape(i['src'])).to_s : i['src'] | |
| 730 | 736 | end |
| 731 | 737 | end |
| 732 | 738 | |
| ... | ... | @@ -763,11 +769,11 @@ class Article < ActiveRecord::Base |
| 763 | 769 | end |
| 764 | 770 | |
| 765 | 771 | def first_image |
| 766 | - img = Hpricot(self.lead.to_s).search('img[@src]').first || Hpricot(self.body.to_s).search('img').first | |
| 767 | - img.nil? ? '' : img.attributes['src'] | |
| 772 | + img = Nokogiri::HTML.fragment(self.lead.to_s).css('img[src]').first || Nokogiri::HTML.fragment(self.body.to_s).search('img').first | |
| 773 | + img.nil? ? '' : img['src'] | |
| 768 | 774 | end |
| 769 | 775 | |
| 770 | - delegate :region, :region_id, :environment, :environment_id, :to => :profile, :allow_nil => true | |
| 776 | + delegate :lat, :lng, :region, :region_id, :environment, :environment_id, :to => :profile, :allow_nil => true | |
| 771 | 777 | |
| 772 | 778 | def has_macro? |
| 773 | 779 | true | ... | ... |
app/models/blog_archives_block.rb
| ... | ... | @@ -36,8 +36,7 @@ class BlogArchivesBlock < Block |
| 36 | 36 | results << content_tag('li', content_tag('strong', "#{year} (#{count})")) |
| 37 | 37 | results << "<ul class='#{year}-archive'>" |
| 38 | 38 | posts.except(:order).count(:all, :conditions => ['EXTRACT(YEAR FROM published_at)=?', year], :group => 'EXTRACT(MONTH FROM published_at)').sort_by {|month, count| -month.to_i}.each do |month, count| |
| 39 | - month_name = gettext(MONTHS[month.to_i - 1]) | |
| 40 | - results << content_tag('li', link_to("#{month_name} (#{count})", owner_blog.url.merge(:year => year, :month => month))) | |
| 39 | + results << content_tag('li', link_to("#{month_name(month.to_i)} (#{count})", owner_blog.url.merge(:year => year, :month => month))) | |
| 41 | 40 | end |
| 42 | 41 | results << "</ul>" |
| 43 | 42 | end | ... | ... |
app/models/box.rb
| ... | ... | @@ -14,8 +14,8 @@ class Box < ActiveRecord::Base |
| 14 | 14 | end |
| 15 | 15 | |
| 16 | 16 | def acceptable_blocks |
| 17 | - blocks_classes = central? ? Box.acceptable_center_blocks + plugins.dispatch(:extra_blocks, :type => owner.class, :position => 1) : Box.acceptable_side_blocks + plugins.dispatch(:extra_blocks, :type => owner.class, :position => [2, 3]) | |
| 18 | - to_css_class_name(blocks_classes) | |
| 17 | + blocks_classes = if central? then Box.acceptable_center_blocks + plugins.dispatch(:extra_blocks, :type => owner.class, :position => 1) else Box.acceptable_side_blocks + plugins.dispatch(:extra_blocks, :type => owner.class, :position => [2, 3]) end | |
| 18 | + to_css_selector blocks_classes | |
| 19 | 19 | end |
| 20 | 20 | |
| 21 | 21 | def central? |
| ... | ... | @@ -74,8 +74,8 @@ class Box < ActiveRecord::Base |
| 74 | 74 | |
| 75 | 75 | private |
| 76 | 76 | |
| 77 | - def to_css_class_name(blocks_classes) | |
| 78 | - blocks_classes.map{ |block_class| block_class.name.to_css_class } | |
| 77 | + def to_css_selector(blocks_classes) | |
| 78 | + blocks_classes.map{ |block_class| ".#{block_class.name.to_css_class}" }.join(',') | |
| 79 | 79 | end |
| 80 | 80 | |
| 81 | 81 | end | ... | ... |
app/models/comment.rb
| ... | ... | @@ -132,11 +132,11 @@ class Comment < ActiveRecord::Base |
| 132 | 132 | def notify_by_mail |
| 133 | 133 | if source.kind_of?(Article) && article.notify_comments? |
| 134 | 134 | if !notification_emails.empty? |
| 135 | - Comment::Notifier.notification(self).deliver | |
| 135 | + CommentNotifier.notification(self).deliver | |
| 136 | 136 | end |
| 137 | 137 | emails = article.followers - [author_email] |
| 138 | 138 | if !emails.empty? |
| 139 | - Comment::Notifier.mail_to_followers(self, emails).deliver | |
| 139 | + CommentNotifier.mail_to_followers(self, emails).deliver | |
| 140 | 140 | end |
| 141 | 141 | end |
| 142 | 142 | end | ... | ... |
app/models/enterprise.rb
| ... | ... | @@ -19,7 +19,8 @@ class Enterprise < Organization |
| 19 | 19 | has_many :inputs, :through => :products |
| 20 | 20 | has_many :production_costs, :as => :owner |
| 21 | 21 | |
| 22 | - has_and_belongs_to_many :fans, :class_name => 'Person', :join_table => 'favorite_enteprises_people' | |
| 22 | + has_many :favorite_enterprise_people | |
| 23 | + has_many :fans, through: :favorite_enterprise_people, source: :person | |
| 23 | 24 | |
| 24 | 25 | def product_categories |
| 25 | 26 | ProductCategory.by_enterprise(self) | ... | ... |
app/models/environment.rb
| ... | ... | @@ -3,7 +3,7 @@ |
| 3 | 3 | # domains. |
| 4 | 4 | class Environment < ActiveRecord::Base |
| 5 | 5 | |
| 6 | - attr_accessible :name, :is_default, :signup_welcome_text_subject, :signup_welcome_text_body, :terms_of_use, :message_for_disabled_enterprise, :news_amount_by_folder, :default_language, :languages, :description, :organization_approval_method, :enabled_plugins, :enabled_features, :redirection_after_login, :redirection_after_signup, :contact_email, :theme, :reports_lower_bound, :noreply_email, :signup_welcome_screen_body, :members_whitelist_enabled, :members_whitelist | |
| 6 | + attr_accessible :name, :is_default, :signup_welcome_text_subject, :signup_welcome_text_body, :terms_of_use, :message_for_disabled_enterprise, :news_amount_by_folder, :default_language, :languages, :description, :organization_approval_method, :enabled_plugins, :enabled_features, :redirection_after_login, :redirection_after_signup, :contact_email, :theme, :reports_lower_bound, :noreply_email, :signup_welcome_screen_body, :members_whitelist_enabled, :members_whitelist, :highlighted_news_amount, :portal_news_amount | |
| 7 | 7 | |
| 8 | 8 | has_many :users |
| 9 | 9 | |
| ... | ... | @@ -268,9 +268,12 @@ class Environment < ActiveRecord::Base |
| 268 | 268 | settings_items :description, :type => String, :default => '<div style="text-align: center"><a href="http://noosfero.org/"><img src="/images/noosfero-network.png" alt="Noosfero"/></a></div>' |
| 269 | 269 | settings_items :local_docs, :type => Array, :default => [] |
| 270 | 270 | settings_items :news_amount_by_folder, :type => Integer, :default => 4 |
| 271 | + settings_items :highlighted_news_amount, :type => Integer, :default => 2 | |
| 272 | + settings_items :portal_news_amount, :type => Integer, :default => 5 | |
| 271 | 273 | settings_items :help_message_to_add_enterprise, :type => String, :default => '' |
| 272 | 274 | settings_items :tip_message_enterprise_activation_question, :type => String, :default => '' |
| 273 | 275 | |
| 276 | + settings_items :currency_iso_unit, :type => String, :default => 'USD' | |
| 274 | 277 | settings_items :currency_unit, :type => String, :default => '$' |
| 275 | 278 | settings_items :currency_separator, :type => String, :default => '.' |
| 276 | 279 | settings_items :currency_delimiter, :type => String, :default => ',' | ... | ... |
app/models/event.rb
| ... | ... | @@ -141,11 +141,13 @@ class Event < Article |
| 141 | 141 | result |
| 142 | 142 | end |
| 143 | 143 | |
| 144 | + def duration | |
| 145 | + ((self.end_date || self.start_date) - self.start_date).to_i | |
| 146 | + end | |
| 147 | + | |
| 148 | + alias_method :article_lead, :lead | |
| 144 | 149 | def lead |
| 145 | - content_tag('div', | |
| 146 | - show_period(start_date, end_date), | |
| 147 | - :class => 'event-dates' | |
| 148 | - ) + super | |
| 150 | + self.class.action_view.render 'content_viewer/event_lead', event: self | |
| 149 | 151 | end |
| 150 | 152 | |
| 151 | 153 | def event? | ... | ... |
app/models/external_feed.rb
| ... | ... | @@ -14,9 +14,9 @@ class ExternalFeed < ActiveRecord::Base |
| 14 | 14 | |
| 15 | 15 | def add_item(title, link, date, content) |
| 16 | 16 | return if content.blank? |
| 17 | - doc = Hpricot(content) | |
| 18 | - doc.search('*').each do |p| | |
| 19 | - if p.instance_of? Hpricot::Elem | |
| 17 | + doc = Nokogiri::HTML.fragment content | |
| 18 | + doc.css('*').each do |p| | |
| 19 | + if p.instance_of? Nokogiri::XML::Element | |
| 20 | 20 | p.remove_attribute 'style' |
| 21 | 21 | p.remove_attribute 'class' |
| 22 | 22 | end |
| ... | ... | @@ -26,10 +26,10 @@ class ExternalFeed < ActiveRecord::Base |
| 26 | 26 | article = TinyMceArticle.new |
| 27 | 27 | article.name = title |
| 28 | 28 | article.profile = blog.profile |
| 29 | - article.body = content | |
| 30 | - article.published_at = date | |
| 31 | - article.source = link | |
| 32 | - article.profile = blog.profile | |
| 29 | + article.body = content | |
| 30 | + article.published_at = date | |
| 31 | + article.source = link | |
| 32 | + article.profile = blog.profile | |
| 33 | 33 | article.parent = blog |
| 34 | 34 | article.author_name = self.feed_title |
| 35 | 35 | unless blog.children.exists?(:slug => article.slug) | ... | ... |
app/models/forum.rb
app/models/input.rb
| 1 | 1 | class Input < ActiveRecord::Base |
| 2 | 2 | |
| 3 | - attr_accessible :product, :product_category, :product_category_id, :amount_used, :unit_id, :price_per_unit, :relevant_to_price | |
| 3 | + attr_accessible :product, :product_id, :product_category, :product_category_id, | |
| 4 | + :amount_used, :unit_id, :price_per_unit, :relevant_to_price, :is_from_solidarity_economy | |
| 4 | 5 | |
| 5 | 6 | belongs_to :product |
| 6 | 7 | belongs_to :product_category | ... | ... |
app/models/main_block.rb
app/models/person.rb
| ... | ... | @@ -150,7 +150,7 @@ roles] } |
| 150 | 150 | end |
| 151 | 151 | |
| 152 | 152 | def already_request_friendship?(person) |
| 153 | - person.tasks.find_by_requestor_id(self.id, :conditions => { :type => 'AddFriend' }) | |
| 153 | + person.tasks.where(requestor_id: self.id, type: 'AddFriend', status: Task::Status::ACTIVE).first | |
| 154 | 154 | end |
| 155 | 155 | |
| 156 | 156 | def remove_friend(friend) |
| ... | ... | @@ -435,6 +435,7 @@ roles] } |
| 435 | 435 | end |
| 436 | 436 | |
| 437 | 437 | def follows?(profile) |
| 438 | + return false if profile.nil? | |
| 438 | 439 | profile.followed_by?(self) |
| 439 | 440 | end |
| 440 | 441 | ... | ... |
app/models/person_notifier.rb
| ... | ... | @@ -22,12 +22,17 @@ class PersonNotifier |
| 22 | 22 | schedule_next_notification_mail |
| 23 | 23 | end |
| 24 | 24 | |
| 25 | + def notify_from | |
| 26 | + @person.last_notification || DateTime.now - @person.notification_time.hours | |
| 27 | + end | |
| 28 | + | |
| 25 | 29 | def notify |
| 26 | 30 | if @person.notification_time && @person.notification_time > 0 |
| 27 | - from = @person.last_notification || DateTime.now - @person.notification_time.hours | |
| 28 | - notifications = @person.tracked_notifications.find(:all, :conditions => ["created_at > ?", from]) | |
| 31 | + notifications = @person.tracked_notifications.find(:all, :conditions => ["created_at > ?", notify_from]) | |
| 32 | + tasks = Task.to(@person).without_spam.pending.where("created_at > ?", notify_from).order_by('created_at', 'asc') | |
| 33 | + | |
| 29 | 34 | Noosfero.with_locale @person.environment.default_language do |
| 30 | - Mailer::content_summary(@person, notifications).deliver unless notifications.empty? | |
| 35 | + Mailer::content_summary(@person, notifications, tasks).deliver unless notifications.empty? && tasks.empty? | |
| 31 | 36 | end |
| 32 | 37 | @person.settings[:last_notification] = DateTime.now |
| 33 | 38 | @person.save! |
| ... | ... | @@ -59,8 +64,12 @@ class PersonNotifier |
| 59 | 64 | end |
| 60 | 65 | |
| 61 | 66 | def failure(job) |
| 62 | - person = Person.find(person_id) | |
| 63 | - person.notifier.dispatch_notification_mail | |
| 67 | + begin | |
| 68 | + person = Person.find(person_id) | |
| 69 | + person.notifier.dispatch_notification_mail | |
| 70 | + rescue | |
| 71 | + Rails.logger.error "PersonNotifier::NotifyJob: Cannot recover from failure" | |
| 72 | + end | |
| 64 | 73 | end |
| 65 | 74 | |
| 66 | 75 | end |
| ... | ... | @@ -73,18 +82,24 @@ class PersonNotifier |
| 73 | 82 | {:theme => nil} |
| 74 | 83 | end |
| 75 | 84 | |
| 76 | - def content_summary(person, notifications) | |
| 85 | + def content_summary(person, notifications, tasks) | |
| 86 | + if person.environment | |
| 87 | + ActionMailer::Base.asset_host = person.environment.top_url | |
| 88 | + ActionMailer::Base.default_url_options[:host] = person.environment.default_hostname | |
| 89 | + end | |
| 90 | + | |
| 77 | 91 | @current_theme = 'default' |
| 78 | 92 | @profile = person |
| 79 | 93 | @recipient = @profile.nickname || @profile.name |
| 80 | 94 | @notifications = notifications |
| 95 | + @tasks = tasks | |
| 81 | 96 | @environment = @profile.environment.name |
| 82 | 97 | @url = @profile.environment.top_url |
| 83 | 98 | mail( |
| 84 | 99 | content_type: "text/html", |
| 85 | 100 | from: "#{@profile.environment.name} <#{@profile.environment.noreply_email}>", |
| 86 | 101 | to: @profile.email, |
| 87 | - subject: _("[%s] Network Activity") % [@profile.environment.name] | |
| 102 | + subject: _("[%s] Notifications") % [@profile.environment.name] | |
| 88 | 103 | ) |
| 89 | 104 | end |
| 90 | 105 | end | ... | ... |
app/models/product.rb
| ... | ... | @@ -10,7 +10,8 @@ class Product < ActiveRecord::Base |
| 10 | 10 | :display => %w[full map] |
| 11 | 11 | } |
| 12 | 12 | |
| 13 | - attr_accessible :name, :product_category, :highlighted, :price, :enterprise, :image_builder, :description, :available, :qualifiers, :unit_id, :discount, :inputs, :qualifiers_list | |
| 13 | + attr_accessible :name, :product_category, :profile, :profile_id, :enterprise, | |
| 14 | + :highlighted, :price, :image_builder, :description, :available, :qualifiers, :unit_id, :discount, :inputs, :qualifiers_list | |
| 14 | 15 | |
| 15 | 16 | def self.default_search_display |
| 16 | 17 | 'full' |
| ... | ... | @@ -236,7 +237,7 @@ class Product < ActiveRecord::Base |
| 236 | 237 | |
| 237 | 238 | def percentage_from_solidarity_economy |
| 238 | 239 | se_i = t_i = 0 |
| 239 | - self.inputs(true).each{ |i| t_i += 1; se_i += 1 if i.is_from_solidarity_economy } | |
| 240 | + self.inputs.each{ |i| t_i += 1; se_i += 1 if i.is_from_solidarity_economy } | |
| 240 | 241 | t_i = 1 if t_i == 0 # avoid division by 0 |
| 241 | 242 | p = case (se_i.to_f/t_i)*100 |
| 242 | 243 | when 0 then [0, ''] | ... | ... |
app/models/scrap.rb
| ... | ... | @@ -25,7 +25,7 @@ class Scrap < ActiveRecord::Base |
| 25 | 25 | |
| 26 | 26 | after_create do |scrap| |
| 27 | 27 | scrap.root.update_attribute('updated_at', DateTime.now) unless scrap.root.nil? |
| 28 | - Scrap::Notifier.notification(scrap).deliver if scrap.send_notification? | |
| 28 | + ScrapNotifier.notification(scrap).deliver if scrap.send_notification? | |
| 29 | 29 | end |
| 30 | 30 | |
| 31 | 31 | before_validation :strip_all_html_tags | ... | ... |
app/models/text_article.rb
| 1 | 1 | require 'noosfero/translatable_content' |
| 2 | 2 | |
| 3 | -# a base class for all text article types. | |
| 3 | +# a base class for all text article types. | |
| 4 | 4 | class TextArticle < Article |
| 5 | 5 | |
| 6 | 6 | xss_terminate :only => [ :name ], :on => 'validation' |
| ... | ... | @@ -26,10 +26,10 @@ class TextArticle < Article |
| 26 | 26 | before_save :set_relative_path |
| 27 | 27 | |
| 28 | 28 | def set_relative_path |
| 29 | - parsed = Hpricot(self.body.to_s) | |
| 30 | - parsed.search('img[@src]').map { |i| change_element_path(i, 'src') } | |
| 31 | - parsed.search('a[@href]').map { |i| change_element_path(i, 'href') } | |
| 32 | - self.body = parsed.to_s | |
| 29 | + parsed = Nokogiri::HTML.fragment(self.body.to_s) | |
| 30 | + parsed.css('img[src]').each { |i| change_element_path(i, 'src') } | |
| 31 | + parsed.css('a[href]').each { |i| change_element_path(i, 'href') } | |
| 32 | + self.body = parsed.to_html | |
| 33 | 33 | end |
| 34 | 34 | |
| 35 | 35 | def change_element_path(el, attribute) | ... | ... |
app/models/user.rb
| ... | ... | @@ -54,7 +54,7 @@ class User < ActiveRecord::Base |
| 54 | 54 | |
| 55 | 55 | user.person = p |
| 56 | 56 | end |
| 57 | - if user.environment.enabled?('skip_new_user_email_confirmation') | |
| 57 | + if user.environment.enabled?('skip_new_user_email_confirmation') | |
| 58 | 58 | if user.environment.enabled?('admin_must_approve_new_users') |
| 59 | 59 | create_moderate_task |
| 60 | 60 | else |
| ... | ... | @@ -102,6 +102,7 @@ class User < ActiveRecord::Base |
| 102 | 102 | validates_length_of :email, :within => 3..100, :if => (lambda {|user| !user.email.blank?}) |
| 103 | 103 | validates_uniqueness_of :login, :email, :case_sensitive => false, :scope => :environment_id |
| 104 | 104 | before_save :encrypt_password |
| 105 | + before_save :normalize_email, if: proc{ |u| u.email.present? } | |
| 105 | 106 | validates_format_of :email, :with => Noosfero::Constants::EMAIL_FORMAT, :if => (lambda {|user| !user.email.blank?}) |
| 106 | 107 | |
| 107 | 108 | validates_inclusion_of :terms_accepted, :in => [ '1' ], :if => lambda { |u| ! u.terms_of_use.blank? }, :message => N_('{fn} must be checked in order to signup.').fix_i18n |
| ... | ... | @@ -114,6 +115,10 @@ class User < ActiveRecord::Base |
| 114 | 115 | u && u.authenticated?(password) ? u : nil |
| 115 | 116 | end |
| 116 | 117 | |
| 118 | + def register_login | |
| 119 | + self.update_attribute :last_login_at, Time.now | |
| 120 | + end | |
| 121 | + | |
| 117 | 122 | # Activates the user in the database. |
| 118 | 123 | def activate |
| 119 | 124 | return false unless self.person |
| ... | ... | @@ -154,6 +159,7 @@ class User < ActiveRecord::Base |
| 154 | 159 | @task.name = self.name |
| 155 | 160 | @task.email = self.email |
| 156 | 161 | @task.target = self.environment |
| 162 | + @task.requestor = self.person | |
| 157 | 163 | @task.save |
| 158 | 164 | end |
| 159 | 165 | |
| ... | ... | @@ -296,6 +302,10 @@ class User < ActiveRecord::Base |
| 296 | 302 | end |
| 297 | 303 | end |
| 298 | 304 | |
| 305 | + def moderate_registration_pending? | |
| 306 | + return ModerateUserRegistration.exists?(:requestor_id => self.person.id, :target_id => self.environment.id, :status => Task::Status::ACTIVE) | |
| 307 | + end | |
| 308 | + | |
| 299 | 309 | def data_hash(gravatar_default = nil) |
| 300 | 310 | friends_list = {} |
| 301 | 311 | enterprises = person.enterprises.map { |e| { 'name' => e.short_name, 'identifier' => e.identifier } } |
| ... | ... | @@ -332,6 +342,11 @@ class User < ActiveRecord::Base |
| 332 | 342 | end |
| 333 | 343 | |
| 334 | 344 | protected |
| 345 | + | |
| 346 | + def normalize_email | |
| 347 | + self.email = self.email.squish.downcase | |
| 348 | + end | |
| 349 | + | |
| 335 | 350 | # before filter |
| 336 | 351 | def encrypt_password |
| 337 | 352 | return if password.blank? |
| ... | ... | @@ -359,6 +374,6 @@ class User < ActiveRecord::Base |
| 359 | 374 | |
| 360 | 375 | def delay_activation_check |
| 361 | 376 | return if person.is_template? |
| 362 | - Delayed::Job.enqueue(UserActivationJob.new(self.id), {:priority => 0, :run_at => 72.hours.from_now}) | |
| 377 | + Delayed::Job.enqueue(UserActivationJob.new(self.id), {:priority => 0, :run_at => (NOOSFERO_CONF['hours_until_user_activation_check'] || 72).hours.from_now}) | |
| 363 | 378 | end |
| 364 | 379 | end | ... | ... |
app/views/account/_login_form.html.erb
| 1 | 1 | <%= labelled_form_for :user, |
| 2 | 2 | :url => { :controller => 'account', :action => (params[:enterprise_code] ? 'activate_enterprise' : 'login') } do |f| %> |
| 3 | 3 | |
| 4 | -<%= f.text_field :login, | |
| 5 | - :id => ( lightbox? ? 'lightbox_' : '' ) + 'user_login', | |
| 6 | - :onchange => 'this.value = convToValidLogin( this.value )' %> | |
| 4 | +<%= f.text_field :login, :id => 'user_login', :onchange => 'this.value = convToValidLogin( this.value )' %> | |
| 7 | 5 | |
| 8 | -<%= f.password_field :password, | |
| 9 | - :id => ( lightbox? ? 'lightbox_' : '' ) + 'user_password' %> | |
| 6 | +<%= f.password_field :password, :id => 'user_password' %> | |
| 10 | 7 | |
| 11 | 8 | <% if params[:enterprise_code] %> |
| 12 | 9 | <%= hidden_field_tag :enterprise_code, params[:enterprise_code] %> |
| ... | ... | @@ -16,7 +13,7 @@ |
| 16 | 13 | |
| 17 | 14 | <% button_bar do %> |
| 18 | 15 | <%= submit_button( 'login', _('Log in') )%> |
| 19 | - <%= lightbox_close_button(_('Cancel')) if lightbox? %> | |
| 16 | + <%= modal_close_button _('Cancel') if request.xhr? %> | |
| 20 | 17 | <% end %> |
| 21 | 18 | |
| 22 | 19 | <% end %> | ... | ... |
app/views/account/_signup_form.html.erb
| ... | ... | @@ -16,7 +16,7 @@ |
| 16 | 16 | <input type="hidden" id="signup_time_key" name="signup_time_key" /> |
| 17 | 17 | <script type="text/javascript"> |
| 18 | 18 | jQuery.ajax({ |
| 19 | - type: "POST", | |
| 19 | + type: "GET", | |
| 20 | 20 | url: "<%= url_for :controller=>'account', :action=>'signup_time' %>", |
| 21 | 21 | dataType: 'json', |
| 22 | 22 | success: function(data) { | ... | ... |
app/views/account/activate_enterprise.html.erb
| ... | ... | @@ -7,8 +7,8 @@ |
| 7 | 7 | <p><%= _('Do you have a personal user account in the system?') %></p> |
| 8 | 8 | |
| 9 | 9 | <div id="enterprise-activation-create-user-or-login-button"> |
| 10 | - <%= button_to_function 'login', _('Yes'), "$('enterprise-activation-create-user-form').hide(); $('enterprise-activation-login-form').show()" %> | |
| 11 | - <%= button_to_function 'add', _('No'), "$('enterprise-activation-login-form').hide(); $('enterprise-activation-create-user-form').show()" %> | |
| 10 | + <%= button_to_function 'login', _('Yes'), "jQuery('#enterprise-activation-create-user-form').hide(); jQuery('#enterprise-activation-login-form').show()" %> | |
| 11 | + <%= button_to_function 'add', _('No'), "jQuery('#enterprise-activation-login-form').hide(); jQuery('#enterprise-activation-create-user-form').show()" %> | |
| 12 | 12 | </div> |
| 13 | 13 | |
| 14 | 14 | <div id="enterprise-activation-create-user-form" style="display: none"> | ... | ... |
app/views/account/index_anonymous.html.erb
| 1 | 1 | <h1><%= _('Identify yourself') %></h1> |
| 2 | 2 | |
| 3 | 3 | <p> |
| 4 | -<%= lightbox_link_to _('Login.'), { :controller => 'account', :action => 'login_popup' } %> | |
| 4 | +<%= modal_link_to _('Login.'), { :controller => 'account', :action => 'login_popup' } %> | |
| 5 | 5 | |
| 6 | 6 | <%= _('You need to login to be able to use all the features in this environment.') %> |
| 7 | 7 | </p> | ... | ... |
app/views/account/login.html.erb
| ... | ... | @@ -3,11 +3,11 @@ |
| 3 | 3 | <h2><%= _('Login') %></h2> |
| 4 | 4 | |
| 5 | 5 | <% @user ||= User.new %> |
| 6 | -<% is_thickbox ||= false %> | |
| 6 | +<% is_popin ||= false %> | |
| 7 | 7 | |
| 8 | 8 | <%= @message %> |
| 9 | 9 | |
| 10 | -<%= labelled_form_for :user, :url => login_url do |f| %> | |
| 10 | +<%= labelled_form_for :user, :url => login_url, :horizontal => true do |f| %> | |
| 11 | 11 | |
| 12 | 12 | <%= f.text_field :login, :id => 'main_user_login', :onchange => 'this.value = convToValidLogin( this.value )', :value => params[:userlogin] %> |
| 13 | 13 | |
| ... | ... | @@ -17,8 +17,8 @@ |
| 17 | 17 | |
| 18 | 18 | <% button_bar do %> |
| 19 | 19 | <%= submit_button( 'login', _('Log in') )%> |
| 20 | - <% if is_thickbox %> | |
| 21 | - <%= thickbox_close_button(_('Cancel')) %> | |
| 20 | + <% if is_popin %> | |
| 21 | + <%= modal_close_button(_('Cancel')) %> | |
| 22 | 22 | <% end %> |
| 23 | 23 | <% end %> |
| 24 | 24 | ... | ... |
app/views/account/login_block.html.erb
| ... | ... | @@ -20,9 +20,7 @@ |
| 20 | 20 | <% button_bar do %> |
| 21 | 21 | <%= submit_button( 'login', _('Log in') )%> |
| 22 | 22 | <% unless @plugins.dispatch(:allow_user_registration).include?(false) %> |
| 23 | - <%= link_to content_tag( 'span', _('New user') ), | |
| 24 | - { :controller => 'account', :action => 'signup' }, | |
| 25 | - :class => 'button with-text icon-add' %> | |
| 23 | + <%= button(:add, _('New user'), { :controller => 'account', :action => 'signup' }) %> | |
| 26 | 24 | <% end %> |
| 27 | 25 | <% end %> |
| 28 | 26 | ... | ... |
app/views/account/logout_popup.html.erb
app/views/admin_panel/set_portal_community.html.erb
| ... | ... | @@ -18,7 +18,7 @@ |
| 18 | 18 | <%= button 'ok', _('Enable'), {:action => 'manage_portal_community', :activate => 1} %> |
| 19 | 19 | <% end %> |
| 20 | 20 | <%= button 'folder', _('Select Portal Folders'), {:action => 'set_portal_folders'} %> |
| 21 | - <%= button 'edit', _('Define Amount by Folder'), {:action => 'set_portal_news_amount'} %> | |
| 21 | + <%= button 'edit', _('Define news amount on portal'), {:action => 'set_portal_news_amount'} %> | |
| 22 | 22 | <%= button 'delete', _('Remove'), { :action => 'unset_portal_community'} %> |
| 23 | 23 | <% end %> |
| 24 | 24 | <% end %> | ... | ... |
app/views/admin_panel/set_portal_news_amount.html.erb
| 1 | -<h1><%= _('News amount by folder') %></h1> | |
| 1 | +<h1><%= _('News amount on portal') %></h1> | |
| 2 | 2 | |
| 3 | 3 | <%= labelled_form_for :environment do |f| %> |
| 4 | 4 | |
| 5 | - <%= labelled_form_field _('Number of news'), select(:environment, :news_amount_by_folder, (1..10).to_a) %> | |
| 5 | + <%= labelled_form_field _('Number of highlighted news'), select(:environment, :highlighted_news_amount, (0..10).to_a) %> | |
| 6 | + <%= labelled_form_field _('Number of portal news'), select(:environment, :portal_news_amount, (0..10).to_a) %> | |
| 7 | + <%= labelled_form_field _('Number of news by folder'), select(:environment, :news_amount_by_folder, (1..10).to_a) %> | |
| 6 | 8 | |
| 7 | 9 | <% button_bar do %> |
| 8 | 10 | <%= submit_button(:save, _('Save')) %> | ... | ... |
app/views/blocks/login_block.html.erb
| ... | ... | @@ -6,7 +6,7 @@ |
| 6 | 6 | <li><%= link_to _('Homepage'), user.public_profile_url %></li> |
| 7 | 7 | </ul> |
| 8 | 8 | <div class="user-actions"> |
| 9 | - <%= link_to content_tag('span', _('Logout')), { :controller => 'account', :action => 'logout' }, :class => 'button with-text icon-menu-logout' %> | |
| 9 | + <%= button(:'menu-logout', _('Logout'), :controller => 'account', :action => 'logout') %> | |
| 10 | 10 | </div> |
| 11 | 11 | </div> |
| 12 | 12 | <% else %> | ... | ... |
app/views/blocks/profile_info_actions/_community.html.erb
| ... | ... | @@ -5,11 +5,11 @@ |
| 5 | 5 | <% if logged_in? %> |
| 6 | 6 | <% if profile.enable_contact? %> |
| 7 | 7 | <li> |
| 8 | - <%= link_to content_tag('span', _('Send an e-mail')), | |
| 9 | - { :profile => profile.identifier, | |
| 10 | - :controller => 'contact', | |
| 11 | - :action => 'new' }, | |
| 12 | - {:class => 'button with-text icon-menu-mail', :title => _('Send an e-mail to the administrators')} %> | |
| 8 | + <%= button(:'menu-mail', _('Send an e-mail'), | |
| 9 | + { :profile => profile.identifier, | |
| 10 | + :controller => 'contact', | |
| 11 | + :action => 'new' }, | |
| 12 | + { :title => _('Send an e-mail to the administrators')}) %> | |
| 13 | 13 | </li> |
| 14 | 14 | <% end %> |
| 15 | 15 | ... | ... |
app/views/blocks/profile_info_actions/_enterprise.html.erb
| 1 | 1 | <ul> |
| 2 | 2 | <%if logged_in? %> |
| 3 | 3 | <%if !user.favorite_enterprises.include?(profile) %> |
| 4 | - <li><%= link_to content_tag('span', _('Add as favorite')), { :profile => user.identifier, :controller => 'favorite_enterprises', :action => 'add', :id => profile.id }, :class => 'button with-text icon-add', :title => _('Add enterprise as favorite') %></li> | |
| 4 | + <li><%= button(:add, _('Add as favorite'), { :profile => user.identifier, :controller => 'favorite_enterprises', :action => 'add', :id => profile.id }, :title => _('Add enterprise as favorite')) %></li> | |
| 5 | 5 | <% end %> |
| 6 | 6 | <% end %> |
| 7 | 7 | <% if profile.enable_contact? %> |
| 8 | - <li> <%= link_to content_tag('span', _('Send an e-mail')), {:profile => profile.identifier, :controller => 'contact', :action => 'new'}, {:id => 'enterprise-contact-button', :class => 'button with-text icon-menu-mail'} %> </li> | |
| 8 | + <li><%= button(:'menu-mail', _('Send an e-mail'), {:profile => profile.identifier, :controller => 'contact', :action => 'new'}, {:id => 'enterprise-contact-button'} ) %></li> | |
| 9 | 9 | <% end %> |
| 10 | 10 | |
| 11 | 11 | <li><%= report_abuse(profile, :button) %></li> | ... | ... |
app/views/blocks/profile_info_actions/_join_leave_community.html.erb
| ... | ... | @@ -22,8 +22,6 @@ |
| 22 | 22 | <% end %> |
| 23 | 23 | <% end %> |
| 24 | 24 | <% else %> |
| 25 | - <%= link_to content_tag('span', _('Join')), profile.join_not_logged_url, | |
| 26 | - :class => 'button with-text icon-add', | |
| 27 | - :title => _('Join this community') %> | |
| 25 | + <%= button(:add, _('Join'), profile.join_not_logged_url, :title => _('Join this community')) %> | |
| 28 | 26 | <% end %> |
| 29 | 27 | </div> | ... | ... |
app/views/blocks/profile_info_actions/_person.html.erb
| ... | ... | @@ -8,7 +8,7 @@ |
| 8 | 8 | <% end %> |
| 9 | 9 | |
| 10 | 10 | <% if user.is_a_friend?(profile) && profile.enable_contact? %> |
| 11 | - <li> <%= link_to content_tag('span', _('Send an e-mail')), {:profile => profile.identifier, :controller => 'contact', :action => 'new'}, :class => 'button with-text icon-menu-mail' %> </li> | |
| 11 | + <li><%= button(:back, _('Send an e-mail'), {:profile => profile.identifier, :controller => 'contact', :action => 'new'}) %></li> | |
| 12 | 12 | <% end %> |
| 13 | 13 | |
| 14 | 14 | <li><%= report_abuse(profile, :button) %></li> | ... | ... |
app/views/box_organizer/_highlights_block.html.erb
| ... | ... | @@ -15,7 +15,7 @@ |
| 15 | 15 | </tbody> |
| 16 | 16 | </table> |
| 17 | 17 | |
| 18 | -<%= link_to(_('New highlight'), '#', :class => 'button icon-add with-text new-highlight-button')%> | |
| 18 | +<%= button(:add, _('New highlight'), '#', class: 'new-highlight-button') %> | |
| 19 | 19 | |
| 20 | 20 | <%= labelled_form_field _('Image transition:'), select('block', 'interval', [[_('No automatic transition'), 0]] + [1, 2, 3, 4, 5, 10, 20, 30, 60].map {|item| [n_('Every 1 second', 'Every %d seconds', item) % item, item]}) %> |
| 21 | 21 | ... | ... |
app/views/box_organizer/add_block.html.erb
app/views/box_organizer/edit.html.erb
app/views/box_organizer/index.html.erb
| 1 | 1 | <h1><%= _('Editing sideboxes')%></h1> |
| 2 | 2 | |
| 3 | 3 | <% button_bar :class=>'design-menu' do %> |
| 4 | - <%= colorbox_button('add', _('Add a block'), { :action => 'add_block' }) %> | |
| 4 | + <%= modal_button('add', _('Add a block'), { :action => 'add_block' }) %> | |
| 5 | 5 | <%= button(:back, _('Back to control panel'), :controller => (profile.nil? ? 'admin_panel': 'profile_editor')) %> |
| 6 | 6 | <% end %> | ... | ... |
app/views/box_organizer/move_block.rjs
app/views/chat/auto_connect_busy.html.erb
app/views/chat/auto_connect_online.html.erb
app/views/cms/_blog.html.erb
| ... | ... | @@ -10,7 +10,8 @@ |
| 10 | 10 | |
| 11 | 11 | <script type="text/javascript"> |
| 12 | 12 | function submit_button(index) { |
| 13 | - return $("article_slug").form.select("input.submit")[index]; | |
| 13 | + var form = $($("#article_slug")[0].form) | |
| 14 | + return form.find("input[type=submit]")[index]; | |
| 14 | 15 | } |
| 15 | 16 | function warn_value_change() { |
| 16 | 17 | show_warning('article-formitem', "slug-change-confirmation"); |
| ... | ... | @@ -23,7 +24,7 @@ |
| 23 | 24 | hide_warning('slug-change-confirmation'); |
| 24 | 25 | } |
| 25 | 26 | function no_change() { |
| 26 | - $("article_slug").value = $("old_article_slug").value; | |
| 27 | + jQuery("#article_slug").val(jQuery("#old_article_slug").val()); | |
| 27 | 28 | enable_button(submit_button(0)); |
| 28 | 29 | enable_button(submit_button(1)); |
| 29 | 30 | hide_warning('slug-change-confirmation'); |
| ... | ... | @@ -78,7 +79,7 @@ |
| 78 | 79 | <div id='fetch-external-feed'> |
| 79 | 80 | <% enabled = @article.external_feed && @article.external_feed.enabled %> |
| 80 | 81 | <% only_once = @article.external_feed ? @article.external_feed.only_once : true %> |
| 81 | - <%= labelled_check_box(_('Fetch posts from an external feed'), 'article[external_feed_builder][enabled]', 'true', enabled, {:onchange => "$('external-feed-options').toggle()"}) %> | |
| 82 | + <%= labelled_check_box(_('Fetch posts from an external feed'), 'article[external_feed_builder][enabled]', 'true', enabled, {:onchange => "jQuery('#external-feed-options').toggle()"}) %> | |
| 82 | 83 | <div id='external-feed-options' style="display: <%= enabled ? 'block' : 'none' %>"> |
| 83 | 84 | <%= efeed.hidden_field(:id) %> |
| 84 | 85 | <%= labelled_form_field( _('Feed address'), efeed.text_field(:address) ) %> | ... | ... |
app/views/cms/_upload_file.html.erb
app/views/cms/_upload_file_form.html.erb
| ... | ... | @@ -13,7 +13,7 @@ |
| 13 | 13 | <%= hidden_field_tag('back_to', @back_to) %> |
| 14 | 14 | |
| 15 | 15 | <% button_bar do %> |
| 16 | - <%= add_upload_file_field(_('More files'), {:size => size}) %> | |
| 16 | + <%= button_to_function :add, _('More files'), "add_new_file_fields()" %> | |
| 17 | 17 | <% if @back_to %> |
| 18 | 18 | <%= submit_button :save, _('Upload'), :cancel => @back_to %> |
| 19 | 19 | <% else %> | ... | ... |
app/views/cms/edit.html.erb
| ... | ... | @@ -28,7 +28,7 @@ |
| 28 | 28 | <% end %> |
| 29 | 29 | |
| 30 | 30 | <div style='float: right'> |
| 31 | - <%= lightbox_button :help, _('Why categorize?'), :action => 'why_categorize' %> | |
| 31 | + <%= modal_button :help, _('Why categorize?'), :action => 'why_categorize' %> | |
| 32 | 32 | </div> |
| 33 | 33 | |
| 34 | 34 | <%= select_categories(:article, _('Categorize your article')) %> | ... | ... |
app/views/cms/select_article_type.html.erb
app/views/cms/view.html.erb
| ... | ... | @@ -17,7 +17,7 @@ |
| 17 | 17 | <% button_bar(:style => 'margin-bottom: 1em;') do %> |
| 18 | 18 | <% parent_id = ((@article && @article.allow_children?) ? @article : nil) %> |
| 19 | 19 | |
| 20 | - <%= colorbox_button('new', _('New content'), :action => 'new', :parent_id => parent_id, :cms => true) %> | |
| 20 | + <%= modal_button('new', _('New content'), :action => 'new', :parent_id => parent_id, :cms => true) %> | |
| 21 | 21 | <%= button(:back, _('Back to control panel'), :controller => 'profile_editor', :action => "index") %> |
| 22 | 22 | <% end %> |
| 23 | 23 | ... | ... |
app/views/cms/why_categorize.html.erb
app/views/comment/_comment_actions.html.erb
| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | <% if !links_submenu.empty? %> |
| 3 | 3 | <div class="comment-actions"> |
| 4 | 4 | <li class="vcard"> |
| 5 | - <%= link_to(content_tag(:span, _('Contents menu')), '#', :onclick => "toggleSubmenu(this,'',#{CGI::escapeHTML(links_submenu.to_json)}); return false", :class => 'menu-submenu-trigger comment-trigger', :url => url) %> | |
| 5 | + <%= popover_menu(_('Contents menu'),'',links_submenu,:class => 'comment-trigger', :url => url) %> | |
| 6 | 6 | </li> |
| 7 | 7 | </div> |
| 8 | 8 | <% end %> | ... | ... |
app/views/comment/_comment_form.html.erb
| ... | ... | @@ -10,7 +10,7 @@ |
| 10 | 10 | <%= recaptcha_tags(:display => { :theme => 'clean' }, :ajax => true) %> |
| 11 | 11 | <% button_bar do %> |
| 12 | 12 | <%= button_to_function :add, _('Confirm'), "return false", :id => "confirm-captcha" %> |
| 13 | - <%= button_to_function :cancel, _('Cancel'), "jQuery.colorbox.close()" %> | |
| 13 | + <%= button_to_function :cancel, _('Cancel'), "noosfero.modal.close()" %> | |
| 14 | 14 | <% end %> |
| 15 | 15 | </div> |
| 16 | 16 | |
| ... | ... | @@ -31,10 +31,10 @@ function check_captcha(button, confirm_action) { |
| 31 | 31 | return true; |
| 32 | 32 | <% else %> |
| 33 | 33 | jQuery('#recaptcha-container').show(); |
| 34 | - jQuery.colorbox({ html: jQuery('#recaptcha-container').html(), maxWidth : '600px', maxHeight : '300px' }); | |
| 34 | + noosfero.modal.inline('#recaptcha-container', {maxWidth :'600px', maxHeight : '300px' }); | |
| 35 | 35 | jQuery('#confirm-captcha').unbind('click'); |
| 36 | 36 | jQuery('#confirm-captcha').bind('click', function() { |
| 37 | - jQuery.colorbox.close(); | |
| 37 | + noosfero.modal.close(); | |
| 38 | 38 | button.form.recaptcha_response_field.value = jQuery('#recaptcha_response_field').val(); |
| 39 | 39 | button.form.recaptcha_challenge_field.value = jQuery('#recaptcha_challenge_field').val(); |
| 40 | 40 | button.form.confirm.value = 'true'; |
| ... | ... | @@ -88,7 +88,7 @@ function check_captcha(button, confirm_action) { |
| 88 | 88 | <% if !edition_mode %> |
| 89 | 89 | <%= button :cancel, _('Cancel'), '', :id => 'cancel-comment' %> |
| 90 | 90 | <% else %> |
| 91 | - <%= button :cancel, _('Cancel'), '#', :onclick => "jQuery.colorbox.close();" %> | |
| 91 | + <%= button :cancel, _('Cancel'), '#', :onclick => "noosfero.modal.close();" %> | |
| 92 | 92 | <% end %> |
| 93 | 93 | <% end %> |
| 94 | 94 | <% end %> | ... | ... |
app/views/comment/notifier/mail_to_followers.html.erb
| ... | ... | @@ -1,22 +0,0 @@ |
| 1 | -<%= _('Hi!') %> | |
| 2 | - | |
| 3 | -<%= word_wrap(_('%{sender} (%{sender_link}) commented on the content "%{article_title}".') % { :sender => @sender, :sender_link => url_for(@sender_link), :article_title => @article_title }) %> | |
| 4 | - | |
| 5 | -<%= word_wrap(_('Title: %s') % @comment_title) if @comment_title %> | |
| 6 | - | |
| 7 | -<%= _("Comment:") %> | |
| 8 | -------------------------------------------------------------------------------- | |
| 9 | -<%= word_wrap(@comment_body) %> | |
| 10 | -------------------------------------------------------------------------------- | |
| 11 | - | |
| 12 | -<%= _('Click on the address below to view this comment:') %> | |
| 13 | -<%= url_for @comment_url %> | |
| 14 | - | |
| 15 | -<%= _('Click on the address below to cancel the notification of new comments:') %> | |
| 16 | -<%= url_for @unsubscribe_url %> | |
| 17 | - | |
| 18 | -<%= _("Greetings,") %> | |
| 19 | - | |
| 20 | --- | |
| 21 | -<%= _('%s team.') % @environment %> | |
| 22 | -<%= url_for @url %> |
app/views/comment/notifier/notification.text.erb
| ... | ... | @@ -1,19 +0,0 @@ |
| 1 | -<%= _('Hi, %{recipient}!') % { :recipient => @recipient } %> | |
| 2 | - | |
| 3 | -<%= word_wrap(_('%{sender} (%{sender_link}) created a new comment on your article "%{article_title}".') % { :sender => @sender, :sender_link => url_for(@sender_link), :article_title => @article_title }) %> | |
| 4 | - | |
| 5 | -<%= word_wrap(_('Title: %s') % @comment_title) %> | |
| 6 | - | |
| 7 | -<%= _("Comment:") %> | |
| 8 | -------------------------------------------------------------------------------- | |
| 9 | -<%= word_wrap(@comment_body) %> | |
| 10 | -------------------------------------------------------------------------------- | |
| 11 | - | |
| 12 | -<%= _('Access the address below to view this comment:') %> | |
| 13 | -<%= url_for @comment_url %> | |
| 14 | - | |
| 15 | -<%= _("Greetings,") %> | |
| 16 | - | |
| 17 | --- | |
| 18 | -<%= _('%s team.') % @environment %> | |
| 19 | -<%= url_for @url %> |
| ... | ... | @@ -0,0 +1,22 @@ |
| 1 | +<%= _('Hi!') %> | |
| 2 | + | |
| 3 | +<%= word_wrap(_('%{sender} (%{sender_link}) commented on the content "%{article_title}".') % { :sender => @sender, :sender_link => url_for(@sender_link), :article_title => @article_title }) %> | |
| 4 | + | |
| 5 | +<%= word_wrap(_('Title: %s') % @comment_title) if @comment_title %> | |
| 6 | + | |
| 7 | +<%= _("Comment:") %> | |
| 8 | +------------------------------------------------------------------------------- | |
| 9 | +<%= word_wrap(@comment_body) %> | |
| 10 | +------------------------------------------------------------------------------- | |
| 11 | + | |
| 12 | +<%= _('Click on the address below to view this comment:') %> | |
| 13 | +<%= url_for @comment_url %> | |
| 14 | + | |
| 15 | +<%= _('Click on the address below to cancel the notification of new comments:') %> | |
| 16 | +<%= url_for @unsubscribe_url %> | |
| 17 | + | |
| 18 | +<%= _("Greetings,") %> | |
| 19 | + | |
| 20 | +-- | |
| 21 | +<%= _('%s team.') % @environment %> | |
| 22 | +<%= url_for @url %> | ... | ... |
| ... | ... | @@ -0,0 +1,19 @@ |
| 1 | +<%= _('Hi, %{recipient}!') % { :recipient => @recipient } %> | |
| 2 | + | |
| 3 | +<%= word_wrap(_('%{sender} (%{sender_link}) created a new comment on your article "%{article_title}".') % { :sender => @sender, :sender_link => url_for(@sender_link), :article_title => @article_title }) %> | |
| 4 | + | |
| 5 | +<%= word_wrap(_('Title: %s') % @comment_title) %> | |
| 6 | + | |
| 7 | +<%= _("Comment:") %> | |
| 8 | +------------------------------------------------------------------------------- | |
| 9 | +<%= word_wrap(@comment_body) %> | |
| 10 | +------------------------------------------------------------------------------- | |
| 11 | + | |
| 12 | +<%= _('Access the address below to view this comment:') %> | |
| 13 | +<%= url_for @comment_url %> | |
| 14 | + | |
| 15 | +<%= _("Greetings,") %> | |
| 16 | + | |
| 17 | +-- | |
| 18 | +<%= _('%s team.') % @environment %> | |
| 19 | +<%= url_for @url %> | ... | ... |
app/views/content_viewer/_article_toolbar.html.erb
| ... | ... | @@ -26,14 +26,14 @@ |
| 26 | 26 | <%= expirable_button @page, :locale, content, url %> |
| 27 | 27 | <% end %> |
| 28 | 28 | |
| 29 | - <%= colorbox_button(:new, label_for_new_article(@page), profile.admin_url.merge(:controller => 'cms', :action => 'new', :parent_id => (@page.folder? ? @page : (@page.parent.nil? ? nil : @page.parent)))) unless remove_content_button(:new, @page) %> | |
| 29 | + <%= modal_button(:new, label_for_new_article(@page), profile.admin_url.merge(:controller => 'cms', :action => 'new', :parent_id => (@page.folder? ? @page : (@page.parent.nil? ? nil : @page.parent)))) unless remove_content_button(:new, @page) %> | |
| 30 | 30 | <% end %> |
| 31 | 31 | |
| 32 | 32 | <% if @page.accept_uploads? && @page.allow_create?(user) %> |
| 33 | 33 | <%= button('upload-file', _('Upload files'), profile.admin_url.merge(:controller => 'cms', :action => 'upload_files', :parent_id => (@page.folder? ? @page : @page.parent))) unless remove_content_button(:upload, @page)%> |
| 34 | 34 | <% end %> |
| 35 | 35 | |
| 36 | - <% if !@page.allow_create?(user) && profile.community? && (@page.blog? || @page.parent && @page.parent.blog?) && !remove_content_button(:suggest, @page) %> | |
| 36 | + <% if !@page.allow_create?(user) && profile.organization? && (@page.blog? || @page.parent && @page.parent.blog?) && !remove_content_button(:suggest, @page) %> | |
| 37 | 37 | <% content = content_tag( 'span', _('Suggest an article') ) %> |
| 38 | 38 | <% url = profile.admin_url.merge({ :controller => 'cms', :action => 'suggest_an_article'}) %> |
| 39 | 39 | <% options = {:id => 'suggest-article-link'} %> | ... | ... |
app/views/content_viewer/_comment_form.html.erb
| ... | ... | @@ -7,10 +7,10 @@ function submit_comment_form(button) { |
| 7 | 7 | return true; |
| 8 | 8 | <% else %> |
| 9 | 9 | jQuery('#recaptcha-container').show(); |
| 10 | - jQuery.colorbox({ inline : true, href : '#recaptcha-container', maxWidth : '600px', maxHeight : '300px' }); | |
| 10 | + noosfero.modal.inline('#recaptcha-container', {maxWidth :'600px', maxHeight : '300px' }); | |
| 11 | 11 | jQuery('#confirm-captcha').unbind('click'); |
| 12 | 12 | jQuery('#confirm-captcha').bind('click', function() { |
| 13 | - jQuery.colorbox.close(); | |
| 13 | + noosfero.modal.close(); | |
| 14 | 14 | button.form.recaptcha_response_field.value = jQuery('#recaptcha_response_field').val(); |
| 15 | 15 | button.form.recaptcha_challenge_field.value = jQuery('#recaptcha_challenge_field').val(); |
| 16 | 16 | button.form.confirm.value = 'true'; |
| ... | ... | @@ -38,7 +38,7 @@ function submit_comment_form(button) { |
| 38 | 38 | <%= recaptcha_tags(:display => { :theme => 'clean' }, :ajax => true) %> |
| 39 | 39 | <% button_bar do %> |
| 40 | 40 | <%= button_to_function :add, _('Confirm'), "return false", :id => "confirm-captcha" %> |
| 41 | - <%= button_to_function :cancel, _('Cancel'), "jQuery.colorbox.close()" %> | |
| 41 | + <%= button_to_function :cancel, _('Cancel'), "noosfero.modal.close()" %> | |
| 42 | 42 | <% end %> |
| 43 | 43 | </div> |
| 44 | 44 | ... | ... |
app/views/events/_month.html.erb
| ... | ... | @@ -13,8 +13,8 @@ |
| 13 | 13 | date.day, |
| 14 | 14 | :url => {:action => 'events_by_day', :year => date.year, :month => date.month, :day => date.day, :category_id => @category_id}, |
| 15 | 15 | :update => 'events-of-the-day', |
| 16 | - :loading => "$('events-of-the-day').addClassName('loading')", | |
| 17 | - :complete => "$('events-of-the-day').removeClassName('loading')" | |
| 16 | + :loading => "jQuery('#events-of-the-day').addClass('loading')", | |
| 17 | + :complete => "jQuery('#events-of-the-day').removeClass('loading')" | |
| 18 | 18 | ) : |
| 19 | 19 | date.day |
| 20 | 20 | %> | ... | ... |
app/views/favorite_enterprises/index.html.erb
| ... | ... | @@ -9,10 +9,7 @@ |
| 9 | 9 | enterprise.identifier, :class => 'profile-link' %> |
| 10 | 10 | <%# profile_image_link enterprise, :portrait, 'div' %> |
| 11 | 11 | <div class="controll"> |
| 12 | - <%= link_to content_tag('span',_('remove')), | |
| 13 | - { :action => 'remove', :id => enterprise.id }, | |
| 14 | - :class => 'button icon-delete', | |
| 15 | - :title => _('remove') %> | |
| 12 | + <%= button(:delete, _('remove'), { :action => 'remove', :id => enterprise.id },:title => _('remove')) %> | |
| 16 | 13 | </div><!-- end class="controll" --> |
| 17 | 14 | </li> |
| 18 | 15 | <% end %> | ... | ... |
app/views/invite/_select_address_book.html.erb
| ... | ... | @@ -12,16 +12,16 @@ |
| 12 | 12 | |
| 13 | 13 | <script type="text/javascript"> |
| 14 | 14 | function hide_invite_friend_login_password() { |
| 15 | - $('invite-friends-login-password').hide(); | |
| 15 | + jQuery('#invite-friends-login-password').hide(); | |
| 16 | 16 | } |
| 17 | 17 | function show_invite_friend_login_password(option) { |
| 18 | 18 | if (option == 'hotmail') { |
| 19 | - $('hotmail_username_tip').show(); | |
| 19 | + jQuery('#hotmail_username_tip').show(); | |
| 20 | 20 | } else { |
| 21 | - $('hotmail_username_tip').hide(); | |
| 21 | + jQuery('#hotmail_username_tip').hide(); | |
| 22 | 22 | } |
| 23 | - $('invite-friends-login-password').show(); | |
| 24 | - $('login').focus(); | |
| 23 | + jQuery('#invite-friends-login-password').show(); | |
| 24 | + jQuery('#login').focus(); | |
| 25 | 25 | } |
| 26 | 26 | </script> |
| 27 | 27 | <div id='invite-friends-login-password' <%= "style='display: none;'" if (@import_from == 'manual') %>> | ... | ... |
app/views/invite/select_friends.html.erb
| ... | ... | @@ -24,8 +24,8 @@ |
| 24 | 24 | </div> |
| 25 | 25 | <% if @import_from != 'manual' %> |
| 26 | 26 | <div> |
| 27 | - <%= link_to_function _('Check all'), "$$('input.contact_to_invite').each(function(checkbox) { checkbox.checked = true; });" %> | |
| 28 | - <%= link_to_function _('Uncheck all'), "$$('input.contact_to_invite').each(function(checkbox) { checkbox.checked = false; });" %> | |
| 27 | + <%= link_to_function _('Check all'), "jQuery('input.contact_to_invite').each(function(index,checkbox) { checkbox.checked = true; });" %> | |
| 28 | + <%= link_to_function _('Uncheck all'), "jQuery('input.contact_to_invite').each(function(index,checkbox) { checkbox.checked = false; });" %> | |
| 29 | 29 | <div id='contacts-list'></div> |
| 30 | 30 | </div> |
| 31 | 31 | <% end -%> | ... | ... |
app/views/layouts/_javascript.html.erb
| 1 | -<%= javascript_include_tag 'prototype.js', 'effects.js', 'dragdrop.js', 'controls.js', | |
| 2 | -'jquery-2.1.1.min', 'jquery-migrate-1.2.1', | |
| 3 | -'jquery.noconflict.js', 'jquery.cycle.all.min.js', 'thickbox.js', 'lightbox', 'colorbox', | |
| 4 | -'jquery-ui-1.10.4/js/jquery-ui-1.10.4.min', 'jquery.scrollTo', 'jquery.form.js', 'jquery-validation/jquery.validate', | |
| 5 | -'jquery.cookie', 'jquery.ba-bbq.min.js', 'reflection', 'jquery.tokeninput', 'jquery.typewatch', 'jquery.textchange', | |
| 6 | -'add-and-join', 'report-abuse', 'catalog', 'manage-products', 'autogrow', 'select-or-die/_src/selectordie', | |
| 7 | -'jquery-timepicker-addon/dist/jquery-ui-timepicker-addon', 'application.js', 'rails.js', 'inputosaurus.js', :cache => 'cache/application' %> | |
| 1 | +<%= javascript_include_tag 'jquery-2.1.1.min', 'jquery-migrate-1.2.1', 'jrails', 'rails.js', | |
| 2 | + 'jquery.cycle.all.min.js', 'jquery.colorbox-min.js', | |
| 3 | + 'jquery-ui-1.10.4/js/jquery-ui-1.10.4.min', 'jquery.scrollTo', 'jquery.form.js', 'jquery-validation/jquery.validate', | |
| 4 | + 'jquery.cookie', 'jquery.ba-bbq.min.js', 'reflection', 'jquery.tokeninput', 'jquery.typewatch', 'jquery.textchange', | |
| 5 | + 'jquery-timepicker-addon/dist/jquery-ui-timepicker-addon', 'inputosaurus.js', 'select-or-die/_src/selectordie', | |
| 6 | + # noosfero libraries | |
| 7 | + 'application.js', 'modal.js', | |
| 8 | + 'add-and-join', 'report-abuse', 'catalog', 'manage-products', 'autogrow', | |
| 9 | + :cache => 'cache/application' %> | |
| 8 | 10 | |
| 9 | 11 | <% language = FastGettext.locale %> |
| 10 | 12 | <% %w{messages methods}.each do |type| %> | ... | ... |
app/views/layouts/_user.html.erb
| ... | ... | @@ -7,11 +7,11 @@ |
| 7 | 7 | </span> |
| 8 | 8 | <% else %> |
| 9 | 9 | <span class='not-logged-in'> |
| 10 | - <%= _("<span class='login'>%s</span>") % thickbox_inline_popup_link('<i class="icon-menu-login"></i><strong>' + _('Login') + '</strong>', login_url, 'inlineLoginBox', :id => 'link_login') %> | |
| 10 | + <%= _("<span class='login'>%s</span>") % modal_inline_link_to('<i class="icon-menu-login"></i><strong>' + _('Login') + '</strong>', login_url, '#inlineLoginBox', :id => 'link_login') %> | |
| 11 | 11 | <%= @plugins.dispatch(:alternative_authentication_link).collect { |content| instance_exec(&content) }.join("") %> |
| 12 | 12 | |
| 13 | 13 | <div id='inlineLoginBox' style='display: none;'> |
| 14 | - <%= render :file => 'account/login', :locals => { :is_thickbox => true } %> | |
| 14 | + <%= render :file => 'account/login', :locals => { :is_popin => true } %> | |
| 15 | 15 | </div> |
| 16 | 16 | |
| 17 | 17 | <% unless @plugins.dispatch(:allow_user_registration).include?(false) %> | ... | ... |
app/views/layouts/application-ng.html.erb
| ... | ... | @@ -5,12 +5,10 @@ |
| 5 | 5 | <%= yield(:feeds) %> |
| 6 | 6 | <!--<meta http-equiv="refresh" content="1"/>--> |
| 7 | 7 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> |
| 8 | - <meta name="description" content="<%= @environment.name %>" /> | |
| 9 | 8 | |
| 10 | - <!-- Twitter Card --> | |
| 11 | - <meta name="twitter:card" value="summary"> | |
| 12 | - <meta name="twitter:title" content="<%= h page_title %>"> | |
| 13 | - <meta name="twitter:description" content="<%= meta_description_tag(@page) %>"> | |
| 9 | + <% unless defined? MetadataPlugin and environment.enabled_plugins.include? 'MetadataPlugin' %> | |
| 10 | + <meta name="description" content="<%= @environment.name %>" /> | |
| 11 | + <% end %> | |
| 14 | 12 | |
| 15 | 13 | <!-- site root --> |
| 16 | 14 | <meta property="noosfero:root" content="<%= Noosfero.root %>"/> |
| ... | ... | @@ -23,7 +21,7 @@ |
| 23 | 21 | <%= yield :head %> |
| 24 | 22 | <%= |
| 25 | 23 | @plugins.dispatch(:head_ending).map do |content| |
| 26 | - if content.respond_to?(:call) then instance_exec(&content).html_safe else content.html_safe end | |
| 24 | + if content.respond_to?(:call) then instance_exec(&content).to_s.html_safe else content.to_s.html_safe end | |
| 27 | 25 | end.join("\n") |
| 28 | 26 | %> |
| 29 | 27 | |
| ... | ... | @@ -37,7 +35,7 @@ |
| 37 | 35 | |
| 38 | 36 | <%= |
| 39 | 37 | @plugins.dispatch(:body_beginning).map do |content| |
| 40 | - if content.respond_to?(:call) then instance_exec(&content).html_safe else content.html_safe end | |
| 38 | + if content.respond_to?(:call) then instance_exec(&content).to_s.html_safe else content.to_s.html_safe end | |
| 41 | 39 | end.join("\n") |
| 42 | 40 | %> |
| 43 | 41 | |
| ... | ... | @@ -61,7 +59,7 @@ |
| 61 | 59 | </div><!-- end id="content" --> |
| 62 | 60 | </div><!-- end id="wrap-2" --> |
| 63 | 61 | </div><!-- end id="wrap-1" --> |
| 64 | - <%= render_environment_features(:logged_in) %> | |
| 62 | + <%= render_environment_features(:logged_in) if logged_in? %> | |
| 65 | 63 | <div id="theme-footer"> |
| 66 | 64 | <%= theme_footer %> |
| 67 | 65 | </div><!-- end id="theme-footer" --> | ... | ... |