Skip to content

Commit

Permalink
removed empty list item with if thought.content
Browse files Browse the repository at this point in the history
  • Loading branch information
rolandnsharp committed Mar 2, 2014
1 parent 9f36a46 commit 14c62ab
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
8 changes: 4 additions & 4 deletions app/controllers/thoughts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@ def new
end

def create
@thoughts = @user.thoughts
@thought = @user.thoughts.new(thought_params)
@thought = @user.thoughts.new(thought_params)
@thoughts = @user.thoughts
# @thoughts_search = @user.thoughts.text_search(params[:query])
if @thought.save
respond_to do |format|
format.html {redirect_to edit_user_path(@user)}
format.js
end

flash[:success] = "Thanks for your thought!"
# flash[:success] = "Thanks for your thought!"
else
render :new
end
Expand Down Expand Up @@ -64,7 +64,7 @@ def update
format.html {redirect_to edit_user_path(@user)}
format.js
end
flash[:success] = "Thought successfully updated!"
# flash[:success] = "Thought successfully updated!"
else
render :edit
end
Expand All @@ -76,7 +76,7 @@ def destroy
@thoughts = @user.thoughts
respond_to do |format|
# format.html {redirect_to edit_user_path(@user)}
format.js { render :layout=>false }
format.js
end


Expand Down
7 changes: 7 additions & 0 deletions app/views/thoughts/_list.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<% @thoughts.each_with_index do |thought, index|%>
<% if thought.content %>
<a class="btn btn-default" id="downChev" data-id="<%= index %>"><span class="glyphicon glyphicon-chevron-down"></span></a>

<% if @thought.id == thought.id %>
Expand All @@ -11,6 +14,9 @@

<% if thought.title %>
<strong><%= thought.title.titleize %></strong>
<strong><%= @thoughts.length %></strong>


<% end %>
</h4>

Expand Down Expand Up @@ -44,4 +50,5 @@
</p>

<% end %>
<% end %>

0 comments on commit 14c62ab

Please sign in to comment.