Commit 6eb736e05645ed902dbb17522ecdbefe14baf8c4
Committed by
Victor Costa
1 parent
64154b3e
Exists in
fix_sign_up_form
Remove TinyMce, RawHTML and Textile article types and create the possibility to …
…choose wich editor will be used to create new text articles
Showing
162 changed files
with
962 additions
and
1083 deletions
Show diff stats
app/api/helpers.rb
@@ -107,7 +107,7 @@ module Api | @@ -107,7 +107,7 @@ module Api | ||
107 | def post_article(asset, params) | 107 | def post_article(asset, params) |
108 | return forbidden! unless current_person.can_post_content?(asset) | 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 | return forbidden! unless klass_type.constantize <= Article | 111 | return forbidden! unless klass_type.constantize <= Article |
112 | 112 | ||
113 | article = klass_type.constantize.new(params[:article]) | 113 | article = klass_type.constantize.new(params[:article]) |
@@ -461,11 +461,9 @@ module Api | @@ -461,11 +461,9 @@ module Api | ||
461 | 461 | ||
462 | def parse_content_type(content_type) | 462 | def parse_content_type(content_type) |
463 | return nil if content_type.blank? | 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 | end | 466 | end |
468 | - content_types.flatten.uniq | ||
469 | end | 467 | end |
470 | 468 | ||
471 | def period(from_date, until_date) | 469 | def period(from_date, until_date) |
app/controllers/my_profile/cms_controller.rb
@@ -151,6 +151,7 @@ class CmsController < MyProfileController | @@ -151,6 +151,7 @@ class CmsController < MyProfileController | ||
151 | 151 | ||
152 | @article.profile = profile | 152 | @article.profile = profile |
153 | @article.author = user | 153 | @article.author = user |
154 | + @article.editor = current_person.editor | ||
154 | @article.last_changed_by = user | 155 | @article.last_changed_by = user |
155 | @article.created_by = user | 156 | @article.created_by = user |
156 | 157 | ||
@@ -399,8 +400,7 @@ class CmsController < MyProfileController | @@ -399,8 +400,7 @@ class CmsController < MyProfileController | ||
399 | 400 | ||
400 | def available_article_types | 401 | def available_article_types |
401 | articles = [ | 402 | articles = [ |
402 | - TinyMceArticle, | ||
403 | - TextileArticle, | 403 | + TextArticle, |
404 | Event | 404 | Event |
405 | ] | 405 | ] |
406 | articles += special_article_types if params && params[:cms] | 406 | articles += special_article_types if params && params[:cms] |
@@ -408,9 +408,6 @@ class CmsController < MyProfileController | @@ -408,9 +408,6 @@ class CmsController < MyProfileController | ||
408 | if @parent && @parent.blog? | 408 | if @parent && @parent.blog? |
409 | articles -= Article.folder_types.map(&:constantize) | 409 | articles -= Article.folder_types.map(&:constantize) |
410 | end | 410 | end |
411 | - if user.is_admin?(profile.environment) | ||
412 | - articles << RawHTMLArticle | ||
413 | - end | ||
414 | articles | 411 | articles |
415 | end | 412 | end |
416 | 413 |
app/controllers/my_profile/profile_editor_controller.rb
@@ -92,7 +92,7 @@ class ProfileEditorController < MyProfileController | @@ -92,7 +92,7 @@ class ProfileEditorController < MyProfileController | ||
92 | end | 92 | end |
93 | 93 | ||
94 | def welcome_page | 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 | if request.post? | 96 | if request.post? |
97 | begin | 97 | begin |
98 | @welcome_page.update!(params[:welcome_page]) | 98 | @welcome_page.update!(params[:welcome_page]) |
app/helpers/application_helper.rb
@@ -109,10 +109,6 @@ module ApplicationHelper | @@ -109,10 +109,6 @@ module ApplicationHelper | ||
109 | content = capture(&block) | 109 | content = capture(&block) |
110 | end | 110 | end |
111 | 111 | ||
112 | - if options[:type] == :textile | ||
113 | - content = RedCloth.new(content).to_html | ||
114 | - end | ||
115 | - | ||
116 | options[:class] = '' if ! options[:class] | 112 | options[:class] = '' if ! options[:class] |
117 | options[:class] += ' button icon-help' # with-text | 113 | options[:class] += ' button icon-help' # with-text |
118 | 114 | ||
@@ -130,13 +126,6 @@ module ApplicationHelper | @@ -130,13 +126,6 @@ module ApplicationHelper | ||
130 | text | 126 | text |
131 | end | 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 | # TODO: do something more useful here | 129 | # TODO: do something more useful here |
141 | # TODO: test this helper | 130 | # TODO: test this helper |
142 | # TODO: add an icon? | 131 | # TODO: add an icon? |
@@ -1243,4 +1232,15 @@ module ApplicationHelper | @@ -1243,4 +1232,15 @@ module ApplicationHelper | ||
1243 | content.html_safe | 1232 | content.html_safe |
1244 | end | 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 | end | 1246 | end |
app/helpers/profile_editor_helper.rb
@@ -158,4 +158,8 @@ module ProfileEditorHelper | @@ -158,4 +158,8 @@ module ProfileEditorHelper | ||
158 | end | 158 | end |
159 | end | 159 | end |
160 | 160 | ||
161 | + def select_editor(title, object, method, options) | ||
162 | + labelled_form_field(title, select(object, method,[[_('TinyMCE'), Article::Editor::TINY_MCE], [_('Textile'), Article::Editor::TEXTILE], [_('Raw HTML'), Article::Editor::RAW_HTML]])) | ||
163 | + end | ||
164 | + | ||
161 | end | 165 | end |
app/helpers/tinymce_helper.rb
@@ -18,7 +18,8 @@ module TinymceHelper | @@ -18,7 +18,8 @@ module TinymceHelper | ||
18 | insertdatetime media nonbreaking save table contextmenu directionality | 18 | insertdatetime media nonbreaking save table contextmenu directionality |
19 | emoticons template paste textcolor colorpicker textpattern], | 19 | emoticons template paste textcolor colorpicker textpattern], |
20 | :image_advtab => true, | 20 | :image_advtab => true, |
21 | - :language => tinymce_language | 21 | + :language => tinymce_language, |
22 | + :selector => '.' + current_editor(options[:mode]) | ||
22 | 23 | ||
23 | options[:toolbar1] = toolbar1(options[:mode]) | 24 | options[:toolbar1] = toolbar1(options[:mode]) |
24 | options[:menubar] = menubar(options[:mode]) | 25 | options[:menubar] = menubar(options[:mode]) |
app/models/article.rb
1 | 1 | ||
2 | class Article < ApplicationRecord | 2 | class Article < ApplicationRecord |
3 | 3 | ||
4 | + module Editor | ||
5 | + TEXTILE = 'textile' | ||
6 | + TINY_MCE = 'tiny_mce' | ||
7 | + RAW_HTML = 'raw_html' | ||
8 | + end | ||
9 | + | ||
4 | include SanitizeHelper | 10 | include SanitizeHelper |
5 | 11 | ||
6 | attr_accessible :name, :body, :abstract, :profile, :tag_list, :parent, | 12 | attr_accessible :name, :body, :abstract, :profile, :tag_list, :parent, |
@@ -11,7 +17,7 @@ class Article < ApplicationRecord | @@ -11,7 +17,7 @@ class Article < ApplicationRecord | ||
11 | :highlighted, :notify_comments, :display_hits, :slug, | 17 | :highlighted, :notify_comments, :display_hits, :slug, |
12 | :external_feed_builder, :display_versions, :external_link, | 18 | :external_feed_builder, :display_versions, :external_link, |
13 | :image_builder, :show_to_followers, :archived, | 19 | :image_builder, :show_to_followers, :archived, |
14 | - :author, :display_preview, :published_at, :person_followers | 20 | + :author, :display_preview, :published_at, :person_followers, :editor |
15 | 21 | ||
16 | extend ActsAsHavingImage::ClassMethods | 22 | extend ActsAsHavingImage::ClassMethods |
17 | acts_as_having_image | 23 | acts_as_having_image |
@@ -518,17 +524,12 @@ class Article < ApplicationRecord | @@ -518,17 +524,12 @@ class Article < ApplicationRecord | ||
518 | ['Folder', 'Blog', 'Forum', 'Gallery'] | 524 | ['Folder', 'Blog', 'Forum', 'Gallery'] |
519 | end | 525 | end |
520 | 526 | ||
521 | - def self.text_article_types | ||
522 | - ['TextArticle', 'TextileArticle', 'TinyMceArticle'] | ||
523 | - end | ||
524 | - | ||
525 | scope :published, -> { where 'articles.published = ?', true } | 527 | scope :published, -> { where 'articles.published = ?', true } |
526 | scope :folders, -> profile { where 'articles.type IN (?)', profile.folder_types } | 528 | scope :folders, -> profile { where 'articles.type IN (?)', profile.folder_types } |
527 | scope :no_folders, -> profile { where 'articles.type NOT IN (?)', profile.folder_types } | 529 | scope :no_folders, -> profile { where 'articles.type NOT IN (?)', profile.folder_types } |
528 | scope :galleries, -> { where "articles.type IN ('Gallery')" } | 530 | scope :galleries, -> { where "articles.type IN ('Gallery')" } |
529 | scope :images, -> { where :is_image => true } | 531 | scope :images, -> { where :is_image => true } |
530 | scope :no_images, -> { where :is_image => false } | 532 | scope :no_images, -> { where :is_image => false } |
531 | - scope :text_articles, -> { where 'articles.type IN (?)', text_article_types } | ||
532 | scope :files, -> { where :type => 'UploadedFile' } | 533 | scope :files, -> { where :type => 'UploadedFile' } |
533 | scope :with_types, -> types { where 'articles.type IN (?)', types } | 534 | scope :with_types, -> types { where 'articles.type IN (?)', types } |
534 | 535 | ||
@@ -711,10 +712,6 @@ class Article < ApplicationRecord | @@ -711,10 +712,6 @@ class Article < ApplicationRecord | ||
711 | false | 712 | false |
712 | end | 713 | end |
713 | 714 | ||
714 | - def tiny_mce? | ||
715 | - false | ||
716 | - end | ||
717 | - | ||
718 | def folder? | 715 | def folder? |
719 | false | 716 | false |
720 | end | 717 | end |
@@ -874,6 +871,10 @@ class Article < ApplicationRecord | @@ -874,6 +871,10 @@ class Article < ApplicationRecord | ||
874 | true | 871 | true |
875 | end | 872 | end |
876 | 873 | ||
874 | + def editor?(editor) | ||
875 | + self.editor == editor | ||
876 | + end | ||
877 | + | ||
877 | private | 878 | private |
878 | 879 | ||
879 | def sanitize_tag_list | 880 | def sanitize_tag_list |
app/models/event.rb
app/models/external_feed.rb
@@ -25,7 +25,7 @@ class ExternalFeed < ApplicationRecord | @@ -25,7 +25,7 @@ class ExternalFeed < ApplicationRecord | ||
25 | end | 25 | end |
26 | content = doc.to_s | 26 | content = doc.to_s |
27 | 27 | ||
28 | - article = TinyMceArticle.new | 28 | + article = TextArticle.new |
29 | article.name = title | 29 | article.name = title |
30 | article.profile = blog.profile | 30 | article.profile = blog.profile |
31 | article.body = content | 31 | article.body = content |
app/models/person.rb
1 | # A person is the profile of an user holding all relationships with the rest of the system | 1 | # A person is the profile of an user holding all relationships with the rest of the system |
2 | class Person < Profile | 2 | class Person < Profile |
3 | 3 | ||
4 | - attr_accessible :organization, :contact_information, :sex, :birth_date, :cell_phone, :comercial_phone, :jabber_id, :personal_website, :nationality, :address_reference, :district, :schooling, :schooling_status, :formation, :custom_formation, :area_of_study, :custom_area_of_study, :professional_activity, :organization_website, :following_articles | 4 | + attr_accessible :organization, :contact_information, :sex, :birth_date, :cell_phone, :comercial_phone, :jabber_id, :personal_website, :nationality, :address_reference, :district, :schooling, :schooling_status, :formation, :custom_formation, :area_of_study, :custom_area_of_study, :professional_activity, :organization_website, :following_articles, :editor |
5 | 5 | ||
6 | SEARCH_FILTERS = { | 6 | SEARCH_FILTERS = { |
7 | :order => %w[more_recent more_popular more_active], | 7 | :order => %w[more_recent more_popular more_active], |
@@ -613,6 +613,10 @@ class Person < Profile | @@ -613,6 +613,10 @@ class Person < Profile | ||
613 | Profile.followed_by self | 613 | Profile.followed_by self |
614 | end | 614 | end |
615 | 615 | ||
616 | + def editor?(editor) | ||
617 | + self.editor == editor | ||
618 | + end | ||
619 | + | ||
616 | def in_social_circle?(person) | 620 | def in_social_circle?(person) |
617 | self.is_a_friend?(person) || super | 621 | self.is_a_friend?(person) || super |
618 | end | 622 | end |
app/models/raw_html_article.rb
@@ -1,17 +0,0 @@ | @@ -1,17 +0,0 @@ | ||
1 | -class RawHTMLArticle < TextArticle | ||
2 | - | ||
3 | - def self.type_name | ||
4 | - _('HTML') | ||
5 | - end | ||
6 | - | ||
7 | - def self.short_description | ||
8 | - _('Raw HTML text article') | ||
9 | - end | ||
10 | - | ||
11 | - def self.description | ||
12 | - _('Allows HTML without filter (only for admins).') | ||
13 | - end | ||
14 | - | ||
15 | - xss_terminate :only => [ ] | ||
16 | - | ||
17 | -end |
app/models/suggest_article.rb
@@ -44,7 +44,7 @@ class SuggestArticle < Task | @@ -44,7 +44,7 @@ class SuggestArticle < Task | ||
44 | type = article[:type].constantize | 44 | type = article[:type].constantize |
45 | return type if type < Article | 45 | return type if type < Article |
46 | end | 46 | end |
47 | - TinyMceArticle | 47 | + TextArticle |
48 | end | 48 | end |
49 | 49 | ||
50 | def perform | 50 | def perform |
app/models/text_article.rb
1 | # a base class for all text article types. | 1 | # a base class for all text article types. |
2 | class TextArticle < Article | 2 | class TextArticle < Article |
3 | 3 | ||
4 | - xss_terminate :only => [ :name ], :on => 'validation' | 4 | + def self.short_description |
5 | + _('Text article') | ||
6 | + end | ||
7 | + | ||
8 | + def self.description | ||
9 | + _('Text article to create user content.') | ||
10 | + end | ||
11 | + | ||
12 | + xss_terminate :only => [ :name, :body, :abstract ], :with => 'white_list', :on => 'validation', :if => lambda { |a| !a.editor?(Article::Editor::TEXTILE) && !a.editor?(Article::Editor::RAW_HTML) } | ||
13 | + | ||
14 | + include WhiteListFilter | ||
15 | + filter_iframes :abstract, :body | ||
16 | + def iframe_whitelist | ||
17 | + profile && profile.environment && profile.environment.trusted_sites_for_iframe | ||
18 | + end | ||
5 | 19 | ||
6 | def self.type_name | 20 | def self.type_name |
7 | _('Article') | 21 | _('Article') |
@@ -21,6 +35,18 @@ class TextArticle < Article | @@ -21,6 +35,18 @@ class TextArticle < Article | ||
21 | true | 35 | true |
22 | end | 36 | end |
23 | 37 | ||
38 | + def can_display_media_panel? | ||
39 | + true | ||
40 | + end | ||
41 | + | ||
42 | + def self.can_display_blocks? | ||
43 | + false | ||
44 | + end | ||
45 | + | ||
46 | + def notifiable? | ||
47 | + true | ||
48 | + end | ||
49 | + | ||
24 | before_save :set_relative_path | 50 | before_save :set_relative_path |
25 | 51 | ||
26 | def set_relative_path | 52 | def set_relative_path |
@@ -43,4 +69,24 @@ class TextArticle < Article | @@ -43,4 +69,24 @@ class TextArticle < Article | ||
43 | parent && parent.kind_of?(Blog) && parent.display_preview | 69 | parent && parent.kind_of?(Blog) && parent.display_preview |
44 | end | 70 | end |
45 | 71 | ||
72 | + def to_html(options ={}) | ||
73 | + content = super(options) | ||
74 | + content = convert_textile_to_html(content) if self.editor?(Article::Editor::TEXTILE) | ||
75 | + content | ||
76 | + end | ||
77 | + | ||
78 | + def lead(length = nil) | ||
79 | + content = super(length) | ||
80 | + content = convert_textile_to_html(content) if self.editor?(Article::Editor::TEXTILE) | ||
81 | + content | ||
82 | + end | ||
83 | + | ||
84 | + protected | ||
85 | + | ||
86 | + def convert_textile_to_html(textile) | ||
87 | + converter = RedCloth.new(textile|| '') | ||
88 | + converter.hard_breaks = false | ||
89 | + sanitize_html(converter.to_html, :white_list) | ||
90 | + end | ||
91 | + | ||
46 | end | 92 | end |
app/models/textile_article.rb
@@ -1,44 +0,0 @@ | @@ -1,44 +0,0 @@ | ||
1 | -class TextileArticle < TextArticle | ||
2 | - include SanitizeHelper | ||
3 | - | ||
4 | - def self.short_description | ||
5 | - _('Text article with Textile markup language') | ||
6 | - end | ||
7 | - | ||
8 | - def self.description | ||
9 | - _('Accessible alternative for visually impaired users.') | ||
10 | - end | ||
11 | - | ||
12 | - def to_html(options ={}) | ||
13 | - convert_to_html(body) | ||
14 | - end | ||
15 | - | ||
16 | - def lead(length = nil) | ||
17 | - if abstract.blank? | ||
18 | - super | ||
19 | - else | ||
20 | - convert_to_html(abstract) | ||
21 | - end | ||
22 | - end | ||
23 | - | ||
24 | - def notifiable? | ||
25 | - true | ||
26 | - end | ||
27 | - | ||
28 | - def can_display_media_panel? | ||
29 | - true | ||
30 | - end | ||
31 | - | ||
32 | - def self.can_display_blocks? | ||
33 | - false | ||
34 | - end | ||
35 | - | ||
36 | - protected | ||
37 | - | ||
38 | - def convert_to_html(textile) | ||
39 | - converter = RedCloth.new(textile|| '') | ||
40 | - converter.hard_breaks = false | ||
41 | - sanitize_html(converter.to_html, :white_list) | ||
42 | - end | ||
43 | - | ||
44 | -end |
app/models/tiny_mce_article.rb
@@ -1,37 +0,0 @@ | @@ -1,37 +0,0 @@ | ||
1 | -class TinyMceArticle < TextArticle | ||
2 | - | ||
3 | - def self.short_description | ||
4 | - _('Text article with visual editor') | ||
5 | - end | ||
6 | - | ||
7 | - def self.description | ||
8 | - _('Not accessible for visually impaired users.') | ||
9 | - end | ||
10 | - | ||
11 | - xss_terminate :only => [ ] | ||
12 | - | ||
13 | - xss_terminate :only => [ :name, :abstract, :body ], :with => 'white_list', :on => 'validation' | ||
14 | - | ||
15 | - include WhiteListFilter | ||
16 | - filter_iframes :abstract, :body | ||
17 | - def iframe_whitelist | ||
18 | - profile && profile.environment && profile.environment.trusted_sites_for_iframe | ||
19 | - end | ||
20 | - | ||
21 | - def notifiable? | ||
22 | - true | ||
23 | - end | ||
24 | - | ||
25 | - def tiny_mce? | ||
26 | - true | ||
27 | - end | ||
28 | - | ||
29 | - def can_display_media_panel? | ||
30 | - true | ||
31 | - end | ||
32 | - | ||
33 | - def self.can_display_blocks? | ||
34 | - false | ||
35 | - end | ||
36 | - | ||
37 | -end |
app/views/admin_panel/_signup_intro.html.erb
@@ -2,4 +2,4 @@ | @@ -2,4 +2,4 @@ | ||
2 | <%= _('This text will be shown to the user on the top of the sign up form.') %> | 2 | <%= _('This text will be shown to the user on the top of the sign up form.') %> |
3 | </div> | 3 | </div> |
4 | 4 | ||
5 | -<%= labelled_form_field(_('Body'), text_area(:environment, :signup_intro, :cols => 40, :style => 'width: 100%', :class => 'mceEditor')) %> | 5 | +<%= labelled_form_field(_('Body'), text_area(:environment, :signup_intro, :cols => 40, :style => 'width: 100%', :class => current_editor)) %> |
app/views/admin_panel/_signup_welcome_screen.html.erb
1 | <div class='description'> | 1 | <div class='description'> |
2 | <%= _('If you enable this feature on the "Features" section of the Administration Panel, this text will be shown as a welcome message to users after signup.') %> | 2 | <%= _('If you enable this feature on the "Features" section of the Administration Panel, this text will be shown as a welcome message to users after signup.') %> |
3 | </div> | 3 | </div> |
4 | -<%= labelled_form_field(_('Body'), text_area(:environment, :signup_welcome_screen_body, :cols => 40, :style => 'width: 100%', :class => 'mceEditor')) %> | 4 | +<%= labelled_form_field(_('Body'), text_area(:environment, :signup_welcome_screen_body, :cols => 40, :style => 'width: 100%', :class => current_editor)) %> |
5 | 5 | ||
6 | <div class='description'> | 6 | <div class='description'> |
7 | <%= _('If this content is left blank, the following page will be displayed to the user:') %> | 7 | <%= _('If this content is left blank, the following page will be displayed to the user:') %> |
app/views/admin_panel/_signup_welcome_text.html.erb
@@ -4,4 +4,4 @@ | @@ -4,4 +4,4 @@ | ||
4 | </div> | 4 | </div> |
5 | 5 | ||
6 | <%= labelled_form_field(_('Subject'), text_field(:environment, :signup_welcome_text_subject, :style => 'width:100%')) %> | 6 | <%= labelled_form_field(_('Subject'), text_field(:environment, :signup_welcome_text_subject, :style => 'width:100%')) %> |
7 | -<%= labelled_form_field(_('Body'), text_area(:environment, :signup_welcome_text_body, :cols => 40, :style => 'width: 100%', :class => 'mceEditor')) %> | 7 | +<%= labelled_form_field(_('Body'), text_area(:environment, :signup_welcome_text_body, :cols => 40, :style => 'width: 100%', :class => current_editor)) %> |
app/views/admin_panel/_site_info.html.erb
@@ -31,4 +31,4 @@ | @@ -31,4 +31,4 @@ | ||
31 | <%= balanced_table(fields)%> | 31 | <%= balanced_table(fields)%> |
32 | 32 | ||
33 | <br /> | 33 | <br /> |
34 | -<%= labelled_form_field _('Homepage content'), text_area(:environment, :description, :cols => 40, :style => 'width: 90%', :class => 'mceEditor') %> | 34 | +<%= labelled_form_field _('Homepage content'), text_area(:environment, :description, :cols => 40, :style => 'width: 90%', :class => current_editor) %> |
app/views/admin_panel/_terms_of_use.html.erb
app/views/admin_panel/message_for_disabled_enterprise.html.erb
1 | <h2><%= _('Site info') %></h2> | 1 | <h2><%= _('Site info') %></h2> |
2 | 2 | ||
3 | -<%= render :file => 'shared/tiny_mce' %> | ||
4 | - | ||
5 | <%= labelled_form_for :environment, :url => {:action => 'site_info'} do |f| %> | 3 | <%= labelled_form_for :environment, :url => {:action => 'site_info'} do |f| %> |
6 | 4 | ||
7 | - <%= f.text_area :message_for_disabled_enterprise, :cols => 40, :style => 'width: 90%' %> | 5 | + <%= f.text_area :message_for_disabled_enterprise, :cols => 40, :style => 'width: 90%', :class => current_editor %> |
8 | 6 | ||
9 | <%= button_bar do %> | 7 | <%= button_bar do %> |
10 | <%= submit_button(:save, _('Save')) %> | 8 | <%= submit_button(:save, _('Save')) %> |
app/views/admin_panel/site_info.html.erb
@@ -2,8 +2,6 @@ | @@ -2,8 +2,6 @@ | ||
2 | 2 | ||
3 | <%= error_messages_for :environment %> | 3 | <%= error_messages_for :environment %> |
4 | 4 | ||
5 | -<%= render :file => 'shared/tiny_mce' %> | ||
6 | - | ||
7 | <%= labelled_form_for :environment do |f| %> | 5 | <%= labelled_form_for :environment do |f| %> |
8 | <% tabs = [] %> | 6 | <% tabs = [] %> |
9 | <% tabs << {:title => _('Site info'), :id => 'site-info', | 7 | <% tabs << {:title => _('Site info'), :id => 'site-info', |
app/views/cms/_article.html.erb
app/views/cms/_blog.html.erb
@@ -2,8 +2,6 @@ | @@ -2,8 +2,6 @@ | ||
2 | 2 | ||
3 | <h1><%= _('My Blog') %></h1> | 3 | <h1><%= _('My Blog') %></h1> |
4 | 4 | ||
5 | -<%= render :file => 'shared/tiny_mce' %> | ||
6 | - | ||
7 | <%= required f.text_field(:name, :size => '64', :maxlength => 150, :onchange => "updateUrlField(this, 'article_slug')") %> | 5 | <%= required f.text_field(:name, :size => '64', :maxlength => 150, :onchange => "updateUrlField(this, 'article_slug')") %> |
8 | 6 | ||
9 | <%= render :partial => 'general_fields' %> | 7 | <%= render :partial => 'general_fields' %> |
@@ -53,7 +51,7 @@ | @@ -53,7 +51,7 @@ | ||
53 | %> | 51 | %> |
54 | </div> | 52 | </div> |
55 | 53 | ||
56 | -<%= labelled_form_field(_('Description:'), text_area(:article, :body, :rows => 10, :class => 'mceEditor')) %> | 54 | +<%= labelled_form_field(_('Description:'), text_area(:article, :body, :rows => 10, :class => current_editor)) %> |
57 | 55 | ||
58 | <div id="blog-image-builder"> | 56 | <div id="blog-image-builder"> |
59 | <%= f.fields_for :image_builder, @article.image do |i| %> | 57 | <%= f.fields_for :image_builder, @article.image do |i| %> |
app/views/cms/_enterprise_homepage.html.erb
1 | -<%= render :file => 'shared/tiny_mce' %> | ||
2 | - | ||
3 | -<%= labelled_form_field(_('Text'), text_area(:article, 'body', :cols => 40, :style => 'width:99%', :class => 'mceEditor')) %> | 1 | +<%= labelled_form_field(_('Text'), text_area(:article, 'body', :cols => 40, :style => 'width:99%', :class => current_editor)) %> |
4 | 2 |
app/views/cms/_event.html.erb
1 | <%= required_fields_message %> | 1 | <%= required_fields_message %> |
2 | 2 | ||
3 | -<%# TODO add Textile help here %> | ||
4 | -<%= render :file => 'shared/tiny_mce' %> | ||
5 | - | ||
6 | <%= required f.text_field('name', :size => '64', :maxlength => 150) %> | 3 | <%= required f.text_field('name', :size => '64', :maxlength => 150) %> |
7 | 4 | ||
8 | <%= render :partial => 'general_fields' %> | 5 | <%= render :partial => 'general_fields' %> |
@@ -15,4 +12,4 @@ | @@ -15,4 +12,4 @@ | ||
15 | 12 | ||
16 | <%= labelled_form_field(_('Address:'), text_field(:article, :address)) %> | 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,18 +4,16 @@ | ||
4 | 4 | ||
5 | <%= required_fields_message %> | 5 | <%= required_fields_message %> |
6 | 6 | ||
7 | -<%= render :file => 'shared/tiny_mce' %> | ||
8 | - | ||
9 | <%= required f.text_field(:name, :size => '64', :maxlength => 150, :onchange => "updateUrlField(this, 'article_slug')") %> | 7 | <%= required f.text_field(:name, :size => '64', :maxlength => 150, :onchange => "updateUrlField(this, 'article_slug')") %> |
10 | 8 | ||
11 | <%= render :partial => 'general_fields' %> | 9 | <%= render :partial => 'general_fields' %> |
12 | 10 | ||
13 | -<%= labelled_form_field(_('Description:'), text_area(:article, :body, :class => 'mceEditor', :cols => 64, :rows => 10)) %> | 11 | +<%= labelled_form_field(_('Description:'), text_area(:article, :body, :class => current_editor, :cols => 64, :rows => 10)) %> |
14 | 12 | ||
15 | <%= labelled_form_field(_('Posts per page:'), f.select(:posts_per_page, Forum.posts_per_page_options)) %> | 13 | <%= labelled_form_field(_('Posts per page:'), f.select(:posts_per_page, Forum.posts_per_page_options)) %> |
16 | 14 | ||
17 | <%= labelled_form_field(_('Has terms of use:'), check_box(:article, :has_terms_of_use))%> | 15 | <%= labelled_form_field(_('Has terms of use:'), check_box(:article, :has_terms_of_use))%> |
18 | 16 | ||
19 | <div id="text_area_terms_of_use"> | 17 | <div id="text_area_terms_of_use"> |
20 | - <%= labelled_form_field(_('Terms of use:'), text_area(:article, :terms_of_use, :class => 'mceEditor',:cols => 64, :rows => 10)) %> | 18 | + <%= labelled_form_field(_('Terms of use:'), text_area(:article, :terms_of_use, :class => current_editor,:cols => 64, :rows => 10)) %> |
21 | </div> | 19 | </div> |
app/views/cms/_raw_html_article.html.erb
@@ -1,8 +0,0 @@ | @@ -1,8 +0,0 @@ | ||
1 | -<%= required_fields_message %> | ||
2 | - | ||
3 | -<%= required labelled_form_field(_('Title'), text_field(:article, 'name', :size => '64', :maxlength => 150)) %> | ||
4 | - | ||
5 | -<%= render :partial => 'text_fields' %> | ||
6 | -<%= render :partial => 'general_fields' %> | ||
7 | -<%= render :partial => 'translatable' %> | ||
8 | -<%= render :partial => 'shared/lead_and_body' %> |
@@ -0,0 +1,10 @@ | @@ -0,0 +1,10 @@ | ||
1 | +<%= required_fields_message %> | ||
2 | + | ||
3 | +<%= required labelled_form_field(_('Title'), text_field(:article, 'name', :size => '72', :maxlength => 150)) %> | ||
4 | + | ||
5 | +<%= render :partial => 'text_fields' %> | ||
6 | +<%= render :partial => 'general_fields' %> | ||
7 | +<%= render :partial => 'translatable' %> | ||
8 | + | ||
9 | +<%= render :partial => 'shared/lead_and_body' %> | ||
10 | + |
app/views/cms/_text_editor_sidebar.html.erb
@@ -7,7 +7,7 @@ | @@ -7,7 +7,7 @@ | ||
7 | 7 | ||
8 | <div class='header'><strong><%= _('Insert media') %></strong><%= button('vertical-toggle', _('Show/Hide'), '#') %></div> | 8 | <div class='header'><strong><%= _('Insert media') %></strong><%= button('vertical-toggle', _('Show/Hide'), '#') %></div> |
9 | 9 | ||
10 | - <%= render(:partial => 'textile_quick_reference') if @article.is_a?(TextileArticle) %> | 10 | + <%= render(:partial => 'textile_quick_reference') if @article.editor?(Article::Editor::TEXTILE) %> |
11 | <div class='text-editor-sidebar-box' id='media-upload-box'> | 11 | <div class='text-editor-sidebar-box' id='media-upload-box'> |
12 | <div id='media-upload-form'> | 12 | <div id='media-upload-form'> |
13 | <%= form_tag({ :action => 'media_upload' }, :multipart => true) do %> | 13 | <%= form_tag({ :action => 'media_upload' }, :multipart => true) do %> |
app/views/cms/_textile_article.html.erb
@@ -1,10 +0,0 @@ | @@ -1,10 +0,0 @@ | ||
1 | -<%= required_fields_message %> | ||
2 | - | ||
3 | -<%# TODO add Textile help here %> | ||
4 | - | ||
5 | -<%= required labelled_form_field(_('Title'), text_field(:article, 'name', :size => '72', :maxlength => 150)) %> | ||
6 | - | ||
7 | -<%= render :partial => 'text_fields' %> | ||
8 | -<%= render :partial => 'general_fields' %> | ||
9 | -<%= render :partial => 'translatable' %> | ||
10 | -<%= render :partial => 'shared/lead_and_body' %> |
app/views/cms/_tiny_mce_article.html.erb
@@ -1,12 +0,0 @@ | @@ -1,12 +0,0 @@ | ||
1 | -<%= required_fields_message %> | ||
2 | - | ||
3 | -<%= render :file => 'shared/tiny_mce' %> | ||
4 | - | ||
5 | -<div> | ||
6 | - <%= required labelled_form_field(_('Title'), text_field(:article, 'name', :size => '64', :maxlength => 150)) %> | ||
7 | - | ||
8 | - <%= render :partial => 'text_fields' %> | ||
9 | - <%= render :partial => 'general_fields' %> | ||
10 | - <%= render :partial => 'translatable' %> | ||
11 | - <%= render :partial => 'shared/lead_and_body', :locals => {:tiny_mce => true} %> | ||
12 | -</div> |
app/views/cms/suggest_an_article.html.erb
@@ -2,8 +2,6 @@ | @@ -2,8 +2,6 @@ | ||
2 | 2 | ||
3 | <%= required_fields_message %> | 3 | <%= required_fields_message %> |
4 | 4 | ||
5 | -<%= render :file => 'shared/tiny_mce' %> | ||
6 | - | ||
7 | <%= labelled_form_for 'task' do |f| %> | 5 | <%= labelled_form_for 'task' do |f| %> |
8 | 6 | ||
9 | <%= required labelled_form_field(_('Title'), text_field('task[article]', 'name', :size => 50)) %> | 7 | <%= required labelled_form_field(_('Title'), text_field('task[article]', 'name', :size => 50)) %> |
@@ -17,7 +15,7 @@ | @@ -17,7 +15,7 @@ | ||
17 | <%= required labelled_form_field(_('Email'), text_field(:task, 'email')) %> | 15 | <%= required labelled_form_field(_('Email'), text_field(:task, 'email')) %> |
18 | <% end %> | 16 | <% end %> |
19 | 17 | ||
20 | - <%= render :partial => 'shared/lead_and_body', :locals => {:tiny_mce => true, :object => 'task[article]'} %> | 18 | + <%= render :partial => 'shared/lead_and_body', :locals => {:object => 'task[article]'} %> |
21 | 19 | ||
22 | <%= hidden_field_tag('back_to', @back_to) %> | 20 | <%= hidden_field_tag('back_to', @back_to) %> |
23 | 21 |
app/views/contact/new.html.erb
@@ -25,8 +25,7 @@ | @@ -25,8 +25,7 @@ | ||
25 | 25 | ||
26 | <%= required f.text_field(:subject) %> | 26 | <%= required f.text_field(:subject) %> |
27 | 27 | ||
28 | - <%= render :file => 'shared/tiny_mce' %> | ||
29 | - <%= required f.text_area(:message, :class => 'mceEditor') %> | 28 | + <%= required f.text_area(:message, :class => current_editor) %> |
30 | 29 | ||
31 | <%= labelled_form_field check_box(:contact, :receive_a_copy) + _('I want to receive a copy of the message in my e-mail.'), '' %> | 30 | <%= labelled_form_field check_box(:contact, :receive_a_copy) + _('I want to receive a copy of the message in my e-mail.'), '' %> |
32 | 31 |
app/views/email_templates/_form.html.erb
@@ -19,8 +19,7 @@ | @@ -19,8 +19,7 @@ | ||
19 | <%= @template_params_allowed %> | 19 | <%= @template_params_allowed %> |
20 | </div> | 20 | </div> |
21 | </div> | 21 | </div> |
22 | - <%= render :file => 'shared/tiny_mce' %> | ||
23 | - <%= labelled_form_field(_('Body:'), f.text_area(:body, :class => 'mceEditor')) %> | 22 | + <%= labelled_form_field(_('Body:'), f.text_area(:body, :class => current_editor)) %> |
24 | </div> | 23 | </div> |
25 | 24 | ||
26 | <div class="actions"> | 25 | <div class="actions"> |
app/views/layouts/application-ng.html.erb
@@ -35,6 +35,9 @@ | @@ -35,6 +35,9 @@ | ||
35 | noosfero.profile = <%= (@profile.identifier if @profile).to_json.html_safe %> | 35 | noosfero.profile = <%= (@profile.identifier if @profile).to_json.html_safe %> |
36 | </script> | 36 | </script> |
37 | 37 | ||
38 | + <% if current_editor_is?(Article::Editor::TINY_MCE) %> | ||
39 | + <%= render :file => 'shared/tiny_mce' %> | ||
40 | + <% end %> | ||
38 | </head> | 41 | </head> |
39 | <body class="<%= h body_classes %>"> | 42 | <body class="<%= h body_classes %>"> |
40 | <a href="#content" id="link-go-content"><span><%= _("Go to the content") %></span></a> | 43 | <a href="#content" id="link-go-content"><span><%= _("Go to the content") %></span></a> |
app/views/profile/send_mail.html.erb
@@ -16,8 +16,7 @@ | @@ -16,8 +16,7 @@ | ||
16 | 16 | ||
17 | <%= labelled_form_field(_('Subject:'), f.text_field(:subject)) %> | 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 | <%= submit_button(:send, _('Send')) %> | 21 | <%= submit_button(:send, _('Send')) %> |
23 | <%= button :cancel, _('Cancel e-mail'), :back %> | 22 | <%= button :cancel, _('Cancel e-mail'), :back %> |
app/views/profile_editor/_person.html.erb
@@ -16,6 +16,8 @@ | @@ -16,6 +16,8 @@ | ||
16 | </div> | 16 | </div> |
17 | </div> | 17 | </div> |
18 | 18 | ||
19 | + <%= select_editor(_('Editor'), 'profile_data', 'editor', {}) %> | ||
20 | + | ||
19 | <%= safe_join(@plugins.dispatch(:profile_info_extra_contents).collect { |content| instance_exec(&content) }, "") %> | 21 | <%= safe_join(@plugins.dispatch(:profile_info_extra_contents).collect { |content| instance_exec(&content) }, "") %> |
20 | 22 | ||
21 | <div class="formfieldline"> | 23 | <div class="formfieldline"> |
app/views/profile_editor/header_footer.html.erb
1 | -<%= render :file => 'shared/tiny_mce' %> | ||
2 | - | ||
3 | <h1><%= _('Editing header and footer') %></h1> | 1 | <h1><%= _('Editing header and footer') %></h1> |
4 | 2 | ||
5 | <%= form_tag do %> | 3 | <%= form_tag do %> |
@@ -21,9 +19,9 @@ | @@ -21,9 +19,9 @@ | ||
21 | </div> | 19 | </div> |
22 | <% end %> | 20 | <% end %> |
23 | <h2><%= _('Content for header ') %></h2> | 21 | <h2><%= _('Content for header ') %></h2> |
24 | - <%= text_area_tag(:custom_header, @header, :style => 'width: 100%; height: 150px;', :class => 'mceEditor') %> | 22 | + <%= text_area_tag(:custom_header, @header, :style => 'width: 100%; height: 150px;', :class => current_editor) %> |
25 | <h2><%= _('Content for footer') %></h2> | 23 | <h2><%= _('Content for footer') %></h2> |
26 | - <%= text_area_tag(:custom_footer, @footer, :style => 'width: 100%; height: 150px;', :class => 'mceEditor') %> | 24 | + <%= text_area_tag(:custom_footer, @footer, :style => 'width: 100%; height: 150px;', :class => current_editor) %> |
27 | <%= button_bar do %> | 25 | <%= button_bar do %> |
28 | <%= submit_button(:save, _('Save')) %> | 26 | <%= submit_button(:save, _('Save')) %> |
29 | <%= button(:cancel, _('Cancel'), :action => 'index') %> | 27 | <%= button(:cancel, _('Cancel'), :action => 'index') %> |
app/views/profile_editor/welcome_page.html.erb
@@ -8,7 +8,7 @@ | @@ -8,7 +8,7 @@ | ||
8 | <%= _('Your welcome page will only be displayed if this options is selected.') %> | 8 | <%= _('Your welcome page will only be displayed if this options is selected.') %> |
9 | </div> | 9 | </div> |
10 | 10 | ||
11 | - <%= f.text_area(:body, :cols => 40, :style => 'width: 100%', :class => 'mceEditor') %> | 11 | + <%= f.text_area(:body, :cols => 40, :style => 'width: 100%', :class => current_editor) %> |
12 | <div class='explanation'> | 12 | <div class='explanation'> |
13 | <%= _('This page will be displayed to the user after his signup with this template.') %> | 13 | <%= _('This page will be displayed to the user after his signup with this template.') %> |
14 | </div> | 14 | </div> |
@@ -17,5 +17,3 @@ | @@ -17,5 +17,3 @@ | ||
17 | <%= submit_button('save', _('Save'), :cancel => @back_to) %> | 17 | <%= submit_button('save', _('Save'), :cancel => @back_to) %> |
18 | <% end %> | 18 | <% end %> |
19 | <% end %> | 19 | <% end %> |
20 | - | ||
21 | -<%= render :file => 'shared/tiny_mce' %> |
app/views/shared/_lead_and_body.html.erb
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | <% abstract_method ||= :abstract %> | 3 | <% abstract_method ||= :abstract %> |
4 | <% body_label ||= 'Text' %> | 4 | <% body_label ||= 'Text' %> |
5 | <% body_method ||= :body %> | 5 | <% body_method ||= :body %> |
6 | -<% editor_type = defined?(tiny_mce) && tiny_mce ? 'mceEditor' : '' %> | 6 | +<% editor_type = current_editor %> |
7 | <% lead_id ||= 0%> | 7 | <% lead_id ||= 0%> |
8 | <% f ||= false%> | 8 | <% f ||= false%> |
9 | 9 |
app/views/shared/tiny_mce.html.erb
@@ -47,7 +47,9 @@ function tinymce_macros_setup(editor) { | @@ -47,7 +47,9 @@ function tinymce_macros_setup(editor) { | ||
47 | tinymce.PluginManager.add('macrosPlugin', tinymce.plugins.MacrosPlugin); | 47 | tinymce.PluginManager.add('macrosPlugin', tinymce.plugins.MacrosPlugin); |
48 | 48 | ||
49 | jQuery(document).ready(function () { | 49 | jQuery(document).ready(function () { |
50 | - <%= tinymce_init_js :mode => mode %> | 50 | + <%= tinymce_init_js %> |
51 | + <%= tinymce_init_js :mode => 'simple' %> | ||
52 | + <%= tinymce_init_js :mode => 'restricted' %> | ||
51 | }); | 53 | }); |
52 | </script> | 54 | </script> |
53 | 55 |
app/views/tasks/_approve_article_accept_details.html.erb
1 | <%= task_email_template(_('Select an acceptance email template:'), @acceptance_email_templates, task) %> | 1 | <%= task_email_template(_('Select an acceptance email template:'), @acceptance_email_templates, task) %> |
2 | 2 | ||
3 | -<%= render :file => 'shared/tiny_mce' %> | ||
4 | - | ||
5 | <%= labelled_form_field(_('Create a link'), f.check_box(:create_link)) %> | 3 | <%= labelled_form_field(_('Create a link'), f.check_box(:create_link)) %> |
6 | 4 | ||
7 | <%= labelled_form_field(_('Name for publishing'), f.text_field(:name)) %> | 5 | <%= labelled_form_field(_('Name for publishing'), f.text_field(:name)) %> |
8 | <%= select_profile_folder(_('Select the folder where the article must be published'), "tasks[#{task.id}][task][article_parent_id]", task.target) %> | 6 | <%= select_profile_folder(_('Select the folder where the article must be published'), "tasks[#{task.id}][task][article_parent_id]", task.target) %> |
9 | <%= labelled_form_field(_('Highlight this article'), f.check_box(:highlighted)) %> | 7 | <%= labelled_form_field(_('Highlight this article'), f.check_box(:highlighted)) %> |
10 | 8 | ||
11 | -<% tiny = task.article && task.article.tiny_mce? ? {:tiny_mce => true} : {} %> | ||
12 | -<%= render :partial => 'shared/lead_and_body', :locals => {:lead_id => task.id, :f => f}.merge(tiny)%> | 9 | +<%= render :partial => 'shared/lead_and_body', :locals => {:lead_id => task.id, :f => f}%> |
13 | 10 | ||
14 | <%= labelled_form_field _('Comment for author'), f.text_field(:closing_statment, :style => 'width: 488px;') %> | 11 | <%= labelled_form_field _('Comment for author'), f.text_field(:closing_statment, :style => 'width: 488px;') %> |
15 | 12 |
app/views/tasks/_suggest_article_accept_details.html.erb
1 | -<%= render :file => 'shared/tiny_mce' %> | ||
2 | - | ||
3 | <% unless task.requestor %> | 1 | <% unless task.requestor %> |
4 | <%= labelled_form_field(_("Sent by: "), f.text_field(:name)) %> | 2 | <%= labelled_form_field(_("Sent by: "), f.text_field(:name)) %> |
5 | <p><%= label_tag(_("Email: %s") % task.email) %> </p> | 3 | <p><%= label_tag(_("Email: %s") % task.email) %> </p> |
@@ -14,5 +12,5 @@ | @@ -14,5 +12,5 @@ | ||
14 | <%= labelled_form_field(_('Highlight this article'), a.check_box(:highlighted)) %> | 12 | <%= labelled_form_field(_('Highlight this article'), a.check_box(:highlighted)) %> |
15 | 13 | ||
16 | <%= a.hidden_field(:type) %> | 14 | <%= a.hidden_field(:type) %> |
17 | - <%= render :partial => 'shared/lead_and_body', :locals => {:tiny_mce => true, :f => a, :lead_id => task.id} %> | 15 | + <%= render :partial => 'shared/lead_and_body', :locals => {:f => a, :lead_id => task.id} %> |
18 | <% end %> | 16 | <% end %> |
app/views/users/send_mail.html.erb
@@ -2,7 +2,6 @@ | @@ -2,7 +2,6 @@ | ||
2 | 2 | ||
3 | <%= error_messages_for :mailing %> | 3 | <%= error_messages_for :mailing %> |
4 | 4 | ||
5 | -<%= render :file => 'shared/tiny_mce' %> | ||
6 | <%= form_for :mailing do |f| %> | 5 | <%= form_for :mailing do |f| %> |
7 | <div class="recipients"> | 6 | <div class="recipients"> |
8 | <%= label_tag(_("Recipients: "), nil, { class: "formlabel" }) %> | 7 | <%= label_tag(_("Recipients: "), nil, { class: "formlabel" }) %> |
@@ -14,7 +13,7 @@ | @@ -14,7 +13,7 @@ | ||
14 | </div> | 13 | </div> |
15 | </div> | 14 | </div> |
16 | <%= labelled_form_field(_('Subject:'), f.text_field(:subject)) %> | 15 | <%= labelled_form_field(_('Subject:'), f.text_field(:subject)) %> |
17 | - <%= labelled_form_field(_('Body:'), f.text_area(:body, :class => 'mceEditor')) %> | 16 | + <%= labelled_form_field(_('Body:'), f.text_area(:body, :class => current_editor)) %> |
18 | <%= submit_button(:send, _('Send')) %> | 17 | <%= submit_button(:send, _('Send')) %> |
19 | <%= button :cancel, _('Cancel e-mail'), :controller => 'users' %> | 18 | <%= button :cancel, _('Cancel e-mail'), :controller => 'users' %> |
20 | <% end %> | 19 | <% end %> |
db/migrate/20160809123835_add_people_and_article_editor.rb
0 → 100644
@@ -0,0 +1,9 @@ | @@ -0,0 +1,9 @@ | ||
1 | +class AddPeopleAndArticleEditor < ActiveRecord::Migration | ||
2 | + def change | ||
3 | + add_column :profiles, :editor, :string, :null => false, :default => Article::Editor::TINY_MCE | ||
4 | + add_column :articles, :editor, :string, :null => false, :default => Article::Editor::TINY_MCE | ||
5 | + Article.where(:type => 'TextileArticle').update_all(:type => 'TextArticle', :editor => Article::Editor::TEXTILE) | ||
6 | + Article.where(:type => 'TinyMceArticle').update_all(:type => 'TextArticle', :editor => Article::Editor::TINY_MCE) | ||
7 | + Article.where(:type => 'RawHTMLArticle').update_all(:type => 'TextArticle', :editor => Article::Editor::RAW_HTML) | ||
8 | + end | ||
9 | +end |
db/schema.rb
@@ -11,7 +11,7 @@ | @@ -11,7 +11,7 @@ | ||
11 | # | 11 | # |
12 | # It's strongly recommended that you check this file into your version control system. | 12 | # It's strongly recommended that you check this file into your version control system. |
13 | 13 | ||
14 | -ActiveRecord::Schema.define(version: 20160705162914) do | 14 | +ActiveRecord::Schema.define(version: 20160809123835) do |
15 | 15 | ||
16 | # These are extensions that must be enabled in order to support this database | 16 | # These are extensions that must be enabled in order to support this database |
17 | enable_extension "plpgsql" | 17 | enable_extension "plpgsql" |
@@ -168,6 +168,7 @@ ActiveRecord::Schema.define(version: 20160705162914) do | @@ -168,6 +168,7 @@ ActiveRecord::Schema.define(version: 20160705162914) do | ||
168 | t.boolean "show_to_followers", default: true | 168 | t.boolean "show_to_followers", default: true |
169 | t.integer "followers_count", default: 0 | 169 | t.integer "followers_count", default: 0 |
170 | t.boolean "archived", default: false | 170 | t.boolean "archived", default: false |
171 | + t.string "editor", default: "tiny_mce", null: false | ||
171 | end | 172 | end |
172 | 173 | ||
173 | add_index "articles", ["comments_count"], name: "index_articles_on_comments_count", using: :btree | 174 | add_index "articles", ["comments_count"], name: "index_articles_on_comments_count", using: :btree |
@@ -631,15 +632,16 @@ ActiveRecord::Schema.define(version: 20160705162914) do | @@ -631,15 +632,16 @@ ActiveRecord::Schema.define(version: 20160705162914) do | ||
631 | t.boolean "is_template", default: false | 632 | t.boolean "is_template", default: false |
632 | t.integer "template_id" | 633 | t.integer "template_id" |
633 | t.string "redirection_after_login" | 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 | t.string "personal_website" | 638 | t.string "personal_website" |
638 | t.string "jabber_id" | 639 | t.string "jabber_id" |
639 | t.integer "welcome_page_id" | 640 | t.integer "welcome_page_id" |
640 | t.boolean "allow_members_to_invite", default: true | 641 | t.boolean "allow_members_to_invite", default: true |
641 | t.boolean "invite_friends_only", default: false | 642 | t.boolean "invite_friends_only", default: false |
642 | t.boolean "secret", default: false | 643 | t.boolean "secret", default: false |
644 | + t.string "editor", default: "tiny_mce", null: false | ||
643 | end | 645 | end |
644 | 646 | ||
645 | add_index "profiles", ["activities_count"], name: "index_profiles_on_activities_count", using: :btree | 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,7 +155,7 @@ Feature: edit article | ||
155 | Given I am on joaosilva's control panel | 155 | Given I am on joaosilva's control panel |
156 | And I follow "Manage Content" | 156 | And I follow "Manage Content" |
157 | And I follow "New content" | 157 | And I follow "New content" |
158 | - When I follow "Text article with Textile markup language" | 158 | + When I follow "Text article" |
159 | Then I should see "Tag list" | 159 | Then I should see "Tag list" |
160 | When I fill in "Title" with "Article with tags" | 160 | When I fill in "Title" with "Article with tags" |
161 | And I fill in "Tag list" with "aurium, bug" | 161 | And I fill in "Tag list" with "aurium, bug" |
@@ -168,7 +168,7 @@ Feature: edit article | @@ -168,7 +168,7 @@ Feature: edit article | ||
168 | Given I am on joaosilva's control panel | 168 | Given I am on joaosilva's control panel |
169 | And I follow "Manage Content" | 169 | And I follow "Manage Content" |
170 | When I follow "New content" | 170 | When I follow "New content" |
171 | - When I follow "Text article with visual editor" | 171 | + When I follow "Text article" |
172 | And I fill in "Title" with "My Article" | 172 | And I fill in "Title" with "My Article" |
173 | And I press "Save" | 173 | And I press "Save" |
174 | Then I should see "My Article" | 174 | Then I should see "My Article" |
@@ -203,8 +203,8 @@ Feature: edit article | @@ -203,8 +203,8 @@ Feature: edit article | ||
203 | And I press "Save" | 203 | And I press "Save" |
204 | Then I should be on /joaosilva/my-folder | 204 | Then I should be on /joaosilva/my-folder |
205 | When I follow "New article" | 205 | When I follow "New article" |
206 | - And I should see "Text article with visual editor" | ||
207 | - And I follow "Text article with visual editor" | 206 | + And I should see "Text article" |
207 | + And I follow "Text article" | ||
208 | And I fill in "Title" with "My Article" | 208 | And I fill in "Title" with "My Article" |
209 | And I press "Save" | 209 | And I press "Save" |
210 | Then I should see "My Article" | 210 | Then I should see "My Article" |
@@ -222,12 +222,11 @@ Feature: edit article | @@ -222,12 +222,11 @@ Feature: edit article | ||
222 | And I press "Save" | 222 | And I press "Save" |
223 | Then I should be on /joaosilva/my-folder | 223 | Then I should be on /joaosilva/my-folder |
224 | When I follow "New article" | 224 | When I follow "New article" |
225 | - And I should see "Text article with visual editor" | ||
226 | - And I follow "Text article with visual editor" | 225 | + And I should see "Text article" |
226 | + And I follow "Text article" | ||
227 | And I follow "Cancel" within ".no-boxes" | 227 | And I follow "Cancel" within ".no-boxes" |
228 | Then I should be on /joaosilva/my-folder | 228 | Then I should be on /joaosilva/my-folder |
229 | 229 | ||
230 | - @selenium | ||
231 | Scenario: save and continue | 230 | Scenario: save and continue |
232 | Given I am on /joaosilva/save-the-whales | 231 | Given I am on /joaosilva/save-the-whales |
233 | And I follow "Edit" | 232 | And I follow "Edit" |
@@ -240,8 +239,8 @@ Feature: edit article | @@ -240,8 +239,8 @@ Feature: edit article | ||
240 | Given I am on joaosilva's control panel | 239 | Given I am on joaosilva's control panel |
241 | When I follow "Manage Content" | 240 | When I follow "Manage Content" |
242 | And I follow "New content" | 241 | And I follow "New content" |
243 | - And I should see "Text article with visual editor" | ||
244 | - And I follow "Text article with visual editor" | 242 | + And I should see "Text article" |
243 | + And I follow "Text article" | ||
245 | And I fill in "Title" with "My new article" | 244 | And I fill in "Title" with "My new article" |
246 | And I fill in "Text" with "text for the new article" | 245 | And I fill in "Text" with "text for the new article" |
247 | And I press "Save and continue" | 246 | And I press "Save and continue" |
@@ -287,7 +286,7 @@ Feature: edit article | @@ -287,7 +286,7 @@ Feature: edit article | ||
287 | Given I am on joaosilva's control panel | 286 | Given I am on joaosilva's control panel |
288 | And I follow "Manage Content" | 287 | And I follow "Manage Content" |
289 | And I follow "New content" | 288 | And I follow "New content" |
290 | - When I follow "Text article with visual editor" | 289 | + When I follow "Text article" |
291 | And I fill in "Title" with "My time testing Article" | 290 | And I fill in "Title" with "My time testing Article" |
292 | And I fill in "Publish date" with "1980-11-15 20:37" | 291 | And I fill in "Publish date" with "1980-11-15 20:37" |
293 | And I press "Save" | 292 | And I press "Save" |
features/forum.feature
@@ -99,8 +99,8 @@ Feature: forum | @@ -99,8 +99,8 @@ Feature: forum | ||
99 | And I check "Has terms of use:" | 99 | And I check "Has terms of use:" |
100 | And I press "Save" | 100 | And I press "Save" |
101 | When I follow "New discussion topic" | 101 | When I follow "New discussion topic" |
102 | - And I should see "Text article with visual editor" | ||
103 | - And I follow "Text article with visual editor" | 102 | + And I should see "Text article" |
103 | + And I follow "Text article" | ||
104 | And I fill in "Title" with "Topic" | 104 | And I fill in "Title" with "Topic" |
105 | And I press "Save" | 105 | And I press "Save" |
106 | And I am logged in as "mariasilva" | 106 | And I am logged in as "mariasilva" |
features/media_panel_upload_files.feature
@@ -8,7 +8,7 @@ Feature: uploads items on media panel | @@ -8,7 +8,7 @@ Feature: uploads items on media panel | ||
8 | | joaosilva | Joao Silva | | 8 | | joaosilva | Joao Silva | |
9 | And feature "media_panel" is enabled on environment | 9 | And feature "media_panel" is enabled on environment |
10 | And I am logged in as "joaosilva" | 10 | And I am logged in as "joaosilva" |
11 | - And I am on /myprofile/joaosilva/cms/new?type=TinyMceArticle | 11 | + And I am on /myprofile/joaosilva/cms/new?type=TextArticle |
12 | 12 | ||
13 | Scenario: see media panel collapsed | 13 | Scenario: see media panel collapsed |
14 | Then I should see "Insert media" | 14 | Then I should see "Insert media" |
@@ -123,7 +123,7 @@ Feature: uploads items on media panel | @@ -123,7 +123,7 @@ Feature: uploads items on media panel | ||
123 | Given the following files | 123 | Given the following files |
124 | | owner | file | mime | | 124 | | owner | file | mime | |
125 | | joaosilva | other-pic.jpg | image/jpeg | | 125 | | joaosilva | other-pic.jpg | image/jpeg | |
126 | - When I go to /myprofile/joaosilva/cms/new?type=TinyMceArticle | 126 | + When I go to /myprofile/joaosilva/cms/new?type=TextArticle |
127 | And I follow "Show/Hide" | 127 | And I follow "Show/Hide" |
128 | And I select "Recent media" from "parent_id" within "#published-media" | 128 | And I select "Recent media" from "parent_id" within "#published-media" |
129 | Then I should see div with title "other-pic.jpg" within ".items" | 129 | Then I should see div with title "other-pic.jpg" within ".items" |
@@ -148,7 +148,7 @@ Feature: uploads items on media panel | @@ -148,7 +148,7 @@ Feature: uploads items on media panel | ||
148 | | owner | file | mime | parent | | 148 | | owner | file | mime | parent | |
149 | | joaosilva | rails.png | image/png | other-gallery | | 149 | | joaosilva | rails.png | image/png | other-gallery | |
150 | | joaosilva | other-pic.jpg | image/jpeg | gallery | | 150 | | joaosilva | other-pic.jpg | image/jpeg | gallery | |
151 | - When I go to /myprofile/joaosilva/cms/new?type=TinyMceArticle | 151 | + When I go to /myprofile/joaosilva/cms/new?type=TextArticle |
152 | And I follow "Show/Hide" | 152 | And I follow "Show/Hide" |
153 | And I select "joaosilva/Gallery" from "parent_id" within "#published-media" | 153 | And I select "joaosilva/Gallery" from "parent_id" within "#published-media" |
154 | Then I should see div with title "other-pic.jpg" within ".items" | 154 | Then I should see div with title "other-pic.jpg" within ".items" |
@@ -165,7 +165,7 @@ Feature: uploads items on media panel | @@ -165,7 +165,7 @@ Feature: uploads items on media panel | ||
165 | And the following files | 165 | And the following files |
166 | | owner | file | mime | parent | | 166 | | owner | file | mime | parent | |
167 | | joaosilva | other-pic.jpg | image/jpeg | gallery | | 167 | | joaosilva | other-pic.jpg | image/jpeg | gallery | |
168 | - When I go to /myprofile/joaosilva/cms/new?type=TinyMceArticle | 168 | + When I go to /myprofile/joaosilva/cms/new?type=TextArticle |
169 | And I follow "Show/Hide" | 169 | And I follow "Show/Hide" |
170 | And I select "joaosilva/Gallery" from "parent_id" within "#published-media" | 170 | And I select "joaosilva/Gallery" from "parent_id" within "#published-media" |
171 | And I select "joaosilva/Gallery" from "parent_id" within "#media-upload-form" | 171 | And I select "joaosilva/Gallery" from "parent_id" within "#media-upload-form" |
@@ -187,7 +187,7 @@ Feature: uploads items on media panel | @@ -187,7 +187,7 @@ Feature: uploads items on media panel | ||
187 | And the following files | 187 | And the following files |
188 | | owner | file | mime | parent | | 188 | | owner | file | mime | parent | |
189 | | joaosilva | rails.png | image/png | other-gallery | | 189 | | joaosilva | rails.png | image/png | other-gallery | |
190 | - When I go to /myprofile/joaosilva/cms/new?type=TinyMceArticle | 190 | + When I go to /myprofile/joaosilva/cms/new?type=TextArticle |
191 | And I follow "Show/Hide" | 191 | And I follow "Show/Hide" |
192 | And I select "Recent media" from "parent_id" within "#published-media" | 192 | And I select "Recent media" from "parent_id" within "#published-media" |
193 | And I fill in "Search" with "rails" within "#published-media" | 193 | And I fill in "Search" with "rails" within "#published-media" |
@@ -227,7 +227,7 @@ Feature: uploads items on media panel | @@ -227,7 +227,7 @@ Feature: uploads items on media panel | ||
227 | | joaosilva | other-pic.jpg | image/jpeg | my-gallery | | 227 | | joaosilva | other-pic.jpg | image/jpeg | my-gallery | |
228 | | joaosilva | rails.png | image/png | gallery | | 228 | | joaosilva | rails.png | image/png | gallery | |
229 | | joaosilva | other-pic.jpg | image/jpeg | gallery | | 229 | | joaosilva | other-pic.jpg | image/jpeg | gallery | |
230 | - When I go to /myprofile/joaosilva/cms/new?type=TinyMceArticle | 230 | + When I go to /myprofile/joaosilva/cms/new?type=TextArticle |
231 | And I follow "Show/Hide" | 231 | And I follow "Show/Hide" |
232 | And I should not see "View all" | 232 | And I should not see "View all" |
233 | And I attach the file "public/503.jpg" to "file" | 233 | And I attach the file "public/503.jpg" to "file" |
features/new_content_on_cms.feature
@@ -15,8 +15,7 @@ Feature: create content on cms | @@ -15,8 +15,7 @@ Feature: create content on cms | ||
15 | 15 | ||
16 | Scenario: list all content types | 16 | Scenario: list all content types |
17 | Given I follow "New content" | 17 | Given I follow "New content" |
18 | - Then I should see "Text article with visual editor" | ||
19 | - And I should see "Text article with Textile markup" | 18 | + Then I should see "Text article" |
20 | And I should see "Folder" | 19 | And I should see "Folder" |
21 | And I should see "Blog" | 20 | And I should see "Blog" |
22 | And I should see "Uploaded file" | 21 | And I should see "Uploaded file" |
@@ -30,22 +29,6 @@ Feature: create content on cms | @@ -30,22 +29,6 @@ Feature: create content on cms | ||
30 | And I go to joaosilva's cms | 29 | And I go to joaosilva's cms |
31 | Then I should see "My Folder" | 30 | Then I should see "My Folder" |
32 | 31 | ||
33 | - Scenario: create a tiny_mce article | ||
34 | - Given I follow "New content" | ||
35 | - When I follow "Text article with visual editor" | ||
36 | - And I fill in "Title" with "My tiny_mce article" | ||
37 | - And I press "Save" | ||
38 | - And I go to joaosilva's cms | ||
39 | - Then I should see "My tiny_mce article" | ||
40 | - | ||
41 | - Scenario: create a textile article | ||
42 | - Given I follow "New content" | ||
43 | - When I follow "Text article with Textile markup" | ||
44 | - And I fill in "Title" with "My textile article" | ||
45 | - And I press "Save" | ||
46 | - And I go to joaosilva's cms | ||
47 | - Then I should see "My textile article" | ||
48 | - | ||
49 | Scenario: create a Blog | 32 | Scenario: create a Blog |
50 | Given I follow "New content" | 33 | Given I follow "New content" |
51 | When I follow "Blog" | 34 | When I follow "Blog" |
features/profile_search.feature
@@ -47,8 +47,8 @@ Feature: search inside a profile | @@ -47,8 +47,8 @@ Feature: search inside a profile | ||
47 | And I go to joaosilva's profile | 47 | And I go to joaosilva's profile |
48 | And I fill in "q" with "article" | 48 | And I fill in "q" with "article" |
49 | And I press "Search" | 49 | And I press "Search" |
50 | - Then I should see "public article" within ".main-block" | ||
51 | - And I should not see "private article" within ".main-block" | 50 | + Then I should see "published article" within ".main-block" |
51 | + And I should not see "unpublished article" within ".main-block" | ||
52 | 52 | ||
53 | Scenario: search on environment | 53 | Scenario: search on environment |
54 | Given I go to joaosilva's profile | 54 | Given I go to joaosilva's profile |
features/publish_article.feature
@@ -60,11 +60,10 @@ Feature: publish article | @@ -60,11 +60,10 @@ Feature: publish article | ||
60 | And I am on mariasilva's control panel | 60 | And I am on mariasilva's control panel |
61 | And I follow "Manage Content" | 61 | And I follow "Manage Content" |
62 | And I follow "New content" | 62 | And I follow "New content" |
63 | - And I should see "Text article with Textile markup language" | ||
64 | - And I follow "Text article with Textile markup language" | 63 | + And I should see "Text article" |
64 | + And I follow "Text article" | ||
65 | And I fill in the following: | 65 | And I fill in the following: |
66 | | Title | Sample Article | | 66 | | Title | Sample Article | |
67 | - | Text | this is Maria's first published article | | ||
68 | And I press "Save" | 67 | And I press "Save" |
69 | And I follow "Spread" | 68 | And I follow "Spread" |
70 | And I type in "Sample Community" into autocomplete list "search-communities-to-publish" and I choose "Sample Community" | 69 | And I type in "Sample Community" into autocomplete list "search-communities-to-publish" and I choose "Sample Community" |
features/search_contents.feature
@@ -22,7 +22,6 @@ Feature: search contents | @@ -22,7 +22,6 @@ Feature: search contents | ||
22 | Then I should see "whales and dolphins" within ".search-text-article-item" | 22 | Then I should see "whales and dolphins" within ".search-text-article-item" |
23 | And I should see "whales and dolphins" within ".only-one-result-box" | 23 | And I should see "whales and dolphins" within ".only-one-result-box" |
24 | And I should not see "bees and butterflies" | 24 | And I should not see "bees and butterflies" |
25 | - And The page should contain ".icon-content-textile-article" | ||
26 | When I follow "whales and dolphins" | 25 | When I follow "whales and dolphins" |
27 | Then I should be on article "whales and dolphins" | 26 | Then I should be on article "whales and dolphins" |
28 | 27 |
features/secret_community.feature
@@ -52,7 +52,7 @@ Feature: Use a secret community | @@ -52,7 +52,7 @@ Feature: Use a secret community | ||
52 | And I go to mycommunity's control panel | 52 | And I go to mycommunity's control panel |
53 | And I follow "Manage Content" | 53 | And I follow "Manage Content" |
54 | And I follow "New content" | 54 | And I follow "New content" |
55 | - And I follow "Text article with visual editor" | 55 | + And I follow "Text article" |
56 | And I fill in "Title" with "My public article" | 56 | And I fill in "Title" with "My public article" |
57 | And I choose "Public" | 57 | And I choose "Public" |
58 | And I press "Save and continue" | 58 | And I press "Save and continue" |
features/step_definitions/noosfero_steps.rb
@@ -101,7 +101,7 @@ end | @@ -101,7 +101,7 @@ end | ||
101 | 101 | ||
102 | Given /^the following (articles|events|blogs|folders|forums|galleries|uploaded files|rss feeds)$/ do |content, table| | 102 | Given /^the following (articles|events|blogs|folders|forums|galleries|uploaded files|rss feeds)$/ do |content, table| |
103 | klass = { | 103 | klass = { |
104 | - 'articles' => TextileArticle, | 104 | + 'articles' => TextArticle, |
105 | 'events' => Event, | 105 | 'events' => Event, |
106 | 'blogs' => Blog, | 106 | 'blogs' => Blog, |
107 | 'folders' => Folder, | 107 | 'folders' => Folder, |
@@ -178,7 +178,7 @@ Given /^the following articles? with images?$/ do |table| | @@ -178,7 +178,7 @@ Given /^the following articles? with images?$/ do |table| | ||
178 | img_tag = "<img " | 178 | img_tag = "<img " |
179 | img.each { |attr, value| img_tag += "#{attr}=\"#{value}\" " } | 179 | img.each { |attr, value| img_tag += "#{attr}=\"#{value}\" " } |
180 | img_tag += "/>" | 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 | if item[:parent] | 182 | if item[:parent] |
183 | article.parent = Article.find_by slug: item[:parent] | 183 | article.parent = Article.find_by slug: item[:parent] |
184 | end | 184 | end |
features/tiny_mce.feature
@@ -10,7 +10,7 @@ Feature: Create tinyMCE article | @@ -10,7 +10,7 @@ Feature: Create tinyMCE article | ||
10 | 10 | ||
11 | @selenium | 11 | @selenium |
12 | Scenario: mce complete mode should show on message creation | 12 | Scenario: mce complete mode should show on message creation |
13 | - Given I am on /myprofile/joaosilva/cms/new?type=TinyMceArticle | 13 | + Given I am on /myprofile/joaosilva/cms/new?type=TextArticle |
14 | Then The tinymce "toolbar1" should be "fullscreen | insertfile undo redo | copy paste | bold italic underline | styleselect fontsizeselect | forecolor backcolor | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image" | 14 | Then The tinymce "toolbar1" should be "fullscreen | insertfile undo redo | copy paste | bold italic underline | styleselect fontsizeselect | forecolor backcolor | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image" |
15 | And The tinymce "menubar" should be "edit insert view tools" | 15 | And The tinymce "menubar" should be "edit insert view tools" |
16 | And The tinymce "toolbar2" should contain "print preview code media | table" | 16 | And The tinymce "toolbar2" should contain "print preview code media | table" |
plugins/admin_notifications/views/shared/_form.html.erb
1 | <div class="notification-plugin-form"> | 1 | <div class="notification-plugin-form"> |
2 | 2 | ||
3 | - <% abstract_options = {:value => @notification.message, :style => 'width: 100%; height: 200px;', :class => 'mceEditor'} %> | 3 | + <% abstract_options = {:value => @notification.message, :style => 'width: 100%; height: 200px;', :class => current_editor('restricted')} %> |
4 | 4 | ||
5 | <%= button :back, _('Back'), :controller => 'admin_notifications_plugin_admin' %> | 5 | <%= button :back, _('Back'), :controller => 'admin_notifications_plugin_admin' %> |
6 | 6 | ||
7 | <%= form_for :notifications do |f| %> | 7 | <%= form_for :notifications do |f| %> |
8 | 8 | ||
9 | - <%= render :file => 'shared/tiny_mce', :locals => {:mode => 'restricted'} %> | ||
10 | - | ||
11 | <%= labelled_form_field(_("Optional Title:"), f.text_field(:title, value: @notification.title)) %> | 9 | <%= labelled_form_field(_("Optional Title:"), f.text_field(:title, value: @notification.title)) %> |
12 | 10 | ||
13 | <%= labelled_form_field(_("Enter your message here:"), f.text_area(:message, abstract_options)) %> | 11 | <%= labelled_form_field(_("Enter your message here:"), f.text_area(:message, abstract_options)) %> |
plugins/comment_paragraph/lib/comment_paragraph_plugin/macros/allow_comment.rb
1 | class Application < Rails::Application | 1 | class Application < Rails::Application |
2 | - config.action_view.sanitized_allowed_attributes << 'data-macro-paragraph_uuid' | 2 | + config.action_view.sanitized_allowed_attributes << 'data-macro-paragraph_uuid' unless config.action_view.sanitized_allowed_attributes.include?('data-macro-paragraph_uuid') |
3 | end | 3 | end |
4 | 4 | ||
5 | class CommentParagraphPlugin::AllowComment < Noosfero::Plugin::Macro | 5 | class CommentParagraphPlugin::AllowComment < Noosfero::Plugin::Macro |
plugins/comment_paragraph/test/unit/article_test.rb
@@ -5,7 +5,7 @@ class ArticleTest < ActiveSupport::TestCase | @@ -5,7 +5,7 @@ class ArticleTest < ActiveSupport::TestCase | ||
5 | 5 | ||
6 | def setup | 6 | def setup |
7 | @profile = fast_create(Community) | 7 | @profile = fast_create(Community) |
8 | - @article = fast_create(TinyMceArticle, :profile_id => profile.id) | 8 | + @article = fast_create(TextArticle, :profile_id => profile.id) |
9 | @environment = Environment.default | 9 | @environment = Environment.default |
10 | @environment.enable_plugin(CommentParagraphPlugin) | 10 | @environment.enable_plugin(CommentParagraphPlugin) |
11 | end | 11 | end |
plugins/comment_paragraph/test/unit/discussion_block_test.rb
@@ -74,7 +74,7 @@ class DiscussionBlockTest < ActiveSupport::TestCase | @@ -74,7 +74,7 @@ class DiscussionBlockTest < ActiveSupport::TestCase | ||
74 | b.save | 74 | b.save |
75 | a1 = fast_create(CommentParagraphPlugin::Discussion, :profile_id => community.id) | 75 | a1 = fast_create(CommentParagraphPlugin::Discussion, :profile_id => community.id) |
76 | fast_create(Event, :profile_id => community.id) | 76 | fast_create(Event, :profile_id => community.id) |
77 | - fast_create(TinyMceArticle, :profile_id => community.id) | 77 | + fast_create(TextArticle, :profile_id => community.id) |
78 | a2 = fast_create(CommentParagraphPlugin::Discussion, :profile_id => community.id) | 78 | a2 = fast_create(CommentParagraphPlugin::Discussion, :profile_id => community.id) |
79 | assert_equivalent [a1, a2], b.discussions | 79 | assert_equivalent [a1, a2], b.discussions |
80 | end | 80 | end |
@@ -183,7 +183,7 @@ class DiscussionBlockViewTest < ActionView::TestCase | @@ -183,7 +183,7 @@ class DiscussionBlockViewTest < ActionView::TestCase | ||
183 | b.save | 183 | b.save |
184 | a1 = fast_create(CommentParagraphPlugin::Discussion, :profile_id => community.id) | 184 | a1 = fast_create(CommentParagraphPlugin::Discussion, :profile_id => community.id) |
185 | fast_create(Event, :profile_id => community.id) | 185 | fast_create(Event, :profile_id => community.id) |
186 | - fast_create(TinyMceArticle, :profile_id => community.id) | 186 | + fast_create(TextArticle, :profile_id => community.id) |
187 | a2 = fast_create(CommentParagraphPlugin::Discussion, :profile_id => community.id) | 187 | a2 = fast_create(CommentParagraphPlugin::Discussion, :profile_id => community.id) |
188 | assert_equivalent [a2.id, a1.id], b.api_content['articles'].map {|a| a[:id]} | 188 | assert_equivalent [a2.id, a1.id], b.api_content['articles'].map {|a| a[:id]} |
189 | end | 189 | end |
plugins/comment_paragraph/test/unit/tinymce_helper_test.rb
@@ -7,6 +7,7 @@ class TinymceHelperTest < ActiveSupport::TestCase | @@ -7,6 +7,7 @@ class TinymceHelperTest < ActiveSupport::TestCase | ||
7 | def setup | 7 | def setup |
8 | expects(:top_url).returns('/') | 8 | expects(:top_url).returns('/') |
9 | expects(:tinymce_language).returns('en') | 9 | expects(:tinymce_language).returns('en') |
10 | + expects(:current_editor).returns(Article::Editor::TINY_MCE) | ||
10 | @plugins = mock | 11 | @plugins = mock |
11 | @plugins.expects(:dispatch).returns([]).at_least_once | 12 | @plugins.expects(:dispatch).returns([]).at_least_once |
12 | @environment = Environment.default | 13 | @environment = Environment.default |
plugins/community_track/lib/community_track_plugin/step.rb
@@ -61,7 +61,7 @@ class CommunityTrackPlugin::Step < Folder | @@ -61,7 +61,7 @@ class CommunityTrackPlugin::Step < Folder | ||
61 | end | 61 | end |
62 | 62 | ||
63 | def enabled_tools | 63 | def enabled_tools |
64 | - [TinyMceArticle, Forum] | 64 | + [TextArticle, Forum] |
65 | end | 65 | end |
66 | 66 | ||
67 | def to_html(options = {}) | 67 | def to_html(options = {}) |
plugins/community_track/test/functional/community_track_plugin_content_viewer_controller_test.rb
@@ -5,7 +5,7 @@ class ContentViewerControllerTest < ActionController::TestCase | @@ -5,7 +5,7 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
5 | def setup | 5 | def setup |
6 | @profile = Community.create!(:name => 'Sample community', :identifier => 'sample-community') | 6 | @profile = Community.create!(:name => 'Sample community', :identifier => 'sample-community') |
7 | @track = create_track('track', @profile) | 7 | @track = create_track('track', @profile) |
8 | - @step = CommunityTrackPlugin::Step.create!(:name => 'step1', :body => 'body', :profile => @profile, :parent => @track, :published => false, :end_date => DateTime.now.end_of_day, :start_date => DateTime.now.beginning_of_day, :tool_type => TinyMceArticle.name) | 8 | + @step = CommunityTrackPlugin::Step.create!(:name => 'step1', :body => 'body', :profile => @profile, :parent => @track, :published => false, :end_date => DateTime.now.end_of_day, :start_date => DateTime.now.beginning_of_day, :tool_type => TextArticle.name) |
9 | 9 | ||
10 | user = create_user('testinguser') | 10 | user = create_user('testinguser') |
11 | login_as(user.login) | 11 | login_as(user.login) |
@@ -49,7 +49,7 @@ class ContentViewerControllerTest < ActionController::TestCase | @@ -49,7 +49,7 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
49 | end | 49 | end |
50 | 50 | ||
51 | should 'show tools for a step' do | 51 | should 'show tools for a step' do |
52 | - TinyMceArticle.create!(:profile => @profile, :name => 'article', :parent => @step) | 52 | + TextArticle.create!(:profile => @profile, :name => 'article', :parent => @step) |
53 | get :view_page, @step.url | 53 | get :view_page, @step.url |
54 | assert_tag :tag => 'div', :attributes => { :class => 'tools' }, :descendant => { :tag => 'div', :attributes => { :class => 'item' } } | 54 | assert_tag :tag => 'div', :attributes => { :class => 'tools' }, :descendant => { :tag => 'div', :attributes => { :class => 'item' } } |
55 | end | 55 | end |
plugins/community_track/test/unit/community_track_plugin/step_test.rb
@@ -235,7 +235,7 @@ class StepTest < ActiveSupport::TestCase | @@ -235,7 +235,7 @@ class StepTest < ActiveSupport::TestCase | ||
235 | end | 235 | end |
236 | 236 | ||
237 | should 'return enabled tools for a step' do | 237 | should 'return enabled tools for a step' do |
238 | - assert_includes @step.enabled_tools, TinyMceArticle | 238 | + assert_includes @step.enabled_tools, TextArticle |
239 | assert_includes @step.enabled_tools, Forum | 239 | assert_includes @step.enabled_tools, Forum |
240 | end | 240 | end |
241 | 241 |
plugins/community_track/views/cms/community_track_plugin/_step.html.erb
1 | <%= required_fields_message %> | 1 | <%= required_fields_message %> |
2 | 2 | ||
3 | -<%= render :file => 'shared/tiny_mce' %> | ||
4 | - | ||
5 | <div> | 3 | <div> |
6 | <%= required f.text_field('name', :size => '64', :maxlength => 150) %> | 4 | <%= required f.text_field('name', :size => '64', :maxlength => 150) %> |
7 | <%= labelled_form_field(_('Period'), ( | 5 | <%= labelled_form_field(_('Period'), ( |
@@ -19,4 +17,4 @@ | @@ -19,4 +17,4 @@ | ||
19 | 17 | ||
20 | <%= labelled_form_field check_box(:article, :hidden) + _('Hidden Step'), '' %> | 18 | <%= labelled_form_field check_box(:article, :hidden) + _('Hidden Step'), '' %> |
21 | 19 | ||
22 | -<%= render :partial => 'shared/lead_and_body', :locals => {:tiny_mce => true, :body_label => 'Description:'} %> | 20 | +<%= render :partial => 'shared/lead_and_body', :locals => {:body_label => 'Description:'} %> |
plugins/community_track/views/cms/community_track_plugin/_track.html.erb
1 | <div class='community-track'> | 1 | <div class='community-track'> |
2 | <%= required_fields_message %> | 2 | <%= required_fields_message %> |
3 | 3 | ||
4 | - <%= render :file => 'shared/tiny_mce' %> | ||
5 | - | ||
6 | <div> | 4 | <div> |
7 | <%= required labelled_form_field(c_('Title'), text_field(:article, 'name', :size => '64', :maxlength => 150)) %> | 5 | <%= required labelled_form_field(c_('Title'), text_field(:article, 'name', :size => '64', :maxlength => 150)) %> |
8 | </div> | 6 | </div> |
9 | 7 | ||
10 | - <%= render :partial => 'shared/lead_and_body', :locals => {:tiny_mce => true, :body_label => 'Description:'} %> | 8 | + <%= render :partial => 'shared/lead_and_body', :locals => {:body_label => 'Description:'} %> |
11 | 9 | ||
12 | <div> | 10 | <div> |
13 | <%= labelled_form_field(_('Goals:'), text_area(:article, :goals, :rows => 3, :cols => 64)) %> | 11 | <%= labelled_form_field(_('Goals:'), text_area(:article, :goals, :rows => 3, :cols => 64)) %> |
plugins/context_content/lib/context_content_plugin/context_content_block.rb
@@ -22,7 +22,7 @@ class ContextContentPlugin::ContextContentBlock < Block | @@ -22,7 +22,7 @@ class ContextContentPlugin::ContextContentBlock < Block | ||
22 | end | 22 | end |
23 | 23 | ||
24 | def available_content_types | 24 | def available_content_types |
25 | - @available_content_types ||= [UploadedFile, Event, TinyMceArticle, TextileArticle, RawHTMLArticle, Folder, Blog, Forum, Gallery, RssFeed] + plugins.dispatch(:content_types) | 25 | + @available_content_types ||= [UploadedFile, Event, TextArticle, Folder, Blog, Forum, Gallery, RssFeed] + plugins.dispatch(:content_types) |
26 | checked_types = types.map {|t| t.constantize} | 26 | checked_types = types.map {|t| t.constantize} |
27 | checked_types + (@available_content_types - checked_types) | 27 | checked_types + (@available_content_types - checked_types) |
28 | end | 28 | end |
plugins/context_content/test/functional/content_viewer_controller_test.rb
@@ -8,7 +8,7 @@ class ContentViewerControllerTest < ActionController::TestCase | @@ -8,7 +8,7 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
8 | 8 | ||
9 | box = Box.create!(:owner => @profile) | 9 | box = Box.create!(:owner => @profile) |
10 | @block = ContextContentPlugin::ContextContentBlock.new(:box_id => box.id) | 10 | @block = ContextContentPlugin::ContextContentBlock.new(:box_id => box.id) |
11 | - @block.types = ['TinyMceArticle'] | 11 | + @block.types = ['TextArticle'] |
12 | @block.limit = 1 | 12 | @block.limit = 1 |
13 | @block.title = "New Context Block" | 13 | @block.title = "New Context Block" |
14 | @block.save! | 14 | @block.save! |
@@ -21,7 +21,7 @@ class ContentViewerControllerTest < ActionController::TestCase | @@ -21,7 +21,7 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
21 | end | 21 | end |
22 | 22 | ||
23 | should 'display context content block if it has contents' do | 23 | should 'display context content block if it has contents' do |
24 | - article = fast_create(TinyMceArticle, :parent_id => @page.id, :profile_id => @profile.id, :name => 'article1') | 24 | + article = fast_create(TextArticle, :parent_id => @page.id, :profile_id => @profile.id, :name => 'article1') |
25 | get :view_page, @page.url | 25 | get :view_page, @page.url |
26 | assert_tag 'div', :attributes => {:id => "context_content_#{@block.id}", :class => 'contents'} | 26 | assert_tag 'div', :attributes => {:id => "context_content_#{@block.id}", :class => 'contents'} |
27 | assert_no_tag 'div', :attributes => {:id => "context_content_more_#{@block.id}", :class => 'more_button'}, :descendant => {:tag => 'a'} | 27 | assert_no_tag 'div', :attributes => {:id => "context_content_more_#{@block.id}", :class => 'more_button'}, :descendant => {:tag => 'a'} |
@@ -31,7 +31,7 @@ class ContentViewerControllerTest < ActionController::TestCase | @@ -31,7 +31,7 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
31 | should 'display context content block title if it is not configured to use_parent_title' do | 31 | should 'display context content block title if it is not configured to use_parent_title' do |
32 | @block.use_parent_title = false | 32 | @block.use_parent_title = false |
33 | @block.save | 33 | @block.save |
34 | - article = fast_create(TinyMceArticle, :parent_id => @page.id, :profile_id => @profile.id, :name => 'article1') | 34 | + article = fast_create(TextArticle, :parent_id => @page.id, :profile_id => @profile.id, :name => 'article1') |
35 | get :view_page, @page.url | 35 | get :view_page, @page.url |
36 | assert_tag 'h3', :attributes => {:class => 'block-title'}, :content => @block.title | 36 | assert_tag 'h3', :attributes => {:class => 'block-title'}, :content => @block.title |
37 | assert_no_tag 'h3', :attributes => {:class => 'block-title'}, :content => @page.name | 37 | assert_no_tag 'h3', :attributes => {:class => 'block-title'}, :content => @page.name |
@@ -40,15 +40,15 @@ class ContentViewerControllerTest < ActionController::TestCase | @@ -40,15 +40,15 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
40 | should 'display context content with folder title if it is configured to use_parent_title' do | 40 | should 'display context content with folder title if it is configured to use_parent_title' do |
41 | @block.use_parent_title = true | 41 | @block.use_parent_title = true |
42 | @block.save | 42 | @block.save |
43 | - article = fast_create(TinyMceArticle, :parent_id => @page.id, :profile_id => @profile.id, :name => 'article1') | 43 | + article = fast_create(TextArticle, :parent_id => @page.id, :profile_id => @profile.id, :name => 'article1') |
44 | get :view_page, @page.url | 44 | get :view_page, @page.url |
45 | assert_tag 'h3', :attributes => {:class => 'block-title'}, :content => @page.name | 45 | assert_tag 'h3', :attributes => {:class => 'block-title'}, :content => @page.name |
46 | assert_no_tag 'h3', :attributes => {:class => 'block-title'}, :content => @block.title | 46 | assert_no_tag 'h3', :attributes => {:class => 'block-title'}, :content => @block.title |
47 | end | 47 | end |
48 | 48 | ||
49 | should 'display context content block with pagination' do | 49 | should 'display context content block with pagination' do |
50 | - article1 = fast_create(TinyMceArticle, :parent_id => @page.id, :profile_id => @profile.id) | ||
51 | - article2 = fast_create(TinyMceArticle, :parent_id => @page.id, :profile_id => @profile.id) | 50 | + article1 = fast_create(TextArticle, :parent_id => @page.id, :profile_id => @profile.id) |
51 | + article2 = fast_create(TextArticle, :parent_id => @page.id, :profile_id => @profile.id) | ||
52 | get :view_page, @page.url | 52 | get :view_page, @page.url |
53 | assert_tag 'div', :attributes => {:id => "context_content_#{@block.id}", :class => 'contents'} | 53 | assert_tag 'div', :attributes => {:id => "context_content_#{@block.id}", :class => 'contents'} |
54 | assert_tag 'div', :attributes => {:id => "context_content_more_#{@block.id}", :class => 'more_button'}, :descendant => {:tag => 'a', :attributes => {:class => 'button icon-button icon-left disabled'} } | 54 | assert_tag 'div', :attributes => {:id => "context_content_more_#{@block.id}", :class => 'more_button'}, :descendant => {:tag => 'a', :attributes => {:class => 'button icon-button icon-left disabled'} } |
plugins/context_content/test/functional/context_content_plugin_profile_controller_test.rb
@@ -9,7 +9,7 @@ class ContextContentPluginProfileControllerTest < ActionController::TestCase | @@ -9,7 +9,7 @@ class ContextContentPluginProfileControllerTest < ActionController::TestCase | ||
9 | box = create(Box, :owner_type => 'Profile', :owner_id => @profile.id) | 9 | box = create(Box, :owner_type => 'Profile', :owner_id => @profile.id) |
10 | @block = ContextContentPlugin::ContextContentBlock.new | 10 | @block = ContextContentPlugin::ContextContentBlock.new |
11 | @block.box = box | 11 | @block.box = box |
12 | - @block.types = ['TinyMceArticle'] | 12 | + @block.types = ['TextArticle'] |
13 | @block.limit = 1 | 13 | @block.limit = 1 |
14 | owner = create_user('block-owner').person | 14 | owner = create_user('block-owner').person |
15 | @block.box = owner.boxes.last | 15 | @block.box = owner.boxes.last |
@@ -23,14 +23,14 @@ class ContextContentPluginProfileControllerTest < ActionController::TestCase | @@ -23,14 +23,14 @@ class ContextContentPluginProfileControllerTest < ActionController::TestCase | ||
23 | end | 23 | end |
24 | 24 | ||
25 | should 'render error if page do not exists' do | 25 | should 'render error if page do not exists' do |
26 | - article = fast_create(TinyMceArticle, :parent_id => @page.id, :profile_id => @profile.id) | 26 | + article = fast_create(TextArticle, :parent_id => @page.id, :profile_id => @profile.id) |
27 | xhr :get, :view_content, :id => @block.id, :article_id => @page.id, :page => 2, :profile => @profile.identifier | 27 | xhr :get, :view_content, :id => @block.id, :article_id => @page.id, :page => 2, :profile => @profile.identifier |
28 | assert_response 500 | 28 | assert_response 500 |
29 | end | 29 | end |
30 | 30 | ||
31 | should 'replace div with content for page passed as parameter' do | 31 | should 'replace div with content for page passed as parameter' do |
32 | - article1 = fast_create(TinyMceArticle, :parent_id => @page.id, :profile_id => @profile.id, :name => 'article1') | ||
33 | - article2 = fast_create(TinyMceArticle, :parent_id => @page.id, :profile_id => @profile.id, :name => 'article2') | 32 | + article1 = fast_create(TextArticle, :parent_id => @page.id, :profile_id => @profile.id, :name => 'article1') |
33 | + article2 = fast_create(TextArticle, :parent_id => @page.id, :profile_id => @profile.id, :name => 'article2') | ||
34 | xhr :get, :view_content, :id => @block.id, :article_id => @page.id, :page => 2, :profile => @profile.identifier | 34 | xhr :get, :view_content, :id => @block.id, :article_id => @page.id, :page => 2, :profile => @profile.identifier |
35 | assert_response :success | 35 | assert_response :success |
36 | assert_match /context_content_#{@block.id}/, @response.body | 36 | assert_match /context_content_#{@block.id}/, @response.body |
@@ -39,7 +39,7 @@ class ContextContentPluginProfileControllerTest < ActionController::TestCase | @@ -39,7 +39,7 @@ class ContextContentPluginProfileControllerTest < ActionController::TestCase | ||
39 | end | 39 | end |
40 | 40 | ||
41 | should 'do not render pagination buttons if it has only one page' do | 41 | should 'do not render pagination buttons if it has only one page' do |
42 | - article1 = fast_create(TinyMceArticle, :parent_id => @page.id, :profile_id => @profile.id, :name => 'article1') | 42 | + article1 = fast_create(TextArticle, :parent_id => @page.id, :profile_id => @profile.id, :name => 'article1') |
43 | xhr :get, :view_content, :id => @block.id, :article_id => @page.id, :page => 2, :profile => @profile.identifier | 43 | xhr :get, :view_content, :id => @block.id, :article_id => @page.id, :page => 2, :profile => @profile.identifier |
44 | assert_no_match /context_content_more_#{@block.id}/, @response.body | 44 | assert_no_match /context_content_more_#{@block.id}/, @response.body |
45 | end | 45 | end |
plugins/context_content/test/functional/profile_design_controller_test.rb
@@ -13,7 +13,7 @@ class ProfileDesignControllerTest < ActionController::TestCase | @@ -13,7 +13,7 @@ class ProfileDesignControllerTest < ActionController::TestCase | ||
13 | 13 | ||
14 | box = Box.create!(:owner => @profile) | 14 | box = Box.create!(:owner => @profile) |
15 | @block = ContextContentPlugin::ContextContentBlock.new(:box_id => box.id) | 15 | @block = ContextContentPlugin::ContextContentBlock.new(:box_id => box.id) |
16 | - @block.types = ['TinyMceArticle'] | 16 | + @block.types = ['TextArticle'] |
17 | @block.limit = 1 | 17 | @block.limit = 1 |
18 | @block.save! | 18 | @block.save! |
19 | 19 | ||
@@ -38,11 +38,11 @@ class ProfileDesignControllerTest < ActionController::TestCase | @@ -38,11 +38,11 @@ class ProfileDesignControllerTest < ActionController::TestCase | ||
38 | @block.show_parent_content = false | 38 | @block.show_parent_content = false |
39 | @block.save! | 39 | @block.save! |
40 | get :edit, :id => @block.id, :profile => @profile.identifier | 40 | get :edit, :id => @block.id, :profile => @profile.identifier |
41 | - post :save, :id => @block.id, :block => {:title => 'context', :show_image => '0', :show_name => '0', :show_parent_content => '0', :types => ['TinyMceArticle', '', nil, 'Folder'] }, :profile => @profile.identifier | 41 | + post :save, :id => @block.id, :block => {:title => 'context', :show_image => '0', :show_name => '0', :show_parent_content => '0', :types => ['TextArticle', '', nil, 'Folder'] }, :profile => @profile.identifier |
42 | @block.reload | 42 | @block.reload |
43 | assert_equal 'context', @block.title | 43 | assert_equal 'context', @block.title |
44 | refute @block.show_image && !@block.show_name && !@block.show_parent_content | 44 | refute @block.show_image && !@block.show_name && !@block.show_parent_content |
45 | - assert_equal ['TinyMceArticle', 'Folder'], @block.types | 45 | + assert_equal ['TextArticle', 'Folder'], @block.types |
46 | end | 46 | end |
47 | 47 | ||
48 | end | 48 | end |
plugins/context_content/test/unit/context_content_block_test.rb
@@ -5,7 +5,7 @@ class ContextContentBlockTest < ActiveSupport::TestCase | @@ -5,7 +5,7 @@ class ContextContentBlockTest < ActiveSupport::TestCase | ||
5 | def setup | 5 | def setup |
6 | Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([]) | 6 | Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([]) |
7 | @block = ContextContentPlugin::ContextContentBlock.create! | 7 | @block = ContextContentPlugin::ContextContentBlock.create! |
8 | - @block.types = ['TinyMceArticle'] | 8 | + @block.types = ['TextArticle'] |
9 | end | 9 | end |
10 | 10 | ||
11 | should 'describe itself' do | 11 | should 'describe itself' do |
@@ -22,13 +22,13 @@ class ContextContentBlockTest < ActiveSupport::TestCase | @@ -22,13 +22,13 @@ class ContextContentBlockTest < ActiveSupport::TestCase | ||
22 | 22 | ||
23 | should 'return children of page' do | 23 | should 'return children of page' do |
24 | folder = fast_create(Folder) | 24 | folder = fast_create(Folder) |
25 | - article = fast_create(TinyMceArticle, :parent_id => folder.id) | 25 | + article = fast_create(TextArticle, :parent_id => folder.id) |
26 | assert_equal [article], @block.contents(folder) | 26 | assert_equal [article], @block.contents(folder) |
27 | end | 27 | end |
28 | 28 | ||
29 | should 'return parent name of the contents' do | 29 | should 'return parent name of the contents' do |
30 | folder = fast_create(Folder, :name => " New Folder") | 30 | folder = fast_create(Folder, :name => " New Folder") |
31 | - article = fast_create(TinyMceArticle, :parent_id => folder.id) | 31 | + article = fast_create(TextArticle, :parent_id => folder.id) |
32 | assert_equal folder.name, @block.parent_title([article]) | 32 | assert_equal folder.name, @block.parent_title([article]) |
33 | end | 33 | end |
34 | 34 | ||
@@ -39,40 +39,40 @@ class ContextContentBlockTest < ActiveSupport::TestCase | @@ -39,40 +39,40 @@ class ContextContentBlockTest < ActiveSupport::TestCase | ||
39 | should 'limit number of children to display' do | 39 | should 'limit number of children to display' do |
40 | @block.limit = 2 | 40 | @block.limit = 2 |
41 | folder = fast_create(Folder) | 41 | folder = fast_create(Folder) |
42 | - article1 = fast_create(TinyMceArticle, :parent_id => folder.id) | ||
43 | - article2 = fast_create(TinyMceArticle, :parent_id => folder.id) | ||
44 | - article3 = fast_create(TinyMceArticle, :parent_id => folder.id) | 42 | + article1 = fast_create(TextArticle, :parent_id => folder.id) |
43 | + article2 = fast_create(TextArticle, :parent_id => folder.id) | ||
44 | + article3 = fast_create(TextArticle, :parent_id => folder.id) | ||
45 | assert_equal 2, @block.contents(folder).length | 45 | assert_equal 2, @block.contents(folder).length |
46 | end | 46 | end |
47 | 47 | ||
48 | should 'show contents for next page' do | 48 | should 'show contents for next page' do |
49 | @block.limit = 2 | 49 | @block.limit = 2 |
50 | folder = fast_create(Folder) | 50 | folder = fast_create(Folder) |
51 | - article1 = fast_create(TinyMceArticle, :name => 'article 1', :parent_id => folder.id) | ||
52 | - article2 = fast_create(TinyMceArticle, :name => 'article 2', :parent_id => folder.id) | ||
53 | - article3 = fast_create(TinyMceArticle, :name => 'article 3', :parent_id => folder.id) | 51 | + article1 = fast_create(TextArticle, :name => 'article 1', :parent_id => folder.id) |
52 | + article2 = fast_create(TextArticle, :name => 'article 2', :parent_id => folder.id) | ||
53 | + article3 = fast_create(TextArticle, :name => 'article 3', :parent_id => folder.id) | ||
54 | assert_equal [article3], @block.contents(folder, 2) | 54 | assert_equal [article3], @block.contents(folder, 2) |
55 | end | 55 | end |
56 | 56 | ||
57 | should 'show parent contents for next page' do | 57 | should 'show parent contents for next page' do |
58 | @block.limit = 2 | 58 | @block.limit = 2 |
59 | folder = fast_create(Folder) | 59 | folder = fast_create(Folder) |
60 | - article1 = fast_create(TinyMceArticle, :name => 'article 1', :parent_id => folder.id) | ||
61 | - article2 = fast_create(TinyMceArticle, :name => 'article 2', :parent_id => folder.id) | ||
62 | - article3 = fast_create(TinyMceArticle, :name => 'article 3', :parent_id => folder.id) | 60 | + article1 = fast_create(TextArticle, :name => 'article 1', :parent_id => folder.id) |
61 | + article2 = fast_create(TextArticle, :name => 'article 2', :parent_id => folder.id) | ||
62 | + article3 = fast_create(TextArticle, :name => 'article 3', :parent_id => folder.id) | ||
63 | assert_equal [article3], @block.contents(article1, 2) | 63 | assert_equal [article3], @block.contents(article1, 2) |
64 | end | 64 | end |
65 | 65 | ||
66 | should 'return parent children if page has no children' do | 66 | should 'return parent children if page has no children' do |
67 | folder = fast_create(Folder) | 67 | folder = fast_create(Folder) |
68 | - article = fast_create(TinyMceArticle, :parent_id => folder.id) | 68 | + article = fast_create(TextArticle, :parent_id => folder.id) |
69 | assert_equal [article], @block.contents(article) | 69 | assert_equal [article], @block.contents(article) |
70 | end | 70 | end |
71 | 71 | ||
72 | should 'do not return parent children if show_parent_content is false' do | 72 | should 'do not return parent children if show_parent_content is false' do |
73 | @block.show_parent_content = false | 73 | @block.show_parent_content = false |
74 | folder = fast_create(Folder) | 74 | folder = fast_create(Folder) |
75 | - article = fast_create(TinyMceArticle, :parent_id => folder.id) | 75 | + article = fast_create(TextArticle, :parent_id => folder.id) |
76 | assert_equal [], @block.contents(article) | 76 | assert_equal [], @block.contents(article) |
77 | end | 77 | end |
78 | 78 | ||
@@ -82,13 +82,13 @@ class ContextContentBlockTest < ActiveSupport::TestCase | @@ -82,13 +82,13 @@ class ContextContentBlockTest < ActiveSupport::TestCase | ||
82 | end | 82 | end |
83 | 83 | ||
84 | should 'return available content types with checked types first' do | 84 | should 'return available content types with checked types first' do |
85 | - @block.types = ['TinyMceArticle', 'Folder'] | ||
86 | - assert_equal [TinyMceArticle, Folder, UploadedFile, Event, TextileArticle, RawHTMLArticle, Blog, Forum, Gallery, RssFeed], @block.available_content_types | 85 | + @block.types = ['TextArticle', 'Folder'] |
86 | + assert_equal [TextArticle, Folder, UploadedFile, Event, Blog, Forum, Gallery, RssFeed], @block.available_content_types | ||
87 | end | 87 | end |
88 | 88 | ||
89 | should 'return available content types' do | 89 | should 'return available content types' do |
90 | @block.types = [] | 90 | @block.types = [] |
91 | - assert_equal [UploadedFile, Event, TinyMceArticle, TextileArticle, RawHTMLArticle, Folder, Blog, Forum, Gallery, RssFeed], @block.available_content_types | 91 | + assert_equal [UploadedFile, Event, TextArticle, Folder, Blog, Forum, Gallery, RssFeed], @block.available_content_types |
92 | end | 92 | end |
93 | 93 | ||
94 | should 'return first 2 content types' do | 94 | should 'return first 2 content types' do |
@@ -120,7 +120,7 @@ class ContextContentBlockTest < ActiveSupport::TestCase | @@ -120,7 +120,7 @@ class ContextContentBlockTest < ActiveSupport::TestCase | ||
120 | Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([SomePlugin.new]) | 120 | Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([SomePlugin.new]) |
121 | 121 | ||
122 | @block.types = [] | 122 | @block.types = [] |
123 | - assert_equal [UploadedFile, Event, TinyMceArticle, TextileArticle, RawHTMLArticle, Folder, Blog, Forum, Gallery, RssFeed, SomePluginContent], @block.available_content_types | 123 | + assert_equal [UploadedFile, Event, TextArticle, Folder, Blog, Forum, Gallery, RssFeed, SomePluginContent], @block.available_content_types |
124 | end | 124 | end |
125 | 125 | ||
126 | should 'return box owner on profile method call' do | 126 | should 'return box owner on profile method call' do |
@@ -144,7 +144,7 @@ class ContextContentBlockViewTest < ActionView::TestCase | @@ -144,7 +144,7 @@ class ContextContentBlockViewTest < ActionView::TestCase | ||
144 | def setup | 144 | def setup |
145 | Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([]) | 145 | Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([]) |
146 | @block = ContextContentPlugin::ContextContentBlock.create! | 146 | @block = ContextContentPlugin::ContextContentBlock.create! |
147 | - @block.types = ['TinyMceArticle'] | 147 | + @block.types = ['TextArticle'] |
148 | end | 148 | end |
149 | 149 | ||
150 | should 'render nothing if it has no content to show' do | 150 | should 'render nothing if it has no content to show' do |
@@ -153,7 +153,7 @@ class ContextContentBlockViewTest < ActionView::TestCase | @@ -153,7 +153,7 @@ class ContextContentBlockViewTest < ActionView::TestCase | ||
153 | 153 | ||
154 | should 'render context content block view' do | 154 | should 'render context content block view' do |
155 | @page = fast_create(Folder) | 155 | @page = fast_create(Folder) |
156 | - article = fast_create(TinyMceArticle, :parent_id => @page.id) | 156 | + article = fast_create(TextArticle, :parent_id => @page.id) |
157 | contents = [article] | 157 | contents = [article] |
158 | @block.use_parent_title = true | 158 | @block.use_parent_title = true |
159 | 159 | ||
@@ -178,9 +178,9 @@ class ContextContentBlockViewTest < ActionView::TestCase | @@ -178,9 +178,9 @@ class ContextContentBlockViewTest < ActionView::TestCase | ||
178 | should 'display pagination links if it has more than one page' do | 178 | should 'display pagination links if it has more than one page' do |
179 | @block.limit = 2 | 179 | @block.limit = 2 |
180 | @page = fast_create(Folder) | 180 | @page = fast_create(Folder) |
181 | - article1 = fast_create(TinyMceArticle, :parent_id => @page.id) | ||
182 | - article2 = fast_create(TinyMceArticle, :parent_id => @page.id) | ||
183 | - article3 = fast_create(TinyMceArticle, :parent_id => @page.id) | 181 | + article1 = fast_create(TextArticle, :parent_id => @page.id) |
182 | + article2 = fast_create(TextArticle, :parent_id => @page.id) | ||
183 | + article3 = fast_create(TextArticle, :parent_id => @page.id) | ||
184 | contents = [article1, article2, article3] | 184 | contents = [article1, article2, article3] |
185 | contents.each do |article| | 185 | contents.each do |article| |
186 | article.expects(:view_url).returns('http://test.noosfero.plugins') | 186 | article.expects(:view_url).returns('http://test.noosfero.plugins') |
plugins/custom_forms/test/functional/custom_forms_plugin_myprofile_controller_test.rb
@@ -180,8 +180,9 @@ class CustomFormsPluginMyprofileControllerTest < ActionController::TestCase | @@ -180,8 +180,9 @@ class CustomFormsPluginMyprofileControllerTest < ActionController::TestCase | ||
180 | form = CustomFormsPlugin::Form.create!(:profile => profile, :name => 'Free Software') | 180 | form = CustomFormsPlugin::Form.create!(:profile => profile, :name => 'Free Software') |
181 | 181 | ||
182 | get :edit, :profile => profile.identifier, :id => form.id | 182 | get :edit, :profile => profile.identifier, :id => form.id |
183 | + expects(:current_editor).returns(Article::Editor::TINY_MCE) | ||
183 | 184 | ||
184 | - assert_tag :tag => 'textarea', :attributes => { :id => 'form_description', :class => 'mceEditor' } | 185 | + assert_tag :tag => 'textarea', :attributes => { :id => 'form_description', :class => /#{current_editor}/ } |
185 | end | 186 | end |
186 | 187 | ||
187 | should 'export submissions as csv' do | 188 | should 'export submissions as csv' do |
plugins/custom_forms/views/custom_forms_plugin_myprofile/_form.html.erb
1 | <% self.extend(CustomFormsPlugin::Helper) %> | 1 | <% self.extend(CustomFormsPlugin::Helper) %> |
2 | -<%= render :file => 'shared/tiny_mce', :locals => {:mode => 'simple'} %> | ||
3 | 2 | ||
4 | <%= error_messages_for :form %> | 3 | <%= error_messages_for :form %> |
5 | <%= required labelled_form_field _('Name'), f.text_field(:name) %> | 4 | <%= required labelled_form_field _('Name'), f.text_field(:name) %> |
@@ -17,7 +16,7 @@ | @@ -17,7 +16,7 @@ | ||
17 | <%= labelled_check_box _('Triggered after membership'), 'form[on_membership]', '1', @form.on_membership %> | 16 | <%= labelled_check_box _('Triggered after membership'), 'form[on_membership]', '1', @form.on_membership %> |
18 | </p> | 17 | </p> |
19 | <% end %> | 18 | <% end %> |
20 | -<%= labelled_form_field c_('Description'), f.text_area(:description, :style => 'width: 100%', :class => 'mceEditor') %> | 19 | +<%= labelled_form_field c_('Description'), f.text_area(:description, :style => 'width: 100%', :class => current_editor('simple')) %> |
21 | 20 | ||
22 | <h2><%= c_('Fields') %></h2> | 21 | <h2><%= c_('Fields') %></h2> |
23 | 22 |
plugins/delivery/views/delivery_plugin/admin_method/_edit.html.slim
@@ -12,7 +12,7 @@ | @@ -12,7 +12,7 @@ | ||
12 | = labelled_field f, :name, t('delivery_plugin.models.method.name'), f.text_field(:name), | 12 | = labelled_field f, :name, t('delivery_plugin.models.method.name'), f.text_field(:name), |
13 | help: t('delivery_plugin.models.method.name_help') | 13 | help: t('delivery_plugin.models.method.name_help') |
14 | = labelled_field f, :description, t('delivery_plugin.models.method.instructions'), | 14 | = labelled_field f, :description, t('delivery_plugin.models.method.instructions'), |
15 | - f.text_area(:description, rows: 5, class: 'mceEditor'), help: t('delivery_plugin.models.method.instructions_help') | 15 | + f.text_area(:description, rows: 5, class: current_editor('simple')), help: t('delivery_plugin.models.method.instructions_help') |
16 | 16 | ||
17 | fieldset | 17 | fieldset |
18 | legend= t'delivery_plugin.models.method.costs_legend' | 18 | legend= t'delivery_plugin.models.method.costs_legend' |
@@ -34,5 +34,3 @@ | @@ -34,5 +34,3 @@ | ||
34 | = submit_button :save, if delivery_method.new_record? then t('delivery_plugin.views.method.edit.add') else t('delivery_plugin.views.method.edit.save') end | 34 | = submit_button :save, if delivery_method.new_record? then t('delivery_plugin.views.method.edit.add') else t('delivery_plugin.views.method.edit.save') end |
35 | = link_to_function t('delivery_plugin.views.method.edit.back'), "delivery.method.view.toggle()" | 35 | = link_to_function t('delivery_plugin.views.method.edit.back'), "delivery.method.view.toggle()" |
36 | 36 | ||
37 | -= render file: 'shared/tiny_mce', locals: {mode: 'simple'} | ||
38 | - |
plugins/display_content/lib/display_content_block.rb
@@ -24,7 +24,7 @@ class DisplayContentBlock < Block | @@ -24,7 +24,7 @@ class DisplayContentBlock < Block | ||
24 | {:value => 'title', :checked => true}, | 24 | {:value => 'title', :checked => true}, |
25 | {:value => 'abstract', :checked => true}] | 25 | {:value => 'abstract', :checked => true}] |
26 | settings_items :display_folder_children, :type => :boolean, :default => true | 26 | settings_items :display_folder_children, :type => :boolean, :default => true |
27 | - settings_items :types, :type => Array, :default => ['TextileArticle', 'TinyMceArticle', 'RawHTMLArticle'] | 27 | + settings_items :types, :type => Array, :default => ['TextArticle'] |
28 | settings_items :order_by_recent, :type => :boolean, :default => :true | 28 | settings_items :order_by_recent, :type => :boolean, :default => :true |
29 | settings_items :content_with_translations, :type => :boolean, :default => :true | 29 | settings_items :content_with_translations, :type => :boolean, :default => :true |
30 | settings_items :limit_to_show, :type => :integer, :default => 6 | 30 | settings_items :limit_to_show, :type => :integer, :default => 6 |
@@ -61,7 +61,7 @@ class DisplayContentBlock < Block | @@ -61,7 +61,7 @@ class DisplayContentBlock < Block | ||
61 | end | 61 | end |
62 | 62 | ||
63 | def available_content_types | 63 | def available_content_types |
64 | - @available_content_types ||= [TinyMceArticle, RawHTMLArticle, TextileArticle, UploadedFile, Event, Folder, Blog, Forum, Gallery, RssFeed] + plugins.dispatch(:content_types) | 64 | + @available_content_types ||= [TextArticle, UploadedFile, Event, Folder, Blog, Forum, Gallery, RssFeed] + plugins.dispatch(:content_types) |
65 | checked_types = types.map {|t| t.constantize} | 65 | checked_types = types.map {|t| t.constantize} |
66 | checked_types + (@available_content_types - checked_types) | 66 | checked_types + (@available_content_types - checked_types) |
67 | end | 67 | end |
@@ -108,7 +108,7 @@ class DisplayContentBlock < Block | @@ -108,7 +108,7 @@ class DisplayContentBlock < Block | ||
108 | @parent_nodes ||= self.holder.articles.where(:id => nodes).map { |article| get_parent(article) }.compact.flatten | 108 | @parent_nodes ||= self.holder.articles.where(:id => nodes).map { |article| get_parent(article) }.compact.flatten |
109 | end | 109 | end |
110 | 110 | ||
111 | - VALID_CONTENT = ['RawHTMLArticle', 'TextArticle', 'TextileArticle', 'TinyMceArticle', 'Folder', 'Blog', 'Forum'] | 111 | + VALID_CONTENT = ['TextArticle', 'Folder', 'Blog', 'Forum'] |
112 | 112 | ||
113 | include Noosfero::Plugin::HotSpot | 113 | include Noosfero::Plugin::HotSpot |
114 | 114 |
plugins/display_content/test/functional/display_content_plugin_admin_controller_test.rb
@@ -39,7 +39,7 @@ class DisplayContentPluginAdminControllerTest < ActionController::TestCase | @@ -39,7 +39,7 @@ class DisplayContentPluginAdminControllerTest < ActionController::TestCase | ||
39 | 39 | ||
40 | should 'index action returns an json with node content' do | 40 | should 'index action returns an json with node content' do |
41 | Article.delete_all | 41 | Article.delete_all |
42 | - article = fast_create(TextileArticle, :name => 'test article 1', :profile_id => environment.portal_community.id) | 42 | + article = fast_create(TextArticle, :name => 'test article 1', :profile_id => environment.portal_community.id) |
43 | 43 | ||
44 | get :index, :block_id => block.id | 44 | get :index, :block_id => block.id |
45 | json_response = ActiveSupport::JSON.decode(@response.body) | 45 | json_response = ActiveSupport::JSON.decode(@response.body) |
@@ -51,7 +51,7 @@ class DisplayContentPluginAdminControllerTest < ActionController::TestCase | @@ -51,7 +51,7 @@ class DisplayContentPluginAdminControllerTest < ActionController::TestCase | ||
51 | 51 | ||
52 | should 'index action returns an json with node checked if the node is in the nodes list' do | 52 | should 'index action returns an json with node checked if the node is in the nodes list' do |
53 | Article.delete_all | 53 | Article.delete_all |
54 | - article = fast_create(TextileArticle, :name => 'test article 1', :profile_id => environment.portal_community.id) | 54 | + article = fast_create(TextArticle, :name => 'test article 1', :profile_id => environment.portal_community.id) |
55 | block.nodes= [article.id] | 55 | block.nodes= [article.id] |
56 | block.save! | 56 | block.save! |
57 | 57 | ||
@@ -67,8 +67,8 @@ class DisplayContentPluginAdminControllerTest < ActionController::TestCase | @@ -67,8 +67,8 @@ class DisplayContentPluginAdminControllerTest < ActionController::TestCase | ||
67 | should 'index action returns an json with node undetermined if the node is in the parent nodes list' do | 67 | should 'index action returns an json with node undetermined if the node is in the parent nodes list' do |
68 | Article.delete_all | 68 | Article.delete_all |
69 | f = fast_create(Folder, :name => 'test folder 1', :profile_id => environment.portal_community.id) | 69 | f = fast_create(Folder, :name => 'test folder 1', :profile_id => environment.portal_community.id) |
70 | - article = fast_create(TextileArticle, :name => 'test article 1', :profile_id => environment.portal_community.id, :parent_id => f.id) | ||
71 | - article2 = fast_create(TextileArticle, :name => 'test article 2', :profile_id => environment.portal_community.id, :parent_id => f.id) | 70 | + article = fast_create(TextArticle, :name => 'test article 1', :profile_id => environment.portal_community.id, :parent_id => f.id) |
71 | + article2 = fast_create(TextArticle, :name => 'test article 2', :profile_id => environment.portal_community.id, :parent_id => f.id) | ||
72 | block.nodes = [article.id] | 72 | block.nodes = [article.id] |
73 | block.save! | 73 | block.save! |
74 | 74 | ||
@@ -81,7 +81,7 @@ class DisplayContentPluginAdminControllerTest < ActionController::TestCase | @@ -81,7 +81,7 @@ class DisplayContentPluginAdminControllerTest < ActionController::TestCase | ||
81 | should 'index action returns an json with node closed if the node has article with children' do | 81 | should 'index action returns an json with node closed if the node has article with children' do |
82 | Article.delete_all | 82 | Article.delete_all |
83 | f = fast_create(Folder, :name => 'test folder 1', :profile_id => environment.portal_community.id) | 83 | f = fast_create(Folder, :name => 'test folder 1', :profile_id => environment.portal_community.id) |
84 | - article = fast_create(TextileArticle, :name => 'test article 1', :profile_id => environment.portal_community.id, :parent_id => f.id) | 84 | + article = fast_create(TextArticle, :name => 'test article 1', :profile_id => environment.portal_community.id, :parent_id => f.id) |
85 | 85 | ||
86 | get :index, :block_id => block.id | 86 | get :index, :block_id => block.id |
87 | json_response = ActiveSupport::JSON.decode(@response.body) | 87 | json_response = ActiveSupport::JSON.decode(@response.body) |
@@ -95,8 +95,8 @@ class DisplayContentPluginAdminControllerTest < ActionController::TestCase | @@ -95,8 +95,8 @@ class DisplayContentPluginAdminControllerTest < ActionController::TestCase | ||
95 | should 'index action returns an json with all the children nodes if some parent is in the parents list' do | 95 | should 'index action returns an json with all the children nodes if some parent is in the parents list' do |
96 | Article.delete_all | 96 | Article.delete_all |
97 | f = fast_create(Folder, :name => 'test folder 1', :profile_id => environment.portal_community.id) | 97 | f = fast_create(Folder, :name => 'test folder 1', :profile_id => environment.portal_community.id) |
98 | - a1 = fast_create(TextileArticle, :name => 'test article 1', :profile_id => environment.portal_community.id, :parent_id => f.id) | ||
99 | - a2 = fast_create(TextileArticle, :name => 'test article 2', :profile_id => environment.portal_community.id, :parent_id => f.id) | 98 | + a1 = fast_create(TextArticle, :name => 'test article 1', :profile_id => environment.portal_community.id, :parent_id => f.id) |
99 | + a2 = fast_create(TextArticle, :name => 'test article 2', :profile_id => environment.portal_community.id, :parent_id => f.id) | ||
100 | block.checked_nodes= {a1.id => true} | 100 | block.checked_nodes= {a1.id => true} |
101 | block.save! | 101 | block.save! |
102 | 102 | ||
@@ -118,9 +118,9 @@ class DisplayContentPluginAdminControllerTest < ActionController::TestCase | @@ -118,9 +118,9 @@ class DisplayContentPluginAdminControllerTest < ActionController::TestCase | ||
118 | should 'index action returns an json with all the children nodes and root nodes if some parent is in the parents list and there is others root articles' do | 118 | should 'index action returns an json with all the children nodes and root nodes if some parent is in the parents list and there is others root articles' do |
119 | Article.delete_all | 119 | Article.delete_all |
120 | f = fast_create(Folder, :name => 'test folder 1', :profile_id => environment.portal_community.id) | 120 | f = fast_create(Folder, :name => 'test folder 1', :profile_id => environment.portal_community.id) |
121 | - a1 = fast_create(TextileArticle, :name => 'test article 1', :profile_id => environment.portal_community.id, :parent_id => f.id) | ||
122 | - a2 = fast_create(TextileArticle, :name => 'test article 2', :profile_id => environment.portal_community.id, :parent_id => f.id) | ||
123 | - a3 = fast_create(TextileArticle, :name => 'test article 3', :profile_id => environment.portal_community.id) | 121 | + a1 = fast_create(TextArticle, :name => 'test article 1', :profile_id => environment.portal_community.id, :parent_id => f.id) |
122 | + a2 = fast_create(TextArticle, :name => 'test article 2', :profile_id => environment.portal_community.id, :parent_id => f.id) | ||
123 | + a3 = fast_create(TextArticle, :name => 'test article 3', :profile_id => environment.portal_community.id) | ||
124 | block.checked_nodes= {a2.id => true, a3.id => true} | 124 | block.checked_nodes= {a2.id => true, a3.id => true} |
125 | block.save! | 125 | block.save! |
126 | 126 | ||
@@ -148,9 +148,9 @@ class DisplayContentPluginAdminControllerTest < ActionController::TestCase | @@ -148,9 +148,9 @@ class DisplayContentPluginAdminControllerTest < ActionController::TestCase | ||
148 | should 'index action returns an json without children nodes if the parent is not in the parents list' do | 148 | should 'index action returns an json without children nodes if the parent is not in the parents list' do |
149 | Article.delete_all | 149 | Article.delete_all |
150 | f = fast_create(Folder, :name => 'test folder 1', :profile_id => environment.portal_community.id) | 150 | f = fast_create(Folder, :name => 'test folder 1', :profile_id => environment.portal_community.id) |
151 | - a1 = fast_create(TextileArticle, :name => 'test article 1', :profile_id => environment.portal_community.id, :parent_id => f.id) | ||
152 | - a2 = fast_create(TextileArticle, :name => 'test article 2', :profile_id => environment.portal_community.id, :parent_id => f.id) | ||
153 | - a3 = fast_create(TextileArticle, :name => 'test article 3', :profile_id => environment.portal_community.id) | 151 | + a1 = fast_create(TextArticle, :name => 'test article 1', :profile_id => environment.portal_community.id, :parent_id => f.id) |
152 | + a2 = fast_create(TextArticle, :name => 'test article 2', :profile_id => environment.portal_community.id, :parent_id => f.id) | ||
153 | + a3 = fast_create(TextArticle, :name => 'test article 3', :profile_id => environment.portal_community.id) | ||
154 | 154 | ||
155 | get :index, :block_id => block.id | 155 | get :index, :block_id => block.id |
156 | json_response = ActiveSupport::JSON.decode(@response.body) | 156 | json_response = ActiveSupport::JSON.decode(@response.body) |
plugins/display_content/test/functional/display_content_plugin_myprofile_controller_test.rb
@@ -40,7 +40,7 @@ class DisplayContentPluginMyprofileControllerTest < ActionController::TestCase | @@ -40,7 +40,7 @@ class DisplayContentPluginMyprofileControllerTest < ActionController::TestCase | ||
40 | 40 | ||
41 | should 'index action returns an json with node content' do | 41 | should 'index action returns an json with node content' do |
42 | Article.delete_all | 42 | Article.delete_all |
43 | - article = fast_create(TextileArticle, :name => 'test article 1', :profile_id => profile.id) | 43 | + article = fast_create(TextArticle, :name => 'test article 1', :profile_id => profile.id) |
44 | 44 | ||
45 | get :index, :block_id => block.id, :profile => profile.identifier | 45 | get :index, :block_id => block.id, :profile => profile.identifier |
46 | json_response = ActiveSupport::JSON.decode(@response.body) | 46 | json_response = ActiveSupport::JSON.decode(@response.body) |
@@ -52,7 +52,7 @@ class DisplayContentPluginMyprofileControllerTest < ActionController::TestCase | @@ -52,7 +52,7 @@ class DisplayContentPluginMyprofileControllerTest < ActionController::TestCase | ||
52 | 52 | ||
53 | should 'index action returns an json with node checked if the node is in the nodes list' do | 53 | should 'index action returns an json with node checked if the node is in the nodes list' do |
54 | Article.delete_all | 54 | Article.delete_all |
55 | - article = fast_create(TextileArticle, :name => 'test article 1', :profile_id => profile.id) | 55 | + article = fast_create(TextArticle, :name => 'test article 1', :profile_id => profile.id) |
56 | block.nodes= [article.id] | 56 | block.nodes= [article.id] |
57 | block.save! | 57 | block.save! |
58 | 58 | ||
@@ -68,8 +68,8 @@ class DisplayContentPluginMyprofileControllerTest < ActionController::TestCase | @@ -68,8 +68,8 @@ class DisplayContentPluginMyprofileControllerTest < ActionController::TestCase | ||
68 | should 'index action returns an json with node undetermined if the node is in the parent nodes list' do | 68 | should 'index action returns an json with node undetermined if the node is in the parent nodes list' do |
69 | Article.delete_all | 69 | Article.delete_all |
70 | f = fast_create(Folder, :name => 'test folder 1', :profile_id => profile.id) | 70 | f = fast_create(Folder, :name => 'test folder 1', :profile_id => profile.id) |
71 | - article = fast_create(TextileArticle, :name => 'test article 1', :profile_id => profile.id, :parent_id => f.id) | ||
72 | - article2 = fast_create(TextileArticle, :name => 'test article 2', :profile_id => profile.id, :parent_id => f.id) | 71 | + article = fast_create(TextArticle, :name => 'test article 1', :profile_id => profile.id, :parent_id => f.id) |
72 | + article2 = fast_create(TextArticle, :name => 'test article 2', :profile_id => profile.id, :parent_id => f.id) | ||
73 | block.nodes = [article.id] | 73 | block.nodes = [article.id] |
74 | block.save! | 74 | block.save! |
75 | 75 | ||
@@ -82,7 +82,7 @@ class DisplayContentPluginMyprofileControllerTest < ActionController::TestCase | @@ -82,7 +82,7 @@ class DisplayContentPluginMyprofileControllerTest < ActionController::TestCase | ||
82 | should 'index action returns an json with node closed if the node has article with children' do | 82 | should 'index action returns an json with node closed if the node has article with children' do |
83 | Article.delete_all | 83 | Article.delete_all |
84 | f = fast_create(Folder, :name => 'test folder 1', :profile_id => profile.id) | 84 | f = fast_create(Folder, :name => 'test folder 1', :profile_id => profile.id) |
85 | - article = fast_create(TextileArticle, :name => 'test article 1', :profile_id => profile.id, :parent_id => f.id) | 85 | + article = fast_create(TextArticle, :name => 'test article 1', :profile_id => profile.id, :parent_id => f.id) |
86 | block.save! | 86 | block.save! |
87 | 87 | ||
88 | get :index, :block_id => block.id, :profile => profile.identifier | 88 | get :index, :block_id => block.id, :profile => profile.identifier |
@@ -97,8 +97,8 @@ class DisplayContentPluginMyprofileControllerTest < ActionController::TestCase | @@ -97,8 +97,8 @@ class DisplayContentPluginMyprofileControllerTest < ActionController::TestCase | ||
97 | should 'index action returns an json with all the children nodes if some parent is in the parents list' do | 97 | should 'index action returns an json with all the children nodes if some parent is in the parents list' do |
98 | Article.delete_all | 98 | Article.delete_all |
99 | f = fast_create(Folder, :name => 'test folder 1', :profile_id => profile.id) | 99 | f = fast_create(Folder, :name => 'test folder 1', :profile_id => profile.id) |
100 | - a1 = fast_create(TextileArticle, :name => 'test article 1', :profile_id => profile.id, :parent_id => f.id) | ||
101 | - a2 = fast_create(TextileArticle, :name => 'test article 2', :profile_id => profile.id, :parent_id => f.id) | 100 | + a1 = fast_create(TextArticle, :name => 'test article 1', :profile_id => profile.id, :parent_id => f.id) |
101 | + a2 = fast_create(TextArticle, :name => 'test article 2', :profile_id => profile.id, :parent_id => f.id) | ||
102 | block.checked_nodes = {a1.id => true} | 102 | block.checked_nodes = {a1.id => true} |
103 | block.save! | 103 | block.save! |
104 | 104 | ||
@@ -120,9 +120,9 @@ class DisplayContentPluginMyprofileControllerTest < ActionController::TestCase | @@ -120,9 +120,9 @@ class DisplayContentPluginMyprofileControllerTest < ActionController::TestCase | ||
120 | should 'index action returns an json with all the children nodes and root nodes if some parent is in the parents list and there is others root articles' do | 120 | should 'index action returns an json with all the children nodes and root nodes if some parent is in the parents list and there is others root articles' do |
121 | Article.delete_all | 121 | Article.delete_all |
122 | f = fast_create(Folder, :name => 'test folder 1', :profile_id => profile.id) | 122 | f = fast_create(Folder, :name => 'test folder 1', :profile_id => profile.id) |
123 | - a1 = fast_create(TextileArticle, :name => 'test article 1', :profile_id => profile.id, :parent_id => f.id) | ||
124 | - a2 = fast_create(TextileArticle, :name => 'test article 2', :profile_id => profile.id, :parent_id => f.id) | ||
125 | - a3 = fast_create(TextileArticle, :name => 'test article 3', :profile_id => profile.id) | 123 | + a1 = fast_create(TextArticle, :name => 'test article 1', :profile_id => profile.id, :parent_id => f.id) |
124 | + a2 = fast_create(TextArticle, :name => 'test article 2', :profile_id => profile.id, :parent_id => f.id) | ||
125 | + a3 = fast_create(TextArticle, :name => 'test article 3', :profile_id => profile.id) | ||
126 | block.checked_nodes = {a1.id => true} | 126 | block.checked_nodes = {a1.id => true} |
127 | block.save! | 127 | block.save! |
128 | 128 | ||
@@ -150,9 +150,9 @@ class DisplayContentPluginMyprofileControllerTest < ActionController::TestCase | @@ -150,9 +150,9 @@ class DisplayContentPluginMyprofileControllerTest < ActionController::TestCase | ||
150 | should 'index action returns an json without children nodes if the parent is not in the parents list' do | 150 | should 'index action returns an json without children nodes if the parent is not in the parents list' do |
151 | Article.delete_all | 151 | Article.delete_all |
152 | f = fast_create(Folder, :name => 'test folder 1', :profile_id => profile.id) | 152 | f = fast_create(Folder, :name => 'test folder 1', :profile_id => profile.id) |
153 | - a1 = fast_create(TextileArticle, :name => 'test article 1', :profile_id => profile.id, :parent_id => f.id) | ||
154 | - a2 = fast_create(TextileArticle, :name => 'test article 2', :profile_id => profile.id, :parent_id => f.id) | ||
155 | - a3 = fast_create(TextileArticle, :name => 'test article 3', :profile_id => profile.id) | 153 | + a1 = fast_create(TextArticle, :name => 'test article 1', :profile_id => profile.id, :parent_id => f.id) |
154 | + a2 = fast_create(TextArticle, :name => 'test article 2', :profile_id => profile.id, :parent_id => f.id) | ||
155 | + a3 = fast_create(TextArticle, :name => 'test article 3', :profile_id => profile.id) | ||
156 | 156 | ||
157 | get :index, :block_id => block.id, :profile => profile.identifier | 157 | get :index, :block_id => block.id, :profile => profile.identifier |
158 | json_response = ActiveSupport::JSON.decode(@response.body) | 158 | json_response = ActiveSupport::JSON.decode(@response.body) |
plugins/display_content/test/unit/display_content_block_test.rb
@@ -2,7 +2,7 @@ require_relative '../test_helper' | @@ -2,7 +2,7 @@ require_relative '../test_helper' | ||
2 | class DisplayContentBlockTest < ActiveSupport::TestCase | 2 | class DisplayContentBlockTest < ActiveSupport::TestCase |
3 | 3 | ||
4 | INVALID_KIND_OF_ARTICLE = [Event, RssFeed, UploadedFile, Gallery] | 4 | INVALID_KIND_OF_ARTICLE = [Event, RssFeed, UploadedFile, Gallery] |
5 | - VALID_KIND_OF_ARTICLE = [RawHTMLArticle, TextArticle, TextileArticle, TinyMceArticle, Folder, Blog, Forum] | 5 | + VALID_KIND_OF_ARTICLE = [TextArticle, Folder, Blog, Forum] |
6 | 6 | ||
7 | should 'describe itself' do | 7 | should 'describe itself' do |
8 | assert_not_equal Block.description, DisplayContentBlock.description | 8 | assert_not_equal Block.description, DisplayContentBlock.description |
@@ -39,9 +39,9 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | @@ -39,9 +39,9 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | ||
39 | should 'nodes be the article ids in hash of checked nodes' do | 39 | should 'nodes be the article ids in hash of checked nodes' do |
40 | profile = create_user('testuser').person | 40 | profile = create_user('testuser').person |
41 | Article.delete_all | 41 | Article.delete_all |
42 | - a1 = fast_create(TextileArticle, :name => 'test article 1', :profile_id => profile.id) | ||
43 | - a2 = fast_create(TextileArticle, :name => 'test article 2', :profile_id => profile.id) | ||
44 | - a3 = fast_create(TextileArticle, :name => 'test article 3', :profile_id => profile.id) | 42 | + a1 = fast_create(TextArticle, :name => 'test article 1', :profile_id => profile.id) |
43 | + a2 = fast_create(TextArticle, :name => 'test article 2', :profile_id => profile.id) | ||
44 | + a3 = fast_create(TextArticle, :name => 'test article 3', :profile_id => profile.id) | ||
45 | 45 | ||
46 | checked_articles= {a1.id => true, a2.id => true, a3.id => false} | 46 | checked_articles= {a1.id => true, a2.id => true, a3.id => false} |
47 | block = DisplayContentBlock.new | 47 | block = DisplayContentBlock.new |
@@ -54,9 +54,9 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | @@ -54,9 +54,9 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | ||
54 | should 'nodes be save in database' do | 54 | should 'nodes be save in database' do |
55 | profile = create_user('testuser').person | 55 | profile = create_user('testuser').person |
56 | Article.delete_all | 56 | Article.delete_all |
57 | - a1 = fast_create(TextileArticle, :name => 'test article 1', :profile_id => profile.id) | ||
58 | - a2 = fast_create(TextileArticle, :name => 'test article 2', :profile_id => profile.id) | ||
59 | - a3 = fast_create(TextileArticle, :name => 'test article 3', :profile_id => profile.id) | 57 | + a1 = fast_create(TextArticle, :name => 'test article 1', :profile_id => profile.id) |
58 | + a2 = fast_create(TextArticle, :name => 'test article 2', :profile_id => profile.id) | ||
59 | + a3 = fast_create(TextArticle, :name => 'test article 3', :profile_id => profile.id) | ||
60 | 60 | ||
61 | checked_articles= {a1.id => true, a2.id => true, a3.id => false} | 61 | checked_articles= {a1.id => true, a2.id => true, a3.id => false} |
62 | block = DisplayContentBlock.new | 62 | block = DisplayContentBlock.new |
@@ -71,10 +71,10 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | @@ -71,10 +71,10 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | ||
71 | should 'be able to update nodes' do | 71 | should 'be able to update nodes' do |
72 | profile = create_user('testuser').person | 72 | profile = create_user('testuser').person |
73 | Article.delete_all | 73 | Article.delete_all |
74 | - a1 = fast_create(TextileArticle, :name => 'test article 1', :profile_id => profile.id) | ||
75 | - a2 = fast_create(TextileArticle, :name => 'test article 2', :profile_id => profile.id) | ||
76 | - a3 = fast_create(TextileArticle, :name => 'test article 3', :profile_id => profile.id) | ||
77 | - a4 = fast_create(TextileArticle, :name => 'test article 4', :profile_id => profile.id) | 74 | + a1 = fast_create(TextArticle, :name => 'test article 1', :profile_id => profile.id) |
75 | + a2 = fast_create(TextArticle, :name => 'test article 2', :profile_id => profile.id) | ||
76 | + a3 = fast_create(TextArticle, :name => 'test article 3', :profile_id => profile.id) | ||
77 | + a4 = fast_create(TextArticle, :name => 'test article 4', :profile_id => profile.id) | ||
78 | 78 | ||
79 | checked_articles= {a1.id => true, a2.id => true, a3.id => false} | 79 | checked_articles= {a1.id => true, a2.id => true, a3.id => false} |
80 | block = DisplayContentBlock.new | 80 | block = DisplayContentBlock.new |
@@ -95,13 +95,13 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | @@ -95,13 +95,13 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | ||
95 | should "save selected folders and articles" do | 95 | should "save selected folders and articles" do |
96 | profile = create_user('testuser').person | 96 | profile = create_user('testuser').person |
97 | Article.delete_all | 97 | Article.delete_all |
98 | - a1 = fast_create(TextileArticle, :name => 'test article 1', :profile_id => profile.id) | ||
99 | - a2 = fast_create(TextileArticle, :name => 'test article 2', :profile_id => profile.id) | 98 | + a1 = fast_create(TextArticle, :name => 'test article 1', :profile_id => profile.id) |
99 | + a2 = fast_create(TextArticle, :name => 'test article 2', :profile_id => profile.id) | ||
100 | f1 = fast_create(Folder, :name => 'test folder 1', :profile_id => profile.id) | 100 | f1 = fast_create(Folder, :name => 'test folder 1', :profile_id => profile.id) |
101 | - a3 = fast_create(TextileArticle, :name => 'test article 3', :profile_id => profile.id, :parent_id => f1.id) | 101 | + a3 = fast_create(TextArticle, :name => 'test article 3', :profile_id => profile.id, :parent_id => f1.id) |
102 | f2 = fast_create(Folder, :name => 'test folder 1', :profile_id => profile.id, :parent_id => f1.id) | 102 | f2 = fast_create(Folder, :name => 'test folder 1', :profile_id => profile.id, :parent_id => f1.id) |
103 | - a4 = fast_create(TextileArticle, :name => 'test article 4', :profile_id => profile.id, :parent_id => f2.id) | ||
104 | - a5 = fast_create(TextileArticle, :name => 'test article 5', :profile_id => profile.id, :parent_id => f2.id) | 103 | + a4 = fast_create(TextArticle, :name => 'test article 4', :profile_id => profile.id, :parent_id => f2.id) |
104 | + a5 = fast_create(TextArticle, :name => 'test article 5', :profile_id => profile.id, :parent_id => f2.id) | ||
105 | 105 | ||
106 | checked_articles= {a1.id => true, a2.id => true, f1.id => false} | 106 | checked_articles= {a1.id => true, a2.id => true, f1.id => false} |
107 | 107 | ||
@@ -115,13 +115,13 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | @@ -115,13 +115,13 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | ||
115 | should "save selected articles and blogs" do | 115 | should "save selected articles and blogs" do |
116 | profile = create_user('testuser').person | 116 | profile = create_user('testuser').person |
117 | Article.delete_all | 117 | Article.delete_all |
118 | - a1 = fast_create(TextileArticle, :name => 'test article 1', :profile_id => profile.id) | ||
119 | - a2 = fast_create(TextileArticle, :name => 'test article 2', :profile_id => profile.id) | 118 | + a1 = fast_create(TextArticle, :name => 'test article 1', :profile_id => profile.id) |
119 | + a2 = fast_create(TextArticle, :name => 'test article 2', :profile_id => profile.id) | ||
120 | b1 = fast_create(Blog, :name => 'test blog 1', :profile_id => profile.id) | 120 | b1 = fast_create(Blog, :name => 'test blog 1', :profile_id => profile.id) |
121 | - a3 = fast_create(TextileArticle, :name => 'test article 3', :profile_id => profile.id, :parent_id => b1.id) | 121 | + a3 = fast_create(TextArticle, :name => 'test article 3', :profile_id => profile.id, :parent_id => b1.id) |
122 | b2 = fast_create(Blog, :name => 'test blog 2', :profile_id => profile.id) | 122 | b2 = fast_create(Blog, :name => 'test blog 2', :profile_id => profile.id) |
123 | - a4 = fast_create(TextileArticle, :name => 'test article 4', :profile_id => profile.id, :parent_id => b2.id) | ||
124 | - a5 = fast_create(TextileArticle, :name => 'test article 5', :profile_id => profile.id, :parent_id => b2.id) | 123 | + a4 = fast_create(TextArticle, :name => 'test article 4', :profile_id => profile.id, :parent_id => b2.id) |
124 | + a5 = fast_create(TextArticle, :name => 'test article 5', :profile_id => profile.id, :parent_id => b2.id) | ||
125 | 125 | ||
126 | checked_articles= {a1.id => true, a2.id => true, b1.id => false, b2.id => true} | 126 | checked_articles= {a1.id => true, a2.id => true, b1.id => false, b2.id => true} |
127 | 127 | ||
@@ -132,36 +132,10 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | @@ -132,36 +132,10 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | ||
132 | assert_equivalent [a1.id, a2.id, b1.id, b2.id], block.nodes | 132 | assert_equivalent [a1.id, a2.id, b1.id, b2.id], block.nodes |
133 | end | 133 | end |
134 | 134 | ||
135 | - should 'TextileArticle be saved as node' do | 135 | + should 'TextArticle be saved as node' do |
136 | profile = create_user('testuser').person | 136 | profile = create_user('testuser').person |
137 | Article.delete_all | 137 | Article.delete_all |
138 | - a1 = fast_create(TextileArticle, :name => 'test article 1', :profile_id => profile.id) | ||
139 | - | ||
140 | - checked_articles= {a1.id => true} | ||
141 | - block = DisplayContentBlock.new | ||
142 | - block.stubs(:holder).returns(profile) | ||
143 | - block.checked_nodes= checked_articles | ||
144 | - assert_equal [], [a1.id] - block.nodes | ||
145 | - assert_equal [], block.nodes - [a1.id] | ||
146 | - end | ||
147 | - | ||
148 | - should 'TinyMceArticle be saved as node' do | ||
149 | - profile = create_user('testuser').person | ||
150 | - Article.delete_all | ||
151 | - a1 = fast_create(TinyMceArticle, :name => 'test article 1', :profile_id => profile.id) | ||
152 | - | ||
153 | - checked_articles= {a1.id => true} | ||
154 | - block = DisplayContentBlock.new | ||
155 | - block.stubs(:holder).returns(profile) | ||
156 | - block.checked_nodes= checked_articles | ||
157 | - assert_equal [], [a1.id] - block.nodes | ||
158 | - assert_equal [], block.nodes - [a1.id] | ||
159 | - end | ||
160 | - | ||
161 | - should 'RawHTMLArticle be saved as node' do | ||
162 | - profile = create_user('testuser').person | ||
163 | - Article.delete_all | ||
164 | - a1 = fast_create(RawHTMLArticle, :name => 'test article 1', :profile_id => profile.id) | 138 | + a1 = fast_create(TextArticle, :name => 'test article 1', :profile_id => profile.id) |
165 | 139 | ||
166 | checked_articles= {a1.id => true} | 140 | checked_articles= {a1.id => true} |
167 | block = DisplayContentBlock.new | 141 | block = DisplayContentBlock.new |
@@ -230,9 +204,9 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | @@ -230,9 +204,9 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | ||
230 | should "return all root articles from profile" do | 204 | should "return all root articles from profile" do |
231 | profile = create_user('testuser').person | 205 | profile = create_user('testuser').person |
232 | Article.delete_all | 206 | Article.delete_all |
233 | - a1 = fast_create(TextileArticle, :name => 'test article 1', :profile_id => profile.id) | ||
234 | - a2 = fast_create(TextileArticle, :name => 'test article 2', :profile_id => profile.id) | ||
235 | - a3 = fast_create(TextileArticle, :name => 'test article 3', :profile_id => profile.id, :parent_id => a2.id) | 207 | + a1 = fast_create(TextArticle, :name => 'test article 1', :profile_id => profile.id) |
208 | + a2 = fast_create(TextArticle, :name => 'test article 2', :profile_id => profile.id) | ||
209 | + a3 = fast_create(TextArticle, :name => 'test article 3', :profile_id => profile.id, :parent_id => a2.id) | ||
236 | 210 | ||
237 | block = DisplayContentBlock.new | 211 | block = DisplayContentBlock.new |
238 | block.nodes= [a1.id, a2.id, a3.id] | 212 | block.nodes= [a1.id, a2.id, a3.id] |
@@ -247,9 +221,9 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | @@ -247,9 +221,9 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | ||
247 | should "return all children of an articles's profile" do | 221 | should "return all children of an articles's profile" do |
248 | profile = create_user('testuser').person | 222 | profile = create_user('testuser').person |
249 | Article.delete_all | 223 | Article.delete_all |
250 | - a1 = fast_create(TextileArticle, :name => 'test article 1', :profile_id => profile.id) | ||
251 | - a2 = fast_create(TextileArticle, :name => 'test article 2', :profile_id => profile.id) | ||
252 | - a3 = fast_create(TextileArticle, :name => 'test article 3', :profile_id => profile.id, :parent_id => a2.id) | 224 | + a1 = fast_create(TextArticle, :name => 'test article 1', :profile_id => profile.id) |
225 | + a2 = fast_create(TextArticle, :name => 'test article 2', :profile_id => profile.id) | ||
226 | + a3 = fast_create(TextArticle, :name => 'test article 3', :profile_id => profile.id, :parent_id => a2.id) | ||
253 | 227 | ||
254 | block = DisplayContentBlock.new | 228 | block = DisplayContentBlock.new |
255 | box = mock() | 229 | box = mock() |
@@ -264,9 +238,9 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | @@ -264,9 +238,9 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | ||
264 | profile = fast_create(Community, :name => 'my test community', :identifier => 'mytestcommunity') | 238 | profile = fast_create(Community, :name => 'my test community', :identifier => 'mytestcommunity') |
265 | environment = Environment.default | 239 | environment = Environment.default |
266 | Article.delete_all | 240 | Article.delete_all |
267 | - a1 = fast_create(TextileArticle, :name => 'test article 1', :profile_id => profile.id) | ||
268 | - a2 = fast_create(TextileArticle, :name => 'test article 2', :profile_id => profile.id) | ||
269 | - a3 = fast_create(TextileArticle, :name => 'test article 3', :profile_id => profile.id, :parent_id => a2.id) | 241 | + a1 = fast_create(TextArticle, :name => 'test article 1', :profile_id => profile.id) |
242 | + a2 = fast_create(TextArticle, :name => 'test article 2', :profile_id => profile.id) | ||
243 | + a3 = fast_create(TextArticle, :name => 'test article 3', :profile_id => profile.id, :parent_id => a2.id) | ||
270 | 244 | ||
271 | block = DisplayContentBlock.new | 245 | block = DisplayContentBlock.new |
272 | box = mock() | 246 | box = mock() |
@@ -283,9 +257,9 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | @@ -283,9 +257,9 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | ||
283 | profile = fast_create(Community, :name => 'my test community', :identifier => 'mytestcommunity') | 257 | profile = fast_create(Community, :name => 'my test community', :identifier => 'mytestcommunity') |
284 | environment = Environment.default | 258 | environment = Environment.default |
285 | Article.delete_all | 259 | Article.delete_all |
286 | - a1 = fast_create(TextileArticle, :name => 'test article 1', :profile_id => profile.id) | ||
287 | - a2 = fast_create(TextileArticle, :name => 'test article 2', :profile_id => profile.id) | ||
288 | - a3 = fast_create(TextileArticle, :name => 'test article 3', :profile_id => profile.id, :parent_id => a2.id) | 260 | + a1 = fast_create(TextArticle, :name => 'test article 1', :profile_id => profile.id) |
261 | + a2 = fast_create(TextArticle, :name => 'test article 2', :profile_id => profile.id) | ||
262 | + a3 = fast_create(TextArticle, :name => 'test article 3', :profile_id => profile.id, :parent_id => a2.id) | ||
289 | 263 | ||
290 | block = DisplayContentBlock.new | 264 | block = DisplayContentBlock.new |
291 | box = mock() | 265 | box = mock() |
@@ -404,9 +378,9 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | @@ -404,9 +378,9 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | ||
404 | profile = create_user('testuser').person | 378 | profile = create_user('testuser').person |
405 | Article.delete_all | 379 | Article.delete_all |
406 | f1 = fast_create(Folder, :name => 'test folder 1', :profile_id => profile.id) | 380 | f1 = fast_create(Folder, :name => 'test folder 1', :profile_id => profile.id) |
407 | - a1 = fast_create(TextileArticle, :name => 'test article 1', :profile_id => profile.id, :parent_id => f1.id) | ||
408 | - a2 = fast_create(TextileArticle, :name => 'test article 2', :profile_id => profile.id, :parent_id => f1.id) | ||
409 | - a3 = fast_create(TextileArticle, :name => 'test article 3', :profile_id => profile.id, :parent_id => f1.id) | 381 | + a1 = fast_create(TextArticle, :name => 'test article 1', :profile_id => profile.id, :parent_id => f1.id) |
382 | + a2 = fast_create(TextArticle, :name => 'test article 2', :profile_id => profile.id, :parent_id => f1.id) | ||
383 | + a3 = fast_create(TextArticle, :name => 'test article 3', :profile_id => profile.id, :parent_id => f1.id) | ||
410 | 384 | ||
411 | checked_articles= {f1.id => true, a1.id => true, a2.id => true, a3.id => false} | 385 | checked_articles= {f1.id => true, a1.id => true, a2.id => true, a3.id => false} |
412 | block = DisplayContentBlock.new | 386 | block = DisplayContentBlock.new |
@@ -420,9 +394,9 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | @@ -420,9 +394,9 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | ||
420 | profile = create_user('testuser').person | 394 | profile = create_user('testuser').person |
421 | Article.delete_all | 395 | Article.delete_all |
422 | f1 = fast_create(Folder, :name => 'test folder 1', :profile_id => profile.id) | 396 | f1 = fast_create(Folder, :name => 'test folder 1', :profile_id => profile.id) |
423 | - a1 = fast_create(TextileArticle, :name => 'test article 1', :profile_id => profile.id, :parent_id => f1.id) | ||
424 | - a2 = fast_create(TextileArticle, :name => 'test article 2', :profile_id => profile.id, :parent_id => f1.id) | ||
425 | - a3 = fast_create(TextileArticle, :name => 'test article 3', :profile_id => profile.id, :parent_id => f1.id) | 397 | + a1 = fast_create(TextArticle, :name => 'test article 1', :profile_id => profile.id, :parent_id => f1.id) |
398 | + a2 = fast_create(TextArticle, :name => 'test article 2', :profile_id => profile.id, :parent_id => f1.id) | ||
399 | + a3 = fast_create(TextArticle, :name => 'test article 3', :profile_id => profile.id, :parent_id => f1.id) | ||
426 | 400 | ||
427 | checked_articles= {f1.id => true, a1.id => true, a2.id => true, a3.id => false} | 401 | checked_articles= {f1.id => true, a1.id => true, a2.id => true, a3.id => false} |
428 | block = DisplayContentBlock.new | 402 | block = DisplayContentBlock.new |
@@ -472,37 +446,37 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | @@ -472,37 +446,37 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | ||
472 | should 'return available content types with checked types first' do | 446 | should 'return available content types with checked types first' do |
473 | Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([]) | 447 | Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([]) |
474 | block = DisplayContentBlock.create! | 448 | block = DisplayContentBlock.create! |
475 | - block.types = ['TinyMceArticle'] | 449 | + block.types = ['TextArticle'] |
476 | 450 | ||
477 | - block.types = ['TinyMceArticle', 'Folder'] | ||
478 | - assert_equivalent [TinyMceArticle, Folder, UploadedFile, Event, TextileArticle, RawHTMLArticle, Blog, Forum, Gallery, RssFeed], block.available_content_types | 451 | + block.types = ['TextArticle', 'Folder'] |
452 | + assert_equivalent [TextArticle, Folder, UploadedFile, Event, Blog, Forum, Gallery, RssFeed], block.available_content_types | ||
479 | end | 453 | end |
480 | 454 | ||
481 | should 'return available content types' do | 455 | should 'return available content types' do |
482 | Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([]) | 456 | Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([]) |
483 | block = DisplayContentBlock.create! | 457 | block = DisplayContentBlock.create! |
484 | - block.types = ['TinyMceArticle'] | 458 | + block.types = ['TextArticle'] |
485 | block.types = [] | 459 | block.types = [] |
486 | - assert_equivalent [UploadedFile, Event, TinyMceArticle, TextileArticle, RawHTMLArticle, Folder, Blog, Forum, Gallery, RssFeed], block.available_content_types | 460 | + assert_equivalent [UploadedFile, Event, TextArticle, Folder, Blog, Forum, Gallery, RssFeed], block.available_content_types |
487 | end | 461 | end |
488 | 462 | ||
489 | should 'return first 2 content types' do | 463 | should 'return first 2 content types' do |
490 | Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([]) | 464 | Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([]) |
491 | block = DisplayContentBlock.create! | 465 | block = DisplayContentBlock.create! |
492 | - block.types = ['TinyMceArticle'] | 466 | + block.types = ['TextArticle'] |
493 | assert_equal 2, block.first_content_types.length | 467 | assert_equal 2, block.first_content_types.length |
494 | end | 468 | end |
495 | 469 | ||
496 | should 'return all but first 2 content types' do | 470 | should 'return all but first 2 content types' do |
497 | Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([]) | 471 | Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([]) |
498 | block = DisplayContentBlock.create! | 472 | block = DisplayContentBlock.create! |
499 | - block.types = ['TinyMceArticle'] | 473 | + block.types = ['TextArticle'] |
500 | assert_equal block.available_content_types.length - 2, block.more_content_types.length | 474 | assert_equal block.available_content_types.length - 2, block.more_content_types.length |
501 | end | 475 | end |
502 | 476 | ||
503 | should 'return 2 as default value for first_types_count' do | 477 | should 'return 2 as default value for first_types_count' do |
504 | block = DisplayContentBlock.create! | 478 | block = DisplayContentBlock.create! |
505 | - block.types = ['TinyMceArticle'] | 479 | + block.types = ['TextArticle'] |
506 | assert_equal 2, block.first_types_count | 480 | assert_equal 2, block.first_types_count |
507 | end | 481 | end |
508 | 482 | ||
@@ -527,14 +501,14 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | @@ -527,14 +501,14 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | ||
527 | Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([SomePlugin.new]) | 501 | Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([SomePlugin.new]) |
528 | 502 | ||
529 | block.types = [] | 503 | block.types = [] |
530 | - assert_equivalent [UploadedFile, Event, TinyMceArticle, TextileArticle, RawHTMLArticle, Folder, Blog, Forum, Gallery, RssFeed, SomePluginContent], block.available_content_types | 504 | + assert_equivalent [UploadedFile, Event, TextArticle, Folder, Blog, Forum, Gallery, RssFeed, SomePluginContent], block.available_content_types |
531 | end | 505 | end |
532 | 506 | ||
533 | should 'do not fail if a selected article was removed' do | 507 | should 'do not fail if a selected article was removed' do |
534 | profile = create_user('testuser').person | 508 | profile = create_user('testuser').person |
535 | Article.delete_all | 509 | Article.delete_all |
536 | f1 = fast_create(Folder, :name => 'test folder 1', :profile_id => profile.id) | 510 | f1 = fast_create(Folder, :name => 'test folder 1', :profile_id => profile.id) |
537 | - a1 = fast_create(TextileArticle, :name => 'test article 1', :profile_id => profile.id, :parent_id => f1.id) | 511 | + a1 = fast_create(TextArticle, :name => 'test article 1', :profile_id => profile.id, :parent_id => f1.id) |
538 | 512 | ||
539 | checked_articles= {a1.id => true} | 513 | checked_articles= {a1.id => true} |
540 | 514 | ||
@@ -547,16 +521,16 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | @@ -547,16 +521,16 @@ class DisplayContentBlockTest < ActiveSupport::TestCase | ||
547 | 521 | ||
548 | end | 522 | end |
549 | 523 | ||
550 | -require 'boxes_helper' | ||
551 | - | ||
552 | class DisplayContentBlockViewTest < ActionView::TestCase | 524 | class DisplayContentBlockViewTest < ActionView::TestCase |
553 | include BoxesHelper | 525 | include BoxesHelper |
526 | + include DatesHelper | ||
527 | + helper :dates | ||
554 | 528 | ||
555 | should 'list links for all articles title defined in nodes' do | 529 | should 'list links for all articles title defined in nodes' do |
556 | profile = create_user('testuser').person | 530 | profile = create_user('testuser').person |
557 | Article.delete_all | 531 | Article.delete_all |
558 | - a1 = fast_create(TextileArticle, :name => 'test article 1', :profile_id => profile.id) | ||
559 | - a2 = fast_create(TextileArticle, :name => 'test article 2', :profile_id => profile.id) | 532 | + a1 = fast_create(TextArticle, :name => 'test article 1', :profile_id => profile.id) |
533 | + a2 = fast_create(TextArticle, :name => 'test article 2', :profile_id => profile.id) | ||
560 | 534 | ||
561 | block = DisplayContentBlock.new | 535 | block = DisplayContentBlock.new |
562 | block.sections = [{:value => 'title', :checked => true}] | 536 | block.sections = [{:value => 'title', :checked => true}] |
@@ -572,8 +546,8 @@ class DisplayContentBlockViewTest < ActionView::TestCase | @@ -572,8 +546,8 @@ class DisplayContentBlockViewTest < ActionView::TestCase | ||
572 | should 'list content for all articles lead defined in nodes' do | 546 | should 'list content for all articles lead defined in nodes' do |
573 | profile = create_user('testuser').person | 547 | profile = create_user('testuser').person |
574 | Article.delete_all | 548 | Article.delete_all |
575 | - a1 = fast_create(TinyMceArticle, :name => 'test article 1', :profile_id => profile.id, :abstract => 'abstract article 1') | ||
576 | - a2 = fast_create(TinyMceArticle, :name => 'test article 2', :profile_id => profile.id, :abstract => 'abstract article 2') | 549 | + a1 = fast_create(TextArticle, :name => 'test article 1', :profile_id => profile.id, :abstract => 'abstract article 1') |
550 | + a2 = fast_create(TextArticle, :name => 'test article 2', :profile_id => profile.id, :abstract => 'abstract article 2') | ||
577 | 551 | ||
578 | block = DisplayContentBlock.new | 552 | block = DisplayContentBlock.new |
579 | block.sections = [{:value => 'abstract', :checked => true}] | 553 | block.sections = [{:value => 'abstract', :checked => true}] |
@@ -602,7 +576,7 @@ class DisplayContentBlockViewTest < ActionView::TestCase | @@ -602,7 +576,7 @@ class DisplayContentBlockViewTest < ActionView::TestCase | ||
602 | 576 | ||
603 | should 'show title if defined by user' do | 577 | should 'show title if defined by user' do |
604 | profile = create_user('testuser').person | 578 | profile = create_user('testuser').person |
605 | - a = fast_create(TextileArticle, :name => 'test article 1', :profile_id => profile.id) | 579 | + a = fast_create(TextArticle, :name => 'test article 1', :profile_id => profile.id) |
606 | 580 | ||
607 | block = DisplayContentBlock.new | 581 | block = DisplayContentBlock.new |
608 | block.nodes = [a.id] | 582 | block.nodes = [a.id] |
@@ -616,7 +590,7 @@ class DisplayContentBlockViewTest < ActionView::TestCase | @@ -616,7 +590,7 @@ class DisplayContentBlockViewTest < ActionView::TestCase | ||
616 | 590 | ||
617 | should 'show abstract if defined by user' do | 591 | should 'show abstract if defined by user' do |
618 | profile = create_user('testuser').person | 592 | profile = create_user('testuser').person |
619 | - a = fast_create(TextileArticle, :name => 'test article 1', :profile_id => profile.id, :abstract => 'some abstract') | 593 | + a = fast_create(TextArticle, :name => 'test article 1', :profile_id => profile.id, :abstract => 'some abstract') |
620 | 594 | ||
621 | block = DisplayContentBlock.new | 595 | block = DisplayContentBlock.new |
622 | block.nodes = [a.id] | 596 | block.nodes = [a.id] |
@@ -630,7 +604,7 @@ class DisplayContentBlockViewTest < ActionView::TestCase | @@ -630,7 +604,7 @@ class DisplayContentBlockViewTest < ActionView::TestCase | ||
630 | 604 | ||
631 | should 'show body if defined by user' do | 605 | should 'show body if defined by user' do |
632 | profile = create_user('testuser').person | 606 | profile = create_user('testuser').person |
633 | - a = fast_create(TextileArticle, :name => 'test article 1', :profile_id => profile.id, :body => 'some body') | 607 | + a = fast_create(TextArticle, :name => 'test article 1', :profile_id => profile.id, :body => 'some body') |
634 | 608 | ||
635 | block = DisplayContentBlock.new | 609 | block = DisplayContentBlock.new |
636 | block.nodes = [a.id] | 610 | block.nodes = [a.id] |
@@ -642,7 +616,7 @@ class DisplayContentBlockViewTest < ActionView::TestCase | @@ -642,7 +616,7 @@ class DisplayContentBlockViewTest < ActionView::TestCase | ||
642 | assert_match /#{a.body}/, render_block_content(block) | 616 | assert_match /#{a.body}/, render_block_content(block) |
643 | end | 617 | end |
644 | 618 | ||
645 | - should 'show publishd date if defined by user' do | 619 | + should 'show published date if defined by user' do |
646 | profile = create_user('testuser').person | 620 | profile = create_user('testuser').person |
647 | a = fast_create(TextArticle, :name => 'test article 1', :profile_id => profile.id, :body => 'some body') | 621 | a = fast_create(TextArticle, :name => 'test article 1', :profile_id => profile.id, :body => 'some body') |
648 | 622 | ||
@@ -658,7 +632,7 @@ class DisplayContentBlockViewTest < ActionView::TestCase | @@ -658,7 +632,7 @@ class DisplayContentBlockViewTest < ActionView::TestCase | ||
658 | 632 | ||
659 | should 'show image if defined by user' do | 633 | should 'show image if defined by user' do |
660 | profile = create_user('testuser').person | 634 | profile = create_user('testuser').person |
661 | - a = create(TinyMceArticle, :name => 'test article 1', :profile_id => profile.id, :image_builder => { :uploaded_data => fixture_file_upload('/files/rails.png', 'image/png')}) | 635 | + a = create(TextArticle, :name => 'test article 1', :profile_id => profile.id, :image_builder => { :uploaded_data => fixture_file_upload('/files/rails.png', 'image/png')}) |
662 | a.save! | 636 | a.save! |
663 | 637 | ||
664 | process_delayed_job_queue | 638 | process_delayed_job_queue |
@@ -676,8 +650,8 @@ class DisplayContentBlockViewTest < ActionView::TestCase | @@ -676,8 +650,8 @@ class DisplayContentBlockViewTest < ActionView::TestCase | ||
676 | should 'show articles in recent order' do | 650 | should 'show articles in recent order' do |
677 | profile = create_user('testuser').person | 651 | profile = create_user('testuser').person |
678 | Article.delete_all | 652 | Article.delete_all |
679 | - a1 = fast_create(TextileArticle, :name => 'test article 1', :profile_id => profile.id, :published_at => DateTime.current) | ||
680 | - a2 = fast_create(TextileArticle, :name => 'test article 2', :profile_id => profile.id, :published_at => (DateTime.current + 1)) | 653 | + a1 = fast_create(TextArticle, :name => 'test article 1', :profile_id => profile.id, :published_at => DateTime.current) |
654 | + a2 = fast_create(TextArticle, :name => 'test article 2', :profile_id => profile.id, :published_at => (DateTime.current + 1)) | ||
681 | 655 | ||
682 | block = DisplayContentBlock.new | 656 | block = DisplayContentBlock.new |
683 | block.sections = [{:value => 'title', :checked => true}] | 657 | block.sections = [{:value => 'title', :checked => true}] |
@@ -697,8 +671,8 @@ class DisplayContentBlockViewTest < ActionView::TestCase | @@ -697,8 +671,8 @@ class DisplayContentBlockViewTest < ActionView::TestCase | ||
697 | should 'show articles in oldest order' do | 671 | should 'show articles in oldest order' do |
698 | profile = create_user('testuser').person | 672 | profile = create_user('testuser').person |
699 | Article.delete_all | 673 | Article.delete_all |
700 | - a1 = fast_create(TextileArticle, :name => 'test article 1', :profile_id => profile.id, :published_at => DateTime.current) | ||
701 | - a2 = fast_create(TextileArticle, :name => 'test article 2', :profile_id => profile.id, :published_at => (DateTime.current + 1)) | 674 | + a1 = fast_create(TextArticle, :name => 'test article 1', :profile_id => profile.id, :published_at => DateTime.current) |
675 | + a2 = fast_create(TextArticle, :name => 'test article 2', :profile_id => profile.id, :published_at => (DateTime.current + 1)) | ||
702 | 676 | ||
703 | block = DisplayContentBlock.new | 677 | block = DisplayContentBlock.new |
704 | block.sections = [{:value => 'title', :checked => true}] | 678 | block.sections = [{:value => 'title', :checked => true}] |
@@ -718,8 +692,8 @@ class DisplayContentBlockViewTest < ActionView::TestCase | @@ -718,8 +692,8 @@ class DisplayContentBlockViewTest < ActionView::TestCase | ||
718 | should 'show articles in recent order with limit option' do | 692 | should 'show articles in recent order with limit option' do |
719 | profile = create_user('testuser').person | 693 | profile = create_user('testuser').person |
720 | Article.delete_all | 694 | Article.delete_all |
721 | - a1 = fast_create(TextileArticle, :name => 'test article 1', :profile_id => profile.id, :published_at => DateTime.current) | ||
722 | - a2 = fast_create(TextileArticle, :name => 'test article 2', :profile_id => profile.id, :published_at => (DateTime.current + 1)) | 695 | + a1 = fast_create(TextArticle, :name => 'test article 1', :profile_id => profile.id, :published_at => DateTime.current) |
696 | + a2 = fast_create(TextArticle, :name => 'test article 2', :profile_id => profile.id, :published_at => (DateTime.current + 1)) | ||
723 | 697 | ||
724 | block = DisplayContentBlock.new | 698 | block = DisplayContentBlock.new |
725 | block.sections = [{:value => 'title', :checked => true}] | 699 | block.sections = [{:value => 'title', :checked => true}] |
@@ -741,10 +715,10 @@ class DisplayContentBlockViewTest < ActionView::TestCase | @@ -741,10 +715,10 @@ class DisplayContentBlockViewTest < ActionView::TestCase | ||
741 | profile = create_user('testuser').person | 715 | profile = create_user('testuser').person |
742 | Article.delete_all | 716 | Article.delete_all |
743 | 717 | ||
744 | - en_article = fast_create(TextileArticle, :profile_id => profile.id, :name => 'en_article', :language => 'en') | ||
745 | - en_article2 = fast_create(TextileArticle, :profile_id => profile.id, :name => 'en_article 2', :language => 'en') | 718 | + en_article = fast_create(TextArticle, :profile_id => profile.id, :name => 'en_article', :language => 'en') |
719 | + en_article2 = fast_create(TextArticle, :profile_id => profile.id, :name => 'en_article 2', :language => 'en') | ||
746 | 720 | ||
747 | - pt_article = fast_create TextileArticle, profile_id: profile.id, name: 'pt_article', language: 'pt', translation_of_id: en_article.id | 721 | + pt_article = fast_create TextArticle, profile_id: profile.id, name: 'pt_article', language: 'pt', translation_of_id: en_article.id |
748 | 722 | ||
749 | block = DisplayContentBlock.new | 723 | block = DisplayContentBlock.new |
750 | block.sections = [{:value => 'title', :checked => true}] | 724 | block.sections = [{:value => 'title', :checked => true}] |
@@ -771,8 +745,8 @@ class DisplayContentBlockViewTest < ActionView::TestCase | @@ -771,8 +745,8 @@ class DisplayContentBlockViewTest < ActionView::TestCase | ||
771 | profile = create_user('testuser').person | 745 | profile = create_user('testuser').person |
772 | Article.delete_all | 746 | Article.delete_all |
773 | 747 | ||
774 | - en_article = fast_create(TextileArticle, :profile_id => profile.id, :name => 'en_article', :language => 'en') | ||
775 | - pt_article = fast_create(TextileArticle, :profile_id => profile.id, :name => 'pt_article', :language => 'pt', :translation_of_id => en_article) | 748 | + en_article = fast_create(TextArticle, :profile_id => profile.id, :name => 'en_article', :language => 'en') |
749 | + pt_article = fast_create(TextArticle, :profile_id => profile.id, :name => 'pt_article', :language => 'pt', :translation_of_id => en_article) | ||
776 | 750 | ||
777 | block = DisplayContentBlock.new | 751 | block = DisplayContentBlock.new |
778 | block.sections = [{:value => 'title', :checked => true}] | 752 | block.sections = [{:value => 'title', :checked => true}] |
@@ -794,7 +768,7 @@ class DisplayContentBlockViewTest < ActionView::TestCase | @@ -794,7 +768,7 @@ class DisplayContentBlockViewTest < ActionView::TestCase | ||
794 | 768 | ||
795 | should 'not escape abstract html of articles' do | 769 | should 'not escape abstract html of articles' do |
796 | profile = create_user('testuser').person | 770 | profile = create_user('testuser').person |
797 | - a1 = fast_create(TextileArticle, abstract: "<p class='test-article-abstract'>Test</p>", name: 'test article 1', profile_id: profile.id, published_at: DateTime.current) | 771 | + a1 = fast_create(TextArticle, abstract: "<p class='test-article-abstract'>Test</p>", name: 'test article 1', profile_id: profile.id, published_at: DateTime.current) |
798 | 772 | ||
799 | block = DisplayContentBlock.new | 773 | block = DisplayContentBlock.new |
800 | block.sections = [{:value => 'abstract', :checked => true}] | 774 | block.sections = [{:value => 'abstract', :checked => true}] |
@@ -807,7 +781,7 @@ class DisplayContentBlockViewTest < ActionView::TestCase | @@ -807,7 +781,7 @@ class DisplayContentBlockViewTest < ActionView::TestCase | ||
807 | 781 | ||
808 | should 'not raise if abstract of article is nil' do | 782 | should 'not raise if abstract of article is nil' do |
809 | profile = create_user('testuser').person | 783 | profile = create_user('testuser').person |
810 | - a1 = fast_create(TextileArticle, name: 'test article 1', profile_id: profile.id, published_at: DateTime.current) | 784 | + a1 = fast_create(TextArticle, name: 'test article 1', profile_id: profile.id, published_at: DateTime.current) |
811 | 785 | ||
812 | block = DisplayContentBlock.new | 786 | block = DisplayContentBlock.new |
813 | block.sections = [{:value => 'abstract', :checked => true}] | 787 | block.sections = [{:value => 'abstract', :checked => true}] |
@@ -823,7 +797,7 @@ class DisplayContentBlockViewTest < ActionView::TestCase | @@ -823,7 +797,7 @@ class DisplayContentBlockViewTest < ActionView::TestCase | ||
823 | 797 | ||
824 | should 'not escape body html of articles' do | 798 | should 'not escape body html of articles' do |
825 | profile = create_user('testuser').person | 799 | profile = create_user('testuser').person |
826 | - a1 = fast_create(TextileArticle, body: "<p class='test-article-body'>Test</p>", name: 'test article 1', profile_id: profile.id, published_at: DateTime.current) | 800 | + a1 = fast_create(TextArticle, body: "<p class='test-article-body'>Test</p>", name: 'test article 1', profile_id: profile.id, published_at: DateTime.current) |
827 | 801 | ||
828 | block = DisplayContentBlock.new | 802 | block = DisplayContentBlock.new |
829 | block.sections = [{:value => 'body', :checked => true}] | 803 | block.sections = [{:value => 'body', :checked => true}] |
@@ -836,7 +810,7 @@ class DisplayContentBlockViewTest < ActionView::TestCase | @@ -836,7 +810,7 @@ class DisplayContentBlockViewTest < ActionView::TestCase | ||
836 | 810 | ||
837 | should 'not raise if body of article is nil' do | 811 | should 'not raise if body of article is nil' do |
838 | profile = create_user('testuser').person | 812 | profile = create_user('testuser').person |
839 | - a1 = fast_create(TextileArticle, name: 'test article 1', profile_id: profile.id, published_at: DateTime.current) | 813 | + a1 = fast_create(TextArticle, name: 'test article 1', profile_id: profile.id, published_at: DateTime.current) |
840 | 814 | ||
841 | block = DisplayContentBlock.new | 815 | block = DisplayContentBlock.new |
842 | block.sections = [{:value => 'abstract', :checked => true}] | 816 | block.sections = [{:value => 'abstract', :checked => true}] |
plugins/fb_app/views/fb_app_plugin_page_tab/_configure_form.html.slim
@@ -15,7 +15,7 @@ | @@ -15,7 +15,7 @@ | ||
15 | = f.text_field :title, class: 'form-control' | 15 | = f.text_field :title, class: 'form-control' |
16 | 16 | ||
17 | = f.label :subtitle, t("fb_app_plugin.views.myprofile.catalogs.catalog_subtitle_label") | 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 | = f.label :config_type, t("fb_app_plugin.views.myprofile.catalogs.catalog_type_chooser_label") | 20 | = f.label :config_type, t("fb_app_plugin.views.myprofile.catalogs.catalog_type_chooser_label") |
21 | = f.select :config_type, | 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,7 +6,7 @@ class MarkCommentAsReadPluginProfileControllerTest < ActionController::TestCase | ||
6 | @controller = MarkCommentAsReadPluginProfileController.new | 6 | @controller = MarkCommentAsReadPluginProfileController.new |
7 | 7 | ||
8 | @profile = create_user('profile').person | 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 | @comment = Comment.new(:source => @article, :author => @profile, :body => 'test') | 10 | @comment = Comment.new(:source => @article, :author => @profile, :body => 'test') |
11 | @comment.save! | 11 | @comment.save! |
12 | login_as(@profile.identifier) | 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,7 +4,7 @@ class MarkCommentAsReadPlugin::CommentTest < ActiveSupport::TestCase | ||
4 | 4 | ||
5 | def setup | 5 | def setup |
6 | @person = create_user('user').person | 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 | @comment = Comment.create!(:title => 'title', :body => 'body', :author => @person, :source => @article) | 8 | @comment = Comment.create!(:title => 'title', :body => 'body', :author => @person, :source => @article) |
9 | end | 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,7 +5,7 @@ class MarkCommentAsReadPluginTest < ActionView::TestCase | ||
5 | def setup | 5 | def setup |
6 | @plugin = MarkCommentAsReadPlugin.new | 6 | @plugin = MarkCommentAsReadPlugin.new |
7 | @person = create_user('user').person | 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 | @comment = Comment.create!(:source => @article, :author => @person, :body => 'test') | 9 | @comment = Comment.create!(:source => @article, :author => @person, :body => 'test') |
10 | self.stubs(:user).returns(@person) | 10 | self.stubs(:user).returns(@person) |
11 | self.stubs(:profile).returns(@person) | 11 | self.stubs(:profile).returns(@person) |
plugins/metadata/test/functional/content_viewer_controller_test.rb
@@ -21,7 +21,7 @@ class ContentViewerControllerTest < ActionController::TestCase | @@ -21,7 +21,7 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
21 | end | 21 | end |
22 | 22 | ||
23 | should 'add meta tags with article info' do | 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 | get :view_page, profile: profile.identifier, page: [ a.name.to_slug ] | 26 | get :view_page, profile: profile.identifier, page: [ a.name.to_slug ] |
27 | 27 | ||
@@ -37,7 +37,7 @@ class ContentViewerControllerTest < ActionController::TestCase | @@ -37,7 +37,7 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
37 | end | 37 | end |
38 | 38 | ||
39 | should 'add meta tags with article images' do | 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 | get :view_page, profile: profile.identifier, page: [ a.name.to_slug ] | 42 | get :view_page, profile: profile.identifier, page: [ a.name.to_slug ] |
43 | assert_tag tag: 'meta', attributes: { name: 'twitter:image', content: /\/images\/x.png/ } | 43 | assert_tag tag: 'meta', attributes: { name: 'twitter:image', content: /\/images\/x.png/ } |
@@ -45,7 +45,7 @@ class ContentViewerControllerTest < ActionController::TestCase | @@ -45,7 +45,7 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
45 | end | 45 | end |
46 | 46 | ||
47 | should 'escape utf8 characters correctly' do | 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 | get :view_page, profile: profile.identifier, page: [ a.name.to_slug ] | 50 | get :view_page, profile: profile.identifier, page: [ a.name.to_slug ] |
51 | assert_tag tag: 'meta', attributes: { property: 'og:image', content: /\/images\/%C3%A7.png/ } | 51 | assert_tag tag: 'meta', attributes: { property: 'og:image', content: /\/images\/%C3%A7.png/ } |
@@ -63,7 +63,7 @@ class ContentViewerControllerTest < ActionController::TestCase | @@ -63,7 +63,7 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
63 | 63 | ||
64 | should 'not expose metadata on private pages' do | 64 | should 'not expose metadata on private pages' do |
65 | profile.update_column :public_profile, false | 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 | get :view_page, profile: profile.identifier, page: [ a.name.to_slug ] | 68 | get :view_page, profile: profile.identifier, page: [ a.name.to_slug ] |
69 | assert_no_tag tag: 'meta', attributes: { property: 'og:image', content: /\/images\/x.png/ } | 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,7 +10,7 @@ class NewsletterPluginSafeStringsTest < ActionDispatch::IntegrationTest | ||
10 | environment.add_admin(person) | 10 | environment.add_admin(person) |
11 | 11 | ||
12 | blog = fast_create(Blog, :profile_id => person.id) | 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 | newsletter = NewsletterPlugin::Newsletter.create!(:environment => environment, :person => person, :enabled => true) | 14 | newsletter = NewsletterPlugin::Newsletter.create!(:environment => environment, :person => person, :enabled => true) |
15 | newsletter.blog_ids = [blog.id] | 15 | newsletter.blog_ids = [blog.id] |
16 | newsletter.save! | 16 | newsletter.save! |
plugins/newsletter/test/unit/newsletter_plugin_moderate_newsletter_test.rb
@@ -28,9 +28,9 @@ class NewsletterPluginModerateNewsletterTest < ActiveSupport::TestCase | @@ -28,9 +28,9 @@ class NewsletterPluginModerateNewsletterTest < ActiveSupport::TestCase | ||
28 | should 'set posts for mailing body on perform' do | 28 | should 'set posts for mailing body on perform' do |
29 | person = create_user('john').person | 29 | person = create_user('john').person |
30 | blog = fast_create(Blog, profile_id: person.id) | 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 | newsletter = NewsletterPlugin::Newsletter.create!(:environment => person.environment, :person => person, :enabled => true) | 35 | newsletter = NewsletterPlugin::Newsletter.create!(:environment => person.environment, :person => person, :enabled => true) |
36 | newsletter.blog_ids = [blog.id] | 36 | newsletter.blog_ids = [blog.id] |
plugins/newsletter/test/unit/newsletter_plugin_newsletter_test.rb
@@ -381,9 +381,9 @@ EOS | @@ -381,9 +381,9 @@ EOS | ||
381 | person = fast_create(Person) | 381 | person = fast_create(Person) |
382 | blog = fast_create(Blog, profile_id: person.id) | 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 | newsletter = NewsletterPlugin::Newsletter.create!( | 388 | newsletter = NewsletterPlugin::Newsletter.create!( |
389 | :environment => person.environment, | 389 | :environment => person.environment, |
@@ -397,9 +397,9 @@ EOS | @@ -397,9 +397,9 @@ EOS | ||
397 | person = fast_create(Person) | 397 | person = fast_create(Person) |
398 | blog = fast_create(Blog, profile_id: person.id) | 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 | newsletter = NewsletterPlugin::Newsletter.create!( | 404 | newsletter = NewsletterPlugin::Newsletter.create!( |
405 | :environment => person.environment, | 405 | :environment => person.environment, |
plugins/newsletter/views/newsletter_plugin_admin/index.html.erb
1 | <h1><%= _('Newsletter settings') %></h1> | 1 | <h1><%= _('Newsletter settings') %></h1> |
2 | 2 | ||
3 | -<%= render :file => 'shared/tiny_mce' %> | ||
4 | - | ||
5 | <%= error_messages_for :newsletter %> | 3 | <%= error_messages_for :newsletter %> |
6 | 4 | ||
7 | <%= form_for(:newsletter, html: { multipart: true }) do |f| %> | 5 | <%= form_for(:newsletter, html: { multipart: true }) do |f| %> |
@@ -81,7 +79,7 @@ | @@ -81,7 +79,7 @@ | ||
81 | content_tag('h3', ui_icon('ui-icon-triangle-1-s') + | 79 | content_tag('h3', ui_icon('ui-icon-triangle-1-s') + |
82 | _('Newsletter footer'), :class => 'newsletter-toggle-link', :element_id => '#newsletter-footer-field'), | 80 | _('Newsletter footer'), :class => 'newsletter-toggle-link', :element_id => '#newsletter-footer-field'), |
83 | content_tag('div', | 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 | :id => 'newsletter-footer-field' | 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,7 +51,7 @@ class OpenGraphPlugin::PublisherTest < ActiveSupport::TestCase | ||
51 | user = User.current.person | 51 | user = User.current.person |
52 | 52 | ||
53 | blog = Blog.create! profile: user, name: 'blog' | 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 | assert_last_activity user, :create_an_article, url_for(blog_post) | 55 | assert_last_activity user, :create_an_article, url_for(blog_post) |
56 | 56 | ||
57 | gallery = Gallery.create! name: 'gallery', profile: user | 57 | gallery = Gallery.create! name: 'gallery', profile: user |
@@ -65,7 +65,7 @@ class OpenGraphPlugin::PublisherTest < ActiveSupport::TestCase | @@ -65,7 +65,7 @@ class OpenGraphPlugin::PublisherTest < ActiveSupport::TestCase | ||
65 | assert_last_activity user, :create_an_event, url_for(event) | 65 | assert_last_activity user, :create_an_event, url_for(event) |
66 | 66 | ||
67 | forum = Forum.create! name: 'forum', profile: user | 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 | assert_last_activity user, :start_a_discussion, url_for(topic, topic.url.merge(og_type: MetadataPlugin.og_types[:forum])) | 69 | assert_last_activity user, :start_a_discussion, url_for(topic, topic.url.merge(og_type: MetadataPlugin.og_types[:forum])) |
70 | 70 | ||
71 | AddFriend.create!(person: user, friend: @other_actor).finish | 71 | AddFriend.create!(person: user, friend: @other_actor).finish |
@@ -82,7 +82,7 @@ class OpenGraphPlugin::PublisherTest < ActiveSupport::TestCase | @@ -82,7 +82,7 @@ class OpenGraphPlugin::PublisherTest < ActiveSupport::TestCase | ||
82 | User.current = @actor.user | 82 | User.current = @actor.user |
83 | user = User.current.person | 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 | story = :announce_news_from_a_sse_initiative | 86 | story = :announce_news_from_a_sse_initiative |
87 | assert_last_activity user, story, passive_url_for(blog_post, nil, OpenGraphPlugin::Stories::Definitions[story]) | 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,13 +91,13 @@ class OpenGraphPlugin::PublisherTest < ActiveSupport::TestCase | ||
91 | user = User.current.person | 91 | user = User.current.person |
92 | 92 | ||
93 | # fan | 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 | assert_last_activity user, :announce_news_from_a_sse_initiative, 'http://noosfero.net/coop/blog/blah2' | 95 | assert_last_activity user, :announce_news_from_a_sse_initiative, 'http://noosfero.net/coop/blog/blah2' |
96 | # member | 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 | assert_last_activity user, :announce_news_from_a_sse_initiative, 'http://noosfero.net/mycoop/blog/blah2' | 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 | assert_last_activity user, :announce_news_from_a_community, 'http://noosfero.net/comm/blog/blah' | 101 | assert_last_activity user, :announce_news_from_a_community, 'http://noosfero.net/comm/blog/blah' |
102 | end | 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,8 +5,7 @@ h3= t('views.cycle._edit_fields.general_settings') | ||
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| | 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 | = labelled_field f, :name, t('views.cycle._edit_fields.name'), f.text_field(:name), class: 'cycle-field-name' | 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 | .cycle-fields-block | 10 | .cycle-fields-block |
12 | = labelled_datetime_range_field f, :start, :finish, t('views.cycle._edit_fields.orders_interval'), class: 'cycle-orders-period' | 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 | <%= render :file => 'shared/tiny_mce', :locals => {:mode => 'simple'} %> | 1 | <%= render :file => 'shared/tiny_mce', :locals => {:mode => 'simple'} %> |
2 | <% if !@product.description.blank? %> | 2 | <% if !@product.description.blank? %> |
3 | <%= @product.description %> | 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 | <% else %> | 5 | <% else %> |
6 | <%= edit_product_ui_button_to_remote( | 6 | <%= edit_product_ui_button_to_remote( |
7 | @product, | 7 | @product, |
plugins/products/views/products_plugin/page/_edit_description.html.erb
1 | -<%= render file: 'shared/tiny_mce', locals: {mode: 'simple'} %> | ||
2 | <%= remote_form_for(@product, | 1 | <%= remote_form_for(@product, |
3 | loading: "small_loading('product-description-form')", | 2 | loading: "small_loading('product-description-form')", |
4 | update: 'product-description', | 3 | update: 'product-description', |
5 | url: {controller: 'products_plugin/page', action: 'edit', id: @product, field: 'description'}, | 4 | url: {controller: 'products_plugin/page', action: 'edit', id: @product, field: 'description'}, |
6 | html: {id: 'product-description-form', method: 'post'}) do |f| %> | 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 | <%= button_bar do %> | 8 | <%= button_bar do %> |
10 | <%= submit_button :save, _('Save') %> | 9 | <%= submit_button :save, _('Save') %> |
11 | <%= cancel_edit_product_link(@product, 'description') %> | 10 | <%= cancel_edit_product_link(@product, 'description') %> |
plugins/products/views/products_plugin/page/_form.html.erb
@@ -5,7 +5,7 @@ | @@ -5,7 +5,7 @@ | ||
5 | 5 | ||
6 | <%= display_form_field( _('Name:'), f.text_field(:name) ) %> | 6 | <%= display_form_field( _('Name:'), f.text_field(:name) ) %> |
7 | <%= display_form_field( _('Price:'), f.text_field(:price) ) %> | 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 | <%= labelled_form_field(f.check_box(:highlighted) + _('Highlight this product'),'') %> | 9 | <%= labelled_form_field(f.check_box(:highlighted) + _('Highlight this product'),'') %> |
10 | <%= f.fields_for :image_builder, @product.image do |i| %> | 10 | <%= f.fields_for :image_builder, @product.image do |i| %> |
11 | <%= file_field_or_thumbnail(_('Image:'), @product.image, i) %> | 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,7 +42,7 @@ class ProfileMembersHeadlinesBlockTest < ActiveSupport::TestCase | ||
42 | block = ProfileMembersHeadlinesBlock.create | 42 | block = ProfileMembersHeadlinesBlock.create |
43 | block.stubs(:owner).returns(community) | 43 | block.stubs(:owner).returns(community) |
44 | blog = fast_create(Blog, :profile_id => member1.id) | 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 | self.expects(:render).with(:template => 'blocks/profile_members_headlines', :locals => { :block => block }).returns('file-with-authors-and-headlines') | 46 | self.expects(:render).with(:template => 'blocks/profile_members_headlines', :locals => { :block => block }).returns('file-with-authors-and-headlines') |
47 | assert_equal 'file-with-authors-and-headlines', render_block_content(block) | 47 | assert_equal 'file-with-authors-and-headlines', render_block_content(block) |
48 | end | 48 | end |
@@ -53,7 +53,7 @@ class ProfileMembersHeadlinesBlockTest < ActiveSupport::TestCase | @@ -53,7 +53,7 @@ class ProfileMembersHeadlinesBlockTest < ActiveSupport::TestCase | ||
53 | block = ProfileMembersHeadlinesBlock.new(:limit => 1, :filtered_roles => [role.id]) | 53 | block = ProfileMembersHeadlinesBlock.new(:limit => 1, :filtered_roles => [role.id]) |
54 | block.expects(:owner).returns(community) | 54 | block.expects(:owner).returns(community) |
55 | blog = fast_create(Blog, :profile_id => member1.id) | 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 | assert_equal [member1], block.authors_list | 57 | assert_equal [member1], block.authors_list |
58 | end | 58 | end |
59 | 59 | ||
@@ -62,7 +62,7 @@ class ProfileMembersHeadlinesBlockTest < ActiveSupport::TestCase | @@ -62,7 +62,7 @@ class ProfileMembersHeadlinesBlockTest < ActiveSupport::TestCase | ||
62 | block.expects(:owner).returns(community) | 62 | block.expects(:owner).returns(community) |
63 | private_author = fast_create(Person, :public_profile => false) | 63 | private_author = fast_create(Person, :public_profile => false) |
64 | blog = fast_create(Blog, :profile_id => private_author.id) | 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 | assert_equal [], block.authors_list | 66 | assert_equal [], block.authors_list |
67 | end | 67 | end |
68 | 68 | ||
@@ -76,7 +76,7 @@ class ProfileMembersHeadlinesBlockTest < ActiveSupport::TestCase | @@ -76,7 +76,7 @@ class ProfileMembersHeadlinesBlockTest < ActiveSupport::TestCase | ||
76 | block.stubs(:owner).returns(community) | 76 | block.stubs(:owner).returns(community) |
77 | community.members.each do |member| | 77 | community.members.each do |member| |
78 | blog = fast_create(Blog, :profile_id => member.id) | 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 | end | 80 | end |
81 | assert_equal [author], block.authors_list | 81 | assert_equal [author], block.authors_list |
82 | end | 82 | end |
plugins/recent_content/lib/recent_content_block.rb
@@ -7,7 +7,7 @@ class RecentContentBlock < Block | @@ -7,7 +7,7 @@ class RecentContentBlock < Block | ||
7 | 7 | ||
8 | attr_accessible :presentation_mode, :total_items, :show_blog_picture, :selected_folder | 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 | def self.description | 12 | def self.description |
13 | c_('Recent content') | 13 | c_('Recent content') |
plugins/recent_content/test/unit/recent_content_block_test.rb
@@ -2,7 +2,7 @@ require_relative '../test_helper' | @@ -2,7 +2,7 @@ require_relative '../test_helper' | ||
2 | class RecentContentBlockTest < ActiveSupport::TestCase | 2 | class RecentContentBlockTest < ActiveSupport::TestCase |
3 | 3 | ||
4 | INVALID_KIND_OF_ARTICLE = [RssFeed, UploadedFile, Gallery, Folder, Blog, Forum] | 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 | should 'describe itself' do | 7 | should 'describe itself' do |
8 | assert_not_equal Block.description, RecentContentBlock.description | 8 | assert_not_equal Block.description, RecentContentBlock.description |
@@ -61,9 +61,9 @@ class RecentContentBlockTest < ActiveSupport::TestCase | @@ -61,9 +61,9 @@ class RecentContentBlockTest < ActiveSupport::TestCase | ||
61 | 61 | ||
62 | root = fast_create(Blog, :name => 'test-blog', :profile_id => profile.id) | 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 | block = RecentContentBlock.new | 68 | block = RecentContentBlock.new |
69 | block.stubs(:holder).returns(profile) | 69 | block.stubs(:holder).returns(profile) |
plugins/relevant_content/test/unit/article.rb
@@ -29,9 +29,9 @@ class RelevantContentBlockTest < ActiveSupport::TestCase | @@ -29,9 +29,9 @@ class RelevantContentBlockTest < ActiveSupport::TestCase | ||
29 | 29 | ||
30 | should 'list most commented articles' do | 30 | should 'list most commented articles' do |
31 | Article.delete_all | 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 | 2.times { Comment.create(:title => 'test', :body => 'asdsad', :author => profile, :source => a2).save! } | 36 | 2.times { Comment.create(:title => 'test', :body => 'asdsad', :author => profile, :source => a2).save! } |
37 | 4.times { Comment.create(:title => 'test', :body => 'asdsad', :author => profile, :source => a3).save! } | 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,7 +4,7 @@ Allows to send e-mails through an e-mail form. | ||
4 | 4 | ||
5 | h2. Usage | 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 | * Add a "to" and "message" field and a submit button | 8 | * Add a "to" and "message" field and a submit button |
9 | * Make sure to fill in allowed 'to' addresses in plugin settings | 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,8 +29,7 @@ class SendEmailPluginTest < ActiveSupport::TestCase | ||
29 | should 'expand macro used on form on profile context' do | 29 | should 'expand macro used on form on profile context' do |
30 | profile = fast_create(Community) | 30 | profile = fast_create(Community) |
31 | @plugin.context.stubs(:profile).returns(profile) | 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 | assert_match /profile\/#{profile.identifier}\/plugin\/send_email\/deliver/, @plugin.parse_content(article.to_html, nil).first | 33 | assert_match /profile\/#{profile.identifier}\/plugin\/send_email\/deliver/, @plugin.parse_content(article.to_html, nil).first |
35 | end | 34 | end |
36 | 35 |
plugins/solr/lib/ext/article.rb
@@ -72,13 +72,7 @@ class Article | @@ -72,13 +72,7 @@ class Article | ||
72 | end | 72 | end |
73 | 73 | ||
74 | def solr_plugin_f_type | 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 | end | 76 | end |
83 | 77 | ||
84 | def solr_plugin_f_profile_type | 78 | def solr_plugin_f_profile_type |
@@ -111,8 +105,6 @@ class Article | @@ -111,8 +105,6 @@ class Article | ||
111 | # see http://stackoverflow.com/questions/4138957/activerecordsubclassnotfound-error-when-using-sti-in-rails/4139245 | 105 | # see http://stackoverflow.com/questions/4138957/activerecordsubclassnotfound-error-when-using-sti-in-rails/4139245 |
112 | UploadedFile | 106 | UploadedFile |
113 | TextArticle | 107 | TextArticle |
114 | - TinyMceArticle | ||
115 | - TextileArticle | ||
116 | Folder | 108 | Folder |
117 | EnterpriseHomepage | 109 | EnterpriseHomepage |
118 | Gallery | 110 | Gallery |
plugins/solr/test/unit/article_test.rb
@@ -82,7 +82,7 @@ class ArticleTest < ActiveSupport::TestCase | @@ -82,7 +82,7 @@ class ArticleTest < ActiveSupport::TestCase | ||
82 | should 'index comments body together with article' do | 82 | should 'index comments body together with article' do |
83 | TestSolr.enable | 83 | TestSolr.enable |
84 | owner = create_user('testuser').person | 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 | c1 = Comment.create!(:title => 'test comment', :body => 'anything', :author => owner, :source => art) | 86 | c1 = Comment.create!(:title => 'test comment', :body => 'anything', :author => owner, :source => art) |
87 | 87 | ||
88 | assert_includes Article.find_by_contents('anything')[:results], art | 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,7 +131,7 @@ class ProfileTest < ActiveSupport::TestCase | ||
131 | should 'index comments title together with article' do | 131 | should 'index comments title together with article' do |
132 | TestSolr.enable | 132 | TestSolr.enable |
133 | owner = create_user('testuser').person | 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 | c1 = Comment.create(:title => 'a nice comment', :body => 'anything', :author => owner, :source => art ); c1.save! | 135 | c1 = Comment.create(:title => 'a nice comment', :body => 'anything', :author => owner, :source => art ); c1.save! |
136 | 136 | ||
137 | assert_includes Article.find_by_contents('nice')[:results], art | 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,10 +8,10 @@ class TextArticleTest < ActiveSupport::TestCase | ||
8 | 8 | ||
9 | attr_accessor :environment | 9 | attr_accessor :environment |
10 | 10 | ||
11 | - should 'found TextileArticle by TextArticle indexes' do | 11 | + should 'found TextArticle by TextArticle indexes' do |
12 | TestSolr.enable | 12 | TestSolr.enable |
13 | person = create_user('testuser').person | 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 | end | 16 | end |
17 | end | 17 | end |
plugins/solr/test/unit/textile_article_test.rb
@@ -1,10 +0,0 @@ | @@ -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,13 +11,13 @@ class TinyMceArticleTest < ActiveSupport::TestCase | ||
11 | 11 | ||
12 | should 'be found when searching for articles by query' do | 12 | should 'be found when searching for articles by query' do |
13 | TestSolr.enable | 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 | assert_includes Article.find_by_contents('article')[:results], tma | 16 | assert_includes Article.find_by_contents('article')[:results], tma |
17 | end | 17 | end |
18 | 18 | ||
19 | should 'define type facet' do | 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 | end | 22 | end |
23 | end | 23 | end |
plugins/variables/doc/variables.textile
@@ -4,12 +4,12 @@ A set of simple variables to be used in a macro context. | @@ -4,12 +4,12 @@ A set of simple variables to be used in a macro context. | ||
4 | 4 | ||
5 | h2. Usage | 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 | article with HTML support | 8 | article with HTML support |
9 | * Add a HTML div tag with css class "macro" (see Example) | 9 | * Add a HTML div tag with css class "macro" (see Example) |
10 | * Add inner that div tag the variable desired, like {profile} | 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 | The Noosfero's macros add a extra button in toolbar of the editor | 14 | The Noosfero's macros add a extra button in toolbar of the editor |
15 | to use macros in a single way, that way this plugin add a option | 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,7 +5,7 @@ class VotePluginProfileControllerTest < ActionController::TestCase | ||
5 | 5 | ||
6 | def setup | 6 | def setup |
7 | @profile = create_user('profile').person | 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 | @comment = Comment.new(:source => @article, :author => @profile, :body => 'test') | 9 | @comment = Comment.new(:source => @article, :author => @profile, :body => 'test') |
10 | @comment.save! | 10 | @comment.save! |
11 | login_as(@profile.identifier) | 11 | login_as(@profile.identifier) |
plugins/vote/test/unit/vote_plugin_test.rb
@@ -5,7 +5,7 @@ class VotePluginTest < ActiveSupport::TestCase | @@ -5,7 +5,7 @@ class VotePluginTest < ActiveSupport::TestCase | ||
5 | def setup | 5 | def setup |
6 | @plugin = VotePlugin.new | 6 | @plugin = VotePlugin.new |
7 | @person = create_user('user').person | 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 | @comment = Comment.create!(:source => @article, :author => @person, :body => 'test') | 9 | @comment = Comment.create!(:source => @article, :author => @person, :body => 'test') |
10 | end | 10 | end |
11 | 11 |
public/javascripts/email_templates.js
@@ -4,7 +4,7 @@ jQuery(document).ready(function($) { | @@ -4,7 +4,7 @@ jQuery(document).ready(function($) { | ||
4 | 4 | ||
5 | $.getJSON($(this).data('url'), {id: $(this).val()}, function(data) { | 5 | $.getJSON($(this).data('url'), {id: $(this).val()}, function(data) { |
6 | $('#mailing-form #mailing_subject').val(data.parsed_subject); | 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,10 +13,13 @@ noosfero.tinymce = { | ||
13 | }, | 13 | }, |
14 | 14 | ||
15 | init: function(_options) { | 15 | init: function(_options) { |
16 | - var options = jQuery.extend({}, this.defaultOptions, _options) | 16 | + var options = jQuery.extend({}, this.defaultOptions, _options); |
17 | // just init. initing this is necessary to add some buttons to the toolbar | 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,13 +9,13 @@ TAGS = ['free-software', 'noosfero', 'development', 'rails', 'ruby'] | ||
9 | EVENT_SUBJECTS = ['International Conference on %s', '%s day', '%s World Congress', '%s World Forum', '%s Summit', '%s Week'] | 9 | EVENT_SUBJECTS = ['International Conference on %s', '%s day', '%s World Congress', '%s World Forum', '%s Summit', '%s Week'] |
10 | THEMES = ['Sustainability', 'Free Software', 'Climate Change', 'Environment', 'Agile Development', 'Solidarity Economy', 'Debian', 'Perl'] | 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 | for subject in SUBJECTS | 13 | for subject in SUBJECTS |
14 | rand(20).times do |i| | 14 | rand(20).times do |i| |
15 | profile = profiles.sample | 15 | profile = profiles.sample |
16 | name = "%s #{subject}" % profile.name | 16 | name = "%s #{subject}" % profile.name |
17 | next if profile.articles.where(:slug => name.to_slug).first | 17 | next if profile.articles.where(:slug => name.to_slug).first |
18 | - article = TinyMceArticle.new( | 18 | + article = TextArticle.new( |
19 | :name => name, | 19 | :name => name, |
20 | :body => name, | 20 | :body => name, |
21 | :tag_list => [TAGS.sample, TAGS.sample], | 21 | :tag_list => [TAGS.sample, TAGS.sample], |
@@ -71,7 +71,7 @@ for subject in SUBJECTS | @@ -71,7 +71,7 @@ for subject in SUBJECTS | ||
71 | rand(20).times do |i| | 71 | rand(20).times do |i| |
72 | profile = profiles.sample | 72 | profile = profiles.sample |
73 | name = "%s #{subject}" % profile.name | 73 | name = "%s #{subject}" % profile.name |
74 | - article = TinyMceArticle.new( | 74 | + article = TextArticle.new( |
75 | :name => name, | 75 | :name => name, |
76 | :body => name, | 76 | :body => name, |
77 | :tag_list => [TAGS.sample, TAGS.sample], | 77 | :tag_list => [TAGS.sample, TAGS.sample], |
test/api/activities_test.rb
@@ -107,7 +107,7 @@ class ActivitiesTest < ActiveSupport::TestCase | @@ -107,7 +107,7 @@ class ActivitiesTest < ActiveSupport::TestCase | ||
107 | 107 | ||
108 | should 'scrap activity return leave_scrap verb' do | 108 | should 'scrap activity return leave_scrap verb' do |
109 | ActionTracker::Record.destroy_all | 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 | create(Scrap, :sender_id => person.id, :receiver_id => person.id) | 111 | create(Scrap, :sender_id => person.id, :receiver_id => person.id) |
112 | get "/api/v1/profiles/#{person.id}/activities?#{params.to_query}" | 112 | get "/api/v1/profiles/#{person.id}/activities?#{params.to_query}" |
113 | json = JSON.parse(last_response.body) | 113 | json = JSON.parse(last_response.body) |
test/api/articles_test.rb
@@ -37,8 +37,8 @@ class ArticlesTest < ActiveSupport::TestCase | @@ -37,8 +37,8 @@ class ArticlesTest < ActiveSupport::TestCase | ||
37 | should 'list all text articles' do | 37 | should 'list all text articles' do |
38 | profile = Community.create(identifier: 'my-community', name: 'name-my-community') | 38 | profile = Community.create(identifier: 'my-community', name: 'name-my-community') |
39 | a1 = fast_create(TextArticle, :profile_id => profile.id) | 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 | params['content_type']='TextArticle' | 42 | params['content_type']='TextArticle' |
43 | get "api/v1/communities/#{profile.id}/articles?#{params.to_query}" | 43 | get "api/v1/communities/#{profile.id}/articles?#{params.to_query}" |
44 | json = JSON.parse(last_response.body) | 44 | json = JSON.parse(last_response.body) |
@@ -138,8 +138,8 @@ class ArticlesTest < ActiveSupport::TestCase | @@ -138,8 +138,8 @@ class ArticlesTest < ActiveSupport::TestCase | ||
138 | should 'list all text articles of children' do | 138 | should 'list all text articles of children' do |
139 | article = fast_create(Article, :profile_id => user.person.id, :name => "Some thing") | 139 | article = fast_create(Article, :profile_id => user.person.id, :name => "Some thing") |
140 | child1 = fast_create(TextArticle, :parent_id => article.id, :profile_id => user.person.id, :name => "Some thing 1") | 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 | get "/api/v1/articles/#{article.id}/children?#{params.to_query}" | 143 | get "/api/v1/articles/#{article.id}/children?#{params.to_query}" |
144 | json = JSON.parse(last_response.body) | 144 | json = JSON.parse(last_response.body) |
145 | assert_equivalent [child1.id, child2.id, child3.id], json["articles"].map { |a| a["id"] } | 145 | assert_equivalent [child1.id, child2.id, child3.id], json["articles"].map { |a| a["id"] } |
@@ -473,7 +473,7 @@ class ArticlesTest < ActiveSupport::TestCase | @@ -473,7 +473,7 @@ class ArticlesTest < ActiveSupport::TestCase | ||
473 | assert_kind_of TextArticle, Article.last | 473 | assert_kind_of TextArticle, Article.last |
474 | end | 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 | profile = fast_create(kind.camelcase.constantize, :environment_id => environment.id) | 477 | profile = fast_create(kind.camelcase.constantize, :environment_id => environment.id) |
478 | Person.any_instance.stubs(:can_post_content?).with(profile).returns(true) | 478 | Person.any_instance.stubs(:can_post_content?).with(profile).returns(true) |
479 | 479 | ||
@@ -481,7 +481,7 @@ class ArticlesTest < ActiveSupport::TestCase | @@ -481,7 +481,7 @@ class ArticlesTest < ActiveSupport::TestCase | ||
481 | post "/api/v1/#{kind.pluralize}/#{profile.id}/articles?#{params.to_query}" | 481 | post "/api/v1/#{kind.pluralize}/#{profile.id}/articles?#{params.to_query}" |
482 | json = JSON.parse(last_response.body) | 482 | json = JSON.parse(last_response.body) |
483 | 483 | ||
484 | - assert_kind_of TinyMceArticle, Article.last | 484 | + assert_kind_of TextArticle, Article.last |
485 | end | 485 | end |
486 | 486 | ||
487 | should "#{kind}: not create article with invalid article content type" do | 487 | should "#{kind}: not create article with invalid article content type" do |
@@ -567,12 +567,12 @@ class ArticlesTest < ActiveSupport::TestCase | @@ -567,12 +567,12 @@ class ArticlesTest < ActiveSupport::TestCase | ||
567 | assert_kind_of TextArticle, Article.last | 567 | assert_kind_of TextArticle, Article.last |
568 | end | 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 | params[:article] = {:name => "Title"} | 571 | params[:article] = {:name => "Title"} |
572 | post "/api/v1/people/#{user.person.id}/articles?#{params.to_query}" | 572 | post "/api/v1/people/#{user.person.id}/articles?#{params.to_query}" |
573 | json = JSON.parse(last_response.body) | 573 | json = JSON.parse(last_response.body) |
574 | 574 | ||
575 | - assert_kind_of TinyMceArticle, Article.last | 575 | + assert_kind_of TextArticle, Article.last |
576 | end | 576 | end |
577 | 577 | ||
578 | should 'person not create article with invalid article content type' do | 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,7 +99,7 @@ class Api::HelpersTest < ActiveSupport::TestCase | ||
99 | end | 99 | end |
100 | 100 | ||
101 | should 'parse_content_type return all content types as an array' do | 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 | end | 103 | end |
104 | 104 | ||
105 | should 'find_article return article by id in list passed for user with permission' do | 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,16 +42,16 @@ class SearchTest < ActiveSupport::TestCase | ||
42 | should 'not list articles of wrong type' do | 42 | should 'not list articles of wrong type' do |
43 | Article.delete_all | 43 | Article.delete_all |
44 | fast_create(Article, :profile_id => person.id) | 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 | json = JSON.parse(last_response.body) | 46 | json = JSON.parse(last_response.body) |
47 | assert_empty json['articles'] | 47 | assert_empty json['articles'] |
48 | end | 48 | end |
49 | 49 | ||
50 | should 'list articles of one type' do | 50 | should 'list articles of one type' do |
51 | fast_create(Article, :profile_id => person.id) | 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 | json = JSON.parse(last_response.body) | 55 | json = JSON.parse(last_response.body) |
56 | assert_equal article.id, json['articles'].first['id'] | 56 | assert_equal article.id, json['articles'].first['id'] |
57 | end | 57 | end |
@@ -59,8 +59,8 @@ class SearchTest < ActiveSupport::TestCase | @@ -59,8 +59,8 @@ class SearchTest < ActiveSupport::TestCase | ||
59 | should 'list articles of one type and query string' do | 59 | should 'list articles of one type and query string' do |
60 | fast_create(Article, :profile_id => person.id, :name => 'some article') | 60 | fast_create(Article, :profile_id => person.id, :name => 'some article') |
61 | fast_create(Article, :profile_id => person.id, :name => 'Some thing') | 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 | json = JSON.parse(last_response.body) | 64 | json = JSON.parse(last_response.body) |
65 | assert_equal 1, json['articles'].count | 65 | assert_equal 1, json['articles'].count |
66 | assert_equal article.id, json['articles'].first['id'] | 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,38 +97,6 @@ class ApplicationControllerTest < ActionController::TestCase | ||
97 | }) | 97 | }) |
98 | end | 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 | def test_shouldnt_generate_help_box_markup_when_no_block_is_passed | 100 | def test_shouldnt_generate_help_box_markup_when_no_block_is_passed |
133 | get :help_without_block | 101 | get :help_without_block |
134 | assert_no_tag({ | 102 | assert_no_tag({ |
test/functional/cms_controller_test.rb
@@ -50,26 +50,26 @@ class CmsControllerTest < ActionController::TestCase | @@ -50,26 +50,26 @@ class CmsControllerTest < ActionController::TestCase | ||
50 | assert_template 'select_article_type' | 50 | assert_template 'select_article_type' |
51 | 51 | ||
52 | # TODO add more types here !! | 52 | # TODO add more types here !! |
53 | - [ TinyMceArticle, TextileArticle ].each do |item| | 53 | + [TextArticle ].each do |item| |
54 | assert_tag :tag => 'a', :attributes => { :href => "/myprofile/#{profile.identifier}/cms/new?type=#{item.name}" } | 54 | assert_tag :tag => 'a', :attributes => { :href => "/myprofile/#{profile.identifier}/cms/new?type=#{item.name}" } |
55 | end | 55 | end |
56 | end | 56 | end |
57 | 57 | ||
58 | should 'present edit screen after choosing article type' do | 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 | assert_template 'edit' | 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 | end | 63 | end |
64 | 64 | ||
65 | should 'be able to save a document' do | 65 | should 'be able to save a document' do |
66 | assert_difference 'Article.count' do | 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 | end | 68 | end |
69 | end | 69 | end |
70 | 70 | ||
71 | should 'display set as home page link to non folder' do | 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 | Article.stubs(:short_description).returns('bli') | 73 | Article.stubs(:short_description).returns('bli') |
74 | get :index, :profile => profile.identifier | 74 | get :index, :profile => profile.identifier |
75 | assert_tag :tag => 'a', :content => 'Use as homepage', :attributes => { :href => "/myprofile/#{profile.identifier}/cms/set_home_page/#{a.id}" } | 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,7 +198,7 @@ class CmsControllerTest < ActionController::TestCase | ||
198 | should 'set last_changed_by when creating article' do | 198 | should 'set last_changed_by when creating article' do |
199 | login_as(profile.identifier) | 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 | a = profile.articles.find_by(path: 'changed-by-me') | 203 | a = profile.articles.find_by(path: 'changed-by-me') |
204 | assert_not_nil a | 204 | assert_not_nil a |
@@ -222,7 +222,7 @@ class CmsControllerTest < ActionController::TestCase | @@ -222,7 +222,7 @@ class CmsControllerTest < ActionController::TestCase | ||
222 | 222 | ||
223 | should 'be able to set label to article image' do | 223 | should 'be able to set label to article image' do |
224 | login_as(profile.identifier) | 224 | login_as(profile.identifier) |
225 | - post :new, :type => TextileArticle.name, :profile => profile.identifier, | 225 | + post :new, :type => TextArticle.name, :profile => profile.identifier, |
226 | :article => { | 226 | :article => { |
227 | :name => 'adding-image-label', | 227 | :name => 'adding-image-label', |
228 | :image_builder => { | 228 | :image_builder => { |
@@ -449,7 +449,7 @@ class CmsControllerTest < ActionController::TestCase | @@ -449,7 +449,7 @@ class CmsControllerTest < ActionController::TestCase | ||
449 | article.save! | 449 | article.save! |
450 | 450 | ||
451 | get :new, :profile => profile.identifier, :parent_id => article.id, :cms => true | 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 | end | 453 | end |
454 | 454 | ||
455 | should 'not offer to create children if article does not accept them' do | 455 | should 'not offer to create children if article does not accept them' do |
@@ -510,7 +510,7 @@ class CmsControllerTest < ActionController::TestCase | @@ -510,7 +510,7 @@ class CmsControllerTest < ActionController::TestCase | ||
510 | c3 = env.categories.build(:name => "Test Category 3"); c3.save! | 510 | c3 = env.categories.build(:name => "Test Category 3"); c3.save! |
511 | 511 | ||
512 | # post is in c1 and c3 | 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 | saved = profile.articles.find_by(name: 'adding-categories-test') | 515 | saved = profile.articles.find_by(name: 'adding-categories-test') |
516 | assert_includes saved.categories, c1 | 516 | assert_includes saved.categories, c1 |
@@ -525,34 +525,34 @@ class CmsControllerTest < ActionController::TestCase | @@ -525,34 +525,34 @@ class CmsControllerTest < ActionController::TestCase | ||
525 | c3 = env.categories.build(:name => "Test Category 3"); c3.save! | 525 | c3 = env.categories.build(:name => "Test Category 3"); c3.save! |
526 | 526 | ||
527 | # post is in c1, c3 and c3 | 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 | saved = profile.articles.find_by(name: 'adding-categories-test') | 530 | saved = profile.articles.find_by(name: 'adding-categories-test') |
531 | assert_equivalent [c1, c3], saved.categories.all | 531 | assert_equivalent [c1, c3], saved.categories.all |
532 | end | 532 | end |
533 | 533 | ||
534 | should 'filter html with white_list from tiny mce article name' do | 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 | assert_equal "<strong>test</strong>", assigns(:article).name | 536 | assert_equal "<strong>test</strong>", assigns(:article).name |
537 | end | 537 | end |
538 | 538 | ||
539 | should 'filter html with white_list from tiny mce article abstract' do | 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 | assert_equal "alert('text') article", assigns(:article).abstract | 541 | assert_equal "alert('text') article", assigns(:article).abstract |
542 | end | 542 | end |
543 | 543 | ||
544 | should 'filter html with white_list from tiny mce article body' do | 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 | assert_equal "the alert('text') of article ...", assigns(:article).body | 546 | assert_equal "the alert('text') of article ...", assigns(:article).body |
547 | end | 547 | end |
548 | 548 | ||
549 | should 'not filter html tags permitted from tiny mce article body' do | 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 | assert_equal "<b>the</b> alert('text') <strong>of</strong> article ...", assigns(:article).body | 551 | assert_equal "<b>the</b> alert('text') <strong>of</strong> article ...", assigns(:article).body |
552 | end | 552 | end |
553 | 553 | ||
554 | should 'sanitize tags' do | 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 | assert_sanitized assigns(:article).tag_list.join(', ') | 556 | assert_sanitized assigns(:article).tag_list.join(', ') |
557 | end | 557 | end |
558 | 558 | ||
@@ -562,7 +562,7 @@ class CmsControllerTest < ActionController::TestCase | @@ -562,7 +562,7 @@ class CmsControllerTest < ActionController::TestCase | ||
562 | profile.home_page = profile.blogs.find_by name: "Sample blog" | 562 | profile.home_page = profile.blogs.find_by name: "Sample blog" |
563 | profile.save! | 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 | assert_tag :tag => 'select', | 566 | assert_tag :tag => 'select', |
567 | :attributes => { :id => 'article_parent_id' }, | 567 | :attributes => { :id => 'article_parent_id' }, |
568 | :child => { | 568 | :child => { |
@@ -574,7 +574,7 @@ class CmsControllerTest < ActionController::TestCase | @@ -574,7 +574,7 @@ class CmsControllerTest < ActionController::TestCase | ||
574 | profile.articles.destroy_all | 574 | profile.articles.destroy_all |
575 | 575 | ||
576 | folder1 = fast_create(Folder, :profile_id => profile.id, :updated_at => DateTime.now - 1.hour) | 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 | folder2 = fast_create(Folder, :profile_id => profile.id, :updated_at => DateTime.now + 1.hour) | 578 | folder2 = fast_create(Folder, :profile_id => profile.id, :updated_at => DateTime.now + 1.hour) |
579 | 579 | ||
580 | get :index, :profile => profile.identifier | 580 | get :index, :profile => profile.identifier |
@@ -586,7 +586,7 @@ class CmsControllerTest < ActionController::TestCase | @@ -586,7 +586,7 @@ class CmsControllerTest < ActionController::TestCase | ||
586 | 586 | ||
587 | parent = fast_create(Folder, :profile_id => profile.id) | 587 | parent = fast_create(Folder, :profile_id => profile.id) |
588 | folder1 = fast_create(Folder, :parent_id => parent.id, :profile_id => profile.id, :updated_at => DateTime.now - 1.hour) | 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 | folder2 = fast_create(Folder, :parent_id => parent.id, :profile_id => profile.id, :updated_at => DateTime.now + 1.hour) | 590 | folder2 = fast_create(Folder, :parent_id => parent.id, :profile_id => profile.id, :updated_at => DateTime.now + 1.hour) |
591 | 591 | ||
592 | get :view, :profile => profile.identifier, :id => parent.id | 592 | get :view, :profile => profile.identifier, :id => parent.id |
@@ -606,14 +606,14 @@ class CmsControllerTest < ActionController::TestCase | @@ -606,14 +606,14 @@ class CmsControllerTest < ActionController::TestCase | ||
606 | end | 606 | end |
607 | 607 | ||
608 | should 'redirect to article after creating top-level article' do | 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 | assert_redirected_to @profile.articles.find_by(name: 'top-level-article').url | 611 | assert_redirected_to @profile.articles.find_by(name: 'top-level-article').url |
612 | end | 612 | end |
613 | 613 | ||
614 | should 'redirect to article after creating article inside a folder' do | 614 | should 'redirect to article after creating article inside a folder' do |
615 | f = Folder.new(:name => 'f'); profile.articles << f; f.save! | 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 | assert_redirected_to @profile.articles.find_by(name: 'article-inside-folder').url | 618 | assert_redirected_to @profile.articles.find_by(name: 'article-inside-folder').url |
619 | end | 619 | end |
@@ -626,7 +626,7 @@ class CmsControllerTest < ActionController::TestCase | @@ -626,7 +626,7 @@ class CmsControllerTest < ActionController::TestCase | ||
626 | 626 | ||
627 | should 'redirect back to article after editing article inside a folder' do | 627 | should 'redirect back to article after editing article inside a folder' do |
628 | f = Folder.new(:name => 'f'); profile.articles << f; f.save! | 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 | post :edit, :profile => profile.identifier, :id => a.id | 631 | post :edit, :profile => profile.identifier, :id => a.id |
632 | assert_redirected_to @profile.articles.find_by(name: 'article-inside-folder').url | 632 | assert_redirected_to @profile.articles.find_by(name: 'article-inside-folder').url |
@@ -653,7 +653,7 @@ class CmsControllerTest < ActionController::TestCase | @@ -653,7 +653,7 @@ class CmsControllerTest < ActionController::TestCase | ||
653 | 653 | ||
654 | should 'point back to folder when cancelling edition of an article inside it' do | 654 | should 'point back to folder when cancelling edition of an article inside it' do |
655 | f = Folder.new(:name => 'f'); profile.articles << f; f.save! | 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 | get :edit, :profile => profile.identifier, :id => a.id | 657 | get :edit, :profile => profile.identifier, :id => a.id |
658 | 658 | ||
659 | assert_tag :tag => 'a', :attributes => { :href => "/myprofile/#{profile.identifier}/cms/view/#{f.id}" }, :descendant => { :content => /Cancel/ } | 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,15 +723,15 @@ class CmsControllerTest < ActionController::TestCase | ||
723 | end | 723 | end |
724 | 724 | ||
725 | should 'be able to add image with alignment' do | 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 | assert_match /<img.*src="#".*>/, saved.body | 728 | assert_match /<img.*src="#".*>/, saved.body |
729 | assert_match /<img.*align="right".*>/, saved.body | 729 | assert_match /<img.*align="right".*>/, saved.body |
730 | end | 730 | end |
731 | 731 | ||
732 | should 'be able to add image with alignment when textile' do | 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 | assert_match /align="right"/, saved.body | 735 | assert_match /align="right"/, saved.body |
736 | end | 736 | end |
737 | 737 | ||
@@ -778,19 +778,19 @@ class CmsControllerTest < ActionController::TestCase | @@ -778,19 +778,19 @@ class CmsControllerTest < ActionController::TestCase | ||
778 | 778 | ||
779 | should 'record as coming from public view when creating article' do | 779 | should 'record as coming from public view when creating article' do |
780 | @request.expects(:referer).returns('http://colivre.net/testinguser/testingusers-home-page').at_least_once | 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 | assert_tag :tag => 'input', :attributes => { :type => 'hidden', :name => 'back_to', :value => @request.referer } | 782 | assert_tag :tag => 'input', :attributes => { :type => 'hidden', :name => 'back_to', :value => @request.referer } |
783 | assert_tag :tag => 'a', :descendant => { :content => 'Cancel' }, :attributes => { :href => 'http://colivre.net/testinguser/testingusers-home-page' } | 783 | assert_tag :tag => 'a', :descendant => { :content => 'Cancel' }, :attributes => { :href => 'http://colivre.net/testinguser/testingusers-home-page' } |
784 | end | 784 | end |
785 | 785 | ||
786 | should 'go to public view after creating article coming from there' do | 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 | assert_response :redirect | 788 | assert_response :redirect |
789 | assert_redirected_to @profile.articles.find_by(name: 'new-article-from-public-view').url | 789 | assert_redirected_to @profile.articles.find_by(name: 'new-article-from-public-view').url |
790 | end | 790 | end |
791 | 791 | ||
792 | should 'keep the back_to hint in unsuccessfull saves' do | 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 | assert_response :success | 794 | assert_response :success |
795 | assert_tag :tag => "input", :attributes => { :type => 'hidden', :name => 'back_to', :value => 'public_view' } | 795 | assert_tag :tag => "input", :attributes => { :type => 'hidden', :name => 'back_to', :value => 'public_view' } |
796 | end | 796 | end |
@@ -798,7 +798,7 @@ class CmsControllerTest < ActionController::TestCase | @@ -798,7 +798,7 @@ class CmsControllerTest < ActionController::TestCase | ||
798 | should 'create a private article child of private folder' do | 798 | should 'create a private article child of private folder' do |
799 | folder = build(Folder, :name => 'my intranet', :published => false); profile.articles << folder; folder.save! | 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 | folder.reload | 802 | folder.reload |
803 | 803 | ||
804 | refute assigns(:article).published? | 804 | refute assigns(:article).published? |
@@ -1198,7 +1198,7 @@ class CmsControllerTest < ActionController::TestCase | @@ -1198,7 +1198,7 @@ class CmsControllerTest < ActionController::TestCase | ||
1198 | end | 1198 | end |
1199 | end | 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 | e = Environment.default | 1202 | e = Environment.default |
1203 | e.enable('media_panel') | 1203 | e.enable('media_panel') |
1204 | e.save! | 1204 | e.save! |
@@ -1209,7 +1209,7 @@ class CmsControllerTest < ActionController::TestCase | @@ -1209,7 +1209,7 @@ class CmsControllerTest < ActionController::TestCase | ||
1209 | image = UploadedFile.create!(:profile => profile, :parent => image_folder, :uploaded_data => fixture_file_upload('/files/rails.png', 'image/png')) | 1209 | image = UploadedFile.create!(:profile => profile, :parent => image_folder, :uploaded_data => fixture_file_upload('/files/rails.png', 'image/png')) |
1210 | file = UploadedFile.create!(:profile => profile, :parent => non_image_folder, :uploaded_data => fixture_file_upload('/files/test.txt', 'text/plain')) | 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 | assert_tag :div, :attributes => { :class => "text-editor-sidebar" } | 1213 | assert_tag :div, :attributes => { :class => "text-editor-sidebar" } |
1214 | end | 1214 | end |
1215 | 1215 | ||
@@ -1225,7 +1225,7 @@ class CmsControllerTest < ActionController::TestCase | @@ -1225,7 +1225,7 @@ class CmsControllerTest < ActionController::TestCase | ||
1225 | end | 1225 | end |
1226 | 1226 | ||
1227 | should "display 'Publish' when profile is a person and is member of communities" do | 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 | c1 = fast_create(Community) | 1229 | c1 = fast_create(Community) |
1230 | c2 = fast_create(Community) | 1230 | c2 = fast_create(Community) |
1231 | c1.add_member(profile) | 1231 | c1.add_member(profile) |
@@ -1235,7 +1235,7 @@ class CmsControllerTest < ActionController::TestCase | @@ -1235,7 +1235,7 @@ class CmsControllerTest < ActionController::TestCase | ||
1235 | end | 1235 | end |
1236 | 1236 | ||
1237 | should "display 'Publish' when profile is a person and there is a portal community" do | 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 | environment = profile.environment | 1239 | environment = profile.environment |
1240 | environment.portal_community = fast_create(Community) | 1240 | environment.portal_community = fast_create(Community) |
1241 | environment.enable('use_portal_community') | 1241 | environment.enable('use_portal_community') |
@@ -1247,7 +1247,7 @@ class CmsControllerTest < ActionController::TestCase | @@ -1247,7 +1247,7 @@ class CmsControllerTest < ActionController::TestCase | ||
1247 | should "display 'Publish' when profile is a community" do | 1247 | should "display 'Publish' when profile is a community" do |
1248 | community = fast_create(Community) | 1248 | community = fast_create(Community) |
1249 | community.add_admin(profile) | 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 | Article.stubs(:short_description).returns('bli') | 1251 | Article.stubs(:short_description).returns('bli') |
1252 | get :index, :profile => community.identifier | 1252 | get :index, :profile => community.identifier |
1253 | assert_tag :tag => 'a', :attributes => {:href => "/myprofile/#{community.identifier}/cms/publish/#{a.id}"} | 1253 | assert_tag :tag => 'a', :attributes => {:href => "/myprofile/#{community.identifier}/cms/publish/#{a.id}"} |
@@ -1279,7 +1279,7 @@ class CmsControllerTest < ActionController::TestCase | @@ -1279,7 +1279,7 @@ class CmsControllerTest < ActionController::TestCase | ||
1279 | login_as :test_user | 1279 | login_as :test_user |
1280 | @controller.stubs(:user).returns(u) | 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 | assert_response :success | 1283 | assert_response :success |
1284 | assert_template 'edit' | 1284 | assert_template 'edit' |
1285 | end | 1285 | end |
@@ -1496,12 +1496,14 @@ class CmsControllerTest < ActionController::TestCase | @@ -1496,12 +1496,14 @@ class CmsControllerTest < ActionController::TestCase | ||
1496 | assert_select '#dynamic_recaptcha', 0 | 1496 | assert_select '#dynamic_recaptcha', 0 |
1497 | end | 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 | logout | 1500 | logout |
1501 | + profile.editor = Article::Editor::TINY_MCE | ||
1502 | + profile.save | ||
1501 | get :suggest_an_article, :profile => profile.identifier | 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 | end | 1507 | end |
1506 | 1508 | ||
1507 | should 'create a task suggest task to a profile' do | 1509 | should 'create a task suggest task to a profile' do |
@@ -1537,7 +1539,7 @@ class CmsControllerTest < ActionController::TestCase | @@ -1537,7 +1539,7 @@ class CmsControllerTest < ActionController::TestCase | ||
1537 | e = Environment.default | 1539 | e = Environment.default |
1538 | e.languages = ['ru'] | 1540 | e.languages = ['ru'] |
1539 | e.save | 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 | get :edit, :profile => @profile.identifier, :id => textile.id | 1543 | get :edit, :profile => @profile.identifier, :id => textile.id |
1542 | assert_tag :option, :attributes => { :selected => 'selected', :value => 'ru' }, :parent => { | 1544 | assert_tag :option, :attributes => { :selected => 'selected', :value => 'ru' }, :parent => { |
1543 | :tag => 'select', :attributes => { :id => 'article_language'} } | 1545 | :tag => 'select', :attributes => { :id => 'article_language'} } |
@@ -1547,16 +1549,16 @@ class CmsControllerTest < ActionController::TestCase | @@ -1547,16 +1549,16 @@ class CmsControllerTest < ActionController::TestCase | ||
1547 | e = Environment.default | 1549 | e = Environment.default |
1548 | e.languages = ['en', 'pt','fr','hy','de', 'ru', 'es', 'eo', 'it'] | 1550 | e.languages = ['en', 'pt','fr','hy','de', 'ru', 'es', 'eo', 'it'] |
1549 | e.save | 1551 | e.save |
1550 | - get :new, :profile => @profile.identifier, :type => 'TextileArticle' | 1552 | + get :new, :profile => @profile.identifier, :type => 'TextArticle' |
1551 | assert_equal Noosfero.locales.invert, assigns(:locales) | 1553 | assert_equal Noosfero.locales.invert, assigns(:locales) |
1552 | assert_tag :option, :attributes => { :value => '' }, :parent => { | 1554 | assert_tag :option, :attributes => { :value => '' }, :parent => { |
1553 | :tag => 'select', :attributes => { :id => 'article_language'} } | 1555 | :tag => 'select', :attributes => { :id => 'article_language'} } |
1554 | end | 1556 | end |
1555 | 1557 | ||
1556 | should 'add translation to an article' do | 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 | assert_difference 'Article.count' do | 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 | end | 1562 | end |
1561 | end | 1563 | end |
1562 | 1564 | ||
@@ -1616,20 +1618,20 @@ class CmsControllerTest < ActionController::TestCase | @@ -1616,20 +1618,20 @@ class CmsControllerTest < ActionController::TestCase | ||
1616 | 1618 | ||
1617 | should 'display accept comments option when creating forum post' do | 1619 | should 'display accept comments option when creating forum post' do |
1618 | profile.articles << f = Forum.new(:name => 'Forum for test') | 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 | assert_no_tag :tag => 'input', :attributes => {:name => 'article[accept_comments]', :value => 1, :type => 'hidden'} | 1622 | assert_no_tag :tag => 'input', :attributes => {:name => 'article[accept_comments]', :value => 1, :type => 'hidden'} |
1621 | assert_tag :tag => 'input', :attributes => {:name => 'article[accept_comments]', :value => 1, :type => 'checkbox'} | 1623 | assert_tag :tag => 'input', :attributes => {:name => 'article[accept_comments]', :value => 1, :type => 'checkbox'} |
1622 | end | 1624 | end |
1623 | 1625 | ||
1624 | should 'display accept comments option when creating an article that is not a forum post' do | 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 | assert_no_tag :tag => 'input', :attributes => {:name => 'article[accept_comments]', :value => 1, :type => 'hidden'} | 1628 | assert_no_tag :tag => 'input', :attributes => {:name => 'article[accept_comments]', :value => 1, :type => 'hidden'} |
1627 | assert_tag :tag => 'input', :attributes => {:name => 'article[accept_comments]', :value => 1, :type => 'checkbox'} | 1629 | assert_tag :tag => 'input', :attributes => {:name => 'article[accept_comments]', :value => 1, :type => 'checkbox'} |
1628 | end | 1630 | end |
1629 | 1631 | ||
1630 | should 'display accept comments option when editing forum post' do | 1632 | should 'display accept comments option when editing forum post' do |
1631 | profile.articles << f = Forum.new(:name => 'Forum for test') | 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 | get :edit, :profile => profile.identifier, :id => a.id | 1635 | get :edit, :profile => profile.identifier, :id => a.id |
1634 | assert_no_tag :tag => 'input', :attributes => {:name => 'article[accept_comments]', :value => 1, :type => 'hidden'} | 1636 | assert_no_tag :tag => 'input', :attributes => {:name => 'article[accept_comments]', :value => 1, :type => 'hidden'} |
1635 | assert_tag :tag => 'input', :attributes => {:name => 'article[accept_comments]', :value => 1, :type => 'checkbox'} | 1637 | assert_tag :tag => 'input', :attributes => {:name => 'article[accept_comments]', :value => 1, :type => 'checkbox'} |
@@ -1642,7 +1644,7 @@ class CmsControllerTest < ActionController::TestCase | @@ -1642,7 +1644,7 @@ class CmsControllerTest < ActionController::TestCase | ||
1642 | :topic_creation => 'self', | 1644 | :topic_creation => 'self', |
1643 | :body => 'Forum Body') | 1645 | :body => 'Forum Body') |
1644 | 1646 | ||
1645 | - post :new, :profile => profile.identifier, :type => 'TinyMceArticle', | 1647 | + post :new, :profile => profile.identifier, :type => 'TextArticle', |
1646 | :article => {:name => 'New Topic by linux', :body => 'Article Body', | 1648 | :article => {:name => 'New Topic by linux', :body => 'Article Body', |
1647 | :parent_id => f.id} | 1649 | :parent_id => f.id} |
1648 | 1650 | ||
@@ -1657,7 +1659,7 @@ class CmsControllerTest < ActionController::TestCase | @@ -1657,7 +1659,7 @@ class CmsControllerTest < ActionController::TestCase | ||
1657 | :topic_creation => 'related', | 1659 | :topic_creation => 'related', |
1658 | :body => 'Forum Body') | 1660 | :body => 'Forum Body') |
1659 | 1661 | ||
1660 | - post :new, :profile => profile.identifier, :type => 'TinyMceArticle', | 1662 | + post :new, :profile => profile.identifier, :type => 'TextArticle', |
1661 | :article => {:name => 'New Topic by linux', :body => 'Article Body', | 1663 | :article => {:name => 'New Topic by linux', :body => 'Article Body', |
1662 | :parent_id => f.id} | 1664 | :parent_id => f.id} |
1663 | 1665 | ||
@@ -1672,7 +1674,7 @@ class CmsControllerTest < ActionController::TestCase | @@ -1672,7 +1674,7 @@ class CmsControllerTest < ActionController::TestCase | ||
1672 | :topic_creation => 'users', | 1674 | :topic_creation => 'users', |
1673 | :body => 'Forum Body') | 1675 | :body => 'Forum Body') |
1674 | 1676 | ||
1675 | - post :new, :profile => profile.identifier, :type => 'TinyMceArticle', | 1677 | + post :new, :profile => profile.identifier, :type => 'TextArticle', |
1676 | :article => {:name => 'New Topic by linux', :body => 'Article Body', | 1678 | :article => {:name => 'New Topic by linux', :body => 'Article Body', |
1677 | :parent_id => f.id} | 1679 | :parent_id => f.id} |
1678 | 1680 | ||
@@ -1681,13 +1683,13 @@ class CmsControllerTest < ActionController::TestCase | @@ -1681,13 +1683,13 @@ class CmsControllerTest < ActionController::TestCase | ||
1681 | 1683 | ||
1682 | should 'display accept comments option when editing forum post with a different label' do | 1684 | should 'display accept comments option when editing forum post with a different label' do |
1683 | profile.articles << f = Forum.new(:name => 'Forum for test') | 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 | get :edit, :profile => profile.identifier, :id => a.id | 1687 | get :edit, :profile => profile.identifier, :id => a.id |
1686 | assert_tag :tag => 'label', :attributes => { :for => 'article_accept_comments' }, :content => _('This topic is opened for replies') | 1688 | assert_tag :tag => 'label', :attributes => { :for => 'article_accept_comments' }, :content => _('This topic is opened for replies') |
1687 | end | 1689 | end |
1688 | 1690 | ||
1689 | should 'display correct label for accept comments option for an article that is not a forum post' do | 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 | get :edit, :profile => profile.identifier, :id => a.id | 1693 | get :edit, :profile => profile.identifier, :id => a.id |
1692 | assert_tag :tag => 'label', :attributes => { :for => 'article_accept_comments' }, :content => _('I want to receive comments about this article') | 1694 | assert_tag :tag => 'label', :attributes => { :for => 'article_accept_comments' }, :content => _('I want to receive comments about this article') |
1693 | end | 1695 | end |
@@ -1711,7 +1713,7 @@ class CmsControllerTest < ActionController::TestCase | @@ -1711,7 +1713,7 @@ class CmsControllerTest < ActionController::TestCase | ||
1711 | end | 1713 | end |
1712 | 1714 | ||
1713 | should 'update article and be redirect to view_page' do | 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 | post :edit, :profile => @profile.identifier, :id => a.id, :article => { } | 1717 | post :edit, :profile => @profile.identifier, :id => a.id, :article => { } |
1716 | assert_redirected_to a.view_url | 1718 | assert_redirected_to a.view_url |
1717 | end | 1719 | end |
@@ -1730,12 +1732,14 @@ class CmsControllerTest < ActionController::TestCase | @@ -1730,12 +1732,14 @@ class CmsControllerTest < ActionController::TestCase | ||
1730 | end | 1732 | end |
1731 | 1733 | ||
1732 | should 'render TinyMce Editor for events' do | 1734 | should 'render TinyMce Editor for events' do |
1735 | + profile.editor = Article::Editor::TINY_MCE | ||
1736 | + profile.save | ||
1733 | get :new, :profile => @profile.identifier, :type => 'Event' | 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 | end | 1739 | end |
1736 | 1740 | ||
1737 | should 'identify form with classname of edited article' do | 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 | a = fast_create(klass, :profile_id => profile.id) | 1743 | a = fast_create(klass, :profile_id => profile.id) |
1740 | get :edit, :profile => profile.identifier, :id => a.id | 1744 | get :edit, :profile => profile.identifier, :id => a.id |
1741 | assert_tag :tag => 'form', :attributes => {:class => "#{a.type} #{a.type.to_css_class}"} | 1745 | assert_tag :tag => 'form', :attributes => {:class => "#{a.type} #{a.type.to_css_class}"} |
@@ -1771,14 +1775,6 @@ class CmsControllerTest < ActionController::TestCase | @@ -1771,14 +1775,6 @@ class CmsControllerTest < ActionController::TestCase | ||
1771 | assert_response :bad_request | 1775 | assert_response :bad_request |
1772 | end | 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 | should 'include new contents special types from plugins' do | 1778 | should 'include new contents special types from plugins' do |
1783 | class TestContentTypesPlugin < Noosfero::Plugin | 1779 | class TestContentTypesPlugin < Noosfero::Plugin |
1784 | def content_types | 1780 | def content_types |
@@ -1810,7 +1806,7 @@ class CmsControllerTest < ActionController::TestCase | @@ -1810,7 +1806,7 @@ class CmsControllerTest < ActionController::TestCase | ||
1810 | License.delete_all | 1806 | License.delete_all |
1811 | login_as(profile.identifier) | 1807 | login_as(profile.identifier) |
1812 | 1808 | ||
1813 | - get :new, :profile => profile.identifier, :type => 'TinyMceArticle' | 1809 | + get :new, :profile => profile.identifier, :type => 'TextArticle' |
1814 | assert_no_tag :tag => 'select', :attributes => {:id => 'article_license_id'} | 1810 | assert_no_tag :tag => 'select', :attributes => {:id => 'article_license_id'} |
1815 | end | 1811 | end |
1816 | 1812 | ||
@@ -1843,7 +1839,7 @@ class CmsControllerTest < ActionController::TestCase | @@ -1843,7 +1839,7 @@ class CmsControllerTest < ActionController::TestCase | ||
1843 | should 'set author when creating article' do | 1839 | should 'set author when creating article' do |
1844 | login_as(profile.identifier) | 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 | a = profile.articles.find_by(path: 'sample-article') | 1844 | a = profile.articles.find_by(path: 'sample-article') |
1849 | assert_not_nil a | 1845 | assert_not_nil a |
@@ -1869,7 +1865,7 @@ class CmsControllerTest < ActionController::TestCase | @@ -1869,7 +1865,7 @@ class CmsControllerTest < ActionController::TestCase | ||
1869 | folder = fast_create(Folder, :name=>'a', :profile_id => profile.id) | 1865 | folder = fast_create(Folder, :name=>'a', :profile_id => profile.id) |
1870 | gallery = fast_create(Gallery, :name=>'b', :profile_id => profile.id) | 1866 | gallery = fast_create(Gallery, :name=>'b', :profile_id => profile.id) |
1871 | blog = fast_create(Blog, :name=>'c', :profile_id => profile.id) | 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 | get :edit, :profile => profile.identifier, :id => article.id | 1869 | get :edit, :profile => profile.identifier, :id => article.id |
1874 | assert_template 'edit' | 1870 | assert_template 'edit' |
1875 | assert_tag :tag => 'select', :attributes => { :name => "parent_id" }, | 1871 | assert_tag :tag => 'select', :attributes => { :name => "parent_id" }, |
@@ -1897,7 +1893,7 @@ class CmsControllerTest < ActionController::TestCase | @@ -1897,7 +1893,7 @@ class CmsControllerTest < ActionController::TestCase | ||
1897 | end | 1893 | end |
1898 | 1894 | ||
1899 | should 'go back to specified url when saving with success' do | 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 | assert_redirected_to '/' | 1897 | assert_redirected_to '/' |
1902 | end | 1898 | end |
1903 | 1899 | ||
@@ -1927,7 +1923,7 @@ class CmsControllerTest < ActionController::TestCase | @@ -1927,7 +1923,7 @@ class CmsControllerTest < ActionController::TestCase | ||
1927 | should 'set created_by when creating article' do | 1923 | should 'set created_by when creating article' do |
1928 | login_as(profile.identifier) | 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 | a = profile.articles.find_by(path: 'changed-by-me') | 1928 | a = profile.articles.find_by(path: 'changed-by-me') |
1933 | assert_not_nil a | 1929 | assert_not_nil a |
@@ -1973,13 +1969,13 @@ class CmsControllerTest < ActionController::TestCase | @@ -1973,13 +1969,13 @@ class CmsControllerTest < ActionController::TestCase | ||
1973 | profile.articles << f | 1969 | profile.articles << f |
1974 | f.save! | 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 | :article => { :name => 'Main Article', :body => 'some content' } | 1973 | :article => { :name => 'Main Article', :body => 'some content' } |
1978 | 1974 | ||
1979 | main_article = profile.articles.find_by(name: 'Main Article') | 1975 | main_article = profile.articles.find_by(name: 'Main Article') |
1980 | assert_not_nil main_article | 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 | :id => main_article.id, :clone => true | 1979 | :id => main_article.id, :clone => true |
1984 | 1980 | ||
1985 | cloned_main_article = profile.articles.find_by(name: 'Main Article') | 1981 | cloned_main_article = profile.articles.find_by(name: 'Main Article') |
@@ -1988,7 +1984,7 @@ class CmsControllerTest < ActionController::TestCase | @@ -1988,7 +1984,7 @@ class CmsControllerTest < ActionController::TestCase | ||
1988 | assert_equal main_article.parent_id, cloned_main_article.parent_id | 1984 | assert_equal main_article.parent_id, cloned_main_article.parent_id |
1989 | 1985 | ||
1990 | get :new, :profile => profile.identifier, :id => cloned_main_article.id, | 1986 | get :new, :profile => profile.identifier, :id => cloned_main_article.id, |
1991 | - :clone => true, :type => 'TinyMceArticle' | 1987 | + :clone => true, :type => 'TextArticle' |
1992 | 1988 | ||
1993 | assert_match main_article.body, @response.body | 1989 | assert_match main_article.body, @response.body |
1994 | end | 1990 | end |
@@ -2005,7 +2001,7 @@ class CmsControllerTest < ActionController::TestCase | @@ -2005,7 +2001,7 @@ class CmsControllerTest < ActionController::TestCase | ||
2005 | end | 2001 | end |
2006 | end | 2002 | end |
2007 | 2003 | ||
2008 | - [TextileArticle, Event, TinyMceArticle].each do |klass| | 2004 | + [TextArticle, Event].each do |klass| |
2009 | should "set no_design_blocks as true when create #{klass.name}" do | 2005 | should "set no_design_blocks as true when create #{klass.name}" do |
2010 | get :new, profile: profile.identifier, type: klass.name | 2006 | get :new, profile: profile.identifier, type: klass.name |
2011 | assert assigns(:no_design_blocks) | 2007 | assert assigns(:no_design_blocks) |
@@ -2018,7 +2014,7 @@ class CmsControllerTest < ActionController::TestCase | @@ -2018,7 +2014,7 @@ class CmsControllerTest < ActionController::TestCase | ||
2018 | assert !assigns(:no_design_blocks) | 2014 | assert !assigns(:no_design_blocks) |
2019 | end | 2015 | end |
2020 | 2016 | ||
2021 | - [TextileArticle, Event, TinyMceArticle].each do |klass| | 2017 | + [TextArticle, Event].each do |klass| |
2022 | should "set no_design_blocks as true when edit #{klass.name}" do | 2018 | should "set no_design_blocks as true when edit #{klass.name}" do |
2023 | article = fast_create(klass, profile_id: profile.id) | 2019 | article = fast_create(klass, profile_id: profile.id) |
2024 | get :edit, profile: profile.identifier, id: article.id | 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,7 +119,7 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
119 | end | 119 | end |
120 | 120 | ||
121 | should "display image label on article image" do | 121 | should "display image label on article image" do |
122 | - page = TinyMceArticle.create!( | 122 | + page = TextArticle.create!( |
123 | :profile => profile, | 123 | :profile => profile, |
124 | :name => 'myarticle', | 124 | :name => 'myarticle', |
125 | :image_builder => { | 125 | :image_builder => { |
@@ -453,7 +453,7 @@ class ContentViewerControllerTest < ActionController::TestCase | @@ -453,7 +453,7 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
453 | should 'list unpublished posts to owner with a different class' do | 453 | should 'list unpublished posts to owner with a different class' do |
454 | login_as('testinguser') | 454 | login_as('testinguser') |
455 | blog = Blog.create!(:name => 'A blog test', :profile => profile) | 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 | get :view_page, :profile => profile.identifier, :page => [blog.path] | 458 | get :view_page, :profile => profile.identifier, :page => [blog.path] |
459 | assert_tag :tag => 'div', :attributes => {:class => /not-published/} | 459 | assert_tag :tag => 'div', :attributes => {:class => /not-published/} |
@@ -461,7 +461,7 @@ class ContentViewerControllerTest < ActionController::TestCase | @@ -461,7 +461,7 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
461 | 461 | ||
462 | should 'not list unpublished posts to a not logged person' do | 462 | should 'not list unpublished posts to a not logged person' do |
463 | blog = Blog.create!(:name => 'A blog test', :profile => profile) | 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 | get :view_page, :profile => profile.identifier, :page => [blog.path] | 466 | get :view_page, :profile => profile.identifier, :page => [blog.path] |
467 | assert_no_tag :tag => 'a', :content => "Post" | 467 | assert_no_tag :tag => 'a', :content => "Post" |
@@ -470,7 +470,7 @@ class ContentViewerControllerTest < ActionController::TestCase | @@ -470,7 +470,7 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
470 | should 'display pagination links of blog' do | 470 | should 'display pagination links of blog' do |
471 | blog = Blog.create!(:name => 'A blog test', :profile => profile, :posts_per_page => 5) | 471 | blog = Blog.create!(:name => 'A blog test', :profile => profile, :posts_per_page => 5) |
472 | for n in 1..10 | 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 | end | 474 | end |
475 | assert_equal 10, blog.posts.size | 475 | assert_equal 10, blog.posts.size |
476 | 476 | ||
@@ -481,7 +481,7 @@ class ContentViewerControllerTest < ActionController::TestCase | @@ -481,7 +481,7 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
481 | should 'display first page of blog posts' do | 481 | should 'display first page of blog posts' do |
482 | blog = Blog.create!(:name => 'My blog', :profile => profile, :posts_per_page => 5) | 482 | blog = Blog.create!(:name => 'My blog', :profile => profile, :posts_per_page => 5) |
483 | for n in 1..10 | 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 | end | 485 | end |
486 | assert_equal 10, blog.posts.size | 486 | assert_equal 10, blog.posts.size |
487 | 487 | ||
@@ -497,7 +497,7 @@ class ContentViewerControllerTest < ActionController::TestCase | @@ -497,7 +497,7 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
497 | should 'display others pages of blog posts' do | 497 | should 'display others pages of blog posts' do |
498 | blog = Blog.create!(:name => 'My blog', :profile => profile, :posts_per_page => 5) | 498 | blog = Blog.create!(:name => 'My blog', :profile => profile, :posts_per_page => 5) |
499 | for n in 1..10 | 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 | end | 501 | end |
502 | assert_equal 10, blog.posts.size | 502 | assert_equal 10, blog.posts.size |
503 | 503 | ||
@@ -514,8 +514,8 @@ class ContentViewerControllerTest < ActionController::TestCase | @@ -514,8 +514,8 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
514 | blog = Blog.create!(:name => "blog", :profile => profile) | 514 | blog = Blog.create!(:name => "blog", :profile => profile) |
515 | profile.articles << blog | 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 | blog.children << past_post | 519 | blog.children << past_post |
520 | blog.children << current_post | 520 | blog.children << current_post |
521 | 521 | ||
@@ -530,7 +530,7 @@ class ContentViewerControllerTest < ActionController::TestCase | @@ -530,7 +530,7 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
530 | should 'give link to create new article inside folder when view child of folder' do | 530 | should 'give link to create new article inside folder when view child of folder' do |
531 | login_as('testinguser') | 531 | login_as('testinguser') |
532 | folder = Folder.create!(:name => 'myfolder', :profile => @profile) | 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 | xhr :get, :view_page, :profile => 'testinguser', :page => [ 'myfolder', 'children-article' ], :toolbar => true | 534 | xhr :get, :view_page, :profile => 'testinguser', :page => [ 'myfolder', 'children-article' ], :toolbar => true |
535 | assert_tag :tag => 'div', :attributes => { :id => 'article-actions' }, :descendant => { :tag => 'a', :attributes => { :href => "/myprofile/testinguser/cms/new?parent_id=#{folder.id}" } } | 535 | assert_tag :tag => 'div', :attributes => { :id => 'article-actions' }, :descendant => { :tag => 'a', :attributes => { :href => "/myprofile/testinguser/cms/new?parent_id=#{folder.id}" } } |
536 | end | 536 | end |
@@ -555,14 +555,14 @@ class ContentViewerControllerTest < ActionController::TestCase | @@ -555,14 +555,14 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
555 | login_as(profile.identifier) | 555 | login_as(profile.identifier) |
556 | a = Blog.create!(:name => 'article folder', :profile => profile) | 556 | a = Blog.create!(:name => 'article folder', :profile => profile) |
557 | Article.stubs(:short_description).returns('bli') | 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 | xhr :get, :view_page, :profile => profile.identifier, :page => [t.path], :toolbar => true | 559 | xhr :get, :view_page, :profile => profile.identifier, :page => [t.path], :toolbar => true |
560 | assert_tag :tag => 'a', :content => 'New post' | 560 | assert_tag :tag => 'a', :content => 'New post' |
561 | end | 561 | end |
562 | 562 | ||
563 | should 'display button to remove article' do | 563 | should 'display button to remove article' do |
564 | login_as(profile.identifier) | 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 | xhr :get, :view_page, :profile => profile.identifier, :page => [t.path], :toolbar => true | 566 | xhr :get, :view_page, :profile => profile.identifier, :page => [t.path], :toolbar => true |
567 | assert_tag :tag => 'a', :content => 'Delete', :attributes => {:href => "/myprofile/#{profile.identifier}/cms/destroy/#{t.id}"} | 567 | assert_tag :tag => 'a', :content => 'Delete', :attributes => {:href => "/myprofile/#{profile.identifier}/cms/destroy/#{t.id}"} |
568 | end | 568 | end |
@@ -584,7 +584,7 @@ class ContentViewerControllerTest < ActionController::TestCase | @@ -584,7 +584,7 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
584 | should 'add meta tag to rss feed on view post blog' do | 584 | should 'add meta tag to rss feed on view post blog' do |
585 | login_as(profile.identifier) | 585 | login_as(profile.identifier) |
586 | blog = Blog.create!(:name => 'Blog', :profile => profile) | 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 | get :view_page, :profile => profile.identifier, :page => ['blog', 'first-post'] | 588 | get :view_page, :profile => profile.identifier, :page => ['blog', 'first-post'] |
589 | assert_tag :tag => 'link', :attributes => { :rel => 'alternate', :type => 'application/rss+xml', :title => 'Blog', :href => "http://#{environment.default_hostname}/testinguser/blog/feed" } | 589 | assert_tag :tag => 'link', :attributes => { :rel => 'alternate', :type => 'application/rss+xml', :title => 'Blog', :href => "http://#{environment.default_hostname}/testinguser/blog/feed" } |
590 | end | 590 | end |
@@ -718,13 +718,13 @@ class ContentViewerControllerTest < ActionController::TestCase | @@ -718,13 +718,13 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
718 | end | 718 | end |
719 | 719 | ||
720 | should 'display source from article' do | 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 | get :view_page, :profile => profile.identifier, :page => ['article-one'] | 722 | get :view_page, :profile => profile.identifier, :page => ['article-one'] |
723 | assert_tag :tag => 'div', :attributes => { :id => 'article-source' }, :content => /http:\/\/www.original-source.invalid/ | 723 | assert_tag :tag => 'div', :attributes => { :id => 'article-source' }, :content => /http:\/\/www.original-source.invalid/ |
724 | end | 724 | end |
725 | 725 | ||
726 | should 'not display source if article has no source' do | 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 | get :view_page, :profile => profile.identifier, :page => ['article-one'] | 728 | get :view_page, :profile => profile.identifier, :page => ['article-one'] |
729 | assert_no_tag :tag => 'div', :attributes => { :id => 'article-source' } | 729 | assert_no_tag :tag => 'div', :attributes => { :id => 'article-source' } |
730 | end | 730 | end |
@@ -745,7 +745,7 @@ class ContentViewerControllerTest < ActionController::TestCase | @@ -745,7 +745,7 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
745 | should "not display 'Upload files' when viewing post from a blog" do | 745 | should "not display 'Upload files' when viewing post from a blog" do |
746 | login_as(profile.identifier) | 746 | login_as(profile.identifier) |
747 | b = Blog.create!(:name => 'article folder', :profile => profile) | 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 | xhr :get, :view_page, :profile => profile.identifier, :page => blog_post.path, :toolbar => true | 749 | xhr :get, :view_page, :profile => profile.identifier, :page => blog_post.path, :toolbar => true |
750 | assert_no_tag :tag => 'a', :content => 'Upload files', :attributes => {:href => /parent_id=#{b.id}/} | 750 | assert_no_tag :tag => 'a', :content => 'Upload files', :attributes => {:href => /parent_id=#{b.id}/} |
751 | end | 751 | end |
@@ -799,7 +799,7 @@ class ContentViewerControllerTest < ActionController::TestCase | @@ -799,7 +799,7 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
799 | 799 | ||
800 | blog = Blog.create!(:name => 'A blog test', :profile => profile, :visualization_format => 'short') | 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 | get :view_page, :profile => profile.identifier, :page => blog.path | 804 | get :view_page, :profile => profile.identifier, :page => blog.path |
805 | 805 | ||
@@ -812,7 +812,7 @@ class ContentViewerControllerTest < ActionController::TestCase | @@ -812,7 +812,7 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
812 | 812 | ||
813 | blog = Blog.create!(:name => 'A blog test', :profile => profile, :visualization_format => 'short+pic') | 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 | get :view_page, :profile => profile.identifier, :page => blog.path | 817 | get :view_page, :profile => profile.identifier, :page => blog.path |
818 | 818 | ||
@@ -833,7 +833,7 @@ class ContentViewerControllerTest < ActionController::TestCase | @@ -833,7 +833,7 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
833 | should 'list unpublished forum posts to owner with a different class' do | 833 | should 'list unpublished forum posts to owner with a different class' do |
834 | login_as('testinguser') | 834 | login_as('testinguser') |
835 | forum = Forum.create!(:name => 'A forum test', :profile => profile) | 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 | get :view_page, :profile => profile.identifier, :page => [forum.path] | 838 | get :view_page, :profile => profile.identifier, :page => [forum.path] |
839 | assert_tag :tag => 'tr', :attributes => {:class => /not-published/} | 839 | assert_tag :tag => 'tr', :attributes => {:class => /not-published/} |
@@ -841,7 +841,7 @@ class ContentViewerControllerTest < ActionController::TestCase | @@ -841,7 +841,7 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
841 | 841 | ||
842 | should 'not list unpublished forum posts to a not logged person' do | 842 | should 'not list unpublished forum posts to a not logged person' do |
843 | forum = Forum.create!(:name => 'A forum test', :profile => profile) | 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 | get :view_page, :profile => profile.identifier, :page => [forum.path] | 846 | get :view_page, :profile => profile.identifier, :page => [forum.path] |
847 | assert_no_tag :tag => 'a', :content => "Post" | 847 | assert_no_tag :tag => 'a', :content => "Post" |
@@ -850,7 +850,7 @@ class ContentViewerControllerTest < ActionController::TestCase | @@ -850,7 +850,7 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
850 | should 'display pagination links of forum' do | 850 | should 'display pagination links of forum' do |
851 | forum = Forum.create!(:name => 'A forum test', :profile => profile, :posts_per_page => 5) | 851 | forum = Forum.create!(:name => 'A forum test', :profile => profile, :posts_per_page => 5) |
852 | for n in 1..10 | 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 | end | 854 | end |
855 | assert_equal 10, forum.posts.size | 855 | assert_equal 10, forum.posts.size |
856 | 856 | ||
@@ -861,7 +861,7 @@ class ContentViewerControllerTest < ActionController::TestCase | @@ -861,7 +861,7 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
861 | should 'display first page of forum posts' do | 861 | should 'display first page of forum posts' do |
862 | forum = Forum.create!(:name => 'My forum', :profile => profile, :posts_per_page => 5) | 862 | forum = Forum.create!(:name => 'My forum', :profile => profile, :posts_per_page => 5) |
863 | for n in 1..10 | 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 | art.updated_at = (10 - n).days.ago | 865 | art.updated_at = (10 - n).days.ago |
866 | art.stubs(:record_timestamps).returns(false) | 866 | art.stubs(:record_timestamps).returns(false) |
867 | art.save! | 867 | art.save! |
@@ -882,7 +882,7 @@ class ContentViewerControllerTest < ActionController::TestCase | @@ -882,7 +882,7 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
882 | now = Time.now | 882 | now = Time.now |
883 | for n in 1..10 | 883 | for n in 1..10 |
884 | Time.stubs(:now).returns(now - 10.days + n.days) | 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 | end | 886 | end |
887 | assert_equal 10, forum.posts.size | 887 | assert_equal 10, forum.posts.size |
888 | 888 | ||
@@ -899,8 +899,8 @@ class ContentViewerControllerTest < ActionController::TestCase | @@ -899,8 +899,8 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
899 | forum = Forum.create!(:name => "forum", :profile => profile) | 899 | forum = Forum.create!(:name => "forum", :profile => profile) |
900 | profile.articles << forum | 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 | forum.children << past_post | 904 | forum.children << past_post |
905 | forum.children << current_post | 905 | forum.children << current_post |
906 | 906 | ||
@@ -924,7 +924,7 @@ class ContentViewerControllerTest < ActionController::TestCase | @@ -924,7 +924,7 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
924 | login_as(profile.identifier) | 924 | login_as(profile.identifier) |
925 | a = Forum.create!(:name => 'article folder', :profile => profile) | 925 | a = Forum.create!(:name => 'article folder', :profile => profile) |
926 | Article.stubs(:short_description).returns('bli') | 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 | xhr :get, :view_page, :profile => profile.identifier, :page => [t.path], :toolbar => true | 928 | xhr :get, :view_page, :profile => profile.identifier, :page => [t.path], :toolbar => true |
929 | assert_tag :tag => 'a', :content => 'New discussion topic' | 929 | assert_tag :tag => 'a', :content => 'New discussion topic' |
930 | end | 930 | end |
@@ -937,7 +937,7 @@ class ContentViewerControllerTest < ActionController::TestCase | @@ -937,7 +937,7 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
937 | community.add_member(author) | 937 | community.add_member(author) |
938 | 938 | ||
939 | forum = Forum.create(:profile => community, :name => 'Forum test', :body => 'Forum test') | 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 | login_as(author.identifier) | 942 | login_as(author.identifier) |
943 | get :view_page, :profile => community.identifier, :page => post.path.split('/') | 943 | get :view_page, :profile => community.identifier, :page => post.path.split('/') |
@@ -953,7 +953,7 @@ class ContentViewerControllerTest < ActionController::TestCase | @@ -953,7 +953,7 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
953 | community.add_member(author) | 953 | community.add_member(author) |
954 | 954 | ||
955 | forum = Forum.create(:profile => community, :name => 'Forum test', :body => 'Forum test') | 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 | login_as(author.identifier) | 958 | login_as(author.identifier) |
959 | get :view_page, :profile => community.identifier, :page => post.path.split('/') | 959 | get :view_page, :profile => community.identifier, :page => post.path.split('/') |
@@ -971,7 +971,7 @@ class ContentViewerControllerTest < ActionController::TestCase | @@ -971,7 +971,7 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
971 | should 'add meta tag to rss feed on view post forum' do | 971 | should 'add meta tag to rss feed on view post forum' do |
972 | login_as(profile.identifier) | 972 | login_as(profile.identifier) |
973 | profile.articles << Forum.new(:name => 'Forum', :profile => profile) | 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 | get :view_page, :profile => profile.identifier, :page => ['forum', 'first-post'] | 975 | get :view_page, :profile => profile.identifier, :page => ['forum', 'first-post'] |
976 | assert_tag :tag => 'link', :attributes => { :rel => 'alternate', :type => 'application/rss+xml', :title => 'Forum', :href => "http://#{environment.default_hostname}/testinguser/forum/feed" } | 976 | assert_tag :tag => 'link', :attributes => { :rel => 'alternate', :type => 'application/rss+xml', :title => 'Forum', :href => "http://#{environment.default_hostname}/testinguser/forum/feed" } |
977 | end | 977 | end |
@@ -986,7 +986,7 @@ class ContentViewerControllerTest < ActionController::TestCase | @@ -986,7 +986,7 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
986 | should "not display 'Upload files' when viewing post from a forum" do | 986 | should "not display 'Upload files' when viewing post from a forum" do |
987 | login_as(profile.identifier) | 987 | login_as(profile.identifier) |
988 | b = Forum.create!(:name => 'article folder', :profile => profile) | 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 | xhr :get, :view_page, :profile => profile.identifier, :page => forum_post.path, :toolbar => true | 990 | xhr :get, :view_page, :profile => profile.identifier, :page => forum_post.path, :toolbar => true |
991 | assert_no_tag :tag => 'a', :content => 'Upload files', :attributes => {:href => /parent_id=#{b.id}/} | 991 | assert_no_tag :tag => 'a', :content => 'Upload files', :attributes => {:href => /parent_id=#{b.id}/} |
992 | end | 992 | end |
@@ -1002,9 +1002,9 @@ class ContentViewerControllerTest < ActionController::TestCase | @@ -1002,9 +1002,9 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
1002 | environment.languages = ['en'] | 1002 | environment.languages = ['en'] |
1003 | environment.save | 1003 | environment.save |
1004 | login_as @profile.identifier | 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 | xhr :get, :view_page, :profile => @profile.identifier, :page => textile.path, :toolbar => true | 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 | end | 1008 | end |
1009 | 1009 | ||
1010 | should 'not display add translation link if article is not translatable' do | 1010 | should 'not display add translation link if article is not translatable' do |
@@ -1016,22 +1016,22 @@ class ContentViewerControllerTest < ActionController::TestCase | @@ -1016,22 +1016,22 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
1016 | 1016 | ||
1017 | should 'not display add translation link if article hasnt a language defined' do | 1017 | should 'not display add translation link if article hasnt a language defined' do |
1018 | login_as @profile.identifier | 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 | xhr :get, :view_page, :profile => @profile.identifier, :page => textile.path, :toolbar => true | 1020 | xhr :get, :view_page, :profile => @profile.identifier, :page => textile.path, :toolbar => true |
1021 | assert_no_tag :a, :attributes => { :content => 'Add translation', :class => /icon-locale/ } | 1021 | assert_no_tag :a, :attributes => { :content => 'Add translation', :class => /icon-locale/ } |
1022 | end | 1022 | end |
1023 | 1023 | ||
1024 | should 'display translations link if article has translations' do | 1024 | should 'display translations link if article has translations' do |
1025 | login_as @profile.identifier | 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 | xhr :get, :view_page, :profile => @profile.identifier, :page => textile.path, :toolbar => true | 1028 | xhr :get, :view_page, :profile => @profile.identifier, :page => textile.path, :toolbar => true |
1029 | assert_tag :a, :attributes => { :class => /article-translations-menu/, :onmouseover => /toggleSubmenu/ } | 1029 | assert_tag :a, :attributes => { :class => /article-translations-menu/, :onmouseover => /toggleSubmenu/ } |
1030 | end | 1030 | end |
1031 | 1031 | ||
1032 | should 'not be redirected if already in translation' do | 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 | @request.env['HTTP_REFERER'] = "http://localhost:3000/#{@profile.identifier}/#{es_article.path}" | 1035 | @request.env['HTTP_REFERER'] = "http://localhost:3000/#{@profile.identifier}/#{es_article.path}" |
1036 | FastGettext.stubs(:locale).returns('es') | 1036 | FastGettext.stubs(:locale).returns('es') |
1037 | get :view_page, :profile => @profile.identifier, :page => es_article.path | 1037 | get :view_page, :profile => @profile.identifier, :page => es_article.path |
@@ -1041,15 +1041,15 @@ class ContentViewerControllerTest < ActionController::TestCase | @@ -1041,15 +1041,15 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
1041 | 1041 | ||
1042 | should 'not be redirected if article does not have a language' do | 1042 | should 'not be redirected if article does not have a language' do |
1043 | FastGettext.stubs(:locale).returns('es') | 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 | get :view_page, :profile => @profile.identifier, :page => article.path | 1045 | get :view_page, :profile => @profile.identifier, :page => article.path |
1046 | assert_response :success | 1046 | assert_response :success |
1047 | assert_equal article, assigns(:page) | 1047 | assert_equal article, assigns(:page) |
1048 | end | 1048 | end |
1049 | 1049 | ||
1050 | should 'not be redirected if http_referer is a translation' do | 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 | @request.env['HTTP_REFERER'] = "http://localhost:3000/#{@profile.identifier}/#{es_article.path}" | 1053 | @request.env['HTTP_REFERER'] = "http://localhost:3000/#{@profile.identifier}/#{es_article.path}" |
1054 | FastGettext.stubs(:locale).returns('es') | 1054 | FastGettext.stubs(:locale).returns('es') |
1055 | get :view_page, :profile => @profile.identifier, :page => en_article.path | 1055 | get :view_page, :profile => @profile.identifier, :page => en_article.path |
@@ -1058,8 +1058,8 @@ class ContentViewerControllerTest < ActionController::TestCase | @@ -1058,8 +1058,8 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
1058 | end | 1058 | end |
1059 | 1059 | ||
1060 | should 'not be redirected to transition if came from edit' do | 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 | FastGettext.stubs(:locale).returns('es') | 1063 | FastGettext.stubs(:locale).returns('es') |
1064 | @request.env['HTTP_REFERER'] = "http://localhost/myprofile/#{@profile.identifier}/cms/edit/#{en_article.id}" | 1064 | @request.env['HTTP_REFERER'] = "http://localhost/myprofile/#{@profile.identifier}/cms/edit/#{en_article.id}" |
1065 | get :view_page, :profile => @profile.identifier, :page => es_article.path | 1065 | get :view_page, :profile => @profile.identifier, :page => es_article.path |
@@ -1068,8 +1068,8 @@ class ContentViewerControllerTest < ActionController::TestCase | @@ -1068,8 +1068,8 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
1068 | end | 1068 | end |
1069 | 1069 | ||
1070 | should 'not be redirected to transition if came from new' do | 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 | FastGettext.stubs(:locale).returns('es') | 1073 | FastGettext.stubs(:locale).returns('es') |
1074 | @request.env['HTTP_REFERER'] = "http://localhost/myprofile/#{@profile.identifier}/cms/new" | 1074 | @request.env['HTTP_REFERER'] = "http://localhost/myprofile/#{@profile.identifier}/cms/new" |
1075 | get :view_page, :profile => @profile.identifier, :page => es_article.path | 1075 | get :view_page, :profile => @profile.identifier, :page => es_article.path |
@@ -1082,8 +1082,8 @@ class ContentViewerControllerTest < ActionController::TestCase | @@ -1082,8 +1082,8 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
1082 | blog = fast_create(Blog, :profile_id => profile.id, :path => 'blog') | 1082 | blog = fast_create(Blog, :profile_id => profile.id, :path => 'blog') |
1083 | blog.display_posts_in_current_language = true | 1083 | blog.display_posts_in_current_language = true |
1084 | blog.save | 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 | get :view_page, :profile => @profile.identifier, :page => blog.path | 1088 | get :view_page, :profile => @profile.identifier, :page => blog.path |
1089 | assert_tag :div, :attributes => { :id => "post-#{es_article.id}" } | 1089 | assert_tag :div, :attributes => { :id => "post-#{es_article.id}" } |
@@ -1095,12 +1095,12 @@ class ContentViewerControllerTest < ActionController::TestCase | @@ -1095,12 +1095,12 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
1095 | blog = fast_create(Blog, :profile_id => profile.id, :path => 'blog') | 1095 | blog = fast_create(Blog, :profile_id => profile.id, :path => 'blog') |
1096 | blog.display_posts_in_current_language = true | 1096 | blog.display_posts_in_current_language = true |
1097 | blog.save | 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 | get :view_page, :profile => @profile.identifier, :page => blog.path | 1106 | get :view_page, :profile => @profile.identifier, :page => blog.path |
@@ -1111,8 +1111,8 @@ class ContentViewerControllerTest < ActionController::TestCase | @@ -1111,8 +1111,8 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
1111 | should 'list all posts at blog listing if blog option is disabled' do | 1111 | should 'list all posts at blog listing if blog option is disabled' do |
1112 | FastGettext.stubs(:locale).returns('es') | 1112 | FastGettext.stubs(:locale).returns('es') |
1113 | blog = Blog.create!(:name => 'A blog test', :profile => profile, :display_posts_in_current_language => false) | 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 | get :view_page, :profile => profile.identifier, :page => [blog.path] | 1116 | get :view_page, :profile => profile.identifier, :page => [blog.path] |
1117 | assert_equal 2, assigns(:posts).size | 1117 | assert_equal 2, assigns(:posts).size |
1118 | assert_tag :div, :attributes => { :id => "post-#{es_post.id}" } | 1118 | assert_tag :div, :attributes => { :id => "post-#{es_post.id}" } |
@@ -1124,8 +1124,8 @@ class ContentViewerControllerTest < ActionController::TestCase | @@ -1124,8 +1124,8 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
1124 | blog = fast_create(Blog, :profile_id => profile.id, :path => 'blog') | 1124 | blog = fast_create(Blog, :profile_id => profile.id, :path => 'blog') |
1125 | blog.display_posts_in_current_language = true | 1125 | blog.display_posts_in_current_language = true |
1126 | blog.save! | 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 | blog.posts = [en_article, es_article] | 1129 | blog.posts = [en_article, es_article] |
1130 | 1130 | ||
1131 | get :view_page, :profile => @profile.identifier, :page => blog.path | 1131 | get :view_page, :profile => @profile.identifier, :page => blog.path |
@@ -1177,7 +1177,7 @@ class ContentViewerControllerTest < ActionController::TestCase | @@ -1177,7 +1177,7 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
1177 | 1177 | ||
1178 | should 'add an zero width space every 4 caracters of comment urls' do | 1178 | should 'add an zero width space every 4 caracters of comment urls' do |
1179 | url = 'www.an.url.to.be.splited.com' | 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 | c = a.comments.create!(:author => @profile, :title => 'An url', :body => url) | 1181 | c = a.comments.create!(:author => @profile, :title => 'An url', :body => url) |
1182 | get :view_page, :profile => @profile.identifier, :page => a.path | 1182 | get :view_page, :profile => @profile.identifier, :page => a.path |
1183 | assert_tag :a, :attributes => { :href => "http://" + url}, :content => url.scan(/.{4}/).join('​') | 1183 | assert_tag :a, :attributes => { :href => "http://" + url}, :content => url.scan(/.{4}/).join('​') |
@@ -1375,7 +1375,7 @@ class ContentViewerControllerTest < ActionController::TestCase | @@ -1375,7 +1375,7 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
1375 | should 'not escape acceptable HTML in list of blog posts' do | 1375 | should 'not escape acceptable HTML in list of blog posts' do |
1376 | login_as('testinguser') | 1376 | login_as('testinguser') |
1377 | blog = Blog.create!(:name => 'A blog test', :profile => profile) | 1377 | blog = Blog.create!(:name => 'A blog test', :profile => profile) |
1378 | - blog.posts << TinyMceArticle.create!( | 1378 | + blog.posts << TextArticle.create!( |
1379 | :name => 'Post', | 1379 | :name => 'Post', |
1380 | :profile => profile, | 1380 | :profile => profile, |
1381 | :parent => blog, | 1381 | :parent => blog, |
@@ -1443,7 +1443,7 @@ class ContentViewerControllerTest < ActionController::TestCase | @@ -1443,7 +1443,7 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
1443 | 1443 | ||
1444 | blog = community.articles.find_by(name: "Blog") | 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 | :body => 'This article should be shared with all social networks', | 1447 | :body => 'This article should be shared with all social networks', |
1448 | :profile => community, | 1448 | :profile => community, |
1449 | :published => false, | 1449 | :published => false, |
@@ -1571,7 +1571,7 @@ class ContentViewerControllerTest < ActionController::TestCase | @@ -1571,7 +1571,7 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
1571 | blog.visualization_format = 'compact' | 1571 | blog.visualization_format = 'compact' |
1572 | blog.save! | 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 | :body => 'This article should be shared with all social networks', | 1575 | :body => 'This article should be shared with all social networks', |
1576 | :profile => @profile, | 1576 | :profile => @profile, |
1577 | :published => false, | 1577 | :published => false, |
test/functional/enterprise_registration_controller_test.rb
@@ -58,7 +58,7 @@ class EnterpriseRegistrationControllerTest < ActionController::TestCase | @@ -58,7 +58,7 @@ class EnterpriseRegistrationControllerTest < ActionController::TestCase | ||
58 | region = fast_create(Region, {}) | 58 | region = fast_create(Region, {}) |
59 | 59 | ||
60 | template = Enterprise.create!(:name => 'Enterprise Template', :identifier => 'enterprise-template', :is_template => true) | 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 | template.welcome_page = welcome_page | 62 | template.welcome_page = welcome_page |
63 | template.save! | 63 | template.save! |
64 | 64 |
test/functional/home_controller_test.rb
@@ -47,14 +47,14 @@ class HomeControllerTest < ActionController::TestCase | @@ -47,14 +47,14 @@ class HomeControllerTest < ActionController::TestCase | ||
47 | env = Environment.default | 47 | env = Environment.default |
48 | env.enable('use_portal_community') | 48 | env.enable('use_portal_community') |
49 | c = fast_create(Community) | 49 | c = fast_create(Community) |
50 | - a1 = TextileArticle.create!(:name => "Article 1", | 50 | + a1 = TextArticle.create!(:name => "Article 1", |
51 | :profile => c, | 51 | :profile => c, |
52 | :abstract => "This is the article1 lead.", | 52 | :abstract => "This is the article1 lead.", |
53 | - :body => "This is the article1 body.", | 53 | + :body => "<p>This is the article1 body.</p>", |
54 | :highlighted => true) | 54 | :highlighted => true) |
55 | - a2 = TextileArticle.create!(:name => "Article 2", | 55 | + a2 = TextArticle.create!(:name => "Article 2", |
56 | :profile => c, | 56 | :profile => c, |
57 | - :body => "This is the article2 body.", | 57 | + :body => "<p>This is the article2 body.</p>", |
58 | :highlighted => true) | 58 | :highlighted => true) |
59 | env.portal_community = c | 59 | env.portal_community = c |
60 | env.save! | 60 | env.save! |
@@ -62,8 +62,8 @@ class HomeControllerTest < ActionController::TestCase | @@ -62,8 +62,8 @@ class HomeControllerTest < ActionController::TestCase | ||
62 | 62 | ||
63 | get :index | 63 | get :index |
64 | assert_tag :attributes => { :class => 'headline' }, :content => a1.abstract | 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 | end | 67 | end |
68 | 68 | ||
69 | should 'display block in index page if it\'s configured to display on homepage and its an environment block' do | 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,7 +128,7 @@ class HomeControllerTest < ActionController::TestCase | ||
128 | should 'display template welcome page' do | 128 | should 'display template welcome page' do |
129 | template = create_user('template').person | 129 | template = create_user('template').person |
130 | template.is_template = true | 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 | template.welcome_page = welcome_page | 132 | template.welcome_page = welcome_page |
133 | template.save! | 133 | template.save! |
134 | get :welcome, :template_id => template.id | 134 | get :welcome, :template_id => template.id |
@@ -138,7 +138,7 @@ class HomeControllerTest < ActionController::TestCase | @@ -138,7 +138,7 @@ class HomeControllerTest < ActionController::TestCase | ||
138 | should 'not display template welcome page if it is not published' do | 138 | should 'not display template welcome page if it is not published' do |
139 | template = create_user('template').person | 139 | template = create_user('template').person |
140 | template.is_template = true | 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 | template.welcome_page = welcome_page | 142 | template.welcome_page = welcome_page |
143 | template.save! | 143 | template.save! |
144 | get :welcome, :template_id => template.id | 144 | get :welcome, :template_id => template.id |
test/functional/profile_controller_test.rb
@@ -518,9 +518,9 @@ class ProfileControllerTest < ActionController::TestCase | @@ -518,9 +518,9 @@ class ProfileControllerTest < ActionController::TestCase | ||
518 | 518 | ||
519 | should 'show number of published posts in index' do | 519 | should 'show number of published posts in index' do |
520 | profile.articles << blog = create(Blog, :name => 'Blog', :profile_id => profile.id) | 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 | get :index, :profile => profile.identifier | 525 | get :index, :profile => profile.identifier |
526 | assert_tag :tag => 'a', :content => '2 posts', :attributes => { :href => /\/testuser\/#{blog.slug}/ } | 526 | assert_tag :tag => 'a', :content => '2 posts', :attributes => { :href => /\/testuser\/#{blog.slug}/ } |
@@ -604,8 +604,8 @@ class ProfileControllerTest < ActionController::TestCase | @@ -604,8 +604,8 @@ class ProfileControllerTest < ActionController::TestCase | ||
604 | end | 604 | end |
605 | 605 | ||
606 | should 'reverse the order of posts in tag feed' do | 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 | get :tag_feed, :profile => profile.identifier, :id => 'tag1' | 610 | get :tag_feed, :profile => profile.identifier, :id => 'tag1' |
611 | assert_match(/Second.*First/, @response.body) | 611 | assert_match(/Second.*First/, @response.body) |
@@ -613,11 +613,11 @@ class ProfileControllerTest < ActionController::TestCase | @@ -613,11 +613,11 @@ class ProfileControllerTest < ActionController::TestCase | ||
613 | 613 | ||
614 | should 'display the most recent posts in tag feed' do | 614 | should 'display the most recent posts in tag feed' do |
615 | start = Time.now - 30.days | 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 | 20.times do |i| | 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 | end | 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 | get :tag_feed, :profile => profile.identifier, :id => 'tag1' | 622 | get :tag_feed, :profile => profile.identifier, :id => 'tag1' |
623 | assert_no_match(/First post/, @response.body) # First post is older than other 20 posts already | 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,7 +755,7 @@ class ProfileControllerTest < ActionController::TestCase | ||
755 | scrap2 = create(Scrap, defaults_for_scrap(:sender => p2, :receiver => p1)) | 755 | scrap2 = create(Scrap, defaults_for_scrap(:sender => p2, :receiver => p1)) |
756 | 756 | ||
757 | User.current = p1.user | 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 | a1 = ActionTracker::Record.last | 759 | a1 = ActionTracker::Record.last |
760 | 760 | ||
761 | login_as(profile.identifier) | 761 | login_as(profile.identifier) |
@@ -787,10 +787,10 @@ class ProfileControllerTest < ActionController::TestCase | @@ -787,10 +787,10 @@ class ProfileControllerTest < ActionController::TestCase | ||
787 | scrap2 = create(Scrap, defaults_for_scrap(:sender => p2, :receiver => profile)) | 787 | scrap2 = create(Scrap, defaults_for_scrap(:sender => p2, :receiver => profile)) |
788 | 788 | ||
789 | User.current = p3.user | 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 | User.current = p2.user | 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 | login_as(profile.identifier) | 795 | login_as(profile.identifier) |
796 | get :index, :profile => p3.identifier | 796 | get :index, :profile => p3.identifier |
@@ -1181,7 +1181,7 @@ class ProfileControllerTest < ActionController::TestCase | @@ -1181,7 +1181,7 @@ class ProfileControllerTest < ActionController::TestCase | ||
1181 | 1181 | ||
1182 | should "view more activities paginated" do | 1182 | should "view more activities paginated" do |
1183 | login_as(profile.identifier) | 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 | ActionTracker::Record.destroy_all | 1185 | ActionTracker::Record.destroy_all |
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})} | 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 | assert_equal 40, profile.tracked_actions.count | 1187 | assert_equal 40, profile.tracked_actions.count |
@@ -1214,7 +1214,7 @@ class ProfileControllerTest < ActionController::TestCase | @@ -1214,7 +1214,7 @@ class ProfileControllerTest < ActionController::TestCase | ||
1214 | 1214 | ||
1215 | should "not index display activities comments" do | 1215 | should "not index display activities comments" do |
1216 | login_as(profile.identifier) | 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 | ActionTracker::Record.destroy_all | 1218 | ActionTracker::Record.destroy_all |
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}) | 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 | 20.times {comment = fast_create(Comment, :source_id => article, :title => 'a comment', :body => 'lalala', :created_at => Time.now)} | 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,7 +1225,7 @@ class ProfileControllerTest < ActionController::TestCase | ||
1225 | 1225 | ||
1226 | should "view more comments paginated" do | 1226 | should "view more comments paginated" do |
1227 | login_as(profile.identifier) | 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 | ActionTracker::Record.destroy_all | 1229 | ActionTracker::Record.destroy_all |
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}) | 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 | 20.times {comment = fast_create(Comment, :source_id => article, :title => 'a comment', :body => 'lalala', :created_at => Time.now)} | 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,7 +1341,7 @@ class ProfileControllerTest < ActionController::TestCase | ||
1341 | 1341 | ||
1342 | should 'register abuse report with content' do | 1342 | should 'register abuse report with content' do |
1343 | reported = fast_create(Profile) | 1343 | reported = fast_create(Profile) |
1344 | - content = fast_create(RawHTMLArticle, :profile_id => reported.id) | 1344 | + content = fast_create(TextArticle, :profile_id => reported.id) |
1345 | login_as(profile.identifier) | 1345 | login_as(profile.identifier) |
1346 | @controller.stubs(:verify_recaptcha).returns(true) | 1346 | @controller.stubs(:verify_recaptcha).returns(true) |
1347 | 1347 | ||
@@ -1368,7 +1368,7 @@ class ProfileControllerTest < ActionController::TestCase | @@ -1368,7 +1368,7 @@ class ProfileControllerTest < ActionController::TestCase | ||
1368 | 1368 | ||
1369 | User.current = profile.user | 1369 | User.current = profile.user |
1370 | ActionTracker::Record.destroy_all | 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 | login_as(profile.identifier) | 1373 | login_as(profile.identifier) |
1374 | get :index, :profile => profile.identifier | 1374 | get :index, :profile => profile.identifier |
@@ -1383,7 +1383,7 @@ class ProfileControllerTest < ActionController::TestCase | @@ -1383,7 +1383,7 @@ class ProfileControllerTest < ActionController::TestCase | ||
1383 | 1383 | ||
1384 | User.current = profile.user | 1384 | User.current = profile.user |
1385 | ActionTracker::Record.destroy_all | 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 | activity = ActionTracker::Record.last | 1387 | activity = ActionTracker::Record.last |
1388 | 1388 | ||
1389 | login_as(profile.identifier) | 1389 | login_as(profile.identifier) |
@@ -1393,14 +1393,14 @@ class ProfileControllerTest < ActionController::TestCase | @@ -1393,14 +1393,14 @@ class ProfileControllerTest < ActionController::TestCase | ||
1393 | end | 1393 | end |
1394 | 1394 | ||
1395 | should "follow an article" do | 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 | login_as(@profile.identifier) | 1397 | login_as(@profile.identifier) |
1398 | post :follow_article, :profile => profile.identifier, :article_id => article.id | 1398 | post :follow_article, :profile => profile.identifier, :article_id => article.id |
1399 | assert_includes article.person_followers, @profile | 1399 | assert_includes article.person_followers, @profile |
1400 | end | 1400 | end |
1401 | 1401 | ||
1402 | should "unfollow an article" do | 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 | article.person_followers << @profile | 1404 | article.person_followers << @profile |
1405 | article.save! | 1405 | article.save! |
1406 | assert_includes article.person_followers, @profile | 1406 | assert_includes article.person_followers, @profile |
@@ -1411,7 +1411,7 @@ class ProfileControllerTest < ActionController::TestCase | @@ -1411,7 +1411,7 @@ class ProfileControllerTest < ActionController::TestCase | ||
1411 | end | 1411 | end |
1412 | 1412 | ||
1413 | should "be logged in to leave comment on an activity" do | 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 | activity = ActionTracker::Record.last | 1415 | activity = ActionTracker::Record.last |
1416 | count = activity.comments.count | 1416 | count = activity.comments.count |
1417 | 1417 | ||
@@ -1422,7 +1422,7 @@ class ProfileControllerTest < ActionController::TestCase | @@ -1422,7 +1422,7 @@ class ProfileControllerTest < ActionController::TestCase | ||
1422 | 1422 | ||
1423 | should "leave a comment in own activity" do | 1423 | should "leave a comment in own activity" do |
1424 | login_as(profile.identifier) | 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 | activity = ActionTracker::Record.last | 1426 | activity = ActionTracker::Record.last |
1427 | count = activity.comments.count | 1427 | count = activity.comments.count |
1428 | 1428 | ||
@@ -1436,7 +1436,7 @@ class ProfileControllerTest < ActionController::TestCase | @@ -1436,7 +1436,7 @@ class ProfileControllerTest < ActionController::TestCase | ||
1436 | should "leave a comment on another profile's activity" do | 1436 | should "leave a comment on another profile's activity" do |
1437 | login_as(profile.identifier) | 1437 | login_as(profile.identifier) |
1438 | another_person = fast_create(Person) | 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 | activity = ActionTracker::Record.last | 1440 | activity = ActionTracker::Record.last |
1441 | count = activity.comments.count | 1441 | count = activity.comments.count |
1442 | assert_equal 0, count | 1442 | assert_equal 0, count |
@@ -1448,7 +1448,7 @@ class ProfileControllerTest < ActionController::TestCase | @@ -1448,7 +1448,7 @@ class ProfileControllerTest < ActionController::TestCase | ||
1448 | 1448 | ||
1449 | should 'display comment in wall if user was removed after click in view all comments' do | 1449 | should 'display comment in wall if user was removed after click in view all comments' do |
1450 | User.current = profile.user | 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 | to_be_removed = create_user('removed_user').person | 1452 | to_be_removed = create_user('removed_user').person |
1453 | comment = create(Comment, :author => to_be_removed, :title => 'Test Comment', :body => 'My author does not exist =(', :source_id => article.id, :source_type => 'Article') | 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 | to_be_removed.destroy | 1454 | to_be_removed.destroy |
@@ -1465,7 +1465,7 @@ class ProfileControllerTest < ActionController::TestCase | @@ -1465,7 +1465,7 @@ class ProfileControllerTest < ActionController::TestCase | ||
1465 | 1465 | ||
1466 | should 'not display spam comments in wall' do | 1466 | should 'not display spam comments in wall' do |
1467 | User.current = profile.user | 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 | comment = create(Comment, :author => profile, :title => 'Test Comment', :body => 'This article makes me hungry', :source_id => article.id, :source_type => 'Article') | 1469 | comment = create(Comment, :author => profile, :title => 'Test Comment', :body => 'This article makes me hungry', :source_id => article.id, :source_type => 'Article') |
1470 | comment.spam! | 1470 | comment.spam! |
1471 | login_as(profile.identifier) | 1471 | login_as(profile.identifier) |
@@ -1476,7 +1476,7 @@ class ProfileControllerTest < ActionController::TestCase | @@ -1476,7 +1476,7 @@ class ProfileControllerTest < ActionController::TestCase | ||
1476 | 1476 | ||
1477 | should 'display comment in wall from non logged users after click in view all comments' do | 1477 | should 'display comment in wall from non logged users after click in view all comments' do |
1478 | User.current = profile.user | 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 | 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') | 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 | login_as(profile.identifier) | 1482 | login_as(profile.identifier) |
test/functional/profile_editor_controller_test.rb
@@ -534,8 +534,8 @@ class ProfileEditorControllerTest < ActionController::TestCase | @@ -534,8 +534,8 @@ class ProfileEditorControllerTest < ActionController::TestCase | ||
534 | 534 | ||
535 | should 'render TinyMce Editor for header and footer' do | 535 | should 'render TinyMce Editor for header and footer' do |
536 | get :header_footer, :profile => profile.identifier | 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 | end | 539 | end |
540 | 540 | ||
541 | should 'save footer and header' do | 541 | should 'save footer and header' do |
@@ -966,7 +966,7 @@ class ProfileEditorControllerTest < ActionController::TestCase | @@ -966,7 +966,7 @@ class ProfileEditorControllerTest < ActionController::TestCase | ||
966 | person_template = create_user('person_template').person | 966 | person_template = create_user('person_template').person |
967 | person_template.is_template = true | 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 | person_template.welcome_page = welcome_page | 970 | person_template.welcome_page = welcome_page |
971 | person_template.save! | 971 | person_template.save! |
972 | welcome_page.profile = person_template | 972 | welcome_page.profile = person_template |
test/functional/profile_search_controller_test.rb
@@ -21,15 +21,15 @@ class ProfileSearchControllerTest < ActionController::TestCase | @@ -21,15 +21,15 @@ class ProfileSearchControllerTest < ActionController::TestCase | ||
21 | end | 21 | end |
22 | 22 | ||
23 | should 'search for articles' do | 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 | get 'index', :profile => person.identifier, :q => 'article to test' | 26 | get 'index', :profile => person.identifier, :q => 'article to test' |
27 | assert_includes assigns(:results), article | 27 | assert_includes assigns(:results), article |
28 | end | 28 | end |
29 | 29 | ||
30 | should 'not display articles from another profile' do | 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 | get 'index', :profile => person.identifier, :q => 'article' | 34 | get 'index', :profile => person.identifier, :q => 'article' |
35 | assert_includes assigns(:results), article | 35 | assert_includes assigns(:results), article |
@@ -49,7 +49,7 @@ class ProfileSearchControllerTest < ActionController::TestCase | @@ -49,7 +49,7 @@ class ProfileSearchControllerTest < ActionController::TestCase | ||
49 | 49 | ||
50 | should 'paginate results listing' do | 50 | should 'paginate results listing' do |
51 | (1..11).each do |i| | 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 | end | 53 | end |
54 | 54 | ||
55 | get 'index', :profile => person.identifier, :q => 'Article' | 55 | get 'index', :profile => person.identifier, :q => 'Article' |
@@ -59,20 +59,20 @@ class ProfileSearchControllerTest < ActionController::TestCase | @@ -59,20 +59,20 @@ class ProfileSearchControllerTest < ActionController::TestCase | ||
59 | end | 59 | end |
60 | 60 | ||
61 | should 'display abstract if given' do | 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 | get 'index', :profile => person.identifier, :q => 'article to test' | 65 | get 'index', :profile => person.identifier, :q => 'article to test' |
66 | 66 | ||
67 | assert_tag :tag => 'li', :descendant => { :tag => 'a', :content => article1.abstract, :attributes => { :class => /article-details/ }} | 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 | end | 71 | end |
72 | 72 | ||
73 | should 'display nothing if search is blank' do | 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 | get 'index', :profile => person.identifier, :q => '' | 77 | get 'index', :profile => person.identifier, :q => '' |
78 | 78 | ||
@@ -80,19 +80,19 @@ class ProfileSearchControllerTest < ActionController::TestCase | @@ -80,19 +80,19 @@ class ProfileSearchControllerTest < ActionController::TestCase | ||
80 | end | 80 | end |
81 | 81 | ||
82 | should 'not display private articles' do | 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 | get 'index', :profile => person.identifier, :q => 'article to test' | 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 | end | 91 | end |
92 | 92 | ||
93 | should 'display number of results found' do | 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 | get 'index', :profile => person.identifier, :q => 'article to test' | 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,9 +309,9 @@ class SearchControllerTest < ActionController::TestCase | ||
309 | assert_tag :tag => 'table', :attributes => {:class => /current-month/}, :descendant => {:tag => 'caption', :content => /August 2008/} | 309 | assert_tag :tag => 'table', :attributes => {:class => /current-month/}, :descendant => {:tag => 'caption', :content => /August 2008/} |
310 | end | 310 | end |
311 | 311 | ||
312 | - should 'found TextileArticle in articles' do | 312 | + should 'found TextArticle in articles' do |
313 | person = create_user('teste').person | 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 | get 'articles', :query => 'article to be found' | 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 +7,7 @@ class SpamControllerTest < ActionController::TestCase | ||
7 | 7 | ||
8 | @community = fast_create(Community, :name => 'testcommunity') | 8 | @community = fast_create(Community, :name => 'testcommunity') |
9 | @community.add_admin(@profile) | 9 | @community.add_admin(@profile) |
10 | - @article = fast_create(TextileArticle, :profile_id => @community.id) | 10 | + @article = fast_create(TextArticle, :profile_id => @community.id) |
11 | @spam_comment = fast_create(Comment, :source_id => @article.id, :spam => true, :name => 'foo', :email => 'foo@example.com') | 11 | @spam_comment = fast_create(Comment, :source_id => @article.id, :spam => true, :name => 'foo', :email => 'foo@example.com') |
12 | 12 | ||
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) | 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,23 +325,23 @@ class TasksControllerTest < ActionController::TestCase | ||
325 | t = SuggestArticle.create!(:article => {:name => 'test name', :abstract => 'test abstract', :body => 'test body'}, :name => 'some name', :email => 'test@localhost.com', :target => c) | 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 | get :index | 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 | end | 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 | c = fast_create(Community) | 334 | c = fast_create(Community) |
335 | c.affiliate(profile, Profile::Roles.all_roles(profile.environment.id)) | 335 | c.affiliate(profile, Profile::Roles.all_roles(profile.environment.id)) |
336 | @controller.stubs(:profile).returns(c) | 336 | @controller.stubs(:profile).returns(c) |
337 | t = SuggestArticle.create!(:article => {:name => 'test name', :body => 'test body'}, :name => 'some name', :email => 'test@localhost.com', :target => c) | 337 | t = SuggestArticle.create!(:article => {:name => 'test name', :body => 'test body'}, :name => 'some name', :email => 'test@localhost.com', :target => c) |
338 | 338 | ||
339 | post :close, :tasks => {t.id => { :task => {}, :decision => "finish"}} | 339 | post :close, :tasks => {t.id => { :task => {}, :decision => "finish"}} |
340 | - assert_not_nil TinyMceArticle.first | 340 | + assert_not_nil TextArticle.first |
341 | end | 341 | end |
342 | 342 | ||
343 | should "change the article's attributes on suggested article task approval" do | 343 | should "change the article's attributes on suggested article task approval" do |
344 | - TinyMceArticle.destroy_all | 344 | + TextArticle.destroy_all |
345 | c = fast_create(Community) | 345 | c = fast_create(Community) |
346 | c.affiliate(profile, Profile::Roles.all_roles(profile.environment.id)) | 346 | c.affiliate(profile, Profile::Roles.all_roles(profile.environment.id)) |
347 | @controller.stubs(:profile).returns(c) | 347 | @controller.stubs(:profile).returns(c) |
@@ -353,11 +353,11 @@ class TasksControllerTest < ActionController::TestCase | @@ -353,11 +353,11 @@ class TasksControllerTest < ActionController::TestCase | ||
353 | t.save! | 353 | t.save! |
354 | 354 | ||
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"}} | 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 | end | 361 | end |
362 | 362 | ||
363 | should "display name from article suggestion when requestor was not setted" do | 363 | should "display name from article suggestion when requestor was not setted" do |
@@ -372,7 +372,7 @@ class TasksControllerTest < ActionController::TestCase | @@ -372,7 +372,7 @@ class TasksControllerTest < ActionController::TestCase | ||
372 | end | 372 | end |
373 | 373 | ||
374 | should "not crash when article suggestion task fails" do | 374 | should "not crash when article suggestion task fails" do |
375 | - TinyMceArticle.destroy_all | 375 | + TextArticle.destroy_all |
376 | c = fast_create(Community) | 376 | c = fast_create(Community) |
377 | c.affiliate(profile, Profile::Roles.all_roles(profile.environment.id)) | 377 | c.affiliate(profile, Profile::Roles.all_roles(profile.environment.id)) |
378 | @controller.stubs(:profile).returns(c) | 378 | @controller.stubs(:profile).returns(c) |
test/integration/manage_documents_test.rb
@@ -17,14 +17,14 @@ class ManageDocumentsTest < ActionDispatch::IntegrationTest | @@ -17,14 +17,14 @@ class ManageDocumentsTest < ActionDispatch::IntegrationTest | ||
17 | 17 | ||
18 | get '/myprofile/myuser/cms/new' | 18 | get '/myprofile/myuser/cms/new' |
19 | assert_response :success | 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 | assert_response :success | 23 | assert_response :success |
24 | assert_tag :tag => 'form', :attributes => { :action => '/myprofile/myuser/cms/new', :method => /post/i } | 24 | assert_tag :tag => 'form', :attributes => { :action => '/myprofile/myuser/cms/new', :method => /post/i } |
25 | 25 | ||
26 | assert_difference 'Article.count' do | 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 | end | 28 | end |
29 | 29 | ||
30 | assert_response :success | 30 | assert_response :success |
@@ -96,7 +96,7 @@ class ManageDocumentsTest < ActionDispatch::IntegrationTest | @@ -96,7 +96,7 @@ class ManageDocumentsTest < ActionDispatch::IntegrationTest | ||
96 | protected | 96 | protected |
97 | 97 | ||
98 | def create_article(profile, options) | 98 | def create_article(profile, options) |
99 | - a = TinyMceArticle.new(options) | 99 | + a = TextArticle.new(options) |
100 | a.profile = profile | 100 | a.profile = profile |
101 | a.save! | 101 | a.save! |
102 | a | 102 | a |
test/integration/performance_test.rb
@@ -49,7 +49,7 @@ class PerformanceTest < ActionDispatch::IntegrationTest | @@ -49,7 +49,7 @@ class PerformanceTest < ActionDispatch::IntegrationTest | ||
49 | blog = profile.blog | 49 | blog = profile.blog |
50 | n.times do |i| | 50 | n.times do |i| |
51 | postnumber += 1 | 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 | end | 53 | end |
54 | end | 54 | end |
55 | 55 |
test/integration/profile_blocks_test.rb
@@ -5,8 +5,8 @@ class ProfileBlocksTest < ActionDispatch::IntegrationTest | @@ -5,8 +5,8 @@ class ProfileBlocksTest < ActionDispatch::IntegrationTest | ||
5 | def blog_on_article_block_bootstrap | 5 | def blog_on_article_block_bootstrap |
6 | profile = fast_create(Profile) | 6 | profile = fast_create(Profile) |
7 | blog = fast_create(Blog, :name => 'Blog', :profile_id => profile.id) | 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 | block = ArticleBlock.new | 10 | block = ArticleBlock.new |
11 | block.article = blog | 11 | block.article = blog |
12 | profile.boxes << Box.new | 12 | profile.boxes << Box.new |
test/integration/safe_strings_test.rb
@@ -122,7 +122,7 @@ class SafeStringsTest < ActionDispatch::IntegrationTest | @@ -122,7 +122,7 @@ class SafeStringsTest < ActionDispatch::IntegrationTest | ||
122 | create_user('jimi', :password => 'test', :password_confirmation => 'test').activate | 122 | create_user('jimi', :password => 'test', :password_confirmation => 'test').activate |
123 | person = Person['jimi'] | 123 | person = Person['jimi'] |
124 | login 'jimi', 'test' | 124 | login 'jimi', 'test' |
125 | - get "/myprofile/jimi/cms/new?type=TinyMceArticle" | 125 | + get "/myprofile/jimi/cms/new?type=TextArticle" |
126 | assert_no_match /title: "Safestringstest::plugin1::macro"/, response.body | 126 | assert_no_match /title: "Safestringstest::plugin1::macro"/, response.body |
127 | end | 127 | end |
128 | 128 | ||
@@ -134,7 +134,7 @@ class SafeStringsTest < ActionDispatch::IntegrationTest | @@ -134,7 +134,7 @@ class SafeStringsTest < ActionDispatch::IntegrationTest | ||
134 | 134 | ||
135 | expected_content = 'something' | 135 | expected_content = 'something' |
136 | html_content = "<p>#{expected_content}</p>" | 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 | ActionTracker::Record.destroy_all | 138 | ActionTracker::Record.destroy_all |
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}) | 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 | get "/profile/marley" | 140 | get "/profile/marley" |
@@ -178,7 +178,7 @@ class SafeStringsTest < ActionDispatch::IntegrationTest | @@ -178,7 +178,7 @@ class SafeStringsTest < ActionDispatch::IntegrationTest | ||
178 | should 'not escape read more link to article on display short format' do | 178 | should 'not escape read more link to article on display short format' do |
179 | profile = fast_create Profile | 179 | profile = fast_create Profile |
180 | blog = fast_create Blog, :name => 'Blog', :profile_id => profile.id | 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 | blog.update_attribute(:visualization_format, 'short') | 182 | blog.update_attribute(:visualization_format, 'short') |
183 | 183 | ||
184 | get "/#{profile.identifier}/blog" | 184 | get "/#{profile.identifier}/blog" |
test/support/factories.rb
@@ -118,7 +118,7 @@ module Noosfero::Factory | @@ -118,7 +118,7 @@ module Noosfero::Factory | ||
118 | }.merge(options) | 118 | }.merge(options) |
119 | user = fast_insert_with_timestamps(User, data) | 119 | user = fast_insert_with_timestamps(User, data) |
120 | person = fast_insert_with_timestamps(Person, { :type => 'Person', :identifier => name, :name => name, :user_id => user.id, :environment_id => environment_id }.merge(person_options)) | 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 | fast_update(person, {:home_page_id => homepage.id}) | 122 | fast_update(person, {:home_page_id => homepage.id}) |
123 | box = fast_insert(Box, { :owner_type => "Profile", :owner_id => person.id, :position => 1}) | 123 | box = fast_insert(Box, { :owner_type => "Profile", :owner_id => person.id, :position => 1}) |
124 | block = fast_insert(Block, { :box_id => box.id, :type => 'MainBlock', :position => 0}) | 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,7 +91,7 @@ class ActionTrackerNotificationTest < ActiveSupport::TestCase | ||
91 | should "have comments through article action_tracker" do | 91 | should "have comments through article action_tracker" do |
92 | user = User.current = create_user | 92 | user = User.current = create_user |
93 | person = user.person | 93 | person = user.person |
94 | - article = create(TextileArticle, :profile_id => person.id) | 94 | + article = create(TextArticle, :profile_id => person.id) |
95 | process_delayed_job_queue | 95 | process_delayed_job_queue |
96 | notification = ActionTrackerNotification.last | 96 | notification = ActionTrackerNotification.last |
97 | 97 |
test/unit/application_helper_test.rb
@@ -615,7 +615,7 @@ class ApplicationHelperTest < ActionView::TestCase | @@ -615,7 +615,7 @@ class ApplicationHelperTest < ActionView::TestCase | ||
615 | 615 | ||
616 | should 'reference to article' do | 616 | should 'reference to article' do |
617 | c = fast_create(Community) | 617 | c = fast_create(Community) |
618 | - a = fast_create(TinyMceArticle, :profile_id => c.id) | 618 | + a = fast_create(TextArticle, :profile_id => c.id) |
619 | assert_equal( | 619 | assert_equal( |
620 | "<a href=\"/#{c.identifier}/#{a.slug}\">x</a>", | 620 | "<a href=\"/#{c.identifier}/#{a.slug}\">x</a>", |
621 | reference_to_article('x', a) ) | 621 | reference_to_article('x', a) ) |
@@ -623,7 +623,7 @@ class ApplicationHelperTest < ActionView::TestCase | @@ -623,7 +623,7 @@ class ApplicationHelperTest < ActionView::TestCase | ||
623 | 623 | ||
624 | should 'reference to article, with anchor' do | 624 | should 'reference to article, with anchor' do |
625 | c = fast_create(Community) | 625 | c = fast_create(Community) |
626 | - a = fast_create(TinyMceArticle, :profile_id => c.id) | 626 | + a = fast_create(TextArticle, :profile_id => c.id) |
627 | assert_equal( | 627 | assert_equal( |
628 | "<a href=\"/#{c.identifier}/#{a.slug}#place\">x</a>", | 628 | "<a href=\"/#{c.identifier}/#{a.slug}#place\">x</a>", |
629 | reference_to_article('x', a, 'place') ) | 629 | reference_to_article('x', a, 'place') ) |
@@ -632,7 +632,7 @@ class ApplicationHelperTest < ActionView::TestCase | @@ -632,7 +632,7 @@ class ApplicationHelperTest < ActionView::TestCase | ||
632 | should 'reference to article, in a blog' do | 632 | should 'reference to article, in a blog' do |
633 | c = fast_create(Community) | 633 | c = fast_create(Community) |
634 | b = fast_create(Blog, :profile_id => c.id) | 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 | a.save! # needed to link to the parent blog | 636 | a.save! # needed to link to the parent blog |
637 | assert_equal( | 637 | assert_equal( |
638 | "<a href=\"/#{c.identifier}/#{b.slug}/#{a.slug}\">x</a>", | 638 | "<a href=\"/#{c.identifier}/#{b.slug}/#{a.slug}\">x</a>", |
@@ -643,7 +643,7 @@ class ApplicationHelperTest < ActionView::TestCase | @@ -643,7 +643,7 @@ class ApplicationHelperTest < ActionView::TestCase | ||
643 | c = fast_create(Community) | 643 | c = fast_create(Community) |
644 | c.domains << build(Domain, :name=>'domain.xyz') | 644 | c.domains << build(Domain, :name=>'domain.xyz') |
645 | b = fast_create(Blog, :profile_id => c.id) | 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 | a.save! | 647 | a.save! |
648 | assert_equal( | 648 | assert_equal( |
649 | "<a href=\"http://domain.xyz/#{b.slug}/#{a.slug}\">x</a>", | 649 | "<a href=\"http://domain.xyz/#{b.slug}/#{a.slug}\">x</a>", |
@@ -856,7 +856,7 @@ class ApplicationHelperTest < ActionView::TestCase | @@ -856,7 +856,7 @@ class ApplicationHelperTest < ActionView::TestCase | ||
856 | assert_equal "Clone Blog", label_for_clone_article(Blog.new) | 856 | assert_equal "Clone Blog", label_for_clone_article(Blog.new) |
857 | assert_equal "Clone Event", label_for_clone_article(Event.new) | 857 | assert_equal "Clone Event", label_for_clone_article(Event.new) |
858 | assert_equal "Clone Forum", label_for_clone_article(Forum.new) | 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 | end | 860 | end |
861 | 861 | ||
862 | should "return top url of environment" do | 862 | should "return top url of environment" do |
@@ -880,6 +880,86 @@ class ApplicationHelperTest < ActionView::TestCase | @@ -880,6 +880,86 @@ class ApplicationHelperTest < ActionView::TestCase | ||
880 | assert_equal c.top_url, top_url | 880 | assert_equal c.top_url, top_url |
881 | end | 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 | protected | 963 | protected |
884 | include NoosferoTestHelper | 964 | include NoosferoTestHelper |
885 | 965 | ||
@@ -892,3 +972,4 @@ class ApplicationHelperTest < ActionView::TestCase | @@ -892,3 +972,4 @@ class ApplicationHelperTest < ActionView::TestCase | ||
892 | end | 972 | end |
893 | 973 | ||
894 | end | 974 | end |
975 | + |
test/unit/approve_article_test.rb
@@ -8,7 +8,7 @@ class ApproveArticleTest < ActiveSupport::TestCase | @@ -8,7 +8,7 @@ class ApproveArticleTest < ActiveSupport::TestCase | ||
8 | ActionMailer::Base.deliveries = [] | 8 | ActionMailer::Base.deliveries = [] |
9 | User.current = @user = create_user 'test_user' | 9 | User.current = @user = create_user 'test_user' |
10 | @profile = @user.person | 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 | @community = fast_create(Community) | 12 | @community = fast_create(Community) |
13 | @community.add_member(@profile) | 13 | @community.add_member(@profile) |
14 | end | 14 | end |
@@ -257,15 +257,15 @@ class ApproveArticleTest < ActiveSupport::TestCase | @@ -257,15 +257,15 @@ class ApproveArticleTest < ActiveSupport::TestCase | ||
257 | other_community.add_member(profile) | 257 | other_community.add_member(profile) |
258 | ActionTracker::Record.delete_all | 258 | ActionTracker::Record.delete_all |
259 | 259 | ||
260 | - article = fast_create(TextileArticle) | 260 | + article = fast_create(TextArticle) |
261 | a = create(ApproveArticle, :name => 'bar', :article => article, :target => community, :requestor => profile) | 261 | a = create(ApproveArticle, :name => 'bar', :article => article, :target => community, :requestor => profile) |
262 | a.finish | 262 | a.finish |
263 | 263 | ||
264 | - article = fast_create(TextileArticle) | 264 | + article = fast_create(TextArticle) |
265 | a = create(ApproveArticle, :name => 'another bar', :article => article, :target => community, :requestor => profile) | 265 | a = create(ApproveArticle, :name => 'another bar', :article => article, :target => community, :requestor => profile) |
266 | a.finish | 266 | a.finish |
267 | 267 | ||
268 | - article = fast_create(TextileArticle) | 268 | + article = fast_create(TextArticle) |
269 | a = create(ApproveArticle, :name => 'another bar', :article => article, :target => other_community, :requestor => profile) | 269 | a = create(ApproveArticle, :name => 'another bar', :article => article, :target => other_community, :requestor => profile) |
270 | a.finish | 270 | a.finish |
271 | assert_equal 3, ActionTracker::Record.count | 271 | assert_equal 3, ActionTracker::Record.count |
@@ -275,11 +275,11 @@ class ApproveArticleTest < ActiveSupport::TestCase | @@ -275,11 +275,11 @@ class ApproveArticleTest < ActiveSupport::TestCase | ||
275 | other_community = fast_create(Community) | 275 | other_community = fast_create(Community) |
276 | other_community.add_member(profile) | 276 | other_community.add_member(profile) |
277 | ActionTracker::Record.delete_all | 277 | ActionTracker::Record.delete_all |
278 | - article1 = fast_create(TextileArticle) | 278 | + article1 = fast_create(TextArticle) |
279 | a = create(ApproveArticle, :name => 'bar', :article => article1, :target => community, :requestor => profile) | 279 | a = create(ApproveArticle, :name => 'bar', :article => article1, :target => community, :requestor => profile) |
280 | a.finish | 280 | a.finish |
281 | 281 | ||
282 | - article2 = fast_create(TinyMceArticle) | 282 | + article2 = fast_create(TextArticle) |
283 | a = create(ApproveArticle, :name => 'another bar', :article => article2, :target => other_community, :requestor => profile) | 283 | a = create(ApproveArticle, :name => 'another bar', :article => article2, :target => other_community, :requestor => profile) |
284 | a.finish | 284 | a.finish |
285 | assert_equal 2, ActionTracker::Record.count | 285 | assert_equal 2, ActionTracker::Record.count |
test/unit/approve_comment_test.rb
@@ -7,7 +7,7 @@ class ApproveCommentTest < ActiveSupport::TestCase | @@ -7,7 +7,7 @@ class ApproveCommentTest < ActiveSupport::TestCase | ||
7 | ActionMailer::Base.perform_deliveries = true | 7 | ActionMailer::Base.perform_deliveries = true |
8 | ActionMailer::Base.deliveries = [] | 8 | ActionMailer::Base.deliveries = [] |
9 | @profile = create_user('test_user', :email => "someone@anyhost.com").person | 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 | @community = create(Community, :contact_email => "someone@anyhost.com") | 11 | @community = create(Community, :contact_email => "someone@anyhost.com") |
12 | @comment = build(Comment, :article => @article, :title => 'any comment', :body => "any text", :author => create_user('someperson').person) | 12 | @comment = build(Comment, :article => @article, :title => 'any comment', :body => "any text", :author => create_user('someperson').person) |
13 | end | 13 | end |
test/unit/article_test.rb
@@ -341,9 +341,9 @@ class ArticleTest < ActiveSupport::TestCase | @@ -341,9 +341,9 @@ class ArticleTest < ActiveSupport::TestCase | ||
341 | 341 | ||
342 | should 'list most commented articles' do | 342 | should 'list most commented articles' do |
343 | Article.delete_all | 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 | 2.times { create(Comment, :title => 'test', :body => 'asdsad', :author => profile, :source => a2).save! } | 348 | 2.times { create(Comment, :title => 'test', :body => 'asdsad', :author => profile, :source => a2).save! } |
349 | 4.times { create(Comment, :title => 'test', :body => 'asdsad', :author => profile, :source => a3).save! } | 349 | 4.times { create(Comment, :title => 'test', :body => 'asdsad', :author => profile, :source => a3).save! } |
@@ -643,14 +643,14 @@ class ArticleTest < ActiveSupport::TestCase | @@ -643,14 +643,14 @@ class ArticleTest < ActiveSupport::TestCase | ||
643 | should 'identify if belongs to blog' do | 643 | should 'identify if belongs to blog' do |
644 | p = create_user('user_blog_test').person | 644 | p = create_user('user_blog_test').person |
645 | blog = fast_create(Blog, :name => 'Blog test', :profile_id => p.id) | 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 | assert post.belongs_to_blog? | 647 | assert post.belongs_to_blog? |
648 | end | 648 | end |
649 | 649 | ||
650 | should 'not belongs to blog' do | 650 | should 'not belongs to blog' do |
651 | p = create_user('user_blog_test').person | 651 | p = create_user('user_blog_test').person |
652 | folder = fast_create(Folder, :name => 'Not Blog', :profile_id => p.id) | 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 | refute a.belongs_to_blog? | 654 | refute a.belongs_to_blog? |
655 | end | 655 | end |
656 | 656 | ||
@@ -955,7 +955,7 @@ class ArticleTest < ActiveSupport::TestCase | @@ -955,7 +955,7 @@ class ArticleTest < ActiveSupport::TestCase | ||
955 | end | 955 | end |
956 | 956 | ||
957 | should 'have short lead' do | 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 | assert_equal 170, a.short_lead.length | 959 | assert_equal 170, a.short_lead.length |
960 | end | 960 | end |
961 | 961 | ||
@@ -965,7 +965,7 @@ class ArticleTest < ActiveSupport::TestCase | @@ -965,7 +965,7 @@ class ArticleTest < ActiveSupport::TestCase | ||
965 | end | 965 | end |
966 | 966 | ||
967 | should 'track action when a published article is created outside a community' do | 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 | ta = article.activity | 969 | ta = article.activity |
970 | assert_equal article.name, ta.get_name | 970 | assert_equal article.name, ta.get_name |
971 | assert_equal article.url, ta.get_url | 971 | assert_equal article.url, ta.get_url |
@@ -980,7 +980,7 @@ class ArticleTest < ActiveSupport::TestCase | @@ -980,7 +980,7 @@ class ArticleTest < ActiveSupport::TestCase | ||
980 | community.add_member(p2) | 980 | community.add_member(p2) |
981 | User.current = p1.user | 981 | User.current = p1.user |
982 | 982 | ||
983 | - article = create(TinyMceArticle, :profile_id => community.id) | 983 | + article = create(TextArticle, :profile_id => community.id) |
984 | activity = article.activity | 984 | activity = article.activity |
985 | 985 | ||
986 | process_delayed_job_queue | 986 | process_delayed_job_queue |
@@ -989,7 +989,7 @@ class ArticleTest < ActiveSupport::TestCase | @@ -989,7 +989,7 @@ class ArticleTest < ActiveSupport::TestCase | ||
989 | end | 989 | end |
990 | 990 | ||
991 | should 'destroy activity when a published article is removed' do | 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 | assert_difference 'ActionTracker::Record.count', -1 do | 993 | assert_difference 'ActionTracker::Record.count', -1 do |
994 | a.destroy | 994 | a.destroy |
995 | end | 995 | end |
@@ -1022,7 +1022,7 @@ class ArticleTest < ActiveSupport::TestCase | @@ -1022,7 +1022,7 @@ class ArticleTest < ActiveSupport::TestCase | ||
1022 | end | 1022 | end |
1023 | 1023 | ||
1024 | should 'create activity' do | 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 | a.activity.destroy | 1026 | a.activity.destroy |
1027 | assert_nil a.activity | 1027 | assert_nil a.activity |
1028 | 1028 | ||
@@ -1068,7 +1068,7 @@ class ArticleTest < ActiveSupport::TestCase | @@ -1068,7 +1068,7 @@ class ArticleTest < ActiveSupport::TestCase | ||
1068 | 1068 | ||
1069 | should "not be trackable if article is inside a private community" do | 1069 | should "not be trackable if article is inside a private community" do |
1070 | private_community = fast_create(Community, :public_profile => false) | 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 | assert_equal false, a.is_trackable? | 1072 | assert_equal false, a.is_trackable? |
1073 | end | 1073 | end |
1074 | 1074 | ||
@@ -1081,7 +1081,7 @@ class ArticleTest < ActiveSupport::TestCase | @@ -1081,7 +1081,7 @@ class ArticleTest < ActiveSupport::TestCase | ||
1081 | member_1 = User.current.person | 1081 | member_1 = User.current.person |
1082 | community.add_member(member_1) | 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 | first_activity = article.activity | 1085 | first_activity = article.activity |
1086 | assert_equal [first_activity], ActionTracker::Record.where(verb: 'create_article') | 1086 | assert_equal [first_activity], ActionTracker::Record.where(verb: 'create_article') |
1087 | 1087 | ||
@@ -1091,7 +1091,7 @@ class ArticleTest < ActiveSupport::TestCase | @@ -1091,7 +1091,7 @@ class ArticleTest < ActiveSupport::TestCase | ||
1091 | member_2 = fast_create(Person) | 1091 | member_2 = fast_create(Person) |
1092 | community.add_member(member_2) | 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 | second_activity = article2.activity | 1095 | second_activity = article2.activity |
1096 | assert_equivalent [first_activity, second_activity], ActionTracker::Record.where(verb: 'create_article') | 1096 | assert_equivalent [first_activity, second_activity], ActionTracker::Record.where(verb: 'create_article') |
1097 | 1097 | ||
@@ -1107,7 +1107,7 @@ class ArticleTest < ActiveSupport::TestCase | @@ -1107,7 +1107,7 @@ class ArticleTest < ActiveSupport::TestCase | ||
1107 | ActionTracker::Record.destroy_all | 1107 | ActionTracker::Record.destroy_all |
1108 | ActionTrackerNotification.destroy_all | 1108 | ActionTrackerNotification.destroy_all |
1109 | User.current = profile.user | 1109 | User.current = profile.user |
1110 | - article = create(TinyMceArticle, :profile_id => profile.id) | 1110 | + article = create(TextArticle, :profile_id => profile.id) |
1111 | 1111 | ||
1112 | process_delayed_job_queue | 1112 | process_delayed_job_queue |
1113 | assert_equal friend, ActionTrackerNotification.last.profile | 1113 | assert_equal friend, ActionTrackerNotification.last.profile |
@@ -1119,7 +1119,7 @@ class ArticleTest < ActiveSupport::TestCase | @@ -1119,7 +1119,7 @@ class ArticleTest < ActiveSupport::TestCase | ||
1119 | f1.follow(profile, circle) | 1119 | f1.follow(profile, circle) |
1120 | 1120 | ||
1121 | User.current = profile.user | 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 | assert_equal 1, ActionTracker::Record.where(verb: 'create_article').count | 1123 | assert_equal 1, ActionTracker::Record.where(verb: 'create_article').count |
1124 | process_delayed_job_queue | 1124 | process_delayed_job_queue |
1125 | assert_equal 2, ActionTrackerNotification.where(action_tracker_id: article.activity.id).count | 1125 | assert_equal 2, ActionTrackerNotification.where(action_tracker_id: article.activity.id).count |
@@ -1128,7 +1128,7 @@ class ArticleTest < ActiveSupport::TestCase | @@ -1128,7 +1128,7 @@ class ArticleTest < ActiveSupport::TestCase | ||
1128 | circle2 = Circle.create!(:person=> f2, :name => "Zombies", :profile_type => 'Person') | 1128 | circle2 = Circle.create!(:person=> f2, :name => "Zombies", :profile_type => 'Person') |
1129 | f2.follow(profile, circle2) | 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 | assert_equal 2, ActionTracker::Record.where(verb: 'create_article').count | 1132 | assert_equal 2, ActionTracker::Record.where(verb: 'create_article').count |
1133 | process_delayed_job_queue | 1133 | process_delayed_job_queue |
1134 | assert_equal 3, ActionTrackerNotification.where(action_tracker_id: article2.activity.id).count | 1134 | assert_equal 3, ActionTrackerNotification.where(action_tracker_id: article2.activity.id).count |
@@ -1145,7 +1145,7 @@ class ArticleTest < ActiveSupport::TestCase | @@ -1145,7 +1145,7 @@ class ArticleTest < ActiveSupport::TestCase | ||
1145 | ActionTracker::Record.destroy_all | 1145 | ActionTracker::Record.destroy_all |
1146 | ActionTrackerNotification.destroy_all | 1146 | ActionTrackerNotification.destroy_all |
1147 | User.current = profile.user | 1147 | User.current = profile.user |
1148 | - article = create(TinyMceArticle, :profile_id => profile.id) | 1148 | + article = create(TextArticle, :profile_id => profile.id) |
1149 | activity = article.activity | 1149 | activity = article.activity |
1150 | 1150 | ||
1151 | process_delayed_job_queue | 1151 | process_delayed_job_queue |
@@ -1168,7 +1168,7 @@ class ArticleTest < ActiveSupport::TestCase | @@ -1168,7 +1168,7 @@ class ArticleTest < ActiveSupport::TestCase | ||
1168 | community.add_member(p2) | 1168 | community.add_member(p2) |
1169 | User.current = p1.user | 1169 | User.current = p1.user |
1170 | 1170 | ||
1171 | - article = create(TinyMceArticle, :profile_id => community.id) | 1171 | + article = create(TextArticle, :profile_id => community.id) |
1172 | activity = article.activity | 1172 | activity = article.activity |
1173 | 1173 | ||
1174 | process_delayed_job_queue | 1174 | process_delayed_job_queue |
@@ -1410,7 +1410,7 @@ class ArticleTest < ActiveSupport::TestCase | @@ -1410,7 +1410,7 @@ class ArticleTest < ActiveSupport::TestCase | ||
1410 | 1410 | ||
1411 | should 'retrieve latest info from topic when has no comments' do | 1411 | should 'retrieve latest info from topic when has no comments' do |
1412 | forum = fast_create(Forum, :name => 'Forum test', :profile_id => profile.id) | 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 | assert_equal post.updated_at, post.info_from_last_update[:date] | 1414 | assert_equal post.updated_at, post.info_from_last_update[:date] |
1415 | assert_equal profile.name, post.info_from_last_update[:author_name] | 1415 | assert_equal profile.name, post.info_from_last_update[:author_name] |
1416 | assert_equal profile.url, post.info_from_last_update[:author_url] | 1416 | assert_equal profile.url, post.info_from_last_update[:author_url] |
@@ -1418,19 +1418,15 @@ class ArticleTest < ActiveSupport::TestCase | @@ -1418,19 +1418,15 @@ class ArticleTest < ActiveSupport::TestCase | ||
1418 | 1418 | ||
1419 | should 'retrieve latest info from comment when has comments' do | 1419 | should 'retrieve latest info from comment when has comments' do |
1420 | forum = fast_create(Forum, :name => 'Forum test', :profile_id => profile.id) | 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 | post.comments << build(Comment, :name => 'Guest', :email => 'guest@example.com', :title => 'test comment', :body => 'hello!') | 1422 | post.comments << build(Comment, :name => 'Guest', :email => 'guest@example.com', :title => 'test comment', :body => 'hello!') |
1423 | assert_equal post.comments.last.created_at, post.info_from_last_update[:date] | 1423 | assert_equal post.comments.last.created_at, post.info_from_last_update[:date] |
1424 | assert_equal "Guest", post.info_from_last_update[:author_name] | 1424 | assert_equal "Guest", post.info_from_last_update[:author_name] |
1425 | assert_nil post.info_from_last_update[:author_url] | 1425 | assert_nil post.info_from_last_update[:author_url] |
1426 | end | 1426 | end |
1427 | 1427 | ||
1428 | - should 'tiny mce editor is disabled by default' do | ||
1429 | - refute Article.new.tiny_mce? | ||
1430 | - end | ||
1431 | - | ||
1432 | should 'return only folders' do | 1428 | should 'return only folders' do |
1433 | - not_folders = [RssFeed, TinyMceArticle, Event, TextileArticle] | 1429 | + not_folders = [RssFeed, TextArticle, Event, TextArticle] |
1434 | folders = [Folder, Blog, Gallery, Forum] | 1430 | folders = [Folder, Blog, Gallery, Forum] |
1435 | 1431 | ||
1436 | not_folders.each do |klass| | 1432 | not_folders.each do |klass| |
@@ -1445,7 +1441,7 @@ class ArticleTest < ActiveSupport::TestCase | @@ -1445,7 +1441,7 @@ class ArticleTest < ActiveSupport::TestCase | ||
1445 | end | 1441 | end |
1446 | 1442 | ||
1447 | should 'return no folders' do | 1443 | should 'return no folders' do |
1448 | - not_folders = [RssFeed, TinyMceArticle, Event, TextileArticle] | 1444 | + not_folders = [RssFeed, TextArticle, Event, TextArticle] |
1449 | folders = [Folder, Blog, Gallery, Forum] | 1445 | folders = [Folder, Blog, Gallery, Forum] |
1450 | 1446 | ||
1451 | not_folders.each do |klass| | 1447 | not_folders.each do |klass| |
@@ -1485,7 +1481,7 @@ class ArticleTest < ActiveSupport::TestCase | @@ -1485,7 +1481,7 @@ class ArticleTest < ActiveSupport::TestCase | ||
1485 | 1481 | ||
1486 | should 'get images paths in article body' do | 1482 | should 'get images paths in article body' do |
1487 | Environment.any_instance.stubs(:default_hostname).returns('noosfero.org') | 1483 | Environment.any_instance.stubs(:default_hostname).returns('noosfero.org') |
1488 | - a = build TinyMceArticle, :profile => @profile | 1484 | + a = build TextArticle, :profile => @profile |
1489 | a.body = 'Noosfero <img src="http://noosfero.com/test.png" /> test <img src="http://test.com/noosfero.png" />' | 1485 | a.body = 'Noosfero <img src="http://noosfero.com/test.png" /> test <img src="http://test.com/noosfero.png" />' |
1490 | assert_includes a.body_images_paths, 'http://noosfero.com/test.png' | 1486 | assert_includes a.body_images_paths, 'http://noosfero.com/test.png' |
1491 | assert_includes a.body_images_paths, 'http://test.com/noosfero.png' | 1487 | assert_includes a.body_images_paths, 'http://test.com/noosfero.png' |
@@ -1493,7 +1489,7 @@ class ArticleTest < ActiveSupport::TestCase | @@ -1493,7 +1489,7 @@ class ArticleTest < ActiveSupport::TestCase | ||
1493 | 1489 | ||
1494 | should 'always put article image first in images paths list in article body' do | 1490 | should 'always put article image first in images paths list in article body' do |
1495 | Environment.any_instance.stubs(:default_hostname).returns('noosfero.org') | 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 | :uploaded_data => fixture_file_upload('/files/rails.png', 'image/png') | 1493 | :uploaded_data => fixture_file_upload('/files/rails.png', 'image/png') |
1498 | }, :profile_id => @profile.id) | 1494 | }, :profile_id => @profile.id) |
1499 | a.save! | 1495 | a.save! |
@@ -1504,7 +1500,7 @@ class ArticleTest < ActiveSupport::TestCase | @@ -1504,7 +1500,7 @@ class ArticleTest < ActiveSupport::TestCase | ||
1504 | 1500 | ||
1505 | should 'escape utf8 characters correctly' do | 1501 | should 'escape utf8 characters correctly' do |
1506 | Environment.any_instance.stubs(:default_hostname).returns('noosfero.org') | 1502 | Environment.any_instance.stubs(:default_hostname).returns('noosfero.org') |
1507 | - a = build TinyMceArticle, profile: @profile | 1503 | + a = build TextArticle, profile: @profile |
1508 | a.body = 'Noosfero <img src="http://noosfero.com/cabeça.png" /> ' | 1504 | a.body = 'Noosfero <img src="http://noosfero.com/cabeça.png" /> ' |
1509 | assert_includes a.body_images_paths, 'http://noosfero.com/cabe%C3%A7a.png' | 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,7 +1511,7 @@ class ArticleTest < ActiveSupport::TestCase | ||
1515 | 1511 | ||
1516 | should 'get absolute images paths in article body' do | 1512 | should 'get absolute images paths in article body' do |
1517 | Environment.any_instance.stubs(:default_hostname).returns('noosfero.org') | 1513 | Environment.any_instance.stubs(:default_hostname).returns('noosfero.org') |
1518 | - a = build TinyMceArticle, :profile => @profile | 1514 | + a = build TextArticle, :profile => @profile |
1519 | a.body = 'Noosfero <img src="test.png" alt="Absolute" /> test <img src="/relative/path.png" />' | 1515 | a.body = 'Noosfero <img src="test.png" alt="Absolute" /> test <img src="/relative/path.png" />' |
1520 | assert_includes a.body_images_paths, 'http://noosfero.org/test.png' | 1516 | assert_includes a.body_images_paths, 'http://noosfero.org/test.png' |
1521 | assert_includes a.body_images_paths, 'http://noosfero.org/relative/path.png' | 1517 | assert_includes a.body_images_paths, 'http://noosfero.org/relative/path.png' |
@@ -1545,13 +1541,13 @@ class ArticleTest < ActiveSupport::TestCase | @@ -1545,13 +1541,13 @@ class ArticleTest < ActiveSupport::TestCase | ||
1545 | should 'find more recent contents' do | 1541 | should 'find more recent contents' do |
1546 | Article.delete_all | 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 | assert_equal [c2,c3,c1] , Article.more_recent | 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 | assert_equal [c2,c4,c3,c1] , Article.more_recent | 1551 | assert_equal [c2,c4,c3,c1] , Article.more_recent |
1556 | end | 1552 | end |
1557 | 1553 | ||
@@ -1604,18 +1600,6 @@ class ArticleTest < ActiveSupport::TestCase | @@ -1604,18 +1600,6 @@ class ArticleTest < ActiveSupport::TestCase | ||
1604 | assert_equal "4 views", a.more_popular_label | 1600 | assert_equal "4 views", a.more_popular_label |
1605 | end | 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 | should 'delegate region info to profile' do | 1603 | should 'delegate region info to profile' do |
1620 | Person.any_instance.expects(:region) | 1604 | Person.any_instance.expects(:region) |
1621 | Person.any_instance.expects(:region_id) | 1605 | Person.any_instance.expects(:region_id) |
@@ -1708,7 +1692,7 @@ class ArticleTest < ActiveSupport::TestCase | @@ -1708,7 +1692,7 @@ class ArticleTest < ActiveSupport::TestCase | ||
1708 | author = fast_create(Person) | 1692 | author = fast_create(Person) |
1709 | community.add_member(author) | 1693 | community.add_member(author) |
1710 | forum = Forum.create(:profile => community, :name => 'Forum test', :body => 'Forum test') | 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 | assert post.allow_edit?(author) | 1697 | assert post.allow_edit?(author) |
1714 | end | 1698 | end |
@@ -1742,7 +1726,7 @@ class ArticleTest < ActiveSupport::TestCase | @@ -1742,7 +1726,7 @@ class ArticleTest < ActiveSupport::TestCase | ||
1742 | end | 1726 | end |
1743 | 1727 | ||
1744 | should 'store first image in tracked action' do | 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 | assert_equal 'foo.png', a.first_image | 1730 | assert_equal 'foo.png', a.first_image |
1747 | assert_equal 'foo.png', ActionTracker::Record.last.get_first_image | 1731 | assert_equal 'foo.png', ActionTracker::Record.last.get_first_image |
1748 | end | 1732 | end |
@@ -1766,7 +1750,7 @@ class ArticleTest < ActiveSupport::TestCase | @@ -1766,7 +1750,7 @@ class ArticleTest < ActiveSupport::TestCase | ||
1766 | should 'update path if parent is changed' do | 1750 | should 'update path if parent is changed' do |
1767 | f1 = create(Folder, :name => 'Folder 1', :profile => profile) | 1751 | f1 = create(Folder, :name => 'Folder 1', :profile => profile) |
1768 | f2 = create(Folder, :name => 'Folder 2', :profile => profile) | 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 | assert_equal [f1.path,article.slug].join('/'), article.path | 1754 | assert_equal [f1.path,article.slug].join('/'), article.path |
1771 | 1755 | ||
1772 | article.parent = f2 | 1756 | article.parent = f2 |
@@ -1836,20 +1820,20 @@ class ArticleTest < ActiveSupport::TestCase | @@ -1836,20 +1820,20 @@ class ArticleTest < ActiveSupport::TestCase | ||
1836 | should 'identify if belongs to forum' do | 1820 | should 'identify if belongs to forum' do |
1837 | p = create_user('user_forum_test').person | 1821 | p = create_user('user_forum_test').person |
1838 | forum = fast_create(Forum, :name => 'Forum test', :profile_id => p.id) | 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 | assert post.belongs_to_forum? | 1824 | assert post.belongs_to_forum? |
1841 | end | 1825 | end |
1842 | 1826 | ||
1843 | should 'not belongs to forum' do | 1827 | should 'not belongs to forum' do |
1844 | p = create_user('user_forum_test').person | 1828 | p = create_user('user_forum_test').person |
1845 | blog = fast_create(Blog, :name => 'Not Forum', :profile_id => p.id) | 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 | refute a.belongs_to_forum? | 1831 | refute a.belongs_to_forum? |
1848 | end | 1832 | end |
1849 | 1833 | ||
1850 | should 'not belongs to forum if do not have a parent' do | 1834 | should 'not belongs to forum if do not have a parent' do |
1851 | p = create_user('user_forum_test').person | 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 | refute a.belongs_to_forum? | 1837 | refute a.belongs_to_forum? |
1854 | end | 1838 | end |
1855 | 1839 | ||
@@ -1865,13 +1849,12 @@ class ArticleTest < ActiveSupport::TestCase | @@ -1865,13 +1849,12 @@ class ArticleTest < ActiveSupport::TestCase | ||
1865 | should 'return articles with specific types' do | 1849 | should 'return articles with specific types' do |
1866 | Article.delete_all | 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 | c3 = fast_create(Event, :name => 'Testing article 3', :body => 'Article body 3', :profile_id => profile.id) | 1853 | c3 = fast_create(Event, :name => 'Testing article 3', :body => 'Article body 3', :profile_id => profile.id) |
1871 | c4 = fast_create(RssFeed, :name => 'Testing article 4', :body => 'Article body 4', :profile_id => profile.id) | 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 | assert_equivalent [c3], Article.with_types(['Event']) | 1858 | assert_equivalent [c3], Article.with_types(['Event']) |
1876 | end | 1859 | end |
1877 | 1860 | ||
@@ -2338,4 +2321,23 @@ class ArticleTest < ActiveSupport::TestCase | @@ -2338,4 +2321,23 @@ class ArticleTest < ActiveSupport::TestCase | ||
2338 | should 'have can_display_blocks with default true' do | 2321 | should 'have can_display_blocks with default true' do |
2339 | assert Article.can_display_blocks? | 2322 | assert Article.can_display_blocks? |
2340 | end | 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 | end | 2343 | end |
test/unit/blog_archives_block_test.rb
@@ -60,8 +60,8 @@ class BlogArchivesBlockTest < ActiveSupport::TestCase | @@ -60,8 +60,8 @@ class BlogArchivesBlockTest < ActiveSupport::TestCase | ||
60 | # block.stubs(:blog).returns(blog) | 60 | # block.stubs(:blog).returns(blog) |
61 | # block.stubs(:owner).returns(profile) | 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 | # assert_match /January \(1\)/, block.content({:person => person}) | 66 | # assert_match /January \(1\)/, block.content({:person => person}) |
67 | # assert_match /January \(1\)/, block.content() | 67 | # assert_match /January \(1\)/, block.content() |
@@ -84,7 +84,7 @@ class BlogArchivesBlockViewTest < ActionView::TestCase | @@ -84,7 +84,7 @@ class BlogArchivesBlockViewTest < ActionView::TestCase | ||
84 | date = DateTime.parse('2008-01-10') | 84 | date = DateTime.parse('2008-01-10') |
85 | blog = profile.blog | 85 | blog = profile.blog |
86 | for i in 1..10 do | 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 | post.update_attribute(:published_at, date) | 88 | post.update_attribute(:published_at, date) |
89 | end | 89 | end |
90 | block = BlogArchivesBlock.new | 90 | block = BlogArchivesBlock.new |
@@ -98,7 +98,7 @@ class BlogArchivesBlockViewTest < ActionView::TestCase | @@ -98,7 +98,7 @@ class BlogArchivesBlockViewTest < ActionView::TestCase | ||
98 | date = DateTime.parse('2008-01-10') | 98 | date = DateTime.parse('2008-01-10') |
99 | blog = profile.blog | 99 | blog = profile.blog |
100 | for i in 1..10 do | 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 | assert post.update_attribute(:published_at, date) | 102 | assert post.update_attribute(:published_at, date) |
103 | end | 103 | end |
104 | block = BlogArchivesBlock.new | 104 | block = BlogArchivesBlock.new |
@@ -120,7 +120,7 @@ class BlogArchivesBlockViewTest < ActionView::TestCase | @@ -120,7 +120,7 @@ class BlogArchivesBlockViewTest < ActionView::TestCase | ||
120 | should 'order list of amount posts' do | 120 | should 'order list of amount posts' do |
121 | blog = profile.blog | 121 | blog = profile.blog |
122 | for i in 1..10 do | 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 | post.update_attribute(:published_at, DateTime.parse("2008-#{i}-01")) | 124 | post.update_attribute(:published_at, DateTime.parse("2008-#{i}-01")) |
125 | end | 125 | end |
126 | block = BlogArchivesBlock.new | 126 | block = BlogArchivesBlock.new |
@@ -146,7 +146,7 @@ class BlogArchivesBlockViewTest < ActionView::TestCase | @@ -146,7 +146,7 @@ class BlogArchivesBlockViewTest < ActionView::TestCase | ||
146 | should 'order years' do | 146 | should 'order years' do |
147 | blog = profile.blog | 147 | blog = profile.blog |
148 | for year in 2005..2009 | 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 | end | 150 | end |
151 | block = BlogArchivesBlock.new | 151 | block = BlogArchivesBlock.new |
152 | block.stubs(:owner).returns(profile) | 152 | block.stubs(:owner).returns(profile) |
@@ -158,7 +158,7 @@ class BlogArchivesBlockViewTest < ActionView::TestCase | @@ -158,7 +158,7 @@ class BlogArchivesBlockViewTest < ActionView::TestCase | ||
158 | should 'order months from later to former' do | 158 | should 'order months from later to former' do |
159 | blog = profile.blog | 159 | blog = profile.blog |
160 | for month in 1..3 | 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 | end | 162 | end |
163 | block = BlogArchivesBlock.new | 163 | block = BlogArchivesBlock.new |
164 | block.stubs(:owner).returns(profile) | 164 | block.stubs(:owner).returns(profile) |
@@ -182,8 +182,8 @@ class BlogArchivesBlockViewTest < ActionView::TestCase | @@ -182,8 +182,8 @@ class BlogArchivesBlockViewTest < ActionView::TestCase | ||
182 | profile.articles << Blog.new(:name => 'Blog Two', :profile => profile) | 182 | profile.articles << Blog.new(:name => 'Blog Two', :profile => profile) |
183 | (blog_one, blog_two) = profile.blogs | 183 | (blog_one, blog_two) = profile.blogs |
184 | for month in 1..3 | 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 | end | 187 | end |
188 | block = BlogArchivesBlock.new | 188 | block = BlogArchivesBlock.new |
189 | block.stubs(:owner).returns(profile) | 189 | block.stubs(:owner).returns(profile) |
@@ -197,10 +197,10 @@ class BlogArchivesBlockViewTest < ActionView::TestCase | @@ -197,10 +197,10 @@ class BlogArchivesBlockViewTest < ActionView::TestCase | ||
197 | date = DateTime.parse('2008-01-10') | 197 | date = DateTime.parse('2008-01-10') |
198 | blog = profile.blog | 198 | blog = profile.blog |
199 | 2.times do |i| | 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 | :parent_id => blog.id, :language => 'en') | 201 | :parent_id => blog.id, :language => 'en') |
202 | post.update_attribute(:published_at, date) | 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 | :parent_id => blog.id, :language => 'en', :translation_of_id => post.id) | 204 | :parent_id => blog.id, :language => 'en', :translation_of_id => post.id) |
205 | translation.update_attribute(:published_at, date) | 205 | translation.update_attribute(:published_at, date) |
206 | end | 206 | end |
@@ -215,10 +215,10 @@ class BlogArchivesBlockViewTest < ActionView::TestCase | @@ -215,10 +215,10 @@ class BlogArchivesBlockViewTest < ActionView::TestCase | ||
215 | date = DateTime.parse('2008-01-10') | 215 | date = DateTime.parse('2008-01-10') |
216 | blog = profile.blog | 216 | blog = profile.blog |
217 | 2.times do |i| | 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 | :parent_id => blog.id, :language => 'en') | 219 | :parent_id => blog.id, :language => 'en') |
220 | post.update_attribute(:published_at, date) | 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 | :parent_id => blog.id, :language => 'en', :translation_of_id => post.id) | 222 | :parent_id => blog.id, :language => 'en', :translation_of_id => post.id) |
223 | translation.update_attribute(:published_at, date) | 223 | translation.update_attribute(:published_at, date) |
224 | end | 224 | end |
test/unit/blog_helper_test.rb
@@ -23,13 +23,13 @@ class BlogHelperTest < ActionView::TestCase | @@ -23,13 +23,13 @@ class BlogHelperTest < ActionView::TestCase | ||
23 | def h(s); s; end | 23 | def h(s); s; end |
24 | 24 | ||
25 | should 'list blog posts with identifiers and classes' do | 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 | :profile => profile, :parent => blog, :published => true) | 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 | :profile => profile, :parent => blog, :published => true) | 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 | :profile => profile, :parent => blog, :published => false) | 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 | :profile => profile, :parent => blog, :published => true) | 33 | :profile => profile, :parent => blog, :published => true) |
34 | 34 | ||
35 | def content_tag(tag, content_or_options_with_block = nil, options = nil, &block) | 35 | def content_tag(tag, content_or_options_with_block = nil, options = nil, &block) |
@@ -57,7 +57,7 @@ class BlogHelperTest < ActionView::TestCase | @@ -57,7 +57,7 @@ class BlogHelperTest < ActionView::TestCase | ||
57 | 57 | ||
58 | 58 | ||
59 | should 'display post' do | 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 | expects(:article_title).with(article, anything).returns('TITLE') | 61 | expects(:article_title).with(article, anything).returns('TITLE') |
62 | expects(:content_tag).with('p', article.to_html).returns(' TO_HTML') | 62 | expects(:content_tag).with('p', article.to_html).returns(' TO_HTML') |
63 | self.stubs(:params).returns({:npage => nil}) | 63 | self.stubs(:params).returns({:npage => nil}) |
test/unit/blog_test.rb
@@ -66,7 +66,7 @@ class BlogTest < ActiveSupport::TestCase | @@ -66,7 +66,7 @@ class BlogTest < ActiveSupport::TestCase | ||
66 | should 'has posts' do | 66 | should 'has posts' do |
67 | p = create_user('testuser').person | 67 | p = create_user('testuser').person |
68 | blog = fast_create(Blog, :profile_id => p.id, :name => 'Blog test') | 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 | blog.children << post | 70 | blog.children << post |
71 | assert_includes blog.posts, post | 71 | assert_includes blog.posts, post |
72 | end | 72 | end |
@@ -81,8 +81,8 @@ class BlogTest < ActiveSupport::TestCase | @@ -81,8 +81,8 @@ class BlogTest < ActiveSupport::TestCase | ||
81 | should 'list posts ordered by published at' do | 81 | should 'list posts ordered by published at' do |
82 | p = create_user('testuser').person | 82 | p = create_user('testuser').person |
83 | blog = fast_create(Blog, :profile_id => p.id, :name => 'Blog test') | 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 | assert_equal [newer, older], blog.posts | 86 | assert_equal [newer, older], blog.posts |
87 | end | 87 | end |
88 | 88 | ||
@@ -215,7 +215,7 @@ class BlogTest < ActiveSupport::TestCase | @@ -215,7 +215,7 @@ class BlogTest < ActiveSupport::TestCase | ||
215 | p = create_user('testuser').person | 215 | p = create_user('testuser').person |
216 | blog = Blog.create!(:profile => p, :name => 'Blog test') | 216 | blog = Blog.create!(:profile => p, :name => 'Blog test') |
217 | folder = fast_create(Folder, :parent_id => blog.id) | 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 | assert_not_includes blog.posts, folder | 220 | assert_not_includes blog.posts, folder |
221 | assert_includes blog.posts, article | 221 | assert_includes blog.posts, article |
@@ -230,7 +230,7 @@ class BlogTest < ActiveSupport::TestCase | @@ -230,7 +230,7 @@ class BlogTest < ActiveSupport::TestCase | ||
230 | p = create_user('testuser').person | 230 | p = create_user('testuser').person |
231 | blog = Blog.create!(:profile => p, :name => 'Blog test') | 231 | blog = Blog.create!(:profile => p, :name => 'Blog test') |
232 | assert blog.empty? | 232 | assert blog.empty? |
233 | - fast_create(TextileArticle, :parent_id => blog.id) | 233 | + fast_create(TextArticle, :parent_id => blog.id) |
234 | refute blog.empty? | 234 | refute blog.empty? |
235 | end | 235 | end |
236 | 236 | ||
@@ -270,18 +270,18 @@ class BlogTest < ActiveSupport::TestCase | @@ -270,18 +270,18 @@ class BlogTest < ActiveSupport::TestCase | ||
270 | should 'count total number of posts by year' do | 270 | should 'count total number of posts by year' do |
271 | p = create_user('testuser').person | 271 | p = create_user('testuser').person |
272 | blog = fast_create(Blog, :profile_id => p.id, :name => 'Blog test') | 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 | assert_equal [[2012.0, 1], [2010.0, 2]], blog.total_number_of_posts(:by_year) | 276 | assert_equal [[2012.0, 1], [2010.0, 2]], blog.total_number_of_posts(:by_year) |
277 | end | 277 | end |
278 | 278 | ||
279 | should 'count total number of posts by month' do | 279 | should 'count total number of posts by month' do |
280 | p = create_user('testuser').person | 280 | p = create_user('testuser').person |
281 | blog = fast_create(Blog, :profile_id => p.id, :name => 'Blog test') | 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 | assert_equal [[10.0, 1], [8.0, 2]], blog.total_number_of_posts(:by_month, 2010) | 285 | assert_equal [[10.0, 1], [8.0, 2]], blog.total_number_of_posts(:by_month, 2010) |
286 | end | 286 | end |
287 | 287 |
test/unit/clone_article_test.rb
@@ -5,7 +5,7 @@ class CloneArticleTest < ActiveSupport::TestCase | @@ -5,7 +5,7 @@ class CloneArticleTest < ActiveSupport::TestCase | ||
5 | should 'cloned article have its source attributes' do | 5 | should 'cloned article have its source attributes' do |
6 | community = fast_create(Community) | 6 | community = fast_create(Community) |
7 | folder = fast_create(Folder, :profile_id => community.id) | 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 | article.parent_id = folder.id | 9 | article.parent_id = folder.id |
10 | article.save! | 10 | article.save! |
11 | 11 | ||
@@ -18,4 +18,4 @@ class CloneArticleTest < ActiveSupport::TestCase | @@ -18,4 +18,4 @@ class CloneArticleTest < ActiveSupport::TestCase | ||
18 | assert_equal article.setting, cloned_article.setting | 18 | assert_equal article.setting, cloned_article.setting |
19 | end | 19 | end |
20 | 20 | ||
21 | -end | ||
22 | \ No newline at end of file | 21 | \ No newline at end of file |
22 | +end |
test/unit/cms_helper_test.rb
@@ -31,7 +31,7 @@ class CmsHelperTest < ActionView::TestCase | @@ -31,7 +31,7 @@ class CmsHelperTest < ActionView::TestCase | ||
31 | 31 | ||
32 | should 'display link to article if article is not folder' do | 32 | should 'display link to article if article is not folder' do |
33 | profile = fast_create(Profile) | 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 | expects(:link_to).with('My article', article.url, :class => icon_for_article(article)) | 35 | expects(:link_to).with('My article', article.url, :class => icon_for_article(article)) |
36 | 36 | ||
37 | result = link_to_article(article) | 37 | result = link_to_article(article) |
@@ -51,7 +51,7 @@ class CmsHelperTest < ActionView::TestCase | @@ -51,7 +51,7 @@ class CmsHelperTest < ActionView::TestCase | ||
51 | should 'display spread button' do | 51 | should 'display spread button' do |
52 | plugins.stubs(:dispatch).returns([]) | 52 | plugins.stubs(:dispatch).returns([]) |
53 | profile = fast_create(Person) | 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 | expects(:link_to).with('Spread this', {:action => 'publish', :id => article.id}, :class => 'modal-toggle button with-text icon-spread', :title => nil) | 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 | result = display_spread_button(article) | 57 | result = display_spread_button(article) |
@@ -72,7 +72,7 @@ class CmsHelperTest < ActionView::TestCase | @@ -72,7 +72,7 @@ class CmsHelperTest < ActionView::TestCase | ||
72 | plugins.stubs(:dispatch).returns([]) | 72 | plugins.stubs(:dispatch).returns([]) |
73 | profile = fast_create(Profile) | 73 | profile = fast_create(Profile) |
74 | name = 'My article' | 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 | confirm_message = "Are you sure that you want to remove the item \"#{name}\"?" | 76 | confirm_message = "Are you sure that you want to remove the item \"#{name}\"?" |
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) | 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,7 +65,7 @@ class CommentTest < ActiveSupport::TestCase | ||
65 | 65 | ||
66 | should 'update counter cache in article' do | 66 | should 'update counter cache in article' do |
67 | owner = create_user('testuser').person | 67 | owner = create_user('testuser').person |
68 | - art = create(TextileArticle, :profile_id => owner.id) | 68 | + art = create(TextArticle, :profile_id => owner.id) |
69 | cc = art.comments_count | 69 | cc = art.comments_count |
70 | 70 | ||
71 | comment = create(Comment, :source => art, :author_id => owner.id) | 71 | comment = create(Comment, :source => art, :author_id => owner.id) |
@@ -75,7 +75,7 @@ class CommentTest < ActiveSupport::TestCase | @@ -75,7 +75,7 @@ class CommentTest < ActiveSupport::TestCase | ||
75 | should 'update counter cache in article activity' do | 75 | should 'update counter cache in article activity' do |
76 | User.current = user = create_user 'testuser' | 76 | User.current = user = create_user 'testuser' |
77 | owner = user.person | 77 | owner = user.person |
78 | - article = create(TextileArticle, :profile_id => owner.id) | 78 | + article = create(TextArticle, :profile_id => owner.id) |
79 | 79 | ||
80 | action = article.activity | 80 | action = article.activity |
81 | cc = action.comments_count | 81 | cc = action.comments_count |
@@ -290,7 +290,7 @@ class CommentTest < ActiveSupport::TestCase | @@ -290,7 +290,7 @@ class CommentTest < ActiveSupport::TestCase | ||
290 | should "return activities comments as a thread" do | 290 | should "return activities comments as a thread" do |
291 | User.current = user = create_user | 291 | User.current = user = create_user |
292 | person = user.person | 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 | c0 = Comment.create!(:source => a, :body => 'My comment', :author => person) | 294 | c0 = Comment.create!(:source => a, :body => 'My comment', :author => person) |
295 | c1 = Comment.create!(:reply_of_id => c0.id, :source => a, :body => 'bla', :author => person) | 295 | c1 = Comment.create!(:reply_of_id => c0.id, :source => a, :body => 'bla', :author => person) |
296 | c2 = Comment.create!(:reply_of_id => c1.id, :source => a, :body => 'bla', :author => person) | 296 | c2 = Comment.create!(:reply_of_id => c1.id, :source => a, :body => 'bla', :author => person) |
@@ -308,7 +308,7 @@ class CommentTest < ActiveSupport::TestCase | @@ -308,7 +308,7 @@ class CommentTest < ActiveSupport::TestCase | ||
308 | should "return activities comments when some comment on thread is spam and not display its replies" do | 308 | should "return activities comments when some comment on thread is spam and not display its replies" do |
309 | User.current = user = create_user | 309 | User.current = user = create_user |
310 | person = user.person | 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 | c0 = Comment.create(:source => a, :body => 'Root comment', :author => person) | 312 | c0 = Comment.create(:source => a, :body => 'Root comment', :author => person) |
313 | c1 = Comment.create(:reply_of_id => c0.id, :source => a, :body => 'c1', :author => person) | 313 | c1 = Comment.create(:reply_of_id => c0.id, :source => a, :body => 'c1', :author => person) |
314 | c2 = Comment.create(:source => a, :body => 'c2', :author => person) | 314 | c2 = Comment.create(:source => a, :body => 'c2', :author => person) |
@@ -385,7 +385,7 @@ class CommentTest < ActiveSupport::TestCase | @@ -385,7 +385,7 @@ class CommentTest < ActiveSupport::TestCase | ||
385 | 385 | ||
386 | User.current = user = create_user 'testuser' | 386 | User.current = user = create_user 'testuser' |
387 | profile = user.person | 387 | profile = user.person |
388 | - article = create(TinyMceArticle, :profile => profile) | 388 | + article = create(TextArticle, :profile => profile) |
389 | 389 | ||
390 | ActionTracker::Record.record_timestamps = false | 390 | ActionTracker::Record.record_timestamps = false |
391 | article.activity.update_attribute(:updated_at, Time.now - 1.day) | 391 | article.activity.update_attribute(:updated_at, Time.now - 1.day) |
@@ -400,7 +400,7 @@ class CommentTest < ActiveSupport::TestCase | @@ -400,7 +400,7 @@ class CommentTest < ActiveSupport::TestCase | ||
400 | should 'create a new activity when add a comment and the activity was removed' do | 400 | should 'create a new activity when add a comment and the activity was removed' do |
401 | User.current = user = create_user 'testuser' | 401 | User.current = user = create_user 'testuser' |
402 | profile = user.person | 402 | profile = user.person |
403 | - article = create(TinyMceArticle, :profile => profile) | 403 | + article = create(TextArticle, :profile => profile) |
404 | article.activity.destroy | 404 | article.activity.destroy |
405 | 405 | ||
406 | assert_nil article.activity | 406 | assert_nil article.activity |
@@ -776,7 +776,7 @@ class CommentTest < ActiveSupport::TestCase | @@ -776,7 +776,7 @@ class CommentTest < ActiveSupport::TestCase | ||
776 | 776 | ||
777 | def create_comment(args = {}) | 777 | def create_comment(args = {}) |
778 | owner = create_user('testuser').person | 778 | owner = create_user('testuser').person |
779 | - article = create(TextileArticle, :profile_id => owner.id) | 779 | + article = create(TextArticle, :profile_id => owner.id) |
780 | create(Comment, { :name => 'foo', :email => 'foo@example.com', :source => article }.merge(args)) | 780 | create(Comment, { :name => 'foo', :email => 'foo@example.com', :source => article }.merge(args)) |
781 | end | 781 | end |
782 | 782 |
test/unit/community_test.rb
@@ -145,25 +145,25 @@ class CommunityTest < ActiveSupport::TestCase | @@ -145,25 +145,25 @@ class CommunityTest < ActiveSupport::TestCase | ||
145 | c = fast_create(Community, :name => 'test_com') | 145 | c = fast_create(Community, :name => 'test_com') |
146 | f = fast_create(Folder, :name => 'folder', :profile_id => c.id) | 146 | f = fast_create(Folder, :name => 'folder', :profile_id => c.id) |
147 | u = create(UploadedFile, :profile => c, :uploaded_data => fixture_file_upload('/files/rails.png', 'image/png')) | 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 | assert_equal [t_in_f, t], c.news(2) | 152 | assert_equal [t_in_f, t], c.news(2) |
153 | end | 153 | end |
154 | 154 | ||
155 | should 'not return highlighted news when not asked' do | 155 | should 'not return highlighted news when not asked' do |
156 | c = fast_create(Community, :name => 'test_com') | 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 | assert_equal [t].map(&:slug), c.news(2).map(&:slug) | 160 | assert_equal [t].map(&:slug), c.news(2).map(&:slug) |
161 | end | 161 | end |
162 | 162 | ||
163 | should 'return highlighted news when asked' do | 163 | should 'return highlighted news when asked' do |
164 | c = fast_create(Community, :name => 'test_com') | 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 | assert_equal [highlighted_t].map(&:slug), c.news(2, true).map(&:slug) | 168 | assert_equal [highlighted_t].map(&:slug), c.news(2, true).map(&:slug) |
169 | end | 169 | end |
@@ -293,7 +293,7 @@ class CommunityTest < ActiveSupport::TestCase | @@ -293,7 +293,7 @@ class CommunityTest < ActiveSupport::TestCase | ||
293 | p2 = create_user.person | 293 | p2 = create_user.person |
294 | p3 = create_user.person | 294 | p3 = create_user.person |
295 | community.add_member(p3) | 295 | community.add_member(p3) |
296 | - article = create(TextileArticle, :profile_id => community.id) | 296 | + article = create(TextArticle, :profile_id => community.id) |
297 | time = article.activity.updated_at + 1.day | 297 | time = article.activity.updated_at + 1.day |
298 | Time.stubs(:now).returns(time) | 298 | Time.stubs(:now).returns(time) |
299 | create(Comment, :source_id => article.id, :title => 'some', :body => 'some', :author_id => p2.id) | 299 | create(Comment, :source_id => article.id, :title => 'some', :body => 'some', :author_id => p2.id) |
@@ -366,7 +366,7 @@ class CommunityTest < ActiveSupport::TestCase | @@ -366,7 +366,7 @@ class CommunityTest < ActiveSupport::TestCase | ||
366 | 366 | ||
367 | User.current = person.user | 367 | User.current = person.user |
368 | assert_difference 'ActionTracker::Record.count', 1 do | 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 | assert_equal [article.activity], community.activities.map(&:activity) | 370 | assert_equal [article.activity], community.activities.map(&:activity) |
371 | end | 371 | end |
372 | end | 372 | end |
@@ -377,7 +377,7 @@ class CommunityTest < ActiveSupport::TestCase | @@ -377,7 +377,7 @@ class CommunityTest < ActiveSupport::TestCase | ||
377 | community2 = fast_create(Community) | 377 | community2 = fast_create(Community) |
378 | 378 | ||
379 | User.current = person.user | 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 | assert_not_includes community.activities.map { |a| a.klass.constantize.find(a.id) }, article.activity | 382 | assert_not_includes community.activities.map { |a| a.klass.constantize.find(a.id) }, article.activity |
383 | end | 383 | end |
test/unit/content_viewer_helper_test.rb
@@ -16,27 +16,27 @@ class ContentViewerHelperTest < ActionView::TestCase | @@ -16,27 +16,27 @@ class ContentViewerHelperTest < ActionView::TestCase | ||
16 | 16 | ||
17 | should 'display published-at for blog posts' do | 17 | should 'display published-at for blog posts' do |
18 | blog = fast_create(Blog, :name => 'Blog test', :profile_id => profile.id) | 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 | result = article_title(post) | 20 | result = article_title(post) |
21 | assert_tag_in_string result, :tag => 'span', :content => show_time(post.published_at) | 21 | assert_tag_in_string result, :tag => 'span', :content => show_time(post.published_at) |
22 | end | 22 | end |
23 | 23 | ||
24 | should 'display published-at for forum posts' do | 24 | should 'display published-at for forum posts' do |
25 | forum = fast_create(Forum, :name => 'Forum test', :profile_id => profile.id) | 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 | result = article_title(post) | 27 | result = article_title(post) |
28 | assert_tag_in_string result, :tag => 'span', :content => show_time(post.published_at) | 28 | assert_tag_in_string result, :tag => 'span', :content => show_time(post.published_at) |
29 | end | 29 | end |
30 | 30 | ||
31 | should 'not display published-at for non-blog and non-forum posts' do | 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 | result = article_title(article) | 33 | result = article_title(article) |
34 | assert_no_match /<span class="date">#{show_date(article.published_at)}<\/span><span class="author">, by .*#{profile.identifier}/, result | 34 | assert_no_match /<span class="date">#{show_date(article.published_at)}<\/span><span class="author">, by .*#{profile.identifier}/, result |
35 | end | 35 | end |
36 | 36 | ||
37 | should 'create link on title of blog posts' do | 37 | should 'create link on title of blog posts' do |
38 | blog = fast_create(Blog, :name => 'Blog test', :profile_id => profile.id) | 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 | assert post.belongs_to_blog? | 40 | assert post.belongs_to_blog? |
41 | result = article_title(post) | 41 | result = article_title(post) |
42 | assert_tag_in_string result, :tag => 'h1', :child => {:tag => 'a', :content => 'post test', :attributes => { :href => /my-article-\d+/ }} | 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,33 +44,33 @@ class ContentViewerHelperTest < ActionView::TestCase | ||
44 | 44 | ||
45 | should 'not create link on title if pass no_link option' do | 45 | should 'not create link on title if pass no_link option' do |
46 | blog = fast_create(Blog, :name => 'Blog test', :profile_id => profile.id) | 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 | result = article_title(post, :no_link => :true) | 48 | result = article_title(post, :no_link => :true) |
49 | assert_no_match /a href='#{url_for(post.url)}'>#{post.name}</, result | 49 | assert_no_match /a href='#{url_for(post.url)}'>#{post.name}</, result |
50 | end | 50 | end |
51 | 51 | ||
52 | should 'not create link on title if non-blog post' do | 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 | result = article_title(article) | 54 | result = article_title(article) |
55 | assert_no_match /a href='#{url_for(article.url)}'>#{article.name}</, result | 55 | assert_no_match /a href='#{url_for(article.url)}'>#{article.name}</, result |
56 | end | 56 | end |
57 | 57 | ||
58 | should 'not create link to comments if called with no_comments' do | 58 | should 'not create link to comments if called with no_comments' do |
59 | blog = fast_create(Blog, :name => 'Blog test', :profile_id => profile.id) | 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 | result = article_title(article, :no_comments => true) | 61 | result = article_title(article, :no_comments => true) |
62 | assert_no_match(/a href='.*comments_list.*>No comments yet</, result) | 62 | assert_no_match(/a href='.*comments_list.*>No comments yet</, result) |
63 | end | 63 | end |
64 | 64 | ||
65 | should 'not create link to comments if the article doesn\'t allow comments' do | 65 | should 'not create link to comments if the article doesn\'t allow comments' do |
66 | blog = fast_create(Blog, :name => 'Blog test', :profile_id => profile.id) | 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 | result = article_title(article) | 68 | result = article_title(article) |
69 | assert_no_match(/a href='.*comments_list.*>No comments yet</, result) | 69 | assert_no_match(/a href='.*comments_list.*>No comments yet</, result) |
70 | end | 70 | end |
71 | 71 | ||
72 | should 'count total of comments from post' do | 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 | create(Comment, :article => article, :author => profile, :title => 'test', :body => 'test') | 74 | create(Comment, :article => article, :author => profile, :title => 'test', :body => 'test') |
75 | article.reload | 75 | article.reload |
76 | result = link_to_comments(article) | 76 | result = link_to_comments(article) |
@@ -78,7 +78,7 @@ class ContentViewerHelperTest < ActionView::TestCase | @@ -78,7 +78,7 @@ class ContentViewerHelperTest < ActionView::TestCase | ||
78 | end | 78 | end |
79 | 79 | ||
80 | should 'not display total of comments if the article doesn\'t allow comments' do | 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 | article.stubs(:url).returns({}) | 82 | article.stubs(:url).returns({}) |
83 | article.stubs(:comments).returns([build(Comment, :author => profile, :title => 'test', :body => 'test')]) | 83 | article.stubs(:comments).returns([build(Comment, :author => profile, :title => 'test', :body => 'test')]) |
84 | result = link_to_comments(article) | 84 | result = link_to_comments(article) |
@@ -86,7 +86,7 @@ class ContentViewerHelperTest < ActionView::TestCase | @@ -86,7 +86,7 @@ class ContentViewerHelperTest < ActionView::TestCase | ||
86 | end | 86 | end |
87 | 87 | ||
88 | should 'not crash if spam_comments_count is nil' do | 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 | article.stubs(:comments_count).returns(10) | 90 | article.stubs(:comments_count).returns(10) |
91 | article.stubs(:spam_comments_count).returns(nil) | 91 | article.stubs(:spam_comments_count).returns(nil) |
92 | result = number_of_comments(article) | 92 | result = number_of_comments(article) |
@@ -116,7 +116,7 @@ class ContentViewerHelperTest < ActionView::TestCase | @@ -116,7 +116,7 @@ class ContentViewerHelperTest < ActionView::TestCase | ||
116 | 116 | ||
117 | should 'show date with mm/dd/yyyy' do | 117 | should 'show date with mm/dd/yyyy' do |
118 | Environment.any_instance.stubs(:date_format).returns('numbers_with_year') | 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 | article.published_at = Time.zone.local(2007, 2, 1, 15, 30, 45) | 120 | article.published_at = Time.zone.local(2007, 2, 1, 15, 30, 45) |
121 | article.save! | 121 | article.save! |
122 | result = show_with_right_format_date article | 122 | result = show_with_right_format_date article |
@@ -125,7 +125,7 @@ class ContentViewerHelperTest < ActionView::TestCase | @@ -125,7 +125,7 @@ class ContentViewerHelperTest < ActionView::TestCase | ||
125 | 125 | ||
126 | should 'show date with mm/dd' do | 126 | should 'show date with mm/dd' do |
127 | Environment.any_instance.stubs(:date_format).returns('numbers') | 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 | article.published_at = Time.zone.local(2007, 2, 1, 15, 30, 45) | 129 | article.published_at = Time.zone.local(2007, 2, 1, 15, 30, 45) |
130 | article.save! | 130 | article.save! |
131 | result = show_with_right_format_date article | 131 | result = show_with_right_format_date article |
@@ -134,7 +134,7 @@ class ContentViewerHelperTest < ActionView::TestCase | @@ -134,7 +134,7 @@ class ContentViewerHelperTest < ActionView::TestCase | ||
134 | 134 | ||
135 | should 'show date with month name' do | 135 | should 'show date with month name' do |
136 | Environment.any_instance.stubs(:date_format).returns('month_name') | 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 | article.published_at = Time.zone.local(2007, 2, 1, 15, 30, 45) | 138 | article.published_at = Time.zone.local(2007, 2, 1, 15, 30, 45) |
139 | article.save! | 139 | article.save! |
140 | result = show_with_right_format_date article | 140 | result = show_with_right_format_date article |
@@ -143,7 +143,7 @@ class ContentViewerHelperTest < ActionView::TestCase | @@ -143,7 +143,7 @@ class ContentViewerHelperTest < ActionView::TestCase | ||
143 | 143 | ||
144 | should 'show date with month name and year' do | 144 | should 'show date with month name and year' do |
145 | Environment.any_instance.stubs(:date_format).returns('month_name_with_year') | 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 | article.published_at = Time.zone.local(2007, 2, 1, 15, 30, 45) | 147 | article.published_at = Time.zone.local(2007, 2, 1, 15, 30, 45) |
148 | article.save! | 148 | article.save! |
149 | result = show_with_right_format_date article | 149 | result = show_with_right_format_date article |
test/unit/enterprise_test.rb
@@ -414,7 +414,7 @@ class EnterpriseTest < ActiveSupport::TestCase | @@ -414,7 +414,7 @@ class EnterpriseTest < ActiveSupport::TestCase | ||
414 | enterprise = fast_create(Enterprise) | 414 | enterprise = fast_create(Enterprise) |
415 | 415 | ||
416 | User.current = person.user | 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 | assert_equal [article.activity], enterprise.activities.map(&:activity) | 419 | assert_equal [article.activity], enterprise.activities.map(&:activity) |
420 | end | 420 | end |
@@ -425,7 +425,7 @@ class EnterpriseTest < ActiveSupport::TestCase | @@ -425,7 +425,7 @@ class EnterpriseTest < ActiveSupport::TestCase | ||
425 | enterprise2 = fast_create(Enterprise) | 425 | enterprise2 = fast_create(Enterprise) |
426 | 426 | ||
427 | User.current = person.user | 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 | assert_not_includes enterprise.activities.map(&:activity), article.activity | 430 | assert_not_includes enterprise.activities.map(&:activity), article.activity |
431 | end | 431 | end |
test/unit/event_test.rb
@@ -285,10 +285,6 @@ class EventTest < ActiveSupport::TestCase | @@ -285,10 +285,6 @@ class EventTest < ActiveSupport::TestCase | ||
285 | assert_kind_of TranslatableContent, Event.new | 285 | assert_kind_of TranslatableContent, Event.new |
286 | end | 286 | end |
287 | 287 | ||
288 | - should 'tiny mce editor is enabled' do | ||
289 | - assert Event.new.tiny_mce? | ||
290 | - end | ||
291 | - | ||
292 | should 'be notifiable' do | 288 | should 'be notifiable' do |
293 | assert Event.new.notifiable? | 289 | assert Event.new.notifiable? |
294 | end | 290 | end |
test/unit/folder_test.rb
@@ -63,9 +63,9 @@ class FolderTest < ActiveSupport::TestCase | @@ -63,9 +63,9 @@ class FolderTest < ActiveSupport::TestCase | ||
63 | folder = fast_create(Folder, :profile_id => c.id) | 63 | folder = fast_create(Folder, :profile_id => c.id) |
64 | f = fast_create(Folder, :name => 'folder', :profile_id => c.id, :parent_id => folder.id) | 64 | f = fast_create(Folder, :name => 'folder', :profile_id => c.id, :parent_id => folder.id) |
65 | u = create(UploadedFile, :profile => c, :uploaded_data => fixture_file_upload('/files/rails.png', 'image/png'), :parent => folder) | 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 | assert_equal [t], folder.news(1) | 70 | assert_equal [t], folder.news(1) |
71 | end | 71 | end |
@@ -73,8 +73,8 @@ class FolderTest < ActiveSupport::TestCase | @@ -73,8 +73,8 @@ class FolderTest < ActiveSupport::TestCase | ||
73 | should 'not return highlighted news when not asked' do | 73 | should 'not return highlighted news when not asked' do |
74 | c = fast_create(Community) | 74 | c = fast_create(Community) |
75 | folder = fast_create(Folder, :profile_id => c.id) | 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 | assert_equal [t].map(&:slug), folder.news(2).map(&:slug) | 79 | assert_equal [t].map(&:slug), folder.news(2).map(&:slug) |
80 | end | 80 | end |
@@ -82,8 +82,8 @@ class FolderTest < ActiveSupport::TestCase | @@ -82,8 +82,8 @@ class FolderTest < ActiveSupport::TestCase | ||
82 | should 'return highlighted news when asked' do | 82 | should 'return highlighted news when asked' do |
83 | c = fast_create(Community) | 83 | c = fast_create(Community) |
84 | folder = fast_create(Folder, :profile_id => c.id) | 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 | assert_equal [highlighted_t].map(&:slug), folder.news(2, true).map(&:slug) | 88 | assert_equal [highlighted_t].map(&:slug), folder.news(2, true).map(&:slug) |
89 | end | 89 | end |
test/unit/forum_helper_test.rb
@@ -30,16 +30,16 @@ class ForumHelperTest < ActionView::TestCase | @@ -30,16 +30,16 @@ class ForumHelperTest < ActionView::TestCase | ||
30 | end | 30 | end |
31 | 31 | ||
32 | should 'list posts with different classes' do | 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 | one_month_later = Time.now + 1.month | 34 | one_month_later = Time.now + 1.month |
35 | Time.stubs(:now).returns(one_month_later) | 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 | assert_match /forum-post position-1 first odd-post.*forum-post position-2 last not-published even-post/, list_forum_posts(forum.posts) | 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 | end | 38 | end |
39 | 39 | ||
40 | should 'return post update if it has no comments' do | 40 | should 'return post update if it has no comments' do |
41 | author = create_user('forum test author').person | 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 | assert some_post.comments.empty? | 43 | assert some_post.comments.empty? |
44 | out = last_topic_update(some_post) | 44 | out = last_topic_update(some_post) |
45 | assert_match time_ago_in_words(some_post.updated_at), out | 45 | assert_match time_ago_in_words(some_post.updated_at), out |
@@ -47,7 +47,7 @@ class ForumHelperTest < ActionView::TestCase | @@ -47,7 +47,7 @@ class ForumHelperTest < ActionView::TestCase | ||
47 | end | 47 | end |
48 | 48 | ||
49 | should 'return last comment date if it has comments' do | 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 | a1, a2 = create_user('a1').person, create_user('a2').person | 51 | a1, a2 = create_user('a1').person, create_user('a2').person |
52 | some_post.comments << build(Comment, :title => 'test', :body => 'test', :author => a1, :created_at => Time.now - 1.day) | 52 | some_post.comments << build(Comment, :title => 'test', :body => 'test', :author => a1, :created_at => Time.now - 1.day) |
53 | some_post.comments << build(Comment, :title => 'test', :body => 'test', :author => a2, :created_at => Time.now) | 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,7 +62,7 @@ class ForumHelperTest < ActionView::TestCase | ||
62 | end | 62 | end |
63 | 63 | ||
64 | should "return last comment author's name from unauthenticated user" do | 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 | some_post.comments << build(Comment, :name => 'John', :email => 'lenon@example.com', :title => 'test', :body => 'test') | 66 | some_post.comments << build(Comment, :name => 'John', :email => 'lenon@example.com', :title => 'test', :body => 'test') |
67 | c = Comment.last | 67 | c = Comment.last |
68 | out = last_topic_update(some_post) | 68 | out = last_topic_update(some_post) |
test/unit/forum_test.rb
@@ -61,7 +61,7 @@ class ForumTest < ActiveSupport::TestCase | @@ -61,7 +61,7 @@ class ForumTest < ActiveSupport::TestCase | ||
61 | should 'has posts' do | 61 | should 'has posts' do |
62 | p = create_user('testuser').person | 62 | p = create_user('testuser').person |
63 | p.articles << forum = build(Forum, :profile => p, :name => 'Forum test', :body => 'Forum test') | 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 | forum.children << post | 65 | forum.children << post |
66 | assert_includes forum.posts, post | 66 | assert_includes forum.posts, post |
67 | end | 67 | end |
@@ -76,8 +76,8 @@ class ForumTest < ActiveSupport::TestCase | @@ -76,8 +76,8 @@ class ForumTest < ActiveSupport::TestCase | ||
76 | should 'list posts ordered by updated at' do | 76 | should 'list posts ordered by updated at' do |
77 | p = create_user('testuser').person | 77 | p = create_user('testuser').person |
78 | forum = fast_create(Forum, :profile_id => p.id, :name => 'Forum test') | 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 | older.updated_at = Time.now.in_time_zone - 1.month | 81 | older.updated_at = Time.now.in_time_zone - 1.month |
82 | older.stubs(:record_timestamps).returns(false) | 82 | older.stubs(:record_timestamps).returns(false) |
83 | older.save! | 83 | older.save! |
test/unit/gallery_test.rb
@@ -71,9 +71,9 @@ class GalleryTest < ActiveSupport::TestCase | @@ -71,9 +71,9 @@ class GalleryTest < ActiveSupport::TestCase | ||
71 | gallery = fast_create(Gallery, :profile_id => c.id) | 71 | gallery = fast_create(Gallery, :profile_id => c.id) |
72 | f = fast_create(Gallery, :name => 'gallery', :profile_id => c.id, :parent_id => gallery.id) | 72 | f = fast_create(Gallery, :name => 'gallery', :profile_id => c.id, :parent_id => gallery.id) |
73 | u = create(UploadedFile, :profile => c, :uploaded_data => fixture_file_upload('/files/rails.png', 'image/png'), :parent => gallery) | 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 | assert_equal [t], gallery.news(1) | 78 | assert_equal [t], gallery.news(1) |
79 | end | 79 | end |
@@ -81,8 +81,8 @@ class GalleryTest < ActiveSupport::TestCase | @@ -81,8 +81,8 @@ class GalleryTest < ActiveSupport::TestCase | ||
81 | should 'not return highlighted news when not asked' do | 81 | should 'not return highlighted news when not asked' do |
82 | c = fast_create(Community) | 82 | c = fast_create(Community) |
83 | gallery = fast_create(Gallery, :profile_id => c.id) | 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 | assert_equal [t].map(&:slug), gallery.news(2).map(&:slug) | 87 | assert_equal [t].map(&:slug), gallery.news(2).map(&:slug) |
88 | end | 88 | end |
@@ -90,8 +90,8 @@ class GalleryTest < ActiveSupport::TestCase | @@ -90,8 +90,8 @@ class GalleryTest < ActiveSupport::TestCase | ||
90 | should 'return highlighted news when asked' do | 90 | should 'return highlighted news when asked' do |
91 | c = fast_create(Community) | 91 | c = fast_create(Community) |
92 | gallery = fast_create(Gallery, :profile_id => c.id) | 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 | assert_equal [highlighted_t].map(&:slug), gallery.news(2, true).map(&:slug) | 96 | assert_equal [highlighted_t].map(&:slug), gallery.news(2, true).map(&:slug) |
97 | end | 97 | end |
test/unit/layout_helper_test.rb
@@ -21,8 +21,8 @@ class LayoutHelperTest < ActionView::TestCase | @@ -21,8 +21,8 @@ class LayoutHelperTest < ActionView::TestCase | ||
21 | @plugins = [] | 21 | @plugins = [] |
22 | expects(:profile).returns(nil).at_least_once | 22 | expects(:profile).returns(nil).at_least_once |
23 | expects(:environment).returns(env).at_least_once | 23 | expects(:environment).returns(env).at_least_once |
24 | + expects(:theme_option).with(:jquery_theme).returns(nil) | ||
24 | expects(:theme_option).with(:icon_theme).returns(['my-icons']).at_least_once | 25 | expects(:theme_option).with(:icon_theme).returns(['my-icons']).at_least_once |
25 | - expects(:jquery_theme).returns('jquery-nice').at_least_once | ||
26 | global_css = Rails.root.join "public/designs/themes/#{env.theme}/global.css" | 26 | global_css = Rails.root.join "public/designs/themes/#{env.theme}/global.css" |
27 | File.stubs(:exists?).returns(false) | 27 | File.stubs(:exists?).returns(false) |
28 | File.expects(:exists?).with(global_css).returns(true).at_least_once | 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,7 +18,7 @@ class PersonNotifierTest < ActiveSupport::TestCase | ||
18 | @member.save! | 18 | @member.save! |
19 | @community = fast_create(Community) | 19 | @community = fast_create(Community) |
20 | @community.add_member(@admin) | 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 | Delayed::Job.delete_all | 22 | Delayed::Job.delete_all |
23 | ActionMailer::Base.deliveries = [] | 23 | ActionMailer::Base.deliveries = [] |
24 | end | 24 | end |
test/unit/person_test.rb
@@ -1261,7 +1261,7 @@ class PersonTest < ActiveSupport::TestCase | @@ -1261,7 +1261,7 @@ class PersonTest < ActiveSupport::TestCase | ||
1261 | User.current = another_person.user | 1261 | User.current = another_person.user |
1262 | scrap = create(Scrap, defaults_for_scrap(:sender => another_person, :receiver => person, :content => 'A scrap')) | 1262 | scrap = create(Scrap, defaults_for_scrap(:sender => another_person, :receiver => person, :content => 'A scrap')) |
1263 | User.current = person.user | 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 | assert_equivalent [scrap,article.activity], person.activities.map { |a| a.activity } | 1266 | assert_equivalent [scrap,article.activity], person.activities.map { |a| a.activity } |
1267 | end | 1267 | end |
@@ -1275,11 +1275,11 @@ class PersonTest < ActiveSupport::TestCase | @@ -1275,11 +1275,11 @@ class PersonTest < ActiveSupport::TestCase | ||
1275 | another_person_scrap = create(Scrap, defaults_for_scrap(:sender => another_person, :receiver => another_person, :content => 'A scrap from another person')) | 1275 | another_person_scrap = create(Scrap, defaults_for_scrap(:sender => another_person, :receiver => another_person, :content => 'A scrap from another person')) |
1276 | 1276 | ||
1277 | User.current = another_person.user | 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 | another_person_activity = ActionTracker::Record.last | 1279 | another_person_activity = ActionTracker::Record.last |
1280 | 1280 | ||
1281 | User.current = person.user | 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 | person_activity = ActionTracker::Record.last | 1283 | person_activity = ActionTracker::Record.last |
1284 | 1284 | ||
1285 | assert_equivalent [person_scrap,person_activity], person.activities.map { |a| a.activity } | 1285 | assert_equivalent [person_scrap,person_activity], person.activities.map { |a| a.activity } |
test/unit/profile_test.rb
@@ -2113,7 +2113,7 @@ class ProfileTest < ActiveSupport::TestCase | @@ -2113,7 +2113,7 @@ class ProfileTest < ActiveSupport::TestCase | ||
2113 | 2113 | ||
2114 | should 'not copy template welcome_page' do | 2114 | should 'not copy template welcome_page' do |
2115 | template = fast_create(Person, :is_template => true) | 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 | refute template.copy_article?(welcome_page) | 2117 | refute template.copy_article?(welcome_page) |
2118 | end | 2118 | end |
2119 | 2119 | ||
@@ -2124,7 +2124,7 @@ class ProfileTest < ActiveSupport::TestCase | @@ -2124,7 +2124,7 @@ class ProfileTest < ActiveSupport::TestCase | ||
2124 | 2124 | ||
2125 | should 'return nil on welcome_page_content if content is not published' do | 2125 | should 'return nil on welcome_page_content if content is not published' do |
2126 | template = fast_create(Profile, :is_template => true) | 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 | template.welcome_page = welcome_page | 2128 | template.welcome_page = welcome_page |
2129 | template.save! | 2129 | template.save! |
2130 | assert_nil template.welcome_page_content | 2130 | assert_nil template.welcome_page_content |
@@ -2133,7 +2133,7 @@ class ProfileTest < ActiveSupport::TestCase | @@ -2133,7 +2133,7 @@ class ProfileTest < ActiveSupport::TestCase | ||
2133 | should 'return template welcome page content on welcome_page_content if content is published' do | 2133 | should 'return template welcome page content on welcome_page_content if content is published' do |
2134 | template = fast_create(Profile, :is_template => true) | 2134 | template = fast_create(Profile, :is_template => true) |
2135 | body = 'Template welcome page' | 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 | template.welcome_page = welcome_page | 2137 | template.welcome_page = welcome_page |
2138 | template.save! | 2138 | template.save! |
2139 | assert_equal body, template.welcome_page_content | 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 +7,8 @@ class RawHTMLArticleTest < ActiveSupport::TestCase | ||
7 | end | 7 | end |
8 | 8 | ||
9 | should 'not filter HTML' do | 9 | should 'not filter HTML' do |
10 | - article = RawHTMLArticle.create!( | 10 | + article = TextArticle.create!( |
11 | + :editor => Article::Editor::RAW_HTML, | ||
11 | :name => 'Raw HTML', | 12 | :name => 'Raw HTML', |
12 | :body => '<strong>HTML!</strong><form action="#"></form>', | 13 | :body => '<strong>HTML!</strong><form action="#"></form>', |
13 | :profile => @profile | 14 | :profile => @profile |
test/unit/rss_feed_test.rb
@@ -204,7 +204,7 @@ class RssFeedTest < ActiveSupport::TestCase | @@ -204,7 +204,7 @@ class RssFeedTest < ActiveSupport::TestCase | ||
204 | end | 204 | end |
205 | 205 | ||
206 | should 'display the referenced body of a article published' do | 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 | profile = fast_create(Profile) | 208 | profile = fast_create(Profile) |
209 | blog = fast_create(Blog, :profile_id => profile.id) | 209 | blog = fast_create(Blog, :profile_id => profile.id) |
210 | a = create(ApproveArticle, :name => 'test name', :article => article, :target => profile, :requestor => fast_create(Person)) | 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,9 +54,9 @@ class SuggestArticleTest < ActiveSupport::TestCase | ||
54 | abstract = 'some abstract' | 54 | abstract = 'some abstract' |
55 | t.article = {:name => name, :body => body, :abstract => abstract} | 55 | t.article = {:name => name, :body => body, :abstract => abstract} |
56 | t.target = @profile | 56 | t.target = @profile |
57 | - count = TinyMceArticle.count | 57 | + count = TextArticle.count |
58 | t.perform | 58 | t.perform |
59 | - assert_equal count + 1, TinyMceArticle.count | 59 | + assert_equal count + 1, TextArticle.count |
60 | end | 60 | end |
61 | 61 | ||
62 | should 'fill source name and URL into created article' do | 62 | should 'fill source name and URL into created article' do |
@@ -64,7 +64,7 @@ class SuggestArticleTest < ActiveSupport::TestCase | @@ -64,7 +64,7 @@ class SuggestArticleTest < ActiveSupport::TestCase | ||
64 | t.article.merge!({:source_name => 'GNU project', :source => 'http://www.gnu.org/'}) | 64 | t.article.merge!({:source_name => 'GNU project', :source => 'http://www.gnu.org/'}) |
65 | t.perform | 65 | t.perform |
66 | 66 | ||
67 | - article = TinyMceArticle.last | 67 | + article = TextArticle.last |
68 | assert_equal 'GNU project', article.source_name | 68 | assert_equal 'GNU project', article.source_name |
69 | assert_equal 'http://www.gnu.org/', article.source | 69 | assert_equal 'http://www.gnu.org/', article.source |
70 | end | 70 | end |
@@ -81,7 +81,7 @@ class SuggestArticleTest < ActiveSupport::TestCase | @@ -81,7 +81,7 @@ class SuggestArticleTest < ActiveSupport::TestCase | ||
81 | t.article[:highlighted] = true | 81 | t.article[:highlighted] = true |
82 | t.perform | 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 | assert article.highlighted | 85 | assert article.highlighted |
86 | end | 86 | end |
87 | 87 | ||
@@ -89,7 +89,7 @@ class SuggestArticleTest < ActiveSupport::TestCase | @@ -89,7 +89,7 @@ class SuggestArticleTest < ActiveSupport::TestCase | ||
89 | t = build(SuggestArticle, :target => @profile) | 89 | t = build(SuggestArticle, :target => @profile) |
90 | t.perform | 90 | t.perform |
91 | 91 | ||
92 | - article = TinyMceArticle.where(name: t.article_name).last | 92 | + article = TextArticle.where(name: t.article_name).last |
93 | assert_equal false, article.highlighted | 93 | assert_equal false, article.highlighted |
94 | end | 94 | end |
95 | 95 | ||
@@ -110,7 +110,7 @@ class SuggestArticleTest < ActiveSupport::TestCase | @@ -110,7 +110,7 @@ class SuggestArticleTest < ActiveSupport::TestCase | ||
110 | t.name = 'some name' | 110 | t.name = 'some name' |
111 | t.perform | 111 | t.perform |
112 | 112 | ||
113 | - article = TinyMceArticle.last | 113 | + article = TextArticle.last |
114 | assert_equal 'some name', article.author_name | 114 | assert_equal 'some name', article.author_name |
115 | end | 115 | end |
116 | 116 | ||
@@ -239,12 +239,12 @@ class SuggestArticleTest < ActiveSupport::TestCase | @@ -239,12 +239,12 @@ class SuggestArticleTest < ActiveSupport::TestCase | ||
239 | should 'fallback to tinymce when type parameter is invalid' do | 239 | should 'fallback to tinymce when type parameter is invalid' do |
240 | t = SuggestArticle.new | 240 | t = SuggestArticle.new |
241 | t.article = {:name => 'name', :body => 'body', :type => 'Comment'} | 241 | t.article = {:name => 'name', :body => 'body', :type => 'Comment'} |
242 | - t.article_type == TinyMceArticle | 242 | + t.article_type == TextArticle |
243 | end | 243 | end |
244 | 244 | ||
245 | should 'fallback to tinymce when type parameter is blank' do | 245 | should 'fallback to tinymce when type parameter is blank' do |
246 | t = SuggestArticle.new | 246 | t = SuggestArticle.new |
247 | t.article = {:name => 'name', :body => 'body', :type => ''} | 247 | t.article = {:name => 'name', :body => 'body', :type => ''} |
248 | - t.article_type == TinyMceArticle | 248 | + t.article_type == TextArticle |
249 | end | 249 | end |
250 | end | 250 | end |
test/unit/text_article_test.rb
@@ -8,12 +8,6 @@ class TextArticleTest < ActiveSupport::TestCase | @@ -8,12 +8,6 @@ class TextArticleTest < ActiveSupport::TestCase | ||
8 | assert_kind_of Article, TextArticle.new | 8 | assert_kind_of Article, TextArticle.new |
9 | end | 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 | should 'be translatable' do | 11 | should 'be translatable' do |
18 | assert_kind_of TranslatableContent, TextArticle.new | 12 | assert_kind_of TranslatableContent, TextArticle.new |
19 | end | 13 | end |
@@ -119,4 +113,22 @@ class TextArticleTest < ActiveSupport::TestCase | @@ -119,4 +113,22 @@ class TextArticleTest < ActiveSupport::TestCase | ||
119 | assert post.display_preview? | 113 | assert post.display_preview? |
120 | end | 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 | end | 134 | end |
test/unit/textile_article_test.rb
1 | require_relative "../test_helper" | 1 | require_relative "../test_helper" |
2 | 2 | ||
3 | -class TextileArticleTest < ActiveSupport::TestCase | 3 | +class TextArticleTest < ActiveSupport::TestCase |
4 | 4 | ||
5 | def setup | 5 | def setup |
6 | @user = User.current = create_user 'testing' | 6 | @user = User.current = create_user 'testing' |
@@ -8,20 +8,12 @@ class TextileArticleTest < ActiveSupport::TestCase | @@ -8,20 +8,12 @@ class TextileArticleTest < ActiveSupport::TestCase | ||
8 | end | 8 | end |
9 | attr_reader :profile | 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 | should 'convert Textile to HTML' do | 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 | end | 13 | end |
22 | 14 | ||
23 | should 'accept empty body' do | 15 | should 'accept empty body' do |
24 | - a = TextileArticle.new | 16 | + a = TextArticle.new |
25 | a.expects(:body).returns(nil) | 17 | a.expects(:body).returns(nil) |
26 | assert_nothing_raised do | 18 | assert_nothing_raised do |
27 | assert_equal '', a.to_html | 19 | assert_equal '', a.to_html |
@@ -29,27 +21,27 @@ class TextileArticleTest < ActiveSupport::TestCase | @@ -29,27 +21,27 @@ class TextileArticleTest < ActiveSupport::TestCase | ||
29 | end | 21 | end |
30 | 22 | ||
31 | should 'notifiable be true' do | 23 | should 'notifiable be true' do |
32 | - a = fast_create(TextileArticle) | 24 | + a = fast_create(TextArticle) |
33 | assert a.notifiable? | 25 | assert a.notifiable? |
34 | end | 26 | end |
35 | 27 | ||
36 | should 'notify activity on create' do | 28 | should 'notify activity on create' do |
37 | ActionTracker::Record.delete_all | 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 | assert_equal 1, ActionTracker::Record.count | 31 | assert_equal 1, ActionTracker::Record.count |
40 | end | 32 | end |
41 | 33 | ||
42 | should 'not group trackers activity of article\'s creation' do | 34 | should 'not group trackers activity of article\'s creation' do |
43 | assert_difference 'ActionTracker::Record.count', 3 do | 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 | end | 39 | end |
48 | end | 40 | end |
49 | 41 | ||
50 | should 'not update activity on update of an article' do | 42 | should 'not update activity on update of an article' do |
51 | ActionTracker::Record.delete_all | 43 | ActionTracker::Record.delete_all |
52 | - article = create(TextileArticle, profile_id: profile.id) | 44 | + article = create(TextArticle, profile_id: profile.id) |
53 | time = article.activity.updated_at | 45 | time = article.activity.updated_at |
54 | Time.stubs(:now).returns(time + 1.day) | 46 | Time.stubs(:now).returns(time + 1.day) |
55 | assert_no_difference 'ActionTracker::Record.count' do | 47 | assert_no_difference 'ActionTracker::Record.count' do |
@@ -61,8 +53,8 @@ class TextileArticleTest < ActiveSupport::TestCase | @@ -61,8 +53,8 @@ class TextileArticleTest < ActiveSupport::TestCase | ||
61 | 53 | ||
62 | should 'not create trackers activity when updating articles' do | 54 | should 'not create trackers activity when updating articles' do |
63 | ActionTracker::Record.delete_all | 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 | assert_no_difference 'ActionTracker::Record.count' do | 58 | assert_no_difference 'ActionTracker::Record.count' do |
67 | a1.name = 'foo';a1.save! | 59 | a1.name = 'foo';a1.save! |
68 | a2.name = 'another foo';a2.save! | 60 | a2.name = 'another foo';a2.save! |
@@ -71,7 +63,7 @@ class TextileArticleTest < ActiveSupport::TestCase | @@ -71,7 +63,7 @@ class TextileArticleTest < ActiveSupport::TestCase | ||
71 | 63 | ||
72 | should 'remove activity after destroying article' do | 64 | should 'remove activity after destroying article' do |
73 | ActionTracker::Record.delete_all | 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 | assert_difference 'ActionTracker::Record.count', -1 do | 67 | assert_difference 'ActionTracker::Record.count', -1 do |
76 | a.destroy | 68 | a.destroy |
77 | end | 69 | end |
@@ -79,8 +71,8 @@ class TextileArticleTest < ActiveSupport::TestCase | @@ -79,8 +71,8 @@ class TextileArticleTest < ActiveSupport::TestCase | ||
79 | 71 | ||
80 | should 'remove activity after article is destroyed' do | 72 | should 'remove activity after article is destroyed' do |
81 | ActionTracker::Record.delete_all | 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 | assert_equal 2, ActionTracker::Record.count | 76 | assert_equal 2, ActionTracker::Record.count |
85 | assert_difference 'ActionTracker::Record.count', -2 do | 77 | assert_difference 'ActionTracker::Record.count', -2 do |
86 | a1.destroy | 78 | a1.destroy |
@@ -94,20 +86,20 @@ class TextileArticleTest < ActiveSupport::TestCase | @@ -94,20 +86,20 @@ class TextileArticleTest < ActiveSupport::TestCase | ||
94 | p1 = Person.first | 86 | p1 = Person.first |
95 | community.add_member(p1) | 87 | community.add_member(p1) |
96 | assert p1.is_member_of?(community) | 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 | assert_equal article, ActionTracker::Record.last.target | 90 | assert_equal article, ActionTracker::Record.last.target |
99 | end | 91 | end |
100 | 92 | ||
101 | should "the tracker action target be defined as the article on articles'creation in profile" do | 93 | should "the tracker action target be defined as the article on articles'creation in profile" do |
102 | ActionTracker::Record.delete_all | 94 | ActionTracker::Record.delete_all |
103 | person = Person.first | 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 | assert_equal article, ActionTracker::Record.last.target | 97 | assert_equal article, ActionTracker::Record.last.target |
106 | end | 98 | end |
107 | 99 | ||
108 | should 'not notify activity if the article is not advertise' do | 100 | should 'not notify activity if the article is not advertise' do |
109 | ActionTracker::Record.delete_all | 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 | assert_equal true, a.published? | 103 | assert_equal true, a.published? |
112 | assert_equal true, a.notifiable? | 104 | assert_equal true, a.notifiable? |
113 | assert_equal false, a.image? | 105 | assert_equal false, a.image? |
@@ -116,11 +108,11 @@ class TextileArticleTest < ActiveSupport::TestCase | @@ -116,11 +108,11 @@ class TextileArticleTest < ActiveSupport::TestCase | ||
116 | end | 108 | end |
117 | 109 | ||
118 | should "have defined the is_trackable method defined" do | 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 | end | 112 | end |
121 | 113 | ||
122 | should "the common trackable conditions return the correct value" do | 114 | should "the common trackable conditions return the correct value" do |
123 | - a = build(TextileArticle, profile: profile) | 115 | + a = build(TextArticle, profile: profile) |
124 | a.published = a.advertise = true | 116 | a.published = a.advertise = true |
125 | assert_equal true, a.published? | 117 | assert_equal true, a.published? |
126 | assert_equal true, a.notifiable? | 118 | assert_equal true, a.notifiable? |
@@ -174,18 +166,18 @@ class TextileArticleTest < ActiveSupport::TestCase | @@ -174,18 +166,18 @@ class TextileArticleTest < ActiveSupport::TestCase | ||
174 | end | 166 | end |
175 | 167 | ||
176 | should 'have can_display_media_panel with default true' do | 168 | should 'have can_display_media_panel with default true' do |
177 | - a = TextileArticle.new | 169 | + a = TextArticle.new |
178 | assert a.can_display_media_panel? | 170 | assert a.can_display_media_panel? |
179 | end | 171 | end |
180 | 172 | ||
181 | should 'have can_display_blocks with default false' do | 173 | should 'have can_display_blocks with default false' do |
182 | - assert !TextileArticle.can_display_blocks? | 174 | + assert !TextArticle.can_display_blocks? |
183 | end | 175 | end |
184 | 176 | ||
185 | protected | 177 | protected |
186 | 178 | ||
187 | def build_article(input = nil, options = {}) | 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 | article.valid? # trigger the xss terminate thingy | 181 | article.valid? # trigger the xss terminate thingy |
190 | article | 182 | article |
191 | end | 183 | end |
test/unit/tiny_mce_article_test.rb
@@ -10,61 +10,48 @@ class TinyMceArticleTest < ActiveSupport::TestCase | @@ -10,61 +10,48 @@ class TinyMceArticleTest < ActiveSupport::TestCase | ||
10 | end | 10 | end |
11 | attr_reader :profile | 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 | should 'not sanitize target attribute' do | 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 | assert_tag_in_string article.body, :tag => 'a', :attributes => {:target => '_blank'} | 15 | assert_tag_in_string article.body, :tag => 'a', :attributes => {:target => '_blank'} |
29 | end | 16 | end |
30 | 17 | ||
31 | should 'not translate & to amp; over times' do | 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 | assert article.save | 20 | assert article.save |
34 | assert_no_match(/&amp;/, article.body) | 21 | assert_no_match(/&amp;/, article.body) |
35 | assert_match(/&/, article.body) | 22 | assert_match(/&/, article.body) |
36 | end | 23 | end |
37 | 24 | ||
38 | should 'not escape comments from tiny mce article body' do | 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 | assert_equal "the <!-- comment --> article ...", article.body | 27 | assert_equal "the <!-- comment --> article ...", article.body |
41 | end | 28 | end |
42 | 29 | ||
43 | should 'convert entities characters to UTF-8 instead of ISO-8859-1' do | 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 | assert(article.body.is_utf8?, "%s expected to be valid UTF-8 content" % article.body.inspect) | 32 | assert(article.body.is_utf8?, "%s expected to be valid UTF-8 content" % article.body.inspect) |
46 | end | 33 | end |
47 | 34 | ||
48 | should 'remove iframe if it is not from a trusted site' do | 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 | assert_equal "", article.body | 37 | assert_equal "", article.body |
51 | end | 38 | end |
52 | 39 | ||
53 | should 'not mess with <iframe and </iframe if it is from itheora by default' do | 40 | should 'not mess with <iframe and </iframe if it is from itheora by default' do |
54 | assert_includes Environment.default.trusted_sites_for_iframe, 'itheora.org' | 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 | assert_tag_in_string article.body, :tag => 'iframe', :attributes => { :src => "http://itheora.org/demo/index.php?v=example.ogv"} | 43 | assert_tag_in_string article.body, :tag => 'iframe', :attributes => { :src => "http://itheora.org/demo/index.php?v=example.ogv"} |
57 | end | 44 | end |
58 | 45 | ||
59 | should 'allow iframe if it is from stream.softwarelivre.org by default' do | 46 | should 'allow iframe if it is from stream.softwarelivre.org by default' do |
60 | assert_includes Environment.default.trusted_sites_for_iframe, 'stream.softwarelivre.org' | 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 | assert_tag_in_string article.body, :tag => 'iframe', :attributes => { :src => "http://stream.softwarelivre.org/fisl10/sites/default/files/videos.ogg"} | 49 | assert_tag_in_string article.body, :tag => 'iframe', :attributes => { :src => "http://stream.softwarelivre.org/fisl10/sites/default/files/videos.ogg"} |
63 | end | 50 | end |
64 | 51 | ||
65 | should 'allow iframe if it is from tv.softwarelivre.org by default' do | 52 | should 'allow iframe if it is from tv.softwarelivre.org by default' do |
66 | assert_includes Environment.default.trusted_sites_for_iframe, 'tv.softwarelivre.org' | 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 | 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"} | 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 | end | 56 | end |
70 | 57 | ||
@@ -73,12 +60,12 @@ class TinyMceArticleTest < ActiveSupport::TestCase | @@ -73,12 +60,12 @@ class TinyMceArticleTest < ActiveSupport::TestCase | ||
73 | env.trusted_sites_for_iframe = ['avideosite.com'] | 60 | env.trusted_sites_for_iframe = ['avideosite.com'] |
74 | env.save | 61 | env.save |
75 | assert_includes Environment.default.trusted_sites_for_iframe, 'avideosite.com' | 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 | assert_tag_in_string article.body, :tag => 'iframe', :attributes => { :src => "http://avideosite.com/videos.ogg"} | 64 | assert_tag_in_string article.body, :tag => 'iframe', :attributes => { :src => "http://avideosite.com/videos.ogg"} |
78 | end | 65 | end |
79 | 66 | ||
80 | should 'remove only the iframe from untrusted site' do | 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 | assert_tag_in_string article.body, :tag => 'iframe', :attributes => { :src => "http://stream.softwarelivre.org/videos.ogg"} | 69 | assert_tag_in_string article.body, :tag => 'iframe', :attributes => { :src => "http://stream.softwarelivre.org/videos.ogg"} |
83 | assert_no_tag_in_string article.body, :tag => 'iframe', :attributes => { :src => "http://untrusted_site.com/videos.ogg"} | 70 | assert_no_tag_in_string article.body, :tag => 'iframe', :attributes => { :src => "http://untrusted_site.com/videos.ogg"} |
84 | end | 71 | end |
@@ -86,12 +73,12 @@ class TinyMceArticleTest < ActiveSupport::TestCase | @@ -86,12 +73,12 @@ class TinyMceArticleTest < ActiveSupport::TestCase | ||
86 | should 'consider first src if there is 2 or more src' do | 73 | should 'consider first src if there is 2 or more src' do |
87 | assert_includes Environment.default.trusted_sites_for_iframe, 'itheora.org' | 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 | assert_tag_in_string article.body, :tag => 'iframe', :attributes => { :src => "http://itheora.org/videos.ogg"} | 77 | assert_tag_in_string article.body, :tag => 'iframe', :attributes => { :src => "http://itheora.org/videos.ogg"} |
91 | end | 78 | end |
92 | 79 | ||
93 | should 'not sanitize html comments' do | 80 | should 'not sanitize html comments' do |
94 | - article = TinyMceArticle.new | 81 | + article = TextArticle.new |
95 | article.body = '<!-- <asdf> << aasdfa >>> --> <h1> Wellformed html code </h1>' | 82 | article.body = '<!-- <asdf> << aasdfa >>> --> <h1> Wellformed html code </h1>' |
96 | article.valid? | 83 | article.valid? |
97 | 84 | ||
@@ -99,38 +86,38 @@ class TinyMceArticleTest < ActiveSupport::TestCase | @@ -99,38 +86,38 @@ class TinyMceArticleTest < ActiveSupport::TestCase | ||
99 | end | 86 | end |
100 | 87 | ||
101 | should 'not allow XSS on name' do | 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 | assert_no_match /script/, article.name | 90 | assert_no_match /script/, article.name |
104 | end | 91 | end |
105 | 92 | ||
106 | should 'not allow XSS on abstract' do | 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 | assert_no_match /script/, article.abstract | 95 | assert_no_match /script/, article.abstract |
109 | end | 96 | end |
110 | 97 | ||
111 | should 'notifiable be true' do | 98 | should 'notifiable be true' do |
112 | - a = fast_create(TinyMceArticle) | 99 | + a = fast_create(TextArticle) |
113 | assert a.notifiable? | 100 | assert a.notifiable? |
114 | end | 101 | end |
115 | 102 | ||
116 | should 'notify activity on create' do | 103 | should 'notify activity on create' do |
117 | ActionTracker::Record.delete_all | 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 | assert_equal 1, ActionTracker::Record.count | 106 | assert_equal 1, ActionTracker::Record.count |
120 | end | 107 | end |
121 | 108 | ||
122 | should 'not group trackers activity of article\'s creation' do | 109 | should 'not group trackers activity of article\'s creation' do |
123 | ActionTracker::Record.delete_all | 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 | assert_equal 2, ActionTracker::Record.count | 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 | assert_equal 3, ActionTracker::Record.count | 115 | assert_equal 3, ActionTracker::Record.count |
129 | end | 116 | end |
130 | 117 | ||
131 | should 'not update activity on update of an article' do | 118 | should 'not update activity on update of an article' do |
132 | ActionTracker::Record.delete_all | 119 | ActionTracker::Record.delete_all |
133 | - article = create TinyMceArticle, profile_id: profile.id | 120 | + article = create TextArticle, profile_id: profile.id |
134 | time = article.activity.updated_at | 121 | time = article.activity.updated_at |
135 | Time.stubs(:now).returns(time + 1.day) | 122 | Time.stubs(:now).returns(time + 1.day) |
136 | assert_no_difference 'ActionTracker::Record.count' do | 123 | assert_no_difference 'ActionTracker::Record.count' do |
@@ -142,8 +129,8 @@ class TinyMceArticleTest < ActiveSupport::TestCase | @@ -142,8 +129,8 @@ class TinyMceArticleTest < ActiveSupport::TestCase | ||
142 | 129 | ||
143 | should 'not create trackers activity when updating articles' do | 130 | should 'not create trackers activity when updating articles' do |
144 | ActionTracker::Record.delete_all | 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 | assert_no_difference 'ActionTracker::Record.count' do | 134 | assert_no_difference 'ActionTracker::Record.count' do |
148 | a1.name = 'foo';a1.save! | 135 | a1.name = 'foo';a1.save! |
149 | a2.name = 'another foo';a2.save! | 136 | a2.name = 'another foo';a2.save! |
@@ -152,8 +139,8 @@ class TinyMceArticleTest < ActiveSupport::TestCase | @@ -152,8 +139,8 @@ class TinyMceArticleTest < ActiveSupport::TestCase | ||
152 | 139 | ||
153 | should 'remove activity when an article is destroyed' do | 140 | should 'remove activity when an article is destroyed' do |
154 | ActionTracker::Record.delete_all | 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 | assert_difference 'ActionTracker::Record.count', -2 do | 144 | assert_difference 'ActionTracker::Record.count', -2 do |
158 | a1.destroy | 145 | a1.destroy |
159 | a2.destroy | 146 | a2.destroy |
@@ -165,19 +152,19 @@ class TinyMceArticleTest < ActiveSupport::TestCase | @@ -165,19 +152,19 @@ class TinyMceArticleTest < ActiveSupport::TestCase | ||
165 | community = fast_create(Community) | 152 | community = fast_create(Community) |
166 | community.add_member profile | 153 | community.add_member profile |
167 | assert profile.is_member_of?(community) | 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 | assert_equal article, ActionTracker::Record.last.target | 156 | assert_equal article, ActionTracker::Record.last.target |
170 | end | 157 | end |
171 | 158 | ||
172 | should "the tracker action target be defined as the article on articles'creation in profile" do | 159 | should "the tracker action target be defined as the article on articles'creation in profile" do |
173 | ActionTracker::Record.delete_all | 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 | assert_equal article, ActionTracker::Record.last.target | 162 | assert_equal article, ActionTracker::Record.last.target |
176 | end | 163 | end |
177 | 164 | ||
178 | should 'not notify activity if the article is not advertise' do | 165 | should 'not notify activity if the article is not advertise' do |
179 | ActionTracker::Record.delete_all | 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 | assert_equal true, a.published? | 168 | assert_equal true, a.published? |
182 | assert_equal true, a.notifiable? | 169 | assert_equal true, a.notifiable? |
183 | assert_equal false, a.image? | 170 | assert_equal false, a.image? |
@@ -186,11 +173,11 @@ class TinyMceArticleTest < ActiveSupport::TestCase | @@ -186,11 +173,11 @@ class TinyMceArticleTest < ActiveSupport::TestCase | ||
186 | end | 173 | end |
187 | 174 | ||
188 | should "have defined the is_trackable method defined" do | 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 | end | 177 | end |
191 | 178 | ||
192 | should "the common trackable conditions return the correct value" do | 179 | should "the common trackable conditions return the correct value" do |
193 | - a = build(TinyMceArticle, :profile => profile) | 180 | + a = build(TextArticle, :profile => profile) |
194 | a.published = a.advertise = true | 181 | a.published = a.advertise = true |
195 | assert_equal true, a.published? | 182 | assert_equal true, a.published? |
196 | assert_equal true, a.notifiable? | 183 | assert_equal true, a.notifiable? |
@@ -207,24 +194,20 @@ class TinyMceArticleTest < ActiveSupport::TestCase | @@ -207,24 +194,20 @@ class TinyMceArticleTest < ActiveSupport::TestCase | ||
207 | assert_equal false, a.is_trackable? | 194 | assert_equal false, a.is_trackable? |
208 | end | 195 | end |
209 | 196 | ||
210 | - should 'tiny mce editor is enabled' do | ||
211 | - assert TinyMceArticle.new.tiny_mce? | ||
212 | - end | ||
213 | - | ||
214 | should 'not sanitize html5 audio tag on body' do | 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 | assert_tag_in_string article.body, :tag => 'audio', :attributes => {:controls => 'controls'} | 199 | assert_tag_in_string article.body, :tag => 'audio', :attributes => {:controls => 'controls'} |
217 | assert_tag_in_string article.body, :tag => 'source', :attributes => {:src => 'http://example.ogg', :type => 'audio/ogg'} | 200 | assert_tag_in_string article.body, :tag => 'source', :attributes => {:src => 'http://example.ogg', :type => 'audio/ogg'} |
218 | end | 201 | end |
219 | 202 | ||
220 | should 'not sanitize html5 video tag on body' do | 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 | assert_tag_in_string article.body, :tag => 'video', :attributes => {:controls => 'controls', :autoplay => 'autoplay'} | 205 | assert_tag_in_string article.body, :tag => 'video', :attributes => {:controls => 'controls', :autoplay => 'autoplay'} |
223 | assert_tag_in_string article.body, :tag => 'source', :attributes => {:src => 'http://example.ogv', :type => 'video/ogg'} | 206 | assert_tag_in_string article.body, :tag => 'source', :attributes => {:src => 'http://example.ogv', :type => 'video/ogg'} |
224 | end | 207 | end |
225 | 208 | ||
226 | should 'not sanitize colspan and rowspan attributes' do | 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 | :body => "<table colspan='2' rowspan='3'><tr></tr></table>", | 211 | :body => "<table colspan='2' rowspan='3'><tr></tr></table>", |
229 | :profile => profile | 212 | :profile => profile |
230 | ) | 213 | ) |
@@ -233,11 +216,11 @@ class TinyMceArticleTest < ActiveSupport::TestCase | @@ -233,11 +216,11 @@ class TinyMceArticleTest < ActiveSupport::TestCase | ||
233 | end | 216 | end |
234 | 217 | ||
235 | should 'have can_display_media_panel with default true' do | 218 | should 'have can_display_media_panel with default true' do |
236 | - a = TinyMceArticle.new | 219 | + a = TextArticle.new |
237 | assert a.can_display_media_panel? | 220 | assert a.can_display_media_panel? |
238 | end | 221 | end |
239 | 222 | ||
240 | should 'have can_display_blocks with default false' do | 223 | should 'have can_display_blocks with default false' do |
241 | - assert !TinyMceArticle.can_display_blocks? | 224 | + assert !TextArticle.can_display_blocks? |
242 | end | 225 | end |
243 | end | 226 | end |
vendor/plugins/xss_terminate/lib/xss_terminate.rb
@@ -27,11 +27,15 @@ module XssTerminate | @@ -27,11 +27,15 @@ module XssTerminate | ||
27 | before_save filter_with | 27 | before_save filter_with |
28 | end | 28 | end |
29 | class_attribute "xss_terminate_#{options[:with]}_options".to_sym | 29 | class_attribute "xss_terminate_#{options[:with]}_options".to_sym |
30 | + | ||
31 | + | ||
30 | self.send("xss_terminate_#{options[:with]}_options=".to_sym, { | 32 | self.send("xss_terminate_#{options[:with]}_options=".to_sym, { |
31 | :except => (options[:except] || []), | 33 | :except => (options[:except] || []), |
34 | + :if => (options[:if] || true), | ||
32 | :only => (options[:only] || options[:sanitize] || []) | 35 | :only => (options[:only] || options[:sanitize] || []) |
33 | - }) | 36 | + }) if |
34 | include XssTerminate::InstanceMethods | 37 | include XssTerminate::InstanceMethods |
38 | + | ||
35 | end | 39 | end |
36 | 40 | ||
37 | end | 41 | end |
@@ -72,6 +76,9 @@ module XssTerminate | @@ -72,6 +76,9 @@ module XssTerminate | ||
72 | unless except.empty? | 76 | unless except.empty? |
73 | only.delete_if{ |i| except.include?( i.to_sym ) } | 77 | only.delete_if{ |i| except.include?( i.to_sym ) } |
74 | end | 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 | return only, columns_serialized | 82 | return only, columns_serialized |
76 | end | 83 | end |
77 | 84 |