Commit cebc50a3281954f882e33962f2ca93f3359fa3ea
1 parent
31c025cc
Exists in
master
and in
21 other branches
[unfinished] fix publish_article features
Showing
4 changed files
with
29 additions
and
26 deletions
Show diff stats
app/views/cms/publish.html.erb
| 1 | -<script type="text/javascript" charset="utf-8"> | |
| 2 | - jQuery(document).ready( function() { | |
| 3 | - jQuery('.publish-article-title').find('label') | |
| 4 | - .click( function(event) { | |
| 5 | - if (this == event.target) { | |
| 6 | - jQuery(this).toggleClass('expanded'); | |
| 7 | - jQuery(this).next('input').slideToggle(); | |
| 8 | - } | |
| 9 | - return false; | |
| 10 | - }).addClass('collapsed').next('input').hide(); | |
| 11 | - }); | |
| 12 | - | |
| 13 | -</script> | |
| 14 | 1 | <div class="select-publish-target"> |
| 15 | 2 | |
| 16 | 3 | <h2><%= _('Where do you want to publish this article?') %></h2> |
| ... | ... | @@ -36,9 +23,7 @@ |
| 36 | 23 | <div class='description'><%= _('You can publish this article on your profile where your friends and followers will see.') %></div> |
| 37 | 24 | <%= form_tag do %> |
| 38 | 25 | <%= hidden_field_tag :back_to, @back_to %> |
| 39 | - <div class='publish-article-title'> | |
| 40 | - <%= labelled_text_field _('Title'), 'name', @article.name %> | |
| 41 | - </div> | |
| 26 | + <%= labelled_form_field _('Title'), text_field_tag('name', @article.name) %> | |
| 42 | 27 | |
| 43 | 28 | <% button_bar do %> |
| 44 | 29 | <%= submit_button 'spread', _('Spread this') %> |
| ... | ... | @@ -55,10 +40,7 @@ |
| 55 | 40 | <%= hidden_field_tag :back_to, @back_to %> |
| 56 | 41 | <% search_action = url_for(:action => 'search_communities_to_publish') %> |
| 57 | 42 | <%= token_input_field_tag(:q, 'search-communities-to-publish', search_action, { :hint_text => _('Type in a search for your community'), :zindex => 10000, :focus => false }) %> |
| 58 | - | |
| 59 | - <div class='publish-article-title'> | |
| 60 | - <%= labelled_text_field _('Title'), 'name', @article.name %> | |
| 61 | - </div> | |
| 43 | + <%= labelled_form_field _('Title'), text_field_tag('name', @article.name) %> | |
| 62 | 44 | <% button_bar do %> |
| 63 | 45 | <%= submit_button 'spread', _('Spread this') %> |
| 64 | 46 | <% end %> |
| ... | ... | @@ -74,9 +56,7 @@ |
| 74 | 56 | |
| 75 | 57 | <%= form_tag :action => 'publish_on_portal_community', :id => @article.id do %> |
| 76 | 58 | <%= hidden_field_tag :back_to, @back_to %> |
| 77 | - <div class='publish-article-title'> | |
| 78 | - <%= labelled_text_field _('Title'), :name, @article.name %> | |
| 79 | - </div> | |
| 59 | + <%= labelled_form_field _('Title'), text_field_tag('name', @article.name) %> | |
| 80 | 60 | |
| 81 | 61 | <% button_bar do %> |
| 82 | 62 | <%= submit_button 'spread', _('Spread this') %> | ... | ... |
features/publish_article.feature
| ... | ... | @@ -28,16 +28,20 @@ Feature: publish article |
| 28 | 28 | When I go to sample-community's sitemap |
| 29 | 29 | Then I should see "Sample Article" |
| 30 | 30 | |
| 31 | + @selenium | |
| 31 | 32 | Scenario: publishing an article with a different name |
| 32 | 33 | Given I am logged in as "joaosilva" |
| 33 | 34 | And "Joao Silva" is a member of "Sample Community" |
| 34 | 35 | And I am on joaosilva's control panel |
| 35 | 36 | And I follow "Manage Content" |
| 36 | 37 | And I follow "Spread" |
| 37 | - And I check "Sample Community" | |
| 38 | + And I choose the following communities to spread | |
| 39 | + | name | | |
| 40 | + | Sample Community | | |
| 38 | 41 | And I fill in "Title" with "Another name" |
| 39 | 42 | And I press "Spread this" |
| 40 | - When I go to sample-community's sitemap | |
| 43 | + And show sample-community tasks | |
| 44 | + When I go to sample-community's blog | |
| 41 | 45 | Then I should see "Another name" |
| 42 | 46 | And I should not see "Sample Article" |
| 43 | 47 | ... | ... |
features/step_definitions/noosfero_steps.rb
| ... | ... | @@ -771,4 +771,8 @@ Given /^the field (.*) is public for all users$/ do |field| |
| 771 | 771 | person.fields_privacy[field] = "public" |
| 772 | 772 | person.save! |
| 773 | 773 | end |
| 774 | -end | |
| 775 | 774 | \ No newline at end of file |
| 775 | +end | |
| 776 | + | |
| 777 | +And /^show (.*) tasks$/ do |identifier| | |
| 778 | + puts Community.find_by_identifier(identifier).tasks.pending.count | |
| 779 | +end | ... | ... |
features/step_definitions/search_steps.rb
| ... | ... | @@ -3,3 +3,18 @@ When /^I choose the search filter "(.*)"$/ do |filter| |
| 3 | 3 | # find("li", :text => filter).click |
| 4 | 4 | page.execute_script("jQuery('li[title=#{filter}]').click();") |
| 5 | 5 | end |
| 6 | + | |
| 7 | +When /^I choose the following communities to spread$/ do |table| | |
| 8 | + ids = [] | |
| 9 | + table.hashes.each do |row| | |
| 10 | + name = row.delete("name") | |
| 11 | + community = Community.find_by_name(name) | |
| 12 | + ids << community.id | |
| 13 | + end | |
| 14 | + #TODO make this work somehow... | |
| 15 | + #fill_in('q', :with => ids.join(',')) | |
| 16 | + #fill_in('#search-communities-to-publish', :with => ids.join(',')) | |
| 17 | + page.execute_script("jQuery('#search-communities-to-publish').val(#{ids.join(',')})") | |
| 18 | + page.execute_script("jQuery('#search-communities-to-publish').show()") | |
| 19 | + p find('#search-communities-to-publish').value | |
| 20 | +end | ... | ... |