From ea357a96effb72bb271f229bb15916c5b292f0f6 Mon Sep 17 00:00:00 2001 From: danielgrippi Date: Mon, 26 Sep 2011 16:36:44 -0700 Subject: [PATCH] expand&collapse comments; added comment form (wip) --- app/controllers/comments_controller.rb | 6 +- app/views/comments/_comment.mobile.haml | 4 -- app/views/comments/_new_comment.mobile.haml | 7 +- app/views/comments/new.mobile.haml | 1 + app/views/layouts/application.mobile.haml | 5 +- app/views/shared/_footer.mobile.haml | 3 +- app/views/shared/_publisher.mobile.haml | 2 +- app/views/shared/_stream_element.mobile.haml | 37 +++------- config/assets.yml | 2 +- config/routes.rb | 2 +- .../icons/pencil_mobile_grey_active.png | Bin 0 -> 871 bytes .../icons/pencil_mobile_grey_mobile.png | Bin 0 -> 871 bytes public/images/icons/reshare_mobile.png | Bin 0 -> 1712 bytes public/javascripts/mobile.js | 64 +++++++++++++---- public/stylesheets/sass/mobile.scss | 68 ++++++++++++++---- 15 files changed, 137 insertions(+), 64 deletions(-) create mode 100644 app/views/comments/new.mobile.haml create mode 100644 public/images/icons/pencil_mobile_grey_active.png create mode 100644 public/images/icons/pencil_mobile_grey_mobile.png create mode 100644 public/images/icons/reshare_mobile.png diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb index ee21517ab..f700ba86a 100644 --- a/app/controllers/comments_controller.rb +++ b/app/controllers/comments_controller.rb @@ -6,7 +6,7 @@ class CommentsController < ApplicationController include ApplicationHelper before_filter :authenticate_user! - respond_to :html, :mobile, :only => [:create, :destroy, :index] + respond_to :html, :mobile, :only => [:new, :create, :destroy, :index] respond_to :js, :only => [:index] rescue_from ActiveRecord::RecordNotFound do @@ -64,4 +64,8 @@ class CommentsController < ApplicationController end end + def new + puts params.inspect + render :layout => false + end end diff --git a/app/views/comments/_comment.mobile.haml b/app/views/comments/_comment.mobile.haml index 84e31ea81..5b622dfa6 100644 --- a/app/views/comments/_comment.mobile.haml +++ b/app/views/comments/_comment.mobile.haml @@ -3,10 +3,6 @@ -# the COPYRIGHT file. %li.comment{:data=>{:guid=>comment.id}, :class => ("hidden" if(defined? hidden))} - .right - -#.controls - -#= link_to image_tag('deletelabel.png'), comment, :confirm => t('are_you_sure'), :method => :delete, :class => "delete comment_delete", :title => t('delete') - .content .from = person_image_link(comment.author) diff --git a/app/views/comments/_new_comment.mobile.haml b/app/views/comments/_new_comment.mobile.haml index 0bf41fff6..95cbfb4c2 100644 --- a/app/views/comments/_new_comment.mobile.haml +++ b/app/views/comments/_new_comment.mobile.haml @@ -2,10 +2,11 @@ -# licensed under the Affero General Public License version 3 or later. See -# the COPYRIGHT file. -= form_tag( post_comments_path(post_id), :id => "new_comment_on_#{post_id}", :class => 'new_comment') do += form_tag( post_comments_path(post_id), :id => "new_comment_on_#{post_id}", :class => 'new_comment', :remote => true) do = hidden_field_tag :post_id, post_id, :id => "post_id_on_#{post_id}" = text_area_tag :text, nil, :rows => 2, :class => "comment_box",:id => "comment_text_on_#{post_id}" - %div{:data => {:inline => 'true'}, :style => 'text-align:right;'} - = submit_tag t('.comment'), :id => "comment_submit_#{post_id}", :disable_with => t('.commenting'), "data-role" => 'button', 'data-theme' => 'b', 'data-inline' => true + %div{:style => 'text-align:right;'} + = link_to "Cancel", post_path(post_id), :class => "cancel_new_comment btn" + = submit_tag t('.comment'), :id => "comment_submit_#{post_id}", :disable_with => t('.commenting'), :class => "action" diff --git a/app/views/comments/new.mobile.haml b/app/views/comments/new.mobile.haml new file mode 100644 index 000000000..c34cdf84a --- /dev/null +++ b/app/views/comments/new.mobile.haml @@ -0,0 +1 @@ += new_comment_form(params[:post_id], current_user) diff --git a/app/views/layouts/application.mobile.haml b/app/views/layouts/application.mobile.haml index d6a34ee07..3b041fe53 100644 --- a/app/views/layouts/application.mobile.haml +++ b/app/views/layouts/application.mobile.haml @@ -31,7 +31,7 @@ / Stylesheets = include_stylesheets :mobile - %script{:src => "javascripts/vendor/mbp-modernizr-custom.js"} + %script{:src => "/javascripts/vendor/mbp-modernizr-custom.js"} / Media Queries Polyfill https://github.com/shichuan/mobile-html5-boilerplate/wiki/Media-Queries-Polyfill :javascript Modernizr.mq('(min-width:0)') || document.write('