Commit cebc50a3281954f882e33962f2ca93f3359fa3ea
1 parent
31c025cc
Exists in
master
and in
27 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 | <div class="select-publish-target"> | 1 | <div class="select-publish-target"> |
| 15 | 2 | ||
| 16 | <h2><%= _('Where do you want to publish this article?') %></h2> | 3 | <h2><%= _('Where do you want to publish this article?') %></h2> |
| @@ -36,9 +23,7 @@ | @@ -36,9 +23,7 @@ | ||
| 36 | <div class='description'><%= _('You can publish this article on your profile where your friends and followers will see.') %></div> | 23 | <div class='description'><%= _('You can publish this article on your profile where your friends and followers will see.') %></div> |
| 37 | <%= form_tag do %> | 24 | <%= form_tag do %> |
| 38 | <%= hidden_field_tag :back_to, @back_to %> | 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 | <% button_bar do %> | 28 | <% button_bar do %> |
| 44 | <%= submit_button 'spread', _('Spread this') %> | 29 | <%= submit_button 'spread', _('Spread this') %> |
| @@ -55,10 +40,7 @@ | @@ -55,10 +40,7 @@ | ||
| 55 | <%= hidden_field_tag :back_to, @back_to %> | 40 | <%= hidden_field_tag :back_to, @back_to %> |
| 56 | <% search_action = url_for(:action => 'search_communities_to_publish') %> | 41 | <% search_action = url_for(:action => 'search_communities_to_publish') %> |
| 57 | <%= token_input_field_tag(:q, 'search-communities-to-publish', search_action, { :hint_text => _('Type in a search for your community'), :zindex => 10000, :focus => false }) %> | 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 | <% button_bar do %> | 44 | <% button_bar do %> |
| 63 | <%= submit_button 'spread', _('Spread this') %> | 45 | <%= submit_button 'spread', _('Spread this') %> |
| 64 | <% end %> | 46 | <% end %> |
| @@ -74,9 +56,7 @@ | @@ -74,9 +56,7 @@ | ||
| 74 | 56 | ||
| 75 | <%= form_tag :action => 'publish_on_portal_community', :id => @article.id do %> | 57 | <%= form_tag :action => 'publish_on_portal_community', :id => @article.id do %> |
| 76 | <%= hidden_field_tag :back_to, @back_to %> | 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 | <% button_bar do %> | 61 | <% button_bar do %> |
| 82 | <%= submit_button 'spread', _('Spread this') %> | 62 | <%= submit_button 'spread', _('Spread this') %> |
features/publish_article.feature
| @@ -28,16 +28,20 @@ Feature: publish article | @@ -28,16 +28,20 @@ Feature: publish article | ||
| 28 | When I go to sample-community's sitemap | 28 | When I go to sample-community's sitemap |
| 29 | Then I should see "Sample Article" | 29 | Then I should see "Sample Article" |
| 30 | 30 | ||
| 31 | + @selenium | ||
| 31 | Scenario: publishing an article with a different name | 32 | Scenario: publishing an article with a different name |
| 32 | Given I am logged in as "joaosilva" | 33 | Given I am logged in as "joaosilva" |
| 33 | And "Joao Silva" is a member of "Sample Community" | 34 | And "Joao Silva" is a member of "Sample Community" |
| 34 | And I am on joaosilva's control panel | 35 | And I am on joaosilva's control panel |
| 35 | And I follow "Manage Content" | 36 | And I follow "Manage Content" |
| 36 | And I follow "Spread" | 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 | And I fill in "Title" with "Another name" | 41 | And I fill in "Title" with "Another name" |
| 39 | And I press "Spread this" | 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 | Then I should see "Another name" | 45 | Then I should see "Another name" |
| 42 | And I should not see "Sample Article" | 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,4 +771,8 @@ Given /^the field (.*) is public for all users$/ do |field| | ||
| 771 | person.fields_privacy[field] = "public" | 771 | person.fields_privacy[field] = "public" |
| 772 | person.save! | 772 | person.save! |
| 773 | end | 773 | end |
| 774 | -end | ||
| 775 | \ No newline at end of file | 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 +3,18 @@ When /^I choose the search filter "(.*)"$/ do |filter| | ||
| 3 | # find("li", :text => filter).click | 3 | # find("li", :text => filter).click |
| 4 | page.execute_script("jQuery('li[title=#{filter}]').click();") | 4 | page.execute_script("jQuery('li[title=#{filter}]').click();") |
| 5 | end | 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 |