From 361adda6cd9f118c1383c8d8e5ffaf6eacc28907 Mon Sep 17 00:00:00 2001 From: maxwell <maxwell@joindiaspora.com> Date: Sun, 22 Aug 2010 22:20:34 -0700 Subject: [PATCH] added group picker. sends the right params, but posts only have one group right now so thats a bummer --- app/controllers/status_messages_controller.rb | 1 + app/helpers/application_helper.rb | 5 +++++ app/views/shared/_publisher.haml | 14 +++++++++----- public/stylesheets/application.css | 2 +- public/stylesheets/sass/application.sass | 2 +- 5 files changed, 17 insertions(+), 7 deletions(-) diff --git a/app/controllers/status_messages_controller.rb b/app/controllers/status_messages_controller.rb index 9b363032e5..786b150077 100644 --- a/app/controllers/status_messages_controller.rb +++ b/app/controllers/status_messages_controller.rb @@ -9,6 +9,7 @@ class StatusMessagesController < ApplicationController end def create + puts params.inspect @status_message = current_user.post(:status_message, params[:status_message]) if @status_message.created_at diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 7f6a7bae23..c5ef2f0e82 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,4 +1,9 @@ module ApplicationHelper + + def current_group?(group) + @group.id == group.id + end + def object_path(object) eval("#{object.class.to_s.underscore}_path(object)") end diff --git a/app/views/shared/_publisher.haml b/app/views/shared/_publisher.haml index 710b0d2bc4..470cfbcfc1 100644 --- a/app/views/shared/_publisher.haml +++ b/app/views/shared/_publisher.haml @@ -1,14 +1,18 @@ #publisher - #publisher_form = form_for StatusMessage.new, :remote => true do |f| = f.error_messages -if group_id = f.hidden_field :group_id, :value => group_id + - %p - %label{:for => "status_message_message"} Message - = f.text_area :message, :rows => 2 - %p.right + %label{:for => "status_message_message"} Message + = f.text_area :message, :rows => 2 + %ul + - for group in current_user.groups + %li + = group.name + = check_box_tag("groups_id[]", group.id, current_group?(group)) + .right = f.submit "Post" diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index a5b4b5fc6d..4015b7a549 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -274,7 +274,7 @@ input[type='text'], textarea { font-size: 14px; padding: 0.3em; display: block; - width: 100%; + width: 66%; box-shadow: 0 2px 0px white; -webkit-box-shadow: 0 2px 0px white; -moz-box-shadow: 0 2px 0px white; diff --git a/public/stylesheets/sass/application.sass b/public/stylesheets/sass/application.sass index b41a1120a6..dbedd6c449 100644 --- a/public/stylesheets/sass/application.sass +++ b/public/stylesheets/sass/application.sass @@ -337,7 +337,7 @@ input[type='text'], textarea :size 14px :padding 0.3em :display block - :width 100% + :width 66% :box-shadow 0 2px 0px #fff :-webkit-box-shadow 0 2px 0px #fff :-moz-box-shadow 0 2px 0px #fff -- GitLab