Commit 132c1fdd7870b4d62882d2f318a48e1103216205
1 parent
0c4d7428
Exists in
master
and in
29 other branches
ActionItem24: yet implementing support for different types of articles
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1128 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
8 changed files
with
67 additions
and
4 deletions
Show diff stats
app/controllers/my_profile/cms_controller.rb
... | ... | @@ -0,0 +1,15 @@ |
1 | +class TextileArticle < Article | |
2 | + | |
3 | + def self.short_description | |
4 | + _('Text article with Textile markup language') | |
5 | + end | |
6 | + | |
7 | + def self.description | |
8 | + _('Accessible alternative for visually impaired users.') | |
9 | + end | |
10 | + | |
11 | + def to_html | |
12 | + RedCloth.new(self.body).to_html | |
13 | + end | |
14 | + | |
15 | +end | ... | ... |
app/models/tiny_mce_article.rb
... | ... | @@ -0,0 +1,11 @@ |
1 | + | |
2 | +<%# TODO add Textile help here %> | |
3 | + | |
4 | +<%= f.text_field('name', :size => '64') %> | |
5 | + | |
6 | +<%= f.text_field('tag_list', :size => 64, :title => _('Separate tags with commas')) %> | |
7 | + | |
8 | +<%= f.text_area('abstract', :cols => 64, :rows => 5) %> | |
9 | + | |
10 | +<%= f.text_area('body', :cols => 64) %> | |
11 | + | ... | ... |
app/views/cms/_tiny_mce_article.rhtml
app/views/cms/edit.rhtml
test/functional/cms_controller_test.rb
... | ... | @@ -56,8 +56,8 @@ class CmsControllerTest < Test::Unit::TestCase |
56 | 56 | assert_template 'select_article_type' |
57 | 57 | |
58 | 58 | # TODO add more types here !! |
59 | - [ 'TinyMceArticle' ].each do |item| | |
60 | - assert_tag :tag => 'a', :attributes => { :href => "/myprofile/#{profile.identifier}/cms/new?type=#{item}" } | |
59 | + [ TinyMceArticle, TextileArticle ].each do |item| | |
60 | + assert_tag :tag => 'a', :attributes => { :href => "/myprofile/#{profile.identifier}/cms/new?type=#{item.name}" } | |
61 | 61 | end |
62 | 62 | end |
63 | 63 | ... | ... |
... | ... | @@ -0,0 +1,26 @@ |
1 | +require File.dirname(__FILE__) + '/../test_helper' | |
2 | + | |
3 | +class TextileArticleTest < Test::Unit::TestCase | |
4 | + | |
5 | + def setup | |
6 | + @profile = create_user('testing').person | |
7 | + end | |
8 | + attr_reader :profile | |
9 | + | |
10 | + should 'provide a proper short description' do | |
11 | + # not test the actual text, though | |
12 | + TextileArticle.stubs(:==).with(Article).returns(true) | |
13 | + assert_not_equal Article.short_description, TextileArticle.short_description | |
14 | + end | |
15 | + | |
16 | + should 'provide a proper description' do | |
17 | + # not test the actual text, though | |
18 | + TextileArticle.stubs(:==).with(Article).returns(true) | |
19 | + assert_not_equal Article.description, TextileArticle.description | |
20 | + end | |
21 | + | |
22 | + should 'convert Textile to HTML' do | |
23 | + assert_equal '<p><strong>my text</strong></p>', TextileArticle.new(:body => '*my text*').to_html | |
24 | + end | |
25 | + | |
26 | +end | ... | ... |