Commit c366c04f669b6681bae62e18fd9042c5c6316a5e
Exists in
fix_sign_up_form
Merge branch 'choose_article_editor' into 'master'
Choose article editor Remove TinyMce, RawHTML and Textile article types and create the possibility to choose wich editor will be used to create new text articles See merge request !959
Showing
162 changed files
with
1006 additions
and
1083 deletions
Show diff stats
app/api/helpers.rb
... | ... | @@ -107,7 +107,7 @@ module Api |
107 | 107 | def post_article(asset, params) |
108 | 108 | return forbidden! unless current_person.can_post_content?(asset) |
109 | 109 | |
110 | - klass_type = params[:content_type] || params[:article].delete(:type) || TinyMceArticle.name | |
110 | + klass_type = params[:content_type] || params[:article].delete(:type) || TextArticle.name | |
111 | 111 | return forbidden! unless klass_type.constantize <= Article |
112 | 112 | |
113 | 113 | article = klass_type.constantize.new(params[:article]) |
... | ... | @@ -461,11 +461,9 @@ module Api |
461 | 461 | |
462 | 462 | def parse_content_type(content_type) |
463 | 463 | return nil if content_type.blank? |
464 | - content_types = content_type.split(',').map do |content_type| | |
465 | - content_type = content_type.camelcase | |
466 | - content_type == 'TextArticle' ? Article.text_article_types : content_type | |
464 | + content_type.split(',').map do |content_type| | |
465 | + content_type.camelcase | |
467 | 466 | end |
468 | - content_types.flatten.uniq | |
469 | 467 | end |
470 | 468 | |
471 | 469 | def period(from_date, until_date) | ... | ... |
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
... | ... | @@ -92,7 +92,7 @@ class ProfileEditorController < MyProfileController |
92 | 92 | end |
93 | 93 | |
94 | 94 | def welcome_page |
95 | - @welcome_page = profile.welcome_page || TinyMceArticle.new(:name => 'Welcome Page', :profile => profile, :published => false) | |
95 | + @welcome_page = profile.welcome_page || TextArticle.new(:name => 'Welcome Page', :profile => profile, :published => false) | |
96 | 96 | if request.post? |
97 | 97 | begin |
98 | 98 | @welcome_page.update!(params[:welcome_page]) | ... | ... |
app/helpers/application_helper.rb
... | ... | @@ -109,10 +109,6 @@ module ApplicationHelper |
109 | 109 | content = capture(&block) |
110 | 110 | end |
111 | 111 | |
112 | - if options[:type] == :textile | |
113 | - content = RedCloth.new(content).to_html | |
114 | - end | |
115 | - | |
116 | 112 | options[:class] = '' if ! options[:class] |
117 | 113 | options[:class] += ' button icon-help' # with-text |
118 | 114 | |
... | ... | @@ -130,13 +126,6 @@ module ApplicationHelper |
130 | 126 | text |
131 | 127 | end |
132 | 128 | |
133 | - # alias for <tt>help(content, :textile)</tt>. You can pass a block in the | |
134 | - # same way you would do if you called <tt>help</tt> directly. | |
135 | - def help_textile(content = nil, link_name = nil, options = {}, &block) | |
136 | - options[:type] = :textile | |
137 | - help(content, link_name, options, &block) | |
138 | - end | |
139 | - | |
140 | 129 | # TODO: do something more useful here |
141 | 130 | # TODO: test this helper |
142 | 131 | # TODO: add an icon? |
... | ... | @@ -1243,4 +1232,15 @@ module ApplicationHelper |
1243 | 1232 | content.html_safe |
1244 | 1233 | end |
1245 | 1234 | |
1235 | + def current_editor_is?(editor) | |
1236 | + editor.blank? ? false : current_editor == editor | |
1237 | + end | |
1238 | + | |
1239 | + def current_editor(mode = '') | |
1240 | + editor = @article.editor || Article::Editor::TINY_MCE unless @article.nil? | |
1241 | + editor ||= (current_person.nil? || current_person.editor.nil?) ? Article::Editor::TINY_MCE : current_person.editor | |
1242 | + editor += '_' + mode unless mode.blank? | |
1243 | + editor | |
1244 | + end | |
1245 | + | |
1246 | 1246 | end | ... | ... |
app/helpers/profile_editor_helper.rb
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/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 |
... | ... | @@ -874,6 +871,10 @@ class Article < ApplicationRecord |
874 | 871 | true |
875 | 872 | end |
876 | 873 | |
874 | + def editor?(editor) | |
875 | + self.editor == editor | |
876 | + end | |
877 | + | |
877 | 878 | private |
878 | 879 | |
879 | 880 | def sanitize_tag_list | ... | ... |
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], |
... | ... | @@ -341,6 +341,8 @@ class Person < Profile |
341 | 341 | |
342 | 342 | validates_associated :user |
343 | 343 | |
344 | + validates :editor, inclusion: { in: lambda { |p| p.available_editors } } | |
345 | + | |
344 | 346 | def email |
345 | 347 | self.user.nil? ? nil : self.user.email |
346 | 348 | end |
... | ... | @@ -613,8 +615,21 @@ class Person < Profile |
613 | 615 | Profile.followed_by self |
614 | 616 | end |
615 | 617 | |
618 | + def editor?(editor) | |
619 | + self.editor == editor | |
620 | + end | |
621 | + | |
616 | 622 | def in_social_circle?(person) |
617 | 623 | self.is_a_friend?(person) || super |
618 | 624 | end |
619 | 625 | |
626 | + def available_editors | |
627 | + available_editors = { | |
628 | + Article::Editor::TINY_MCE => _('TinyMCE'), | |
629 | + Article::Editor::TEXTILE => _('Textile') | |
630 | + } | |
631 | + available_editors.merge!({Article::Editor::RAW_HTML => _('Raw HTML')}) if self.is_admin? | |
632 | + available_editors | |
633 | + end | |
634 | + | |
620 | 635 | 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/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/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' %> |
... | ... | @@ -15,4 +12,4 @@ |
15 | 12 | |
16 | 13 | <%= labelled_form_field(_('Address:'), text_field(:article, :address)) %> |
17 | 14 | |
18 | -<%= render :partial => 'shared/lead_and_body', :locals => {:tiny_mce => true, :body_label => 'Information about the event:'} %> | |
15 | +<%= 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/send_mail.html.erb
... | ... | @@ -16,8 +16,7 @@ |
16 | 16 | |
17 | 17 | <%= labelled_form_field(_('Subject:'), f.text_field(:subject)) %> |
18 | 18 | |
19 | - <%= render :file => 'shared/tiny_mce' %> | |
20 | - <%= labelled_form_field(_('Body:'), f.text_area(:body, :class => 'mceEditor')) %> | |
19 | + <%= labelled_form_field(_('Body:'), f.text_area(:body, :class => 'body ' + current_editor)) %> | |
21 | 20 | |
22 | 21 | <%= submit_button(:send, _('Send')) %> |
23 | 22 | <%= 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: 20160705162914) 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: 20160705162914) 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 |
... | ... | @@ -631,15 +632,16 @@ ActiveRecord::Schema.define(version: 20160705162914) do |
631 | 632 | t.boolean "is_template", default: false |
632 | 633 | t.integer "template_id" |
633 | 634 | t.string "redirection_after_login" |
634 | - t.integer "friends_count", default: 0, null: false | |
635 | - t.integer "members_count", default: 0, null: false | |
636 | - t.integer "activities_count", default: 0, null: false | |
635 | + t.integer "friends_count", default: 0, null: false | |
636 | + t.integer "members_count", default: 0, null: false | |
637 | + t.integer "activities_count", default: 0, null: false | |
637 | 638 | t.string "personal_website" |
638 | 639 | t.string "jabber_id" |
639 | 640 | t.integer "welcome_page_id" |
640 | 641 | t.boolean "allow_members_to_invite", default: true |
641 | 642 | t.boolean "invite_friends_only", default: false |
642 | 643 | t.boolean "secret", default: false |
644 | + t.string "editor", default: "tiny_mce", null: false | |
643 | 645 | end |
644 | 646 | |
645 | 647 | 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, |
... | ... | @@ -178,7 +178,7 @@ Given /^the following articles? with images?$/ do |table| |
178 | 178 | img_tag = "<img " |
179 | 179 | img.each { |attr, value| img_tag += "#{attr}=\"#{value}\" " } |
180 | 180 | img_tag += "/>" |
181 | - article = TinyMceArticle.new(:profile => owner, :name => item[:name], :body => img_tag) | |
181 | + article = TextArticle.new(:profile => owner, :name => item[:name], :body => img_tag) | |
182 | 182 | if item[:parent] |
183 | 183 | article.parent = Article.find_by slug: item[:parent] |
184 | 184 | 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" | ... | ... |
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
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
... | ... | @@ -235,7 +235,7 @@ class StepTest < ActiveSupport::TestCase |
235 | 235 | end |
236 | 236 | |
237 | 237 | should 'return enabled tools for a step' do |
238 | - assert_includes @step.enabled_tools, TinyMceArticle | |
238 | + assert_includes @step.enabled_tools, TextArticle | |
239 | 239 | assert_includes @step.enabled_tools, Forum |
240 | 240 | end |
241 | 241 | ... | ... |
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}] | ... | ... |
plugins/fb_app/views/fb_app_plugin_page_tab/_configure_form.html.slim
... | ... | @@ -15,7 +15,7 @@ |
15 | 15 | = f.text_field :title, class: 'form-control' |
16 | 16 | |
17 | 17 | = f.label :subtitle, t("fb_app_plugin.views.myprofile.catalogs.catalog_subtitle_label") |
18 | - = f.text_area :subtitle, class: 'form-control mceEditor', id: "page-tab-subtitle-#{page_tab.id}" | |
18 | + = f.text_area :subtitle, class: 'form-control ' + current_editor, id: "page-tab-subtitle-#{page_tab.id}" | |
19 | 19 | |
20 | 20 | = f.label :config_type, t("fb_app_plugin.views.myprofile.catalogs.catalog_type_chooser_label") |
21 | 21 | = f.select :config_type, | ... | ... |
plugins/mark_comment_as_read/test/functional/mark_comment_as_read_plugin_profile_controller_test.rb
... | ... | @@ -6,7 +6,7 @@ class MarkCommentAsReadPluginProfileControllerTest < ActionController::TestCase |
6 | 6 | @controller = MarkCommentAsReadPluginProfileController.new |
7 | 7 | |
8 | 8 | @profile = create_user('profile').person |
9 | - @article = TinyMceArticle.create!(:profile => @profile, :name => 'An article') | |
9 | + @article = TextArticle.create!(:profile => @profile, :name => 'An article') | |
10 | 10 | @comment = Comment.new(:source => @article, :author => @profile, :body => 'test') |
11 | 11 | @comment.save! |
12 | 12 | login_as(@profile.identifier) | ... | ... |
plugins/mark_comment_as_read/test/unit/mark_comment_as_read_plugin/comment_test.rb
... | ... | @@ -4,7 +4,7 @@ class MarkCommentAsReadPlugin::CommentTest < ActiveSupport::TestCase |
4 | 4 | |
5 | 5 | def setup |
6 | 6 | @person = create_user('user').person |
7 | - @article = TinyMceArticle.create!(:profile => @person, :name => 'An article') | |
7 | + @article = TextArticle.create!(:profile => @person, :name => 'An article') | |
8 | 8 | @comment = Comment.create!(:title => 'title', :body => 'body', :author => @person, :source => @article) |
9 | 9 | end |
10 | 10 | ... | ... |
plugins/mark_comment_as_read/test/unit/mark_comment_as_read_test.rb
... | ... | @@ -5,7 +5,7 @@ class MarkCommentAsReadPluginTest < ActionView::TestCase |
5 | 5 | def setup |
6 | 6 | @plugin = MarkCommentAsReadPlugin.new |
7 | 7 | @person = create_user('user').person |
8 | - @article = TinyMceArticle.create!(:profile => @person, :name => 'An article') | |
8 | + @article = TextArticle.create!(:profile => @person, :name => 'An article') | |
9 | 9 | @comment = Comment.create!(:source => @article, :author => @person, :body => 'test') |
10 | 10 | self.stubs(:user).returns(@person) |
11 | 11 | self.stubs(:profile).returns(@person) | ... | ... |
plugins/metadata/test/functional/content_viewer_controller_test.rb
... | ... | @@ -21,7 +21,7 @@ class ContentViewerControllerTest < ActionController::TestCase |
21 | 21 | end |
22 | 22 | |
23 | 23 | should 'add meta tags with article info' do |
24 | - a = TinyMceArticle.create(name: 'Article to be shared', body: '<p>This article should be shared with all social networks</p>', profile: profile) | |
24 | + a = TextArticle.create(name: 'Article to be shared', body: '<p>This article should be shared with all social networks</p>', profile: profile) | |
25 | 25 | |
26 | 26 | get :view_page, profile: profile.identifier, page: [ a.name.to_slug ] |
27 | 27 | |
... | ... | @@ -37,7 +37,7 @@ class ContentViewerControllerTest < ActionController::TestCase |
37 | 37 | end |
38 | 38 | |
39 | 39 | should 'add meta tags with article images' do |
40 | - a = TinyMceArticle.create(name: 'Article to be shared with images', body: 'This article should be shared with all social networks <img src="/images/x.png" />', profile: profile) | |
40 | + a = TextArticle.create(name: 'Article to be shared with images', body: 'This article should be shared with all social networks <img src="/images/x.png" />', profile: profile) | |
41 | 41 | |
42 | 42 | get :view_page, profile: profile.identifier, page: [ a.name.to_slug ] |
43 | 43 | assert_tag tag: 'meta', attributes: { name: 'twitter:image', content: /\/images\/x.png/ } |
... | ... | @@ -45,7 +45,7 @@ class ContentViewerControllerTest < ActionController::TestCase |
45 | 45 | end |
46 | 46 | |
47 | 47 | should 'escape utf8 characters correctly' do |
48 | - a = TinyMceArticle.create(name: 'Article to be shared with images', body: 'This article should be shared with all social networks <img src="/images/ç.png" />', profile: profile) | |
48 | + a = TextArticle.create(name: 'Article to be shared with images', body: 'This article should be shared with all social networks <img src="/images/ç.png" />', profile: profile) | |
49 | 49 | |
50 | 50 | get :view_page, profile: profile.identifier, page: [ a.name.to_slug ] |
51 | 51 | assert_tag tag: 'meta', attributes: { property: 'og:image', content: /\/images\/%C3%A7.png/ } |
... | ... | @@ -63,7 +63,7 @@ class ContentViewerControllerTest < ActionController::TestCase |
63 | 63 | |
64 | 64 | should 'not expose metadata on private pages' do |
65 | 65 | profile.update_column :public_profile, false |
66 | - a = TinyMceArticle.create(name: 'Article to be shared with images', body: 'This article should be shared with all social networks <img src="/images/x.png" />', profile: profile) | |
66 | + a = TextArticle.create(name: 'Article to be shared with images', body: 'This article should be shared with all social networks <img src="/images/x.png" />', profile: profile) | |
67 | 67 | |
68 | 68 | get :view_page, profile: profile.identifier, page: [ a.name.to_slug ] |
69 | 69 | assert_no_tag tag: 'meta', attributes: { property: 'og:image', content: /\/images\/x.png/ } | ... | ... |
plugins/newsletter/test/integration/safe_strings_test.rb
... | ... | @@ -10,7 +10,7 @@ class NewsletterPluginSafeStringsTest < ActionDispatch::IntegrationTest |
10 | 10 | environment.add_admin(person) |
11 | 11 | |
12 | 12 | blog = fast_create(Blog, :profile_id => person.id) |
13 | - post = fast_create(TextileArticle, :name => 'First post', :profile_id => person.id, :parent_id => blog.id, :body => 'Test') | |
13 | + post = fast_create(TextArticle, :name => 'First post', :profile_id => person.id, :parent_id => blog.id, :body => 'Test') | |
14 | 14 | newsletter = NewsletterPlugin::Newsletter.create!(:environment => environment, :person => person, :enabled => true) |
15 | 15 | newsletter.blog_ids = [blog.id] |
16 | 16 | newsletter.save! | ... | ... |
plugins/newsletter/test/unit/newsletter_plugin_moderate_newsletter_test.rb
... | ... | @@ -28,9 +28,9 @@ class NewsletterPluginModerateNewsletterTest < ActiveSupport::TestCase |
28 | 28 | should 'set posts for mailing body on perform' do |
29 | 29 | person = create_user('john').person |
30 | 30 | blog = fast_create(Blog, profile_id: person.id) |
31 | - post_1 = fast_create(TextileArticle, :name => 'First post', :profile_id => person.id, :parent_id => blog.id, :body => 'Test') | |
32 | - post_2 = fast_create(TextileArticle, :name => 'Second post', :profile_id => person.id, :parent_id => blog.id, :body => 'Test') | |
33 | - post_3 = fast_create(TextileArticle, :name => 'Third post', :profile_id => person.id, :parent_id => blog.id, :body => 'Test') | |
31 | + post_1 = fast_create(TextArticle, :name => 'First post', :profile_id => person.id, :parent_id => blog.id, :body => 'Test') | |
32 | + post_2 = fast_create(TextArticle, :name => 'Second post', :profile_id => person.id, :parent_id => blog.id, :body => 'Test') | |
33 | + post_3 = fast_create(TextArticle, :name => 'Third post', :profile_id => person.id, :parent_id => blog.id, :body => 'Test') | |
34 | 34 | |
35 | 35 | newsletter = NewsletterPlugin::Newsletter.create!(:environment => person.environment, :person => person, :enabled => true) |
36 | 36 | newsletter.blog_ids = [blog.id] | ... | ... |
plugins/newsletter/test/unit/newsletter_plugin_newsletter_test.rb
... | ... | @@ -381,9 +381,9 @@ EOS |
381 | 381 | person = fast_create(Person) |
382 | 382 | blog = fast_create(Blog, profile_id: person.id) |
383 | 383 | |
384 | - post_1 = fast_create(TextileArticle, :name => 'First post', :profile_id => person.id, :parent_id => blog.id, :body => 'Test') | |
385 | - post_2 = fast_create(TextileArticle, :name => 'Second post', :profile_id => person.id, :parent_id => blog.id, :body => 'Test') | |
386 | - post_3 = fast_create(TextileArticle, :name => 'Third post', :profile_id => person.id, :parent_id => blog.id, :body => 'Test') | |
384 | + post_1 = fast_create(TextArticle, :name => 'First post', :profile_id => person.id, :parent_id => blog.id, :body => 'Test') | |
385 | + post_2 = fast_create(TextArticle, :name => 'Second post', :profile_id => person.id, :parent_id => blog.id, :body => 'Test') | |
386 | + post_3 = fast_create(TextArticle, :name => 'Third post', :profile_id => person.id, :parent_id => blog.id, :body => 'Test') | |
387 | 387 | |
388 | 388 | newsletter = NewsletterPlugin::Newsletter.create!( |
389 | 389 | :environment => person.environment, |
... | ... | @@ -397,9 +397,9 @@ EOS |
397 | 397 | person = fast_create(Person) |
398 | 398 | blog = fast_create(Blog, profile_id: person.id) |
399 | 399 | |
400 | - post_1 = fast_create(TextileArticle, :name => 'First post', :profile_id => person.id, :parent_id => blog.id, :body => 'Test') | |
401 | - post_2 = fast_create(TextileArticle, :name => 'Second post', :profile_id => person.id, :parent_id => blog.id, :body => 'Test') | |
402 | - post_3 = fast_create(TextileArticle, :name => 'Third post', :profile_id => person.id, :parent_id => blog.id, :body => 'Test') | |
400 | + post_1 = fast_create(TextArticle, :name => 'First post', :profile_id => person.id, :parent_id => blog.id, :body => 'Test') | |
401 | + post_2 = fast_create(TextArticle, :name => 'Second post', :profile_id => person.id, :parent_id => blog.id, :body => 'Test') | |
402 | + post_3 = fast_create(TextArticle, :name => 'Third post', :profile_id => person.id, :parent_id => blog.id, :body => 'Test') | |
403 | 403 | |
404 | 404 | newsletter = NewsletterPlugin::Newsletter.create!( |
405 | 405 | :environment => person.environment, | ... | ... |
plugins/newsletter/views/newsletter_plugin_admin/index.html.erb
1 | 1 | <h1><%= _('Newsletter settings') %></h1> |
2 | 2 | |
3 | -<%= render :file => 'shared/tiny_mce' %> | |
4 | - | |
5 | 3 | <%= error_messages_for :newsletter %> |
6 | 4 | |
7 | 5 | <%= form_for(:newsletter, html: { multipart: true }) do |f| %> |
... | ... | @@ -81,7 +79,7 @@ |
81 | 79 | content_tag('h3', ui_icon('ui-icon-triangle-1-s') + |
82 | 80 | _('Newsletter footer'), :class => 'newsletter-toggle-link', :element_id => '#newsletter-footer-field'), |
83 | 81 | content_tag('div', |
84 | - f.text_area(:footer, :style => 'width: 100%', :class => 'mceEditor'), | |
82 | + f.text_area(:footer, :style => 'width: 100%', :class => current_editor), | |
85 | 83 | :id => 'newsletter-footer-field' |
86 | 84 | )) |
87 | 85 | %> | ... | ... |
plugins/open_graph/test/unit/open_graph_graph/publisher_test.rb
... | ... | @@ -51,7 +51,7 @@ class OpenGraphPlugin::PublisherTest < ActiveSupport::TestCase |
51 | 51 | user = User.current.person |
52 | 52 | |
53 | 53 | blog = Blog.create! profile: user, name: 'blog' |
54 | - blog_post = TinyMceArticle.create! profile: user, parent: blog, name: 'blah', author: user | |
54 | + blog_post = TextArticle.create! profile: user, parent: blog, name: 'blah', author: user | |
55 | 55 | assert_last_activity user, :create_an_article, url_for(blog_post) |
56 | 56 | |
57 | 57 | gallery = Gallery.create! name: 'gallery', profile: user |
... | ... | @@ -65,7 +65,7 @@ class OpenGraphPlugin::PublisherTest < ActiveSupport::TestCase |
65 | 65 | assert_last_activity user, :create_an_event, url_for(event) |
66 | 66 | |
67 | 67 | forum = Forum.create! name: 'forum', profile: user |
68 | - topic = TinyMceArticle.create! profile: user, parent: forum, name: 'blah2', author: user | |
68 | + topic = TextArticle.create! profile: user, parent: forum, name: 'blah2', author: user | |
69 | 69 | assert_last_activity user, :start_a_discussion, url_for(topic, topic.url.merge(og_type: MetadataPlugin.og_types[:forum])) |
70 | 70 | |
71 | 71 | AddFriend.create!(person: user, friend: @other_actor).finish |
... | ... | @@ -82,7 +82,7 @@ class OpenGraphPlugin::PublisherTest < ActiveSupport::TestCase |
82 | 82 | User.current = @actor.user |
83 | 83 | user = User.current.person |
84 | 84 | |
85 | - blog_post = TinyMceArticle.create! profile: @enterprise, parent: @enterprise.blog, name: 'blah', author: user | |
85 | + blog_post = TextArticle.create! profile: @enterprise, parent: @enterprise.blog, name: 'blah', author: user | |
86 | 86 | story = :announce_news_from_a_sse_initiative |
87 | 87 | assert_last_activity user, story, passive_url_for(blog_post, nil, OpenGraphPlugin::Stories::Definitions[story]) |
88 | 88 | |
... | ... | @@ -91,13 +91,13 @@ class OpenGraphPlugin::PublisherTest < ActiveSupport::TestCase |
91 | 91 | user = User.current.person |
92 | 92 | |
93 | 93 | # fan |
94 | - blog_post = TinyMceArticle.create! profile: @enterprise, parent: @enterprise.blog, name: 'blah2', author: user | |
94 | + blog_post = TextArticle.create! profile: @enterprise, parent: @enterprise.blog, name: 'blah2', author: user | |
95 | 95 | assert_last_activity user, :announce_news_from_a_sse_initiative, 'http://noosfero.net/coop/blog/blah2' |
96 | 96 | # member |
97 | - blog_post = TinyMceArticle.create! profile: @myenterprise, parent: @myenterprise.blog, name: 'blah2', author: user | |
97 | + blog_post = TextArticle.create! profile: @myenterprise, parent: @myenterprise.blog, name: 'blah2', author: user | |
98 | 98 | assert_last_activity user, :announce_news_from_a_sse_initiative, 'http://noosfero.net/mycoop/blog/blah2' |
99 | 99 | |
100 | - blog_post = TinyMceArticle.create! profile: @community, parent: @community.blog, name: 'blah', author: user | |
100 | + blog_post = TextArticle.create! profile: @community, parent: @community.blog, name: 'blah', author: user | |
101 | 101 | assert_last_activity user, :announce_news_from_a_community, 'http://noosfero.net/comm/blog/blah' |
102 | 102 | end |
103 | 103 | ... | ... |
plugins/orders_cycle/views/orders_cycle_plugin_cycle/_edit_fields.html.slim
... | ... | @@ -5,8 +5,7 @@ h3= t('views.cycle._edit_fields.general_settings') |
5 | 5 | = form_for @cycle, as: :cycle , remote: true, url: {action: @cycle.new? ? :new : :edit, id: @cycle.id }, html: {data: {loading: '#cycle-fields form'}} do |f| |
6 | 6 | |
7 | 7 | = labelled_field f, :name, t('views.cycle._edit_fields.name'), f.text_field(:name), class: 'cycle-field-name' |
8 | - = labelled_field f, :description, t('views.cycle._edit_fields.description'), f.text_area(:description, class: 'mceEditor'), class: 'cycle-field-description' | |
9 | - = render file: 'shared/tiny_mce', locals: {mode: 'simple'} | |
8 | + = labelled_field f, :description, t('views.cycle._edit_fields.description'), f.text_area(:description, class: current_editor('simple')), class: 'cycle-field-description' | |
10 | 9 | |
11 | 10 | .cycle-fields-block |
12 | 11 | = labelled_datetime_range_field f, :start, :finish, t('views.cycle._edit_fields.orders_interval'), class: 'cycle-orders-period' | ... | ... |
plugins/products/views/products_plugin/page/_display_description.html.erb
1 | 1 | <%= render :file => 'shared/tiny_mce', :locals => {:mode => 'simple'} %> |
2 | 2 | <% if !@product.description.blank? %> |
3 | 3 | <%= @product.description %> |
4 | - <%= edit_product_button_to_remote(@product, 'description', _('Edit description'), :title => _('Edit the description of your product and give consumers more information about what you are advertising')) %> | |
4 | + <%= edit_product_button_to_remote(@product, 'description', _('Edit description'), {:title => _('Edit the description of your product and give consumers more information about what you are advertising'), :class => current_editor}) %> | |
5 | 5 | <% else %> |
6 | 6 | <%= edit_product_ui_button_to_remote( |
7 | 7 | @product, | ... | ... |
plugins/products/views/products_plugin/page/_edit_description.html.erb
1 | -<%= render file: 'shared/tiny_mce', locals: {mode: 'simple'} %> | |
2 | 1 | <%= remote_form_for(@product, |
3 | 2 | loading: "small_loading('product-description-form')", |
4 | 3 | update: 'product-description', |
5 | 4 | url: {controller: 'products_plugin/page', action: 'edit', id: @product, field: 'description'}, |
6 | 5 | html: {id: 'product-description-form', method: 'post'}) do |f| %> |
7 | 6 | |
8 | - <%= labelled_form_field(_('Description:'), f.text_area(:description, rows: 15, style: 'width: 90%;', class: 'mceEditor')) %> | |
7 | + <%= labelled_form_field(_('Description:'), f.text_area(:description, rows: 15, style: 'width: 90%;', class: current_editor('simple'))) %> | |
9 | 8 | <%= button_bar do %> |
10 | 9 | <%= submit_button :save, _('Save') %> |
11 | 10 | <%= cancel_edit_product_link(@product, 'description') %> | ... | ... |
plugins/products/views/products_plugin/page/_form.html.erb
... | ... | @@ -5,7 +5,7 @@ |
5 | 5 | |
6 | 6 | <%= display_form_field( _('Name:'), f.text_field(:name) ) %> |
7 | 7 | <%= display_form_field( _('Price:'), f.text_field(:price) ) %> |
8 | - <%= display_form_field( _('Description:'), f.text_area(:description, :rows => 10, :class => 'mceEditor') ) %> | |
8 | + <%= display_form_field( _('Description:'), f.text_area(:description, :rows => 10, :class => current_editor('simples')) ) %> | |
9 | 9 | <%= labelled_form_field(f.check_box(:highlighted) + _('Highlight this product'),'') %> |
10 | 10 | <%= f.fields_for :image_builder, @product.image do |i| %> |
11 | 11 | <%= file_field_or_thumbnail(_('Image:'), @product.image, i) %> | ... | ... |
plugins/profile_members_headlines/test/unit/profile_members_headlines_block_test.rb
... | ... | @@ -42,7 +42,7 @@ class ProfileMembersHeadlinesBlockTest < ActiveSupport::TestCase |
42 | 42 | block = ProfileMembersHeadlinesBlock.create |
43 | 43 | block.stubs(:owner).returns(community) |
44 | 44 | blog = fast_create(Blog, :profile_id => member1.id) |
45 | - post = fast_create(TinyMceArticle, :name => 'headlines', :profile_id => member1.id, :parent_id => blog.id) | |
45 | + post = fast_create(TextArticle, :name => 'headlines', :profile_id => member1.id, :parent_id => blog.id) | |
46 | 46 | self.expects(:render).with(:template => 'blocks/profile_members_headlines', :locals => { :block => block }).returns('file-with-authors-and-headlines') |
47 | 47 | assert_equal 'file-with-authors-and-headlines', render_block_content(block) |
48 | 48 | end |
... | ... | @@ -53,7 +53,7 @@ class ProfileMembersHeadlinesBlockTest < ActiveSupport::TestCase |
53 | 53 | block = ProfileMembersHeadlinesBlock.new(:limit => 1, :filtered_roles => [role.id]) |
54 | 54 | block.expects(:owner).returns(community) |
55 | 55 | blog = fast_create(Blog, :profile_id => member1.id) |
56 | - post = fast_create(TinyMceArticle, :name => 'headlines', :profile_id => member1.id, :parent_id => blog.id) | |
56 | + post = fast_create(TextArticle, :name => 'headlines', :profile_id => member1.id, :parent_id => blog.id) | |
57 | 57 | assert_equal [member1], block.authors_list |
58 | 58 | end |
59 | 59 | |
... | ... | @@ -62,7 +62,7 @@ class ProfileMembersHeadlinesBlockTest < ActiveSupport::TestCase |
62 | 62 | block.expects(:owner).returns(community) |
63 | 63 | private_author = fast_create(Person, :public_profile => false) |
64 | 64 | blog = fast_create(Blog, :profile_id => private_author.id) |
65 | - post = fast_create(TinyMceArticle, :name => 'headlines', :profile_id => private_author.id, :parent_id => blog.id) | |
65 | + post = fast_create(TextArticle, :name => 'headlines', :profile_id => private_author.id, :parent_id => blog.id) | |
66 | 66 | assert_equal [], block.authors_list |
67 | 67 | end |
68 | 68 | |
... | ... | @@ -76,7 +76,7 @@ class ProfileMembersHeadlinesBlockTest < ActiveSupport::TestCase |
76 | 76 | block.stubs(:owner).returns(community) |
77 | 77 | community.members.each do |member| |
78 | 78 | blog = fast_create(Blog, :profile_id => member.id) |
79 | - post = fast_create(TinyMceArticle, :name => 'headlines', :profile_id => member.id, :parent_id => blog.id) | |
79 | + post = fast_create(TextArticle, :name => 'headlines', :profile_id => member.id, :parent_id => blog.id) | |
80 | 80 | end |
81 | 81 | assert_equal [author], block.authors_list |
82 | 82 | end | ... | ... |
plugins/recent_content/lib/recent_content_block.rb
... | ... | @@ -7,7 +7,7 @@ class RecentContentBlock < Block |
7 | 7 | |
8 | 8 | attr_accessible :presentation_mode, :total_items, :show_blog_picture, :selected_folder |
9 | 9 | |
10 | - VALID_CONTENT = ['RawHTMLArticle', 'TextArticle', 'TextileArticle', 'TinyMceArticle'] | |
10 | + VALID_CONTENT = ['TextArticle'] | |
11 | 11 | |
12 | 12 | def self.description |
13 | 13 | c_('Recent content') | ... | ... |
plugins/recent_content/test/unit/recent_content_block_test.rb
... | ... | @@ -2,7 +2,7 @@ require_relative '../test_helper' |
2 | 2 | class RecentContentBlockTest < ActiveSupport::TestCase |
3 | 3 | |
4 | 4 | INVALID_KIND_OF_ARTICLE = [RssFeed, UploadedFile, Gallery, Folder, Blog, Forum] |
5 | - VALID_KIND_OF_ARTICLE = [RawHTMLArticle, TextArticle, TextileArticle, TinyMceArticle] | |
5 | + VALID_KIND_OF_ARTICLE = [TextArticle] | |
6 | 6 | |
7 | 7 | should 'describe itself' do |
8 | 8 | assert_not_equal Block.description, RecentContentBlock.description |
... | ... | @@ -61,9 +61,9 @@ class RecentContentBlockTest < ActiveSupport::TestCase |
61 | 61 | |
62 | 62 | root = fast_create(Blog, :name => 'test-blog', :profile_id => profile.id) |
63 | 63 | |
64 | - a1 = fast_create(TextileArticle, :name => 'article #1', :profile_id => profile.id, :parent_id => root.id, :created_at => Time.now - 2.days) | |
65 | - a2 = fast_create(TextileArticle, :name => 'article #2', :profile_id => profile.id, :parent_id => root.id, :created_at => Time.now - 1.days) | |
66 | - a3 = fast_create(TextileArticle, :name => 'article #3', :profile_id => profile.id, :parent_id => root.id, :created_at => Time.now) | |
64 | + a1 = fast_create(TextArticle, :name => 'article #1', :profile_id => profile.id, :parent_id => root.id, :created_at => Time.now - 2.days) | |
65 | + a2 = fast_create(TextArticle, :name => 'article #2', :profile_id => profile.id, :parent_id => root.id, :created_at => Time.now - 1.days) | |
66 | + a3 = fast_create(TextArticle, :name => 'article #3', :profile_id => profile.id, :parent_id => root.id, :created_at => Time.now) | |
67 | 67 | |
68 | 68 | block = RecentContentBlock.new |
69 | 69 | block.stubs(:holder).returns(profile) | ... | ... |
plugins/relevant_content/test/unit/article.rb
... | ... | @@ -29,9 +29,9 @@ class RelevantContentBlockTest < ActiveSupport::TestCase |
29 | 29 | |
30 | 30 | should 'list most commented articles' do |
31 | 31 | Article.delete_all |
32 | - a1 = create(TextileArticle, :name => "art 1", :profile_id => profile.id) | |
33 | - a2 = create(TextileArticle, :name => "art 2", :profile_id => profile.id) | |
34 | - a3 = create(TextileArticle, :name => "art 3", :profile_id => profile.id) | |
32 | + a1 = create(TextArticle, :name => "art 1", :profile_id => profile.id) | |
33 | + a2 = create(TextArticle, :name => "art 2", :profile_id => profile.id) | |
34 | + a3 = create(TextArticle, :name => "art 3", :profile_id => profile.id) | |
35 | 35 | |
36 | 36 | 2.times { Comment.create(:title => 'test', :body => 'asdsad', :author => profile, :source => a2).save! } |
37 | 37 | 4.times { Comment.create(:title => 'test', :body => 'asdsad', :author => profile, :source => a3).save! } | ... | ... |
plugins/send_email/doc/send_email.textile
... | ... | @@ -4,7 +4,7 @@ Allows to send e-mails through an e-mail form. |
4 | 4 | |
5 | 5 | h2. Usage |
6 | 6 | |
7 | -* Create a HTML form using RawHTMLBlock or RawHTMLArticle that invokes the {sendemail} action | |
7 | +* Create a HTML form using RawHTMLBlock that invokes the {sendemail} action | |
8 | 8 | * Add a "to" and "message" field and a submit button |
9 | 9 | * Make sure to fill in allowed 'to' addresses in plugin settings |
10 | 10 | ... | ... |
plugins/send_email/test/unit/send_email_plugin_test.rb
... | ... | @@ -29,8 +29,7 @@ class SendEmailPluginTest < ActiveSupport::TestCase |
29 | 29 | should 'expand macro used on form on profile context' do |
30 | 30 | profile = fast_create(Community) |
31 | 31 | @plugin.context.stubs(:profile).returns(profile) |
32 | - article = RawHTMLArticle.create!(:name => 'Raw HTML', :body => "<form action='{sendemail}'></form>", :profile => profile) | |
33 | - | |
32 | + article = TextArticle.create!(:name => 'Text HTML', :body => "<form action='{sendemail}'></form>", :profile => profile, :editor => Article::Editor::RAW_HTML) | |
34 | 33 | assert_match /profile\/#{profile.identifier}\/plugin\/send_email\/deliver/, @plugin.parse_content(article.to_html, nil).first |
35 | 34 | end |
36 | 35 | ... | ... |
plugins/solr/lib/ext/article.rb
... | ... | @@ -72,13 +72,7 @@ class Article |
72 | 72 | end |
73 | 73 | |
74 | 74 | def solr_plugin_f_type |
75 | - #join common types | |
76 | - case self.class.name | |
77 | - when 'TinyMceArticle', 'TextileArticle' | |
78 | - TextArticle.name | |
79 | - else | |
80 | - self.class.name | |
81 | - end | |
75 | + self.class.name | |
82 | 76 | end |
83 | 77 | |
84 | 78 | def solr_plugin_f_profile_type |
... | ... | @@ -111,8 +105,6 @@ class Article |
111 | 105 | # see http://stackoverflow.com/questions/4138957/activerecordsubclassnotfound-error-when-using-sti-in-rails/4139245 |
112 | 106 | UploadedFile |
113 | 107 | TextArticle |
114 | - TinyMceArticle | |
115 | - TextileArticle | |
116 | 108 | Folder |
117 | 109 | EnterpriseHomepage |
118 | 110 | Gallery | ... | ... |
plugins/solr/test/unit/article_test.rb
... | ... | @@ -82,7 +82,7 @@ class ArticleTest < ActiveSupport::TestCase |
82 | 82 | should 'index comments body together with article' do |
83 | 83 | TestSolr.enable |
84 | 84 | owner = create_user('testuser').person |
85 | - art = fast_create(TinyMceArticle, :profile_id => owner.id, :name => 'ytest') | |
85 | + art = fast_create(TextArticle, :profile_id => owner.id, :name => 'ytest') | |
86 | 86 | c1 = Comment.create!(:title => 'test comment', :body => 'anything', :author => owner, :source => art) |
87 | 87 | |
88 | 88 | assert_includes Article.find_by_contents('anything')[:results], art | ... | ... |
plugins/solr/test/unit/profile_test.rb
... | ... | @@ -131,7 +131,7 @@ class ProfileTest < ActiveSupport::TestCase |
131 | 131 | should 'index comments title together with article' do |
132 | 132 | TestSolr.enable |
133 | 133 | owner = create_user('testuser').person |
134 | - art = fast_create(TinyMceArticle, :profile_id => owner.id, :name => 'ytest') | |
134 | + art = fast_create(TextArticle, :profile_id => owner.id, :name => 'ytest') | |
135 | 135 | c1 = Comment.create(:title => 'a nice comment', :body => 'anything', :author => owner, :source => art ); c1.save! |
136 | 136 | |
137 | 137 | assert_includes Article.find_by_contents('nice')[:results], art | ... | ... |
plugins/solr/test/unit/text_article_test.rb
... | ... | @@ -8,10 +8,10 @@ class TextArticleTest < ActiveSupport::TestCase |
8 | 8 | |
9 | 9 | attr_accessor :environment |
10 | 10 | |
11 | - should 'found TextileArticle by TextArticle indexes' do | |
11 | + should 'found TextArticle by TextArticle indexes' do | |
12 | 12 | TestSolr.enable |
13 | 13 | person = create_user('testuser').person |
14 | - article = TextileArticle.create!(:name => 'found article test', :profile => person) | |
15 | - assert_equal TextileArticle.find_by_contents('found')[:results].docs, TextArticle.find_by_contents('found')[:results].docs | |
14 | + article = TextArticle.create!(:name => 'found article test', :profile => person) | |
15 | + assert_equal TextArticle.find_by_contents('found')[:results].docs, TextArticle.find_by_contents('found')[:results].docs | |
16 | 16 | end |
17 | 17 | end | ... | ... |
plugins/solr/test/unit/textile_article_test.rb
... | ... | @@ -1,10 +0,0 @@ |
1 | -require "#{File.dirname(__FILE__)}/../test_helper" | |
2 | - | |
3 | -class TextileArticleTest < ActiveSupport::TestCase | |
4 | - | |
5 | - should 'define type facet' do | |
6 | - a = TextileArticle.new | |
7 | - assert_equal TextArticle.type_name, TextileArticle.send(:solr_plugin_f_type_proc, a.send(:solr_plugin_f_type)) | |
8 | - end | |
9 | - | |
10 | -end |
plugins/solr/test/unit/tiny_mce_article_test.rb
... | ... | @@ -11,13 +11,13 @@ class TinyMceArticleTest < ActiveSupport::TestCase |
11 | 11 | |
12 | 12 | should 'be found when searching for articles by query' do |
13 | 13 | TestSolr.enable |
14 | - tma = TinyMceArticle.create!(:name => 'test tinymce article', :body => '---', :profile => profile) | |
15 | - assert_includes TinyMceArticle.find_by_contents('article')[:results], tma | |
14 | + tma = TextArticle.create!(:name => 'test tinymce article', :body => '---', :profile => profile) | |
15 | + assert_includes TextArticle.find_by_contents('article')[:results], tma | |
16 | 16 | assert_includes Article.find_by_contents('article')[:results], tma |
17 | 17 | end |
18 | 18 | |
19 | 19 | should 'define type facet' do |
20 | - a = TinyMceArticle.new | |
21 | - assert_equal TextArticle.type_name, TinyMceArticle.send(:solr_plugin_f_type_proc, a.send(:solr_plugin_f_type)) | |
20 | + a = TextArticle.new | |
21 | + assert_equal TextArticle.type_name, TextArticle.send(:solr_plugin_f_type_proc, a.send(:solr_plugin_f_type)) | |
22 | 22 | end |
23 | 23 | end | ... | ... |
plugins/variables/doc/variables.textile
... | ... | @@ -4,12 +4,12 @@ A set of simple variables to be used in a macro context. |
4 | 4 | |
5 | 5 | h2. Usage |
6 | 6 | |
7 | -* Create a HTML content using RawHTMLBlock, TinyMceArticle or other | |
7 | +* Create a HTML content using TextArticle or other | |
8 | 8 | article with HTML support |
9 | 9 | * Add a HTML div tag with css class "macro" (see Example) |
10 | 10 | * Add inner that div tag the variable desired, like {profile} |
11 | 11 | |
12 | -h2. Usage with TinyMceArticle | |
12 | +h2. Usage with TextArticle | |
13 | 13 | |
14 | 14 | The Noosfero's macros add a extra button in toolbar of the editor |
15 | 15 | to use macros in a single way, that way this plugin add a option | ... | ... |
plugins/vote/test/functional/vote_plugin_profile_controller_test.rb
... | ... | @@ -5,7 +5,7 @@ class VotePluginProfileControllerTest < ActionController::TestCase |
5 | 5 | |
6 | 6 | def setup |
7 | 7 | @profile = create_user('profile').person |
8 | - @article = TinyMceArticle.create!(:profile => @profile, :name => 'An article') | |
8 | + @article = TextArticle.create!(:profile => @profile, :name => 'An article') | |
9 | 9 | @comment = Comment.new(:source => @article, :author => @profile, :body => 'test') |
10 | 10 | @comment.save! |
11 | 11 | login_as(@profile.identifier) | ... | ... |
plugins/vote/test/unit/vote_plugin_test.rb
... | ... | @@ -5,7 +5,7 @@ class VotePluginTest < ActiveSupport::TestCase |
5 | 5 | def setup |
6 | 6 | @plugin = VotePlugin.new |
7 | 7 | @person = create_user('user').person |
8 | - @article = TinyMceArticle.create!(:profile => @person, :name => 'An article') | |
8 | + @article = TextArticle.create!(:profile => @person, :name => 'An article') | |
9 | 9 | @comment = Comment.create!(:source => @article, :author => @person, :body => 'test') |
10 | 10 | end |
11 | 11 | ... | ... |
public/javascripts/email_templates.js
... | ... | @@ -4,7 +4,7 @@ jQuery(document).ready(function($) { |
4 | 4 | |
5 | 5 | $.getJSON($(this).data('url'), {id: $(this).val()}, function(data) { |
6 | 6 | $('#mailing-form #mailing_subject').val(data.parsed_subject); |
7 | - $('#mailing-form .mceEditor').val(data.parsed_body); | |
7 | + $('#mailing-form .body').val(data.parsed_body); | |
8 | 8 | }); |
9 | 9 | }); |
10 | 10 | }); | ... | ... |
public/javascripts/tinymce.js
... | ... | @@ -13,10 +13,13 @@ noosfero.tinymce = { |
13 | 13 | }, |
14 | 14 | |
15 | 15 | init: function(_options) { |
16 | - var options = jQuery.extend({}, this.defaultOptions, _options) | |
16 | + var options = jQuery.extend({}, this.defaultOptions, _options); | |
17 | 17 | // just init. initing this is necessary to add some buttons to the toolbar |
18 | - tinymce.init(options) | |
19 | - // apply to selector | |
20 | - jQuery('.mceEditor').tinymce(options); | |
18 | + tinymce.init(options); | |
19 | +// var options = jQuery.extend({selector: '.tiny_mce_simple'}, this.defaultOptions, _options); | |
20 | +// delete options['toolbar2']; | |
21 | +// options['menubar'] = false; | |
22 | + // just init. initing this is necessary to add some buttons to the toolbar | |
23 | +// tinymce.init(options); | |
21 | 24 | }, |
22 | 25 | }; | ... | ... |
script/sample-articles
... | ... | @@ -9,13 +9,13 @@ TAGS = ['free-software', 'noosfero', 'development', 'rails', 'ruby'] |
9 | 9 | EVENT_SUBJECTS = ['International Conference on %s', '%s day', '%s World Congress', '%s World Forum', '%s Summit', '%s Week'] |
10 | 10 | THEMES = ['Sustainability', 'Free Software', 'Climate Change', 'Environment', 'Agile Development', 'Solidarity Economy', 'Debian', 'Perl'] |
11 | 11 | |
12 | -print "Creating some TinyMce articles: " | |
12 | +print "Creating some Text articles: " | |
13 | 13 | for subject in SUBJECTS |
14 | 14 | rand(20).times do |i| |
15 | 15 | profile = profiles.sample |
16 | 16 | name = "%s #{subject}" % profile.name |
17 | 17 | next if profile.articles.where(:slug => name.to_slug).first |
18 | - article = TinyMceArticle.new( | |
18 | + article = TextArticle.new( | |
19 | 19 | :name => name, |
20 | 20 | :body => name, |
21 | 21 | :tag_list => [TAGS.sample, TAGS.sample], |
... | ... | @@ -71,7 +71,7 @@ for subject in SUBJECTS |
71 | 71 | rand(20).times do |i| |
72 | 72 | profile = profiles.sample |
73 | 73 | name = "%s #{subject}" % profile.name |
74 | - article = TinyMceArticle.new( | |
74 | + article = TextArticle.new( | |
75 | 75 | :name => name, |
76 | 76 | :body => name, |
77 | 77 | :tag_list => [TAGS.sample, TAGS.sample], | ... | ... |
test/api/activities_test.rb
... | ... | @@ -107,7 +107,7 @@ class ActivitiesTest < ActiveSupport::TestCase |
107 | 107 | |
108 | 108 | should 'scrap activity return leave_scrap verb' do |
109 | 109 | ActionTracker::Record.destroy_all |
110 | - create(TinyMceArticle, :name => 'Tracked Article 1', :profile_id => person.id) | |
110 | + create(TextArticle, :name => 'Tracked Article 1', :profile_id => person.id) | |
111 | 111 | create(Scrap, :sender_id => person.id, :receiver_id => person.id) |
112 | 112 | get "/api/v1/profiles/#{person.id}/activities?#{params.to_query}" |
113 | 113 | json = JSON.parse(last_response.body) | ... | ... |
test/api/articles_test.rb
... | ... | @@ -37,8 +37,8 @@ class ArticlesTest < ActiveSupport::TestCase |
37 | 37 | should 'list all text articles' do |
38 | 38 | profile = Community.create(identifier: 'my-community', name: 'name-my-community') |
39 | 39 | a1 = fast_create(TextArticle, :profile_id => profile.id) |
40 | - a2 = fast_create(TextileArticle, :profile_id => profile.id) | |
41 | - a3 = fast_create(TinyMceArticle, :profile_id => profile.id) | |
40 | + a2 = fast_create(TextArticle, :profile_id => profile.id) | |
41 | + a3 = fast_create(TextArticle, :profile_id => profile.id) | |
42 | 42 | params['content_type']='TextArticle' |
43 | 43 | get "api/v1/communities/#{profile.id}/articles?#{params.to_query}" |
44 | 44 | json = JSON.parse(last_response.body) |
... | ... | @@ -138,8 +138,8 @@ class ArticlesTest < ActiveSupport::TestCase |
138 | 138 | should 'list all text articles of children' do |
139 | 139 | article = fast_create(Article, :profile_id => user.person.id, :name => "Some thing") |
140 | 140 | child1 = fast_create(TextArticle, :parent_id => article.id, :profile_id => user.person.id, :name => "Some thing 1") |
141 | - child2 = fast_create(TextileArticle, :parent_id => article.id, :profile_id => user.person.id, :name => "Some thing 2") | |
142 | - child3 = fast_create(TinyMceArticle, :parent_id => article.id, :profile_id => user.person.id, :name => "Some thing 3") | |
141 | + child2 = fast_create(TextArticle, :parent_id => article.id, :profile_id => user.person.id, :name => "Some thing 2") | |
142 | + child3 = fast_create(TextArticle, :parent_id => article.id, :profile_id => user.person.id, :name => "Some thing 3") | |
143 | 143 | get "/api/v1/articles/#{article.id}/children?#{params.to_query}" |
144 | 144 | json = JSON.parse(last_response.body) |
145 | 145 | assert_equivalent [child1.id, child2.id, child3.id], json["articles"].map { |a| a["id"] } |
... | ... | @@ -473,7 +473,7 @@ class ArticlesTest < ActiveSupport::TestCase |
473 | 473 | assert_kind_of TextArticle, Article.last |
474 | 474 | end |
475 | 475 | |
476 | - should "#{kind}: create article of TinyMceArticle type if no content type is passed as parameter" do | |
476 | + should "#{kind}: create article of TexrArticle type if no content type is passed as parameter" do | |
477 | 477 | profile = fast_create(kind.camelcase.constantize, :environment_id => environment.id) |
478 | 478 | Person.any_instance.stubs(:can_post_content?).with(profile).returns(true) |
479 | 479 | |
... | ... | @@ -481,7 +481,7 @@ class ArticlesTest < ActiveSupport::TestCase |
481 | 481 | post "/api/v1/#{kind.pluralize}/#{profile.id}/articles?#{params.to_query}" |
482 | 482 | json = JSON.parse(last_response.body) |
483 | 483 | |
484 | - assert_kind_of TinyMceArticle, Article.last | |
484 | + assert_kind_of TextArticle, Article.last | |
485 | 485 | end |
486 | 486 | |
487 | 487 | should "#{kind}: not create article with invalid article content type" do |
... | ... | @@ -567,12 +567,12 @@ class ArticlesTest < ActiveSupport::TestCase |
567 | 567 | assert_kind_of TextArticle, Article.last |
568 | 568 | end |
569 | 569 | |
570 | - should 'person create article of TinyMceArticle type if no content type is passed as parameter' do | |
570 | + should 'person create article of TextArticle type if no content type is passed as parameter' do | |
571 | 571 | params[:article] = {:name => "Title"} |
572 | 572 | post "/api/v1/people/#{user.person.id}/articles?#{params.to_query}" |
573 | 573 | json = JSON.parse(last_response.body) |
574 | 574 | |
575 | - assert_kind_of TinyMceArticle, Article.last | |
575 | + assert_kind_of TextArticle, Article.last | |
576 | 576 | end |
577 | 577 | |
578 | 578 | should 'person not create article with invalid article content type' do | ... | ... |
test/api/helpers_test.rb
... | ... | @@ -99,7 +99,7 @@ class Api::HelpersTest < ActiveSupport::TestCase |
99 | 99 | end |
100 | 100 | |
101 | 101 | should 'parse_content_type return all content types as an array' do |
102 | - assert_equivalent ['TextileArticle','TinyMceArticle'], parse_content_type("TextileArticle,TinyMceArticle") | |
102 | + assert_equivalent ['Event','TextArticle'], parse_content_type("Event,TextArticle") | |
103 | 103 | end |
104 | 104 | |
105 | 105 | should 'find_article return article by id in list passed for user with permission' do | ... | ... |
test/api/search_test.rb
... | ... | @@ -42,16 +42,16 @@ class SearchTest < ActiveSupport::TestCase |
42 | 42 | should 'not list articles of wrong type' do |
43 | 43 | Article.delete_all |
44 | 44 | fast_create(Article, :profile_id => person.id) |
45 | - get "/api/v1/search/article?type=TinyMceArticle" | |
45 | + get "/api/v1/search/article?type=TextArticle" | |
46 | 46 | json = JSON.parse(last_response.body) |
47 | 47 | assert_empty json['articles'] |
48 | 48 | end |
49 | 49 | |
50 | 50 | should 'list articles of one type' do |
51 | 51 | fast_create(Article, :profile_id => person.id) |
52 | - article = fast_create(TinyMceArticle, :profile_id => person.id) | |
52 | + article = fast_create(TextArticle, :profile_id => person.id) | |
53 | 53 | |
54 | - get "/api/v1/search/article?type=TinyMceArticle" | |
54 | + get "/api/v1/search/article?type=TextArticle" | |
55 | 55 | json = JSON.parse(last_response.body) |
56 | 56 | assert_equal article.id, json['articles'].first['id'] |
57 | 57 | end |
... | ... | @@ -59,8 +59,8 @@ class SearchTest < ActiveSupport::TestCase |
59 | 59 | should 'list articles of one type and query string' do |
60 | 60 | fast_create(Article, :profile_id => person.id, :name => 'some article') |
61 | 61 | fast_create(Article, :profile_id => person.id, :name => 'Some thing') |
62 | - article = fast_create(TinyMceArticle, :profile_id => person.id, :name => 'Some thing') | |
63 | - get "/api/v1/search/article?type=TinyMceArticle&query=thing" | |
62 | + article = fast_create(TextArticle, :profile_id => person.id, :name => 'Some thing') | |
63 | + get "/api/v1/search/article?type=TextArticle&query=thing" | |
64 | 64 | json = JSON.parse(last_response.body) |
65 | 65 | assert_equal 1, json['articles'].count |
66 | 66 | assert_equal article.id, json['articles'].first['id'] | ... | ... |
test/fixtures/articles.yml
test/functional/application_controller_test.rb
... | ... | @@ -97,38 +97,6 @@ class ApplicationControllerTest < ActionController::TestCase |
97 | 97 | }) |
98 | 98 | end |
99 | 99 | |
100 | - def test_should_generate_help_box_expanding_textile_markup_when_passing_string | |
101 | - get :help_textile_with_string | |
102 | - assert_tag({ | |
103 | - :tag => 'div', | |
104 | - :attributes => { :class => 'help_box'}, | |
105 | - :descendant => { | |
106 | - :tag => 'div', | |
107 | - :attributes => { :class => 'help_message', :style => /display:\s+none/}, | |
108 | - :descendant => { | |
109 | - :tag => 'strong', | |
110 | - :content => /my_bold_help_message/ | |
111 | - } | |
112 | - } | |
113 | - }) | |
114 | - end | |
115 | - | |
116 | - def test_should_generate_help_box_expanding_textile_markup_when_passing_block | |
117 | - get :help_textile_with_block | |
118 | - assert_tag({ | |
119 | - :tag => 'div', | |
120 | - :attributes => { :class => 'help_box'}, | |
121 | - :descendant => { | |
122 | - :tag => 'div', | |
123 | - :attributes => { :class => 'help_message', :style => /display:\s+none/}, | |
124 | - :descendant => { | |
125 | - :tag => 'strong', | |
126 | - :content => /my_bold_help_message/ | |
127 | - } | |
128 | - } | |
129 | - }) | |
130 | - end | |
131 | - | |
132 | 100 | def test_shouldnt_generate_help_box_markup_when_no_block_is_passed |
133 | 101 | get :help_without_block |
134 | 102 | assert_no_tag({ | ... | ... |
test/functional/cms_controller_test.rb
... | ... | @@ -50,26 +50,26 @@ class CmsControllerTest < ActionController::TestCase |
50 | 50 | assert_template 'select_article_type' |
51 | 51 | |
52 | 52 | # TODO add more types here !! |
53 | - [ TinyMceArticle, TextileArticle ].each do |item| | |
53 | + [TextArticle ].each do |item| | |
54 | 54 | assert_tag :tag => 'a', :attributes => { :href => "/myprofile/#{profile.identifier}/cms/new?type=#{item.name}" } |
55 | 55 | end |
56 | 56 | end |
57 | 57 | |
58 | 58 | should 'present edit screen after choosing article type' do |
59 | - get :new, :profile => profile.identifier, :type => 'TinyMceArticle' | |
59 | + get :new, :profile => profile.identifier, :type => 'TextArticle' | |
60 | 60 | assert_template 'edit' |
61 | 61 | |
62 | - assert_tag :tag => 'form', :attributes => { :action => "/myprofile/#{profile.identifier}/cms/new", :method => /post/i }, :descendant => { :tag => "input", :attributes => { :type => 'hidden', :value => 'TinyMceArticle' }} | |
62 | + assert_tag :tag => 'form', :attributes => { :action => "/myprofile/#{profile.identifier}/cms/new", :method => /post/i }, :descendant => { :tag => "input", :attributes => { :type => 'hidden', :value => 'TextArticle' }} | |
63 | 63 | end |
64 | 64 | |
65 | 65 | should 'be able to save a document' do |
66 | 66 | assert_difference 'Article.count' do |
67 | - post :new, :type => 'TinyMceArticle', :profile => profile.identifier, :article => { :name => 'a test article', :body => 'the text of the article ...' } | |
67 | + post :new, :type => 'TextArticle', :profile => profile.identifier, :article => { :name => 'a test article', :body => 'the text of the article ...' } | |
68 | 68 | end |
69 | 69 | end |
70 | 70 | |
71 | 71 | should 'display set as home page link to non folder' do |
72 | - a = fast_create(TextileArticle, :profile_id => profile.id, :updated_at => DateTime.now) | |
72 | + a = fast_create(TextArticle, :profile_id => profile.id, :updated_at => DateTime.now) | |
73 | 73 | Article.stubs(:short_description).returns('bli') |
74 | 74 | get :index, :profile => profile.identifier |
75 | 75 | assert_tag :tag => 'a', :content => 'Use as homepage', :attributes => { :href => "/myprofile/#{profile.identifier}/cms/set_home_page/#{a.id}" } |
... | ... | @@ -198,7 +198,7 @@ class CmsControllerTest < ActionController::TestCase |
198 | 198 | should 'set last_changed_by when creating article' do |
199 | 199 | login_as(profile.identifier) |
200 | 200 | |
201 | - post :new, :type => 'TinyMceArticle', :profile => profile.identifier, :article => { :name => 'changed by me', :body => 'content ...' } | |
201 | + post :new, :type => 'TextArticle', :profile => profile.identifier, :article => { :name => 'changed by me', :body => 'content ...' } | |
202 | 202 | |
203 | 203 | a = profile.articles.find_by(path: 'changed-by-me') |
204 | 204 | assert_not_nil a |
... | ... | @@ -222,7 +222,7 @@ class CmsControllerTest < ActionController::TestCase |
222 | 222 | |
223 | 223 | should 'be able to set label to article image' do |
224 | 224 | login_as(profile.identifier) |
225 | - post :new, :type => TextileArticle.name, :profile => profile.identifier, | |
225 | + post :new, :type => TextArticle.name, :profile => profile.identifier, | |
226 | 226 | :article => { |
227 | 227 | :name => 'adding-image-label', |
228 | 228 | :image_builder => { |
... | ... | @@ -449,7 +449,7 @@ class CmsControllerTest < ActionController::TestCase |
449 | 449 | article.save! |
450 | 450 | |
451 | 451 | get :new, :profile => profile.identifier, :parent_id => article.id, :cms => true |
452 | - assert_tag :tag => 'a', :attributes => { :href => "/myprofile/#{profile.identifier}/cms/new?parent_id=#{article.id}&type=TextileArticle"} | |
452 | + assert_tag :tag => 'a', :attributes => { :href => "/myprofile/#{profile.identifier}/cms/new?parent_id=#{article.id}&type=TextArticle"} | |
453 | 453 | end |
454 | 454 | |
455 | 455 | should 'not offer to create children if article does not accept them' do |
... | ... | @@ -510,7 +510,7 @@ class CmsControllerTest < ActionController::TestCase |
510 | 510 | c3 = env.categories.build(:name => "Test Category 3"); c3.save! |
511 | 511 | |
512 | 512 | # post is in c1 and c3 |
513 | - post :new, :type => TextileArticle.name, :profile => profile.identifier, :article => { :name => 'adding-categories-test', :category_ids => [ c1.id, c3.id] } | |
513 | + post :new, :type => TextArticle.name, :profile => profile.identifier, :article => { :name => 'adding-categories-test', :category_ids => [ c1.id, c3.id] } | |
514 | 514 | |
515 | 515 | saved = profile.articles.find_by(name: 'adding-categories-test') |
516 | 516 | assert_includes saved.categories, c1 |
... | ... | @@ -525,34 +525,34 @@ class CmsControllerTest < ActionController::TestCase |
525 | 525 | c3 = env.categories.build(:name => "Test Category 3"); c3.save! |
526 | 526 | |
527 | 527 | # post is in c1, c3 and c3 |
528 | - post :new, :type => TextileArticle.name, :profile => profile.identifier, :article => { :name => 'adding-categories-test', :category_ids => [ c1.id, c3.id, c3.id ] } | |
528 | + post :new, :type => TextArticle.name, :profile => profile.identifier, :article => { :name => 'adding-categories-test', :category_ids => [ c1.id, c3.id, c3.id ] } | |
529 | 529 | |
530 | 530 | saved = profile.articles.find_by(name: 'adding-categories-test') |
531 | 531 | assert_equivalent [c1, c3], saved.categories.all |
532 | 532 | end |
533 | 533 | |
534 | 534 | should 'filter html with white_list from tiny mce article name' do |
535 | - post :new, :type => 'TinyMceArticle', :profile => profile.identifier, :article => { :name => "<strong>test</strong>", :body => 'the text of the article ...' } | |
535 | + post :new, :type => 'TextArticle', :profile => profile.identifier, :article => { :name => "<strong>test</strong>", :body => 'the text of the article ...' } | |
536 | 536 | assert_equal "<strong>test</strong>", assigns(:article).name |
537 | 537 | end |
538 | 538 | |
539 | 539 | should 'filter html with white_list from tiny mce article abstract' do |
540 | - post :new, :type => 'TinyMceArticle', :profile => profile.identifier, :article => { :name => 'article', :abstract => "<script>alert('text')</script> article", :body => 'the text of the article ...' } | |
540 | + post :new, :type => 'TextArticle', :profile => profile.identifier, :article => { :name => 'article', :abstract => "<script>alert('text')</script> article", :body => 'the text of the article ...' } | |
541 | 541 | assert_equal "alert('text') article", assigns(:article).abstract |
542 | 542 | end |
543 | 543 | |
544 | 544 | should 'filter html with white_list from tiny mce article body' do |
545 | - post :new, :type => 'TinyMceArticle', :profile => profile.identifier, :article => { :name => 'article', :abstract => 'abstract', :body => "the <script>alert('text')</script> of article ..." } | |
545 | + post :new, :type => 'TextArticle', :profile => profile.identifier, :article => { :name => 'article', :abstract => 'abstract', :body => "the <script>alert('text')</script> of article ..." } | |
546 | 546 | assert_equal "the alert('text') of article ...", assigns(:article).body |
547 | 547 | end |
548 | 548 | |
549 | 549 | should 'not filter html tags permitted from tiny mce article body' do |
550 | - post :new, :type => 'TinyMceArticle', :profile => profile.identifier, :article => { :name => 'article', :abstract => 'abstract', :body => "<b>the</b> <script>alert('text')</script> <strong>of</strong> article ..." } | |
550 | + post :new, :type => 'TextArticle', :profile => profile.identifier, :article => { :name => 'article', :abstract => 'abstract', :body => "<b>the</b> <script>alert('text')</script> <strong>of</strong> article ..." } | |
551 | 551 | assert_equal "<b>the</b> alert('text') <strong>of</strong> article ...", assigns(:article).body |
552 | 552 | end |
553 | 553 | |
554 | 554 | should 'sanitize tags' do |
555 | - post :new, :type => 'TextileArticle', :profile => profile.identifier, :article => { :name => 'a test article', :body => 'the text of the article ...', :tag_list => 'tag1, <strong>tag2</strong>' } | |
555 | + post :new, :type => 'TextArticle', :profile => profile.identifier, :article => { :name => 'a test article', :body => 'the text of the article ...', :tag_list => 'tag1, <strong>tag2</strong>' } | |
556 | 556 | assert_sanitized assigns(:article).tag_list.join(', ') |
557 | 557 | end |
558 | 558 | |
... | ... | @@ -562,7 +562,7 @@ class CmsControllerTest < ActionController::TestCase |
562 | 562 | profile.home_page = profile.blogs.find_by name: "Sample blog" |
563 | 563 | profile.save! |
564 | 564 | |
565 | - get :new, :profile => @profile.identifier, :parent_id => profile.home_page.id, :type => 'TextileArticle' | |
565 | + get :new, :profile => @profile.identifier, :parent_id => profile.home_page.id, :type => 'TextArticle' | |
566 | 566 | assert_tag :tag => 'select', |
567 | 567 | :attributes => { :id => 'article_parent_id' }, |
568 | 568 | :child => { |
... | ... | @@ -574,7 +574,7 @@ class CmsControllerTest < ActionController::TestCase |
574 | 574 | profile.articles.destroy_all |
575 | 575 | |
576 | 576 | folder1 = fast_create(Folder, :profile_id => profile.id, :updated_at => DateTime.now - 1.hour) |
577 | - article = fast_create(TextileArticle, :profile_id => profile.id, :updated_at => DateTime.now) | |
577 | + article = fast_create(TextArticle, :profile_id => profile.id, :updated_at => DateTime.now) | |
578 | 578 | folder2 = fast_create(Folder, :profile_id => profile.id, :updated_at => DateTime.now + 1.hour) |
579 | 579 | |
580 | 580 | get :index, :profile => profile.identifier |
... | ... | @@ -586,7 +586,7 @@ class CmsControllerTest < ActionController::TestCase |
586 | 586 | |
587 | 587 | parent = fast_create(Folder, :profile_id => profile.id) |
588 | 588 | folder1 = fast_create(Folder, :parent_id => parent.id, :profile_id => profile.id, :updated_at => DateTime.now - 1.hour) |
589 | - article = fast_create(TextileArticle, :parent_id => parent.id, :profile_id => profile.id, :updated_at => DateTime.now) | |
589 | + article = fast_create(TextArticle, :parent_id => parent.id, :profile_id => profile.id, :updated_at => DateTime.now) | |
590 | 590 | folder2 = fast_create(Folder, :parent_id => parent.id, :profile_id => profile.id, :updated_at => DateTime.now + 1.hour) |
591 | 591 | |
592 | 592 | get :view, :profile => profile.identifier, :id => parent.id |
... | ... | @@ -606,14 +606,14 @@ class CmsControllerTest < ActionController::TestCase |
606 | 606 | end |
607 | 607 | |
608 | 608 | should 'redirect to article after creating top-level article' do |
609 | - post :new, :profile => profile.identifier, :type => 'TextileArticle', :article => { :name => 'top-level-article' } | |
609 | + post :new, :profile => profile.identifier, :type => 'TextArticle', :article => { :name => 'top-level-article' } | |
610 | 610 | |
611 | 611 | assert_redirected_to @profile.articles.find_by(name: 'top-level-article').url |
612 | 612 | end |
613 | 613 | |
614 | 614 | should 'redirect to article after creating article inside a folder' do |
615 | 615 | f = Folder.new(:name => 'f'); profile.articles << f; f.save! |
616 | - post :new, :profile => profile.identifier, :type => 'TextileArticle', :parent_id => f.id, :article => { :name => 'article-inside-folder' } | |
616 | + post :new, :profile => profile.identifier, :type => 'TextArticle', :parent_id => f.id, :article => { :name => 'article-inside-folder' } | |
617 | 617 | |
618 | 618 | assert_redirected_to @profile.articles.find_by(name: 'article-inside-folder').url |
619 | 619 | end |
... | ... | @@ -626,7 +626,7 @@ class CmsControllerTest < ActionController::TestCase |
626 | 626 | |
627 | 627 | should 'redirect back to article after editing article inside a folder' do |
628 | 628 | f = Folder.new(:name => 'f'); profile.articles << f; f.save! |
629 | - a = create(TextileArticle, :parent => f, :name => 'article-inside-folder', :profile_id => profile.id) | |
629 | + a = create(TextArticle, :parent => f, :name => 'article-inside-folder', :profile_id => profile.id) | |
630 | 630 | |
631 | 631 | post :edit, :profile => profile.identifier, :id => a.id |
632 | 632 | assert_redirected_to @profile.articles.find_by(name: 'article-inside-folder').url |
... | ... | @@ -653,7 +653,7 @@ class CmsControllerTest < ActionController::TestCase |
653 | 653 | |
654 | 654 | should 'point back to folder when cancelling edition of an article inside it' do |
655 | 655 | f = Folder.new(:name => 'f'); profile.articles << f; f.save! |
656 | - a = create(TextileArticle, :name => 'test', :parent => f, :profile_id => profile.id) | |
656 | + a = create(TextArticle, :name => 'test', :parent => f, :profile_id => profile.id) | |
657 | 657 | get :edit, :profile => profile.identifier, :id => a.id |
658 | 658 | |
659 | 659 | assert_tag :tag => 'a', :attributes => { :href => "/myprofile/#{profile.identifier}/cms/view/#{f.id}" }, :descendant => { :content => /Cancel/ } |
... | ... | @@ -723,15 +723,15 @@ class CmsControllerTest < ActionController::TestCase |
723 | 723 | end |
724 | 724 | |
725 | 725 | should 'be able to add image with alignment' do |
726 | - post :new, :type => 'TinyMceArticle', :profile => profile.identifier, :article => { :name => 'image-alignment', :body => "the text of the article with image <img src='#' align='right'/> right align..." } | |
727 | - saved = TinyMceArticle.find_by(name: 'image-alignment') | |
726 | + post :new, :type => 'TextArticle', :profile => profile.identifier, :article => { :name => 'image-alignment', :body => "the text of the article with image <img src='#' align='right'/> right align..." } | |
727 | + saved = TextArticle.find_by(name: 'image-alignment') | |
728 | 728 | assert_match /<img.*src="#".*>/, saved.body |
729 | 729 | assert_match /<img.*align="right".*>/, saved.body |
730 | 730 | end |
731 | 731 | |
732 | 732 | should 'be able to add image with alignment when textile' do |
733 | - post :new, :type => 'TextileArticle', :profile => profile.identifier, :article => { :name => 'image-alignment', :body => "the text of the article with image <img src='#' align='right'/> right align..." } | |
734 | - saved = TextileArticle.find_by(name: 'image-alignment') | |
733 | + post :new, :type => 'TextArticle', :profile => profile.identifier, :article => { :name => 'image-alignment', :body => "the text of the article with image <img src='#' align='right'/> right align..." } | |
734 | + saved = TextArticle.find_by(name: 'image-alignment') | |
735 | 735 | assert_match /align="right"/, saved.body |
736 | 736 | end |
737 | 737 | |
... | ... | @@ -778,19 +778,19 @@ class CmsControllerTest < ActionController::TestCase |
778 | 778 | |
779 | 779 | should 'record as coming from public view when creating article' do |
780 | 780 | @request.expects(:referer).returns('http://colivre.net/testinguser/testingusers-home-page').at_least_once |
781 | - get :new, :profile => 'testinguser', :type => 'TextileArticle' | |
781 | + get :new, :profile => 'testinguser', :type => 'TextArticle' | |
782 | 782 | assert_tag :tag => 'input', :attributes => { :type => 'hidden', :name => 'back_to', :value => @request.referer } |
783 | 783 | assert_tag :tag => 'a', :descendant => { :content => 'Cancel' }, :attributes => { :href => 'http://colivre.net/testinguser/testingusers-home-page' } |
784 | 784 | end |
785 | 785 | |
786 | 786 | should 'go to public view after creating article coming from there' do |
787 | - post :new, :profile => 'testinguser', :type => 'TextileArticle', :back_to => 'public_view', :article => { :name => 'new-article-from-public-view' } | |
787 | + post :new, :profile => 'testinguser', :type => 'TextArticle', :back_to => 'public_view', :article => { :name => 'new-article-from-public-view' } | |
788 | 788 | assert_response :redirect |
789 | 789 | assert_redirected_to @profile.articles.find_by(name: 'new-article-from-public-view').url |
790 | 790 | end |
791 | 791 | |
792 | 792 | should 'keep the back_to hint in unsuccessfull saves' do |
793 | - post :new, :profile => 'testinguser', :type => 'TextileArticle', :back_to => 'public_view', :article => { } | |
793 | + post :new, :profile => 'testinguser', :type => 'TextArticle', :back_to => 'public_view', :article => { } | |
794 | 794 | assert_response :success |
795 | 795 | assert_tag :tag => "input", :attributes => { :type => 'hidden', :name => 'back_to', :value => 'public_view' } |
796 | 796 | end |
... | ... | @@ -798,7 +798,7 @@ class CmsControllerTest < ActionController::TestCase |
798 | 798 | should 'create a private article child of private folder' do |
799 | 799 | folder = build(Folder, :name => 'my intranet', :published => false); profile.articles << folder; folder.save! |
800 | 800 | |
801 | - post :new, :profile => profile.identifier, :type => 'TextileArticle', :parent_id => folder.id, :article => { :name => 'new-private-article'} | |
801 | + post :new, :profile => profile.identifier, :type => 'TextArticle', :parent_id => folder.id, :article => { :name => 'new-private-article'} | |
802 | 802 | folder.reload |
803 | 803 | |
804 | 804 | refute assigns(:article).published? |
... | ... | @@ -1198,7 +1198,7 @@ class CmsControllerTest < ActionController::TestCase |
1198 | 1198 | end |
1199 | 1199 | end |
1200 | 1200 | |
1201 | - should 'display media listing when it is TinyMceArticle and enabled on environment' do | |
1201 | + should 'display media listing when it is TextArticle and enabled on environment' do | |
1202 | 1202 | e = Environment.default |
1203 | 1203 | e.enable('media_panel') |
1204 | 1204 | e.save! |
... | ... | @@ -1209,7 +1209,7 @@ class CmsControllerTest < ActionController::TestCase |
1209 | 1209 | image = UploadedFile.create!(:profile => profile, :parent => image_folder, :uploaded_data => fixture_file_upload('/files/rails.png', 'image/png')) |
1210 | 1210 | file = UploadedFile.create!(:profile => profile, :parent => non_image_folder, :uploaded_data => fixture_file_upload('/files/test.txt', 'text/plain')) |
1211 | 1211 | |
1212 | - get :new, :profile => profile.identifier, :type => 'TinyMceArticle' | |
1212 | + get :new, :profile => profile.identifier, :type => 'TextArticle' | |
1213 | 1213 | assert_tag :div, :attributes => { :class => "text-editor-sidebar" } |
1214 | 1214 | end |
1215 | 1215 | |
... | ... | @@ -1225,7 +1225,7 @@ class CmsControllerTest < ActionController::TestCase |
1225 | 1225 | end |
1226 | 1226 | |
1227 | 1227 | should "display 'Publish' when profile is a person and is member of communities" do |
1228 | - a = fast_create(TextileArticle, :profile_id => profile.id, :updated_at => DateTime.now) | |
1228 | + a = fast_create(TextArticle, :profile_id => profile.id, :updated_at => DateTime.now) | |
1229 | 1229 | c1 = fast_create(Community) |
1230 | 1230 | c2 = fast_create(Community) |
1231 | 1231 | c1.add_member(profile) |
... | ... | @@ -1235,7 +1235,7 @@ class CmsControllerTest < ActionController::TestCase |
1235 | 1235 | end |
1236 | 1236 | |
1237 | 1237 | should "display 'Publish' when profile is a person and there is a portal community" do |
1238 | - a = fast_create(TextileArticle, :profile_id => profile.id, :updated_at => DateTime.now) | |
1238 | + a = fast_create(TextArticle, :profile_id => profile.id, :updated_at => DateTime.now) | |
1239 | 1239 | environment = profile.environment |
1240 | 1240 | environment.portal_community = fast_create(Community) |
1241 | 1241 | environment.enable('use_portal_community') |
... | ... | @@ -1247,7 +1247,7 @@ class CmsControllerTest < ActionController::TestCase |
1247 | 1247 | should "display 'Publish' when profile is a community" do |
1248 | 1248 | community = fast_create(Community) |
1249 | 1249 | community.add_admin(profile) |
1250 | - a = fast_create(TextileArticle, :profile_id => community.id, :updated_at => DateTime.now) | |
1250 | + a = fast_create(TextArticle, :profile_id => community.id, :updated_at => DateTime.now) | |
1251 | 1251 | Article.stubs(:short_description).returns('bli') |
1252 | 1252 | get :index, :profile => community.identifier |
1253 | 1253 | assert_tag :tag => 'a', :attributes => {:href => "/myprofile/#{community.identifier}/cms/publish/#{a.id}"} |
... | ... | @@ -1279,7 +1279,7 @@ class CmsControllerTest < ActionController::TestCase |
1279 | 1279 | login_as :test_user |
1280 | 1280 | @controller.stubs(:user).returns(u) |
1281 | 1281 | |
1282 | - get :new, :profile => c.identifier, :type => 'TinyMceArticle' | |
1282 | + get :new, :profile => c.identifier, :type => 'TextArticle' | |
1283 | 1283 | assert_response :success |
1284 | 1284 | assert_template 'edit' |
1285 | 1285 | end |
... | ... | @@ -1496,12 +1496,14 @@ class CmsControllerTest < ActionController::TestCase |
1496 | 1496 | assert_select '#dynamic_recaptcha', 0 |
1497 | 1497 | end |
1498 | 1498 | |
1499 | - should 'render TinyMce Editor on suggestion of article' do | |
1499 | + should 'render TinyMce Editor on suggestion of article if editor is TinyMCE' do | |
1500 | 1500 | logout |
1501 | + profile.editor = Article::Editor::TINY_MCE | |
1502 | + profile.save | |
1501 | 1503 | get :suggest_an_article, :profile => profile.identifier |
1502 | 1504 | |
1503 | - assert_tag :tag => 'textarea', :attributes => { :name => /task\[article\]\[abstract\]/, :class => 'mceEditor' } | |
1504 | - assert_tag :tag => 'textarea', :attributes => { :name => /task\[article\]\[body\]/, :class => 'mceEditor' } | |
1505 | + assert_tag :tag => 'textarea', :attributes => { :name => /task\[article\]\[abstract\]/, :class => Article::Editor::TINY_MCE } | |
1506 | + assert_tag :tag => 'textarea', :attributes => { :name => /task\[article\]\[body\]/, :class => Article::Editor::TINY_MCE } | |
1505 | 1507 | end |
1506 | 1508 | |
1507 | 1509 | should 'create a task suggest task to a profile' do |
... | ... | @@ -1537,7 +1539,7 @@ class CmsControllerTest < ActionController::TestCase |
1537 | 1539 | e = Environment.default |
1538 | 1540 | e.languages = ['ru'] |
1539 | 1541 | e.save |
1540 | - textile = fast_create(TextileArticle, :profile_id => @profile.id, :path => 'textile', :language => 'ru') | |
1542 | + textile = fast_create(TextArticle, :profile_id => @profile.id, :path => 'textile', :language => 'ru') | |
1541 | 1543 | get :edit, :profile => @profile.identifier, :id => textile.id |
1542 | 1544 | assert_tag :option, :attributes => { :selected => 'selected', :value => 'ru' }, :parent => { |
1543 | 1545 | :tag => 'select', :attributes => { :id => 'article_language'} } |
... | ... | @@ -1547,16 +1549,16 @@ class CmsControllerTest < ActionController::TestCase |
1547 | 1549 | e = Environment.default |
1548 | 1550 | e.languages = ['en', 'pt','fr','hy','de', 'ru', 'es', 'eo', 'it'] |
1549 | 1551 | e.save |
1550 | - get :new, :profile => @profile.identifier, :type => 'TextileArticle' | |
1552 | + get :new, :profile => @profile.identifier, :type => 'TextArticle' | |
1551 | 1553 | assert_equal Noosfero.locales.invert, assigns(:locales) |
1552 | 1554 | assert_tag :option, :attributes => { :value => '' }, :parent => { |
1553 | 1555 | :tag => 'select', :attributes => { :id => 'article_language'} } |
1554 | 1556 | end |
1555 | 1557 | |
1556 | 1558 | should 'add translation to an article' do |
1557 | - textile = fast_create(TextileArticle, :profile_id => @profile.id, :path => 'textile', :language => 'ru') | |
1559 | + textile = fast_create(TextArticle, :profile_id => @profile.id, :path => 'textile', :language => 'ru') | |
1558 | 1560 | assert_difference 'Article.count' do |
1559 | - post :new, :profile => @profile.identifier, :type => 'TextileArticle', :article => { :name => 'english translation', :translation_of_id => textile.id, :language => 'en' } | |
1561 | + post :new, :profile => @profile.identifier, :type => 'TextArticle', :article => { :name => 'english translation', :translation_of_id => textile.id, :language => 'en' } | |
1560 | 1562 | end |
1561 | 1563 | end |
1562 | 1564 | |
... | ... | @@ -1616,20 +1618,20 @@ class CmsControllerTest < ActionController::TestCase |
1616 | 1618 | |
1617 | 1619 | should 'display accept comments option when creating forum post' do |
1618 | 1620 | profile.articles << f = Forum.new(:name => 'Forum for test') |
1619 | - get :new, :profile => profile.identifier, :type => 'TinyMceArticle', :parent_id => f.id | |
1621 | + get :new, :profile => profile.identifier, :type => 'TextArticle', :parent_id => f.id | |
1620 | 1622 | assert_no_tag :tag => 'input', :attributes => {:name => 'article[accept_comments]', :value => 1, :type => 'hidden'} |
1621 | 1623 | assert_tag :tag => 'input', :attributes => {:name => 'article[accept_comments]', :value => 1, :type => 'checkbox'} |
1622 | 1624 | end |
1623 | 1625 | |
1624 | 1626 | should 'display accept comments option when creating an article that is not a forum post' do |
1625 | - get :new, :profile => profile.identifier, :type => 'TinyMceArticle' | |
1627 | + get :new, :profile => profile.identifier, :type => 'TextArticle' | |
1626 | 1628 | assert_no_tag :tag => 'input', :attributes => {:name => 'article[accept_comments]', :value => 1, :type => 'hidden'} |
1627 | 1629 | assert_tag :tag => 'input', :attributes => {:name => 'article[accept_comments]', :value => 1, :type => 'checkbox'} |
1628 | 1630 | end |
1629 | 1631 | |
1630 | 1632 | should 'display accept comments option when editing forum post' do |
1631 | 1633 | profile.articles << f = Forum.new(:name => 'Forum for test') |
1632 | - profile.articles << a = TinyMceArticle.new(:name => 'Forum post for test', :parent => f) | |
1634 | + profile.articles << a = TextArticle.new(:name => 'Forum post for test', :parent => f) | |
1633 | 1635 | get :edit, :profile => profile.identifier, :id => a.id |
1634 | 1636 | assert_no_tag :tag => 'input', :attributes => {:name => 'article[accept_comments]', :value => 1, :type => 'hidden'} |
1635 | 1637 | assert_tag :tag => 'input', :attributes => {:name => 'article[accept_comments]', :value => 1, :type => 'checkbox'} |
... | ... | @@ -1642,7 +1644,7 @@ class CmsControllerTest < ActionController::TestCase |
1642 | 1644 | :topic_creation => 'self', |
1643 | 1645 | :body => 'Forum Body') |
1644 | 1646 | |
1645 | - post :new, :profile => profile.identifier, :type => 'TinyMceArticle', | |
1647 | + post :new, :profile => profile.identifier, :type => 'TextArticle', | |
1646 | 1648 | :article => {:name => 'New Topic by linux', :body => 'Article Body', |
1647 | 1649 | :parent_id => f.id} |
1648 | 1650 | |
... | ... | @@ -1657,7 +1659,7 @@ class CmsControllerTest < ActionController::TestCase |
1657 | 1659 | :topic_creation => 'related', |
1658 | 1660 | :body => 'Forum Body') |
1659 | 1661 | |
1660 | - post :new, :profile => profile.identifier, :type => 'TinyMceArticle', | |
1662 | + post :new, :profile => profile.identifier, :type => 'TextArticle', | |
1661 | 1663 | :article => {:name => 'New Topic by linux', :body => 'Article Body', |
1662 | 1664 | :parent_id => f.id} |
1663 | 1665 | |
... | ... | @@ -1672,7 +1674,7 @@ class CmsControllerTest < ActionController::TestCase |
1672 | 1674 | :topic_creation => 'users', |
1673 | 1675 | :body => 'Forum Body') |
1674 | 1676 | |
1675 | - post :new, :profile => profile.identifier, :type => 'TinyMceArticle', | |
1677 | + post :new, :profile => profile.identifier, :type => 'TextArticle', | |
1676 | 1678 | :article => {:name => 'New Topic by linux', :body => 'Article Body', |
1677 | 1679 | :parent_id => f.id} |
1678 | 1680 | |
... | ... | @@ -1681,13 +1683,13 @@ class CmsControllerTest < ActionController::TestCase |
1681 | 1683 | |
1682 | 1684 | should 'display accept comments option when editing forum post with a different label' do |
1683 | 1685 | profile.articles << f = Forum.new(:name => 'Forum for test') |
1684 | - profile.articles << a = TinyMceArticle.new(:name => 'Forum post for test', :parent => f) | |
1686 | + profile.articles << a = TextArticle.new(:name => 'Forum post for test', :parent => f) | |
1685 | 1687 | get :edit, :profile => profile.identifier, :id => a.id |
1686 | 1688 | assert_tag :tag => 'label', :attributes => { :for => 'article_accept_comments' }, :content => _('This topic is opened for replies') |
1687 | 1689 | end |
1688 | 1690 | |
1689 | 1691 | should 'display correct label for accept comments option for an article that is not a forum post' do |
1690 | - profile.articles << a = TinyMceArticle.new(:name => 'Forum post for test') | |
1692 | + profile.articles << a = TextArticle.new(:name => 'Forum post for test') | |
1691 | 1693 | get :edit, :profile => profile.identifier, :id => a.id |
1692 | 1694 | assert_tag :tag => 'label', :attributes => { :for => 'article_accept_comments' }, :content => _('I want to receive comments about this article') |
1693 | 1695 | end |
... | ... | @@ -1711,7 +1713,7 @@ class CmsControllerTest < ActionController::TestCase |
1711 | 1713 | end |
1712 | 1714 | |
1713 | 1715 | should 'update article and be redirect to view_page' do |
1714 | - a = fast_create(TextileArticle, :profile_id => @profile.id) | |
1716 | + a = fast_create(TextArticle, :profile_id => @profile.id) | |
1715 | 1717 | post :edit, :profile => @profile.identifier, :id => a.id, :article => { } |
1716 | 1718 | assert_redirected_to a.view_url |
1717 | 1719 | end |
... | ... | @@ -1730,12 +1732,14 @@ class CmsControllerTest < ActionController::TestCase |
1730 | 1732 | end |
1731 | 1733 | |
1732 | 1734 | should 'render TinyMce Editor for events' do |
1735 | + profile.editor = Article::Editor::TINY_MCE | |
1736 | + profile.save | |
1733 | 1737 | get :new, :profile => @profile.identifier, :type => 'Event' |
1734 | - assert_tag :tag => 'textarea', :attributes => { :class => 'mceEditor' } | |
1738 | + assert_tag :tag => 'textarea', :attributes => { :class => Article::Editor::TINY_MCE } | |
1735 | 1739 | end |
1736 | 1740 | |
1737 | 1741 | should 'identify form with classname of edited article' do |
1738 | - [Blog, TinyMceArticle, Forum].each do |klass| | |
1742 | + [Blog, TextArticle, Forum].each do |klass| | |
1739 | 1743 | a = fast_create(klass, :profile_id => profile.id) |
1740 | 1744 | get :edit, :profile => profile.identifier, :id => a.id |
1741 | 1745 | assert_tag :tag => 'form', :attributes => {:class => "#{a.type} #{a.type.to_css_class}"} |
... | ... | @@ -1771,14 +1775,6 @@ class CmsControllerTest < ActionController::TestCase |
1771 | 1775 | assert_response :bad_request |
1772 | 1776 | end |
1773 | 1777 | |
1774 | - should 'make RawHTMLArticle available only to environment admins' do | |
1775 | - @controller.stubs(:profile).returns(profile) | |
1776 | - @controller.stubs(:user).returns(profile) | |
1777 | - assert_not_includes available_article_types, RawHTMLArticle | |
1778 | - profile.environment.add_admin(profile) | |
1779 | - assert_includes available_article_types, RawHTMLArticle | |
1780 | - end | |
1781 | - | |
1782 | 1778 | should 'include new contents special types from plugins' do |
1783 | 1779 | class TestContentTypesPlugin < Noosfero::Plugin |
1784 | 1780 | def content_types |
... | ... | @@ -1810,7 +1806,7 @@ class CmsControllerTest < ActionController::TestCase |
1810 | 1806 | License.delete_all |
1811 | 1807 | login_as(profile.identifier) |
1812 | 1808 | |
1813 | - get :new, :profile => profile.identifier, :type => 'TinyMceArticle' | |
1809 | + get :new, :profile => profile.identifier, :type => 'TextArticle' | |
1814 | 1810 | assert_no_tag :tag => 'select', :attributes => {:id => 'article_license_id'} |
1815 | 1811 | end |
1816 | 1812 | |
... | ... | @@ -1843,7 +1839,7 @@ class CmsControllerTest < ActionController::TestCase |
1843 | 1839 | should 'set author when creating article' do |
1844 | 1840 | login_as(profile.identifier) |
1845 | 1841 | |
1846 | - post :new, :type => 'TinyMceArticle', :profile => profile.identifier, :article => { :name => 'Sample Article', :body => 'content ...' } | |
1842 | + post :new, :type => 'TextArticle', :profile => profile.identifier, :article => { :name => 'Sample Article', :body => 'content ...' } | |
1847 | 1843 | |
1848 | 1844 | a = profile.articles.find_by(path: 'sample-article') |
1849 | 1845 | assert_not_nil a |
... | ... | @@ -1869,7 +1865,7 @@ class CmsControllerTest < ActionController::TestCase |
1869 | 1865 | folder = fast_create(Folder, :name=>'a', :profile_id => profile.id) |
1870 | 1866 | gallery = fast_create(Gallery, :name=>'b', :profile_id => profile.id) |
1871 | 1867 | blog = fast_create(Blog, :name=>'c', :profile_id => profile.id) |
1872 | - article = fast_create(TinyMceArticle, :profile_id => profile.id) | |
1868 | + article = fast_create(TextArticle, :profile_id => profile.id) | |
1873 | 1869 | get :edit, :profile => profile.identifier, :id => article.id |
1874 | 1870 | assert_template 'edit' |
1875 | 1871 | assert_tag :tag => 'select', :attributes => { :name => "parent_id" }, |
... | ... | @@ -1897,7 +1893,7 @@ class CmsControllerTest < ActionController::TestCase |
1897 | 1893 | end |
1898 | 1894 | |
1899 | 1895 | should 'go back to specified url when saving with success' do |
1900 | - post :new, :type => 'TinyMceArticle', :profile => profile.identifier, :article => { :name => 'changed by me', :body => 'content ...' }, :success_back_to => '/' | |
1896 | + post :new, :type => 'TextArticle', :profile => profile.identifier, :article => { :name => 'changed by me', :body => 'content ...' }, :success_back_to => '/' | |
1901 | 1897 | assert_redirected_to '/' |
1902 | 1898 | end |
1903 | 1899 | |
... | ... | @@ -1927,7 +1923,7 @@ class CmsControllerTest < ActionController::TestCase |
1927 | 1923 | should 'set created_by when creating article' do |
1928 | 1924 | login_as(profile.identifier) |
1929 | 1925 | |
1930 | - post :new, :type => 'TinyMceArticle', :profile => profile.identifier, :article => { :name => 'changed by me', :body => 'content ...' } | |
1926 | + post :new, :type => 'TextArticle', :profile => profile.identifier, :article => { :name => 'changed by me', :body => 'content ...' } | |
1931 | 1927 | |
1932 | 1928 | a = profile.articles.find_by(path: 'changed-by-me') |
1933 | 1929 | assert_not_nil a |
... | ... | @@ -1973,13 +1969,13 @@ class CmsControllerTest < ActionController::TestCase |
1973 | 1969 | profile.articles << f |
1974 | 1970 | f.save! |
1975 | 1971 | |
1976 | - post :new, :type => 'TinyMceArticle', :profile => profile.identifier, :parent_id => f.id, | |
1972 | + post :new, :type => 'TextArticle', :profile => profile.identifier, :parent_id => f.id, | |
1977 | 1973 | :article => { :name => 'Main Article', :body => 'some content' } |
1978 | 1974 | |
1979 | 1975 | main_article = profile.articles.find_by(name: 'Main Article') |
1980 | 1976 | assert_not_nil main_article |
1981 | 1977 | |
1982 | - post :new, :type => 'TinyMceArticle', :profile => profile.identifier, :parent_id => f.id, | |
1978 | + post :new, :type => 'TextArticle', :profile => profile.identifier, :parent_id => f.id, | |
1983 | 1979 | :id => main_article.id, :clone => true |
1984 | 1980 | |
1985 | 1981 | cloned_main_article = profile.articles.find_by(name: 'Main Article') |
... | ... | @@ -1988,7 +1984,7 @@ class CmsControllerTest < ActionController::TestCase |
1988 | 1984 | assert_equal main_article.parent_id, cloned_main_article.parent_id |
1989 | 1985 | |
1990 | 1986 | get :new, :profile => profile.identifier, :id => cloned_main_article.id, |
1991 | - :clone => true, :type => 'TinyMceArticle' | |
1987 | + :clone => true, :type => 'TextArticle' | |
1992 | 1988 | |
1993 | 1989 | assert_match main_article.body, @response.body |
1994 | 1990 | end |
... | ... | @@ -2005,7 +2001,7 @@ class CmsControllerTest < ActionController::TestCase |
2005 | 2001 | end |
2006 | 2002 | end |
2007 | 2003 | |
2008 | - [TextileArticle, Event, TinyMceArticle].each do |klass| | |
2004 | + [TextArticle, Event].each do |klass| | |
2009 | 2005 | should "set no_design_blocks as true when create #{klass.name}" do |
2010 | 2006 | get :new, profile: profile.identifier, type: klass.name |
2011 | 2007 | assert assigns(:no_design_blocks) |
... | ... | @@ -2018,7 +2014,7 @@ class CmsControllerTest < ActionController::TestCase |
2018 | 2014 | assert !assigns(:no_design_blocks) |
2019 | 2015 | end |
2020 | 2016 | |
2021 | - [TextileArticle, Event, TinyMceArticle].each do |klass| | |
2017 | + [TextArticle, Event].each do |klass| | |
2022 | 2018 | should "set no_design_blocks as true when edit #{klass.name}" do |
2023 | 2019 | article = fast_create(klass, profile_id: profile.id) |
2024 | 2020 | get :edit, profile: profile.identifier, id: article.id | ... | ... |
test/functional/content_viewer_controller_test.rb
... | ... | @@ -119,7 +119,7 @@ class ContentViewerControllerTest < ActionController::TestCase |
119 | 119 | end |
120 | 120 | |
121 | 121 | should "display image label on article image" do |
122 | - page = TinyMceArticle.create!( | |
122 | + page = TextArticle.create!( | |
123 | 123 | :profile => profile, |
124 | 124 | :name => 'myarticle', |
125 | 125 | :image_builder => { |
... | ... | @@ -453,7 +453,7 @@ class ContentViewerControllerTest < ActionController::TestCase |
453 | 453 | should 'list unpublished posts to owner with a different class' do |
454 | 454 | login_as('testinguser') |
455 | 455 | blog = Blog.create!(:name => 'A blog test', :profile => profile) |
456 | - blog.posts << TextileArticle.create!(:name => 'Post', :profile => profile, :parent => blog, :published => false) | |
456 | + blog.posts << TextArticle.create!(:name => 'Post', :profile => profile, :parent => blog, :published => false) | |
457 | 457 | |
458 | 458 | get :view_page, :profile => profile.identifier, :page => [blog.path] |
459 | 459 | assert_tag :tag => 'div', :attributes => {:class => /not-published/} |
... | ... | @@ -461,7 +461,7 @@ class ContentViewerControllerTest < ActionController::TestCase |
461 | 461 | |
462 | 462 | should 'not list unpublished posts to a not logged person' do |
463 | 463 | blog = Blog.create!(:name => 'A blog test', :profile => profile) |
464 | - blog.posts << TextileArticle.create!(:name => 'Post', :profile => profile, :parent => blog, :published => false) | |
464 | + blog.posts << TextArticle.create!(:name => 'Post', :profile => profile, :parent => blog, :published => false) | |
465 | 465 | |
466 | 466 | get :view_page, :profile => profile.identifier, :page => [blog.path] |
467 | 467 | assert_no_tag :tag => 'a', :content => "Post" |
... | ... | @@ -470,7 +470,7 @@ class ContentViewerControllerTest < ActionController::TestCase |
470 | 470 | should 'display pagination links of blog' do |
471 | 471 | blog = Blog.create!(:name => 'A blog test', :profile => profile, :posts_per_page => 5) |
472 | 472 | for n in 1..10 |
473 | - blog.posts << TextileArticle.create!(:name => "Post #{n}", :profile => profile, :parent => blog) | |
473 | + blog.posts << TextArticle.create!(:name => "Post #{n}", :profile => profile, :parent => blog) | |
474 | 474 | end |
475 | 475 | assert_equal 10, blog.posts.size |
476 | 476 | |
... | ... | @@ -481,7 +481,7 @@ class ContentViewerControllerTest < ActionController::TestCase |
481 | 481 | should 'display first page of blog posts' do |
482 | 482 | blog = Blog.create!(:name => 'My blog', :profile => profile, :posts_per_page => 5) |
483 | 483 | for n in 1..10 |
484 | - blog.children << TextileArticle.create!(:name => "Post #{n}", :profile => profile, :parent => blog) | |
484 | + blog.children << TextArticle.create!(:name => "Post #{n}", :profile => profile, :parent => blog) | |
485 | 485 | end |
486 | 486 | assert_equal 10, blog.posts.size |
487 | 487 | |
... | ... | @@ -497,7 +497,7 @@ class ContentViewerControllerTest < ActionController::TestCase |
497 | 497 | should 'display others pages of blog posts' do |
498 | 498 | blog = Blog.create!(:name => 'My blog', :profile => profile, :posts_per_page => 5) |
499 | 499 | for n in 1..10 |
500 | - blog.children << TextileArticle.create!(:name => "Post #{n}", :profile => profile, :parent => blog) | |
500 | + blog.children << TextArticle.create!(:name => "Post #{n}", :profile => profile, :parent => blog) | |
501 | 501 | end |
502 | 502 | assert_equal 10, blog.posts.size |
503 | 503 | |
... | ... | @@ -514,8 +514,8 @@ class ContentViewerControllerTest < ActionController::TestCase |
514 | 514 | blog = Blog.create!(:name => "blog", :profile => profile) |
515 | 515 | profile.articles << blog |
516 | 516 | |
517 | - past_post = create(TextileArticle, :name => "past post", :profile => profile, :parent => blog, :published_at => blog.created_at - 1.year) | |
518 | - current_post = TextileArticle.create!(:name => "current post", :profile => profile, :parent => blog) | |
517 | + past_post = create(TextArticle, :name => "past post", :profile => profile, :parent => blog, :published_at => blog.created_at - 1.year) | |
518 | + current_post = TextArticle.create!(:name => "current post", :profile => profile, :parent => blog) | |
519 | 519 | blog.children << past_post |
520 | 520 | blog.children << current_post |
521 | 521 | |
... | ... | @@ -530,7 +530,7 @@ class ContentViewerControllerTest < ActionController::TestCase |
530 | 530 | should 'give link to create new article inside folder when view child of folder' do |
531 | 531 | login_as('testinguser') |
532 | 532 | folder = Folder.create!(:name => 'myfolder', :profile => @profile) |
533 | - folder.children << TextileArticle.new(:name => 'children-article', :profile => @profile) | |
533 | + folder.children << TextArticle.new(:name => 'children-article', :profile => @profile) | |
534 | 534 | xhr :get, :view_page, :profile => 'testinguser', :page => [ 'myfolder', 'children-article' ], :toolbar => true |
535 | 535 | assert_tag :tag => 'div', :attributes => { :id => 'article-actions' }, :descendant => { :tag => 'a', :attributes => { :href => "/myprofile/testinguser/cms/new?parent_id=#{folder.id}" } } |
536 | 536 | end |
... | ... | @@ -555,14 +555,14 @@ class ContentViewerControllerTest < ActionController::TestCase |
555 | 555 | login_as(profile.identifier) |
556 | 556 | a = Blog.create!(:name => 'article folder', :profile => profile) |
557 | 557 | Article.stubs(:short_description).returns('bli') |
558 | - t = TextileArticle.create!(:name => 'first post', :parent => a, :profile => profile) | |
558 | + t = TextArticle.create!(:name => 'first post', :parent => a, :profile => profile) | |
559 | 559 | xhr :get, :view_page, :profile => profile.identifier, :page => [t.path], :toolbar => true |
560 | 560 | assert_tag :tag => 'a', :content => 'New post' |
561 | 561 | end |
562 | 562 | |
563 | 563 | should 'display button to remove article' do |
564 | 564 | login_as(profile.identifier) |
565 | - t = TextileArticle.create!(:name => 'article to destroy', :profile => profile) | |
565 | + t = TextArticle.create!(:name => 'article to destroy', :profile => profile) | |
566 | 566 | xhr :get, :view_page, :profile => profile.identifier, :page => [t.path], :toolbar => true |
567 | 567 | assert_tag :tag => 'a', :content => 'Delete', :attributes => {:href => "/myprofile/#{profile.identifier}/cms/destroy/#{t.id}"} |
568 | 568 | end |
... | ... | @@ -584,7 +584,7 @@ class ContentViewerControllerTest < ActionController::TestCase |
584 | 584 | should 'add meta tag to rss feed on view post blog' do |
585 | 585 | login_as(profile.identifier) |
586 | 586 | blog = Blog.create!(:name => 'Blog', :profile => profile) |
587 | - TextileArticle.create!(:name => 'first post', :parent => blog, :profile => profile) | |
587 | + TextArticle.create!(:name => 'first post', :parent => blog, :profile => profile) | |
588 | 588 | get :view_page, :profile => profile.identifier, :page => ['blog', 'first-post'] |
589 | 589 | assert_tag :tag => 'link', :attributes => { :rel => 'alternate', :type => 'application/rss+xml', :title => 'Blog', :href => "http://#{environment.default_hostname}/testinguser/blog/feed" } |
590 | 590 | end |
... | ... | @@ -718,13 +718,13 @@ class ContentViewerControllerTest < ActionController::TestCase |
718 | 718 | end |
719 | 719 | |
720 | 720 | should 'display source from article' do |
721 | - profile.articles << TextileArticle.new(:name => "Article one", :profile => profile, :source => 'http://www.original-source.invalid') | |
721 | + profile.articles << TextArticle.new(:name => "Article one", :profile => profile, :source => 'http://www.original-source.invalid') | |
722 | 722 | get :view_page, :profile => profile.identifier, :page => ['article-one'] |
723 | 723 | assert_tag :tag => 'div', :attributes => { :id => 'article-source' }, :content => /http:\/\/www.original-source.invalid/ |
724 | 724 | end |
725 | 725 | |
726 | 726 | should 'not display source if article has no source' do |
727 | - profile.articles << TextileArticle.new(:name => "Article one", :profile => profile) | |
727 | + profile.articles << TextArticle.new(:name => "Article one", :profile => profile) | |
728 | 728 | get :view_page, :profile => profile.identifier, :page => ['article-one'] |
729 | 729 | assert_no_tag :tag => 'div', :attributes => { :id => 'article-source' } |
730 | 730 | end |
... | ... | @@ -745,7 +745,7 @@ class ContentViewerControllerTest < ActionController::TestCase |
745 | 745 | should "not display 'Upload files' when viewing post from a blog" do |
746 | 746 | login_as(profile.identifier) |
747 | 747 | b = Blog.create!(:name => 'article folder', :profile => profile) |
748 | - blog_post = TextileArticle.create!(:name => 'children-article', :profile => profile, :parent => b) | |
748 | + blog_post = TextArticle.create!(:name => 'children-article', :profile => profile, :parent => b) | |
749 | 749 | xhr :get, :view_page, :profile => profile.identifier, :page => blog_post.path, :toolbar => true |
750 | 750 | assert_no_tag :tag => 'a', :content => 'Upload files', :attributes => {:href => /parent_id=#{b.id}/} |
751 | 751 | end |
... | ... | @@ -799,7 +799,7 @@ class ContentViewerControllerTest < ActionController::TestCase |
799 | 799 | |
800 | 800 | blog = Blog.create!(:name => 'A blog test', :profile => profile, :visualization_format => 'short') |
801 | 801 | |
802 | - blog.posts << TinyMceArticle.create!(:name => 'first post', :parent => blog, :profile => profile, :body => '<p>Content to be displayed.</p> Anything') | |
802 | + blog.posts << TextArticle.create!(:name => 'first post', :parent => blog, :profile => profile, :body => '<p>Content to be displayed.</p> Anything') | |
803 | 803 | |
804 | 804 | get :view_page, :profile => profile.identifier, :page => blog.path |
805 | 805 | |
... | ... | @@ -812,7 +812,7 @@ class ContentViewerControllerTest < ActionController::TestCase |
812 | 812 | |
813 | 813 | blog = Blog.create!(:name => 'A blog test', :profile => profile, :visualization_format => 'short+pic') |
814 | 814 | |
815 | - blog.posts << TinyMceArticle.create!(:name => 'first post', :parent => blog, :profile => profile, :body => '<p>Content to be displayed.</p> <img src="pic.jpg">') | |
815 | + blog.posts << TextArticle.create!(:name => 'first post', :parent => blog, :profile => profile, :body => '<p>Content to be displayed.</p> <img src="pic.jpg">') | |
816 | 816 | |
817 | 817 | get :view_page, :profile => profile.identifier, :page => blog.path |
818 | 818 | |
... | ... | @@ -833,7 +833,7 @@ class ContentViewerControllerTest < ActionController::TestCase |
833 | 833 | should 'list unpublished forum posts to owner with a different class' do |
834 | 834 | login_as('testinguser') |
835 | 835 | forum = Forum.create!(:name => 'A forum test', :profile => profile) |
836 | - forum.posts << TextileArticle.create!(:name => 'Post', :profile => profile, :parent => forum, :published => false) | |
836 | + forum.posts << TextArticle.create!(:name => 'Post', :profile => profile, :parent => forum, :published => false) | |
837 | 837 | |
838 | 838 | get :view_page, :profile => profile.identifier, :page => [forum.path] |
839 | 839 | assert_tag :tag => 'tr', :attributes => {:class => /not-published/} |
... | ... | @@ -841,7 +841,7 @@ class ContentViewerControllerTest < ActionController::TestCase |
841 | 841 | |
842 | 842 | should 'not list unpublished forum posts to a not logged person' do |
843 | 843 | forum = Forum.create!(:name => 'A forum test', :profile => profile) |
844 | - forum.posts << TextileArticle.create!(:name => 'Post', :profile => profile, :parent => forum, :published => false) | |
844 | + forum.posts << TextArticle.create!(:name => 'Post', :profile => profile, :parent => forum, :published => false) | |
845 | 845 | |
846 | 846 | get :view_page, :profile => profile.identifier, :page => [forum.path] |
847 | 847 | assert_no_tag :tag => 'a', :content => "Post" |
... | ... | @@ -850,7 +850,7 @@ class ContentViewerControllerTest < ActionController::TestCase |
850 | 850 | should 'display pagination links of forum' do |
851 | 851 | forum = Forum.create!(:name => 'A forum test', :profile => profile, :posts_per_page => 5) |
852 | 852 | for n in 1..10 |
853 | - forum.posts << TextileArticle.create!(:name => "Post #{n}", :profile => profile, :parent => forum) | |
853 | + forum.posts << TextArticle.create!(:name => "Post #{n}", :profile => profile, :parent => forum) | |
854 | 854 | end |
855 | 855 | assert_equal 10, forum.posts.size |
856 | 856 | |
... | ... | @@ -861,7 +861,7 @@ class ContentViewerControllerTest < ActionController::TestCase |
861 | 861 | should 'display first page of forum posts' do |
862 | 862 | forum = Forum.create!(:name => 'My forum', :profile => profile, :posts_per_page => 5) |
863 | 863 | for n in 1..10 |
864 | - art = TextileArticle.create!(:name => "Post #{n}", :profile => profile, :parent => forum) | |
864 | + art = TextArticle.create!(:name => "Post #{n}", :profile => profile, :parent => forum) | |
865 | 865 | art.updated_at = (10 - n).days.ago |
866 | 866 | art.stubs(:record_timestamps).returns(false) |
867 | 867 | art.save! |
... | ... | @@ -882,7 +882,7 @@ class ContentViewerControllerTest < ActionController::TestCase |
882 | 882 | now = Time.now |
883 | 883 | for n in 1..10 |
884 | 884 | Time.stubs(:now).returns(now - 10.days + n.days) |
885 | - forum.children << art = TextileArticle.create!(:name => "Post #{n}", :profile => profile, :parent => forum) | |
885 | + forum.children << art = TextArticle.create!(:name => "Post #{n}", :profile => profile, :parent => forum) | |
886 | 886 | end |
887 | 887 | assert_equal 10, forum.posts.size |
888 | 888 | |
... | ... | @@ -899,8 +899,8 @@ class ContentViewerControllerTest < ActionController::TestCase |
899 | 899 | forum = Forum.create!(:name => "forum", :profile => profile) |
900 | 900 | profile.articles << forum |
901 | 901 | |
902 | - past_post = create(TextileArticle, :name => "past post", :profile => profile, :parent => forum, :published_at => forum.created_at - 1.year) | |
903 | - current_post = TextileArticle.create!(:name => "current post", :profile => profile, :parent => forum) | |
902 | + past_post = create(TextArticle, :name => "past post", :profile => profile, :parent => forum, :published_at => forum.created_at - 1.year) | |
903 | + current_post = TextArticle.create!(:name => "current post", :profile => profile, :parent => forum) | |
904 | 904 | forum.children << past_post |
905 | 905 | forum.children << current_post |
906 | 906 | |
... | ... | @@ -924,7 +924,7 @@ class ContentViewerControllerTest < ActionController::TestCase |
924 | 924 | login_as(profile.identifier) |
925 | 925 | a = Forum.create!(:name => 'article folder', :profile => profile) |
926 | 926 | Article.stubs(:short_description).returns('bli') |
927 | - t = TextileArticle.create!(:name => 'first post', :parent => a, :profile => profile) | |
927 | + t = TextArticle.create!(:name => 'first post', :parent => a, :profile => profile) | |
928 | 928 | xhr :get, :view_page, :profile => profile.identifier, :page => [t.path], :toolbar => true |
929 | 929 | assert_tag :tag => 'a', :content => 'New discussion topic' |
930 | 930 | end |
... | ... | @@ -937,7 +937,7 @@ class ContentViewerControllerTest < ActionController::TestCase |
937 | 937 | community.add_member(author) |
938 | 938 | |
939 | 939 | forum = Forum.create(:profile => community, :name => 'Forum test', :body => 'Forum test') |
940 | - post = fast_create(TextileArticle, :name => 'First post', :profile_id => community.id, :parent_id => forum.id, :author_id => author.id) | |
940 | + post = fast_create(TextArticle, :name => 'First post', :profile_id => community.id, :parent_id => forum.id, :author_id => author.id) | |
941 | 941 | |
942 | 942 | login_as(author.identifier) |
943 | 943 | get :view_page, :profile => community.identifier, :page => post.path.split('/') |
... | ... | @@ -953,7 +953,7 @@ class ContentViewerControllerTest < ActionController::TestCase |
953 | 953 | community.add_member(author) |
954 | 954 | |
955 | 955 | forum = Forum.create(:profile => community, :name => 'Forum test', :body => 'Forum test') |
956 | - post = fast_create(TextileArticle, :name => 'First post', :profile_id => community.id, :parent_id => forum.id, :author_id => author.id) | |
956 | + post = fast_create(TextArticle, :name => 'First post', :profile_id => community.id, :parent_id => forum.id, :author_id => author.id) | |
957 | 957 | |
958 | 958 | login_as(author.identifier) |
959 | 959 | get :view_page, :profile => community.identifier, :page => post.path.split('/') |
... | ... | @@ -971,7 +971,7 @@ class ContentViewerControllerTest < ActionController::TestCase |
971 | 971 | should 'add meta tag to rss feed on view post forum' do |
972 | 972 | login_as(profile.identifier) |
973 | 973 | profile.articles << Forum.new(:name => 'Forum', :profile => profile) |
974 | - profile.forum.posts << TextileArticle.new(:name => 'first post', :parent => profile.forum, :profile => profile) | |
974 | + profile.forum.posts << TextArticle.new(:name => 'first post', :parent => profile.forum, :profile => profile) | |
975 | 975 | get :view_page, :profile => profile.identifier, :page => ['forum', 'first-post'] |
976 | 976 | assert_tag :tag => 'link', :attributes => { :rel => 'alternate', :type => 'application/rss+xml', :title => 'Forum', :href => "http://#{environment.default_hostname}/testinguser/forum/feed" } |
977 | 977 | end |
... | ... | @@ -986,7 +986,7 @@ class ContentViewerControllerTest < ActionController::TestCase |
986 | 986 | should "not display 'Upload files' when viewing post from a forum" do |
987 | 987 | login_as(profile.identifier) |
988 | 988 | b = Forum.create!(:name => 'article folder', :profile => profile) |
989 | - forum_post = TextileArticle.create!(:name => 'children-article', :profile => profile, :parent => b) | |
989 | + forum_post = TextArticle.create!(:name => 'children-article', :profile => profile, :parent => b) | |
990 | 990 | xhr :get, :view_page, :profile => profile.identifier, :page => forum_post.path, :toolbar => true |
991 | 991 | assert_no_tag :tag => 'a', :content => 'Upload files', :attributes => {:href => /parent_id=#{b.id}/} |
992 | 992 | end |
... | ... | @@ -1002,9 +1002,9 @@ class ContentViewerControllerTest < ActionController::TestCase |
1002 | 1002 | environment.languages = ['en'] |
1003 | 1003 | environment.save |
1004 | 1004 | login_as @profile.identifier |
1005 | - textile = fast_create(TextileArticle, :profile_id => @profile.id, :path => 'textile', :language => 'en') | |
1005 | + textile = fast_create(TextArticle, :profile_id => @profile.id, :path => 'textile', :language => 'en') | |
1006 | 1006 | xhr :get, :view_page, :profile => @profile.identifier, :page => textile.path, :toolbar => true |
1007 | - assert_tag :a, :attributes => { :href => "/myprofile/#{profile.identifier}/cms/new?article%5Btranslation_of_id%5D=#{textile.id}&type=#{TextileArticle}" } | |
1007 | + assert_tag :a, :attributes => { :href => "/myprofile/#{profile.identifier}/cms/new?article%5Btranslation_of_id%5D=#{textile.id}&type=#{TextArticle}" } | |
1008 | 1008 | end |
1009 | 1009 | |
1010 | 1010 | should 'not display add translation link if article is not translatable' do |
... | ... | @@ -1016,22 +1016,22 @@ class ContentViewerControllerTest < ActionController::TestCase |
1016 | 1016 | |
1017 | 1017 | should 'not display add translation link if article hasnt a language defined' do |
1018 | 1018 | login_as @profile.identifier |
1019 | - textile = fast_create(TextileArticle, :profile_id => @profile.id, :path => 'textile') | |
1019 | + textile = fast_create(TextArticle, :profile_id => @profile.id, :path => 'textile') | |
1020 | 1020 | xhr :get, :view_page, :profile => @profile.identifier, :page => textile.path, :toolbar => true |
1021 | 1021 | assert_no_tag :a, :attributes => { :content => 'Add translation', :class => /icon-locale/ } |
1022 | 1022 | end |
1023 | 1023 | |
1024 | 1024 | should 'display translations link if article has translations' do |
1025 | 1025 | login_as @profile.identifier |
1026 | - textile = fast_create(TextileArticle, :profile_id => @profile.id, :path => 'textile', :language => 'en') | |
1027 | - translation = fast_create(TextileArticle, :profile_id => @profile.id, :path => 'translation', :language => 'es', :translation_of_id => textile) | |
1026 | + textile = fast_create(TextArticle, :profile_id => @profile.id, :path => 'textile', :language => 'en') | |
1027 | + translation = fast_create(TextArticle, :profile_id => @profile.id, :path => 'translation', :language => 'es', :translation_of_id => textile) | |
1028 | 1028 | xhr :get, :view_page, :profile => @profile.identifier, :page => textile.path, :toolbar => true |
1029 | 1029 | assert_tag :a, :attributes => { :class => /article-translations-menu/, :onmouseover => /toggleSubmenu/ } |
1030 | 1030 | end |
1031 | 1031 | |
1032 | 1032 | should 'not be redirected if already in translation' do |
1033 | - en_article = fast_create(TextileArticle, :profile_id => @profile.id, :path => 'en_article', :language => 'en') | |
1034 | - es_article = fast_create(TextileArticle, :profile_id => @profile.id, :path => 'es_article', :language => 'es', :translation_of_id => en_article) | |
1033 | + en_article = fast_create(TextArticle, :profile_id => @profile.id, :path => 'en_article', :language => 'en') | |
1034 | + es_article = fast_create(TextArticle, :profile_id => @profile.id, :path => 'es_article', :language => 'es', :translation_of_id => en_article) | |
1035 | 1035 | @request.env['HTTP_REFERER'] = "http://localhost:3000/#{@profile.identifier}/#{es_article.path}" |
1036 | 1036 | FastGettext.stubs(:locale).returns('es') |
1037 | 1037 | get :view_page, :profile => @profile.identifier, :page => es_article.path |
... | ... | @@ -1041,15 +1041,15 @@ class ContentViewerControllerTest < ActionController::TestCase |
1041 | 1041 | |
1042 | 1042 | should 'not be redirected if article does not have a language' do |
1043 | 1043 | FastGettext.stubs(:locale).returns('es') |
1044 | - article = fast_create(TextileArticle, :profile_id => @profile.id, :path => 'article') | |
1044 | + article = fast_create(TextArticle, :profile_id => @profile.id, :path => 'article') | |
1045 | 1045 | get :view_page, :profile => @profile.identifier, :page => article.path |
1046 | 1046 | assert_response :success |
1047 | 1047 | assert_equal article, assigns(:page) |
1048 | 1048 | end |
1049 | 1049 | |
1050 | 1050 | should 'not be redirected if http_referer is a translation' do |
1051 | - en_article = fast_create(TextileArticle, :profile_id => @profile.id, :path => 'en_article', :language => 'en') | |
1052 | - es_article = fast_create(TextileArticle, :profile_id => @profile.id, :path => 'es_article', :language => 'es', :translation_of_id => en_article) | |
1051 | + en_article = fast_create(TextArticle, :profile_id => @profile.id, :path => 'en_article', :language => 'en') | |
1052 | + es_article = fast_create(TextArticle, :profile_id => @profile.id, :path => 'es_article', :language => 'es', :translation_of_id => en_article) | |
1053 | 1053 | @request.env['HTTP_REFERER'] = "http://localhost:3000/#{@profile.identifier}/#{es_article.path}" |
1054 | 1054 | FastGettext.stubs(:locale).returns('es') |
1055 | 1055 | get :view_page, :profile => @profile.identifier, :page => en_article.path |
... | ... | @@ -1058,8 +1058,8 @@ class ContentViewerControllerTest < ActionController::TestCase |
1058 | 1058 | end |
1059 | 1059 | |
1060 | 1060 | should 'not be redirected to transition if came from edit' do |
1061 | - en_article = fast_create(TextileArticle, :profile_id => @profile.id, :path => 'en_article', :language => 'en') | |
1062 | - es_article = fast_create(TextileArticle, :profile_id => @profile.id, :path => 'es_article', :language => 'es', :translation_of_id => en_article) | |
1061 | + en_article = fast_create(TextArticle, :profile_id => @profile.id, :path => 'en_article', :language => 'en') | |
1062 | + es_article = fast_create(TextArticle, :profile_id => @profile.id, :path => 'es_article', :language => 'es', :translation_of_id => en_article) | |
1063 | 1063 | FastGettext.stubs(:locale).returns('es') |
1064 | 1064 | @request.env['HTTP_REFERER'] = "http://localhost/myprofile/#{@profile.identifier}/cms/edit/#{en_article.id}" |
1065 | 1065 | get :view_page, :profile => @profile.identifier, :page => es_article.path |
... | ... | @@ -1068,8 +1068,8 @@ class ContentViewerControllerTest < ActionController::TestCase |
1068 | 1068 | end |
1069 | 1069 | |
1070 | 1070 | should 'not be redirected to transition if came from new' do |
1071 | - en_article = fast_create(TextileArticle, :profile_id => @profile.id, :path => 'en_article', :language => 'en') | |
1072 | - es_article = fast_create(TextileArticle, :profile_id => @profile.id, :path => 'es_article', :language => 'es', :translation_of_id => en_article) | |
1071 | + en_article = fast_create(TextArticle, :profile_id => @profile.id, :path => 'en_article', :language => 'en') | |
1072 | + es_article = fast_create(TextArticle, :profile_id => @profile.id, :path => 'es_article', :language => 'es', :translation_of_id => en_article) | |
1073 | 1073 | FastGettext.stubs(:locale).returns('es') |
1074 | 1074 | @request.env['HTTP_REFERER'] = "http://localhost/myprofile/#{@profile.identifier}/cms/new" |
1075 | 1075 | get :view_page, :profile => @profile.identifier, :page => es_article.path |
... | ... | @@ -1082,8 +1082,8 @@ class ContentViewerControllerTest < ActionController::TestCase |
1082 | 1082 | blog = fast_create(Blog, :profile_id => profile.id, :path => 'blog') |
1083 | 1083 | blog.display_posts_in_current_language = true |
1084 | 1084 | blog.save |
1085 | - en_article = fast_create(TextileArticle, :profile_id => @profile.id, :path => 'en_article', :language => 'en', :parent_id => blog.id) | |
1086 | - es_article = fast_create(TextileArticle, :profile_id => @profile.id, :path => 'es_article', :language => 'es', :parent_id => blog.id, :translation_of_id => en_article) | |
1085 | + en_article = fast_create(TextArticle, :profile_id => @profile.id, :path => 'en_article', :language => 'en', :parent_id => blog.id) | |
1086 | + es_article = fast_create(TextArticle, :profile_id => @profile.id, :path => 'es_article', :language => 'es', :parent_id => blog.id, :translation_of_id => en_article) | |
1087 | 1087 | |
1088 | 1088 | get :view_page, :profile => @profile.identifier, :page => blog.path |
1089 | 1089 | assert_tag :div, :attributes => { :id => "post-#{es_article.id}" } |
... | ... | @@ -1095,12 +1095,12 @@ class ContentViewerControllerTest < ActionController::TestCase |
1095 | 1095 | blog = fast_create(Blog, :profile_id => profile.id, :path => 'blog') |
1096 | 1096 | blog.display_posts_in_current_language = true |
1097 | 1097 | blog.save |
1098 | - en_article = fast_create(TextileArticle, :profile_id => @profile.id, :path => 'en_article', :language => 'en', :parent_id => blog.id) | |
1099 | - es_article = fast_create(TextileArticle, :profile_id => @profile.id, :path => 'es_article', :language => 'es', :parent_id => blog.id, :translation_of_id => en_article) | |
1100 | - pt_article = fast_create(TextileArticle, :profile_id => @profile.id, :path => 'es_article', :language => 'pt', :parent_id => blog.id, :translation_of_id => en_article) | |
1098 | + en_article = fast_create(TextArticle, :profile_id => @profile.id, :path => 'en_article', :language => 'en', :parent_id => blog.id) | |
1099 | + es_article = fast_create(TextArticle, :profile_id => @profile.id, :path => 'es_article', :language => 'es', :parent_id => blog.id, :translation_of_id => en_article) | |
1100 | + pt_article = fast_create(TextArticle, :profile_id => @profile.id, :path => 'es_article', :language => 'pt', :parent_id => blog.id, :translation_of_id => en_article) | |
1101 | 1101 | |
1102 | - en_article2 = fast_create(TextileArticle, :profile_id => @profile.id, :path => 'en_article', :language => 'en', :parent_id => blog.id) | |
1103 | - es_article2 = fast_create(TextileArticle, :profile_id => @profile.id, :path => 'es_article', :language => 'es', :parent_id => blog.id, :translation_of_id => en_article2) | |
1102 | + en_article2 = fast_create(TextArticle, :profile_id => @profile.id, :path => 'en_article', :language => 'en', :parent_id => blog.id) | |
1103 | + es_article2 = fast_create(TextArticle, :profile_id => @profile.id, :path => 'es_article', :language => 'es', :parent_id => blog.id, :translation_of_id => en_article2) | |
1104 | 1104 | |
1105 | 1105 | |
1106 | 1106 | get :view_page, :profile => @profile.identifier, :page => blog.path |
... | ... | @@ -1111,8 +1111,8 @@ class ContentViewerControllerTest < ActionController::TestCase |
1111 | 1111 | should 'list all posts at blog listing if blog option is disabled' do |
1112 | 1112 | FastGettext.stubs(:locale).returns('es') |
1113 | 1113 | blog = Blog.create!(:name => 'A blog test', :profile => profile, :display_posts_in_current_language => false) |
1114 | - blog.posts << es_post = TextileArticle.create!(:name => 'Spanish Post', :profile => profile, :parent => blog, :language => 'es') | |
1115 | - blog.posts << en_post = TextileArticle.create!(:name => 'English Post', :profile => profile, :parent => blog, :language => 'en', :translation_of_id => es_post.id) | |
1114 | + blog.posts << es_post = TextArticle.create!(:name => 'Spanish Post', :profile => profile, :parent => blog, :language => 'es') | |
1115 | + blog.posts << en_post = TextArticle.create!(:name => 'English Post', :profile => profile, :parent => blog, :language => 'en', :translation_of_id => es_post.id) | |
1116 | 1116 | get :view_page, :profile => profile.identifier, :page => [blog.path] |
1117 | 1117 | assert_equal 2, assigns(:posts).size |
1118 | 1118 | assert_tag :div, :attributes => { :id => "post-#{es_post.id}" } |
... | ... | @@ -1124,8 +1124,8 @@ class ContentViewerControllerTest < ActionController::TestCase |
1124 | 1124 | blog = fast_create(Blog, :profile_id => profile.id, :path => 'blog') |
1125 | 1125 | blog.display_posts_in_current_language = true |
1126 | 1126 | blog.save! |
1127 | - en_article = fast_create(TextileArticle, :profile_id => @profile.id, :path => 'en_article', :language => 'en', :parent_id => blog.id) | |
1128 | - es_article = fast_create(TextileArticle, :profile_id => @profile.id, :path => 'es_article', :language => 'es', :parent_id => blog.id, :translation_of_id => en_article) | |
1127 | + en_article = fast_create(TextArticle, :profile_id => @profile.id, :path => 'en_article', :language => 'en', :parent_id => blog.id) | |
1128 | + es_article = fast_create(TextArticle, :profile_id => @profile.id, :path => 'es_article', :language => 'es', :parent_id => blog.id, :translation_of_id => en_article) | |
1129 | 1129 | blog.posts = [en_article, es_article] |
1130 | 1130 | |
1131 | 1131 | get :view_page, :profile => @profile.identifier, :page => blog.path |
... | ... | @@ -1177,7 +1177,7 @@ class ContentViewerControllerTest < ActionController::TestCase |
1177 | 1177 | |
1178 | 1178 | should 'add an zero width space every 4 caracters of comment urls' do |
1179 | 1179 | url = 'www.an.url.to.be.splited.com' |
1180 | - a = fast_create(TextileArticle, :profile_id => @profile.id, :language => 'en') | |
1180 | + a = fast_create(TextArticle, :profile_id => @profile.id, :language => 'en') | |
1181 | 1181 | c = a.comments.create!(:author => @profile, :title => 'An url', :body => url) |
1182 | 1182 | get :view_page, :profile => @profile.identifier, :page => a.path |
1183 | 1183 | assert_tag :a, :attributes => { :href => "http://" + url}, :content => url.scan(/.{4}/).join('​') |
... | ... | @@ -1375,7 +1375,7 @@ class ContentViewerControllerTest < ActionController::TestCase |
1375 | 1375 | should 'not escape acceptable HTML in list of blog posts' do |
1376 | 1376 | login_as('testinguser') |
1377 | 1377 | blog = Blog.create!(:name => 'A blog test', :profile => profile) |
1378 | - blog.posts << TinyMceArticle.create!( | |
1378 | + blog.posts << TextArticle.create!( | |
1379 | 1379 | :name => 'Post', |
1380 | 1380 | :profile => profile, |
1381 | 1381 | :parent => blog, |
... | ... | @@ -1443,7 +1443,7 @@ class ContentViewerControllerTest < ActionController::TestCase |
1443 | 1443 | |
1444 | 1444 | blog = community.articles.find_by(name: "Blog") |
1445 | 1445 | |
1446 | - article = TinyMceArticle.create(:name => 'Article to be shared with images', | |
1446 | + article = TextArticle.create(:name => 'Article to be shared with images', | |
1447 | 1447 | :body => 'This article should be shared with all social networks', |
1448 | 1448 | :profile => community, |
1449 | 1449 | :published => false, |
... | ... | @@ -1571,7 +1571,7 @@ class ContentViewerControllerTest < ActionController::TestCase |
1571 | 1571 | blog.visualization_format = 'compact' |
1572 | 1572 | blog.save! |
1573 | 1573 | |
1574 | - article = TinyMceArticle.create(:name => 'Article to be shared with images', | |
1574 | + article = TextArticle.create(:name => 'Article to be shared with images', | |
1575 | 1575 | :body => 'This article should be shared with all social networks', |
1576 | 1576 | :profile => @profile, |
1577 | 1577 | :published => false, | ... | ... |
test/functional/enterprise_registration_controller_test.rb
... | ... | @@ -58,7 +58,7 @@ class EnterpriseRegistrationControllerTest < ActionController::TestCase |
58 | 58 | region = fast_create(Region, {}) |
59 | 59 | |
60 | 60 | template = Enterprise.create!(:name => 'Enterprise Template', :identifier => 'enterprise-template', :is_template => true) |
61 | - welcome_page = TinyMceArticle.create!(:name => 'Welcome Page', :profile => template, :body => 'This is the welcome page of enterprise template.', :published => true) | |
61 | + welcome_page = TextArticle.create!(:name => 'Welcome Page', :profile => template, :body => 'This is the welcome page of enterprise template.', :published => true) | |
62 | 62 | template.welcome_page = welcome_page |
63 | 63 | template.save! |
64 | 64 | ... | ... |
test/functional/home_controller_test.rb
... | ... | @@ -47,14 +47,14 @@ class HomeControllerTest < ActionController::TestCase |
47 | 47 | env = Environment.default |
48 | 48 | env.enable('use_portal_community') |
49 | 49 | c = fast_create(Community) |
50 | - a1 = TextileArticle.create!(:name => "Article 1", | |
50 | + a1 = TextArticle.create!(:name => "Article 1", | |
51 | 51 | :profile => c, |
52 | 52 | :abstract => "This is the article1 lead.", |
53 | - :body => "This is the article1 body.", | |
53 | + :body => "<p>This is the article1 body.</p>", | |
54 | 54 | :highlighted => true) |
55 | - a2 = TextileArticle.create!(:name => "Article 2", | |
55 | + a2 = TextArticle.create!(:name => "Article 2", | |
56 | 56 | :profile => c, |
57 | - :body => "This is the article2 body.", | |
57 | + :body => "<p>This is the article2 body.</p>", | |
58 | 58 | :highlighted => true) |
59 | 59 | env.portal_community = c |
60 | 60 | env.save! |
... | ... | @@ -62,8 +62,8 @@ class HomeControllerTest < ActionController::TestCase |
62 | 62 | |
63 | 63 | get :index |
64 | 64 | assert_tag :attributes => { :class => 'headline' }, :content => a1.abstract |
65 | - assert_no_tag :attributes => { :class => 'headline' }, :content => a1.body | |
66 | - assert_tag :attributes => { :class => 'headline' }, :content => a2.body | |
65 | + assert_no_tag :attributes => { :class => 'headline' }, :content => 'This is the article1 body.' | |
66 | + assert_tag :attributes => { :class => 'headline' }, :content => 'This is the article2 body.' | |
67 | 67 | end |
68 | 68 | |
69 | 69 | should 'display block in index page if it\'s configured to display on homepage and its an environment block' do |
... | ... | @@ -128,7 +128,7 @@ class HomeControllerTest < ActionController::TestCase |
128 | 128 | should 'display template welcome page' do |
129 | 129 | template = create_user('template').person |
130 | 130 | template.is_template = true |
131 | - welcome_page = TinyMceArticle.create!(:name => 'Welcome page', :profile => template, :published => true, :body => 'Template welcome page') | |
131 | + welcome_page = TextArticle.create!(:name => 'Welcome page', :profile => template, :published => true, :body => 'Template welcome page') | |
132 | 132 | template.welcome_page = welcome_page |
133 | 133 | template.save! |
134 | 134 | get :welcome, :template_id => template.id |
... | ... | @@ -138,7 +138,7 @@ class HomeControllerTest < ActionController::TestCase |
138 | 138 | should 'not display template welcome page if it is not published' do |
139 | 139 | template = create_user('template').person |
140 | 140 | template.is_template = true |
141 | - welcome_page = TinyMceArticle.create!(:name => 'Welcome page', :profile => template, :published => false, :body => 'Template welcome page') | |
141 | + welcome_page = TextArticle.create!(:name => 'Welcome page', :profile => template, :published => false, :body => 'Template welcome page') | |
142 | 142 | template.welcome_page = welcome_page |
143 | 143 | template.save! |
144 | 144 | get :welcome, :template_id => template.id | ... | ... |
test/functional/profile_controller_test.rb
... | ... | @@ -518,9 +518,9 @@ class ProfileControllerTest < ActionController::TestCase |
518 | 518 | |
519 | 519 | should 'show number of published posts in index' do |
520 | 520 | profile.articles << blog = create(Blog, :name => 'Blog', :profile_id => profile.id) |
521 | - fast_create(TextileArticle, :name => 'Published post', :parent_id => profile.blog.id, :profile_id => profile.id) | |
522 | - fast_create(TextileArticle, :name => 'Other published post', :parent_id => profile.blog.id, :profile_id => profile.id) | |
523 | - fast_create(TextileArticle, :name => 'Unpublished post', :parent_id => profile.blog.id, :profile_id => profile.id, :published => false) | |
521 | + fast_create(TextArticle, :name => 'Published post', :parent_id => profile.blog.id, :profile_id => profile.id) | |
522 | + fast_create(TextArticle, :name => 'Other published post', :parent_id => profile.blog.id, :profile_id => profile.id) | |
523 | + fast_create(TextArticle, :name => 'Unpublished post', :parent_id => profile.blog.id, :profile_id => profile.id, :published => false) | |
524 | 524 | |
525 | 525 | get :index, :profile => profile.identifier |
526 | 526 | assert_tag :tag => 'a', :content => '2 posts', :attributes => { :href => /\/testuser\/#{blog.slug}/ } |
... | ... | @@ -604,8 +604,8 @@ class ProfileControllerTest < ActionController::TestCase |
604 | 604 | end |
605 | 605 | |
606 | 606 | should 'reverse the order of posts in tag feed' do |
607 | - create(TextileArticle, :name => 'First post', :profile => profile, :tag_list => 'tag1', :published_at => Time.now) | |
608 | - create(TextileArticle, :name => 'Second post', :profile => profile, :tag_list => 'tag1', :published_at => Time.now + 1.day) | |
607 | + create(TextArticle, :name => 'First post', :profile => profile, :tag_list => 'tag1', :published_at => Time.now) | |
608 | + create(TextArticle, :name => 'Second post', :profile => profile, :tag_list => 'tag1', :published_at => Time.now + 1.day) | |
609 | 609 | |
610 | 610 | get :tag_feed, :profile => profile.identifier, :id => 'tag1' |
611 | 611 | assert_match(/Second.*First/, @response.body) |
... | ... | @@ -613,11 +613,11 @@ class ProfileControllerTest < ActionController::TestCase |
613 | 613 | |
614 | 614 | should 'display the most recent posts in tag feed' do |
615 | 615 | start = Time.now - 30.days |
616 | - first = create(TextileArticle, :name => 'First post', :profile => profile, :tag_list => 'tag1', :published_at => start) | |
616 | + first = create(TextArticle, :name => 'First post', :profile => profile, :tag_list => 'tag1', :published_at => start) | |
617 | 617 | 20.times do |i| |
618 | - create(TextileArticle, :name => 'Post #' + i.to_s, :profile => profile, :tag_list => 'tag1', :published_at => start + i.days) | |
618 | + create(TextArticle, :name => 'Post #' + i.to_s, :profile => profile, :tag_list => 'tag1', :published_at => start + i.days) | |
619 | 619 | end |
620 | - last = create(TextileArticle, :name => 'Last post', :profile => profile, :tag_list => 'tag1', :published_at => Time.now) | |
620 | + last = create(TextArticle, :name => 'Last post', :profile => profile, :tag_list => 'tag1', :published_at => Time.now) | |
621 | 621 | |
622 | 622 | get :tag_feed, :profile => profile.identifier, :id => 'tag1' |
623 | 623 | assert_no_match(/First post/, @response.body) # First post is older than other 20 posts already |
... | ... | @@ -755,7 +755,7 @@ class ProfileControllerTest < ActionController::TestCase |
755 | 755 | scrap2 = create(Scrap, defaults_for_scrap(:sender => p2, :receiver => p1)) |
756 | 756 | |
757 | 757 | User.current = p1.user |
758 | - create(TinyMceArticle, :profile => p1, :name => 'An article about free software') | |
758 | + create(TextArticle, :profile => p1, :name => 'An article about free software') | |
759 | 759 | a1 = ActionTracker::Record.last |
760 | 760 | |
761 | 761 | login_as(profile.identifier) |
... | ... | @@ -787,10 +787,10 @@ class ProfileControllerTest < ActionController::TestCase |
787 | 787 | scrap2 = create(Scrap, defaults_for_scrap(:sender => p2, :receiver => profile)) |
788 | 788 | |
789 | 789 | User.current = p3.user |
790 | - article1 = TinyMceArticle.create!(:profile => p3, :name => 'An article about free software') | |
790 | + article1 = TextArticle.create!(:profile => p3, :name => 'An article about free software') | |
791 | 791 | |
792 | 792 | User.current = p2.user |
793 | - article2 = TinyMceArticle.create!(:profile => p2, :name => 'Another article about free software') | |
793 | + article2 = TextArticle.create!(:profile => p2, :name => 'Another article about free software') | |
794 | 794 | |
795 | 795 | login_as(profile.identifier) |
796 | 796 | get :index, :profile => p3.identifier |
... | ... | @@ -1181,7 +1181,7 @@ class ProfileControllerTest < ActionController::TestCase |
1181 | 1181 | |
1182 | 1182 | should "view more activities paginated" do |
1183 | 1183 | login_as(profile.identifier) |
1184 | - article = TinyMceArticle.create!(:profile => profile, :name => 'An Article about Free Software') | |
1184 | + article = TextArticle.create!(:profile => profile, :name => 'An Article about Free Software') | |
1185 | 1185 | ActionTracker::Record.destroy_all |
1186 | 1186 | 40.times{ create(ActionTracker::Record, :user_id => profile.id, :user_type => 'Profile', :verb => 'create_article', :target_id => article.id, :target_type => 'Article', :params => {'name' => article.name, 'url' => article.url, 'lead' => article.lead, 'first_image' => article.first_image})} |
1187 | 1187 | assert_equal 40, profile.tracked_actions.count |
... | ... | @@ -1214,7 +1214,7 @@ class ProfileControllerTest < ActionController::TestCase |
1214 | 1214 | |
1215 | 1215 | should "not index display activities comments" do |
1216 | 1216 | login_as(profile.identifier) |
1217 | - article = TinyMceArticle.create!(:profile => profile, :name => 'An Article about Free Software') | |
1217 | + article = TextArticle.create!(:profile => profile, :name => 'An Article about Free Software') | |
1218 | 1218 | ActionTracker::Record.destroy_all |
1219 | 1219 | activity = create(ActionTracker::Record, :user_id => profile.id, :user_type => 'Profile', :verb => 'create_article', :target_id => article.id, :target_type => 'Article', :params => {'name' => article.name, 'url' => article.url, 'lead' => article.lead, 'first_image' => article.first_image}) |
1220 | 1220 | 20.times {comment = fast_create(Comment, :source_id => article, :title => 'a comment', :body => 'lalala', :created_at => Time.now)} |
... | ... | @@ -1225,7 +1225,7 @@ class ProfileControllerTest < ActionController::TestCase |
1225 | 1225 | |
1226 | 1226 | should "view more comments paginated" do |
1227 | 1227 | login_as(profile.identifier) |
1228 | - article = TinyMceArticle.create!(:profile => profile, :name => 'An Article about Free Software') | |
1228 | + article = TextArticle.create!(:profile => profile, :name => 'An Article about Free Software') | |
1229 | 1229 | ActionTracker::Record.destroy_all |
1230 | 1230 | activity = create(ActionTracker::Record, :user_id => profile.id, :user_type => 'Profile', :verb => 'create_article', :target_id => article.id, :target_type => 'Article', :params => {'name' => article.name, 'url' => article.url, 'lead' => article.lead, 'first_image' => article.first_image}) |
1231 | 1231 | 20.times {comment = fast_create(Comment, :source_id => article, :title => 'a comment', :body => 'lalala', :created_at => Time.now)} |
... | ... | @@ -1341,7 +1341,7 @@ class ProfileControllerTest < ActionController::TestCase |
1341 | 1341 | |
1342 | 1342 | should 'register abuse report with content' do |
1343 | 1343 | reported = fast_create(Profile) |
1344 | - content = fast_create(RawHTMLArticle, :profile_id => reported.id) | |
1344 | + content = fast_create(TextArticle, :profile_id => reported.id) | |
1345 | 1345 | login_as(profile.identifier) |
1346 | 1346 | @controller.stubs(:verify_recaptcha).returns(true) |
1347 | 1347 | |
... | ... | @@ -1368,7 +1368,7 @@ class ProfileControllerTest < ActionController::TestCase |
1368 | 1368 | |
1369 | 1369 | User.current = profile.user |
1370 | 1370 | ActionTracker::Record.destroy_all |
1371 | - TinyMceArticle.create!(:profile => profile, :name => 'An article about free software') | |
1371 | + TextArticle.create!(:profile => profile, :name => 'An article about free software') | |
1372 | 1372 | |
1373 | 1373 | login_as(profile.identifier) |
1374 | 1374 | get :index, :profile => profile.identifier |
... | ... | @@ -1383,7 +1383,7 @@ class ProfileControllerTest < ActionController::TestCase |
1383 | 1383 | |
1384 | 1384 | User.current = profile.user |
1385 | 1385 | ActionTracker::Record.destroy_all |
1386 | - TinyMceArticle.create!(:profile => profile, :name => 'An article about free software') | |
1386 | + TextArticle.create!(:profile => profile, :name => 'An article about free software') | |
1387 | 1387 | activity = ActionTracker::Record.last |
1388 | 1388 | |
1389 | 1389 | login_as(profile.identifier) |
... | ... | @@ -1393,14 +1393,14 @@ class ProfileControllerTest < ActionController::TestCase |
1393 | 1393 | end |
1394 | 1394 | |
1395 | 1395 | should "follow an article" do |
1396 | - article = TinyMceArticle.create!(:profile => profile, :name => 'An article about free software') | |
1396 | + article = TextArticle.create!(:profile => profile, :name => 'An article about free software') | |
1397 | 1397 | login_as(@profile.identifier) |
1398 | 1398 | post :follow_article, :profile => profile.identifier, :article_id => article.id |
1399 | 1399 | assert_includes article.person_followers, @profile |
1400 | 1400 | end |
1401 | 1401 | |
1402 | 1402 | should "unfollow an article" do |
1403 | - article = TinyMceArticle.create!(:profile => profile, :name => 'An article about free software') | |
1403 | + article = TextArticle.create!(:profile => profile, :name => 'An article about free software') | |
1404 | 1404 | article.person_followers << @profile |
1405 | 1405 | article.save! |
1406 | 1406 | assert_includes article.person_followers, @profile |
... | ... | @@ -1411,7 +1411,7 @@ class ProfileControllerTest < ActionController::TestCase |
1411 | 1411 | end |
1412 | 1412 | |
1413 | 1413 | should "be logged in to leave comment on an activity" do |
1414 | - article = TinyMceArticle.create!(:profile => profile, :name => 'An article about free software') | |
1414 | + article = TextArticle.create!(:profile => profile, :name => 'An article about free software') | |
1415 | 1415 | activity = ActionTracker::Record.last |
1416 | 1416 | count = activity.comments.count |
1417 | 1417 | |
... | ... | @@ -1422,7 +1422,7 @@ class ProfileControllerTest < ActionController::TestCase |
1422 | 1422 | |
1423 | 1423 | should "leave a comment in own activity" do |
1424 | 1424 | login_as(profile.identifier) |
1425 | - TinyMceArticle.create!(:profile => profile, :name => 'An article about free software') | |
1425 | + TextArticle.create!(:profile => profile, :name => 'An article about free software') | |
1426 | 1426 | activity = ActionTracker::Record.last |
1427 | 1427 | count = activity.comments.count |
1428 | 1428 | |
... | ... | @@ -1436,7 +1436,7 @@ class ProfileControllerTest < ActionController::TestCase |
1436 | 1436 | should "leave a comment on another profile's activity" do |
1437 | 1437 | login_as(profile.identifier) |
1438 | 1438 | another_person = fast_create(Person) |
1439 | - TinyMceArticle.create!(:profile => another_person, :name => 'An article about free software') | |
1439 | + TextArticle.create!(:profile => another_person, :name => 'An article about free software') | |
1440 | 1440 | activity = ActionTracker::Record.last |
1441 | 1441 | count = activity.comments.count |
1442 | 1442 | assert_equal 0, count |
... | ... | @@ -1448,7 +1448,7 @@ class ProfileControllerTest < ActionController::TestCase |
1448 | 1448 | |
1449 | 1449 | should 'display comment in wall if user was removed after click in view all comments' do |
1450 | 1450 | User.current = profile.user |
1451 | - article = TinyMceArticle.create!(:profile => profile, :name => 'An article about free software') | |
1451 | + article = TextArticle.create!(:profile => profile, :name => 'An article about free software') | |
1452 | 1452 | to_be_removed = create_user('removed_user').person |
1453 | 1453 | comment = create(Comment, :author => to_be_removed, :title => 'Test Comment', :body => 'My author does not exist =(', :source_id => article.id, :source_type => 'Article') |
1454 | 1454 | to_be_removed.destroy |
... | ... | @@ -1465,7 +1465,7 @@ class ProfileControllerTest < ActionController::TestCase |
1465 | 1465 | |
1466 | 1466 | should 'not display spam comments in wall' do |
1467 | 1467 | User.current = profile.user |
1468 | - article = TinyMceArticle.create!(:profile => profile, :name => 'An article about spams nutritional attributes') | |
1468 | + article = TextArticle.create!(:profile => profile, :name => 'An article about spams nutritional attributes') | |
1469 | 1469 | comment = create(Comment, :author => profile, :title => 'Test Comment', :body => 'This article makes me hungry', :source_id => article.id, :source_type => 'Article') |
1470 | 1470 | comment.spam! |
1471 | 1471 | login_as(profile.identifier) |
... | ... | @@ -1476,7 +1476,7 @@ class ProfileControllerTest < ActionController::TestCase |
1476 | 1476 | |
1477 | 1477 | should 'display comment in wall from non logged users after click in view all comments' do |
1478 | 1478 | User.current = profile.user |
1479 | - article = TinyMceArticle.create!(:profile => profile, :name => 'An article about free software') | |
1479 | + article = TextArticle.create!(:profile => profile, :name => 'An article about free software') | |
1480 | 1480 | comment = create(Comment, :name => 'outside user', :email => 'outside@localhost.localdomain', :title => 'Test Comment', :body => 'My author does not exist =(', :source_id => article.id, :source_type => 'Article') |
1481 | 1481 | |
1482 | 1482 | login_as(profile.identifier) | ... | ... |
test/functional/profile_editor_controller_test.rb
... | ... | @@ -534,8 +534,8 @@ class ProfileEditorControllerTest < ActionController::TestCase |
534 | 534 | |
535 | 535 | should 'render TinyMce Editor for header and footer' do |
536 | 536 | get :header_footer, :profile => profile.identifier |
537 | - assert_tag :tag => 'textarea', :attributes => { :id => 'custom_header', :class => 'mceEditor' } | |
538 | - assert_tag :tag => 'textarea', :attributes => { :id => 'custom_footer', :class => 'mceEditor' } | |
537 | + assert_tag :tag => 'textarea', :attributes => { :id => 'custom_header', :class => Article::Editor::TINY_MCE } | |
538 | + assert_tag :tag => 'textarea', :attributes => { :id => 'custom_footer', :class => Article::Editor::TINY_MCE } | |
539 | 539 | end |
540 | 540 | |
541 | 541 | should 'save footer and header' do |
... | ... | @@ -966,7 +966,7 @@ class ProfileEditorControllerTest < ActionController::TestCase |
966 | 966 | person_template = create_user('person_template').person |
967 | 967 | person_template.is_template = true |
968 | 968 | |
969 | - welcome_page = fast_create(TinyMceArticle, :body => 'Initial welcome page') | |
969 | + welcome_page = fast_create(TextArticle, :body => 'Initial welcome page') | |
970 | 970 | person_template.welcome_page = welcome_page |
971 | 971 | person_template.save! |
972 | 972 | welcome_page.profile = person_template | ... | ... |
test/functional/profile_search_controller_test.rb
... | ... | @@ -21,15 +21,15 @@ class ProfileSearchControllerTest < ActionController::TestCase |
21 | 21 | end |
22 | 22 | |
23 | 23 | should 'search for articles' do |
24 | - article = TextileArticle.create(:name => 'My article', :body => 'Article to test profile search', :profile => person) | |
24 | + article = TextArticle.create(:name => 'My article', :body => 'Article to test profile search', :profile => person) | |
25 | 25 | |
26 | 26 | get 'index', :profile => person.identifier, :q => 'article to test' |
27 | 27 | assert_includes assigns(:results), article |
28 | 28 | end |
29 | 29 | |
30 | 30 | should 'not display articles from another profile' do |
31 | - article = TextileArticle.create(:name => 'My article', :body => 'Article to test profile search', :profile => person) | |
32 | - article2 = TextileArticle.create(:name => 'Another article', :body => 'Article from someone else', :profile => fast_create(Person)) | |
31 | + article = TextArticle.create(:name => 'My article', :body => 'Article to test profile search', :profile => person) | |
32 | + article2 = TextArticle.create(:name => 'Another article', :body => 'Article from someone else', :profile => fast_create(Person)) | |
33 | 33 | |
34 | 34 | get 'index', :profile => person.identifier, :q => 'article' |
35 | 35 | assert_includes assigns(:results), article |
... | ... | @@ -49,7 +49,7 @@ class ProfileSearchControllerTest < ActionController::TestCase |
49 | 49 | |
50 | 50 | should 'paginate results listing' do |
51 | 51 | (1..11).each do |i| |
52 | - TextileArticle.create!(:name => "Article #{i}", :profile => person, :language => 'en') | |
52 | + TextArticle.create!(:name => "Article #{i}", :profile => person, :language => 'en') | |
53 | 53 | end |
54 | 54 | |
55 | 55 | get 'index', :profile => person.identifier, :q => 'Article' |
... | ... | @@ -59,20 +59,20 @@ class ProfileSearchControllerTest < ActionController::TestCase |
59 | 59 | end |
60 | 60 | |
61 | 61 | should 'display abstract if given' do |
62 | - article1 = TextileArticle.create(:name => 'Article 1', :abstract => 'Abstract to test', :body => 'Article to test profile search', :profile => person) | |
63 | - article2 = TextileArticle.create(:name => 'Article 2', :body => 'Another article to test profile search', :profile => person) | |
62 | + article1 = TextArticle.create(:name => 'Article 1', :abstract => 'Abstract to test', :body => '<p>Article to test profile search</p>', :profile => person) | |
63 | + article2 = TextArticle.create(:name => 'Article 2', :body => '<p>Another article to test profile search</p>', :profile => person) | |
64 | 64 | |
65 | 65 | get 'index', :profile => person.identifier, :q => 'article to test' |
66 | 66 | |
67 | 67 | assert_tag :tag => 'li', :descendant => { :tag => 'a', :content => article1.abstract, :attributes => { :class => /article-details/ }} |
68 | - assert_no_tag :tag => 'li', :descendant => { :tag => 'a', :content => article1.body, :attributes => { :class => /article-details/ }} | |
68 | + assert_no_tag :tag => 'li', :descendant => { :tag => 'a', :content => 'Article to test profile search', :attributes => { :class => /article-details/ }} | |
69 | 69 | |
70 | - assert_tag :tag => 'li', :descendant => { :tag => 'a', :content => article2.body, :attributes => { :class => /article-details/ }} | |
70 | + assert_tag :tag => 'li', :descendant => { :tag => 'a', :content => 'Another article to test profile search', :attributes => { :class => /article-details/ }} | |
71 | 71 | end |
72 | 72 | |
73 | 73 | should 'display nothing if search is blank' do |
74 | - article1 = TextileArticle.create(:name => 'Article 1', :body => 'Article to test profile search', :profile => person) | |
75 | - article2 = TextileArticle.create(:name => 'Article 2', :body => 'Another article to test profile search', :profile => person) | |
74 | + article1 = TextArticle.create(:name => 'Article 1', :body => 'Article to test profile search', :profile => person) | |
75 | + article2 = TextArticle.create(:name => 'Article 2', :body => 'Another article to test profile search', :profile => person) | |
76 | 76 | |
77 | 77 | get 'index', :profile => person.identifier, :q => '' |
78 | 78 | |
... | ... | @@ -80,19 +80,19 @@ class ProfileSearchControllerTest < ActionController::TestCase |
80 | 80 | end |
81 | 81 | |
82 | 82 | should 'not display private articles' do |
83 | - article1 = TextileArticle.create(:name => 'Article 1', :body => 'Article to test profile search', :profile => person, :published => false) | |
84 | - article2 = TextileArticle.create(:name => 'Article 2', :body => 'Another article to test profile search', :profile => person) | |
83 | + article1 = TextArticle.create(:name => 'Article 1', :body => '<p>Article to test profile search</p>', :profile => person, :published => false) | |
84 | + article2 = TextArticle.create(:name => 'Article 2', :body => '<p>Another article to test profile search</p>', :profile => person) | |
85 | 85 | |
86 | 86 | get 'index', :profile => person.identifier, :q => 'article to test' |
87 | 87 | |
88 | - assert_no_tag :tag => 'li', :descendant => { :tag => 'a', :content => article1.body, :attributes => { :class => /article-details/ }} | |
88 | + assert_no_tag :tag => 'li', :descendant => { :tag => 'a', :content => 'Article to test profile search', :attributes => { :class => /article-details/ }} | |
89 | 89 | |
90 | - assert_tag :tag => 'li', :descendant => { :tag => 'a', :content => article2.body, :attributes => { :class => /article-details/ }} | |
90 | + assert_tag :tag => 'li', :descendant => { :tag => 'a', :content => 'Another article to test profile search', :attributes => { :class => /article-details/ }} | |
91 | 91 | end |
92 | 92 | |
93 | 93 | should 'display number of results found' do |
94 | - article1 = TextileArticle.create(:name => 'Article 1', :body => 'Article to test profile search', :profile => person) | |
95 | - article2 = TextileArticle.create(:name => 'Article 2', :body => 'Another article to test profile search', :profile => person) | |
94 | + article1 = TextArticle.create(:name => 'Article 1', :body => 'Article to test profile search', :profile => person) | |
95 | + article2 = TextArticle.create(:name => 'Article 2', :body => 'Another article to test profile search', :profile => person) | |
96 | 96 | |
97 | 97 | get 'index', :profile => person.identifier, :q => 'article to test' |
98 | 98 | ... | ... |
test/functional/search_controller_test.rb
... | ... | @@ -309,9 +309,9 @@ class SearchControllerTest < ActionController::TestCase |
309 | 309 | assert_tag :tag => 'table', :attributes => {:class => /current-month/}, :descendant => {:tag => 'caption', :content => /August 2008/} |
310 | 310 | end |
311 | 311 | |
312 | - should 'found TextileArticle in articles' do | |
312 | + should 'found TextArticle in articles' do | |
313 | 313 | person = create_user('teste').person |
314 | - art = TextileArticle.create!(:name => 'an text_article article to be found', :profile => person) | |
314 | + art = TextArticle.create!(:name => 'an text_article article to be found', :profile => person) | |
315 | 315 | |
316 | 316 | get 'articles', :query => 'article to be found' |
317 | 317 | ... | ... |
test/functional/spam_controller_test.rb
... | ... | @@ -7,7 +7,7 @@ class SpamControllerTest < ActionController::TestCase |
7 | 7 | |
8 | 8 | @community = fast_create(Community, :name => 'testcommunity') |
9 | 9 | @community.add_admin(@profile) |
10 | - @article = fast_create(TextileArticle, :profile_id => @community.id) | |
10 | + @article = fast_create(TextArticle, :profile_id => @community.id) | |
11 | 11 | @spam_comment = fast_create(Comment, :source_id => @article.id, :spam => true, :name => 'foo', :email => 'foo@example.com') |
12 | 12 | |
13 | 13 | @spam_suggest_article = SuggestArticle.create!(:name => 'spammer', :article => {:name => 'Spam article', :body => "Something you don't need"}, :email => 'spammer@shady.place', :target => @community, :spam => true) | ... | ... |
test/functional/tasks_controller_test.rb
... | ... | @@ -325,23 +325,23 @@ class TasksControllerTest < ActionController::TestCase |
325 | 325 | t = SuggestArticle.create!(:article => {:name => 'test name', :abstract => 'test abstract', :body => 'test body'}, :name => 'some name', :email => 'test@localhost.com', :target => c) |
326 | 326 | |
327 | 327 | get :index |
328 | - assert_tag :tag => 'textarea', :content => /test abstract/, :attributes => { :name => /tasks\[#{t.id}\]\[task\]\[article\]\[abstract\]/, :class => 'mceEditor' } | |
329 | - assert_tag :tag => 'textarea', :content => /test body/, :attributes => { :name => /tasks\[#{t.id}\]\[task\]\[article\]\[body\]/, :class => 'mceEditor' } | |
328 | + assert_tag :tag => 'textarea', :content => /test abstract/, :attributes => { :name => /tasks\[#{t.id}\]\[task\]\[article\]\[abstract\]/, :class => Article::Editor::TINY_MCE } | |
329 | + assert_tag :tag => 'textarea', :content => /test body/, :attributes => { :name => /tasks\[#{t.id}\]\[task\]\[article\]\[body\]/, :class => Article::Editor::TINY_MCE } | |
330 | 330 | end |
331 | 331 | |
332 | - should 'create TinyMceArticle article after finish approve suggested article task' do | |
333 | - TinyMceArticle.destroy_all | |
332 | + should 'create TextArticle article after finish approve suggested article task' do | |
333 | + TextArticle.destroy_all | |
334 | 334 | c = fast_create(Community) |
335 | 335 | c.affiliate(profile, Profile::Roles.all_roles(profile.environment.id)) |
336 | 336 | @controller.stubs(:profile).returns(c) |
337 | 337 | t = SuggestArticle.create!(:article => {:name => 'test name', :body => 'test body'}, :name => 'some name', :email => 'test@localhost.com', :target => c) |
338 | 338 | |
339 | 339 | post :close, :tasks => {t.id => { :task => {}, :decision => "finish"}} |
340 | - assert_not_nil TinyMceArticle.first | |
340 | + assert_not_nil TextArticle.first | |
341 | 341 | end |
342 | 342 | |
343 | 343 | should "change the article's attributes on suggested article task approval" do |
344 | - TinyMceArticle.destroy_all | |
344 | + TextArticle.destroy_all | |
345 | 345 | c = fast_create(Community) |
346 | 346 | c.affiliate(profile, Profile::Roles.all_roles(profile.environment.id)) |
347 | 347 | @controller.stubs(:profile).returns(c) |
... | ... | @@ -353,11 +353,11 @@ class TasksControllerTest < ActionController::TestCase |
353 | 353 | t.save! |
354 | 354 | |
355 | 355 | post :close, :tasks => {t.id => { :task => {:article => {:name => 'new article name', :body => 'new body', :source => 'http://www.noosfero.com', :source_name => 'new source'}, :name => 'new name'}, :decision => "finish"}} |
356 | - assert_equal 'new article name', TinyMceArticle.first.name | |
357 | - assert_equal 'new name', TinyMceArticle.first.author_name | |
358 | - assert_equal 'new body', TinyMceArticle.first.body | |
359 | - assert_equal 'http://www.noosfero.com', TinyMceArticle.first.source | |
360 | - assert_equal 'new source', TinyMceArticle.first.source_name | |
356 | + assert_equal 'new article name', TextArticle.first.name | |
357 | + assert_equal 'new name', TextArticle.first.author_name | |
358 | + assert_equal 'new body', TextArticle.first.body | |
359 | + assert_equal 'http://www.noosfero.com', TextArticle.first.source | |
360 | + assert_equal 'new source', TextArticle.first.source_name | |
361 | 361 | end |
362 | 362 | |
363 | 363 | should "display name from article suggestion when requestor was not setted" do |
... | ... | @@ -372,7 +372,7 @@ class TasksControllerTest < ActionController::TestCase |
372 | 372 | end |
373 | 373 | |
374 | 374 | should "not crash when article suggestion task fails" do |
375 | - TinyMceArticle.destroy_all | |
375 | + TextArticle.destroy_all | |
376 | 376 | c = fast_create(Community) |
377 | 377 | c.affiliate(profile, Profile::Roles.all_roles(profile.environment.id)) |
378 | 378 | @controller.stubs(:profile).returns(c) | ... | ... |
test/integration/manage_documents_test.rb
... | ... | @@ -17,14 +17,14 @@ class ManageDocumentsTest < ActionDispatch::IntegrationTest |
17 | 17 | |
18 | 18 | get '/myprofile/myuser/cms/new' |
19 | 19 | assert_response :success |
20 | - assert_tag :tag => 'a', :attributes => { :href => '/myprofile/myuser/cms/new?type=TinyMceArticle' } | |
20 | + assert_tag :tag => 'a', :attributes => { :href => '/myprofile/myuser/cms/new?type=TextArticle' } | |
21 | 21 | |
22 | - get '/myprofile/myuser/cms/new?type=TinyMceArticle' | |
22 | + get '/myprofile/myuser/cms/new?type=TextArticle' | |
23 | 23 | assert_response :success |
24 | 24 | assert_tag :tag => 'form', :attributes => { :action => '/myprofile/myuser/cms/new', :method => /post/i } |
25 | 25 | |
26 | 26 | assert_difference 'Article.count' do |
27 | - post_via_redirect '/myprofile/myuser/cms/new', :type => 'TinyMceArticle', :article => { :name => 'my article', :body => 'this is the body of ther article'} | |
27 | + post_via_redirect '/myprofile/myuser/cms/new', :type => 'TextArticle', :article => { :name => 'my article', :body => 'this is the body of ther article'} | |
28 | 28 | end |
29 | 29 | |
30 | 30 | assert_response :success |
... | ... | @@ -96,7 +96,7 @@ class ManageDocumentsTest < ActionDispatch::IntegrationTest |
96 | 96 | protected |
97 | 97 | |
98 | 98 | def create_article(profile, options) |
99 | - a = TinyMceArticle.new(options) | |
99 | + a = TextArticle.new(options) | |
100 | 100 | a.profile = profile |
101 | 101 | a.save! |
102 | 102 | a | ... | ... |
test/integration/performance_test.rb
... | ... | @@ -49,7 +49,7 @@ class PerformanceTest < ActionDispatch::IntegrationTest |
49 | 49 | blog = profile.blog |
50 | 50 | n.times do |i| |
51 | 51 | postnumber += 1 |
52 | - TinyMceArticle.create!(:profile => profile, :parent => blog, :name => "post number #{postnumber}") | |
52 | + TextArticle.create!(:profile => profile, :parent => blog, :name => "post number #{postnumber}") | |
53 | 53 | end |
54 | 54 | end |
55 | 55 | ... | ... |
test/integration/profile_blocks_test.rb
... | ... | @@ -5,8 +5,8 @@ class ProfileBlocksTest < ActionDispatch::IntegrationTest |
5 | 5 | def blog_on_article_block_bootstrap |
6 | 6 | profile = fast_create(Profile) |
7 | 7 | blog = fast_create(Blog, :name => 'Blog', :profile_id => profile.id) |
8 | - fast_create(TinyMceArticle, :name => "First Post", :profile_id => profile.id, :parent_id => blog.id, :body => '<p> Wasserstoffbombe </p>') | |
9 | - fast_create(TinyMceArticle, :name => "A Post", :profile_id => profile.id, :parent_id => blog.id, :body => '<p>Lorem ipsum dolor sit amet</p> <p>Second paragraph</p>') | |
8 | + fast_create(TextArticle, :name => "First Post", :profile_id => profile.id, :parent_id => blog.id, :body => '<p> Wasserstoffbombe </p>') | |
9 | + fast_create(TextArticle, :name => "A Post", :profile_id => profile.id, :parent_id => blog.id, :body => '<p>Lorem ipsum dolor sit amet</p> <p>Second paragraph</p>') | |
10 | 10 | block = ArticleBlock.new |
11 | 11 | block.article = blog |
12 | 12 | profile.boxes << Box.new | ... | ... |
test/integration/safe_strings_test.rb
... | ... | @@ -122,7 +122,7 @@ class SafeStringsTest < ActionDispatch::IntegrationTest |
122 | 122 | create_user('jimi', :password => 'test', :password_confirmation => 'test').activate |
123 | 123 | person = Person['jimi'] |
124 | 124 | login 'jimi', 'test' |
125 | - get "/myprofile/jimi/cms/new?type=TinyMceArticle" | |
125 | + get "/myprofile/jimi/cms/new?type=TextArticle" | |
126 | 126 | assert_no_match /title: "Safestringstest::plugin1::macro"/, response.body |
127 | 127 | end |
128 | 128 | |
... | ... | @@ -134,7 +134,7 @@ class SafeStringsTest < ActionDispatch::IntegrationTest |
134 | 134 | |
135 | 135 | expected_content = 'something' |
136 | 136 | html_content = "<p>#{expected_content}</p>" |
137 | - article = TinyMceArticle.create!(:profile => profile, :name => 'An Article about Free Software', :body => html_content) | |
137 | + article = TextArticle.create!(:profile => profile, :name => 'An Article about Free Software', :body => html_content) | |
138 | 138 | ActionTracker::Record.destroy_all |
139 | 139 | activity = create(ActionTracker::Record, :user_id => profile.id, :user_type => 'Profile', :verb => 'create_article', :target_id => article.id, :target_type => 'Article', :params => {'name' => article.name, 'url' => article.url, 'lead' => article.lead, 'first_image' => article.first_image}) |
140 | 140 | get "/profile/marley" |
... | ... | @@ -178,7 +178,7 @@ class SafeStringsTest < ActionDispatch::IntegrationTest |
178 | 178 | should 'not escape read more link to article on display short format' do |
179 | 179 | profile = fast_create Profile |
180 | 180 | blog = fast_create Blog, :name => 'Blog', :profile_id => profile.id |
181 | - fast_create(TinyMceArticle, :name => "Post Test", :profile_id => profile.id, :parent_id => blog.id, :accept_comments => false, :body => '<p>Lorem ipsum dolor sit amet</p>') | |
181 | + fast_create(TextArticle, :name => "Post Test", :profile_id => profile.id, :parent_id => blog.id, :accept_comments => false, :body => '<p>Lorem ipsum dolor sit amet</p>') | |
182 | 182 | blog.update_attribute(:visualization_format, 'short') |
183 | 183 | |
184 | 184 | get "/#{profile.identifier}/blog" | ... | ... |
test/support/factories.rb
... | ... | @@ -118,7 +118,7 @@ module Noosfero::Factory |
118 | 118 | }.merge(options) |
119 | 119 | user = fast_insert_with_timestamps(User, data) |
120 | 120 | person = fast_insert_with_timestamps(Person, { :type => 'Person', :identifier => name, :name => name, :user_id => user.id, :environment_id => environment_id }.merge(person_options)) |
121 | - homepage = fast_insert_with_timestamps(TextileArticle, { :type => 'TextileArticle', :name => 'homepage', :slug => 'homepage', :path => 'homepage', :profile_id => person.id }) | |
121 | + homepage = fast_insert_with_timestamps(TextArticle, { :type => 'TextArticle', :name => 'homepage', :slug => 'homepage', :path => 'homepage', :profile_id => person.id }) | |
122 | 122 | fast_update(person, {:home_page_id => homepage.id}) |
123 | 123 | box = fast_insert(Box, { :owner_type => "Profile", :owner_id => person.id, :position => 1}) |
124 | 124 | block = fast_insert(Block, { :box_id => box.id, :type => 'MainBlock', :position => 0}) | ... | ... |
test/unit/action_tracker_notification_test.rb
... | ... | @@ -91,7 +91,7 @@ class ActionTrackerNotificationTest < ActiveSupport::TestCase |
91 | 91 | should "have comments through article action_tracker" do |
92 | 92 | user = User.current = create_user |
93 | 93 | person = user.person |
94 | - article = create(TextileArticle, :profile_id => person.id) | |
94 | + article = create(TextArticle, :profile_id => person.id) | |
95 | 95 | process_delayed_job_queue |
96 | 96 | notification = ActionTrackerNotification.last |
97 | 97 | ... | ... |
test/unit/application_helper_test.rb
... | ... | @@ -615,7 +615,7 @@ class ApplicationHelperTest < ActionView::TestCase |
615 | 615 | |
616 | 616 | should 'reference to article' do |
617 | 617 | c = fast_create(Community) |
618 | - a = fast_create(TinyMceArticle, :profile_id => c.id) | |
618 | + a = fast_create(TextArticle, :profile_id => c.id) | |
619 | 619 | assert_equal( |
620 | 620 | "<a href=\"/#{c.identifier}/#{a.slug}\">x</a>", |
621 | 621 | reference_to_article('x', a) ) |
... | ... | @@ -623,7 +623,7 @@ class ApplicationHelperTest < ActionView::TestCase |
623 | 623 | |
624 | 624 | should 'reference to article, with anchor' do |
625 | 625 | c = fast_create(Community) |
626 | - a = fast_create(TinyMceArticle, :profile_id => c.id) | |
626 | + a = fast_create(TextArticle, :profile_id => c.id) | |
627 | 627 | assert_equal( |
628 | 628 | "<a href=\"/#{c.identifier}/#{a.slug}#place\">x</a>", |
629 | 629 | reference_to_article('x', a, 'place') ) |
... | ... | @@ -632,7 +632,7 @@ class ApplicationHelperTest < ActionView::TestCase |
632 | 632 | should 'reference to article, in a blog' do |
633 | 633 | c = fast_create(Community) |
634 | 634 | b = fast_create(Blog, :profile_id => c.id) |
635 | - a = fast_create(TinyMceArticle, :profile_id => c.id, :parent_id => b.id) | |
635 | + a = fast_create(TextArticle, :profile_id => c.id, :parent_id => b.id) | |
636 | 636 | a.save! # needed to link to the parent blog |
637 | 637 | assert_equal( |
638 | 638 | "<a href=\"/#{c.identifier}/#{b.slug}/#{a.slug}\">x</a>", |
... | ... | @@ -643,7 +643,7 @@ class ApplicationHelperTest < ActionView::TestCase |
643 | 643 | c = fast_create(Community) |
644 | 644 | c.domains << build(Domain, :name=>'domain.xyz') |
645 | 645 | b = fast_create(Blog, :profile_id => c.id) |
646 | - a = fast_create(TinyMceArticle, :profile_id => c.id, :parent_id => b.id) | |
646 | + a = fast_create(TextArticle, :profile_id => c.id, :parent_id => b.id) | |
647 | 647 | a.save! |
648 | 648 | assert_equal( |
649 | 649 | "<a href=\"http://domain.xyz/#{b.slug}/#{a.slug}\">x</a>", |
... | ... | @@ -856,7 +856,7 @@ class ApplicationHelperTest < ActionView::TestCase |
856 | 856 | assert_equal "Clone Blog", label_for_clone_article(Blog.new) |
857 | 857 | assert_equal "Clone Event", label_for_clone_article(Event.new) |
858 | 858 | assert_equal "Clone Forum", label_for_clone_article(Forum.new) |
859 | - assert_equal "Clone Article", label_for_clone_article(TinyMceArticle.new) | |
859 | + assert_equal "Clone Article", label_for_clone_article(TextArticle.new) | |
860 | 860 | end |
861 | 861 | |
862 | 862 | should "return top url of environment" do |
... | ... | @@ -880,6 +880,86 @@ class ApplicationHelperTest < ActionView::TestCase |
880 | 880 | assert_equal c.top_url, top_url |
881 | 881 | end |
882 | 882 | |
883 | + should "current editor return the editor defined in article" do | |
884 | + person = fast_create(Person) | |
885 | + @article = fast_create(Article) | |
886 | + @article.editor = Article::Editor::TEXTILE | |
887 | + @article.save | |
888 | + stubs(:current_person).returns(person) | |
889 | + assert_equal Article::Editor::TEXTILE, current_editor | |
890 | + end | |
891 | + | |
892 | + should "current editor be tiny mce if an article is present and no editor is defined" do | |
893 | + person = fast_create(Person) | |
894 | + @article = fast_create(Article) | |
895 | + @article.editor = nil | |
896 | + @article.save | |
897 | + stubs(:current_person).returns(person) | |
898 | + assert_equal Article::Editor::TINY_MCE, current_editor | |
899 | + end | |
900 | + | |
901 | + should "current editor be the person editor if there is no article" do | |
902 | + person = fast_create(Person) | |
903 | + request = mock() | |
904 | + stubs(:current_person).returns(person) | |
905 | + person.stubs(:editor).returns(Article::Editor::TEXTILE) | |
906 | + assert_equal Article::Editor::TEXTILE, current_editor | |
907 | + end | |
908 | + | |
909 | + | |
910 | + should "current editor be tiny mce if there is no article and no person editor is defined" do | |
911 | + person = fast_create(Person) | |
912 | + stubs(:current_person).returns(person) | |
913 | + person.stubs(:editor).returns(nil) | |
914 | + assert_equal Article::Editor::TINY_MCE, current_editor | |
915 | + end | |
916 | + | |
917 | + should "current editor return the editor defined in article even if there is a person editor defined" do | |
918 | + person = fast_create(Person) | |
919 | + @article = fast_create(Article) | |
920 | + @article.editor = Article::Editor::TEXTILE | |
921 | + @article.save | |
922 | + stubs(:current_person).returns(person) | |
923 | + person.stubs(:editor).returns(Article::Editor::TINY_MCE) | |
924 | + assert_equal Article::Editor::TEXTILE, current_editor | |
925 | + end | |
926 | + | |
927 | + should "current editor be tiny mce if an article is present and no editor is defined even if there is a person editor defined" do | |
928 | + person = fast_create(Person) | |
929 | + @article = fast_create(Article) | |
930 | + @article.editor = nil | |
931 | + @article.save | |
932 | + stubs(:current_person).returns(person) | |
933 | + person.stubs(:editor).returns(Article::Editor::TINY_MCE) | |
934 | + assert_equal Article::Editor::TINY_MCE, current_editor | |
935 | + end | |
936 | + | |
937 | + should "current editor concat the mode passed as parameter" do | |
938 | + person = fast_create(Person) | |
939 | + @article = fast_create(Article) | |
940 | + @article.editor = Article::Editor::TEXTILE | |
941 | + @article.save | |
942 | + stubs(:current_person).returns(person) | |
943 | + mode = 'something' | |
944 | + assert_equal Article::Editor::TEXTILE + '_' + mode, current_editor(mode) | |
945 | + end | |
946 | + should "current_editor_is? be true if the test editor is equal to defined one" do | |
947 | + stubs(:current_editor).returns(Article::Editor::TEXTILE) | |
948 | + assert current_editor_is?(Article::Editor::TEXTILE) | |
949 | + end | |
950 | + | |
951 | + should "current_editor_is? be false if the test editor is different to defined one" do | |
952 | + stubs(:current_editor).returns(Article::Editor::TINY_MCE) | |
953 | + refute current_editor_is?(Article::Editor::TEXTILE) | |
954 | + end | |
955 | + | |
956 | + should "current_editor_is? be false if the test editor is nil" do | |
957 | + stubs(:current_editor).returns(Article::Editor::TEXTILE) | |
958 | + refute current_editor_is?(nil) | |
959 | + stubs(:current_editor).returns(Article::Editor::TINY_MCE) | |
960 | + refute current_editor_is?(nil) | |
961 | + end | |
962 | + | |
883 | 963 | protected |
884 | 964 | include NoosferoTestHelper |
885 | 965 | |
... | ... | @@ -892,3 +972,4 @@ class ApplicationHelperTest < ActionView::TestCase |
892 | 972 | end |
893 | 973 | |
894 | 974 | end |
975 | + | ... | ... |
test/unit/approve_article_test.rb
... | ... | @@ -8,7 +8,7 @@ class ApproveArticleTest < ActiveSupport::TestCase |
8 | 8 | ActionMailer::Base.deliveries = [] |
9 | 9 | User.current = @user = create_user 'test_user' |
10 | 10 | @profile = @user.person |
11 | - @article = fast_create(TextileArticle, :profile_id => @profile.id, :name => 'test name', :abstract => 'Lead of article', :body => 'This is my article') | |
11 | + @article = fast_create(TextArticle, :profile_id => @profile.id, :name => 'test name', :abstract => 'Lead of article', :body => 'This is my article') | |
12 | 12 | @community = fast_create(Community) |
13 | 13 | @community.add_member(@profile) |
14 | 14 | end |
... | ... | @@ -257,15 +257,15 @@ class ApproveArticleTest < ActiveSupport::TestCase |
257 | 257 | other_community.add_member(profile) |
258 | 258 | ActionTracker::Record.delete_all |
259 | 259 | |
260 | - article = fast_create(TextileArticle) | |
260 | + article = fast_create(TextArticle) | |
261 | 261 | a = create(ApproveArticle, :name => 'bar', :article => article, :target => community, :requestor => profile) |
262 | 262 | a.finish |
263 | 263 | |
264 | - article = fast_create(TextileArticle) | |
264 | + article = fast_create(TextArticle) | |
265 | 265 | a = create(ApproveArticle, :name => 'another bar', :article => article, :target => community, :requestor => profile) |
266 | 266 | a.finish |
267 | 267 | |
268 | - article = fast_create(TextileArticle) | |
268 | + article = fast_create(TextArticle) | |
269 | 269 | a = create(ApproveArticle, :name => 'another bar', :article => article, :target => other_community, :requestor => profile) |
270 | 270 | a.finish |
271 | 271 | assert_equal 3, ActionTracker::Record.count |
... | ... | @@ -275,11 +275,11 @@ class ApproveArticleTest < ActiveSupport::TestCase |
275 | 275 | other_community = fast_create(Community) |
276 | 276 | other_community.add_member(profile) |
277 | 277 | ActionTracker::Record.delete_all |
278 | - article1 = fast_create(TextileArticle) | |
278 | + article1 = fast_create(TextArticle) | |
279 | 279 | a = create(ApproveArticle, :name => 'bar', :article => article1, :target => community, :requestor => profile) |
280 | 280 | a.finish |
281 | 281 | |
282 | - article2 = fast_create(TinyMceArticle) | |
282 | + article2 = fast_create(TextArticle) | |
283 | 283 | a = create(ApproveArticle, :name => 'another bar', :article => article2, :target => other_community, :requestor => profile) |
284 | 284 | a.finish |
285 | 285 | assert_equal 2, ActionTracker::Record.count | ... | ... |
test/unit/approve_comment_test.rb
... | ... | @@ -7,7 +7,7 @@ class ApproveCommentTest < ActiveSupport::TestCase |
7 | 7 | ActionMailer::Base.perform_deliveries = true |
8 | 8 | ActionMailer::Base.deliveries = [] |
9 | 9 | @profile = create_user('test_user', :email => "someone@anyhost.com").person |
10 | - @article = fast_create(TextileArticle, :profile_id => @profile.id, :name => 'test name', :abstract => 'Lead of article', :body => 'This is my article') | |
10 | + @article = fast_create(TextArticle, :profile_id => @profile.id, :name => 'test name', :abstract => 'Lead of article', :body => 'This is my article') | |
11 | 11 | @community = create(Community, :contact_email => "someone@anyhost.com") |
12 | 12 | @comment = build(Comment, :article => @article, :title => 'any comment', :body => "any text", :author => create_user('someperson').person) |
13 | 13 | end | ... | ... |
test/unit/article_test.rb
... | ... | @@ -341,9 +341,9 @@ class ArticleTest < ActiveSupport::TestCase |
341 | 341 | |
342 | 342 | should 'list most commented articles' do |
343 | 343 | Article.delete_all |
344 | - a1 = create(TextileArticle, :name => "art 1", :profile_id => profile.id) | |
345 | - a2 = create(TextileArticle, :name => "art 2", :profile_id => profile.id) | |
346 | - a3 = create(TextileArticle, :name => "art 3", :profile_id => profile.id) | |
344 | + a1 = create(TextArticle, :name => "art 1", :profile_id => profile.id) | |
345 | + a2 = create(TextArticle, :name => "art 2", :profile_id => profile.id) | |
346 | + a3 = create(TextArticle, :name => "art 3", :profile_id => profile.id) | |
347 | 347 | |
348 | 348 | 2.times { create(Comment, :title => 'test', :body => 'asdsad', :author => profile, :source => a2).save! } |
349 | 349 | 4.times { create(Comment, :title => 'test', :body => 'asdsad', :author => profile, :source => a3).save! } |
... | ... | @@ -643,14 +643,14 @@ class ArticleTest < ActiveSupport::TestCase |
643 | 643 | should 'identify if belongs to blog' do |
644 | 644 | p = create_user('user_blog_test').person |
645 | 645 | blog = fast_create(Blog, :name => 'Blog test', :profile_id => p.id) |
646 | - post = fast_create(TextileArticle, :name => 'First post', :profile_id => p.id, :parent_id => blog.id) | |
646 | + post = fast_create(TextArticle, :name => 'First post', :profile_id => p.id, :parent_id => blog.id) | |
647 | 647 | assert post.belongs_to_blog? |
648 | 648 | end |
649 | 649 | |
650 | 650 | should 'not belongs to blog' do |
651 | 651 | p = create_user('user_blog_test').person |
652 | 652 | folder = fast_create(Folder, :name => 'Not Blog', :profile_id => p.id) |
653 | - a = fast_create(TextileArticle, :name => 'Not blog post', :profile_id => p.id, :parent_id => folder.id) | |
653 | + a = fast_create(TextArticle, :name => 'Not blog post', :profile_id => p.id, :parent_id => folder.id) | |
654 | 654 | refute a.belongs_to_blog? |
655 | 655 | end |
656 | 656 | |
... | ... | @@ -955,7 +955,7 @@ class ArticleTest < ActiveSupport::TestCase |
955 | 955 | end |
956 | 956 | |
957 | 957 | should 'have short lead' do |
958 | - a = fast_create(TinyMceArticle, :body => '<p>' + ('a' *180) + '</p>') | |
958 | + a = fast_create(TextArticle, :body => '<p>' + ('a' *180) + '</p>') | |
959 | 959 | assert_equal 170, a.short_lead.length |
960 | 960 | end |
961 | 961 | |
... | ... | @@ -965,7 +965,7 @@ class ArticleTest < ActiveSupport::TestCase |
965 | 965 | end |
966 | 966 | |
967 | 967 | should 'track action when a published article is created outside a community' do |
968 | - article = create(TinyMceArticle, :profile_id => profile.id) | |
968 | + article = create(TextArticle, :profile_id => profile.id) | |
969 | 969 | ta = article.activity |
970 | 970 | assert_equal article.name, ta.get_name |
971 | 971 | assert_equal article.url, ta.get_url |
... | ... | @@ -980,7 +980,7 @@ class ArticleTest < ActiveSupport::TestCase |
980 | 980 | community.add_member(p2) |
981 | 981 | User.current = p1.user |
982 | 982 | |
983 | - article = create(TinyMceArticle, :profile_id => community.id) | |
983 | + article = create(TextArticle, :profile_id => community.id) | |
984 | 984 | activity = article.activity |
985 | 985 | |
986 | 986 | process_delayed_job_queue |
... | ... | @@ -989,7 +989,7 @@ class ArticleTest < ActiveSupport::TestCase |
989 | 989 | end |
990 | 990 | |
991 | 991 | should 'destroy activity when a published article is removed' do |
992 | - a = create(TinyMceArticle, :profile_id => profile.id) | |
992 | + a = create(TextArticle, :profile_id => profile.id) | |
993 | 993 | assert_difference 'ActionTracker::Record.count', -1 do |
994 | 994 | a.destroy |
995 | 995 | end |
... | ... | @@ -1022,7 +1022,7 @@ class ArticleTest < ActiveSupport::TestCase |
1022 | 1022 | end |
1023 | 1023 | |
1024 | 1024 | should 'create activity' do |
1025 | - a = create TextileArticle, :name => 'bar', :profile_id => profile.id, :published => true | |
1025 | + a = create TextArticle, :name => 'bar', :profile_id => profile.id, :published => true | |
1026 | 1026 | a.activity.destroy |
1027 | 1027 | assert_nil a.activity |
1028 | 1028 | |
... | ... | @@ -1068,7 +1068,7 @@ class ArticleTest < ActiveSupport::TestCase |
1068 | 1068 | |
1069 | 1069 | should "not be trackable if article is inside a private community" do |
1070 | 1070 | private_community = fast_create(Community, :public_profile => false) |
1071 | - a = fast_create(TinyMceArticle, :profile_id => private_community.id) | |
1071 | + a = fast_create(TextArticle, :profile_id => private_community.id) | |
1072 | 1072 | assert_equal false, a.is_trackable? |
1073 | 1073 | end |
1074 | 1074 | |
... | ... | @@ -1081,7 +1081,7 @@ class ArticleTest < ActiveSupport::TestCase |
1081 | 1081 | member_1 = User.current.person |
1082 | 1082 | community.add_member(member_1) |
1083 | 1083 | |
1084 | - article = create TinyMceArticle, :name => 'Tracked Article 1', :profile_id => community.id | |
1084 | + article = create TextArticle, :name => 'Tracked Article 1', :profile_id => community.id | |
1085 | 1085 | first_activity = article.activity |
1086 | 1086 | assert_equal [first_activity], ActionTracker::Record.where(verb: 'create_article') |
1087 | 1087 | |
... | ... | @@ -1091,7 +1091,7 @@ class ArticleTest < ActiveSupport::TestCase |
1091 | 1091 | member_2 = fast_create(Person) |
1092 | 1092 | community.add_member(member_2) |
1093 | 1093 | |
1094 | - article2 = create TinyMceArticle, :name => 'Tracked Article 2', :profile_id => community.id | |
1094 | + article2 = create TextArticle, :name => 'Tracked Article 2', :profile_id => community.id | |
1095 | 1095 | second_activity = article2.activity |
1096 | 1096 | assert_equivalent [first_activity, second_activity], ActionTracker::Record.where(verb: 'create_article') |
1097 | 1097 | |
... | ... | @@ -1107,7 +1107,7 @@ class ArticleTest < ActiveSupport::TestCase |
1107 | 1107 | ActionTracker::Record.destroy_all |
1108 | 1108 | ActionTrackerNotification.destroy_all |
1109 | 1109 | User.current = profile.user |
1110 | - article = create(TinyMceArticle, :profile_id => profile.id) | |
1110 | + article = create(TextArticle, :profile_id => profile.id) | |
1111 | 1111 | |
1112 | 1112 | process_delayed_job_queue |
1113 | 1113 | assert_equal friend, ActionTrackerNotification.last.profile |
... | ... | @@ -1119,7 +1119,7 @@ class ArticleTest < ActiveSupport::TestCase |
1119 | 1119 | f1.follow(profile, circle) |
1120 | 1120 | |
1121 | 1121 | User.current = profile.user |
1122 | - article = create TinyMceArticle, :name => 'Tracked Article 1', :profile_id => profile.id | |
1122 | + article = create TextArticle, :name => 'Tracked Article 1', :profile_id => profile.id | |
1123 | 1123 | assert_equal 1, ActionTracker::Record.where(verb: 'create_article').count |
1124 | 1124 | process_delayed_job_queue |
1125 | 1125 | assert_equal 2, ActionTrackerNotification.where(action_tracker_id: article.activity.id).count |
... | ... | @@ -1128,7 +1128,7 @@ class ArticleTest < ActiveSupport::TestCase |
1128 | 1128 | circle2 = Circle.create!(:person=> f2, :name => "Zombies", :profile_type => 'Person') |
1129 | 1129 | f2.follow(profile, circle2) |
1130 | 1130 | |
1131 | - article2 = create TinyMceArticle, :name => 'Tracked Article 2', :profile_id => profile.id | |
1131 | + article2 = create TextArticle, :name => 'Tracked Article 2', :profile_id => profile.id | |
1132 | 1132 | assert_equal 2, ActionTracker::Record.where(verb: 'create_article').count |
1133 | 1133 | process_delayed_job_queue |
1134 | 1134 | assert_equal 3, ActionTrackerNotification.where(action_tracker_id: article2.activity.id).count |
... | ... | @@ -1145,7 +1145,7 @@ class ArticleTest < ActiveSupport::TestCase |
1145 | 1145 | ActionTracker::Record.destroy_all |
1146 | 1146 | ActionTrackerNotification.destroy_all |
1147 | 1147 | User.current = profile.user |
1148 | - article = create(TinyMceArticle, :profile_id => profile.id) | |
1148 | + article = create(TextArticle, :profile_id => profile.id) | |
1149 | 1149 | activity = article.activity |
1150 | 1150 | |
1151 | 1151 | process_delayed_job_queue |
... | ... | @@ -1168,7 +1168,7 @@ class ArticleTest < ActiveSupport::TestCase |
1168 | 1168 | community.add_member(p2) |
1169 | 1169 | User.current = p1.user |
1170 | 1170 | |
1171 | - article = create(TinyMceArticle, :profile_id => community.id) | |
1171 | + article = create(TextArticle, :profile_id => community.id) | |
1172 | 1172 | activity = article.activity |
1173 | 1173 | |
1174 | 1174 | process_delayed_job_queue |
... | ... | @@ -1410,7 +1410,7 @@ class ArticleTest < ActiveSupport::TestCase |
1410 | 1410 | |
1411 | 1411 | should 'retrieve latest info from topic when has no comments' do |
1412 | 1412 | forum = fast_create(Forum, :name => 'Forum test', :profile_id => profile.id) |
1413 | - post = fast_create(TextileArticle, :name => 'First post', :profile_id => profile.id, :parent_id => forum.id, :updated_at => Time.now.in_time_zone, :author_id => profile.id) | |
1413 | + post = fast_create(TextArticle, :name => 'First post', :profile_id => profile.id, :parent_id => forum.id, :updated_at => Time.now.in_time_zone, :author_id => profile.id) | |
1414 | 1414 | assert_equal post.updated_at, post.info_from_last_update[:date] |
1415 | 1415 | assert_equal profile.name, post.info_from_last_update[:author_name] |
1416 | 1416 | assert_equal profile.url, post.info_from_last_update[:author_url] |
... | ... | @@ -1418,19 +1418,15 @@ class ArticleTest < ActiveSupport::TestCase |
1418 | 1418 | |
1419 | 1419 | should 'retrieve latest info from comment when has comments' do |
1420 | 1420 | forum = fast_create(Forum, :name => 'Forum test', :profile_id => profile.id) |
1421 | - post = fast_create(TextileArticle, :name => 'First post', :profile_id => profile.id, :parent_id => forum.id, :updated_at => Time.now.in_time_zone) | |
1421 | + post = fast_create(TextArticle, :name => 'First post', :profile_id => profile.id, :parent_id => forum.id, :updated_at => Time.now.in_time_zone) | |
1422 | 1422 | post.comments << build(Comment, :name => 'Guest', :email => 'guest@example.com', :title => 'test comment', :body => 'hello!') |
1423 | 1423 | assert_equal post.comments.last.created_at, post.info_from_last_update[:date] |
1424 | 1424 | assert_equal "Guest", post.info_from_last_update[:author_name] |
1425 | 1425 | assert_nil post.info_from_last_update[:author_url] |
1426 | 1426 | end |
1427 | 1427 | |
1428 | - should 'tiny mce editor is disabled by default' do | |
1429 | - refute Article.new.tiny_mce? | |
1430 | - end | |
1431 | - | |
1432 | 1428 | should 'return only folders' do |
1433 | - not_folders = [RssFeed, TinyMceArticle, Event, TextileArticle] | |
1429 | + not_folders = [RssFeed, TextArticle, Event, TextArticle] | |
1434 | 1430 | folders = [Folder, Blog, Gallery, Forum] |
1435 | 1431 | |
1436 | 1432 | not_folders.each do |klass| |
... | ... | @@ -1445,7 +1441,7 @@ class ArticleTest < ActiveSupport::TestCase |
1445 | 1441 | end |
1446 | 1442 | |
1447 | 1443 | should 'return no folders' do |
1448 | - not_folders = [RssFeed, TinyMceArticle, Event, TextileArticle] | |
1444 | + not_folders = [RssFeed, TextArticle, Event, TextArticle] | |
1449 | 1445 | folders = [Folder, Blog, Gallery, Forum] |
1450 | 1446 | |
1451 | 1447 | not_folders.each do |klass| |
... | ... | @@ -1485,7 +1481,7 @@ class ArticleTest < ActiveSupport::TestCase |
1485 | 1481 | |
1486 | 1482 | should 'get images paths in article body' do |
1487 | 1483 | Environment.any_instance.stubs(:default_hostname).returns('noosfero.org') |
1488 | - a = build TinyMceArticle, :profile => @profile | |
1484 | + a = build TextArticle, :profile => @profile | |
1489 | 1485 | a.body = 'Noosfero <img src="http://noosfero.com/test.png" /> test <img src="http://test.com/noosfero.png" />' |
1490 | 1486 | assert_includes a.body_images_paths, 'http://noosfero.com/test.png' |
1491 | 1487 | assert_includes a.body_images_paths, 'http://test.com/noosfero.png' |
... | ... | @@ -1493,7 +1489,7 @@ class ArticleTest < ActiveSupport::TestCase |
1493 | 1489 | |
1494 | 1490 | should 'always put article image first in images paths list in article body' do |
1495 | 1491 | Environment.any_instance.stubs(:default_hostname).returns('noosfero.org') |
1496 | - a = create(TinyMceArticle, :name => 'test', :image_builder => { | |
1492 | + a = create(TextArticle, :name => 'test', :image_builder => { | |
1497 | 1493 | :uploaded_data => fixture_file_upload('/files/rails.png', 'image/png') |
1498 | 1494 | }, :profile_id => @profile.id) |
1499 | 1495 | a.save! |
... | ... | @@ -1504,7 +1500,7 @@ class ArticleTest < ActiveSupport::TestCase |
1504 | 1500 | |
1505 | 1501 | should 'escape utf8 characters correctly' do |
1506 | 1502 | Environment.any_instance.stubs(:default_hostname).returns('noosfero.org') |
1507 | - a = build TinyMceArticle, profile: @profile | |
1503 | + a = build TextArticle, profile: @profile | |
1508 | 1504 | a.body = 'Noosfero <img src="http://noosfero.com/cabeça.png" /> ' |
1509 | 1505 | assert_includes a.body_images_paths, 'http://noosfero.com/cabe%C3%A7a.png' |
1510 | 1506 | |
... | ... | @@ -1515,7 +1511,7 @@ class ArticleTest < ActiveSupport::TestCase |
1515 | 1511 | |
1516 | 1512 | should 'get absolute images paths in article body' do |
1517 | 1513 | Environment.any_instance.stubs(:default_hostname).returns('noosfero.org') |
1518 | - a = build TinyMceArticle, :profile => @profile | |
1514 | + a = build TextArticle, :profile => @profile | |
1519 | 1515 | a.body = 'Noosfero <img src="test.png" alt="Absolute" /> test <img src="/relative/path.png" />' |
1520 | 1516 | assert_includes a.body_images_paths, 'http://noosfero.org/test.png' |
1521 | 1517 | assert_includes a.body_images_paths, 'http://noosfero.org/relative/path.png' |
... | ... | @@ -1545,13 +1541,13 @@ class ArticleTest < ActiveSupport::TestCase |
1545 | 1541 | should 'find more recent contents' do |
1546 | 1542 | Article.delete_all |
1547 | 1543 | |
1548 | - c1 = fast_create(TinyMceArticle, :name => 'Testing article 1', :body => 'Article body 1', :profile_id => profile.id, :created_at => DateTime.now - 4) | |
1549 | - c2 = fast_create(TinyMceArticle, :name => 'Testing article 2', :body => 'Article body 2', :profile_id => profile.id, :created_at => DateTime.now - 1) | |
1550 | - c3 = fast_create(TinyMceArticle, :name => 'Testing article 3', :body => 'Article body 3', :profile_id => profile.id, :created_at => DateTime.now - 3) | |
1544 | + c1 = fast_create(TextArticle, :name => 'Testing article 1', :body => 'Article body 1', :profile_id => profile.id, :created_at => DateTime.now - 4) | |
1545 | + c2 = fast_create(TextArticle, :name => 'Testing article 2', :body => 'Article body 2', :profile_id => profile.id, :created_at => DateTime.now - 1) | |
1546 | + c3 = fast_create(TextArticle, :name => 'Testing article 3', :body => 'Article body 3', :profile_id => profile.id, :created_at => DateTime.now - 3) | |
1551 | 1547 | |
1552 | 1548 | assert_equal [c2,c3,c1] , Article.more_recent |
1553 | 1549 | |
1554 | - c4 = fast_create(TinyMceArticle, :name => 'Testing article 4', :body => 'Article body 4', :profile_id => profile.id, :created_at => DateTime.now - 2) | |
1550 | + c4 = fast_create(TextArticle, :name => 'Testing article 4', :body => 'Article body 4', :profile_id => profile.id, :created_at => DateTime.now - 2) | |
1555 | 1551 | assert_equal [c2,c4,c3,c1] , Article.more_recent |
1556 | 1552 | end |
1557 | 1553 | |
... | ... | @@ -1604,18 +1600,6 @@ class ArticleTest < ActiveSupport::TestCase |
1604 | 1600 | assert_equal "4 views", a.more_popular_label |
1605 | 1601 | end |
1606 | 1602 | |
1607 | - should 'return only text articles' do | |
1608 | - Article.delete_all | |
1609 | - | |
1610 | - c1 = fast_create(TinyMceArticle, :name => 'Testing article 1', :body => 'Article body 1', :profile_id => profile.id) | |
1611 | - c2 = fast_create(TextArticle, :name => 'Testing article 2', :body => 'Article body 2', :profile_id => profile.id) | |
1612 | - c3 = fast_create(Event, :name => 'Testing article 3', :body => 'Article body 3', :profile_id => profile.id) | |
1613 | - c4 = fast_create(RssFeed, :name => 'Testing article 4', :body => 'Article body 4', :profile_id => profile.id) | |
1614 | - c5 = fast_create(TextileArticle, :name => 'Testing article 5', :body => 'Article body 5', :profile_id => profile.id) | |
1615 | - | |
1616 | - assert_equivalent [c1,c2,c5], Article.text_articles | |
1617 | - end | |
1618 | - | |
1619 | 1603 | should 'delegate region info to profile' do |
1620 | 1604 | Person.any_instance.expects(:region) |
1621 | 1605 | Person.any_instance.expects(:region_id) |
... | ... | @@ -1708,7 +1692,7 @@ class ArticleTest < ActiveSupport::TestCase |
1708 | 1692 | author = fast_create(Person) |
1709 | 1693 | community.add_member(author) |
1710 | 1694 | forum = Forum.create(:profile => community, :name => 'Forum test', :body => 'Forum test') |
1711 | - post = fast_create(TextileArticle, :name => 'First post', :profile_id => community.id, :parent_id => forum.id, :author_id => author.id) | |
1695 | + post = fast_create(TextArticle, :name => 'First post', :profile_id => community.id, :parent_id => forum.id, :author_id => author.id) | |
1712 | 1696 | |
1713 | 1697 | assert post.allow_edit?(author) |
1714 | 1698 | end |
... | ... | @@ -1742,7 +1726,7 @@ class ArticleTest < ActiveSupport::TestCase |
1742 | 1726 | end |
1743 | 1727 | |
1744 | 1728 | should 'store first image in tracked action' do |
1745 | - a = create TinyMceArticle, :name => 'Tracked Article', :body => '<p>Foo<img src="foo.png" />Bar</p>', :profile_id => profile.id | |
1729 | + a = create TextArticle, :name => 'Tracked Article', :body => '<p>Foo<img src="foo.png" />Bar</p>', :profile_id => profile.id | |
1746 | 1730 | assert_equal 'foo.png', a.first_image |
1747 | 1731 | assert_equal 'foo.png', ActionTracker::Record.last.get_first_image |
1748 | 1732 | end |
... | ... | @@ -1766,7 +1750,7 @@ class ArticleTest < ActiveSupport::TestCase |
1766 | 1750 | should 'update path if parent is changed' do |
1767 | 1751 | f1 = create(Folder, :name => 'Folder 1', :profile => profile) |
1768 | 1752 | f2 = create(Folder, :name => 'Folder 2', :profile => profile) |
1769 | - article = create(TinyMceArticle, :name => 'Sample Article', :parent_id => f1.id, :profile => profile) | |
1753 | + article = create(TextArticle, :name => 'Sample Article', :parent_id => f1.id, :profile => profile) | |
1770 | 1754 | assert_equal [f1.path,article.slug].join('/'), article.path |
1771 | 1755 | |
1772 | 1756 | article.parent = f2 |
... | ... | @@ -1836,20 +1820,20 @@ class ArticleTest < ActiveSupport::TestCase |
1836 | 1820 | should 'identify if belongs to forum' do |
1837 | 1821 | p = create_user('user_forum_test').person |
1838 | 1822 | forum = fast_create(Forum, :name => 'Forum test', :profile_id => p.id) |
1839 | - post = fast_create(TextileArticle, :name => 'First post', :profile_id => p.id, :parent_id => forum.id) | |
1823 | + post = fast_create(TextArticle, :name => 'First post', :profile_id => p.id, :parent_id => forum.id) | |
1840 | 1824 | assert post.belongs_to_forum? |
1841 | 1825 | end |
1842 | 1826 | |
1843 | 1827 | should 'not belongs to forum' do |
1844 | 1828 | p = create_user('user_forum_test').person |
1845 | 1829 | blog = fast_create(Blog, :name => 'Not Forum', :profile_id => p.id) |
1846 | - a = fast_create(TextileArticle, :name => 'Not forum post', :profile_id => p.id, :parent_id => blog.id) | |
1830 | + a = fast_create(TextArticle, :name => 'Not forum post', :profile_id => p.id, :parent_id => blog.id) | |
1847 | 1831 | refute a.belongs_to_forum? |
1848 | 1832 | end |
1849 | 1833 | |
1850 | 1834 | should 'not belongs to forum if do not have a parent' do |
1851 | 1835 | p = create_user('user_forum_test').person |
1852 | - a = fast_create(TextileArticle, :name => 'Orphan post', :profile_id => p.id) | |
1836 | + a = fast_create(TextArticle, :name => 'Orphan post', :profile_id => p.id) | |
1853 | 1837 | refute a.belongs_to_forum? |
1854 | 1838 | end |
1855 | 1839 | |
... | ... | @@ -1865,13 +1849,12 @@ class ArticleTest < ActiveSupport::TestCase |
1865 | 1849 | should 'return articles with specific types' do |
1866 | 1850 | Article.delete_all |
1867 | 1851 | |
1868 | - c1 = fast_create(TinyMceArticle, :name => 'Testing article 1', :body => 'Article body 1', :profile_id => profile.id) | |
1869 | - c2 = fast_create(TextArticle, :name => 'Testing article 2', :body => 'Article body 2', :profile_id => profile.id) | |
1852 | + c1 = fast_create(TextArticle, :name => 'Testing article 1', :body => 'Article body 2', :profile_id => profile.id) | |
1870 | 1853 | c3 = fast_create(Event, :name => 'Testing article 3', :body => 'Article body 3', :profile_id => profile.id) |
1871 | 1854 | c4 = fast_create(RssFeed, :name => 'Testing article 4', :body => 'Article body 4', :profile_id => profile.id) |
1872 | - c5 = fast_create(TextileArticle, :name => 'Testing article 5', :body => 'Article body 5', :profile_id => profile.id) | |
1855 | + c5 = fast_create(TextArticle, :name => 'Testing article 5', :body => 'Article body 5', :profile_id => profile.id) | |
1873 | 1856 | |
1874 | - assert_equivalent [c1,c2], Article.with_types(['TinyMceArticle', 'TextArticle']) | |
1857 | + assert_equivalent [c1,c5], Article.with_types(['TextArticle']) | |
1875 | 1858 | assert_equivalent [c3], Article.with_types(['Event']) |
1876 | 1859 | end |
1877 | 1860 | |
... | ... | @@ -2338,4 +2321,23 @@ class ArticleTest < ActiveSupport::TestCase |
2338 | 2321 | should 'have can_display_blocks with default true' do |
2339 | 2322 | assert Article.can_display_blocks? |
2340 | 2323 | end |
2324 | + | |
2325 | + should 'is_editor true if the article editor is the same as te editor parameter' do | |
2326 | + article = Article.new(:editor => Article::Editor::TEXTILE) | |
2327 | + assert article.editor?(Article::Editor::TEXTILE) | |
2328 | + article = Article.new(:editor => Article::Editor::TINY_MCE) | |
2329 | + assert article.editor?(Article::Editor::TINY_MCE) | |
2330 | + article = Article.new(:editor => Article::Editor::RAW_HTML) | |
2331 | + assert article.editor?(Article::Editor::RAW_HTML) | |
2332 | + end | |
2333 | + | |
2334 | + should 'is_editor false if the article editor is not the same as te editor parameter' do | |
2335 | + article = Article.new(:editor => Article::Editor::TEXTILE) | |
2336 | + assert !article.editor?(Article::Editor::TINY_MCE) | |
2337 | + article = Article.new(:editor => Article::Editor::TINY_MCE) | |
2338 | + assert !article.editor?(Article::Editor::TEXTILE) | |
2339 | + article = Article.new(:editor => Article::Editor::RAW_HTML) | |
2340 | + assert !article.editor?(Article::Editor::TINY_MCE) | |
2341 | + end | |
2342 | + | |
2341 | 2343 | end | ... | ... |
test/unit/blog_archives_block_test.rb
... | ... | @@ -60,8 +60,8 @@ class BlogArchivesBlockTest < ActiveSupport::TestCase |
60 | 60 | # block.stubs(:blog).returns(blog) |
61 | 61 | # block.stubs(:owner).returns(profile) |
62 | 62 | # |
63 | -# public_post = fast_create(TextileArticle, :profile_id => profile.id, :parent_id => blog.id, :published => true, :published_at => Time.mktime(2012, 'jan')) | |
64 | -# private_post = fast_create(TextileArticle, :profile_id => profile.id, :parent_id => blog.id, :published => false, :published_at => Time.mktime(2012, 'jan')) | |
63 | +# public_post = fast_create(TextArticle, :profile_id => profile.id, :parent_id => blog.id, :published => true, :published_at => Time.mktime(2012, 'jan')) | |
64 | +# private_post = fast_create(TextArticle, :profile_id => profile.id, :parent_id => blog.id, :published => false, :published_at => Time.mktime(2012, 'jan')) | |
65 | 65 | # |
66 | 66 | # assert_match /January \(1\)/, block.content({:person => person}) |
67 | 67 | # assert_match /January \(1\)/, block.content() |
... | ... | @@ -84,7 +84,7 @@ class BlogArchivesBlockViewTest < ActionView::TestCase |
84 | 84 | date = DateTime.parse('2008-01-10') |
85 | 85 | blog = profile.blog |
86 | 86 | for i in 1..10 do |
87 | - post = fast_create(TextileArticle, :name => "post #{i} test", :profile_id => profile.id, :parent_id => blog.id) | |
87 | + post = fast_create(TextArticle, :name => "post #{i} test", :profile_id => profile.id, :parent_id => blog.id) | |
88 | 88 | post.update_attribute(:published_at, date) |
89 | 89 | end |
90 | 90 | block = BlogArchivesBlock.new |
... | ... | @@ -98,7 +98,7 @@ class BlogArchivesBlockViewTest < ActionView::TestCase |
98 | 98 | date = DateTime.parse('2008-01-10') |
99 | 99 | blog = profile.blog |
100 | 100 | for i in 1..10 do |
101 | - post = fast_create(TextileArticle, :name => "post #{i} test", :profile_id => profile.id, :parent_id => blog.id) | |
101 | + post = fast_create(TextArticle, :name => "post #{i} test", :profile_id => profile.id, :parent_id => blog.id) | |
102 | 102 | assert post.update_attribute(:published_at, date) |
103 | 103 | end |
104 | 104 | block = BlogArchivesBlock.new |
... | ... | @@ -120,7 +120,7 @@ class BlogArchivesBlockViewTest < ActionView::TestCase |
120 | 120 | should 'order list of amount posts' do |
121 | 121 | blog = profile.blog |
122 | 122 | for i in 1..10 do |
123 | - post = fast_create(TextileArticle, :name => "post #{i} test", :profile_id => profile.id, :parent_id => blog.id) | |
123 | + post = fast_create(TextArticle, :name => "post #{i} test", :profile_id => profile.id, :parent_id => blog.id) | |
124 | 124 | post.update_attribute(:published_at, DateTime.parse("2008-#{i}-01")) |
125 | 125 | end |
126 | 126 | block = BlogArchivesBlock.new |
... | ... | @@ -146,7 +146,7 @@ class BlogArchivesBlockViewTest < ActionView::TestCase |
146 | 146 | should 'order years' do |
147 | 147 | blog = profile.blog |
148 | 148 | for year in 2005..2009 |
149 | - post = create(TextileArticle, :name => "post #{year}", :profile => profile, :parent => blog, :published_at => Date.new(year, 1, 1)) | |
149 | + post = create(TextArticle, :name => "post #{year}", :profile => profile, :parent => blog, :published_at => Date.new(year, 1, 1)) | |
150 | 150 | end |
151 | 151 | block = BlogArchivesBlock.new |
152 | 152 | block.stubs(:owner).returns(profile) |
... | ... | @@ -158,7 +158,7 @@ class BlogArchivesBlockViewTest < ActionView::TestCase |
158 | 158 | should 'order months from later to former' do |
159 | 159 | blog = profile.blog |
160 | 160 | for month in 1..3 |
161 | - post = create(TextileArticle, :name => "post #{month}", :profile => profile, :parent => blog, :published_at => Date.new(2009, month, 1)) | |
161 | + post = create(TextArticle, :name => "post #{month}", :profile => profile, :parent => blog, :published_at => Date.new(2009, month, 1)) | |
162 | 162 | end |
163 | 163 | block = BlogArchivesBlock.new |
164 | 164 | block.stubs(:owner).returns(profile) |
... | ... | @@ -182,8 +182,8 @@ class BlogArchivesBlockViewTest < ActionView::TestCase |
182 | 182 | profile.articles << Blog.new(:name => 'Blog Two', :profile => profile) |
183 | 183 | (blog_one, blog_two) = profile.blogs |
184 | 184 | for month in 1..3 |
185 | - create(TextileArticle, :name => "blog one - post #{month}", :profile_id => profile.id, :parent_id => blog_one.id) | |
186 | - create(TextileArticle, :name => "blog two - post #{month}", :profile_id => profile.id, :parent_id => blog_two.id) | |
185 | + create(TextArticle, :name => "blog one - post #{month}", :profile_id => profile.id, :parent_id => blog_one.id) | |
186 | + create(TextArticle, :name => "blog two - post #{month}", :profile_id => profile.id, :parent_id => blog_two.id) | |
187 | 187 | end |
188 | 188 | block = BlogArchivesBlock.new |
189 | 189 | block.stubs(:owner).returns(profile) |
... | ... | @@ -197,10 +197,10 @@ class BlogArchivesBlockViewTest < ActionView::TestCase |
197 | 197 | date = DateTime.parse('2008-01-10') |
198 | 198 | blog = profile.blog |
199 | 199 | 2.times do |i| |
200 | - post = fast_create(TextileArticle, :name => "post #{i} test", :profile_id => profile.id, | |
200 | + post = fast_create(TextArticle, :name => "post #{i} test", :profile_id => profile.id, | |
201 | 201 | :parent_id => blog.id, :language => 'en') |
202 | 202 | post.update_attribute(:published_at, date) |
203 | - translation = fast_create(TextileArticle, :name => "post #{i} test", :profile_id => profile.id, | |
203 | + translation = fast_create(TextArticle, :name => "post #{i} test", :profile_id => profile.id, | |
204 | 204 | :parent_id => blog.id, :language => 'en', :translation_of_id => post.id) |
205 | 205 | translation.update_attribute(:published_at, date) |
206 | 206 | end |
... | ... | @@ -215,10 +215,10 @@ class BlogArchivesBlockViewTest < ActionView::TestCase |
215 | 215 | date = DateTime.parse('2008-01-10') |
216 | 216 | blog = profile.blog |
217 | 217 | 2.times do |i| |
218 | - post = fast_create(TextileArticle, :name => "post #{i} test", :profile_id => profile.id, | |
218 | + post = fast_create(TextArticle, :name => "post #{i} test", :profile_id => profile.id, | |
219 | 219 | :parent_id => blog.id, :language => 'en') |
220 | 220 | post.update_attribute(:published_at, date) |
221 | - translation = fast_create(TextileArticle, :name => "post #{i} test", :profile_id => profile.id, | |
221 | + translation = fast_create(TextArticle, :name => "post #{i} test", :profile_id => profile.id, | |
222 | 222 | :parent_id => blog.id, :language => 'en', :translation_of_id => post.id) |
223 | 223 | translation.update_attribute(:published_at, date) |
224 | 224 | end | ... | ... |
test/unit/blog_helper_test.rb
... | ... | @@ -23,13 +23,13 @@ class BlogHelperTest < ActionView::TestCase |
23 | 23 | def h(s); s; end |
24 | 24 | |
25 | 25 | should 'list blog posts with identifiers and classes' do |
26 | - blog.children << older_post = create(TextileArticle, :name => 'First post', | |
26 | + blog.children << older_post = create(TextArticle, :name => 'First post', | |
27 | 27 | :profile => profile, :parent => blog, :published => true) |
28 | - blog.children << some_post = create(TextileArticle, :name => 'Some post', | |
28 | + blog.children << some_post = create(TextArticle, :name => 'Some post', | |
29 | 29 | :profile => profile, :parent => blog, :published => true) |
30 | - blog.children << hidden_post = create(TextileArticle, :name => 'Hidden post', | |
30 | + blog.children << hidden_post = create(TextArticle, :name => 'Hidden post', | |
31 | 31 | :profile => profile, :parent => blog, :published => false) |
32 | - blog.children << newer_post = create(TextileArticle, :name => 'Last post', | |
32 | + blog.children << newer_post = create(TextArticle, :name => 'Last post', | |
33 | 33 | :profile => profile, :parent => blog, :published => true) |
34 | 34 | |
35 | 35 | def content_tag(tag, content_or_options_with_block = nil, options = nil, &block) |
... | ... | @@ -57,7 +57,7 @@ class BlogHelperTest < ActionView::TestCase |
57 | 57 | |
58 | 58 | |
59 | 59 | should 'display post' do |
60 | - blog.children << article = create(TextileArticle, :name => 'Second post', :profile => profile, :parent => blog, :published => true) | |
60 | + blog.children << article = create(TextArticle, :name => 'Second post', :profile => profile, :parent => blog, :published => true) | |
61 | 61 | expects(:article_title).with(article, anything).returns('TITLE') |
62 | 62 | expects(:content_tag).with('p', article.to_html).returns(' TO_HTML') |
63 | 63 | self.stubs(:params).returns({:npage => nil}) | ... | ... |
test/unit/blog_test.rb
... | ... | @@ -66,7 +66,7 @@ class BlogTest < ActiveSupport::TestCase |
66 | 66 | should 'has posts' do |
67 | 67 | p = create_user('testuser').person |
68 | 68 | blog = fast_create(Blog, :profile_id => p.id, :name => 'Blog test') |
69 | - post = fast_create(TextileArticle, :name => 'First post', :profile_id => p.id, :parent_id => blog.id) | |
69 | + post = fast_create(TextArticle, :name => 'First post', :profile_id => p.id, :parent_id => blog.id) | |
70 | 70 | blog.children << post |
71 | 71 | assert_includes blog.posts, post |
72 | 72 | end |
... | ... | @@ -81,8 +81,8 @@ class BlogTest < ActiveSupport::TestCase |
81 | 81 | should 'list posts ordered by published at' do |
82 | 82 | p = create_user('testuser').person |
83 | 83 | blog = fast_create(Blog, :profile_id => p.id, :name => 'Blog test') |
84 | - newer = create(TextileArticle, :name => 'Post 2', :parent => blog, :profile => p) | |
85 | - older = create(TextileArticle, :name => 'Post 1', :parent => blog, :profile => p, :published_at => Time.now - 1.month) | |
84 | + newer = create(TextArticle, :name => 'Post 2', :parent => blog, :profile => p) | |
85 | + older = create(TextArticle, :name => 'Post 1', :parent => blog, :profile => p, :published_at => Time.now - 1.month) | |
86 | 86 | assert_equal [newer, older], blog.posts |
87 | 87 | end |
88 | 88 | |
... | ... | @@ -215,7 +215,7 @@ class BlogTest < ActiveSupport::TestCase |
215 | 215 | p = create_user('testuser').person |
216 | 216 | blog = Blog.create!(:profile => p, :name => 'Blog test') |
217 | 217 | folder = fast_create(Folder, :parent_id => blog.id) |
218 | - article = fast_create(TextileArticle, :parent_id => blog.id) | |
218 | + article = fast_create(TextArticle, :parent_id => blog.id) | |
219 | 219 | |
220 | 220 | assert_not_includes blog.posts, folder |
221 | 221 | assert_includes blog.posts, article |
... | ... | @@ -230,7 +230,7 @@ class BlogTest < ActiveSupport::TestCase |
230 | 230 | p = create_user('testuser').person |
231 | 231 | blog = Blog.create!(:profile => p, :name => 'Blog test') |
232 | 232 | assert blog.empty? |
233 | - fast_create(TextileArticle, :parent_id => blog.id) | |
233 | + fast_create(TextArticle, :parent_id => blog.id) | |
234 | 234 | refute blog.empty? |
235 | 235 | end |
236 | 236 | |
... | ... | @@ -270,18 +270,18 @@ class BlogTest < ActiveSupport::TestCase |
270 | 270 | should 'count total number of posts by year' do |
271 | 271 | p = create_user('testuser').person |
272 | 272 | blog = fast_create(Blog, :profile_id => p.id, :name => 'Blog test') |
273 | - create(TextileArticle, :name => 'Post 1', :parent => blog, :profile => p, :published_at => DateTime.parse('16-08-2010')) | |
274 | - create(TextileArticle, :name => 'Post 2', :parent => blog, :profile => p, :published_at => DateTime.parse('17-08-2010')) | |
275 | - create(TextileArticle, :name => 'Post 3', :parent => blog, :profile => p, :published_at => DateTime.parse('10-05-2012')) | |
273 | + create(TextArticle, :name => 'Post 1', :parent => blog, :profile => p, :published_at => DateTime.parse('16-08-2010')) | |
274 | + create(TextArticle, :name => 'Post 2', :parent => blog, :profile => p, :published_at => DateTime.parse('17-08-2010')) | |
275 | + create(TextArticle, :name => 'Post 3', :parent => blog, :profile => p, :published_at => DateTime.parse('10-05-2012')) | |
276 | 276 | assert_equal [[2012.0, 1], [2010.0, 2]], blog.total_number_of_posts(:by_year) |
277 | 277 | end |
278 | 278 | |
279 | 279 | should 'count total number of posts by month' do |
280 | 280 | p = create_user('testuser').person |
281 | 281 | blog = fast_create(Blog, :profile_id => p.id, :name => 'Blog test') |
282 | - create(TextileArticle, :name => 'Post 1', :parent => blog, :profile => p, :published_at => DateTime.parse('16-08-2010')) | |
283 | - create(TextileArticle, :name => 'Post 2', :parent => blog, :profile => p, :published_at => DateTime.parse('17-08-2010')) | |
284 | - create(TextileArticle, :name => 'Post 3', :parent => blog, :profile => p, :published_at => DateTime.parse('11-10-2010')) | |
282 | + create(TextArticle, :name => 'Post 1', :parent => blog, :profile => p, :published_at => DateTime.parse('16-08-2010')) | |
283 | + create(TextArticle, :name => 'Post 2', :parent => blog, :profile => p, :published_at => DateTime.parse('17-08-2010')) | |
284 | + create(TextArticle, :name => 'Post 3', :parent => blog, :profile => p, :published_at => DateTime.parse('11-10-2010')) | |
285 | 285 | assert_equal [[10.0, 1], [8.0, 2]], blog.total_number_of_posts(:by_month, 2010) |
286 | 286 | end |
287 | 287 | ... | ... |
test/unit/clone_article_test.rb
... | ... | @@ -5,7 +5,7 @@ class CloneArticleTest < ActiveSupport::TestCase |
5 | 5 | should 'cloned article have its source attributes' do |
6 | 6 | community = fast_create(Community) |
7 | 7 | folder = fast_create(Folder, :profile_id => community.id) |
8 | - article = fast_create(TinyMceArticle, :profile_id => community.id) | |
8 | + article = fast_create(TextArticle, :profile_id => community.id) | |
9 | 9 | article.parent_id = folder.id |
10 | 10 | article.save! |
11 | 11 | |
... | ... | @@ -18,4 +18,4 @@ class CloneArticleTest < ActiveSupport::TestCase |
18 | 18 | assert_equal article.setting, cloned_article.setting |
19 | 19 | end |
20 | 20 | |
21 | -end | |
22 | 21 | \ No newline at end of file |
22 | +end | ... | ... |
test/unit/cms_helper_test.rb
... | ... | @@ -31,7 +31,7 @@ class CmsHelperTest < ActionView::TestCase |
31 | 31 | |
32 | 32 | should 'display link to article if article is not folder' do |
33 | 33 | profile = fast_create(Profile) |
34 | - article = fast_create(TinyMceArticle, :name => 'My article', :profile_id => profile.id) | |
34 | + article = fast_create(TextArticle, :name => 'My article', :profile_id => profile.id) | |
35 | 35 | expects(:link_to).with('My article', article.url, :class => icon_for_article(article)) |
36 | 36 | |
37 | 37 | result = link_to_article(article) |
... | ... | @@ -51,7 +51,7 @@ class CmsHelperTest < ActionView::TestCase |
51 | 51 | should 'display spread button' do |
52 | 52 | plugins.stubs(:dispatch).returns([]) |
53 | 53 | profile = fast_create(Person) |
54 | - article = fast_create(TinyMceArticle, :name => 'My article', :profile_id => profile.id) | |
54 | + article = fast_create(TextArticle, :name => 'My article', :profile_id => profile.id) | |
55 | 55 | expects(:link_to).with('Spread this', {:action => 'publish', :id => article.id}, :class => 'modal-toggle button with-text icon-spread', :title => nil) |
56 | 56 | |
57 | 57 | result = display_spread_button(article) |
... | ... | @@ -72,7 +72,7 @@ class CmsHelperTest < ActionView::TestCase |
72 | 72 | plugins.stubs(:dispatch).returns([]) |
73 | 73 | profile = fast_create(Profile) |
74 | 74 | name = 'My article' |
75 | - article = fast_create(TinyMceArticle, :name => name, :profile_id => profile.id) | |
75 | + article = fast_create(TextArticle, :name => name, :profile_id => profile.id) | |
76 | 76 | confirm_message = "Are you sure that you want to remove the item \"#{name}\"?" |
77 | 77 | expects(:link_to).with('Delete', {action: 'destroy', id: article.id}, method: :post, 'data-confirm' => confirm_message, class: 'button with-text icon-delete', title: nil) |
78 | 78 | ... | ... |
test/unit/comment_test.rb
... | ... | @@ -65,7 +65,7 @@ class CommentTest < ActiveSupport::TestCase |
65 | 65 | |
66 | 66 | should 'update counter cache in article' do |
67 | 67 | owner = create_user('testuser').person |
68 | - art = create(TextileArticle, :profile_id => owner.id) | |
68 | + art = create(TextArticle, :profile_id => owner.id) | |
69 | 69 | cc = art.comments_count |
70 | 70 | |
71 | 71 | comment = create(Comment, :source => art, :author_id => owner.id) |
... | ... | @@ -75,7 +75,7 @@ class CommentTest < ActiveSupport::TestCase |
75 | 75 | should 'update counter cache in article activity' do |
76 | 76 | User.current = user = create_user 'testuser' |
77 | 77 | owner = user.person |
78 | - article = create(TextileArticle, :profile_id => owner.id) | |
78 | + article = create(TextArticle, :profile_id => owner.id) | |
79 | 79 | |
80 | 80 | action = article.activity |
81 | 81 | cc = action.comments_count |
... | ... | @@ -290,7 +290,7 @@ class CommentTest < ActiveSupport::TestCase |
290 | 290 | should "return activities comments as a thread" do |
291 | 291 | User.current = user = create_user |
292 | 292 | person = user.person |
293 | - a = TextileArticle.create!(:profile => person, :name => 'My article', :body => 'Article body') | |
293 | + a = TextArticle.create!(:profile => person, :name => 'My article', :body => 'Article body') | |
294 | 294 | c0 = Comment.create!(:source => a, :body => 'My comment', :author => person) |
295 | 295 | c1 = Comment.create!(:reply_of_id => c0.id, :source => a, :body => 'bla', :author => person) |
296 | 296 | c2 = Comment.create!(:reply_of_id => c1.id, :source => a, :body => 'bla', :author => person) |
... | ... | @@ -308,7 +308,7 @@ class CommentTest < ActiveSupport::TestCase |
308 | 308 | should "return activities comments when some comment on thread is spam and not display its replies" do |
309 | 309 | User.current = user = create_user |
310 | 310 | person = user.person |
311 | - a = TextileArticle.create!(:profile => person, :name => 'My article', :body => 'Article body') | |
311 | + a = TextArticle.create!(:profile => person, :name => 'My article', :body => 'Article body') | |
312 | 312 | c0 = Comment.create(:source => a, :body => 'Root comment', :author => person) |
313 | 313 | c1 = Comment.create(:reply_of_id => c0.id, :source => a, :body => 'c1', :author => person) |
314 | 314 | c2 = Comment.create(:source => a, :body => 'c2', :author => person) |
... | ... | @@ -385,7 +385,7 @@ class CommentTest < ActiveSupport::TestCase |
385 | 385 | |
386 | 386 | User.current = user = create_user 'testuser' |
387 | 387 | profile = user.person |
388 | - article = create(TinyMceArticle, :profile => profile) | |
388 | + article = create(TextArticle, :profile => profile) | |
389 | 389 | |
390 | 390 | ActionTracker::Record.record_timestamps = false |
391 | 391 | article.activity.update_attribute(:updated_at, Time.now - 1.day) |
... | ... | @@ -400,7 +400,7 @@ class CommentTest < ActiveSupport::TestCase |
400 | 400 | should 'create a new activity when add a comment and the activity was removed' do |
401 | 401 | User.current = user = create_user 'testuser' |
402 | 402 | profile = user.person |
403 | - article = create(TinyMceArticle, :profile => profile) | |
403 | + article = create(TextArticle, :profile => profile) | |
404 | 404 | article.activity.destroy |
405 | 405 | |
406 | 406 | assert_nil article.activity |
... | ... | @@ -776,7 +776,7 @@ class CommentTest < ActiveSupport::TestCase |
776 | 776 | |
777 | 777 | def create_comment(args = {}) |
778 | 778 | owner = create_user('testuser').person |
779 | - article = create(TextileArticle, :profile_id => owner.id) | |
779 | + article = create(TextArticle, :profile_id => owner.id) | |
780 | 780 | create(Comment, { :name => 'foo', :email => 'foo@example.com', :source => article }.merge(args)) |
781 | 781 | end |
782 | 782 | ... | ... |
test/unit/community_test.rb
... | ... | @@ -145,25 +145,25 @@ class CommunityTest < ActiveSupport::TestCase |
145 | 145 | c = fast_create(Community, :name => 'test_com') |
146 | 146 | f = fast_create(Folder, :name => 'folder', :profile_id => c.id) |
147 | 147 | u = create(UploadedFile, :profile => c, :uploaded_data => fixture_file_upload('/files/rails.png', 'image/png')) |
148 | - older_t = fast_create(TinyMceArticle, :name => 'old news', :profile_id => c.id) | |
149 | - t = fast_create(TinyMceArticle, :name => 'news', :profile_id => c.id) | |
150 | - t_in_f = fast_create(TinyMceArticle, :name => 'news', :profile_id => c.id, :parent_id => f.id) | |
148 | + older_t = fast_create(TextArticle, :name => 'old news', :profile_id => c.id) | |
149 | + t = fast_create(TextArticle, :name => 'news', :profile_id => c.id) | |
150 | + t_in_f = fast_create(TextArticle, :name => 'news', :profile_id => c.id, :parent_id => f.id) | |
151 | 151 | |
152 | 152 | assert_equal [t_in_f, t], c.news(2) |
153 | 153 | end |
154 | 154 | |
155 | 155 | should 'not return highlighted news when not asked' do |
156 | 156 | c = fast_create(Community, :name => 'test_com') |
157 | - highlighted_t = fast_create(TinyMceArticle, :name => 'high news', :profile_id => c.id, :highlighted => true) | |
158 | - t = fast_create(TinyMceArticle, :name => 'news', :profile_id => c.id) | |
157 | + highlighted_t = fast_create(TextArticle, :name => 'high news', :profile_id => c.id, :highlighted => true) | |
158 | + t = fast_create(TextArticle, :name => 'news', :profile_id => c.id) | |
159 | 159 | |
160 | 160 | assert_equal [t].map(&:slug), c.news(2).map(&:slug) |
161 | 161 | end |
162 | 162 | |
163 | 163 | should 'return highlighted news when asked' do |
164 | 164 | c = fast_create(Community, :name => 'test_com') |
165 | - highlighted_t = fast_create(TinyMceArticle, :name => 'high news', :profile_id => c.id, :highlighted => true) | |
166 | - t = fast_create(TinyMceArticle, :name => 'news', :profile_id => c.id) | |
165 | + highlighted_t = fast_create(TextArticle, :name => 'high news', :profile_id => c.id, :highlighted => true) | |
166 | + t = fast_create(TextArticle, :name => 'news', :profile_id => c.id) | |
167 | 167 | |
168 | 168 | assert_equal [highlighted_t].map(&:slug), c.news(2, true).map(&:slug) |
169 | 169 | end |
... | ... | @@ -293,7 +293,7 @@ class CommunityTest < ActiveSupport::TestCase |
293 | 293 | p2 = create_user.person |
294 | 294 | p3 = create_user.person |
295 | 295 | community.add_member(p3) |
296 | - article = create(TextileArticle, :profile_id => community.id) | |
296 | + article = create(TextArticle, :profile_id => community.id) | |
297 | 297 | time = article.activity.updated_at + 1.day |
298 | 298 | Time.stubs(:now).returns(time) |
299 | 299 | create(Comment, :source_id => article.id, :title => 'some', :body => 'some', :author_id => p2.id) |
... | ... | @@ -366,7 +366,7 @@ class CommunityTest < ActiveSupport::TestCase |
366 | 366 | |
367 | 367 | User.current = person.user |
368 | 368 | assert_difference 'ActionTracker::Record.count', 1 do |
369 | - article = create(TinyMceArticle, :profile => community, :name => 'An article about free software') | |
369 | + article = create(TextArticle, :profile => community, :name => 'An article about free software') | |
370 | 370 | assert_equal [article.activity], community.activities.map(&:activity) |
371 | 371 | end |
372 | 372 | end |
... | ... | @@ -377,7 +377,7 @@ class CommunityTest < ActiveSupport::TestCase |
377 | 377 | community2 = fast_create(Community) |
378 | 378 | |
379 | 379 | User.current = person.user |
380 | - article = create(TinyMceArticle, :profile => community2, :name => 'Another article about free software') | |
380 | + article = create(TextArticle, :profile => community2, :name => 'Another article about free software') | |
381 | 381 | |
382 | 382 | assert_not_includes community.activities.map { |a| a.klass.constantize.find(a.id) }, article.activity |
383 | 383 | end | ... | ... |
test/unit/content_viewer_helper_test.rb
... | ... | @@ -16,27 +16,27 @@ class ContentViewerHelperTest < ActionView::TestCase |
16 | 16 | |
17 | 17 | should 'display published-at for blog posts' do |
18 | 18 | blog = fast_create(Blog, :name => 'Blog test', :profile_id => profile.id) |
19 | - post = create(TextileArticle, :name => 'post test', :profile => profile, :parent => blog) | |
19 | + post = create(TextArticle, :name => 'post test', :profile => profile, :parent => blog) | |
20 | 20 | result = article_title(post) |
21 | 21 | assert_tag_in_string result, :tag => 'span', :content => show_time(post.published_at) |
22 | 22 | end |
23 | 23 | |
24 | 24 | should 'display published-at for forum posts' do |
25 | 25 | forum = fast_create(Forum, :name => 'Forum test', :profile_id => profile.id) |
26 | - post = TextileArticle.create!(:name => 'post test', :profile => profile, :parent => forum) | |
26 | + post = TextArticle.create!(:name => 'post test', :profile => profile, :parent => forum) | |
27 | 27 | result = article_title(post) |
28 | 28 | assert_tag_in_string result, :tag => 'span', :content => show_time(post.published_at) |
29 | 29 | end |
30 | 30 | |
31 | 31 | should 'not display published-at for non-blog and non-forum posts' do |
32 | - article = create(TextileArticle, :name => 'article for test', :profile => profile) | |
32 | + article = create(TextArticle, :name => 'article for test', :profile => profile) | |
33 | 33 | result = article_title(article) |
34 | 34 | assert_no_match /<span class="date">#{show_date(article.published_at)}<\/span><span class="author">, by .*#{profile.identifier}/, result |
35 | 35 | end |
36 | 36 | |
37 | 37 | should 'create link on title of blog posts' do |
38 | 38 | blog = fast_create(Blog, :name => 'Blog test', :profile_id => profile.id) |
39 | - post = fast_create(TextileArticle, :name => 'post test', :profile_id => profile.id, :parent_id => blog.id) | |
39 | + post = fast_create(TextArticle, :name => 'post test', :profile_id => profile.id, :parent_id => blog.id) | |
40 | 40 | assert post.belongs_to_blog? |
41 | 41 | result = article_title(post) |
42 | 42 | assert_tag_in_string result, :tag => 'h1', :child => {:tag => 'a', :content => 'post test', :attributes => { :href => /my-article-\d+/ }} |
... | ... | @@ -44,33 +44,33 @@ class ContentViewerHelperTest < ActionView::TestCase |
44 | 44 | |
45 | 45 | should 'not create link on title if pass no_link option' do |
46 | 46 | blog = fast_create(Blog, :name => 'Blog test', :profile_id => profile.id) |
47 | - post = fast_create(TextileArticle, :name => 'post test', :profile_id => profile.id, :parent_id => blog.id) | |
47 | + post = fast_create(TextArticle, :name => 'post test', :profile_id => profile.id, :parent_id => blog.id) | |
48 | 48 | result = article_title(post, :no_link => :true) |
49 | 49 | assert_no_match /a href='#{url_for(post.url)}'>#{post.name}</, result |
50 | 50 | end |
51 | 51 | |
52 | 52 | should 'not create link on title if non-blog post' do |
53 | - article = fast_create(TextileArticle, :name => 'art test', :profile_id => profile.id) | |
53 | + article = fast_create(TextArticle, :name => 'art test', :profile_id => profile.id) | |
54 | 54 | result = article_title(article) |
55 | 55 | assert_no_match /a href='#{url_for(article.url)}'>#{article.name}</, result |
56 | 56 | end |
57 | 57 | |
58 | 58 | should 'not create link to comments if called with no_comments' do |
59 | 59 | blog = fast_create(Blog, :name => 'Blog test', :profile_id => profile.id) |
60 | - article = fast_create(TextileArticle, :name => 'art test', :profile_id => profile.id, :parent_id => blog.id) | |
60 | + article = fast_create(TextArticle, :name => 'art test', :profile_id => profile.id, :parent_id => blog.id) | |
61 | 61 | result = article_title(article, :no_comments => true) |
62 | 62 | assert_no_match(/a href='.*comments_list.*>No comments yet</, result) |
63 | 63 | end |
64 | 64 | |
65 | 65 | should 'not create link to comments if the article doesn\'t allow comments' do |
66 | 66 | blog = fast_create(Blog, :name => 'Blog test', :profile_id => profile.id) |
67 | - article = fast_create(TextileArticle, :name => 'art test', :profile_id => profile.id, :parent_id => blog.id, :accept_comments => false) | |
67 | + article = fast_create(TextArticle, :name => 'art test', :profile_id => profile.id, :parent_id => blog.id, :accept_comments => false) | |
68 | 68 | result = article_title(article) |
69 | 69 | assert_no_match(/a href='.*comments_list.*>No comments yet</, result) |
70 | 70 | end |
71 | 71 | |
72 | 72 | should 'count total of comments from post' do |
73 | - article = fast_create(TextileArticle, :profile_id => profile.id) | |
73 | + article = fast_create(TextArticle, :profile_id => profile.id) | |
74 | 74 | create(Comment, :article => article, :author => profile, :title => 'test', :body => 'test') |
75 | 75 | article.reload |
76 | 76 | result = link_to_comments(article) |
... | ... | @@ -78,7 +78,7 @@ class ContentViewerHelperTest < ActionView::TestCase |
78 | 78 | end |
79 | 79 | |
80 | 80 | should 'not display total of comments if the article doesn\'t allow comments' do |
81 | - article = build(TextileArticle, :name => 'first post for test', :body => 'first post for test', :profile => profile, :accept_comments => false) | |
81 | + article = build(TextArticle, :name => 'first post for test', :body => 'first post for test', :profile => profile, :accept_comments => false) | |
82 | 82 | article.stubs(:url).returns({}) |
83 | 83 | article.stubs(:comments).returns([build(Comment, :author => profile, :title => 'test', :body => 'test')]) |
84 | 84 | result = link_to_comments(article) |
... | ... | @@ -86,7 +86,7 @@ class ContentViewerHelperTest < ActionView::TestCase |
86 | 86 | end |
87 | 87 | |
88 | 88 | should 'not crash if spam_comments_count is nil' do |
89 | - article = TextileArticle.new(:name => 'post for test', :body => 'post for test', :profile => profile) | |
89 | + article = TextArticle.new(:name => 'post for test', :body => 'post for test', :profile => profile) | |
90 | 90 | article.stubs(:comments_count).returns(10) |
91 | 91 | article.stubs(:spam_comments_count).returns(nil) |
92 | 92 | result = number_of_comments(article) |
... | ... | @@ -116,7 +116,7 @@ class ContentViewerHelperTest < ActionView::TestCase |
116 | 116 | |
117 | 117 | should 'show date with mm/dd/yyyy' do |
118 | 118 | Environment.any_instance.stubs(:date_format).returns('numbers_with_year') |
119 | - article = TextileArticle.new(:name => 'post for test', :body => 'post for test', :profile => profile) | |
119 | + article = TextArticle.new(:name => 'post for test', :body => 'post for test', :profile => profile) | |
120 | 120 | article.published_at = Time.zone.local(2007, 2, 1, 15, 30, 45) |
121 | 121 | article.save! |
122 | 122 | result = show_with_right_format_date article |
... | ... | @@ -125,7 +125,7 @@ class ContentViewerHelperTest < ActionView::TestCase |
125 | 125 | |
126 | 126 | should 'show date with mm/dd' do |
127 | 127 | Environment.any_instance.stubs(:date_format).returns('numbers') |
128 | - article = TextileArticle.new(:name => 'post for test', :body => 'post for test', :profile => profile) | |
128 | + article = TextArticle.new(:name => 'post for test', :body => 'post for test', :profile => profile) | |
129 | 129 | article.published_at = Time.zone.local(2007, 2, 1, 15, 30, 45) |
130 | 130 | article.save! |
131 | 131 | result = show_with_right_format_date article |
... | ... | @@ -134,7 +134,7 @@ class ContentViewerHelperTest < ActionView::TestCase |
134 | 134 | |
135 | 135 | should 'show date with month name' do |
136 | 136 | Environment.any_instance.stubs(:date_format).returns('month_name') |
137 | - article = TextileArticle.new(:name => 'post for test', :body => 'post for test', :profile => profile) | |
137 | + article = TextArticle.new(:name => 'post for test', :body => 'post for test', :profile => profile) | |
138 | 138 | article.published_at = Time.zone.local(2007, 2, 1, 15, 30, 45) |
139 | 139 | article.save! |
140 | 140 | result = show_with_right_format_date article |
... | ... | @@ -143,7 +143,7 @@ class ContentViewerHelperTest < ActionView::TestCase |
143 | 143 | |
144 | 144 | should 'show date with month name and year' do |
145 | 145 | Environment.any_instance.stubs(:date_format).returns('month_name_with_year') |
146 | - article = TextileArticle.new(:name => 'post for test', :body => 'post for test', :profile => profile) | |
146 | + article = TextArticle.new(:name => 'post for test', :body => 'post for test', :profile => profile) | |
147 | 147 | article.published_at = Time.zone.local(2007, 2, 1, 15, 30, 45) |
148 | 148 | article.save! |
149 | 149 | result = show_with_right_format_date article | ... | ... |
test/unit/enterprise_test.rb
... | ... | @@ -414,7 +414,7 @@ class EnterpriseTest < ActiveSupport::TestCase |
414 | 414 | enterprise = fast_create(Enterprise) |
415 | 415 | |
416 | 416 | User.current = person.user |
417 | - article = create(TinyMceArticle, :profile => enterprise, :name => 'An article about free software') | |
417 | + article = create(TextArticle, :profile => enterprise, :name => 'An article about free software') | |
418 | 418 | |
419 | 419 | assert_equal [article.activity], enterprise.activities.map(&:activity) |
420 | 420 | end |
... | ... | @@ -425,7 +425,7 @@ class EnterpriseTest < ActiveSupport::TestCase |
425 | 425 | enterprise2 = fast_create(Enterprise) |
426 | 426 | |
427 | 427 | User.current = person.user |
428 | - article = create(TinyMceArticle, :profile => enterprise2, :name => 'Another article about free software') | |
428 | + article = create(TextArticle, :profile => enterprise2, :name => 'Another article about free software') | |
429 | 429 | |
430 | 430 | assert_not_includes enterprise.activities.map(&:activity), article.activity |
431 | 431 | end | ... | ... |
test/unit/event_test.rb
... | ... | @@ -285,10 +285,6 @@ class EventTest < ActiveSupport::TestCase |
285 | 285 | assert_kind_of TranslatableContent, Event.new |
286 | 286 | end |
287 | 287 | |
288 | - should 'tiny mce editor is enabled' do | |
289 | - assert Event.new.tiny_mce? | |
290 | - end | |
291 | - | |
292 | 288 | should 'be notifiable' do |
293 | 289 | assert Event.new.notifiable? |
294 | 290 | end | ... | ... |
test/unit/folder_test.rb
... | ... | @@ -63,9 +63,9 @@ class FolderTest < ActiveSupport::TestCase |
63 | 63 | folder = fast_create(Folder, :profile_id => c.id) |
64 | 64 | f = fast_create(Folder, :name => 'folder', :profile_id => c.id, :parent_id => folder.id) |
65 | 65 | u = create(UploadedFile, :profile => c, :uploaded_data => fixture_file_upload('/files/rails.png', 'image/png'), :parent => folder) |
66 | - older_t = fast_create(TinyMceArticle, :name => 'old news', :profile_id => c.id, :parent_id => folder.id) | |
67 | - t = fast_create(TinyMceArticle, :name => 'news', :profile_id => c.id, :parent_id => folder.id) | |
68 | - t_in_f = fast_create(TinyMceArticle, :name => 'news', :profile_id => c.id, :parent_id => f.id) | |
66 | + older_t = fast_create(TextArticle, :name => 'old news', :profile_id => c.id, :parent_id => folder.id) | |
67 | + t = fast_create(TextArticle, :name => 'news', :profile_id => c.id, :parent_id => folder.id) | |
68 | + t_in_f = fast_create(TextArticle, :name => 'news', :profile_id => c.id, :parent_id => f.id) | |
69 | 69 | |
70 | 70 | assert_equal [t], folder.news(1) |
71 | 71 | end |
... | ... | @@ -73,8 +73,8 @@ class FolderTest < ActiveSupport::TestCase |
73 | 73 | should 'not return highlighted news when not asked' do |
74 | 74 | c = fast_create(Community) |
75 | 75 | folder = fast_create(Folder, :profile_id => c.id) |
76 | - highlighted_t = fast_create(TinyMceArticle, :name => 'high news', :profile_id => c.id, :highlighted => true, :parent_id => folder.id) | |
77 | - t = fast_create(TinyMceArticle, :name => 'news', :profile_id => c.id, :parent_id => folder.id) | |
76 | + highlighted_t = fast_create(TextArticle, :name => 'high news', :profile_id => c.id, :highlighted => true, :parent_id => folder.id) | |
77 | + t = fast_create(TextArticle, :name => 'news', :profile_id => c.id, :parent_id => folder.id) | |
78 | 78 | |
79 | 79 | assert_equal [t].map(&:slug), folder.news(2).map(&:slug) |
80 | 80 | end |
... | ... | @@ -82,8 +82,8 @@ class FolderTest < ActiveSupport::TestCase |
82 | 82 | should 'return highlighted news when asked' do |
83 | 83 | c = fast_create(Community) |
84 | 84 | folder = fast_create(Folder, :profile_id => c.id) |
85 | - highlighted_t = fast_create(TinyMceArticle, :name => 'high news', :profile_id => c.id, :highlighted => true, :parent_id => folder.id) | |
86 | - t = fast_create(TinyMceArticle, :name => 'news', :profile_id => c.id, :parent_id => folder.id) | |
85 | + highlighted_t = fast_create(TextArticle, :name => 'high news', :profile_id => c.id, :highlighted => true, :parent_id => folder.id) | |
86 | + t = fast_create(TextArticle, :name => 'news', :profile_id => c.id, :parent_id => folder.id) | |
87 | 87 | |
88 | 88 | assert_equal [highlighted_t].map(&:slug), folder.news(2, true).map(&:slug) |
89 | 89 | end | ... | ... |
test/unit/forum_helper_test.rb
... | ... | @@ -30,16 +30,16 @@ class ForumHelperTest < ActionView::TestCase |
30 | 30 | end |
31 | 31 | |
32 | 32 | should 'list posts with different classes' do |
33 | - forum.children << older_post = create(TextileArticle, :name => 'First post', :profile => profile, :parent => forum, :published => false, :author => profile) | |
33 | + forum.children << older_post = create(TextArticle, :name => 'First post', :profile => profile, :parent => forum, :published => false, :author => profile) | |
34 | 34 | one_month_later = Time.now + 1.month |
35 | 35 | Time.stubs(:now).returns(one_month_later) |
36 | - forum.children << newer_post = create(TextileArticle, :name => 'Second post', :profile => profile, :parent => forum, :published => true, :author => profile) | |
36 | + forum.children << newer_post = create(TextArticle, :name => 'Second post', :profile => profile, :parent => forum, :published => true, :author => profile) | |
37 | 37 | assert_match /forum-post position-1 first odd-post.*forum-post position-2 last not-published even-post/, list_forum_posts(forum.posts) |
38 | 38 | end |
39 | 39 | |
40 | 40 | should 'return post update if it has no comments' do |
41 | 41 | author = create_user('forum test author').person |
42 | - some_post = create(TextileArticle, :name => 'First post', :profile => profile, :parent => forum, :published => true, :author => author) | |
42 | + some_post = create(TextArticle, :name => 'First post', :profile => profile, :parent => forum, :published => true, :author => author) | |
43 | 43 | assert some_post.comments.empty? |
44 | 44 | out = last_topic_update(some_post) |
45 | 45 | assert_match time_ago_in_words(some_post.updated_at), out |
... | ... | @@ -47,7 +47,7 @@ class ForumHelperTest < ActionView::TestCase |
47 | 47 | end |
48 | 48 | |
49 | 49 | should 'return last comment date if it has comments' do |
50 | - some_post = create(TextileArticle, :name => 'First post', :profile => profile, :parent => forum, :published => true) | |
50 | + some_post = create(TextArticle, :name => 'First post', :profile => profile, :parent => forum, :published => true) | |
51 | 51 | a1, a2 = create_user('a1').person, create_user('a2').person |
52 | 52 | some_post.comments << build(Comment, :title => 'test', :body => 'test', :author => a1, :created_at => Time.now - 1.day) |
53 | 53 | some_post.comments << build(Comment, :title => 'test', :body => 'test', :author => a2, :created_at => Time.now) |
... | ... | @@ -62,7 +62,7 @@ class ForumHelperTest < ActionView::TestCase |
62 | 62 | end |
63 | 63 | |
64 | 64 | should "return last comment author's name from unauthenticated user" do |
65 | - some_post = create(TextileArticle, :name => 'First post', :profile => profile, :parent => forum, :published => true) | |
65 | + some_post = create(TextArticle, :name => 'First post', :profile => profile, :parent => forum, :published => true) | |
66 | 66 | some_post.comments << build(Comment, :name => 'John', :email => 'lenon@example.com', :title => 'test', :body => 'test') |
67 | 67 | c = Comment.last |
68 | 68 | out = last_topic_update(some_post) | ... | ... |
test/unit/forum_test.rb
... | ... | @@ -61,7 +61,7 @@ class ForumTest < ActiveSupport::TestCase |
61 | 61 | should 'has posts' do |
62 | 62 | p = create_user('testuser').person |
63 | 63 | p.articles << forum = build(Forum, :profile => p, :name => 'Forum test', :body => 'Forum test') |
64 | - post = fast_create(TextileArticle, :name => 'First post', :profile_id => p.id, :parent_id => forum.id) | |
64 | + post = fast_create(TextArticle, :name => 'First post', :profile_id => p.id, :parent_id => forum.id) | |
65 | 65 | forum.children << post |
66 | 66 | assert_includes forum.posts, post |
67 | 67 | end |
... | ... | @@ -76,8 +76,8 @@ class ForumTest < ActiveSupport::TestCase |
76 | 76 | should 'list posts ordered by updated at' do |
77 | 77 | p = create_user('testuser').person |
78 | 78 | forum = fast_create(Forum, :profile_id => p.id, :name => 'Forum test') |
79 | - newer = create(TextileArticle, :name => 'Post 2', :parent => forum, :profile => p) | |
80 | - older = create(TextileArticle, :name => 'Post 1', :parent => forum, :profile => p) | |
79 | + newer = create(TextArticle, :name => 'Post 2', :parent => forum, :profile => p) | |
80 | + older = create(TextArticle, :name => 'Post 1', :parent => forum, :profile => p) | |
81 | 81 | older.updated_at = Time.now.in_time_zone - 1.month |
82 | 82 | older.stubs(:record_timestamps).returns(false) |
83 | 83 | older.save! | ... | ... |
test/unit/gallery_test.rb
... | ... | @@ -71,9 +71,9 @@ class GalleryTest < ActiveSupport::TestCase |
71 | 71 | gallery = fast_create(Gallery, :profile_id => c.id) |
72 | 72 | f = fast_create(Gallery, :name => 'gallery', :profile_id => c.id, :parent_id => gallery.id) |
73 | 73 | u = create(UploadedFile, :profile => c, :uploaded_data => fixture_file_upload('/files/rails.png', 'image/png'), :parent => gallery) |
74 | - older_t = fast_create(TinyMceArticle, :name => 'old news', :profile_id => c.id, :parent_id => gallery.id) | |
75 | - t = fast_create(TinyMceArticle, :name => 'news', :profile_id => c.id, :parent_id => gallery.id) | |
76 | - t_in_f = fast_create(TinyMceArticle, :name => 'news', :profile_id => c.id, :parent_id => f.id) | |
74 | + older_t = fast_create(TextArticle, :name => 'old news', :profile_id => c.id, :parent_id => gallery.id) | |
75 | + t = fast_create(TextArticle, :name => 'news', :profile_id => c.id, :parent_id => gallery.id) | |
76 | + t_in_f = fast_create(TextArticle, :name => 'news', :profile_id => c.id, :parent_id => f.id) | |
77 | 77 | |
78 | 78 | assert_equal [t], gallery.news(1) |
79 | 79 | end |
... | ... | @@ -81,8 +81,8 @@ class GalleryTest < ActiveSupport::TestCase |
81 | 81 | should 'not return highlighted news when not asked' do |
82 | 82 | c = fast_create(Community) |
83 | 83 | gallery = fast_create(Gallery, :profile_id => c.id) |
84 | - highlighted_t = fast_create(TinyMceArticle, :name => 'high news', :profile_id => c.id, :highlighted => true, :parent_id => gallery.id) | |
85 | - t = fast_create(TinyMceArticle, :name => 'news', :profile_id => c.id, :parent_id => gallery.id) | |
84 | + highlighted_t = fast_create(TextArticle, :name => 'high news', :profile_id => c.id, :highlighted => true, :parent_id => gallery.id) | |
85 | + t = fast_create(TextArticle, :name => 'news', :profile_id => c.id, :parent_id => gallery.id) | |
86 | 86 | |
87 | 87 | assert_equal [t].map(&:slug), gallery.news(2).map(&:slug) |
88 | 88 | end |
... | ... | @@ -90,8 +90,8 @@ class GalleryTest < ActiveSupport::TestCase |
90 | 90 | should 'return highlighted news when asked' do |
91 | 91 | c = fast_create(Community) |
92 | 92 | gallery = fast_create(Gallery, :profile_id => c.id) |
93 | - highlighted_t = fast_create(TinyMceArticle, :name => 'high news', :profile_id => c.id, :highlighted => true, :parent_id => gallery.id) | |
94 | - t = fast_create(TinyMceArticle, :name => 'news', :profile_id => c.id, :parent_id => gallery.id) | |
93 | + highlighted_t = fast_create(TextArticle, :name => 'high news', :profile_id => c.id, :highlighted => true, :parent_id => gallery.id) | |
94 | + t = fast_create(TextArticle, :name => 'news', :profile_id => c.id, :parent_id => gallery.id) | |
95 | 95 | |
96 | 96 | assert_equal [highlighted_t].map(&:slug), gallery.news(2, true).map(&:slug) |
97 | 97 | end | ... | ... |
test/unit/layout_helper_test.rb
... | ... | @@ -21,8 +21,8 @@ class LayoutHelperTest < ActionView::TestCase |
21 | 21 | @plugins = [] |
22 | 22 | expects(:profile).returns(nil).at_least_once |
23 | 23 | expects(:environment).returns(env).at_least_once |
24 | + expects(:theme_option).with(:jquery_theme).returns(nil) | |
24 | 25 | expects(:theme_option).with(:icon_theme).returns(['my-icons']).at_least_once |
25 | - expects(:jquery_theme).returns('jquery-nice').at_least_once | |
26 | 26 | global_css = Rails.root.join "public/designs/themes/#{env.theme}/global.css" |
27 | 27 | File.stubs(:exists?).returns(false) |
28 | 28 | File.expects(:exists?).with(global_css).returns(true).at_least_once | ... | ... |
test/unit/person_notifier_test.rb
... | ... | @@ -18,7 +18,7 @@ class PersonNotifierTest < ActiveSupport::TestCase |
18 | 18 | @member.save! |
19 | 19 | @community = fast_create(Community) |
20 | 20 | @community.add_member(@admin) |
21 | - @article = fast_create(TextileArticle, :name => 'Article test', :profile_id => @community.id, :notify_comments => false) | |
21 | + @article = fast_create(TextArticle, :name => 'Article test', :profile_id => @community.id, :notify_comments => false) | |
22 | 22 | Delayed::Job.delete_all |
23 | 23 | ActionMailer::Base.deliveries = [] |
24 | 24 | end | ... | ... |
test/unit/person_test.rb
... | ... | @@ -1261,7 +1261,7 @@ class PersonTest < ActiveSupport::TestCase |
1261 | 1261 | User.current = another_person.user |
1262 | 1262 | scrap = create(Scrap, defaults_for_scrap(:sender => another_person, :receiver => person, :content => 'A scrap')) |
1263 | 1263 | User.current = person.user |
1264 | - article = create(TinyMceArticle, :profile => person, :name => 'An article about free software') | |
1264 | + article = create(TextArticle, :profile => person, :name => 'An article about free software') | |
1265 | 1265 | |
1266 | 1266 | assert_equivalent [scrap,article.activity], person.activities.map { |a| a.activity } |
1267 | 1267 | end |
... | ... | @@ -1275,11 +1275,11 @@ class PersonTest < ActiveSupport::TestCase |
1275 | 1275 | another_person_scrap = create(Scrap, defaults_for_scrap(:sender => another_person, :receiver => another_person, :content => 'A scrap from another person')) |
1276 | 1276 | |
1277 | 1277 | User.current = another_person.user |
1278 | - create(TinyMceArticle, :profile => another_person, :name => 'An article about free software from another person') | |
1278 | + create(TextArticle, :profile => another_person, :name => 'An article about free software from another person') | |
1279 | 1279 | another_person_activity = ActionTracker::Record.last |
1280 | 1280 | |
1281 | 1281 | User.current = person.user |
1282 | - create(TinyMceArticle, :profile => person, :name => 'An article about free software') | |
1282 | + create(TextArticle, :profile => person, :name => 'An article about free software') | |
1283 | 1283 | person_activity = ActionTracker::Record.last |
1284 | 1284 | |
1285 | 1285 | assert_equivalent [person_scrap,person_activity], person.activities.map { |a| a.activity } |
... | ... | @@ -2006,4 +2006,37 @@ class PersonTest < ActiveSupport::TestCase |
2006 | 2006 | assert_equivalent [circle2], ProfileFollower.with_profile(community).with_follower(person).map(&:circle) |
2007 | 2007 | end |
2008 | 2008 | |
2009 | + should 'list available editors for a regular person' do | |
2010 | + person = Person.new | |
2011 | + person.expects(:is_admin?).returns(false) | |
2012 | + assert_equivalent [Article::Editor::TINY_MCE, Article::Editor::TEXTILE], person.available_editors.keys | |
2013 | + end | |
2014 | + | |
2015 | + should 'list available editors for an admin' do | |
2016 | + person = Person.new | |
2017 | + person.expects(:is_admin?).returns(true) | |
2018 | + assert_equivalent [Article::Editor::TINY_MCE, Article::Editor::TEXTILE, Article::Editor::RAW_HTML], person.available_editors.keys | |
2019 | + end | |
2020 | + | |
2021 | + should 'not save a person with an inexistent editor' do | |
2022 | + person = create_user('testuser').person | |
2023 | + person.editor = "bli" | |
2024 | + assert !person.save | |
2025 | + assert person.errors['editor'].present? | |
2026 | + end | |
2027 | + | |
2028 | + should 'not allow a regular person to change to raw_html editor' do | |
2029 | + person = create_user('testuser').person | |
2030 | + person.editor = Article::Editor::RAW_HTML | |
2031 | + assert !person.save | |
2032 | + assert person.errors['editor'].present? | |
2033 | + end | |
2034 | + | |
2035 | + should 'allow admin to change to raw_html editor' do | |
2036 | + person = create_user('testuser').person | |
2037 | + person.environment.add_admin(person) | |
2038 | + person.editor = Article::Editor::RAW_HTML | |
2039 | + assert person.save | |
2040 | + end | |
2041 | + | |
2009 | 2042 | end | ... | ... |
test/unit/profile_test.rb
... | ... | @@ -2113,7 +2113,7 @@ class ProfileTest < ActiveSupport::TestCase |
2113 | 2113 | |
2114 | 2114 | should 'not copy template welcome_page' do |
2115 | 2115 | template = fast_create(Person, :is_template => true) |
2116 | - welcome_page = fast_create(TinyMceArticle, :slug => 'welcome-page', :profile_id => template.id) | |
2116 | + welcome_page = fast_create(TextArticle, :slug => 'welcome-page', :profile_id => template.id) | |
2117 | 2117 | refute template.copy_article?(welcome_page) |
2118 | 2118 | end |
2119 | 2119 | |
... | ... | @@ -2124,7 +2124,7 @@ class ProfileTest < ActiveSupport::TestCase |
2124 | 2124 | |
2125 | 2125 | should 'return nil on welcome_page_content if content is not published' do |
2126 | 2126 | template = fast_create(Profile, :is_template => true) |
2127 | - welcome_page = fast_create(TinyMceArticle, :slug => 'welcome-page', :profile_id => template.id, :body => 'Template welcome page', :published => false) | |
2127 | + welcome_page = fast_create(TextArticle, :slug => 'welcome-page', :profile_id => template.id, :body => 'Template welcome page', :published => false) | |
2128 | 2128 | template.welcome_page = welcome_page |
2129 | 2129 | template.save! |
2130 | 2130 | assert_nil template.welcome_page_content |
... | ... | @@ -2133,7 +2133,7 @@ class ProfileTest < ActiveSupport::TestCase |
2133 | 2133 | should 'return template welcome page content on welcome_page_content if content is published' do |
2134 | 2134 | template = fast_create(Profile, :is_template => true) |
2135 | 2135 | body = 'Template welcome page' |
2136 | - welcome_page = fast_create(TinyMceArticle, :slug => 'welcome-page', :profile_id => template.id, :body => body, :published => true) | |
2136 | + welcome_page = fast_create(TextArticle, :slug => 'welcome-page', :profile_id => template.id, :body => body, :published => true) | |
2137 | 2137 | template.welcome_page = welcome_page |
2138 | 2138 | template.save! |
2139 | 2139 | assert_equal body, template.welcome_page_content | ... | ... |
test/unit/raw_html_article_test.rb
... | ... | @@ -7,7 +7,8 @@ class RawHTMLArticleTest < ActiveSupport::TestCase |
7 | 7 | end |
8 | 8 | |
9 | 9 | should 'not filter HTML' do |
10 | - article = RawHTMLArticle.create!( | |
10 | + article = TextArticle.create!( | |
11 | + :editor => Article::Editor::RAW_HTML, | |
11 | 12 | :name => 'Raw HTML', |
12 | 13 | :body => '<strong>HTML!</strong><form action="#"></form>', |
13 | 14 | :profile => @profile | ... | ... |
test/unit/rss_feed_test.rb
... | ... | @@ -204,7 +204,7 @@ class RssFeedTest < ActiveSupport::TestCase |
204 | 204 | end |
205 | 205 | |
206 | 206 | should 'display the referenced body of a article published' do |
207 | - article = fast_create(TextileArticle, :body => 'This is the content of the Sample Article.', :profile_id => fast_create(Person).id) | |
207 | + article = fast_create(TextArticle, :body => 'This is the content of the Sample Article.', :profile_id => fast_create(Person).id) | |
208 | 208 | profile = fast_create(Profile) |
209 | 209 | blog = fast_create(Blog, :profile_id => profile.id) |
210 | 210 | a = create(ApproveArticle, :name => 'test name', :article => article, :target => profile, :requestor => fast_create(Person)) | ... | ... |
test/unit/suggest_article_test.rb
... | ... | @@ -54,9 +54,9 @@ class SuggestArticleTest < ActiveSupport::TestCase |
54 | 54 | abstract = 'some abstract' |
55 | 55 | t.article = {:name => name, :body => body, :abstract => abstract} |
56 | 56 | t.target = @profile |
57 | - count = TinyMceArticle.count | |
57 | + count = TextArticle.count | |
58 | 58 | t.perform |
59 | - assert_equal count + 1, TinyMceArticle.count | |
59 | + assert_equal count + 1, TextArticle.count | |
60 | 60 | end |
61 | 61 | |
62 | 62 | should 'fill source name and URL into created article' do |
... | ... | @@ -64,7 +64,7 @@ class SuggestArticleTest < ActiveSupport::TestCase |
64 | 64 | t.article.merge!({:source_name => 'GNU project', :source => 'http://www.gnu.org/'}) |
65 | 65 | t.perform |
66 | 66 | |
67 | - article = TinyMceArticle.last | |
67 | + article = TextArticle.last | |
68 | 68 | assert_equal 'GNU project', article.source_name |
69 | 69 | assert_equal 'http://www.gnu.org/', article.source |
70 | 70 | end |
... | ... | @@ -81,7 +81,7 @@ class SuggestArticleTest < ActiveSupport::TestCase |
81 | 81 | t.article[:highlighted] = true |
82 | 82 | t.perform |
83 | 83 | |
84 | - article = TinyMceArticle.where(name: t.article_name).last # just to be sure | |
84 | + article = TextArticle.where(name: t.article_name).last # just to be sure | |
85 | 85 | assert article.highlighted |
86 | 86 | end |
87 | 87 | |
... | ... | @@ -89,7 +89,7 @@ class SuggestArticleTest < ActiveSupport::TestCase |
89 | 89 | t = build(SuggestArticle, :target => @profile) |
90 | 90 | t.perform |
91 | 91 | |
92 | - article = TinyMceArticle.where(name: t.article_name).last | |
92 | + article = TextArticle.where(name: t.article_name).last | |
93 | 93 | assert_equal false, article.highlighted |
94 | 94 | end |
95 | 95 | |
... | ... | @@ -110,7 +110,7 @@ class SuggestArticleTest < ActiveSupport::TestCase |
110 | 110 | t.name = 'some name' |
111 | 111 | t.perform |
112 | 112 | |
113 | - article = TinyMceArticle.last | |
113 | + article = TextArticle.last | |
114 | 114 | assert_equal 'some name', article.author_name |
115 | 115 | end |
116 | 116 | |
... | ... | @@ -239,12 +239,12 @@ class SuggestArticleTest < ActiveSupport::TestCase |
239 | 239 | should 'fallback to tinymce when type parameter is invalid' do |
240 | 240 | t = SuggestArticle.new |
241 | 241 | t.article = {:name => 'name', :body => 'body', :type => 'Comment'} |
242 | - t.article_type == TinyMceArticle | |
242 | + t.article_type == TextArticle | |
243 | 243 | end |
244 | 244 | |
245 | 245 | should 'fallback to tinymce when type parameter is blank' do |
246 | 246 | t = SuggestArticle.new |
247 | 247 | t.article = {:name => 'name', :body => 'body', :type => ''} |
248 | - t.article_type == TinyMceArticle | |
248 | + t.article_type == TextArticle | |
249 | 249 | end |
250 | 250 | end | ... | ... |
test/unit/text_article_test.rb
... | ... | @@ -8,12 +8,6 @@ class TextArticleTest < ActiveSupport::TestCase |
8 | 8 | assert_kind_of Article, TextArticle.new |
9 | 9 | end |
10 | 10 | |
11 | - should 'found TextileArticle by TextArticle class' do | |
12 | - person = create_user('testuser').person | |
13 | - article = fast_create(TextileArticle, :name => 'textile article test', :profile_id => person.id) | |
14 | - assert_includes TextArticle.all, article | |
15 | - end | |
16 | - | |
17 | 11 | should 'be translatable' do |
18 | 12 | assert_kind_of TranslatableContent, TextArticle.new |
19 | 13 | end |
... | ... | @@ -119,4 +113,22 @@ class TextArticleTest < ActiveSupport::TestCase |
119 | 113 | assert post.display_preview? |
120 | 114 | end |
121 | 115 | |
116 | + should 'provide HTML version for textile editor' do | |
117 | + profile = create_user('testinguser').person | |
118 | + a = fast_create(TextArticle, :body => '*my text*', :profile_id => profile.id, :editor => Article::Editor::TEXTILE) | |
119 | + assert_equal '<p><strong>my text</strong></p>', a.to_html | |
120 | + end | |
121 | + | |
122 | + should 'provide HTML version for body lead textile editor' do | |
123 | + profile = create_user('testinguser').person | |
124 | + a = fast_create(TextArticle, :body => '*my text*', :profile_id => profile.id, :editor => Article::Editor::TEXTILE) | |
125 | + assert_equal '<p><strong>my text</strong></p>', a.lead | |
126 | + end | |
127 | + | |
128 | + should 'provide HTML version for abstract lead textile editor' do | |
129 | + profile = create_user('testinguser').person | |
130 | + a = fast_create(TextArticle, :abstract => '*my text*', :profile_id => profile.id, :editor => Article::Editor::TEXTILE) | |
131 | + assert_equal '<p><strong>my text</strong></p>', a.lead | |
132 | + end | |
133 | + | |
122 | 134 | end | ... | ... |
test/unit/textile_article_test.rb
1 | 1 | require_relative "../test_helper" |
2 | 2 | |
3 | -class TextileArticleTest < ActiveSupport::TestCase | |
3 | +class TextArticleTest < ActiveSupport::TestCase | |
4 | 4 | |
5 | 5 | def setup |
6 | 6 | @user = User.current = create_user 'testing' |
... | ... | @@ -8,20 +8,12 @@ class TextileArticleTest < ActiveSupport::TestCase |
8 | 8 | end |
9 | 9 | attr_reader :profile |
10 | 10 | |
11 | - should 'provide a proper short description' do | |
12 | - assert_kind_of String, TextileArticle.short_description | |
13 | - end | |
14 | - | |
15 | - should 'provide a proper description' do | |
16 | - assert_kind_of String, TextileArticle.description | |
17 | - end | |
18 | - | |
19 | 11 | should 'convert Textile to HTML' do |
20 | - assert_equal '<p><strong>my text</strong></p>', build(TextileArticle, body: '*my text*').to_html | |
12 | + assert_equal '<p><strong>my text</strong></p>', build(TextArticle, body: '*my text*', :editor => Article::Editor::TEXTILE).to_html | |
21 | 13 | end |
22 | 14 | |
23 | 15 | should 'accept empty body' do |
24 | - a = TextileArticle.new | |
16 | + a = TextArticle.new | |
25 | 17 | a.expects(:body).returns(nil) |
26 | 18 | assert_nothing_raised do |
27 | 19 | assert_equal '', a.to_html |
... | ... | @@ -29,27 +21,27 @@ class TextileArticleTest < ActiveSupport::TestCase |
29 | 21 | end |
30 | 22 | |
31 | 23 | should 'notifiable be true' do |
32 | - a = fast_create(TextileArticle) | |
24 | + a = fast_create(TextArticle) | |
33 | 25 | assert a.notifiable? |
34 | 26 | end |
35 | 27 | |
36 | 28 | should 'notify activity on create' do |
37 | 29 | ActionTracker::Record.delete_all |
38 | - create TextileArticle, name: 'test', profile_id: profile.id, published: true | |
30 | + create TextArticle, name: 'test', profile_id: profile.id, published: true | |
39 | 31 | assert_equal 1, ActionTracker::Record.count |
40 | 32 | end |
41 | 33 | |
42 | 34 | should 'not group trackers activity of article\'s creation' do |
43 | 35 | assert_difference 'ActionTracker::Record.count', 3 do |
44 | - create TextileArticle, name: 'bar', profile_id: profile.id, published: true | |
45 | - create TextileArticle, name: 'another bar', profile_id: profile.id, published: true | |
46 | - create TextileArticle, name: 'another bar 2', profile_id: profile.id, published: true | |
36 | + create TextArticle, name: 'bar', profile_id: profile.id, published: true | |
37 | + create TextArticle, name: 'another bar', profile_id: profile.id, published: true | |
38 | + create TextArticle, name: 'another bar 2', profile_id: profile.id, published: true | |
47 | 39 | end |
48 | 40 | end |
49 | 41 | |
50 | 42 | should 'not update activity on update of an article' do |
51 | 43 | ActionTracker::Record.delete_all |
52 | - article = create(TextileArticle, profile_id: profile.id) | |
44 | + article = create(TextArticle, profile_id: profile.id) | |
53 | 45 | time = article.activity.updated_at |
54 | 46 | Time.stubs(:now).returns(time + 1.day) |
55 | 47 | assert_no_difference 'ActionTracker::Record.count' do |
... | ... | @@ -61,8 +53,8 @@ class TextileArticleTest < ActiveSupport::TestCase |
61 | 53 | |
62 | 54 | should 'not create trackers activity when updating articles' do |
63 | 55 | ActionTracker::Record.delete_all |
64 | - a1 = create TextileArticle, name: 'bar', profile_id: profile.id, published: true | |
65 | - a2 = create TextileArticle, name: 'another bar', profile_id: profile.id, published: true | |
56 | + a1 = create TextArticle, name: 'bar', profile_id: profile.id, published: true | |
57 | + a2 = create TextArticle, name: 'another bar', profile_id: profile.id, published: true | |
66 | 58 | assert_no_difference 'ActionTracker::Record.count' do |
67 | 59 | a1.name = 'foo';a1.save! |
68 | 60 | a2.name = 'another foo';a2.save! |
... | ... | @@ -71,7 +63,7 @@ class TextileArticleTest < ActiveSupport::TestCase |
71 | 63 | |
72 | 64 | should 'remove activity after destroying article' do |
73 | 65 | ActionTracker::Record.delete_all |
74 | - a = create TextileArticle, name: 'bar', profile_id: profile.id, published: true | |
66 | + a = create TextArticle, name: 'bar', profile_id: profile.id, published: true | |
75 | 67 | assert_difference 'ActionTracker::Record.count', -1 do |
76 | 68 | a.destroy |
77 | 69 | end |
... | ... | @@ -79,8 +71,8 @@ class TextileArticleTest < ActiveSupport::TestCase |
79 | 71 | |
80 | 72 | should 'remove activity after article is destroyed' do |
81 | 73 | ActionTracker::Record.delete_all |
82 | - a1 = create TextileArticle, name: 'bar', profile_id: profile.id, published: true | |
83 | - a2 = create TextileArticle, name: 'another bar', profile_id: profile.id, published: true | |
74 | + a1 = create TextArticle, name: 'bar', profile_id: profile.id, published: true | |
75 | + a2 = create TextArticle, name: 'another bar', profile_id: profile.id, published: true | |
84 | 76 | assert_equal 2, ActionTracker::Record.count |
85 | 77 | assert_difference 'ActionTracker::Record.count', -2 do |
86 | 78 | a1.destroy |
... | ... | @@ -94,20 +86,20 @@ class TextileArticleTest < ActiveSupport::TestCase |
94 | 86 | p1 = Person.first |
95 | 87 | community.add_member(p1) |
96 | 88 | assert p1.is_member_of?(community) |
97 | - article = create TextileArticle, name: 'test', profile_id: community.id | |
89 | + article = create TextArticle, name: 'test', profile_id: community.id | |
98 | 90 | assert_equal article, ActionTracker::Record.last.target |
99 | 91 | end |
100 | 92 | |
101 | 93 | should "the tracker action target be defined as the article on articles'creation in profile" do |
102 | 94 | ActionTracker::Record.delete_all |
103 | 95 | person = Person.first |
104 | - article = create TextileArticle, name: 'test', profile_id: person.id | |
96 | + article = create TextArticle, name: 'test', profile_id: person.id | |
105 | 97 | assert_equal article, ActionTracker::Record.last.target |
106 | 98 | end |
107 | 99 | |
108 | 100 | should 'not notify activity if the article is not advertise' do |
109 | 101 | ActionTracker::Record.delete_all |
110 | - a = create TextileArticle, name: 'bar', profile_id: profile.id, published: true, advertise: false | |
102 | + a = create TextArticle, name: 'bar', profile_id: profile.id, published: true, advertise: false | |
111 | 103 | assert_equal true, a.published? |
112 | 104 | assert_equal true, a.notifiable? |
113 | 105 | assert_equal false, a.image? |
... | ... | @@ -116,11 +108,11 @@ class TextileArticleTest < ActiveSupport::TestCase |
116 | 108 | end |
117 | 109 | |
118 | 110 | should "have defined the is_trackable method defined" do |
119 | - assert TextileArticle.method_defined?(:is_trackable?) | |
111 | + assert TextArticle.method_defined?(:is_trackable?) | |
120 | 112 | end |
121 | 113 | |
122 | 114 | should "the common trackable conditions return the correct value" do |
123 | - a = build(TextileArticle, profile: profile) | |
115 | + a = build(TextArticle, profile: profile) | |
124 | 116 | a.published = a.advertise = true |
125 | 117 | assert_equal true, a.published? |
126 | 118 | assert_equal true, a.notifiable? |
... | ... | @@ -174,18 +166,18 @@ class TextileArticleTest < ActiveSupport::TestCase |
174 | 166 | end |
175 | 167 | |
176 | 168 | should 'have can_display_media_panel with default true' do |
177 | - a = TextileArticle.new | |
169 | + a = TextArticle.new | |
178 | 170 | assert a.can_display_media_panel? |
179 | 171 | end |
180 | 172 | |
181 | 173 | should 'have can_display_blocks with default false' do |
182 | - assert !TextileArticle.can_display_blocks? | |
174 | + assert !TextArticle.can_display_blocks? | |
183 | 175 | end |
184 | 176 | |
185 | 177 | protected |
186 | 178 | |
187 | 179 | def build_article(input = nil, options = {}) |
188 | - article = build(TextileArticle, {body: input}.merge(options)) | |
180 | + article = build(TextArticle, {body: input, :editor => Article::Editor::TEXTILE}.merge(options)) | |
189 | 181 | article.valid? # trigger the xss terminate thingy |
190 | 182 | article |
191 | 183 | end | ... | ... |
test/unit/tiny_mce_article_test.rb
... | ... | @@ -10,61 +10,48 @@ class TinyMceArticleTest < ActiveSupport::TestCase |
10 | 10 | end |
11 | 11 | attr_reader :profile |
12 | 12 | |
13 | - # this test can be removed when we get real tests for TinyMceArticle | |
14 | - should 'be an article' do | |
15 | - assert_kind_of TextArticle, TinyMceArticle.new | |
16 | - end | |
17 | - | |
18 | - should 'define description' do | |
19 | - assert_kind_of String, TinyMceArticle.description | |
20 | - end | |
21 | - | |
22 | - should 'define short description' do | |
23 | - assert_kind_of String, TinyMceArticle.short_description | |
24 | - end | |
25 | - | |
26 | 13 | should 'not sanitize target attribute' do |
27 | - article = create(TinyMceArticle, :name => 'open link in new window', :body => "open <a href='www.invalid.com' target='_blank'>link</a> in new window", :profile => profile) | |
14 | + article = create(TextArticle, :name => 'open link in new window', :body => "open <a href='www.invalid.com' target='_blank'>link</a> in new window", :profile => profile) | |
28 | 15 | assert_tag_in_string article.body, :tag => 'a', :attributes => {:target => '_blank'} |
29 | 16 | end |
30 | 17 | |
31 | 18 | should 'not translate & to amp; over times' do |
32 | - article = create(TinyMceArticle, :name => 'link', :body => "<a href='www.invalid.com?param1=value¶m2=value'>link</a>", :profile => profile) | |
19 | + article = create(TextArticle, :name => 'link', :body => "<a href='www.invalid.com?param1=value¶m2=value'>link</a>", :profile => profile) | |
33 | 20 | assert article.save |
34 | 21 | assert_no_match(/&amp;/, article.body) |
35 | 22 | assert_match(/&/, article.body) |
36 | 23 | end |
37 | 24 | |
38 | 25 | should 'not escape comments from tiny mce article body' do |
39 | - article = create(TinyMceArticle, :profile => profile, :name => 'article', :abstract => 'abstract', :body => "the <!-- comment --> article ...") | |
26 | + article = create(TextArticle, :profile => profile, :name => 'article', :abstract => 'abstract', :body => "the <!-- comment --> article ...") | |
40 | 27 | assert_equal "the <!-- comment --> article ...", article.body |
41 | 28 | end |
42 | 29 | |
43 | 30 | should 'convert entities characters to UTF-8 instead of ISO-8859-1' do |
44 | - article = create(TinyMceArticle, :profile => profile, :name => 'teste ' + Time.now.to_s, :body => '<a title="informática">link</a>') | |
31 | + article = create(TextArticle, :profile => profile, :name => 'teste ' + Time.now.to_s, :body => '<a title="informática">link</a>') | |
45 | 32 | assert(article.body.is_utf8?, "%s expected to be valid UTF-8 content" % article.body.inspect) |
46 | 33 | end |
47 | 34 | |
48 | 35 | should 'remove iframe if it is not from a trusted site' do |
49 | - article = create(TinyMceArticle, :profile => profile, :name => 'article', :abstract => 'abstract', :body => "<iframe src='http://anything/videos.ogg'></iframe>") | |
36 | + article = create(TextArticle, :profile => profile, :name => 'article', :abstract => 'abstract', :body => "<iframe src='http://anything/videos.ogg'></iframe>") | |
50 | 37 | assert_equal "", article.body |
51 | 38 | end |
52 | 39 | |
53 | 40 | should 'not mess with <iframe and </iframe if it is from itheora by default' do |
54 | 41 | assert_includes Environment.default.trusted_sites_for_iframe, 'itheora.org' |
55 | - article = create(TinyMceArticle, :profile => profile, :name => 'article', :abstract => 'abstract', :body => "<iframe src='http://itheora.org/demo/index.php?v=example.ogv'></iframe>") | |
42 | + article = create(TextArticle, :profile => profile, :name => 'article', :abstract => 'abstract', :body => "<iframe src='http://itheora.org/demo/index.php?v=example.ogv'></iframe>") | |
56 | 43 | assert_tag_in_string article.body, :tag => 'iframe', :attributes => { :src => "http://itheora.org/demo/index.php?v=example.ogv"} |
57 | 44 | end |
58 | 45 | |
59 | 46 | should 'allow iframe if it is from stream.softwarelivre.org by default' do |
60 | 47 | assert_includes Environment.default.trusted_sites_for_iframe, 'stream.softwarelivre.org' |
61 | - article = create(TinyMceArticle, :profile => profile, :name => 'article', :abstract => 'abstract', :body => "<iframe src='http://stream.softwarelivre.org/fisl10/sites/default/files/videos.ogg'></iframe>") | |
48 | + article = create(TextArticle, :profile => profile, :name => 'article', :abstract => 'abstract', :body => "<iframe src='http://stream.softwarelivre.org/fisl10/sites/default/files/videos.ogg'></iframe>") | |
62 | 49 | assert_tag_in_string article.body, :tag => 'iframe', :attributes => { :src => "http://stream.softwarelivre.org/fisl10/sites/default/files/videos.ogg"} |
63 | 50 | end |
64 | 51 | |
65 | 52 | should 'allow iframe if it is from tv.softwarelivre.org by default' do |
66 | 53 | assert_includes Environment.default.trusted_sites_for_iframe, 'tv.softwarelivre.org' |
67 | - article = create(TinyMceArticle, :profile => profile, :name => 'article', :abstract => 'abstract', :body => "<iframe id='player-base' src='http://tv.softwarelivre.org/embed/1170' width='482' height='406' align='right' frameborder='0' scrolling='no'></iframe>") | |
54 | + article = create(TextArticle, :profile => profile, :name => 'article', :abstract => 'abstract', :body => "<iframe id='player-base' src='http://tv.softwarelivre.org/embed/1170' width='482' height='406' align='right' frameborder='0' scrolling='no'></iframe>") | |
68 | 55 | assert_tag_in_string article.body, :tag => 'iframe', :attributes => { :src => "http://tv.softwarelivre.org/embed/1170", :width => "482", :height => "406", :align => "right", :frameborder => "0", :scrolling => "no"} |
69 | 56 | end |
70 | 57 | |
... | ... | @@ -73,12 +60,12 @@ class TinyMceArticleTest < ActiveSupport::TestCase |
73 | 60 | env.trusted_sites_for_iframe = ['avideosite.com'] |
74 | 61 | env.save |
75 | 62 | assert_includes Environment.default.trusted_sites_for_iframe, 'avideosite.com' |
76 | - article = create(TinyMceArticle, :profile => profile, :name => 'article', :abstract => 'abstract', :body => "<iframe src='http://avideosite.com/videos.ogg'></iframe>") | |
63 | + article = create(TextArticle, :profile => profile, :name => 'article', :abstract => 'abstract', :body => "<iframe src='http://avideosite.com/videos.ogg'></iframe>") | |
77 | 64 | assert_tag_in_string article.body, :tag => 'iframe', :attributes => { :src => "http://avideosite.com/videos.ogg"} |
78 | 65 | end |
79 | 66 | |
80 | 67 | should 'remove only the iframe from untrusted site' do |
81 | - article = create(TinyMceArticle, :profile => profile, :name => 'article', :abstract => 'abstract', :body => "<iframe src='http://stream.softwarelivre.org/videos.ogg'></iframe><iframe src='http://untrusted_site.com/videos.ogg'></iframe>") | |
68 | + article = create(TextArticle, :profile => profile, :name => 'article', :abstract => 'abstract', :body => "<iframe src='http://stream.softwarelivre.org/videos.ogg'></iframe><iframe src='http://untrusted_site.com/videos.ogg'></iframe>") | |
82 | 69 | assert_tag_in_string article.body, :tag => 'iframe', :attributes => { :src => "http://stream.softwarelivre.org/videos.ogg"} |
83 | 70 | assert_no_tag_in_string article.body, :tag => 'iframe', :attributes => { :src => "http://untrusted_site.com/videos.ogg"} |
84 | 71 | end |
... | ... | @@ -86,12 +73,12 @@ class TinyMceArticleTest < ActiveSupport::TestCase |
86 | 73 | should 'consider first src if there is 2 or more src' do |
87 | 74 | assert_includes Environment.default.trusted_sites_for_iframe, 'itheora.org' |
88 | 75 | |
89 | - article = create(TinyMceArticle, :profile => profile, :name => 'article', :abstract => 'abstract', :body => "<iframe src='http://itheora.org/videos.ogg' src='http://untrusted_site.com/videos.ogg'></iframe>") | |
76 | + article = create(TextArticle, :profile => profile, :name => 'article', :abstract => 'abstract', :body => "<iframe src='http://itheora.org/videos.ogg' src='http://untrusted_site.com/videos.ogg'></iframe>") | |
90 | 77 | assert_tag_in_string article.body, :tag => 'iframe', :attributes => { :src => "http://itheora.org/videos.ogg"} |
91 | 78 | end |
92 | 79 | |
93 | 80 | should 'not sanitize html comments' do |
94 | - article = TinyMceArticle.new | |
81 | + article = TextArticle.new | |
95 | 82 | article.body = '<!-- <asdf> << aasdfa >>> --> <h1> Wellformed html code </h1>' |
96 | 83 | article.valid? |
97 | 84 | |
... | ... | @@ -99,38 +86,38 @@ class TinyMceArticleTest < ActiveSupport::TestCase |
99 | 86 | end |
100 | 87 | |
101 | 88 | should 'not allow XSS on name' do |
102 | - article = create(TinyMceArticle, :name => 'title with <script>alert("xss")</script>', :profile => profile) | |
89 | + article = create(TextArticle, :name => 'title with <script>alert("xss")</script>', :profile => profile) | |
103 | 90 | assert_no_match /script/, article.name |
104 | 91 | end |
105 | 92 | |
106 | 93 | should 'not allow XSS on abstract' do |
107 | - article = create(TinyMceArticle, :name => "test 123", :abstract => 'abstract with <script>alert("xss")</script>', :profile => profile) | |
94 | + article = create(TextArticle, :name => "test 123", :abstract => 'abstract with <script>alert("xss")</script>', :profile => profile) | |
108 | 95 | assert_no_match /script/, article.abstract |
109 | 96 | end |
110 | 97 | |
111 | 98 | should 'notifiable be true' do |
112 | - a = fast_create(TinyMceArticle) | |
99 | + a = fast_create(TextArticle) | |
113 | 100 | assert a.notifiable? |
114 | 101 | end |
115 | 102 | |
116 | 103 | should 'notify activity on create' do |
117 | 104 | ActionTracker::Record.delete_all |
118 | - create TinyMceArticle, name: 'test', profile_id: profile.id, published: true | |
105 | + create TextArticle, name: 'test', profile_id: profile.id, published: true | |
119 | 106 | assert_equal 1, ActionTracker::Record.count |
120 | 107 | end |
121 | 108 | |
122 | 109 | should 'not group trackers activity of article\'s creation' do |
123 | 110 | ActionTracker::Record.delete_all |
124 | - create TinyMceArticle, name: 'bar', profile_id: profile.id, published: true | |
125 | - create TinyMceArticle, name: 'another bar', profile_id: profile.id, published: true | |
111 | + create TextArticle, name: 'bar', profile_id: profile.id, published: true | |
112 | + create TextArticle, name: 'another bar', profile_id: profile.id, published: true | |
126 | 113 | assert_equal 2, ActionTracker::Record.count |
127 | - create TinyMceArticle, name: 'another bar 2', profile_id: profile.id, published: true | |
114 | + create TextArticle, name: 'another bar 2', profile_id: profile.id, published: true | |
128 | 115 | assert_equal 3, ActionTracker::Record.count |
129 | 116 | end |
130 | 117 | |
131 | 118 | should 'not update activity on update of an article' do |
132 | 119 | ActionTracker::Record.delete_all |
133 | - article = create TinyMceArticle, profile_id: profile.id | |
120 | + article = create TextArticle, profile_id: profile.id | |
134 | 121 | time = article.activity.updated_at |
135 | 122 | Time.stubs(:now).returns(time + 1.day) |
136 | 123 | assert_no_difference 'ActionTracker::Record.count' do |
... | ... | @@ -142,8 +129,8 @@ class TinyMceArticleTest < ActiveSupport::TestCase |
142 | 129 | |
143 | 130 | should 'not create trackers activity when updating articles' do |
144 | 131 | ActionTracker::Record.delete_all |
145 | - a1 = create TinyMceArticle, name: 'bar', profile_id: profile.id, published: true | |
146 | - a2 = create TinyMceArticle, name: 'another bar', profile_id: profile.id, published: true | |
132 | + a1 = create TextArticle, name: 'bar', profile_id: profile.id, published: true | |
133 | + a2 = create TextArticle, name: 'another bar', profile_id: profile.id, published: true | |
147 | 134 | assert_no_difference 'ActionTracker::Record.count' do |
148 | 135 | a1.name = 'foo';a1.save! |
149 | 136 | a2.name = 'another foo';a2.save! |
... | ... | @@ -152,8 +139,8 @@ class TinyMceArticleTest < ActiveSupport::TestCase |
152 | 139 | |
153 | 140 | should 'remove activity when an article is destroyed' do |
154 | 141 | ActionTracker::Record.delete_all |
155 | - a1 = create TinyMceArticle, name: 'bar', profile_id: profile.id, published: true | |
156 | - a2 = create TinyMceArticle, name: 'another bar', profile_id: profile.id, published: true | |
142 | + a1 = create TextArticle, name: 'bar', profile_id: profile.id, published: true | |
143 | + a2 = create TextArticle, name: 'another bar', profile_id: profile.id, published: true | |
157 | 144 | assert_difference 'ActionTracker::Record.count', -2 do |
158 | 145 | a1.destroy |
159 | 146 | a2.destroy |
... | ... | @@ -165,19 +152,19 @@ class TinyMceArticleTest < ActiveSupport::TestCase |
165 | 152 | community = fast_create(Community) |
166 | 153 | community.add_member profile |
167 | 154 | assert profile.is_member_of?(community) |
168 | - article = create TinyMceArticle, name: 'test', profile_id: community.id | |
155 | + article = create TextArticle, name: 'test', profile_id: community.id | |
169 | 156 | assert_equal article, ActionTracker::Record.last.target |
170 | 157 | end |
171 | 158 | |
172 | 159 | should "the tracker action target be defined as the article on articles'creation in profile" do |
173 | 160 | ActionTracker::Record.delete_all |
174 | - article = create TinyMceArticle, name: 'test', profile_id: profile.id | |
161 | + article = create TextArticle, name: 'test', profile_id: profile.id | |
175 | 162 | assert_equal article, ActionTracker::Record.last.target |
176 | 163 | end |
177 | 164 | |
178 | 165 | should 'not notify activity if the article is not advertise' do |
179 | 166 | ActionTracker::Record.delete_all |
180 | - a = create TinyMceArticle, name: 'bar', profile_id: profile.id, published: true, advertise: false | |
167 | + a = create TextArticle, name: 'bar', profile_id: profile.id, published: true, advertise: false | |
181 | 168 | assert_equal true, a.published? |
182 | 169 | assert_equal true, a.notifiable? |
183 | 170 | assert_equal false, a.image? |
... | ... | @@ -186,11 +173,11 @@ class TinyMceArticleTest < ActiveSupport::TestCase |
186 | 173 | end |
187 | 174 | |
188 | 175 | should "have defined the is_trackable method defined" do |
189 | - assert TinyMceArticle.method_defined?(:is_trackable?) | |
176 | + assert TextArticle.method_defined?(:is_trackable?) | |
190 | 177 | end |
191 | 178 | |
192 | 179 | should "the common trackable conditions return the correct value" do |
193 | - a = build(TinyMceArticle, :profile => profile) | |
180 | + a = build(TextArticle, :profile => profile) | |
194 | 181 | a.published = a.advertise = true |
195 | 182 | assert_equal true, a.published? |
196 | 183 | assert_equal true, a.notifiable? |
... | ... | @@ -207,24 +194,20 @@ class TinyMceArticleTest < ActiveSupport::TestCase |
207 | 194 | assert_equal false, a.is_trackable? |
208 | 195 | end |
209 | 196 | |
210 | - should 'tiny mce editor is enabled' do | |
211 | - assert TinyMceArticle.new.tiny_mce? | |
212 | - end | |
213 | - | |
214 | 197 | should 'not sanitize html5 audio tag on body' do |
215 | - article = TinyMceArticle.create!(:name => 'html5 audio', :body => "Audio: <audio controls='controls'><source src='http://example.ogg' type='audio/ogg' />Audio not playing?.</audio>", :profile => profile) | |
198 | + article = TextArticle.create!(:name => 'html5 audio', :body => "Audio: <audio controls='controls'><source src='http://example.ogg' type='audio/ogg' />Audio not playing?.</audio>", :profile => profile) | |
216 | 199 | assert_tag_in_string article.body, :tag => 'audio', :attributes => {:controls => 'controls'} |
217 | 200 | assert_tag_in_string article.body, :tag => 'source', :attributes => {:src => 'http://example.ogg', :type => 'audio/ogg'} |
218 | 201 | end |
219 | 202 | |
220 | 203 | should 'not sanitize html5 video tag on body' do |
221 | - article = TinyMceArticle.create!(:name => 'html5 video', :body => "Video: <video controls='controls' autoplay='autoplay'><source src='http://example.ogv' type='video/ogg' />Video not playing?</video>", :profile => profile) | |
204 | + article = TextArticle.create!(:name => 'html5 video', :body => "Video: <video controls='controls' autoplay='autoplay'><source src='http://example.ogv' type='video/ogg' />Video not playing?</video>", :profile => profile) | |
222 | 205 | assert_tag_in_string article.body, :tag => 'video', :attributes => {:controls => 'controls', :autoplay => 'autoplay'} |
223 | 206 | assert_tag_in_string article.body, :tag => 'source', :attributes => {:src => 'http://example.ogv', :type => 'video/ogg'} |
224 | 207 | end |
225 | 208 | |
226 | 209 | should 'not sanitize colspan and rowspan attributes' do |
227 | - article = TinyMceArticle.create!(:name => 'table with colspan and rowspan', | |
210 | + article = TextArticle.create!(:name => 'table with colspan and rowspan', | |
228 | 211 | :body => "<table colspan='2' rowspan='3'><tr></tr></table>", |
229 | 212 | :profile => profile |
230 | 213 | ) |
... | ... | @@ -233,11 +216,11 @@ class TinyMceArticleTest < ActiveSupport::TestCase |
233 | 216 | end |
234 | 217 | |
235 | 218 | should 'have can_display_media_panel with default true' do |
236 | - a = TinyMceArticle.new | |
219 | + a = TextArticle.new | |
237 | 220 | assert a.can_display_media_panel? |
238 | 221 | end |
239 | 222 | |
240 | 223 | should 'have can_display_blocks with default false' do |
241 | - assert !TinyMceArticle.can_display_blocks? | |
224 | + assert !TextArticle.can_display_blocks? | |
242 | 225 | end |
243 | 226 | end | ... | ... |
vendor/plugins/xss_terminate/lib/xss_terminate.rb
... | ... | @@ -27,11 +27,15 @@ module XssTerminate |
27 | 27 | before_save filter_with |
28 | 28 | end |
29 | 29 | class_attribute "xss_terminate_#{options[:with]}_options".to_sym |
30 | + | |
31 | + | |
30 | 32 | self.send("xss_terminate_#{options[:with]}_options=".to_sym, { |
31 | 33 | :except => (options[:except] || []), |
34 | + :if => (options[:if] || true), | |
32 | 35 | :only => (options[:only] || options[:sanitize] || []) |
33 | - }) | |
36 | + }) if | |
34 | 37 | include XssTerminate::InstanceMethods |
38 | + | |
35 | 39 | end |
36 | 40 | |
37 | 41 | end |
... | ... | @@ -72,6 +76,9 @@ module XssTerminate |
72 | 76 | unless except.empty? |
73 | 77 | only.delete_if{ |i| except.include?( i.to_sym ) } |
74 | 78 | end |
79 | + if_condition = eval "xss_terminate_#{with}_options[:if]" | |
80 | + only = [] if !if_condition.nil? && if_condition.respond_to?(:call) && !if_condition.call(self) | |
81 | + | |
75 | 82 | return only, columns_serialized |
76 | 83 | end |
77 | 84 | ... | ... |