Commit cbbdba89c6c44bebe6011c4c247c49b823f16f6b

Authored by Rodrigo Souto
2 parents 90c77cdb b9f2172d

Merge commit 'refs/merge-requests/315' of git://gitorious.org/noosfero/noosfero …

…into merge-requests/315
plugins/send_email/doc/send_email.textile
... ... @@ -14,7 +14,7 @@ h3. Form action
14 14  
15 15 You should use {sendemail} macro as form action, it will be expanded as:
16 16  
17   -* */profile/<identifier>/plugins/send_email/deliver* in profile context
  17 +* */profile/<identifier>/plugin/send_email/deliver* in profile context
18 18 * */plugin/send_email/deliver* in environment context
19 19  
20 20 h3. 'Subject' field
... ... @@ -39,6 +39,17 @@ h3. extra fields
39 39  
40 40 Each other params in HTML form will compose message body in a format "key: value"
41 41  
  42 +h3. Example
  43 +
  44 +<pre>
  45 +<form action='{sendemail}' method='post'>
  46 + To: <input type='text' name='to'/>
  47 + Subject: <input type='text' name='subject'/>
  48 + Message: <input type='text' name='message'/>
  49 + <input type='submit'/>
  50 +</form>
  51 +</pre>
  52 +
42 53 h2. Options
43 54  
44 55 h3. Using ajax
... ... @@ -49,10 +60,10 @@ Example:
49 60  
50 61 <pre>
51 62 <form action='{sendemail}' id='ajax-form'>
52   - <input type='text' name='to'/>
53   - <input type='text' name='subject'/>
54   - <input type='text' name='message'/>
55   - <input type='subject'/>
  63 + To: <input type='text' name='to'/>
  64 + Subject: <input type='text' name='subject'/>
  65 + Message: <input type='text' name='message'/>
  66 + <input type='submit'/>
56 67 </form>
57 68 </pre>
58 69  
... ...
plugins/send_email/features/send_email_plugin.feature
... ... @@ -12,7 +12,7 @@ Feature: send_email_plugin
12 12 | owner | name | body |
13 13 | joaosilva | sample-article | URL path to {sendemail} action |
14 14 When I go to /joaosilva/sample-article
15   - Then I should see "URL path to /profile/joaosilva/plugins/send_email/deliver action"
  15 + Then I should see "URL path to /profile/joaosilva/plugin/send_email/deliver action"
16 16  
17 17 Scenario: expand macro in block content
18 18 Given plugin SendEmailPlugin is enabled on environment
... ... @@ -20,7 +20,7 @@ Feature: send_email_plugin
20 20 | owner | type | html |
21 21 | joaosilva | RawHTMLBlock | URL path to {sendemail} action |
22 22 When I go to Joao Silva's homepage
23   - Then I should see "URL path to /profile/joaosilva/plugins/send_email/deliver action"
  23 + Then I should see "URL path to /profile/joaosilva/plugin/send_email/deliver action"
24 24  
25 25 Scenario: as admin I can configure plugin
26 26 Given I am logged in as admin
... ...
plugins/send_email/lib/send_email_plugin.rb
... ... @@ -14,7 +14,7 @@ class SendEmailPlugin &lt; Noosfero::Plugin
14 14  
15 15 def parse_content(raw_content)
16 16 if context.profile
17   - raw_content.gsub(/\{sendemail\}/, "/profile/#{context.profile.identifier}/plugins/send_email/deliver")
  17 + raw_content.gsub(/\{sendemail\}/, "/profile/#{context.profile.identifier}/plugin/send_email/deliver")
18 18 else
19 19 raw_content.gsub(/\{sendemail\}/, '/plugin/send_email/deliver')
20 20 end
... ...
plugins/send_email/test/unit/send_email_plugin_test.rb
... ... @@ -23,7 +23,7 @@ class SendEmailPluginTest &lt; ActiveSupport::TestCase
23 23  
24 24 should 'expand macro in parse_content event on profile context' do
25 25 @plugin.context.stubs(:profile).returns(fast_create(Community))
26   - assert_match /profile\/#{@plugin.context.profile.identifier}\/plugins\/send_email\/deliver/, @plugin.parse_content("expand this macro {sendemail}")
  26 + assert_match /profile\/#{@plugin.context.profile.identifier}\/plugin\/send_email\/deliver/, @plugin.parse_content("expand this macro {sendemail}")
27 27 end
28 28  
29 29 end
... ...