From 8ed2714f3fe4c05bd0b83e9fe3c06adf565810c1 Mon Sep 17 00:00:00 2001 From: cktricky Date: Tue, 20 May 2014 14:25:45 -0400 Subject: [PATCH 1/2] changed constantize to metaprogramming for the addition of tutorials specific to metaprogramming flaws. In addition, the messages portion of the app needed some generic TLC so I have removed the "new" view in order to bring that functionality into the seed message page/view. --- app/controllers/messages_controller.rb | 5 +- app/controllers/tutorials_controller.rb | 2 +- app/views/layouts/tutorial/_sidebar.html.erb | 14 +-- .../_benefit_forms_constantize.html.erb | 0 app/views/messages/index.html.erb | 87 ++++++++++++++++- app/views/messages/new.html.erb | 96 ------------------- ...tize.html.erb => metaprogramming.html.erb} | 4 +- config/routes.rb | 2 +- 8 files changed, 93 insertions(+), 117 deletions(-) rename app/views/layouts/tutorial/{constantize => metaprogramming}/_benefit_forms_constantize.html.erb (100%) delete mode 100644 app/views/messages/new.html.erb rename app/views/tutorials/{constantize.html.erb => metaprogramming.html.erb} (68%) diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index 95fd22d..706f103 100644 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -2,6 +2,7 @@ class MessagesController < ApplicationController def index @messages = current_user.messages + @message = Message.new end def show @@ -19,10 +20,6 @@ class MessagesController < ApplicationController end end - def new - @message = Message.new - end - def create if Message.create(params[:message]) respond_to do |format| diff --git a/app/controllers/tutorials_controller.rb b/app/controllers/tutorials_controller.rb index 69df74f..7f878f3 100755 --- a/app/controllers/tutorials_controller.rb +++ b/app/controllers/tutorials_controller.rb @@ -93,7 +93,7 @@ class TutorialsController < ApplicationController end - def constantize + def metaprogramming end end diff --git a/app/views/layouts/tutorial/_sidebar.html.erb b/app/views/layouts/tutorial/_sidebar.html.erb index 644b772..4cf7dce 100755 --- a/app/views/layouts/tutorial/_sidebar.html.erb +++ b/app/views/layouts/tutorial/_sidebar.html.erb @@ -103,23 +103,15 @@
  • <%= link_to "Guard", guard_tutorials_path %>
  • -
  • <%= link_to "Mass Assignment", mass_assignment_tutorials_path %>
  • -
  • - <%= link_to "Constantize", constantize_tutorials_path %> -
  • <%= link_to "Logic Flaws", logic_flaws_tutorials_path %>
  • - +
  • + <%= link_to "Meta- Programming", metaprogramming_tutorials_path %> +
  • diff --git a/app/views/layouts/tutorial/constantize/_benefit_forms_constantize.html.erb b/app/views/layouts/tutorial/metaprogramming/_benefit_forms_constantize.html.erb similarity index 100% rename from app/views/layouts/tutorial/constantize/_benefit_forms_constantize.html.erb rename to app/views/layouts/tutorial/metaprogramming/_benefit_forms_constantize.html.erb diff --git a/app/views/messages/index.html.erb b/app/views/messages/index.html.erb index 219aa7c..d3f79d4 100644 --- a/app/views/messages/index.html.erb +++ b/app/views/messages/index.html.erb @@ -1,12 +1,14 @@
    +
    +
    Messages for <%= current_user.full_name %> - +
    @@ -37,13 +39,94 @@
    +
    + + +
    + +
    +
    +
    +
    + Send Message +
    +
    +
    + + +
    +
    + + <%= form_for @message, :url => user_messages_path, :method => :post, :html => {:id => "send_message"} do |f|%> + <%= f.hidden_field :creator_id, :value => current_user.id %> + <%= f.hidden_field :read, :value => '0' %> +
    + <%= f.label "To:", nil, {:class => "control-label"}%> + <%= f.select(:receiver_id, options_from_collection_for_select(User.all, :id, :full_name)) %> +
    + +
    + <%= f.label :message, nil, {:class => "control-label"}%> + <%= f.text_area :message, {:class => "span12"} %> +
    + +
    + <%= f.submit "Submit", {:id => 'submit_button', :class => "btn btn-info pull-right"} %> +
    + +
    + <% end %> + +
    +
    +
    +
    +
    + +
    +
    - - - - - diff --git a/app/views/tutorials/constantize.html.erb b/app/views/tutorials/metaprogramming.html.erb similarity index 68% rename from app/views/tutorials/constantize.html.erb rename to app/views/tutorials/metaprogramming.html.erb index 3cc16bc..4ce0fcc 100644 --- a/app/views/tutorials/constantize.html.erb +++ b/app/views/tutorials/metaprogramming.html.erb @@ -2,7 +2,7 @@
    - <%= render :partial => ("layouts/tutorial/constantize/benefit_forms_constantize")%> + <%= render :partial => ("layouts/tutorial/metaprogramming/benefit_forms_constantize")%>
    @@ -10,7 +10,7 @@