Commit 5c07417902c18a5fe80e3d73f4978a4c1d24867f
Exists in
staging
and in
1 other branch
fix merge conflit
Showing
278 changed files
with
9373 additions
and
2046 deletions
Show diff stats
Too many changes.
To preserve performance only 100 of 278 files displayed.
.gitlab-ci.yml
@@ -59,18 +59,18 @@ selenium-6: | @@ -59,18 +59,18 @@ selenium-6: | ||
59 | # NOOSFERO_BUNDLE_OPTS=install makes migrations fails | 59 | # NOOSFERO_BUNDLE_OPTS=install makes migrations fails |
60 | # probably because of rubygems-integration | 60 | # probably because of rubygems-integration |
61 | plugins-1: | 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 | stage: all-tests | 63 | stage: all-tests |
64 | plugins-2: | 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 | stage: all-tests | 66 | stage: all-tests |
67 | plugins-3: | 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 | stage: all-tests | 69 | stage: all-tests |
70 | plugins-4: | 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 | stage: all-tests | 72 | stage: all-tests |
73 | plugins-5: | 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 | stage: all-tests | 75 | stage: all-tests |
76 | 76 |
.travis.yml
Gemfile
@@ -84,7 +84,7 @@ group :cucumber do | @@ -84,7 +84,7 @@ group :cucumber do | ||
84 | gem 'cucumber' | 84 | gem 'cucumber' |
85 | gem 'cucumber-rails', '~> 1.4.2', :require => false | 85 | gem 'cucumber-rails', '~> 1.4.2', :require => false |
86 | gem 'database_cleaner', '~> 1.3' | 86 | gem 'database_cleaner', '~> 1.3' |
87 | - gem 'selenium-webdriver', '>= 2.50' | 87 | + gem 'selenium-webdriver', '>= 2.53' |
88 | gem 'chromedriver-helper' if ENV['SELENIUM_DRIVER'] == 'chrome' | 88 | gem 'chromedriver-helper' if ENV['SELENIUM_DRIVER'] == 'chrome' |
89 | end | 89 | end |
90 | 90 |
HACKING.md
@@ -31,7 +31,7 @@ If you want to use a different port than 3000, pass `-p <PORT>` to `./script/dev | @@ -31,7 +31,7 @@ If you want to use a different port than 3000, pass `-p <PORT>` to `./script/dev | ||
31 | Instructions for other systems | 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 | ### 1) using a chroot or a VM with Debian stable (easier) | 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,6 +45,14 @@ You can check `./script/install-dependencies/debian-squeeze.sh` to have an idea | ||
45 | 45 | ||
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. | 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 | Submitting your changes back | 56 | Submitting your changes back |
49 | ---------------------------- | 57 | ---------------------------- |
50 | 58 |
app/api/entities.rb
@@ -38,6 +38,13 @@ module Api | @@ -38,6 +38,13 @@ module Api | ||
38 | PERMISSIONS[current_permission] <= PERMISSIONS[permission] | 38 | PERMISSIONS[current_permission] <= PERMISSIONS[permission] |
39 | end | 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 | class Image < Entity | 48 | class Image < Entity |
42 | root 'images', 'image' | 49 | root 'images', 'image' |
43 | 50 | ||
@@ -166,7 +173,8 @@ module Api | @@ -166,7 +173,8 @@ module Api | ||
166 | community.admins.map{|admin| {"name"=>admin.name, "id"=>admin.id, "username" => admin.identifier}} | 173 | community.admins.map{|admin| {"name"=>admin.name, "id"=>admin.id, "username" => admin.identifier}} |
167 | end | 174 | end |
168 | expose :categories, :using => Category | 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 | end | 178 | end |
171 | 179 | ||
172 | class CommentBase < Entity | 180 | class CommentBase < Entity |
@@ -213,7 +221,7 @@ module Api | @@ -213,7 +221,7 @@ module Api | ||
213 | expose :comments_count | 221 | expose :comments_count |
214 | expose :archived, :documentation => {:type => "Boolean", :desc => "Defines if a article is readonly"} | 222 | expose :archived, :documentation => {:type => "Boolean", :desc => "Defines if a article is readonly"} |
215 | expose :type | 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 | expose :published | 225 | expose :published |
218 | expose :accept_comments?, as: :accept_comments | 226 | expose :accept_comments?, as: :accept_comments |
219 | end | 227 | end |
app/api/helpers.rb
@@ -57,9 +57,11 @@ module Api | @@ -57,9 +57,11 @@ module Api | ||
57 | def present_partial(model, options) | 57 | def present_partial(model, options) |
58 | if(params[:fields].present?) | 58 | if(params[:fields].present?) |
59 | begin | 59 | begin |
60 | - fields = JSON.parse(params[:fields]) | 60 | + fields = JSON.parse((params.to_hash[:fields] || params.to_hash['fields']).to_json) |
61 | if fields.present? | 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 | end | 65 | end |
64 | rescue | 66 | rescue |
65 | fields = params[:fields] | 67 | fields = params[:fields] |
@@ -116,7 +118,7 @@ module Api | @@ -116,7 +118,7 @@ module Api | ||
116 | def post_article(asset, params) | 118 | def post_article(asset, params) |
117 | return forbidden! unless current_person.can_post_content?(asset) | 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 | return forbidden! unless klass_type.constantize <= Article | 122 | return forbidden! unless klass_type.constantize <= Article |
121 | 123 | ||
122 | article = klass_type.constantize.new(params[:article]) | 124 | article = klass_type.constantize.new(params[:article]) |
@@ -503,11 +505,9 @@ module Api | @@ -503,11 +505,9 @@ module Api | ||
503 | 505 | ||
504 | def parse_content_type(content_type) | 506 | def parse_content_type(content_type) |
505 | return nil if content_type.blank? | 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 | end | 510 | end |
510 | - content_types.flatten.uniq | ||
511 | end | 511 | end |
512 | 512 | ||
513 | def period(from_date, until_date) | 513 | def period(from_date, until_date) |
app/api/v1/communities.rb
@@ -18,7 +18,7 @@ module Api | @@ -18,7 +18,7 @@ module Api | ||
18 | communities = select_filtered_collection_of(environment, 'communities', params) | 18 | communities = select_filtered_collection_of(environment, 'communities', params) |
19 | communities = profiles_for_person(communities, current_person) | 19 | communities = profiles_for_person(communities, current_person) |
20 | communities = communities.by_location(params) # Must be the last. May return Exception obj | 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 | end | 22 | end |
23 | 23 | ||
24 | 24 | ||
@@ -49,7 +49,7 @@ module Api | @@ -49,7 +49,7 @@ module Api | ||
49 | 49 | ||
50 | get ':id' do | 50 | get ':id' do |
51 | community = profiles_for_person(environment.communities, current_person).find_by_id(params[:id]) | 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 | end | 53 | end |
54 | 54 | ||
55 | end | 55 | end |
app/controllers/my_profile/cms_controller.rb
@@ -151,6 +151,7 @@ class CmsController < MyProfileController | @@ -151,6 +151,7 @@ class CmsController < MyProfileController | ||
151 | 151 | ||
152 | @article.profile = profile | 152 | @article.profile = profile |
153 | @article.author = user | 153 | @article.author = user |
154 | + @article.editor = current_person.editor | ||
154 | @article.last_changed_by = user | 155 | @article.last_changed_by = user |
155 | @article.created_by = user | 156 | @article.created_by = user |
156 | 157 | ||
@@ -399,8 +400,7 @@ class CmsController < MyProfileController | @@ -399,8 +400,7 @@ class CmsController < MyProfileController | ||
399 | 400 | ||
400 | def available_article_types | 401 | def available_article_types |
401 | articles = [ | 402 | articles = [ |
402 | - TinyMceArticle, | ||
403 | - TextileArticle, | 403 | + TextArticle, |
404 | Event | 404 | Event |
405 | ] | 405 | ] |
406 | articles += special_article_types if params && params[:cms] | 406 | articles += special_article_types if params && params[:cms] |
@@ -408,9 +408,6 @@ class CmsController < MyProfileController | @@ -408,9 +408,6 @@ class CmsController < MyProfileController | ||
408 | if @parent && @parent.blog? | 408 | if @parent && @parent.blog? |
409 | articles -= Article.folder_types.map(&:constantize) | 409 | articles -= Article.folder_types.map(&:constantize) |
410 | end | 410 | end |
411 | - if user.is_admin?(profile.environment) | ||
412 | - articles << RawHTMLArticle | ||
413 | - end | ||
414 | articles | 411 | articles |
415 | end | 412 | end |
416 | 413 |
app/controllers/my_profile/profile_editor_controller.rb
@@ -95,7 +95,7 @@ class ProfileEditorController < MyProfileController | @@ -95,7 +95,7 @@ class ProfileEditorController < MyProfileController | ||
95 | end | 95 | end |
96 | 96 | ||
97 | def welcome_page | 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 | if request.post? | 99 | if request.post? |
100 | begin | 100 | begin |
101 | @welcome_page.update!(params[:welcome_page]) | 101 | @welcome_page.update!(params[:welcome_page]) |
app/controllers/public/profile_controller.rb
@@ -19,6 +19,11 @@ class ProfileController < PublicController | @@ -19,6 +19,11 @@ class ProfileController < PublicController | ||
19 | @network_activities = @profile.tracked_notifications.visible.paginate(:per_page => 15, :page => params[:page]) if @network_activities.empty? | 19 | @network_activities = @profile.tracked_notifications.visible.paginate(:per_page => 15, :page => params[:page]) if @network_activities.empty? |
20 | @activities = @profile.activities.paginate(:per_page => 15, :page => params[:page]) | 20 | @activities = @profile.activities.paginate(:per_page => 15, :page => params[:page]) |
21 | end | 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 | @tags = profile.article_tags | 27 | @tags = profile.article_tags |
23 | allow_access_to_page | 28 | allow_access_to_page |
24 | end | 29 | end |
@@ -231,6 +236,7 @@ class ProfileController < PublicController | @@ -231,6 +236,7 @@ class ProfileController < PublicController | ||
231 | @scrap = Scrap.new(params[:scrap]) | 236 | @scrap = Scrap.new(params[:scrap]) |
232 | @scrap.sender= sender | 237 | @scrap.sender= sender |
233 | @scrap.receiver= receiver | 238 | @scrap.receiver= receiver |
239 | + @scrap.marked_people = treat_followed_entries(params[:filter_followed]) | ||
234 | @tab_action = params[:tab_action] | 240 | @tab_action = params[:tab_action] |
235 | @message = @scrap.save ? _("Message successfully sent.") : _("You can't leave an empty message.") | 241 | @message = @scrap.save ? _("Message successfully sent.") : _("You can't leave an empty message.") |
236 | activities = @profile.activities.paginate(:per_page => 15, :page => params[:page]) if params[:not_load_scraps].nil? | 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,6 +259,14 @@ class ProfileController < PublicController | ||
253 | end | 259 | end |
254 | end | 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 | def view_more_activities | 270 | def view_more_activities |
257 | @activities = @profile.activities.paginate(:per_page => 10, :page => params[:page]) | 271 | @activities = @profile.activities.paginate(:per_page => 10, :page => params[:page]) |
258 | render :partial => 'profile_activities_list', :locals => {:activities => @activities} | 272 | render :partial => 'profile_activities_list', :locals => {:activities => @activities} |
@@ -434,7 +448,6 @@ class ProfileController < PublicController | @@ -434,7 +448,6 @@ class ProfileController < PublicController | ||
434 | end | 448 | end |
435 | end | 449 | end |
436 | 450 | ||
437 | - | ||
438 | protected | 451 | protected |
439 | 452 | ||
440 | def check_access_to_profile | 453 | def check_access_to_profile |
@@ -480,4 +493,39 @@ class ProfileController < PublicController | @@ -480,4 +493,39 @@ class ProfileController < PublicController | ||
480 | render_not_found unless profile.allow_followers? | 493 | render_not_found unless profile.allow_followers? |
481 | end | 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 | end | 531 | end |
app/helpers/application_helper.rb
@@ -111,10 +111,6 @@ module ApplicationHelper | @@ -111,10 +111,6 @@ module ApplicationHelper | ||
111 | content = capture(&block) | 111 | content = capture(&block) |
112 | end | 112 | end |
113 | 113 | ||
114 | - if options[:type] == :textile | ||
115 | - content = RedCloth.new(content).to_html | ||
116 | - end | ||
117 | - | ||
118 | options[:class] = '' if ! options[:class] | 114 | options[:class] = '' if ! options[:class] |
119 | options[:class] += ' button icon-help' # with-text | 115 | options[:class] += ' button icon-help' # with-text |
120 | 116 | ||
@@ -132,13 +128,6 @@ module ApplicationHelper | @@ -132,13 +128,6 @@ module ApplicationHelper | ||
132 | text | 128 | text |
133 | end | 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 | # TODO: do something more useful here | 131 | # TODO: do something more useful here |
143 | # TODO: test this helper | 132 | # TODO: test this helper |
144 | # TODO: add an icon? | 133 | # TODO: add an icon? |
@@ -1245,4 +1234,15 @@ module ApplicationHelper | @@ -1245,4 +1234,15 @@ module ApplicationHelper | ||
1245 | content.html_safe | 1234 | content.html_safe |
1246 | end | 1235 | end |
1247 | 1236 | ||
1237 | + def current_editor_is?(editor) | ||
1238 | + editor.blank? ? false : current_editor == editor | ||
1239 | + end | ||
1240 | + | ||
1241 | + def current_editor(mode = '') | ||
1242 | + editor = @article.editor || Article::Editor::TINY_MCE unless @article.nil? | ||
1243 | + editor ||= (current_person.nil? || current_person.editor.nil?) ? Article::Editor::TINY_MCE : current_person.editor | ||
1244 | + editor += '_' + mode unless mode.blank? | ||
1245 | + editor | ||
1246 | + end | ||
1247 | + | ||
1248 | end | 1248 | end |
app/helpers/article_helper.rb
@@ -161,6 +161,10 @@ module ArticleHelper | @@ -161,6 +161,10 @@ module ArticleHelper | ||
161 | array.map { |object| {:label => object.name, :value => object.name} } | 161 | array.map { |object| {:label => object.name, :value => object.name} } |
162 | end | 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 | def cms_label_for_new_children | 168 | def cms_label_for_new_children |
165 | _('New article') | 169 | _('New article') |
166 | end | 170 | end |
app/helpers/profile_editor_helper.rb
@@ -158,4 +158,8 @@ module ProfileEditorHelper | @@ -158,4 +158,8 @@ module ProfileEditorHelper | ||
158 | end | 158 | end |
159 | end | 159 | end |
160 | 160 | ||
161 | + def select_editor(title, object, method, options) | ||
162 | + labelled_form_field(title, select(object, method, current_person.available_editors.map { |k,v| [v, k] })) | ||
163 | + end | ||
164 | + | ||
161 | end | 165 | end |
app/helpers/tags_helper.rb
@@ -67,4 +67,17 @@ module TagsHelper | @@ -67,4 +67,17 @@ module TagsHelper | ||
67 | end.join("\n").html_safe | 67 | end.join("\n").html_safe |
68 | end | 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 | end | 83 | end |
app/helpers/tinymce_helper.rb
@@ -18,7 +18,8 @@ module TinymceHelper | @@ -18,7 +18,8 @@ module TinymceHelper | ||
18 | insertdatetime media nonbreaking save table contextmenu directionality | 18 | insertdatetime media nonbreaking save table contextmenu directionality |
19 | emoticons template paste textcolor colorpicker textpattern], | 19 | emoticons template paste textcolor colorpicker textpattern], |
20 | :image_advtab => true, | 20 | :image_advtab => true, |
21 | - :language => tinymce_language | 21 | + :language => tinymce_language, |
22 | + :selector => '.' + current_editor(options[:mode]) | ||
22 | 23 | ||
23 | options[:toolbar1] = toolbar1(options[:mode]) | 24 | options[:toolbar1] = toolbar1(options[:mode]) |
24 | options[:menubar] = menubar(options[:mode]) | 25 | options[:menubar] = menubar(options[:mode]) |
app/helpers/token_helper.rb
@@ -5,10 +5,11 @@ module TokenHelper | @@ -5,10 +5,11 @@ module TokenHelper | ||
5 | end | 5 | end |
6 | 6 | ||
7 | def token_input_field_tag(name, element_id, search_action, options = {}, text_field_options = {}, html_options = {}) | 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 | options[:hint_text] ||= _("Type in a search term") | 9 | options[:hint_text] ||= _("Type in a search term") |
10 | options[:no_results_text] ||= _("No results") | 10 | options[:no_results_text] ||= _("No results") |
11 | options[:searching_text] ||= _("Searching...") | 11 | options[:searching_text] ||= _("Searching...") |
12 | + options[:placeholder] ||= 'null' | ||
12 | options[:search_delay] ||= 1000 | 13 | options[:search_delay] ||= 1000 |
13 | options[:prevent_duplicates] ||= true | 14 | options[:prevent_duplicates] ||= true |
14 | options[:backspace_delete_item] ||= false | 15 | options[:backspace_delete_item] ||= false |
@@ -20,6 +21,9 @@ module TokenHelper | @@ -20,6 +21,9 @@ module TokenHelper | ||
20 | options[:on_delete] ||= 'null' | 21 | options[:on_delete] ||= 'null' |
21 | options[:on_ready] ||= 'null' | 22 | options[:on_ready] ||= 'null' |
22 | options[:query_param] ||= 'q' | 23 | options[:query_param] ||= 'q' |
24 | + options[:theme] ||= 'null' | ||
25 | + options[:results_formatter] ||= 'null' | ||
26 | + options[:token_formatter] ||= 'null' | ||
23 | 27 | ||
24 | result = text_field_tag(name, nil, text_field_options.merge(html_options.merge({:id => element_id}))) | 28 | result = text_field_tag(name, nil, text_field_options.merge(html_options.merge({:id => element_id}))) |
25 | result += javascript_tag("jQuery('##{element_id}') | 29 | result += javascript_tag("jQuery('##{element_id}') |
@@ -29,6 +33,7 @@ module TokenHelper | @@ -29,6 +33,7 @@ module TokenHelper | ||
29 | hintText: #{options[:hint_text].to_json}, | 33 | hintText: #{options[:hint_text].to_json}, |
30 | noResultsText: #{options[:no_results_text].to_json}, | 34 | noResultsText: #{options[:no_results_text].to_json}, |
31 | searchingText: #{options[:searching_text].to_json}, | 35 | searchingText: #{options[:searching_text].to_json}, |
36 | + placeholder: #{options[:placeholder].to_json}, | ||
32 | searchDelay: #{options[:search_delay].to_json}, | 37 | searchDelay: #{options[:search_delay].to_json}, |
33 | preventDuplicates: #{options[:prevent_duplicates].to_json}, | 38 | preventDuplicates: #{options[:prevent_duplicates].to_json}, |
34 | backspaceDeleteItem: #{options[:backspace_delete_item].to_json}, | 39 | backspaceDeleteItem: #{options[:backspace_delete_item].to_json}, |
@@ -39,6 +44,9 @@ module TokenHelper | @@ -39,6 +44,9 @@ module TokenHelper | ||
39 | onAdd: #{options[:on_add]}, | 44 | onAdd: #{options[:on_add]}, |
40 | onDelete: #{options[:on_delete]}, | 45 | onDelete: #{options[:on_delete]}, |
41 | onReady: #{options[:on_ready]}, | 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 | result += javascript_tag("jQuery('##{element_id}').focus();") if options[:focus] | 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,8 +19,13 @@ class NotifyActivityToProfilesJob < Struct.new(:tracked_action_id) | ||
19 | # Notify the user | 19 | # Notify the user |
20 | ActionTrackerNotification.create(:profile_id => tracked_action.user.id, :action_tracker_id => tracked_action.id) | 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 | if tracked_action.user.is_a? Organization | 30 | if tracked_action.user.is_a? Organization |
26 | ActionTrackerNotification.connection.execute "insert into action_tracker_notifications(profile_id, action_tracker_id) " + | 31 | ActionTrackerNotification.connection.execute "insert into action_tracker_notifications(profile_id, action_tracker_id) " + |
app/models/article.rb
1 | 1 | ||
2 | class Article < ApplicationRecord | 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 | include SanitizeHelper | 10 | include SanitizeHelper |
5 | 11 | ||
6 | attr_accessible :name, :body, :abstract, :profile, :tag_list, :parent, | 12 | attr_accessible :name, :body, :abstract, :profile, :tag_list, :parent, |
@@ -11,7 +17,7 @@ class Article < ApplicationRecord | @@ -11,7 +17,7 @@ class Article < ApplicationRecord | ||
11 | :highlighted, :notify_comments, :display_hits, :slug, | 17 | :highlighted, :notify_comments, :display_hits, :slug, |
12 | :external_feed_builder, :display_versions, :external_link, | 18 | :external_feed_builder, :display_versions, :external_link, |
13 | :image_builder, :show_to_followers, :archived, | 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 | extend ActsAsHavingImage::ClassMethods | 22 | extend ActsAsHavingImage::ClassMethods |
17 | acts_as_having_image | 23 | acts_as_having_image |
@@ -518,17 +524,12 @@ class Article < ApplicationRecord | @@ -518,17 +524,12 @@ class Article < ApplicationRecord | ||
518 | ['Folder', 'Blog', 'Forum', 'Gallery'] | 524 | ['Folder', 'Blog', 'Forum', 'Gallery'] |
519 | end | 525 | end |
520 | 526 | ||
521 | - def self.text_article_types | ||
522 | - ['TextArticle', 'TextileArticle', 'TinyMceArticle'] | ||
523 | - end | ||
524 | - | ||
525 | scope :published, -> { where 'articles.published = ?', true } | 527 | scope :published, -> { where 'articles.published = ?', true } |
526 | scope :folders, -> profile { where 'articles.type IN (?)', profile.folder_types } | 528 | scope :folders, -> profile { where 'articles.type IN (?)', profile.folder_types } |
527 | scope :no_folders, -> profile { where 'articles.type NOT IN (?)', profile.folder_types } | 529 | scope :no_folders, -> profile { where 'articles.type NOT IN (?)', profile.folder_types } |
528 | scope :galleries, -> { where "articles.type IN ('Gallery')" } | 530 | scope :galleries, -> { where "articles.type IN ('Gallery')" } |
529 | scope :images, -> { where :is_image => true } | 531 | scope :images, -> { where :is_image => true } |
530 | scope :no_images, -> { where :is_image => false } | 532 | scope :no_images, -> { where :is_image => false } |
531 | - scope :text_articles, -> { where 'articles.type IN (?)', text_article_types } | ||
532 | scope :files, -> { where :type => 'UploadedFile' } | 533 | scope :files, -> { where :type => 'UploadedFile' } |
533 | scope :with_types, -> types { where 'articles.type IN (?)', types } | 534 | scope :with_types, -> types { where 'articles.type IN (?)', types } |
534 | 535 | ||
@@ -711,10 +712,6 @@ class Article < ApplicationRecord | @@ -711,10 +712,6 @@ class Article < ApplicationRecord | ||
711 | false | 712 | false |
712 | end | 713 | end |
713 | 714 | ||
714 | - def tiny_mce? | ||
715 | - false | ||
716 | - end | ||
717 | - | ||
718 | def folder? | 715 | def folder? |
719 | false | 716 | false |
720 | end | 717 | end |
@@ -879,6 +876,10 @@ class Article < ApplicationRecord | @@ -879,6 +876,10 @@ class Article < ApplicationRecord | ||
879 | true | 876 | true |
880 | end | 877 | end |
881 | 878 | ||
879 | + def editor?(editor) | ||
880 | + self.editor == editor | ||
881 | + end | ||
882 | + | ||
882 | private | 883 | private |
883 | 884 | ||
884 | def sanitize_tag_list | 885 | def sanitize_tag_list |
app/models/circle.rb
app/models/event.rb
app/models/external_feed.rb
@@ -25,7 +25,7 @@ class ExternalFeed < ApplicationRecord | @@ -25,7 +25,7 @@ class ExternalFeed < ApplicationRecord | ||
25 | end | 25 | end |
26 | content = doc.to_s | 26 | content = doc.to_s |
27 | 27 | ||
28 | - article = TinyMceArticle.new | 28 | + article = TextArticle.new |
29 | article.name = title | 29 | article.name = title |
30 | article.profile = blog.profile | 30 | article.profile = blog.profile |
31 | article.body = content | 31 | article.body = content |
app/models/person.rb
1 | # A person is the profile of an user holding all relationships with the rest of the system | 1 | # A person is the profile of an user holding all relationships with the rest of the system |
2 | class Person < Profile | 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 | SEARCH_FILTERS = { | 6 | SEARCH_FILTERS = { |
7 | :order => %w[more_recent more_popular more_active], | 7 | :order => %w[more_recent more_popular more_active], |
@@ -124,6 +124,8 @@ class Person < Profile | @@ -124,6 +124,8 @@ class Person < Profile | ||
124 | where 'profile_suggestions.suggestion_type = ? AND profile_suggestions.enabled = ?', 'Community', true | 124 | where 'profile_suggestions.suggestion_type = ? AND profile_suggestions.enabled = ?', 'Community', true |
125 | }, through: :suggested_profiles, source: :suggestion | 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 | scope :more_popular, -> { order 'friends_count DESC' } | 129 | scope :more_popular, -> { order 'friends_count DESC' } |
128 | 130 | ||
129 | scope :abusers, -> { | 131 | scope :abusers, -> { |
@@ -344,6 +346,8 @@ class Person < Profile | @@ -344,6 +346,8 @@ class Person < Profile | ||
344 | 346 | ||
345 | validates_associated :user | 347 | validates_associated :user |
346 | 348 | ||
349 | + validates :editor, inclusion: { in: lambda { |p| p.available_editors } } | ||
350 | + | ||
347 | def email | 351 | def email |
348 | self.user.nil? ? nil : self.user.email | 352 | self.user.nil? ? nil : self.user.email |
349 | end | 353 | end |
@@ -616,8 +620,21 @@ class Person < Profile | @@ -616,8 +620,21 @@ class Person < Profile | ||
616 | Profile.followed_by self | 620 | Profile.followed_by self |
617 | end | 621 | end |
618 | 622 | ||
623 | + def editor?(editor) | ||
624 | + self.editor == editor | ||
625 | + end | ||
626 | + | ||
619 | def in_social_circle?(person) | 627 | def in_social_circle?(person) |
620 | self.is_a_friend?(person) || super | 628 | self.is_a_friend?(person) || super |
621 | end | 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 | end | 640 | end |
app/models/raw_html_article.rb
@@ -1,17 +0,0 @@ | @@ -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,7 +2,7 @@ class Scrap < ApplicationRecord | ||
2 | 2 | ||
3 | include SanitizeHelper | 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 | SEARCHABLE_FIELDS = { | 7 | SEARCHABLE_FIELDS = { |
8 | :content => {:label => _('Content'), :weight => 1}, | 8 | :content => {:label => _('Content'), :weight => 1}, |
@@ -19,6 +19,8 @@ class Scrap < ApplicationRecord | @@ -19,6 +19,8 @@ class Scrap < ApplicationRecord | ||
19 | where profile_activities: {activity_type: 'Scrap'} | 19 | where profile_activities: {activity_type: 'Scrap'} |
20 | }, foreign_key: :activity_id, dependent: :destroy | 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 | after_create :create_activity | 24 | after_create :create_activity |
23 | after_update :update_activity | 25 | after_update :update_activity |
24 | 26 |
app/models/suggest_article.rb
@@ -44,7 +44,7 @@ class SuggestArticle < Task | @@ -44,7 +44,7 @@ class SuggestArticle < Task | ||
44 | type = article[:type].constantize | 44 | type = article[:type].constantize |
45 | return type if type < Article | 45 | return type if type < Article |
46 | end | 46 | end |
47 | - TinyMceArticle | 47 | + TextArticle |
48 | end | 48 | end |
49 | 49 | ||
50 | def perform | 50 | def perform |
app/models/text_article.rb
1 | # a base class for all text article types. | 1 | # a base class for all text article types. |
2 | class TextArticle < Article | 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 | def self.type_name | 20 | def self.type_name |
7 | _('Article') | 21 | _('Article') |
@@ -21,6 +35,18 @@ class TextArticle < Article | @@ -21,6 +35,18 @@ class TextArticle < Article | ||
21 | true | 35 | true |
22 | end | 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 | before_save :set_relative_path | 50 | before_save :set_relative_path |
25 | 51 | ||
26 | def set_relative_path | 52 | def set_relative_path |
@@ -43,4 +69,24 @@ class TextArticle < Article | @@ -43,4 +69,24 @@ class TextArticle < Article | ||
43 | parent && parent.kind_of?(Blog) && parent.display_preview | 69 | parent && parent.kind_of?(Blog) && parent.display_preview |
44 | end | 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 | end | 92 | end |
app/models/textile_article.rb
@@ -1,44 +0,0 @@ | @@ -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,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
@@ -9,6 +9,12 @@ class UploadedFile < Article | @@ -9,6 +9,12 @@ class UploadedFile < Article | ||
9 | 9 | ||
10 | attr_accessible :uploaded_data, :title | 10 | attr_accessible :uploaded_data, :title |
11 | 11 | ||
12 | + include Noosfero::Plugin::HotSpot | ||
13 | + | ||
14 | + def environment | ||
15 | + profile.environment | ||
16 | + end | ||
17 | + | ||
12 | def self.type_name | 18 | def self.type_name |
13 | _('File') | 19 | _('File') |
14 | end | 20 | end |
app/views/admin_panel/_signup_intro.html.erb
@@ -2,4 +2,4 @@ | @@ -2,4 +2,4 @@ | ||
2 | <%= _('This text will be shown to the user on the top of the sign up form.') %> | 2 | <%= _('This text will be shown to the user on the top of the sign up form.') %> |
3 | </div> | 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 | <div class='description'> | 1 | <div class='description'> |
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.') %> | 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 | </div> | 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 | <div class='description'> | 6 | <div class='description'> |
7 | <%= _('If this content is left blank, the following page will be displayed to the user:') %> | 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 +4,4 @@ | ||
4 | </div> | 4 | </div> |
5 | 5 | ||
6 | <%= labelled_form_field(_('Subject'), text_field(:environment, :signup_welcome_text_subject, :style => 'width:100%')) %> | 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,4 +31,4 @@ | ||
31 | <%= balanced_table(fields)%> | 31 | <%= balanced_table(fields)%> |
32 | 32 | ||
33 | <br /> | 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 | <h2><%= _('Site info') %></h2> | 1 | <h2><%= _('Site info') %></h2> |
2 | 2 | ||
3 | -<%= render :file => 'shared/tiny_mce' %> | ||
4 | - | ||
5 | <%= labelled_form_for :environment, :url => {:action => 'site_info'} do |f| %> | 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 | <%= button_bar do %> | 7 | <%= button_bar do %> |
10 | <%= submit_button(:save, _('Save')) %> | 8 | <%= submit_button(:save, _('Save')) %> |
app/views/admin_panel/site_info.html.erb
@@ -2,8 +2,6 @@ | @@ -2,8 +2,6 @@ | ||
2 | 2 | ||
3 | <%= error_messages_for :environment %> | 3 | <%= error_messages_for :environment %> |
4 | 4 | ||
5 | -<%= render :file => 'shared/tiny_mce' %> | ||
6 | - | ||
7 | <%= labelled_form_for :environment do |f| %> | 5 | <%= labelled_form_for :environment do |f| %> |
8 | <% tabs = [] %> | 6 | <% tabs = [] %> |
9 | <% tabs << {:title => _('Site info'), :id => 'site-info', | 7 | <% tabs << {:title => _('Site info'), :id => 'site-info', |
app/views/cms/_article.html.erb
app/views/cms/_blog.html.erb
@@ -2,8 +2,6 @@ | @@ -2,8 +2,6 @@ | ||
2 | 2 | ||
3 | <h1><%= _('My Blog') %></h1> | 3 | <h1><%= _('My Blog') %></h1> |
4 | 4 | ||
5 | -<%= render :file => 'shared/tiny_mce' %> | ||
6 | - | ||
7 | <%= required f.text_field(:name, :size => '64', :maxlength => 150, :onchange => "updateUrlField(this, 'article_slug')") %> | 5 | <%= required f.text_field(:name, :size => '64', :maxlength => 150, :onchange => "updateUrlField(this, 'article_slug')") %> |
8 | 6 | ||
9 | <%= render :partial => 'general_fields' %> | 7 | <%= render :partial => 'general_fields' %> |
@@ -53,7 +51,7 @@ | @@ -53,7 +51,7 @@ | ||
53 | %> | 51 | %> |
54 | </div> | 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 | <div id="blog-image-builder"> | 56 | <div id="blog-image-builder"> |
59 | <%= f.fields_for :image_builder, @article.image do |i| %> | 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 | <%= required_fields_message %> | 1 | <%= required_fields_message %> |
2 | 2 | ||
3 | -<%# TODO add Textile help here %> | ||
4 | -<%= render :file => 'shared/tiny_mce' %> | ||
5 | - | ||
6 | <%= required f.text_field('name', :size => '64', :maxlength => 150) %> | 3 | <%= required f.text_field('name', :size => '64', :maxlength => 150) %> |
7 | 4 | ||
8 | <%= render :partial => 'general_fields' %> | 5 | <%= render :partial => 'general_fields' %> |
@@ -16,4 +13,4 @@ | @@ -16,4 +13,4 @@ | ||
16 | 13 | ||
17 | <%= labelled_form_field(_('Address:'), text_field(:article, :address)) %> | 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,18 +4,16 @@ | ||
4 | 4 | ||
5 | <%= required_fields_message %> | 5 | <%= required_fields_message %> |
6 | 6 | ||
7 | -<%= render :file => 'shared/tiny_mce' %> | ||
8 | - | ||
9 | <%= required f.text_field(:name, :size => '64', :maxlength => 150, :onchange => "updateUrlField(this, 'article_slug')") %> | 7 | <%= required f.text_field(:name, :size => '64', :maxlength => 150, :onchange => "updateUrlField(this, 'article_slug')") %> |
10 | 8 | ||
11 | <%= render :partial => 'general_fields' %> | 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 | <%= labelled_form_field(_('Posts per page:'), f.select(:posts_per_page, Forum.posts_per_page_options)) %> | 13 | <%= labelled_form_field(_('Posts per page:'), f.select(:posts_per_page, Forum.posts_per_page_options)) %> |
16 | 14 | ||
17 | <%= labelled_form_field(_('Has terms of use:'), check_box(:article, :has_terms_of_use))%> | 15 | <%= labelled_form_field(_('Has terms of use:'), check_box(:article, :has_terms_of_use))%> |
18 | 16 | ||
19 | <div id="text_area_terms_of_use"> | 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 | </div> | 19 | </div> |
app/views/cms/_raw_html_article.html.erb
@@ -1,8 +0,0 @@ | @@ -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 @@ | @@ -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 +7,7 @@ | ||
7 | 7 | ||
8 | <div class='header'><strong><%= _('Insert media') %></strong><%= button('vertical-toggle', _('Show/Hide'), '#') %></div> | 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 | <div class='text-editor-sidebar-box' id='media-upload-box'> | 11 | <div class='text-editor-sidebar-box' id='media-upload-box'> |
12 | <div id='media-upload-form'> | 12 | <div id='media-upload-form'> |
13 | <%= form_tag({ :action => 'media_upload' }, :multipart => true) do %> | 13 | <%= form_tag({ :action => 'media_upload' }, :multipart => true) do %> |
app/views/cms/_textile_article.html.erb
@@ -1,10 +0,0 @@ | @@ -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,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,8 +2,6 @@ | ||
2 | 2 | ||
3 | <%= required_fields_message %> | 3 | <%= required_fields_message %> |
4 | 4 | ||
5 | -<%= render :file => 'shared/tiny_mce' %> | ||
6 | - | ||
7 | <%= labelled_form_for 'task' do |f| %> | 5 | <%= labelled_form_for 'task' do |f| %> |
8 | 6 | ||
9 | <%= required labelled_form_field(_('Title'), text_field('task[article]', 'name', :size => 50)) %> | 7 | <%= required labelled_form_field(_('Title'), text_field('task[article]', 'name', :size => 50)) %> |
@@ -17,7 +15,7 @@ | @@ -17,7 +15,7 @@ | ||
17 | <%= required labelled_form_field(_('Email'), text_field(:task, 'email')) %> | 15 | <%= required labelled_form_field(_('Email'), text_field(:task, 'email')) %> |
18 | <% end %> | 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 | <%= hidden_field_tag('back_to', @back_to) %> | 20 | <%= hidden_field_tag('back_to', @back_to) %> |
23 | 21 |
app/views/contact/new.html.erb
@@ -25,8 +25,7 @@ | @@ -25,8 +25,7 @@ | ||
25 | 25 | ||
26 | <%= required f.text_field(:subject) %> | 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 | <%= labelled_form_field check_box(:contact, :receive_a_copy) + _('I want to receive a copy of the message in my e-mail.'), '' %> | 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,8 +19,7 @@ | ||
19 | <%= @template_params_allowed %> | 19 | <%= @template_params_allowed %> |
20 | </div> | 20 | </div> |
21 | </div> | 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 | </div> | 23 | </div> |
25 | 24 | ||
26 | <div class="actions"> | 25 | <div class="actions"> |
app/views/layouts/application-ng.html.erb
@@ -35,6 +35,9 @@ | @@ -35,6 +35,9 @@ | ||
35 | noosfero.profile = <%= (@profile.identifier if @profile).to_json.html_safe %> | 35 | noosfero.profile = <%= (@profile.identifier if @profile).to_json.html_safe %> |
36 | </script> | 36 | </script> |
37 | 37 | ||
38 | + <% if current_editor_is?(Article::Editor::TINY_MCE) %> | ||
39 | + <%= render :file => 'shared/tiny_mce' %> | ||
40 | + <% end %> | ||
38 | </head> | 41 | </head> |
39 | <body class="<%= h body_classes %>"> | 42 | <body class="<%= h body_classes %>"> |
40 | <a href="#content" id="link-go-content"><span><%= _("Go to the content") %></span></a> | 43 | <a href="#content" id="link-go-content"><span><%= _("Go to the content") %></span></a> |
app/views/profile/_profile_wall.html.erb
1 | <h3><%= _("%s's wall") % @profile.name %></h3> | 1 | <h3><%= _("%s's wall") % @profile.name %></h3> |
2 | <div id='leave_scrap'> | 2 | <div id='leave_scrap'> |
3 | <%= flash[:error] %> | 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 | <%= submit_button :new, _('Share') %> | 9 | <%= submit_button :new, _('Share') %> |
7 | <% end %> | 10 | <% end %> |
8 | </div> | 11 | </div> |
app/views/profile/send_mail.html.erb
@@ -22,8 +22,7 @@ | @@ -22,8 +22,7 @@ | ||
22 | 22 | ||
23 | <%= labelled_form_field(_('Subject:'), f.text_field(:subject)) %> | 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 | <%= submit_button(:send, _('Send')) %> | 27 | <%= submit_button(:send, _('Send')) %> |
29 | <%= button :cancel, _('Cancel e-mail'), :back %> | 28 | <%= button :cancel, _('Cancel e-mail'), :back %> |
app/views/profile_editor/_person.html.erb
@@ -16,6 +16,8 @@ | @@ -16,6 +16,8 @@ | ||
16 | </div> | 16 | </div> |
17 | </div> | 17 | </div> |
18 | 18 | ||
19 | + <%= select_editor(_('Editor'), 'profile_data', 'editor', {}) %> | ||
20 | + | ||
19 | <%= safe_join(@plugins.dispatch(:profile_info_extra_contents).collect { |content| instance_exec(&content) }, "") %> | 21 | <%= safe_join(@plugins.dispatch(:profile_info_extra_contents).collect { |content| instance_exec(&content) }, "") %> |
20 | 22 | ||
21 | <div class="formfieldline"> | 23 | <div class="formfieldline"> |
app/views/profile_editor/header_footer.html.erb
1 | -<%= render :file => 'shared/tiny_mce' %> | ||
2 | - | ||
3 | <h1><%= _('Editing header and footer') %></h1> | 1 | <h1><%= _('Editing header and footer') %></h1> |
4 | 2 | ||
5 | <%= form_tag do %> | 3 | <%= form_tag do %> |
@@ -21,9 +19,9 @@ | @@ -21,9 +19,9 @@ | ||
21 | </div> | 19 | </div> |
22 | <% end %> | 20 | <% end %> |
23 | <h2><%= _('Content for header ') %></h2> | 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 | <h2><%= _('Content for footer') %></h2> | 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 | <%= button_bar do %> | 25 | <%= button_bar do %> |
28 | <%= submit_button(:save, _('Save')) %> | 26 | <%= submit_button(:save, _('Save')) %> |
29 | <%= button(:cancel, _('Cancel'), :action => 'index') %> | 27 | <%= button(:cancel, _('Cancel'), :action => 'index') %> |
app/views/profile_editor/welcome_page.html.erb
@@ -8,7 +8,7 @@ | @@ -8,7 +8,7 @@ | ||
8 | <%= _('Your welcome page will only be displayed if this options is selected.') %> | 8 | <%= _('Your welcome page will only be displayed if this options is selected.') %> |
9 | </div> | 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 | <div class='explanation'> | 12 | <div class='explanation'> |
13 | <%= _('This page will be displayed to the user after his signup with this template.') %> | 13 | <%= _('This page will be displayed to the user after his signup with this template.') %> |
14 | </div> | 14 | </div> |
@@ -17,5 +17,3 @@ | @@ -17,5 +17,3 @@ | ||
17 | <%= submit_button('save', _('Save'), :cancel => @back_to) %> | 17 | <%= submit_button('save', _('Save'), :cancel => @back_to) %> |
18 | <% end %> | 18 | <% end %> |
19 | <% end %> | 19 | <% end %> |
20 | - | ||
21 | -<%= render :file => 'shared/tiny_mce' %> |
app/views/shared/_lead_and_body.html.erb
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | <% abstract_method ||= :abstract %> | 3 | <% abstract_method ||= :abstract %> |
4 | <% body_label ||= 'Text' %> | 4 | <% body_label ||= 'Text' %> |
5 | <% body_method ||= :body %> | 5 | <% body_method ||= :body %> |
6 | -<% editor_type = defined?(tiny_mce) && tiny_mce ? 'mceEditor' : '' %> | 6 | +<% editor_type = current_editor %> |
7 | <% lead_id ||= 0%> | 7 | <% lead_id ||= 0%> |
8 | <% f ||= false%> | 8 | <% f ||= false%> |
9 | 9 |
app/views/shared/tiny_mce.html.erb
@@ -47,7 +47,9 @@ function tinymce_macros_setup(editor) { | @@ -47,7 +47,9 @@ function tinymce_macros_setup(editor) { | ||
47 | tinymce.PluginManager.add('macrosPlugin', tinymce.plugins.MacrosPlugin); | 47 | tinymce.PluginManager.add('macrosPlugin', tinymce.plugins.MacrosPlugin); |
48 | 48 | ||
49 | jQuery(document).ready(function () { | 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 | </script> | 54 | </script> |
53 | 55 |
app/views/tasks/_approve_article_accept_details.html.erb
1 | <%= task_email_template(_('Select an acceptance email template:'), @acceptance_email_templates, task) %> | 1 | <%= task_email_template(_('Select an acceptance email template:'), @acceptance_email_templates, task) %> |
2 | 2 | ||
3 | -<%= render :file => 'shared/tiny_mce' %> | ||
4 | - | ||
5 | <%= labelled_form_field(_('Create a link'), f.check_box(:create_link)) %> | 3 | <%= labelled_form_field(_('Create a link'), f.check_box(:create_link)) %> |
6 | 4 | ||
7 | <%= labelled_form_field(_('Name for publishing'), f.text_field(:name)) %> | 5 | <%= labelled_form_field(_('Name for publishing'), f.text_field(:name)) %> |
8 | <%= select_profile_folder(_('Select the folder where the article must be published'), "tasks[#{task.id}][task][article_parent_id]", task.target) %> | 6 | <%= select_profile_folder(_('Select the folder where the article must be published'), "tasks[#{task.id}][task][article_parent_id]", task.target) %> |
9 | <%= labelled_form_field(_('Highlight this article'), f.check_box(:highlighted)) %> | 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 | <%= labelled_form_field _('Comment for author'), f.text_field(:closing_statment, :style => 'width: 488px;') %> | 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 | <% unless task.requestor %> | 1 | <% unless task.requestor %> |
4 | <%= labelled_form_field(_("Sent by: "), f.text_field(:name)) %> | 2 | <%= labelled_form_field(_("Sent by: "), f.text_field(:name)) %> |
5 | <p><%= label_tag(_("Email: %s") % task.email) %> </p> | 3 | <p><%= label_tag(_("Email: %s") % task.email) %> </p> |
@@ -14,5 +12,5 @@ | @@ -14,5 +12,5 @@ | ||
14 | <%= labelled_form_field(_('Highlight this article'), a.check_box(:highlighted)) %> | 12 | <%= labelled_form_field(_('Highlight this article'), a.check_box(:highlighted)) %> |
15 | 13 | ||
16 | <%= a.hidden_field(:type) %> | 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 | <% end %> | 16 | <% end %> |
app/views/users/send_mail.html.erb
@@ -2,7 +2,6 @@ | @@ -2,7 +2,6 @@ | ||
2 | 2 | ||
3 | <%= error_messages_for :mailing %> | 3 | <%= error_messages_for :mailing %> |
4 | 4 | ||
5 | -<%= render :file => 'shared/tiny_mce' %> | ||
6 | <%= form_for :mailing do |f| %> | 5 | <%= form_for :mailing do |f| %> |
7 | <div class="recipients"> | 6 | <div class="recipients"> |
8 | <%= label_tag(_("Recipients: "), nil, { class: "formlabel" }) %> | 7 | <%= label_tag(_("Recipients: "), nil, { class: "formlabel" }) %> |
@@ -14,7 +13,7 @@ | @@ -14,7 +13,7 @@ | ||
14 | </div> | 13 | </div> |
15 | </div> | 14 | </div> |
16 | <%= labelled_form_field(_('Subject:'), f.text_field(:subject)) %> | 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 | <%= submit_button(:send, _('Send')) %> | 17 | <%= submit_button(:send, _('Send')) %> |
19 | <%= button :cancel, _('Cancel e-mail'), :controller => 'users' %> | 18 | <%= button :cancel, _('Cancel e-mail'), :controller => 'users' %> |
20 | <% end %> | 19 | <% end %> |
db/migrate/20160809123835_add_people_and_article_editor.rb
0 → 100644
@@ -0,0 +1,9 @@ | @@ -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,7 +11,7 @@ | ||
11 | # | 11 | # |
12 | # It's strongly recommended that you check this file into your version control system. | 12 | # It's strongly recommended that you check this file into your version control system. |
13 | 13 | ||
14 | -ActiveRecord::Schema.define(version: 20160608123748) do | 14 | +ActiveRecord::Schema.define(version: 20160809123835) do |
15 | 15 | ||
16 | # These are extensions that must be enabled in order to support this database | 16 | # These are extensions that must be enabled in order to support this database |
17 | enable_extension "plpgsql" | 17 | enable_extension "plpgsql" |
@@ -168,6 +168,7 @@ ActiveRecord::Schema.define(version: 20160608123748) do | @@ -168,6 +168,7 @@ ActiveRecord::Schema.define(version: 20160608123748) do | ||
168 | t.boolean "show_to_followers", default: true | 168 | t.boolean "show_to_followers", default: true |
169 | t.integer "followers_count", default: 0 | 169 | t.integer "followers_count", default: 0 |
170 | t.boolean "archived", default: false | 170 | t.boolean "archived", default: false |
171 | + t.string "editor", default: "tiny_mce", null: false | ||
171 | end | 172 | end |
172 | 173 | ||
173 | add_index "articles", ["comments_count"], name: "index_articles_on_comments_count", using: :btree | 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,6 +529,11 @@ ActiveRecord::Schema.define(version: 20160608123748) do | ||
528 | t.datetime "updated_at" | 529 | t.datetime "updated_at" |
529 | end | 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 | create_table "product_qualifiers", force: :cascade do |t| | 537 | create_table "product_qualifiers", force: :cascade do |t| |
532 | t.integer "product_id" | 538 | t.integer "product_id" |
533 | t.integer "qualifier_id" | 539 | t.integer "qualifier_id" |
@@ -630,15 +636,16 @@ ActiveRecord::Schema.define(version: 20160608123748) do | @@ -630,15 +636,16 @@ ActiveRecord::Schema.define(version: 20160608123748) do | ||
630 | t.boolean "is_template", default: false | 636 | t.boolean "is_template", default: false |
631 | t.integer "template_id" | 637 | t.integer "template_id" |
632 | t.string "redirection_after_login" | 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 | t.string "personal_website" | 642 | t.string "personal_website" |
637 | t.string "jabber_id" | 643 | t.string "jabber_id" |
638 | t.integer "welcome_page_id" | 644 | t.integer "welcome_page_id" |
639 | t.boolean "allow_members_to_invite", default: true | 645 | t.boolean "allow_members_to_invite", default: true |
640 | t.boolean "invite_friends_only", default: false | 646 | t.boolean "invite_friends_only", default: false |
641 | t.boolean "secret", default: false | 647 | t.boolean "secret", default: false |
648 | + t.string "editor", default: "tiny_mce", null: false | ||
642 | end | 649 | end |
643 | 650 | ||
644 | add_index "profiles", ["activities_count"], name: "index_profiles_on_activities_count", using: :btree | 651 | add_index "profiles", ["activities_count"], name: "index_profiles_on_activities_count", using: :btree |
features/edit_article.feature
@@ -155,7 +155,7 @@ Feature: edit article | @@ -155,7 +155,7 @@ Feature: edit article | ||
155 | Given I am on joaosilva's control panel | 155 | Given I am on joaosilva's control panel |
156 | And I follow "Manage Content" | 156 | And I follow "Manage Content" |
157 | And I follow "New content" | 157 | And I follow "New content" |
158 | - When I follow "Text article with Textile markup language" | 158 | + When I follow "Text article" |
159 | Then I should see "Tag list" | 159 | Then I should see "Tag list" |
160 | When I fill in "Title" with "Article with tags" | 160 | When I fill in "Title" with "Article with tags" |
161 | And I fill in "Tag list" with "aurium, bug" | 161 | And I fill in "Tag list" with "aurium, bug" |
@@ -168,7 +168,7 @@ Feature: edit article | @@ -168,7 +168,7 @@ Feature: edit article | ||
168 | Given I am on joaosilva's control panel | 168 | Given I am on joaosilva's control panel |
169 | And I follow "Manage Content" | 169 | And I follow "Manage Content" |
170 | When I follow "New content" | 170 | When I follow "New content" |
171 | - When I follow "Text article with visual editor" | 171 | + When I follow "Text article" |
172 | And I fill in "Title" with "My Article" | 172 | And I fill in "Title" with "My Article" |
173 | And I press "Save" | 173 | And I press "Save" |
174 | Then I should see "My Article" | 174 | Then I should see "My Article" |
@@ -203,8 +203,8 @@ Feature: edit article | @@ -203,8 +203,8 @@ Feature: edit article | ||
203 | And I press "Save" | 203 | And I press "Save" |
204 | Then I should be on /joaosilva/my-folder | 204 | Then I should be on /joaosilva/my-folder |
205 | When I follow "New article" | 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 | And I fill in "Title" with "My Article" | 208 | And I fill in "Title" with "My Article" |
209 | And I press "Save" | 209 | And I press "Save" |
210 | Then I should see "My Article" | 210 | Then I should see "My Article" |
@@ -222,12 +222,11 @@ Feature: edit article | @@ -222,12 +222,11 @@ Feature: edit article | ||
222 | And I press "Save" | 222 | And I press "Save" |
223 | Then I should be on /joaosilva/my-folder | 223 | Then I should be on /joaosilva/my-folder |
224 | When I follow "New article" | 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 | And I follow "Cancel" within ".no-boxes" | 227 | And I follow "Cancel" within ".no-boxes" |
228 | Then I should be on /joaosilva/my-folder | 228 | Then I should be on /joaosilva/my-folder |
229 | 229 | ||
230 | - @selenium | ||
231 | Scenario: save and continue | 230 | Scenario: save and continue |
232 | Given I am on /joaosilva/save-the-whales | 231 | Given I am on /joaosilva/save-the-whales |
233 | And I follow "Edit" | 232 | And I follow "Edit" |
@@ -240,8 +239,8 @@ Feature: edit article | @@ -240,8 +239,8 @@ Feature: edit article | ||
240 | Given I am on joaosilva's control panel | 239 | Given I am on joaosilva's control panel |
241 | When I follow "Manage Content" | 240 | When I follow "Manage Content" |
242 | And I follow "New content" | 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 | And I fill in "Title" with "My new article" | 244 | And I fill in "Title" with "My new article" |
246 | And I fill in "Text" with "text for the new article" | 245 | And I fill in "Text" with "text for the new article" |
247 | And I press "Save and continue" | 246 | And I press "Save and continue" |
@@ -287,7 +286,7 @@ Feature: edit article | @@ -287,7 +286,7 @@ Feature: edit article | ||
287 | Given I am on joaosilva's control panel | 286 | Given I am on joaosilva's control panel |
288 | And I follow "Manage Content" | 287 | And I follow "Manage Content" |
289 | And I follow "New content" | 288 | And I follow "New content" |
290 | - When I follow "Text article with visual editor" | 289 | + When I follow "Text article" |
291 | And I fill in "Title" with "My time testing Article" | 290 | And I fill in "Title" with "My time testing Article" |
292 | And I fill in "Publish date" with "1980-11-15 20:37" | 291 | And I fill in "Publish date" with "1980-11-15 20:37" |
293 | And I press "Save" | 292 | And I press "Save" |
features/forum.feature
@@ -99,8 +99,8 @@ Feature: forum | @@ -99,8 +99,8 @@ Feature: forum | ||
99 | And I check "Has terms of use:" | 99 | And I check "Has terms of use:" |
100 | And I press "Save" | 100 | And I press "Save" |
101 | When I follow "New discussion topic" | 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 | And I fill in "Title" with "Topic" | 104 | And I fill in "Title" with "Topic" |
105 | And I press "Save" | 105 | And I press "Save" |
106 | And I am logged in as "mariasilva" | 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,7 +8,7 @@ Feature: uploads items on media panel | ||
8 | | joaosilva | Joao Silva | | 8 | | joaosilva | Joao Silva | |
9 | And feature "media_panel" is enabled on environment | 9 | And feature "media_panel" is enabled on environment |
10 | And I am logged in as "joaosilva" | 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 | Scenario: see media panel collapsed | 13 | Scenario: see media panel collapsed |
14 | Then I should see "Insert media" | 14 | Then I should see "Insert media" |
@@ -123,7 +123,7 @@ Feature: uploads items on media panel | @@ -123,7 +123,7 @@ Feature: uploads items on media panel | ||
123 | Given the following files | 123 | Given the following files |
124 | | owner | file | mime | | 124 | | owner | file | mime | |
125 | | joaosilva | other-pic.jpg | image/jpeg | | 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 | And I follow "Show/Hide" | 127 | And I follow "Show/Hide" |
128 | And I select "Recent media" from "parent_id" within "#published-media" | 128 | And I select "Recent media" from "parent_id" within "#published-media" |
129 | Then I should see div with title "other-pic.jpg" within ".items" | 129 | Then I should see div with title "other-pic.jpg" within ".items" |
@@ -148,7 +148,7 @@ Feature: uploads items on media panel | @@ -148,7 +148,7 @@ Feature: uploads items on media panel | ||
148 | | owner | file | mime | parent | | 148 | | owner | file | mime | parent | |
149 | | joaosilva | rails.png | image/png | other-gallery | | 149 | | joaosilva | rails.png | image/png | other-gallery | |
150 | | joaosilva | other-pic.jpg | image/jpeg | gallery | | 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 | And I follow "Show/Hide" | 152 | And I follow "Show/Hide" |
153 | And I select "joaosilva/Gallery" from "parent_id" within "#published-media" | 153 | And I select "joaosilva/Gallery" from "parent_id" within "#published-media" |
154 | Then I should see div with title "other-pic.jpg" within ".items" | 154 | Then I should see div with title "other-pic.jpg" within ".items" |
@@ -165,7 +165,7 @@ Feature: uploads items on media panel | @@ -165,7 +165,7 @@ Feature: uploads items on media panel | ||
165 | And the following files | 165 | And the following files |
166 | | owner | file | mime | parent | | 166 | | owner | file | mime | parent | |
167 | | joaosilva | other-pic.jpg | image/jpeg | gallery | | 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 | And I follow "Show/Hide" | 169 | And I follow "Show/Hide" |
170 | And I select "joaosilva/Gallery" from "parent_id" within "#published-media" | 170 | And I select "joaosilva/Gallery" from "parent_id" within "#published-media" |
171 | And I select "joaosilva/Gallery" from "parent_id" within "#media-upload-form" | 171 | And I select "joaosilva/Gallery" from "parent_id" within "#media-upload-form" |
@@ -187,7 +187,7 @@ Feature: uploads items on media panel | @@ -187,7 +187,7 @@ Feature: uploads items on media panel | ||
187 | And the following files | 187 | And the following files |
188 | | owner | file | mime | parent | | 188 | | owner | file | mime | parent | |
189 | | joaosilva | rails.png | image/png | other-gallery | | 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 | And I follow "Show/Hide" | 191 | And I follow "Show/Hide" |
192 | And I select "Recent media" from "parent_id" within "#published-media" | 192 | And I select "Recent media" from "parent_id" within "#published-media" |
193 | And I fill in "Search" with "rails" within "#published-media" | 193 | And I fill in "Search" with "rails" within "#published-media" |
@@ -227,7 +227,7 @@ Feature: uploads items on media panel | @@ -227,7 +227,7 @@ Feature: uploads items on media panel | ||
227 | | joaosilva | other-pic.jpg | image/jpeg | my-gallery | | 227 | | joaosilva | other-pic.jpg | image/jpeg | my-gallery | |
228 | | joaosilva | rails.png | image/png | gallery | | 228 | | joaosilva | rails.png | image/png | gallery | |
229 | | joaosilva | other-pic.jpg | image/jpeg | gallery | | 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 | And I follow "Show/Hide" | 231 | And I follow "Show/Hide" |
232 | And I should not see "View all" | 232 | And I should not see "View all" |
233 | And I attach the file "public/503.jpg" to "file" | 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,8 +15,7 @@ Feature: create content on cms | ||
15 | 15 | ||
16 | Scenario: list all content types | 16 | Scenario: list all content types |
17 | Given I follow "New content" | 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 | And I should see "Folder" | 19 | And I should see "Folder" |
21 | And I should see "Blog" | 20 | And I should see "Blog" |
22 | And I should see "Uploaded file" | 21 | And I should see "Uploaded file" |
@@ -30,22 +29,6 @@ Feature: create content on cms | @@ -30,22 +29,6 @@ Feature: create content on cms | ||
30 | And I go to joaosilva's cms | 29 | And I go to joaosilva's cms |
31 | Then I should see "My Folder" | 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 | Scenario: create a Blog | 32 | Scenario: create a Blog |
50 | Given I follow "New content" | 33 | Given I follow "New content" |
51 | When I follow "Blog" | 34 | When I follow "Blog" |
features/profile_search.feature
@@ -47,8 +47,8 @@ Feature: search inside a profile | @@ -47,8 +47,8 @@ Feature: search inside a profile | ||
47 | And I go to joaosilva's profile | 47 | And I go to joaosilva's profile |
48 | And I fill in "q" with "article" | 48 | And I fill in "q" with "article" |
49 | And I press "Search" | 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 | Scenario: search on environment | 53 | Scenario: search on environment |
54 | Given I go to joaosilva's profile | 54 | Given I go to joaosilva's profile |
features/publish_article.feature
@@ -60,11 +60,10 @@ Feature: publish article | @@ -60,11 +60,10 @@ Feature: publish article | ||
60 | And I am on mariasilva's control panel | 60 | And I am on mariasilva's control panel |
61 | And I follow "Manage Content" | 61 | And I follow "Manage Content" |
62 | And I follow "New content" | 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 | And I fill in the following: | 65 | And I fill in the following: |
66 | | Title | Sample Article | | 66 | | Title | Sample Article | |
67 | - | Text | this is Maria's first published article | | ||
68 | And I press "Save" | 67 | And I press "Save" |
69 | And I follow "Spread" | 68 | And I follow "Spread" |
70 | And I type in "Sample Community" into autocomplete list "search-communities-to-publish" and I choose "Sample Community" | 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,7 +22,6 @@ Feature: search contents | ||
22 | Then I should see "whales and dolphins" within ".search-text-article-item" | 22 | Then I should see "whales and dolphins" within ".search-text-article-item" |
23 | And I should see "whales and dolphins" within ".only-one-result-box" | 23 | And I should see "whales and dolphins" within ".only-one-result-box" |
24 | And I should not see "bees and butterflies" | 24 | And I should not see "bees and butterflies" |
25 | - And The page should contain ".icon-content-textile-article" | ||
26 | When I follow "whales and dolphins" | 25 | When I follow "whales and dolphins" |
27 | Then I should be on article "whales and dolphins" | 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,7 +52,7 @@ Feature: Use a secret community | ||
52 | And I go to mycommunity's control panel | 52 | And I go to mycommunity's control panel |
53 | And I follow "Manage Content" | 53 | And I follow "Manage Content" |
54 | And I follow "New content" | 54 | And I follow "New content" |
55 | - And I follow "Text article with visual editor" | 55 | + And I follow "Text article" |
56 | And I fill in "Title" with "My public article" | 56 | And I fill in "Title" with "My public article" |
57 | And I choose "Public" | 57 | And I choose "Public" |
58 | And I press "Save and continue" | 58 | And I press "Save and continue" |
features/step_definitions/noosfero_steps.rb
@@ -101,7 +101,7 @@ end | @@ -101,7 +101,7 @@ end | ||
101 | 101 | ||
102 | Given /^the following (articles|events|blogs|folders|forums|galleries|uploaded files|rss feeds)$/ do |content, table| | 102 | Given /^the following (articles|events|blogs|folders|forums|galleries|uploaded files|rss feeds)$/ do |content, table| |
103 | klass = { | 103 | klass = { |
104 | - 'articles' => TextileArticle, | 104 | + 'articles' => TextArticle, |
105 | 'events' => Event, | 105 | 'events' => Event, |
106 | 'blogs' => Blog, | 106 | 'blogs' => Blog, |
107 | 'folders' => Folder, | 107 | 'folders' => Folder, |
@@ -118,6 +118,7 @@ Given /^the following (articles|events|blogs|folders|forums|galleries|uploaded f | @@ -118,6 +118,7 @@ Given /^the following (articles|events|blogs|folders|forums|galleries|uploaded f | ||
118 | language = item.delete("language") | 118 | language = item.delete("language") |
119 | category = item.delete("category") | 119 | category = item.delete("category") |
120 | filename = item.delete("filename") | 120 | filename = item.delete("filename") |
121 | + mime = item.delete("mime") || 'binary/octet-stream' | ||
121 | translation_of_id = nil | 122 | translation_of_id = nil |
122 | if item["translation_of"] | 123 | if item["translation_of"] |
123 | if item["translation_of"] != "nil" | 124 | if item["translation_of"] != "nil" |
@@ -131,7 +132,7 @@ Given /^the following (articles|events|blogs|folders|forums|galleries|uploaded f | @@ -131,7 +132,7 @@ Given /^the following (articles|events|blogs|folders|forums|galleries|uploaded f | ||
131 | :language => language, | 132 | :language => language, |
132 | :translation_of_id => translation_of_id) | 133 | :translation_of_id => translation_of_id) |
133 | if !filename.blank? | 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 | end | 136 | end |
136 | result = klass.new(item) | 137 | result = klass.new(item) |
137 | if !parent.blank? | 138 | if !parent.blank? |
@@ -178,7 +179,7 @@ Given /^the following articles? with images?$/ do |table| | @@ -178,7 +179,7 @@ Given /^the following articles? with images?$/ do |table| | ||
178 | img_tag = "<img " | 179 | img_tag = "<img " |
179 | img.each { |attr, value| img_tag += "#{attr}=\"#{value}\" " } | 180 | img.each { |attr, value| img_tag += "#{attr}=\"#{value}\" " } |
180 | img_tag += "/>" | 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 | if item[:parent] | 183 | if item[:parent] |
183 | article.parent = Article.find_by slug: item[:parent] | 184 | article.parent = Article.find_by slug: item[:parent] |
184 | end | 185 | end |
@@ -366,6 +367,10 @@ Then /^The page should not contain "(.*)"$/ do |selector| | @@ -366,6 +367,10 @@ Then /^The page should not contain "(.*)"$/ do |selector| | ||
366 | page.should have_no_css("#{selector}") | 367 | page.should have_no_css("#{selector}") |
367 | end | 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 | Given /^the mailbox is empty$/ do | 374 | Given /^the mailbox is empty$/ do |
370 | ActionMailer::Base.deliveries = [] | 375 | ActionMailer::Base.deliveries = [] |
371 | end | 376 | end |
@@ -653,6 +658,15 @@ Given /^the environment is configured to (.*) after signup$/ do |option| | @@ -653,6 +658,15 @@ Given /^the environment is configured to (.*) after signup$/ do |option| | ||
653 | environment.save | 658 | environment.save |
654 | end | 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 | When /^wait for the captcha signup time$/ do | 670 | When /^wait for the captcha signup time$/ do |
657 | environment = Environment.default | 671 | environment = Environment.default |
658 | sleep environment.min_signup_delay + 1 | 672 | sleep environment.min_signup_delay + 1 |
@@ -671,3 +685,7 @@ Given /^the field (.*) is public for all users$/ do |field| | @@ -671,3 +685,7 @@ Given /^the field (.*) is public for all users$/ do |field| | ||
671 | person.save! | 685 | person.save! |
672 | end | 686 | end |
673 | end | 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,7 +10,7 @@ Feature: Create tinyMCE article | ||
10 | 10 | ||
11 | @selenium | 11 | @selenium |
12 | Scenario: mce complete mode should show on message creation | 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 | 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" | 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 | And The tinymce "menubar" should be "edit insert view tools" | 15 | And The tinymce "menubar" should be "edit insert view tools" |
16 | And The tinymce "toolbar2" should contain "print preview code media | table" | 16 | And The tinymce "toolbar2" should contain "print preview code media | table" |
lib/file_presenter.rb
@@ -124,3 +124,8 @@ end | @@ -124,3 +124,8 @@ end | ||
124 | Dir.glob(File.join('app', 'presenters', '*.rb')) do |file| | 124 | Dir.glob(File.join('app', 'presenters', '*.rb')) do |file| |
125 | load file | 125 | load file |
126 | end | 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,7 +10,8 @@ class Noosfero::Plugin::Settings | ||
10 | end | 10 | end |
11 | 11 | ||
12 | def settings | 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 | end | 15 | end |
15 | 16 | ||
16 | def method_missing(method, *args, &block) | 17 | def method_missing(method, *args, &block) |
plugins/admin_notifications/views/shared/_form.html.erb
1 | <div class="notification-plugin-form"> | 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 | <%= button :back, _('Back'), :controller => 'admin_notifications_plugin_admin' %> | 5 | <%= button :back, _('Back'), :controller => 'admin_notifications_plugin_admin' %> |
6 | 6 | ||
7 | <%= form_for :notifications do |f| %> | 7 | <%= form_for :notifications do |f| %> |
8 | 8 | ||
9 | - <%= render :file => 'shared/tiny_mce', :locals => {:mode => 'restricted'} %> | ||
10 | - | ||
11 | <%= labelled_form_field(_("Optional Title:"), f.text_field(:title, value: @notification.title)) %> | 9 | <%= labelled_form_field(_("Optional Title:"), f.text_field(:title, value: @notification.title)) %> |
12 | 10 | ||
13 | <%= labelled_form_field(_("Enter your message here:"), f.text_area(:message, abstract_options)) %> | 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 | class Application < Rails::Application | 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 | end | 3 | end |
4 | 4 | ||
5 | class CommentParagraphPlugin::AllowComment < Noosfero::Plugin::Macro | 5 | class CommentParagraphPlugin::AllowComment < Noosfero::Plugin::Macro |
plugins/comment_paragraph/test/unit/article_test.rb
@@ -5,7 +5,7 @@ class ArticleTest < ActiveSupport::TestCase | @@ -5,7 +5,7 @@ class ArticleTest < ActiveSupport::TestCase | ||
5 | 5 | ||
6 | def setup | 6 | def setup |
7 | @profile = fast_create(Community) | 7 | @profile = fast_create(Community) |
8 | - @article = fast_create(TinyMceArticle, :profile_id => profile.id) | 8 | + @article = fast_create(TextArticle, :profile_id => profile.id) |
9 | @environment = Environment.default | 9 | @environment = Environment.default |
10 | @environment.enable_plugin(CommentParagraphPlugin) | 10 | @environment.enable_plugin(CommentParagraphPlugin) |
11 | end | 11 | end |
plugins/comment_paragraph/test/unit/discussion_block_test.rb
@@ -74,7 +74,7 @@ class DiscussionBlockTest < ActiveSupport::TestCase | @@ -74,7 +74,7 @@ class DiscussionBlockTest < ActiveSupport::TestCase | ||
74 | b.save | 74 | b.save |
75 | a1 = fast_create(CommentParagraphPlugin::Discussion, :profile_id => community.id) | 75 | a1 = fast_create(CommentParagraphPlugin::Discussion, :profile_id => community.id) |
76 | fast_create(Event, :profile_id => community.id) | 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 | a2 = fast_create(CommentParagraphPlugin::Discussion, :profile_id => community.id) | 78 | a2 = fast_create(CommentParagraphPlugin::Discussion, :profile_id => community.id) |
79 | assert_equivalent [a1, a2], b.discussions | 79 | assert_equivalent [a1, a2], b.discussions |
80 | end | 80 | end |
@@ -183,7 +183,7 @@ class DiscussionBlockViewTest < ActionView::TestCase | @@ -183,7 +183,7 @@ class DiscussionBlockViewTest < ActionView::TestCase | ||
183 | b.save | 183 | b.save |
184 | a1 = fast_create(CommentParagraphPlugin::Discussion, :profile_id => community.id) | 184 | a1 = fast_create(CommentParagraphPlugin::Discussion, :profile_id => community.id) |
185 | fast_create(Event, :profile_id => community.id) | 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 | a2 = fast_create(CommentParagraphPlugin::Discussion, :profile_id => community.id) | 187 | a2 = fast_create(CommentParagraphPlugin::Discussion, :profile_id => community.id) |
188 | assert_equivalent [a2.id, a1.id], b.api_content['articles'].map {|a| a[:id]} | 188 | assert_equivalent [a2.id, a1.id], b.api_content['articles'].map {|a| a[:id]} |
189 | end | 189 | end |
plugins/comment_paragraph/test/unit/tinymce_helper_test.rb
@@ -7,6 +7,7 @@ class TinymceHelperTest < ActiveSupport::TestCase | @@ -7,6 +7,7 @@ class TinymceHelperTest < ActiveSupport::TestCase | ||
7 | def setup | 7 | def setup |
8 | expects(:top_url).returns('/') | 8 | expects(:top_url).returns('/') |
9 | expects(:tinymce_language).returns('en') | 9 | expects(:tinymce_language).returns('en') |
10 | + expects(:current_editor).returns(Article::Editor::TINY_MCE) | ||
10 | @plugins = mock | 11 | @plugins = mock |
11 | @plugins.expects(:dispatch).returns([]).at_least_once | 12 | @plugins.expects(:dispatch).returns([]).at_least_once |
12 | @environment = Environment.default | 13 | @environment = Environment.default |
plugins/community_track/lib/community_track_plugin/step.rb
@@ -61,7 +61,7 @@ class CommunityTrackPlugin::Step < Folder | @@ -61,7 +61,7 @@ class CommunityTrackPlugin::Step < Folder | ||
61 | end | 61 | end |
62 | 62 | ||
63 | def enabled_tools | 63 | def enabled_tools |
64 | - tools = [TinyMceArticle, Forum] | 64 | + tools = [TextArticle, Forum] |
65 | tools << CommunityHubPlugin::Hub if environment.plugin_enabled?('CommunityHubPlugin') | 65 | tools << CommunityHubPlugin::Hub if environment.plugin_enabled?('CommunityHubPlugin') |
66 | tools << ProposalsDiscussionPlugin::Discussion if environment.plugin_enabled?('ProposalsDiscussionPlugin') | 66 | tools << ProposalsDiscussionPlugin::Discussion if environment.plugin_enabled?('ProposalsDiscussionPlugin') |
67 | tools << PairwisePlugin::PairwiseContent if environment.plugin_enabled?('PairwisePlugin') | 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,7 +5,7 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
5 | def setup | 5 | def setup |
6 | @profile = Community.create!(:name => 'Sample community', :identifier => 'sample-community') | 6 | @profile = Community.create!(:name => 'Sample community', :identifier => 'sample-community') |
7 | @track = create_track('track', @profile) | 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 | user = create_user('testinguser') | 10 | user = create_user('testinguser') |
11 | login_as(user.login) | 11 | login_as(user.login) |
@@ -49,7 +49,7 @@ class ContentViewerControllerTest < ActionController::TestCase | @@ -49,7 +49,7 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
49 | end | 49 | end |
50 | 50 | ||
51 | should 'show tools for a step' do | 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 | get :view_page, @step.url | 53 | get :view_page, @step.url |
54 | assert_tag :tag => 'div', :attributes => { :class => 'tools' }, :descendant => { :tag => 'div', :attributes => { :class => 'item' } } | 54 | assert_tag :tag => 'div', :attributes => { :class => 'tools' }, :descendant => { :tag => 'div', :attributes => { :class => 'item' } } |
55 | end | 55 | end |
plugins/community_track/test/unit/community_track_plugin/step_test.rb
@@ -237,7 +237,7 @@ class StepTest < ActiveSupport::TestCase | @@ -237,7 +237,7 @@ class StepTest < ActiveSupport::TestCase | ||
237 | end | 237 | end |
238 | 238 | ||
239 | should 'return enabled tools for a step' do | 239 | should 'return enabled tools for a step' do |
240 | - assert_includes @step.enabled_tools, TinyMceArticle | 240 | + assert_includes @step.enabled_tools, TextArticle |
241 | assert_includes @step.enabled_tools, Forum | 241 | assert_includes @step.enabled_tools, Forum |
242 | end | 242 | end |
243 | 243 |
plugins/community_track/views/cms/community_track_plugin/_step.html.erb
1 | <%= required_fields_message %> | 1 | <%= required_fields_message %> |
2 | 2 | ||
3 | -<%= render :file => 'shared/tiny_mce' %> | ||
4 | - | ||
5 | <div> | 3 | <div> |
6 | <%= required f.text_field('name', :size => '64', :maxlength => 150) %> | 4 | <%= required f.text_field('name', :size => '64', :maxlength => 150) %> |
7 | <%= labelled_form_field(_('Period'), ( | 5 | <%= labelled_form_field(_('Period'), ( |
@@ -19,4 +17,4 @@ | @@ -19,4 +17,4 @@ | ||
19 | 17 | ||
20 | <%= labelled_form_field check_box(:article, :hidden) + _('Hidden Step'), '' %> | 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 | <div class='community-track'> | 1 | <div class='community-track'> |
2 | <%= required_fields_message %> | 2 | <%= required_fields_message %> |
3 | 3 | ||
4 | - <%= render :file => 'shared/tiny_mce' %> | ||
5 | - | ||
6 | <div> | 4 | <div> |
7 | <%= required labelled_form_field(c_('Title'), text_field(:article, 'name', :size => '64', :maxlength => 150)) %> | 5 | <%= required labelled_form_field(c_('Title'), text_field(:article, 'name', :size => '64', :maxlength => 150)) %> |
8 | </div> | 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 | <div> | 10 | <div> |
13 | <%= labelled_form_field(_('Goals:'), text_area(:article, :goals, :rows => 3, :cols => 64)) %> | 11 | <%= labelled_form_field(_('Goals:'), text_area(:article, :goals, :rows => 3, :cols => 64)) %> |
plugins/context_content/lib/context_content_plugin/context_content_block.rb
@@ -22,7 +22,7 @@ class ContextContentPlugin::ContextContentBlock < Block | @@ -22,7 +22,7 @@ class ContextContentPlugin::ContextContentBlock < Block | ||
22 | end | 22 | end |
23 | 23 | ||
24 | def available_content_types | 24 | def available_content_types |
25 | - @available_content_types ||= [UploadedFile, Event, TinyMceArticle, TextileArticle, RawHTMLArticle, Folder, Blog, Forum, Gallery, RssFeed] + plugins.dispatch(:content_types) | 25 | + @available_content_types ||= [UploadedFile, Event, TextArticle, Folder, Blog, Forum, Gallery, RssFeed] + plugins.dispatch(:content_types) |
26 | checked_types = types.map {|t| t.constantize} | 26 | checked_types = types.map {|t| t.constantize} |
27 | checked_types + (@available_content_types - checked_types) | 27 | checked_types + (@available_content_types - checked_types) |
28 | end | 28 | end |
plugins/context_content/test/functional/content_viewer_controller_test.rb
@@ -8,7 +8,7 @@ class ContentViewerControllerTest < ActionController::TestCase | @@ -8,7 +8,7 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
8 | 8 | ||
9 | box = Box.create!(:owner => @profile) | 9 | box = Box.create!(:owner => @profile) |
10 | @block = ContextContentPlugin::ContextContentBlock.new(:box_id => box.id) | 10 | @block = ContextContentPlugin::ContextContentBlock.new(:box_id => box.id) |
11 | - @block.types = ['TinyMceArticle'] | 11 | + @block.types = ['TextArticle'] |
12 | @block.limit = 1 | 12 | @block.limit = 1 |
13 | @block.title = "New Context Block" | 13 | @block.title = "New Context Block" |
14 | @block.save! | 14 | @block.save! |
@@ -21,7 +21,7 @@ class ContentViewerControllerTest < ActionController::TestCase | @@ -21,7 +21,7 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
21 | end | 21 | end |
22 | 22 | ||
23 | should 'display context content block if it has contents' do | 23 | should 'display context content block if it has contents' do |
24 | - article = fast_create(TinyMceArticle, :parent_id => @page.id, :profile_id => @profile.id, :name => 'article1') | 24 | + article = fast_create(TextArticle, :parent_id => @page.id, :profile_id => @profile.id, :name => 'article1') |
25 | get :view_page, @page.url | 25 | get :view_page, @page.url |
26 | assert_tag 'div', :attributes => {:id => "context_content_#{@block.id}", :class => 'contents'} | 26 | assert_tag 'div', :attributes => {:id => "context_content_#{@block.id}", :class => 'contents'} |
27 | assert_no_tag 'div', :attributes => {:id => "context_content_more_#{@block.id}", :class => 'more_button'}, :descendant => {:tag => 'a'} | 27 | assert_no_tag 'div', :attributes => {:id => "context_content_more_#{@block.id}", :class => 'more_button'}, :descendant => {:tag => 'a'} |
@@ -31,7 +31,7 @@ class ContentViewerControllerTest < ActionController::TestCase | @@ -31,7 +31,7 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
31 | should 'display context content block title if it is not configured to use_parent_title' do | 31 | should 'display context content block title if it is not configured to use_parent_title' do |
32 | @block.use_parent_title = false | 32 | @block.use_parent_title = false |
33 | @block.save | 33 | @block.save |
34 | - article = fast_create(TinyMceArticle, :parent_id => @page.id, :profile_id => @profile.id, :name => 'article1') | 34 | + article = fast_create(TextArticle, :parent_id => @page.id, :profile_id => @profile.id, :name => 'article1') |
35 | get :view_page, @page.url | 35 | get :view_page, @page.url |
36 | assert_tag 'h3', :attributes => {:class => 'block-title'}, :content => @block.title | 36 | assert_tag 'h3', :attributes => {:class => 'block-title'}, :content => @block.title |
37 | assert_no_tag 'h3', :attributes => {:class => 'block-title'}, :content => @page.name | 37 | assert_no_tag 'h3', :attributes => {:class => 'block-title'}, :content => @page.name |
@@ -40,15 +40,15 @@ class ContentViewerControllerTest < ActionController::TestCase | @@ -40,15 +40,15 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
40 | should 'display context content with folder title if it is configured to use_parent_title' do | 40 | should 'display context content with folder title if it is configured to use_parent_title' do |
41 | @block.use_parent_title = true | 41 | @block.use_parent_title = true |
42 | @block.save | 42 | @block.save |
43 | - article = fast_create(TinyMceArticle, :parent_id => @page.id, :profile_id => @profile.id, :name => 'article1') | 43 | + article = fast_create(TextArticle, :parent_id => @page.id, :profile_id => @profile.id, :name => 'article1') |
44 | get :view_page, @page.url | 44 | get :view_page, @page.url |
45 | assert_tag 'h3', :attributes => {:class => 'block-title'}, :content => @page.name | 45 | assert_tag 'h3', :attributes => {:class => 'block-title'}, :content => @page.name |
46 | assert_no_tag 'h3', :attributes => {:class => 'block-title'}, :content => @block.title | 46 | assert_no_tag 'h3', :attributes => {:class => 'block-title'}, :content => @block.title |
47 | end | 47 | end |
48 | 48 | ||
49 | should 'display context content block with pagination' do | 49 | should 'display context content block with pagination' do |
50 | - article1 = fast_create(TinyMceArticle, :parent_id => @page.id, :profile_id => @profile.id) | ||
51 | - article2 = fast_create(TinyMceArticle, :parent_id => @page.id, :profile_id => @profile.id) | 50 | + article1 = fast_create(TextArticle, :parent_id => @page.id, :profile_id => @profile.id) |
51 | + article2 = fast_create(TextArticle, :parent_id => @page.id, :profile_id => @profile.id) | ||
52 | get :view_page, @page.url | 52 | get :view_page, @page.url |
53 | assert_tag 'div', :attributes => {:id => "context_content_#{@block.id}", :class => 'contents'} | 53 | assert_tag 'div', :attributes => {:id => "context_content_#{@block.id}", :class => 'contents'} |
54 | assert_tag 'div', :attributes => {:id => "context_content_more_#{@block.id}", :class => 'more_button'}, :descendant => {:tag => 'a', :attributes => {:class => 'button icon-button icon-left disabled'} } | 54 | assert_tag 'div', :attributes => {:id => "context_content_more_#{@block.id}", :class => 'more_button'}, :descendant => {:tag => 'a', :attributes => {:class => 'button icon-button icon-left disabled'} } |
plugins/context_content/test/functional/context_content_plugin_profile_controller_test.rb
@@ -9,7 +9,7 @@ class ContextContentPluginProfileControllerTest < ActionController::TestCase | @@ -9,7 +9,7 @@ class ContextContentPluginProfileControllerTest < ActionController::TestCase | ||
9 | box = create(Box, :owner_type => 'Profile', :owner_id => @profile.id) | 9 | box = create(Box, :owner_type => 'Profile', :owner_id => @profile.id) |
10 | @block = ContextContentPlugin::ContextContentBlock.new | 10 | @block = ContextContentPlugin::ContextContentBlock.new |
11 | @block.box = box | 11 | @block.box = box |
12 | - @block.types = ['TinyMceArticle'] | 12 | + @block.types = ['TextArticle'] |
13 | @block.limit = 1 | 13 | @block.limit = 1 |
14 | owner = create_user('block-owner').person | 14 | owner = create_user('block-owner').person |
15 | @block.box = owner.boxes.last | 15 | @block.box = owner.boxes.last |
@@ -23,14 +23,14 @@ class ContextContentPluginProfileControllerTest < ActionController::TestCase | @@ -23,14 +23,14 @@ class ContextContentPluginProfileControllerTest < ActionController::TestCase | ||
23 | end | 23 | end |
24 | 24 | ||
25 | should 'render error if page do not exists' do | 25 | should 'render error if page do not exists' do |
26 | - article = fast_create(TinyMceArticle, :parent_id => @page.id, :profile_id => @profile.id) | 26 | + article = fast_create(TextArticle, :parent_id => @page.id, :profile_id => @profile.id) |
27 | xhr :get, :view_content, :id => @block.id, :article_id => @page.id, :page => 2, :profile => @profile.identifier | 27 | xhr :get, :view_content, :id => @block.id, :article_id => @page.id, :page => 2, :profile => @profile.identifier |
28 | assert_response 500 | 28 | assert_response 500 |
29 | end | 29 | end |
30 | 30 | ||
31 | should 'replace div with content for page passed as parameter' do | 31 | should 'replace div with content for page passed as parameter' do |
32 | - article1 = fast_create(TinyMceArticle, :parent_id => @page.id, :profile_id => @profile.id, :name => 'article1') | ||
33 | - article2 = fast_create(TinyMceArticle, :parent_id => @page.id, :profile_id => @profile.id, :name => 'article2') | 32 | + article1 = fast_create(TextArticle, :parent_id => @page.id, :profile_id => @profile.id, :name => 'article1') |
33 | + article2 = fast_create(TextArticle, :parent_id => @page.id, :profile_id => @profile.id, :name => 'article2') | ||
34 | xhr :get, :view_content, :id => @block.id, :article_id => @page.id, :page => 2, :profile => @profile.identifier | 34 | xhr :get, :view_content, :id => @block.id, :article_id => @page.id, :page => 2, :profile => @profile.identifier |
35 | assert_response :success | 35 | assert_response :success |
36 | assert_match /context_content_#{@block.id}/, @response.body | 36 | assert_match /context_content_#{@block.id}/, @response.body |
@@ -39,7 +39,7 @@ class ContextContentPluginProfileControllerTest < ActionController::TestCase | @@ -39,7 +39,7 @@ class ContextContentPluginProfileControllerTest < ActionController::TestCase | ||
39 | end | 39 | end |
40 | 40 | ||
41 | should 'do not render pagination buttons if it has only one page' do | 41 | should 'do not render pagination buttons if it has only one page' do |
42 | - article1 = fast_create(TinyMceArticle, :parent_id => @page.id, :profile_id => @profile.id, :name => 'article1') | 42 | + article1 = fast_create(TextArticle, :parent_id => @page.id, :profile_id => @profile.id, :name => 'article1') |
43 | xhr :get, :view_content, :id => @block.id, :article_id => @page.id, :page => 2, :profile => @profile.identifier | 43 | xhr :get, :view_content, :id => @block.id, :article_id => @page.id, :page => 2, :profile => @profile.identifier |
44 | assert_no_match /context_content_more_#{@block.id}/, @response.body | 44 | assert_no_match /context_content_more_#{@block.id}/, @response.body |
45 | end | 45 | end |
plugins/context_content/test/functional/profile_design_controller_test.rb
@@ -13,7 +13,7 @@ class ProfileDesignControllerTest < ActionController::TestCase | @@ -13,7 +13,7 @@ class ProfileDesignControllerTest < ActionController::TestCase | ||
13 | 13 | ||
14 | box = Box.create!(:owner => @profile) | 14 | box = Box.create!(:owner => @profile) |
15 | @block = ContextContentPlugin::ContextContentBlock.new(:box_id => box.id) | 15 | @block = ContextContentPlugin::ContextContentBlock.new(:box_id => box.id) |
16 | - @block.types = ['TinyMceArticle'] | 16 | + @block.types = ['TextArticle'] |
17 | @block.limit = 1 | 17 | @block.limit = 1 |
18 | @block.save! | 18 | @block.save! |
19 | 19 | ||
@@ -38,11 +38,11 @@ class ProfileDesignControllerTest < ActionController::TestCase | @@ -38,11 +38,11 @@ class ProfileDesignControllerTest < ActionController::TestCase | ||
38 | @block.show_parent_content = false | 38 | @block.show_parent_content = false |
39 | @block.save! | 39 | @block.save! |
40 | get :edit, :id => @block.id, :profile => @profile.identifier | 40 | get :edit, :id => @block.id, :profile => @profile.identifier |
41 | - post :save, :id => @block.id, :block => {:title => 'context', :show_image => '0', :show_name => '0', :show_parent_content => '0', :types => ['TinyMceArticle', '', nil, 'Folder'] }, :profile => @profile.identifier | 41 | + post :save, :id => @block.id, :block => {:title => 'context', :show_image => '0', :show_name => '0', :show_parent_content => '0', :types => ['TextArticle', '', nil, 'Folder'] }, :profile => @profile.identifier |
42 | @block.reload | 42 | @block.reload |
43 | assert_equal 'context', @block.title | 43 | assert_equal 'context', @block.title |
44 | refute @block.show_image && !@block.show_name && !@block.show_parent_content | 44 | refute @block.show_image && !@block.show_name && !@block.show_parent_content |
45 | - assert_equal ['TinyMceArticle', 'Folder'], @block.types | 45 | + assert_equal ['TextArticle', 'Folder'], @block.types |
46 | end | 46 | end |
47 | 47 | ||
48 | end | 48 | end |
plugins/context_content/test/unit/context_content_block_test.rb
@@ -5,7 +5,7 @@ class ContextContentBlockTest < ActiveSupport::TestCase | @@ -5,7 +5,7 @@ class ContextContentBlockTest < ActiveSupport::TestCase | ||
5 | def setup | 5 | def setup |
6 | Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([]) | 6 | Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([]) |
7 | @block = ContextContentPlugin::ContextContentBlock.create! | 7 | @block = ContextContentPlugin::ContextContentBlock.create! |
8 | - @block.types = ['TinyMceArticle'] | 8 | + @block.types = ['TextArticle'] |
9 | end | 9 | end |
10 | 10 | ||
11 | should 'describe itself' do | 11 | should 'describe itself' do |
@@ -22,13 +22,13 @@ class ContextContentBlockTest < ActiveSupport::TestCase | @@ -22,13 +22,13 @@ class ContextContentBlockTest < ActiveSupport::TestCase | ||
22 | 22 | ||
23 | should 'return children of page' do | 23 | should 'return children of page' do |
24 | folder = fast_create(Folder) | 24 | folder = fast_create(Folder) |
25 | - article = fast_create(TinyMceArticle, :parent_id => folder.id) | 25 | + article = fast_create(TextArticle, :parent_id => folder.id) |
26 | assert_equal [article], @block.contents(folder) | 26 | assert_equal [article], @block.contents(folder) |
27 | end | 27 | end |
28 | 28 | ||
29 | should 'return parent name of the contents' do | 29 | should 'return parent name of the contents' do |
30 | folder = fast_create(Folder, :name => " New Folder") | 30 | folder = fast_create(Folder, :name => " New Folder") |
31 | - article = fast_create(TinyMceArticle, :parent_id => folder.id) | 31 | + article = fast_create(TextArticle, :parent_id => folder.id) |
32 | assert_equal folder.name, @block.parent_title([article]) | 32 | assert_equal folder.name, @block.parent_title([article]) |
33 | end | 33 | end |
34 | 34 | ||
@@ -39,40 +39,40 @@ class ContextContentBlockTest < ActiveSupport::TestCase | @@ -39,40 +39,40 @@ class ContextContentBlockTest < ActiveSupport::TestCase | ||
39 | should 'limit number of children to display' do | 39 | should 'limit number of children to display' do |
40 | @block.limit = 2 | 40 | @block.limit = 2 |
41 | folder = fast_create(Folder) | 41 | folder = fast_create(Folder) |
42 | - article1 = fast_create(TinyMceArticle, :parent_id => folder.id) | ||
43 | - article2 = fast_create(TinyMceArticle, :parent_id => folder.id) | ||
44 | - article3 = fast_create(TinyMceArticle, :parent_id => folder.id) | 42 | + article1 = fast_create(TextArticle, :parent_id => folder.id) |
43 | + article2 = fast_create(TextArticle, :parent_id => folder.id) | ||
44 | + article3 = fast_create(TextArticle, :parent_id => folder.id) | ||
45 | assert_equal 2, @block.contents(folder).length | 45 | assert_equal 2, @block.contents(folder).length |
46 | end | 46 | end |
47 | 47 | ||
48 | should 'show contents for next page' do | 48 | should 'show contents for next page' do |
49 | @block.limit = 2 | 49 | @block.limit = 2 |
50 | folder = fast_create(Folder) | 50 | folder = fast_create(Folder) |
51 | - article1 = fast_create(TinyMceArticle, :name => 'article 1', :parent_id => folder.id) | ||
52 | - article2 = fast_create(TinyMceArticle, :name => 'article 2', :parent_id => folder.id) | ||
53 | - article3 = fast_create(TinyMceArticle, :name => 'article 3', :parent_id => folder.id) | 51 | + article1 = fast_create(TextArticle, :name => 'article 1', :parent_id => folder.id) |
52 | + article2 = fast_create(TextArticle, :name => 'article 2', :parent_id => folder.id) | ||
53 | + article3 = fast_create(TextArticle, :name => 'article 3', :parent_id => folder.id) | ||
54 | assert_equal [article3], @block.contents(folder, 2) | 54 | assert_equal [article3], @block.contents(folder, 2) |
55 | end | 55 | end |
56 | 56 | ||
57 | should 'show parent contents for next page' do | 57 | should 'show parent contents for next page' do |
58 | @block.limit = 2 | 58 | @block.limit = 2 |
59 | folder = fast_create(Folder) | 59 | folder = fast_create(Folder) |
60 | - article1 = fast_create(TinyMceArticle, :name => 'article 1', :parent_id => folder.id) | ||
61 | - article2 = fast_create(TinyMceArticle, :name => 'article 2', :parent_id => folder.id) | ||
62 | - article3 = fast_create(TinyMceArticle, :name => 'article 3', :parent_id => folder.id) | 60 | + article1 = fast_create(TextArticle, :name => 'article 1', :parent_id => folder.id) |
61 | + article2 = fast_create(TextArticle, :name => 'article 2', :parent_id => folder.id) | ||
62 | + article3 = fast_create(TextArticle, :name => 'article 3', :parent_id => folder.id) | ||
63 | assert_equal [article3], @block.contents(article1, 2) | 63 | assert_equal [article3], @block.contents(article1, 2) |
64 | end | 64 | end |
65 | 65 | ||
66 | should 'return parent children if page has no children' do | 66 | should 'return parent children if page has no children' do |
67 | folder = fast_create(Folder) | 67 | folder = fast_create(Folder) |
68 | - article = fast_create(TinyMceArticle, :parent_id => folder.id) | 68 | + article = fast_create(TextArticle, :parent_id => folder.id) |
69 | assert_equal [article], @block.contents(article) | 69 | assert_equal [article], @block.contents(article) |
70 | end | 70 | end |
71 | 71 | ||
72 | should 'do not return parent children if show_parent_content is false' do | 72 | should 'do not return parent children if show_parent_content is false' do |
73 | @block.show_parent_content = false | 73 | @block.show_parent_content = false |
74 | folder = fast_create(Folder) | 74 | folder = fast_create(Folder) |
75 | - article = fast_create(TinyMceArticle, :parent_id => folder.id) | 75 | + article = fast_create(TextArticle, :parent_id => folder.id) |
76 | assert_equal [], @block.contents(article) | 76 | assert_equal [], @block.contents(article) |
77 | end | 77 | end |
78 | 78 | ||
@@ -82,13 +82,13 @@ class ContextContentBlockTest < ActiveSupport::TestCase | @@ -82,13 +82,13 @@ class ContextContentBlockTest < ActiveSupport::TestCase | ||
82 | end | 82 | end |
83 | 83 | ||
84 | should 'return available content types with checked types first' do | 84 | should 'return available content types with checked types first' do |
85 | - @block.types = ['TinyMceArticle', 'Folder'] | ||
86 | - assert_equal [TinyMceArticle, Folder, UploadedFile, Event, TextileArticle, RawHTMLArticle, Blog, Forum, Gallery, RssFeed], @block.available_content_types | 85 | + @block.types = ['TextArticle', 'Folder'] |
86 | + assert_equal [TextArticle, Folder, UploadedFile, Event, Blog, Forum, Gallery, RssFeed], @block.available_content_types | ||
87 | end | 87 | end |
88 | 88 | ||
89 | should 'return available content types' do | 89 | should 'return available content types' do |
90 | @block.types = [] | 90 | @block.types = [] |
91 | - assert_equal [UploadedFile, Event, TinyMceArticle, TextileArticle, RawHTMLArticle, Folder, Blog, Forum, Gallery, RssFeed], @block.available_content_types | 91 | + assert_equal [UploadedFile, Event, TextArticle, Folder, Blog, Forum, Gallery, RssFeed], @block.available_content_types |
92 | end | 92 | end |
93 | 93 | ||
94 | should 'return first 2 content types' do | 94 | should 'return first 2 content types' do |
@@ -120,7 +120,7 @@ class ContextContentBlockTest < ActiveSupport::TestCase | @@ -120,7 +120,7 @@ class ContextContentBlockTest < ActiveSupport::TestCase | ||
120 | Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([SomePlugin.new]) | 120 | Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([SomePlugin.new]) |
121 | 121 | ||
122 | @block.types = [] | 122 | @block.types = [] |
123 | - assert_equal [UploadedFile, Event, TinyMceArticle, TextileArticle, RawHTMLArticle, Folder, Blog, Forum, Gallery, RssFeed, SomePluginContent], @block.available_content_types | 123 | + assert_equal [UploadedFile, Event, TextArticle, Folder, Blog, Forum, Gallery, RssFeed, SomePluginContent], @block.available_content_types |
124 | end | 124 | end |
125 | 125 | ||
126 | should 'return box owner on profile method call' do | 126 | should 'return box owner on profile method call' do |
@@ -144,7 +144,7 @@ class ContextContentBlockViewTest < ActionView::TestCase | @@ -144,7 +144,7 @@ class ContextContentBlockViewTest < ActionView::TestCase | ||
144 | def setup | 144 | def setup |
145 | Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([]) | 145 | Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([]) |
146 | @block = ContextContentPlugin::ContextContentBlock.create! | 146 | @block = ContextContentPlugin::ContextContentBlock.create! |
147 | - @block.types = ['TinyMceArticle'] | 147 | + @block.types = ['TextArticle'] |
148 | end | 148 | end |
149 | 149 | ||
150 | should 'render nothing if it has no content to show' do | 150 | should 'render nothing if it has no content to show' do |
@@ -153,7 +153,7 @@ class ContextContentBlockViewTest < ActionView::TestCase | @@ -153,7 +153,7 @@ class ContextContentBlockViewTest < ActionView::TestCase | ||
153 | 153 | ||
154 | should 'render context content block view' do | 154 | should 'render context content block view' do |
155 | @page = fast_create(Folder) | 155 | @page = fast_create(Folder) |
156 | - article = fast_create(TinyMceArticle, :parent_id => @page.id) | 156 | + article = fast_create(TextArticle, :parent_id => @page.id) |
157 | contents = [article] | 157 | contents = [article] |
158 | @block.use_parent_title = true | 158 | @block.use_parent_title = true |
159 | 159 | ||
@@ -178,9 +178,9 @@ class ContextContentBlockViewTest < ActionView::TestCase | @@ -178,9 +178,9 @@ class ContextContentBlockViewTest < ActionView::TestCase | ||
178 | should 'display pagination links if it has more than one page' do | 178 | should 'display pagination links if it has more than one page' do |
179 | @block.limit = 2 | 179 | @block.limit = 2 |
180 | @page = fast_create(Folder) | 180 | @page = fast_create(Folder) |
181 | - article1 = fast_create(TinyMceArticle, :parent_id => @page.id) | ||
182 | - article2 = fast_create(TinyMceArticle, :parent_id => @page.id) | ||
183 | - article3 = fast_create(TinyMceArticle, :parent_id => @page.id) | 181 | + article1 = fast_create(TextArticle, :parent_id => @page.id) |
182 | + article2 = fast_create(TextArticle, :parent_id => @page.id) | ||
183 | + article3 = fast_create(TextArticle, :parent_id => @page.id) | ||
184 | contents = [article1, article2, article3] | 184 | contents = [article1, article2, article3] |
185 | contents.each do |article| | 185 | contents.each do |article| |
186 | article.expects(:view_url).returns('http://test.noosfero.plugins') | 186 | article.expects(:view_url).returns('http://test.noosfero.plugins') |
plugins/custom_forms/test/functional/custom_forms_plugin_myprofile_controller_test.rb
@@ -180,8 +180,9 @@ class CustomFormsPluginMyprofileControllerTest < ActionController::TestCase | @@ -180,8 +180,9 @@ class CustomFormsPluginMyprofileControllerTest < ActionController::TestCase | ||
180 | form = CustomFormsPlugin::Form.create!(:profile => profile, :name => 'Free Software') | 180 | form = CustomFormsPlugin::Form.create!(:profile => profile, :name => 'Free Software') |
181 | 181 | ||
182 | get :edit, :profile => profile.identifier, :id => form.id | 182 | get :edit, :profile => profile.identifier, :id => form.id |
183 | + expects(:current_editor).returns(Article::Editor::TINY_MCE) | ||
183 | 184 | ||
184 | - assert_tag :tag => 'textarea', :attributes => { :id => 'form_description', :class => 'mceEditor' } | 185 | + assert_tag :tag => 'textarea', :attributes => { :id => 'form_description', :class => /#{current_editor}/ } |
185 | end | 186 | end |
186 | 187 | ||
187 | should 'export submissions as csv' do | 188 | should 'export submissions as csv' do |
plugins/custom_forms/views/custom_forms_plugin_myprofile/_form.html.erb
1 | <% self.extend(CustomFormsPlugin::Helper) %> | 1 | <% self.extend(CustomFormsPlugin::Helper) %> |
2 | -<%= render :file => 'shared/tiny_mce', :locals => {:mode => 'simple'} %> | ||
3 | 2 | ||
4 | <%= error_messages_for :form %> | 3 | <%= error_messages_for :form %> |
5 | <%= required labelled_form_field _('Name'), f.text_field(:name) %> | 4 | <%= required labelled_form_field _('Name'), f.text_field(:name) %> |
@@ -17,7 +16,7 @@ | @@ -17,7 +16,7 @@ | ||
17 | <%= labelled_check_box _('Triggered after membership'), 'form[on_membership]', '1', @form.on_membership %> | 16 | <%= labelled_check_box _('Triggered after membership'), 'form[on_membership]', '1', @form.on_membership %> |
18 | </p> | 17 | </p> |
19 | <% end %> | 18 | <% end %> |
20 | -<%= labelled_form_field c_('Description'), f.text_area(:description, :style => 'width: 100%', :class => 'mceEditor') %> | 19 | +<%= labelled_form_field c_('Description'), f.text_area(:description, :style => 'width: 100%', :class => current_editor('simple')) %> |
21 | 20 | ||
22 | <h2><%= c_('Fields') %></h2> | 21 | <h2><%= c_('Fields') %></h2> |
23 | 22 |
plugins/delivery/views/delivery_plugin/admin_method/_edit.html.slim
@@ -12,7 +12,7 @@ | @@ -12,7 +12,7 @@ | ||
12 | = labelled_field f, :name, t('delivery_plugin.models.method.name'), f.text_field(:name), | 12 | = labelled_field f, :name, t('delivery_plugin.models.method.name'), f.text_field(:name), |
13 | help: t('delivery_plugin.models.method.name_help') | 13 | help: t('delivery_plugin.models.method.name_help') |
14 | = labelled_field f, :description, t('delivery_plugin.models.method.instructions'), | 14 | = labelled_field f, :description, t('delivery_plugin.models.method.instructions'), |
15 | - f.text_area(:description, rows: 5, class: 'mceEditor'), help: t('delivery_plugin.models.method.instructions_help') | 15 | + f.text_area(:description, rows: 5, class: current_editor('simple')), help: t('delivery_plugin.models.method.instructions_help') |
16 | 16 | ||
17 | fieldset | 17 | fieldset |
18 | legend= t'delivery_plugin.models.method.costs_legend' | 18 | legend= t'delivery_plugin.models.method.costs_legend' |
@@ -34,5 +34,3 @@ | @@ -34,5 +34,3 @@ | ||
34 | = submit_button :save, if delivery_method.new_record? then t('delivery_plugin.views.method.edit.add') else t('delivery_plugin.views.method.edit.save') end | 34 | = submit_button :save, if delivery_method.new_record? then t('delivery_plugin.views.method.edit.add') else t('delivery_plugin.views.method.edit.save') end |
35 | = link_to_function t('delivery_plugin.views.method.edit.back'), "delivery.method.view.toggle()" | 35 | = link_to_function t('delivery_plugin.views.method.edit.back'), "delivery.method.view.toggle()" |
36 | 36 | ||
37 | -= render file: 'shared/tiny_mce', locals: {mode: 'simple'} | ||
38 | - |
plugins/display_content/lib/display_content_block.rb
@@ -24,7 +24,7 @@ class DisplayContentBlock < Block | @@ -24,7 +24,7 @@ class DisplayContentBlock < Block | ||
24 | {:value => 'title', :checked => true}, | 24 | {:value => 'title', :checked => true}, |
25 | {:value => 'abstract', :checked => true}] | 25 | {:value => 'abstract', :checked => true}] |
26 | settings_items :display_folder_children, :type => :boolean, :default => true | 26 | settings_items :display_folder_children, :type => :boolean, :default => true |
27 | - settings_items :types, :type => Array, :default => ['TextileArticle', 'TinyMceArticle', 'RawHTMLArticle'] | 27 | + settings_items :types, :type => Array, :default => ['TextArticle'] |
28 | settings_items :order_by_recent, :type => :boolean, :default => :true | 28 | settings_items :order_by_recent, :type => :boolean, :default => :true |
29 | settings_items :content_with_translations, :type => :boolean, :default => :true | 29 | settings_items :content_with_translations, :type => :boolean, :default => :true |
30 | settings_items :limit_to_show, :type => :integer, :default => 6 | 30 | settings_items :limit_to_show, :type => :integer, :default => 6 |
@@ -61,7 +61,7 @@ class DisplayContentBlock < Block | @@ -61,7 +61,7 @@ class DisplayContentBlock < Block | ||
61 | end | 61 | end |
62 | 62 | ||
63 | def available_content_types | 63 | def available_content_types |
64 | - @available_content_types ||= [TinyMceArticle, RawHTMLArticle, TextileArticle, UploadedFile, Event, Folder, Blog, Forum, Gallery, RssFeed] + plugins.dispatch(:content_types) | 64 | + @available_content_types ||= [TextArticle, UploadedFile, Event, Folder, Blog, Forum, Gallery, RssFeed] + plugins.dispatch(:content_types) |
65 | checked_types = types.map {|t| t.constantize} | 65 | checked_types = types.map {|t| t.constantize} |
66 | checked_types + (@available_content_types - checked_types) | 66 | checked_types + (@available_content_types - checked_types) |
67 | end | 67 | end |
@@ -108,7 +108,7 @@ class DisplayContentBlock < Block | @@ -108,7 +108,7 @@ class DisplayContentBlock < Block | ||
108 | @parent_nodes ||= self.holder.articles.where(:id => nodes).map { |article| get_parent(article) }.compact.flatten | 108 | @parent_nodes ||= self.holder.articles.where(:id => nodes).map { |article| get_parent(article) }.compact.flatten |
109 | end | 109 | end |
110 | 110 | ||
111 | - VALID_CONTENT = ['RawHTMLArticle', 'TextArticle', 'TextileArticle', 'TinyMceArticle', 'Folder', 'Blog', 'Forum'] | 111 | + VALID_CONTENT = ['TextArticle', 'Folder', 'Blog', 'Forum'] |
112 | 112 | ||
113 | include Noosfero::Plugin::HotSpot | 113 | include Noosfero::Plugin::HotSpot |
114 | 114 |
plugins/display_content/test/functional/display_content_plugin_admin_controller_test.rb
@@ -39,7 +39,7 @@ class DisplayContentPluginAdminControllerTest < ActionController::TestCase | @@ -39,7 +39,7 @@ class DisplayContentPluginAdminControllerTest < ActionController::TestCase | ||
39 | 39 | ||
40 | should 'index action returns an json with node content' do | 40 | should 'index action returns an json with node content' do |
41 | Article.delete_all | 41 | Article.delete_all |
42 | - article = fast_create(TextileArticle, :name => 'test article 1', :profile_id => environment.portal_community.id) | 42 | + article = fast_create(TextArticle, :name => 'test article 1', :profile_id => environment.portal_community.id) |
43 | 43 | ||
44 | get :index, :block_id => block.id | 44 | get :index, :block_id => block.id |
45 | json_response = ActiveSupport::JSON.decode(@response.body) | 45 | json_response = ActiveSupport::JSON.decode(@response.body) |
@@ -51,7 +51,7 @@ class DisplayContentPluginAdminControllerTest < ActionController::TestCase | @@ -51,7 +51,7 @@ class DisplayContentPluginAdminControllerTest < ActionController::TestCase | ||
51 | 51 | ||
52 | should 'index action returns an json with node checked if the node is in the nodes list' do | 52 | should 'index action returns an json with node checked if the node is in the nodes list' do |
53 | Article.delete_all | 53 | Article.delete_all |
54 | - article = fast_create(TextileArticle, :name => 'test article 1', :profile_id => environment.portal_community.id) | 54 | + article = fast_create(TextArticle, :name => 'test article 1', :profile_id => environment.portal_community.id) |
55 | block.nodes= [article.id] | 55 | block.nodes= [article.id] |
56 | block.save! | 56 | block.save! |
57 | 57 | ||
@@ -67,8 +67,8 @@ class DisplayContentPluginAdminControllerTest < ActionController::TestCase | @@ -67,8 +67,8 @@ class DisplayContentPluginAdminControllerTest < ActionController::TestCase | ||
67 | should 'index action returns an json with node undetermined if the node is in the parent nodes list' do | 67 | should 'index action returns an json with node undetermined if the node is in the parent nodes list' do |
68 | Article.delete_all | 68 | Article.delete_all |
69 | f = fast_create(Folder, :name => 'test folder 1', :profile_id => environment.portal_community.id) | 69 | f = fast_create(Folder, :name => 'test folder 1', :profile_id => environment.portal_community.id) |
70 | - article = fast_create(TextileArticle, :name => 'test article 1', :profile_id => environment.portal_community.id, :parent_id => f.id) | ||
71 | - article2 = fast_create(TextileArticle, :name => 'test article 2', :profile_id => environment.portal_community.id, :parent_id => f.id) | 70 | + article = fast_create(TextArticle, :name => 'test article 1', :profile_id => environment.portal_community.id, :parent_id => f.id) |
71 | + article2 = fast_create(TextArticle, :name => 'test article 2', :profile_id => environment.portal_community.id, :parent_id => f.id) | ||
72 | block.nodes = [article.id] | 72 | block.nodes = [article.id] |
73 | block.save! | 73 | block.save! |
74 | 74 | ||
@@ -81,7 +81,7 @@ class DisplayContentPluginAdminControllerTest < ActionController::TestCase | @@ -81,7 +81,7 @@ class DisplayContentPluginAdminControllerTest < ActionController::TestCase | ||
81 | should 'index action returns an json with node closed if the node has article with children' do | 81 | should 'index action returns an json with node closed if the node has article with children' do |
82 | Article.delete_all | 82 | Article.delete_all |
83 | f = fast_create(Folder, :name => 'test folder 1', :profile_id => environment.portal_community.id) | 83 | f = fast_create(Folder, :name => 'test folder 1', :profile_id => environment.portal_community.id) |
84 | - article = fast_create(TextileArticle, :name => 'test article 1', :profile_id => environment.portal_community.id, :parent_id => f.id) | 84 | + article = fast_create(TextArticle, :name => 'test article 1', :profile_id => environment.portal_community.id, :parent_id => f.id) |
85 | 85 | ||
86 | get :index, :block_id => block.id | 86 | get :index, :block_id => block.id |
87 | json_response = ActiveSupport::JSON.decode(@response.body) | 87 | json_response = ActiveSupport::JSON.decode(@response.body) |
@@ -95,8 +95,8 @@ class DisplayContentPluginAdminControllerTest < ActionController::TestCase | @@ -95,8 +95,8 @@ class DisplayContentPluginAdminControllerTest < ActionController::TestCase | ||
95 | should 'index action returns an json with all the children nodes if some parent is in the parents list' do | 95 | should 'index action returns an json with all the children nodes if some parent is in the parents list' do |
96 | Article.delete_all | 96 | Article.delete_all |
97 | f = fast_create(Folder, :name => 'test folder 1', :profile_id => environment.portal_community.id) | 97 | f = fast_create(Folder, :name => 'test folder 1', :profile_id => environment.portal_community.id) |
98 | - a1 = fast_create(TextileArticle, :name => 'test article 1', :profile_id => environment.portal_community.id, :parent_id => f.id) | ||
99 | - a2 = fast_create(TextileArticle, :name => 'test article 2', :profile_id => environment.portal_community.id, :parent_id => f.id) | 98 | + a1 = fast_create(TextArticle, :name => 'test article 1', :profile_id => environment.portal_community.id, :parent_id => f.id) |
99 | + a2 = fast_create(TextArticle, :name => 'test article 2', :profile_id => environment.portal_community.id, :parent_id => f.id) | ||
100 | block.checked_nodes= {a1.id => true} | 100 | block.checked_nodes= {a1.id => true} |
101 | block.save! | 101 | block.save! |
102 | 102 | ||
@@ -118,9 +118,9 @@ class DisplayContentPluginAdminControllerTest < ActionController::TestCase | @@ -118,9 +118,9 @@ class DisplayContentPluginAdminControllerTest < ActionController::TestCase | ||
118 | should 'index action returns an json with all the children nodes and root nodes if some parent is in the parents list and there is others root articles' do | 118 | should 'index action returns an json with all the children nodes and root nodes if some parent is in the parents list and there is others root articles' do |
119 | Article.delete_all | 119 | Article.delete_all |
120 | f = fast_create(Folder, :name => 'test folder 1', :profile_id => environment.portal_community.id) | 120 | f = fast_create(Folder, :name => 'test folder 1', :profile_id => environment.portal_community.id) |
121 | - a1 = fast_create(TextileArticle, :name => 'test article 1', :profile_id => environment.portal_community.id, :parent_id => f.id) | ||
122 | - a2 = fast_create(TextileArticle, :name => 'test article 2', :profile_id => environment.portal_community.id, :parent_id => f.id) | ||
123 | - a3 = fast_create(TextileArticle, :name => 'test article 3', :profile_id => environment.portal_community.id) | 121 | + a1 = fast_create(TextArticle, :name => 'test article 1', :profile_id => environment.portal_community.id, :parent_id => f.id) |
122 | + a2 = fast_create(TextArticle, :name => 'test article 2', :profile_id => environment.portal_community.id, :parent_id => f.id) | ||
123 | + a3 = fast_create(TextArticle, :name => 'test article 3', :profile_id => environment.portal_community.id) | ||
124 | block.checked_nodes= {a2.id => true, a3.id => true} | 124 | block.checked_nodes= {a2.id => true, a3.id => true} |
125 | block.save! | 125 | block.save! |
126 | 126 | ||
@@ -148,9 +148,9 @@ class DisplayContentPluginAdminControllerTest < ActionController::TestCase | @@ -148,9 +148,9 @@ class DisplayContentPluginAdminControllerTest < ActionController::TestCase | ||
148 | should 'index action returns an json without children nodes if the parent is not in the parents list' do | 148 | should 'index action returns an json without children nodes if the parent is not in the parents list' do |
149 | Article.delete_all | 149 | Article.delete_all |
150 | f = fast_create(Folder, :name => 'test folder 1', :profile_id => environment.portal_community.id) | 150 | f = fast_create(Folder, :name => 'test folder 1', :profile_id => environment.portal_community.id) |
151 | - a1 = fast_create(TextileArticle, :name => 'test article 1', :profile_id => environment.portal_community.id, :parent_id => f.id) | ||
152 | - a2 = fast_create(TextileArticle, :name => 'test article 2', :profile_id => environment.portal_community.id, :parent_id => f.id) | ||
153 | - a3 = fast_create(TextileArticle, :name => 'test article 3', :profile_id => environment.portal_community.id) | 151 | + a1 = fast_create(TextArticle, :name => 'test article 1', :profile_id => environment.portal_community.id, :parent_id => f.id) |
152 | + a2 = fast_create(TextArticle, :name => 'test article 2', :profile_id => environment.portal_community.id, :parent_id => f.id) | ||
153 | + a3 = fast_create(TextArticle, :name => 'test article 3', :profile_id => environment.portal_community.id) | ||
154 | 154 | ||
155 | get :index, :block_id => block.id | 155 | get :index, :block_id => block.id |
156 | json_response = ActiveSupport::JSON.decode(@response.body) | 156 | json_response = ActiveSupport::JSON.decode(@response.body) |
plugins/display_content/test/functional/display_content_plugin_myprofile_controller_test.rb
@@ -40,7 +40,7 @@ class DisplayContentPluginMyprofileControllerTest < ActionController::TestCase | @@ -40,7 +40,7 @@ class DisplayContentPluginMyprofileControllerTest < ActionController::TestCase | ||
40 | 40 | ||
41 | should 'index action returns an json with node content' do | 41 | should 'index action returns an json with node content' do |
42 | Article.delete_all | 42 | Article.delete_all |
43 | - article = fast_create(TextileArticle, :name => 'test article 1', :profile_id => profile.id) | 43 | + article = fast_create(TextArticle, :name => 'test article 1', :profile_id => profile.id) |
44 | 44 | ||
45 | get :index, :block_id => block.id, :profile => profile.identifier | 45 | get :index, :block_id => block.id, :profile => profile.identifier |
46 | json_response = ActiveSupport::JSON.decode(@response.body) | 46 | json_response = ActiveSupport::JSON.decode(@response.body) |
@@ -52,7 +52,7 @@ class DisplayContentPluginMyprofileControllerTest < ActionController::TestCase | @@ -52,7 +52,7 @@ class DisplayContentPluginMyprofileControllerTest < ActionController::TestCase | ||
52 | 52 | ||
53 | should 'index action returns an json with node checked if the node is in the nodes list' do | 53 | should 'index action returns an json with node checked if the node is in the nodes list' do |
54 | Article.delete_all | 54 | Article.delete_all |
55 | - article = fast_create(TextileArticle, :name => 'test article 1', :profile_id => profile.id) | 55 | + article = fast_create(TextArticle, :name => 'test article 1', :profile_id => profile.id) |
56 | block.nodes= [article.id] | 56 | block.nodes= [article.id] |
57 | block.save! | 57 | block.save! |
58 | 58 | ||
@@ -68,8 +68,8 @@ class DisplayContentPluginMyprofileControllerTest < ActionController::TestCase | @@ -68,8 +68,8 @@ class DisplayContentPluginMyprofileControllerTest < ActionController::TestCase | ||
68 | should 'index action returns an json with node undetermined if the node is in the parent nodes list' do | 68 | should 'index action returns an json with node undetermined if the node is in the parent nodes list' do |
69 | Article.delete_all | 69 | Article.delete_all |
70 | f = fast_create(Folder, :name => 'test folder 1', :profile_id => profile.id) | 70 | f = fast_create(Folder, :name => 'test folder 1', :profile_id => profile.id) |
71 | - article = fast_create(TextileArticle, :name => 'test article 1', :profile_id => profile.id, :parent_id => f.id) | ||
72 | - article2 = fast_create(TextileArticle, :name => 'test article 2', :profile_id => profile.id, :parent_id => f.id) | 71 | + article = fast_create(TextArticle, :name => 'test article 1', :profile_id => profile.id, :parent_id => f.id) |
72 | + article2 = fast_create(TextArticle, :name => 'test article 2', :profile_id => profile.id, :parent_id => f.id) | ||
73 | block.nodes = [article.id] | 73 | block.nodes = [article.id] |
74 | block.save! | 74 | block.save! |
75 | 75 | ||
@@ -82,7 +82,7 @@ class DisplayContentPluginMyprofileControllerTest < ActionController::TestCase | @@ -82,7 +82,7 @@ class DisplayContentPluginMyprofileControllerTest < ActionController::TestCase | ||
82 | should 'index action returns an json with node closed if the node has article with children' do | 82 | should 'index action returns an json with node closed if the node has article with children' do |
83 | Article.delete_all | 83 | Article.delete_all |
84 | f = fast_create(Folder, :name => 'test folder 1', :profile_id => profile.id) | 84 | f = fast_create(Folder, :name => 'test folder 1', :profile_id => profile.id) |
85 | - article = fast_create(TextileArticle, :name => 'test article 1', :profile_id => profile.id, :parent_id => f.id) | 85 | + article = fast_create(TextArticle, :name => 'test article 1', :profile_id => profile.id, :parent_id => f.id) |
86 | block.save! | 86 | block.save! |
87 | 87 | ||
88 | get :index, :block_id => block.id, :profile => profile.identifier | 88 | get :index, :block_id => block.id, :profile => profile.identifier |
@@ -97,8 +97,8 @@ class DisplayContentPluginMyprofileControllerTest < ActionController::TestCase | @@ -97,8 +97,8 @@ class DisplayContentPluginMyprofileControllerTest < ActionController::TestCase | ||
97 | should 'index action returns an json with all the children nodes if some parent is in the parents list' do | 97 | should 'index action returns an json with all the children nodes if some parent is in the parents list' do |
98 | Article.delete_all | 98 | Article.delete_all |
99 | f = fast_create(Folder, :name => 'test folder 1', :profile_id => profile.id) | 99 | f = fast_create(Folder, :name => 'test folder 1', :profile_id => profile.id) |
100 | - a1 = fast_create(TextileArticle, :name => 'test article 1', :profile_id => profile.id, :parent_id => f.id) | ||
101 | - a2 = fast_create(TextileArticle, :name => 'test article 2', :profile_id => profile.id, :parent_id => f.id) | 100 | + a1 = fast_create(TextArticle, :name => 'test article 1', :profile_id => profile.id, :parent_id => f.id) |
101 | + a2 = fast_create(TextArticle, :name => 'test article 2', :profile_id => profile.id, :parent_id => f.id) | ||
102 | block.checked_nodes = {a1.id => true} | 102 | block.checked_nodes = {a1.id => true} |
103 | block.save! | 103 | block.save! |
104 | 104 | ||
@@ -120,9 +120,9 @@ class DisplayContentPluginMyprofileControllerTest < ActionController::TestCase | @@ -120,9 +120,9 @@ class DisplayContentPluginMyprofileControllerTest < ActionController::TestCase | ||
120 | should 'index action returns an json with all the children nodes and root nodes if some parent is in the parents list and there is others root articles' do | 120 | should 'index action returns an json with all the children nodes and root nodes if some parent is in the parents list and there is others root articles' do |
121 | Article.delete_all | 121 | Article.delete_all |
122 | f = fast_create(Folder, :name => 'test folder 1', :profile_id => profile.id) | 122 | f = fast_create(Folder, :name => 'test folder 1', :profile_id => profile.id) |
123 | - a1 = fast_create(TextileArticle, :name => 'test article 1', :profile_id => profile.id, :parent_id => f.id) | ||
124 | - a2 = fast_create(TextileArticle, :name => 'test article 2', :profile_id => profile.id, :parent_id => f.id) | ||
125 | - a3 = fast_create(TextileArticle, :name => 'test article 3', :profile_id => profile.id) | 123 | + a1 = fast_create(TextArticle, :name => 'test article 1', :profile_id => profile.id, :parent_id => f.id) |
124 | + a2 = fast_create(TextArticle, :name => 'test article 2', :profile_id => profile.id, :parent_id => f.id) | ||
125 | + a3 = fast_create(TextArticle, :name => 'test article 3', :profile_id => profile.id) | ||
126 | block.checked_nodes = {a1.id => true} | 126 | block.checked_nodes = {a1.id => true} |
127 | block.save! | 127 | block.save! |
128 | 128 | ||
@@ -150,9 +150,9 @@ class DisplayContentPluginMyprofileControllerTest < ActionController::TestCase | @@ -150,9 +150,9 @@ class DisplayContentPluginMyprofileControllerTest < ActionController::TestCase | ||
150 | should 'index action returns an json without children nodes if the parent is not in the parents list' do | 150 | should 'index action returns an json without children nodes if the parent is not in the parents list' do |
151 | Article.delete_all | 151 | Article.delete_all |
152 | f = fast_create(Folder, :name => 'test folder 1', :profile_id => profile.id) | 152 | f = fast_create(Folder, :name => 'test folder 1', :profile_id => profile.id) |
153 | - a1 = fast_create(TextileArticle, :name => 'test article 1', :profile_id => profile.id, :parent_id => f.id) | ||
154 | - a2 = fast_create(TextileArticle, :name => 'test article 2', :profile_id => profile.id, :parent_id => f.id) | ||
155 | - a3 = fast_create(TextileArticle, :name => 'test article 3', :profile_id => profile.id) | 153 | + a1 = fast_create(TextArticle, :name => 'test article 1', :profile_id => profile.id, :parent_id => f.id) |
154 | + a2 = fast_create(TextArticle, :name => 'test article 2', :profile_id => profile.id, :parent_id => f.id) | ||
155 | + a3 = fast_create(TextArticle, :name => 'test article 3', :profile_id => profile.id) | ||
156 | 156 | ||
157 | get :index, :block_id => block.id, :profile => profile.identifier | 157 | get :index, :block_id => block.id, :profile => profile.identifier |
158 | json_response = ActiveSupport::JSON.decode(@response.body) | 158 | json_response = ActiveSupport::JSON.decode(@response.body) |
plugins/display_content/test/unit/display_content_block_test.rb
@@ -2,7 +2,7 @@ require_relative '../test_helper' | @@ -2,7 +2,7 @@ require_relative '../test_helper' | ||
2 | class DisplayContentBlockTest < ActiveSupport::TestCase | 2 | class DisplayContentBlockTest < ActiveSupport::TestCase |
3 | 3 | ||
4 | INVALID_KIND_OF_ARTICLE = [Event, RssFeed, UploadedFile, Gallery] | 4 | INVALID_KIND_OF_ARTICLE = [Event, RssFeed, UploadedFile, Gallery] |
5 | - VALID_KIND_OF_ARTICLE = [RawHTMLArticle, TextArticle, TextileArticle, TinyMceArticle, Folder, Blog, Forum] | 5 | + VALID_KIND_OF_ARTICLE = [TextArticle, Folder, Blog, Forum] |
6 | 6 | ||
7 | should 'describe itself' do | 7 | should 'describe itself' do |
8 | assert_not_equal Block.description, DisplayContentBlock.description | 8 | assert_not_equal Block.description, DisplayContentBlock.description |
@@ -39,9 +39,9 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | @@ -39,9 +39,9 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | ||
39 | should 'nodes be the article ids in hash of checked nodes' do | 39 | should 'nodes be the article ids in hash of checked nodes' do |
40 | profile = create_user('testuser').person | 40 | profile = create_user('testuser').person |
41 | Article.delete_all | 41 | Article.delete_all |
42 | - a1 = fast_create(TextileArticle, :name => 'test article 1', :profile_id => profile.id) | ||
43 | - a2 = fast_create(TextileArticle, :name => 'test article 2', :profile_id => profile.id) | ||
44 | - a3 = fast_create(TextileArticle, :name => 'test article 3', :profile_id => profile.id) | 42 | + a1 = fast_create(TextArticle, :name => 'test article 1', :profile_id => profile.id) |
43 | + a2 = fast_create(TextArticle, :name => 'test article 2', :profile_id => profile.id) | ||
44 | + a3 = fast_create(TextArticle, :name => 'test article 3', :profile_id => profile.id) | ||
45 | 45 | ||
46 | checked_articles= {a1.id => true, a2.id => true, a3.id => false} | 46 | checked_articles= {a1.id => true, a2.id => true, a3.id => false} |
47 | block = DisplayContentBlock.new | 47 | block = DisplayContentBlock.new |
@@ -54,9 +54,9 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | @@ -54,9 +54,9 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | ||
54 | should 'nodes be save in database' do | 54 | should 'nodes be save in database' do |
55 | profile = create_user('testuser').person | 55 | profile = create_user('testuser').person |
56 | Article.delete_all | 56 | Article.delete_all |
57 | - a1 = fast_create(TextileArticle, :name => 'test article 1', :profile_id => profile.id) | ||
58 | - a2 = fast_create(TextileArticle, :name => 'test article 2', :profile_id => profile.id) | ||
59 | - a3 = fast_create(TextileArticle, :name => 'test article 3', :profile_id => profile.id) | 57 | + a1 = fast_create(TextArticle, :name => 'test article 1', :profile_id => profile.id) |
58 | + a2 = fast_create(TextArticle, :name => 'test article 2', :profile_id => profile.id) | ||
59 | + a3 = fast_create(TextArticle, :name => 'test article 3', :profile_id => profile.id) | ||
60 | 60 | ||
61 | checked_articles= {a1.id => true, a2.id => true, a3.id => false} | 61 | checked_articles= {a1.id => true, a2.id => true, a3.id => false} |
62 | block = DisplayContentBlock.new | 62 | block = DisplayContentBlock.new |
@@ -71,10 +71,10 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | @@ -71,10 +71,10 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | ||
71 | should 'be able to update nodes' do | 71 | should 'be able to update nodes' do |
72 | profile = create_user('testuser').person | 72 | profile = create_user('testuser').person |
73 | Article.delete_all | 73 | Article.delete_all |
74 | - a1 = fast_create(TextileArticle, :name => 'test article 1', :profile_id => profile.id) | ||
75 | - a2 = fast_create(TextileArticle, :name => 'test article 2', :profile_id => profile.id) | ||
76 | - a3 = fast_create(TextileArticle, :name => 'test article 3', :profile_id => profile.id) | ||
77 | - a4 = fast_create(TextileArticle, :name => 'test article 4', :profile_id => profile.id) | 74 | + a1 = fast_create(TextArticle, :name => 'test article 1', :profile_id => profile.id) |
75 | + a2 = fast_create(TextArticle, :name => 'test article 2', :profile_id => profile.id) | ||
76 | + a3 = fast_create(TextArticle, :name => 'test article 3', :profile_id => profile.id) | ||
77 | + a4 = fast_create(TextArticle, :name => 'test article 4', :profile_id => profile.id) | ||
78 | 78 | ||
79 | checked_articles= {a1.id => true, a2.id => true, a3.id => false} | 79 | checked_articles= {a1.id => true, a2.id => true, a3.id => false} |
80 | block = DisplayContentBlock.new | 80 | block = DisplayContentBlock.new |
@@ -95,13 +95,13 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | @@ -95,13 +95,13 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | ||
95 | should "save selected folders and articles" do | 95 | should "save selected folders and articles" do |
96 | profile = create_user('testuser').person | 96 | profile = create_user('testuser').person |
97 | Article.delete_all | 97 | Article.delete_all |
98 | - a1 = fast_create(TextileArticle, :name => 'test article 1', :profile_id => profile.id) | ||
99 | - a2 = fast_create(TextileArticle, :name => 'test article 2', :profile_id => profile.id) | 98 | + a1 = fast_create(TextArticle, :name => 'test article 1', :profile_id => profile.id) |
99 | + a2 = fast_create(TextArticle, :name => 'test article 2', :profile_id => profile.id) | ||
100 | f1 = fast_create(Folder, :name => 'test folder 1', :profile_id => profile.id) | 100 | f1 = fast_create(Folder, :name => 'test folder 1', :profile_id => profile.id) |
101 | - a3 = fast_create(TextileArticle, :name => 'test article 3', :profile_id => profile.id, :parent_id => f1.id) | 101 | + a3 = fast_create(TextArticle, :name => 'test article 3', :profile_id => profile.id, :parent_id => f1.id) |
102 | f2 = fast_create(Folder, :name => 'test folder 1', :profile_id => profile.id, :parent_id => f1.id) | 102 | f2 = fast_create(Folder, :name => 'test folder 1', :profile_id => profile.id, :parent_id => f1.id) |
103 | - a4 = fast_create(TextileArticle, :name => 'test article 4', :profile_id => profile.id, :parent_id => f2.id) | ||
104 | - a5 = fast_create(TextileArticle, :name => 'test article 5', :profile_id => profile.id, :parent_id => f2.id) | 103 | + a4 = fast_create(TextArticle, :name => 'test article 4', :profile_id => profile.id, :parent_id => f2.id) |
104 | + a5 = fast_create(TextArticle, :name => 'test article 5', :profile_id => profile.id, :parent_id => f2.id) | ||
105 | 105 | ||
106 | checked_articles= {a1.id => true, a2.id => true, f1.id => false} | 106 | checked_articles= {a1.id => true, a2.id => true, f1.id => false} |
107 | 107 | ||
@@ -115,13 +115,13 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | @@ -115,13 +115,13 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | ||
115 | should "save selected articles and blogs" do | 115 | should "save selected articles and blogs" do |
116 | profile = create_user('testuser').person | 116 | profile = create_user('testuser').person |
117 | Article.delete_all | 117 | Article.delete_all |
118 | - a1 = fast_create(TextileArticle, :name => 'test article 1', :profile_id => profile.id) | ||
119 | - a2 = fast_create(TextileArticle, :name => 'test article 2', :profile_id => profile.id) | 118 | + a1 = fast_create(TextArticle, :name => 'test article 1', :profile_id => profile.id) |
119 | + a2 = fast_create(TextArticle, :name => 'test article 2', :profile_id => profile.id) | ||
120 | b1 = fast_create(Blog, :name => 'test blog 1', :profile_id => profile.id) | 120 | b1 = fast_create(Blog, :name => 'test blog 1', :profile_id => profile.id) |
121 | - a3 = fast_create(TextileArticle, :name => 'test article 3', :profile_id => profile.id, :parent_id => b1.id) | 121 | + a3 = fast_create(TextArticle, :name => 'test article 3', :profile_id => profile.id, :parent_id => b1.id) |
122 | b2 = fast_create(Blog, :name => 'test blog 2', :profile_id => profile.id) | 122 | b2 = fast_create(Blog, :name => 'test blog 2', :profile_id => profile.id) |
123 | - a4 = fast_create(TextileArticle, :name => 'test article 4', :profile_id => profile.id, :parent_id => b2.id) | ||
124 | - a5 = fast_create(TextileArticle, :name => 'test article 5', :profile_id => profile.id, :parent_id => b2.id) | 123 | + a4 = fast_create(TextArticle, :name => 'test article 4', :profile_id => profile.id, :parent_id => b2.id) |
124 | + a5 = fast_create(TextArticle, :name => 'test article 5', :profile_id => profile.id, :parent_id => b2.id) | ||
125 | 125 | ||
126 | checked_articles= {a1.id => true, a2.id => true, b1.id => false, b2.id => true} | 126 | checked_articles= {a1.id => true, a2.id => true, b1.id => false, b2.id => true} |
127 | 127 | ||
@@ -132,36 +132,10 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | @@ -132,36 +132,10 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | ||
132 | assert_equivalent [a1.id, a2.id, b1.id, b2.id], block.nodes | 132 | assert_equivalent [a1.id, a2.id, b1.id, b2.id], block.nodes |
133 | end | 133 | end |
134 | 134 | ||
135 | - should 'TextileArticle be saved as node' do | 135 | + should 'TextArticle be saved as node' do |
136 | profile = create_user('testuser').person | 136 | profile = create_user('testuser').person |
137 | Article.delete_all | 137 | Article.delete_all |
138 | - a1 = fast_create(TextileArticle, :name => 'test article 1', :profile_id => profile.id) | ||
139 | - | ||
140 | - checked_articles= {a1.id => true} | ||
141 | - block = DisplayContentBlock.new | ||
142 | - block.stubs(:holder).returns(profile) | ||
143 | - block.checked_nodes= checked_articles | ||
144 | - assert_equal [], [a1.id] - block.nodes | ||
145 | - assert_equal [], block.nodes - [a1.id] | ||
146 | - end | ||
147 | - | ||
148 | - should 'TinyMceArticle be saved as node' do | ||
149 | - profile = create_user('testuser').person | ||
150 | - Article.delete_all | ||
151 | - a1 = fast_create(TinyMceArticle, :name => 'test article 1', :profile_id => profile.id) | ||
152 | - | ||
153 | - checked_articles= {a1.id => true} | ||
154 | - block = DisplayContentBlock.new | ||
155 | - block.stubs(:holder).returns(profile) | ||
156 | - block.checked_nodes= checked_articles | ||
157 | - assert_equal [], [a1.id] - block.nodes | ||
158 | - assert_equal [], block.nodes - [a1.id] | ||
159 | - end | ||
160 | - | ||
161 | - should 'RawHTMLArticle be saved as node' do | ||
162 | - profile = create_user('testuser').person | ||
163 | - Article.delete_all | ||
164 | - a1 = fast_create(RawHTMLArticle, :name => 'test article 1', :profile_id => profile.id) | 138 | + a1 = fast_create(TextArticle, :name => 'test article 1', :profile_id => profile.id) |
165 | 139 | ||
166 | checked_articles= {a1.id => true} | 140 | checked_articles= {a1.id => true} |
167 | block = DisplayContentBlock.new | 141 | block = DisplayContentBlock.new |
@@ -230,9 +204,9 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | @@ -230,9 +204,9 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | ||
230 | should "return all root articles from profile" do | 204 | should "return all root articles from profile" do |
231 | profile = create_user('testuser').person | 205 | profile = create_user('testuser').person |
232 | Article.delete_all | 206 | Article.delete_all |
233 | - a1 = fast_create(TextileArticle, :name => 'test article 1', :profile_id => profile.id) | ||
234 | - a2 = fast_create(TextileArticle, :name => 'test article 2', :profile_id => profile.id) | ||
235 | - a3 = fast_create(TextileArticle, :name => 'test article 3', :profile_id => profile.id, :parent_id => a2.id) | 207 | + a1 = fast_create(TextArticle, :name => 'test article 1', :profile_id => profile.id) |
208 | + a2 = fast_create(TextArticle, :name => 'test article 2', :profile_id => profile.id) | ||
209 | + a3 = fast_create(TextArticle, :name => 'test article 3', :profile_id => profile.id, :parent_id => a2.id) | ||
236 | 210 | ||
237 | block = DisplayContentBlock.new | 211 | block = DisplayContentBlock.new |
238 | block.nodes= [a1.id, a2.id, a3.id] | 212 | block.nodes= [a1.id, a2.id, a3.id] |
@@ -247,9 +221,9 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | @@ -247,9 +221,9 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | ||
247 | should "return all children of an articles's profile" do | 221 | should "return all children of an articles's profile" do |
248 | profile = create_user('testuser').person | 222 | profile = create_user('testuser').person |
249 | Article.delete_all | 223 | Article.delete_all |
250 | - a1 = fast_create(TextileArticle, :name => 'test article 1', :profile_id => profile.id) | ||
251 | - a2 = fast_create(TextileArticle, :name => 'test article 2', :profile_id => profile.id) | ||
252 | - a3 = fast_create(TextileArticle, :name => 'test article 3', :profile_id => profile.id, :parent_id => a2.id) | 224 | + a1 = fast_create(TextArticle, :name => 'test article 1', :profile_id => profile.id) |
225 | + a2 = fast_create(TextArticle, :name => 'test article 2', :profile_id => profile.id) | ||
226 | + a3 = fast_create(TextArticle, :name => 'test article 3', :profile_id => profile.id, :parent_id => a2.id) | ||
253 | 227 | ||
254 | block = DisplayContentBlock.new | 228 | block = DisplayContentBlock.new |
255 | box = mock() | 229 | box = mock() |
@@ -264,9 +238,9 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | @@ -264,9 +238,9 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | ||
264 | profile = fast_create(Community, :name => 'my test community', :identifier => 'mytestcommunity') | 238 | profile = fast_create(Community, :name => 'my test community', :identifier => 'mytestcommunity') |
265 | environment = Environment.default | 239 | environment = Environment.default |
266 | Article.delete_all | 240 | Article.delete_all |
267 | - a1 = fast_create(TextileArticle, :name => 'test article 1', :profile_id => profile.id) | ||
268 | - a2 = fast_create(TextileArticle, :name => 'test article 2', :profile_id => profile.id) | ||
269 | - a3 = fast_create(TextileArticle, :name => 'test article 3', :profile_id => profile.id, :parent_id => a2.id) | 241 | + a1 = fast_create(TextArticle, :name => 'test article 1', :profile_id => profile.id) |
242 | + a2 = fast_create(TextArticle, :name => 'test article 2', :profile_id => profile.id) | ||
243 | + a3 = fast_create(TextArticle, :name => 'test article 3', :profile_id => profile.id, :parent_id => a2.id) | ||
270 | 244 | ||
271 | block = DisplayContentBlock.new | 245 | block = DisplayContentBlock.new |
272 | box = mock() | 246 | box = mock() |
@@ -283,9 +257,9 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | @@ -283,9 +257,9 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | ||
283 | profile = fast_create(Community, :name => 'my test community', :identifier => 'mytestcommunity') | 257 | profile = fast_create(Community, :name => 'my test community', :identifier => 'mytestcommunity') |
284 | environment = Environment.default | 258 | environment = Environment.default |
285 | Article.delete_all | 259 | Article.delete_all |
286 | - a1 = fast_create(TextileArticle, :name => 'test article 1', :profile_id => profile.id) | ||
287 | - a2 = fast_create(TextileArticle, :name => 'test article 2', :profile_id => profile.id) | ||
288 | - a3 = fast_create(TextileArticle, :name => 'test article 3', :profile_id => profile.id, :parent_id => a2.id) | 260 | + a1 = fast_create(TextArticle, :name => 'test article 1', :profile_id => profile.id) |
261 | + a2 = fast_create(TextArticle, :name => 'test article 2', :profile_id => profile.id) | ||
262 | + a3 = fast_create(TextArticle, :name => 'test article 3', :profile_id => profile.id, :parent_id => a2.id) | ||
289 | 263 | ||
290 | block = DisplayContentBlock.new | 264 | block = DisplayContentBlock.new |
291 | box = mock() | 265 | box = mock() |
@@ -404,9 +378,9 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | @@ -404,9 +378,9 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | ||
404 | profile = create_user('testuser').person | 378 | profile = create_user('testuser').person |
405 | Article.delete_all | 379 | Article.delete_all |
406 | f1 = fast_create(Folder, :name => 'test folder 1', :profile_id => profile.id) | 380 | f1 = fast_create(Folder, :name => 'test folder 1', :profile_id => profile.id) |
407 | - a1 = fast_create(TextileArticle, :name => 'test article 1', :profile_id => profile.id, :parent_id => f1.id) | ||
408 | - a2 = fast_create(TextileArticle, :name => 'test article 2', :profile_id => profile.id, :parent_id => f1.id) | ||
409 | - a3 = fast_create(TextileArticle, :name => 'test article 3', :profile_id => profile.id, :parent_id => f1.id) | 381 | + a1 = fast_create(TextArticle, :name => 'test article 1', :profile_id => profile.id, :parent_id => f1.id) |
382 | + a2 = fast_create(TextArticle, :name => 'test article 2', :profile_id => profile.id, :parent_id => f1.id) | ||
383 | + a3 = fast_create(TextArticle, :name => 'test article 3', :profile_id => profile.id, :parent_id => f1.id) | ||
410 | 384 | ||
411 | checked_articles= {f1.id => true, a1.id => true, a2.id => true, a3.id => false} | 385 | checked_articles= {f1.id => true, a1.id => true, a2.id => true, a3.id => false} |
412 | block = DisplayContentBlock.new | 386 | block = DisplayContentBlock.new |
@@ -420,9 +394,9 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | @@ -420,9 +394,9 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | ||
420 | profile = create_user('testuser').person | 394 | profile = create_user('testuser').person |
421 | Article.delete_all | 395 | Article.delete_all |
422 | f1 = fast_create(Folder, :name => 'test folder 1', :profile_id => profile.id) | 396 | f1 = fast_create(Folder, :name => 'test folder 1', :profile_id => profile.id) |
423 | - a1 = fast_create(TextileArticle, :name => 'test article 1', :profile_id => profile.id, :parent_id => f1.id) | ||
424 | - a2 = fast_create(TextileArticle, :name => 'test article 2', :profile_id => profile.id, :parent_id => f1.id) | ||
425 | - a3 = fast_create(TextileArticle, :name => 'test article 3', :profile_id => profile.id, :parent_id => f1.id) | 397 | + a1 = fast_create(TextArticle, :name => 'test article 1', :profile_id => profile.id, :parent_id => f1.id) |
398 | + a2 = fast_create(TextArticle, :name => 'test article 2', :profile_id => profile.id, :parent_id => f1.id) | ||
399 | + a3 = fast_create(TextArticle, :name => 'test article 3', :profile_id => profile.id, :parent_id => f1.id) | ||
426 | 400 | ||
427 | checked_articles= {f1.id => true, a1.id => true, a2.id => true, a3.id => false} | 401 | checked_articles= {f1.id => true, a1.id => true, a2.id => true, a3.id => false} |
428 | block = DisplayContentBlock.new | 402 | block = DisplayContentBlock.new |
@@ -472,37 +446,37 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | @@ -472,37 +446,37 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | ||
472 | should 'return available content types with checked types first' do | 446 | should 'return available content types with checked types first' do |
473 | Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([]) | 447 | Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([]) |
474 | block = DisplayContentBlock.create! | 448 | block = DisplayContentBlock.create! |
475 | - block.types = ['TinyMceArticle'] | 449 | + block.types = ['TextArticle'] |
476 | 450 | ||
477 | - block.types = ['TinyMceArticle', 'Folder'] | ||
478 | - assert_equivalent [TinyMceArticle, Folder, UploadedFile, Event, TextileArticle, RawHTMLArticle, Blog, Forum, Gallery, RssFeed], block.available_content_types | 451 | + block.types = ['TextArticle', 'Folder'] |
452 | + assert_equivalent [TextArticle, Folder, UploadedFile, Event, Blog, Forum, Gallery, RssFeed], block.available_content_types | ||
479 | end | 453 | end |
480 | 454 | ||
481 | should 'return available content types' do | 455 | should 'return available content types' do |
482 | Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([]) | 456 | Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([]) |
483 | block = DisplayContentBlock.create! | 457 | block = DisplayContentBlock.create! |
484 | - block.types = ['TinyMceArticle'] | 458 | + block.types = ['TextArticle'] |
485 | block.types = [] | 459 | block.types = [] |
486 | - assert_equivalent [UploadedFile, Event, TinyMceArticle, TextileArticle, RawHTMLArticle, Folder, Blog, Forum, Gallery, RssFeed], block.available_content_types | 460 | + assert_equivalent [UploadedFile, Event, TextArticle, Folder, Blog, Forum, Gallery, RssFeed], block.available_content_types |
487 | end | 461 | end |
488 | 462 | ||
489 | should 'return first 2 content types' do | 463 | should 'return first 2 content types' do |
490 | Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([]) | 464 | Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([]) |
491 | block = DisplayContentBlock.create! | 465 | block = DisplayContentBlock.create! |
492 | - block.types = ['TinyMceArticle'] | 466 | + block.types = ['TextArticle'] |
493 | assert_equal 2, block.first_content_types.length | 467 | assert_equal 2, block.first_content_types.length |
494 | end | 468 | end |
495 | 469 | ||
496 | should 'return all but first 2 content types' do | 470 | should 'return all but first 2 content types' do |
497 | Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([]) | 471 | Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([]) |
498 | block = DisplayContentBlock.create! | 472 | block = DisplayContentBlock.create! |
499 | - block.types = ['TinyMceArticle'] | 473 | + block.types = ['TextArticle'] |
500 | assert_equal block.available_content_types.length - 2, block.more_content_types.length | 474 | assert_equal block.available_content_types.length - 2, block.more_content_types.length |
501 | end | 475 | end |
502 | 476 | ||
503 | should 'return 2 as default value for first_types_count' do | 477 | should 'return 2 as default value for first_types_count' do |
504 | block = DisplayContentBlock.create! | 478 | block = DisplayContentBlock.create! |
505 | - block.types = ['TinyMceArticle'] | 479 | + block.types = ['TextArticle'] |
506 | assert_equal 2, block.first_types_count | 480 | assert_equal 2, block.first_types_count |
507 | end | 481 | end |
508 | 482 | ||
@@ -527,14 +501,14 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | @@ -527,14 +501,14 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | ||
527 | Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([SomePlugin.new]) | 501 | Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([SomePlugin.new]) |
528 | 502 | ||
529 | block.types = [] | 503 | block.types = [] |
530 | - assert_equivalent [UploadedFile, Event, TinyMceArticle, TextileArticle, RawHTMLArticle, Folder, Blog, Forum, Gallery, RssFeed, SomePluginContent], block.available_content_types | 504 | + assert_equivalent [UploadedFile, Event, TextArticle, Folder, Blog, Forum, Gallery, RssFeed, SomePluginContent], block.available_content_types |
531 | end | 505 | end |
532 | 506 | ||
533 | should 'do not fail if a selected article was removed' do | 507 | should 'do not fail if a selected article was removed' do |
534 | profile = create_user('testuser').person | 508 | profile = create_user('testuser').person |
535 | Article.delete_all | 509 | Article.delete_all |
536 | f1 = fast_create(Folder, :name => 'test folder 1', :profile_id => profile.id) | 510 | f1 = fast_create(Folder, :name => 'test folder 1', :profile_id => profile.id) |
537 | - a1 = fast_create(TextileArticle, :name => 'test article 1', :profile_id => profile.id, :parent_id => f1.id) | 511 | + a1 = fast_create(TextArticle, :name => 'test article 1', :profile_id => profile.id, :parent_id => f1.id) |
538 | 512 | ||
539 | checked_articles= {a1.id => true} | 513 | checked_articles= {a1.id => true} |
540 | 514 | ||
@@ -547,16 +521,16 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | @@ -547,16 +521,16 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | ||
547 | 521 | ||
548 | end | 522 | end |
549 | 523 | ||
550 | -require 'boxes_helper' | ||
551 | - | ||
552 | class DisplayContentBlockViewTest < ActionView::TestCase | 524 | class DisplayContentBlockViewTest < ActionView::TestCase |
553 | include BoxesHelper | 525 | include BoxesHelper |
526 | + include DatesHelper | ||
527 | + helper :dates | ||
554 | 528 | ||
555 | should 'list links for all articles title defined in nodes' do | 529 | should 'list links for all articles title defined in nodes' do |
556 | profile = create_user('testuser').person | 530 | profile = create_user('testuser').person |
557 | Article.delete_all | 531 | Article.delete_all |
558 | - a1 = fast_create(TextileArticle, :name => 'test article 1', :profile_id => profile.id) | ||
559 | - a2 = fast_create(TextileArticle, :name => 'test article 2', :profile_id => profile.id) | 532 | + a1 = fast_create(TextArticle, :name => 'test article 1', :profile_id => profile.id) |
533 | + a2 = fast_create(TextArticle, :name => 'test article 2', :profile_id => profile.id) | ||
560 | 534 | ||
561 | block = DisplayContentBlock.new | 535 | block = DisplayContentBlock.new |
562 | block.sections = [{:value => 'title', :checked => true}] | 536 | block.sections = [{:value => 'title', :checked => true}] |
@@ -572,8 +546,8 @@ class DisplayContentBlockViewTest < ActionView::TestCase | @@ -572,8 +546,8 @@ class DisplayContentBlockViewTest < ActionView::TestCase | ||
572 | should 'list content for all articles lead defined in nodes' do | 546 | should 'list content for all articles lead defined in nodes' do |
573 | profile = create_user('testuser').person | 547 | profile = create_user('testuser').person |
574 | Article.delete_all | 548 | Article.delete_all |
575 | - a1 = fast_create(TinyMceArticle, :name => 'test article 1', :profile_id => profile.id, :abstract => 'abstract article 1') | ||
576 | - a2 = fast_create(TinyMceArticle, :name => 'test article 2', :profile_id => profile.id, :abstract => 'abstract article 2') | 549 | + a1 = fast_create(TextArticle, :name => 'test article 1', :profile_id => profile.id, :abstract => 'abstract article 1') |
550 | + a2 = fast_create(TextArticle, :name => 'test article 2', :profile_id => profile.id, :abstract => 'abstract article 2') | ||
577 | 551 | ||
578 | block = DisplayContentBlock.new | 552 | block = DisplayContentBlock.new |
579 | block.sections = [{:value => 'abstract', :checked => true}] | 553 | block.sections = [{:value => 'abstract', :checked => true}] |
@@ -602,7 +576,7 @@ class DisplayContentBlockViewTest < ActionView::TestCase | @@ -602,7 +576,7 @@ class DisplayContentBlockViewTest < ActionView::TestCase | ||
602 | 576 | ||
603 | should 'show title if defined by user' do | 577 | should 'show title if defined by user' do |
604 | profile = create_user('testuser').person | 578 | profile = create_user('testuser').person |
605 | - a = fast_create(TextileArticle, :name => 'test article 1', :profile_id => profile.id) | 579 | + a = fast_create(TextArticle, :name => 'test article 1', :profile_id => profile.id) |
606 | 580 | ||
607 | block = DisplayContentBlock.new | 581 | block = DisplayContentBlock.new |
608 | block.nodes = [a.id] | 582 | block.nodes = [a.id] |
@@ -616,7 +590,7 @@ class DisplayContentBlockViewTest < ActionView::TestCase | @@ -616,7 +590,7 @@ class DisplayContentBlockViewTest < ActionView::TestCase | ||
616 | 590 | ||
617 | should 'show abstract if defined by user' do | 591 | should 'show abstract if defined by user' do |
618 | profile = create_user('testuser').person | 592 | profile = create_user('testuser').person |
619 | - a = fast_create(TextileArticle, :name => 'test article 1', :profile_id => profile.id, :abstract => 'some abstract') | 593 | + a = fast_create(TextArticle, :name => 'test article 1', :profile_id => profile.id, :abstract => 'some abstract') |
620 | 594 | ||
621 | block = DisplayContentBlock.new | 595 | block = DisplayContentBlock.new |
622 | block.nodes = [a.id] | 596 | block.nodes = [a.id] |
@@ -630,7 +604,7 @@ class DisplayContentBlockViewTest < ActionView::TestCase | @@ -630,7 +604,7 @@ class DisplayContentBlockViewTest < ActionView::TestCase | ||
630 | 604 | ||
631 | should 'show body if defined by user' do | 605 | should 'show body if defined by user' do |
632 | profile = create_user('testuser').person | 606 | profile = create_user('testuser').person |
633 | - a = fast_create(TextileArticle, :name => 'test article 1', :profile_id => profile.id, :body => 'some body') | 607 | + a = fast_create(TextArticle, :name => 'test article 1', :profile_id => profile.id, :body => 'some body') |
634 | 608 | ||
635 | block = DisplayContentBlock.new | 609 | block = DisplayContentBlock.new |
636 | block.nodes = [a.id] | 610 | block.nodes = [a.id] |
@@ -642,7 +616,7 @@ class DisplayContentBlockViewTest < ActionView::TestCase | @@ -642,7 +616,7 @@ class DisplayContentBlockViewTest < ActionView::TestCase | ||
642 | assert_match /#{a.body}/, render_block_content(block) | 616 | assert_match /#{a.body}/, render_block_content(block) |
643 | end | 617 | end |
644 | 618 | ||
645 | - should 'show publishd date if defined by user' do | 619 | + should 'show published date if defined by user' do |
646 | profile = create_user('testuser').person | 620 | profile = create_user('testuser').person |
647 | a = fast_create(TextArticle, :name => 'test article 1', :profile_id => profile.id, :body => 'some body') | 621 | a = fast_create(TextArticle, :name => 'test article 1', :profile_id => profile.id, :body => 'some body') |
648 | 622 | ||
@@ -658,7 +632,7 @@ class DisplayContentBlockViewTest < ActionView::TestCase | @@ -658,7 +632,7 @@ class DisplayContentBlockViewTest < ActionView::TestCase | ||
658 | 632 | ||
659 | should 'show image if defined by user' do | 633 | should 'show image if defined by user' do |
660 | profile = create_user('testuser').person | 634 | profile = create_user('testuser').person |
661 | - a = create(TinyMceArticle, :name => 'test article 1', :profile_id => profile.id, :image_builder => { :uploaded_data => fixture_file_upload('/files/rails.png', 'image/png')}) | 635 | + a = create(TextArticle, :name => 'test article 1', :profile_id => profile.id, :image_builder => { :uploaded_data => fixture_file_upload('/files/rails.png', 'image/png')}) |
662 | a.save! | 636 | a.save! |
663 | 637 | ||
664 | process_delayed_job_queue | 638 | process_delayed_job_queue |
@@ -676,8 +650,8 @@ class DisplayContentBlockViewTest < ActionView::TestCase | @@ -676,8 +650,8 @@ class DisplayContentBlockViewTest < ActionView::TestCase | ||
676 | should 'show articles in recent order' do | 650 | should 'show articles in recent order' do |
677 | profile = create_user('testuser').person | 651 | profile = create_user('testuser').person |
678 | Article.delete_all | 652 | Article.delete_all |
679 | - a1 = fast_create(TextileArticle, :name => 'test article 1', :profile_id => profile.id, :published_at => DateTime.current) | ||
680 | - a2 = fast_create(TextileArticle, :name => 'test article 2', :profile_id => profile.id, :published_at => (DateTime.current + 1)) | 653 | + a1 = fast_create(TextArticle, :name => 'test article 1', :profile_id => profile.id, :published_at => DateTime.current) |
654 | + a2 = fast_create(TextArticle, :name => 'test article 2', :profile_id => profile.id, :published_at => (DateTime.current + 1)) | ||
681 | 655 | ||
682 | block = DisplayContentBlock.new | 656 | block = DisplayContentBlock.new |
683 | block.sections = [{:value => 'title', :checked => true}] | 657 | block.sections = [{:value => 'title', :checked => true}] |
@@ -697,8 +671,8 @@ class DisplayContentBlockViewTest < ActionView::TestCase | @@ -697,8 +671,8 @@ class DisplayContentBlockViewTest < ActionView::TestCase | ||
697 | should 'show articles in oldest order' do | 671 | should 'show articles in oldest order' do |
698 | profile = create_user('testuser').person | 672 | profile = create_user('testuser').person |
699 | Article.delete_all | 673 | Article.delete_all |
700 | - a1 = fast_create(TextileArticle, :name => 'test article 1', :profile_id => profile.id, :published_at => DateTime.current) | ||
701 | - a2 = fast_create(TextileArticle, :name => 'test article 2', :profile_id => profile.id, :published_at => (DateTime.current + 1)) | 674 | + a1 = fast_create(TextArticle, :name => 'test article 1', :profile_id => profile.id, :published_at => DateTime.current) |
675 | + a2 = fast_create(TextArticle, :name => 'test article 2', :profile_id => profile.id, :published_at => (DateTime.current + 1)) | ||
702 | 676 | ||
703 | block = DisplayContentBlock.new | 677 | block = DisplayContentBlock.new |
704 | block.sections = [{:value => 'title', :checked => true}] | 678 | block.sections = [{:value => 'title', :checked => true}] |
@@ -718,8 +692,8 @@ class DisplayContentBlockViewTest < ActionView::TestCase | @@ -718,8 +692,8 @@ class DisplayContentBlockViewTest < ActionView::TestCase | ||
718 | should 'show articles in recent order with limit option' do | 692 | should 'show articles in recent order with limit option' do |
719 | profile = create_user('testuser').person | 693 | profile = create_user('testuser').person |
720 | Article.delete_all | 694 | Article.delete_all |
721 | - a1 = fast_create(TextileArticle, :name => 'test article 1', :profile_id => profile.id, :published_at => DateTime.current) | ||
722 | - a2 = fast_create(TextileArticle, :name => 'test article 2', :profile_id => profile.id, :published_at => (DateTime.current + 1)) | 695 | + a1 = fast_create(TextArticle, :name => 'test article 1', :profile_id => profile.id, :published_at => DateTime.current) |
696 | + a2 = fast_create(TextArticle, :name => 'test article 2', :profile_id => profile.id, :published_at => (DateTime.current + 1)) | ||
723 | 697 | ||
724 | block = DisplayContentBlock.new | 698 | block = DisplayContentBlock.new |
725 | block.sections = [{:value => 'title', :checked => true}] | 699 | block.sections = [{:value => 'title', :checked => true}] |
@@ -741,10 +715,10 @@ class DisplayContentBlockViewTest < ActionView::TestCase | @@ -741,10 +715,10 @@ class DisplayContentBlockViewTest < ActionView::TestCase | ||
741 | profile = create_user('testuser').person | 715 | profile = create_user('testuser').person |
742 | Article.delete_all | 716 | Article.delete_all |
743 | 717 | ||
744 | - en_article = fast_create(TextileArticle, :profile_id => profile.id, :name => 'en_article', :language => 'en') | ||
745 | - en_article2 = fast_create(TextileArticle, :profile_id => profile.id, :name => 'en_article 2', :language => 'en') | 718 | + en_article = fast_create(TextArticle, :profile_id => profile.id, :name => 'en_article', :language => 'en') |
719 | + en_article2 = fast_create(TextArticle, :profile_id => profile.id, :name => 'en_article 2', :language => 'en') | ||
746 | 720 | ||
747 | - pt_article = fast_create TextileArticle, profile_id: profile.id, name: 'pt_article', language: 'pt', translation_of_id: en_article.id | 721 | + pt_article = fast_create TextArticle, profile_id: profile.id, name: 'pt_article', language: 'pt', translation_of_id: en_article.id |
748 | 722 | ||
749 | block = DisplayContentBlock.new | 723 | block = DisplayContentBlock.new |
750 | block.sections = [{:value => 'title', :checked => true}] | 724 | block.sections = [{:value => 'title', :checked => true}] |
@@ -771,8 +745,8 @@ class DisplayContentBlockViewTest < ActionView::TestCase | @@ -771,8 +745,8 @@ class DisplayContentBlockViewTest < ActionView::TestCase | ||
771 | profile = create_user('testuser').person | 745 | profile = create_user('testuser').person |
772 | Article.delete_all | 746 | Article.delete_all |
773 | 747 | ||
774 | - en_article = fast_create(TextileArticle, :profile_id => profile.id, :name => 'en_article', :language => 'en') | ||
775 | - pt_article = fast_create(TextileArticle, :profile_id => profile.id, :name => 'pt_article', :language => 'pt', :translation_of_id => en_article) | 748 | + en_article = fast_create(TextArticle, :profile_id => profile.id, :name => 'en_article', :language => 'en') |
749 | + pt_article = fast_create(TextArticle, :profile_id => profile.id, :name => 'pt_article', :language => 'pt', :translation_of_id => en_article) | ||
776 | 750 | ||
777 | block = DisplayContentBlock.new | 751 | block = DisplayContentBlock.new |
778 | block.sections = [{:value => 'title', :checked => true}] | 752 | block.sections = [{:value => 'title', :checked => true}] |
@@ -794,7 +768,7 @@ class DisplayContentBlockViewTest < ActionView::TestCase | @@ -794,7 +768,7 @@ class DisplayContentBlockViewTest < ActionView::TestCase | ||
794 | 768 | ||
795 | should 'not escape abstract html of articles' do | 769 | should 'not escape abstract html of articles' do |
796 | profile = create_user('testuser').person | 770 | profile = create_user('testuser').person |
797 | - a1 = fast_create(TextileArticle, abstract: "<p class='test-article-abstract'>Test</p>", name: 'test article 1', profile_id: profile.id, published_at: DateTime.current) | 771 | + a1 = fast_create(TextArticle, abstract: "<p class='test-article-abstract'>Test</p>", name: 'test article 1', profile_id: profile.id, published_at: DateTime.current) |
798 | 772 | ||
799 | block = DisplayContentBlock.new | 773 | block = DisplayContentBlock.new |
800 | block.sections = [{:value => 'abstract', :checked => true}] | 774 | block.sections = [{:value => 'abstract', :checked => true}] |
@@ -807,7 +781,7 @@ class DisplayContentBlockViewTest < ActionView::TestCase | @@ -807,7 +781,7 @@ class DisplayContentBlockViewTest < ActionView::TestCase | ||
807 | 781 | ||
808 | should 'not raise if abstract of article is nil' do | 782 | should 'not raise if abstract of article is nil' do |
809 | profile = create_user('testuser').person | 783 | profile = create_user('testuser').person |
810 | - a1 = fast_create(TextileArticle, name: 'test article 1', profile_id: profile.id, published_at: DateTime.current) | 784 | + a1 = fast_create(TextArticle, name: 'test article 1', profile_id: profile.id, published_at: DateTime.current) |
811 | 785 | ||
812 | block = DisplayContentBlock.new | 786 | block = DisplayContentBlock.new |
813 | block.sections = [{:value => 'abstract', :checked => true}] | 787 | block.sections = [{:value => 'abstract', :checked => true}] |
@@ -823,7 +797,7 @@ class DisplayContentBlockViewTest < ActionView::TestCase | @@ -823,7 +797,7 @@ class DisplayContentBlockViewTest < ActionView::TestCase | ||
823 | 797 | ||
824 | should 'not escape body html of articles' do | 798 | should 'not escape body html of articles' do |
825 | profile = create_user('testuser').person | 799 | profile = create_user('testuser').person |
826 | - a1 = fast_create(TextileArticle, body: "<p class='test-article-body'>Test</p>", name: 'test article 1', profile_id: profile.id, published_at: DateTime.current) | 800 | + a1 = fast_create(TextArticle, body: "<p class='test-article-body'>Test</p>", name: 'test article 1', profile_id: profile.id, published_at: DateTime.current) |
827 | 801 | ||
828 | block = DisplayContentBlock.new | 802 | block = DisplayContentBlock.new |
829 | block.sections = [{:value => 'body', :checked => true}] | 803 | block.sections = [{:value => 'body', :checked => true}] |
@@ -836,7 +810,7 @@ class DisplayContentBlockViewTest < ActionView::TestCase | @@ -836,7 +810,7 @@ class DisplayContentBlockViewTest < ActionView::TestCase | ||
836 | 810 | ||
837 | should 'not raise if body of article is nil' do | 811 | should 'not raise if body of article is nil' do |
838 | profile = create_user('testuser').person | 812 | profile = create_user('testuser').person |
839 | - a1 = fast_create(TextileArticle, name: 'test article 1', profile_id: profile.id, published_at: DateTime.current) | 813 | + a1 = fast_create(TextArticle, name: 'test article 1', profile_id: profile.id, published_at: DateTime.current) |
840 | 814 | ||
841 | block = DisplayContentBlock.new | 815 | block = DisplayContentBlock.new |
842 | block.sections = [{:value => 'abstract', :checked => true}] | 816 | block.sections = [{:value => 'abstract', :checked => true}] |
@@ -0,0 +1,58 @@ | @@ -0,0 +1,58 @@ | ||
1 | +Elasticsearch Plugin | ||
2 | +==================== | ||
3 | + | ||
4 | +Elasticsearch is as plugin to run searchs in noosfero through elasticsearch. | ||
5 | + | ||
6 | +The Version used is 1.7.5 due compatibility problems with gems and new versions. | ||
7 | + | ||
8 | +Download: https://www.elastic.co/downloads/past-releases/elasticsearch-1-7-5 | ||
9 | + | ||
10 | +INSTALL | ||
11 | +======= | ||
12 | + | ||
13 | +Install elasticsearch and openjdk-7-jdk. | ||
14 | + | ||
15 | + $ cd plugins/elasticsearch | ||
16 | + $ rake install | ||
17 | + | ||
18 | +After install start the service, by default, the service runs on port 9200. | ||
19 | + | ||
20 | +Install gems listed in plugin Gemfile. | ||
21 | + | ||
22 | + $ cd plugins/elasticsearch | ||
23 | + $ bundle install | ||
24 | + | ||
25 | +If this step fail, just copy the gems to core Gemfile and run the command | ||
26 | +'bundle install'. | ||
27 | + | ||
28 | +Enable plugin | ||
29 | +------------- | ||
30 | + | ||
31 | +Execute the command to enable Elasticsearch Plugin at your noosfero: | ||
32 | + | ||
33 | + ``sh $ ./script/noosfero-plugins enable elasticsearch `` | ||
34 | + | ||
35 | +Active plugin | ||
36 | +------------- | ||
37 | + | ||
38 | +As a Noosfero administrator user, go to administrator panel: | ||
39 | + | ||
40 | +- Click on "Enable/disable plugins" option | ||
41 | +- Click on "Elasticsearch" check-box | ||
42 | + | ||
43 | +DEVELOPMENT | ||
44 | +=========== | ||
45 | + | ||
46 | +To run tests for Elasticsearch: | ||
47 | + | ||
48 | +- All elasticsearch Tests: | ||
49 | + | ||
50 | +``` | ||
51 | +$ rake test:noosfero_plugins:elasticsearch:units | ||
52 | +``` | ||
53 | + | ||
54 | +- One Test: | ||
55 | + | ||
56 | +``` | ||
57 | +$ rake test:units TEST=plugins/elasticsearch/test/unit/controllers/elasticsearch_plugin_controller_test.rb | ||
58 | +``` |
@@ -0,0 +1,36 @@ | @@ -0,0 +1,36 @@ | ||
1 | +#!/usr/bin/env rake | ||
2 | + | ||
3 | +require 'open-uri' | ||
4 | + | ||
5 | +desc "download elasticsearch" | ||
6 | +task :download do | ||
7 | + unless File.exists? '/tmp/elasticsearch.deb' | ||
8 | + puts "downloading elasticsearch Debian package..." | ||
9 | + download = open('https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch-1.7.5.deb') | ||
10 | + IO.copy_stream(download, '/tmp/elasticsearch.deb') | ||
11 | + end | ||
12 | +end | ||
13 | + | ||
14 | +desc "install elasticsearch" | ||
15 | +task :install => :download do | ||
16 | + sh 'sudo apt-get install openjdk-7-jdk' | ||
17 | + sh 'sudo dpkg -i /tmp/elasticsearch.deb || sudo apt-get install -f' | ||
18 | +end | ||
19 | + | ||
20 | +desc "start elasticsearch" | ||
21 | +task :start do | ||
22 | + if not system 'sudo systemctl start elasticsearch > /dev/null' | ||
23 | + Rake::Task['install'].invoke | ||
24 | + end | ||
25 | + puts "Enable Elasticsearch service" | ||
26 | + sh 'sudo systemctl start elasticsearch >> /dev/null 2>&1' | ||
27 | + sh 'sudo systemctl enable elasticsearch >> /dev/null 2>&1' | ||
28 | + sleep 10 | ||
29 | +end | ||
30 | + | ||
31 | +desc "stop elasticsearch" | ||
32 | +task :stop do | ||
33 | + puts "Disable elasticsearch service" | ||
34 | + sh 'sudo systemctl stop elasticsearch >> /dev/null 2>&1' | ||
35 | + sh 'sudo systemctl disable elasticsearch >> /dev/null 2>&1' | ||
36 | +end |