<commit_before>require 'features/support/page_models/sections'

module PageModels
  
  def self.landing_page
    Home.new
  end
  
  class Home < SitePrism::Page
    set_url "/"

    class Idea < SitePrism::Section
      element :vote_count, "div.votes"
      element :upvote_image, "div.upvote img"
      element :title, "h3.title"
      element :description, "div.description"
    end

    class IdeasList < SitePrism::Section
      element  :ideas_title, "h1", text: "Ideas"
      sections :idea_items, Idea, "ul li.idea"

      def ideas
        idea_items.map do |idea|
          { 
            title: idea.title.text, 
            description: idea.description.text,
          }
        end
      end
    end

    elements :notifications, "#notifications div.notification"
    section  :user_nav, UserNav, "#user_nav"
    section  :idea_list, IdeasList, "#ideas"
    
    def change_idea(old_idea, new_idea)
      within("#idea-#{old_idea.id}") do
        click_link 'Edit'
        fill_in 'idea_title', with: new_idea.title
        fill_in 'idea_description', with: new_idea.description
        click_on 'Save'
      end
    end
    
        
  end
end<commit_msg>Block call to change idea until it's done<commit_after>require 'features/support/page_models/sections'

module PageModels

  def self.landing_page
    Home.new
  end

  class Home < SitePrism::Page
    set_url "/"

    class Idea < SitePrism::Section
      element :vote_count, "div.votes"
      element :upvote_image, "div.upvote img"
      element :title, "h3.title"
      element :description, "div.description"
    end

    class IdeasList < SitePrism::Section
      element  :ideas_title, "h1", text: "Ideas"
      sections :idea_items, Idea, "ul li.idea"

      def ideas
        idea_items.map do |idea|
          {
            title: idea.title.text, 
            description: idea.description.text,
          }
        end
      end
    end

    elements :notifications, "#notifications div.notification"
    section  :user_nav, UserNav, "#user_nav"
    section  :idea_list, IdeasList, "#ideas"

    def change_idea(old_idea, new_idea)
      within("#idea-#{old_idea.id}") do
        click_link 'Edit'
        fill_in 'idea_title', with: new_idea.title
        fill_in 'idea_description', with: new_idea.description
        click_on 'Save'
      end

      find("#idea-#{old_idea.id} .idea-content") # block until finished
    end

  end
end
{'fraction_non_alphanumeric': 0.09995869475423379, 'fraction_numerical': 0.0016522098306484924, 'mean_word_length': 2.4257425742574257, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3392500', 'n_tokens_mistral': 786, 'n_tokens_neox': 767, 'n_words': 185}