Commit 0bf5797a682e1a7f594d3d4a47a98541e72bd091
Exists in
production
Merge branch 'staging' into production
Showing
4566 changed files
with
167267 additions
and
2277 deletions
Show diff stats
Too many changes.
To preserve performance only 100 of 4566 files displayed.
.gitlab-ci.yml
... | ... | @@ -59,18 +59,18 @@ selenium-6: |
59 | 59 | # NOOSFERO_BUNDLE_OPTS=install makes migrations fails |
60 | 60 | # probably because of rubygems-integration |
61 | 61 | plugins-1: |
62 | - script: SLICE=1/5 bundle exec rake test:noosfero_plugins | |
62 | + script: SLICE=1/5 bundle exec rake test:noosfero_plugins NOOSFERO_BUNDLE_OPTS=install | |
63 | 63 | stage: all-tests |
64 | 64 | plugins-2: |
65 | - script: SLICE=2/5 bundle exec rake test:noosfero_plugins | |
65 | + script: SLICE=2/5 bundle exec rake test:noosfero_plugins NOOSFERO_BUNDLE_OPTS=install | |
66 | 66 | stage: all-tests |
67 | 67 | plugins-3: |
68 | - script: SLICE=3/5 bundle exec rake test:noosfero_plugins | |
68 | + script: SLICE=3/5 bundle exec rake test:noosfero_plugins NOOSFERO_BUNDLE_OPTS=install | |
69 | 69 | stage: all-tests |
70 | 70 | plugins-4: |
71 | - script: SLICE=4/5 bundle exec rake test:noosfero_plugins | |
71 | + script: SLICE=4/5 bundle exec rake test:noosfero_plugins NOOSFERO_BUNDLE_OPTS=install | |
72 | 72 | stage: all-tests |
73 | 73 | plugins-5: |
74 | - script: SLICE=5/5 bundle exec rake test:noosfero_plugins | |
74 | + script: SLICE=5/5 bundle exec rake test:noosfero_plugins NOOSFERO_BUNDLE_OPTS=install | |
75 | 75 | stage: all-tests |
76 | 76 | ... | ... |
.gitmodules
... | ... | @@ -46,3 +46,63 @@ |
46 | 46 | [submodule "plugins/serpro_integration"] |
47 | 47 | path = plugins/serpro_integration |
48 | 48 | url = https://softwarepublico.gov.br/gitlab/noosfero-plugins/serpro_integration.git |
49 | +[submodule "public/designs/themes/conference"] | |
50 | + path = public/designs/themes/conference | |
51 | + url = https://gitlab.com/noosfero-themes/conference.git | |
52 | +[submodule "public/designs/themes/participa-site"] | |
53 | + path = public/designs/themes/participa-site | |
54 | + url = https://gitlab.com/noosfero-themes/participa-site.git | |
55 | +[submodule "public/designs/themes/presidencia"] | |
56 | + path = public/designs/themes/presidencia | |
57 | + url = https://gitlab.com/noosfero-themes/presidencia.git | |
58 | +[submodule "public/designs/themes/planejamento-serpro"] | |
59 | + path = public/designs/themes/planejamento-serpro | |
60 | + url = https://gitlab.com/noosfero-themes/planejamento-serpro.git | |
61 | +[submodule "public/designs/themes/voce-serpro"] | |
62 | + path = public/designs/themes/voce-serpro | |
63 | + url = https://gitlab.com/noosfero-themes/voce-serpro.git | |
64 | +[submodule "public/designs/themes/softwarepublico"] | |
65 | + path = public/designs/themes/softwarepublico | |
66 | + url = https://gitlab.com/noosfero-themes/softwarepublico.git | |
67 | +[submodule "public/designs/themes/mrosc-theme"] | |
68 | + path = public/designs/themes/mrosc-theme | |
69 | + url = https://gitlab.com/noosfero-themes/mrosc-theme.git | |
70 | +[submodule "public/designs/themes/colabora"] | |
71 | + path = public/designs/themes/colabora | |
72 | + url = https://gitlab.com/noosfero-themes/colabora.git | |
73 | +[submodule "public/designs/themes/inclusao-digital"] | |
74 | + path = public/designs/themes/inclusao-digital | |
75 | + url = https://gitlab.com/noosfero-themes/inclusao-digital.git | |
76 | +[submodule "public/designs/themes/participa-consulta"] | |
77 | + path = public/designs/themes/participa-consulta | |
78 | + url = https://gitlab.com/noosfero-themes/participa-consulta.git | |
79 | +[submodule "public/designs/themes/participa-theme"] | |
80 | + path = public/designs/themes/participa-theme | |
81 | + url = https://gitlab.com/noosfero-themes/participa-theme.git | |
82 | +[submodule "public/designs/themes/serpro"] | |
83 | + path = public/designs/themes/serpro | |
84 | + url = https://gitlab.com/noosfero-themes/serpro.git | |
85 | +[submodule "public/designs/themes/voce-serpro-novo"] | |
86 | + path = public/designs/themes/voce-serpro-novo | |
87 | + url = https://gitlab.com/noosfero-themes/voce-serpro-novo.git | |
88 | +[submodule "public/designs/themes/juventude"] | |
89 | + path = public/designs/themes/juventude | |
90 | + url = https://gitlab.com/noosfero-themes/juventude.git | |
91 | +[submodule "public/designs/themes/new-participa-theme"] | |
92 | + path = public/designs/themes/new-participa-theme | |
93 | + url = https://gitlab.com/noosfero-themes/new-participa-theme.git | |
94 | +[submodule "public/designs/themes/participa-event"] | |
95 | + path = public/designs/themes/participa-event | |
96 | + url = https://gitlab.com/noosfero-themes/participa-event.git | |
97 | +[submodule "public/designs/themes/participatorio-theme"] | |
98 | + path = public/designs/themes/participatorio-theme | |
99 | + url = https://gitlab.com/noosfero-themes/participatorio-theme.git | |
100 | +[submodule "public/designs/themes/sinesp"] | |
101 | + path = public/designs/themes/sinesp | |
102 | + url = https://gitlab.com/noosfero-themes/sinesp.git | |
103 | +[submodule "public/designs/themes/maranhao"] | |
104 | + path = public/designs/themes/maranhao | |
105 | + url = https://gitlab.com/noosfero-themes/maranhao.git | |
106 | +[submodule "public/designs/themes/minjustica"] | |
107 | + path = public/designs/themes/minjustica | |
108 | + url = https://gitlab.com/noosfero-themes/minjustica.git | ... | ... |
.travis.yml
Gemfile
... | ... | @@ -27,7 +27,7 @@ gem 'rest-client', '~> 1.6' |
27 | 27 | gem 'exception_notification', '~> 4.0.1' |
28 | 28 | gem 'gettext', '~> 3.1', :require => false |
29 | 29 | gem 'locale', '~> 2.1' |
30 | -gem 'whenever', '~> 0.9.4', :require => false | |
30 | +gem 'whenever', '0.9.4', :require => false | |
31 | 31 | gem 'eita-jrails', '~> 0.10.0', require: 'jrails' |
32 | 32 | gem 'diffy', '~> 3.0' |
33 | 33 | gem 'slim' |
... | ... | @@ -35,17 +35,16 @@ gem 'activerecord-session_store', ('1.0.0.pre' if RUBY_VERSION >= '2.3.0') |
35 | 35 | |
36 | 36 | # API dependencies |
37 | 37 | gem 'grape', '~> 0.12' |
38 | -gem 'grape-entity', '0.4.8' | |
38 | +gem 'grape-entity', '~>0.4.8' | |
39 | 39 | gem 'grape_logging' |
40 | 40 | gem 'grape-swagger' |
41 | 41 | gem 'swagger-ui_rails' |
42 | 42 | gem 'kramdown' |
43 | 43 | gem 'rack-cors' |
44 | 44 | gem 'rack-contrib' |
45 | -gem 'liquid', '~> 3.0.3' | |
46 | 45 | |
47 | 46 | gem 'api-pagination', '>= 4.1.1' |
48 | -gem 'liquid', '~> 3.0.3' | |
47 | +gem 'liquid', '>= 3.0.3' | |
49 | 48 | |
50 | 49 | # asset pipeline |
51 | 50 | gem 'uglifier', '>= 1.0.3' |
... | ... | @@ -84,7 +83,7 @@ group :cucumber do |
84 | 83 | gem 'cucumber' |
85 | 84 | gem 'cucumber-rails', '~> 1.4.2', :require => false |
86 | 85 | gem 'database_cleaner', '~> 1.3' |
87 | - gem 'selenium-webdriver', '>= 2.50' | |
86 | + gem 'selenium-webdriver', '>= 2.53' | |
88 | 87 | gem 'chromedriver-helper' if ENV['SELENIUM_DRIVER'] == 'chrome' |
89 | 88 | end |
90 | 89 | ... | ... |
Gemfile.lock
... | ... | @@ -444,7 +444,7 @@ DEPENDENCIES |
444 | 444 | gdata (> 0.0.0)! |
445 | 445 | gettext (~> 3.1) |
446 | 446 | grape (~> 0.12) |
447 | - grape-entity (= 0.4.8) | |
447 | + grape-entity (~> 0.4.8) | |
448 | 448 | grape-swagger |
449 | 449 | grape_logging |
450 | 450 | honeypot (= 0.0.0)! |
... | ... | @@ -452,7 +452,7 @@ DEPENDENCIES |
452 | 452 | kandadaboggu-vote_fu (> 0.0.0)! |
453 | 453 | kramdown |
454 | 454 | launchy |
455 | - liquid (~> 3.0.3) | |
455 | + liquid (>= 3.0.3) | |
456 | 456 | locale (~> 2.1) |
457 | 457 | minitest |
458 | 458 | minitest-reporters |
... | ... | @@ -479,7 +479,7 @@ DEPENDENCIES |
479 | 479 | ruby-feedparser (~> 0.7) |
480 | 480 | ruby_bosh (> 0.0.0)! |
481 | 481 | sass-rails |
482 | - selenium-webdriver (>= 2.50) | |
482 | + selenium-webdriver (>= 2.53) | |
483 | 483 | slim |
484 | 484 | spring |
485 | 485 | sprockets-rails (~> 2.1) |
... | ... | @@ -489,7 +489,7 @@ DEPENDENCIES |
489 | 489 | unicorn (~> 4.8) |
490 | 490 | validates_as_cnpj (= 0.0.0)! |
491 | 491 | validates_multiparameter_assignments (= 0.0.0)! |
492 | - whenever (~> 0.9.4) | |
492 | + whenever (= 0.9.4) | |
493 | 493 | will_paginate (~> 3.0.7) |
494 | 494 | xss_terminate (= 0.0.0)! |
495 | 495 | ... | ... |
HACKING.md
... | ... | @@ -31,7 +31,7 @@ If you want to use a different port than 3000, pass `-p <PORT>` to `./script/dev |
31 | 31 | Instructions for other systems |
32 | 32 | ------------------------------ |
33 | 33 | |
34 | -On other OS, you have 2 options: | |
34 | +On other OS, you have many options: | |
35 | 35 | |
36 | 36 | ### 1) using a chroot or a VM with Debian stable (easier) |
37 | 37 | |
... | ... | @@ -45,6 +45,14 @@ You can check `./script/install-dependencies/debian-squeeze.sh` to have an idea |
45 | 45 | |
46 | 46 | If you write such script for your own OS, *please* share it with us at the development mailing list so that we can include it in the official repository. This way other people using the same OS will have to put less effort to develop Noosfero. |
47 | 47 | |
48 | +### 3) Installing dependencies via Rubygems and RVM | |
49 | + | |
50 | +To setup the development environment through Rubygems you just need to install some basic deps and then install the gems defined on the Gemfile. Further instructions can be found on: http://noosfero.org/bin/view/Development/DepsWithRVMAndGems | |
51 | + | |
52 | +### 4) Using a docker image | |
53 | + | |
54 | +Use a docker image to run an out-of-the-box development environment. Further information can be found on: https://hub.docker.com/r/noosfero/dev-rails4/ | |
55 | + | |
48 | 56 | Submitting your changes back |
49 | 57 | ---------------------------- |
50 | 58 | ... | ... |
app/api/entities.rb
... | ... | @@ -38,6 +38,13 @@ module Api |
38 | 38 | PERMISSIONS[current_permission] <= PERMISSIONS[permission] |
39 | 39 | end |
40 | 40 | |
41 | + def self.expose_optional_field?(field, options = {}) | |
42 | + return false if options[:params].nil? | |
43 | + optional_fields = options[:params][:optional_fields] || [] | |
44 | + optional_fields.include?(field.to_s) | |
45 | + end | |
46 | + | |
47 | + | |
41 | 48 | class Image < Entity |
42 | 49 | root 'images', 'image' |
43 | 50 | |
... | ... | @@ -166,7 +173,8 @@ module Api |
166 | 173 | community.admins.map{|admin| {"name"=>admin.name, "id"=>admin.id, "username" => admin.identifier}} |
167 | 174 | end |
168 | 175 | expose :categories, :using => Category |
169 | - expose :members, :using => Person , :if => lambda{ |community, options| community.display_info_to? options[:current_person] } | |
176 | + expose :members_count | |
177 | + expose :members, :if => lambda {|community, options| Entities.expose_optional_field?(:members, options)} | |
170 | 178 | end |
171 | 179 | |
172 | 180 | class CommentBase < Entity |
... | ... | @@ -213,7 +221,7 @@ module Api |
213 | 221 | expose :comments_count |
214 | 222 | expose :archived, :documentation => {:type => "Boolean", :desc => "Defines if a article is readonly"} |
215 | 223 | expose :type |
216 | - expose :comments, using: CommentBase, :if => lambda{|obj,opt| opt[:params] && ['1','true',true].include?(opt[:params][:show_comments])} | |
224 | + expose :comments, using: CommentBase, :if => lambda{|comment,options| Entities.expose_optional_field?(:comments, options)} | |
217 | 225 | expose :published |
218 | 226 | expose :accept_comments?, as: :accept_comments |
219 | 227 | end | ... | ... |
app/api/helpers.rb
... | ... | @@ -57,9 +57,11 @@ module Api |
57 | 57 | def present_partial(model, options) |
58 | 58 | if(params[:fields].present?) |
59 | 59 | begin |
60 | - fields = JSON.parse(params[:fields]) | |
60 | + fields = JSON.parse((params.to_hash[:fields] || params.to_hash['fields']).to_json) | |
61 | 61 | if fields.present? |
62 | - options.merge!(fields.symbolize_keys.slice(:only, :except)) | |
62 | + fields = fields.symbolize_keys | |
63 | + options.merge!(:only => fields[:only]) if fields[:only].present? | |
64 | + options.merge!(:except => fields[:except]) if fields[:except].present? | |
63 | 65 | end |
64 | 66 | rescue |
65 | 67 | fields = params[:fields] |
... | ... | @@ -116,7 +118,7 @@ module Api |
116 | 118 | def post_article(asset, params) |
117 | 119 | return forbidden! unless current_person.can_post_content?(asset) |
118 | 120 | |
119 | - klass_type = params[:content_type] || params[:article].delete(:type) || TinyMceArticle.name | |
121 | + klass_type = params[:content_type] || params[:article].delete(:type) || TextArticle.name | |
120 | 122 | return forbidden! unless klass_type.constantize <= Article |
121 | 123 | |
122 | 124 | article = klass_type.constantize.new(params[:article]) |
... | ... | @@ -503,11 +505,9 @@ module Api |
503 | 505 | |
504 | 506 | def parse_content_type(content_type) |
505 | 507 | return nil if content_type.blank? |
506 | - content_types = content_type.split(',').map do |content_type| | |
507 | - content_type = content_type.camelcase | |
508 | - content_type == 'TextArticle' ? Article.text_article_types : content_type | |
508 | + content_type.split(',').map do |content_type| | |
509 | + content_type.camelcase | |
509 | 510 | end |
510 | - content_types.flatten.uniq | |
511 | 511 | end |
512 | 512 | |
513 | 513 | def period(from_date, until_date) | ... | ... |
app/api/v1/communities.rb
... | ... | @@ -18,7 +18,7 @@ module Api |
18 | 18 | communities = select_filtered_collection_of(environment, 'communities', params) |
19 | 19 | communities = profiles_for_person(communities, current_person) |
20 | 20 | communities = communities.by_location(params) # Must be the last. May return Exception obj |
21 | - present communities, :with => Entities::Community, :current_person => current_person | |
21 | + present communities, :with => Entities::Community, :current_person => current_person, :params => params | |
22 | 22 | end |
23 | 23 | |
24 | 24 | |
... | ... | @@ -49,7 +49,7 @@ module Api |
49 | 49 | |
50 | 50 | get ':id' do |
51 | 51 | community = profiles_for_person(environment.communities, current_person).find_by_id(params[:id]) |
52 | - present community, :with => Entities::Community, :current_person => current_person | |
52 | + present community, :with => Entities::Community, :current_person => current_person, :params => params | |
53 | 53 | end |
54 | 54 | |
55 | 55 | end | ... | ... |
app/controllers/my_profile/cms_controller.rb
... | ... | @@ -146,11 +146,14 @@ class CmsController < MyProfileController |
146 | 146 | parent = check_parent(params[:parent_id]) |
147 | 147 | if parent |
148 | 148 | @article.parent = parent |
149 | + @article.published = parent.published | |
150 | + @article.show_to_followers = parent.show_to_followers | |
149 | 151 | @parent_id = parent.id |
150 | 152 | end |
151 | 153 | |
152 | 154 | @article.profile = profile |
153 | 155 | @article.author = user |
156 | + @article.editor = current_person.editor | |
154 | 157 | @article.last_changed_by = user |
155 | 158 | @article.created_by = user |
156 | 159 | |
... | ... | @@ -399,8 +402,7 @@ class CmsController < MyProfileController |
399 | 402 | |
400 | 403 | def available_article_types |
401 | 404 | articles = [ |
402 | - TinyMceArticle, | |
403 | - TextileArticle, | |
405 | + TextArticle, | |
404 | 406 | Event |
405 | 407 | ] |
406 | 408 | articles += special_article_types if params && params[:cms] |
... | ... | @@ -408,9 +410,6 @@ class CmsController < MyProfileController |
408 | 410 | if @parent && @parent.blog? |
409 | 411 | articles -= Article.folder_types.map(&:constantize) |
410 | 412 | end |
411 | - if user.is_admin?(profile.environment) | |
412 | - articles << RawHTMLArticle | |
413 | - end | |
414 | 413 | articles |
415 | 414 | end |
416 | 415 | ... | ... |
app/controllers/my_profile/profile_editor_controller.rb
... | ... | @@ -95,7 +95,7 @@ class ProfileEditorController < MyProfileController |
95 | 95 | end |
96 | 96 | |
97 | 97 | def welcome_page |
98 | - @welcome_page = profile.welcome_page || TinyMceArticle.new(:name => 'Welcome Page', :profile => profile, :published => false) | |
98 | + @welcome_page = profile.welcome_page || TextArticle.new(:name => 'Welcome Page', :profile => profile, :published => false) | |
99 | 99 | if request.post? |
100 | 100 | begin |
101 | 101 | @welcome_page.update!(params[:welcome_page]) | ... | ... |
app/controllers/public/account_controller.rb
... | ... | @@ -164,6 +164,7 @@ class AccountController < ApplicationController |
164 | 164 | def logout |
165 | 165 | if logged_in? |
166 | 166 | self.current_user.forget_me |
167 | + current_user.update({:chat_status_at => DateTime.now}.merge({:last_chat_status => current_user.chat_status, :chat_status => 'offline'})) | |
167 | 168 | end |
168 | 169 | reset_session |
169 | 170 | session[:notice] = _("You have been logged out.") | ... | ... |
app/controllers/public/chat_controller.rb
... | ... | @@ -113,8 +113,20 @@ class ChatController < PublicController |
113 | 113 | end |
114 | 114 | |
115 | 115 | #TODO Ideally this is done through roster table on ejabberd. |
116 | - def roster_groups | |
117 | - render :text => user.memberships.map {|m| {:jid => m.jid, :name => m.name}}.to_json | |
116 | + def rosters | |
117 | + rooms = user.memberships.map {|m| {:jid => m.jid, :name => m.name}} | |
118 | + friends = user.friends.map {|f| {:jid => f.jid, :name => f.name}} | |
119 | + rosters = {:rooms => rooms, :friends => friends} | |
120 | + render :text => rosters.to_json | |
121 | + end | |
122 | + | |
123 | + def availabilities | |
124 | + availabilities = user.friends.map do |friend| | |
125 | + status = friend.user.chat_status | |
126 | + status = 'offline' if status.blank? | |
127 | + {:jid => friend.jid, :status => status} | |
128 | + end | |
129 | + render :text => availabilities.to_json | |
118 | 130 | end |
119 | 131 | |
120 | 132 | protected | ... | ... |
app/controllers/public/profile_controller.rb
... | ... | @@ -19,6 +19,11 @@ class ProfileController < PublicController |
19 | 19 | @network_activities = @profile.tracked_notifications.visible.paginate(:per_page => 15, :page => params[:page]) if @network_activities.empty? |
20 | 20 | @activities = @profile.activities.paginate(:per_page => 15, :page => params[:page]) |
21 | 21 | end |
22 | + | |
23 | + # TODO Find a way to filter these through sql | |
24 | + @network_activities = filter_private_scraps(@network_activities) | |
25 | + @activities = filter_private_scraps(@activities) | |
26 | + | |
22 | 27 | @tags = profile.article_tags |
23 | 28 | allow_access_to_page |
24 | 29 | end |
... | ... | @@ -231,6 +236,7 @@ class ProfileController < PublicController |
231 | 236 | @scrap = Scrap.new(params[:scrap]) |
232 | 237 | @scrap.sender= sender |
233 | 238 | @scrap.receiver= receiver |
239 | + @scrap.marked_people = treat_followed_entries(params[:filter_followed]) | |
234 | 240 | @tab_action = params[:tab_action] |
235 | 241 | @message = @scrap.save ? _("Message successfully sent.") : _("You can't leave an empty message.") |
236 | 242 | activities = @profile.activities.paginate(:per_page => 15, :page => params[:page]) if params[:not_load_scraps].nil? |
... | ... | @@ -253,6 +259,14 @@ class ProfileController < PublicController |
253 | 259 | end |
254 | 260 | end |
255 | 261 | |
262 | + def search_followed | |
263 | + result = [] | |
264 | + circles = find_by_contents(:circles, user, user.circles.where(:profile_type => 'Person'), params[:q])[:results] | |
265 | + followed = find_by_contents(:followed, user, Profile.followed_by(user), params[:q])[:results] | |
266 | + result = circles + followed | |
267 | + render :text => prepare_to_token_input_by_class(result).to_json | |
268 | + end | |
269 | + | |
256 | 270 | def view_more_activities |
257 | 271 | @activities = @profile.activities.paginate(:per_page => 10, :page => params[:page]) |
258 | 272 | render :partial => 'profile_activities_list', :locals => {:activities => @activities} |
... | ... | @@ -434,7 +448,6 @@ class ProfileController < PublicController |
434 | 448 | end |
435 | 449 | end |
436 | 450 | |
437 | - | |
438 | 451 | protected |
439 | 452 | |
440 | 453 | def check_access_to_profile |
... | ... | @@ -480,4 +493,39 @@ class ProfileController < PublicController |
480 | 493 | render_not_found unless profile.allow_followers? |
481 | 494 | end |
482 | 495 | |
496 | + def treat_followed_entries(entries) | |
497 | + return [] if entries.blank? || profile != user | |
498 | + | |
499 | + followed = [] | |
500 | + entries.split(',').map do |entry| | |
501 | + klass, identifier = entry.split('_') | |
502 | + case klass | |
503 | + when 'Person' | |
504 | + followed << Person.find(identifier) | |
505 | + when 'Circle' | |
506 | + circle = Circle.find(identifier) | |
507 | + followed += Profile.in_circle(circle) | |
508 | + end | |
509 | + end | |
510 | + followed.uniq | |
511 | + end | |
512 | + | |
513 | + def filter_private_scraps(activities) | |
514 | + activities = Array(activities) | |
515 | + activities.delete_if do |item| | |
516 | + if item.kind_of?(ProfileActivity) | |
517 | + target = item.activity | |
518 | + owner = profile | |
519 | + else | |
520 | + target = item.target | |
521 | + owner = item.user | |
522 | + end | |
523 | + !environment.admins.include?(user) && | |
524 | + owner != user && | |
525 | + target.is_a?(Scrap) && | |
526 | + target.marked_people.present? && | |
527 | + !target.marked_people.include?(user) | |
528 | + end | |
529 | + activities | |
530 | + end | |
483 | 531 | end | ... | ... |
app/helpers/application_helper.rb
... | ... | @@ -111,10 +111,6 @@ module ApplicationHelper |
111 | 111 | content = capture(&block) |
112 | 112 | end |
113 | 113 | |
114 | - if options[:type] == :textile | |
115 | - content = RedCloth.new(content).to_html | |
116 | - end | |
117 | - | |
118 | 114 | options[:class] = '' if ! options[:class] |
119 | 115 | options[:class] += ' button icon-help' # with-text |
120 | 116 | |
... | ... | @@ -132,13 +128,6 @@ module ApplicationHelper |
132 | 128 | text |
133 | 129 | end |
134 | 130 | |
135 | - # alias for <tt>help(content, :textile)</tt>. You can pass a block in the | |
136 | - # same way you would do if you called <tt>help</tt> directly. | |
137 | - def help_textile(content = nil, link_name = nil, options = {}, &block) | |
138 | - options[:type] = :textile | |
139 | - help(content, link_name, options, &block) | |
140 | - end | |
141 | - | |
142 | 131 | # TODO: do something more useful here |
143 | 132 | # TODO: test this helper |
144 | 133 | # TODO: add an icon? |
... | ... | @@ -552,7 +541,7 @@ module ApplicationHelper |
552 | 541 | ) |
553 | 542 | label_html = self.class.content_tag 'label', text, |
554 | 543 | :class => 'formlabel' |
555 | - control_html = self.class.content_tag 'div', html, | |
544 | + control_html = self.class.content_tag 'div', html.html_safe, | |
556 | 545 | :class => 'formfield type-radio '+ |
557 | 546 | 'fieldgroup linesize'+line_size.to_s() |
558 | 547 | |
... | ... | @@ -977,11 +966,16 @@ module ApplicationHelper |
977 | 966 | content_tag(:div, _('Source: %s') % source_url, :id => 'article-source') unless source_url.nil? |
978 | 967 | end |
979 | 968 | |
980 | - def task_information(task) | |
969 | + def task_information(task, params = {}) | |
981 | 970 | values = {} |
982 | 971 | values.merge!(task.information[:variables]) if task.information[:variables] |
983 | 972 | values.merge!({:requestor => link_to(task.requestor.name, task.requestor.url)}) if task.requestor |
984 | - values.merge!({:target => link_to(task.target.name, task.target.url)}) if (task.target && task.target.respond_to?(:url)) | |
973 | + if (task.target && task.target.respond_to?(:url)) | |
974 | + values.merge!({:target => link_to(task.target.name, task.target.url)}) | |
975 | + target_detail = _("in %s").html_safe % values[:target] | |
976 | + target_detail = '' if task.target.identifier == params[:profile] | |
977 | + values.merge!({:target_detail => target_detail}) | |
978 | + end | |
985 | 979 | values.merge!({:subject => content_tag('span', task.subject, :class=>'task_target')}) if task.subject |
986 | 980 | values.merge!({:linked_subject => link_to(content_tag('span', task.linked_subject[:text], :class => 'task_target'), task.linked_subject[:url])}) if task.linked_subject |
987 | 981 | (task.information[:message] % values).html_safe |
... | ... | @@ -1245,4 +1239,15 @@ module ApplicationHelper |
1245 | 1239 | content.html_safe |
1246 | 1240 | end |
1247 | 1241 | |
1242 | + def current_editor_is?(editor) | |
1243 | + editor.blank? ? false : current_editor == editor | |
1244 | + end | |
1245 | + | |
1246 | + def current_editor(mode = '') | |
1247 | + editor = @article.editor || Article::Editor::TINY_MCE unless @article.nil? | |
1248 | + editor ||= (current_person.nil? || current_person.editor.nil?) ? Article::Editor::TINY_MCE : current_person.editor | |
1249 | + editor += '_' + mode unless mode.blank? | |
1250 | + editor | |
1251 | + end | |
1252 | + | |
1248 | 1253 | end | ... | ... |
app/helpers/article_helper.rb
... | ... | @@ -161,6 +161,10 @@ module ArticleHelper |
161 | 161 | array.map { |object| {:label => object.name, :value => object.name} } |
162 | 162 | end |
163 | 163 | |
164 | + def prepare_to_token_input_by_class(array) | |
165 | + array.map { |object| {:id => "#{object.class.name}_#{object.id || object.name}", :name => "#{object.name} (#{_(object.class.name)})", :class => object.class.name}} | |
166 | + end | |
167 | + | |
164 | 168 | def cms_label_for_new_children |
165 | 169 | _('New article') |
166 | 170 | end | ... | ... |
app/helpers/profile_editor_helper.rb
app/helpers/tags_helper.rb
... | ... | @@ -67,4 +67,17 @@ module TagsHelper |
67 | 67 | end.join("\n").html_safe |
68 | 68 | end |
69 | 69 | |
70 | + def linked_article_tags(article) | |
71 | + if @profile | |
72 | + # We are rendering a page inside a profile, so link to the profile tag search. | |
73 | + url = { :controller => 'profile', :profile => @profile.identifier, :action => 'tags' } | |
74 | + tagname_option = :id | |
75 | + else | |
76 | + # We are rendering a page outside a profile, so link to the global tag search. | |
77 | + url = { :action => 'tag' } | |
78 | + tagname_option = :tag | |
79 | + end | |
80 | + article.tags.map { |t| link_to(t, url.merge(tagname_option=>t.name) ) }.join("\n") | |
81 | + end | |
82 | + | |
70 | 83 | end | ... | ... |
app/helpers/tinymce_helper.rb
... | ... | @@ -18,7 +18,8 @@ module TinymceHelper |
18 | 18 | insertdatetime media nonbreaking save table contextmenu directionality |
19 | 19 | emoticons template paste textcolor colorpicker textpattern], |
20 | 20 | :image_advtab => true, |
21 | - :language => tinymce_language | |
21 | + :language => tinymce_language, | |
22 | + :selector => '.' + current_editor(options[:mode]) | |
22 | 23 | |
23 | 24 | options[:toolbar1] = toolbar1(options[:mode]) |
24 | 25 | options[:menubar] = menubar(options[:mode]) | ... | ... |
app/helpers/token_helper.rb
... | ... | @@ -5,10 +5,11 @@ module TokenHelper |
5 | 5 | end |
6 | 6 | |
7 | 7 | def token_input_field_tag(name, element_id, search_action, options = {}, text_field_options = {}, html_options = {}) |
8 | - options[:min_chars] ||= 3 | |
8 | + options[:min_chars] ||= 2 | |
9 | 9 | options[:hint_text] ||= _("Type in a search term") |
10 | 10 | options[:no_results_text] ||= _("No results") |
11 | 11 | options[:searching_text] ||= _("Searching...") |
12 | + options[:placeholder] ||= 'null' | |
12 | 13 | options[:search_delay] ||= 1000 |
13 | 14 | options[:prevent_duplicates] ||= true |
14 | 15 | options[:backspace_delete_item] ||= false |
... | ... | @@ -20,6 +21,9 @@ module TokenHelper |
20 | 21 | options[:on_delete] ||= 'null' |
21 | 22 | options[:on_ready] ||= 'null' |
22 | 23 | options[:query_param] ||= 'q' |
24 | + options[:theme] ||= 'null' | |
25 | + options[:results_formatter] ||= 'null' | |
26 | + options[:token_formatter] ||= 'null' | |
23 | 27 | |
24 | 28 | result = text_field_tag(name, nil, text_field_options.merge(html_options.merge({:id => element_id}))) |
25 | 29 | result += javascript_tag("jQuery('##{element_id}') |
... | ... | @@ -29,6 +33,7 @@ module TokenHelper |
29 | 33 | hintText: #{options[:hint_text].to_json}, |
30 | 34 | noResultsText: #{options[:no_results_text].to_json}, |
31 | 35 | searchingText: #{options[:searching_text].to_json}, |
36 | + placeholder: #{options[:placeholder].to_json}, | |
32 | 37 | searchDelay: #{options[:search_delay].to_json}, |
33 | 38 | preventDuplicates: #{options[:prevent_duplicates].to_json}, |
34 | 39 | backspaceDeleteItem: #{options[:backspace_delete_item].to_json}, |
... | ... | @@ -39,6 +44,9 @@ module TokenHelper |
39 | 44 | onAdd: #{options[:on_add]}, |
40 | 45 | onDelete: #{options[:on_delete]}, |
41 | 46 | onReady: #{options[:on_ready]}, |
47 | + theme: #{options[:theme] == 'null' ? options[:theme] : options[:theme].to_json}, | |
48 | + resultsFormater: #{options[:results_formatter]}, | |
49 | + tokenFormater: #{options[:token_formatter]}, | |
42 | 50 | }); |
43 | 51 | ") |
44 | 52 | result += javascript_tag("jQuery('##{element_id}').focus();") if options[:focus] | ... | ... |
app/jobs/notify_activity_to_profiles_job.rb
... | ... | @@ -19,8 +19,13 @@ class NotifyActivityToProfilesJob < Struct.new(:tracked_action_id) |
19 | 19 | # Notify the user |
20 | 20 | ActionTrackerNotification.create(:profile_id => tracked_action.user.id, :action_tracker_id => tracked_action.id) |
21 | 21 | |
22 | - # Notify all followers | |
23 | - ActionTrackerNotification.connection.execute("INSERT INTO action_tracker_notifications(profile_id, action_tracker_id) SELECT DISTINCT c.person_id, #{tracked_action.id} FROM profiles_circles AS p JOIN circles as c ON c.id = p.circle_id WHERE p.profile_id = #{tracked_action.user.id} AND (c.person_id NOT IN (SELECT atn.profile_id FROM action_tracker_notifications AS atn WHERE atn.action_tracker_id = #{tracked_action.id}))") | |
22 | + if target.is_a?(Scrap) && target.marked_people.present? | |
23 | + # Notify only marked people | |
24 | + ActionTrackerNotification.connection.execute("INSERT INTO action_tracker_notifications(profile_id, action_tracker_id) SELECT DISTINCT profiles.id, #{tracked_action.id} FROM profiles WHERE profiles.id IN (#{target.marked_people.map(&:id).join(',')})") | |
25 | + else | |
26 | + # Notify all followers | |
27 | + ActionTrackerNotification.connection.execute("INSERT INTO action_tracker_notifications(profile_id, action_tracker_id) SELECT DISTINCT c.person_id, #{tracked_action.id} FROM profiles_circles AS p JOIN circles as c ON c.id = p.circle_id WHERE p.profile_id = #{tracked_action.user.id} AND (c.person_id NOT IN (SELECT atn.profile_id FROM action_tracker_notifications AS atn WHERE atn.action_tracker_id = #{tracked_action.id}))") | |
28 | + end | |
24 | 29 | |
25 | 30 | if tracked_action.user.is_a? Organization |
26 | 31 | ActionTrackerNotification.connection.execute "insert into action_tracker_notifications(profile_id, action_tracker_id) " + | ... | ... |
app/models/approve_article.rb
... | ... | @@ -9,9 +9,6 @@ class ApproveArticle < Task |
9 | 9 | if target.person? && requestor != target |
10 | 10 | self.errors.add(:requestor, _('You can not post articles to other users.')) |
11 | 11 | end |
12 | - if target.organization? && !target.members.include?(requestor) && target.environment.portal_community != target | |
13 | - self.errors.add(:requestor, _('Only members can post articles on communities.')) | |
14 | - end | |
15 | 12 | end |
16 | 13 | end |
17 | 14 | ... | ... |
app/models/article.rb
1 | 1 | |
2 | 2 | class Article < ApplicationRecord |
3 | 3 | |
4 | + module Editor | |
5 | + TEXTILE = 'textile' | |
6 | + TINY_MCE = 'tiny_mce' | |
7 | + RAW_HTML = 'raw_html' | |
8 | + end | |
9 | + | |
4 | 10 | include SanitizeHelper |
5 | 11 | |
6 | 12 | attr_accessible :name, :body, :abstract, :profile, :tag_list, :parent, |
... | ... | @@ -11,7 +17,7 @@ class Article < ApplicationRecord |
11 | 17 | :highlighted, :notify_comments, :display_hits, :slug, |
12 | 18 | :external_feed_builder, :display_versions, :external_link, |
13 | 19 | :image_builder, :show_to_followers, :archived, |
14 | - :author, :display_preview, :published_at, :person_followers | |
20 | + :author, :display_preview, :published_at, :person_followers, :editor | |
15 | 21 | |
16 | 22 | extend ActsAsHavingImage::ClassMethods |
17 | 23 | acts_as_having_image |
... | ... | @@ -518,17 +524,12 @@ class Article < ApplicationRecord |
518 | 524 | ['Folder', 'Blog', 'Forum', 'Gallery'] |
519 | 525 | end |
520 | 526 | |
521 | - def self.text_article_types | |
522 | - ['TextArticle', 'TextileArticle', 'TinyMceArticle'] | |
523 | - end | |
524 | - | |
525 | 527 | scope :published, -> { where 'articles.published = ?', true } |
526 | 528 | scope :folders, -> profile { where 'articles.type IN (?)', profile.folder_types } |
527 | 529 | scope :no_folders, -> profile { where 'articles.type NOT IN (?)', profile.folder_types } |
528 | 530 | scope :galleries, -> { where "articles.type IN ('Gallery')" } |
529 | 531 | scope :images, -> { where :is_image => true } |
530 | 532 | scope :no_images, -> { where :is_image => false } |
531 | - scope :text_articles, -> { where 'articles.type IN (?)', text_article_types } | |
532 | 533 | scope :files, -> { where :type => 'UploadedFile' } |
533 | 534 | scope :with_types, -> types { where 'articles.type IN (?)', types } |
534 | 535 | |
... | ... | @@ -711,10 +712,6 @@ class Article < ApplicationRecord |
711 | 712 | false |
712 | 713 | end |
713 | 714 | |
714 | - def tiny_mce? | |
715 | - false | |
716 | - end | |
717 | - | |
718 | 715 | def folder? |
719 | 716 | false |
720 | 717 | end |
... | ... | @@ -879,6 +876,10 @@ class Article < ApplicationRecord |
879 | 876 | true |
880 | 877 | end |
881 | 878 | |
879 | + def editor?(editor) | |
880 | + self.editor == editor | |
881 | + end | |
882 | + | |
882 | 883 | private |
883 | 884 | |
884 | 885 | def sanitize_tag_list | ... | ... |
app/models/circle.rb
app/models/event.rb
app/models/external_feed.rb
app/models/person.rb
1 | 1 | # A person is the profile of an user holding all relationships with the rest of the system |
2 | 2 | class Person < Profile |
3 | 3 | |
4 | - attr_accessible :organization, :contact_information, :sex, :birth_date, :cell_phone, :comercial_phone, :jabber_id, :personal_website, :nationality, :address_reference, :district, :schooling, :schooling_status, :formation, :custom_formation, :area_of_study, :custom_area_of_study, :professional_activity, :organization_website, :following_articles | |
4 | + attr_accessible :organization, :contact_information, :sex, :birth_date, :cell_phone, :comercial_phone, :jabber_id, :personal_website, :nationality, :address_reference, :district, :schooling, :schooling_status, :formation, :custom_formation, :area_of_study, :custom_area_of_study, :professional_activity, :organization_website, :following_articles, :editor | |
5 | 5 | |
6 | 6 | SEARCH_FILTERS = { |
7 | 7 | :order => %w[more_recent more_popular more_active], |
... | ... | @@ -124,6 +124,8 @@ class Person < Profile |
124 | 124 | where 'profile_suggestions.suggestion_type = ? AND profile_suggestions.enabled = ?', 'Community', true |
125 | 125 | }, through: :suggested_profiles, source: :suggestion |
126 | 126 | |
127 | + has_and_belongs_to_many :marked_scraps, :join_table => :private_scraps, :class_name => 'Scrap' | |
128 | + | |
127 | 129 | scope :more_popular, -> { order 'friends_count DESC' } |
128 | 130 | |
129 | 131 | scope :abusers, -> { |
... | ... | @@ -344,6 +346,8 @@ class Person < Profile |
344 | 346 | |
345 | 347 | validates_associated :user |
346 | 348 | |
349 | + validates :editor, inclusion: { in: lambda { |p| p.available_editors } } | |
350 | + | |
347 | 351 | def email |
348 | 352 | self.user.nil? ? nil : self.user.email |
349 | 353 | end |
... | ... | @@ -616,8 +620,21 @@ class Person < Profile |
616 | 620 | Profile.followed_by self |
617 | 621 | end |
618 | 622 | |
623 | + def editor?(editor) | |
624 | + self.editor == editor | |
625 | + end | |
626 | + | |
619 | 627 | def in_social_circle?(person) |
620 | 628 | self.is_a_friend?(person) || super |
621 | 629 | end |
622 | 630 | |
631 | + def available_editors | |
632 | + available_editors = { | |
633 | + Article::Editor::TINY_MCE => _('TinyMCE'), | |
634 | + Article::Editor::TEXTILE => _('Textile') | |
635 | + } | |
636 | + available_editors.merge!({Article::Editor::RAW_HTML => _('Raw HTML')}) if self.is_admin? | |
637 | + available_editors | |
638 | + end | |
639 | + | |
623 | 640 | end | ... | ... |
app/models/raw_html_article.rb
... | ... | @@ -1,17 +0,0 @@ |
1 | -class RawHTMLArticle < TextArticle | |
2 | - | |
3 | - def self.type_name | |
4 | - _('HTML') | |
5 | - end | |
6 | - | |
7 | - def self.short_description | |
8 | - _('Raw HTML text article') | |
9 | - end | |
10 | - | |
11 | - def self.description | |
12 | - _('Allows HTML without filter (only for admins).') | |
13 | - end | |
14 | - | |
15 | - xss_terminate :only => [ ] | |
16 | - | |
17 | -end |
app/models/scrap.rb
... | ... | @@ -2,7 +2,7 @@ class Scrap < ApplicationRecord |
2 | 2 | |
3 | 3 | include SanitizeHelper |
4 | 4 | |
5 | - attr_accessible :content, :sender_id, :receiver_id, :scrap_id | |
5 | + attr_accessible :content, :sender_id, :receiver_id, :scrap_id, :marked_people | |
6 | 6 | |
7 | 7 | SEARCHABLE_FIELDS = { |
8 | 8 | :content => {:label => _('Content'), :weight => 1}, |
... | ... | @@ -19,6 +19,8 @@ class Scrap < ApplicationRecord |
19 | 19 | where profile_activities: {activity_type: 'Scrap'} |
20 | 20 | }, foreign_key: :activity_id, dependent: :destroy |
21 | 21 | |
22 | + has_and_belongs_to_many :marked_people, :join_table => :private_scraps, :class_name => 'Person' | |
23 | + | |
22 | 24 | after_create :create_activity |
23 | 25 | after_update :update_activity |
24 | 26 | ... | ... |
app/models/suggest_article.rb
... | ... | @@ -44,7 +44,7 @@ class SuggestArticle < Task |
44 | 44 | type = article[:type].constantize |
45 | 45 | return type if type < Article |
46 | 46 | end |
47 | - TinyMceArticle | |
47 | + TextArticle | |
48 | 48 | end |
49 | 49 | |
50 | 50 | def perform |
... | ... | @@ -65,7 +65,7 @@ class SuggestArticle < Task |
65 | 65 | |
66 | 66 | def information |
67 | 67 | variables = requestor.blank? ? {:requestor => sender} : {} |
68 | - { :message => _('%{requestor} suggested the publication of the article: %{subject}.').html_safe, | |
68 | + { :message => _('%{requestor} suggested the publication %{target_detail} of the article: %{subject}.').html_safe, | |
69 | 69 | :variables => variables } |
70 | 70 | end |
71 | 71 | ... | ... |
app/models/text_article.rb
1 | 1 | # a base class for all text article types. |
2 | 2 | class TextArticle < Article |
3 | 3 | |
4 | - xss_terminate :only => [ :name ], :on => 'validation' | |
4 | + def self.short_description | |
5 | + _('Text article') | |
6 | + end | |
7 | + | |
8 | + def self.description | |
9 | + _('Text article to create user content.') | |
10 | + end | |
11 | + | |
12 | + xss_terminate :only => [ :name, :body, :abstract ], :with => 'white_list', :on => 'validation', :if => lambda { |a| !a.editor?(Article::Editor::TEXTILE) && !a.editor?(Article::Editor::RAW_HTML) } | |
13 | + | |
14 | + include WhiteListFilter | |
15 | + filter_iframes :abstract, :body | |
16 | + def iframe_whitelist | |
17 | + profile && profile.environment && profile.environment.trusted_sites_for_iframe | |
18 | + end | |
5 | 19 | |
6 | 20 | def self.type_name |
7 | 21 | _('Article') |
... | ... | @@ -21,6 +35,18 @@ class TextArticle < Article |
21 | 35 | true |
22 | 36 | end |
23 | 37 | |
38 | + def can_display_media_panel? | |
39 | + true | |
40 | + end | |
41 | + | |
42 | + def self.can_display_blocks? | |
43 | + false | |
44 | + end | |
45 | + | |
46 | + def notifiable? | |
47 | + true | |
48 | + end | |
49 | + | |
24 | 50 | before_save :set_relative_path |
25 | 51 | |
26 | 52 | def set_relative_path |
... | ... | @@ -43,4 +69,24 @@ class TextArticle < Article |
43 | 69 | parent && parent.kind_of?(Blog) && parent.display_preview |
44 | 70 | end |
45 | 71 | |
72 | + def to_html(options ={}) | |
73 | + content = super(options) | |
74 | + content = convert_textile_to_html(content) if self.editor?(Article::Editor::TEXTILE) | |
75 | + content | |
76 | + end | |
77 | + | |
78 | + def lead(length = nil) | |
79 | + content = super(length) | |
80 | + content = convert_textile_to_html(content) if self.editor?(Article::Editor::TEXTILE) | |
81 | + content | |
82 | + end | |
83 | + | |
84 | + protected | |
85 | + | |
86 | + def convert_textile_to_html(textile) | |
87 | + converter = RedCloth.new(textile|| '') | |
88 | + converter.hard_breaks = false | |
89 | + sanitize_html(converter.to_html, :white_list) | |
90 | + end | |
91 | + | |
46 | 92 | end | ... | ... |
app/models/textile_article.rb
... | ... | @@ -1,44 +0,0 @@ |
1 | -class TextileArticle < TextArticle | |
2 | - include SanitizeHelper | |
3 | - | |
4 | - def self.short_description | |
5 | - _('Text article with Textile markup language') | |
6 | - end | |
7 | - | |
8 | - def self.description | |
9 | - _('Accessible alternative for visually impaired users.') | |
10 | - end | |
11 | - | |
12 | - def to_html(options ={}) | |
13 | - convert_to_html(body) | |
14 | - end | |
15 | - | |
16 | - def lead(length = nil) | |
17 | - if abstract.blank? | |
18 | - super | |
19 | - else | |
20 | - convert_to_html(abstract) | |
21 | - end | |
22 | - end | |
23 | - | |
24 | - def notifiable? | |
25 | - true | |
26 | - end | |
27 | - | |
28 | - def can_display_media_panel? | |
29 | - true | |
30 | - end | |
31 | - | |
32 | - def self.can_display_blocks? | |
33 | - false | |
34 | - end | |
35 | - | |
36 | - protected | |
37 | - | |
38 | - def convert_to_html(textile) | |
39 | - converter = RedCloth.new(textile|| '') | |
40 | - converter.hard_breaks = false | |
41 | - sanitize_html(converter.to_html, :white_list) | |
42 | - end | |
43 | - | |
44 | -end |
app/models/tiny_mce_article.rb
... | ... | @@ -1,37 +0,0 @@ |
1 | -class TinyMceArticle < TextArticle | |
2 | - | |
3 | - def self.short_description | |
4 | - _('Text article with visual editor') | |
5 | - end | |
6 | - | |
7 | - def self.description | |
8 | - _('Not accessible for visually impaired users.') | |
9 | - end | |
10 | - | |
11 | - xss_terminate :only => [ ] | |
12 | - | |
13 | - xss_terminate :only => [ :name, :abstract, :body ], :with => 'white_list', :on => 'validation' | |
14 | - | |
15 | - include WhiteListFilter | |
16 | - filter_iframes :abstract, :body | |
17 | - def iframe_whitelist | |
18 | - profile && profile.environment && profile.environment.trusted_sites_for_iframe | |
19 | - end | |
20 | - | |
21 | - def notifiable? | |
22 | - true | |
23 | - end | |
24 | - | |
25 | - def tiny_mce? | |
26 | - true | |
27 | - end | |
28 | - | |
29 | - def can_display_media_panel? | |
30 | - true | |
31 | - end | |
32 | - | |
33 | - def self.can_display_blocks? | |
34 | - false | |
35 | - end | |
36 | - | |
37 | -end |
app/models/uploaded_file.rb
app/views/admin_panel/_signup_intro.html.erb
... | ... | @@ -2,4 +2,4 @@ |
2 | 2 | <%= _('This text will be shown to the user on the top of the sign up form.') %> |
3 | 3 | </div> |
4 | 4 | |
5 | -<%= labelled_form_field(_('Body'), text_area(:environment, :signup_intro, :cols => 40, :style => 'width: 100%', :class => 'mceEditor')) %> | |
5 | +<%= labelled_form_field(_('Body'), text_area(:environment, :signup_intro, :cols => 40, :style => 'width: 100%', :class => current_editor)) %> | ... | ... |
app/views/admin_panel/_signup_welcome_screen.html.erb
1 | 1 | <div class='description'> |
2 | 2 | <%= _('If you enable this feature on the "Features" section of the Administration Panel, this text will be shown as a welcome message to users after signup.') %> |
3 | 3 | </div> |
4 | -<%= labelled_form_field(_('Body'), text_area(:environment, :signup_welcome_screen_body, :cols => 40, :style => 'width: 100%', :class => 'mceEditor')) %> | |
4 | +<%= labelled_form_field(_('Body'), text_area(:environment, :signup_welcome_screen_body, :cols => 40, :style => 'width: 100%', :class => current_editor)) %> | |
5 | 5 | |
6 | 6 | <div class='description'> |
7 | 7 | <%= _('If this content is left blank, the following page will be displayed to the user:') %> | ... | ... |
app/views/admin_panel/_signup_welcome_text.html.erb
... | ... | @@ -4,4 +4,4 @@ |
4 | 4 | </div> |
5 | 5 | |
6 | 6 | <%= labelled_form_field(_('Subject'), text_field(:environment, :signup_welcome_text_subject, :style => 'width:100%')) %> |
7 | -<%= labelled_form_field(_('Body'), text_area(:environment, :signup_welcome_text_body, :cols => 40, :style => 'width: 100%', :class => 'mceEditor')) %> | |
7 | +<%= labelled_form_field(_('Body'), text_area(:environment, :signup_welcome_text_body, :cols => 40, :style => 'width: 100%', :class => current_editor)) %> | ... | ... |
app/views/admin_panel/_site_info.html.erb
... | ... | @@ -31,4 +31,4 @@ |
31 | 31 | <%= balanced_table(fields)%> |
32 | 32 | |
33 | 33 | <br /> |
34 | -<%= labelled_form_field _('Homepage content'), text_area(:environment, :description, :cols => 40, :style => 'width: 90%', :class => 'mceEditor') %> | |
34 | +<%= labelled_form_field _('Homepage content'), text_area(:environment, :description, :cols => 40, :style => 'width: 90%', :class => current_editor) %> | ... | ... |
app/views/admin_panel/_terms_of_use.html.erb
app/views/admin_panel/message_for_disabled_enterprise.html.erb
1 | 1 | <h2><%= _('Site info') %></h2> |
2 | 2 | |
3 | -<%= render :file => 'shared/tiny_mce' %> | |
4 | - | |
5 | 3 | <%= labelled_form_for :environment, :url => {:action => 'site_info'} do |f| %> |
6 | 4 | |
7 | - <%= f.text_area :message_for_disabled_enterprise, :cols => 40, :style => 'width: 90%' %> | |
5 | + <%= f.text_area :message_for_disabled_enterprise, :cols => 40, :style => 'width: 90%', :class => current_editor %> | |
8 | 6 | |
9 | 7 | <%= button_bar do %> |
10 | 8 | <%= submit_button(:save, _('Save')) %> | ... | ... |
app/views/admin_panel/site_info.html.erb
app/views/cms/_article.html.erb
app/views/cms/_blog.html.erb
... | ... | @@ -2,8 +2,6 @@ |
2 | 2 | |
3 | 3 | <h1><%= _('My Blog') %></h1> |
4 | 4 | |
5 | -<%= render :file => 'shared/tiny_mce' %> | |
6 | - | |
7 | 5 | <%= required f.text_field(:name, :size => '64', :maxlength => 150, :onchange => "updateUrlField(this, 'article_slug')") %> |
8 | 6 | |
9 | 7 | <%= render :partial => 'general_fields' %> |
... | ... | @@ -53,7 +51,7 @@ |
53 | 51 | %> |
54 | 52 | </div> |
55 | 53 | |
56 | -<%= labelled_form_field(_('Description:'), text_area(:article, :body, :rows => 10, :class => 'mceEditor')) %> | |
54 | +<%= labelled_form_field(_('Description:'), text_area(:article, :body, :rows => 10, :class => current_editor)) %> | |
57 | 55 | |
58 | 56 | <div id="blog-image-builder"> |
59 | 57 | <%= f.fields_for :image_builder, @article.image do |i| %> | ... | ... |
app/views/cms/_enterprise_homepage.html.erb
1 | -<%= render :file => 'shared/tiny_mce' %> | |
2 | - | |
3 | -<%= labelled_form_field(_('Text'), text_area(:article, 'body', :cols => 40, :style => 'width:99%', :class => 'mceEditor')) %> | |
1 | +<%= labelled_form_field(_('Text'), text_area(:article, 'body', :cols => 40, :style => 'width:99%', :class => current_editor)) %> | |
4 | 2 | ... | ... |
app/views/cms/_event.html.erb
1 | 1 | <%= required_fields_message %> |
2 | 2 | |
3 | -<%# TODO add Textile help here %> | |
4 | -<%= render :file => 'shared/tiny_mce' %> | |
5 | - | |
6 | 3 | <%= required f.text_field('name', :size => '64', :maxlength => 150) %> |
7 | 4 | |
8 | 5 | <%= render :partial => 'general_fields' %> |
... | ... | @@ -16,4 +13,4 @@ |
16 | 13 | |
17 | 14 | <%= labelled_form_field(_('Address:'), text_field(:article, :address)) %> |
18 | 15 | |
19 | -<%= render :partial => 'shared/lead_and_body', :locals => {:tiny_mce => true, :body_label => 'Information about the event:'} %> | |
16 | +<%= render :partial => 'shared/lead_and_body', :locals => {:body_label => 'Information about the event:'} %> | ... | ... |
app/views/cms/_forum.html.erb
... | ... | @@ -4,18 +4,16 @@ |
4 | 4 | |
5 | 5 | <%= required_fields_message %> |
6 | 6 | |
7 | -<%= render :file => 'shared/tiny_mce' %> | |
8 | - | |
9 | 7 | <%= required f.text_field(:name, :size => '64', :maxlength => 150, :onchange => "updateUrlField(this, 'article_slug')") %> |
10 | 8 | |
11 | 9 | <%= render :partial => 'general_fields' %> |
12 | 10 | |
13 | -<%= labelled_form_field(_('Description:'), text_area(:article, :body, :class => 'mceEditor', :cols => 64, :rows => 10)) %> | |
11 | +<%= labelled_form_field(_('Description:'), text_area(:article, :body, :class => current_editor, :cols => 64, :rows => 10)) %> | |
14 | 12 | |
15 | 13 | <%= labelled_form_field(_('Posts per page:'), f.select(:posts_per_page, Forum.posts_per_page_options)) %> |
16 | 14 | |
17 | 15 | <%= labelled_form_field(_('Has terms of use:'), check_box(:article, :has_terms_of_use))%> |
18 | 16 | |
19 | 17 | <div id="text_area_terms_of_use"> |
20 | - <%= labelled_form_field(_('Terms of use:'), text_area(:article, :terms_of_use, :class => 'mceEditor',:cols => 64, :rows => 10)) %> | |
18 | + <%= labelled_form_field(_('Terms of use:'), text_area(:article, :terms_of_use, :class => current_editor,:cols => 64, :rows => 10)) %> | |
21 | 19 | </div> | ... | ... |
app/views/cms/_raw_html_article.html.erb
... | ... | @@ -1,8 +0,0 @@ |
1 | -<%= required_fields_message %> | |
2 | - | |
3 | -<%= required labelled_form_field(_('Title'), text_field(:article, 'name', :size => '64', :maxlength => 150)) %> | |
4 | - | |
5 | -<%= render :partial => 'text_fields' %> | |
6 | -<%= render :partial => 'general_fields' %> | |
7 | -<%= render :partial => 'translatable' %> | |
8 | -<%= render :partial => 'shared/lead_and_body' %> |
... | ... | @@ -0,0 +1,10 @@ |
1 | +<%= required_fields_message %> | |
2 | + | |
3 | +<%= required labelled_form_field(_('Title'), text_field(:article, 'name', :size => '72', :maxlength => 150)) %> | |
4 | + | |
5 | +<%= render :partial => 'text_fields' %> | |
6 | +<%= render :partial => 'general_fields' %> | |
7 | +<%= render :partial => 'translatable' %> | |
8 | + | |
9 | +<%= render :partial => 'shared/lead_and_body' %> | |
10 | + | ... | ... |
app/views/cms/_text_editor_sidebar.html.erb
... | ... | @@ -7,7 +7,7 @@ |
7 | 7 | |
8 | 8 | <div class='header'><strong><%= _('Insert media') %></strong><%= button('vertical-toggle', _('Show/Hide'), '#') %></div> |
9 | 9 | |
10 | - <%= render(:partial => 'textile_quick_reference') if @article.is_a?(TextileArticle) %> | |
10 | + <%= render(:partial => 'textile_quick_reference') if @article.editor?(Article::Editor::TEXTILE) %> | |
11 | 11 | <div class='text-editor-sidebar-box' id='media-upload-box'> |
12 | 12 | <div id='media-upload-form'> |
13 | 13 | <%= form_tag({ :action => 'media_upload' }, :multipart => true) do %> | ... | ... |
app/views/cms/_textile_article.html.erb
... | ... | @@ -1,10 +0,0 @@ |
1 | -<%= required_fields_message %> | |
2 | - | |
3 | -<%# TODO add Textile help here %> | |
4 | - | |
5 | -<%= required labelled_form_field(_('Title'), text_field(:article, 'name', :size => '72', :maxlength => 150)) %> | |
6 | - | |
7 | -<%= render :partial => 'text_fields' %> | |
8 | -<%= render :partial => 'general_fields' %> | |
9 | -<%= render :partial => 'translatable' %> | |
10 | -<%= render :partial => 'shared/lead_and_body' %> |
app/views/cms/_tiny_mce_article.html.erb
... | ... | @@ -1,12 +0,0 @@ |
1 | -<%= required_fields_message %> | |
2 | - | |
3 | -<%= render :file => 'shared/tiny_mce' %> | |
4 | - | |
5 | -<div> | |
6 | - <%= required labelled_form_field(_('Title'), text_field(:article, 'name', :size => '64', :maxlength => 150)) %> | |
7 | - | |
8 | - <%= render :partial => 'text_fields' %> | |
9 | - <%= render :partial => 'general_fields' %> | |
10 | - <%= render :partial => 'translatable' %> | |
11 | - <%= render :partial => 'shared/lead_and_body', :locals => {:tiny_mce => true} %> | |
12 | -</div> |
app/views/cms/suggest_an_article.html.erb
... | ... | @@ -2,8 +2,6 @@ |
2 | 2 | |
3 | 3 | <%= required_fields_message %> |
4 | 4 | |
5 | -<%= render :file => 'shared/tiny_mce' %> | |
6 | - | |
7 | 5 | <%= labelled_form_for 'task' do |f| %> |
8 | 6 | |
9 | 7 | <%= required labelled_form_field(_('Title'), text_field('task[article]', 'name', :size => 50)) %> |
... | ... | @@ -17,7 +15,7 @@ |
17 | 15 | <%= required labelled_form_field(_('Email'), text_field(:task, 'email')) %> |
18 | 16 | <% end %> |
19 | 17 | |
20 | - <%= render :partial => 'shared/lead_and_body', :locals => {:tiny_mce => true, :object => 'task[article]'} %> | |
18 | + <%= render :partial => 'shared/lead_and_body', :locals => {:object => 'task[article]'} %> | |
21 | 19 | |
22 | 20 | <%= hidden_field_tag('back_to', @back_to) %> |
23 | 21 | ... | ... |
app/views/contact/new.html.erb
... | ... | @@ -25,8 +25,7 @@ |
25 | 25 | |
26 | 26 | <%= required f.text_field(:subject) %> |
27 | 27 | |
28 | - <%= render :file => 'shared/tiny_mce' %> | |
29 | - <%= required f.text_area(:message, :class => 'mceEditor') %> | |
28 | + <%= required f.text_area(:message, :class => current_editor) %> | |
30 | 29 | |
31 | 30 | <%= labelled_form_field check_box(:contact, :receive_a_copy) + _('I want to receive a copy of the message in my e-mail.'), '' %> |
32 | 31 | ... | ... |
app/views/email_templates/_form.html.erb
... | ... | @@ -19,8 +19,7 @@ |
19 | 19 | <%= @template_params_allowed %> |
20 | 20 | </div> |
21 | 21 | </div> |
22 | - <%= render :file => 'shared/tiny_mce' %> | |
23 | - <%= labelled_form_field(_('Body:'), f.text_area(:body, :class => 'mceEditor')) %> | |
22 | + <%= labelled_form_field(_('Body:'), f.text_area(:body, :class => current_editor)) %> | |
24 | 23 | </div> |
25 | 24 | |
26 | 25 | <div class="actions"> | ... | ... |
app/views/layouts/application-ng.html.erb
... | ... | @@ -35,6 +35,9 @@ |
35 | 35 | noosfero.profile = <%= (@profile.identifier if @profile).to_json.html_safe %> |
36 | 36 | </script> |
37 | 37 | |
38 | + <% if current_editor_is?(Article::Editor::TINY_MCE) %> | |
39 | + <%= render :file => 'shared/tiny_mce' %> | |
40 | + <% end %> | |
38 | 41 | </head> |
39 | 42 | <body class="<%= h body_classes %>"> |
40 | 43 | <a href="#content" id="link-go-content"><span><%= _("Go to the content") %></span></a> |
... | ... | @@ -72,7 +75,7 @@ |
72 | 75 | </div><!-- end id="content" --> |
73 | 76 | </div><!-- end id="wrap-2" --> |
74 | 77 | </div><!-- end id="wrap-1" --> |
75 | - <%= render_environment_features(:logged_in) if logged_in? %> | |
78 | + <%= render_environment_features(:logged_in).html_safe if logged_in? %> | |
76 | 79 | <div id="footer"> |
77 | 80 | <div id="theme-footer"> |
78 | 81 | <%= theme_footer %> | ... | ... |
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 => "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 | - <%= limited_text_area :scrap, :content, 420, 'leave_scrap_content', :cols => 50, :rows => 2, :class => 'autogrow' %> | |
4 | + <%= form_remote_tag :url => {:controller => 'profile', :action => 'leave_scrap', :tab_action => 'wall' }, :update => 'profile_activities', :success => "jQuery('#leave_scrap_content').val(''); jQuery('#filter-followed').tokenInput('clear')", :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 | + <%= limited_text_area :scrap, :content, 420, 'leave_scrap_content', :rows => 2, :class => 'autogrow' %> | |
6 | + <% if profile == user %> | |
7 | + <%= token_input_field_tag(:filter_followed, 'filter-followed', {:action => 'search_followed'}, {:theme => 'facebook', :placeholder => _('Filter followed, friends or group of friends to send them a private scrap...')}) %> | |
8 | + <% end %> | |
6 | 9 | <%= submit_button :new, _('Share') %> |
7 | 10 | <% end %> |
8 | 11 | </div> | ... | ... |
app/views/profile/send_mail.html.erb
... | ... | @@ -22,8 +22,7 @@ |
22 | 22 | |
23 | 23 | <%= labelled_form_field(_('Subject:'), f.text_field(:subject)) %> |
24 | 24 | |
25 | - <%= render :file => 'shared/tiny_mce' %> | |
26 | - <%= labelled_form_field(_('Body:'), f.text_area(:body, :class => 'mceEditor')) %> | |
25 | + <%= labelled_form_field(_('Body:'), f.text_area(:body, :class => 'body ' + current_editor)) %> | |
27 | 26 | |
28 | 27 | <%= submit_button(:send, _('Send')) %> |
29 | 28 | <%= button :cancel, _('Cancel e-mail'), :back %> | ... | ... |
app/views/profile_editor/_pending_tasks.html.erb
... | ... | @@ -4,7 +4,7 @@ |
4 | 4 | <div class='pending-tasks'> |
5 | 5 | <h2><%= _('You have %s pending requests' % @pending_tasks.count) %></h2> |
6 | 6 | <ul> |
7 | - <%= safe_join(@pending_tasks.limit(5).map {|task| content_tag('li', task_information(task).html_safe)}) %> | |
7 | + <%= safe_join(@pending_tasks.limit(5).map {|task| content_tag('li', task_information(task, params).html_safe)}) %> | |
8 | 8 | </ul> |
9 | 9 | <%= button(:todo, _('Process requests'), :controller => 'tasks', :action => 'index') %> |
10 | 10 | </div> | ... | ... |
app/views/profile_editor/_person.html.erb
... | ... | @@ -16,6 +16,8 @@ |
16 | 16 | </div> |
17 | 17 | </div> |
18 | 18 | |
19 | + <%= select_editor(_('Editor'), 'profile_data', 'editor', {}) %> | |
20 | + | |
19 | 21 | <%= safe_join(@plugins.dispatch(:profile_info_extra_contents).collect { |content| instance_exec(&content) }, "") %> |
20 | 22 | |
21 | 23 | <div class="formfieldline"> | ... | ... |
app/views/profile_editor/header_footer.html.erb
1 | -<%= render :file => 'shared/tiny_mce' %> | |
2 | - | |
3 | 1 | <h1><%= _('Editing header and footer') %></h1> |
4 | 2 | |
5 | 3 | <%= form_tag do %> |
... | ... | @@ -21,9 +19,9 @@ |
21 | 19 | </div> |
22 | 20 | <% end %> |
23 | 21 | <h2><%= _('Content for header ') %></h2> |
24 | - <%= text_area_tag(:custom_header, @header, :style => 'width: 100%; height: 150px;', :class => 'mceEditor') %> | |
22 | + <%= text_area_tag(:custom_header, @header, :style => 'width: 100%; height: 150px;', :class => current_editor) %> | |
25 | 23 | <h2><%= _('Content for footer') %></h2> |
26 | - <%= text_area_tag(:custom_footer, @footer, :style => 'width: 100%; height: 150px;', :class => 'mceEditor') %> | |
24 | + <%= text_area_tag(:custom_footer, @footer, :style => 'width: 100%; height: 150px;', :class => current_editor) %> | |
27 | 25 | <%= button_bar do %> |
28 | 26 | <%= submit_button(:save, _('Save')) %> |
29 | 27 | <%= button(:cancel, _('Cancel'), :action => 'index') %> | ... | ... |
app/views/profile_editor/welcome_page.html.erb
... | ... | @@ -8,7 +8,7 @@ |
8 | 8 | <%= _('Your welcome page will only be displayed if this options is selected.') %> |
9 | 9 | </div> |
10 | 10 | |
11 | - <%= f.text_area(:body, :cols => 40, :style => 'width: 100%', :class => 'mceEditor') %> | |
11 | + <%= f.text_area(:body, :cols => 40, :style => 'width: 100%', :class => current_editor) %> | |
12 | 12 | <div class='explanation'> |
13 | 13 | <%= _('This page will be displayed to the user after his signup with this template.') %> |
14 | 14 | </div> |
... | ... | @@ -17,5 +17,3 @@ |
17 | 17 | <%= submit_button('save', _('Save'), :cancel => @back_to) %> |
18 | 18 | <% end %> |
19 | 19 | <% end %> |
20 | - | |
21 | -<%= render :file => 'shared/tiny_mce' %> | ... | ... |
app/views/shared/_lead_and_body.html.erb
app/views/shared/tiny_mce.html.erb
... | ... | @@ -47,7 +47,9 @@ function tinymce_macros_setup(editor) { |
47 | 47 | tinymce.PluginManager.add('macrosPlugin', tinymce.plugins.MacrosPlugin); |
48 | 48 | |
49 | 49 | jQuery(document).ready(function () { |
50 | - <%= tinymce_init_js :mode => mode %> | |
50 | + <%= tinymce_init_js %> | |
51 | + <%= tinymce_init_js :mode => 'simple' %> | |
52 | + <%= tinymce_init_js :mode => 'restricted' %> | |
51 | 53 | }); |
52 | 54 | </script> |
53 | 55 | ... | ... |
app/views/spam/_task.html.erb
... | ... | @@ -2,7 +2,7 @@ |
2 | 2 | <%= render :partial => 'tasks/task_icon', :locals => {:task => task} %> |
3 | 3 | <%= render :partial => 'tasks/task_title', :locals => {:task => task} %> |
4 | 4 | <div class="task-information"> |
5 | - <%= task_information(task) %> | |
5 | + <%= task_information(task, params) %> | |
6 | 6 | </div> |
7 | 7 | |
8 | 8 | <%= yield %> <%# ??? %> | ... | ... |
app/views/tasks/_approve_article_accept_details.html.erb
1 | 1 | <%= task_email_template(_('Select an acceptance email template:'), @acceptance_email_templates, task) %> |
2 | 2 | |
3 | -<%= render :file => 'shared/tiny_mce' %> | |
4 | - | |
5 | 3 | <%= labelled_form_field(_('Create a link'), f.check_box(:create_link)) %> |
6 | 4 | |
7 | 5 | <%= labelled_form_field(_('Name for publishing'), f.text_field(:name)) %> |
8 | 6 | <%= select_profile_folder(_('Select the folder where the article must be published'), "tasks[#{task.id}][task][article_parent_id]", task.target) %> |
9 | 7 | <%= labelled_form_field(_('Highlight this article'), f.check_box(:highlighted)) %> |
10 | 8 | |
11 | -<% tiny = task.article && task.article.tiny_mce? ? {:tiny_mce => true} : {} %> | |
12 | -<%= render :partial => 'shared/lead_and_body', :locals => {:lead_id => task.id, :f => f}.merge(tiny)%> | |
9 | +<%= render :partial => 'shared/lead_and_body', :locals => {:lead_id => task.id, :f => f}%> | |
13 | 10 | |
14 | 11 | <%= labelled_form_field _('Comment for author'), f.text_field(:closing_statment, :style => 'width: 488px;') %> |
15 | 12 | ... | ... |
app/views/tasks/_suggest_article_accept_details.html.erb
1 | -<%= render :file => 'shared/tiny_mce' %> | |
2 | - | |
3 | 1 | <% unless task.requestor %> |
4 | 2 | <%= labelled_form_field(_("Sent by: "), f.text_field(:name)) %> |
5 | 3 | <p><%= label_tag(_("Email: %s") % task.email) %> </p> |
... | ... | @@ -14,5 +12,5 @@ |
14 | 12 | <%= labelled_form_field(_('Highlight this article'), a.check_box(:highlighted)) %> |
15 | 13 | |
16 | 14 | <%= a.hidden_field(:type) %> |
17 | - <%= render :partial => 'shared/lead_and_body', :locals => {:tiny_mce => true, :f => a, :lead_id => task.id} %> | |
15 | + <%= render :partial => 'shared/lead_and_body', :locals => {:f => a, :lead_id => task.id} %> | |
18 | 16 | <% end %> | ... | ... |
app/views/tasks/_task.html.erb
app/views/tasks/_task_processed.html.erb
app/views/users/send_mail.html.erb
... | ... | @@ -2,7 +2,6 @@ |
2 | 2 | |
3 | 3 | <%= error_messages_for :mailing %> |
4 | 4 | |
5 | -<%= render :file => 'shared/tiny_mce' %> | |
6 | 5 | <%= form_for :mailing do |f| %> |
7 | 6 | <div class="recipients"> |
8 | 7 | <%= label_tag(_("Recipients: "), nil, { class: "formlabel" }) %> |
... | ... | @@ -14,7 +13,7 @@ |
14 | 13 | </div> |
15 | 14 | </div> |
16 | 15 | <%= labelled_form_field(_('Subject:'), f.text_field(:subject)) %> |
17 | - <%= labelled_form_field(_('Body:'), f.text_area(:body, :class => 'mceEditor')) %> | |
16 | + <%= labelled_form_field(_('Body:'), f.text_area(:body, :class => current_editor)) %> | |
18 | 17 | <%= submit_button(:send, _('Send')) %> |
19 | 18 | <%= button :cancel, _('Cancel e-mail'), :controller => 'users' %> |
20 | 19 | <% end %> | ... | ... |
db/migrate/20160809123835_add_people_and_article_editor.rb
0 → 100644
... | ... | @@ -0,0 +1,9 @@ |
1 | +class AddPeopleAndArticleEditor < ActiveRecord::Migration | |
2 | + def change | |
3 | + add_column :profiles, :editor, :string, :null => false, :default => Article::Editor::TINY_MCE | |
4 | + add_column :articles, :editor, :string, :null => false, :default => Article::Editor::TINY_MCE | |
5 | + Article.where(:type => 'TextileArticle').update_all(:type => 'TextArticle', :editor => Article::Editor::TEXTILE) | |
6 | + Article.where(:type => 'TinyMceArticle').update_all(:type => 'TextArticle', :editor => Article::Editor::TINY_MCE) | |
7 | + Article.where(:type => 'RawHTMLArticle').update_all(:type => 'TextArticle', :editor => Article::Editor::RAW_HTML) | |
8 | + end | |
9 | +end | ... | ... |
db/schema.rb
... | ... | @@ -11,7 +11,7 @@ |
11 | 11 | # |
12 | 12 | # It's strongly recommended that you check this file into your version control system. |
13 | 13 | |
14 | -ActiveRecord::Schema.define(version: 20160608123748) do | |
14 | +ActiveRecord::Schema.define(version: 20160809123835) do | |
15 | 15 | |
16 | 16 | # These are extensions that must be enabled in order to support this database |
17 | 17 | enable_extension "plpgsql" |
... | ... | @@ -168,6 +168,7 @@ ActiveRecord::Schema.define(version: 20160608123748) do |
168 | 168 | t.boolean "show_to_followers", default: true |
169 | 169 | t.integer "followers_count", default: 0 |
170 | 170 | t.boolean "archived", default: false |
171 | + t.string "editor", default: "tiny_mce", null: false | |
171 | 172 | end |
172 | 173 | |
173 | 174 | add_index "articles", ["comments_count"], name: "index_articles_on_comments_count", using: :btree |
... | ... | @@ -528,6 +529,11 @@ ActiveRecord::Schema.define(version: 20160608123748) do |
528 | 529 | t.datetime "updated_at" |
529 | 530 | end |
530 | 531 | |
532 | + create_table "private_scraps", force: :cascade do |t| | |
533 | + t.integer "person_id" | |
534 | + t.integer "scrap_id" | |
535 | + end | |
536 | + | |
531 | 537 | create_table "product_qualifiers", force: :cascade do |t| |
532 | 538 | t.integer "product_id" |
533 | 539 | t.integer "qualifier_id" |
... | ... | @@ -630,15 +636,16 @@ ActiveRecord::Schema.define(version: 20160608123748) do |
630 | 636 | t.boolean "is_template", default: false |
631 | 637 | t.integer "template_id" |
632 | 638 | t.string "redirection_after_login" |
633 | - t.integer "friends_count", default: 0, null: false | |
634 | - t.integer "members_count", default: 0, null: false | |
635 | - t.integer "activities_count", default: 0, null: false | |
639 | + t.integer "friends_count", default: 0, null: false | |
640 | + t.integer "members_count", default: 0, null: false | |
641 | + t.integer "activities_count", default: 0, null: false | |
636 | 642 | t.string "personal_website" |
637 | 643 | t.string "jabber_id" |
638 | 644 | t.integer "welcome_page_id" |
639 | 645 | t.boolean "allow_members_to_invite", default: true |
640 | 646 | t.boolean "invite_friends_only", default: false |
641 | 647 | t.boolean "secret", default: false |
648 | + t.string "editor", default: "tiny_mce", null: false | |
642 | 649 | end |
643 | 650 | |
644 | 651 | add_index "profiles", ["activities_count"], name: "index_profiles_on_activities_count", using: :btree | ... | ... |
debian/control
... | ... | @@ -60,8 +60,9 @@ Depends: adduser, |
60 | 60 | ruby-feedparser (>= 0.7-3~), |
61 | 61 | ruby-gettext, |
62 | 62 | ruby-grape, |
63 | - ruby-grape-entity (= 0.4.8), | |
63 | + ruby-grape-entity (>= 0.4.8), | |
64 | 64 | ruby-grape-logging, |
65 | + ruby-liquid (>= 3.0.3), | |
65 | 66 | ruby-minitest, |
66 | 67 | ruby-nokogiri, |
67 | 68 | ruby-pg, |
... | ... | @@ -107,7 +108,7 @@ Description: free web-based platform for social networks (apache frontend) |
107 | 108 | |
108 | 109 | Package: noosfero-chat |
109 | 110 | Architecture: all |
110 | -Depends: noosfero (>= 1.2), ejabberd, odbc-postgresql, pidgin-data | |
111 | +Depends: noosfero (>= 1.5.1), ejabberd (>= 16.06), odbc-postgresql, pidgin-data | |
111 | 112 | Description: free web-based platform for social networks (ejabberd based chat) |
112 | 113 | Noosfero is a web platform for social and solidarity economy networks with |
113 | 114 | blog, e-Porfolios, CMS, RSS, thematic discussion, events agenda and collective | ... | ... |
... | ... | @@ -0,0 +1,18 @@ |
1 | +#!/bin/sh | |
2 | + | |
3 | +set -e | |
4 | + | |
5 | +. /usr/share/debconf/confmodule | |
6 | +if [ -f /usr/share/dbconfig-common/dpkg/config ]; then | |
7 | + # comma-separated, e.g. "mysql, pgsql, sqlite3" | |
8 | + dbc_dbtypes="pgsql" | |
9 | + | |
10 | + . /usr/share/dbconfig-common/dpkg/config | |
11 | +fi | |
12 | + | |
13 | +db_input high noosfero-chat/environment || true | |
14 | +db_go | |
15 | + | |
16 | +db_input high noosfero-chat/admin || true | |
17 | +db_go | |
18 | + | ... | ... |
debian/noosfero-chat.install
debian/noosfero-chat.postinst
... | ... | @@ -4,18 +4,32 @@ set -e |
4 | 4 | |
5 | 5 | . /usr/share/debconf/confmodule |
6 | 6 | |
7 | -echo -n "Fetching noosfero domain ..." | |
8 | -domain=$(noosfero-runner 'puts Environment.default.default_hostname(true)') | |
7 | +db_get noosfero-chat/environment | |
8 | +if [ ! -z "$RET" ]; then | |
9 | + environment="${RET}_production" | |
10 | +else | |
11 | + environment="production" | |
12 | +fi | |
13 | + | |
14 | +domain=$(noosfero-runner 'puts Environment.default.default_hostname(true)' $environment) | |
9 | 15 | echo " [domain = $domain]" |
10 | 16 | |
11 | -ejabberd_config='/etc/ejabberd/ejabberd.cfg' | |
17 | +db_get noosfero-chat/admin | |
18 | +if [ ! -z "$RET" ]; then | |
19 | + admin="$RET@$domain" | |
20 | +else | |
21 | + admin="admin@$domain" | |
22 | +fi | |
23 | +echo " [admin = $admin]" | |
24 | + | |
25 | +ejabberd_config='/etc/ejabberd/ejabberd.yml' | |
12 | 26 | if test -f $ejabberd_config; then |
13 | - sed -i "s/acl, *\([^,]*\), *{user, *\([^,]*\), *[^}]*/acl, \1, {user, \2, \"$domain\"/" /etc/ejabberd/ejabberd.cfg | |
14 | - sed -i "s/hosts, *\[[^]]*/hosts, [\"$domain\"/" /etc/ejabberd/ejabberd.cfg | |
27 | + sed -i "s/HOST_DOMAIN/$domain/" /etc/ejabberd/ejabberd.yml | |
28 | + sed -i "s/ACL_ADMIN_ACCOUNT/$admin/" /etc/ejabberd/ejabberd.yml | |
15 | 29 | fi |
16 | 30 | |
17 | 31 | echo -n 'Fetching noosfero database name ...' |
18 | -noosfero_database=$(noosfero-runner 'puts Environment.connection_config[:database]') | |
32 | +noosfero_database=$(noosfero-runner 'puts Environment.connection_config[:database]' $environment) | |
19 | 33 | echo " [database = $noosfero_database]" |
20 | 34 | |
21 | 35 | echo 'Creating ejabberd schema ...' |
... | ... | @@ -29,7 +43,7 @@ else |
29 | 43 | echo " => GRANT CREATE ON DATABASE $noosfero_database TO $noosfero_user;" |
30 | 44 | fi |
31 | 45 | |
32 | -su - $noosfero_user -c 'rails dbconsole production < /usr/share/noosfero/util/chat/postgresql/ejabberd.sql > /dev/null' | |
46 | +su - $noosfero_user -c "rails dbconsole $environment < /usr/share/noosfero/util/chat/postgresql/ejabberd.sql > /dev/null" | |
33 | 47 | |
34 | 48 | if which update-noosfero-odbc &> /dev/null ; then |
35 | 49 | update-noosfero-odbc |
... | ... | @@ -37,6 +51,7 @@ fi |
37 | 51 | |
38 | 52 | ejabberd_default='/etc/default/ejabberd' |
39 | 53 | noosfero_chat_default='/etc/default/noosfero-chat' |
54 | + | |
40 | 55 | if test -f $ejabberd_default; then |
41 | 56 | if ! cat $ejabberd_default | grep "^\. $noosfero_chat_default" > /dev/null ; then |
42 | 57 | echo 'Extending ejabberd defaults with noosfero-chat defaults ...' | ... | ... |
... | ... | @@ -0,0 +1,19 @@ |
1 | +Template: noosfero-chat/environment | |
2 | +Type: string | |
3 | +Description: Choose the environment in which the chat will be installed | |
4 | + Noosfero Chat currently does not support multitenancy environments. If your | |
5 | + system is using a multitenancy setup with multiple environments, you will need | |
6 | + to fill below the environment in which you want the chat installed | |
7 | + uses. For example, if your environment is 'social_production', you should | |
8 | + enter below 'social'. | |
9 | + . | |
10 | + If you are not using a multitenancy setup, you may leave this option blank, in | |
11 | + which case the used environment will be 'production'. | |
12 | + | |
13 | +Template: noosfero-chat/admin | |
14 | +Type: string | |
15 | +Description: Choose the admin of the chat | |
16 | + Enter the user identifier to define the user that will have administrator | |
17 | + privileges on the chat. | |
18 | + . | |
19 | + If you leave this option blank the user defined will be 'admin'. | ... | ... |
features/edit_article.feature
... | ... | @@ -155,7 +155,7 @@ Feature: edit article |
155 | 155 | Given I am on joaosilva's control panel |
156 | 156 | And I follow "Manage Content" |
157 | 157 | And I follow "New content" |
158 | - When I follow "Text article with Textile markup language" | |
158 | + When I follow "Text article" | |
159 | 159 | Then I should see "Tag list" |
160 | 160 | When I fill in "Title" with "Article with tags" |
161 | 161 | And I fill in "Tag list" with "aurium, bug" |
... | ... | @@ -168,7 +168,7 @@ Feature: edit article |
168 | 168 | Given I am on joaosilva's control panel |
169 | 169 | And I follow "Manage Content" |
170 | 170 | When I follow "New content" |
171 | - When I follow "Text article with visual editor" | |
171 | + When I follow "Text article" | |
172 | 172 | And I fill in "Title" with "My Article" |
173 | 173 | And I press "Save" |
174 | 174 | Then I should see "My Article" |
... | ... | @@ -203,8 +203,8 @@ Feature: edit article |
203 | 203 | And I press "Save" |
204 | 204 | Then I should be on /joaosilva/my-folder |
205 | 205 | When I follow "New article" |
206 | - And I should see "Text article with visual editor" | |
207 | - And I follow "Text article with visual editor" | |
206 | + And I should see "Text article" | |
207 | + And I follow "Text article" | |
208 | 208 | And I fill in "Title" with "My Article" |
209 | 209 | And I press "Save" |
210 | 210 | Then I should see "My Article" |
... | ... | @@ -222,12 +222,11 @@ Feature: edit article |
222 | 222 | And I press "Save" |
223 | 223 | Then I should be on /joaosilva/my-folder |
224 | 224 | When I follow "New article" |
225 | - And I should see "Text article with visual editor" | |
226 | - And I follow "Text article with visual editor" | |
225 | + And I should see "Text article" | |
226 | + And I follow "Text article" | |
227 | 227 | And I follow "Cancel" within ".no-boxes" |
228 | 228 | Then I should be on /joaosilva/my-folder |
229 | 229 | |
230 | - @selenium | |
231 | 230 | Scenario: save and continue |
232 | 231 | Given I am on /joaosilva/save-the-whales |
233 | 232 | And I follow "Edit" |
... | ... | @@ -240,8 +239,8 @@ Feature: edit article |
240 | 239 | Given I am on joaosilva's control panel |
241 | 240 | When I follow "Manage Content" |
242 | 241 | And I follow "New content" |
243 | - And I should see "Text article with visual editor" | |
244 | - And I follow "Text article with visual editor" | |
242 | + And I should see "Text article" | |
243 | + And I follow "Text article" | |
245 | 244 | And I fill in "Title" with "My new article" |
246 | 245 | And I fill in "Text" with "text for the new article" |
247 | 246 | And I press "Save and continue" |
... | ... | @@ -287,7 +286,7 @@ Feature: edit article |
287 | 286 | Given I am on joaosilva's control panel |
288 | 287 | And I follow "Manage Content" |
289 | 288 | And I follow "New content" |
290 | - When I follow "Text article with visual editor" | |
289 | + When I follow "Text article" | |
291 | 290 | And I fill in "Title" with "My time testing Article" |
292 | 291 | And I fill in "Publish date" with "1980-11-15 20:37" |
293 | 292 | And I press "Save" | ... | ... |
features/forum.feature
... | ... | @@ -99,8 +99,8 @@ Feature: forum |
99 | 99 | And I check "Has terms of use:" |
100 | 100 | And I press "Save" |
101 | 101 | When I follow "New discussion topic" |
102 | - And I should see "Text article with visual editor" | |
103 | - And I follow "Text article with visual editor" | |
102 | + And I should see "Text article" | |
103 | + And I follow "Text article" | |
104 | 104 | And I fill in "Title" with "Topic" |
105 | 105 | And I press "Save" |
106 | 106 | And I am logged in as "mariasilva" | ... | ... |
features/media_panel_upload_files.feature
... | ... | @@ -8,7 +8,7 @@ Feature: uploads items on media panel |
8 | 8 | | joaosilva | Joao Silva | |
9 | 9 | And feature "media_panel" is enabled on environment |
10 | 10 | And I am logged in as "joaosilva" |
11 | - And I am on /myprofile/joaosilva/cms/new?type=TinyMceArticle | |
11 | + And I am on /myprofile/joaosilva/cms/new?type=TextArticle | |
12 | 12 | |
13 | 13 | Scenario: see media panel collapsed |
14 | 14 | Then I should see "Insert media" |
... | ... | @@ -123,7 +123,7 @@ Feature: uploads items on media panel |
123 | 123 | Given the following files |
124 | 124 | | owner | file | mime | |
125 | 125 | | joaosilva | other-pic.jpg | image/jpeg | |
126 | - When I go to /myprofile/joaosilva/cms/new?type=TinyMceArticle | |
126 | + When I go to /myprofile/joaosilva/cms/new?type=TextArticle | |
127 | 127 | And I follow "Show/Hide" |
128 | 128 | And I select "Recent media" from "parent_id" within "#published-media" |
129 | 129 | Then I should see div with title "other-pic.jpg" within ".items" |
... | ... | @@ -148,7 +148,7 @@ Feature: uploads items on media panel |
148 | 148 | | owner | file | mime | parent | |
149 | 149 | | joaosilva | rails.png | image/png | other-gallery | |
150 | 150 | | joaosilva | other-pic.jpg | image/jpeg | gallery | |
151 | - When I go to /myprofile/joaosilva/cms/new?type=TinyMceArticle | |
151 | + When I go to /myprofile/joaosilva/cms/new?type=TextArticle | |
152 | 152 | And I follow "Show/Hide" |
153 | 153 | And I select "joaosilva/Gallery" from "parent_id" within "#published-media" |
154 | 154 | Then I should see div with title "other-pic.jpg" within ".items" |
... | ... | @@ -165,7 +165,7 @@ Feature: uploads items on media panel |
165 | 165 | And the following files |
166 | 166 | | owner | file | mime | parent | |
167 | 167 | | joaosilva | other-pic.jpg | image/jpeg | gallery | |
168 | - When I go to /myprofile/joaosilva/cms/new?type=TinyMceArticle | |
168 | + When I go to /myprofile/joaosilva/cms/new?type=TextArticle | |
169 | 169 | And I follow "Show/Hide" |
170 | 170 | And I select "joaosilva/Gallery" from "parent_id" within "#published-media" |
171 | 171 | And I select "joaosilva/Gallery" from "parent_id" within "#media-upload-form" |
... | ... | @@ -187,7 +187,7 @@ Feature: uploads items on media panel |
187 | 187 | And the following files |
188 | 188 | | owner | file | mime | parent | |
189 | 189 | | joaosilva | rails.png | image/png | other-gallery | |
190 | - When I go to /myprofile/joaosilva/cms/new?type=TinyMceArticle | |
190 | + When I go to /myprofile/joaosilva/cms/new?type=TextArticle | |
191 | 191 | And I follow "Show/Hide" |
192 | 192 | And I select "Recent media" from "parent_id" within "#published-media" |
193 | 193 | And I fill in "Search" with "rails" within "#published-media" |
... | ... | @@ -227,7 +227,7 @@ Feature: uploads items on media panel |
227 | 227 | | joaosilva | other-pic.jpg | image/jpeg | my-gallery | |
228 | 228 | | joaosilva | rails.png | image/png | gallery | |
229 | 229 | | joaosilva | other-pic.jpg | image/jpeg | gallery | |
230 | - When I go to /myprofile/joaosilva/cms/new?type=TinyMceArticle | |
230 | + When I go to /myprofile/joaosilva/cms/new?type=TextArticle | |
231 | 231 | And I follow "Show/Hide" |
232 | 232 | And I should not see "View all" |
233 | 233 | And I attach the file "public/503.jpg" to "file" | ... | ... |
features/new_content_on_cms.feature
... | ... | @@ -15,8 +15,7 @@ Feature: create content on cms |
15 | 15 | |
16 | 16 | Scenario: list all content types |
17 | 17 | Given I follow "New content" |
18 | - Then I should see "Text article with visual editor" | |
19 | - And I should see "Text article with Textile markup" | |
18 | + Then I should see "Text article" | |
20 | 19 | And I should see "Folder" |
21 | 20 | And I should see "Blog" |
22 | 21 | And I should see "Uploaded file" |
... | ... | @@ -30,22 +29,6 @@ Feature: create content on cms |
30 | 29 | And I go to joaosilva's cms |
31 | 30 | Then I should see "My Folder" |
32 | 31 | |
33 | - Scenario: create a tiny_mce article | |
34 | - Given I follow "New content" | |
35 | - When I follow "Text article with visual editor" | |
36 | - And I fill in "Title" with "My tiny_mce article" | |
37 | - And I press "Save" | |
38 | - And I go to joaosilva's cms | |
39 | - Then I should see "My tiny_mce article" | |
40 | - | |
41 | - Scenario: create a textile article | |
42 | - Given I follow "New content" | |
43 | - When I follow "Text article with Textile markup" | |
44 | - And I fill in "Title" with "My textile article" | |
45 | - And I press "Save" | |
46 | - And I go to joaosilva's cms | |
47 | - Then I should see "My textile article" | |
48 | - | |
49 | 32 | Scenario: create a Blog |
50 | 33 | Given I follow "New content" |
51 | 34 | When I follow "Blog" | ... | ... |
features/profile_search.feature
... | ... | @@ -47,8 +47,8 @@ Feature: search inside a profile |
47 | 47 | And I go to joaosilva's profile |
48 | 48 | And I fill in "q" with "article" |
49 | 49 | And I press "Search" |
50 | - Then I should see "public article" within ".main-block" | |
51 | - And I should not see "private article" within ".main-block" | |
50 | + Then I should see "published article" within ".main-block" | |
51 | + And I should not see "unpublished article" within ".main-block" | |
52 | 52 | |
53 | 53 | Scenario: search on environment |
54 | 54 | Given I go to joaosilva's profile | ... | ... |
features/publish_article.feature
... | ... | @@ -60,11 +60,10 @@ Feature: publish article |
60 | 60 | And I am on mariasilva's control panel |
61 | 61 | And I follow "Manage Content" |
62 | 62 | And I follow "New content" |
63 | - And I should see "Text article with Textile markup language" | |
64 | - And I follow "Text article with Textile markup language" | |
63 | + And I should see "Text article" | |
64 | + And I follow "Text article" | |
65 | 65 | And I fill in the following: |
66 | 66 | | Title | Sample Article | |
67 | - | Text | this is Maria's first published article | | |
68 | 67 | And I press "Save" |
69 | 68 | And I follow "Spread" |
70 | 69 | And I type in "Sample Community" into autocomplete list "search-communities-to-publish" and I choose "Sample Community" | ... | ... |
features/search_contents.feature
... | ... | @@ -22,7 +22,6 @@ Feature: search contents |
22 | 22 | Then I should see "whales and dolphins" within ".search-text-article-item" |
23 | 23 | And I should see "whales and dolphins" within ".only-one-result-box" |
24 | 24 | And I should not see "bees and butterflies" |
25 | - And The page should contain ".icon-content-textile-article" | |
26 | 25 | When I follow "whales and dolphins" |
27 | 26 | Then I should be on article "whales and dolphins" |
28 | 27 | ... | ... |
features/secret_community.feature
... | ... | @@ -52,7 +52,7 @@ Feature: Use a secret community |
52 | 52 | And I go to mycommunity's control panel |
53 | 53 | And I follow "Manage Content" |
54 | 54 | And I follow "New content" |
55 | - And I follow "Text article with visual editor" | |
55 | + And I follow "Text article" | |
56 | 56 | And I fill in "Title" with "My public article" |
57 | 57 | And I choose "Public" |
58 | 58 | And I press "Save and continue" | ... | ... |
features/step_definitions/noosfero_steps.rb
... | ... | @@ -101,7 +101,7 @@ end |
101 | 101 | |
102 | 102 | Given /^the following (articles|events|blogs|folders|forums|galleries|uploaded files|rss feeds)$/ do |content, table| |
103 | 103 | klass = { |
104 | - 'articles' => TextileArticle, | |
104 | + 'articles' => TextArticle, | |
105 | 105 | 'events' => Event, |
106 | 106 | 'blogs' => Blog, |
107 | 107 | 'folders' => Folder, |
... | ... | @@ -118,6 +118,7 @@ Given /^the following (articles|events|blogs|folders|forums|galleries|uploaded f |
118 | 118 | language = item.delete("language") |
119 | 119 | category = item.delete("category") |
120 | 120 | filename = item.delete("filename") |
121 | + mime = item.delete("mime") || 'binary/octet-stream' | |
121 | 122 | translation_of_id = nil |
122 | 123 | if item["translation_of"] |
123 | 124 | if item["translation_of"] != "nil" |
... | ... | @@ -131,7 +132,7 @@ Given /^the following (articles|events|blogs|folders|forums|galleries|uploaded f |
131 | 132 | :language => language, |
132 | 133 | :translation_of_id => translation_of_id) |
133 | 134 | if !filename.blank? |
134 | - item.merge!(:uploaded_data => fixture_file_upload("/files/#{filename}", 'binary/octet-stream')) | |
135 | + item.merge!(:uploaded_data => fixture_file_upload("/files/#{filename}", mime)) | |
135 | 136 | end |
136 | 137 | result = klass.new(item) |
137 | 138 | if !parent.blank? |
... | ... | @@ -178,7 +179,7 @@ Given /^the following articles? with images?$/ do |table| |
178 | 179 | img_tag = "<img " |
179 | 180 | img.each { |attr, value| img_tag += "#{attr}=\"#{value}\" " } |
180 | 181 | img_tag += "/>" |
181 | - article = TinyMceArticle.new(:profile => owner, :name => item[:name], :body => img_tag) | |
182 | + article = TextArticle.new(:profile => owner, :name => item[:name], :body => img_tag) | |
182 | 183 | if item[:parent] |
183 | 184 | article.parent = Article.find_by slug: item[:parent] |
184 | 185 | end |
... | ... | @@ -366,6 +367,10 @@ Then /^The page should not contain "(.*)"$/ do |selector| |
366 | 367 | page.should have_no_css("#{selector}") |
367 | 368 | end |
368 | 369 | |
370 | +Then /^The page should contain only (\d+) "(.*)"$/ do |count, selector| | |
371 | + page.should have_css(selector, :count => count) | |
372 | +end | |
373 | + | |
369 | 374 | Given /^the mailbox is empty$/ do |
370 | 375 | ActionMailer::Base.deliveries = [] |
371 | 376 | end |
... | ... | @@ -653,6 +658,15 @@ Given /^the environment is configured to (.*) after signup$/ do |option| |
653 | 658 | environment.save |
654 | 659 | end |
655 | 660 | |
661 | +When /^I click "(.*?)"$/ do |selector| | |
662 | + find(selector).click | |
663 | +end | |
664 | + | |
665 | +Then /^the element "(.*)" has class "(.*)"$/ do |el_selector, el_class| | |
666 | + class_list = find(el_selector)[:class].split(' ') | |
667 | + class_list.should include(el_class) | |
668 | +end | |
669 | + | |
656 | 670 | When /^wait for the captcha signup time$/ do |
657 | 671 | environment = Environment.default |
658 | 672 | sleep environment.min_signup_delay + 1 |
... | ... | @@ -671,3 +685,7 @@ Given /^the field (.*) is public for all users$/ do |field| |
671 | 685 | person.save! |
672 | 686 | end |
673 | 687 | end |
688 | + | |
689 | +When(/^I press "(.*?)" by selector$/) do |selector| | |
690 | + page.execute_script("jQuery('#{selector}').click();") | |
691 | +end | ... | ... |
features/tiny_mce.feature
... | ... | @@ -10,7 +10,7 @@ Feature: Create tinyMCE article |
10 | 10 | |
11 | 11 | @selenium |
12 | 12 | Scenario: mce complete mode should show on message creation |
13 | - Given I am on /myprofile/joaosilva/cms/new?type=TinyMceArticle | |
13 | + Given I am on /myprofile/joaosilva/cms/new?type=TextArticle | |
14 | 14 | Then The tinymce "toolbar1" should be "fullscreen | insertfile undo redo | copy paste | bold italic underline | styleselect fontsizeselect | forecolor backcolor | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image" |
15 | 15 | And The tinymce "menubar" should be "edit insert view tools" |
16 | 16 | And The tinymce "toolbar2" should contain "print preview code media | table" | ... | ... |
lib/file_presenter.rb
... | ... | @@ -124,3 +124,8 @@ end |
124 | 124 | Dir.glob(File.join('app', 'presenters', '*.rb')) do |file| |
125 | 125 | load file |
126 | 126 | end |
127 | + | |
128 | +# Preload FilePresenters from plugins to allow `FilePresenter.for()` to work | |
129 | +Dir.glob(File.join('plugins', '*', 'lib', 'presenters', '*.rb')) do |file| | |
130 | + load file | |
131 | +end | ... | ... |
lib/noosfero/plugin/settings.rb
... | ... | @@ -10,7 +10,8 @@ class Noosfero::Plugin::Settings |
10 | 10 | end |
11 | 11 | |
12 | 12 | def settings |
13 | - @base.settings["#{@plugin.public_name}_plugin".to_sym] ||= {} | |
13 | + settings_field = @base.class.settings_field | |
14 | + @base.send(settings_field)["#{@plugin.public_name}_plugin".to_sym] ||= {} | |
14 | 15 | end |
15 | 16 | |
16 | 17 | def method_missing(method, *args, &block) | ... | ... |
lib/noosfero/version.rb
plugins/admin_notifications/views/shared/_form.html.erb
1 | 1 | <div class="notification-plugin-form"> |
2 | 2 | |
3 | - <% abstract_options = {:value => @notification.message, :style => 'width: 100%; height: 200px;', :class => 'mceEditor'} %> | |
3 | + <% abstract_options = {:value => @notification.message, :style => 'width: 100%; height: 200px;', :class => current_editor('restricted')} %> | |
4 | 4 | |
5 | 5 | <%= button :back, _('Back'), :controller => 'admin_notifications_plugin_admin' %> |
6 | 6 | |
7 | 7 | <%= form_for :notifications do |f| %> |
8 | 8 | |
9 | - <%= render :file => 'shared/tiny_mce', :locals => {:mode => 'restricted'} %> | |
10 | - | |
11 | 9 | <%= labelled_form_field(_("Optional Title:"), f.text_field(:title, value: @notification.title)) %> |
12 | 10 | |
13 | 11 | <%= labelled_form_field(_("Enter your message here:"), f.text_area(:message, abstract_options)) %> | ... | ... |
plugins/comment_paragraph/lib/comment_paragraph_plugin/macros/allow_comment.rb
1 | 1 | class Application < Rails::Application |
2 | - config.action_view.sanitized_allowed_attributes << 'data-macro-paragraph_uuid' | |
2 | + config.action_view.sanitized_allowed_attributes << 'data-macro-paragraph_uuid' unless config.action_view.sanitized_allowed_attributes.include?('data-macro-paragraph_uuid') | |
3 | 3 | end |
4 | 4 | |
5 | 5 | class CommentParagraphPlugin::AllowComment < Noosfero::Plugin::Macro | ... | ... |
plugins/comment_paragraph/test/unit/article_test.rb
... | ... | @@ -5,7 +5,7 @@ class ArticleTest < ActiveSupport::TestCase |
5 | 5 | |
6 | 6 | def setup |
7 | 7 | @profile = fast_create(Community) |
8 | - @article = fast_create(TinyMceArticle, :profile_id => profile.id) | |
8 | + @article = fast_create(TextArticle, :profile_id => profile.id) | |
9 | 9 | @environment = Environment.default |
10 | 10 | @environment.enable_plugin(CommentParagraphPlugin) |
11 | 11 | end | ... | ... |
plugins/comment_paragraph/test/unit/discussion_block_test.rb
... | ... | @@ -74,7 +74,7 @@ class DiscussionBlockTest < ActiveSupport::TestCase |
74 | 74 | b.save |
75 | 75 | a1 = fast_create(CommentParagraphPlugin::Discussion, :profile_id => community.id) |
76 | 76 | fast_create(Event, :profile_id => community.id) |
77 | - fast_create(TinyMceArticle, :profile_id => community.id) | |
77 | + fast_create(TextArticle, :profile_id => community.id) | |
78 | 78 | a2 = fast_create(CommentParagraphPlugin::Discussion, :profile_id => community.id) |
79 | 79 | assert_equivalent [a1, a2], b.discussions |
80 | 80 | end |
... | ... | @@ -183,7 +183,7 @@ class DiscussionBlockViewTest < ActionView::TestCase |
183 | 183 | b.save |
184 | 184 | a1 = fast_create(CommentParagraphPlugin::Discussion, :profile_id => community.id) |
185 | 185 | fast_create(Event, :profile_id => community.id) |
186 | - fast_create(TinyMceArticle, :profile_id => community.id) | |
186 | + fast_create(TextArticle, :profile_id => community.id) | |
187 | 187 | a2 = fast_create(CommentParagraphPlugin::Discussion, :profile_id => community.id) |
188 | 188 | assert_equivalent [a2.id, a1.id], b.api_content['articles'].map {|a| a[:id]} |
189 | 189 | end | ... | ... |
plugins/comment_paragraph/test/unit/tinymce_helper_test.rb
... | ... | @@ -7,6 +7,7 @@ class TinymceHelperTest < ActiveSupport::TestCase |
7 | 7 | def setup |
8 | 8 | expects(:top_url).returns('/') |
9 | 9 | expects(:tinymce_language).returns('en') |
10 | + expects(:current_editor).returns(Article::Editor::TINY_MCE) | |
10 | 11 | @plugins = mock |
11 | 12 | @plugins.expects(:dispatch).returns([]).at_least_once |
12 | 13 | @environment = Environment.default | ... | ... |
plugins/community_track/lib/community_track_plugin/step.rb
... | ... | @@ -61,7 +61,7 @@ class CommunityTrackPlugin::Step < Folder |
61 | 61 | end |
62 | 62 | |
63 | 63 | def enabled_tools |
64 | - tools = [TinyMceArticle, Forum] | |
64 | + tools = [TextArticle, Forum] | |
65 | 65 | tools << CommunityHubPlugin::Hub if environment.plugin_enabled?('CommunityHubPlugin') |
66 | 66 | tools << ProposalsDiscussionPlugin::Discussion if environment.plugin_enabled?('ProposalsDiscussionPlugin') |
67 | 67 | tools << PairwisePlugin::PairwiseContent if environment.plugin_enabled?('PairwisePlugin') | ... | ... |
plugins/community_track/test/functional/community_track_plugin_content_viewer_controller_test.rb
... | ... | @@ -5,7 +5,7 @@ class ContentViewerControllerTest < ActionController::TestCase |
5 | 5 | def setup |
6 | 6 | @profile = Community.create!(:name => 'Sample community', :identifier => 'sample-community') |
7 | 7 | @track = create_track('track', @profile) |
8 | - @step = CommunityTrackPlugin::Step.create!(:name => 'step1', :body => 'body', :profile => @profile, :parent => @track, :published => false, :end_date => DateTime.now.end_of_day, :start_date => DateTime.now.beginning_of_day, :tool_type => TinyMceArticle.name) | |
8 | + @step = CommunityTrackPlugin::Step.create!(:name => 'step1', :body => 'body', :profile => @profile, :parent => @track, :published => false, :end_date => DateTime.now.end_of_day, :start_date => DateTime.now.beginning_of_day, :tool_type => TextArticle.name) | |
9 | 9 | |
10 | 10 | user = create_user('testinguser') |
11 | 11 | login_as(user.login) |
... | ... | @@ -49,7 +49,7 @@ class ContentViewerControllerTest < ActionController::TestCase |
49 | 49 | end |
50 | 50 | |
51 | 51 | should 'show tools for a step' do |
52 | - TinyMceArticle.create!(:profile => @profile, :name => 'article', :parent => @step) | |
52 | + TextArticle.create!(:profile => @profile, :name => 'article', :parent => @step) | |
53 | 53 | get :view_page, @step.url |
54 | 54 | assert_tag :tag => 'div', :attributes => { :class => 'tools' }, :descendant => { :tag => 'div', :attributes => { :class => 'item' } } |
55 | 55 | end | ... | ... |
plugins/community_track/test/unit/community_track_plugin/step_test.rb
... | ... | @@ -237,7 +237,7 @@ class StepTest < ActiveSupport::TestCase |
237 | 237 | end |
238 | 238 | |
239 | 239 | should 'return enabled tools for a step' do |
240 | - assert_includes @step.enabled_tools, TinyMceArticle | |
240 | + assert_includes @step.enabled_tools, TextArticle | |
241 | 241 | assert_includes @step.enabled_tools, Forum |
242 | 242 | end |
243 | 243 | ... | ... |
plugins/community_track/views/cms/community_track_plugin/_step.html.erb
1 | 1 | <%= required_fields_message %> |
2 | 2 | |
3 | -<%= render :file => 'shared/tiny_mce' %> | |
4 | - | |
5 | 3 | <div> |
6 | 4 | <%= required f.text_field('name', :size => '64', :maxlength => 150) %> |
7 | 5 | <%= labelled_form_field(_('Period'), ( |
... | ... | @@ -19,4 +17,4 @@ |
19 | 17 | |
20 | 18 | <%= labelled_form_field check_box(:article, :hidden) + _('Hidden Step'), '' %> |
21 | 19 | |
22 | -<%= render :partial => 'shared/lead_and_body', :locals => {:tiny_mce => true, :body_label => 'Description:'} %> | |
20 | +<%= render :partial => 'shared/lead_and_body', :locals => {:body_label => 'Description:'} %> | ... | ... |
plugins/community_track/views/cms/community_track_plugin/_track.html.erb
1 | 1 | <div class='community-track'> |
2 | 2 | <%= required_fields_message %> |
3 | 3 | |
4 | - <%= render :file => 'shared/tiny_mce' %> | |
5 | - | |
6 | 4 | <div> |
7 | 5 | <%= required labelled_form_field(c_('Title'), text_field(:article, 'name', :size => '64', :maxlength => 150)) %> |
8 | 6 | </div> |
9 | 7 | |
10 | - <%= render :partial => 'shared/lead_and_body', :locals => {:tiny_mce => true, :body_label => 'Description:'} %> | |
8 | + <%= render :partial => 'shared/lead_and_body', :locals => {:body_label => 'Description:'} %> | |
11 | 9 | |
12 | 10 | <div> |
13 | 11 | <%= labelled_form_field(_('Goals:'), text_area(:article, :goals, :rows => 3, :cols => 64)) %> | ... | ... |