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 | 59 | # NOOSFERO_BUNDLE_OPTS=install makes migrations fails |
60 | 60 | # probably because of rubygems-integration |
61 | 61 | plugins-1: |
62 | - script: SLICE=1/5 bundle exec rake test:noosfero_plugins | |
62 | + script: SLICE=1/5 bundle exec rake test:noosfero_plugins NOOSFERO_BUNDLE_OPTS=install | |
63 | 63 | stage: all-tests |
64 | 64 | plugins-2: |
65 | - script: SLICE=2/5 bundle exec rake test:noosfero_plugins | |
65 | + script: SLICE=2/5 bundle exec rake test:noosfero_plugins NOOSFERO_BUNDLE_OPTS=install | |
66 | 66 | stage: all-tests |
67 | 67 | plugins-3: |
68 | - script: SLICE=3/5 bundle exec rake test:noosfero_plugins | |
68 | + script: SLICE=3/5 bundle exec rake test:noosfero_plugins NOOSFERO_BUNDLE_OPTS=install | |
69 | 69 | stage: all-tests |
70 | 70 | plugins-4: |
71 | - script: SLICE=4/5 bundle exec rake test:noosfero_plugins | |
71 | + script: SLICE=4/5 bundle exec rake test:noosfero_plugins NOOSFERO_BUNDLE_OPTS=install | |
72 | 72 | stage: all-tests |
73 | 73 | plugins-5: |
74 | - script: SLICE=5/5 bundle exec rake test:noosfero_plugins | |
74 | + script: SLICE=5/5 bundle exec rake test:noosfero_plugins NOOSFERO_BUNDLE_OPTS=install | |
75 | 75 | stage: all-tests |
76 | 76 | ... | ... |
.travis.yml
Gemfile
... | ... | @@ -84,7 +84,7 @@ group :cucumber do |
84 | 84 | gem 'cucumber' |
85 | 85 | gem 'cucumber-rails', '~> 1.4.2', :require => false |
86 | 86 | gem 'database_cleaner', '~> 1.3' |
87 | - gem 'selenium-webdriver', '>= 2.50' | |
87 | + gem 'selenium-webdriver', '>= 2.53' | |
88 | 88 | gem 'chromedriver-helper' if ENV['SELENIUM_DRIVER'] == 'chrome' |
89 | 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 | 31 | Instructions for other systems |
32 | 32 | ------------------------------ |
33 | 33 | |
34 | -On other OS, you have 2 options: | |
34 | +On other OS, you have many options: | |
35 | 35 | |
36 | 36 | ### 1) using a chroot or a VM with Debian stable (easier) |
37 | 37 | |
... | ... | @@ -45,6 +45,14 @@ You can check `./script/install-dependencies/debian-squeeze.sh` to have an idea |
45 | 45 | |
46 | 46 | If you write such script for your own OS, *please* share it with us at the development mailing list so that we can include it in the official repository. This way other people using the same OS will have to put less effort to develop Noosfero. |
47 | 47 | |
48 | +### 3) Installing dependencies via Rubygems and RVM | |
49 | + | |
50 | +To setup the development environment through Rubygems you just need to install some basic deps and then install the gems defined on the Gemfile. Further instructions can be found on: http://noosfero.org/bin/view/Development/DepsWithRVMAndGems | |
51 | + | |
52 | +### 4) Using a docker image | |
53 | + | |
54 | +Use a docker image to run an out-of-the-box development environment. Further information can be found on: https://hub.docker.com/r/noosfero/dev-rails4/ | |
55 | + | |
48 | 56 | Submitting your changes back |
49 | 57 | ---------------------------- |
50 | 58 | ... | ... |
app/api/entities.rb
... | ... | @@ -38,6 +38,13 @@ module Api |
38 | 38 | PERMISSIONS[current_permission] <= PERMISSIONS[permission] |
39 | 39 | end |
40 | 40 | |
41 | + def self.expose_optional_field?(field, options = {}) | |
42 | + return false if options[:params].nil? | |
43 | + optional_fields = options[:params][:optional_fields] || [] | |
44 | + optional_fields.include?(field.to_s) | |
45 | + end | |
46 | + | |
47 | + | |
41 | 48 | class Image < Entity |
42 | 49 | root 'images', 'image' |
43 | 50 | |
... | ... | @@ -166,7 +173,8 @@ module Api |
166 | 173 | community.admins.map{|admin| {"name"=>admin.name, "id"=>admin.id, "username" => admin.identifier}} |
167 | 174 | end |
168 | 175 | expose :categories, :using => Category |
169 | - expose :members, :using => Person , :if => lambda{ |community, options| community.display_info_to? options[:current_person] } | |
176 | + expose :members_count | |
177 | + expose :members, :if => lambda {|community, options| Entities.expose_optional_field?(:members, options)} | |
170 | 178 | end |
171 | 179 | |
172 | 180 | class CommentBase < Entity |
... | ... | @@ -213,7 +221,7 @@ module Api |
213 | 221 | expose :comments_count |
214 | 222 | expose :archived, :documentation => {:type => "Boolean", :desc => "Defines if a article is readonly"} |
215 | 223 | expose :type |
216 | - expose :comments, using: CommentBase, :if => lambda{|obj,opt| opt[:params] && ['1','true',true].include?(opt[:params][:show_comments])} | |
224 | + expose :comments, using: CommentBase, :if => lambda{|comment,options| Entities.expose_optional_field?(:comments, options)} | |
217 | 225 | expose :published |
218 | 226 | expose :accept_comments?, as: :accept_comments |
219 | 227 | end | ... | ... |
app/api/helpers.rb
... | ... | @@ -57,9 +57,11 @@ module Api |
57 | 57 | def present_partial(model, options) |
58 | 58 | if(params[:fields].present?) |
59 | 59 | begin |
60 | - fields = JSON.parse(params[:fields]) | |
60 | + fields = JSON.parse((params.to_hash[:fields] || params.to_hash['fields']).to_json) | |
61 | 61 | if fields.present? |
62 | - options.merge!(fields.symbolize_keys.slice(:only, :except)) | |
62 | + fields = fields.symbolize_keys | |
63 | + options.merge!(:only => fields[:only]) if fields[:only].present? | |
64 | + options.merge!(:except => fields[:except]) if fields[:except].present? | |
63 | 65 | end |
64 | 66 | rescue |
65 | 67 | fields = params[:fields] |
... | ... | @@ -116,7 +118,7 @@ module Api |
116 | 118 | def post_article(asset, params) |
117 | 119 | return forbidden! unless current_person.can_post_content?(asset) |
118 | 120 | |
119 | - klass_type = params[:content_type] || params[:article].delete(:type) || TinyMceArticle.name | |
121 | + klass_type = params[:content_type] || params[:article].delete(:type) || TextArticle.name | |
120 | 122 | return forbidden! unless klass_type.constantize <= Article |
121 | 123 | |
122 | 124 | article = klass_type.constantize.new(params[:article]) |
... | ... | @@ -503,11 +505,9 @@ module Api |
503 | 505 | |
504 | 506 | def parse_content_type(content_type) |
505 | 507 | return nil if content_type.blank? |
506 | - content_types = content_type.split(',').map do |content_type| | |
507 | - content_type = content_type.camelcase | |
508 | - content_type == 'TextArticle' ? Article.text_article_types : content_type | |
508 | + content_type.split(',').map do |content_type| | |
509 | + content_type.camelcase | |
509 | 510 | end |
510 | - content_types.flatten.uniq | |
511 | 511 | end |
512 | 512 | |
513 | 513 | def period(from_date, until_date) | ... | ... |
app/api/v1/communities.rb
... | ... | @@ -18,7 +18,7 @@ module Api |
18 | 18 | communities = select_filtered_collection_of(environment, 'communities', params) |
19 | 19 | communities = profiles_for_person(communities, current_person) |
20 | 20 | communities = communities.by_location(params) # Must be the last. May return Exception obj |
21 | - present communities, :with => Entities::Community, :current_person => current_person | |
21 | + present communities, :with => Entities::Community, :current_person => current_person, :params => params | |
22 | 22 | end |
23 | 23 | |
24 | 24 | |
... | ... | @@ -49,7 +49,7 @@ module Api |
49 | 49 | |
50 | 50 | get ':id' do |
51 | 51 | community = profiles_for_person(environment.communities, current_person).find_by_id(params[:id]) |
52 | - present community, :with => Entities::Community, :current_person => current_person | |
52 | + present community, :with => Entities::Community, :current_person => current_person, :params => params | |
53 | 53 | end |
54 | 54 | |
55 | 55 | end | ... | ... |
app/controllers/my_profile/cms_controller.rb
... | ... | @@ -151,6 +151,7 @@ class CmsController < MyProfileController |
151 | 151 | |
152 | 152 | @article.profile = profile |
153 | 153 | @article.author = user |
154 | + @article.editor = current_person.editor | |
154 | 155 | @article.last_changed_by = user |
155 | 156 | @article.created_by = user |
156 | 157 | |
... | ... | @@ -399,8 +400,7 @@ class CmsController < MyProfileController |
399 | 400 | |
400 | 401 | def available_article_types |
401 | 402 | articles = [ |
402 | - TinyMceArticle, | |
403 | - TextileArticle, | |
403 | + TextArticle, | |
404 | 404 | Event |
405 | 405 | ] |
406 | 406 | articles += special_article_types if params && params[:cms] |
... | ... | @@ -408,9 +408,6 @@ class CmsController < MyProfileController |
408 | 408 | if @parent && @parent.blog? |
409 | 409 | articles -= Article.folder_types.map(&:constantize) |
410 | 410 | end |
411 | - if user.is_admin?(profile.environment) | |
412 | - articles << RawHTMLArticle | |
413 | - end | |
414 | 411 | articles |
415 | 412 | end |
416 | 413 | ... | ... |
app/controllers/my_profile/profile_editor_controller.rb
... | ... | @@ -95,7 +95,7 @@ class ProfileEditorController < MyProfileController |
95 | 95 | end |
96 | 96 | |
97 | 97 | def welcome_page |
98 | - @welcome_page = profile.welcome_page || TinyMceArticle.new(:name => 'Welcome Page', :profile => profile, :published => false) | |
98 | + @welcome_page = profile.welcome_page || TextArticle.new(:name => 'Welcome Page', :profile => profile, :published => false) | |
99 | 99 | if request.post? |
100 | 100 | begin |
101 | 101 | @welcome_page.update!(params[:welcome_page]) | ... | ... |
app/controllers/public/profile_controller.rb
... | ... | @@ -19,6 +19,11 @@ class ProfileController < PublicController |
19 | 19 | @network_activities = @profile.tracked_notifications.visible.paginate(:per_page => 15, :page => params[:page]) if @network_activities.empty? |
20 | 20 | @activities = @profile.activities.paginate(:per_page => 15, :page => params[:page]) |
21 | 21 | end |
22 | + | |
23 | + # TODO Find a way to filter these through sql | |
24 | + @network_activities = filter_private_scraps(@network_activities) | |
25 | + @activities = filter_private_scraps(@activities) | |
26 | + | |
22 | 27 | @tags = profile.article_tags |
23 | 28 | allow_access_to_page |
24 | 29 | end |
... | ... | @@ -231,6 +236,7 @@ class ProfileController < PublicController |
231 | 236 | @scrap = Scrap.new(params[:scrap]) |
232 | 237 | @scrap.sender= sender |
233 | 238 | @scrap.receiver= receiver |
239 | + @scrap.marked_people = treat_followed_entries(params[:filter_followed]) | |
234 | 240 | @tab_action = params[:tab_action] |
235 | 241 | @message = @scrap.save ? _("Message successfully sent.") : _("You can't leave an empty message.") |
236 | 242 | activities = @profile.activities.paginate(:per_page => 15, :page => params[:page]) if params[:not_load_scraps].nil? |
... | ... | @@ -253,6 +259,14 @@ class ProfileController < PublicController |
253 | 259 | end |
254 | 260 | end |
255 | 261 | |
262 | + def search_followed | |
263 | + result = [] | |
264 | + circles = find_by_contents(:circles, user, user.circles.where(:profile_type => 'Person'), params[:q])[:results] | |
265 | + followed = find_by_contents(:followed, user, Profile.followed_by(user), params[:q])[:results] | |
266 | + result = circles + followed | |
267 | + render :text => prepare_to_token_input_by_class(result).to_json | |
268 | + end | |
269 | + | |
256 | 270 | def view_more_activities |
257 | 271 | @activities = @profile.activities.paginate(:per_page => 10, :page => params[:page]) |
258 | 272 | render :partial => 'profile_activities_list', :locals => {:activities => @activities} |
... | ... | @@ -434,7 +448,6 @@ class ProfileController < PublicController |
434 | 448 | end |
435 | 449 | end |
436 | 450 | |
437 | - | |
438 | 451 | protected |
439 | 452 | |
440 | 453 | def check_access_to_profile |
... | ... | @@ -480,4 +493,39 @@ class ProfileController < PublicController |
480 | 493 | render_not_found unless profile.allow_followers? |
481 | 494 | end |
482 | 495 | |
496 | + def treat_followed_entries(entries) | |
497 | + return [] if entries.blank? || profile != user | |
498 | + | |
499 | + followed = [] | |
500 | + entries.split(',').map do |entry| | |
501 | + klass, identifier = entry.split('_') | |
502 | + case klass | |
503 | + when 'Person' | |
504 | + followed << Person.find(identifier) | |
505 | + when 'Circle' | |
506 | + circle = Circle.find(identifier) | |
507 | + followed += Profile.in_circle(circle) | |
508 | + end | |
509 | + end | |
510 | + followed.uniq | |
511 | + end | |
512 | + | |
513 | + def filter_private_scraps(activities) | |
514 | + activities = Array(activities) | |
515 | + activities.delete_if do |item| | |
516 | + if item.kind_of?(ProfileActivity) | |
517 | + target = item.activity | |
518 | + owner = profile | |
519 | + else | |
520 | + target = item.target | |
521 | + owner = item.user | |
522 | + end | |
523 | + !environment.admins.include?(user) && | |
524 | + owner != user && | |
525 | + target.is_a?(Scrap) && | |
526 | + target.marked_people.present? && | |
527 | + !target.marked_people.include?(user) | |
528 | + end | |
529 | + activities | |
530 | + end | |
483 | 531 | end | ... | ... |
app/helpers/application_helper.rb
... | ... | @@ -111,10 +111,6 @@ module ApplicationHelper |
111 | 111 | content = capture(&block) |
112 | 112 | end |
113 | 113 | |
114 | - if options[:type] == :textile | |
115 | - content = RedCloth.new(content).to_html | |
116 | - end | |
117 | - | |
118 | 114 | options[:class] = '' if ! options[:class] |
119 | 115 | options[:class] += ' button icon-help' # with-text |
120 | 116 | |
... | ... | @@ -132,13 +128,6 @@ module ApplicationHelper |
132 | 128 | text |
133 | 129 | end |
134 | 130 | |
135 | - # alias for <tt>help(content, :textile)</tt>. You can pass a block in the | |
136 | - # same way you would do if you called <tt>help</tt> directly. | |
137 | - def help_textile(content = nil, link_name = nil, options = {}, &block) | |
138 | - options[:type] = :textile | |
139 | - help(content, link_name, options, &block) | |
140 | - end | |
141 | - | |
142 | 131 | # TODO: do something more useful here |
143 | 132 | # TODO: test this helper |
144 | 133 | # TODO: add an icon? |
... | ... | @@ -1245,4 +1234,15 @@ module ApplicationHelper |
1245 | 1234 | content.html_safe |
1246 | 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 | 1248 | end | ... | ... |
app/helpers/article_helper.rb
... | ... | @@ -161,6 +161,10 @@ module ArticleHelper |
161 | 161 | array.map { |object| {:label => object.name, :value => object.name} } |
162 | 162 | end |
163 | 163 | |
164 | + def prepare_to_token_input_by_class(array) | |
165 | + array.map { |object| {:id => "#{object.class.name}_#{object.id || object.name}", :name => "#{object.name} (#{_(object.class.name)})", :class => object.class.name}} | |
166 | + end | |
167 | + | |
164 | 168 | def cms_label_for_new_children |
165 | 169 | _('New article') |
166 | 170 | end | ... | ... |
app/helpers/profile_editor_helper.rb
app/helpers/tags_helper.rb
... | ... | @@ -67,4 +67,17 @@ module TagsHelper |
67 | 67 | end.join("\n").html_safe |
68 | 68 | end |
69 | 69 | |
70 | + def linked_article_tags(article) | |
71 | + if @profile | |
72 | + # We are rendering a page inside a profile, so link to the profile tag search. | |
73 | + url = { :controller => 'profile', :profile => @profile.identifier, :action => 'tags' } | |
74 | + tagname_option = :id | |
75 | + else | |
76 | + # We are rendering a page outside a profile, so link to the global tag search. | |
77 | + url = { :action => 'tag' } | |
78 | + tagname_option = :tag | |
79 | + end | |
80 | + article.tags.map { |t| link_to(t, url.merge(tagname_option=>t.name) ) }.join("\n") | |
81 | + end | |
82 | + | |
70 | 83 | end | ... | ... |
app/helpers/tinymce_helper.rb
... | ... | @@ -18,7 +18,8 @@ module TinymceHelper |
18 | 18 | insertdatetime media nonbreaking save table contextmenu directionality |
19 | 19 | emoticons template paste textcolor colorpicker textpattern], |
20 | 20 | :image_advtab => true, |
21 | - :language => tinymce_language | |
21 | + :language => tinymce_language, | |
22 | + :selector => '.' + current_editor(options[:mode]) | |
22 | 23 | |
23 | 24 | options[:toolbar1] = toolbar1(options[:mode]) |
24 | 25 | options[:menubar] = menubar(options[:mode]) | ... | ... |
app/helpers/token_helper.rb
... | ... | @@ -5,10 +5,11 @@ module TokenHelper |
5 | 5 | end |
6 | 6 | |
7 | 7 | def token_input_field_tag(name, element_id, search_action, options = {}, text_field_options = {}, html_options = {}) |
8 | - options[:min_chars] ||= 3 | |
8 | + options[:min_chars] ||= 2 | |
9 | 9 | options[:hint_text] ||= _("Type in a search term") |
10 | 10 | options[:no_results_text] ||= _("No results") |
11 | 11 | options[:searching_text] ||= _("Searching...") |
12 | + options[:placeholder] ||= 'null' | |
12 | 13 | options[:search_delay] ||= 1000 |
13 | 14 | options[:prevent_duplicates] ||= true |
14 | 15 | options[:backspace_delete_item] ||= false |
... | ... | @@ -20,6 +21,9 @@ module TokenHelper |
20 | 21 | options[:on_delete] ||= 'null' |
21 | 22 | options[:on_ready] ||= 'null' |
22 | 23 | options[:query_param] ||= 'q' |
24 | + options[:theme] ||= 'null' | |
25 | + options[:results_formatter] ||= 'null' | |
26 | + options[:token_formatter] ||= 'null' | |
23 | 27 | |
24 | 28 | result = text_field_tag(name, nil, text_field_options.merge(html_options.merge({:id => element_id}))) |
25 | 29 | result += javascript_tag("jQuery('##{element_id}') |
... | ... | @@ -29,6 +33,7 @@ module TokenHelper |
29 | 33 | hintText: #{options[:hint_text].to_json}, |
30 | 34 | noResultsText: #{options[:no_results_text].to_json}, |
31 | 35 | searchingText: #{options[:searching_text].to_json}, |
36 | + placeholder: #{options[:placeholder].to_json}, | |
32 | 37 | searchDelay: #{options[:search_delay].to_json}, |
33 | 38 | preventDuplicates: #{options[:prevent_duplicates].to_json}, |
34 | 39 | backspaceDeleteItem: #{options[:backspace_delete_item].to_json}, |
... | ... | @@ -39,6 +44,9 @@ module TokenHelper |
39 | 44 | onAdd: #{options[:on_add]}, |
40 | 45 | onDelete: #{options[:on_delete]}, |
41 | 46 | onReady: #{options[:on_ready]}, |
47 | + theme: #{options[:theme] == 'null' ? options[:theme] : options[:theme].to_json}, | |
48 | + resultsFormater: #{options[:results_formatter]}, | |
49 | + tokenFormater: #{options[:token_formatter]}, | |
42 | 50 | }); |
43 | 51 | ") |
44 | 52 | result += javascript_tag("jQuery('##{element_id}').focus();") if options[:focus] | ... | ... |
app/jobs/notify_activity_to_profiles_job.rb
... | ... | @@ -19,8 +19,13 @@ class NotifyActivityToProfilesJob < Struct.new(:tracked_action_id) |
19 | 19 | # Notify the user |
20 | 20 | ActionTrackerNotification.create(:profile_id => tracked_action.user.id, :action_tracker_id => tracked_action.id) |
21 | 21 | |
22 | - # Notify all followers | |
23 | - ActionTrackerNotification.connection.execute("INSERT INTO action_tracker_notifications(profile_id, action_tracker_id) SELECT DISTINCT c.person_id, #{tracked_action.id} FROM profiles_circles AS p JOIN circles as c ON c.id = p.circle_id WHERE p.profile_id = #{tracked_action.user.id} AND (c.person_id NOT IN (SELECT atn.profile_id FROM action_tracker_notifications AS atn WHERE atn.action_tracker_id = #{tracked_action.id}))") | |
22 | + if target.is_a?(Scrap) && target.marked_people.present? | |
23 | + # Notify only marked people | |
24 | + ActionTrackerNotification.connection.execute("INSERT INTO action_tracker_notifications(profile_id, action_tracker_id) SELECT DISTINCT profiles.id, #{tracked_action.id} FROM profiles WHERE profiles.id IN (#{target.marked_people.map(&:id).join(',')})") | |
25 | + else | |
26 | + # Notify all followers | |
27 | + ActionTrackerNotification.connection.execute("INSERT INTO action_tracker_notifications(profile_id, action_tracker_id) SELECT DISTINCT c.person_id, #{tracked_action.id} FROM profiles_circles AS p JOIN circles as c ON c.id = p.circle_id WHERE p.profile_id = #{tracked_action.user.id} AND (c.person_id NOT IN (SELECT atn.profile_id FROM action_tracker_notifications AS atn WHERE atn.action_tracker_id = #{tracked_action.id}))") | |
28 | + end | |
24 | 29 | |
25 | 30 | if tracked_action.user.is_a? Organization |
26 | 31 | ActionTrackerNotification.connection.execute "insert into action_tracker_notifications(profile_id, action_tracker_id) " + | ... | ... |
app/models/article.rb
1 | 1 | |
2 | 2 | class Article < ApplicationRecord |
3 | 3 | |
4 | + module Editor | |
5 | + TEXTILE = 'textile' | |
6 | + TINY_MCE = 'tiny_mce' | |
7 | + RAW_HTML = 'raw_html' | |
8 | + end | |
9 | + | |
4 | 10 | include SanitizeHelper |
5 | 11 | |
6 | 12 | attr_accessible :name, :body, :abstract, :profile, :tag_list, :parent, |
... | ... | @@ -11,7 +17,7 @@ class Article < ApplicationRecord |
11 | 17 | :highlighted, :notify_comments, :display_hits, :slug, |
12 | 18 | :external_feed_builder, :display_versions, :external_link, |
13 | 19 | :image_builder, :show_to_followers, :archived, |
14 | - :author, :display_preview, :published_at, :person_followers | |
20 | + :author, :display_preview, :published_at, :person_followers, :editor | |
15 | 21 | |
16 | 22 | extend ActsAsHavingImage::ClassMethods |
17 | 23 | acts_as_having_image |
... | ... | @@ -518,17 +524,12 @@ class Article < ApplicationRecord |
518 | 524 | ['Folder', 'Blog', 'Forum', 'Gallery'] |
519 | 525 | end |
520 | 526 | |
521 | - def self.text_article_types | |
522 | - ['TextArticle', 'TextileArticle', 'TinyMceArticle'] | |
523 | - end | |
524 | - | |
525 | 527 | scope :published, -> { where 'articles.published = ?', true } |
526 | 528 | scope :folders, -> profile { where 'articles.type IN (?)', profile.folder_types } |
527 | 529 | scope :no_folders, -> profile { where 'articles.type NOT IN (?)', profile.folder_types } |
528 | 530 | scope :galleries, -> { where "articles.type IN ('Gallery')" } |
529 | 531 | scope :images, -> { where :is_image => true } |
530 | 532 | scope :no_images, -> { where :is_image => false } |
531 | - scope :text_articles, -> { where 'articles.type IN (?)', text_article_types } | |
532 | 533 | scope :files, -> { where :type => 'UploadedFile' } |
533 | 534 | scope :with_types, -> types { where 'articles.type IN (?)', types } |
534 | 535 | |
... | ... | @@ -711,10 +712,6 @@ class Article < ApplicationRecord |
711 | 712 | false |
712 | 713 | end |
713 | 714 | |
714 | - def tiny_mce? | |
715 | - false | |
716 | - end | |
717 | - | |
718 | 715 | def folder? |
719 | 716 | false |
720 | 717 | end |
... | ... | @@ -879,6 +876,10 @@ class Article < ApplicationRecord |
879 | 876 | true |
880 | 877 | end |
881 | 878 | |
879 | + def editor?(editor) | |
880 | + self.editor == editor | |
881 | + end | |
882 | + | |
882 | 883 | private |
883 | 884 | |
884 | 885 | def sanitize_tag_list | ... | ... |
app/models/circle.rb
app/models/event.rb
app/models/external_feed.rb
app/models/person.rb
1 | 1 | # A person is the profile of an user holding all relationships with the rest of the system |
2 | 2 | class Person < Profile |
3 | 3 | |
4 | - attr_accessible :organization, :contact_information, :sex, :birth_date, :cell_phone, :comercial_phone, :jabber_id, :personal_website, :nationality, :address_reference, :district, :schooling, :schooling_status, :formation, :custom_formation, :area_of_study, :custom_area_of_study, :professional_activity, :organization_website, :following_articles | |
4 | + attr_accessible :organization, :contact_information, :sex, :birth_date, :cell_phone, :comercial_phone, :jabber_id, :personal_website, :nationality, :address_reference, :district, :schooling, :schooling_status, :formation, :custom_formation, :area_of_study, :custom_area_of_study, :professional_activity, :organization_website, :following_articles, :editor | |
5 | 5 | |
6 | 6 | SEARCH_FILTERS = { |
7 | 7 | :order => %w[more_recent more_popular more_active], |
... | ... | @@ -124,6 +124,8 @@ class Person < Profile |
124 | 124 | where 'profile_suggestions.suggestion_type = ? AND profile_suggestions.enabled = ?', 'Community', true |
125 | 125 | }, through: :suggested_profiles, source: :suggestion |
126 | 126 | |
127 | + has_and_belongs_to_many :marked_scraps, :join_table => :private_scraps, :class_name => 'Scrap' | |
128 | + | |
127 | 129 | scope :more_popular, -> { order 'friends_count DESC' } |
128 | 130 | |
129 | 131 | scope :abusers, -> { |
... | ... | @@ -344,6 +346,8 @@ class Person < Profile |
344 | 346 | |
345 | 347 | validates_associated :user |
346 | 348 | |
349 | + validates :editor, inclusion: { in: lambda { |p| p.available_editors } } | |
350 | + | |
347 | 351 | def email |
348 | 352 | self.user.nil? ? nil : self.user.email |
349 | 353 | end |
... | ... | @@ -616,8 +620,21 @@ class Person < Profile |
616 | 620 | Profile.followed_by self |
617 | 621 | end |
618 | 622 | |
623 | + def editor?(editor) | |
624 | + self.editor == editor | |
625 | + end | |
626 | + | |
619 | 627 | def in_social_circle?(person) |
620 | 628 | self.is_a_friend?(person) || super |
621 | 629 | end |
622 | 630 | |
631 | + def available_editors | |
632 | + available_editors = { | |
633 | + Article::Editor::TINY_MCE => _('TinyMCE'), | |
634 | + Article::Editor::TEXTILE => _('Textile') | |
635 | + } | |
636 | + available_editors.merge!({Article::Editor::RAW_HTML => _('Raw HTML')}) if self.is_admin? | |
637 | + available_editors | |
638 | + end | |
639 | + | |
623 | 640 | end | ... | ... |
app/models/raw_html_article.rb
... | ... | @@ -1,17 +0,0 @@ |
1 | -class RawHTMLArticle < TextArticle | |
2 | - | |
3 | - def self.type_name | |
4 | - _('HTML') | |
5 | - end | |
6 | - | |
7 | - def self.short_description | |
8 | - _('Raw HTML text article') | |
9 | - end | |
10 | - | |
11 | - def self.description | |
12 | - _('Allows HTML without filter (only for admins).') | |
13 | - end | |
14 | - | |
15 | - xss_terminate :only => [ ] | |
16 | - | |
17 | -end |
app/models/scrap.rb
... | ... | @@ -2,7 +2,7 @@ class Scrap < ApplicationRecord |
2 | 2 | |
3 | 3 | include SanitizeHelper |
4 | 4 | |
5 | - attr_accessible :content, :sender_id, :receiver_id, :scrap_id | |
5 | + attr_accessible :content, :sender_id, :receiver_id, :scrap_id, :marked_people | |
6 | 6 | |
7 | 7 | SEARCHABLE_FIELDS = { |
8 | 8 | :content => {:label => _('Content'), :weight => 1}, |
... | ... | @@ -19,6 +19,8 @@ class Scrap < ApplicationRecord |
19 | 19 | where profile_activities: {activity_type: 'Scrap'} |
20 | 20 | }, foreign_key: :activity_id, dependent: :destroy |
21 | 21 | |
22 | + has_and_belongs_to_many :marked_people, :join_table => :private_scraps, :class_name => 'Person' | |
23 | + | |
22 | 24 | after_create :create_activity |
23 | 25 | after_update :update_activity |
24 | 26 | ... | ... |
app/models/suggest_article.rb
app/models/text_article.rb
1 | 1 | # a base class for all text article types. |
2 | 2 | class TextArticle < Article |
3 | 3 | |
4 | - xss_terminate :only => [ :name ], :on => 'validation' | |
4 | + def self.short_description | |
5 | + _('Text article') | |
6 | + end | |
7 | + | |
8 | + def self.description | |
9 | + _('Text article to create user content.') | |
10 | + end | |
11 | + | |
12 | + xss_terminate :only => [ :name, :body, :abstract ], :with => 'white_list', :on => 'validation', :if => lambda { |a| !a.editor?(Article::Editor::TEXTILE) && !a.editor?(Article::Editor::RAW_HTML) } | |
13 | + | |
14 | + include WhiteListFilter | |
15 | + filter_iframes :abstract, :body | |
16 | + def iframe_whitelist | |
17 | + profile && profile.environment && profile.environment.trusted_sites_for_iframe | |
18 | + end | |
5 | 19 | |
6 | 20 | def self.type_name |
7 | 21 | _('Article') |
... | ... | @@ -21,6 +35,18 @@ class TextArticle < Article |
21 | 35 | true |
22 | 36 | end |
23 | 37 | |
38 | + def can_display_media_panel? | |
39 | + true | |
40 | + end | |
41 | + | |
42 | + def self.can_display_blocks? | |
43 | + false | |
44 | + end | |
45 | + | |
46 | + def notifiable? | |
47 | + true | |
48 | + end | |
49 | + | |
24 | 50 | before_save :set_relative_path |
25 | 51 | |
26 | 52 | def set_relative_path |
... | ... | @@ -43,4 +69,24 @@ class TextArticle < Article |
43 | 69 | parent && parent.kind_of?(Blog) && parent.display_preview |
44 | 70 | end |
45 | 71 | |
72 | + def to_html(options ={}) | |
73 | + content = super(options) | |
74 | + content = convert_textile_to_html(content) if self.editor?(Article::Editor::TEXTILE) | |
75 | + content | |
76 | + end | |
77 | + | |
78 | + def lead(length = nil) | |
79 | + content = super(length) | |
80 | + content = convert_textile_to_html(content) if self.editor?(Article::Editor::TEXTILE) | |
81 | + content | |
82 | + end | |
83 | + | |
84 | + protected | |
85 | + | |
86 | + def convert_textile_to_html(textile) | |
87 | + converter = RedCloth.new(textile|| '') | |
88 | + converter.hard_breaks = false | |
89 | + sanitize_html(converter.to_html, :white_list) | |
90 | + end | |
91 | + | |
46 | 92 | end | ... | ... |
app/models/textile_article.rb
... | ... | @@ -1,44 +0,0 @@ |
1 | -class TextileArticle < TextArticle | |
2 | - include SanitizeHelper | |
3 | - | |
4 | - def self.short_description | |
5 | - _('Text article with Textile markup language') | |
6 | - end | |
7 | - | |
8 | - def self.description | |
9 | - _('Accessible alternative for visually impaired users.') | |
10 | - end | |
11 | - | |
12 | - def to_html(options ={}) | |
13 | - convert_to_html(body) | |
14 | - end | |
15 | - | |
16 | - def lead(length = nil) | |
17 | - if abstract.blank? | |
18 | - super | |
19 | - else | |
20 | - convert_to_html(abstract) | |
21 | - end | |
22 | - end | |
23 | - | |
24 | - def notifiable? | |
25 | - true | |
26 | - end | |
27 | - | |
28 | - def can_display_media_panel? | |
29 | - true | |
30 | - end | |
31 | - | |
32 | - def self.can_display_blocks? | |
33 | - false | |
34 | - end | |
35 | - | |
36 | - protected | |
37 | - | |
38 | - def convert_to_html(textile) | |
39 | - converter = RedCloth.new(textile|| '') | |
40 | - converter.hard_breaks = false | |
41 | - sanitize_html(converter.to_html, :white_list) | |
42 | - end | |
43 | - | |
44 | -end |
app/models/tiny_mce_article.rb
... | ... | @@ -1,37 +0,0 @@ |
1 | -class TinyMceArticle < TextArticle | |
2 | - | |
3 | - def self.short_description | |
4 | - _('Text article with visual editor') | |
5 | - end | |
6 | - | |
7 | - def self.description | |
8 | - _('Not accessible for visually impaired users.') | |
9 | - end | |
10 | - | |
11 | - xss_terminate :only => [ ] | |
12 | - | |
13 | - xss_terminate :only => [ :name, :abstract, :body ], :with => 'white_list', :on => 'validation' | |
14 | - | |
15 | - include WhiteListFilter | |
16 | - filter_iframes :abstract, :body | |
17 | - def iframe_whitelist | |
18 | - profile && profile.environment && profile.environment.trusted_sites_for_iframe | |
19 | - end | |
20 | - | |
21 | - def notifiable? | |
22 | - true | |
23 | - end | |
24 | - | |
25 | - def tiny_mce? | |
26 | - true | |
27 | - end | |
28 | - | |
29 | - def can_display_media_panel? | |
30 | - true | |
31 | - end | |
32 | - | |
33 | - def self.can_display_blocks? | |
34 | - false | |
35 | - end | |
36 | - | |
37 | -end |
app/models/uploaded_file.rb
app/views/admin_panel/_signup_intro.html.erb
... | ... | @@ -2,4 +2,4 @@ |
2 | 2 | <%= _('This text will be shown to the user on the top of the sign up form.') %> |
3 | 3 | </div> |
4 | 4 | |
5 | -<%= labelled_form_field(_('Body'), text_area(:environment, :signup_intro, :cols => 40, :style => 'width: 100%', :class => 'mceEditor')) %> | |
5 | +<%= labelled_form_field(_('Body'), text_area(:environment, :signup_intro, :cols => 40, :style => 'width: 100%', :class => current_editor)) %> | ... | ... |
app/views/admin_panel/_signup_welcome_screen.html.erb
1 | 1 | <div class='description'> |
2 | 2 | <%= _('If you enable this feature on the "Features" section of the Administration Panel, this text will be shown as a welcome message to users after signup.') %> |
3 | 3 | </div> |
4 | -<%= labelled_form_field(_('Body'), text_area(:environment, :signup_welcome_screen_body, :cols => 40, :style => 'width: 100%', :class => 'mceEditor')) %> | |
4 | +<%= labelled_form_field(_('Body'), text_area(:environment, :signup_welcome_screen_body, :cols => 40, :style => 'width: 100%', :class => current_editor)) %> | |
5 | 5 | |
6 | 6 | <div class='description'> |
7 | 7 | <%= _('If this content is left blank, the following page will be displayed to the user:') %> | ... | ... |
app/views/admin_panel/_signup_welcome_text.html.erb
... | ... | @@ -4,4 +4,4 @@ |
4 | 4 | </div> |
5 | 5 | |
6 | 6 | <%= labelled_form_field(_('Subject'), text_field(:environment, :signup_welcome_text_subject, :style => 'width:100%')) %> |
7 | -<%= labelled_form_field(_('Body'), text_area(:environment, :signup_welcome_text_body, :cols => 40, :style => 'width: 100%', :class => 'mceEditor')) %> | |
7 | +<%= labelled_form_field(_('Body'), text_area(:environment, :signup_welcome_text_body, :cols => 40, :style => 'width: 100%', :class => current_editor)) %> | ... | ... |
app/views/admin_panel/_site_info.html.erb
... | ... | @@ -31,4 +31,4 @@ |
31 | 31 | <%= balanced_table(fields)%> |
32 | 32 | |
33 | 33 | <br /> |
34 | -<%= labelled_form_field _('Homepage content'), text_area(:environment, :description, :cols => 40, :style => 'width: 90%', :class => 'mceEditor') %> | |
34 | +<%= labelled_form_field _('Homepage content'), text_area(:environment, :description, :cols => 40, :style => 'width: 90%', :class => current_editor) %> | ... | ... |
app/views/admin_panel/_terms_of_use.html.erb
app/views/admin_panel/message_for_disabled_enterprise.html.erb
1 | 1 | <h2><%= _('Site info') %></h2> |
2 | 2 | |
3 | -<%= render :file => 'shared/tiny_mce' %> | |
4 | - | |
5 | 3 | <%= labelled_form_for :environment, :url => {:action => 'site_info'} do |f| %> |
6 | 4 | |
7 | - <%= f.text_area :message_for_disabled_enterprise, :cols => 40, :style => 'width: 90%' %> | |
5 | + <%= f.text_area :message_for_disabled_enterprise, :cols => 40, :style => 'width: 90%', :class => current_editor %> | |
8 | 6 | |
9 | 7 | <%= button_bar do %> |
10 | 8 | <%= submit_button(:save, _('Save')) %> | ... | ... |
app/views/admin_panel/site_info.html.erb
app/views/cms/_article.html.erb
app/views/cms/_blog.html.erb
... | ... | @@ -2,8 +2,6 @@ |
2 | 2 | |
3 | 3 | <h1><%= _('My Blog') %></h1> |
4 | 4 | |
5 | -<%= render :file => 'shared/tiny_mce' %> | |
6 | - | |
7 | 5 | <%= required f.text_field(:name, :size => '64', :maxlength => 150, :onchange => "updateUrlField(this, 'article_slug')") %> |
8 | 6 | |
9 | 7 | <%= render :partial => 'general_fields' %> |
... | ... | @@ -53,7 +51,7 @@ |
53 | 51 | %> |
54 | 52 | </div> |
55 | 53 | |
56 | -<%= labelled_form_field(_('Description:'), text_area(:article, :body, :rows => 10, :class => 'mceEditor')) %> | |
54 | +<%= labelled_form_field(_('Description:'), text_area(:article, :body, :rows => 10, :class => current_editor)) %> | |
57 | 55 | |
58 | 56 | <div id="blog-image-builder"> |
59 | 57 | <%= f.fields_for :image_builder, @article.image do |i| %> | ... | ... |
app/views/cms/_enterprise_homepage.html.erb
1 | -<%= render :file => 'shared/tiny_mce' %> | |
2 | - | |
3 | -<%= labelled_form_field(_('Text'), text_area(:article, 'body', :cols => 40, :style => 'width:99%', :class => 'mceEditor')) %> | |
1 | +<%= labelled_form_field(_('Text'), text_area(:article, 'body', :cols => 40, :style => 'width:99%', :class => current_editor)) %> | |
4 | 2 | ... | ... |
app/views/cms/_event.html.erb
1 | 1 | <%= required_fields_message %> |
2 | 2 | |
3 | -<%# TODO add Textile help here %> | |
4 | -<%= render :file => 'shared/tiny_mce' %> | |
5 | - | |
6 | 3 | <%= required f.text_field('name', :size => '64', :maxlength => 150) %> |
7 | 4 | |
8 | 5 | <%= render :partial => 'general_fields' %> |
... | ... | @@ -16,4 +13,4 @@ |
16 | 13 | |
17 | 14 | <%= labelled_form_field(_('Address:'), text_field(:article, :address)) %> |
18 | 15 | |
19 | -<%= render :partial => 'shared/lead_and_body', :locals => {:tiny_mce => true, :body_label => 'Information about the event:'} %> | |
16 | +<%= render :partial => 'shared/lead_and_body', :locals => {:body_label => 'Information about the event:'} %> | ... | ... |
app/views/cms/_forum.html.erb
... | ... | @@ -4,18 +4,16 @@ |
4 | 4 | |
5 | 5 | <%= required_fields_message %> |
6 | 6 | |
7 | -<%= render :file => 'shared/tiny_mce' %> | |
8 | - | |
9 | 7 | <%= required f.text_field(:name, :size => '64', :maxlength => 150, :onchange => "updateUrlField(this, 'article_slug')") %> |
10 | 8 | |
11 | 9 | <%= render :partial => 'general_fields' %> |
12 | 10 | |
13 | -<%= labelled_form_field(_('Description:'), text_area(:article, :body, :class => 'mceEditor', :cols => 64, :rows => 10)) %> | |
11 | +<%= labelled_form_field(_('Description:'), text_area(:article, :body, :class => current_editor, :cols => 64, :rows => 10)) %> | |
14 | 12 | |
15 | 13 | <%= labelled_form_field(_('Posts per page:'), f.select(:posts_per_page, Forum.posts_per_page_options)) %> |
16 | 14 | |
17 | 15 | <%= labelled_form_field(_('Has terms of use:'), check_box(:article, :has_terms_of_use))%> |
18 | 16 | |
19 | 17 | <div id="text_area_terms_of_use"> |
20 | - <%= labelled_form_field(_('Terms of use:'), text_area(:article, :terms_of_use, :class => 'mceEditor',:cols => 64, :rows => 10)) %> | |
18 | + <%= labelled_form_field(_('Terms of use:'), text_area(:article, :terms_of_use, :class => current_editor,:cols => 64, :rows => 10)) %> | |
21 | 19 | </div> | ... | ... |
app/views/cms/_raw_html_article.html.erb
... | ... | @@ -1,8 +0,0 @@ |
1 | -<%= required_fields_message %> | |
2 | - | |
3 | -<%= required labelled_form_field(_('Title'), text_field(:article, 'name', :size => '64', :maxlength => 150)) %> | |
4 | - | |
5 | -<%= render :partial => 'text_fields' %> | |
6 | -<%= render :partial => 'general_fields' %> | |
7 | -<%= render :partial => 'translatable' %> | |
8 | -<%= render :partial => 'shared/lead_and_body' %> |
... | ... | @@ -0,0 +1,10 @@ |
1 | +<%= required_fields_message %> | |
2 | + | |
3 | +<%= required labelled_form_field(_('Title'), text_field(:article, 'name', :size => '72', :maxlength => 150)) %> | |
4 | + | |
5 | +<%= render :partial => 'text_fields' %> | |
6 | +<%= render :partial => 'general_fields' %> | |
7 | +<%= render :partial => 'translatable' %> | |
8 | + | |
9 | +<%= render :partial => 'shared/lead_and_body' %> | |
10 | + | ... | ... |
app/views/cms/_text_editor_sidebar.html.erb
... | ... | @@ -7,7 +7,7 @@ |
7 | 7 | |
8 | 8 | <div class='header'><strong><%= _('Insert media') %></strong><%= button('vertical-toggle', _('Show/Hide'), '#') %></div> |
9 | 9 | |
10 | - <%= render(:partial => 'textile_quick_reference') if @article.is_a?(TextileArticle) %> | |
10 | + <%= render(:partial => 'textile_quick_reference') if @article.editor?(Article::Editor::TEXTILE) %> | |
11 | 11 | <div class='text-editor-sidebar-box' id='media-upload-box'> |
12 | 12 | <div id='media-upload-form'> |
13 | 13 | <%= form_tag({ :action => 'media_upload' }, :multipart => true) do %> | ... | ... |
app/views/cms/_textile_article.html.erb
... | ... | @@ -1,10 +0,0 @@ |
1 | -<%= required_fields_message %> | |
2 | - | |
3 | -<%# TODO add Textile help here %> | |
4 | - | |
5 | -<%= required labelled_form_field(_('Title'), text_field(:article, 'name', :size => '72', :maxlength => 150)) %> | |
6 | - | |
7 | -<%= render :partial => 'text_fields' %> | |
8 | -<%= render :partial => 'general_fields' %> | |
9 | -<%= render :partial => 'translatable' %> | |
10 | -<%= render :partial => 'shared/lead_and_body' %> |
app/views/cms/_tiny_mce_article.html.erb
... | ... | @@ -1,12 +0,0 @@ |
1 | -<%= required_fields_message %> | |
2 | - | |
3 | -<%= render :file => 'shared/tiny_mce' %> | |
4 | - | |
5 | -<div> | |
6 | - <%= required labelled_form_field(_('Title'), text_field(:article, 'name', :size => '64', :maxlength => 150)) %> | |
7 | - | |
8 | - <%= render :partial => 'text_fields' %> | |
9 | - <%= render :partial => 'general_fields' %> | |
10 | - <%= render :partial => 'translatable' %> | |
11 | - <%= render :partial => 'shared/lead_and_body', :locals => {:tiny_mce => true} %> | |
12 | -</div> |
app/views/cms/suggest_an_article.html.erb
... | ... | @@ -2,8 +2,6 @@ |
2 | 2 | |
3 | 3 | <%= required_fields_message %> |
4 | 4 | |
5 | -<%= render :file => 'shared/tiny_mce' %> | |
6 | - | |
7 | 5 | <%= labelled_form_for 'task' do |f| %> |
8 | 6 | |
9 | 7 | <%= required labelled_form_field(_('Title'), text_field('task[article]', 'name', :size => 50)) %> |
... | ... | @@ -17,7 +15,7 @@ |
17 | 15 | <%= required labelled_form_field(_('Email'), text_field(:task, 'email')) %> |
18 | 16 | <% end %> |
19 | 17 | |
20 | - <%= render :partial => 'shared/lead_and_body', :locals => {:tiny_mce => true, :object => 'task[article]'} %> | |
18 | + <%= render :partial => 'shared/lead_and_body', :locals => {:object => 'task[article]'} %> | |
21 | 19 | |
22 | 20 | <%= hidden_field_tag('back_to', @back_to) %> |
23 | 21 | ... | ... |
app/views/contact/new.html.erb
... | ... | @@ -25,8 +25,7 @@ |
25 | 25 | |
26 | 26 | <%= required f.text_field(:subject) %> |
27 | 27 | |
28 | - <%= render :file => 'shared/tiny_mce' %> | |
29 | - <%= required f.text_area(:message, :class => 'mceEditor') %> | |
28 | + <%= required f.text_area(:message, :class => current_editor) %> | |
30 | 29 | |
31 | 30 | <%= labelled_form_field check_box(:contact, :receive_a_copy) + _('I want to receive a copy of the message in my e-mail.'), '' %> |
32 | 31 | ... | ... |
app/views/email_templates/_form.html.erb
... | ... | @@ -19,8 +19,7 @@ |
19 | 19 | <%= @template_params_allowed %> |
20 | 20 | </div> |
21 | 21 | </div> |
22 | - <%= render :file => 'shared/tiny_mce' %> | |
23 | - <%= labelled_form_field(_('Body:'), f.text_area(:body, :class => 'mceEditor')) %> | |
22 | + <%= labelled_form_field(_('Body:'), f.text_area(:body, :class => current_editor)) %> | |
24 | 23 | </div> |
25 | 24 | |
26 | 25 | <div class="actions"> | ... | ... |
app/views/layouts/application-ng.html.erb
... | ... | @@ -35,6 +35,9 @@ |
35 | 35 | noosfero.profile = <%= (@profile.identifier if @profile).to_json.html_safe %> |
36 | 36 | </script> |
37 | 37 | |
38 | + <% if current_editor_is?(Article::Editor::TINY_MCE) %> | |
39 | + <%= render :file => 'shared/tiny_mce' %> | |
40 | + <% end %> | |
38 | 41 | </head> |
39 | 42 | <body class="<%= h body_classes %>"> |
40 | 43 | <a href="#content" id="link-go-content"><span><%= _("Go to the content") %></span></a> | ... | ... |
app/views/profile/_profile_wall.html.erb
1 | 1 | <h3><%= _("%s's wall") % @profile.name %></h3> |
2 | 2 | <div id='leave_scrap'> |
3 | 3 | <%= flash[:error] %> |
4 | - <%= form_remote_tag :url => {:controller => 'profile', :action => 'leave_scrap', :tab_action => 'wall' }, :update => 'profile_activities', :success => "jQuery('#leave_scrap_content').val('')", :complete => "jQuery('#leave_scrap_form').removeClass('loading').find('*').attr('disabled', false)", :loading => "jQuery('#leave_scrap_form').addClass('loading').find('*').attr('disabled', true)", :html => {:id => 'leave_scrap_form' } do %> | |
5 | - <%= limited_text_area :scrap, :content, 420, 'leave_scrap_content', :cols => 50, :rows => 2, :class => 'autogrow' %> | |
4 | + <%= form_remote_tag :url => {:controller => 'profile', :action => 'leave_scrap', :tab_action => 'wall' }, :update => 'profile_activities', :success => "jQuery('#leave_scrap_content').val(''); jQuery('#filter-followed').tokenInput('clear')", :complete => "jQuery('#leave_scrap_form').removeClass('loading').find('*').attr('disabled', false)", :loading => "jQuery('#leave_scrap_form').addClass('loading').find('*').attr('disabled', true)", :html => {:id => 'leave_scrap_form' } do %> | |
5 | + <%= limited_text_area :scrap, :content, 420, 'leave_scrap_content', :rows => 2, :class => 'autogrow' %> | |
6 | + <% if profile == user %> | |
7 | + <%= token_input_field_tag(:filter_followed, 'filter-followed', {:action => 'search_followed'}, {:theme => 'facebook', :placeholder => _('Filter followed, friends or group of friends to send them a private scrap...')}) %> | |
8 | + <% end %> | |
6 | 9 | <%= submit_button :new, _('Share') %> |
7 | 10 | <% end %> |
8 | 11 | </div> | ... | ... |
app/views/profile/send_mail.html.erb
... | ... | @@ -22,8 +22,7 @@ |
22 | 22 | |
23 | 23 | <%= labelled_form_field(_('Subject:'), f.text_field(:subject)) %> |
24 | 24 | |
25 | - <%= render :file => 'shared/tiny_mce' %> | |
26 | - <%= labelled_form_field(_('Body:'), f.text_area(:body, :class => 'mceEditor')) %> | |
25 | + <%= labelled_form_field(_('Body:'), f.text_area(:body, :class => 'body ' + current_editor)) %> | |
27 | 26 | |
28 | 27 | <%= submit_button(:send, _('Send')) %> |
29 | 28 | <%= button :cancel, _('Cancel e-mail'), :back %> | ... | ... |
app/views/profile_editor/_person.html.erb
... | ... | @@ -16,6 +16,8 @@ |
16 | 16 | </div> |
17 | 17 | </div> |
18 | 18 | |
19 | + <%= select_editor(_('Editor'), 'profile_data', 'editor', {}) %> | |
20 | + | |
19 | 21 | <%= safe_join(@plugins.dispatch(:profile_info_extra_contents).collect { |content| instance_exec(&content) }, "") %> |
20 | 22 | |
21 | 23 | <div class="formfieldline"> | ... | ... |
app/views/profile_editor/header_footer.html.erb
1 | -<%= render :file => 'shared/tiny_mce' %> | |
2 | - | |
3 | 1 | <h1><%= _('Editing header and footer') %></h1> |
4 | 2 | |
5 | 3 | <%= form_tag do %> |
... | ... | @@ -21,9 +19,9 @@ |
21 | 19 | </div> |
22 | 20 | <% end %> |
23 | 21 | <h2><%= _('Content for header ') %></h2> |
24 | - <%= text_area_tag(:custom_header, @header, :style => 'width: 100%; height: 150px;', :class => 'mceEditor') %> | |
22 | + <%= text_area_tag(:custom_header, @header, :style => 'width: 100%; height: 150px;', :class => current_editor) %> | |
25 | 23 | <h2><%= _('Content for footer') %></h2> |
26 | - <%= text_area_tag(:custom_footer, @footer, :style => 'width: 100%; height: 150px;', :class => 'mceEditor') %> | |
24 | + <%= text_area_tag(:custom_footer, @footer, :style => 'width: 100%; height: 150px;', :class => current_editor) %> | |
27 | 25 | <%= button_bar do %> |
28 | 26 | <%= submit_button(:save, _('Save')) %> |
29 | 27 | <%= button(:cancel, _('Cancel'), :action => 'index') %> | ... | ... |
app/views/profile_editor/welcome_page.html.erb
... | ... | @@ -8,7 +8,7 @@ |
8 | 8 | <%= _('Your welcome page will only be displayed if this options is selected.') %> |
9 | 9 | </div> |
10 | 10 | |
11 | - <%= f.text_area(:body, :cols => 40, :style => 'width: 100%', :class => 'mceEditor') %> | |
11 | + <%= f.text_area(:body, :cols => 40, :style => 'width: 100%', :class => current_editor) %> | |
12 | 12 | <div class='explanation'> |
13 | 13 | <%= _('This page will be displayed to the user after his signup with this template.') %> |
14 | 14 | </div> |
... | ... | @@ -17,5 +17,3 @@ |
17 | 17 | <%= submit_button('save', _('Save'), :cancel => @back_to) %> |
18 | 18 | <% end %> |
19 | 19 | <% end %> |
20 | - | |
21 | -<%= render :file => 'shared/tiny_mce' %> | ... | ... |
app/views/shared/_lead_and_body.html.erb
app/views/shared/tiny_mce.html.erb
... | ... | @@ -47,7 +47,9 @@ function tinymce_macros_setup(editor) { |
47 | 47 | tinymce.PluginManager.add('macrosPlugin', tinymce.plugins.MacrosPlugin); |
48 | 48 | |
49 | 49 | jQuery(document).ready(function () { |
50 | - <%= tinymce_init_js :mode => mode %> | |
50 | + <%= tinymce_init_js %> | |
51 | + <%= tinymce_init_js :mode => 'simple' %> | |
52 | + <%= tinymce_init_js :mode => 'restricted' %> | |
51 | 53 | }); |
52 | 54 | </script> |
53 | 55 | ... | ... |
app/views/tasks/_approve_article_accept_details.html.erb
1 | 1 | <%= task_email_template(_('Select an acceptance email template:'), @acceptance_email_templates, task) %> |
2 | 2 | |
3 | -<%= render :file => 'shared/tiny_mce' %> | |
4 | - | |
5 | 3 | <%= labelled_form_field(_('Create a link'), f.check_box(:create_link)) %> |
6 | 4 | |
7 | 5 | <%= labelled_form_field(_('Name for publishing'), f.text_field(:name)) %> |
8 | 6 | <%= select_profile_folder(_('Select the folder where the article must be published'), "tasks[#{task.id}][task][article_parent_id]", task.target) %> |
9 | 7 | <%= labelled_form_field(_('Highlight this article'), f.check_box(:highlighted)) %> |
10 | 8 | |
11 | -<% tiny = task.article && task.article.tiny_mce? ? {:tiny_mce => true} : {} %> | |
12 | -<%= render :partial => 'shared/lead_and_body', :locals => {:lead_id => task.id, :f => f}.merge(tiny)%> | |
9 | +<%= render :partial => 'shared/lead_and_body', :locals => {:lead_id => task.id, :f => f}%> | |
13 | 10 | |
14 | 11 | <%= labelled_form_field _('Comment for author'), f.text_field(:closing_statment, :style => 'width: 488px;') %> |
15 | 12 | ... | ... |
app/views/tasks/_suggest_article_accept_details.html.erb
1 | -<%= render :file => 'shared/tiny_mce' %> | |
2 | - | |
3 | 1 | <% unless task.requestor %> |
4 | 2 | <%= labelled_form_field(_("Sent by: "), f.text_field(:name)) %> |
5 | 3 | <p><%= label_tag(_("Email: %s") % task.email) %> </p> |
... | ... | @@ -14,5 +12,5 @@ |
14 | 12 | <%= labelled_form_field(_('Highlight this article'), a.check_box(:highlighted)) %> |
15 | 13 | |
16 | 14 | <%= a.hidden_field(:type) %> |
17 | - <%= render :partial => 'shared/lead_and_body', :locals => {:tiny_mce => true, :f => a, :lead_id => task.id} %> | |
15 | + <%= render :partial => 'shared/lead_and_body', :locals => {:f => a, :lead_id => task.id} %> | |
18 | 16 | <% end %> | ... | ... |
app/views/users/send_mail.html.erb
... | ... | @@ -2,7 +2,6 @@ |
2 | 2 | |
3 | 3 | <%= error_messages_for :mailing %> |
4 | 4 | |
5 | -<%= render :file => 'shared/tiny_mce' %> | |
6 | 5 | <%= form_for :mailing do |f| %> |
7 | 6 | <div class="recipients"> |
8 | 7 | <%= label_tag(_("Recipients: "), nil, { class: "formlabel" }) %> |
... | ... | @@ -14,7 +13,7 @@ |
14 | 13 | </div> |
15 | 14 | </div> |
16 | 15 | <%= labelled_form_field(_('Subject:'), f.text_field(:subject)) %> |
17 | - <%= labelled_form_field(_('Body:'), f.text_area(:body, :class => 'mceEditor')) %> | |
16 | + <%= labelled_form_field(_('Body:'), f.text_area(:body, :class => current_editor)) %> | |
18 | 17 | <%= submit_button(:send, _('Send')) %> |
19 | 18 | <%= button :cancel, _('Cancel e-mail'), :controller => 'users' %> |
20 | 19 | <% end %> | ... | ... |
db/migrate/20160809123835_add_people_and_article_editor.rb
0 → 100644
... | ... | @@ -0,0 +1,9 @@ |
1 | +class AddPeopleAndArticleEditor < ActiveRecord::Migration | |
2 | + def change | |
3 | + add_column :profiles, :editor, :string, :null => false, :default => Article::Editor::TINY_MCE | |
4 | + add_column :articles, :editor, :string, :null => false, :default => Article::Editor::TINY_MCE | |
5 | + Article.where(:type => 'TextileArticle').update_all(:type => 'TextArticle', :editor => Article::Editor::TEXTILE) | |
6 | + Article.where(:type => 'TinyMceArticle').update_all(:type => 'TextArticle', :editor => Article::Editor::TINY_MCE) | |
7 | + Article.where(:type => 'RawHTMLArticle').update_all(:type => 'TextArticle', :editor => Article::Editor::RAW_HTML) | |
8 | + end | |
9 | +end | ... | ... |
db/schema.rb
... | ... | @@ -11,7 +11,7 @@ |
11 | 11 | # |
12 | 12 | # It's strongly recommended that you check this file into your version control system. |
13 | 13 | |
14 | -ActiveRecord::Schema.define(version: 20160608123748) do | |
14 | +ActiveRecord::Schema.define(version: 20160809123835) do | |
15 | 15 | |
16 | 16 | # These are extensions that must be enabled in order to support this database |
17 | 17 | enable_extension "plpgsql" |
... | ... | @@ -168,6 +168,7 @@ ActiveRecord::Schema.define(version: 20160608123748) do |
168 | 168 | t.boolean "show_to_followers", default: true |
169 | 169 | t.integer "followers_count", default: 0 |
170 | 170 | t.boolean "archived", default: false |
171 | + t.string "editor", default: "tiny_mce", null: false | |
171 | 172 | end |
172 | 173 | |
173 | 174 | add_index "articles", ["comments_count"], name: "index_articles_on_comments_count", using: :btree |
... | ... | @@ -528,6 +529,11 @@ ActiveRecord::Schema.define(version: 20160608123748) do |
528 | 529 | t.datetime "updated_at" |
529 | 530 | end |
530 | 531 | |
532 | + create_table "private_scraps", force: :cascade do |t| | |
533 | + t.integer "person_id" | |
534 | + t.integer "scrap_id" | |
535 | + end | |
536 | + | |
531 | 537 | create_table "product_qualifiers", force: :cascade do |t| |
532 | 538 | t.integer "product_id" |
533 | 539 | t.integer "qualifier_id" |
... | ... | @@ -630,15 +636,16 @@ ActiveRecord::Schema.define(version: 20160608123748) do |
630 | 636 | t.boolean "is_template", default: false |
631 | 637 | t.integer "template_id" |
632 | 638 | t.string "redirection_after_login" |
633 | - t.integer "friends_count", default: 0, null: false | |
634 | - t.integer "members_count", default: 0, null: false | |
635 | - t.integer "activities_count", default: 0, null: false | |
639 | + t.integer "friends_count", default: 0, null: false | |
640 | + t.integer "members_count", default: 0, null: false | |
641 | + t.integer "activities_count", default: 0, null: false | |
636 | 642 | t.string "personal_website" |
637 | 643 | t.string "jabber_id" |
638 | 644 | t.integer "welcome_page_id" |
639 | 645 | t.boolean "allow_members_to_invite", default: true |
640 | 646 | t.boolean "invite_friends_only", default: false |
641 | 647 | t.boolean "secret", default: false |
648 | + t.string "editor", default: "tiny_mce", null: false | |
642 | 649 | end |
643 | 650 | |
644 | 651 | add_index "profiles", ["activities_count"], name: "index_profiles_on_activities_count", using: :btree | ... | ... |
features/edit_article.feature
... | ... | @@ -155,7 +155,7 @@ Feature: edit article |
155 | 155 | Given I am on joaosilva's control panel |
156 | 156 | And I follow "Manage Content" |
157 | 157 | And I follow "New content" |
158 | - When I follow "Text article with Textile markup language" | |
158 | + When I follow "Text article" | |
159 | 159 | Then I should see "Tag list" |
160 | 160 | When I fill in "Title" with "Article with tags" |
161 | 161 | And I fill in "Tag list" with "aurium, bug" |
... | ... | @@ -168,7 +168,7 @@ Feature: edit article |
168 | 168 | Given I am on joaosilva's control panel |
169 | 169 | And I follow "Manage Content" |
170 | 170 | When I follow "New content" |
171 | - When I follow "Text article with visual editor" | |
171 | + When I follow "Text article" | |
172 | 172 | And I fill in "Title" with "My Article" |
173 | 173 | And I press "Save" |
174 | 174 | Then I should see "My Article" |
... | ... | @@ -203,8 +203,8 @@ Feature: edit article |
203 | 203 | And I press "Save" |
204 | 204 | Then I should be on /joaosilva/my-folder |
205 | 205 | When I follow "New article" |
206 | - And I should see "Text article with visual editor" | |
207 | - And I follow "Text article with visual editor" | |
206 | + And I should see "Text article" | |
207 | + And I follow "Text article" | |
208 | 208 | And I fill in "Title" with "My Article" |
209 | 209 | And I press "Save" |
210 | 210 | Then I should see "My Article" |
... | ... | @@ -222,12 +222,11 @@ Feature: edit article |
222 | 222 | And I press "Save" |
223 | 223 | Then I should be on /joaosilva/my-folder |
224 | 224 | When I follow "New article" |
225 | - And I should see "Text article with visual editor" | |
226 | - And I follow "Text article with visual editor" | |
225 | + And I should see "Text article" | |
226 | + And I follow "Text article" | |
227 | 227 | And I follow "Cancel" within ".no-boxes" |
228 | 228 | Then I should be on /joaosilva/my-folder |
229 | 229 | |
230 | - @selenium | |
231 | 230 | Scenario: save and continue |
232 | 231 | Given I am on /joaosilva/save-the-whales |
233 | 232 | And I follow "Edit" |
... | ... | @@ -240,8 +239,8 @@ Feature: edit article |
240 | 239 | Given I am on joaosilva's control panel |
241 | 240 | When I follow "Manage Content" |
242 | 241 | And I follow "New content" |
243 | - And I should see "Text article with visual editor" | |
244 | - And I follow "Text article with visual editor" | |
242 | + And I should see "Text article" | |
243 | + And I follow "Text article" | |
245 | 244 | And I fill in "Title" with "My new article" |
246 | 245 | And I fill in "Text" with "text for the new article" |
247 | 246 | And I press "Save and continue" |
... | ... | @@ -287,7 +286,7 @@ Feature: edit article |
287 | 286 | Given I am on joaosilva's control panel |
288 | 287 | And I follow "Manage Content" |
289 | 288 | And I follow "New content" |
290 | - When I follow "Text article with visual editor" | |
289 | + When I follow "Text article" | |
291 | 290 | And I fill in "Title" with "My time testing Article" |
292 | 291 | And I fill in "Publish date" with "1980-11-15 20:37" |
293 | 292 | And I press "Save" | ... | ... |
features/forum.feature
... | ... | @@ -99,8 +99,8 @@ Feature: forum |
99 | 99 | And I check "Has terms of use:" |
100 | 100 | And I press "Save" |
101 | 101 | When I follow "New discussion topic" |
102 | - And I should see "Text article with visual editor" | |
103 | - And I follow "Text article with visual editor" | |
102 | + And I should see "Text article" | |
103 | + And I follow "Text article" | |
104 | 104 | And I fill in "Title" with "Topic" |
105 | 105 | And I press "Save" |
106 | 106 | And I am logged in as "mariasilva" | ... | ... |
features/media_panel_upload_files.feature
... | ... | @@ -8,7 +8,7 @@ Feature: uploads items on media panel |
8 | 8 | | joaosilva | Joao Silva | |
9 | 9 | And feature "media_panel" is enabled on environment |
10 | 10 | And I am logged in as "joaosilva" |
11 | - And I am on /myprofile/joaosilva/cms/new?type=TinyMceArticle | |
11 | + And I am on /myprofile/joaosilva/cms/new?type=TextArticle | |
12 | 12 | |
13 | 13 | Scenario: see media panel collapsed |
14 | 14 | Then I should see "Insert media" |
... | ... | @@ -123,7 +123,7 @@ Feature: uploads items on media panel |
123 | 123 | Given the following files |
124 | 124 | | owner | file | mime | |
125 | 125 | | joaosilva | other-pic.jpg | image/jpeg | |
126 | - When I go to /myprofile/joaosilva/cms/new?type=TinyMceArticle | |
126 | + When I go to /myprofile/joaosilva/cms/new?type=TextArticle | |
127 | 127 | And I follow "Show/Hide" |
128 | 128 | And I select "Recent media" from "parent_id" within "#published-media" |
129 | 129 | Then I should see div with title "other-pic.jpg" within ".items" |
... | ... | @@ -148,7 +148,7 @@ Feature: uploads items on media panel |
148 | 148 | | owner | file | mime | parent | |
149 | 149 | | joaosilva | rails.png | image/png | other-gallery | |
150 | 150 | | joaosilva | other-pic.jpg | image/jpeg | gallery | |
151 | - When I go to /myprofile/joaosilva/cms/new?type=TinyMceArticle | |
151 | + When I go to /myprofile/joaosilva/cms/new?type=TextArticle | |
152 | 152 | And I follow "Show/Hide" |
153 | 153 | And I select "joaosilva/Gallery" from "parent_id" within "#published-media" |
154 | 154 | Then I should see div with title "other-pic.jpg" within ".items" |
... | ... | @@ -165,7 +165,7 @@ Feature: uploads items on media panel |
165 | 165 | And the following files |
166 | 166 | | owner | file | mime | parent | |
167 | 167 | | joaosilva | other-pic.jpg | image/jpeg | gallery | |
168 | - When I go to /myprofile/joaosilva/cms/new?type=TinyMceArticle | |
168 | + When I go to /myprofile/joaosilva/cms/new?type=TextArticle | |
169 | 169 | And I follow "Show/Hide" |
170 | 170 | And I select "joaosilva/Gallery" from "parent_id" within "#published-media" |
171 | 171 | And I select "joaosilva/Gallery" from "parent_id" within "#media-upload-form" |
... | ... | @@ -187,7 +187,7 @@ Feature: uploads items on media panel |
187 | 187 | And the following files |
188 | 188 | | owner | file | mime | parent | |
189 | 189 | | joaosilva | rails.png | image/png | other-gallery | |
190 | - When I go to /myprofile/joaosilva/cms/new?type=TinyMceArticle | |
190 | + When I go to /myprofile/joaosilva/cms/new?type=TextArticle | |
191 | 191 | And I follow "Show/Hide" |
192 | 192 | And I select "Recent media" from "parent_id" within "#published-media" |
193 | 193 | And I fill in "Search" with "rails" within "#published-media" |
... | ... | @@ -227,7 +227,7 @@ Feature: uploads items on media panel |
227 | 227 | | joaosilva | other-pic.jpg | image/jpeg | my-gallery | |
228 | 228 | | joaosilva | rails.png | image/png | gallery | |
229 | 229 | | joaosilva | other-pic.jpg | image/jpeg | gallery | |
230 | - When I go to /myprofile/joaosilva/cms/new?type=TinyMceArticle | |
230 | + When I go to /myprofile/joaosilva/cms/new?type=TextArticle | |
231 | 231 | And I follow "Show/Hide" |
232 | 232 | And I should not see "View all" |
233 | 233 | And I attach the file "public/503.jpg" to "file" | ... | ... |
features/new_content_on_cms.feature
... | ... | @@ -15,8 +15,7 @@ Feature: create content on cms |
15 | 15 | |
16 | 16 | Scenario: list all content types |
17 | 17 | Given I follow "New content" |
18 | - Then I should see "Text article with visual editor" | |
19 | - And I should see "Text article with Textile markup" | |
18 | + Then I should see "Text article" | |
20 | 19 | And I should see "Folder" |
21 | 20 | And I should see "Blog" |
22 | 21 | And I should see "Uploaded file" |
... | ... | @@ -30,22 +29,6 @@ Feature: create content on cms |
30 | 29 | And I go to joaosilva's cms |
31 | 30 | Then I should see "My Folder" |
32 | 31 | |
33 | - Scenario: create a tiny_mce article | |
34 | - Given I follow "New content" | |
35 | - When I follow "Text article with visual editor" | |
36 | - And I fill in "Title" with "My tiny_mce article" | |
37 | - And I press "Save" | |
38 | - And I go to joaosilva's cms | |
39 | - Then I should see "My tiny_mce article" | |
40 | - | |
41 | - Scenario: create a textile article | |
42 | - Given I follow "New content" | |
43 | - When I follow "Text article with Textile markup" | |
44 | - And I fill in "Title" with "My textile article" | |
45 | - And I press "Save" | |
46 | - And I go to joaosilva's cms | |
47 | - Then I should see "My textile article" | |
48 | - | |
49 | 32 | Scenario: create a Blog |
50 | 33 | Given I follow "New content" |
51 | 34 | When I follow "Blog" | ... | ... |
features/profile_search.feature
... | ... | @@ -47,8 +47,8 @@ Feature: search inside a profile |
47 | 47 | And I go to joaosilva's profile |
48 | 48 | And I fill in "q" with "article" |
49 | 49 | And I press "Search" |
50 | - Then I should see "public article" within ".main-block" | |
51 | - And I should not see "private article" within ".main-block" | |
50 | + Then I should see "published article" within ".main-block" | |
51 | + And I should not see "unpublished article" within ".main-block" | |
52 | 52 | |
53 | 53 | Scenario: search on environment |
54 | 54 | Given I go to joaosilva's profile | ... | ... |
features/publish_article.feature
... | ... | @@ -60,11 +60,10 @@ Feature: publish article |
60 | 60 | And I am on mariasilva's control panel |
61 | 61 | And I follow "Manage Content" |
62 | 62 | And I follow "New content" |
63 | - And I should see "Text article with Textile markup language" | |
64 | - And I follow "Text article with Textile markup language" | |
63 | + And I should see "Text article" | |
64 | + And I follow "Text article" | |
65 | 65 | And I fill in the following: |
66 | 66 | | Title | Sample Article | |
67 | - | Text | this is Maria's first published article | | |
68 | 67 | And I press "Save" |
69 | 68 | And I follow "Spread" |
70 | 69 | And I type in "Sample Community" into autocomplete list "search-communities-to-publish" and I choose "Sample Community" | ... | ... |
features/search_contents.feature
... | ... | @@ -22,7 +22,6 @@ Feature: search contents |
22 | 22 | Then I should see "whales and dolphins" within ".search-text-article-item" |
23 | 23 | And I should see "whales and dolphins" within ".only-one-result-box" |
24 | 24 | And I should not see "bees and butterflies" |
25 | - And The page should contain ".icon-content-textile-article" | |
26 | 25 | When I follow "whales and dolphins" |
27 | 26 | Then I should be on article "whales and dolphins" |
28 | 27 | ... | ... |
features/secret_community.feature
... | ... | @@ -52,7 +52,7 @@ Feature: Use a secret community |
52 | 52 | And I go to mycommunity's control panel |
53 | 53 | And I follow "Manage Content" |
54 | 54 | And I follow "New content" |
55 | - And I follow "Text article with visual editor" | |
55 | + And I follow "Text article" | |
56 | 56 | And I fill in "Title" with "My public article" |
57 | 57 | And I choose "Public" |
58 | 58 | And I press "Save and continue" | ... | ... |
features/step_definitions/noosfero_steps.rb
... | ... | @@ -101,7 +101,7 @@ end |
101 | 101 | |
102 | 102 | Given /^the following (articles|events|blogs|folders|forums|galleries|uploaded files|rss feeds)$/ do |content, table| |
103 | 103 | klass = { |
104 | - 'articles' => TextileArticle, | |
104 | + 'articles' => TextArticle, | |
105 | 105 | 'events' => Event, |
106 | 106 | 'blogs' => Blog, |
107 | 107 | 'folders' => Folder, |
... | ... | @@ -118,6 +118,7 @@ Given /^the following (articles|events|blogs|folders|forums|galleries|uploaded f |
118 | 118 | language = item.delete("language") |
119 | 119 | category = item.delete("category") |
120 | 120 | filename = item.delete("filename") |
121 | + mime = item.delete("mime") || 'binary/octet-stream' | |
121 | 122 | translation_of_id = nil |
122 | 123 | if item["translation_of"] |
123 | 124 | if item["translation_of"] != "nil" |
... | ... | @@ -131,7 +132,7 @@ Given /^the following (articles|events|blogs|folders|forums|galleries|uploaded f |
131 | 132 | :language => language, |
132 | 133 | :translation_of_id => translation_of_id) |
133 | 134 | if !filename.blank? |
134 | - item.merge!(:uploaded_data => fixture_file_upload("/files/#{filename}", 'binary/octet-stream')) | |
135 | + item.merge!(:uploaded_data => fixture_file_upload("/files/#{filename}", mime)) | |
135 | 136 | end |
136 | 137 | result = klass.new(item) |
137 | 138 | if !parent.blank? |
... | ... | @@ -178,7 +179,7 @@ Given /^the following articles? with images?$/ do |table| |
178 | 179 | img_tag = "<img " |
179 | 180 | img.each { |attr, value| img_tag += "#{attr}=\"#{value}\" " } |
180 | 181 | img_tag += "/>" |
181 | - article = TinyMceArticle.new(:profile => owner, :name => item[:name], :body => img_tag) | |
182 | + article = TextArticle.new(:profile => owner, :name => item[:name], :body => img_tag) | |
182 | 183 | if item[:parent] |
183 | 184 | article.parent = Article.find_by slug: item[:parent] |
184 | 185 | end |
... | ... | @@ -366,6 +367,10 @@ Then /^The page should not contain "(.*)"$/ do |selector| |
366 | 367 | page.should have_no_css("#{selector}") |
367 | 368 | end |
368 | 369 | |
370 | +Then /^The page should contain only (\d+) "(.*)"$/ do |count, selector| | |
371 | + page.should have_css(selector, :count => count) | |
372 | +end | |
373 | + | |
369 | 374 | Given /^the mailbox is empty$/ do |
370 | 375 | ActionMailer::Base.deliveries = [] |
371 | 376 | end |
... | ... | @@ -653,6 +658,15 @@ Given /^the environment is configured to (.*) after signup$/ do |option| |
653 | 658 | environment.save |
654 | 659 | end |
655 | 660 | |
661 | +When /^I click "(.*?)"$/ do |selector| | |
662 | + find(selector).click | |
663 | +end | |
664 | + | |
665 | +Then /^the element "(.*)" has class "(.*)"$/ do |el_selector, el_class| | |
666 | + class_list = find(el_selector)[:class].split(' ') | |
667 | + class_list.should include(el_class) | |
668 | +end | |
669 | + | |
656 | 670 | When /^wait for the captcha signup time$/ do |
657 | 671 | environment = Environment.default |
658 | 672 | sleep environment.min_signup_delay + 1 |
... | ... | @@ -671,3 +685,7 @@ Given /^the field (.*) is public for all users$/ do |field| |
671 | 685 | person.save! |
672 | 686 | end |
673 | 687 | end |
688 | + | |
689 | +When(/^I press "(.*?)" by selector$/) do |selector| | |
690 | + page.execute_script("jQuery('#{selector}').click();") | |
691 | +end | ... | ... |
features/tiny_mce.feature
... | ... | @@ -10,7 +10,7 @@ Feature: Create tinyMCE article |
10 | 10 | |
11 | 11 | @selenium |
12 | 12 | Scenario: mce complete mode should show on message creation |
13 | - Given I am on /myprofile/joaosilva/cms/new?type=TinyMceArticle | |
13 | + Given I am on /myprofile/joaosilva/cms/new?type=TextArticle | |
14 | 14 | Then The tinymce "toolbar1" should be "fullscreen | insertfile undo redo | copy paste | bold italic underline | styleselect fontsizeselect | forecolor backcolor | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image" |
15 | 15 | And The tinymce "menubar" should be "edit insert view tools" |
16 | 16 | And The tinymce "toolbar2" should contain "print preview code media | table" | ... | ... |
lib/file_presenter.rb
... | ... | @@ -124,3 +124,8 @@ end |
124 | 124 | Dir.glob(File.join('app', 'presenters', '*.rb')) do |file| |
125 | 125 | load file |
126 | 126 | end |
127 | + | |
128 | +# Preload FilePresenters from plugins to allow `FilePresenter.for()` to work | |
129 | +Dir.glob(File.join('plugins', '*', 'lib', 'presenters', '*.rb')) do |file| | |
130 | + load file | |
131 | +end | ... | ... |
lib/noosfero/plugin/settings.rb
... | ... | @@ -10,7 +10,8 @@ class Noosfero::Plugin::Settings |
10 | 10 | end |
11 | 11 | |
12 | 12 | def settings |
13 | - @base.settings["#{@plugin.public_name}_plugin".to_sym] ||= {} | |
13 | + settings_field = @base.class.settings_field | |
14 | + @base.send(settings_field)["#{@plugin.public_name}_plugin".to_sym] ||= {} | |
14 | 15 | end |
15 | 16 | |
16 | 17 | def method_missing(method, *args, &block) | ... | ... |
plugins/admin_notifications/views/shared/_form.html.erb
1 | 1 | <div class="notification-plugin-form"> |
2 | 2 | |
3 | - <% abstract_options = {:value => @notification.message, :style => 'width: 100%; height: 200px;', :class => 'mceEditor'} %> | |
3 | + <% abstract_options = {:value => @notification.message, :style => 'width: 100%; height: 200px;', :class => current_editor('restricted')} %> | |
4 | 4 | |
5 | 5 | <%= button :back, _('Back'), :controller => 'admin_notifications_plugin_admin' %> |
6 | 6 | |
7 | 7 | <%= form_for :notifications do |f| %> |
8 | 8 | |
9 | - <%= render :file => 'shared/tiny_mce', :locals => {:mode => 'restricted'} %> | |
10 | - | |
11 | 9 | <%= labelled_form_field(_("Optional Title:"), f.text_field(:title, value: @notification.title)) %> |
12 | 10 | |
13 | 11 | <%= labelled_form_field(_("Enter your message here:"), f.text_area(:message, abstract_options)) %> | ... | ... |
plugins/comment_paragraph/lib/comment_paragraph_plugin/macros/allow_comment.rb
1 | 1 | class Application < Rails::Application |
2 | - config.action_view.sanitized_allowed_attributes << 'data-macro-paragraph_uuid' | |
2 | + config.action_view.sanitized_allowed_attributes << 'data-macro-paragraph_uuid' unless config.action_view.sanitized_allowed_attributes.include?('data-macro-paragraph_uuid') | |
3 | 3 | end |
4 | 4 | |
5 | 5 | class CommentParagraphPlugin::AllowComment < Noosfero::Plugin::Macro | ... | ... |
plugins/comment_paragraph/test/unit/article_test.rb
... | ... | @@ -5,7 +5,7 @@ class ArticleTest < ActiveSupport::TestCase |
5 | 5 | |
6 | 6 | def setup |
7 | 7 | @profile = fast_create(Community) |
8 | - @article = fast_create(TinyMceArticle, :profile_id => profile.id) | |
8 | + @article = fast_create(TextArticle, :profile_id => profile.id) | |
9 | 9 | @environment = Environment.default |
10 | 10 | @environment.enable_plugin(CommentParagraphPlugin) |
11 | 11 | end | ... | ... |
plugins/comment_paragraph/test/unit/discussion_block_test.rb
... | ... | @@ -74,7 +74,7 @@ class DiscussionBlockTest < ActiveSupport::TestCase |
74 | 74 | b.save |
75 | 75 | a1 = fast_create(CommentParagraphPlugin::Discussion, :profile_id => community.id) |
76 | 76 | fast_create(Event, :profile_id => community.id) |
77 | - fast_create(TinyMceArticle, :profile_id => community.id) | |
77 | + fast_create(TextArticle, :profile_id => community.id) | |
78 | 78 | a2 = fast_create(CommentParagraphPlugin::Discussion, :profile_id => community.id) |
79 | 79 | assert_equivalent [a1, a2], b.discussions |
80 | 80 | end |
... | ... | @@ -183,7 +183,7 @@ class DiscussionBlockViewTest < ActionView::TestCase |
183 | 183 | b.save |
184 | 184 | a1 = fast_create(CommentParagraphPlugin::Discussion, :profile_id => community.id) |
185 | 185 | fast_create(Event, :profile_id => community.id) |
186 | - fast_create(TinyMceArticle, :profile_id => community.id) | |
186 | + fast_create(TextArticle, :profile_id => community.id) | |
187 | 187 | a2 = fast_create(CommentParagraphPlugin::Discussion, :profile_id => community.id) |
188 | 188 | assert_equivalent [a2.id, a1.id], b.api_content['articles'].map {|a| a[:id]} |
189 | 189 | end | ... | ... |
plugins/comment_paragraph/test/unit/tinymce_helper_test.rb
... | ... | @@ -7,6 +7,7 @@ class TinymceHelperTest < ActiveSupport::TestCase |
7 | 7 | def setup |
8 | 8 | expects(:top_url).returns('/') |
9 | 9 | expects(:tinymce_language).returns('en') |
10 | + expects(:current_editor).returns(Article::Editor::TINY_MCE) | |
10 | 11 | @plugins = mock |
11 | 12 | @plugins.expects(:dispatch).returns([]).at_least_once |
12 | 13 | @environment = Environment.default | ... | ... |
plugins/community_track/lib/community_track_plugin/step.rb
... | ... | @@ -61,7 +61,7 @@ class CommunityTrackPlugin::Step < Folder |
61 | 61 | end |
62 | 62 | |
63 | 63 | def enabled_tools |
64 | - tools = [TinyMceArticle, Forum] | |
64 | + tools = [TextArticle, Forum] | |
65 | 65 | tools << CommunityHubPlugin::Hub if environment.plugin_enabled?('CommunityHubPlugin') |
66 | 66 | tools << ProposalsDiscussionPlugin::Discussion if environment.plugin_enabled?('ProposalsDiscussionPlugin') |
67 | 67 | tools << PairwisePlugin::PairwiseContent if environment.plugin_enabled?('PairwisePlugin') | ... | ... |
plugins/community_track/test/functional/community_track_plugin_content_viewer_controller_test.rb
... | ... | @@ -5,7 +5,7 @@ class ContentViewerControllerTest < ActionController::TestCase |
5 | 5 | def setup |
6 | 6 | @profile = Community.create!(:name => 'Sample community', :identifier => 'sample-community') |
7 | 7 | @track = create_track('track', @profile) |
8 | - @step = CommunityTrackPlugin::Step.create!(:name => 'step1', :body => 'body', :profile => @profile, :parent => @track, :published => false, :end_date => DateTime.now.end_of_day, :start_date => DateTime.now.beginning_of_day, :tool_type => TinyMceArticle.name) | |
8 | + @step = CommunityTrackPlugin::Step.create!(:name => 'step1', :body => 'body', :profile => @profile, :parent => @track, :published => false, :end_date => DateTime.now.end_of_day, :start_date => DateTime.now.beginning_of_day, :tool_type => TextArticle.name) | |
9 | 9 | |
10 | 10 | user = create_user('testinguser') |
11 | 11 | login_as(user.login) |
... | ... | @@ -49,7 +49,7 @@ class ContentViewerControllerTest < ActionController::TestCase |
49 | 49 | end |
50 | 50 | |
51 | 51 | should 'show tools for a step' do |
52 | - TinyMceArticle.create!(:profile => @profile, :name => 'article', :parent => @step) | |
52 | + TextArticle.create!(:profile => @profile, :name => 'article', :parent => @step) | |
53 | 53 | get :view_page, @step.url |
54 | 54 | assert_tag :tag => 'div', :attributes => { :class => 'tools' }, :descendant => { :tag => 'div', :attributes => { :class => 'item' } } |
55 | 55 | end | ... | ... |
plugins/community_track/test/unit/community_track_plugin/step_test.rb
... | ... | @@ -237,7 +237,7 @@ class StepTest < ActiveSupport::TestCase |
237 | 237 | end |
238 | 238 | |
239 | 239 | should 'return enabled tools for a step' do |
240 | - assert_includes @step.enabled_tools, TinyMceArticle | |
240 | + assert_includes @step.enabled_tools, TextArticle | |
241 | 241 | assert_includes @step.enabled_tools, Forum |
242 | 242 | end |
243 | 243 | ... | ... |
plugins/community_track/views/cms/community_track_plugin/_step.html.erb
1 | 1 | <%= required_fields_message %> |
2 | 2 | |
3 | -<%= render :file => 'shared/tiny_mce' %> | |
4 | - | |
5 | 3 | <div> |
6 | 4 | <%= required f.text_field('name', :size => '64', :maxlength => 150) %> |
7 | 5 | <%= labelled_form_field(_('Period'), ( |
... | ... | @@ -19,4 +17,4 @@ |
19 | 17 | |
20 | 18 | <%= labelled_form_field check_box(:article, :hidden) + _('Hidden Step'), '' %> |
21 | 19 | |
22 | -<%= render :partial => 'shared/lead_and_body', :locals => {:tiny_mce => true, :body_label => 'Description:'} %> | |
20 | +<%= render :partial => 'shared/lead_and_body', :locals => {:body_label => 'Description:'} %> | ... | ... |
plugins/community_track/views/cms/community_track_plugin/_track.html.erb
1 | 1 | <div class='community-track'> |
2 | 2 | <%= required_fields_message %> |
3 | 3 | |
4 | - <%= render :file => 'shared/tiny_mce' %> | |
5 | - | |
6 | 4 | <div> |
7 | 5 | <%= required labelled_form_field(c_('Title'), text_field(:article, 'name', :size => '64', :maxlength => 150)) %> |
8 | 6 | </div> |
9 | 7 | |
10 | - <%= render :partial => 'shared/lead_and_body', :locals => {:tiny_mce => true, :body_label => 'Description:'} %> | |
8 | + <%= render :partial => 'shared/lead_and_body', :locals => {:body_label => 'Description:'} %> | |
11 | 9 | |
12 | 10 | <div> |
13 | 11 | <%= labelled_form_field(_('Goals:'), text_area(:article, :goals, :rows => 3, :cols => 64)) %> | ... | ... |
plugins/context_content/lib/context_content_plugin/context_content_block.rb
... | ... | @@ -22,7 +22,7 @@ class ContextContentPlugin::ContextContentBlock < Block |
22 | 22 | end |
23 | 23 | |
24 | 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 | 26 | checked_types = types.map {|t| t.constantize} |
27 | 27 | checked_types + (@available_content_types - checked_types) |
28 | 28 | end | ... | ... |
plugins/context_content/test/functional/content_viewer_controller_test.rb
... | ... | @@ -8,7 +8,7 @@ class ContentViewerControllerTest < ActionController::TestCase |
8 | 8 | |
9 | 9 | box = Box.create!(:owner => @profile) |
10 | 10 | @block = ContextContentPlugin::ContextContentBlock.new(:box_id => box.id) |
11 | - @block.types = ['TinyMceArticle'] | |
11 | + @block.types = ['TextArticle'] | |
12 | 12 | @block.limit = 1 |
13 | 13 | @block.title = "New Context Block" |
14 | 14 | @block.save! |
... | ... | @@ -21,7 +21,7 @@ class ContentViewerControllerTest < ActionController::TestCase |
21 | 21 | end |
22 | 22 | |
23 | 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 | 25 | get :view_page, @page.url |
26 | 26 | assert_tag 'div', :attributes => {:id => "context_content_#{@block.id}", :class => 'contents'} |
27 | 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 | 31 | should 'display context content block title if it is not configured to use_parent_title' do |
32 | 32 | @block.use_parent_title = false |
33 | 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 | 35 | get :view_page, @page.url |
36 | 36 | assert_tag 'h3', :attributes => {:class => 'block-title'}, :content => @block.title |
37 | 37 | assert_no_tag 'h3', :attributes => {:class => 'block-title'}, :content => @page.name |
... | ... | @@ -40,15 +40,15 @@ class ContentViewerControllerTest < ActionController::TestCase |
40 | 40 | should 'display context content with folder title if it is configured to use_parent_title' do |
41 | 41 | @block.use_parent_title = true |
42 | 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 | 44 | get :view_page, @page.url |
45 | 45 | assert_tag 'h3', :attributes => {:class => 'block-title'}, :content => @page.name |
46 | 46 | assert_no_tag 'h3', :attributes => {:class => 'block-title'}, :content => @block.title |
47 | 47 | end |
48 | 48 | |
49 | 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 | 52 | get :view_page, @page.url |
53 | 53 | assert_tag 'div', :attributes => {:id => "context_content_#{@block.id}", :class => 'contents'} |
54 | 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 | 9 | box = create(Box, :owner_type => 'Profile', :owner_id => @profile.id) |
10 | 10 | @block = ContextContentPlugin::ContextContentBlock.new |
11 | 11 | @block.box = box |
12 | - @block.types = ['TinyMceArticle'] | |
12 | + @block.types = ['TextArticle'] | |
13 | 13 | @block.limit = 1 |
14 | 14 | owner = create_user('block-owner').person |
15 | 15 | @block.box = owner.boxes.last |
... | ... | @@ -23,14 +23,14 @@ class ContextContentPluginProfileControllerTest < ActionController::TestCase |
23 | 23 | end |
24 | 24 | |
25 | 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 | 27 | xhr :get, :view_content, :id => @block.id, :article_id => @page.id, :page => 2, :profile => @profile.identifier |
28 | 28 | assert_response 500 |
29 | 29 | end |
30 | 30 | |
31 | 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 | 34 | xhr :get, :view_content, :id => @block.id, :article_id => @page.id, :page => 2, :profile => @profile.identifier |
35 | 35 | assert_response :success |
36 | 36 | assert_match /context_content_#{@block.id}/, @response.body |
... | ... | @@ -39,7 +39,7 @@ class ContextContentPluginProfileControllerTest < ActionController::TestCase |
39 | 39 | end |
40 | 40 | |
41 | 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 | 43 | xhr :get, :view_content, :id => @block.id, :article_id => @page.id, :page => 2, :profile => @profile.identifier |
44 | 44 | assert_no_match /context_content_more_#{@block.id}/, @response.body |
45 | 45 | end | ... | ... |
plugins/context_content/test/functional/profile_design_controller_test.rb
... | ... | @@ -13,7 +13,7 @@ class ProfileDesignControllerTest < ActionController::TestCase |
13 | 13 | |
14 | 14 | box = Box.create!(:owner => @profile) |
15 | 15 | @block = ContextContentPlugin::ContextContentBlock.new(:box_id => box.id) |
16 | - @block.types = ['TinyMceArticle'] | |
16 | + @block.types = ['TextArticle'] | |
17 | 17 | @block.limit = 1 |
18 | 18 | @block.save! |
19 | 19 | |
... | ... | @@ -38,11 +38,11 @@ class ProfileDesignControllerTest < ActionController::TestCase |
38 | 38 | @block.show_parent_content = false |
39 | 39 | @block.save! |
40 | 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 | 42 | @block.reload |
43 | 43 | assert_equal 'context', @block.title |
44 | 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 | 46 | end |
47 | 47 | |
48 | 48 | end | ... | ... |
plugins/context_content/test/unit/context_content_block_test.rb
... | ... | @@ -5,7 +5,7 @@ class ContextContentBlockTest < ActiveSupport::TestCase |
5 | 5 | def setup |
6 | 6 | Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([]) |
7 | 7 | @block = ContextContentPlugin::ContextContentBlock.create! |
8 | - @block.types = ['TinyMceArticle'] | |
8 | + @block.types = ['TextArticle'] | |
9 | 9 | end |
10 | 10 | |
11 | 11 | should 'describe itself' do |
... | ... | @@ -22,13 +22,13 @@ class ContextContentBlockTest < ActiveSupport::TestCase |
22 | 22 | |
23 | 23 | should 'return children of page' do |
24 | 24 | folder = fast_create(Folder) |
25 | - article = fast_create(TinyMceArticle, :parent_id => folder.id) | |
25 | + article = fast_create(TextArticle, :parent_id => folder.id) | |
26 | 26 | assert_equal [article], @block.contents(folder) |
27 | 27 | end |
28 | 28 | |
29 | 29 | should 'return parent name of the contents' do |
30 | 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 | 32 | assert_equal folder.name, @block.parent_title([article]) |
33 | 33 | end |
34 | 34 | |
... | ... | @@ -39,40 +39,40 @@ class ContextContentBlockTest < ActiveSupport::TestCase |
39 | 39 | should 'limit number of children to display' do |
40 | 40 | @block.limit = 2 |
41 | 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 | 45 | assert_equal 2, @block.contents(folder).length |
46 | 46 | end |
47 | 47 | |
48 | 48 | should 'show contents for next page' do |
49 | 49 | @block.limit = 2 |
50 | 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 | 54 | assert_equal [article3], @block.contents(folder, 2) |
55 | 55 | end |
56 | 56 | |
57 | 57 | should 'show parent contents for next page' do |
58 | 58 | @block.limit = 2 |
59 | 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 | 63 | assert_equal [article3], @block.contents(article1, 2) |
64 | 64 | end |
65 | 65 | |
66 | 66 | should 'return parent children if page has no children' do |
67 | 67 | folder = fast_create(Folder) |
68 | - article = fast_create(TinyMceArticle, :parent_id => folder.id) | |
68 | + article = fast_create(TextArticle, :parent_id => folder.id) | |
69 | 69 | assert_equal [article], @block.contents(article) |
70 | 70 | end |
71 | 71 | |
72 | 72 | should 'do not return parent children if show_parent_content is false' do |
73 | 73 | @block.show_parent_content = false |
74 | 74 | folder = fast_create(Folder) |
75 | - article = fast_create(TinyMceArticle, :parent_id => folder.id) | |
75 | + article = fast_create(TextArticle, :parent_id => folder.id) | |
76 | 76 | assert_equal [], @block.contents(article) |
77 | 77 | end |
78 | 78 | |
... | ... | @@ -82,13 +82,13 @@ class ContextContentBlockTest < ActiveSupport::TestCase |
82 | 82 | end |
83 | 83 | |
84 | 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 | 87 | end |
88 | 88 | |
89 | 89 | should 'return available content types' do |
90 | 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 | 92 | end |
93 | 93 | |
94 | 94 | should 'return first 2 content types' do |
... | ... | @@ -120,7 +120,7 @@ class ContextContentBlockTest < ActiveSupport::TestCase |
120 | 120 | Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([SomePlugin.new]) |
121 | 121 | |
122 | 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 | 124 | end |
125 | 125 | |
126 | 126 | should 'return box owner on profile method call' do |
... | ... | @@ -144,7 +144,7 @@ class ContextContentBlockViewTest < ActionView::TestCase |
144 | 144 | def setup |
145 | 145 | Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([]) |
146 | 146 | @block = ContextContentPlugin::ContextContentBlock.create! |
147 | - @block.types = ['TinyMceArticle'] | |
147 | + @block.types = ['TextArticle'] | |
148 | 148 | end |
149 | 149 | |
150 | 150 | should 'render nothing if it has no content to show' do |
... | ... | @@ -153,7 +153,7 @@ class ContextContentBlockViewTest < ActionView::TestCase |
153 | 153 | |
154 | 154 | should 'render context content block view' do |
155 | 155 | @page = fast_create(Folder) |
156 | - article = fast_create(TinyMceArticle, :parent_id => @page.id) | |
156 | + article = fast_create(TextArticle, :parent_id => @page.id) | |
157 | 157 | contents = [article] |
158 | 158 | @block.use_parent_title = true |
159 | 159 | |
... | ... | @@ -178,9 +178,9 @@ class ContextContentBlockViewTest < ActionView::TestCase |
178 | 178 | should 'display pagination links if it has more than one page' do |
179 | 179 | @block.limit = 2 |
180 | 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 | 184 | contents = [article1, article2, article3] |
185 | 185 | contents.each do |article| |
186 | 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 | 180 | form = CustomFormsPlugin::Form.create!(:profile => profile, :name => 'Free Software') |
181 | 181 | |
182 | 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 | 186 | end |
186 | 187 | |
187 | 188 | should 'export submissions as csv' do | ... | ... |
plugins/custom_forms/views/custom_forms_plugin_myprofile/_form.html.erb
1 | 1 | <% self.extend(CustomFormsPlugin::Helper) %> |
2 | -<%= render :file => 'shared/tiny_mce', :locals => {:mode => 'simple'} %> | |
3 | 2 | |
4 | 3 | <%= error_messages_for :form %> |
5 | 4 | <%= required labelled_form_field _('Name'), f.text_field(:name) %> |
... | ... | @@ -17,7 +16,7 @@ |
17 | 16 | <%= labelled_check_box _('Triggered after membership'), 'form[on_membership]', '1', @form.on_membership %> |
18 | 17 | </p> |
19 | 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 | 21 | <h2><%= c_('Fields') %></h2> |
23 | 22 | ... | ... |
plugins/delivery/views/delivery_plugin/admin_method/_edit.html.slim
... | ... | @@ -12,7 +12,7 @@ |
12 | 12 | = labelled_field f, :name, t('delivery_plugin.models.method.name'), f.text_field(:name), |
13 | 13 | help: t('delivery_plugin.models.method.name_help') |
14 | 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 | 17 | fieldset |
18 | 18 | legend= t'delivery_plugin.models.method.costs_legend' |
... | ... | @@ -34,5 +34,3 @@ |
34 | 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 | 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 | 24 | {:value => 'title', :checked => true}, |
25 | 25 | {:value => 'abstract', :checked => true}] |
26 | 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 | 28 | settings_items :order_by_recent, :type => :boolean, :default => :true |
29 | 29 | settings_items :content_with_translations, :type => :boolean, :default => :true |
30 | 30 | settings_items :limit_to_show, :type => :integer, :default => 6 |
... | ... | @@ -61,7 +61,7 @@ class DisplayContentBlock < Block |
61 | 61 | end |
62 | 62 | |
63 | 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 | 65 | checked_types = types.map {|t| t.constantize} |
66 | 66 | checked_types + (@available_content_types - checked_types) |
67 | 67 | end |
... | ... | @@ -108,7 +108,7 @@ class DisplayContentBlock < Block |
108 | 108 | @parent_nodes ||= self.holder.articles.where(:id => nodes).map { |article| get_parent(article) }.compact.flatten |
109 | 109 | end |
110 | 110 | |
111 | - VALID_CONTENT = ['RawHTMLArticle', 'TextArticle', 'TextileArticle', 'TinyMceArticle', 'Folder', 'Blog', 'Forum'] | |
111 | + VALID_CONTENT = ['TextArticle', 'Folder', 'Blog', 'Forum'] | |
112 | 112 | |
113 | 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 | 39 | |
40 | 40 | should 'index action returns an json with node content' do |
41 | 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 | 44 | get :index, :block_id => block.id |
45 | 45 | json_response = ActiveSupport::JSON.decode(@response.body) |
... | ... | @@ -51,7 +51,7 @@ class DisplayContentPluginAdminControllerTest < ActionController::TestCase |
51 | 51 | |
52 | 52 | should 'index action returns an json with node checked if the node is in the nodes list' do |
53 | 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 | 55 | block.nodes= [article.id] |
56 | 56 | block.save! |
57 | 57 | |
... | ... | @@ -67,8 +67,8 @@ class DisplayContentPluginAdminControllerTest < ActionController::TestCase |
67 | 67 | should 'index action returns an json with node undetermined if the node is in the parent nodes list' do |
68 | 68 | Article.delete_all |
69 | 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 | 72 | block.nodes = [article.id] |
73 | 73 | block.save! |
74 | 74 | |
... | ... | @@ -81,7 +81,7 @@ class DisplayContentPluginAdminControllerTest < ActionController::TestCase |
81 | 81 | should 'index action returns an json with node closed if the node has article with children' do |
82 | 82 | Article.delete_all |
83 | 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 | 86 | get :index, :block_id => block.id |
87 | 87 | json_response = ActiveSupport::JSON.decode(@response.body) |
... | ... | @@ -95,8 +95,8 @@ class DisplayContentPluginAdminControllerTest < ActionController::TestCase |
95 | 95 | should 'index action returns an json with all the children nodes if some parent is in the parents list' do |
96 | 96 | Article.delete_all |
97 | 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 | 100 | block.checked_nodes= {a1.id => true} |
101 | 101 | block.save! |
102 | 102 | |
... | ... | @@ -118,9 +118,9 @@ class DisplayContentPluginAdminControllerTest < ActionController::TestCase |
118 | 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 | 119 | Article.delete_all |
120 | 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 | 124 | block.checked_nodes= {a2.id => true, a3.id => true} |
125 | 125 | block.save! |
126 | 126 | |
... | ... | @@ -148,9 +148,9 @@ class DisplayContentPluginAdminControllerTest < ActionController::TestCase |
148 | 148 | should 'index action returns an json without children nodes if the parent is not in the parents list' do |
149 | 149 | Article.delete_all |
150 | 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 | 155 | get :index, :block_id => block.id |
156 | 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 | 40 | |
41 | 41 | should 'index action returns an json with node content' do |
42 | 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 | 45 | get :index, :block_id => block.id, :profile => profile.identifier |
46 | 46 | json_response = ActiveSupport::JSON.decode(@response.body) |
... | ... | @@ -52,7 +52,7 @@ class DisplayContentPluginMyprofileControllerTest < ActionController::TestCase |
52 | 52 | |
53 | 53 | should 'index action returns an json with node checked if the node is in the nodes list' do |
54 | 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 | 56 | block.nodes= [article.id] |
57 | 57 | block.save! |
58 | 58 | |
... | ... | @@ -68,8 +68,8 @@ class DisplayContentPluginMyprofileControllerTest < ActionController::TestCase |
68 | 68 | should 'index action returns an json with node undetermined if the node is in the parent nodes list' do |
69 | 69 | Article.delete_all |
70 | 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 | 73 | block.nodes = [article.id] |
74 | 74 | block.save! |
75 | 75 | |
... | ... | @@ -82,7 +82,7 @@ class DisplayContentPluginMyprofileControllerTest < ActionController::TestCase |
82 | 82 | should 'index action returns an json with node closed if the node has article with children' do |
83 | 83 | Article.delete_all |
84 | 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 | 86 | block.save! |
87 | 87 | |
88 | 88 | get :index, :block_id => block.id, :profile => profile.identifier |
... | ... | @@ -97,8 +97,8 @@ class DisplayContentPluginMyprofileControllerTest < ActionController::TestCase |
97 | 97 | should 'index action returns an json with all the children nodes if some parent is in the parents list' do |
98 | 98 | Article.delete_all |
99 | 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 | 102 | block.checked_nodes = {a1.id => true} |
103 | 103 | block.save! |
104 | 104 | |
... | ... | @@ -120,9 +120,9 @@ class DisplayContentPluginMyprofileControllerTest < ActionController::TestCase |
120 | 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 | 121 | Article.delete_all |
122 | 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 | 126 | block.checked_nodes = {a1.id => true} |
127 | 127 | block.save! |
128 | 128 | |
... | ... | @@ -150,9 +150,9 @@ class DisplayContentPluginMyprofileControllerTest < ActionController::TestCase |
150 | 150 | should 'index action returns an json without children nodes if the parent is not in the parents list' do |
151 | 151 | Article.delete_all |
152 | 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 | 157 | get :index, :block_id => block.id, :profile => profile.identifier |
158 | 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 | 2 | class DisplayContentBlockTest < ActiveSupport::TestCase |
3 | 3 | |
4 | 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 | 7 | should 'describe itself' do |
8 | 8 | assert_not_equal Block.description, DisplayContentBlock.description |
... | ... | @@ -39,9 +39,9 @@ class DisplayContentBlockTest < ActiveSupport::TestCase |
39 | 39 | should 'nodes be the article ids in hash of checked nodes' do |
40 | 40 | profile = create_user('testuser').person |
41 | 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 | 46 | checked_articles= {a1.id => true, a2.id => true, a3.id => false} |
47 | 47 | block = DisplayContentBlock.new |
... | ... | @@ -54,9 +54,9 @@ class DisplayContentBlockTest < ActiveSupport::TestCase |
54 | 54 | should 'nodes be save in database' do |
55 | 55 | profile = create_user('testuser').person |
56 | 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 | 61 | checked_articles= {a1.id => true, a2.id => true, a3.id => false} |
62 | 62 | block = DisplayContentBlock.new |
... | ... | @@ -71,10 +71,10 @@ class DisplayContentBlockTest < ActiveSupport::TestCase |
71 | 71 | should 'be able to update nodes' do |
72 | 72 | profile = create_user('testuser').person |
73 | 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 | 79 | checked_articles= {a1.id => true, a2.id => true, a3.id => false} |
80 | 80 | block = DisplayContentBlock.new |
... | ... | @@ -95,13 +95,13 @@ class DisplayContentBlockTest < ActiveSupport::TestCase |
95 | 95 | should "save selected folders and articles" do |
96 | 96 | profile = create_user('testuser').person |
97 | 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 | 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 | 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 | 106 | checked_articles= {a1.id => true, a2.id => true, f1.id => false} |
107 | 107 | |
... | ... | @@ -115,13 +115,13 @@ class DisplayContentBlockTest < ActiveSupport::TestCase |
115 | 115 | should "save selected articles and blogs" do |
116 | 116 | profile = create_user('testuser').person |
117 | 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 | 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 | 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 | 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 | 132 | assert_equivalent [a1.id, a2.id, b1.id, b2.id], block.nodes |
133 | 133 | end |
134 | 134 | |
135 | - should 'TextileArticle be saved as node' do | |
135 | + should 'TextArticle be saved as node' do | |
136 | 136 | profile = create_user('testuser').person |
137 | 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 | 140 | checked_articles= {a1.id => true} |
167 | 141 | block = DisplayContentBlock.new |
... | ... | @@ -230,9 +204,9 @@ class DisplayContentBlockTest < ActiveSupport::TestCase |
230 | 204 | should "return all root articles from profile" do |
231 | 205 | profile = create_user('testuser').person |
232 | 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 | 211 | block = DisplayContentBlock.new |
238 | 212 | block.nodes= [a1.id, a2.id, a3.id] |
... | ... | @@ -247,9 +221,9 @@ class DisplayContentBlockTest < ActiveSupport::TestCase |
247 | 221 | should "return all children of an articles's profile" do |
248 | 222 | profile = create_user('testuser').person |
249 | 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 | 228 | block = DisplayContentBlock.new |
255 | 229 | box = mock() |
... | ... | @@ -264,9 +238,9 @@ class DisplayContentBlockTest < ActiveSupport::TestCase |
264 | 238 | profile = fast_create(Community, :name => 'my test community', :identifier => 'mytestcommunity') |
265 | 239 | environment = Environment.default |
266 | 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 | 245 | block = DisplayContentBlock.new |
272 | 246 | box = mock() |
... | ... | @@ -283,9 +257,9 @@ class DisplayContentBlockTest < ActiveSupport::TestCase |
283 | 257 | profile = fast_create(Community, :name => 'my test community', :identifier => 'mytestcommunity') |
284 | 258 | environment = Environment.default |
285 | 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 | 264 | block = DisplayContentBlock.new |
291 | 265 | box = mock() |
... | ... | @@ -404,9 +378,9 @@ class DisplayContentBlockTest < ActiveSupport::TestCase |
404 | 378 | profile = create_user('testuser').person |
405 | 379 | Article.delete_all |
406 | 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 | 385 | checked_articles= {f1.id => true, a1.id => true, a2.id => true, a3.id => false} |
412 | 386 | block = DisplayContentBlock.new |
... | ... | @@ -420,9 +394,9 @@ class DisplayContentBlockTest < ActiveSupport::TestCase |
420 | 394 | profile = create_user('testuser').person |
421 | 395 | Article.delete_all |
422 | 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 | 401 | checked_articles= {f1.id => true, a1.id => true, a2.id => true, a3.id => false} |
428 | 402 | block = DisplayContentBlock.new |
... | ... | @@ -472,37 +446,37 @@ class DisplayContentBlockTest < ActiveSupport::TestCase |
472 | 446 | should 'return available content types with checked types first' do |
473 | 447 | Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([]) |
474 | 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 | 453 | end |
480 | 454 | |
481 | 455 | should 'return available content types' do |
482 | 456 | Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([]) |
483 | 457 | block = DisplayContentBlock.create! |
484 | - block.types = ['TinyMceArticle'] | |
458 | + block.types = ['TextArticle'] | |
485 | 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 | 461 | end |
488 | 462 | |
489 | 463 | should 'return first 2 content types' do |
490 | 464 | Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([]) |
491 | 465 | block = DisplayContentBlock.create! |
492 | - block.types = ['TinyMceArticle'] | |
466 | + block.types = ['TextArticle'] | |
493 | 467 | assert_equal 2, block.first_content_types.length |
494 | 468 | end |
495 | 469 | |
496 | 470 | should 'return all but first 2 content types' do |
497 | 471 | Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([]) |
498 | 472 | block = DisplayContentBlock.create! |
499 | - block.types = ['TinyMceArticle'] | |
473 | + block.types = ['TextArticle'] | |
500 | 474 | assert_equal block.available_content_types.length - 2, block.more_content_types.length |
501 | 475 | end |
502 | 476 | |
503 | 477 | should 'return 2 as default value for first_types_count' do |
504 | 478 | block = DisplayContentBlock.create! |
505 | - block.types = ['TinyMceArticle'] | |
479 | + block.types = ['TextArticle'] | |
506 | 480 | assert_equal 2, block.first_types_count |
507 | 481 | end |
508 | 482 | |
... | ... | @@ -527,14 +501,14 @@ class DisplayContentBlockTest < ActiveSupport::TestCase |
527 | 501 | Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([SomePlugin.new]) |
528 | 502 | |
529 | 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 | 505 | end |
532 | 506 | |
533 | 507 | should 'do not fail if a selected article was removed' do |
534 | 508 | profile = create_user('testuser').person |
535 | 509 | Article.delete_all |
536 | 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 | 513 | checked_articles= {a1.id => true} |
540 | 514 | |
... | ... | @@ -547,16 +521,16 @@ class DisplayContentBlockTest < ActiveSupport::TestCase |
547 | 521 | |
548 | 522 | end |
549 | 523 | |
550 | -require 'boxes_helper' | |
551 | - | |
552 | 524 | class DisplayContentBlockViewTest < ActionView::TestCase |
553 | 525 | include BoxesHelper |
526 | + include DatesHelper | |
527 | + helper :dates | |
554 | 528 | |
555 | 529 | should 'list links for all articles title defined in nodes' do |
556 | 530 | profile = create_user('testuser').person |
557 | 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 | 535 | block = DisplayContentBlock.new |
562 | 536 | block.sections = [{:value => 'title', :checked => true}] |
... | ... | @@ -572,8 +546,8 @@ class DisplayContentBlockViewTest < ActionView::TestCase |
572 | 546 | should 'list content for all articles lead defined in nodes' do |
573 | 547 | profile = create_user('testuser').person |
574 | 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 | 552 | block = DisplayContentBlock.new |
579 | 553 | block.sections = [{:value => 'abstract', :checked => true}] |
... | ... | @@ -602,7 +576,7 @@ class DisplayContentBlockViewTest < ActionView::TestCase |
602 | 576 | |
603 | 577 | should 'show title if defined by user' do |
604 | 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 | 581 | block = DisplayContentBlock.new |
608 | 582 | block.nodes = [a.id] |
... | ... | @@ -616,7 +590,7 @@ class DisplayContentBlockViewTest < ActionView::TestCase |
616 | 590 | |
617 | 591 | should 'show abstract if defined by user' do |
618 | 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 | 595 | block = DisplayContentBlock.new |
622 | 596 | block.nodes = [a.id] |
... | ... | @@ -630,7 +604,7 @@ class DisplayContentBlockViewTest < ActionView::TestCase |
630 | 604 | |
631 | 605 | should 'show body if defined by user' do |
632 | 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 | 609 | block = DisplayContentBlock.new |
636 | 610 | block.nodes = [a.id] |
... | ... | @@ -642,7 +616,7 @@ class DisplayContentBlockViewTest < ActionView::TestCase |
642 | 616 | assert_match /#{a.body}/, render_block_content(block) |
643 | 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 | 620 | profile = create_user('testuser').person |
647 | 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 | 632 | |
659 | 633 | should 'show image if defined by user' do |
660 | 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 | 636 | a.save! |
663 | 637 | |
664 | 638 | process_delayed_job_queue |
... | ... | @@ -676,8 +650,8 @@ class DisplayContentBlockViewTest < ActionView::TestCase |
676 | 650 | should 'show articles in recent order' do |
677 | 651 | profile = create_user('testuser').person |
678 | 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 | 656 | block = DisplayContentBlock.new |
683 | 657 | block.sections = [{:value => 'title', :checked => true}] |
... | ... | @@ -697,8 +671,8 @@ class DisplayContentBlockViewTest < ActionView::TestCase |
697 | 671 | should 'show articles in oldest order' do |
698 | 672 | profile = create_user('testuser').person |
699 | 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 | 677 | block = DisplayContentBlock.new |
704 | 678 | block.sections = [{:value => 'title', :checked => true}] |
... | ... | @@ -718,8 +692,8 @@ class DisplayContentBlockViewTest < ActionView::TestCase |
718 | 692 | should 'show articles in recent order with limit option' do |
719 | 693 | profile = create_user('testuser').person |
720 | 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 | 698 | block = DisplayContentBlock.new |
725 | 699 | block.sections = [{:value => 'title', :checked => true}] |
... | ... | @@ -741,10 +715,10 @@ class DisplayContentBlockViewTest < ActionView::TestCase |
741 | 715 | profile = create_user('testuser').person |
742 | 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 | 723 | block = DisplayContentBlock.new |
750 | 724 | block.sections = [{:value => 'title', :checked => true}] |
... | ... | @@ -771,8 +745,8 @@ class DisplayContentBlockViewTest < ActionView::TestCase |
771 | 745 | profile = create_user('testuser').person |
772 | 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 | 751 | block = DisplayContentBlock.new |
778 | 752 | block.sections = [{:value => 'title', :checked => true}] |
... | ... | @@ -794,7 +768,7 @@ class DisplayContentBlockViewTest < ActionView::TestCase |
794 | 768 | |
795 | 769 | should 'not escape abstract html of articles' do |
796 | 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 | 773 | block = DisplayContentBlock.new |
800 | 774 | block.sections = [{:value => 'abstract', :checked => true}] |
... | ... | @@ -807,7 +781,7 @@ class DisplayContentBlockViewTest < ActionView::TestCase |
807 | 781 | |
808 | 782 | should 'not raise if abstract of article is nil' do |
809 | 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 | 786 | block = DisplayContentBlock.new |
813 | 787 | block.sections = [{:value => 'abstract', :checked => true}] |
... | ... | @@ -823,7 +797,7 @@ class DisplayContentBlockViewTest < ActionView::TestCase |
823 | 797 | |
824 | 798 | should 'not escape body html of articles' do |
825 | 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 | 802 | block = DisplayContentBlock.new |
829 | 803 | block.sections = [{:value => 'body', :checked => true}] |
... | ... | @@ -836,7 +810,7 @@ class DisplayContentBlockViewTest < ActionView::TestCase |
836 | 810 | |
837 | 811 | should 'not raise if body of article is nil' do |
838 | 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 | 815 | block = DisplayContentBlock.new |
842 | 816 | block.sections = [{:value => 'abstract', :checked => true}] | ... | ... |
... | ... | @@ -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 @@ |
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 | ... | ... |