From c302aebf1e12393027d513ceaf5ce29e08ddadbb Mon Sep 17 00:00:00 2001 From: Chris Date: Wed, 19 Jan 2011 18:52:57 -0600 Subject: [PATCH] Fixing the navigation and removing references to sample app --- app/controllers/microposts_controller.rb | 6 ++++-- app/controllers/users_controller.rb | 5 +++-- app/views/layouts/_footer.html.erb | 4 ---- app/views/layouts/_header.html.erb | 4 ++-- app/views/pages/home.html.erb | 5 ++--- app/views/shared/_user_info.html.erb | 8 ++++++++ app/views/users/show.html.erb | 4 ++-- 7 files changed, 21 insertions(+), 15 deletions(-) diff --git a/app/controllers/microposts_controller.rb b/app/controllers/microposts_controller.rb index f875040..0a33fbe 100644 --- a/app/controllers/microposts_controller.rb +++ b/app/controllers/microposts_controller.rb @@ -4,8 +4,7 @@ class MicropostsController < ApplicationController def create success_message = "Micropost created!" - @micropost = current_user.microposts.build(params[:micropost]) - puts params[:micropost] + if Blog.is_blog_post? params[:micropost][:content] current_user.blogs.create_with_post params[:micropost][:content] @@ -15,6 +14,9 @@ def create new_show.save success_message = "Show created!" end + + params[:micropost][:content] = params[:micropost][:content][0..136] + '...' + @micropost = current_user.microposts.build(params[:micropost]) if @micropost.save redirect_to home_path, :flash => { :success => success_message} diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 66e493d..b2aeb24 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -29,6 +29,7 @@ def followers end def new + redirect_to root_path unless signed_in? @user = User.new @title = "Sign up" end @@ -36,9 +37,9 @@ def new def create @user = User.new(params[:user]) if @user.save - sign_in @user + #sign_in @user @user.follow_all - redirect_to @user, :flash => { :success => "Welcome to the Sample App!" } + redirect_to users_path, :flash => { :success => "#{@user.name} created" } else @title = "Sign up" render 'new' diff --git a/app/views/layouts/_footer.html.erb b/app/views/layouts/_footer.html.erb index 859ce5f..2f4b7ca 100644 --- a/app/views/layouts/_footer.html.erb +++ b/app/views/layouts/_footer.html.erb @@ -1,10 +1,6 @@ \ No newline at end of file diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb index 11d9d79..73e3283 100644 --- a/app/views/layouts/_header.html.erb +++ b/app/views/layouts/_header.html.erb @@ -7,8 +7,8 @@
  • <%= link_to "Profile", current_user %>
  • <%= link_to "Users", users_path %>
  • <%= link_to "Settings", edit_user_path(current_user) %>
  • - <% end %> -
  • <%= link_to "Help", help_path %>
  • +
  • <%= link_to "Add User", signup_path %>
  • + <% end %> <% if signed_in? %>
  • <%= link_to "Sign out", signout_path %>
  • <% else %> diff --git a/app/views/pages/home.html.erb b/app/views/pages/home.html.erb index 4ae2fba..ee66790 100644 --- a/app/views/pages/home.html.erb +++ b/app/views/pages/home.html.erb @@ -16,11 +16,10 @@ <% else %> -

    Sample App

    - This is the home page for the Ruby on Rails Tutorial sample application. + This is the admin section for Geronimo!

    -<%= link_to "Sign up now!", signup_path, :class => "signup_button round" %> +<%= link_to "Sign in now!", signin_path, :class => "signup_button round" %> <% end %> \ No newline at end of file diff --git a/app/views/shared/_user_info.html.erb b/app/views/shared/_user_info.html.erb index 1446734..3db95af 100644 --- a/app/views/shared/_user_info.html.erb +++ b/app/views/shared/_user_info.html.erb @@ -8,4 +8,12 @@ <%= pluralize(current_user.microposts.count, "micropost") %> + Instructions +
    +

    To create a show type: show -text that describes show-

    +

    Use a date format you are comfortable with and the show will be placed in the correct order

    +

    To create a blog: blog -blog text-

    +

    To place the blog on the frontpage: blog frontpage -blog text-

    +

    For either a show or a blog, you can use the markdown language to add formatting (bold text, links, etc.). The syntax for markdown can be found here

    +
    \ No newline at end of file diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index 711a45e..3def737 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -18,7 +18,7 @@ URL <%= link_to user_path(@user), @user %>
    Microposts <%= @user.microposts.count %> <%= render 'shared/stats' %> + - - + \ No newline at end of file