Commit 199fc3b7089e8c235f0a7e5b16ac922d36f134fd
Exists in
staging
and in
7 other branches
app/views/tasks/index.html.erb
Showing
405 changed files
with
39044 additions
and
10438 deletions
Show diff stats
Too many changes.
To preserve performance only 100 of 405 files displayed.
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,19 +11,15 @@ 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 | -gem 'nokogiri', '~> 1.6.0' | |
| 14 | +gem 'nokogiri', '~> 1.5.5' | |
| 18 | 15 | gem 'rake', :require => false |
| 19 | 16 | gem 'grape', '~> 0.2.1' |
| 20 | 17 | gem 'rest-client', '~> 1.6.7' |
| 21 | 18 | gem 'exception_notification', '~> 4.0.1' |
| 22 | 19 | gem 'gettext', '~> 2.2.1', :require => false, :group => :development |
| 23 | 20 | gem 'locale', '~> 2.0.5' |
| 24 | - | |
| 25 | 21 | gem 'whenever', :require => false |
| 26 | - | |
| 27 | -# FIXME list here all actual dependencies (i.e. the ones in debian/control), | |
| 28 | -# with their GEM names (not the Debian package names) | |
| 22 | +gem 'eita-jrails', '>= 0.9.5', :require => 'jrails' | |
| 29 | 23 | |
| 30 | 24 | group :production do |
| 31 | 25 | gem 'dalli', '~> 2.7.0' |
| ... | ... | @@ -45,6 +39,9 @@ group :cucumber do |
| 45 | 39 | gem 'selenium-webdriver', '~> 2.39.0' |
| 46 | 40 | end |
| 47 | 41 | |
| 42 | +# Requires custom dependencies | |
| 43 | +eval(File.read('config/Gemfile'), binding) rescue nil | |
| 44 | + | |
| 48 | 45 | # include gemfiles from enabled plugins |
| 49 | 46 | # plugins in baseplugins/ are not included on purpose. They should not have any |
| 50 | 47 | # 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,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
| ... | ... | @@ -33,6 +33,7 @@ class ApplicationController < ActionController::Base |
| 33 | 33 | unless environment.access_control_allow_methods.blank? |
| 34 | 34 | response.headers["Access-Control-Allow-Methods"] = environment.access_control_allow_methods |
| 35 | 35 | end |
| 36 | + response.headers["Access-Control-Allow-Credentials"] = 'true' | |
| 36 | 37 | elsif environment.restrict_to_access_control_origins |
| 37 | 38 | render_access_denied _('Origin not in allowed.') |
| 38 | 39 | end |
| ... | ... | @@ -64,15 +65,7 @@ class ApplicationController < ActionController::Base |
| 64 | 65 | helper :document |
| 65 | 66 | helper :language |
| 66 | 67 | |
| 67 | - def self.no_design_blocks | |
| 68 | - @no_design_blocks = true | |
| 69 | - end | |
| 70 | - def self.uses_design_blocks? | |
| 71 | - !@no_design_blocks | |
| 72 | - end | |
| 73 | - def uses_design_blocks? | |
| 74 | - !@no_design_blocks && self.class.uses_design_blocks? | |
| 75 | - end | |
| 68 | + include DesignHelper | |
| 76 | 69 | |
| 77 | 70 | # Be sure to include AuthenticationSystem in Application Controller instead |
| 78 | 71 | include AuthenticatedSystem | ... | ... |
app/controllers/my_profile/profile_design_controller.rb
| ... | ... | @@ -8,7 +8,7 @@ class ProfileDesignController < BoxOrganizerController |
| 8 | 8 | |
| 9 | 9 | def protect_fixed_block |
| 10 | 10 | block = boxes_holder.blocks.find(params[:id].gsub(/^block-/, '')) |
| 11 | - if block.fixed && !current_person.is_admin? | |
| 11 | + if !block.nil? && block.fixed && !current_person.is_admin? | |
| 12 | 12 | render_access_denied |
| 13 | 13 | end |
| 14 | 14 | end | ... | ... |
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) |
| ... | ... | @@ -51,18 +77,28 @@ class ChatController < PublicController |
| 51 | 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}) |
| 52 | 78 | end |
| 53 | 79 | |
| 54 | - messages = messages.order('created_at DESC').includes(:to, :from).limit(20) | |
| 80 | + messages = messages.order('created_at DESC').includes(:to, :from).offset(params[:offset]).limit(20) | |
| 55 | 81 | messages_json = messages.map do |message| |
| 56 | 82 | { |
| 57 | 83 | :body => message.body, |
| 58 | - :to => {:id => message.to.identifier, :name => message.to.name, :type => message.to.type}, | |
| 59 | - :from => {:id => message.from.identifier, :name => message.from.name, :type => message.from.type}, | |
| 84 | + :to => {:id => message.to.identifier, :name => message.to.name}, | |
| 85 | + :from => {:id => message.from.identifier, :name => message.from.name}, | |
| 60 | 86 | :created_at => message.created_at |
| 61 | 87 | } |
| 62 | 88 | end |
| 63 | 89 | render :json => messages_json.reverse |
| 64 | 90 | end |
| 65 | 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 | + | |
| 66 | 102 | protected |
| 67 | 103 | |
| 68 | 104 | def check_environment_feature | ... | ... |
app/controllers/public/contact_controller.rb
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 |
| ... | ... | @@ -399,17 +393,6 @@ class ProfileController < PublicController |
| 399 | 393 | end |
| 400 | 394 | end |
| 401 | 395 | |
| 402 | - def private_profile | |
| 403 | - private_profile_partial_parameters | |
| 404 | - render :action => 'index', :status => 403 | |
| 405 | - end | |
| 406 | - | |
| 407 | - def invisible_profile | |
| 408 | - unless profile.is_template? | |
| 409 | - render_access_denied(_("This profile is inaccessible. You don't have the permission to view the content here."), _("Oops ... you cannot go ahead here")) | |
| 410 | - end | |
| 411 | - end | |
| 412 | - | |
| 413 | 396 | def per_page |
| 414 | 397 | Noosfero::Constants::PROFILE_PER_PAGE |
| 415 | 398 | end | ... | ... |
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 | |
| ... | ... | @@ -1408,16 +1414,16 @@ module ApplicationHelper |
| 1408 | 1414 | end |
| 1409 | 1415 | |
| 1410 | 1416 | def convert_macro(html, source) |
| 1411 | - doc = Hpricot(html) | |
| 1417 | + doc = Nokogiri::HTML.fragment html | |
| 1412 | 1418 | #TODO This way is more efficient but do not support macro inside of |
| 1413 | 1419 | # macro. You must parse them from the inside-out in order to enable |
| 1414 | 1420 | # that. |
| 1415 | - doc.search('.macro').each do |macro| | |
| 1421 | + doc.css('.macro').each do |macro| | |
| 1416 | 1422 | macro_name = macro['data-macro'] |
| 1417 | 1423 | result = @plugins.parse_macro(macro_name, macro, source) |
| 1418 | 1424 | macro.inner_html = result.kind_of?(Proc) ? self.instance_exec(&result) : result |
| 1419 | 1425 | end |
| 1420 | - doc.html | |
| 1426 | + doc.to_html | |
| 1421 | 1427 | end |
| 1422 | 1428 | |
| 1423 | 1429 | 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 | |
| ... | ... | @@ -171,7 +191,7 @@ module BoxesHelper |
| 171 | 191 | "before-block-#{block.id}" |
| 172 | 192 | end |
| 173 | 193 | if block.nil? or modifiable?(block) |
| 174 | - content_tag('div', ' ', :id => id, :class => 'block-target' ) + drop_receiving_element(id, :url => { :action => 'move_block', :target => id }, :accept => box.acceptable_blocks, :hoverclass => 'block-target-hover') | |
| 194 | + content_tag('div', ' ', :id => id, :class => 'block-target' ) + drop_receiving_element(id, :url => { :action => 'add_or_move_block', :target => id }, :accept => box.acceptable_blocks, :hoverclass => 'block-target-hover') | |
| 175 | 195 | else |
| 176 | 196 | "" |
| 177 | 197 | end |
| ... | ... | @@ -204,14 +224,14 @@ module BoxesHelper |
| 204 | 224 | # FIXME too much hardcoded stuff |
| 205 | 225 | if holder.layout_template == 'default' |
| 206 | 226 | if block.box.position == 2 # area 2, left side => move to right side |
| 207 | - buttons << icon_button('right', _('Move to the opposite side'), { :action => 'move_block', :target => 'end-of-box-' + holder.boxes[2].id.to_s, :id => block.id }, :method => 'post' ) | |
| 227 | + buttons << icon_button('right', _('Move to the opposite side'), { :action => 'add_or_move_block', :target => 'end-of-box-' + holder.boxes[2].id.to_s, :id => block.id }, :method => 'post' ) | |
| 208 | 228 | elsif block.box.position == 3 # area 3, right side => move to left side |
| 209 | - buttons << icon_button('left', _('Move to the opposite side'), { :action => 'move_block', :target => 'end-of-box-' + holder.boxes[1].id.to_s, :id => block.id }, :method => 'post' ) | |
| 229 | + buttons << icon_button('left', _('Move to the opposite side'), { :action => 'add_or_move_block', :target => 'end-of-box-' + holder.boxes[1].id.to_s, :id => block.id }, :method => 'post' ) | |
| 210 | 230 | end |
| 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', user.name) + 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/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,14 @@ 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 | + MONTHS = I18n.t('date.month_names') | |
| 6 | + | |
| 7 | + def month_name(n, abbreviated = false) | |
| 8 | + if abbreviated | |
| 9 | + I18n.t('date.abbr_month_names')[n] | |
| 10 | + else | |
| 11 | + MONTHS[n] | |
| 12 | + end | |
| 23 | 13 | end |
| 24 | 14 | |
| 25 | 15 | # formats a date for displaying. |
| ... | ... | @@ -91,15 +81,7 @@ module DatesHelper |
| 91 | 81 | _(date.strftime("%a")) |
| 92 | 82 | else |
| 93 | 83 | # 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]) | |
| 84 | + I18n.t('date.day_names')[date.wday] | |
| 103 | 85 | end |
| 104 | 86 | end |
| 105 | 87 | |
| ... | ... | @@ -111,7 +93,7 @@ module DatesHelper |
| 111 | 93 | date = date << 1 |
| 112 | 94 | end |
| 113 | 95 | if opts[:only_month] |
| 114 | - _('%{month}') % {:month => month_name(date.month.to_i) } | |
| 96 | + _('%{month}') % { :month => month_name(date.month.to_i) } | |
| 115 | 97 | else |
| 116 | 98 | _('%{month} %{year}') % { :year => date.year, :month => month_name(date.month.to_i) } |
| 117 | 99 | end |
| ... | ... | @@ -156,7 +138,7 @@ module DatesHelper |
| 156 | 138 | else |
| 157 | 139 | order = [:day, :month, :year] |
| 158 | 140 | end |
| 159 | - date_select(object, method, html_options.merge(options.merge(:include_blank => true, :order => order, :use_month_names => MONTHS.map {|item| gettext(item)}))) | |
| 141 | + date_select(object, method, html_options.merge(options.merge(:include_blank => true, :order => order, :use_month_names => MONTHS))) | |
| 160 | 142 | end |
| 161 | 143 | |
| 162 | 144 | 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,8 +45,6 @@ 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', |
| ... | ... | @@ -88,6 +86,7 @@ module LayoutHelper |
| 88 | 86 | end |
| 89 | 87 | end |
| 90 | 88 | |
| 89 | + | |
| 91 | 90 | def icon_theme_stylesheet_path |
| 92 | 91 | icon_themes = [] |
| 93 | 92 | theme_icon_themes = theme_option(:icon_theme) || [] |
| ... | ... | @@ -118,8 +117,5 @@ module LayoutHelper |
| 118 | 117 | end |
| 119 | 118 | end |
| 120 | 119 | |
| 121 | - def meta_description_tag(article=nil) | |
| 122 | - article ? CGI.escapeHTML(truncate(strip_tags(article.body.to_s), :length => 200)) : environment.name | |
| 123 | - end | |
| 124 | 120 | end |
| 125 | 121 | ... | ... |
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/article.rb
| 1 | -require 'hpricot' | |
| 2 | 1 | |
| 3 | 2 | class Article < ActiveRecord::Base |
| 4 | 3 | |
| ... | ... | @@ -400,6 +399,10 @@ class Article < ActiveRecord::Base |
| 400 | 399 | {} |
| 401 | 400 | end |
| 402 | 401 | |
| 402 | + def alternate_languages | |
| 403 | + self.translations.map(&:language) | |
| 404 | + end | |
| 405 | + | |
| 403 | 406 | scope :native_translations, :conditions => { :translation_of_id => nil } |
| 404 | 407 | |
| 405 | 408 | def translatable? |
| ... | ... | @@ -713,7 +716,7 @@ class Article < ActiveRecord::Base |
| 713 | 716 | end |
| 714 | 717 | |
| 715 | 718 | def first_paragraph |
| 716 | - paragraphs = Hpricot(to_html).search('p') | |
| 719 | + paragraphs = Nokogiri::HTML.fragment(to_html).css('p') | |
| 717 | 720 | paragraphs.empty? ? '' : paragraphs.first.to_html |
| 718 | 721 | end |
| 719 | 722 | |
| ... | ... | @@ -735,8 +738,8 @@ class Article < ActiveRecord::Base |
| 735 | 738 | |
| 736 | 739 | def body_images_paths |
| 737 | 740 | require 'uri' |
| 738 | - Hpricot(self.body.to_s).search('img[@src]').collect do |i| | |
| 739 | - (self.profile && self.profile.environment) ? URI.join(self.profile.environment.top_url, URI.escape(i.attributes['src'])).to_s : i.attributes['src'] | |
| 741 | + Nokogiri::HTML.fragment(self.body.to_s).css('img[src]').collect do |i| | |
| 742 | + (self.profile && self.profile.environment) ? URI.join(self.profile.environment.top_url, URI.escape(i['src'])).to_s : i['src'] | |
| 740 | 743 | end |
| 741 | 744 | end |
| 742 | 745 | |
| ... | ... | @@ -773,11 +776,11 @@ class Article < ActiveRecord::Base |
| 773 | 776 | end |
| 774 | 777 | |
| 775 | 778 | def first_image |
| 776 | - img = Hpricot(self.lead.to_s).search('img[@src]').first || Hpricot(self.body.to_s).search('img').first | |
| 777 | - img.nil? ? '' : img.attributes['src'] | |
| 779 | + img = Nokogiri::HTML.fragment(self.lead.to_s).css('img[src]').first || Nokogiri::HTML.fragment(self.body.to_s).search('img').first | |
| 780 | + img.nil? ? '' : img['src'] | |
| 778 | 781 | end |
| 779 | 782 | |
| 780 | - delegate :region, :region_id, :environment, :environment_id, :to => :profile, :allow_nil => true | |
| 783 | + delegate :lat, :lng, :region, :region_id, :environment, :environment_id, :to => :profile, :allow_nil => true | |
| 781 | 784 | |
| 782 | 785 | def has_macro? |
| 783 | 786 | 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
| ... | ... | @@ -150,11 +150,11 @@ class Comment < ActiveRecord::Base |
| 150 | 150 | def notify_by_mail |
| 151 | 151 | if source.kind_of?(Article) && article.notify_comments? |
| 152 | 152 | if !notification_emails.empty? |
| 153 | - Comment::Notifier.notification(self).deliver | |
| 153 | + CommentNotifier.notification(self).deliver | |
| 154 | 154 | end |
| 155 | 155 | emails = article.followers - [author_email] |
| 156 | 156 | if !emails.empty? |
| 157 | - Comment::Notifier.mail_to_followers(self, emails).deliver | |
| 157 | + CommentNotifier.mail_to_followers(self, emails).deliver | |
| 158 | 158 | end |
| 159 | 159 | end |
| 160 | 160 | 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, :disabled_blocks, :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 => ',' |
| ... | ... | @@ -292,8 +295,6 @@ class Environment < ActiveRecord::Base |
| 292 | 295 | |
| 293 | 296 | settings_items :enabled_plugins, :type => Array, :default => Noosfero::Plugin.available_plugin_names |
| 294 | 297 | |
| 295 | - settings_items :disabled_blocks, :type => Array, :default => [] | |
| 296 | - | |
| 297 | 298 | settings_items :search_hints, :type => Hash, :default => {} |
| 298 | 299 | |
| 299 | 300 | # Set to return http forbidden to host not on the allow origin list bellow |
| ... | ... | @@ -359,10 +360,6 @@ class Environment < ActiveRecord::Base |
| 359 | 360 | enabled_plugins.include?(plugin.to_s) |
| 360 | 361 | end |
| 361 | 362 | |
| 362 | - def block_disabled?(block) | |
| 363 | - disabled_blocks.include?(block.to_s) | |
| 364 | - end | |
| 365 | - | |
| 366 | 363 | # enables the features identified by <tt>features</tt>, which is expected to |
| 367 | 364 | # be an Enumarable object containing the identifiers of the desired features. |
| 368 | 365 | # Passing <tt>nil</tt> is the same as passing an empty Array. | ... | ... |
app/models/event.rb
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/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
| 1 | 1 | require 'digest/sha1' |
| 2 | 2 | require 'user_activation_job' |
| 3 | -require 'securerandom' | |
| 4 | 3 | |
| 5 | 4 | # User models the system users, and is generated by the acts_as_authenticated |
| 6 | 5 | # Rails generator. |
| ... | ... | @@ -55,7 +54,7 @@ class User < ActiveRecord::Base |
| 55 | 54 | |
| 56 | 55 | user.person = p |
| 57 | 56 | end |
| 58 | - if user.environment.enabled?('skip_new_user_email_confirmation') | |
| 57 | + if user.environment.enabled?('skip_new_user_email_confirmation') | |
| 59 | 58 | if user.environment.enabled?('admin_must_approve_new_users') |
| 60 | 59 | create_moderate_task |
| 61 | 60 | else |
| ... | ... | @@ -103,6 +102,7 @@ class User < ActiveRecord::Base |
| 103 | 102 | validates_length_of :email, :within => 3..100, :if => (lambda {|user| !user.email.blank?}) |
| 104 | 103 | validates_uniqueness_of :login, :email, :case_sensitive => false, :scope => :environment_id |
| 105 | 104 | before_save :encrypt_password |
| 105 | + before_save :normalize_email, if: proc{ |u| u.email.present? } | |
| 106 | 106 | validates_format_of :email, :with => Noosfero::Constants::EMAIL_FORMAT, :if => (lambda {|user| !user.email.blank?}) |
| 107 | 107 | |
| 108 | 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 |
| ... | ... | @@ -115,16 +115,8 @@ class User < ActiveRecord::Base |
| 115 | 115 | u && u.authenticated?(password) ? u : nil |
| 116 | 116 | end |
| 117 | 117 | |
| 118 | - #FIXME make this test | |
| 119 | - def generate_private_token! | |
| 120 | - self.private_token = SecureRandom.hex | |
| 121 | - self.private_token_generated_at = DateTime.now | |
| 122 | - save(:validate => false) | |
| 123 | - end | |
| 124 | - | |
| 125 | - #FIXME make this test | |
| 126 | - def private_token_expired? | |
| 127 | - self.generate_private_token! if self.private_token.nil? || (self.private_token_generated_at + 2.weeks < DateTime.now) | |
| 118 | + def register_login | |
| 119 | + self.update_attribute :last_login_at, Time.now | |
| 128 | 120 | end |
| 129 | 121 | |
| 130 | 122 | # Activates the user in the database. |
| ... | ... | @@ -344,7 +336,25 @@ class User < ActiveRecord::Base |
| 344 | 336 | @is_password_required = false |
| 345 | 337 | end |
| 346 | 338 | |
| 339 | + #FIXME make this test | |
| 340 | + def generate_private_token! | |
| 341 | + self.private_token = SecureRandom.hex | |
| 342 | + self.private_token_generated_at = DateTime.now | |
| 343 | + save(:validate => false) | |
| 344 | + end | |
| 345 | + | |
| 346 | + #FIXME make this test | |
| 347 | + def private_token_expired? | |
| 348 | + self.generate_private_token! if self.private_token.nil? || (self.private_token_generated_at + 2.weeks < DateTime.now) | |
| 349 | + end | |
| 350 | + | |
| 351 | + | |
| 347 | 352 | protected |
| 353 | + | |
| 354 | + def normalize_email | |
| 355 | + self.email = self.email.squish.downcase | |
| 356 | + end | |
| 357 | + | |
| 348 | 358 | # before filter |
| 349 | 359 | def encrypt_password |
| 350 | 360 | return if password.blank? |
| ... | ... | @@ -372,6 +382,6 @@ class User < ActiveRecord::Base |
| 372 | 382 | |
| 373 | 383 | def delay_activation_check |
| 374 | 384 | return if person.is_template? |
| 375 | - Delayed::Job.enqueue(UserActivationJob.new(self.id), {:priority => 0, :run_at => 72.hours.from_now}) | |
| 385 | + Delayed::Job.enqueue(UserActivationJob.new(self.id), {:priority => 0, :run_at => (NOOSFERO_CONF['hours_until_user_activation_check'] || 72).hours.from_now}) | |
| 376 | 386 | end |
| 377 | 387 | 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/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/edit.html.erb
app/views/box_organizer/move_block.rjs
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/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
| ... | ... | @@ -29,14 +29,14 @@ |
| 29 | 29 | <%= expirable_button @page, :locale, content, url %> |
| 30 | 30 | <% end %> |
| 31 | 31 | |
| 32 | - <%= 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) %> | |
| 32 | + <%= 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) %> | |
| 33 | 33 | <% end %> |
| 34 | 34 | |
| 35 | 35 | <% if @page.accept_uploads? && @page.allow_create?(user) %> |
| 36 | 36 | <%= 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)%> |
| 37 | 37 | <% end %> |
| 38 | 38 | |
| 39 | - <% if !@page.allow_create?(user) && profile.community? && (@page.blog? || @page.parent && @page.parent.blog?) && !remove_content_button(:suggest, @page) %> | |
| 39 | + <% if !@page.allow_create?(user) && profile.organization? && (@page.blog? || @page.parent && @page.parent.blog?) && !remove_content_button(:suggest, @page) %> | |
| 40 | 40 | <% content = content_tag( 'span', _('Suggest an article') ) %> |
| 41 | 41 | <% url = profile.admin_url.merge({ :controller => 'cms', :action => 'suggest_an_article'}) %> |
| 42 | 42 | <% 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
| ... | ... | @@ -7,11 +7,6 @@ |
| 7 | 7 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> |
| 8 | 8 | <meta name="description" content="<%= @environment.name %>" /> |
| 9 | 9 | |
| 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) %>"> | |
| 14 | - | |
| 15 | 10 | <!-- site root --> |
| 16 | 11 | <meta property="noosfero:root" content="<%= Noosfero.root %>"/> |
| 17 | 12 | |
| ... | ... | @@ -23,7 +18,7 @@ |
| 23 | 18 | <%= yield :head %> |
| 24 | 19 | <%= |
| 25 | 20 | @plugins.dispatch(:head_ending).map do |content| |
| 26 | - if content.respond_to?(:call) then instance_exec(&content).html_safe else content.html_safe end | |
| 21 | + if content.respond_to?(:call) then instance_exec(&content).to_s.html_safe else content.to_s.html_safe end | |
| 27 | 22 | end.join("\n") |
| 28 | 23 | %> |
| 29 | 24 | |
| ... | ... | @@ -37,7 +32,7 @@ |
| 37 | 32 | |
| 38 | 33 | <%= |
| 39 | 34 | @plugins.dispatch(:body_beginning).map do |content| |
| 40 | - if content.respond_to?(:call) then instance_exec(&content).html_safe else content.html_safe end | |
| 35 | + if content.respond_to?(:call) then instance_exec(&content).to_s.html_safe else content.to_s.html_safe end | |
| 41 | 36 | end.join("\n") |
| 42 | 37 | %> |
| 43 | 38 | |
| ... | ... | @@ -89,5 +84,57 @@ |
| 89 | 84 | </script> |
| 90 | 85 | <!-- End Piwik Code --> |
| 91 | 86 | |
| 87 | + <!-- Feedback --> | |
| 88 | + | |
| 89 | + <link href='//feedback.participa.br/assets/feedback.css' media='all' rel='stylesheet'> | |
| 90 | + <script src='//feedback.participa.br/assets/feedback_client.js'></script> | |
| 91 | + | |
| 92 | + <script type=text/javascript> | |
| 93 | + $(document).ready(function() { | |
| 94 | + Feedback( | |
| 95 | + { | |
| 96 | + label: "Dê um Feedback!", | |
| 97 | + header: "Registro do Feedback", | |
| 98 | + url: "//feedback.participa.br/api/v1/feedbacks?access_token=pINDdceSPik_4vRCleHTQg", | |
| 99 | + nextLabel: "Continuar", | |
| 100 | + reviewLabel: "Revisar", | |
| 101 | + sendLabel: "Enviar", | |
| 102 | + closeLabel: "Fechar", | |
| 103 | + highlightBlackoutHelp: "Você pode destacar informações úteis ou ocultar informações sensíveis.", | |
| 104 | + blackoutButtonLabel: "Ocultar", | |
| 105 | + highlightButtonLabel: "Destacar", | |
| 106 | + messageSuccess: "O seu relato foi enviado com sucesso!", | |
| 107 | + messageError: "Houve um erro ao enviar o feedback...", | |
| 108 | + pages: [ | |
| 109 | + new window.Feedback.Form([ | |
| 110 | + { | |
| 111 | + type: "select", | |
| 112 | + name: "tipo_relato", | |
| 113 | + label: "Tipo de Relato", | |
| 114 | + options: ["Sugestão", "Erro", "Elogio"], | |
| 115 | + required: true | |
| 116 | + }, | |
| 117 | + { | |
| 118 | + type: "starrating", | |
| 119 | + name: "starrating", | |
| 120 | + label: "Avalie", | |
| 121 | + options: ["1", "2", "3", "4", "5"], | |
| 122 | + required: true | |
| 123 | + }, | |
| 124 | + { | |
| 125 | + type: "textarea", | |
| 126 | + name: "observacao", | |
| 127 | + label: "Observação" | |
| 128 | + } | |
| 129 | + ] | |
| 130 | + ), | |
| 131 | + new window.Feedback.Screenshot(), | |
| 132 | + new window.Feedback.Review() | |
| 133 | + ] | |
| 134 | + }); | |
| 135 | + }); | |
| 136 | + | |
| 137 | + </script> | |
| 138 | + <!-- End Feedback Code --> | |
| 92 | 139 | </body> |
| 93 | 140 | </html> | ... | ... |
app/views/manage_products/_categories_for_selection.html.erb
| 1 | 1 | <%= select_for_categories(categories, level) %> |
| 2 | 2 | |
| 3 | 3 | <%= javascript_tag do %> |
| 4 | - jQuery('#categories_container_wrapper').scrollTo('100%', 1000) | |
| 5 | - $('selected_category_id').value = <%= @category && @category.id %> | |
| 6 | - $('hierarchy_navigation').update('<%= escape_javascript(hierarchy_category_navigation(@category, :make_links => true)) %>') | |
| 7 | - toggleDisabled(<%= @category && @category.accept_products? ? 'true' : 'false' %>, $('save_and_continue')) | |
| 4 | + jQuery(document).ready(function() { | |
| 5 | + jQuery('#categories_container_wrapper').scrollTo('100%', 1000) | |
| 6 | + jQuery('#selected_category_id').val(<%= @category.id rescue nil %>) | |
| 7 | + jQuery('#hierarchy_navigation').html(<%= hierarchy_category_navigation(@category, :make_links => true).to_json %>) | |
| 8 | + toggleDisabled(<%= (!!(@category && @category.accept_products?)).to_json %>, jQuery('#save_and_continue')) | |
| 9 | + }); | |
| 8 | 10 | <% end %> | ... | ... |
app/views/manage_products/_display_name.html.erb
| ... | ... | @@ -3,7 +3,7 @@ |
| 3 | 3 | <%= edit_product_link_to_remote(@product, 'name', _('Edit name and unit'), :title => _('Click here to edit the name of your product and the unit')) %> |
| 4 | 4 | </div> |
| 5 | 5 | <%= javascript_tag do %> |
| 6 | - $$('#display-product-category .hierarchy-category')[0].update('<%= | |
| 6 | + jQuery('#display-product-category .hierarchy-category').first().html('<%= | |
| 7 | 7 | escape_javascript(hierarchy_category_navigation( |
| 8 | 8 | @product.product_category, |
| 9 | 9 | :make_links => false, | ... | ... |
app/views/manage_products/new.html.erb
| ... | ... | @@ -26,5 +26,5 @@ |
| 26 | 26 | <% end %> |
| 27 | 27 | |
| 28 | 28 | <%= javascript_tag do %> |
| 29 | - toggleDisabled(<%= @category && @category.accept_products? ? 'true' : 'false' %>, $('save_and_continue')) | |
| 29 | + toggleDisabled(<%= @category && @category.accept_products? ? 'true' : 'false' %>, jQuery('#save_and_continue')[0]) | |
| 30 | 30 | <% end %> | ... | ... |
app/views/manage_products/show.html.erb
| ... | ... | @@ -24,6 +24,8 @@ |
| 24 | 24 | <br style='clear: both'/> |
| 25 | 25 | |
| 26 | 26 | <% unless !@allowed_user && (@product.description.blank? && @product.inputs.empty? && !@product.price_described? ) %> |
| 27 | + <% plugins_tabs = plugins_product_tabs %> | |
| 28 | + | |
| 27 | 29 | <div class='ui-tabs' id='product-<%= @product.id %>-tabs'> |
| 28 | 30 | <ul> |
| 29 | 31 | <% if !@product.description.blank? || @allowed_user %> |
| ... | ... | @@ -35,19 +37,32 @@ |
| 35 | 37 | <% if @product.price_described? || @allowed_user %> |
| 36 | 38 | <li class='tab'><a href='#product-price-details'><%= _('Price composition') %></a></li> |
| 37 | 39 | <% end %> |
| 40 | + | |
| 41 | + <% plugins_tabs.each do |tab| %> | |
| 42 | + <li class='tab'><a href='#<%=tab[:id]%>'><%= tab[:title] %></a></li> | |
| 43 | + <% end %> | |
| 44 | + | |
| 38 | 45 | </ul> |
| 46 | + | |
| 39 | 47 | <div id='product-description'> |
| 40 | 48 | <%= render :partial => 'manage_products/display_description' %> |
| 41 | 49 | </div> |
| 50 | + | |
| 42 | 51 | <div id='product-inputs'> |
| 43 | 52 | <%= render :partial => 'manage_products/display_inputs' %> |
| 44 | 53 | </div> |
| 54 | + | |
| 45 | 55 | <% if @product.price_described? || @allowed_user %> |
| 46 | 56 | <div id='product-price-details'> |
| 47 | 57 | <%= render :partial => 'manage_products/display_price_details' %> |
| 48 | 58 | <%= render :partial => 'manage_products/price_details_button' %> |
| 49 | 59 | </div> |
| 50 | 60 | <% end %> |
| 61 | + | |
| 62 | + <% plugins_tabs.each do |tab| %> | |
| 63 | + <div id='<%=tab[:id]%>'><%= raw tab[:content] %></div> | |
| 64 | + <% end %> | |
| 65 | + | |
| 51 | 66 | </div> |
| 52 | 67 | <% end %> |
| 53 | 68 | ... | ... |
app/views/maps/_google_map.js.erb
| ... | ... | @@ -9,7 +9,7 @@ var mapZoom = 15; |
| 9 | 9 | var delay_autocomplete = 500; |
| 10 | 10 | |
| 11 | 11 | function pointToAddress(latlng) { |
| 12 | - $('location-fields').addClassName("loading"); | |
| 12 | + jQuery('#location-fields').addClass("loading"); | |
| 13 | 13 | |
| 14 | 14 | if (latlng == null) |
| 15 | 15 | return; |
| ... | ... | @@ -22,11 +22,11 @@ function pointToAddress(latlng) { |
| 22 | 22 | |
| 23 | 23 | var place = results[0]; |
| 24 | 24 | |
| 25 | - $('location-fields').removeClassName("loading"); | |
| 25 | + jQuery('#location-fields').removeClass("loading"); | |
| 26 | 26 | |
| 27 | 27 | var position = marker.getPosition(); |
| 28 | - $('profile_data_lat').value = position.lat(); | |
| 29 | - $('profile_data_lng').value = position.lng(); | |
| 28 | + jQuery('#profile_data_lat').val(position.lat()); | |
| 29 | + jQuery('#profile_data_lng').val(position.lng()); | |
| 30 | 30 | |
| 31 | 31 | form = jQuery('#location-form')[0]; |
| 32 | 32 | form.lat = marker.getPosition().lat(); |
| ... | ... | @@ -85,26 +85,26 @@ function pointToAddress(latlng) { |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | if (country_code) |
| 88 | - $('profile_data_country').value = country_code; | |
| 88 | + jQuery('#profile_data_country').val(country_code); | |
| 89 | 89 | if (state) |
| 90 | - $('profile_data_state').value = state; | |
| 90 | + jQuery('#profile_data_state').val(state); | |
| 91 | 91 | if (city) |
| 92 | - $('profile_data_city').value = city; | |
| 92 | + jQuery('#profile_data_city').val(city); | |
| 93 | 93 | if (zip_code) |
| 94 | - $('profile_data_zip_code').value = zip_code; | |
| 94 | + jQuery('#profile_data_zip_code').val(zip_code); | |
| 95 | 95 | if (address) |
| 96 | - $('profile_data_address').value = address; | |
| 96 | + jQuery('#profile_data_address').val(address); | |
| 97 | 97 | |
| 98 | 98 | map.setCenter(marker.getPosition()); |
| 99 | 99 | }); |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | function addressToPoint() { |
| 103 | - $('location-fields').addClassName("loading"); | |
| 103 | + jQuery('#location-fields').addClass("loading"); | |
| 104 | 104 | |
| 105 | - var country_option = $('profile_data_country').value; | |
| 106 | - var address = $('profile_data_address').value + ", " + $('profile_data_zip_code').value + ", " | |
| 107 | - + $('profile_data_city').value+ ", " + $('profile_data_state').value + ", " + country_option; | |
| 105 | + var country_option = jQuery('#profile_data_country').val(); | |
| 106 | + var address = jQuery('#profile_data_address').val() + ", " + jQuery('#profile_data_zip_code').val() + ", " | |
| 107 | + + jQuery('#profile_data_city').val() + ", " + jQuery('#profile_data_state').val() + ", " + country_option; | |
| 108 | 108 | |
| 109 | 109 | if (geocoder) { |
| 110 | 110 | geocoder.geocode({ 'address': address}, function(results, status) { |
| ... | ... | @@ -113,12 +113,12 @@ function addressToPoint() { |
| 113 | 113 | marker.setPosition(results[0].geometry.location); |
| 114 | 114 | pointToAddress(marker.getPosition()); |
| 115 | 115 | |
| 116 | - $('profile_data_lat').value = results[0].geometry.location.lat(); | |
| 117 | - $('profile_data_lng').value = results[0].geometry.location.lng(); | |
| 118 | - $('location-fields').removeClassName("loading"); | |
| 116 | + jQuery('#profile_data_lat').val(results[0].geometry.location.lat()); | |
| 117 | + jQuery('#profile_data_lng').val(results[0].geometry.location.lng()); | |
| 118 | + jQuery('#location-fields').removeClass("loading"); | |
| 119 | 119 | enable_save(); |
| 120 | 120 | } else { |
| 121 | - $('location-fields').removeClassName("loading"); | |
| 121 | + jQuery('#location-fields').removeClass("loading"); | |
| 122 | 122 | alert('<%=_("Address not found, reason:")%>' + statusErrorMessage(status)); |
| 123 | 123 | } |
| 124 | 124 | }); |
| ... | ... | @@ -175,7 +175,6 @@ function initializeMap() { |
| 175 | 175 | |
| 176 | 176 | } |
| 177 | 177 | |
| 178 | -jQuery.noConflict(); | |
| 179 | 178 | jQuery(document).ready(function () { |
| 180 | 179 | |
| 181 | 180 | initializeMap(); |
| ... | ... | @@ -198,7 +197,7 @@ jQuery(document).ready(function () { |
| 198 | 197 | source: "../maps/search_city", |
| 199 | 198 | minLength: 3, |
| 200 | 199 | delay: delay_autocomplete, |
| 201 | - select: function( event, ui ) { $('profile_data_state').value =( ui.item ? ui.item.category : this.value ); } | |
| 200 | + select: function( event, ui ) { jQuery('#profile_data_state').val( ui.item ? ui.item.category : this.value ); } | |
| 202 | 201 | }); |
| 203 | 202 | |
| 204 | 203 | jQuery("#profile_data_state").autocomplete({ | ... | ... |
app/views/profile/_profile_scrap.html.erb
| ... | ... | @@ -9,7 +9,7 @@ |
| 9 | 9 | <div class='profile-wall-actions'> |
| 10 | 10 | <% if logged_in? && current_person.follows?(scrap.sender) %> |
| 11 | 11 | <span class='profile-activity-send-reply'> |
| 12 | - <%= link_to_function s_('profile|Comment'), "hide_and_show(['#profile-wall-message-response-#{scrap.id}'],['#profile-wall-reply-#{scrap.id}', '#profile-wall-reply-form-#{scrap.id}']);$('reply_content_#{scrap.id}').value='';$('reply_content_#{scrap.id}').focus();return false", :class => "profile-send-reply" %> | |
| 12 | + <%= link_to_function s_('profile|Comment'), "hide_and_show(['#profile-wall-message-response-#{scrap.id}'],['#profile-wall-reply-#{scrap.id}', '#profile-wall-reply-form-#{scrap.id}']);jQuery('#reply_content_#{scrap.id}').val('');jQuery('#reply_content_#{scrap.id}').focus();return false", :class => "profile-send-reply" %> | |
| 13 | 13 | </span> |
| 14 | 14 | <% end %> |
| 15 | 15 | <%= link_to_function(_('Remove'), 'remove_item_wall(this, \'%s\', \'%s\', \'%s\'); return false ;' % [".profile-activity-item", url_for(:profile => params[:profile], :action => :remove_scrap, :scrap_id => scrap.id, :view => params[:view]), _('Are you sure you want to remove this scrap and all its replies?')]) if logged_in? && user.can_control_scrap?(scrap) %> | ... | ... |
app/views/profile/_profile_scraps.html.erb
| ... | ... | @@ -9,7 +9,7 @@ |
| 9 | 9 | <div class='profile-wall-actions'> |
| 10 | 10 | <% if logged_in? && current_person.follows?(scrap.sender) %> |
| 11 | 11 | <span class='profile-activity-send-reply'> |
| 12 | - <%= link_to_function s_('profile|Comment'), "hide_and_show(['#profile-wall-message-response-#{scrap.id}'],['#profile-wall-reply-#{scrap.id}', '#profile-wall-reply-form-#{scrap.id}']);$('reply_content_#{scrap.id}').value='';$('reply_content_#{scrap.id}').focus();return false", :class => "profile-send-reply" %> | |
| 12 | + <%= link_to_function s_('profile|Comment'), "hide_and_show(['#profile-wall-message-response-#{scrap.id}'],['#profile-wall-reply-#{scrap.id}', '#profile-wall-reply-form-#{scrap.id}']);jQuery('#reply_content_#{scrap.id}').val('');jQuery('#reply_content_#{scrap.id}').focus();return false", :class => "profile-send-reply" %> | |
| 13 | 13 | </span> |
| 14 | 14 | <% end %> |
| 15 | 15 | <%= link_to_function(_('Remove'), 'remove_item_wall(this, \'%s\', \'%s\', \'%s\'); return false ;' % [".profile-activity-item", url_for(:profile => params[:profile], :action => :remove_scrap, :scrap_id => scrap.id, :view => params[:view]), _('Are you sure you want to remove this scrap and all its replies?')]) if logged_in? && user.can_control_scrap?(scrap) %> | ... | ... |
app/views/profile/_profile_wall.html.erb
| 1 | 1 | <h3><%= _("%s's wall") % @profile.name %></h3> |
| 2 | 2 | <div id='leave_scrap'> |
| 3 | 3 | <%= flash[:error] %> |
| 4 | - <%= form_remote_tag :url => {:controller => 'profile', :action => 'leave_scrap', :tab_action => 'wall' }, :update => 'profile_activities', :success => "$('leave_scrap_content').value=''", :complete => "jQuery('#leave_scrap_form').removeClass('loading').find('*').attr('disabled', false)", :loading => "jQuery('#leave_scrap_form').addClass('loading').find('*').attr('disabled', true)", :html => {:id => 'leave_scrap_form' } do %> | |
| 4 | + <%= form_remote_tag :url => {:controller => 'profile', :action => 'leave_scrap', :tab_action => 'wall' }, :update => 'profile_activities', :success => "jQuery('#leave_scrap_content').val('')", :complete => "jQuery('#leave_scrap_form').removeClass('loading').find('*').attr('disabled', false)", :loading => "jQuery('#leave_scrap_form').addClass('loading').find('*').attr('disabled', true)", :html => {:id => 'leave_scrap_form' } do %> | |
| 5 | 5 | <%= limited_text_area :scrap, :content, 420, 'leave_scrap_content', :cols => 50, :rows => 2, :class => 'autogrow' %> |
| 6 | 6 | <%= submit_button :new, _('Share') %> |
| 7 | 7 | <% end %> | ... | ... |
app/views/profile/join.html.erb
| ... | ... | @@ -9,7 +9,7 @@ |
| 9 | 9 | <%= hidden_field_tag(:confirmation, 1) %> |
| 10 | 10 | <%= submit_button(:ok, _("Yes, I want to join.") % profile.name) %> |
| 11 | 11 | <% if logged_in? && request.xhr? %> |
| 12 | - <%= lightbox_close_button(_("No, I don't want")) %> | |
| 12 | + <%= modal_close_button _("No, I don't want") %> | |
| 13 | 13 | <% else %> |
| 14 | 14 | <%= button(:cancel, _("No, I don't want."), profile.url) %> |
| 15 | 15 | <% end %> | ... | ... |
app/views/profile/leave.html.erb
| ... | ... | @@ -9,7 +9,7 @@ |
| 9 | 9 | <%= hidden_field_tag(:back_to, @back_to) %> |
| 10 | 10 | <%= submit_button(:ok, _("Yes, I want to leave.") % profile.name) %> |
| 11 | 11 | <% if logged_in? && request.xhr? %> |
| 12 | - <%= lightbox_close_button(_("No, I don't want")) %> | |
| 12 | + <%= modal_close_button _("No, I don't want") %> | |
| 13 | 13 | <% else %> |
| 14 | 14 | <%= button(:cancel, _("No, I don't want."), profile.url) %> |
| 15 | 15 | <% end %> | ... | ... |
app/views/profile/report_abuse.html.erb
| ... | ... | @@ -9,7 +9,7 @@ |
| 9 | 9 | <% end %> |
| 10 | 10 | |
| 11 | 11 | <%= submit_button(:send, _('Report profile'), :style => 'float: left; cursor: pointer;', :id => 'report-abuse-submit-button', :onclick => "jQuery('#form-submit-loading').show()") %> |
| 12 | - <%= button(:cancel, _('Cancel'), {}, :style => 'float: left; padding-top: 0px; padding-bottom: 0px;', :onclick => 'jQuery.colorbox.close(); return false;')%> | |
| 12 | + <%= button(:cancel, _('Cancel'), {}, :style => 'float: left; padding-top: 0px; padding-bottom: 0px;', :onclick => 'noosfero.modal.close(); return false;')%> | |
| 13 | 13 | <div id="form-submit-loading" class="small-loading" style="width: 16px; height: 16px; margin-top: 3px; float: left; display: none;"></div> |
| 14 | 14 | <% end %> |
| 15 | 15 | |
| ... | ... | @@ -30,7 +30,7 @@ |
| 30 | 30 | success: function(data, status, ajax){ |
| 31 | 31 | if ( !data.ok ) display_notice(data.error.message); |
| 32 | 32 | else { |
| 33 | - $.colorbox.close(); | |
| 33 | + noosfero.modal.close(); | |
| 34 | 34 | display_notice(data.message); |
| 35 | 35 | window.location.reload(); |
| 36 | 36 | } | ... | ... |
app/views/profile_editor/_organization.html.erb
| ... | ... | @@ -19,7 +19,7 @@ |
| 19 | 19 | <% if @environment.enabled?('enable_organization_url_change') %> |
| 20 | 20 | <script type="text/javascript"> |
| 21 | 21 | function submit_button() { |
| 22 | - return $("profile-data").select("input.submit")[0]; | |
| 22 | + return jQuery("#profile-data").find("input.submit")[0]; | |
| 23 | 23 | } |
| 24 | 24 | function warn_value_change() { |
| 25 | 25 | show_warning('profile-identifier-formitem', "identifier-change-confirmation"); |
| ... | ... | @@ -30,7 +30,7 @@ |
| 30 | 30 | hide_warning('identifier-change-confirmation'); |
| 31 | 31 | } |
| 32 | 32 | function no_change() { |
| 33 | - $("profile_data_identifier").value = $("old_profile_identifier").value; | |
| 33 | + jQuery("#profile_data_identifier").val(jQuery("#old_profile_identifier").val()); | |
| 34 | 34 | enable_button(submit_button()); |
| 35 | 35 | hide_warning('identifier-change-confirmation'); |
| 36 | 36 | } | ... | ... |
app/views/profile_members/_add_admins.html.erb
| 1 | 1 | <h2><%= _('Add admins to %s') % profile.name %></h2> |
| 2 | 2 | |
| 3 | -<%= form_remote_tag :url => {:action => 'find_users', :profile => profile.identifier, :scope => 'new_admins'}, :update => 'users-list', :loading => '$("users-list").addClassName("loading")', :complete => '$("users-list").removeClassName("loading")' do %> | |
| 3 | +<%= form_remote_tag :url => {:action => 'find_users', :profile => profile.identifier, :scope => 'new_admins'}, :update => 'users-list', :loading => 'jQuery("#users-list").addClass("loading")', :complete => 'jQuery("#users-list").removeClass("loading")' do %> | |
| 4 | 4 | <%= text_field_tag('query', '', :autocomplete => 'off') %> |
| 5 | 5 | <%= submit_tag(_('Search')) %> |
| 6 | 6 | <% end %> |
| 7 | 7 | |
| 8 | -<%= observe_field('query', :url => {:action => 'find_users', :profile => profile.identifier, :scope => 'new_admins'}, :update => 'users-list', :frequency => 1, :with => 'query', :condition => '$("query").value.length > 2', :loading => '$("users-list").addClassName("loading")', :complete => '$("users-list").removeClassName("loading")') %> | |
| 9 | -<%= observe_field('query', :frequency => 1, :condition => '$("query").value.length <= 2', :function => '$("users-list").update($("empty-query").innerHTML)') %> | |
| 8 | +<%= observe_field('query', :url => {:action => 'find_users', :profile => profile.identifier, :scope => 'new_admins'}, :update => 'users-list', :frequency => 1, :with => 'query', :condition => 'jQuery("#query").val().length > 2', :loading => 'jQuery("#users-list").addClass("loading")', :complete => 'jQuery("#users-list").removeClass("loading")') %> | |
| 9 | +<%= observe_field('query', :frequency => 1, :condition => 'jQuery("#query").val().length <= 2', :function => 'jQuery("#users-list").html(jQuery("#empty-query").html())') %> | |
| 10 | 10 | |
| 11 | 11 | <div id="users-list"> |
| 12 | 12 | <%= render :partial => 'find_users' %> |
| ... | ... | @@ -21,10 +21,10 @@ |
| 21 | 21 | </div> |
| 22 | 22 | <%= drop_receiving_element('members-list', |
| 23 | 23 | :url => {:action => 'add_admin', :profile => profile.identifier, :leaving_admin => @person}, |
| 24 | - :before => '$("tr-" + element.id).hide()', | |
| 25 | - :loading => '$("members-list").addClassName("loading")', | |
| 24 | + :before => 'jQuery("#tr-" + element.id).hide()', | |
| 25 | + :loading => 'jQuery("#members-list").addClass("loading")', | |
| 26 | 26 | :update => 'members-list', |
| 27 | - :success => '$("tr-" + element.id).hide(); $(element.id).show();', | |
| 28 | - :complete => '$("members-list").removeClassName("loading")') %> | |
| 27 | + :success => 'jQuery("#tr-" + element.id).hide(); jQuery("#"+element.id).show();', | |
| 28 | + :complete => 'jQuery("#members-list").removeClass("loading")') %> | |
| 29 | 29 | |
| 30 | 30 | <br style="clear:both" /> | ... | ... |
app/views/profile_members/_members_list.html.erb
| ... | ... | @@ -17,9 +17,9 @@ |
| 17 | 17 | <%= button_without_text :edit, _('Edit'), :action => 'change_role', :id => m %> |
| 18 | 18 | <%= button_to_remote_without_text(:remove, _('Remove'), |
| 19 | 19 | :update => 'members-list', |
| 20 | - :loading => "$('members-list').addClassName('loading')", | |
| 21 | - :success => "$('tr-#{m.identifier}').show()", | |
| 22 | - :complete => "$('members-list').removeClassName('loading')", | |
| 20 | + :loading => "jQuery('#members-list').addClass('loading')", | |
| 21 | + :success => "jQuery('#tr-#{m.identifier}').show()", | |
| 22 | + :complete => "jQuery('#members-list').removeClass('loading')", | |
| 23 | 23 | :url => { :id => m }.merge(remove_action)) if m != user %> |
| 24 | 24 | </div> |
| 25 | 25 | </td> | ... | ... |
app/views/profile_themes/add_css.html.erb
app/views/profile_themes/edit.html.erb
| ... | ... | @@ -16,7 +16,7 @@ |
| 16 | 16 | <% end %> |
| 17 | 17 | </ul> |
| 18 | 18 | <% button_bar do %> |
| 19 | - <%= lightbox_button(:add, _('New CSS'), :action => 'add_css', :id => @theme.id) %> | |
| 19 | + <%= modal_button :add, _('New CSS'), :action => 'add_css', :id => @theme.id %> | |
| 20 | 20 | <% end %> |
| 21 | 21 | </div> |
| 22 | 22 | |
| ... | ... | @@ -25,10 +25,10 @@ |
| 25 | 25 | <ul> |
| 26 | 26 | <% for image in @image_files %> |
| 27 | 27 | <li><%= image_tag("/user_themes/#{@theme.id}/images/#{image}") %></li> |
| 28 | - <% end %> | |
| 28 | + <% end %> | |
| 29 | 29 | </ul> |
| 30 | 30 | <% button_bar do %> |
| 31 | - <%= lightbox_button(:add, _('Add image'), :action => 'add_image', :id => @theme.id) %> | |
| 31 | + <%= modal_button :add, _('Add image'), :action => 'add_image', :id => @theme.id %> | |
| 32 | 32 | <% end %> |
| 33 | 33 | </div> |
| 34 | 34 | ... | ... |